Skip to content

Commit a801731

Browse files
[PWGHF] Occupancy studies in Pb-Pb collisions for D mesons (#8475)
Co-authored-by: ALICE Action Bot <alibuild@cern.ch>
1 parent 96ad55b commit a801731

File tree

2 files changed

+138
-11
lines changed

2 files changed

+138
-11
lines changed

PWGHF/D2H/Tasks/taskFlowCharmHadrons.cxx

Lines changed: 108 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
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

PWGHF/Utils/utilsEvSelHf.h

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ enum EventRejection {
4848
NContrib,
4949
Chi2,
5050
PositionZ,
51+
NoCollInTimeRangeNarrow,
52+
NoCollInTimeRangeStandard,
53+
NoCollInRofStandard,
5154
NEventRejection
5255
};
5356

@@ -73,6 +76,9 @@ void setEventRejectionLabels(Histo& hRejection, std::string softwareTriggerLabel
7376
hRejection->GetXaxis()->SetBinLabel(EventRejection::NContrib + 1, "# of PV contributors");
7477
hRejection->GetXaxis()->SetBinLabel(EventRejection::Chi2 + 1, "PV #it{#chi}^{2}");
7578
hRejection->GetXaxis()->SetBinLabel(EventRejection::PositionZ + 1, "PV #it{z}");
79+
hRejection->GetXaxis()->SetBinLabel(EventRejection::NoCollInTimeRangeNarrow + 1, "No coll timerange narrow");
80+
hRejection->GetXaxis()->SetBinLabel(EventRejection::NoCollInTimeRangeStandard + 1, "No coll timerange strict");
81+
hRejection->GetXaxis()->SetBinLabel(EventRejection::NoCollInRofStandard + 1, "No coll in ROF std");
7682
}
7783

7884
struct HfEventSelection : o2::framework::ConfigurableGroup {
@@ -88,12 +94,16 @@ struct HfEventSelection : o2::framework::ConfigurableGroup {
8894
o2::framework::Configurable<bool> useIsGoodZvtxFT0vsPV{"useIsGoodZvtxFT0vsPV", false, "Check consistency between PVz from central barrel with that from FT0 timing"};
8995
o2::framework::Configurable<bool> useNoSameBunchPileup{"useNoSameBunchPileup", false, "Exclude collisions in bunches with more than 1 reco. PV"}; // POTENTIALLY BAD FOR BEAUTY ANALYSES
9096
o2::framework::Configurable<bool> useNumTracksInTimeRange{"useNumTracksInTimeRange", false, "Apply occupancy selection (num. ITS tracks with at least 5 clusters in +-100us from current collision)"};
97+
o2::framework::Configurable<bool> useFT0cOccEstimator{"useFT0cOccEstimator", false, "Adopt FT0c amplitudes as occupancy estimator instead of ITS tracks"};
9198
o2::framework::Configurable<int> numTracksInTimeRangeMin{"numTracksInTimeRangeMin", 0, "Minimum occupancy"};
9299
o2::framework::Configurable<int> numTracksInTimeRangeMax{"numTracksInTimeRangeMax", 1000000, "Maximum occupancy"};
93100
o2::framework::Configurable<int> nPvContributorsMin{"nPvContributorsMin", 0, "Minimum number of PV contributors"};
94101
o2::framework::Configurable<float> chi2PvMax{"chi2PvMax", -1.f, "Maximum PV chi2"};
95102
o2::framework::Configurable<float> zPvPosMin{"zPvPosMin", -10.f, "Minimum PV posZ (cm)"};
96103
o2::framework::Configurable<float> zPvPosMax{"zPvPosMax", 10.f, "Maximum PV posZ (cm)"};
104+
o2::framework::Configurable<bool> useNoCollInTimeRangeNarrow{"useNoCollInTimeRangeNarrow", false, "Reject collisions in time range narrow"};
105+
o2::framework::Configurable<bool> useNoCollInTimeRangeStandard{"useNoCollInTimeRangeStandard", false, "Reject collisions in time range strict"};
106+
o2::framework::Configurable<bool> useNoCollInRofStandard{"useNoCollInRofStandard", false, "Reject collisions in ROF standard"};
97107
o2::framework::Configurable<std::string> softwareTrigger{"softwareTrigger", "", "Label of software trigger. Multiple triggers can be selected dividing them by a comma. Set None if you want bcs that are not selected by any trigger"};
98108
o2::framework::Configurable<uint64_t> bcMarginForSoftwareTrigger{"bcMarginForSoftwareTrigger", 100, "Number of BCs of margin for software triggers"};
99109
o2::framework::Configurable<std::string> ccdbPathSoftwareTrigger{"ccdbPathSoftwareTrigger", "Users/m/mpuccio/EventFiltering/OTS/", "ccdb path for ZORRO objects"};
@@ -189,9 +199,27 @@ struct HfEventSelection : o2::framework::ConfigurableGroup {
189199
if (useNoSameBunchPileup && !collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup)) {
190200
SETBIT(rejectionMask, EventRejection::NoSameBunchPileup);
191201
}
192-
/// occupancy estimator (ITS tracks with at least 5 clusters in +-10us from current collision)
202+
/// No collisions in time range narrow
203+
if (useNoCollInTimeRangeNarrow && !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeNarrow)) {
204+
SETBIT(rejectionMask, EventRejection::NoCollInTimeRangeNarrow);
205+
}
206+
/// No collisions in time range strict
207+
if (useNoCollInTimeRangeStandard && !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) {
208+
SETBIT(rejectionMask, EventRejection::NoCollInTimeRangeStandard);
209+
}
210+
/// No collisions in ROF standard
211+
if (useNoCollInRofStandard && !collision.selection_bit(o2::aod::evsel::kNoCollInRofStandard)) {
212+
SETBIT(rejectionMask, EventRejection::NoCollInRofStandard);
213+
}
193214
if (useNumTracksInTimeRange) {
194-
const int numTracksInTimeRange = collision.trackOccupancyInTimeRange();
215+
float numTracksInTimeRange;
216+
if (useFT0cOccEstimator) {
217+
/// occupancy estimator (FT0c signal amplitudes in +-10us from current collision)
218+
numTracksInTimeRange = collision.ft0cOccupancyInTimeRange();
219+
} else {
220+
/// occupancy estimator (ITS tracks with at least 5 clusters in +-10us from current collision)
221+
numTracksInTimeRange = static_cast<float>(collision.trackOccupancyInTimeRange());
222+
}
195223
if (numTracksInTimeRange < numTracksInTimeRangeMin || numTracksInTimeRange > numTracksInTimeRangeMax) {
196224
SETBIT(rejectionMask, EventRejection::NumTracksInTimeRange);
197225
}

0 commit comments

Comments
 (0)