@@ -43,6 +43,9 @@ static const std::vector<std::string> parameterNames{"enable"};
4343static const int defaultParameters[9 ][nParameters]{{0 }, {0 }, {1 }, {1 }, {1 }, {0 }, {0 }, {0 }, {0 }};
4444static const float defaultPIDSelection[9 ][nParameters]{{-1 .f }, {-1 .f }, {-1 .f }, {-1 .f }, {-1 .f }, {-1 .f }, {-1 .f }, {-1 .f }, {-1 .f }};
4545static constexpr int Np = 9 ;
46+ bool enableParticle[Np] = {false , false , false ,
47+ false , false , false ,
48+ false , false , false };
4649std::array<std::shared_ptr<TH2>, Np> hNsigmaPos;
4750std::array<std::shared_ptr<TH2>, Np> hNsigmaNeg;
4851
@@ -137,9 +140,9 @@ struct itsPidQa {
137140 static constexpr const char * pN[Np] = {" El" , " Mu" , " Pi" , " Ka" , " Pr" , " De" , " Tr" , " He" , " Al" };
138141
139142 HistogramRegistry histos{" Histos" , {}, OutputObjHandlingPolicy::AnalysisObject};
140- Configurable<LabeledArray<int >> enabledTables{ " enabledTables " ,
141- {defaultParameters[0 ], 9 , nParameters, tableNames, parameterNames},
142- " Produce QA for this species: 0 - no, 1 - yes" };
143+ Configurable<LabeledArray<int >> enabledParticle{ " enabledParticle " ,
144+ {defaultParameters[0 ], 9 , nParameters, tableNames, parameterNames},
145+ " Produce QA for this species: 0 - no, 1 - yes" };
143146 Configurable<LabeledArray<float >> tofSelection{" tofSelection" ,
144147 {defaultPIDSelection[0 ], 9 , nParameters, tableNames, parameterNames},
145148 " Selection on the TOF nsigma" };
@@ -214,13 +217,14 @@ struct itsPidQa {
214217 histos.add (" event/p" , " " , kTH1D , {pAxis});
215218
216219 for (int id = 0 ; id < 9 ; id++) {
217- const int f = enabledTables ->get (tableNames[id].c_str (), " enable" );
220+ const int f = enabledParticle ->get (tableNames[id].c_str (), " enable" );
218221 if (f != 1 ) {
219222 continue ;
220223 }
221224 // NSigma
222225 const char * axisTitle = Form (" N_{#sigma}^{ITS}(%s)" , pT[id]);
223226 const AxisSpec nSigmaAxis{nSigmaBins, axisTitle};
227+ enableParticle[id] = true ;
224228 hNsigmaPos[id] = histos.add <TH2>(Form (" nsigmaPos/%s" , pN[id]), axisTitle, kTH2F , {pAxis, nSigmaAxis});
225229 hNsigmaNeg[id] = histos.add <TH2>(Form (" nsigmaNeg/%s" , pN[id]), axisTitle, kTH2F , {pAxis, nSigmaAxis});
226230 }
@@ -259,7 +263,9 @@ struct itsPidQa {
259263 histos.fill (HIST (" event/evsel" ), 3 );
260264 histos.fill (HIST (" event/vertexz" ), collision.posZ ());
261265
266+ int nTracks = -1 ;
262267 for (const auto & track : tracksWithPid) {
268+ nTracks++;
263269 histos.fill (HIST (" event/trackselection" ), 1 .f );
264270 if (!track.isGlobalTrack ()) { // Skipping non global tracks
265271 continue ;
@@ -299,16 +305,20 @@ struct itsPidQa {
299305 continue ;
300306 }
301307 for (o2::track::PID::ID id = 0 ; id <= o2::track::PID::Last; id++) {
308+ if (!enableParticle[id]) {
309+ continue ;
310+ }
302311 if (applyRapidityCut) {
303312 if (std::abs (track.rapidity (PID::getMass (id))) > 0.5 ) {
304313 continue ;
305314 }
306315 }
307316 const float nsigma = nsigmaITS (track, id);
308- if (track.sign () > 0 ) {
309- hNsigmaPos[id]->Fill (track.p (), nsigma);
317+ const auto & t = tracks.iteratorAt (nTracks);
318+ if (t.sign () > 0 ) {
319+ hNsigmaPos[id]->Fill (t.p (), nsigma);
310320 } else {
311- hNsigmaNeg[id]->Fill (track .p (), nsigma);
321+ hNsigmaNeg[id]->Fill (t .p (), nsigma);
312322 }
313323 }
314324 }
0 commit comments