@@ -64,8 +64,7 @@ struct HfTaskFlowCharmHadrons {
6464 Configurable<float > centralityMax{" centralityMax" , 100 ., " Maximum centrality accepted in SP/EP computation (not applied in resolution process)" };
6565 Configurable<bool > storeEP{" storeEP" , false , " Flag to store EP-related axis" };
6666 Configurable<bool > storeMl{" storeMl" , false , " Flag to store ML scores" };
67- Configurable<int > occEstimator{" occEstimator" , 1 , " Occupancy estimation (1: ITS, 2: FT0C)" };
68- Configurable<bool > storeOccupancy{" storeOccupancy" , false , " Flag to store TH2 occITS/occFT0C + HfEvSelBitMasks" };
67+ Configurable<int > occEstimator{" occEstimator" , 0 , " Occupancy estimation (0: None, 1: ITS, 2: FT0C)" };
6968 Configurable<bool > saveEpResoHisto{" saveEpResoHisto" , false , " Flag to save event plane resolution histogram" };
7069 Configurable<std::string> ccdbUrl{" ccdbUrl" , " http://alice-ccdb.cern.ch" , " url of the ccdb repository" };
7170 Configurable<std::vector<int >> classMl{" classMl" , {0 , 2 }, " Indexes of BDT scores to be stored. Two indexes max." };
@@ -81,7 +80,7 @@ struct HfTaskFlowCharmHadrons {
8180 ConfigurableAxis thnConfigAxisOccupancyITS{" thnConfigAxisOccupancyITS" , {14 , 0 , 14000 }, " " };
8281 ConfigurableAxis thnConfigAxisOccupancyFT0C{" thnConfigAxisOccupancyFT0C" , {14 , 0 , 140000 }, " " };
8382 ConfigurableAxis thnConfigAxisNoSameBunchPileup{" thnConfigAxisNoSameBunchPileup" , {2 , 0 , 2 }, " " };
84- ConfigurableAxis thnConfigAxisNumTracksInTimeRange{ " thnConfigAxisNumTracksInTimeRange " , {2 , 0 , 2 }, " " };
83+ ConfigurableAxis thnConfigAxisOccupancy{ " thnConfigAxisOccupancy " , {2 , 0 , 2 }, " " };
8584 ConfigurableAxis thnConfigAxisNoCollInTimeRangeNarrow{" thnConfigAxisNoCollInTimeRangeNarrow" , {2 , 0 , 2 }, " " };
8685 ConfigurableAxis thnConfigAxisNoCollInTimeRangeStandard{" thnConfigAxisNoCollInTimeRangeStandard" , {2 , 0 , 2 }, " " };
8786 ConfigurableAxis thnConfigAxisNoCollInRofStandard{" thnConfigAxisNoCollInRofStandard" , {2 , 0 , 2 }, " " };
@@ -135,7 +134,7 @@ struct HfTaskFlowCharmHadrons {
135134 const AxisSpec thnAxisOccupancyITS{thnConfigAxisOccupancyITS, " OccupancyITS" };
136135 const AxisSpec thnAxisOccupancyFT0C{thnConfigAxisOccupancyFT0C, " OccupancyFT0C" };
137136 const AxisSpec thnAxisNoSameBunchPileup{thnConfigAxisNoSameBunchPileup, " NoSameBunchPileup" };
138- const AxisSpec thnAxisNumTracksInTimeRange{thnConfigAxisNumTracksInTimeRange , " NumTracksInTimeRange " };
137+ const AxisSpec thnAxisOccupancy{thnConfigAxisOccupancy , " Occupancy " };
139138 const AxisSpec thnAxisNoCollInTimeRangeNarrow{thnConfigAxisNoCollInTimeRangeNarrow, " NoCollInTimeRangeNarrow" };
140139 const AxisSpec thnAxisNoCollInTimeRangeStandard{thnConfigAxisNoCollInTimeRangeStandard, " NoCollInTimeRangeStandard" };
141140 const AxisSpec thnAxisNoCollInRofStandard{thnConfigAxisNoCollInRofStandard, " NoCollInRofStandard" };
@@ -147,18 +146,18 @@ struct HfTaskFlowCharmHadrons {
147146 if (storeMl) {
148147 axes.insert (axes.end (), {thnAxisMlOne, thnAxisMlTwo});
149148 }
150- if (storeOccupancy ) {
149+ if (occEstimator != 0 ) {
151150 if (occEstimator == 1 ) {
152- axes.insert (axes.end (), {thnAxisOccupancyITS, thnAxisNoSameBunchPileup, thnAxisNumTracksInTimeRange ,
151+ axes.insert (axes.end (), {thnAxisOccupancyITS, thnAxisNoSameBunchPileup, thnAxisOccupancy ,
153152 thnAxisNoCollInTimeRangeNarrow, thnAxisNoCollInTimeRangeStandard, thnAxisNoCollInRofStandard});
154153 } else {
155- axes.insert (axes.end (), {thnAxisOccupancyFT0C, thnAxisNoSameBunchPileup, thnAxisNumTracksInTimeRange ,
154+ axes.insert (axes.end (), {thnAxisOccupancyFT0C, thnAxisNoSameBunchPileup, thnAxisOccupancy ,
156155 thnAxisNoCollInTimeRangeNarrow, thnAxisNoCollInTimeRangeStandard, thnAxisNoCollInRofStandard});
157156 }
158157 }
159158 registry.add (" hSparseFlowCharm" , " THn for SP" , HistType::kTHnSparseF , axes);
160159
161- if (storeOccupancy ) {
160+ if (occEstimator != 0 ) {
162161 registry.add (" trackOccVsFT0COcc" , " trackOccVsFT0COcc; trackOcc; FT0COcc" , {HistType::kTH2F , {thnAxisOccupancyITS, thnAxisOccupancyFT0C}});
163162 }
164163
@@ -280,19 +279,19 @@ struct HfTaskFlowCharmHadrons {
280279 float & occupancy,
281280 uint16_t & hfevselflag)
282281 {
283- if (storeOccupancy ) {
282+ if (occEstimator != 0 ) {
284283 if (storeMl) {
285284 if (storeEP) {
286285 registry.fill (HIST (" hSparseFlowCharm" ), mass, pt, cent, sp, cosNPhi, cosDeltaPhi, outputMl[0 ], outputMl[1 ], occupancy,
287286 TESTBIT (hfevselflag, o2::hf_evsel::EventRejection::NoSameBunchPileup),
288- TESTBIT (hfevselflag, o2::hf_evsel::EventRejection::NumTracksInTimeRange ),
287+ TESTBIT (hfevselflag, o2::hf_evsel::EventRejection::Occupancy ),
289288 TESTBIT (hfevselflag, o2::hf_evsel::EventRejection::NoCollInTimeRangeNarrow),
290289 TESTBIT (hfevselflag, o2::hf_evsel::EventRejection::NoCollInTimeRangeStandard),
291290 TESTBIT (hfevselflag, o2::hf_evsel::EventRejection::NoCollInRofStandard));
292291 } else {
293292 registry.fill (HIST (" hSparseFlowCharm" ), mass, pt, cent, sp, outputMl[0 ], outputMl[1 ], occupancy,
294293 TESTBIT (hfevselflag, o2::hf_evsel::EventRejection::NoSameBunchPileup),
295- TESTBIT (hfevselflag, o2::hf_evsel::EventRejection::NumTracksInTimeRange ),
294+ TESTBIT (hfevselflag, o2::hf_evsel::EventRejection::Occupancy ),
296295 TESTBIT (hfevselflag, o2::hf_evsel::EventRejection::NoCollInTimeRangeNarrow),
297296 TESTBIT (hfevselflag, o2::hf_evsel::EventRejection::NoCollInTimeRangeStandard),
298297 TESTBIT (hfevselflag, o2::hf_evsel::EventRejection::NoCollInRofStandard));
@@ -301,14 +300,14 @@ struct HfTaskFlowCharmHadrons {
301300 if (storeEP) {
302301 registry.fill (HIST (" hSparseFlowCharm" ), mass, pt, cent, sp, cosNPhi, cosDeltaPhi, occupancy,
303302 TESTBIT (hfevselflag, o2::hf_evsel::EventRejection::NoSameBunchPileup),
304- TESTBIT (hfevselflag, o2::hf_evsel::EventRejection::NumTracksInTimeRange ),
303+ TESTBIT (hfevselflag, o2::hf_evsel::EventRejection::Occupancy ),
305304 TESTBIT (hfevselflag, o2::hf_evsel::EventRejection::NoCollInTimeRangeNarrow),
306305 TESTBIT (hfevselflag, o2::hf_evsel::EventRejection::NoCollInTimeRangeStandard),
307306 TESTBIT (hfevselflag, o2::hf_evsel::EventRejection::NoCollInRofStandard));
308307 } else {
309308 registry.fill (HIST (" hSparseFlowCharm" ), mass, pt, cent, sp, occupancy,
310309 TESTBIT (hfevselflag, o2::hf_evsel::EventRejection::NoSameBunchPileup),
311- TESTBIT (hfevselflag, o2::hf_evsel::EventRejection::NumTracksInTimeRange ),
310+ TESTBIT (hfevselflag, o2::hf_evsel::EventRejection::Occupancy ),
312311 TESTBIT (hfevselflag, o2::hf_evsel::EventRejection::NoCollInTimeRangeNarrow),
313312 TESTBIT (hfevselflag, o2::hf_evsel::EventRejection::NoCollInTimeRangeStandard),
314313 TESTBIT (hfevselflag, o2::hf_evsel::EventRejection::NoCollInRofStandard));
@@ -331,26 +330,6 @@ struct HfTaskFlowCharmHadrons {
331330 }
332331 }
333332
334- // / Get the occupancy
335- // / \param collision is the collision with the occupancy information
336- float getOccupancy (CollsWithQvecs::iterator const & collision)
337- {
338- float occupancy = -999 .;
339- switch (occEstimator) {
340- case 1 :
341- occupancy = collision.trackOccupancyInTimeRange ();
342- break ;
343- case 2 :
344- occupancy = collision.ft0cOccupancyInTimeRange ();
345- break ;
346- default :
347- LOG (warning) << " Occupancy estimator not valid. Possible values are ITS or FT0C. Fallback to ITS" ;
348- occupancy = collision.trackOccupancyInTimeRange ();
349- break ;
350- }
351- return occupancy;
352- }
353-
354333 // / Get the centrality
355334 // / \param collision is the collision with the centrality information
356335 float getCentrality (CollsWithQvecs::iterator const & collision)
@@ -380,16 +359,20 @@ struct HfTaskFlowCharmHadrons {
380359 // / Check if the collision is selected
381360 // / \param collision is the collision with the Q vector information
382361 // / \param bc is the bunch crossing with timestamp information
362+ // / \param centrality is the collision centrality
383363 // / \return true if the collision is selected, false otherwise
384364 template <o2::hf_centrality::CentralityEstimator centEstimator>
385365 bool isCollSelected (CollsWithQvecs::iterator const & collision,
386- aod::BCsWithTimestamps const &)
366+ aod::BCsWithTimestamps const &,
367+ float & centrality)
387368 {
388- float centrality{- 1 . f } ;
369+ float occupancy = hfEvSel. getOccupancy (collision, occEstimator) ;
389370 const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask <true , centEstimator, aod::BCsWithTimestamps>(collision, centrality, ccdb, registry);
371+ centrality = getCentrality (collision);
390372
391373 // / monitor the satisfied event selections
392- hfEvSel.fillHistograms (collision, rejectionMask, centrality);
374+ hfEvSel.fillHistograms (collision, rejectionMask, centrality, occupancy);
375+ registry.fill (HIST (" trackOccVsFT0COcc" ), collision.trackOccupancyInTimeRange (), collision.ft0cOccupancyInTimeRange ());
393376 return rejectionMask == 0 ;
394377 }
395378
@@ -454,8 +437,8 @@ struct HfTaskFlowCharmHadrons {
454437 }
455438 float occupancy = 0 .;
456439 uint16_t hfevflag;
457- if (storeOccupancy ) {
458- occupancy = getOccupancy (collision);
440+ if (occEstimator != 0 ) {
441+ occupancy = hfEvSel. getOccupancy (collision, occEstimator );
459442 registry.fill (HIST (" trackOccVsFT0COcc" ), collision.trackOccupancyInTimeRange (), collision.ft0cOccupancyInTimeRange ());
460443 hfevflag = hfEvSel.getHfCollisionRejectionMask <true , o2::hf_centrality::CentralityEstimator::None, aod::BCsWithTimestamps>(collision, cent, ccdb, registry);
461444 }
@@ -648,12 +631,12 @@ struct HfTaskFlowCharmHadrons {
648631 void processResolution (CollsWithQvecs::iterator const & collision,
649632 aod::BCsWithTimestamps const & bcs)
650633 {
651- if (!isCollSelected<o2::hf_centrality::CentralityEstimator::None>(collision, bcs)) {
634+ float centrality{-1 .f };
635+ if (!isCollSelected<o2::hf_centrality::CentralityEstimator::None>(collision, bcs, centrality)) {
652636 // no selection on the centrality is applied on purpose to allow for the resolution study in post-processing
653637 return ;
654638 }
655639
656- float centrality = getCentrality (collision); // centrality not updated in the rejection mask function
657640 float xQVecFT0a = collision.qvecFT0ARe ();
658641 float yQVecFT0a = collision.qvecFT0AIm ();
659642 float xQVecFT0c = collision.qvecFT0CRe ();
0 commit comments