@@ -52,10 +52,9 @@ namespace o2::aod
5252{
5353namespace ml
5454{
55- // collision info
56- DECLARE_SOA_COLUMN (KfptPiFromOmegac, kfptPiFromOmegac, float );
57- DECLARE_SOA_COLUMN (KfptOmegac, kfptOmegac, float );
5855DECLARE_SOA_COLUMN (InvMassCharmBaryon, invMassCharmBaryon, float );
56+ DECLARE_SOA_COLUMN (KfptOmegac, kfptOmegac, float );
57+ DECLARE_SOA_COLUMN (KfptPiFromOmegac, kfptPiFromOmegac, float );
5958DECLARE_SOA_COLUMN (MlProbOmegac, mlProbOmegac, float );
6059DECLARE_SOA_COLUMN (Cent, cent, float );
6160} // namespace ml
@@ -64,17 +63,13 @@ DECLARE_SOA_TABLE(HfKfOmegacML, "AOD", "HFKFOMEGACML",
6463} // namespace o2::aod
6564
6665// / Omegac0 analysis task
67-
6866struct HfTaskOmegac0ToOmegapi {
69-
7067 Produces<o2::aod::HfKfOmegacML> kfCandMl;
71- // ML inference
72- Configurable<bool > applyMl{" applyMl" , false , " Flag to apply ML selections" };
73- Configurable<bool > fillCent{" fillCent" , false , " Flag to fill centrality information" };
74- Configurable<bool > fillTree{" fillTree" , false , " Fill TTree for local analysis.(Enabled only with ML)" };
68+
7569 Configurable<bool > selectionFlagOmegac0{" selectionFlagOmegac0" , true , " Select Omegac0 candidates" };
76- Configurable<double > yCandGenMax{" yCandGenMax" , 0.5 , " max. gen particle rapidity" };
77- Configurable<double > yCandRecoMax{" yCandRecoMax" , 0.8 , " max. cand. rapidity" };
70+ Configurable<double > yCandGenMax{" yCandGenMax" , 0.5 , " Max. gen particle rapidity" };
71+ Configurable<double > yCandRecoMax{" yCandRecoMax" , 0.8 , " Max. cand. rapidity" };
72+ Configurable<bool > fillTree{" fillTree" , false , " Fill tree for local analysis (enabled only with ML)" };
7873
7974 HfHelper hfHelper;
8075 SliceCache cache;
@@ -84,7 +79,6 @@ struct HfTaskOmegac0ToOmegapi {
8479 using Omegac0Cands = soa::Filtered<soa::Join<aod::HfCandToOmegaPi, aod::HfSelToOmegaPi>>;
8580 using Omegac0CandsKF = soa::Filtered<soa::Join<aod::HfCandToOmegaPi, aod::HfSelToOmegaPi, aod::HfOmegacKf>>;
8681 using OmegaC0CandsMcKF = soa::Filtered<soa::Join<aod::HfCandToOmegaPi, aod::HfSelToOmegaPi, aod::HfOmegacKf, aod::HfToOmegaPiMCRec>>;
87-
8882 using Omegac0CandsMl = soa::Filtered<soa::Join<aod::HfCandToOmegaPi, aod::HfSelToOmegaPi, aod::HfMlSelOmegacToOmegaPi>>;
8983 using Omegac0CandsMlKF = soa::Filtered<soa::Join<aod::HfCandToOmegaPi, aod::HfSelToOmegaPi, aod::HfMlSelOmegacToOmegaPi, aod::HfOmegacKf>>;
9084 using Omegac0CandsMlMcKF = soa::Filtered<soa::Join<aod::HfCandToOmegaPi, aod::HfSelToOmegaPi, aod::HfMlSelOmegacToOmegaPi, aod::HfOmegacKf, aod::HfToOmegaPiMCRec>>;
@@ -99,23 +93,21 @@ struct HfTaskOmegac0ToOmegapi {
9993 Filter filterOmegaCToOmegaPiFlag = (aod::hf_track_index::hfflag & static_cast <uint8_t >(BIT(aod::hf_cand_casc_lf::DecayType2Prong::OmegaczeroToOmegaPi))) != static_cast <uint8_t >(0 );
10094 Filter filterOmegaCMatchedRec = nabs(aod::hf_cand_xic0_omegac0::flagMcMatchRec) == static_cast <int8_t >(BIT(aod::hf_cand_xic0_omegac0::DecayType::OmegaczeroToOmegaPi));
10195 Filter filterOmegaCMatchedGen = nabs(aod::hf_cand_xic0_omegac0::flagMcMatchGen) == static_cast <int8_t >(BIT(aod::hf_cand_xic0_omegac0::DecayType::OmegaczeroToOmegaPi));
96+
10297 Preslice<Omegac0CandsKF> candOmegacKFPerCollision = aod::hf_cand_xic0_omegac0::collisionId;
10398 Preslice<Omegac0CandsMlKF> candOmegacKFMlPerCollision = aod::hf_cand_xic0_omegac0::collisionId;
104-
10599 PresliceUnsorted<CollisionsWithMcLabels> colPerMcCollision = aod::mccollisionlabel::mcCollisionId;
106100
107- // ThnSparse for ML outputScores and Vars
108- ConfigurableAxis thnConfigAxisPromptScore{" thnConfigAxisPromptScore" , {100 , 0 , 1 }, " Prompt score bins" };
109- ConfigurableAxis thnConfigAxisMass{" thnConfigAxisMass" , {120 , 2.4 , 3.1 }, " Cand. inv-mass bins" };
110- ConfigurableAxis thnConfigAxisPtB{" thnConfigAxisPtB" , {1000 , 0 , 100 }, " Cand. beauty mother pTB bins" };
111- ConfigurableAxis thnConfigAxisPt{" thnConfigAxisPt" , {100 , 0 , 20 }, " Cand. pT bins" };
112- ConfigurableAxis thnConfigAxisY{" thnConfigAxisY" , {20 , -1 , 1 }, " Cand. rapidity bins" };
113- ConfigurableAxis thnConfigAxisCent{" thnConfigAxisCent" , {100 , 0 , 100 }, " Centrality bins" };
114- ConfigurableAxis thnConfigAxisPtPion{" thnConfigAxisPtPion" , {100 , 0 , 10 }, " PtPion from Omegac0 bins" };
115- ConfigurableAxis thnConfigAxisOrigin{" thnConfigAxisOrigin" , {3 , -0.5 , 2.5 }, " Cand. origin type" };
116- ConfigurableAxis thnConfigAxisMatchFlag{" thnConfigAxisMatchFlag" , {15 , -7.5 , 7.5 }, " Cand. MC Match Flag type" };
117- ConfigurableAxis thnConfigAxisGenPtD{" thnConfigAxisGenPtD" , {500 , 0 , 50 }, " Gen Pt D" };
118- ConfigurableAxis thnConfigAxisGenPtB{" thnConfigAxisGenPtB" , {1000 , 0 , 100 }, " Gen Pt B" };
101+ ConfigurableAxis thnConfigAxisPromptScore{" thnConfigAxisPromptScore" , {100 , 0 , 1 }, " Prompt score" };
102+ ConfigurableAxis thnConfigAxisMass{" thnConfigAxisMass" , {700 , 2.4 , 3.1 }, " Cand. inv. mass" };
103+ ConfigurableAxis thnConfigAxisPtB{" thnConfigAxisPtB" , {500 , 0 , 50 }, " Cand. beauty mother pT" };
104+ ConfigurableAxis thnConfigAxisPt{" thnConfigAxisPt" , {500 , 0 , 50 }, " Cand. pT" };
105+ ConfigurableAxis thnConfigAxisY{" thnConfigAxisY" , {20 , -1 , 1 }, " Cand. rapidity" };
106+ ConfigurableAxis thnConfigAxisCent{" thnConfigAxisCent" , {100 , 0 , 100 }, " Centrality" };
107+ ConfigurableAxis thnConfigAxisOrigin{" thnConfigAxisOrigin" , {3 , -0.5 , 2.5 }, " Cand. origin" };
108+ ConfigurableAxis thnConfigAxisMatchFlag{" thnConfigAxisMatchFlag" , {15 , -7.5 , 7.5 }, " Cand. MC match flag" };
109+ ConfigurableAxis thnConfigAxisGenPtD{" thnConfigAxisGenPtD" , {500 , 0 , 50 }, " Gen pT" };
110+ ConfigurableAxis thnConfigAxisGenPtB{" thnConfigAxisGenPtB" , {500 , 0 , 50 }, " Gen beauty mother pT" };
119111 ConfigurableAxis thnConfigAxisNumPvContr{" thnConfigAxisNumPvContr" , {200 , -0.5 , 199.5 }, " Number of PV contributors" };
120112 HistogramRegistry registry{" registry" , {}};
121113
@@ -140,44 +132,37 @@ struct HfTaskOmegac0ToOmegapi {
140132 const AxisSpec thnAxisPtB{thnConfigAxisPtB, " #it{p}_{T}^{B} (GeV/#it{c})" };
141133 const AxisSpec thnAxisY{thnConfigAxisY, " y" };
142134 const AxisSpec thnAxisOrigin{thnConfigAxisOrigin, " Origin" };
143- const AxisSpec thnAxisMatchFlag{thnConfigAxisMatchFlag, " MatchFlag " };
135+ const AxisSpec thnAxisMatchFlag{thnConfigAxisMatchFlag, " MC match flag " };
144136 const AxisSpec thnAxisGenPtD{thnConfigAxisGenPtD, " #it{p}_{T} (GeV/#it{c})" };
145137 const AxisSpec thnAxisGenPtB{thnConfigAxisGenPtB, " #it{p}_{T}^{B} (GeV/#it{c})" };
146138 const AxisSpec thnAxisNumPvContr{thnConfigAxisNumPvContr, " Number of PV contributors" };
139+ const AxisSpec thnAxisPromptScore{thnConfigAxisPromptScore, " BDT score prompt" };
140+ const AxisSpec thnAxisCent{thnConfigAxisCent, " Centrality" };
147141
148- if (doprocessMcWithKFParticle || doprocessMcWithKFParticleMl) {
149- std::vector<AxisSpec> axesAcc = {thnAxisGenPtD, thnAxisGenPtB, thnAxisY, thnAxisOrigin, thnAxisNumPvContr};
150- registry.add (" hSparseAcc" , " Thn for generated Omega0 from charm and beauty" , HistType::kTHnSparseD , axesAcc);
151- registry.get <THnSparse>(HIST (" hSparseAcc" ))->Sumw2 ();
142+ std::vector<AxisSpec> axes = {thnAxisMass, thnAxisPt, thnAxisY};
143+
144+ if (doprocessDataWithKFParticleFT0C || doprocessDataWithKFParticleMlFT0C || doprocessDataWithKFParticleFT0M || doprocessDataWithKFParticleMlFT0M) {
145+ axes.push_back (thnAxisCent);
146+ axes.push_back (thnConfigAxisNumPvContr);
152147 }
153148
154- std::vector<AxisSpec> axes = {thnAxisMass, thnAxisPt, thnAxisY};
155149 if (doprocessMcWithKFParticle || doprocessMcWithKFParticleMl) {
150+ std::vector<AxisSpec> axesMcGen = {thnAxisGenPtD, thnAxisGenPtB, thnAxisY, thnAxisOrigin, thnAxisNumPvContr};
151+ registry.add (" hMcGen" , " Thn for generated #Omega_{c}^{0} from charm and beauty" , HistType::kTHnSparseD , axesMcGen);
152+ registry.get <THnSparse>(HIST (" hMcGen" ))->Sumw2 ();
153+
156154 axes.push_back (thnAxisPtB);
157155 axes.push_back (thnAxisOrigin);
158156 axes.push_back (thnAxisMatchFlag);
159157 axes.push_back (thnAxisNumPvContr);
160158 }
161- if (applyMl) {
162- const AxisSpec thnAxisPromptScore{thnConfigAxisPromptScore, " BDT score prompt." };
163- axes.insert (axes.begin (), thnAxisPromptScore);
164- registry.add (" hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsOmegac0Type" , " Thn for Omegac0 candidates" , HistType::kTHnSparseD , axes);
165- registry.get <THnSparse>(HIST (" hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsOmegac0Type" ))->Sumw2 ();
166- } else {
167- registry.add (" hMassVsPtVsPtBVsYVsOriginVsOmegac0Type" , " Thn for Omegac0 candidates" , HistType::kTHnSparseF , axes);
168- registry.get <THnSparse>(HIST (" hMassVsPtVsPtBVsYVsOriginVsOmegac0Type" ))->Sumw2 ();
169- }
170- if (fillCent) {
171- const AxisSpec thnAxisPromptScore{thnConfigAxisPromptScore, " BDT score prompt." };
172- const AxisSpec thnAxisCent{thnConfigAxisCent, " Centrality." };
173- const AxisSpec thnAxisPtPion{thnConfigAxisPtPion, " Pt of Pion from Omegac0." };
174- std::vector<AxisSpec> axesWithBdtCent = {thnAxisPromptScore, thnAxisMass, thnAxisPt, thnAxisY, thnAxisCent, thnAxisPtPion, thnConfigAxisNumPvContr};
175- std::vector<AxisSpec> axesWithCent = {thnAxisMass, thnAxisPt, thnAxisY, thnAxisCent, thnAxisPtPion, thnConfigAxisNumPvContr};
176- registry.add (" hBdtScoreVsMassVsPtVsYVsCentVsPtPion" , " Thn for Omegac0 candidates with BDT&Cent&pTpi" , HistType::kTHnSparseD , axesWithBdtCent);
177- registry.add (" hMassVsPtVsYVsCentVsPtPion" , " Thn for Omegac0 candidates with Cent&pTpi" , HistType::kTHnSparseD , axesWithCent);
178- registry.get <THnSparse>(HIST (" hBdtScoreVsMassVsPtVsYVsCentVsPtPion" ))->Sumw2 ();
179- registry.get <THnSparse>(HIST (" hMassVsPtVsYVsCentVsPtPion" ))->Sumw2 ();
159+
160+ if (doprocessDataWithKFParticleMl || doprocessDataWithKFParticleMlFT0C || doprocessDataWithKFParticleMlFT0M || doprocessMcWithKFParticleMl) {
161+ axes.push_back (thnAxisPromptScore);
180162 }
163+
164+ registry.add (" hReco" , " Thn for reco. #Omega_{c}^{0} candidates" , HistType::kTHnSparseD , axes);
165+ registry.get <THnSparse>(HIST (" hReco" ))->Sumw2 ();
181166 }
182167
183168 // / Evaluate centrality/multiplicity percentile (centrality estimator is automatically selected based on the used table)
@@ -196,14 +181,15 @@ struct HfTaskOmegac0ToOmegapi {
196181 if (!(candidate.resultSelections () == true || (candidate.resultSelections () == false && !selectionFlagOmegac0))) {
197182 continue ;
198183 }
184+
199185 if (yCandRecoMax >= 0 . && std::abs (candidate.kfRapOmegac ()) > yCandRecoMax) {
200186 continue ;
201187 }
202188
203189 if constexpr (applyMl) {
204- registry.fill (HIST (" hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsOmegac0Type " ), candidate.mlProbOmegac ()[ 0 ] , candidate.invMassCharmBaryon (), candidate.ptCharmBaryon (), candidate.kfRapOmegac () );
190+ registry.fill (HIST (" hReco " ), candidate.invMassCharmBaryon () , candidate.ptCharmBaryon (), candidate.kfRapOmegac (), candidate.mlProbOmegac ()[ 0 ] );
205191 } else {
206- registry.fill (HIST (" hMassVsPtVsPtBVsYVsOriginVsOmegac0Type " ), candidate.invMassCharmBaryon (), candidate.ptCharmBaryon (), candidate.kfRapOmegac ());
192+ registry.fill (HIST (" hReco " ), candidate.invMassCharmBaryon (), candidate.ptCharmBaryon (), candidate.kfRapOmegac ());
207193 }
208194 }
209195 }
@@ -214,55 +200,37 @@ struct HfTaskOmegac0ToOmegapi {
214200 for (const auto & collision : collisions) {
215201
216202 auto thisCollId = collision.globalIndex ();
217- auto groupedOmegacCandidates = applyMl
218- ? candidates.sliceBy (candOmegacKFMlPerCollision, thisCollId)
219- : candidates.sliceBy (candOmegacKFPerCollision, thisCollId);
203+ auto groupedOmegacCandidates = applyMl ? candidates.sliceBy (candOmegacKFMlPerCollision, thisCollId) : candidates.sliceBy (candOmegacKFPerCollision, thisCollId);
220204 auto numPvContributors = collision.numContrib ();
221205
222206 for (const auto & candidate : groupedOmegacCandidates) {
223207 if (!(candidate.resultSelections () == true || (candidate.resultSelections () == false && !selectionFlagOmegac0))) {
224208 continue ;
225209 }
210+
226211 if (yCandRecoMax >= 0 . && std::abs (candidate.kfRapOmegac ()) > yCandRecoMax) {
227212 continue ;
228213 }
214+
229215 float cent = evaluateCentralityColl (collision);
216+
230217 if constexpr (applyMl) {
218+ registry.fill (HIST (" hReco" ), candidate.invMassCharmBaryon (), candidate.ptCharmBaryon (), candidate.kfRapOmegac (),
219+ cent, numPvContributors, candidate.mlProbOmegac ()[0 ]);
231220 if (fillTree) {
232- kfCandMl (candidate.invMassCharmBaryon (),
233- candidate.ptCharmBaryon (),
234- candidate.kfptPiFromOmegac (),
235- candidate.mlProbOmegac ()[0 ],
236- cent);
237- } else {
238- registry.fill (HIST (" hBdtScoreVsMassVsPtVsYVsCentVsPtPion" ),
239- candidate.mlProbOmegac ()[0 ],
240- candidate.invMassCharmBaryon (),
241- candidate.ptCharmBaryon (),
242- candidate.kfRapOmegac (),
243- cent,
244- candidate.kfptPiFromOmegac (),
245- numPvContributors);
221+ kfCandMl (candidate.invMassCharmBaryon (), candidate.ptCharmBaryon (), candidate.kfptPiFromOmegac (), candidate.mlProbOmegac ()[0 ], cent);
246222 }
247223 } else {
248- registry.fill (HIST (" hMassVsPtVsYVsCentVsPtPion" ),
249- candidate.invMassCharmBaryon (),
250- candidate.ptCharmBaryon (),
251- candidate.kfRapOmegac (),
252- cent,
253- candidate.kfptPiFromOmegac (),
254- numPvContributors);
224+ registry.fill (HIST (" hReco" ), candidate.invMassCharmBaryon (), candidate.ptCharmBaryon (), candidate.kfRapOmegac (),
225+ cent, numPvContributors);
255226 }
256227 }
257228 }
258229 }
259230
260231 template <bool applyMl, typename CandType, typename CollType>
261- void processMc (const CandType& candidates,
262- Omegac0Gen const & mcParticles,
263- TracksMc const &,
264- CollType const & collisions,
265- aod::McCollisions const &)
232+ void processMc (const CandType& candidates, Omegac0Gen const & mcParticles, TracksMc const &,
233+ CollType const & collisions, aod::McCollisions const &)
266234 {
267235 // MC rec.
268236 for (const auto & candidate : candidates) {
@@ -276,10 +244,10 @@ struct HfTaskOmegac0ToOmegapi {
276244 auto numPvContributors = candidate.template collision_as <CollType>().numContrib ();
277245
278246 if constexpr (applyMl) {
279- registry.fill (HIST (" hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsOmegac0Type " ), candidate. mlProbOmegac ()[ 0 ] , candidate.invMassCharmBaryon (), candidate.ptCharmBaryon (), candidate.kfRapOmegac (), candidate.ptBhadMotherPart (), candidate.originMcRec (), candidate.flagMcMatchRec (), numPvContributors);
247+ registry.fill (HIST (" hReco " ) , candidate.invMassCharmBaryon (), candidate.ptCharmBaryon (), candidate.kfRapOmegac (), candidate.ptBhadMotherPart (), candidate.originMcRec (), candidate.flagMcMatchRec (), numPvContributors);
280248
281249 } else {
282- registry.fill (HIST (" hMassVsPtVsPtBVsYVsOriginVsOmegac0Type " ), candidate.invMassCharmBaryon (), candidate.ptCharmBaryon (), candidate.kfRapOmegac (), candidate.ptBhadMotherPart (), candidate.originMcRec (), candidate.flagMcMatchRec (), numPvContributors);
250+ registry.fill (HIST (" hReco " ), candidate.invMassCharmBaryon (), candidate.ptCharmBaryon (), candidate.kfRapOmegac (), candidate.ptBhadMotherPart (), candidate.originMcRec (), candidate.flagMcMatchRec (), numPvContributors, candidate. mlProbOmegac ()[ 0 ] );
283251 }
284252 }
285253
@@ -292,17 +260,17 @@ struct HfTaskOmegac0ToOmegapi {
292260 auto ptGen = particle.pt ();
293261 auto yGen = particle.rapidityCharmBaryonGen ();
294262
295- unsigned maxNumContrib = 0 ;
263+ int maxNumContrib = 0 ;
296264 const auto & recoCollsPerMcColl = collisions.sliceBy (colPerMcCollision, particle.mcCollision ().globalIndex ());
297265 for (const auto & recCol : recoCollsPerMcColl) {
298266 maxNumContrib = recCol.numContrib () > maxNumContrib ? recCol.numContrib () : maxNumContrib;
299267 }
300268
301269 if (particle.originMcGen () == RecoDecay::OriginType::Prompt) {
302- registry.fill (HIST (" hSparseAcc " ), ptGen, -1 ., yGen, RecoDecay::OriginType::Prompt, maxNumContrib);
270+ registry.fill (HIST (" hMcGen " ), ptGen, -1 ., yGen, RecoDecay::OriginType::Prompt, maxNumContrib);
303271 } else {
304272 float ptGenB = mcParticles.rawIteratorAt (particle.idxBhadMotherPart ()).pt ();
305- registry.fill (HIST (" hSparseAcc " ), ptGen, ptGenB, yGen, RecoDecay::OriginType::NonPrompt, maxNumContrib);
273+ registry.fill (HIST (" hMcGen " ), ptGen, ptGenB, yGen, RecoDecay::OriginType::NonPrompt, maxNumContrib);
306274 }
307275 }
308276 }
0 commit comments