Skip to content

Commit 57e177e

Browse files
authored
DPG: PID QA fix missing TOF plots (#1077)
* Fix missing TOF plots * Align TOF and TPC QA
1 parent 5d87894 commit 57e177e

2 files changed

Lines changed: 157 additions & 81 deletions

File tree

DPG/Tasks/qaPIDTOF.h

Lines changed: 52 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@ struct tofPidQa {
3636
static constexpr std::string_view hexpected_diff[Np] = {"expected_diff/El", "expected_diff/Mu", "expected_diff/Pi",
3737
"expected_diff/Ka", "expected_diff/Pr", "expected_diff/De",
3838
"expected_diff/Tr", "expected_diff/He", "expected_diff/Al"};
39+
static constexpr std::string_view hexpected_diffptpos[Np] = {"expected_diffptpos/El", "expected_diffptpos/Mu", "expected_diffptpos/Pi",
40+
"expected_diffptpos/Ka", "expected_diffptpos/Pr", "expected_diffptpos/De",
41+
"expected_diffptpos/Tr", "expected_diffptpos/He", "expected_diffptpos/Al"};
42+
static constexpr std::string_view hexpected_diffptneg[Np] = {"expected_diffptneg/El", "expected_diffptneg/Mu", "expected_diffptneg/Pi",
43+
"expected_diffptneg/Ka", "expected_diffptneg/Pr", "expected_diffptneg/De",
44+
"expected_diffptneg/Tr", "expected_diffptneg/He", "expected_diffptneg/Al"};
3945
static constexpr std::string_view hexpsigma[Np] = {"expsigma/El", "expsigma/Mu", "expsigma/Pi",
4046
"expsigma/Ka", "expsigma/Pr", "expsigma/De",
4147
"expsigma/Tr", "expsigma/He", "expsigma/Al"};
@@ -76,12 +82,21 @@ struct tofPidQa {
7682
void initPerParticle(const AxisSpec& pAxis, const AxisSpec& ptAxis)
7783
{
7884
static_assert(id >= 0 && id <= PID::Alpha && "Particle index outside limits");
85+
bool enableFullHistos = false;
86+
int enabledProcesses = 0;
7987
switch (id) { // Skipping disabled particles
8088
#define particleCase(particleId) \
8189
case PID::particleId: \
8290
if (!doprocess##particleId && !doprocessFull##particleId) { \
8391
return; \
8492
} \
93+
if (!doprocess##particleId) { \
94+
enabledProcesses++; \
95+
} \
96+
if (!doprocessFull##particleId) { \
97+
enableFullHistos = true; \
98+
enabledProcesses++; \
99+
} \
85100
LOGF(info, "Enabled TOF QA for %s %s", #particleId, pT[id]); \
86101
break;
87102

@@ -96,6 +111,9 @@ struct tofPidQa {
96111
particleCase(Alpha);
97112
#undef particleCase
98113
}
114+
if (enabledProcesses != 1) {
115+
LOG(fatal) << "Cannot enable more than one process function per particle, check and retry!";
116+
}
99117

100118
auto addHistogram = [&](const auto& name, const auto& title, const auto& xAxis, const auto& yAxis) {
101119
if (!enableEvTimeSplitting) {
@@ -110,6 +128,18 @@ struct tofPidQa {
110128
histo->GetZaxis()->SetBinLabel(4, "FT0+TOF");
111129
};
112130

131+
// NSigma
132+
const char* axisTitle = Form("N_{#sigma}^{TOF}(%s)", pT[id]);
133+
const AxisSpec nSigmaAxis{nBinsNSigma, minNSigma, maxNSigma, axisTitle};
134+
addHistogram(hnsigma[id], axisTitle, pAxis, nSigmaAxis);
135+
addHistogram(hnsigmapt[id], axisTitle, ptAxis, nSigmaAxis);
136+
addHistogram(hnsigmapospt[id], axisTitle, ptAxis, nSigmaAxis);
137+
addHistogram(hnsigmanegpt[id], axisTitle, ptAxis, nSigmaAxis);
138+
139+
if (!enableFullHistos) { // Enabling only NSigma for tiny tables
140+
return;
141+
}
142+
113143
// Exp signal
114144
const AxisSpec expAxis{1000, 0, 2e6, Form("t_{exp}(%s) (ps)", pT[id])};
115145
histos.add(hexpected[id].data(), "", kTH2F, {pAxis, expAxis});
@@ -121,21 +151,12 @@ struct tofPidQa {
121151
// Exp Sigma
122152
const AxisSpec expSigmaAxis{nBinsExpSigma, minExpSigma, maxExpSigma, Form("Exp_{#sigma}^{TOF}(%s) (ps)", pT[id])};
123153
histos.add(hexpsigma[id].data(), "", kTH2F, {pAxis, expSigmaAxis});
124-
125-
// NSigma
126-
const char* axisTitle = Form("N_{#sigma}^{TOF}(%s)", pT[id]);
127-
const AxisSpec nSigmaAxis{nBinsNSigma, minNSigma, maxNSigma, axisTitle};
128-
addHistogram(hnsigma[id], axisTitle, pAxis, nSigmaAxis);
129-
addHistogram(hnsigmapt[id], axisTitle, ptAxis, nSigmaAxis);
130-
addHistogram(hnsigmapospt[id], axisTitle, ptAxis, nSigmaAxis);
131-
addHistogram(hnsigmanegpt[id], axisTitle, ptAxis, nSigmaAxis);
132154
}
133155

134156
void init(o2::framework::InitContext&)
135157
{
136158
const AxisSpec multAxis{100, 0, 100, "TOF multiplicity"};
137159
const AxisSpec vtxZAxis{100, -20, 20, "Vtx_{z} (cm)"};
138-
const AxisSpec tofAxis{10000, 0, 2e6, "TOF Signal (ps)"};
139160
const AxisSpec etaAxis{100, -1, 1, "#it{#eta}"};
140161
const AxisSpec phiAxis{100, 0, TMath::TwoPi(), "#it{#phi}"};
141162
const AxisSpec colTimeAxis{100, -2000, 2000, "Collision time (ps)"};
@@ -150,6 +171,7 @@ struct tofPidQa {
150171
pAxis.makeLogaritmic();
151172
pExpAxis.makeLogaritmic();
152173
}
174+
const AxisSpec tofAxis{10000, 0, 2e6, "TOF Signal (ps)"};
153175

154176
// Event properties
155177
auto h = histos.add<TH1>("event/evsel", "", kTH1F, {{10, 0.5, 10.5, "Ev. Sel."}});
@@ -347,15 +369,18 @@ struct tofPidQa {
347369

348370
using CollisionCandidate = soa::Join<aod::Collisions, aod::EvSels>::iterator;
349371
void process(CollisionCandidate const& collision,
350-
soa::Join<aod::Tracks, aod::TracksExtra, aod::TOFSignal, aod::TOFEvTime, aod::pidEvTimeFlags, aod::TrackSelection> const& tracks)
372+
soa::Join<aod::Tracks, aod::TracksExtra,
373+
aod::TOFSignal, aod::TOFEvTime, aod::pidEvTimeFlags,
374+
aod::TrackSelection> const& tracks)
351375
{
352376
isEventSelected<true>(collision, tracks);
353377
for (auto t : tracks) {
354378
isTrackSelected<true>(collision, t);
355379
}
356380
}
357381

358-
template <o2::track::PID::ID id, bool fillFullHistograms, typename TrackType>
382+
template <o2::track::PID::ID id, bool fillFullHistograms,
383+
typename TrackType>
359384
void processSingleParticle(CollisionCandidate const& collision,
360385
TrackType const& tracks)
361386
{
@@ -418,13 +443,14 @@ struct tofPidQa {
418443
}
419444

420445
// QA of nsigma only tables
421-
#define makeProcessFunction(inputPid, particleId) \
422-
void process##particleId(CollisionCandidate const& collision, \
423-
soa::Join<aod::Tracks, aod::TracksExtra, aod::TrackSelection, \
424-
aod::pidEvTimeFlags, aod::TOFSignal, inputPid> const& tracks) \
425-
{ \
426-
processSingleParticle<PID::particleId, false>(collision, tracks); \
427-
} \
446+
#define makeProcessFunction(inputPid, particleId) \
447+
void process##particleId(CollisionCandidate const& collision, \
448+
soa::Join<aod::Tracks, aod::TracksExtra, aod::TrackSelection, \
449+
aod::pidEvTimeFlags, aod::TOFSignal, \
450+
inputPid> const& tracks) \
451+
{ \
452+
processSingleParticle<PID::particleId, false>(collision, tracks); \
453+
} \
428454
PROCESS_SWITCH(tofPidQa, process##particleId, Form("Process for the %s hypothesis for TOF NSigma QA", #particleId), false);
429455

430456
makeProcessFunction(aod::pidTOFEl, Electron);
@@ -439,13 +465,14 @@ struct tofPidQa {
439465
#undef makeProcessFunction
440466

441467
// QA of full tables
442-
#define makeProcessFunction(inputPid, particleId) \
443-
void processFull##particleId(CollisionCandidate const& collision, \
444-
soa::Join<aod::Tracks, aod::TracksExtra, aod::TrackSelection, \
445-
aod::pidEvTimeFlags, aod::TOFSignal, inputPid> const& tracks) \
446-
{ \
447-
processSingleParticle<PID::particleId, true>(collision, tracks); \
448-
} \
468+
#define makeProcessFunction(inputPid, particleId) \
469+
void processFull##particleId(CollisionCandidate const& collision, \
470+
soa::Join<aod::Tracks, aod::TracksExtra, aod::TrackSelection, \
471+
aod::pidEvTimeFlags, aod::TOFSignal, \
472+
inputPid> const& tracks) \
473+
{ \
474+
processSingleParticle<PID::particleId, true>(collision, tracks); \
475+
} \
449476
PROCESS_SWITCH(tofPidQa, processFull##particleId, Form("Process for the %s hypothesis for full TOF PID QA", #particleId), false);
450477

451478
makeProcessFunction(aod::pidTOFFullEl, Electron);

0 commit comments

Comments
 (0)