1414// / \author Grazia Luparello <grazia.luparello@cern.ch>
1515// / \author Samuele Cattaruzzi <samuele.cattaruzzi@cern.ch>
1616
17+ #include " PWGHF/Core/CentralityEstimation.h"
1718#include " PWGHF/Core/DecayChannels.h"
1819#include " PWGHF/Core/HfHelper.h"
1920#include " PWGHF/Core/SelectorCuts.h"
2223#include " PWGHF/DataModel/CandidateSelectionTables.h"
2324#include " PWGHF/DataModel/TrackIndexSkimmingTables.h"
2425#include " PWGHF/HFC/DataModel/CorrelationTables.h"
26+ #include " PWGHF/HFC/Utils/utilsCorrelations.h"
2527#include " PWGHF/Utils/utilsAnalysis.h"
2628
2729#include " Common/CCDB/EventSelectionParams.h"
2830#include " Common/Core/RecoDecay.h"
31+ #include " Common/DataModel/Centrality.h"
2932#include " Common/DataModel/EventSelection.h"
3033#include " Common/DataModel/Multiplicity.h"
3134#include " Common/DataModel/TrackSelectionTables.h"
@@ -65,6 +68,8 @@ using namespace o2::constants::physics;
6568using namespace o2 ::constants::math;
6669using namespace o2 ::framework;
6770using namespace o2 ::framework::expressions;
71+ using namespace o2 ::hf_centrality;
72+ using namespace o2 ::analysis::hf_correlations;
6873
6974enum ResonantChannel : int8_t {
7075 PhiPi = 1 ,
@@ -92,7 +97,10 @@ struct HfTaskCorrelationDsHadrons {
9297 Configurable<bool > applyDeltaPhiCorrEff{" applyDeltaPhiCorrEff" , false , " Flag to use higher dimension histograms with delta phi correction in the efficiency correction" };
9398 Configurable<bool > doLSpair{" doLSpair" , false , " Flag to evaluate correlations for like-sign pairs" };
9499 Configurable<bool > doULSpair{" doULSpair" , false , " Flag to evaluate correlations for unlike-sign pairs" };
100+ Configurable<bool > pidTrkApplied{" pidTrkApplied" , false , " Apply PID selection for associated tracks" };
101+ Configurable<bool > forceTOF{" forceTOF" , false , " force the TOF signal for the PID" };
95102 // Configurable<bool> doMcCollisionCheck{"doMcCollisionCheck", false, "Flag for applying the collision check and selection based on MC collision info"};
103+ Configurable<int > centEstimator{" centEstimator" , 2 , " Centrality estimation (FT0A: 1, FT0C: 2, FT0M: 3, FV0A: 4)" };
96104 Configurable<int > selectionFlagDs{" selectionFlagDs" , 7 , " Selection Flag for Ds (avoid the case of flag = 0, no outputMlScore)" };
97105 Configurable<int > nTpcCrossedRaws{" nTpcCrossedRaws" , 70 , " Number of crossed TPC Rows" };
98106 // Configurable<int> eventGeneratorType{"eventGeneratorType", -1, "If positive, enable event selection using subGeneratorId information. The value indicates which events to keep (0 = MB, 4 = charm triggered, 5 = beauty triggered)"};
@@ -108,7 +116,13 @@ struct HfTaskCorrelationDsHadrons {
108116 Configurable<float > yCandMax{" yCandMax" , 0.8 , " max. cand. rapidity (used in eff. process only)" };
109117 Configurable<float > yCandGenMax{" yCandGenMax" , 0.5 , " max. gen. cand. rapidity (used in eff. process only)" };
110118 Configurable<float > ptDaughterMin{" ptDaughterMin" , 0.1 , " min. daughter pT (used in eff. process only)" };
119+ Configurable<float > tofPIDThreshold{" tofPIDThreshold" , 0.75 , " minimum pT after which TOF PID is applicable" };
120+ Configurable<float > centralityMin{" centralityMin" , 0 ., " min. centrality" };
121+ Configurable<float > centralityMax{" centralityMax" , 100 ., " max. centrality" };
111122 Configurable<std::vector<int >> classMl{" classMl" , {0 , 1 , 2 }, " Indexes of ML scores to be stored. Three indexes max." };
123+ Configurable<std::vector<int >> trkPIDspecies{" trkPIDspecies" , std::vector<int >{o2::track::PID::Proton, o2::track::PID::Pion, o2::track::PID::Kaon}, " Trk sel: Particles species for PID, proton, pion, kaon" };
124+ Configurable<std::vector<float >> pidTPCMax{" pidTPCMax" , std::vector<float >{3 ., 0 ., 0 .}, " maximum nSigma TPC" };
125+ Configurable<std::vector<float >> pidTOFMax{" pidTOFMax" , std::vector<float >{3 ., 0 ., 0 .}, " maximum nSigma TOF" };
112126 Configurable<std::vector<double >> binsPtD{" binsPtD" , std::vector<double >{o2::analysis::hf_cuts_ds_to_k_k_pi::vecBinsPt}, " pT bin limits for candidate mass plots and efficiency" };
113127 Configurable<std::vector<double >> binsPtHadron{" binsPtHadron" , std::vector<double >{0.3 , 2 ., 4 ., 8 ., 12 ., 50 .}, " pT bin limits for assoc particle efficiency" };
114128 Configurable<std::vector<double >> mlOutputPromptMin{" mlOutputPromptMin" , {0.5 , 0.5 , 0.5 , 0.5 }, " Machine learning scores for prompt" };
@@ -143,16 +157,17 @@ struct HfTaskCorrelationDsHadrons {
143157
144158 Service<ccdb::BasicCCDBManager> ccdb;
145159
146- using DsHadronPair = soa::Join<aod::DsHadronPair, aod::DsHadronRecoInfo>;
147- using DsHadronPairFull = soa::Join<aod::DsHadronPair, aod::DsHadronRecoInfo, aod::DsHadronGenInfo>;
148- using DsHadronPairWithMl = soa::Join<aod::DsHadronPair, aod::DsHadronRecoInfo, aod::DsHadronMlInfo, aod::TrackRecoInfo>;
149- using DsHadronPairFullWithMl = soa::Join<aod::DsHadronPair, aod::DsHadronRecoInfo, aod::DsHadronGenInfo, aod::DsHadronMlInfo, aod::TrackRecoInfo>;
160+ using DsHadronPair = soa::Filtered<soa:: Join<aod::DsHadronPair, aod::DsHadronRecoInfo> >;
161+ using DsHadronPairFull = soa::Filtered<soa:: Join<aod::DsHadronPair, aod::DsHadronRecoInfo, aod::DsHadronGenInfo> >;
162+ using DsHadronPairWithMl = soa::Filtered<soa:: Join<aod::DsHadronPair, aod::DsHadronRecoInfo, aod::DsHadronMlInfo, aod::TrackRecoInfo> >;
163+ using DsHadronPairFullWithMl = soa::Filtered<soa:: Join<aod::DsHadronPair, aod::DsHadronRecoInfo, aod::DsHadronGenInfo, aod::DsHadronMlInfo, aod::TrackRecoInfo> >;
150164 using CandDsMcReco = soa::Filtered<soa::Join<aod::HfCand3Prong, aod::HfSelDsToKKPi, aod::HfMlDsToKKPi, aod::HfCand3ProngMcRec>>; // flagDsFilter applied
151165 using CandDsMcGen = soa::Join<aod::McParticles, aod::HfCand3ProngMcGen>; // flagDsFilter applied
152166 using TracksWithMc = soa::Filtered<soa::Join<aod::TracksWDca, aod::TrackSelection, aod::TracksExtra, o2::aod::McTrackLabels>>; // trackFilter applied
153167
154168 Filter flagDsFilter = ((o2::aod::hf_track_index::hfflag & static_cast <uint8_t >(1 << aod::hf_cand_3prong::DecayType::DsToKKPi)) != static_cast <uint8_t >(0 )) && (aod::hf_sel_candidate_ds::isSelDsToKKPi >= selectionFlagDs || aod::hf_sel_candidate_ds::isSelDsToPiKK >= selectionFlagDs);
155169 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);
170+ Filter trackPairFilter = (nabs(aod::hf_correlation_ds_hadron::signedPtHadron) > ptTrackMin) && (nabs(aod::hf_correlation_ds_hadron::signedPtHadron) < ptTrackMax);
156171
157172 Preslice<CandDsMcReco> perCollisionCand = o2::aod::hf_cand::collisionId;
158173 Preslice<CandDsMcGen> perCollisionCandMc = o2::aod::mcparticle::mcCollisionId;
@@ -431,6 +446,27 @@ struct HfTaskCorrelationDsHadrons {
431446 return weight;
432447 }
433448
449+ // / Check event selections for collision and fill the collision table
450+ // / \param collision is the collision
451+ template <typename Coll>
452+ int getCentrality (Coll const & collision)
453+ {
454+ int cent{-1 };
455+ if (centEstimator == CentralityEstimator::FT0A) {
456+ cent = collision.centFT0A ();
457+ } else if (centEstimator == CentralityEstimator::FT0C) {
458+ cent = collision.centFT0C ();
459+ } else if (centEstimator == CentralityEstimator::FT0M) {
460+ cent = collision.centFT0M ();
461+ } else if (centEstimator == CentralityEstimator::FV0A) {
462+ cent = collision.centFV0A ();
463+ } else {
464+ LOG (fatal) << " Centrality estimator not recognized for collision selection" ;
465+ std::abort ();
466+ }
467+ return cent;
468+ }
469+
434470 void processData (DsHadronPairWithMl const & pairEntries,
435471 aod::DsCandRecoInfo const & candidates)
436472 {
@@ -1061,7 +1097,7 @@ struct HfTaskCorrelationDsHadrons {
10611097 PROCESS_SWITCH (HfTaskCorrelationDsHadrons, processMcCandEfficiencyWoColl, " Process MC for calculating candidate reconstruction efficiency" , false );
10621098
10631099 // / Ds-Hadron correlation - for calculating associated particle tracking efficiency using MC reco-level analysis
1064- void processMcTrackEfficiency (soa::Join<aod::Collisions, aod::FT0Mults, aod::EvSels, aod::McCollisionLabels> const & collisions,
1100+ void processMcTrackEfficiency (soa::Join<aod::Collisions, aod::FT0Mults, aod::EvSels, aod::CentFT0Ms, aod::CentFT0As, aod::CentFT0Cs, aod::CentFV0As, aod:: McCollisionLabels> const & collisions,
10651101 soa::Join<aod::McCollisions, aod::MultsExtraMC> const & mcCollisions,
10661102 aod::McParticles const & mcParticles,
10671103 TracksWithMc const & tracksData)
@@ -1093,6 +1129,10 @@ struct HfTaskCorrelationDsHadrons {
10931129 if (selNoSameBunchPileUpColl && !(collision.selection_bit (o2::aod::evsel::kNoSameBunchPileup ))) {
10941130 continue ;
10951131 }
1132+ int centrality = getCentrality (collision);
1133+ if (centrality < centralityMin || centrality > centralityMax) {
1134+ continue ;
1135+ }
10961136 if (!collision.has_mcCollision ()) {
10971137 registry.fill (HIST (" hFakeCollision" ), 0 .);
10981138 continue ;
@@ -1151,6 +1191,11 @@ struct HfTaskCorrelationDsHadrons {
11511191 continue ;
11521192 }
11531193 if (track.has_mcParticle ()) {
1194+ if (pidTrkApplied) {
1195+ if (!passPIDSelection (track, trkPIDspecies, pidTPCMax, pidTOFMax, tofPIDThreshold, forceTOF)) {
1196+ continue ;
1197+ }
1198+ }
11541199 auto mcParticle = track.template mcParticle_as <aod::McParticles>();
11551200 if (mcParticle.isPhysicalPrimary ()) {
11561201 registry.fill (HIST (" hPtParticleAssocMcRec" ), track.pt ());
0 commit comments