2323
2424#include " PWGHF/Core/CentralityEstimation.h"
2525#include " PWGHF/Core/HfHelper.h"
26+ #include " PWGHF/Core/SelectorCuts.h"
2627#include " PWGHF/DataModel/CandidateReconstructionTables.h"
2728#include " PWGHF/DataModel/CandidateSelectionTables.h"
2829#include " PWGHF/Utils/utilsEvSelHf.h"
@@ -37,6 +38,7 @@ using namespace o2::framework::expressions;
3738struct HfTaskOmegac0ToOmegapi {
3839 // ML inference
3940 Configurable<bool > applyMl{" applyMl" , false , " Flag to apply ML selections" };
41+ Configurable<bool > fillCent{" fillCent" , false , " Flag to fill centrality information" };
4042 Configurable<bool > selectionFlagOmegac0{" selectionFlagOmegac0" , true , " Select Omegac0 candidates" };
4143 Configurable<double > yCandGenMax{" yCandGenMax" , 0.5 , " max. gen particle rapidity" };
4244 Configurable<double > yCandRecoMax{" yCandRecoMax" , 0.8 , " max. cand. rapidity" };
@@ -57,20 +59,26 @@ struct HfTaskOmegac0ToOmegapi {
5759 using Omegac0Gen = soa::Filtered<soa::Join<aod::McParticles, aod::HfToOmegaPiMCGen>>;
5860
5961 using Collisions = soa::Join<aod::Collisions, aod::EvSels>;
62+ using CollisionsWithFT0C = soa::Join<aod::Collisions, aod::EvSels, aod::CentFT0Cs>;
63+ using CollisionsWithFT0M = soa::Join<aod::Collisions, aod::EvSels, aod::CentFT0Ms>;
6064 using CollisionsWithMcLabels = soa::Join<aod::Collisions, aod::McCollisionLabels, aod::EvSels>;
6165
6266 Filter filterOmegaCToOmegaPiFlag = (aod::hf_track_index::hfflag & static_cast <uint8_t >(BIT(aod::hf_cand_casc_lf::DecayType2Prong::OmegaczeroToOmegaPi))) != static_cast <uint8_t >(0 );
6367 Filter filterOmegaCMatchedRec = nabs(aod::hf_cand_xic0_omegac0::flagMcMatchRec) == static_cast <int8_t >(BIT(aod::hf_cand_xic0_omegac0::DecayType::OmegaczeroToOmegaPi));
6468 Filter filterOmegaCMatchedGen = nabs(aod::hf_cand_xic0_omegac0::flagMcMatchGen) == static_cast <int8_t >(BIT(aod::hf_cand_xic0_omegac0::DecayType::OmegaczeroToOmegaPi));
69+ Preslice<Omegac0CandsKF> candOmegacKFPerCollision = aod::hf_cand_xic0_omegac0::collisionId;
70+ Preslice<Omegac0CandsMlKF> candOmegacKFMlPerCollision = aod::hf_cand_xic0_omegac0::collisionId;
6571
6672 PresliceUnsorted<CollisionsWithMcLabels> colPerMcCollision = aod::mccollisionlabel::mcCollisionId;
6773
6874 // ThnSparse for ML outputScores and Vars
69- ConfigurableAxis thnConfigAxisPromptScore{" thnConfigAxisPromptScore" , {50 , 0 , 1 }, " Prompt score bins" };
75+ ConfigurableAxis thnConfigAxisPromptScore{" thnConfigAxisPromptScore" , {100 , 0 , 1 }, " Prompt score bins" };
7076 ConfigurableAxis thnConfigAxisMass{" thnConfigAxisMass" , {120 , 2.4 , 3.1 }, " Cand. inv-mass bins" };
7177 ConfigurableAxis thnConfigAxisPtB{" thnConfigAxisPtB" , {1000 , 0 , 100 }, " Cand. beauty mother pTB bins" };
7278 ConfigurableAxis thnConfigAxisPt{" thnConfigAxisPt" , {100 , 0 , 20 }, " Cand. pT bins" };
7379 ConfigurableAxis thnConfigAxisY{" thnConfigAxisY" , {20 , -1 , 1 }, " Cand. rapidity bins" };
80+ ConfigurableAxis thnConfigAxisCent{" thnConfigAxisCent" , {100 , 0 , 100 }, " Centrality bins" };
81+ ConfigurableAxis thnConfigAxisPtPion{" thnConfigAxisPtPion" , {100 , 0 , 10 }, " PtPion from Omegac0 bins" };
7482 ConfigurableAxis thnConfigAxisOrigin{" thnConfigAxisOrigin" , {3 , -0.5 , 2.5 }, " Cand. origin type" };
7583 ConfigurableAxis thnConfigAxisMatchFlag{" thnConfigAxisMatchFlag" , {15 , -7.5 , 7.5 }, " Cand. MC Match Flag type" };
7684 ConfigurableAxis thnConfigAxisGenPtD{" thnConfigAxisGenPtD" , {500 , 0 , 50 }, " Gen Pt D" };
@@ -80,7 +88,7 @@ struct HfTaskOmegac0ToOmegapi {
8088
8189 void init (InitContext&)
8290 {
83- std::array<bool , 4 > doprocess{doprocessDataWithKFParticle, doprocessMcWithKFParticle, doprocessDataWithKFParticleMl, doprocessMcWithKFParticleMl};
91+ std::array<bool , 8 > doprocess{doprocessDataWithKFParticle, doprocessMcWithKFParticle, doprocessDataWithKFParticleMl, doprocessMcWithKFParticleMl, doprocessDataWithKFParticleFT0C, doprocessDataWithKFParticleMlFT0C, doprocessDataWithKFParticleFT0M, doprocessDataWithKFParticleMlFT0M };
8492 if ((std::accumulate (doprocess.begin (), doprocess.end (), 0 )) != 1 ) {
8593 LOGP (fatal, " One and only one process function should be enabled at a time." );
8694 }
@@ -117,6 +125,26 @@ struct HfTaskOmegac0ToOmegapi {
117125 registry.add (" hMassVsPtVsPtBVsYVsOriginVsOmegac0Type" , " Thn for Omegac0 candidates" , HistType::kTHnSparseF , axes);
118126 registry.get <THnSparse>(HIST (" hMassVsPtVsPtBVsYVsOriginVsOmegac0Type" ))->Sumw2 ();
119127 }
128+ if (fillCent) {
129+ const AxisSpec thnAxisPromptScore{thnConfigAxisPromptScore, " BDT score prompt." };
130+ const AxisSpec thnAxisCent{thnConfigAxisCent, " Centrality." };
131+ const AxisSpec thnAxisPtPion{thnConfigAxisPtPion, " Pt of Pion from Omegac0." };
132+ std::vector<AxisSpec> axesWithBdtCent = {thnAxisPromptScore, thnAxisMass, thnAxisPt, thnAxisY, thnAxisCent, thnAxisPtPion, thnConfigAxisNumPvContr};
133+ std::vector<AxisSpec> axesWithCent = {thnAxisMass, thnAxisPt, thnAxisY, thnAxisCent, thnAxisPtPion, thnConfigAxisNumPvContr};
134+ registry.add (" hBdtScoreVsMassVsPtVsYVsCentVsPtPion" , " Thn for Omegac0 candidates with BDT&Cent&pTpi" , HistType::kTHnSparseD , axesWithBdtCent);
135+ registry.add (" hMassVsPtVsYVsCentVsPtPion" , " Thn for Omegac0 candidates with Cent&pTpi" , HistType::kTHnSparseD , axesWithCent);
136+ registry.get <THnSparse>(HIST (" hBdtScoreVsMassVsPtVsYVsCentVsPtPion" ))->Sumw2 ();
137+ registry.get <THnSparse>(HIST (" hMassVsPtVsYVsCentVsPtPion" ))->Sumw2 ();
138+ }
139+ }
140+
141+ // / Evaluate centrality/multiplicity percentile (centrality estimator is automatically selected based on the used table)
142+ // / \param candidate is candidate
143+ // / \return centrality/multiplicity percentile of the collision
144+ template <typename Coll>
145+ float evaluateCentralityColl (const Coll& collision)
146+ {
147+ return o2::hf_centrality::getCentralityColl<Coll>(collision);
120148 }
121149
122150 template <bool applyMl, typename CandType, typename CollType>
@@ -138,6 +166,47 @@ struct HfTaskOmegac0ToOmegapi {
138166 }
139167 }
140168
169+ template <bool applyMl, typename CandType, typename CollType>
170+ void processDataCent (const CandType& candidates, CollType const & collisions)
171+ {
172+ for (const auto & collision : collisions) {
173+
174+ auto thisCollId = collision.globalIndex ();
175+ auto groupedOmegacCandidates = applyMl
176+ ? candidates.sliceBy (candOmegacKFMlPerCollision, thisCollId)
177+ : candidates.sliceBy (candOmegacKFPerCollision, thisCollId);
178+ auto numPvContributors = collision.numContrib ();
179+
180+ for (const auto & candidate : groupedOmegacCandidates) {
181+ if (!(candidate.resultSelections () == true || (candidate.resultSelections () == false && !selectionFlagOmegac0))) {
182+ continue ;
183+ }
184+ if (yCandRecoMax >= 0 . && std::abs (candidate.kfRapOmegac ()) > yCandRecoMax) {
185+ continue ;
186+ }
187+ float cent = evaluateCentralityColl (collision);
188+ if constexpr (applyMl) {
189+ registry.fill (HIST (" hBdtScoreVsMassVsPtVsYVsCentVsPtPion" ),
190+ candidate.mlProbOmegac ()[0 ],
191+ candidate.invMassCharmBaryon (),
192+ candidate.ptCharmBaryon (),
193+ candidate.kfRapOmegac (),
194+ cent,
195+ candidate.kfptPiFromOmegac (),
196+ numPvContributors);
197+ } else {
198+ registry.fill (HIST (" hMassVsPtVsYVsCentVsPtPion" ),
199+ candidate.invMassCharmBaryon (),
200+ candidate.ptCharmBaryon (),
201+ candidate.kfRapOmegac (),
202+ cent,
203+ candidate.kfptPiFromOmegac (),
204+ numPvContributors);
205+ }
206+ }
207+ }
208+ }
209+
141210 template <bool applyMl, typename CandType, typename CollType>
142211 void processMc (const CandType& candidates,
143212 Omegac0Gen const & mcParticles,
@@ -202,6 +271,34 @@ struct HfTaskOmegac0ToOmegapi {
202271 }
203272 PROCESS_SWITCH (HfTaskOmegac0ToOmegapi, processDataWithKFParticleMl, " process HfTaskOmegac0ToOmegapi with KFParticle and ML selections" , false );
204273
274+ void processDataWithKFParticleFT0C (Omegac0CandsKF const & candidates,
275+ CollisionsWithFT0C const & collisions)
276+ {
277+ processDataCent<false >(candidates, collisions);
278+ }
279+ PROCESS_SWITCH (HfTaskOmegac0ToOmegapi, processDataWithKFParticleFT0C, " process HfTaskOmegac0ToOmegapi with KFParticle and with FT0C centrality" , false );
280+
281+ void processDataWithKFParticleMlFT0C (Omegac0CandsMlKF const & candidates,
282+ CollisionsWithFT0C const & collisions)
283+ {
284+ processDataCent<true >(candidates, collisions);
285+ }
286+ PROCESS_SWITCH (HfTaskOmegac0ToOmegapi, processDataWithKFParticleMlFT0C, " process HfTaskOmegac0ToOmegapi with KFParticle and ML selections and with FT0C centrality" , false );
287+
288+ void processDataWithKFParticleFT0M (Omegac0CandsKF const & candidates,
289+ CollisionsWithFT0M const & collisions)
290+ {
291+ processDataCent<false >(candidates, collisions);
292+ }
293+ PROCESS_SWITCH (HfTaskOmegac0ToOmegapi, processDataWithKFParticleFT0M, " process HfTaskOmegac0ToOmegapi with KFParticle and with FT0M centrality" , false );
294+
295+ void processDataWithKFParticleMlFT0M (Omegac0CandsMlKF const & candidates,
296+ CollisionsWithFT0M const & collisions)
297+ {
298+ processDataCent<true >(candidates, collisions);
299+ }
300+ PROCESS_SWITCH (HfTaskOmegac0ToOmegapi, processDataWithKFParticleMlFT0M, " process HfTaskOmegac0ToOmegapi with KFParticle and ML selections and with FT0M centrality" , false );
301+
205302 void processMcWithKFParticle (OmegaC0CandsMcKF const & omegaC0CandidatesMcKF,
206303 Omegac0Gen const & mcParticles,
207304 TracksMc const & tracks,
0 commit comments