Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 19 additions & 5 deletions PWGCF/TwoParticleCorrelations/TableProducer/longrangeMaker.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

#include "PWGCF/Core/CorrelationContainer.h"
#include "PWGCF/TwoParticleCorrelations/DataModel/LongRangeDerived.h"
//
#include "PWGLF/DataModel/LFStrangenessTables.h"
#include "PWGMM/Mult/DataModel/bestCollisionTable.h"
#include "PWGUD/Core/SGCutParHolder.h"
Expand Down Expand Up @@ -62,6 +61,7 @@

#include <algorithm>
#include <array>
#include <bitset>
#include <chrono>
#include <cmath>
#include <cstdint>
Expand Down Expand Up @@ -120,6 +120,7 @@ struct LongrangeMaker {
Configurable<int> cfgOccuCut{"cfgOccuCut", 1000, "Occupancy selection"};
Configurable<float> cfgVtxCut{"cfgVtxCut", 10.0f, "vertex Z selection"};
Configurable<bool> isApplyBestCollIndex{"isApplyBestCollIndex", true, "bestCollIndex"};
Configurable<bool> isrejectFlangeEvent{"isrejectFlangeEvent", false, "At least one channel with -350 TDC < time < -450 TDC"};
} cfgevtsel;

struct : ConfigurableGroup {
Expand All @@ -130,6 +131,7 @@ struct LongrangeMaker {
Configurable<float> minNCrossedRowsTPC{"minNCrossedRowsTPC", 70.f, "cut on minimum number of TPC crossed rows"};
Configurable<float> minTPCNClsFound{"minTPCNClsFound", 50.f, "cut on minimum value of TPC found clusters"};
Configurable<float> maxDcaZ{"maxDcaZ", 2.f, "cut on maximum abs value of DCA z"};
Configurable<float> maxDcaXY{"maxDcaXY", 1.f, "cut on maximum abs value of DCA xy"};
Configurable<float> maxChi2PerClusterTPC{"maxChi2PerClusterTPC", 4.f, "cut on maximum value of TPC chi2 per cluster"};
} cfgtrksel;

Expand All @@ -151,7 +153,7 @@ struct LongrangeMaker {
Configurable<float> cfigFt0cEtaMin{"cfigFt0cEtaMin", -3.3f, "Minimum FT0C eta cut"};
Configurable<int> cfigVerbosity{"cfigVerbosity", 0, "print statement"};
Configurable<bool> useGainCalib{"useGainCalib", true, "use gain calibration"};
Configurable<std::string> ConfGainPath{"ConfGainPath", "Analysis/EventPlane/GainEq/FT0", "Path to gain calibration"};
Configurable<std::string> confGainPath{"confGainPath", "Analysis/EventPlane/GainEq/FT0", "Path to gain calibration"};
} cfgfittrksel;

struct : ConfigurableGroup {
Expand Down Expand Up @@ -241,6 +243,7 @@ struct LongrangeMaker {
x->SetBinLabel(10, "ApplyNoCollInRofStandard");
x->SetBinLabel(11, "ApplyNoHighMultCollInPrevRof");
x->SetBinLabel(12, "ApplyOccupancySelection");
x->SetBinLabel(13, "reject flange event");
histos.add("hSelectionResult", "hSelectionResult", kTH1I, {{5, -0.5, 4.5}});

AxisSpec axisVtx = {vtxHistBin, "Vertex", "VtxAxis"};
Expand Down Expand Up @@ -270,6 +273,7 @@ struct LongrangeMaker {
myTrackFilter.SetMinNCrossedRowsTPC(cfgtrksel.minNCrossedRowsTPC);
myTrackFilter.SetMinNClustersTPC(cfgtrksel.minTPCNClsFound);
myTrackFilter.SetMaxDcaZ(cfgtrksel.maxDcaZ);
myTrackFilter.SetMaxDcaXYPtDep([scale = cfgtrksel.maxDcaXY.value](float pt) { return scale * (0.0105f + 0.0350f / std::pow(pt, 1.1f)); });
myTrackFilter.SetMaxChi2PerClusterTPC(cfgtrksel.maxChi2PerClusterTPC);
myTrackFilter.print();

Expand Down Expand Up @@ -309,7 +313,7 @@ struct LongrangeMaker {
Filter fTracksEta = nabs(aod::track::eta) < cfgtrksel.cfgEtaCut;
Filter fTracksPt = (aod::track::pt > cfgtrksel.cfgPtCutMin) && (aod::track::pt < cfgtrksel.cfgPtCutMax);

using CollTable = soa::Join<aod::Collisions, aod::EvSels, aod::Mults, aod::CentFT0Cs, aod::CentFV0As, aod::CentFT0Ms>;
using CollTable = soa::Join<aod::Collisions, aod::EvSels, aod::Mults, aod::CentFT0Cs, aod::CentFV0As, aod::CentFT0Ms, aod::FITExtraMults>;
using TrksTable = soa::Filtered<soa::Join<aod::Tracks, aod::TracksExtra, aod::TracksDCA, aod::TrackSelection, aod::pidTPCFullPi, aod::pidTPCFullKa, aod::pidTPCFullPr, aod::pidTOFbeta, aod::pidTOFFullPi, aod::pidTOFFullKa, aod::pidTOFFullPr>>;
using MftTrkTable = aod::MFTTracks;
using BCs = soa::Join<aod::BCsWithTimestamps, aod::BcSels, aod::Run3MatchedToBCSparse>;
Expand All @@ -329,7 +333,7 @@ struct LongrangeMaker {
ft0gainvalues.clear();
ft0gainvalues = {};
if (cfgfittrksel.useGainCalib) {
const auto ft0GainObj = ccdb->getForTimeStamp<std::vector<float>>(cfgfittrksel.ConfGainPath, bc.timestamp());
const auto ft0GainObj = ccdb->getForTimeStamp<std::vector<float>>(cfgfittrksel.confGainPath, bc.timestamp());
if (!ft0GainObj) {
for (auto i{0u}; i < TotFt0Channels; i++) {
ft0gainvalues.push_back(1.);
Expand Down Expand Up @@ -604,7 +608,7 @@ struct LongrangeMaker {
ft0gainvalues.clear();
ft0gainvalues = {};
if (cfgfittrksel.useGainCalib) {
const auto ft0GainObj = ccdb->getForTimeStamp<std::vector<float>>(cfgfittrksel.ConfGainPath, bc.timestamp());
const auto ft0GainObj = ccdb->getForTimeStamp<std::vector<float>>(cfgfittrksel.confGainPath, bc.timestamp());
if (!ft0GainObj) {
for (auto i{0u}; i < TotFt0Channels; i++) {
ft0gainvalues.push_back(1.);
Expand Down Expand Up @@ -911,6 +915,16 @@ struct LongrangeMaker {
return false;
}
histos.fill(HIST("EventHist"), 12);
if (cfgevtsel.isrejectFlangeEvent) {
if constexpr (requires { col.ft0TriggerMask(); }) {
constexpr int IsFlangeEventId = 7;
std::bitset<8> ft0TriggerMask = col.ft0TriggerMask();
if (ft0TriggerMask[IsFlangeEventId]) {
return false;
}
}
}
histos.fill(HIST("EventHist"), 13);
return true;
}

Expand Down
45 changes: 16 additions & 29 deletions PWGCF/TwoParticleCorrelations/Tasks/longrangecorrDerived.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ struct LongrangecorrDerived {
void fillCollQA(TCollision const& col)
{
histos.fill(HIST("hMultiplicity"), col.multiplicity());
if constexpr (std::experimental::is_detected<HasCent, TCollision>::value) {
if constexpr (requires { col.centrality(); }) {
histos.fill(HIST("hCentrality"), col.centrality());
}
histos.fill(HIST("hVertexZ"), col.posZ());
Expand All @@ -197,15 +197,15 @@ struct LongrangecorrDerived {
histos.fill(HIST("Trig_etavsphi"), track.phi(), track.eta());
histos.fill(HIST("Trig_eta"), track.eta());
histos.fill(HIST("Trig_phi"), track.phi());
if constexpr (std::experimental::is_detected<HasFt0, TTrack>::value) {
if constexpr (requires { track.channelID(); }) {
histos.fill(HIST("Trig_amp"), track.amplitude());
histos.fill(HIST("Channel_vs_Trig_amp"), track.channelID(), track.amplitude());
histos.fill(HIST("Trig_amp_gaincorrected"), track.gainAmplitude());
histos.fill(HIST("Channel_vs_Trig_amp_gaincorrected"), track.channelID(), track.gainAmplitude());
} else {
histos.fill(HIST("Trig_pt"), track.pt());
}
if constexpr (std::experimental::is_detected<HasInvMass, TTrack>::value) {
if constexpr (requires { track.invMass(); }) {
histos.fill(HIST("Trig_invMass"), track.invMass());
}
}
Expand All @@ -216,7 +216,7 @@ struct LongrangecorrDerived {
histos.fill(HIST("Assoc_etavsphi"), track.phi(), track.eta());
histos.fill(HIST("Assoc_eta"), track.eta());
histos.fill(HIST("Assoc_phi"), track.phi());
if constexpr (std::experimental::is_detected<HasFt0, TTrack>::value) {
if constexpr (requires { track.channelID(); }) {
histos.fill(HIST("Assoc_amp"), track.amplitude());
histos.fill(HIST("Channel_vs_Assoc_amp"), track.channelID(), track.amplitude());
histos.fill(HIST("Assoc_amp_gaincorrected"), track.gainAmplitude());
Expand Down Expand Up @@ -244,52 +244,39 @@ struct LongrangecorrDerived {
return true;
}

template <class T>
using HasTpcTrack = decltype(std::declval<T&>().trackType());
template <class T>
using HasV0Track = decltype(std::declval<T&>().v0Type());
template <class T>
using HasInvMass = decltype(std::declval<T&>().invMass());
template <class T>
using HasUpc = decltype(std::declval<T&>().gapSide());
template <class T>
using HasFt0 = decltype(std::declval<T&>().channelID());
template <class T>
using HasCent = decltype(std::declval<T&>().centrality());

template <CorrelationContainer::CFStep step, typename TTarget, typename TTriggers, typename TAssocs>
void fillCorrHist(TTarget target, TTriggers const& triggers, TAssocs const& assocs, bool mixing, float vz, float multiplicity, float eventWeight)
{
for (auto const& triggerTrack : triggers) {
auto trigAmpl = 1.0f;
if constexpr (std::experimental::is_detected<HasFt0, typename TTriggers::iterator>::value) {
if constexpr (requires { triggerTrack.channelID(); }) {
if (useGainCorr)
trigAmpl = triggerTrack.gainAmplitude();
else
trigAmpl = triggerTrack.amplitude();
} else {
trigAmpl = 1.0;
}
if constexpr (std::experimental::is_detected<HasTpcTrack, typename TTriggers::iterator>::value) {
if constexpr (requires { triggerTrack.trackType(); }) {
if (cfgPidMask != 0 && (cfgPidMask & (1u << static_cast<uint32_t>(triggerTrack.trackType()))) == 0u)
continue;
} else if constexpr (std::experimental::is_detected<HasV0Track, typename TTriggers::iterator>::value) {
} else if constexpr (requires { triggerTrack.v0Type(); }) {
if (cfgV0Mask != 0 && (cfgV0Mask & (1u << static_cast<uint32_t>(triggerTrack.v0Type()))) == 0u)
continue;
}
if (!mixing) {
fillTrigTrackQA(triggerTrack);
if constexpr (std::experimental::is_detected<HasFt0, typename TTriggers::iterator>::value) {
if constexpr (requires { triggerTrack.channelID(); }) {
histos.fill(HIST("Trig_hist"), vz, multiplicity, 1.0, 1.0, eventWeight * trigAmpl);
} else if constexpr (std::experimental::is_detected<HasInvMass, typename TTriggers::iterator>::value) {
} else if constexpr (requires { triggerTrack.v0Type(); }) {
histos.fill(HIST("Trig_hist"), vz, multiplicity, triggerTrack.pt(), triggerTrack.invMass(), eventWeight * trigAmpl);
} else {
histos.fill(HIST("Trig_hist"), vz, multiplicity, triggerTrack.pt(), 1.0, eventWeight * trigAmpl);
}
}
for (auto const& assoTrack : assocs) {
auto assoAmpl = 1.0f;
if constexpr (std::experimental::is_detected<HasFt0, typename TAssocs::iterator>::value) {
if constexpr (requires { assoTrack.v0Type(); }) {
if (useGainCorr)
assoAmpl = assoTrack.gainAmplitude();
else
Expand All @@ -305,9 +292,9 @@ struct LongrangecorrDerived {
} else {
histos.fill(HIST("deltaEta_deltaPhi_mixed"), deltaPhi, deltaEta, eventWeight * trigAmpl * assoAmpl);
}
if constexpr (std::experimental::is_detected<HasFt0, typename TTriggers::iterator>::value) {
if constexpr (requires { triggerTrack.channelID(); }) {
target->getPairHist()->Fill(step, vz, multiplicity, 1.0, 1.0, deltaPhi, deltaEta, 1.0, eventWeight * trigAmpl * assoAmpl);
} else if constexpr (std::experimental::is_detected<HasInvMass, typename TTriggers::iterator>::value) {
} else if constexpr (requires { triggerTrack.invMass(); }) {
target->getPairHist()->Fill(step, vz, multiplicity, triggerTrack.pt(), triggerTrack.pt(), deltaPhi, deltaEta, triggerTrack.invMass(), eventWeight * trigAmpl * assoAmpl);
} else {
target->getPairHist()->Fill(step, vz, multiplicity, triggerTrack.pt(), triggerTrack.pt(), deltaPhi, deltaEta, 1.0, eventWeight * trigAmpl * assoAmpl);
Expand All @@ -324,7 +311,7 @@ struct LongrangecorrDerived {
}
fillCollQA(col);
auto multiplicity = 1.0f;
if constexpr (std::experimental::is_detected<HasCent, TCollision>::value) {
if constexpr (requires { col.centrality(); }) {
if (isUseCentEst)
multiplicity = col.centrality();
else
Expand All @@ -339,15 +326,15 @@ struct LongrangecorrDerived {
void processMixed(TCollision const& cols, TrackTypes&&... tracks)
{
auto getMultiplicity = [this](auto& col) {
if constexpr (std::experimental::is_detected<HasUpc, TCollision>::value) {
if constexpr (requires { col.gapSide(); }) {
if (!isUpcEventSelected<false>(col)) {
return -1.0f;
}
} else {
(void)this;
}
auto multiplicity = 1.0f;
if constexpr (std::experimental::is_detected<HasCent, TCollision>::value) {
if constexpr (requires { col.centrality(); }) {
if (isUseCentEst)
multiplicity = col.centrality();
else
Expand All @@ -365,7 +352,7 @@ struct LongrangecorrDerived {
Pair<TCollision, TupleAtrack, TupleBtrack, MixedBinning> pairs{binningOnVtxAndMult, cfgNmixedevent, -1, cols, tracksTuple, &cache};
for (auto it = pairs.begin(); it != pairs.end(); it++) {
auto& [col1, tracks1, col2, tracks2] = *it;
if constexpr (std::experimental::is_detected<HasUpc, TCollision>::value) {
if constexpr (requires { col1.gapSide(); } || requires { col2.gapSide(); }) {
if (!isUpcEventSelected<false>(col1) || !isUpcEventSelected<false>(col2)) {
continue;
}
Expand Down
Loading