@@ -65,6 +65,7 @@ struct HfTaskFlowCharmHadrons {
6565 Configurable<float > centralityMax{" centralityMax" , 100 ., " Maximum centrality accepted in SP/EP computation (not applied in resolution process)" };
6666 Configurable<bool > storeEP{" storeEP" , false , " Flag to store EP-related axis" };
6767 Configurable<bool > storeMl{" storeMl" , false , " Flag to store ML scores" };
68+ Configurable<bool > storeResoOccu{" storeResoOccu" , false , " Flag to store Occupancy in resolution ThnSparse" };
6869 Configurable<int > occEstimator{" occEstimator" , 0 , " Occupancy estimation (0: None, 1: ITS, 2: FT0C)" };
6970 Configurable<bool > saveEpResoHisto{" saveEpResoHisto" , false , " Flag to save event plane resolution histogram" };
7071 Configurable<std::string> ccdbUrl{" ccdbUrl" , " http://alice-ccdb.cern.ch" , " url of the ccdb repository" };
@@ -85,6 +86,9 @@ struct HfTaskFlowCharmHadrons {
8586 ConfigurableAxis thnConfigAxisNoCollInTimeRangeNarrow{" thnConfigAxisNoCollInTimeRangeNarrow" , {2 , 0 , 2 }, " " };
8687 ConfigurableAxis thnConfigAxisNoCollInTimeRangeStandard{" thnConfigAxisNoCollInTimeRangeStandard" , {2 , 0 , 2 }, " " };
8788 ConfigurableAxis thnConfigAxisNoCollInRofStandard{" thnConfigAxisNoCollInRofStandard" , {2 , 0 , 2 }, " " };
89+ ConfigurableAxis thnConfigAxisResoFT0cFV0a{" thnConfigAxisResoFT0cFV0a" , {160 , -8 , 8 }, " " };
90+ ConfigurableAxis thnConfigAxisResoFT0cTPCtot{" thnConfigAxisResoFT0cTPCtot" , {160 , -8 , 8 }, " " };
91+ ConfigurableAxis thnConfigAxisResoFV0aTPCtot{" thnConfigAxisResoFV0aTPCtot" , {160 , -8 , 8 }, " " };
8892
8993 using CandDsDataWMl = soa::Filtered<soa::Join<aod::HfCand3Prong, aod::HfSelDsToKKPi, aod::HfMlDsToKKPi>>;
9094 using CandDsData = soa::Filtered<soa::Join<aod::HfCand3Prong, aod::HfSelDsToKKPi>>;
@@ -124,6 +128,9 @@ struct HfTaskFlowCharmHadrons {
124128
125129 void init (InitContext&)
126130 {
131+ if (storeResoOccu && occEstimator == 0 ) {
132+ LOGP (fatal, " Occupancy estimation must be enabled to store resolution THnSparse! Please check your configuration!" );
133+ }
127134 const AxisSpec thnAxisInvMass{thnConfigAxisInvMass, " Inv. mass (GeV/#it{c}^{2})" };
128135 const AxisSpec thnAxisPt{thnConfigAxisPt, " #it{p}_{T} (GeV/#it{c})" };
129136 const AxisSpec thnAxisCent{thnConfigAxisCent, " Centrality" };
@@ -139,6 +146,10 @@ struct HfTaskFlowCharmHadrons {
139146 const AxisSpec thnAxisNoCollInTimeRangeNarrow{thnConfigAxisNoCollInTimeRangeNarrow, " NoCollInTimeRangeNarrow" };
140147 const AxisSpec thnAxisNoCollInTimeRangeStandard{thnConfigAxisNoCollInTimeRangeStandard, " NoCollInTimeRangeStandard" };
141148 const AxisSpec thnAxisNoCollInRofStandard{thnConfigAxisNoCollInRofStandard, " NoCollInRofStandard" };
149+ // TODO: currently only the Q vector of FT0c FV0a and TPCtot are considered
150+ const AxisSpec thnAxisResoFT0cFV0a{thnConfigAxisResoFT0cFV0a, " Q_{FT0c} #bullet Q_{FV0a}" };
151+ const AxisSpec thnAxisResoFT0cTPCtot{thnConfigAxisResoFT0cTPCtot, " Q_{FT0c} #bullet Q_{TPCtot}" };
152+ const AxisSpec thnAxisResoFV0aTPCtot{thnConfigAxisResoFV0aTPCtot, " Q_{FV0a} #bullet Q_{TPCtot}" };
142153
143154 std::vector<AxisSpec> axes = {thnAxisInvMass, thnAxisPt, thnAxisCent, thnAxisScalarProd};
144155 if (storeEP) {
@@ -201,6 +212,18 @@ struct HfTaskFlowCharmHadrons {
201212 registry.add (" epReso/hEpResoTPCposTPCneg" , " hEpResoTPCposTPCneg; centrality; #Delta#Psi_{sub}" , {HistType::kTH2F , {thnAxisCent, thnAxisCosNPhi}});
202213 }
203214
215+ if (storeResoOccu) {
216+ std::vector<AxisSpec> axes_reso = {thnAxisCent, thnAxisResoFT0cFV0a, thnAxisResoFT0cTPCtot, thnAxisResoFV0aTPCtot};
217+ if (occEstimator == 1 ) {
218+ axes_reso.insert (axes_reso.end (), {thnAxisOccupancyITS, thnAxisNoSameBunchPileup, thnAxisOccupancy,
219+ thnAxisNoCollInTimeRangeNarrow, thnAxisNoCollInTimeRangeStandard, thnAxisNoCollInRofStandard});
220+ } else {
221+ axes_reso.insert (axes_reso.end (), {thnAxisOccupancyFT0C, thnAxisNoSameBunchPileup, thnAxisOccupancy,
222+ thnAxisNoCollInTimeRangeNarrow, thnAxisNoCollInTimeRangeStandard, thnAxisNoCollInRofStandard});
223+ }
224+ registry.add (" spReso/hSparseReso" , " THn for resolution with occupancy" , HistType::kTHnSparseF , axes_reso);
225+ }
226+
204227 hfEvSel.addHistograms (registry); // collision monitoring
205228 ccdb->setURL (ccdbUrl);
206229 ccdb->setCaching (true );
@@ -260,6 +283,18 @@ struct HfTaskFlowCharmHadrons {
260283 return deltaPsi;
261284 }
262285
286+ // / Get the event selection flags
287+ // / \param hfevselflag is the event selection flag
288+ std::vector<int > getEventSelectionFlags (uint16_t hfevselflag)
289+ {
290+ return {
291+ TESTBIT (hfevselflag, o2::hf_evsel::EventRejection::NoSameBunchPileup),
292+ TESTBIT (hfevselflag, o2::hf_evsel::EventRejection::Occupancy),
293+ TESTBIT (hfevselflag, o2::hf_evsel::EventRejection::NoCollInTimeRangeNarrow),
294+ TESTBIT (hfevselflag, o2::hf_evsel::EventRejection::NoCollInTimeRangeStandard),
295+ TESTBIT (hfevselflag, o2::hf_evsel::EventRejection::NoCollInRofStandard)};
296+ }
297+
263298 // / Fill THnSparse
264299 // / \param mass is the invariant mass of the candidate
265300 // / \param pt is the transverse momentum of the candidate
@@ -281,37 +316,22 @@ struct HfTaskFlowCharmHadrons {
281316 uint16_t & hfevselflag)
282317 {
283318 if (occEstimator != 0 ) {
319+ std::vector<int > evtSelFlags = getEventSelectionFlags (hfevselflag);
284320 if (storeMl) {
285321 if (storeEP) {
286322 registry.fill (HIST (" hSparseFlowCharm" ), mass, pt, cent, sp, cosNPhi, cosDeltaPhi, outputMl[0 ], outputMl[1 ], occupancy,
287- TESTBIT (hfevselflag, o2::hf_evsel::EventRejection::NoSameBunchPileup),
288- TESTBIT (hfevselflag, o2::hf_evsel::EventRejection::Occupancy),
289- TESTBIT (hfevselflag, o2::hf_evsel::EventRejection::NoCollInTimeRangeNarrow),
290- TESTBIT (hfevselflag, o2::hf_evsel::EventRejection::NoCollInTimeRangeStandard),
291- TESTBIT (hfevselflag, o2::hf_evsel::EventRejection::NoCollInRofStandard));
323+ evtSelFlags[0 ], evtSelFlags[1 ], evtSelFlags[2 ], evtSelFlags[3 ], evtSelFlags[4 ]);
292324 } else {
293325 registry.fill (HIST (" hSparseFlowCharm" ), mass, pt, cent, sp, outputMl[0 ], outputMl[1 ], occupancy,
294- TESTBIT (hfevselflag, o2::hf_evsel::EventRejection::NoSameBunchPileup),
295- TESTBIT (hfevselflag, o2::hf_evsel::EventRejection::Occupancy),
296- TESTBIT (hfevselflag, o2::hf_evsel::EventRejection::NoCollInTimeRangeNarrow),
297- TESTBIT (hfevselflag, o2::hf_evsel::EventRejection::NoCollInTimeRangeStandard),
298- TESTBIT (hfevselflag, o2::hf_evsel::EventRejection::NoCollInRofStandard));
326+ evtSelFlags[0 ], evtSelFlags[1 ], evtSelFlags[2 ], evtSelFlags[3 ], evtSelFlags[4 ]);
299327 }
300328 } else {
301329 if (storeEP) {
302330 registry.fill (HIST (" hSparseFlowCharm" ), mass, pt, cent, sp, cosNPhi, cosDeltaPhi, occupancy,
303- TESTBIT (hfevselflag, o2::hf_evsel::EventRejection::NoSameBunchPileup),
304- TESTBIT (hfevselflag, o2::hf_evsel::EventRejection::Occupancy),
305- TESTBIT (hfevselflag, o2::hf_evsel::EventRejection::NoCollInTimeRangeNarrow),
306- TESTBIT (hfevselflag, o2::hf_evsel::EventRejection::NoCollInTimeRangeStandard),
307- TESTBIT (hfevselflag, o2::hf_evsel::EventRejection::NoCollInRofStandard));
331+ evtSelFlags[0 ], evtSelFlags[1 ], evtSelFlags[2 ], evtSelFlags[3 ], evtSelFlags[4 ]);
308332 } else {
309333 registry.fill (HIST (" hSparseFlowCharm" ), mass, pt, cent, sp, occupancy,
310- TESTBIT (hfevselflag, o2::hf_evsel::EventRejection::NoSameBunchPileup),
311- TESTBIT (hfevselflag, o2::hf_evsel::EventRejection::Occupancy),
312- TESTBIT (hfevselflag, o2::hf_evsel::EventRejection::NoCollInTimeRangeNarrow),
313- TESTBIT (hfevselflag, o2::hf_evsel::EventRejection::NoCollInTimeRangeStandard),
314- TESTBIT (hfevselflag, o2::hf_evsel::EventRejection::NoCollInRofStandard));
334+ evtSelFlags[0 ], evtSelFlags[1 ], evtSelFlags[2 ], evtSelFlags[3 ], evtSelFlags[4 ]);
315335 }
316336 }
317337 } else {
@@ -607,11 +627,6 @@ struct HfTaskFlowCharmHadrons {
607627 aod::BCsWithTimestamps const & bcs)
608628 {
609629 float centrality{-1 .f };
610- if (!isCollSelected<o2::hf_centrality::CentralityEstimator::FT0C>(collision, bcs, centrality)) {
611- // no selection on the centrality is applied on purpose to allow for the resolution study in post-processing
612- return ;
613- }
614-
615630 float xQVecFT0a = collision.qvecFT0ARe ();
616631 float yQVecFT0a = collision.qvecFT0AIm ();
617632 float xQVecFT0c = collision.qvecFT0CRe ();
@@ -627,6 +642,24 @@ struct HfTaskFlowCharmHadrons {
627642 float xQVecBTot = collision.qvecBTotRe ();
628643 float yQVecBTot = collision.qvecBTotIm ();
629644
645+ centrality = o2::hf_centrality::getCentralityColl (collision, o2::hf_centrality::CentralityEstimator::FT0C);
646+ if (storeResoOccu) {
647+ float occupancy{-1 .f };
648+ occupancy = getOccupancyColl (collision, occEstimator);
649+ registry.fill (HIST (" trackOccVsFT0COcc" ), collision.trackOccupancyInTimeRange (), collision.ft0cOccupancyInTimeRange ());
650+ uint16_t hfevflag = hfEvSel.getHfCollisionRejectionMask <true , o2::hf_centrality::CentralityEstimator::None, aod::BCsWithTimestamps>(collision, centrality, ccdb, registry);
651+ std::vector<int > evtSelFlags = getEventSelectionFlags (hfevflag);
652+ registry.fill (HIST (" spReso/hSparseReso" ), centrality, xQVecFT0c * xQVecFV0a + yQVecFT0c * yQVecFV0a,
653+ xQVecFT0c * xQVecBTot + yQVecFT0c * yQVecBTot,
654+ xQVecFV0a * xQVecBTot + yQVecFV0a * yQVecBTot,
655+ occupancy, evtSelFlags[0 ], evtSelFlags[1 ], evtSelFlags[2 ], evtSelFlags[3 ], evtSelFlags[4 ]);
656+ }
657+
658+ if (!isCollSelected<o2::hf_centrality::CentralityEstimator::FT0C>(collision, bcs, centrality)) {
659+ // no selection on the centrality is applied, but on event selection flags
660+ return ;
661+ }
662+
630663 registry.fill (HIST (" spReso/hSpResoFT0cFT0a" ), centrality, xQVecFT0c * xQVecFT0a + yQVecFT0c * yQVecFT0a);
631664 registry.fill (HIST (" spReso/hSpResoFT0cFV0a" ), centrality, xQVecFT0c * xQVecFV0a + yQVecFT0c * yQVecFV0a);
632665 registry.fill (HIST (" spReso/hSpResoFT0cTPCpos" ), centrality, xQVecFT0c * xQVecBPos + yQVecFT0c * yQVecBPos);
0 commit comments