Skip to content

Commit 7f3f3c5

Browse files
[PWGHF] Adding occupcany vs centrality info in HF ev. sel. utils (#8700)
Co-authored-by: ALICE Action Bot <alibuild@cern.ch>
1 parent 125d200 commit 7f3f3c5

File tree

4 files changed

+96
-75
lines changed

4 files changed

+96
-75
lines changed

PWGHF/D2H/Tasks/taskFlowCharmHadrons.cxx

Lines changed: 23 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -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();

PWGHF/TableProducer/candidateCreator2Prong.cxx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -625,10 +625,11 @@ struct HfCandidateCreator2Prong {
625625

626626
/// bitmask with event. selection info
627627
float centrality{-1.f};
628+
float occupancy = hfEvSel.getOccupancy(collision);
628629
const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask<true, CentralityEstimator::None, aod::BCsWithTimestamps>(collision, centrality, ccdb, registry);
629630

630631
/// monitor the satisfied event selections
631-
hfEvSel.fillHistograms(collision, rejectionMask, centrality);
632+
hfEvSel.fillHistograms(collision, rejectionMask, centrality, occupancy);
632633

633634
} /// end loop over collisions
634635
}
@@ -642,10 +643,11 @@ struct HfCandidateCreator2Prong {
642643

643644
/// bitmask with event. selection info
644645
float centrality{-1.f};
646+
float occupancy = hfEvSel.getOccupancy(collision);
645647
const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask<true, CentralityEstimator::FT0C, aod::BCsWithTimestamps>(collision, centrality, ccdb, registry);
646648

647649
/// monitor the satisfied event selections
648-
hfEvSel.fillHistograms(collision, rejectionMask, centrality);
650+
hfEvSel.fillHistograms(collision, rejectionMask, centrality, occupancy);
649651

650652
} /// end loop over collisions
651653
}
@@ -659,10 +661,11 @@ struct HfCandidateCreator2Prong {
659661

660662
/// bitmask with event. selection info
661663
float centrality{-1.f};
664+
float occupancy = hfEvSel.getOccupancy(collision);
662665
const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask<true, CentralityEstimator::FT0M, aod::BCsWithTimestamps>(collision, centrality, ccdb, registry);
663666

664667
/// monitor the satisfied event selections
665-
hfEvSel.fillHistograms(collision, rejectionMask, centrality);
668+
hfEvSel.fillHistograms(collision, rejectionMask, centrality, occupancy);
666669

667670
} /// end loop over collisions
668671
}

PWGHF/TableProducer/candidateCreator3Prong.cxx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -404,10 +404,11 @@ struct HfCandidateCreator3Prong {
404404

405405
/// bitmask with event. selection info
406406
float centrality{-1.f};
407+
float occupancy = hfEvSel.getOccupancy(collision);
407408
const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask<true, CentralityEstimator::None, aod::BCsWithTimestamps>(collision, centrality, ccdb, registry);
408409

409410
/// monitor the satisfied event selections
410-
hfEvSel.fillHistograms(collision, rejectionMask, centrality);
411+
hfEvSel.fillHistograms(collision, rejectionMask, centrality, occupancy);
411412

412413
} /// end loop over collisions
413414
}
@@ -421,10 +422,11 @@ struct HfCandidateCreator3Prong {
421422

422423
/// bitmask with event. selection info
423424
float centrality{-1.f};
425+
float occupancy = hfEvSel.getOccupancy(collision);
424426
const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask<true, CentralityEstimator::FT0C, aod::BCsWithTimestamps>(collision, centrality, ccdb, registry);
425427

426428
/// monitor the satisfied event selections
427-
hfEvSel.fillHistograms(collision, rejectionMask, centrality);
429+
hfEvSel.fillHistograms(collision, rejectionMask, centrality, occupancy);
428430

429431
} /// end loop over collisions
430432
}
@@ -438,10 +440,11 @@ struct HfCandidateCreator3Prong {
438440

439441
/// bitmask with event. selection info
440442
float centrality{-1.f};
443+
float occupancy = hfEvSel.getOccupancy(collision);
441444
const auto rejectionMask = hfEvSel.getHfCollisionRejectionMask<true, CentralityEstimator::FT0M, aod::BCsWithTimestamps>(collision, centrality, ccdb, registry);
442445

443446
/// monitor the satisfied event selections
444-
hfEvSel.fillHistograms(collision, rejectionMask, centrality);
447+
hfEvSel.fillHistograms(collision, rejectionMask, centrality, occupancy);
445448

446449
} /// end loop over collisions
447450
}

0 commit comments

Comments
 (0)