Skip to content

Commit 9eabb7c

Browse files
committed
introduce PARTICLE_LIST for DRY particle-wise code, init cuts
1 parent 5eee604 commit 9eabb7c

1 file changed

Lines changed: 66 additions & 78 deletions

File tree

DPG/Tasks/AOTTrack/PID/TPC/treeCreatorPidTpcQa.cxx

Lines changed: 66 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,17 @@ using namespace o2::framework;
4646
using namespace o2::track;
4747
using namespace o2::dpg_tpcskimstablecreator;
4848

49+
#define PARTICLE_LIST(MACRO_ARG) \
50+
MACRO_ARG(El, Electron) \
51+
MACRO_ARG(Mu, Muon) \
52+
MACRO_ARG(Pi, Pion) \
53+
MACRO_ARG(Ka, Kaon) \
54+
MACRO_ARG(Pr, Proton) \
55+
MACRO_ARG(De, Deuteron) \
56+
MACRO_ARG(Tr, Triton) \
57+
MACRO_ARG(He, Helium3) \
58+
MACRO_ARG(Al, Alpha)
59+
4960
struct treeCreatorPidTpcQa {
5061
Produces<o2::aod::QaPidTpc> rowPidTpcQa;
5162

@@ -60,6 +71,14 @@ struct treeCreatorPidTpcQa {
6071
// Configurable for the path of CCDB General Run Parameters LHC Interface information
6172
Configurable<std::string> ccdbPathGrpLhcIf{"ccdbPathGrpLhcIf", "GLO/Config/GRPLHCIF", "Path on the CCDB for the GRPLHCIF object"};
6273

74+
#define DECLARE_PARTICLE_WISE_CONFIGURABLES(ParticleNameShort, ParticleNameLong) \
75+
Configurable<float> cutTpcInnerParameterMin##ParticleNameLong{"cutTpcInnerParameterMin" #ParticleNameLong, -1., "Lower-value cut on tpcInnerParam for " #ParticleNameLong}; \
76+
Configurable<float> cutTpcInnerParameterMax##ParticleNameLong{"cutTpcInnerParameterMax" #ParticleNameLong, -1., "Upper-value cut on tpcInnerParam for " #ParticleNameLong}; \
77+
Configurable<float> cutNSigmaTpcAbs##ParticleNameLong{"cutNSigmaTpcAbs" #ParticleNameLong, -1., "Cut on absolute value of nSigmaTpc for " #ParticleNameLong};
78+
79+
PARTICLE_LIST(DECLARE_PARTICLE_WISE_CONFIGURABLES)
80+
#undef DECLARE_PARTICLE_WISE_CONFIGURABLES
81+
6382
Service<o2::ccdb::BasicCCDBManager> ccdb{};
6483

6584
ctpRateFetcher mRateFetcher{};
@@ -78,32 +97,24 @@ struct treeCreatorPidTpcQa {
7897
int enabledProcesses{0};
7998

8099
switch (Id) {
81-
#define PARTICLE_CASE(ParticleId) \
82-
case PID::ParticleId: \
83-
if (!doprocess##ParticleId && !doprocessFull##ParticleId && !doprocessFullWithTOF##ParticleId) { \
84-
return false; \
85-
} \
86-
if (doprocess##ParticleId) { \
87-
++enabledProcesses; \
88-
} \
89-
if (doprocessFull##ParticleId) { \
90-
++enabledProcesses; \
91-
} \
92-
if (doprocessFullWithTOF##ParticleId) { \
93-
++enabledProcesses; \
94-
} \
95-
LOG(info) << "Enabled TPC QA for " << #ParticleId; \
100+
#define PARTICLE_CASE(ParticleNameShort, ParticleNameLong) \
101+
case PID::ParticleNameLong: \
102+
if (!doprocess##ParticleNameLong && !doprocessFull##ParticleNameLong && !doprocessFullWithTOF##ParticleNameLong) { \
103+
return false; \
104+
} \
105+
if (doprocess##ParticleNameLong) { \
106+
++enabledProcesses; \
107+
} \
108+
if (doprocessFull##ParticleNameLong) { \
109+
++enabledProcesses; \
110+
} \
111+
if (doprocessFullWithTOF##ParticleNameLong) { \
112+
++enabledProcesses; \
113+
} \
114+
LOG(info) << "Enabled TPC QA for " << #ParticleNameLong; \
96115
break;
97116

98-
PARTICLE_CASE(Electron);
99-
PARTICLE_CASE(Muon);
100-
PARTICLE_CASE(Pion);
101-
PARTICLE_CASE(Kaon);
102-
PARTICLE_CASE(Proton);
103-
PARTICLE_CASE(Deuteron);
104-
PARTICLE_CASE(Triton);
105-
PARTICLE_CASE(Helium3);
106-
PARTICLE_CASE(Alpha);
117+
PARTICLE_LIST(PARTICLE_CASE)
107118
#undef PARTICLE_CASE
108119
}
109120
if (enabledProcesses != 1) {
@@ -194,70 +205,47 @@ struct treeCreatorPidTpcQa {
194205
}
195206

196207
// QA of nsigma only tables
197-
#define MAKE_PROCESS_FUNCTION(PidTableTPC, ParticleId) \
198-
void process##ParticleId(CollisionsExtra const& collisions, \
199-
soa::Join<TrackCandidates, PidTableTPC> const& tracks, \
200-
aod::BCsWithTimestamps const&) \
201-
{ \
202-
processSingleParticle<PID::ParticleId, false, false>(collisions, tracks); \
203-
} \
204-
PROCESS_SWITCH(treeCreatorPidTpcQa, process##ParticleId, Form("Process for the %s hypothesis for TPC NSigma QA", #ParticleId), false);
205-
206-
MAKE_PROCESS_FUNCTION(aod::pidTPCEl, Electron);
207-
MAKE_PROCESS_FUNCTION(aod::pidTPCMu, Muon);
208-
MAKE_PROCESS_FUNCTION(aod::pidTPCPi, Pion);
209-
MAKE_PROCESS_FUNCTION(aod::pidTPCKa, Kaon);
210-
MAKE_PROCESS_FUNCTION(aod::pidTPCPr, Proton);
211-
MAKE_PROCESS_FUNCTION(aod::pidTPCDe, Deuteron);
212-
MAKE_PROCESS_FUNCTION(aod::pidTPCTr, Triton);
213-
MAKE_PROCESS_FUNCTION(aod::pidTPCHe, Helium3);
214-
MAKE_PROCESS_FUNCTION(aod::pidTPCAl, Alpha);
208+
#define MAKE_PROCESS_FUNCTION(ParticleNameShort, ParticleNameLong) \
209+
void process##ParticleNameLong(CollisionsExtra const& collisions, \
210+
soa::Join<TrackCandidates, aod::pidTPC##ParticleNameShort> const& tracks, \
211+
aod::BCsWithTimestamps const&) \
212+
{ \
213+
processSingleParticle<PID::ParticleNameLong, false, false>(collisions, tracks); \
214+
} \
215+
PROCESS_SWITCH(treeCreatorPidTpcQa, process##ParticleNameLong, Form("Process for the %s hypothesis for TPC NSigma QA ", #ParticleNameLong), false);
216+
217+
PARTICLE_LIST(MAKE_PROCESS_FUNCTION)
215218
#undef MAKE_PROCESS_FUNCTION
216219

217220
// QA of full tables
218-
#define MAKE_PROCESS_FUNCTION(PidTableTPC, ParticleId) \
219-
void processFull##ParticleId(CollisionsExtra const& collisions, \
220-
soa::Join<TrackCandidates, PidTableTPC> const& tracks, \
221-
aod::BCsWithTimestamps const&) \
222-
{ \
223-
processSingleParticle<PID::ParticleId, true, false>(collisions, tracks); \
224-
} \
225-
PROCESS_SWITCH(treeCreatorPidTpcQa, processFull##ParticleId, Form("Process for the %s hypothesis for full TPC PID QA", #ParticleId), false);
226-
227-
MAKE_PROCESS_FUNCTION(aod::pidTPCFullEl, Electron);
228-
MAKE_PROCESS_FUNCTION(aod::pidTPCFullMu, Muon);
229-
MAKE_PROCESS_FUNCTION(aod::pidTPCFullPi, Pion);
230-
MAKE_PROCESS_FUNCTION(aod::pidTPCFullKa, Kaon);
231-
MAKE_PROCESS_FUNCTION(aod::pidTPCFullPr, Proton);
232-
MAKE_PROCESS_FUNCTION(aod::pidTPCFullDe, Deuteron);
233-
MAKE_PROCESS_FUNCTION(aod::pidTPCFullTr, Triton);
234-
MAKE_PROCESS_FUNCTION(aod::pidTPCFullHe, Helium3);
235-
MAKE_PROCESS_FUNCTION(aod::pidTPCFullAl, Alpha);
221+
#define MAKE_PROCESS_FUNCTION(ParticleNameShort, ParticleNameLong) \
222+
void processFull##ParticleNameLong(CollisionsExtra const& collisions, \
223+
soa::Join<TrackCandidates, aod::pidTPCFull##ParticleNameShort> const& tracks, \
224+
aod::BCsWithTimestamps const&) \
225+
{ \
226+
processSingleParticle<PID::ParticleNameLong, true, false>(collisions, tracks); \
227+
} \
228+
PROCESS_SWITCH(treeCreatorPidTpcQa, processFull##ParticleNameLong, Form("Process for the %s hypothesis for full TPC PID QA ", #ParticleNameLong), false);
229+
230+
PARTICLE_LIST(MAKE_PROCESS_FUNCTION)
236231
#undef MAKE_PROCESS_FUNCTION
237232

238233
// QA of full tables with TOF information
239-
#define MAKE_PROCESS_FUNCTION(PidTableTPC, PidTableTOF, ParticleId) \
240-
void processFullWithTOF##ParticleId(CollisionsExtra const& collisions, \
241-
soa::Join<TrackCandidates, PidTableTPC, PidTableTOF> const& tracks, \
242-
aod::BCsWithTimestamps const&) \
243-
{ \
244-
processSingleParticle<PID::ParticleId, true, true>(collisions, tracks); \
245-
} \
246-
PROCESS_SWITCH(treeCreatorPidTpcQa, processFullWithTOF##ParticleId, Form("Process for the %s hypothesis for full TPC PID QA with the TOF info added", #ParticleId), false);
247-
248-
MAKE_PROCESS_FUNCTION(aod::pidTPCFullEl, aod::pidTOFFullEl, Electron);
249-
MAKE_PROCESS_FUNCTION(aod::pidTPCFullMu, aod::pidTOFFullMu, Muon);
250-
MAKE_PROCESS_FUNCTION(aod::pidTPCFullPi, aod::pidTOFFullPi, Pion);
251-
MAKE_PROCESS_FUNCTION(aod::pidTPCFullKa, aod::pidTOFFullKa, Kaon);
252-
MAKE_PROCESS_FUNCTION(aod::pidTPCFullPr, aod::pidTOFFullPr, Proton);
253-
MAKE_PROCESS_FUNCTION(aod::pidTPCFullDe, aod::pidTOFFullDe, Deuteron);
254-
MAKE_PROCESS_FUNCTION(aod::pidTPCFullTr, aod::pidTOFFullTr, Triton);
255-
MAKE_PROCESS_FUNCTION(aod::pidTPCFullHe, aod::pidTOFFullHe, Helium3);
256-
MAKE_PROCESS_FUNCTION(aod::pidTPCFullAl, aod::pidTOFFullAl, Alpha);
234+
#define MAKE_PROCESS_FUNCTION(ParticleNameShort, ParticleNameLong) \
235+
void processFullWithTOF##ParticleNameLong(CollisionsExtra const& collisions, \
236+
soa::Join<TrackCandidates, aod::pidTPCFull##ParticleNameShort, aod::pidTOFFull##ParticleNameShort> const& tracks, \
237+
aod::BCsWithTimestamps const&) \
238+
{ \
239+
processSingleParticle<PID::ParticleNameLong, true, true>(collisions, tracks); \
240+
} \
241+
PROCESS_SWITCH(treeCreatorPidTpcQa, processFullWithTOF##ParticleNameLong, Form("Process for the %s hypothesis for full TPC PID QA with the TOF info added ", #ParticleNameLong), false);
242+
243+
PARTICLE_LIST(MAKE_PROCESS_FUNCTION)
257244
#undef MAKE_PROCESS_FUNCTION
258245
};
259246

260247
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
261248
{
262249
return WorkflowSpec{adaptAnalysisTask<treeCreatorPidTpcQa>(cfgc)};
263250
}
251+
#undef PARTICLE_LIST

0 commit comments

Comments
 (0)