Skip to content

Commit 5b94a34

Browse files
authored
[PWGLF] use reconstructed eventType in cascade analysis (#16208)
1 parent 3fae554 commit 5b94a34

1 file changed

Lines changed: 71 additions & 31 deletions

File tree

PWGLF/TableProducer/Strangeness/cascqaanalysis.cxx

Lines changed: 71 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,14 @@
4444
#include <Framework/runDataProcessing.h>
4545

4646
#include <TH1.h>
47+
#include <TH2.h>
48+
#include <TH3.h>
4749
#include <TPDGCode.h>
4850
#include <TRandom2.h>
4951
#include <TString.h>
5052

5153
#include <algorithm>
54+
#include <array>
5255
#include <cmath>
5356
#include <cstdint>
5457
#include <cstdlib>
@@ -74,6 +77,19 @@ struct Cascqaanalysis {
7477

7578
HistogramRegistry registry{"registry"};
7679

80+
enum EventTypeBin {
81+
kINEL = 0,
82+
kINELgt0,
83+
kINELgt1,
84+
kNEventTypeBins
85+
};
86+
87+
static constexpr std::array<std::pair<EventTypeBin, const char*>, kNEventTypeBins> EventTypeBinLabels{{
88+
{kINEL, "INEL"},
89+
{kINELgt0, "INEL>0"},
90+
{kINELgt1, "INEL>1"},
91+
}};
92+
7793
// Axes
7894
ConfigurableAxis ptAxis{"ptAxis", {200, 0.0f, 10.0f}, "#it{p}_{T} (GeV/#it{c})"};
7995
ConfigurableAxis rapidityAxis{"rapidityAxis", {200, -2.0f, 2.0f}, "y"};
@@ -83,7 +99,7 @@ struct Cascqaanalysis {
8399
ConfigurableAxis centFV0AAxis{"centFV0AAxis",
84100
{VARIABLE_WIDTH, 0., 0.01, 0.05, 0.1, 0.5, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 105.5},
85101
"FV0A (%)"};
86-
ConfigurableAxis eventTypeAxis{"eventTypeAxis", {3, -0.5f, 2.5f}, "Event Type"};
102+
ConfigurableAxis eventTypeAxis{"eventTypeAxis", {kNEventTypeBins, -0.5f, static_cast<float>(kNEventTypeBins) - 0.5f}, "Event Type"};
87103

88104
ConfigurableAxis nAssocCollAxis{"nAssocCollAxis", {5, -0.5f, 4.5f}, "N_{assoc.}"};
89105
ConfigurableAxis nChargedFT0MGenAxis{"nChargedFT0MGenAxis", {300, 0, 300}, "N_{FT0M, gen.}"};
@@ -194,6 +210,14 @@ struct Cascqaanalysis {
194210
o2::constants::physics::MassOmegaMinus * decayLength * invMomentum};
195211
}
196212

213+
template <typename TAxisType>
214+
static void setEventTypeAxisLabels(TAxisType* axis)
215+
{
216+
for (const auto& [bin, label] : EventTypeBinLabels) {
217+
axis->SetBinLabel(static_cast<int>(bin) + 1, label);
218+
}
219+
}
220+
197221
void init(InitContext const&)
198222
{
199223
TString hCandidateCounterLabels[4] = {"All candidates", "passed topo cuts", "has associated MC particle", "associated with Xi(Omega)"};
@@ -220,15 +244,25 @@ struct Cascqaanalysis {
220244
registry.get<TH1>(HIST("hNEventsMC"))->GetXaxis()->SetBinLabel(n, hNEventsMCLabels[n - 1]);
221245
}
222246
registry.add("hZCollisionGen", "hZCollisionGen", {HistType::kTH1D, {{200, -20.f, 20.f}}});
247+
registry.add("hZCollisionRecVsGen", "hZCollisionRecVsGen", {HistType::kTH2D, {{100, -10.f, 10.f, "z_{vtx}^{rec} (cm)"}, {100, -10.f, 10.f, "z_{vtx}^{gen} (cm)"}}});
248+
registry.add("hEventTypeRecVsGen", "hEventTypeRecVsGen", {HistType::kTH2D, {eventTypeAxis, eventTypeAxis}});
223249
registry.add("hNchFT0MNAssocMCCollisions", "hNchFT0MNAssocMCCollisions", {HistType::kTH3D, {nChargedFT0MGenAxis, nAssocCollAxis, eventTypeAxis}});
224250
registry.add("hNchFT0MNAssocMCCollisionsSameType", "hNchFT0MNAssocMCCollisionsSameType", {HistType::kTH3D, {nChargedFT0MGenAxis, nAssocCollAxis, eventTypeAxis}});
225251
registry.add("hNContributorsCorrelation", "hNContributorsCorrelation", {HistType::kTH2F, {{250, -0.5f, 249.5f, "Secondary Contributor"}, {250, -0.5f, 249.5f, "Main Contributor"}}});
226252
registry.add("hNchFT0MGenEvType", "hNchFT0MGenEvType", {HistType::kTH2D, {nChargedFT0MGenAxis, eventTypeAxis}});
227253
registry.add("hNchFV0AGenEvType", "hNchFV0AGenEvType", {HistType::kTH2D, {nChargedFV0AGenAxis, eventTypeAxis}});
228254
registry.add("hCentFT0M_genMC", "hCentFT0M_genMC", {HistType::kTH2D, {centFT0MAxis, eventTypeAxis}});
255+
setEventTypeAxisLabels(registry.get<TH2>(HIST("hEventTypeRecVsGen"))->GetXaxis());
256+
setEventTypeAxisLabels(registry.get<TH2>(HIST("hEventTypeRecVsGen"))->GetYaxis());
257+
setEventTypeAxisLabels(registry.get<TH3>(HIST("hNchFT0MNAssocMCCollisions"))->GetZaxis());
258+
setEventTypeAxisLabels(registry.get<TH3>(HIST("hNchFT0MNAssocMCCollisionsSameType"))->GetZaxis());
259+
setEventTypeAxisLabels(registry.get<TH2>(HIST("hNchFT0MGenEvType"))->GetYaxis());
260+
setEventTypeAxisLabels(registry.get<TH2>(HIST("hNchFV0AGenEvType"))->GetYaxis());
261+
setEventTypeAxisLabels(registry.get<TH2>(HIST("hCentFT0M_genMC"))->GetYaxis());
229262
}
230263

231264
registry.add("hCentFT0M_rec", "hCentFT0M_rec", {HistType::kTH2D, {centFT0MAxis, eventTypeAxis}});
265+
setEventTypeAxisLabels(registry.get<TH2>(HIST("hCentFT0M_rec"))->GetYaxis());
232266

233267
if (candidateQA) {
234268
registry.add("hNcandidates", "hNcandidates", {HistType::kTH3D, {nCandidates, centFT0MAxis, {2, -0.5f, 1.5f}}});
@@ -242,13 +276,21 @@ struct Cascqaanalysis {
242276
registry.add("hNchFT0Mglobal", "hNchFT0Mglobal", {HistType::kTH3D, {nChargedFT0MGenAxis, multNTracksAxis, eventTypeAxis}});
243277
registry.add("hNchFT0MPVContr", "hNchFT0MPVContr", {HistType::kTH3D, {nChargedFT0MGenAxis, multNTracksAxis, eventTypeAxis}});
244278
registry.add("hNchFV0APVContr", "hNchFV0APVContr", {HistType::kTH3D, {nChargedFV0AGenAxis, multNTracksAxis, eventTypeAxis}});
279+
setEventTypeAxisLabels(registry.get<TH3>(HIST("hNchFT0Mglobal"))->GetZaxis());
280+
setEventTypeAxisLabels(registry.get<TH3>(HIST("hNchFT0MPVContr"))->GetZaxis());
281+
setEventTypeAxisLabels(registry.get<TH3>(HIST("hNchFV0APVContr"))->GetZaxis());
245282
}
246283
registry.add("hFT0MpvContr", "hFT0MpvContr", {HistType::kTH3D, {centFT0MAxis, multNTracksAxis, eventTypeAxis}});
247284
registry.add("hFV0ApvContr", "hFV0ApvContr", {HistType::kTH3D, {centFV0AAxis, multNTracksAxis, eventTypeAxis}});
248285
registry.add("hFT0Mglobal", "hFT0Mglobal", {HistType::kTH3D, {centFT0MAxis, multNTracksAxis, eventTypeAxis}});
249286
registry.add("hFV0AFT0M", "hFV0AFT0M", {HistType::kTH3D, {centFV0AAxis, centFT0MAxis, eventTypeAxis}});
250287
registry.add("hFT0MFV0Asignal", "hFT0MFV0Asignal", {HistType::kTH2D, {signalFT0MAxis, signalFV0AAxis}});
251288
registry.add("hFT0MsignalPVContr", "hFT0MsignalPVContr", {HistType::kTH3D, {signalFT0MAxis, multNTracksAxis, eventTypeAxis}});
289+
setEventTypeAxisLabels(registry.get<TH3>(HIST("hFT0MpvContr"))->GetZaxis());
290+
setEventTypeAxisLabels(registry.get<TH3>(HIST("hFV0ApvContr"))->GetZaxis());
291+
setEventTypeAxisLabels(registry.get<TH3>(HIST("hFT0Mglobal"))->GetZaxis());
292+
setEventTypeAxisLabels(registry.get<TH3>(HIST("hFV0AFT0M"))->GetZaxis());
293+
setEventTypeAxisLabels(registry.get<TH3>(HIST("hFT0MsignalPVContr"))->GetZaxis());
252294
}
253295

254296
rctChecker.init(cfgEvtRCTFlagCheckerLabel, cfgEvtRCTFlagCheckerZDCCheck, cfgEvtRCTFlagCheckerLimitAcceptAsBad);
@@ -334,20 +376,19 @@ struct Cascqaanalysis {
334376
}
335377

336378
template <typename TCollision>
337-
int getEventTypeFlag(TCollision const& collision)
379+
EventTypeBin getEventTypeBin(TCollision const& collision)
338380
{
339-
// 0 - INEL, 1 - INEL>0, 2 - INEL>1
340-
int evFlag = 0;
381+
EventTypeBin evTypeBin = kINEL;
341382
registry.fill(HIST("hNEvents"), 11.5); // INEL
342383
if (collision.isInelGt0()) {
343-
evFlag += 1;
384+
evTypeBin = kINELgt0;
344385
registry.fill(HIST("hNEvents"), 12.5); // INEL>0
345386
}
346387
if (collision.isInelGt1()) {
347-
evFlag += 1;
388+
evTypeBin = kINELgt1;
348389
registry.fill(HIST("hNEvents"), 13.5); // INEL>1
349390
}
350-
return evFlag;
391+
return evTypeBin;
351392
}
352393

353394
template <typename TCollision>
@@ -451,7 +492,7 @@ struct Cascqaanalysis {
451492
return;
452493
}
453494

454-
int evType = getEventTypeFlag(collision);
495+
EventTypeBin evType = getEventTypeBin(collision);
455496

456497
auto tracksGroupedPVcontr = pvContribTracksIUEta1->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache);
457498
int nTracksPVcontr = tracksGroupedPVcontr.size();
@@ -549,31 +590,30 @@ struct Cascqaanalysis {
549590
uint16_t nchFT0 = getGenNchInFT0Mregion(mcPartSlice);
550591
uint16_t nchFV0 = getGenNchInFV0Aregion(mcPartSlice);
551592

552-
int evType = 0;
553-
registry.fill(HIST("hNEvents"), 11.5); // INEL
554-
// Rec. collision associated with INEL>0 gen. one
593+
EventTypeBin genEvType = kINEL;
555594
if (pwglf::isINELgtNmc(mcPartSlice, 0, pdgDB)) {
556-
registry.fill(HIST("hNEvents"), 12.5); // INEL
557-
evType++;
595+
genEvType = kINELgt0;
558596
}
559-
// Rec. collision associated with INEL>1 gen. one
560597
if (pwglf::isINELgtNmc(mcPartSlice, 1, pdgDB)) {
561-
registry.fill(HIST("hNEvents"), 13.5); // INEL
562-
evType++;
598+
genEvType = kINELgt1;
563599
}
564600

565-
registry.fill(HIST("hCentFT0M_rec"), mcCollision.centFT0M(), evType);
601+
const EventTypeBin recoEvType = getEventTypeBin(collision);
602+
603+
registry.fill(HIST("hCentFT0M_rec"), mcCollision.centFT0M(), recoEvType);
604+
registry.fill(HIST("hZCollisionRecVsGen"), collision.posZ(), mcCollision.posZ());
605+
registry.fill(HIST("hEventTypeRecVsGen"), recoEvType, genEvType);
566606

567607
if (multQA) {
568-
registry.fill(HIST("hNchFT0MPVContr"), nchFT0, nTracksPVcontr, evType);
569-
registry.fill(HIST("hNchFV0APVContr"), nchFV0, nTracksPVcontr, evType);
570-
registry.fill(HIST("hFT0MpvContr"), mcCollision.centFT0M(), nTracksPVcontr, evType);
571-
registry.fill(HIST("hFV0ApvContr"), 0, nTracksPVcontr, evType); // mcCollision.centFV0A() to be added
572-
registry.fill(HIST("hFT0Mglobal"), mcCollision.centFT0M(), nTracksGlobal, evType);
573-
registry.fill(HIST("hFV0AFT0M"), 0, mcCollision.centFT0M(), evType); // mcCollision.centFV0A() to be added
574-
registry.fill(HIST("hNchFT0Mglobal"), nchFT0, nTracksGlobal, evType);
608+
registry.fill(HIST("hNchFT0MPVContr"), nchFT0, nTracksPVcontr, recoEvType);
609+
registry.fill(HIST("hNchFV0APVContr"), nchFV0, nTracksPVcontr, recoEvType);
610+
registry.fill(HIST("hFT0MpvContr"), mcCollision.centFT0M(), nTracksPVcontr, recoEvType);
611+
registry.fill(HIST("hFV0ApvContr"), 0, nTracksPVcontr, recoEvType); // mcCollision.centFV0A() to be added
612+
registry.fill(HIST("hFT0Mglobal"), mcCollision.centFT0M(), nTracksGlobal, recoEvType);
613+
registry.fill(HIST("hFV0AFT0M"), 0, mcCollision.centFT0M(), recoEvType); // mcCollision.centFV0A() to be added
614+
registry.fill(HIST("hNchFT0Mglobal"), nchFT0, nTracksGlobal, recoEvType);
575615
registry.fill(HIST("hFT0MFV0Asignal"), collision.multFT0A() + collision.multFT0C(), collision.multFV0A());
576-
registry.fill(HIST("hFT0MsignalPVContr"), collision.multFT0A() + collision.multFT0C(), nTracksPVcontr, evType);
616+
registry.fill(HIST("hFT0MsignalPVContr"), collision.multFT0A() + collision.multFT0C(), nTracksPVcontr, recoEvType);
577617
}
578618

579619
float lEventScale = scalefactor;
@@ -654,20 +694,20 @@ struct Cascqaanalysis {
654694
registry.fill(HIST("hNEventsMC"), 1.5);
655695

656696
// Define the type of generated MC collision
657-
int evType = 0;
697+
EventTypeBin evType = kINEL;
658698
uint8_t flagsGen = 0;
659699
flagsGen |= o2::aod::myMCcascades::EvFlags::EvINEL;
660700
registry.fill(HIST("hNEventsMC"), 2.5);
661701
// Generated collision is INEL>0
662702
if (pwglf::isINELgtNmc(mcParticles, 0, pdgDB)) {
663703
flagsGen |= o2::aod::myMCcascades::EvFlags::EvINELgt0;
664-
evType++;
704+
evType = kINELgt0;
665705
registry.fill(HIST("hNEventsMC"), 3.5);
666706
}
667707
// Generated collision is INEL>1
668708
if (pwglf::isINELgtNmc(mcParticles, 1, pdgDB)) {
669709
flagsGen |= o2::aod::myMCcascades::EvFlags::EvINELgt1;
670-
evType++;
710+
evType = kINELgt1;
671711
registry.fill(HIST("hNEventsMC"), 4.5);
672712
}
673713

@@ -723,15 +763,15 @@ struct Cascqaanalysis {
723763
const auto evtReconstructedAndINELgt1 = std::count_if(selectedEvents.begin(), selectedEvents.end(), isAssocToINELgt1);
724764

725765
switch (evType) {
726-
case 0: {
766+
case kINEL: {
727767
registry.fill(HIST("hNchFT0MNAssocMCCollisionsSameType"), nchFT0, evtReconstructedAndINEL, evType);
728768
break;
729769
}
730-
case 1: {
770+
case kINELgt0: {
731771
registry.fill(HIST("hNchFT0MNAssocMCCollisionsSameType"), nchFT0, evtReconstructedAndINELgt0, evType);
732772
break;
733773
}
734-
case 2: {
774+
case kINELgt1: {
735775
registry.fill(HIST("hNchFT0MNAssocMCCollisionsSameType"), nchFT0, evtReconstructedAndINELgt1, evType);
736776
break;
737777
}

0 commit comments

Comments
 (0)