@@ -42,6 +42,7 @@ static const std::vector<std::string> tableNames{"Electron", // 0
4242 " Helium" , // 7
4343 " Alpha" }; // 8
4444static const std::vector<std::string> parameterNames{" enable" };
45+ static const std::vector<std::string> selectionNames{" selection" };
4546static const int defaultParameters[9 ][nParameters]{{0 }, {0 }, {1 }, {1 }, {1 }, {0 }, {0 }, {0 }, {0 }};
4647static const float defaultPIDSelection[9 ][nParameters]{{-1 .f }, {-1 .f }, {-1 .f }, {-1 .f }, {-1 .f }, {-1 .f }, {-1 .f }, {-1 .f }, {-1 .f }};
4748static constexpr int Np = 9 ;
@@ -146,10 +147,10 @@ struct itsPidQa {
146147 {defaultParameters[0 ], 9 , nParameters, tableNames, parameterNames},
147148 " Produce QA for this species: 0 - no, 1 - yes" };
148149 Configurable<LabeledArray<float >> tofSelection{" tofSelection" ,
149- {defaultPIDSelection[0 ], 9 , nParameters, tableNames, parameterNames },
150+ {defaultPIDSelection[0 ], 9 , nParameters, tableNames, selectionNames },
150151 " Selection on the TOF nsigma" };
151152 Configurable<LabeledArray<float >> tpcSelection{" tpcSelection" ,
152- {defaultPIDSelection[0 ], 9 , nParameters, tableNames, parameterNames },
153+ {defaultPIDSelection[0 ], 9 , nParameters, tableNames, selectionNames },
153154 " Selection on the TPC nsigma" };
154155
155156 Configurable<int > logAxis{" logAxis" , 1 , " Flag to use a log momentum axis" };
@@ -165,10 +166,8 @@ struct itsPidQa {
165166 ConfigurableAxis avClsBins{" avClsBins" , {200 , 0 , 20 }, " Binning in average cluster size" };
166167 Configurable<int > trackSelection{" trackSelection" , 1 , " Track selection: 0 -> No Cut, 1 -> kGlobalTrack, 2 -> kGlobalTrackWoPtEta, 3 -> kGlobalTrackWoDCA, 4 -> kQualityTracks, 5 -> kInAcceptanceTracks" };
167168 Configurable<bool > applyRapidityCut{" applyRapidityCut" , false , " Flag to apply rapidity cut" };
168- Configurable<bool > enableDeDxPlot{" enableDeDxPlot" , true , " Enables the dEdx plot (reduces memory footprint if off)" };
169169 Configurable<int16_t > minTPCNcls{" minTPCNcls" , 0 , " Minimum number or TPC Clusters for tracks" };
170170 ConfigurableAxis tpcNclsBins{" tpcNclsBins" , {16 , 0 , 160 }, " Binning in number of clusters in TPC" };
171- Configurable<bool > fillTHnSparses{" fillTHnSparses" , false , " Flag to fill multidimensional histograms for nsigma vs pt, eta, Ncls" };
172171
173172 template <typename TrackType>
174173 float averageClusterSizeTrk (const TrackType& track)
@@ -196,7 +195,6 @@ struct itsPidQa {
196195 ptAxis.makeLogarithmic ();
197196 pAxis.makeLogarithmic ();
198197 }
199- const AxisSpec chargeAxis{2 , -2 .f , 2 .f , " Charge" };
200198 const AxisSpec avClsAxis{avClsBins, " <ITS Cls. Size>" };
201199 const AxisSpec avClsEffAxis{avClsBins, " <ITS Cls. Size> / cosh(#eta)" };
202200
@@ -217,11 +215,11 @@ struct itsPidQa {
217215 h = histos.add <TH1>(" event/particlehypo" , " " , kTH1D , {{10 , 0 , 10 , " PID in tracking" }});
218216 for (int id = 0 ; id < 9 ; id++) {
219217 h->GetXaxis ()->SetBinLabel (id + 1 , PID::getName (id));
220- tpcSelValues[id] = tpcSelection->get (tableNames[id].c_str (), " enable " );
218+ tpcSelValues[id] = tpcSelection->get (tableNames[id].c_str (), " selection " );
221219 if (tpcSelValues[id] <= 0 .f ) {
222220 tpcSelValues[id] = 999 .f ;
223221 }
224- tofSelValues[id] = tofSelection->get (tableNames[id].c_str (), " enable " );
222+ tofSelValues[id] = tofSelection->get (tableNames[id].c_str (), " selection " );
225223 if (tofSelValues[id] <= 0 .f ) {
226224 tofSelValues[id] = 999 .f ;
227225 }
@@ -245,16 +243,16 @@ struct itsPidQa {
245243 hNsigmaPos[id] = histos.add <TH2>(Form (" nsigmaPos/%s" , pN[id]), axisTitle, kTH2F , {pAxis, nSigmaAxis});
246244 hNsigmaNeg[id] = histos.add <TH2>(Form (" nsigmaNeg/%s" , pN[id]), axisTitle, kTH2F , {pAxis, nSigmaAxis});
247245 }
248- histos.add (" event/averageClusterSize" , " " , kTH2F , {ptAxis , avClsAxis});
249- histos.add (" event/averageClusterSizePerCoslInv" , " " , kTH2F , {ptAxis , avClsEffAxis});
250- histos.add (" event/SelectedAverageClusterSize" , " " , kTH2F , {ptAxis , avClsAxis});
251- histos.add (" event/SelectedAverageClusterSizePerCoslInv" , " " , kTH2F , {ptAxis , avClsEffAxis});
246+ histos.add (" event/averageClusterSize" , " " , kTH2D , {pAxis , avClsAxis});
247+ histos.add (" event/averageClusterSizePerCoslInv" , " " , kTH2D , {pAxis , avClsEffAxis});
248+ histos.add (" event/SelectedAverageClusterSize" , " " , kTH2D , {pAxis , avClsAxis});
249+ histos.add (" event/SelectedAverageClusterSizePerCoslInv" , " " , kTH2D , {pAxis , avClsEffAxis});
252250 LOG (info) << " QA PID ITS histograms:" ;
253251 histos.print ();
254252 }
255253
256- Filter eventFilter = (o2::aod::evsel::sel8 == true );
257- Filter trackFilter = (requireGlobalTrackInFilter());
254+ Filter eventFilter = (o2::aod::evsel::sel8 == true && nabs(o2::aod::collision::posZ) < 10 .f );
255+ // Filter trackFilter = (requireGlobalTrackInFilter());
258256 using CollisionCandidate = soa::Filtered<soa::Join<aod::Collisions, aod::EvSels>>::iterator;
259257 using TrackCandidates = soa::Join<aod::Tracks, aod::TracksExtra, aod::TrackSelection,
260258 aod::pidTPCEl, aod::pidTPCMu, aod::pidTPCPi,
@@ -264,29 +262,22 @@ struct itsPidQa {
264262 aod::pidTOFKa, aod::pidTOFPr, aod::pidTOFDe,
265263 aod::pidTOFTr, aod::pidTOFHe, aod::pidTOFAl>;
266264 void process (CollisionCandidate const & collision,
267- soa::Filtered< TrackCandidates> const & tracks)
265+ TrackCandidates const & tracks)
268266 {
269267 auto tracksWithPid = soa::Attach<TrackCandidates,
270268 aod::pidits::ITSNSigmaEl, aod::pidits::ITSNSigmaMu, aod::pidits::ITSNSigmaPi,
271269 aod::pidits::ITSNSigmaKa, aod::pidits::ITSNSigmaPr, aod::pidits::ITSNSigmaDe,
272270 aod::pidits::ITSNSigmaTr, aod::pidits::ITSNSigmaHe, aod::pidits::ITSNSigmaAl>(tracks);
273271
274- histos.fill (HIST (" event/evsel" ), 1 );
275- if (!collision.sel8 ()) {
276- return ;
272+ if (tracks.size () != tracksWithPid.size ()) {
273+ LOG (fatal) << " Mismatch in track table size!" << tracks.size () << " vs " << tracksWithPid.size ();
277274 }
278-
275+ histos. fill ( HIST ( " event/evsel " ), 1 );
279276 histos.fill (HIST (" event/evsel" ), 2 );
280-
281- if (std::abs (collision.posZ ()) > 10 .f ) {
282- return ;
283- }
284277 histos.fill (HIST (" event/evsel" ), 3 );
285278 histos.fill (HIST (" event/vertexz" ), collision.posZ ());
286279
287- int nTracks = -1 ;
288280 for (const auto & track : tracksWithPid) {
289- nTracks++;
290281 histos.fill (HIST (" event/trackselection" ), 1 .f );
291282 if (!track.isGlobalTrack ()) { // Skipping non global tracks
292283 continue ;
@@ -312,23 +303,28 @@ struct itsPidQa {
312303 histos.fill (HIST (" event/length" ), track.length ());
313304 histos.fill (HIST (" event/pt" ), track.pt ());
314305 histos.fill (HIST (" event/p" ), track.p ());
315- const auto & t = tracks.iteratorAt (nTracks);
316- histos.fill (HIST (" event/averageClusterSize" ), track.pt (), averageClusterSizeTrk (track));
317- histos.fill (HIST (" event/averageClusterSizePerCoslInv" ), track.pt (), averageClusterSizePerCoslInv (track));
306+ histos.fill (HIST (" event/averageClusterSize" ), track.p (), averageClusterSizeTrk (track));
307+ histos.fill (HIST (" event/averageClusterSizePerCoslInv" ), track.p (), averageClusterSizePerCoslInv (track));
318308 bool discard = false ;
319309 for (int id = 0 ; id < 9 ; id++) {
320310 if (std::abs (nsigmaTPC (track, id)) > tpcSelValues[id]) {
311+ LOG (debug) << " Discarding based on TPC hypothesis " << id << " " << std::abs (nsigmaTPC (track, id)) << " >" << tpcSelValues[id];
321312 discard = true ;
313+ break ;
322314 }
323- if (std::abs (nsigmaTOF (track, id)) > tofSelValues[id]) {
324- discard = true ;
315+ if (track.hasTOF ()) {
316+ if (std::abs (nsigmaTOF (track, id)) > tofSelValues[id]) {
317+ LOG (debug) << " Discarding based on TOF hypothesis " << id << " " << std::abs (nsigmaTOF (track, id)) << " >" << tofSelValues[id];
318+ discard = true ;
319+ break ;
320+ }
325321 }
326322 }
327323 if (discard) {
328324 continue ;
329325 }
330- histos.fill (HIST (" event/SelectedAverageClusterSize" ), track.pt (), averageClusterSizeTrk (track));
331- histos.fill (HIST (" event/SelectedAverageClusterSizePerCoslInv" ), track.pt (), averageClusterSizePerCoslInv (track));
326+ histos.fill (HIST (" event/SelectedAverageClusterSize" ), track.p (), averageClusterSizeTrk (track));
327+ histos.fill (HIST (" event/SelectedAverageClusterSizePerCoslInv" ), track.p (), averageClusterSizePerCoslInv (track));
332328
333329 for (o2::track::PID::ID id = 0 ; id <= o2::track::PID::Last; id++) {
334330 if (!enableParticle[id]) {
@@ -340,10 +336,10 @@ struct itsPidQa {
340336 }
341337 }
342338 const float nsigma = nsigmaITS (track, id);
343- if (t .sign () > 0 ) {
344- hNsigmaPos[id]->Fill (t. p (), nsigma);
339+ if (track .sign () > 0 ) {
340+ hNsigmaPos[id]->Fill (track. pt (), nsigma);
345341 } else {
346- hNsigmaNeg[id]->Fill (t. p (), nsigma);
342+ hNsigmaNeg[id]->Fill (track. pt (), nsigma);
347343 }
348344 }
349345 }
0 commit comments