From 52fcea8a7f8ec7fd2fd45bd494642503f970bc17 Mon Sep 17 00:00:00 2001 From: Samuele Cattaruzzi <124249902+scattaru@users.noreply.github.com> Date: Sat, 21 Dec 2024 10:37:44 +0100 Subject: [PATCH] [PWGHF] Ds-h correlation, fix bug in ME derived data (#9086) Co-authored-by: ALICE Action Bot --- .../HFC/TableProducer/correlatorDsHadrons.cxx | 20 ++++----- .../correlatorDsHadronsReduced.cxx | 4 +- PWGHF/HFC/Tasks/taskCorrelationDsHadrons.cxx | 45 ++++++++++--------- 3 files changed, 36 insertions(+), 33 deletions(-) diff --git a/PWGHF/HFC/TableProducer/correlatorDsHadrons.cxx b/PWGHF/HFC/TableProducer/correlatorDsHadrons.cxx index 090b3f45d23..740d7832491 100644 --- a/PWGHF/HFC/TableProducer/correlatorDsHadrons.cxx +++ b/PWGHF/HFC/TableProducer/correlatorDsHadrons.cxx @@ -417,7 +417,7 @@ struct HfCorrelatorDsHadrons { track.pt(), poolBin); entryDsHadronRecoInfo(hfHelper.invMassDsToKKPi(candidate), false, false); - entryDsHadronGenInfo(false, false, 0); + // entryDsHadronGenInfo(false, false, 0); entryDsHadronMlInfo(outputMl[0], outputMl[2]); entryTrackRecoInfo(track.dcaXY(), track.dcaZ(), track.tpcNClsCrossedRows()); } else if (candidate.isSelDsToPiKK() >= selectionFlagDs) { @@ -427,7 +427,7 @@ struct HfCorrelatorDsHadrons { track.pt(), poolBin); entryDsHadronRecoInfo(hfHelper.invMassDsToPiKK(candidate), false, false); - entryDsHadronGenInfo(false, false, 0); + // entryDsHadronGenInfo(false, false, 0); entryDsHadronMlInfo(outputMl[0], outputMl[2]); entryTrackRecoInfo(track.dcaXY(), track.dcaZ(), track.tpcNClsCrossedRows()); } @@ -688,8 +688,8 @@ struct HfCorrelatorDsHadrons { entryDsHadronRecoInfo(MassDS, true, isDecayChan); entryDsHadronGenInfo(isDsPrompt, particleAssoc.isPhysicalPrimary(), trackOrigin); } - } - } + } // end loop generated particles + } // end loop generated Ds } // end loop reconstructed collision } // end loop generated collision } @@ -706,7 +706,7 @@ struct HfCorrelatorDsHadrons { auto tracksThisColl = tracks.sliceBy(trackIndicesPerCollision, thisCollId); // Ds fill histograms and Ds candidates information stored - for (const auto& candidate : candidates) { + for (const auto& candidate : candsDsThisColl) { // candidate selected if (candidate.isSelDsToKKPi() >= selectionFlagDs) { candReduced(hfcReducedCollisionIndex, candidate.phi(), candidate.eta(), candidate.pt(), hfHelper.invMassDsToKKPi(candidate)); @@ -716,7 +716,7 @@ struct HfCorrelatorDsHadrons { } // tracks information - for (const auto& track : tracks) { + for (const auto& track : tracksThisColl) { if (!track.isGlobalTrackWoDCA()) { continue; } @@ -742,7 +742,7 @@ struct HfCorrelatorDsHadrons { int indexHfcReducedCollision = collReduced.lastIndex() + 1; // Ds fill histograms and Ds candidates information stored - for (const auto& candidate : candidates) { + for (const auto& candidate : candsDsThisColl) { // candidate selected if (candidate.isSelDsToKKPi() >= selectionFlagDs) { candReduced(indexHfcReducedCollision, candidate.phi(), candidate.eta(), candidate.pt(), hfHelper.invMassDsToKKPi(candidate)); @@ -752,7 +752,7 @@ struct HfCorrelatorDsHadrons { } // tracks information - for (const auto& track : tracks) { + for (const auto& track : tracksThisColl) { if (!track.isGlobalTrackWoDCA()) { continue; } @@ -808,7 +808,7 @@ struct HfCorrelatorDsHadrons { pAssoc.pt(), poolBin); entryDsHadronRecoInfo(hfHelper.invMassDsToKKPi(cand), false, false); - entryDsHadronGenInfo(false, false, 0); + // entryDsHadronGenInfo(false, false, 0); for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) { outputMl[iclass] = cand.mlProbDsToKKPi()[classMl->at(iclass)]; } @@ -822,7 +822,7 @@ struct HfCorrelatorDsHadrons { pAssoc.pt(), poolBin); entryDsHadronRecoInfo(hfHelper.invMassDsToPiKK(cand), false, false); - entryDsHadronGenInfo(false, false, 0); + // entryDsHadronGenInfo(false, false, 0); for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) { outputMl[iclass] = cand.mlProbDsToPiKK()[classMl->at(iclass)]; } diff --git a/PWGHF/HFC/TableProducer/correlatorDsHadronsReduced.cxx b/PWGHF/HFC/TableProducer/correlatorDsHadronsReduced.cxx index 37cf40766f2..78e05a61ec1 100644 --- a/PWGHF/HFC/TableProducer/correlatorDsHadronsReduced.cxx +++ b/PWGHF/HFC/TableProducer/correlatorDsHadronsReduced.cxx @@ -43,7 +43,7 @@ using BinningTypeDerived = ColumnBinningPolicy entryDsHadronPair; Produces entryDsHadronRecoInfo; - Produces entryDsHadronGenInfo; + // Produces entryDsHadronGenInfo; Configurable fillHistoData{"fillHistoData", true, "Flag for filling histograms in data processes"}; Configurable numberEventsMixed{"numberEventsMixed", 5, "Number of events mixed in ME process"}; @@ -109,7 +109,7 @@ struct HfCorrelatorDsHadronsReduced { pAssoc.ptAssocTrack(), poolBin); entryDsHadronRecoInfo(cand.invMassDs(), false, false); - entryDsHadronGenInfo(false, false, 0); + // entryDsHadronGenInfo(false, false, 0); } } } diff --git a/PWGHF/HFC/Tasks/taskCorrelationDsHadrons.cxx b/PWGHF/HFC/Tasks/taskCorrelationDsHadrons.cxx index 89d8631652e..1611f3560a0 100644 --- a/PWGHF/HFC/Tasks/taskCorrelationDsHadrons.cxx +++ b/PWGHF/HFC/Tasks/taskCorrelationDsHadrons.cxx @@ -14,6 +14,8 @@ /// \author Grazia Luparello /// \author Samuele Cattaruzzi +#include + #include "Framework/AnalysisTask.h" #include "Framework/HistogramRegistry.h" #include "Framework/runDataProcessing.h" @@ -59,8 +61,8 @@ struct HfTaskCorrelationDsHadrons { Configurable> classMl{"classMl", {0, 1, 2}, "Indexes of ML scores to be stored. Three indexes max."}; Configurable> binsPtD{"binsPtD", std::vector{o2::analysis::hf_cuts_ds_to_k_k_pi::vecBinsPt}, "pT bin limits for candidate mass plots and efficiency"}; Configurable> binsPtHadron{"binsPtHadron", std::vector{0.3, 2., 4., 8., 12., 50.}, "pT bin limits for assoc particle efficiency"}; - Configurable> mlOutputPrompt{"mlScorePrompt", {0.5, 0.5, 0.5, 0.5}, "Machine learning scores for prompt"}; - Configurable> mlOutputBkg{"mlScoreBkg", {0.5, 0.5, 0.5, 0.5}, "Machine learning scores for bkg"}; + Configurable> mlOutputPrompt{"mlOutputPrompt", {0.5, 0.5, 0.5, 0.5}, "Machine learning scores for prompt"}; + Configurable> mlOutputBkg{"mlOutputBkg", {0.5, 0.5, 0.5, 0.5}, "Machine learning scores for bkg"}; Configurable> binsPtEfficiencyD{"binsPtEfficiencyD", std::vector{o2::analysis::hf_cuts_ds_to_k_k_pi::vecBinsPt}, "pT bin limits for D-meson efficiency"}; Configurable> binsPtEfficiencyHad{"binsPtEfficiencyHad", std::vector{0.3, 2., 4., 8., 12., 50.}, "pT bin limits for associated particle efficiency"}; Configurable> efficiencyD{"efficiencyD", {1., 1., 1., 1., 1., 1.}, "efficiency values for Ds meson"}; @@ -71,15 +73,6 @@ struct HfTaskCorrelationDsHadrons { Configurable> sidebandLeftOuter{"sidebandLeftOuter", {1.9040, 1.9040, 1.9040, 1.9040, 1.9040, 1.9040, 1.9040, 1.9040}, "Outer values of left sideband vs pT"}; Configurable> sidebandRightInner{"sidebandRightInner", {2.0000, 2.0000, 2.0000, 2.0000, 2.0000, 2.0000, 2.0000, 2.0000}, "Inner values of right sideband vs pT"}; Configurable> sidebandRightOuter{"sidebandRightOuter", {2.0320, 2.0320, 2.0320, 2.0320, 2.0320, 2.0320, 2.0320, 2.0320}, "Outer values of right sideband vs pT"}; - ConfigurableAxis binsMassD{"binsMassD", {200, 1.7, 2.25}, "inv. mass (K^{#pm}K^{-}#pi^{+}) (GeV/#it{c}^{2})"}; - ConfigurableAxis binsBdtScore{"binsBdtScore", {100, 0., 1.}, "Bdt output scores"}; - ConfigurableAxis binsEta{"binsEta", {100, -2., 2.}, "#it{#eta}"}; - ConfigurableAxis binsPhi{"binsPhi", {64, -PIHalf, 3. * PIHalf}, "#it{#varphi}"}; - ConfigurableAxis binsMultFT0M{"binsMultFT0M", {600, 0., 8000.}, "Multiplicity as FT0M signal amplitude"}; - ConfigurableAxis binsPosZ{"binsPosZ", {100, -10., 10.}, "primary vertex z coordinate"}; - ConfigurableAxis binsPoolBin{"binsPoolBin", {9, 0., 9.}, "PoolBin"}; - - HfHelper hfHelper; enum CandidateStep { kCandidateStepMcGenDsToKKPi = 0, @@ -98,7 +91,11 @@ struct HfTaskCorrelationDsHadrons { kAssocTrackStepRecoSpecies, kAssocTrackNSteps }; + HfHelper hfHelper; + SliceCache cache; + using DsHadronPairFull = soa::Join; + using DsHadronPairWithMl = soa::Join; using DsHadronPairFullWithMl = soa::Join; using CandDsMcReco = soa::Filtered>; // flagDsFilter applied using CandDsMcGen = soa::Join; // flagDsFilter applied @@ -107,6 +104,20 @@ struct HfTaskCorrelationDsHadrons { Filter flagDsFilter = ((o2::aod::hf_track_index::hfflag & static_cast(1 << aod::hf_cand_3prong::DecayType::DsToKKPi)) != static_cast(0)) && (aod::hf_sel_candidate_ds::isSelDsToKKPi >= selectionFlagDs || aod::hf_sel_candidate_ds::isSelDsToPiKK >= selectionFlagDs); Filter trackFilter = (nabs(aod::track::eta) < etaTrackMax) && (aod::track::pt > ptTrackMin) && (aod::track::pt < ptTrackMax) && (nabs(aod::track::dcaXY) < dcaXYTrackMax) && (nabs(aod::track::dcaZ) < dcaZTrackMax); + Preslice perCollisionCand = o2::aod::hf_cand::collisionId; + Preslice perCollisionCandMc = o2::aod::mcparticle::mcCollisionId; + Preslice perCollision = o2::aod::track::collisionId; + Preslice perCollisionMc = o2::aod::mcparticle::mcCollisionId; + PresliceUnsorted> collPerCollMc = o2::aod::mccollisionlabel::mcCollisionId; + + ConfigurableAxis binsMassD{"binsMassD", {200, 1.7, 2.25}, "inv. mass (K^{#pm}K^{-}#pi^{+}) (GeV/#it{c}^{2})"}; + ConfigurableAxis binsBdtScore{"binsBdtScore", {100, 0., 1.}, "Bdt output scores"}; + ConfigurableAxis binsEta{"binsEta", {100, -2., 2.}, "#it{#eta}"}; + ConfigurableAxis binsPhi{"binsPhi", {64, -PIHalf, 3. * PIHalf}, "#it{#varphi}"}; + ConfigurableAxis binsMultFT0M{"binsMultFT0M", {600, 0., 8000.}, "Multiplicity as FT0M signal amplitude"}; + ConfigurableAxis binsPosZ{"binsPosZ", {100, -10., 10.}, "primary vertex z coordinate"}; + ConfigurableAxis binsPoolBin{"binsPoolBin", {9, 0., 9.}, "PoolBin"}; + HistogramRegistry registry{"registry", {}, OutputObjHandlingPolicy::AnalysisObject}; void init(InitContext&) @@ -218,7 +229,7 @@ struct HfTaskCorrelationDsHadrons { } } - void processData(DsHadronPairFullWithMl const& pairEntries, + void processData(DsHadronPairWithMl const& pairEntries, aod::DsCandRecoInfo const& candidates) { for (const auto& candidate : candidates) { @@ -410,7 +421,7 @@ struct HfTaskCorrelationDsHadrons { } PROCESS_SWITCH(HfTaskCorrelationDsHadrons, processMcGen, "Process MC Gen mode", false); - void processDataME(DsHadronPairFullWithMl const& pairEntries) + void processDataME(DsHadronPairWithMl const& pairEntries) { for (const auto& pairEntry : pairEntries) { // define variables for widely used quantities @@ -524,11 +535,6 @@ struct HfTaskCorrelationDsHadrons { } PROCESS_SWITCH(HfTaskCorrelationDsHadrons, processMcRecME, "Process MC Reco ME", false); - SliceCache cache; - Preslice perCollisionCand = o2::aod::hf_cand::collisionId; - Preslice perCollisionCandMc = o2::aod::mcparticle::mcCollisionId; - PresliceUnsorted> collPerCollMc = o2::aod::mccollisionlabel::mcCollisionId; - /// Ds-Hadron correlation - for calculating candidate reconstruction efficiency using MC reco-level analysis void processMcCandEfficiency(soa::Join const& collisions, soa::Join const& mcCollisions, @@ -727,9 +733,6 @@ struct HfTaskCorrelationDsHadrons { } PROCESS_SWITCH(HfTaskCorrelationDsHadrons, processMcCandEfficiencyWoColl, "Process MC for calculating candidate reconstruction efficiency", false); - Preslice perCollision = o2::aod::track::collisionId; - Preslice perCollisionMc = o2::aod::mcparticle::mcCollisionId; - /// Ds-Hadron correlation - for calculating associated particle tracking efficiency using MC reco-level analysis void processMcTrackEfficiency(soa::Join const& collisions, soa::Join const& mcCollisions,