Skip to content

Commit 32a4ca5

Browse files
committed
Process Monte Carlo with correct count of generated tracks
1 parent ea902fd commit 32a4ca5

File tree

1 file changed

+27
-3
lines changed

1 file changed

+27
-3
lines changed

PWGLF/Tasks/GlobalEventProperties/studyPnch.cxx

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ struct StudyPnch {
125125
x->SetBinLabel(6, "INEL > 0");
126126
x->SetBinLabel(7, "|vz| < 10");
127127

128-
if (doprocessData || doprocessCorrelation || doprocessMonteCarlo) {
128+
if (doprocessData || doprocessCorrelation || doprocessMonteCarlo || doprocessTreatedMonteCarlo) {
129129
histos.add("PhiVsEtaHist", "PhiVsEtaHist", kTH2F, {axisPhi, axisEta}, false);
130130
}
131131
if (doprocessData) {
@@ -143,6 +143,11 @@ struct StudyPnch {
143143
histos.add("hMultiplicityMCgen", "hMultiplicityMCgen", kTH1F, {axisMult}, true);
144144
histos.add("hResponseMatrix", "hResponseMatrix", kTH2F, {axisMult, axisMult}, true);
145145
}
146+
if (doprocessTreatedMonteCarlo) {
147+
histos.add("hMultiplicityTreatMCrec", "hMultiplicityTreatMCrec", kTH1F, {axisMult}, true);
148+
histos.add("hMultiplicityTreatMCgen", "hMultiplicityTreatMCgen", kTH1F, {axisMult}, true);
149+
histos.add("hResponseMatrixTreat", "hResponseMatrixTreat", kTH2F, {axisMult, axisMult}, true);
150+
}
146151
if (doprocessEvtLossSigLossMC) {
147152
histos.add("MCEventHist", "MCEventHist", kTH1F, {axisEvent}, false);
148153
auto hstat = histos.get<TH1>(HIST("MCEventHist"));
@@ -249,7 +254,6 @@ struct StudyPnch {
249254
if (track.mcCollisionId() != McCol.globalIndex()) {
250255
continue;
251256
}
252-
253257
histos.fill(HIST("PhiVsEtaHist"), track.phi(), track.eta());
254258
nTrk++;
255259
}
@@ -264,7 +268,6 @@ struct StudyPnch {
264268
if (!isTrackSelected(track)) {
265269
continue;
266270
}
267-
268271
// Verify that the track belongs to the given MC collision
269272
if (track.has_mcParticle()) {
270273
auto particle = track.mcParticle();
@@ -322,6 +325,26 @@ struct StudyPnch {
322325
}
323326
}
324327

328+
void processTreatedMonteCarlo(ColMCTrueTable::iterator const& mcCollision, ColMCRecTable const& RecCols, TrackMCTrueTable const& GenParticles, FilTrackMCRecTable const& RecTracks)
329+
{
330+
// Count generated tracks at each iterator
331+
auto multgen = countGenTracks(GenParticles, mcCollision);
332+
histos.fill(HIST("hMultiplicityTreatMCgen"), multgen);
333+
for (const auto& RecCol : RecCols) {
334+
if (!isEventSelected(RecCol)) {
335+
continue;
336+
}
337+
// Verify that the reconstructed collision corresponds to the given MC collision
338+
if (RecCol.mcCollisionId() != mcCollision.globalIndex()) {
339+
continue;
340+
}
341+
auto recTracksPart = RecTracks.sliceBy(perCollision, RecCol.globalIndex());
342+
auto multrec = countNTracksMcCol(recTracksPart, RecCol);
343+
histos.fill(HIST("hMultiplicityTreatMCrec"), multrec);
344+
histos.fill(HIST("hResponseMatrixTreat"), multrec, multgen);
345+
}
346+
}
347+
325348
void processEvtLossSigLossMC(soa::Join<ColMCTrueTable, aod::MultMCExtras>::iterator const& mcCollision, ColMCRecTable const& RecCols, TrackMCTrueTable const& GenParticles)
326349
{
327350
if (isApplyInelgt0 && !mcCollision.isInelGt0()) {
@@ -359,6 +382,7 @@ struct StudyPnch {
359382
PROCESS_SWITCH(StudyPnch, processData, "process data CentFT0C", false);
360383
PROCESS_SWITCH(StudyPnch, processCorrelation, "do correlation study in data", false);
361384
PROCESS_SWITCH(StudyPnch, processMonteCarlo, "process MC CentFT0C", false);
385+
PROCESS_SWITCH(StudyPnch, processTreatedMonteCarlo, "process Treated MC CentFT0C", false);
362386
PROCESS_SWITCH(StudyPnch, processEvtLossSigLossMC, "process Signal Loss, Event Loss", false);
363387
};
364388

0 commit comments

Comments
 (0)