1515// / \author S. Politanò, INFN Torino, Italy
1616// / \author Wu Chuntai, CUG, China
1717
18+ #include < string>
19+ #include < vector>
20+
1821#include " CCDB/BasicCCDBManager.h"
1922#include " Framework/AnalysisTask.h"
2023#include " Framework/HistogramRegistry.h"
@@ -61,6 +64,8 @@ struct HfTaskFlowCharmHadrons {
6164 Configurable<float > centralityMax{" centralityMax" , 100 ., " Maximum centrality accepted in SP/EP computation (not applied in resolution process)" };
6265 Configurable<bool > storeEP{" storeEP" , false , " Flag to store EP-related axis" };
6366 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" };
6469 Configurable<bool > saveEpResoHisto{" saveEpResoHisto" , false , " Flag to save event plane resolution histogram" };
6570 Configurable<std::string> ccdbUrl{" ccdbUrl" , " http://alice-ccdb.cern.ch" , " url of the ccdb repository" };
6671 Configurable<std::vector<int >> classMl{" classMl" , {0 , 2 }, " Indexes of BDT scores to be stored. Two indexes max." };
@@ -73,6 +78,13 @@ struct HfTaskFlowCharmHadrons {
7378 ConfigurableAxis thnConfigAxisScalarProd{" thnConfigAxisScalarProd" , {100 , 0 ., 1 .}, " " };
7479 ConfigurableAxis thnConfigAxisMlOne{" thnConfigAxisMlOne" , {1000 , 0 ., 1 .}, " " };
7580 ConfigurableAxis thnConfigAxisMlTwo{" thnConfigAxisMlTwo" , {1000 , 0 ., 1 .}, " " };
81+ ConfigurableAxis thnConfigAxisOccupancyITS{" thnConfigAxisOccupancyITS" , {14 , 0 , 14000 }, " " };
82+ ConfigurableAxis thnConfigAxisOccupancyFT0C{" thnConfigAxisOccupancyFT0C" , {14 , 0 , 140000 }, " " };
83+ ConfigurableAxis thnConfigAxisNoSameBunchPileup{" thnConfigAxisNoSameBunchPileup" , {2 , 0 , 2 }, " " };
84+ ConfigurableAxis thnConfigAxisNumTracksInTimeRange{" thnConfigAxisNumTracksInTimeRange" , {2 , 0 , 2 }, " " };
85+ ConfigurableAxis thnConfigAxisNoCollInTimeRangeNarrow{" thnConfigAxisNoCollInTimeRangeNarrow" , {2 , 0 , 2 }, " " };
86+ ConfigurableAxis thnConfigAxisNoCollInTimeRangeStandard{" thnConfigAxisNoCollInTimeRangeStandard" , {2 , 0 , 2 }, " " };
87+ ConfigurableAxis thnConfigAxisNoCollInRofStandard{" thnConfigAxisNoCollInRofStandard" , {2 , 0 , 2 }, " " };
7688
7789 using CandDsDataWMl = soa::Filtered<soa::Join<aod::HfCand3Prong, aod::HfSelDsToKKPi, aod::HfMlDsToKKPi>>;
7890 using CandDsData = soa::Filtered<soa::Join<aod::HfCand3Prong, aod::HfSelDsToKKPi>>;
@@ -120,6 +132,13 @@ struct HfTaskFlowCharmHadrons {
120132 const AxisSpec thnAxisScalarProd{thnConfigAxisScalarProd, " SP" };
121133 const AxisSpec thnAxisMlOne{thnConfigAxisMlOne, " Bkg score" };
122134 const AxisSpec thnAxisMlTwo{thnConfigAxisMlTwo, " FD score" };
135+ const AxisSpec thnAxisOccupancyITS{thnConfigAxisOccupancyITS, " OccupancyITS" };
136+ const AxisSpec thnAxisOccupancyFT0C{thnConfigAxisOccupancyFT0C, " OccupancyFT0C" };
137+ const AxisSpec thnAxisNoSameBunchPileup{thnConfigAxisNoSameBunchPileup, " NoSameBunchPileup" };
138+ const AxisSpec thnAxisNumTracksInTimeRange{thnConfigAxisNumTracksInTimeRange, " NumTracksInTimeRange" };
139+ const AxisSpec thnAxisNoCollInTimeRangeNarrow{thnConfigAxisNoCollInTimeRangeNarrow, " NoCollInTimeRangeNarrow" };
140+ const AxisSpec thnAxisNoCollInTimeRangeStandard{thnConfigAxisNoCollInTimeRangeStandard, " NoCollInTimeRangeStandard" };
141+ const AxisSpec thnAxisNoCollInRofStandard{thnConfigAxisNoCollInRofStandard, " NoCollInRofStandard" };
123142
124143 std::vector<AxisSpec> axes = {thnAxisInvMass, thnAxisPt, thnAxisCent, thnAxisScalarProd};
125144 if (storeEP) {
@@ -128,8 +147,21 @@ struct HfTaskFlowCharmHadrons {
128147 if (storeMl) {
129148 axes.insert (axes.end (), {thnAxisMlOne, thnAxisMlTwo});
130149 }
150+ if (storeOccupancy) {
151+ if (occEstimator == 1 ) {
152+ axes.insert (axes.end (), {thnAxisOccupancyITS, thnAxisNoSameBunchPileup, thnAxisNumTracksInTimeRange,
153+ thnAxisNoCollInTimeRangeNarrow, thnAxisNoCollInTimeRangeStandard, thnAxisNoCollInRofStandard});
154+ } else {
155+ axes.insert (axes.end (), {thnAxisOccupancyFT0C, thnAxisNoSameBunchPileup, thnAxisNumTracksInTimeRange,
156+ thnAxisNoCollInTimeRangeNarrow, thnAxisNoCollInTimeRangeStandard, thnAxisNoCollInRofStandard});
157+ }
158+ }
131159 registry.add (" hSparseFlowCharm" , " THn for SP" , HistType::kTHnSparseF , axes);
132160
161+ if (storeOccupancy) {
162+ registry.add (" trackOccVsFT0COcc" , " trackOccVsFT0COcc; trackOcc; FT0COcc" , {HistType::kTH2F , {thnAxisOccupancyITS, thnAxisOccupancyFT0C}});
163+ }
164+
133165 if (doprocessResolution) { // enable resolution histograms only for resolution process
134166 registry.add (" spReso/hSpResoFT0cFT0a" , " hSpResoFT0cFT0a; centrality; Q_{FT0c} #bullet Q_{FT0a}" , {HistType::kTH2F , {thnAxisCent, thnAxisScalarProd}});
135167 registry.add (" spReso/hSpResoFT0cFV0a" , " hSpResoFT0cFV0a; centrality; Q_{FT0c} #bullet Q_{FV0a}" , {HistType::kTH2F , {thnAxisCent, thnAxisScalarProd}});
@@ -236,29 +268,89 @@ struct HfTaskFlowCharmHadrons {
236268 // / \param cosDeltaPhi is the cosine of the n*(phi - evtPl) angle
237269 // / \param sp is the scalar product
238270 // / \param outputMl are the ML scores
271+ // / \param occupancy is the occupancy of the collision using the track estimator
272+ // / \param hfevselflag flag of the collision associated to utilsEvSelHf.h
239273 void fillThn (float & mass,
240274 float & pt,
241275 float & cent,
242276 float & cosNPhi,
243277 float & cosDeltaPhi,
244278 float & sp,
245- std::vector<float >& outputMl)
279+ std::vector<float >& outputMl,
280+ float & occupancy,
281+ uint16_t & hfevselflag)
246282 {
247- if (storeMl) {
248- if (storeEP) {
249- registry.fill (HIST (" hSparseFlowCharm" ), mass, pt, cent, sp, cosNPhi, cosDeltaPhi, outputMl[0 ], outputMl[1 ]);
283+ if (storeOccupancy) {
284+ if (storeMl) {
285+ if (storeEP) {
286+ 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::NumTracksInTimeRange),
289+ TESTBIT (hfevselflag, o2::hf_evsel::EventRejection::NoCollInTimeRangeNarrow),
290+ TESTBIT (hfevselflag, o2::hf_evsel::EventRejection::NoCollInTimeRangeStandard),
291+ TESTBIT (hfevselflag, o2::hf_evsel::EventRejection::NoCollInRofStandard));
292+ } else {
293+ 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::NumTracksInTimeRange),
296+ TESTBIT (hfevselflag, o2::hf_evsel::EventRejection::NoCollInTimeRangeNarrow),
297+ TESTBIT (hfevselflag, o2::hf_evsel::EventRejection::NoCollInTimeRangeStandard),
298+ TESTBIT (hfevselflag, o2::hf_evsel::EventRejection::NoCollInRofStandard));
299+ }
250300 } else {
251- registry.fill (HIST (" hSparseFlowCharm" ), mass, pt, cent, sp, outputMl[0 ], outputMl[1 ]);
301+ if (storeEP) {
302+ 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::NumTracksInTimeRange),
305+ TESTBIT (hfevselflag, o2::hf_evsel::EventRejection::NoCollInTimeRangeNarrow),
306+ TESTBIT (hfevselflag, o2::hf_evsel::EventRejection::NoCollInTimeRangeStandard),
307+ TESTBIT (hfevselflag, o2::hf_evsel::EventRejection::NoCollInRofStandard));
308+ } else {
309+ registry.fill (HIST (" hSparseFlowCharm" ), mass, pt, cent, sp, occupancy,
310+ TESTBIT (hfevselflag, o2::hf_evsel::EventRejection::NoSameBunchPileup),
311+ TESTBIT (hfevselflag, o2::hf_evsel::EventRejection::NumTracksInTimeRange),
312+ TESTBIT (hfevselflag, o2::hf_evsel::EventRejection::NoCollInTimeRangeNarrow),
313+ TESTBIT (hfevselflag, o2::hf_evsel::EventRejection::NoCollInTimeRangeStandard),
314+ TESTBIT (hfevselflag, o2::hf_evsel::EventRejection::NoCollInRofStandard));
315+ }
252316 }
253317 } else {
254- if (storeEP) {
255- registry.fill (HIST (" hSparseFlowCharm" ), mass, pt, cent, sp, cosNPhi, cosDeltaPhi);
318+ if (storeMl) {
319+ if (storeEP) {
320+ registry.fill (HIST (" hSparseFlowCharm" ), mass, pt, cent, sp, cosNPhi, cosDeltaPhi, outputMl[0 ], outputMl[1 ]);
321+ } else {
322+ registry.fill (HIST (" hSparseFlowCharm" ), mass, pt, cent, sp, outputMl[0 ], outputMl[1 ]);
323+ }
256324 } else {
257- registry.fill (HIST (" hSparseFlowCharm" ), mass, pt, cent, sp);
325+ if (storeEP) {
326+ registry.fill (HIST (" hSparseFlowCharm" ), mass, pt, cent, sp, cosNPhi, cosDeltaPhi);
327+ } else {
328+ registry.fill (HIST (" hSparseFlowCharm" ), mass, pt, cent, sp);
329+ }
258330 }
259331 }
260332 }
261333
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+
262354 // / Get the centrality
263355 // / \param collision is the collision with the centrality information
264356 float getCentrality (CollsWithQvecs::iterator const & collision)
@@ -360,6 +452,13 @@ struct HfTaskFlowCharmHadrons {
360452 if (cent < centralityMin || cent > centralityMax) {
361453 return ;
362454 }
455+ float occupancy = 0 .;
456+ uint16_t hfevflag;
457+ if (storeOccupancy) {
458+ occupancy = getOccupancy (collision);
459+ registry.fill (HIST (" trackOccVsFT0COcc" ), collision.trackOccupancyInTimeRange (), collision.ft0cOccupancyInTimeRange ());
460+ hfevflag = hfEvSel.getHfCollisionRejectionMask <true , o2::hf_centrality::CentralityEstimator::None, aod::BCsWithTimestamps>(collision, cent, ccdb, registry);
461+ }
363462
364463 std::vector<float > qVecs = getQvec (collision);
365464 float xQVec = qVecs[0 ];
@@ -459,7 +558,7 @@ struct HfTaskFlowCharmHadrons {
459558 float scalprodCand = cosNPhi * xQVec + sinNPhi * yQVec;
460559 float cosDeltaPhi = std::cos (harmonic * (phiCand - evtPl));
461560
462- fillThn (massCand, ptCand, cent, cosNPhi, cosDeltaPhi, scalprodCand, outputMl);
561+ fillThn (massCand, ptCand, cent, cosNPhi, cosDeltaPhi, scalprodCand, outputMl, occupancy, hfevflag );
463562 }
464563 }
465564
0 commit comments