2121#include " Framework/runDataProcessing.h"
2222
2323#include " PWGHF/Core/HfHelper.h"
24+ #include " PWGHF/Core/CentralityEstimation.h"
2425#include " PWGHF/DataModel/CandidateReconstructionTables.h"
2526#include " PWGHF/DataModel/CandidateSelectionTables.h"
2627
2728using namespace o2 ;
2829using namespace o2 ::framework;
2930using namespace o2 ::framework::expressions;
31+ using namespace o2 ::hf_centrality;
3032
3133namespace o2 ::aod
3234{
@@ -50,6 +52,7 @@ DECLARE_SOA_COLUMN(Y, y, float);
5052DECLARE_SOA_COLUMN (Eta, eta, float ); // ! Pseudorapidity of candidate
5153DECLARE_SOA_COLUMN (Phi, phi, float ); // ! Azimuth angle of candidate
5254DECLARE_SOA_COLUMN (E, e, float ); // ! Energy of candidate (GeV)
55+ DECLARE_SOA_COLUMN (Centrality, centrality, float ); // ! Collision centrality
5356DECLARE_SOA_COLUMN (NSigTpcPi0, nSigTpcPi0, float ); // ! TPC Nsigma separation for prong0 with pion mass hypothesis
5457DECLARE_SOA_COLUMN (NSigTpcKa0, nSigTpcKa0, float ); // ! TPC Nsigma separation for prong0 with kaon mass hypothesis
5558DECLARE_SOA_COLUMN (NSigTofPi0, nSigTofPi0, float ); // ! TOF Nsigma separation for prong0 with pion mass hypothesis
@@ -129,6 +132,7 @@ DECLARE_SOA_TABLE(HfCandDpLites, "AOD", "HFCANDDPLITE",
129132 full::Eta,
130133 full::Phi,
131134 full::Y,
135+ full::Centrality,
132136 hf_cand_3prong::FlagMcMatchRec,
133137 hf_cand_3prong::OriginMcRec,
134138 hf_cand_3prong::FlagMcDecayChanRec)
@@ -210,6 +214,7 @@ DECLARE_SOA_TABLE(HfCandDpFulls, "AOD", "HFCANDDPFULL",
210214 full::Phi,
211215 full::Y,
212216 full::E,
217+ full::Centrality,
213218 hf_cand_3prong::FlagMcMatchRec,
214219 hf_cand_3prong::OriginMcRec,
215220 hf_cand_3prong::FlagMcDecayChanRec);
@@ -258,6 +263,9 @@ struct HfTreeCreatorDplusToPiKPi {
258263 using SelectedCandidatesMcWithMl = soa::Filtered<soa::Join<aod::HfCand3Prong, aod::HfCand3ProngMcRec, aod::HfSelDplusToPiKPi, aod::HfMlDplusToPiKPi>>;
259264 using TracksWPid = soa::Join<aod::Tracks, aod::TracksPidPi, aod::PidTpcTofFullPi, aod::TracksPidKa, aod::PidTpcTofFullKa>;
260265
266+ using CollisionsCent = soa::Join<aod::Collisions, aod::CentFT0Cs>;
267+ using McRecoCollisionsCent = soa::Join<aod::Collisions, aod::McCollisionLabels, aod::CentFT0Cs>;
268+
261269 Filter filterSelectCandidates = aod::hf_sel_candidate_dplus::isSelDplusToPiKPi >= selectionFlagDplus;
262270 Filter filterMcGenMatching = nabs(o2::aod::hf_cand_3prong::flagMcMatchGen) == static_cast <int8_t >(BIT(aod::hf_cand_3prong::DecayType::DplusToPiKPi));
263271
@@ -283,7 +291,7 @@ struct HfTreeCreatorDplusToPiKPi {
283291 }
284292
285293 template <bool doMc = false , bool doMl = false , typename T>
286- void fillCandidateTable (const T& candidate)
294+ void fillCandidateTable (const T& candidate, float cent )
287295 {
288296 int8_t flagMc = 0 ;
289297 int8_t originMc = 0 ;
@@ -351,6 +359,7 @@ struct HfTreeCreatorDplusToPiKPi {
351359 candidate.eta (),
352360 candidate.phi (),
353361 hfHelper.yDplus (candidate),
362+ cent,
354363 flagMc,
355364 originMc,
356365 channelMc);
@@ -432,13 +441,14 @@ struct HfTreeCreatorDplusToPiKPi {
432441 candidate.phi (),
433442 hfHelper.yDplus (candidate),
434443 hfHelper.eDplus (candidate),
444+ cent,
435445 flagMc,
436446 originMc,
437447 channelMc);
438448 }
439449 }
440450
441- void processData (aod::Collisions const & collisions,
451+ void processData (CollisionsCent const & collisions,
442452 soa::Filtered<soa::Join<aod::HfCand3Prong, aod::HfSelDplusToPiKPi>> const & candidates,
443453 TracksWPid const &)
444454 {
@@ -461,13 +471,15 @@ struct HfTreeCreatorDplusToPiKPi {
461471 continue ;
462472 }
463473 }
464- fillCandidateTable (candidate);
474+ auto coll = candidate.template collision_as <CollisionsCent>();
475+ float cent = getCentralityColl (coll, CentralityEstimator::FT0C);
476+ fillCandidateTable (candidate, cent);
465477 }
466478 }
467479
468480 PROCESS_SWITCH (HfTreeCreatorDplusToPiKPi, processData, " Process data" , true );
469481
470- void processMc (aod::Collisions const & collisions,
482+ void processMc (McRecoCollisionsCent const & collisions,
471483 aod::McCollisions const &,
472484 SelectedCandidatesMc const & candidates,
473485 MatchedGenCandidatesMc const & particles,
@@ -488,7 +500,9 @@ struct HfTreeCreatorDplusToPiKPi {
488500 rowCandidateFull.reserve (reconstructedCandSig.size ());
489501 }
490502 for (const auto & candidate : reconstructedCandSig) {
491- fillCandidateTable<true >(candidate);
503+ auto coll = candidate.template collision_as <McRecoCollisionsCent>();
504+ float cent = getCentralityColl (coll, CentralityEstimator::FT0C);
505+ fillCandidateTable<true >(candidate, cent);
492506 }
493507 } else if (fillOnlySignalMl) {
494508 rowCandidateMl.reserve (reconstructedCandSigMl.size ());
@@ -504,7 +518,9 @@ struct HfTreeCreatorDplusToPiKPi {
504518 continue ;
505519 }
506520 }
507- fillCandidateTable<true , true >(candidate);
521+ auto coll = candidate.template collision_as <McRecoCollisionsCent>();
522+ float cent = getCentralityColl (coll, CentralityEstimator::FT0C);
523+ fillCandidateTable<true , true >(candidate, cent);
508524 }
509525 } else if (fillOnlyBackground) {
510526 if (fillCandidateLiteTable) {
@@ -519,7 +535,9 @@ struct HfTreeCreatorDplusToPiKPi {
519535 continue ;
520536 }
521537 }
522- fillCandidateTable<true >(candidate);
538+ auto coll = candidate.template collision_as <McRecoCollisionsCent>();
539+ float cent = getCentralityColl (coll, CentralityEstimator::FT0C);
540+ fillCandidateTable<true >(candidate, cent);
523541 }
524542 } else {
525543 if (fillCandidateLiteTable) {
@@ -528,7 +546,9 @@ struct HfTreeCreatorDplusToPiKPi {
528546 rowCandidateFull.reserve (candidates.size ());
529547 }
530548 for (const auto & candidate : candidates) {
531- fillCandidateTable<true >(candidate);
549+ auto coll = candidate.template collision_as <McRecoCollisionsCent>();
550+ float cent = getCentralityColl (coll, CentralityEstimator::FT0C);
551+ fillCandidateTable<true >(candidate, cent);
532552 }
533553 }
534554
0 commit comments