Skip to content

Commit 5118cf0

Browse files
authored
Improvements regarding track criteria selection
Monte Carlo Process function was updated to better evaluate the different criteria for track selection. Moreover, histograms for dca were included
1 parent 7045705 commit 5118cf0

File tree

1 file changed

+72
-53
lines changed

1 file changed

+72
-53
lines changed

PWGLF/Tasks/GlobalEventProperties/studyPnch.cxx

Lines changed: 72 additions & 53 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,9 @@ 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> isApplyNoTrackSel{"isApplyNoTrackSel", false, "Do not consider any criteria for track selection"};
111+
Configurable<bool> isApplyCheckID{"isApplyCheckID", true, "Select Tracks evaluating Collision ID"};
112+
Configurable<bool> isApplyDuplicatedTrack{"isApplyDuplicatedTrack", true, "Select tracks that are not duplicated"};
108113

109114
void init(InitContext const&)
110115
{
@@ -115,6 +120,7 @@ struct StudyPnch {
115120
AxisSpec axisFt0cMult = {ft0cMultHistBin, "ft0c", "FT0CMultAxis"};
116121
AxisSpec axisPt = {ptHistBin, "pT", "pTAxis"};
117122
AxisSpec axisCountNumberTracks = {countNumberTracks, "Count", "CountAxis"};
123+
AxisSpec dcaAxis = {binsDCA, "DCA vs PV"};
118124

119125
histos.add("EventHist", "EventHist", kTH1D, {axisEvent}, false);
120126
histos.add("VtxZHist", "VtxZHist", kTH1D, {axisVtxZ}, false);
@@ -129,8 +135,19 @@ struct StudyPnch {
129135
x->SetBinLabel(6, "INEL > 0");
130136
x->SetBinLabel(7, "|vz| < 10");
131137

132-
if (doprocessData || doprocessCorrelation || doprocessMonteCarlo || doprocessModifiedMonteCarlo) {
138+
histos.add("SelCollsHist", "SelCollsHist", kTH1D, {axisCollSel}, false);
139+
auto hstat_colls = histos.get<TH1>(HIST("SelCollsHist"));
140+
auto* xColls = hstat_colls->GetXaxis();
141+
xColls->SetBinLabel(1, "All collisions");
142+
xColls->SetBinLabel(2, "Best Collision Selection");
143+
xColls->SetBinLabel(3, "Has MC Collision Selection");
144+
145+
if (doprocessData || doprocessCorrelation || doprocessMonteCarlo) {
133146
histos.add("PhiVsEtaHist", "PhiVsEtaHist", kTH2F, {axisPhi, axisEta}, false);
147+
histos.add("EtaHist", "EtaHist", kTH1D, {axisEta}, false);
148+
histos.add("PhiHist", "PhiHist", kTH1D, {axisPhi}, false);
149+
histos.add("hdcaxy", "dca to pv in the xy plane", kTH1D, {dcaAxis}, false);
150+
histos.add("hdcaz", "dca to pv in the z axis", kTH1D, {dcaAxis}, false);
134151
}
135152
if (doprocessData) {
136153
histos.add("hMultiplicityData", "hMultiplicityData", kTH1F, {axisMult}, true);
@@ -143,17 +160,14 @@ struct StudyPnch {
143160
histos.add("NPVtracks_vs_GlobalMult", "NPVtracks_vs_GlobalMult", kTH2F, {axisPV, axisMult}, true);
144161
}
145162
if (doprocessMonteCarlo) {
163+
histos.add("PhiVsEtaGenHist", "PhiVsEtaGenHist", kTH2F, {axisPhi, axisEta}, false);
164+
histos.add("EtaGenHist", "EtaGenHist", kTH1D, {axisEta}, false);
165+
histos.add("PhiGenHist", "PhiGenHist", kTH1D, {axisPhi}, false);
146166
histos.add("hMultiplicityMCrec", "hMultiplicityMCrec", kTH1F, {axisMult}, true);
147167
histos.add("hMultiplicityMCgen", "hMultiplicityMCgen", kTH1F, {axisMult}, true);
148168
histos.add("hResponseMatrix", "hResponseMatrix", kTH2F, {axisMult, axisMult}, true);
149169
histos.add("hCountNTracks", "hCountNTracks", kTH1F, {axisCountNumberTracks}, true);
150170
}
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-
}
157171
if (doprocessEvtLossSigLossMC) {
158172
histos.add("MCEventHist", "MCEventHist", kTH1F, {axisEvent}, false);
159173
auto hstat = histos.get<TH1>(HIST("MCEventHist"));
@@ -242,6 +256,10 @@ struct StudyPnch {
242256
if (!isTrackSelected(track)) {
243257
continue;
244258
}
259+
histos.fill(HIST("hdcaxy"), track.dcaXY());
260+
histos.fill(HIST("hdcaz"), track.dcaZ());
261+
histos.fill(HIST("EtaHist"), track.eta());
262+
histos.fill(HIST("PhiHist"), track.phi());
245263
histos.fill(HIST("PhiVsEtaHist"), track.phi(), track.eta());
246264
nTrk++;
247265
}
@@ -256,11 +274,12 @@ struct StudyPnch {
256274
if (!isGenTrackSelected(track)) {
257275
continue;
258276
}
259-
if (track.mcCollisionId() != McCol.globalIndex()) {
277+
if (track.mcCollisionId() != McCol.mcCollisionId()) {
260278
continue;
261279
}
262-
263-
histos.fill(HIST("PhiVsEtaHist"), track.phi(), track.eta());
280+
histos.fill(HIST("EtaGenHist"), track.eta());
281+
histos.fill(HIST("PhiGenHist"), track.phi());
282+
histos.fill(HIST("PhiVsEtaGenHist"), track.phi(), track.eta());
264283
nTrk++;
265284
}
266285
return nTrk;
@@ -271,29 +290,33 @@ struct StudyPnch {
271290
{
272291
auto nTrk = 0;
273292
std::unordered_map<int, int> recoFrequencies; // Map that stores globalIndex and the times it appears
293+
std::vector<int> mcRecIDs;
274294
for (const auto& track : tracks) {
275295
if (!isTrackSelected(track)) {
276296
continue;
277297
}
278-
if (track.has_mcParticle()) {
298+
if (isApplyNoTrackSel) {
299+
nTrk++;
300+
}
301+
if (isApplyCheckID && track.has_mcParticle()) {
279302
auto particle = track.mcParticle();
280303
if (particle.mcCollisionId() != McCol.mcCollisionId()) {
281304
continue;
282305
}
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) {
306+
if (isApplyDuplicatedTrack) {
307+
if (find(mcRecIDs.begin(), mcRecIDs.end(), particle.globalIndex()) != mcRecIDs.end()) {
308+
continue;
309+
}
310+
}
311+
mcRecIDs.push_back(particle.globalIndex());
293312
nTrk++;
294313
}
314+
histos.fill(HIST("hdcaxy"), track.dcaXY());
315+
histos.fill(HIST("hdcaz"), track.dcaZ());
316+
histos.fill(HIST("EtaHist"), track.eta());
317+
histos.fill(HIST("PhiHist"), track.phi());
318+
histos.fill(HIST("PhiVsEtaHist"), track.phi(), track.eta());
295319
}
296-
// return recoFrequencies;
297320
return nTrk;
298321
}
299322

@@ -328,47 +351,32 @@ struct StudyPnch {
328351
histos.fill(HIST("NPVtracks_vs_GlobalMult"), cols.multNTracksPV(), mult);
329352
}
330353

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)
354+
void processMonteCarlo(soa::Join<aod::McCollisions, aod::McCollsExtra>::iterator const& mcCollision, ColMCRecTable const& RecCols, TrackMCTrueTable const& GenParticles, FilTrackMCRecTable const& RecTracks)
351355
{
356+
std::vector<int> mclabels;
352357
for (const auto& RecCol : RecCols) {
353358
if (!isEventSelected(RecCol)) {
354359
continue;
355360
}
361+
histos.fill(HIST("SelCollsHist"), 1);
356362
// Evaluation of reconstructed collisions with more than 1 contributor
357363
if (RecCol.globalIndex() != mcCollision.bestCollisionIndex()) {
358364
continue;
359365
}
366+
histos.fill(HIST("SelCollsHist"), 2);
360367
if (!RecCol.has_mcCollision()) {
361368
continue;
362369
}
370+
histos.fill(HIST("SelCollsHist"), 3);
363371
auto recTracksPart = RecTracks.sliceBy(perCollision, RecCol.globalIndex());
364372
auto multrec = countNTracksMcCol(recTracksPart, RecCol);
365373
if (multrec > 0) {
366-
histos.fill(HIST("hMultiplicityMCrecMod"), multrec);
374+
histos.fill(HIST("hMultiplicityMCrec"), multrec);
367375
}
368-
auto multgen = countGenTracks(GenParticles, mcCollision);
376+
auto multgen = countGenTracks(GenParticles, RecCol);
369377
if (multgen > 0 && multrec > 0) {
370-
histos.fill(HIST("hMultiplicityMCgenMod"), multgen);
371-
histos.fill(HIST("hResponseMatrixMod"), multrec, multgen);
378+
histos.fill(HIST("hMultiplicityMCgen"), multgen);
379+
histos.fill(HIST("hResponseMatrix"), multrec, multgen);
372380
}
373381
}
374382
}
@@ -386,9 +394,15 @@ struct StudyPnch {
386394
}
387395
// All generated events
388396
histos.fill(HIST("MCEventHist"), 1);
389-
auto multAll = countGenTracks(GenParticles, mcCollision);
390-
if (multAll > 0) {
391-
histos.fill(HIST("hMultiplicityMCgenAll"), multAll);
397+
auto nTrk_multAll = 0;
398+
for (const auto& GenParticle : GenParticles) {
399+
if (!isGenTrackSelected(GenParticle)) {
400+
continue;
401+
}
402+
nTrk_multAll++;
403+
}
404+
if (nTrk_multAll > 0) {
405+
histos.fill(HIST("hMultiplicityMCgenAll"), nTrk_multAll);
392406
}
393407

394408
bool atLeastOne = false;
@@ -407,17 +421,22 @@ struct StudyPnch {
407421

408422
if (atLeastOne) {
409423
histos.fill(HIST("MCEventHist"), 2);
410-
auto multSel = countGenTracks(GenParticles, mcCollision);
411-
if (multSel > 0) {
412-
histos.fill(HIST("hMultiplicityMCgenSel"), multSel);
424+
auto nTrk_multSel = 0;
425+
for (const auto& GenParticle : GenParticles) {
426+
if (!isGenTrackSelected(GenParticle)) {
427+
continue;
428+
}
429+
nTrk_multSel++;
430+
}
431+
if (nTrk_multSel > 0) {
432+
histos.fill(HIST("hMultiplicityMCgenSel"), nTrk_multSel);
413433
}
414434
}
415435
}
416436

417437
PROCESS_SWITCH(StudyPnch, processData, "process data CentFT0C", false);
418438
PROCESS_SWITCH(StudyPnch, processCorrelation, "do correlation study in data", false);
419439
PROCESS_SWITCH(StudyPnch, processMonteCarlo, "process MC CentFT0C", false);
420-
PROCESS_SWITCH(StudyPnch, processModifiedMonteCarlo, "process MC CentFT0C", false);
421440
PROCESS_SWITCH(StudyPnch, processEvtLossSigLossMC, "process Signal Loss, Event Loss", false);
422441
};
423442

0 commit comments

Comments
 (0)