diff --git a/PWGHF/HFC/Tasks/taskFlow.cxx b/PWGHF/HFC/Tasks/taskFlow.cxx index 5f6a5b2a95a..5fcdb7a7878 100644 --- a/PWGHF/HFC/Tasks/taskFlow.cxx +++ b/PWGHF/HFC/Tasks/taskFlow.cxx @@ -23,6 +23,7 @@ #include "Framework/AnalysisTask.h" #include "Framework/ASoAHelpers.h" #include "Framework/HistogramRegistry.h" +#include "Framework/O2DatabasePDGPlugin.h" #include "Framework/runDataProcessing.h" #include "Framework/RunningWorkflowInfo.h" #include "Framework/StepTHn.h" @@ -47,6 +48,7 @@ using namespace o2::framework; using namespace o2::framework::expressions; struct HfTaskFlow { + // configurables for processing options Configurable processRun2{"processRun2", false, "Flag to run on Run 2 data"}; Configurable processRun3{"processRun3", true, "Flag to run on Run 3 data"}; @@ -63,25 +65,82 @@ struct HfTaskFlow { Configurable yCandMax{"yCandMax", -1., "max. cand. rapidity"}; Configurable> binsPt{"binsPt", std::vector{hf_cuts_d0_to_pi_k::vecBinsPt}, "pT bin limits"}; + Service pdg; HfHelper hfHelper; SliceCache cache; + // ========================= + // using declarations : DATA + // ========================= + using FilteredCollisionsWSelMult = soa::Filtered>; - using TracksWDcaSel = soa::Filtered>; using HfCandidatesSel = soa::Filtered>; + using TracksWDcaSel = soa::Filtered>; + + // ========================= + // using declarations : MC + // ========================= + + // Even add McCollisions in the join ? + // Kata adds subscribes to it but do not add it in the join + // using FilteredCollisionsWSelMultMC = soa::Filtered>; + using FilteredCollisionsWSelMultMC = soa::Filtered>; + using FilteredMcCollisions = soa::Filtered; + using FilteredMcParticles = soa::Filtered; + using TracksWDcaSelMC = soa::Filtered>; + + // Remnants, need Katarina's info + // using FilteredCollisionsWDcaSelMcLabels = soa::Filtered>; + // using FilteredTracksWDcaSelMcLabels = soa::Filtered>; + + // ========================= + // Filters & partitions : DATA + // ========================= + + // HF candidate filter + // TODO: use Partition instead of filter + Filter candidateFilter = aod::hf_sel_candidate_d0::isSelD0 >= selectionFlagD0 || + aod::hf_sel_candidate_d0::isSelD0bar >= selectionFlagD0bar; // Collision filters // FIXME: The filter is applied also on the candidates! Beware! Filter collisionVtxZFilter = nabs(aod::collision::posZ) < zVertexMax; - // Charged track filters + Filter trackFilter = (nabs(aod::track::eta) < etaTrackAssocMax) && (aod::track::pt > ptTrackAssocMin) && requireGlobalTrackWoPtEtaInFilter(); - // HF candidate filter - // TODO: use Partition instead of filter - Filter candidateFilter = aod::hf_sel_candidate_d0::isSelD0 >= selectionFlagD0 || aod::hf_sel_candidate_d0::isSelD0bar >= selectionFlagD0bar; - Preslice perCol = aod::track::collisionId; + // Katarina had this in her code : + // Charged track filters + // Filter trackFilter = (nabs(aod::track::eta) < etaTrackAssocMax) && + // (aod::track::pt > ptTrackAssocMin) && + // requireGlobalTrackWoPtEtaInFilter(); + + // ========================= + // Filters & partitions : MC + // ========================= + + // From Katarina's code, but not sure if I use it + Filter mcCollisionFilter = nabs(aod::mccollision::posZ) < zVertexMax; + + // From Katarina's code + Filter mcParticlesFilter = (nabs(aod::mcparticle::eta) < etaTrackAssocMax) && + (aod::mcparticle::pt > ptTrackAssocMin); //&& + //(aod::mcparticle::sign != 0) + + // ========================= + // Preslice : DATA + // ========================= + + Preslice dataPerCol = aod::track::collisionId; + + // ========================= + // Preslice : MC + // ========================= + + Preslice mcTruthPerCol = aod::mcparticle::mcCollisionId; + // Do I have to adapt this preslice to MC ? How does it work exactly ? + // Preslice mcRecPerCol = aod::track::collisionId; // configurables for containers ConfigurableAxis axisVertex{"axisVertex", {14, -7, 7}, "vertex axis for histograms"}; @@ -100,19 +159,29 @@ struct HfTaskFlow { HistogramRegistry registry{"registry"}; + // Correlation containers used for data OutputObj sameTPCTPCChCh{"sameTPCTPCChCh"}; OutputObj mixedTPCTPCChCh{"mixedTPCTPCChCh"}; OutputObj sameTPCTPCHfCh{"sameTPCTPCHfCh"}; OutputObj mixedTPCTPCHfCh{"mixedTPCTPCHfCh"}; OutputObj sameTPCMFTChCh{"sameTPCMFTChCh"}; OutputObj mixedTPCMFTChCh{"mixedTPCMFTChCh"}; + OutputObj sameTPCMFTHfCh{"sameTPCMFTHfCh"}; + OutputObj mixedTPCMFTHfCh{"mixedTPCMFTHfCh"}; + + // Correlation containers used for Monte-Carlo + OutputObj sameTPCTPCChChMC{"sameTPCTPCChChMC"}; + OutputObj mixedTPCTPCChChMC{"mixedTPCTPCChChMC"}; // ========================= // init() // ========================= void init(InitContext&) { - // EVENT HISTOGRAMS + // ========================= + // Event histograms + // TO-DO : do i have to separate event histograms between DATA and MC ? + // ========================= constexpr int kNBinsEvents = 3; registry.add("Data/hEventCounter", "hEventCounter", {HistType::kTH1F, {{kNBinsEvents, 0.5, 0.5 + kNBinsEvents}}}); // set axes of the event counter histogram @@ -120,70 +189,232 @@ struct HfTaskFlow { labels[0] = "all"; labels[1] = "after trigger selection (Run 2)"; labels[2] = "after Physics selection"; + + const int nBinsMix = axisMultiplicity->size() * 14; // 14 bins for z-vertex + for (int iBin = 0; iBin < kNBinsEvents; iBin++) { registry.get(HIST("Data/hEventCounter"))->GetXaxis()->SetBinLabel(iBin + 1, labels[iBin].data()); } + + // ========================= + // DATA : histograms for TPC-TPC h-h case + // ========================= + + // DATA : event histograms for TPC-TPC h-h same event registry.add("Data/TpcTpc/HadronHadron/SameEvent/hMultiplicity", "hMultiplicity", {HistType::kTH1F, {{500, 0, 500}}}); registry.add("Data/TpcTpc/HadronHadron/SameEvent/hVtxZ", "hVtxZ", {HistType::kTH1F, {{400, -50, 50}}}); + registry.add("Data/TpcTpc/HadronHadron/SameEvent/hEventCountSame", "bin", {HistType::kTH1F, {{nBinsMix + 2, -2.5, -0.5 + nBinsMix, "bin"}}}); + + // DATA : associated particles histograms for TPC-TPC h-h same event + registry.add("Data/TpcTpc/HadronHadron/SameEvent/hPt", "pT", {HistType::kTH1F, {{100, 0, 10, "p_{T}"}}}); + registry.add("Data/TpcTpc/HadronHadron/SameEvent/hEta", "eta", {HistType::kTH1F, {{100, -4, 4, "#eta"}}}); + registry.add("Data/TpcTpc/HadronHadron/SameEvent/hPhi", "phi", {HistType::kTH1F, {{100, 0, TwoPI, "#varphi"}}}); + registry.add("Data/TpcTpc/HadronHadron/SameEvent/hYields", "multiplicity vs pT vs eta", {HistType::kTH3F, {{200, 0, 200, "multiplicity"}, {40, 0, 20, "p_{T}"}, {100, -2, 2, "#eta"}}}); + registry.add("Data/TpcTpc/HadronHadron/SameEvent/hEtaPhi", "multiplicity vs eta vs phi", {HistType::kTH3F, {{200, 0, 200, "multiplicity"}, {100, -2, 2, "#eta"}, {200, 0, TwoPI, "#varphi"}}}); registry.add("Data/TpcTpc/HadronHadron/SameEvent/hNtracks", "hNtracks", {HistType::kTH1F, {{500, 0, 500}}}); - // histograms for event mixing - const int maxMixBin = axisMultiplicity->size() * 14; // 14 bins for z-vertex - registry.add("Data/TpcTpc/HadronHadron/MixedEvent/hEventCountMixing", "bin", {HistType::kTH1F, {{maxMixBin + 2, -2.5, -0.5 + maxMixBin, "bin"}}}); - registry.add("Data/TpcTpc/HfHadron/MixedEvent/hEventCountHFMixing", "bin", {HistType::kTH1F, {{maxMixBin + 2, -2.5, -0.5 + maxMixBin, "bin"}}}); - registry.add("Data/TpcTpc/HadronHadron/SameEvent/hEventCountSame", "bin", {HistType::kTH1F, {{maxMixBin + 2, -2.5, -0.5 + maxMixBin, "bin"}}}); + // Katarina had this : + registry.add("Data/TpcTpc/HadronHadron/SameEvent/hVzEta", "eta vs. Vz", {HistType::kTH2F, {{100, -4, 4, "#eta"}, {20, -10, 10, "Vz"}}}); + + // DATA : event mixing histograms for TPC-TPC h-h mixed event + registry.add("Data/TpcTpc/HadronHadron/MixedEvent/hEventCountMixing", "bin", {HistType::kTH1F, {{nBinsMix + 2, -2.5, -0.5 + nBinsMix, "bin"}}}); registry.add("Data/TpcTpc/HadronHadron/MixedEvent/hMultiplicityMixing", "hMultiplicityMixing", {HistType::kTH1F, {{500, 0, 500}}}); registry.add("Data/TpcTpc/HadronHadron/MixedEvent/hVtxZMixing", "hVtxZMixing", {HistType::kTH1F, {{100, -10, 10}}}); registry.add("Data/TpcTpc/HadronHadron/MixedEvent/hNtracksMixing", "hNtracksMixing", {HistType::kTH1F, {{500, 0, 500}}}); - registry.add("Data/TpcTpc/HfHadron/MixedEvent/hMultiplicityHFMixing", "hMultiplicityHFMixing", {HistType::kTH1F, {{500, 0, 500}}}); - registry.add("Data/TpcTpc/HfHadron/MixedEvent/hVtxZHFMixing", "hVtxZHFMixing", {HistType::kTH1F, {{100, -10, 10}}}); - registry.add("Data/TpcTpc/HfHadron/MixedEvent/hNtracksHFMixing", "hNtracksHFMixing", {HistType::kTH1F, {{500, 0, 500}}}); - // TRACK HISTOGRAMS - // histograms for associated particles - registry.add("Data/TpcTpc/HadronHadron/SameEvent/hYields", "multiplicity vs pT vs eta", {HistType::kTH3F, {{200, 0, 200, "multiplicity"}, {40, 0, 20, "p_{T}"}, {100, -2, 2, "#eta"}}}); - registry.add("Data/TpcTpc/HadronHadron/SameEvent/hEtaPhi", "multiplicity vs eta vs phi", {HistType::kTH3F, {{200, 0, 200, "multiplicity"}, {100, -2, 2, "#eta"}, {200, 0, TwoPI, "#varphi"}}}); - registry.add("Data/TpcTpc/HadronHadron/SameEvent/hPt", "pT", {HistType::kTH1F, {{100, 0, 10, "p_{T}"}}}); - registry.add("Data/TpcTpc/HadronHadron/SameEvent/hEta", "eta", {HistType::kTH1F, {{100, -4, 4, "#eta"}}}); - registry.add("Data/TpcTpc/HadronHadron/SameEvent/hPhi", "phi", {HistType::kTH1F, {{100, 0, TwoPI, "#varphi"}}}); - - // histograms for particles in event mixing + // DATA : particles histograms for TPC-TPC h-h mixed event registry.add("Data/TpcTpc/HadronHadron/MixedEvent/hPtMixing", "pT", {HistType::kTH1F, {{100, 0, 10, "p_{T}"}}}); registry.add("Data/TpcTpc/HadronHadron/MixedEvent/hEtaMixing", "eta", {HistType::kTH1F, {{100, -4, 4, "#eta"}}}); registry.add("Data/TpcTpc/HadronHadron/MixedEvent/hPhiMixing", "phi", {HistType::kTH1F, {{100, 0, TwoPI, "#varphi"}}}); - // histograms for MFT tracks - registry.add("Data/TpcMft/HadronHadron/hEtaPhiMFT", "multiplicity vs eta vs phi in MFT", {HistType::kTH3F, {{200, 0, 200, "multiplicity"}, {100, -2, 2, "#eta"}, {200, 0, TwoPI, "#varphi"}}}); - registry.add("Data/TpcMft/HadronHadron/hEtaMFT", "etaMFT", {HistType::kTH1F, {{100, -4, 4, "#eta"}}}); - registry.add("Data/TpcMft/HadronHadron/hPhiMFT", "phiMFT", {HistType::kTH1F, {{100, 0, TwoPI, "#varphi"}}}); + // ========================= + // DATA : histograms for TPC-TPC HF-h case + // ========================= - // histograms for candidates - auto vbins = (std::vector)binsPt; + // DATA : event histograms for TPC-TPC HF-h same event + registry.add("Data/TpcTpc/HfHadron/MixedEvent/hEventCountHFMixing", "bin", {HistType::kTH1F, {{nBinsMix + 2, -2.5, -0.5 + nBinsMix, "bin"}}}); + registry.add("Data/TpcTpc/HfHadron/MixedEvent/hMultiplicityHFMixing", "hMultiplicityHFMixing", {HistType::kTH1F, {{500, 0, 500}}}); + registry.add("Data/TpcTpc/HfHadron/MixedEvent/hVtxZHFMixing", "hVtxZHFMixing", {HistType::kTH1F, {{100, -10, 10}}}); + registry.add("Data/TpcTpc/HfHadron/MixedEvent/hNtracksHFMixing", "hNtracksHFMixing", {HistType::kTH1F, {{500, 0, 500}}}); - registry.add("Data/TpcTpc/HfHadron/hPtCand", "2-prong candidates;candidate #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{100, 0, 10.}}}); - registry.add("Data/TpcTpc/HfHadron/hPtProng0", "2-prong candidates;prong 0 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{100, 0, 10.}}}); - registry.add("Data/TpcTpc/HfHadron/hPtProng1", "2-prong candidates;prong 1 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{100, 0, 10.}}}); - registry.add("Data/TpcTpc/HfHadron/hMass", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{500, 0., 5.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("Data/TpcTpc/HfHadron/hDecLength", "2-prong candidates;decay length (cm);entries", {HistType::kTH2F, {{200, 0., 2.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("Data/TpcTpc/HfHadron/hDecLengthXY", "2-prong candidates;decay length xy (cm);entries", {HistType::kTH2F, {{200, 0., 2.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("Data/TpcTpc/HfHadron/hd0Prong0", "2-prong candidates;prong 0 DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {{100, -1., 1.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("Data/TpcTpc/HfHadron/hd0Prong1", "2-prong candidates;prong 1 DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {{100, -1., 1.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("Data/TpcTpc/HfHadron/hd0d0", "2-prong candidates;product of DCAxy to prim. vertex (cm^{2});entries", {HistType::kTH2F, {{500, -1., 1.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("Data/TpcTpc/HfHadron/hCTS", "2-prong candidates;cos #it{#theta}* (D^{0});entries", {HistType::kTH2F, {{110, -1.1, 1.1}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("Data/TpcTpc/HfHadron/hCt", "2-prong candidates;proper lifetime (D^{0}) * #it{c} (cm);entries", {HistType::kTH2F, {{120, -20., 100.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("Data/TpcTpc/HfHadron/hCPA", "2-prong candidates;cosine of pointing angle;entries", {HistType::kTH2F, {{110, -1.1, 1.1}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("Data/TpcTpc/HfHadron/hEtaCand", "2-prong candidates;candidate #it{#eta};entries", {HistType::kTH2F, {{100, -2., 2.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("Data/TpcTpc/HfHadron/hSelectionStatus", "2-prong candidates;selection status;entries", {HistType::kTH2F, {{5, -0.5, 4.5}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("Data/TpcTpc/HfHadron/hImpParErr", "2-prong candidates;impact parameter error (cm);entries", {HistType::kTH2F, {{100, -1., 1.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("Data/TpcTpc/HfHadron/hDecLenErr", "2-prong candidates;decay length error (cm);entries", {HistType::kTH2F, {{100, 0., 1.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - registry.add("Data/TpcTpc/HfHadron/hDecLenXYErr", "2-prong candidates;decay length xy error (cm);entries", {HistType::kTH2F, {{100, 0., 1.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); - - // histograms for candidates in event mixing + // DATA : trigger particles (candidates) histograms for TPC-TPC h-h same event + auto vbins = (std::vector)binsPt; + registry.add("Data/TpcTpc/HfHadron/SameEvent/hPtCand", "2-prong candidates;candidate #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{100, 0, 10.}}}); + registry.add("Data/TpcTpc/HfHadron/SameEvent/hPtProng0", "2-prong candidates;prong 0 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{100, 0, 10.}}}); + registry.add("Data/TpcTpc/HfHadron/SameEvent/hPtProng1", "2-prong candidates;prong 1 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{100, 0, 10.}}}); + registry.add("Data/TpcTpc/HfHadron/SameEvent/hMassVsPt", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{500, 0., 5.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("Data/TpcTpc/HfHadron/SameEvent/hMass", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH1F, {{100, 0., 10.}}}); + registry.add("Data/TpcTpc/HfHadron/SameEvent/hDecLength", "2-prong candidates;decay length (cm);entries", {HistType::kTH2F, {{200, 0., 2.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("Data/TpcTpc/HfHadron/SameEvent/hDecLengthXY", "2-prong candidates;decay length xy (cm);entries", {HistType::kTH2F, {{200, 0., 2.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("Data/TpcTpc/HfHadron/SameEvent/hd0Prong0", "2-prong candidates;prong 0 DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {{100, -1., 1.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("Data/TpcTpc/HfHadron/SameEvent/hd0Prong1", "2-prong candidates;prong 1 DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {{100, -1., 1.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("Data/TpcTpc/HfHadron/SameEvent/hd0d0", "2-prong candidates;product of DCAxy to prim. vertex (cm^{2});entries", {HistType::kTH2F, {{500, -1., 1.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("Data/TpcTpc/HfHadron/SameEvent/hCTS", "2-prong candidates;cos #it{#theta}* (D^{0});entries", {HistType::kTH2F, {{110, -1.1, 1.1}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("Data/TpcTpc/HfHadron/SameEvent/hCt", "2-prong candidates;proper lifetime (D^{0}) * #it{c} (cm);entries", {HistType::kTH2F, {{120, -20., 100.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("Data/TpcTpc/HfHadron/SameEvent/hCPA", "2-prong candidates;cosine of pointing angle;entries", {HistType::kTH2F, {{110, -1.1, 1.1}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("Data/TpcTpc/HfHadron/SameEvent/hEtaCand", "2-prong candidates;candidate #it{#eta};entries", {HistType::kTH2F, {{100, -2., 2.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("Data/TpcTpc/HfHadron/SameEvent/hSelectionStatus", "2-prong candidates;selection status;entries", {HistType::kTH2F, {{5, -0.5, 4.5}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("Data/TpcTpc/HfHadron/SameEvent/hImpParErr", "2-prong candidates;impact parameter error (cm);entries", {HistType::kTH2F, {{100, -1., 1.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("Data/TpcTpc/HfHadron/SameEvent/hDecLenErr", "2-prong candidates;decay length error (cm);entries", {HistType::kTH2F, {{100, 0., 1.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("Data/TpcTpc/HfHadron/SameEvent/hDecLenXYErr", "2-prong candidates;decay length xy error (cm);entries", {HistType::kTH2F, {{100, 0., 1.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + + // DATA : trigger particles (candidates) histograms for TPC-TPC h-h mixed event registry.add("Data/TpcTpc/HfHadron/MixedEvent/hPtHFMixing", "pT", {HistType::kTH1F, {{100, 0, 10, "p_{T}"}}}); registry.add("Data/TpcTpc/HfHadron/MixedEvent/hEtaHFMixing", "eta", {HistType::kTH1F, {{100, -4, 4, "#eta"}}}); registry.add("Data/TpcTpc/HfHadron/MixedEvent/hPhiHFMixing", "phi", {HistType::kTH1F, {{100, 0, TwoPI, "#varphi"}}}); - // set axes of the correlation container + // ========================= + // DATA : histograms for TPC-MFT h-h case + // ========================= + + // DATA : trigger particles (TPC tracks) histograms for TPC-MFT h-h same event + registry.add("Data/TpcMft/HadronHadron/SameEvent/hEtaPhiTPC", "multiplicity vs eta vs phi in TPC", {HistType::kTH3F, {{200, 0, 200, "multiplicity"}, {100, -2, 2, "#eta"}, {200, 0, TwoPI, "#varphi"}}}); + registry.add("Data/TpcMft/HadronHadron/SameEvent/hEtaTPC", "etaTPC", {HistType::kTH1F, {{100, -4, 4, "#eta"}}}); + registry.add("Data/TpcMft/HadronHadron/SameEvent/hPhiTPC", "phiTPC", {HistType::kTH1F, {{100, 0, TwoPI, "#varphi"}}}); + registry.add("Data/TpcMft/HadronHadron/SameEvent/hPtTPC", "pT", {HistType::kTH1F, {{100, 0, 10, "p_{T}"}}}); + registry.add("Data/TpcMft/HadronHadron/SameEvent/hYieldsTPC", "multiplicity vs pT vs eta", {HistType::kTH3F, {{200, 0, 200, "multiplicity"}, {40, 0, 20, "p_{T}"}, {100, -2, 2, "#eta"}}}); + registry.add("Data/TpcTpc/HadronHadron/SameEvent/hNtracksTPC", "hNtracks", {HistType::kTH1F, {{500, 0, 500}}}); + + // DATA : associated particles (MFT tracks) histograms for TPC-MFT h-h same event + registry.add("Data/TpcMft/HadronHadron/SameEvent/hEtaPhiMFT", "multiplicity vs eta vs phi in MFT", {HistType::kTH3F, {{200, 0, 200, "multiplicity"}, {100, -2, 2, "#eta"}, {200, 0, TwoPI, "#varphi"}}}); + registry.add("Data/TpcMft/HadronHadron/SameEvent/hEtaMFT", "etaMFT", {HistType::kTH1F, {{100, -4, 4, "#eta"}}}); + registry.add("Data/TpcMft/HadronHadron/SameEvent/hPhiMFT", "phiMFT", {HistType::kTH1F, {{100, 0, TwoPI, "#varphi"}}}); + registry.add("Data/TpcMft/HadronHadron/SameEvent/hPtMFT", "pT", {HistType::kTH1F, {{100, 0, 10, "p_{T}"}}}); + registry.add("Data/TpcMft/HadronHadron/SameEvent/hYieldsMFT", "multiplicity vs pT vs eta", {HistType::kTH3F, {{200, 0, 200, "multiplicity"}, {40, 0, 20, "p_{T}"}, {100, -2, 2, "#eta"}}}); + registry.add("Data/TpcTpc/HadronHadron/SameEvent/hNtracksMFT", "hNtracks", {HistType::kTH1F, {{500, 0, 500}}}); + + // DATA : histograms for TPC-MFT h-h event mixing for TPC tracks + registry.add("Data/TpcMft/HadronHadron/MixedEvent/hMultiplicityMixingTPC", "hMultiplicityMixing", {HistType::kTH1F, {{500, 0, 500}}}); + registry.add("Data/TpcMft/HadronHadron/MixedEvent/hVtxZMixingTPC", "hVtxZMixing", {HistType::kTH1F, {{100, -10, 10}}}); + registry.add("Data/TpcMft/HadronHadron/MixedEvent/hPtMixingTPC", "pT", {HistType::kTH1F, {{100, 0, 10, "p_{T}"}}}); + registry.add("Data/TpcMft/HadronHadron/MixedEvent/hEtaMixingTPC", "eta", {HistType::kTH1F, {{100, -4, 4, "#eta"}}}); + registry.add("Data/TpcMft/HadronHadron/MixedEvent/hPhiMixingTPC", "phi", {HistType::kTH1F, {{100, 0, TwoPI, "#varphi"}}}); + registry.add("Data/TpcMft/HadronHadron/MixedEvent/hNtracksMixingTPC", "hNtracksMixing", {HistType::kTH1F, {{500, 0, 500}}}); + + // DATA : histograms for TPC-MFT h-h event mixing for MFT tracks + registry.add("Data/TpcMft/HadronHadron/MixedEvent/hMultiplicityMixingMFT", "hMultiplicityMixing", {HistType::kTH1F, {{500, 0, 500}}}); + registry.add("Data/TpcMft/HadronHadron/MixedEvent/hVtxZMixingMFT", "hVtxZMixing", {HistType::kTH1F, {{100, -10, 10}}}); + registry.add("Data/TpcMft/HadronHadron/MixedEvent/hPtMixingMFT", "pT", {HistType::kTH1F, {{100, 0, 10, "p_{T}"}}}); + registry.add("Data/TpcMft/HadronHadron/MixedEvent/hEtaMixingMFT", "eta", {HistType::kTH1F, {{100, -4, 4, "#eta"}}}); + registry.add("Data/TpcMft/HadronHadron/MixedEvent/hPhiMixingMFT", "phi", {HistType::kTH1F, {{100, 0, TwoPI, "#varphi"}}}); + registry.add("Data/TpcMft/HadronHadron/MixedEvent/hNtracksMixingMFT", "hNtracksMixing", {HistType::kTH1F, {{500, 0, 500}}}); + + // DATA : histograms for TPC-MFT h-h event mixing for events QA + registry.add("Data/TpcMft/HadronHadron/MixedEvent/hEventCountMixing", "bin", {HistType::kTH1F, {{nBinsMix + 2, -2.5, -0.5 + nBinsMix, "bin"}}}); + + // ========================= + // DATA : histograms for TPC-MFT HF-h case + // ========================= + + // DATA : trigger particles (candidates) histograms for TPC-MFT HF-h same event + registry.add("Data/TpcMft/HfHadron/SameEvent/SameEvent/hEtaPhiCandidate", "multiplicity vs eta vs phi in TPC", {HistType::kTH3F, {{200, 0, 200, "multiplicity"}, {100, -2, 2, "#eta"}, {200, 0, TwoPI, "#varphi"}}}); + registry.add("Data/TpcMft/HfHadron/SameEvent/SameEvent/hEtaCandidate", "etaTPC", {HistType::kTH1F, {{100, -4, 4, "#eta"}}}); + registry.add("Data/TpcMft/HfHadron/SameEvent/SameEvent/hPhiCandidate", "phiTPC", {HistType::kTH1F, {{100, 0, TwoPI, "#varphi"}}}); + registry.add("Data/TpcMft/HfHadron/SameEvent/SameEvent/hPtCandidate", "pT", {HistType::kTH1F, {{100, 0, 10, "p_{T}"}}}); + registry.add("Data/TpcMft/HfHadron/SameEvent/SameEvent/hYieldsCandidate", "multiplicity vs pT vs eta", {HistType::kTH3F, {{200, 0, 200, "multiplicity"}, {40, 0, 20, "p_{T}"}, {100, -2, 2, "#eta"}}}); + registry.add("Data/TpcTpc/HfHadron/SameEvent/SameEvent/hNtracksCandidate", "hNtracks", {HistType::kTH1F, {{500, 0, 500}}}); + + // DATA : trigger particles (candidates) histograms for TPC-TPC h-h same event + registry.add("Data/TpcMft/HfHadron/SameEvent/hPtCand", "2-prong candidates;candidate #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{100, 0, 10.}}}); + registry.add("Data/TpcMft/HfHadron/SameEvent/hPtProng0", "2-prong candidates;prong 0 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{100, 0, 10.}}}); + registry.add("Data/TpcMft/HfHadron/SameEvent/hPtProng1", "2-prong candidates;prong 1 #it{p}_{T} (GeV/#it{c});entries", {HistType::kTH1F, {{100, 0, 10.}}}); + registry.add("Data/TpcMft/HfHadron/SameEvent/hMassVsPt", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{500, 0., 5.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("Data/TpcMft/HfHadron/SameEvent/hMass", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH1F, {{100, 0., 10.}}}); + registry.add("Data/TpcMft/HfHadron/SameEvent/hDecLength", "2-prong candidates;decay length (cm);entries", {HistType::kTH2F, {{200, 0., 2.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("Data/TpcMft/HfHadron/SameEvent/hDecLengthXY", "2-prong candidates;decay length xy (cm);entries", {HistType::kTH2F, {{200, 0., 2.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("Data/TpcMft/HfHadron/SameEvent/hd0Prong0", "2-prong candidates;prong 0 DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {{100, -1., 1.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("Data/TpcMft/HfHadron/SameEvent/hd0Prong1", "2-prong candidates;prong 1 DCAxy to prim. vertex (cm);entries", {HistType::kTH2F, {{100, -1., 1.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("Data/TpcMft/HfHadron/SameEvent/hd0d0", "2-prong candidates;product of DCAxy to prim. vertex (cm^{2});entries", {HistType::kTH2F, {{500, -1., 1.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("Data/TpcMft/HfHadron/SameEvent/hCTS", "2-prong candidates;cos #it{#theta}* (D^{0});entries", {HistType::kTH2F, {{110, -1.1, 1.1}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("Data/TpcMft/HfHadron/SameEvent/hCt", "2-prong candidates;proper lifetime (D^{0}) * #it{c} (cm);entries", {HistType::kTH2F, {{120, -20., 100.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("Data/TpcMft/HfHadron/SameEvent/hCPA", "2-prong candidates;cosine of pointing angle;entries", {HistType::kTH2F, {{110, -1.1, 1.1}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("Data/TpcMft/HfHadron/SameEvent/hEtaCand", "2-prong candidates;candidate #it{#eta};entries", {HistType::kTH2F, {{100, -2., 2.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("Data/TpcMft/HfHadron/SameEvent/hSelectionStatus", "2-prong candidates;selection status;entries", {HistType::kTH2F, {{5, -0.5, 4.5}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("Data/TpcMft/HfHadron/SameEvent/hImpParErr", "2-prong candidates;impact parameter error (cm);entries", {HistType::kTH2F, {{100, -1., 1.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("Data/TpcMft/HfHadron/SameEvent/hDecLenErr", "2-prong candidates;decay length error (cm);entries", {HistType::kTH2F, {{100, 0., 1.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + registry.add("Data/TpcMft/HfHadron/SameEvent/hDecLenXYErr", "2-prong candidates;decay length xy error (cm);entries", {HistType::kTH2F, {{100, 0., 1.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); + + // DATA : associated particles (MFT tracks) histograms for TPC-MFT h-h same event + registry.add("Data/TpcMft/HfHadron/SameEvent/SameEvent/hEtaPhiMFT", "multiplicity vs eta vs phi in MFT", {HistType::kTH3F, {{200, 0, 200, "multiplicity"}, {100, -2, 2, "#eta"}, {200, 0, TwoPI, "#varphi"}}}); + registry.add("Data/TpcMft/HfHadron/SameEvent/SameEvent/hEtaMFT", "etaMFT", {HistType::kTH1F, {{100, -4, 4, "#eta"}}}); + registry.add("Data/TpcMft/HfHadron/SameEvent/SameEvent/hPhiMFT", "phiMFT", {HistType::kTH1F, {{100, 0, TwoPI, "#varphi"}}}); + registry.add("Data/TpcMft/HfHadron/SameEvent/SameEvent/hPtMFT", "pT", {HistType::kTH1F, {{100, 0, 10, "p_{T}"}}}); + registry.add("Data/TpcMft/HfHadron/SameEvent/SameEvent/hYieldsMFT", "multiplicity vs pT vs eta", {HistType::kTH3F, {{200, 0, 200, "multiplicity"}, {40, 0, 20, "p_{T}"}, {100, -2, 2, "#eta"}}}); + registry.add("Data/TpcTpc/HfHadron/SameEvent/SameEvent/hNtracksMFT", "hNtracks", {HistType::kTH1F, {{500, 0, 500}}}); + + // DATA : histograms for TPC-MFT h-h event mixing for candidates + registry.add("Data/TpcMft/HfHadron/MixedEvent/hMultiplicityMixingCandidate", "hMultiplicityMixing", {HistType::kTH1F, {{500, 0, 500}}}); + registry.add("Data/TpcMft/HfHadron/MixedEvent/hVtxZMixingCandidate", "hVtxZMixing", {HistType::kTH1F, {{100, -10, 10}}}); + registry.add("Data/TpcMft/HfHadron/MixedEvent/hPtMixingCandidate", "pT", {HistType::kTH1F, {{100, 0, 10, "p_{T}"}}}); + registry.add("Data/TpcMft/HfHadron/MixedEvent/hEtaMixingCandidate", "eta", {HistType::kTH1F, {{100, -4, 4, "#eta"}}}); + registry.add("Data/TpcMft/HfHadron/MixedEvent/hPhiMixingCandidate", "phi", {HistType::kTH1F, {{100, 0, TwoPI, "#varphi"}}}); + registry.add("Data/TpcMft/HfHadron/MixedEvent/hNtracksMixingCandidate", "hNtracksMixing", {HistType::kTH1F, {{500, 0, 500}}}); + + // DATA : histograms for TPC-MFT h-h event mixing for MFT tracks + registry.add("Data/TpcMft/HfHadron/MixedEvent/hMultiplicityMixingMFT", "hMultiplicityMixing", {HistType::kTH1F, {{500, 0, 500}}}); + registry.add("Data/TpcMft/HfHadron/MixedEvent/hVtxZMixingMFT", "hVtxZMixing", {HistType::kTH1F, {{100, -10, 10}}}); + registry.add("Data/TpcMft/HfHadron/MixedEvent/hPtMixingMFT", "pT", {HistType::kTH1F, {{100, 0, 10, "p_{T}"}}}); + registry.add("Data/TpcMft/HfHadron/MixedEvent/hEtaMixingMFT", "eta", {HistType::kTH1F, {{100, -4, 4, "#eta"}}}); + registry.add("Data/TpcMft/HfHadron/MixedEvent/hPhiMixingMFT", "phi", {HistType::kTH1F, {{100, 0, TwoPI, "#varphi"}}}); + registry.add("Data/TpcMft/HfHadron/MixedEvent/hNtracksMixingMFT", "hNtracksMixing", {HistType::kTH1F, {{500, 0, 500}}}); + + // DATA : histograms for TPC-MFT h-h event mixing for events QA + registry.add("Data/TpcMft/HfHadron/MixedEvent/hEventCountMixing", "bin", {HistType::kTH1F, {{nBinsMix + 2, -2.5, -0.5 + nBinsMix, "bin"}}}); + + // ========================= + // MC : histograms for TPC-MFT h-h case + // ========================= + + // MC reconstructed + + registry.add("MC/Rec/TpcTpc/HadronHadron/SameEvent/hMultiplicity", "hMultiplicity", {HistType::kTH1F, {{500, 0, 500}}}); + registry.add("MC/Rec/TpcTpc/HadronHadron/SameEvent/hVtxZ", "hVtxZ", {HistType::kTH1F, {{400, -50, 50}}}); + registry.add("MC/Rec/TpcTpc/HadronHadron/SameEvent/hEventCountSame", "hNtracks", {HistType::kTH1F, {{500, 0, 500}}}); + // Katarina had this : + registry.add("MC/Rec/TpcTpc/HadronHadron/SameEvent/hMultiplicityPrimary", "hMultiplicityPrimary", {HistType::kTH1F, {{500, 0, 500}}}); + // histograms for MC associated particles + registry.add("MC/Rec/TpcTpc/HadronHadron/SameEvent/hPt", "pT", {HistType::kTH1F, {{100, 0, 10, "p_{T}"}}}); + registry.add("MC/Rec/TpcTpc/HadronHadron/SameEvent/hEta", "eta", {HistType::kTH1F, {{100, -4, 4, "#eta"}}}); + registry.add("MC/Rec/TpcTpc/HadronHadron/SameEvent/hPhi", "phi", {HistType::kTH1F, {{100, 0, TwoPI, "#varphi"}}}); + registry.add("MC/Rec/TpcTpc/HadronHadron/SameEvent/hYields", "multiplicity vs pT vs eta", {HistType::kTH3F, {{200, 0, 200, "multiplicity"}, {40, 0, 20, "p_{T}"}, {100, -2, 2, "#eta"}}}); + registry.add("MC/Rec/TpcTpc/HadronHadron/SameEvent/hEtaPhi", "multiplicity vs eta vs phi", {HistType::kTH3F, {{200, 0, 200, "multiplicity"}, {100, -2, 2, "#eta"}, {200, 0, TwoPI, "#varphi"}}}); + registry.add("MC/Rec/TpcTpc/HadronHadron/SameEvent/hNtracks", "hNtracks", {HistType::kTH1F, {{500, 0, 500}}}); + // histograms for MC particles in event mixing + registry.add("MC/Rec/TpcTpc/HadronHadron/MixedEvent/hEventCountMixing", "bin", {HistType::kTH1F, {{nBinsMix + 2, -2.5, -0.5 + nBinsMix, "bin"}}}); + registry.add("MC/Rec/TpcTpc/HadronHadron/MixedEvent/hMultiplicityMixing", "hMultiplicityMixing", {HistType::kTH1F, {{500, 0, 500}}}); + registry.add("MC/Rec/TpcTpc/HadronHadron/MixedEvent/hVtxZMixing", "hVtxZMixing", {HistType::kTH1F, {{100, -10, 10}}}); + registry.add("MC/Rec/TpcTpc/HadronHadron/MixedEvent/hPtMixing", "pT", {HistType::kTH1F, {{100, 0, 10, "p_{T}"}}}); + registry.add("MC/Rec/TpcTpc/HadronHadron/MixedEvent/hEtaMixing", "eta", {HistType::kTH1F, {{100, -4, 4, "#eta"}}}); + registry.add("MC/Rec/TpcTpc/HadronHadron/MixedEvent/hPhiMixing", "phi", {HistType::kTH1F, {{100, 0, TwoPI, "#varphi"}}}); + registry.add("MC/Rec/TpcTpc/HadronHadron/MixedEvent/hNtracksMixing", "hNtracksMixing", {HistType::kTH1F, {{500, 0, 500}}}); + + // MC Truth + + registry.add("MC/Gen/TpcTpc/HadronHadron/SameEvent/hMultiplicity", "hMultiplicity", {HistType::kTH1F, {{500, 0, 500}}}); + registry.add("MC/Gen/TpcTpc/HadronHadron/SameEvent/hVtxZ", "hVtxZ", {HistType::kTH1F, {{400, -50, 50}}}); + registry.add("MC/Gen/TpcTpc/HadronHadron/SameEvent/hEventCountSame", "hNtracks", {HistType::kTH1F, {{500, 0, 500}}}); + // Katarina had this : + registry.add("MC/Gen/TpcTpc/HadronHadron/SameEvent/hMultiplicityPrimary", "hMultiplicityPrimary", {HistType::kTH1F, {{500, 0, 500}}}); + // histograms for MC associated particles + registry.add("MC/Gen/TpcTpc/HadronHadron/SameEvent/hPt", "pT", {HistType::kTH1F, {{100, 0, 10, "p_{T}"}}}); + registry.add("MC/Gen/TpcTpc/HadronHadron/SameEvent/hEta", "eta", {HistType::kTH1F, {{100, -4, 4, "#eta"}}}); + registry.add("MC/Gen/TpcTpc/HadronHadron/SameEvent/hPhi", "phi", {HistType::kTH1F, {{100, 0, TwoPI, "#varphi"}}}); + registry.add("MC/Gen/TpcTpc/HadronHadron/SameEvent/hYields", "multiplicity vs pT vs eta", {HistType::kTH3F, {{200, 0, 200, "multiplicity"}, {40, 0, 20, "p_{T}"}, {100, -2, 2, "#eta"}}}); + registry.add("MC/Gen/TpcTpc/HadronHadron/SameEvent/hEtaPhi", "multiplicity vs eta vs phi", {HistType::kTH3F, {{200, 0, 200, "multiplicity"}, {100, -2, 2, "#eta"}, {200, 0, TwoPI, "#varphi"}}}); + registry.add("MC/Gen/TpcTpc/HadronHadron/SameEvent/hNtracks", "hNtracks", {HistType::kTH1F, {{500, 0, 500}}}); + // histograms for MC particles in event mixing + registry.add("MC/Gen/TpcTpc/HadronHadron/MixedEvent/hEventCountMixing", "bin", {HistType::kTH1F, {{nBinsMix + 2, -2.5, -0.5 + nBinsMix, "bin"}}}); + registry.add("MC/Gen/TpcTpc/HadronHadron/MixedEvent/hMultiplicityMixing", "hMultiplicityMixing", {HistType::kTH1F, {{500, 0, 500}}}); + registry.add("MC/Gen/TpcTpc/HadronHadron/MixedEvent/hVtxZMixing", "hVtxZMixing", {HistType::kTH1F, {{100, -10, 10}}}); + registry.add("MC/Gen/TpcTpc/HadronHadron/MixedEvent/hPtMixing", "pT", {HistType::kTH1F, {{100, 0, 10, "p_{T}"}}}); + registry.add("MC/Gen/TpcTpc/HadronHadron/MixedEvent/hEtaMixing", "eta", {HistType::kTH1F, {{100, -4, 4, "#eta"}}}); + registry.add("MC/Gen/TpcTpc/HadronHadron/MixedEvent/hPhiMixing", "phi", {HistType::kTH1F, {{100, 0, TwoPI, "#varphi"}}}); + registry.add("MC/Gen/TpcTpc/HadronHadron/MixedEvent/hNtracksMixing", "hNtracksMixing", {HistType::kTH1F, {{500, 0, 500}}}); + + // ========================= + // Declaration of correlation containers and their respective axis + // ========================= + std::vector corrAxis = {{axisDeltaEta, "#Delta#eta"}, {axisPtAssoc, "p_{T} (GeV/c)"}, {axisPtTrigger, "p_{T} (GeV/c)"}, @@ -195,107 +426,286 @@ struct HfTaskFlow { {axisVertexEfficiency, "z-vtx (cm)"}}; std::vector userAxis = {{axisMass, "m_{inv} (GeV/c^{2})"}}; + // initialization of correlation containers for data sameTPCTPCChCh.setObject(new CorrelationContainer("sameTPCTPCChCh", "sameTPCTPCChCh", corrAxis, effAxis, {})); mixedTPCTPCChCh.setObject(new CorrelationContainer("mixedTPCTPCChCh", "mixedTPCTPCChCh", corrAxis, effAxis, {})); sameTPCTPCHfCh.setObject(new CorrelationContainer("sameTPCTPCHfCh", "sameTPCTPCHfCh", corrAxis, effAxis, userAxis)); mixedTPCTPCHfCh.setObject(new CorrelationContainer("mixedTPCTPCHfCh", "mixedTPCTPCHfCh", corrAxis, effAxis, userAxis)); sameTPCMFTChCh.setObject(new CorrelationContainer("sameTPCMFTChCh", "sameTPCMFTChCh", corrAxis, effAxis, {})); mixedTPCMFTChCh.setObject(new CorrelationContainer("mixedTPCMFTChCh", "mixedTPCMFTChCh", corrAxis, effAxis, {})); - } + sameTPCMFTHfCh.setObject(new CorrelationContainer("sameTPCMFTHfCh", "sameTPCMFTHfCh", corrAxis, effAxis, userAxis)); + mixedTPCMFTHfCh.setObject(new CorrelationContainer("mixedTPCMFTHfCh", "mixedTPCMFTHfCh", corrAxis, effAxis, userAxis)); - // --------------- + // initialization of correlation containes for monte-carlo + sameTPCTPCChChMC.setObject(new CorrelationContainer("sameTPCTPCChChMC", "sameTPCTPCChChMC", corrAxis, effAxis, {})); + mixedTPCTPCChChMC.setObject(new CorrelationContainer("mixedTPCTPCChChMC", "mixedTPCTPCChChMC", corrAxis, effAxis, {})); + } // End of init() function + + // ========================= // templates // FIXME: Some collisions are rejected here, what causes (part of) differences with the D0 task - // --------------- + // ========================= template bool isCollisionSelected(TCollision const& collision, bool fillHistograms = false) { - if (processRun2 == true) { - // Run 2: trigger selection for data case - if (fillHistograms) - registry.fill(HIST("Data/hEventCounter"), 1); - if (!processMc) { - if (!collision.alias_bit(kINT7)) { - return false; - } - } - // Run 2: further offline selection - if (fillHistograms) - registry.fill(HIST("Data/hEventCounter"), 2); - if (!collision.sel7()) { - return false; - } - if (fillHistograms) - registry.fill(HIST("Data/hEventCounter"), 3); - } else { - // Run 3: selection - if (fillHistograms) - registry.fill(HIST("Data/hEventCounter"), 1); + if (fillHistograms) + registry.fill(HIST("Data/hEventCounter"), 1); + + if (processMc == false) { if (!collision.sel8()) { return false; } - if (fillHistograms) - registry.fill(HIST("Data/hEventCounter"), 3); } + + if (fillHistograms) + registry.fill(HIST("Data/hEventCounter"), 3); + return true; } + // ========================= + // Quality Assesment plots + // ========================= + + // ---- DATA : TPC-TPC h-h Same Event QA ---- template - void fillQA(float multiplicity, TTracks const& tracks) + void fillTpcTpcChChSameEventQa(float multiplicity, TTracks const& tracks) { - int Ntracks = 0; + int nTracks = tracks.size(); for (const auto& track1 : tracks) { - Ntracks++; registry.fill(HIST("Data/TpcTpc/HadronHadron/SameEvent/hPt"), track1.pt()); registry.fill(HIST("Data/TpcTpc/HadronHadron/SameEvent/hEta"), track1.eta()); registry.fill(HIST("Data/TpcTpc/HadronHadron/SameEvent/hPhi"), track1.phi()); registry.fill(HIST("Data/TpcTpc/HadronHadron/SameEvent/hYields"), multiplicity, track1.pt(), track1.eta()); registry.fill(HIST("Data/TpcTpc/HadronHadron/SameEvent/hEtaPhi"), multiplicity, track1.eta(), track1.phi()); } - registry.fill(HIST("Data/TpcTpc/HadronHadron/SameEvent/hNtracks"), Ntracks); + registry.fill(HIST("Data/TpcTpc/HadronHadron/SameEvent/hNtracks"), nTracks); + } + + // ---- MC : TPC-TPC h-h Same Event QA ---- + // Changed quickly void for int type + added the return for a test + template + int fillTpcTpcChChSameEventQaMc(float multiplicity, TTracks const& tracks) + { + int nTracks = tracks.size(); + for (const auto& track1 : tracks) { + + // in case of MC-generated, do additional selection on MCparticles : charge and isPhysicalPrimary + if constexpr (std::is_same_v) { + if (!isMcParticleSelected(track1)) { + continue; + } + // TO-DO : add other if constexpr conditions when I will have more MC cases + } + + if constexpr (std::is_same_v) { // if MC Rec + registry.fill(HIST("MC/Rec/TpcTpc/HadronHadron/SameEvent/hPt"), track1.pt()); + registry.fill(HIST("MC/Rec/TpcTpc/HadronHadron/SameEvent/hEta"), track1.eta()); + registry.fill(HIST("MC/Rec/TpcTpc/HadronHadron/SameEvent/hPhi"), track1.phi()); + registry.fill(HIST("MC/Rec/TpcTpc/HadronHadron/SameEvent/hYields"), multiplicity, track1.pt(), track1.eta()); + registry.fill(HIST("MC/Rec/TpcTpc/HadronHadron/SameEvent/hEtaPhi"), multiplicity, track1.eta(), track1.phi()); + } else { // if MC Gen + registry.fill(HIST("MC/Gen/TpcTpc/HadronHadron/SameEvent/hPt"), track1.pt()); + registry.fill(HIST("MC/Gen/TpcTpc/HadronHadron/SameEvent/hEta"), track1.eta()); + registry.fill(HIST("MC/Gen/TpcTpc/HadronHadron/SameEvent/hPhi"), track1.phi()); + registry.fill(HIST("MC/Gen/TpcTpc/HadronHadron/SameEvent/hYields"), multiplicity, track1.pt(), track1.eta()); + registry.fill(HIST("MC/Gen/TpcTpc/HadronHadron/SameEvent/hEtaPhi"), multiplicity, track1.eta(), track1.phi()); + } + } + if constexpr (std::is_same_v) { // if MC Rec + registry.fill(HIST("MC/Rec/TpcTpc/HadronHadron/SameEvent/hNtracks"), nTracks); + registry.fill(HIST("MC/Rec/TpcTpc/HadronHadron/SameEvent/hMultiplicityPrimary"), nTracks); + } else { // if MC Gen + registry.fill(HIST("MC/Gen/TpcTpc/HadronHadron/SameEvent/hNtracks"), nTracks); + registry.fill(HIST("MC/Gen/TpcTpc/HadronHadron/SameEvent/hMultiplicityPrimary"), nTracks); + } + return nTracks; } + // ---- DATA : TPC-TPC h-h Mixed Event QA ---- template - void fillMixingQA(float multiplicity, float vz, TTracks const& tracks) + void fillTpcTpcChChMixedEventQa(float multiplicity, float vz, TTracks const& tracks) { registry.fill(HIST("Data/TpcTpc/HadronHadron/MixedEvent/hMultiplicityMixing"), multiplicity); registry.fill(HIST("Data/TpcTpc/HadronHadron/MixedEvent/hVtxZMixing"), vz); - int Ntracks = 0; + int nTracks = tracks.size(); for (const auto& track1 : tracks) { - Ntracks++; registry.fill(HIST("Data/TpcTpc/HadronHadron/MixedEvent/hPtMixing"), track1.pt()); registry.fill(HIST("Data/TpcTpc/HadronHadron/MixedEvent/hEtaMixing"), track1.eta()); registry.fill(HIST("Data/TpcTpc/HadronHadron/MixedEvent/hPhiMixing"), track1.phi()); } - registry.fill(HIST("Data/TpcTpc/HadronHadron/MixedEvent/hNtracksMixing"), Ntracks); + registry.fill(HIST("Data/TpcTpc/HadronHadron/MixedEvent/hNtracksMixing"), nTracks); + } + + // ---- MC : TPC-TPC h-h Mixed Event QA ---- + template + void fillTpcTpcChChMixedEventQaMc(float multiplicity, float vz, TTracks const& tracks) + { + if constexpr (std::is_same_v) { // if MC Rec + registry.fill(HIST("MC/Rec/TpcTpc/HadronHadron/MixedEvent/hMultiplicityMixing"), multiplicity); + registry.fill(HIST("MC/Rec/TpcTpc/HadronHadron/MixedEvent/hVtxZMixing"), vz); + } else { // if MC Gen + registry.fill(HIST("MC/Gen/TpcTpc/HadronHadron/MixedEvent/hMultiplicityMixing"), multiplicity); + registry.fill(HIST("MC/Gen/TpcTpc/HadronHadron/MixedEvent/hVtxZMixing"), vz); + } + + int nTracks = tracks.size(); + for (const auto& track1 : tracks) { + if constexpr (std::is_same_v) { // if MC Rec + registry.fill(HIST("MC/Rec/TpcTpc/HadronHadron/MixedEvent/hPtMixing"), track1.pt()); + registry.fill(HIST("MC/Rec/TpcTpc/HadronHadron/MixedEvent/hEtaMixing"), track1.eta()); + registry.fill(HIST("MC/Rec/TpcTpc/HadronHadron/MixedEvent/hPhiMixing"), track1.phi()); + } else { // if MC Gen + registry.fill(HIST("MC/Gen/TpcTpc/HadronHadron/MixedEvent/hPtMixing"), track1.pt()); + registry.fill(HIST("MC/Gen/TpcTpc/HadronHadron/MixedEvent/hEtaMixing"), track1.eta()); + registry.fill(HIST("MC/Gen/TpcTpc/HadronHadron/MixedEvent/hPhiMixing"), track1.phi()); + } + } + if constexpr (std::is_same_v) { // if MC Rec + registry.fill(HIST("MC/Rec/TpcTpc/HadronHadron/MixedEvent/hNtracksMixing"), nTracks); + } else { // if MC Gen + registry.fill(HIST("MC/Gen/TpcTpc/HadronHadron/MixedEvent/hNtracksMixing"), nTracks); + } } + // ---- DATA : TPC-TPC HF-h Mixed Event QA ---- template - void fillHFMixingQA(float multiplicity, float vz, TTracks const& tracks) + void fillTpcTpcHfChMixedEventQa(float multiplicity, float vz, TTracks const& tracks) { registry.fill(HIST("Data/TpcTpc/HfHadron/MixedEvent/hMultiplicityHFMixing"), multiplicity); registry.fill(HIST("Data/TpcTpc/HfHadron/MixedEvent/hVtxZHFMixing"), vz); - int Ntracks = 0; + int nTracks = tracks.size(); for (const auto& track1 : tracks) { - Ntracks++; registry.fill(HIST("Data/TpcTpc/HfHadron/MixedEvent/hPtHFMixing"), track1.pt()); registry.fill(HIST("Data/TpcTpc/HfHadron/MixedEvent/hEtaHFMixing"), track1.eta()); registry.fill(HIST("Data/TpcTpc/HfHadron/MixedEvent/hPhiHFMixing"), track1.phi()); } - registry.fill(HIST("Data/TpcTpc/HfHadron/MixedEvent/hNtracksHFMixing"), Ntracks); + registry.fill(HIST("Data/TpcTpc/HfHadron/MixedEvent/hNtracksHFMixing"), nTracks); } + // ---- DATA : TPC-MFT h-h Same Event QA ---- template - void fillMFTQA(float multiplicity, TTracks const& tracks) + void fillTpcMftChChSameEventQa(float multiplicity, TTracks const& tracks) { + int nTracks = tracks.size(); + bool isMFT = false; for (const auto& track1 : tracks) { - registry.fill(HIST("Data/TpcMft/HadronHadron/hEtaMFT"), track1.eta()); - float phi = track1.phi(); - o2::math_utils::bringTo02Pi(phi); - registry.fill(HIST("Data/TpcMft/HadronHadron/hPhiMFT"), phi); - registry.fill(HIST("Data/TpcMft/HadronHadron/hEtaPhiMFT"), multiplicity, track1.eta(), phi); + if constexpr (std::is_same_v) { // if MFT tracks + isMFT = true; + registry.fill(HIST("Data/TpcMft/HadronHadron/SameEvent/hEtaMFT"), track1.eta()); + float phi = track1.phi(); + o2::math_utils::bringTo02Pi(phi); + registry.fill(HIST("Data/TpcMft/HadronHadron/SameEvent/hPhiMFT"), phi); + registry.fill(HIST("Data/TpcMft/HadronHadron/SameEvent/hEtaPhiMFT"), multiplicity, track1.eta(), phi); + registry.fill(HIST("Data/TpcMft/HadronHadron/SameEvent/hPtMFT"), track1.pt()); + registry.fill(HIST("Data/TpcMft/HadronHadron/SameEvent/hYieldsMFT"), multiplicity, track1.pt(), track1.eta()); + } else { // if TPC tracks + registry.fill(HIST("Data/TpcMft/HadronHadron/SameEvent/hEtaTPC"), track1.eta()); + float phi = track1.phi(); + o2::math_utils::bringTo02Pi(phi); + registry.fill(HIST("Data/TpcMft/HadronHadron/SameEvent/hPhiTPC"), phi); + registry.fill(HIST("Data/TpcMft/HadronHadron/SameEvent/hEtaPhiTPC"), multiplicity, track1.eta(), phi); + registry.fill(HIST("Data/TpcMft/HadronHadron/SameEvent/hPtTPC"), track1.pt()); + registry.fill(HIST("Data/TpcMft/HadronHadron/SameEvent/hYieldsTPC"), multiplicity, track1.pt(), track1.eta()); + } + if (isMFT) { + registry.fill(HIST("Data/TpcTpc/HadronHadron/SameEvent/hNtracksMFT"), nTracks); + } else { + registry.fill(HIST("Data/TpcTpc/HadronHadron/SameEvent/hNtracksTPC"), nTracks); + } + } + } + + // ---- DATA : TPC-MFT HF-h Same Event QA ---- + template + void fillTpcMftHfChSameEventQa(float multiplicity, TTracks const& tracks) + { + int nTracks = tracks.size(); + bool isMFT = false; + for (const auto& track1 : tracks) { + if constexpr (std::is_same_v) { // if MFT tracks + isMFT = true; + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/SameEvent/hEtaMFT"), track1.eta()); + float phi = track1.phi(); + o2::math_utils::bringTo02Pi(phi); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/SameEvent/hPhiMFT"), phi); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/SameEvent/hEtaPhiMFT"), multiplicity, track1.eta(), phi); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/SameEvent/hPtMFT"), track1.pt()); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/SameEvent/hYieldsMFT"), multiplicity, track1.pt(), track1.eta()); + } else { // if TPC tracks + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/SameEvent/hEtaCandidate"), track1.eta()); + float phi = track1.phi(); + o2::math_utils::bringTo02Pi(phi); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/SameEvent/hPhiCandidate"), phi); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/SameEvent/hEtaPhiCandidate"), multiplicity, track1.eta(), phi); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/SameEvent/hPtCandidate"), track1.pt()); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/SameEvent/hYieldsCandidate"), multiplicity, track1.pt(), track1.eta()); + } + if (isMFT) { + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/SameEvent/hNtracksMFT"), nTracks); + } else { + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/SameEvent/hNtracksCandidate"), nTracks); + } + } + } + + // ---- DATA : TPC-MFT h-h Mixed Event QA ---- + template + void fillTpcMftChChMixedEventQa(float multiplicity, float vz, TTracks const& tracks) + { + if constexpr (std::is_same_v) { // if MFT tracks + registry.fill(HIST("Data/TpcMft/HadronHadron/MixedEvent/hMultiplicityMixingMFT"), multiplicity); + registry.fill(HIST("Data/TpcMft/HadronHadron/MixedEvent/hVtxZMixingMFT"), vz); + + int nTracks = tracks.size(); + for (const auto& track1 : tracks) { + registry.fill(HIST("Data/TpcMft/HadronHadron/MixedEvent/hPtMixingMFT"), track1.pt()); + registry.fill(HIST("Data/TpcMft/HadronHadron/MixedEvent/hEtaMixingMFT"), track1.eta()); + registry.fill(HIST("Data/TpcMft/HadronHadron/MixedEvent/hPhiMixingMFT"), track1.phi()); + } + registry.fill(HIST("Data/TpcMft/HadronHadron/MixedEvent/hNtracksMixingMFT"), nTracks); + } else { // if TPC tracks + registry.fill(HIST("Data/TpcMft/HadronHadron/MixedEvent/hMultiplicityMixingTPC"), multiplicity); + registry.fill(HIST("Data/TpcMft/HadronHadron/MixedEvent/hVtxZMixingTPC"), vz); + + int nTracks = tracks.size(); + for (const auto& track1 : tracks) { + registry.fill(HIST("Data/TpcMft/HadronHadron/MixedEvent/hPtMixingTPC"), track1.pt()); + registry.fill(HIST("Data/TpcMft/HadronHadron/MixedEvent/hEtaMixingTPC"), track1.eta()); + registry.fill(HIST("Data/TpcMft/HadronHadron/MixedEvent/hPhiMixingTPC"), track1.phi()); + } + registry.fill(HIST("Data/TpcMft/HadronHadron/MixedEvent/hNtracksMixingTPC"), nTracks); + } + } + + // ---- DATA : TPC-MFT h-h Mixed Event QA ---- + template + void fillTpcMftHfChMixedEventQa(float multiplicity, float vz, TTracks const& tracks) + { + if constexpr (std::is_same_v) { // if MFT tracks + registry.fill(HIST("Data/TpcMft/HfHadron/MixedEvent/hMultiplicityMixingMFT"), multiplicity); + registry.fill(HIST("Data/TpcMft/HfHadron/MixedEvent/hVtxZMixingMFT"), vz); + + int nTracks = tracks.size(); + for (const auto& track1 : tracks) { + registry.fill(HIST("Data/TpcMft/HfHadron/MixedEvent/hPtMixingMFT"), track1.pt()); + registry.fill(HIST("Data/TpcMft/HfHadron/MixedEvent/hEtaMixingMFT"), track1.eta()); + registry.fill(HIST("Data/TpcMft/HfHadron/MixedEvent/hPhiMixingMFT"), track1.phi()); + } + registry.fill(HIST("Data/TpcMft/HfHadron/MixedEvent/hNtracksMixingMFT"), nTracks); + } else { // if candidate tracks + registry.fill(HIST("Data/TpcMft/HfHadron/MixedEvent/hMultiplicityMixingCandidate"), multiplicity); + registry.fill(HIST("Data/TpcMft/HfHadron/MixedEvent/hVtxZMixingCandidate"), vz); + + int nTracks = tracks.size(); + for (const auto& track1 : tracks) { + registry.fill(HIST("Data/TpcMft/HfHadron/MixedEvent/hPtMixingCandidate"), track1.pt()); + registry.fill(HIST("Data/TpcMft/HfHadron/MixedEvent/hEtaMixingCandidate"), track1.eta()); + registry.fill(HIST("Data/TpcMft/HfHadron/MixedEvent/hPhiMixingCandidate"), track1.phi()); + } + registry.fill(HIST("Data/TpcMft/HfHadron/MixedEvent/hNtracksMixingCandidate"), nTracks); } } @@ -312,9 +722,68 @@ struct HfTaskFlow { return true; } + // I am not sure if to template McParticles is useful, I'll address this when doing the MC Gen case of HF-h correlations + template + bool isMcParticleSelected(TMcParticles& mcParticles) + { + // remove MC particles with charge = 0 + TParticlePDG* pdgparticle = pdg->GetParticle(mcParticles.pdgCode()); + if (pdgparticle != nullptr) { + if (pdgparticle->Charge() == 0) { + return false; + } + } + + // MC particle has to be primary + if constexpr (step <= CorrelationContainer::kCFStepAnaTopology) { + return mcParticles.isPhysicalPrimary(); + } + return true; + } + + // ---- DATA : TPC-TPC HF-h Same Event (Candidates) QA ---- + // TODO: Note: we do not need all these plots since they are in D0 and Lc task -> remove it after we are sure this works + template + void fillTpcTpcCandidateQa(TTracks const& candidates) + { + for (const auto& candidate : candidates) { + if (!isAcceptedCandidate(candidate)) { + continue; + } + + if (candidate.isSelD0() >= selectionFlagD0) { + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/hMassVsPt"), hfHelper.invMassD0ToPiK(candidate), candidate.pt()); + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/hMass"), hfHelper.invMassD0ToPiK(candidate)); + } + if (candidate.isSelD0bar() >= selectionFlagD0bar) { + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/hMassVsPt"), hfHelper.invMassD0barToKPi(candidate), candidate.pt()); + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/hMass"), hfHelper.invMassD0barToKPi(candidate)); + } + + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/hPtCand"), candidate.pt()); + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/hPtProng0"), candidate.ptProng0()); + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/hPtProng1"), candidate.ptProng1()); + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/hDecLength"), candidate.decayLength(), candidate.pt()); + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/hDecLengthXY"), candidate.decayLengthXY(), candidate.pt()); + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/hd0Prong0"), candidate.impactParameter0(), candidate.pt()); + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/hd0Prong1"), candidate.impactParameter1(), candidate.pt()); + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/hd0d0"), candidate.impactParameterProduct(), candidate.pt()); + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/hCTS"), hfHelper.cosThetaStarD0(candidate), candidate.pt()); + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/hCt"), hfHelper.ctD0(candidate), candidate.pt()); + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/hCPA"), candidate.cpa(), candidate.pt()); + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/hEtaCand"), candidate.eta(), candidate.pt()); + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/hSelectionStatus"), candidate.isSelD0() + (candidate.isSelD0bar() * 2), candidate.pt()); + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/hImpParErr"), candidate.errorImpactParameter0(), candidate.pt()); + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/hImpParErr"), candidate.errorImpactParameter1(), candidate.pt()); + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/hDecLenErr"), candidate.errorDecayLength(), candidate.pt()); + registry.fill(HIST("Data/TpcTpc/HfHadron/SameEvent/hDecLenXYErr"), candidate.errorDecayLengthXY(), candidate.pt()); + } + } + + // ---- DATA : TPC-MFT HF-h Same Event (Candidates) QA ---- // TODO: Note: we do not need all these plots since they are in D0 and Lc task -> remove it after we are sure this works template - void fillCandidateQA(TTracks const& candidates) + void fillTpcMftCandidateQa(TTracks const& candidates) { for (const auto& candidate : candidates) { if (!isAcceptedCandidate(candidate)) { @@ -322,33 +791,39 @@ struct HfTaskFlow { } if (candidate.isSelD0() >= selectionFlagD0) { - registry.fill(HIST("Data/TpcTpc/HfHadron/hMass"), hfHelper.invMassD0ToPiK(candidate), candidate.pt()); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/hMassVsPt"), hfHelper.invMassD0ToPiK(candidate), candidate.pt()); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/hMass"), hfHelper.invMassD0ToPiK(candidate)); } if (candidate.isSelD0bar() >= selectionFlagD0bar) { - registry.fill(HIST("Data/TpcTpc/HfHadron/hMass"), hfHelper.invMassD0barToKPi(candidate), candidate.pt()); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/hMassVsPt"), hfHelper.invMassD0barToKPi(candidate), candidate.pt()); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/hMass"), hfHelper.invMassD0barToKPi(candidate)); } - registry.fill(HIST("Data/TpcTpc/HfHadron/hPtCand"), candidate.pt()); - registry.fill(HIST("Data/TpcTpc/HfHadron/hPtProng0"), candidate.ptProng0()); - registry.fill(HIST("Data/TpcTpc/HfHadron/hPtProng1"), candidate.ptProng1()); - registry.fill(HIST("Data/TpcTpc/HfHadron/hDecLength"), candidate.decayLength(), candidate.pt()); - registry.fill(HIST("Data/TpcTpc/HfHadron/hDecLengthXY"), candidate.decayLengthXY(), candidate.pt()); - registry.fill(HIST("Data/TpcTpc/HfHadron/hd0Prong0"), candidate.impactParameter0(), candidate.pt()); - registry.fill(HIST("Data/TpcTpc/HfHadron/hd0Prong1"), candidate.impactParameter1(), candidate.pt()); - registry.fill(HIST("Data/TpcTpc/HfHadron/hd0d0"), candidate.impactParameterProduct(), candidate.pt()); - registry.fill(HIST("Data/TpcTpc/HfHadron/hCTS"), hfHelper.cosThetaStarD0(candidate), candidate.pt()); - registry.fill(HIST("Data/TpcTpc/HfHadron/hCt"), hfHelper.ctD0(candidate), candidate.pt()); - registry.fill(HIST("Data/TpcTpc/HfHadron/hCPA"), candidate.cpa(), candidate.pt()); - registry.fill(HIST("Data/TpcTpc/HfHadron/hEtaCand"), candidate.eta(), candidate.pt()); - registry.fill(HIST("Data/TpcTpc/HfHadron/hSelectionStatus"), candidate.isSelD0() + (candidate.isSelD0bar() * 2), candidate.pt()); - registry.fill(HIST("Data/TpcTpc/HfHadron/hImpParErr"), candidate.errorImpactParameter0(), candidate.pt()); - registry.fill(HIST("Data/TpcTpc/HfHadron/hImpParErr"), candidate.errorImpactParameter1(), candidate.pt()); - registry.fill(HIST("Data/TpcTpc/HfHadron/hDecLenErr"), candidate.errorDecayLength(), candidate.pt()); - registry.fill(HIST("Data/TpcTpc/HfHadron/hDecLenXYErr"), candidate.errorDecayLengthXY(), candidate.pt()); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/hPtCand"), candidate.pt()); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/hPtProng0"), candidate.ptProng0()); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/hPtProng1"), candidate.ptProng1()); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/hDecLength"), candidate.decayLength(), candidate.pt()); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/hDecLengthXY"), candidate.decayLengthXY(), candidate.pt()); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/hd0Prong0"), candidate.impactParameter0(), candidate.pt()); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/hd0Prong1"), candidate.impactParameter1(), candidate.pt()); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/hd0d0"), candidate.impactParameterProduct(), candidate.pt()); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/hCTS"), hfHelper.cosThetaStarD0(candidate), candidate.pt()); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/hCt"), hfHelper.ctD0(candidate), candidate.pt()); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/hCPA"), candidate.cpa(), candidate.pt()); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/hEtaCand"), candidate.eta(), candidate.pt()); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/hSelectionStatus"), candidate.isSelD0() + (candidate.isSelD0bar() * 2), candidate.pt()); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/hImpParErr"), candidate.errorImpactParameter0(), candidate.pt()); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/hImpParErr"), candidate.errorImpactParameter1(), candidate.pt()); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/hDecLenErr"), candidate.errorDecayLength(), candidate.pt()); + registry.fill(HIST("Data/TpcMft/HfHadron/SameEvent/hDecLenXYErr"), candidate.errorDecayLengthXY(), candidate.pt()); } } - template + // ========================= + // Correlation functions + // ========================= + + template void fillCorrelations(TTarget target, TTracksTrig const& tracks1, TTracksAssoc const& tracks2, float multiplicity, float posZ) { auto triggerWeight = 1; @@ -365,6 +840,7 @@ struct HfTaskFlow { // calculating inv. mass to be filled into the container below // Note: this is needed only in case of HF-hadron correlations + // TO DO ? Add one more if condition if its MC ? bool fillingHFcontainer = false; double invmass = 0; if constexpr (std::is_same_v) { @@ -376,11 +852,22 @@ struct HfTaskFlow { invmass = hfHelper.invMassD0ToPiK(track1); } + // From Katarina's code + // in case of MC-generated, do additional selection on MCparticles : charge and isPhysicalPrimary + // if (processMc) { + // NOTE : this version with FilteredMcParticles is only for Katarina's way of doing MC + if constexpr (std::is_same_v || std::is_same_v) { + if (!isMcParticleSelected(track1)) { + continue; + } + // TO-DO : add other if constexpr conditions when I will have more MC cases + } + // fill single-track distributions if (!fillingHFcontainer) { - target->getTriggerHist()->Fill(CorrelationContainer::kCFStepReconstructed, pt1, multiplicity, posZ, triggerWeight); + target->getTriggerHist()->Fill(step, pt1, multiplicity, posZ, triggerWeight); } else { - target->getTriggerHist()->Fill(CorrelationContainer::kCFStepReconstructed, pt1, multiplicity, posZ, invmass, triggerWeight); + target->getTriggerHist()->Fill(step, pt1, multiplicity, posZ, invmass, triggerWeight); } for (const auto& track2 : tracks2) { @@ -394,13 +881,22 @@ struct HfTaskFlow { } // in case of HF-h correlations, remove candidate daughters from the pool of associated hadrons - // with which the candidate is being correlated + // with which the candidate is being correlated (will not have to do it for TPC-MFT case) if constexpr (std::is_same_v) { if ((track1.prong0Id() == track2.globalIndex()) || (track1.prong1Id() == track2.globalIndex())) { continue; } } + // in case of MC-generated, do additional selection on MCparticles : charge and isPhysicalPrimary + // if (processMc) { + if constexpr (std::is_same_v || std::is_same_v) { + if (!isMcParticleSelected(track2)) { + continue; + } + // Note : no need for HF if condition as this will always be normal track, but maybe for MFT + } + float eta2 = track2.eta(); float pt2 = track2.pt(); float phi2 = track2.phi(); @@ -416,57 +912,133 @@ struct HfTaskFlow { if (!fillingHFcontainer) { // fill pair correlations - target->getPairHist()->Fill(CorrelationContainer::kCFStepReconstructed, - eta1 - eta2, pt2, pt1, multiplicity, deltaPhi, posZ, + target->getPairHist()->Fill(step, eta1 - eta2, pt2, pt1, multiplicity, deltaPhi, posZ, triggerWeight * associatedWeight); } else { - target->getPairHist()->Fill(CorrelationContainer::kCFStepReconstructed, - eta1 - eta2, pt2, pt1, multiplicity, deltaPhi, posZ, invmass, + target->getPairHist()->Fill(step, eta1 - eta2, pt2, pt1, multiplicity, deltaPhi, posZ, invmass, triggerWeight * associatedWeight); } } } } - template - void mixCollisions(FilteredCollisionsWSelMult const& collisions, TTracksTrig const& tracks1, TTracksAssoc const& tracks2, TLambda getPartsSize, OutputObj& corrContainer) + // template + // void mixCollisions(FilteredCollisionsWSelMult const& collisions, TTracksTrig const& tracks1, TTracksAssoc const& tracks2, TLambda getPartsSize, OutputObj& corrContainer) + template + void mixCollisions(TCollisions const& collisions, TTracksTrig const& tracks1, TTracksAssoc const& tracks2, TLambda getPartsSize, OutputObj& corrContainer) { - using BinningType = FlexibleBinningPolicy, aod::collision::PosZ, decltype(getPartsSize)>; - BinningType binningWithTracksSize{{getPartsSize}, {axisVertex, axisMultiplicity}, true}; + // The first one that I call "Data" should work for data and mc rec + using BinningTypeData = FlexibleBinningPolicy, aod::collision::PosZ, decltype(getPartsSize)>; + + BinningTypeData binningWithTracksSize{{getPartsSize}, {axisVertex, axisMultiplicity}, true}; auto tracksTuple = std::make_tuple(tracks1, tracks2); - Pair pair{binningWithTracksSize, nMixedEvents, -1, collisions, tracksTuple, &cache}; + Pair pair{binningWithTracksSize, nMixedEvents, -1, collisions, tracksTuple, &cache}; for (const auto& [collision1, tracks1, collision2, tracks2] : pair) { - if (!(isCollisionSelected(collision1, false))) { - continue; - } - if (!(isCollisionSelected(collision2, false))) { - continue; + if constexpr (!std::is_same_v) { + if (!(isCollisionSelected(collision1, false))) { + continue; + } + if (!(isCollisionSelected(collision2, false))) { + continue; + } } auto binningValues = binningWithTracksSize.getBinningValues(collision1, collisions); int bin = binningWithTracksSize.getBin(binningValues); - const auto multiplicity = tracks2.size(); // get multiplicity of charged hadrons, which is used for slicing in mixing + const auto multiplicityTracks2 = tracks2.size(); // get multiplicity of charged hadrons, which is used for slicing in mixing + const auto multiplicityTracks1 = tracks1.size(); // get multiplicity of charged hadrons, which is used for slicing in mixing const auto vz = collision1.posZ(); - if constexpr (std::is_same_v) { - registry.fill(HIST("Data/TpcTpc/HfHadron/MixedEvent/hEventCountHFMixing"), bin); - fillHFMixingQA(multiplicity, vz, tracks1); - } else { - registry.fill(HIST("Data/TpcTpc/HadronHadron/MixedEvent/hEventCountMixing"), bin); - fillMixingQA(multiplicity, vz, tracks1); + if constexpr (std::is_same_v) { // If MC + registry.fill(HIST("MC/Rec/TpcTpc/HadronHadron/MixedEvent/hEventCountMixing"), bin); + fillTpcTpcChChMixedEventQaMc(multiplicityTracks2, vz, tracks1); + + // if constexpr (std::is_same_v) { + // registry.fill(HIST("Data/TpcTpc/HfHadron/MixedEvent/hEventCountHFMixing"), bin); + // fillHFMixingQA(multiplicity, vz, tracks1); + // } else { + // registry.fill(HIST("Data/TpcTpc/HadronHadron/MixedEvent/hEventCountMixing"), bin); + // fillMixingQA(multiplicity, vz, tracks1); + // } + + } else { // If not MC + if constexpr (std::is_same_v) { // DATA : If TPC-TPC Hf-h case + registry.fill(HIST("Data/TpcTpc/HfHadron/MixedEvent/hEventCountHFMixing"), bin); + fillTpcTpcHfChMixedEventQa(multiplicityTracks2, vz, tracks1); + } else if constexpr (std::is_same_v) { // DATA : If TPC-MFT h-h case + registry.fill(HIST("Data/TpcMft/HadronHadron/MixedEvent/hEventCountMixing"), bin); + fillTpcMftChChMixedEventQa(multiplicityTracks1, vz, tracks1); // TPC tracks + fillTpcMftChChMixedEventQa(multiplicityTracks2, vz, tracks2); // MFT tracks + } else if constexpr (std::is_same_v && std::is_same_v) { // DATA : If TPC-MFT HF-h case + registry.fill(HIST("Data/TpcMft/HfHadron/MixedEvent/hEventCountMixing"), bin); + fillTpcMftHfChMixedEventQa(multiplicityTracks1, vz, tracks1); // Candidates + fillTpcMftHfChMixedEventQa(multiplicityTracks2, vz, tracks2); // MFT tracks + } else { // DATA : If TPC-TPC h-h case + registry.fill(HIST("Data/TpcTpc/HadronHadron/MixedEvent/hEventCountMixing"), bin); + fillTpcTpcChChMixedEventQa(multiplicityTracks2, vz, tracks1); + } } - corrContainer->fillEvent(multiplicity, CorrelationContainer::kCFStepReconstructed); - fillCorrelations(corrContainer, tracks1, tracks2, multiplicity, collision1.posZ()); + corrContainer->fillEvent(multiplicityTracks2, CorrelationContainer::kCFStepReconstructed); + fillCorrelations(corrContainer, tracks1, tracks2, multiplicityTracks2, collision1.posZ()); + } + } + + // template + // void mixCollisions(FilteredCollisionsWSelMult const& collisions, TTracksTrig const& tracks1, TTracksAssoc const& tracks2, TLambda getPartsSize, OutputObj& corrContainer) + template + void mixCollisionsMcTruth(TCollisions const& collisions, TTracksTrig const& tracks1, TTracksAssoc const& tracks2, TLambda getPartsSize, OutputObj& corrContainer) + { + using BinningTypeMcTruth = FlexibleBinningPolicy, aod::mccollision::PosZ, decltype(getPartsSize)>; + + BinningTypeMcTruth binningWithTracksSize{{getPartsSize}, {axisVertex, axisMultiplicity}, true}; + auto tracksTuple = std::make_tuple(tracks1, tracks2); + Pair pair{binningWithTracksSize, nMixedEvents, -1, collisions, tracksTuple, &cache}; + + for (const auto& [collision1, tracks1, collision2, tracks2] : pair) { + + // added this to try to compile when doing mixed event with FilteredMcParticles and FilteredMcCollisions (MC truth) + // TODO : GET RID OF THE COLLISION SELECTION FOR MC TRUTH + // if constexpr (!std::is_same_v) { + // if (!(isCollisionSelected(collision1, false))) { + // continue; + // } + // if (!(isCollisionSelected(collision2, false))) { + // continue; + // } + //} + + auto binningValues = binningWithTracksSize.getBinningValues(collision1, collisions); + int bin = binningWithTracksSize.getBin(binningValues); + + const auto multiplicity = tracks2.size(); // get multiplicity of charged hadrons, which is used for slicing in mixing + const auto vz = collision1.posZ(); + + // TO BE DONE : ADD ONE MORE IF CONDITION TO FILL THE MC CASE + // TODO : FILL NEW PLOTS FOR MCTRUTH ONLY + registry.fill(HIST("MC/Gen/TpcTpc/HadronHadron/MixedEvent/hEventCountMixing"), bin); + fillTpcTpcChChMixedEventQaMc(multiplicity, vz, tracks1); + + // if constexpr (std::is_same_v) { + // registry.fill(HIST("Data/TpcTpc/HfHadron/MixedEvent/hEventCountHFMixing"), bin); + // fillHFMixingQA(multiplicity, vz, tracks1); + // } else { + // registry.fill(HIST("Data/TpcTpc/HadronHadron/MixedEvent/hEventCountMixing"), bin); + // fillMixingQA(multiplicity, vz, tracks1); + // } + + corrContainer->fillEvent(multiplicity, CorrelationContainer::kCFStepAll); + fillCorrelations(corrContainer, tracks1, tracks2, multiplicity, collision1.posZ()); } } // ===================================== - // process same event correlations: h-h case + // DATA : process same event correlations: TPC-TPC h-h case // ===================================== + void processSameTpcTpcChCh(FilteredCollisionsWSelMult::iterator const& collision, TracksWDcaSel const& tracks) { @@ -489,14 +1061,16 @@ struct HfTaskFlow { sameTPCTPCChCh->fillEvent(multiplicity, CorrelationContainer::kCFStepReconstructed); - fillQA(multiplicity, tracks); - fillCorrelations(sameTPCTPCChCh, tracks, tracks, multiplicity, collision.posZ()); + fillTpcTpcChChSameEventQa(multiplicity, tracks); + // TO-DO : add if condition for when we will implant corrected correlations (kCFStepReconstructed -> kCFStepCorrected) + fillCorrelations(sameTPCTPCChCh, tracks, tracks, multiplicity, collision.posZ()); } - PROCESS_SWITCH(HfTaskFlow, processSameTpcTpcChCh, "Process same-event correlations for TPC-TPC h-h case", true); + PROCESS_SWITCH(HfTaskFlow, processSameTpcTpcChCh, "DATA : Process same-event correlations for TPC-TPC h-h case", true); // ===================================== - // process same event correlations: HF-h case + // DATA : process same event correlations: TPC-TPC HF-h case // ===================================== + void processSameTpcTpcHfCh(FilteredCollisionsWSelMult::iterator const& collision, TracksWDcaSel const& tracks, HfCandidatesSel const& candidates) @@ -508,33 +1082,131 @@ struct HfTaskFlow { sameTPCTPCHfCh->fillEvent(multiplicity, CorrelationContainer::kCFStepReconstructed); - fillCandidateQA(candidates); - fillCorrelations(sameTPCTPCHfCh, candidates, tracks, multiplicity, collision.posZ()); + fillTpcTpcCandidateQa(candidates); + fillCorrelations(sameTPCTPCHfCh, candidates, tracks, multiplicity, collision.posZ()); } - PROCESS_SWITCH(HfTaskFlow, processSameTpcTpcHfCh, "Process same-event correlations for TPC-TPC HF-h case", true); + PROCESS_SWITCH(HfTaskFlow, processSameTpcTpcHfCh, "DATA : Process same-event correlations for TPC-TPC HF-h case", true); // ===================================== - // process same event correlations: h-MFT case + // DATA : process same event correlations: TPC-MFT h-h case // ===================================== + void processSameTpcMftChCh(FilteredCollisionsWSelMult::iterator const& collision, TracksWDcaSel const& tracks, - aod::MFTTracks const& mfttracks) + aod::MFTTracks const& mftTracks) { if (!(isCollisionSelected(collision, true))) { return; } - const auto multiplicity = tracks.size(); + const auto multiplicityTPC = tracks.size(); + const auto multiplicityMFT = mftTracks.size(); + + sameTPCMFTChCh->fillEvent(multiplicityTPC, CorrelationContainer::kCFStepReconstructed); + fillTpcMftChChSameEventQa(multiplicityTPC, tracks); + fillTpcMftChChSameEventQa(multiplicityMFT, mftTracks); + fillCorrelations(sameTPCMFTChCh, tracks, mftTracks, multiplicityTPC, collision.posZ()); + } + PROCESS_SWITCH(HfTaskFlow, processSameTpcMftChCh, "DATA : Process same-event correlations for TPC-MFT h-h case", true); + + // ===================================== + // DATA : process same event correlations: TPC-MFT HF-h case + // ===================================== - sameTPCMFTChCh->fillEvent(multiplicity, CorrelationContainer::kCFStepReconstructed); - fillMFTQA(multiplicity, mfttracks); - fillCorrelations(sameTPCMFTChCh, tracks, mfttracks, multiplicity, collision.posZ()); + void processSameTpcMftHfCh(FilteredCollisionsWSelMult::iterator const& collision, + HfCandidatesSel const& candidates, + aod::MFTTracks const& mftTracks) + { + if (!(isCollisionSelected(collision, true))) { + return; + } + + const auto multiplicityCandidates = candidates.size(); + const auto multiplicityMFT = mftTracks.size(); + + sameTPCMFTHfCh->fillEvent(multiplicityCandidates, CorrelationContainer::kCFStepReconstructed); + fillTpcMftCandidateQa(candidates); + fillTpcMftHfChSameEventQa(multiplicityMFT, mftTracks); + fillCorrelations(sameTPCMFTHfCh, candidates, mftTracks, multiplicityCandidates, collision.posZ()); + } + PROCESS_SWITCH(HfTaskFlow, processSameTpcMftHfCh, "DATA : Process same-event correlations for TPC-MFT HF-h case", true); + + // ===================================== + // MONTE-CARLO : process same event correlations: TPC-TPC h-h case + // ===================================== + + void processSameTpcTpcChChmcREC(FilteredCollisionsWSelMultMC::iterator const& mcCollision, + TracksWDcaSelMC const& mcTracks) + { + + // NEED TO COMMENT THIS + // if (!(isCollisionSelected(mcCollision, true))) { + // return; + //} + + const auto multiplicity = mcTracks.size(); + registry.fill(HIST("MC/Rec/TpcTpc/HadronHadron/SameEvent/hMultiplicity"), multiplicity); + registry.fill(HIST("MC/Rec/TpcTpc/HadronHadron/SameEvent/hVtxZ"), mcCollision.posZ()); + + BinningPolicyBase<2> baseBinning{{axisVertex, axisMultiplicity}, true}; + int bin = baseBinning.getBin(std::make_tuple(mcCollision.posZ(), multiplicity)); + registry.fill(HIST("MC/Rec/TpcTpc/HadronHadron/SameEvent/hEventCountSame"), bin); + + sameTPCTPCChChMC->fillEvent(multiplicity, CorrelationContainer::kCFStepReconstructed); + + fillTpcTpcChChSameEventQaMc(multiplicity, mcTracks); + fillCorrelations(sameTPCTPCChChMC, mcTracks, mcTracks, multiplicity, mcCollision.posZ()); + } + PROCESS_SWITCH(HfTaskFlow, processSameTpcTpcChChmcREC, "MONTE-CARLO : Process same-event correlations for TPC-TPC h-h case", true); + + // Katarina's version = MC Truth + void processSameTpcTpcChChmcGEN(FilteredMcCollisions::iterator const& mcCollision, + FilteredMcParticles const& mcParticles) + { + + // if (!(isCollisionSelected(mcCollision, true))) { + // return; + // } + + // Not sure why to use this + // if (collisions.size() == 0) { + // return; + //} + + // if (!collision.has_mcCollision()) { + // LOGF(warning, "No MC collision for this collision, skip..."); + // return; + // } + + const auto multiplicity = mcParticles.size(); // Note: these are all MC particles after selection (not only primary) + registry.fill(HIST("MC/Gen/TpcTpc/HadronHadron/SameEvent/hMultiplicity"), multiplicity); + registry.fill(HIST("MC/Gen/TpcTpc/HadronHadron/SameEvent/hVtxZ"), mcCollision.posZ()); + + // fill correlations for all MC collisions + // In Katka's code, the first time doing this does not fill the histograms, right now will be filled two times.. + auto multPrimaryCharge0 = fillTpcTpcChChSameEventQaMc(multiplicity, mcParticles); + sameTPCTPCChChMC->fillEvent(multPrimaryCharge0, CorrelationContainer::kCFStepAll); + fillCorrelations(sameTPCTPCChChMC, mcParticles, mcParticles, multPrimaryCharge0, mcCollision.posZ()); + + // NOT USED BY KATARINA APPARENTLY + // BinningPolicyBase<2> baseBinning{{axisVertex, axisMultiplicity}, true}; + // int bin = baseBinning.getBin(std::make_tuple(mcCollision.posZ(), multiplicity)); + // registry.fill(HIST("MC/Gen/TpcTpc/HadronHadron/SameEvent/hEventCountSame"), bin); + + // TO-DO : fill correlation container for MC collisions that have a reconstructed collision + // got rid of the second const auto for multPrimaryCharge0 + // This line below for sure induce that some plots are filled two times + // multPrimaryCharge0 = fillTpcTpcChChSameEventQaMc(multiplicity, mcParticles); + // sameTPCTPCChChMC->fillEvent(multPrimaryCharge0, CorrelationContainer::kCFStepVertex); + // fillCorrelations(sameTPCTPCChChMC, mcParticles, mcParticles, multPrimaryCharge0, mcCollision.posZ()); } - PROCESS_SWITCH(HfTaskFlow, processSameTpcMftChCh, "Process same-event correlations for TPC-MFT h-h case", true); + PROCESS_SWITCH(HfTaskFlow, processSameTpcTpcChChmcGEN, "MONTE-CARLO : Process same-event correlations for TPC-TPC h-h case", true); // ===================================== - // process mixed event correlations: h-h case + // DATA : process mixed event correlations:TPC-TPC h-h case // ===================================== + // TO BECOME DATA & MC REC ? + void processMixedTpcTpcChCh(FilteredCollisionsWSelMult const& collisions, TracksWDcaSel const& tracks) { @@ -547,11 +1219,12 @@ struct HfTaskFlow { mixCollisions(collisions, tracks, tracks, getTracksSize, mixedTPCTPCChCh); } - PROCESS_SWITCH(HfTaskFlow, processMixedTpcTpcChCh, "Process mixed-event correlations for TPC-TPC h-h case", true); + PROCESS_SWITCH(HfTaskFlow, processMixedTpcTpcChCh, "DATA : Process mixed-event correlations for TPC-TPC h-h case", true); // ===================================== - // process mixed event correlations: h-HF case + // DATA : process mixed event correlations: TPC-TPC HF-h case // ===================================== + void processMixedTpcTpcHfCh(FilteredCollisionsWSelMult const& collisions, TracksWDcaSel const& tracks, HfCandidatesSel const& candidates) @@ -563,16 +1236,23 @@ struct HfTaskFlow { return size; }; + // auto getTracksSize = [&candidates, this](FilteredCollisionsWSelMult::iterator const& col) { + // auto associatedTracks = candidates.sliceByCached(o2::aod::track::collisionId, col.globalIndex(), this->cache); + // auto size = associatedTracks.size(); + // return size; + // }; + mixCollisions(collisions, candidates, tracks, getTracksSize, mixedTPCTPCHfCh); } - PROCESS_SWITCH(HfTaskFlow, processMixedTpcTpcHfCh, "Process mixed-event correlations for TPC-TPC HF-h case", true); + PROCESS_SWITCH(HfTaskFlow, processMixedTpcTpcHfCh, "DATA : Process mixed-event correlations for TPC-TPC HF-h case", true); // ===================================== - // process mixed event correlations: h-MFT case + // DATA : process mixed event correlations: TPC-MFT h-h case // ===================================== + void processMixedTpcMftChCh(FilteredCollisionsWSelMult const& collisions, TracksWDcaSel const& tracks, - aod::MFTTracks const& mfttracks) + aod::MFTTracks const& mftTracks) { // we want to group collisions based on charged-track multiplicity auto getTracksSize = [&tracks, this](FilteredCollisionsWSelMult::iterator const& col) { @@ -581,9 +1261,70 @@ struct HfTaskFlow { return size; }; - mixCollisions(collisions, tracks, mfttracks, getTracksSize, mixedTPCMFTChCh); + mixCollisions(collisions, tracks, mftTracks, getTracksSize, mixedTPCMFTChCh); + } + PROCESS_SWITCH(HfTaskFlow, processMixedTpcMftChCh, "DATA : Process mixed-event correlations for TPC-MFT h-h case", true); + + // ===================================== + // DATA : process mixed event correlations: TPC-MFT HF-h case + // ===================================== + + void processMixedTpcMftHfCh(FilteredCollisionsWSelMult const& collisions, + HfCandidatesSel const& candidates, + aod::MFTTracks const& mftTracks) + { + // we want to group collisions based on charged-track multiplicity + auto getTracksSize = [&candidates, this](FilteredCollisionsWSelMult::iterator const& col) { + // Still o2::aod::track::collisionId with HF ??? + auto associatedTracks = candidates.sliceByCached(o2::aod::track::collisionId, col.globalIndex(), this->cache); + auto size = associatedTracks.size(); + return size; + }; + + mixCollisions(collisions, candidates, mftTracks, getTracksSize, mixedTPCMFTHfCh); + } + PROCESS_SWITCH(HfTaskFlow, processMixedTpcMftHfCh, "DATA : Process mixed-event correlations for TPC-MFT HF-h case", true); + + // ===================================== + // MONTE-CARLO : process mixed event correlations: TPC-TPC h-h case + // ===================================== + + // MC rec + void processMixedTpcTpcChChmcREC(FilteredCollisionsWSelMultMC const& mcCollisions, + TracksWDcaSelMC const& mcTracks) + { + // use normal index instead of globalIndex for MixedEvent ?? + + // we want to group collisions based on charged-track multiplicity + auto getTracksSize = [&mcTracks, this](FilteredCollisionsWSelMultMC::iterator const& mcCol) { + auto associatedTracks = mcTracks.sliceByCached(o2::aod::track::collisionId, mcCol.globalIndex(), this->cache); // it's cached, so slicing/grouping happens only once + auto size = associatedTracks.size(); + return size; + }; + + mixCollisions(mcCollisions, mcTracks, mcTracks, getTracksSize, mixedTPCTPCChChMC); + } + PROCESS_SWITCH(HfTaskFlow, processMixedTpcTpcChChmcREC, "MONTE-CARLO : Process mixed-event correlations for TPC-TPC h-h case", true); + + // MC gen + void processMixedTpcTpcChChmcGEN(FilteredMcCollisions const& mcCollisions, + FilteredMcParticles const& mcParticles, + FilteredCollisionsWSelMultMC const& collisions) + { + // use normal index instead of globalIndex for MixedEvent ?? + + // we want to group collisions based on charged-track multiplicity + auto getTracksSize = [&mcParticles, this](FilteredMcCollisions::iterator const& mcCol) { + auto associatedTracks = mcParticles.sliceByCached(o2::aod::mcparticle::mcCollisionId, mcCol.globalIndex(), this->cache); // it's cached, so slicing/grouping happens only once + auto size = associatedTracks.size(); + return size; + }; + + mixCollisionsMcTruth(mcCollisions, mcParticles, mcParticles, getTracksSize, mixedTPCTPCChChMC); + + // TO-DO : mixed event for particles that have a reconstructed collision kCFStepVertex } - PROCESS_SWITCH(HfTaskFlow, processMixedTpcMftChCh, "Process mixed-event correlations for TPC-MFT h-h case", true); + PROCESS_SWITCH(HfTaskFlow, processMixedTpcTpcChChmcGEN, "MONTE-CARLO : Process mixed-event correlations for TPC-TPC h-h case", true); }; // End of struct WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)