5858#include < cstdlib>
5959#include < vector>
6060
61+ #include " PWGHF/Core/CentralityEstimation.h"
62+
6163using namespace o2 ;
6264using namespace o2 ::analysis;
6365using namespace o2 ::constants::physics;
@@ -66,6 +68,8 @@ using namespace o2::framework;
6668using namespace o2 ::framework::expressions;
6769using namespace o2 ::analysis::hf_correlations;
6870
71+ using namespace o2 ::hf_centrality;
72+
6973// /
7074// / Returns deltaPhi values in range [-pi/2., 3.*pi/2.], typically used for correlation studies
7175// /
@@ -92,14 +96,22 @@ struct HfCorrelatorLcHadronsSelection {
9296 HfHelper hfHelper;
9397 SliceCache cache;
9498
95- using SelCollisions = soa::Join<aod::Collisions, aod::EvSels>;
99+ // using SelCollisions = soa::Join<aod::Collisions, aod::EvSels>;
100+ using SelCollisions = soa::Join<aod::Collisions, aod::EvSels, aod::CentFT0Ms>;
96101 using CandidatesLcData = soa::Filtered<soa::Join<aod::HfCand3Prong, aod::HfSelLc>>;
97102 using CandidatesLcMcRec = soa::Filtered<soa::Join<aod::HfCand3Prong, aod::HfSelLc, aod::HfCand3ProngMcRec>>;
98103 using CandidatesLcMcGen = soa::Join<aod::McParticles, aod::HfCand3ProngMcGen>;
104+
99105
100106 // filter on selection of Lc and decay channel Lc->PKPi
101107 Filter lcFilter = ((o2::aod::hf_track_index::hfflag & static_cast <uint8_t >(1 << aod::hf_cand_3prong::DecayType::LcToPKPi)) != static_cast <uint8_t >(0 )) && (aod::hf_sel_candidate_lc::isSelLcToPKPi >= selectionFlagLc || aod::hf_sel_candidate_lc::isSelLcToPiKP >= selectionFlagLc);
102108
109+ template <typename Coll>
110+ float evaluateCentralityColl (const Coll& collision)
111+ {
112+ return o2::hf_centrality::getCentralityColl<Coll>(collision);
113+ }
114+
103115 // / Code to select collisions with at least one Lc - for real data and data-like analysis
104116 void processLcSelectionData (SelCollisions::iterator const & collision,
105117 CandidatesLcData const & candidates)
@@ -108,6 +120,7 @@ struct HfCorrelatorLcHadronsSelection {
108120 bool isLcFound = true ;
109121 bool isSel8 = true ;
110122 bool isNosameBunchPileUp = true ;
123+ bool isCentInRange = false ;
111124 if (doSelLcCollision) {
112125 for (const auto & candidate : candidates) {
113126 if (std::abs (hfHelper.yLc (candidate)) > yCandMax || candidate.pt () < ptCandMin) {
@@ -118,13 +131,19 @@ struct HfCorrelatorLcHadronsSelection {
118131 break ;
119132 }
120133 }
134+
135+ float cent=evaluateCentralityColl (collision);
136+
121137 if (useSel8) {
122138 isSel8 = collision.sel8 ();
123139 }
124140 if (selNoSameBunchPileUpColl) {
125141 isNosameBunchPileUp = static_cast <bool >(collision.selection_bit (o2::aod::evsel::kNoSameBunchPileup ));
126142 }
127- isSelColl = isLcFound && isSel8 && isNosameBunchPileUp;
143+ // isSelColl = isLcFound && isSel8 && isNosameBunchPileUp;
144+ // lcSel(isSelColl);
145+ isCentInRange = cent >= 0 . && cent < 100 .; // adjust percentile as needed
146+ isSelColl = isLcFound && isSel8 && isNosameBunchPileUp && isCentInRange;
128147 lcSel (isSelColl);
129148 }
130149 PROCESS_SWITCH (HfCorrelatorLcHadronsSelection, processLcSelectionData, " Process Lc Collision Selection Data" , true );
@@ -182,6 +201,7 @@ struct HfCorrelatorLcHadronsSelection {
182201// Lc-Hadron correlation pair builder - for real data and data-like analysis (i.e. reco-level w/o matching request via Mc truth)
183202struct HfCorrelatorLcHadrons {
184203 Produces<aod::LcHadronPair> entryLcHadronPair;
204+ Produces<aod::LcHadronPairC> entryLcHadronPairC;
185205 Produces<aod::LcHadronPairY> entryLcHadronPairY;
186206 Produces<aod::LcHadronPairTrkPID> entryLcHadronPairTrkPID;
187207 Produces<aod::LcHadronRecoInfo> entryLcHadronRecoInfo;
@@ -194,7 +214,7 @@ struct HfCorrelatorLcHadrons {
194214 Produces<aod::Hadron> entryHadron;
195215 Produces<aod::LcHadronTrkPID> entryTrkPID;
196216
197- Configurable<int > selectionFlagLc{" selectionFlagLc" , 1 , " Selection Flag for Lc" };
217+ Configurable<int > selectionFlagLc{" selectionFlagLc" , 1 , " Selection Flag for Lc in mult " };
198218 Configurable<int > numberEventsMixed{" numberEventsMixed" , 5 , " number of events mixed in ME process" };
199219 Configurable<int > applyEfficiency{" applyEfficiency" , 1 , " Flag for applying Lc efficiency weights" };
200220 Configurable<float > yCandMax{" yCandMax" , 0.8 , " max. cand. rapidity" };
@@ -236,7 +256,9 @@ struct HfCorrelatorLcHadrons {
236256 TRandom3* rnd = new TRandom3(0 );
237257
238258 // Event Mixing for the Data Mode
239- using SelCollisionsWithLc = soa::Filtered<soa::Join<aod::Collisions, aod::Mults, aod::EvSels, aod::LcSelection>>;
259+ using SelCollisionsWithLc = soa::Filtered<soa::Join<aod::Collisions, aod::Mults, aod::EvSels, aod::LcSelection, aod::CentFT0Ms>>;
260+
261+ // using SelCollisionsWithLc = soa::Filtered<soa::Join<aod::Collisions, aod::Mults, aod::EvSels, aod::LcSelection>>;
240262 using SelCollisionsWithLcMc = soa::Filtered<soa::Join<aod::McCollisions, aod::LcSelection, aod::MultsExtraMC>>; // collisionFilter applied
241263 using CandidatesLcData = soa::Filtered<soa::Join<aod::HfCand3Prong, aod::HfSelLc, aod::HfMlLcToPKPi>>;
242264 // Event Mixing for the MCRec Mode
@@ -267,6 +289,9 @@ struct HfCorrelatorLcHadrons {
267289 ConfigurableAxis binsPoolBin{" binsPoolBin" , {9 , 0 ., 9 .}, " PoolBin" };
268290 ConfigurableAxis binsMultFT0M{" binsMultFT0M" , {600 , 0 ., 6000 .}, " Multiplicity as FT0M signal amplitude" };
269291 ConfigurableAxis binsMassLc{" binsMassLc" , {200 , 1.98 , 2.58 }, " inv. mass (p K #pi) (GeV/#it{c}^{2})" };
292+ ConfigurableAxis binsCentFT0M{" binsCentFT0M" , {100 , 0 ., 100 .}, " Centrality percentile (FT0M)" };
293+
294+
270295
271296 BinningType corrBinning{{binsZVtx, binsMultiplicity}, true };
272297
@@ -286,6 +311,7 @@ struct HfCorrelatorLcHadrons {
286311 AxisSpec axisPoolBin = {binsPoolBin, " PoolBin" };
287312 AxisSpec axisRapidity = {100 , -2 , 2 , " Rapidity" };
288313 AxisSpec axisSign = {2 , -1 , 1 , " Sign" };
314+ AxisSpec axisCent = {binsCentFT0M," Centrality" };
289315
290316 registry.add (" hPtCand" , " Lc,Hadron candidates;candidate #it{p}_{T} (GeV/#it{c});entries" , {HistType::kTH1F , {axisPtLc}});
291317 registry.add (" hPtProng0" , " Lc,Hadron candidates;prong 0 #it{p}_{T} (GeV/#it{c});entries" , {HistType::kTH1F , {axisPtLc}});
@@ -303,7 +329,9 @@ struct HfCorrelatorLcHadrons {
303329 registry.add (" hZvtx" , " z vertex;z vertex;entries" , {HistType::kTH1F , {{200 , -20 ., 20 .}}});
304330 registry.add (" hLcBin" , " Lc selected in pool Bin;pool Bin;entries" , {HistType::kTH1F , {{9 , 0 ., 9 .}}});
305331 registry.add (" hTracksBin" , " Tracks selected in pool Bin;pool Bin;entries" , {HistType::kTH1F , {{9 , 0 ., 9 .}}});
306- registry.add (" hMassLcVsPt" , " Lc candidates;inv. mass (p K #pi) (GeV/#it{c}^{2});entries" , {HistType::kTH2F , {{axisMassLc}, {axisPtLc}}});
332+ registry.add (" hMassLcVsPtvsmult" , " Lc candidates;inv. mass (p K #pi) (GeV/#it{c}^{2});entries" , {HistType::kTH3F , {{axisMassLc}, {axisPtLc}, {axisCent}}});
333+
334+ // registry.add("hMassLcVsPt", "Lc candidates;inv. mass (p K #pi) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{axisMassLc}, {axisPtLc}}});
307335 registry.add (" hMassLcData" , " Lc candidates;inv. mass (p K #pi) (GeV/#it{c}^{2});entries" , {HistType::kTH1F , {{axisMassLc}}});
308336 registry.add (" hLcPoolBin" , " Lc candidates pool bin" , {HistType::kTH1F , {axisPoolBin}});
309337 registry.add (" hTracksPoolBin" , " Particles associated pool bin" , {HistType::kTH1F , {axisPoolBin}});
@@ -346,10 +374,16 @@ struct HfCorrelatorLcHadrons {
346374 registry.add (" hEtaMcGen" , " Lc,Hadron particles - MC Gen" , {HistType::kTH1F , {axisEta}});
347375 registry.add (" hPhiMcGen" , " Lc,Hadron particles - MC Gen" , {HistType::kTH1F , {axisPhi}});
348376 registry.add (" hMultFT0AMcGen" , " Lc,Hadron multiplicity FT0A - MC Gen" , {HistType::kTH1F , {axisMultiplicity}});
349-
350377 corrBinning = {{binsZVtx, binsMultiplicity}, true };
351378 }
352379
380+
381+ template <typename Coll>
382+ float evaluateCentralityColl (const Coll& collision)
383+ {
384+ return o2::hf_centrality::getCentralityColl<Coll>(collision);
385+ }
386+
353387 // / Lc-hadron correlation pair builder - for real data and data-like analysis (i.e. reco-level w/o matching request via MC truth)
354388 void processData (SelCollisionsWithLc::iterator const & collision,
355389 TracksData const & tracks,
@@ -374,6 +408,9 @@ struct HfCorrelatorLcHadrons {
374408 int gCollisionId = collision.globalIndex ();
375409 int64_t timeStamp = bc.timestamp ();
376410
411+ float cent=evaluateCentralityColl (collision);
412+ float zv=collision.posZ ();
413+
377414 int poolBin = corrBinning.getBin (std::make_tuple (collision.posZ (), collision.multFT0M ()));
378415 int nTracks = 0 ;
379416 if (collision.numContrib () > 1 ) {
@@ -412,8 +449,10 @@ struct HfCorrelatorLcHadrons {
412449 registry.fill (HIST (" hPhi" ), RecoDecay::constrainAngle (candidate.phi (), -PIHalf));
413450 registry.fill (HIST (" hY" ), hfHelper.yLc (candidate));
414451 registry.fill (HIST (" hLcBin" ), poolBin);
452+
415453 if (candidate.isSelLcToPKPi () >= selectionFlagLc) {
416- registry.fill (HIST (" hMassLcVsPt" ), hfHelper.invMassLcToPKPi (candidate), candidate.pt (), efficiencyWeightLc);
454+ registry.fill (HIST (" hMassLcVsPtvsmult" ), hfHelper.invMassLcToPKPi (candidate), candidate.pt (), cent, efficiencyWeightLc);
455+ // registry.fill(HIST("hMassLcVsPt"), hfHelper.invMassLcToPKPi(candidate), candidate.pt(), efficiencyWeightLc);
417456 registry.fill (HIST (" hMassLcData" ), hfHelper.invMassLcToPKPi (candidate), efficiencyWeightLc);
418457 registry.fill (HIST (" hSelectionStatusLcToPKPi" ), candidate.isSelLcToPKPi ());
419458 for (unsigned int iclass = 0 ; iclass < classMl->size (); iclass++) {
@@ -423,7 +462,8 @@ struct HfCorrelatorLcHadrons {
423462 entryLc (candidate.phi (), candidate.eta (), candidate.pt () * chargeLc, hfHelper.invMassLcToPKPi (candidate), poolBin, gCollisionId , timeStamp);
424463 }
425464 if (candidate.isSelLcToPiKP () >= selectionFlagLc) {
426- registry.fill (HIST (" hMassLcVsPt" ), hfHelper.invMassLcToPiKP (candidate), candidate.pt (), efficiencyWeightLc);
465+ registry.fill (HIST (" hMassLcVsPtvsmult" ), hfHelper.invMassLcToPiKP (candidate), candidate.pt (), cent, efficiencyWeightLc);
466+ // registry.fill(HIST("hMassLcVsPt"), hfHelper.invMassLcToPiKP(candidate), candidate.pt(), efficiencyWeightLc);
427467 registry.fill (HIST (" hMassLcData" ), hfHelper.invMassLcToPiKP (candidate), efficiencyWeightLc);
428468 registry.fill (HIST (" hSelectionStatusLcToPiKP" ), candidate.isSelLcToPiKP ());
429469 for (unsigned int iclass = 0 ; iclass < classMl->size (); iclass++) {
@@ -458,12 +498,14 @@ struct HfCorrelatorLcHadrons {
458498 }
459499 }
460500 if (candidate.isSelLcToPKPi () >= selectionFlagLc) {
461- entryLcHadronPair (getDeltaPhi (track.phi (), candidate.phi ()),
501+ entryLcHadronPairC (getDeltaPhi (track.phi (), candidate.phi ()),
462502 track.eta () - candidate.eta (),
463503 candidate.pt () * chargeLc,
464504 track.pt () * track.sign (),
465505 poolBin,
466- correlationStatus);
506+ correlationStatus,
507+ cent,
508+ zv);
467509 entryLcHadronPairY (track.rapidity (MassProton) - hfHelper.yLc (candidate)); // only for proton as of now
468510 entryLcHadronRecoInfo (hfHelper.invMassLcToPKPi (candidate), false );
469511 entryLcHadronGenInfo (false , false , 0 );
@@ -474,12 +516,14 @@ struct HfCorrelatorLcHadrons {
474516 }
475517 }
476518 if (candidate.isSelLcToPiKP () >= selectionFlagLc) {
477- entryLcHadronPair (getDeltaPhi (track.phi (), candidate.phi ()),
519+ entryLcHadronPairC (getDeltaPhi (track.phi (), candidate.phi ()),
478520 track.eta () - candidate.eta (),
479521 candidate.pt () * chargeLc,
480522 track.pt () * track.sign (),
481523 poolBin,
482- correlationStatus);
524+ correlationStatus,
525+ cent,
526+ zv);
483527 entryLcHadronPairY (track.rapidity (MassProton) - hfHelper.yLc (candidate)); // only for proton as of now
484528 entryLcHadronRecoInfo (hfHelper.invMassLcToPiKP (candidate), false );
485529 entryLcHadronGenInfo (false , false , 0 );
0 commit comments