Skip to content

Commit 634f647

Browse files
lucasjsilvafjonasALICE
authored andcommitted
[PWGLF] Improvements in the track criteria selection (#15702)
1 parent fa9aecc commit 634f647

File tree

1 file changed

+65
-54
lines changed

1 file changed

+65
-54
lines changed

PWGLF/Tasks/GlobalEventProperties/studyPnch.cxx

Lines changed: 65 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ AxisSpec axisEvent{10, 0.5, 10.5, "#Event", "EventAxis"};
7676
AxisSpec axisVtxZ{40, -20, 20, "Vertex Z", "VzAxis"};
7777
AxisSpec axisEta{40, -2, 2, "#eta", "EtaAxis"};
7878
AxisSpec axisPhi{629, 0, o2::constants::math::TwoPI, "#phi"};
79+
AxisSpec axisCollSel{5, 0.5, 5.5, "#Event", "CollSelAxis"};
7980
auto static constexpr kMinCharge = 3.f;
8081

8182
struct StudyPnch {
@@ -97,6 +98,7 @@ struct StudyPnch {
9798
ConfigurableAxis ft0aMultHistBin{"ft0aMultHistBin", {501, -0.5, 500.5}, ""};
9899
ConfigurableAxis ft0cMultHistBin{"ft0cMultHistBin", {501, -0.5, 500.5}, ""};
99100
ConfigurableAxis ptHistBin{"ptHistBin", {200, 0., 20.}, ""};
101+
ConfigurableAxis binsDCA{"binsDCA", {500, -10.0f, 10.0f}, ""};
100102
ConfigurableAxis countNumberTracks{"countNumberTracks", {10, -0.5, 9.5}, ""};
101103

102104
Configurable<bool> isApplyTFcut{"isApplyTFcut", true, "Enable TimeFrameBorder cut"};
@@ -105,6 +107,8 @@ struct StudyPnch {
105107
Configurable<bool> isApplyInelgt0{"isApplyInelgt0", false, "Enable INEL > 0 condition"};
106108
Configurable<bool> isApplyExtraPhiCut{"isApplyExtraPhiCut", false, "Enable extra phi cut"};
107109
Configurable<bool> isApplyTVX{"isApplyTVX", false, "Enable TVX trigger sel"};
110+
Configurable<bool> isApplyCheckID{"isApplyCheckID", true, "Select Tracks evaluating Collision ID"};
111+
Configurable<bool> isApplyDuplicatedTrack{"isApplyDuplicatedTrack", true, "Select tracks that are not duplicated"};
108112

109113
void init(InitContext const&)
110114
{
@@ -115,6 +119,7 @@ struct StudyPnch {
115119
AxisSpec axisFt0cMult = {ft0cMultHistBin, "ft0c", "FT0CMultAxis"};
116120
AxisSpec axisPt = {ptHistBin, "pT", "pTAxis"};
117121
AxisSpec axisCountNumberTracks = {countNumberTracks, "Count", "CountAxis"};
122+
AxisSpec dcaAxis = {binsDCA, "DCA vs PV"};
118123

119124
histos.add("EventHist", "EventHist", kTH1D, {axisEvent}, false);
120125
histos.add("VtxZHist", "VtxZHist", kTH1D, {axisVtxZ}, false);
@@ -129,8 +134,19 @@ struct StudyPnch {
129134
x->SetBinLabel(6, "INEL > 0");
130135
x->SetBinLabel(7, "|vz| < 10");
131136

132-
if (doprocessData || doprocessCorrelation || doprocessMonteCarlo || doprocessModifiedMonteCarlo) {
137+
histos.add("SelCollsHist", "SelCollsHist", kTH1D, {axisCollSel}, false);
138+
auto hstat_colls = histos.get<TH1>(HIST("SelCollsHist"));
139+
auto* xColls = hstat_colls->GetXaxis();
140+
xColls->SetBinLabel(1, "All collisions");
141+
xColls->SetBinLabel(2, "Best Collision Selection");
142+
xColls->SetBinLabel(3, "Has MC Collision Selection");
143+
144+
if (doprocessData || doprocessCorrelation || doprocessMonteCarlo) {
133145
histos.add("PhiVsEtaHist", "PhiVsEtaHist", kTH2F, {axisPhi, axisEta}, false);
146+
histos.add("EtaHist", "EtaHist", kTH1D, {axisEta}, false);
147+
histos.add("PhiHist", "PhiHist", kTH1D, {axisPhi}, false);
148+
histos.add("hdcaxy", "dca to pv in the xy plane", kTH1D, {dcaAxis}, false);
149+
histos.add("hdcaz", "dca to pv in the z axis", kTH1D, {dcaAxis}, false);
134150
}
135151
if (doprocessData) {
136152
histos.add("hMultiplicityData", "hMultiplicityData", kTH1F, {axisMult}, true);
@@ -143,17 +159,14 @@ struct StudyPnch {
143159
histos.add("NPVtracks_vs_GlobalMult", "NPVtracks_vs_GlobalMult", kTH2F, {axisPV, axisMult}, true);
144160
}
145161
if (doprocessMonteCarlo) {
162+
histos.add("PhiVsEtaGenHist", "PhiVsEtaGenHist", kTH2F, {axisPhi, axisEta}, false);
163+
histos.add("EtaGenHist", "EtaGenHist", kTH1D, {axisEta}, false);
164+
histos.add("PhiGenHist", "PhiGenHist", kTH1D, {axisPhi}, false);
146165
histos.add("hMultiplicityMCrec", "hMultiplicityMCrec", kTH1F, {axisMult}, true);
147166
histos.add("hMultiplicityMCgen", "hMultiplicityMCgen", kTH1F, {axisMult}, true);
148167
histos.add("hResponseMatrix", "hResponseMatrix", kTH2F, {axisMult, axisMult}, true);
149168
histos.add("hCountNTracks", "hCountNTracks", kTH1F, {axisCountNumberTracks}, true);
150169
}
151-
if (doprocessModifiedMonteCarlo) {
152-
histos.add("hMultiplicityMCrecMod", "hMultiplicityMCrecMod", kTH1F, {axisMult}, true);
153-
histos.add("hMultiplicityMCgenMod", "hMultiplicityMCgenMod", kTH1F, {axisMult}, true);
154-
histos.add("hResponseMatrixMod", "hResponseMatrixMod", kTH2F, {axisMult, axisMult}, true);
155-
histos.add("hCountNTracksMod", "hCountNTracksMod", kTH1F, {axisCountNumberTracks}, true);
156-
}
157170
if (doprocessEvtLossSigLossMC) {
158171
histos.add("MCEventHist", "MCEventHist", kTH1F, {axisEvent}, false);
159172
auto hstat = histos.get<TH1>(HIST("MCEventHist"));
@@ -242,6 +255,10 @@ struct StudyPnch {
242255
if (!isTrackSelected(track)) {
243256
continue;
244257
}
258+
histos.fill(HIST("hdcaxy"), track.dcaXY());
259+
histos.fill(HIST("hdcaz"), track.dcaZ());
260+
histos.fill(HIST("EtaHist"), track.eta());
261+
histos.fill(HIST("PhiHist"), track.phi());
245262
histos.fill(HIST("PhiVsEtaHist"), track.phi(), track.eta());
246263
nTrk++;
247264
}
@@ -256,11 +273,12 @@ struct StudyPnch {
256273
if (!isGenTrackSelected(track)) {
257274
continue;
258275
}
259-
if (track.mcCollisionId() != McCol.globalIndex()) {
276+
if (track.mcCollisionId() != McCol.mcCollisionId()) {
260277
continue;
261278
}
262-
263-
histos.fill(HIST("PhiVsEtaHist"), track.phi(), track.eta());
279+
histos.fill(HIST("EtaGenHist"), track.eta());
280+
histos.fill(HIST("PhiGenHist"), track.phi());
281+
histos.fill(HIST("PhiVsEtaGenHist"), track.phi(), track.eta());
264282
nTrk++;
265283
}
266284
return nTrk;
@@ -270,30 +288,28 @@ struct StudyPnch {
270288
int countNTracksMcCol(countTrk const& tracks, McColType const& McCol)
271289
{
272290
auto nTrk = 0;
273-
std::unordered_map<int, int> recoFrequencies; // Map that stores globalIndex and the times it appears
291+
std::vector<int> mcRecIDs;
274292
for (const auto& track : tracks) {
275293
if (!isTrackSelected(track)) {
276294
continue;
277295
}
278296
if (track.has_mcParticle()) {
279297
auto particle = track.mcParticle();
280-
if (particle.mcCollisionId() != McCol.mcCollisionId()) {
298+
if (isApplyCheckID && particle.mcCollisionId() != McCol.mcCollisionId()) {
281299
continue;
282300
}
283-
auto globalIndex = particle.globalIndex();
284-
recoFrequencies[globalIndex]++; // Increment the count for this globalIndex
285-
}
286-
histos.fill(HIST("PhiVsEtaHist"), track.phi(), track.eta());
287-
}
288-
// Loop to fill the histogram without cloned tracks
289-
for (const auto& [globalIndex, frequency] : recoFrequencies) {
290-
histos.fill(HIST("hCountNTracks"), frequency);
291-
// Fill histogram with not cloned tracks
292-
if (frequency == 1) {
301+
if (isApplyDuplicatedTrack && find(mcRecIDs.begin(), mcRecIDs.end(), particle.globalIndex()) != mcRecIDs.end()) {
302+
continue;
303+
}
304+
mcRecIDs.push_back(particle.globalIndex());
293305
nTrk++;
294306
}
307+
histos.fill(HIST("hdcaxy"), track.dcaXY());
308+
histos.fill(HIST("hdcaz"), track.dcaZ());
309+
histos.fill(HIST("EtaHist"), track.eta());
310+
histos.fill(HIST("PhiHist"), track.phi());
311+
histos.fill(HIST("PhiVsEtaHist"), track.phi(), track.eta());
295312
}
296-
// return recoFrequencies;
297313
return nTrk;
298314
}
299315

@@ -328,47 +344,31 @@ struct StudyPnch {
328344
histos.fill(HIST("NPVtracks_vs_GlobalMult"), cols.multNTracksPV(), mult);
329345
}
330346

331-
void processMonteCarlo(ColMCTrueTable::iterator const& mcCollision, ColMCRecTable const& RecCols, TrackMCTrueTable const& GenParticles, FilTrackMCRecTable const& RecTracks)
332-
{
333-
for (const auto& RecCol : RecCols) {
334-
if (!isEventSelected(RecCol)) {
335-
continue;
336-
}
337-
auto recTracksPart = RecTracks.sliceBy(perCollision, RecCol.globalIndex());
338-
auto multrec = countNTracksMcCol(recTracksPart, RecCol);
339-
if (multrec > 0) {
340-
histos.fill(HIST("hMultiplicityMCrec"), multrec);
341-
}
342-
auto multgen = countGenTracks(GenParticles, mcCollision);
343-
if (multgen > 0 && multrec > 0) {
344-
histos.fill(HIST("hMultiplicityMCgen"), multgen);
345-
histos.fill(HIST("hResponseMatrix"), multrec, multgen);
346-
}
347-
}
348-
}
349-
350-
void processModifiedMonteCarlo(soa::Join<aod::McCollisions, aod::McCollsExtra>::iterator const& mcCollision, ColMCRecTable const& RecCols, TrackMCTrueTable const& GenParticles, FilTrackMCRecTable const& RecTracks)
347+
void processMonteCarlo(soa::Join<aod::McCollisions, aod::McCollsExtra>::iterator const& mcCollision, ColMCRecTable const& RecCols, TrackMCTrueTable const& GenParticles, FilTrackMCRecTable const& RecTracks)
351348
{
352349
for (const auto& RecCol : RecCols) {
353350
if (!isEventSelected(RecCol)) {
354351
continue;
355352
}
353+
histos.fill(HIST("SelCollsHist"), 1);
356354
// Evaluation of reconstructed collisions with more than 1 contributor
357355
if (RecCol.globalIndex() != mcCollision.bestCollisionIndex()) {
358356
continue;
359357
}
358+
histos.fill(HIST("SelCollsHist"), 2);
360359
if (!RecCol.has_mcCollision()) {
361360
continue;
362361
}
362+
histos.fill(HIST("SelCollsHist"), 3);
363363
auto recTracksPart = RecTracks.sliceBy(perCollision, RecCol.globalIndex());
364364
auto multrec = countNTracksMcCol(recTracksPart, RecCol);
365365
if (multrec > 0) {
366-
histos.fill(HIST("hMultiplicityMCrecMod"), multrec);
366+
histos.fill(HIST("hMultiplicityMCrec"), multrec);
367367
}
368-
auto multgen = countGenTracks(GenParticles, mcCollision);
368+
auto multgen = countGenTracks(GenParticles, RecCol);
369369
if (multgen > 0 && multrec > 0) {
370-
histos.fill(HIST("hMultiplicityMCgenMod"), multgen);
371-
histos.fill(HIST("hResponseMatrixMod"), multrec, multgen);
370+
histos.fill(HIST("hMultiplicityMCgen"), multgen);
371+
histos.fill(HIST("hResponseMatrix"), multrec, multgen);
372372
}
373373
}
374374
}
@@ -386,9 +386,15 @@ struct StudyPnch {
386386
}
387387
// All generated events
388388
histos.fill(HIST("MCEventHist"), 1);
389-
auto multAll = countGenTracks(GenParticles, mcCollision);
390-
if (multAll > 0) {
391-
histos.fill(HIST("hMultiplicityMCgenAll"), multAll);
389+
auto nTrk_multAll = 0;
390+
for (const auto& GenParticle : GenParticles) {
391+
if (!isGenTrackSelected(GenParticle)) {
392+
continue;
393+
}
394+
nTrk_multAll++;
395+
}
396+
if (nTrk_multAll > 0) {
397+
histos.fill(HIST("hMultiplicityMCgenAll"), nTrk_multAll);
392398
}
393399

394400
bool atLeastOne = false;
@@ -407,17 +413,22 @@ struct StudyPnch {
407413

408414
if (atLeastOne) {
409415
histos.fill(HIST("MCEventHist"), 2);
410-
auto multSel = countGenTracks(GenParticles, mcCollision);
411-
if (multSel > 0) {
412-
histos.fill(HIST("hMultiplicityMCgenSel"), multSel);
416+
auto nTrk_multSel = 0;
417+
for (const auto& GenParticle : GenParticles) {
418+
if (!isGenTrackSelected(GenParticle)) {
419+
continue;
420+
}
421+
nTrk_multSel++;
422+
}
423+
if (nTrk_multSel > 0) {
424+
histos.fill(HIST("hMultiplicityMCgenSel"), nTrk_multSel);
413425
}
414426
}
415427
}
416428

417429
PROCESS_SWITCH(StudyPnch, processData, "process data CentFT0C", false);
418430
PROCESS_SWITCH(StudyPnch, processCorrelation, "do correlation study in data", false);
419431
PROCESS_SWITCH(StudyPnch, processMonteCarlo, "process MC CentFT0C", false);
420-
PROCESS_SWITCH(StudyPnch, processModifiedMonteCarlo, "process MC CentFT0C", false);
421432
PROCESS_SWITCH(StudyPnch, processEvtLossSigLossMC, "process Signal Loss, Event Loss", false);
422433
};
423434

0 commit comments

Comments
 (0)