2020#include " ReconstructionDataFormats/Track.h"
2121#include " Common/Core/MC.h"
2222#include " Common/Core/TrackSelection.h"
23+ #include " Common/DataModel/EventSelection.h"
2324#include " Common/Core/TrackSelectionDefaults.h"
2425#include " Common/DataModel/TrackSelectionTables.h"
2526
@@ -59,6 +60,8 @@ struct QaTrackingEfficiency {
5960 Configurable<float > etaMax{" eta-max" , 3 .f , " Upper limit in eta" };
6061 Configurable<float > phiMin{" phi-min" , 0 .f , " Lower limit in phi" };
6162 Configurable<float > phiMax{" phi-max" , 6 .284f , " Upper limit in phi" };
63+ Configurable<float > yMin{" y-min" , -0 .5f , " Lower limit in y" };
64+ Configurable<float > yMax{" y-max" , 0 .5f , " Upper limit in y" };
6265 Configurable<float > ptMin{" pt-min" , 0 .f , " Lower limit in pT" };
6366 Configurable<float > ptMax{" pt-max" , 5 .f , " Upper limit in pT" };
6467 Configurable<int > selPrim{" sel-prim" , 1 , " 1 select primaries, 0 select all particles" };
@@ -72,6 +75,7 @@ struct QaTrackingEfficiency {
7275 Configurable<int > ptBins{" pt-bins" , 500 , " Number of pT bins" };
7376 Configurable<int > logPt{" log-pt" , 0 , " Flag to use a logarithmic pT axis" };
7477 Configurable<int > etaBins{" eta-bins" , 500 , " Number of eta bins" };
78+ Configurable<int > yBins{" y-bins" , 500 , " Number of eta bins" };
7579 Configurable<int > phiBins{" phi-bins" , 500 , " Number of phi bins" };
7680 // Task configuration
7781 Configurable<bool > makeEff{" make-eff" , false , " Flag to produce the efficiency with TEfficiency" };
@@ -93,66 +97,93 @@ struct QaTrackingEfficiency {
9397 axisP.makeLogaritmic ();
9498 }
9599 const AxisSpec axisEta{etaBins, etaMin, etaMax, " #it{#eta}" };
100+ const AxisSpec axisY{yBins, yMin, yMax, " #it{y}" };
96101 const AxisSpec axisPhi{phiBins, phiMin, phiMax, " #it{#varphi} (rad)" };
97102
98- const AxisSpec axisSel{9 , 0.5 , 9 .5 , " Selection" };
103+ const AxisSpec axisSel{20 , 0.5 , 20 .5 , " Selection" };
99104 histos.add (" eventSelection" , " Event Selection" , kTH1D , {axisSel});
100105 histos.get <TH1 >(HIST (" eventSelection" ))->GetXaxis ()->SetBinLabel (1 , " Events read" );
101106 histos.get <TH1 >(HIST (" eventSelection" ))->GetXaxis ()->SetBinLabel (2 , " Passed Contrib." );
102107 histos.get <TH1 >(HIST (" eventSelection" ))->GetXaxis ()->SetBinLabel (3 , " Passed Position" );
108+ histos.get <TH1 >(HIST (" eventSelection" ))->GetXaxis ()->SetBinLabel (4 , " Passed Ev. Sel." );
103109
104110 histos.add (" trackSelection" , " Track Selection" , kTH1D , {axisSel});
105111 histos.get <TH1 >(HIST (" trackSelection" ))->GetXaxis ()->SetBinLabel (1 , " Tracks read" );
106112 histos.get <TH1 >(HIST (" trackSelection" ))->GetXaxis ()->SetBinLabel (2 , " Passed Ev. Reco." );
107113 histos.get <TH1 >(HIST (" trackSelection" ))->GetXaxis ()->SetBinLabel (3 , " Passed #it{p}_{T}" );
108114 histos.get <TH1 >(HIST (" trackSelection" ))->GetXaxis ()->SetBinLabel (4 , " Passed #it{#eta}" );
109115 histos.get <TH1 >(HIST (" trackSelection" ))->GetXaxis ()->SetBinLabel (5 , " Passed #it{#varphi}" );
110- histos.get <TH1 >(HIST (" trackSelection" ))->GetXaxis ()->SetBinLabel (6 , " Passed Prim." );
111- histos.get <TH1 >(HIST (" trackSelection" ))->GetXaxis ()->SetBinLabel (7 , Form (" Passed PDG %i" , pdg));
112- histos.get <TH1 >(HIST (" trackSelection" ))->GetXaxis ()->SetBinLabel (8 , " Passed Fake" );
116+ histos.get <TH1 >(HIST (" trackSelection" ))->GetXaxis ()->SetBinLabel (6 , " Passed y" );
117+ histos.get <TH1 >(HIST (" trackSelection" ))->GetXaxis ()->SetBinLabel (7 , " Passed Prim." );
118+ histos.get <TH1 >(HIST (" trackSelection" ))->GetXaxis ()->SetBinLabel (8 , Form (" Passed PDG %i" , pdg));
119+ histos.get <TH1 >(HIST (" trackSelection" ))->GetXaxis ()->SetBinLabel (9 , " Passed Prim. MC" );
120+ histos.get <TH1 >(HIST (" trackSelection" ))->GetXaxis ()->SetBinLabel (10 , " Passed Fake" );
121+ histos.get <TH1 >(HIST (" trackSelection" ))->GetXaxis ()->SetBinLabel (11 , " Passed standard quality cuts" );
122+ histos.get <TH1 >(HIST (" trackSelection" ))->GetXaxis ()->SetBinLabel (12 , " Passed has collision" );
123+ histos.get <TH1 >(HIST (" trackSelection" ))->GetXaxis ()->SetBinLabel (13 , " Passed hasTOF" );
113124
114125 histos.add (" partSelection" , " Particle Selection" , kTH1D , {axisSel});
115126 histos.get <TH1 >(HIST (" partSelection" ))->GetXaxis ()->SetBinLabel (1 , " Particles read" );
116127 histos.get <TH1 >(HIST (" partSelection" ))->GetXaxis ()->SetBinLabel (2 , " Passed Ev. Reco." );
117128 histos.get <TH1 >(HIST (" partSelection" ))->GetXaxis ()->SetBinLabel (3 , " Passed #it{p}_{T}" );
118129 histos.get <TH1 >(HIST (" partSelection" ))->GetXaxis ()->SetBinLabel (4 , " Passed #it{#eta}" );
119130 histos.get <TH1 >(HIST (" partSelection" ))->GetXaxis ()->SetBinLabel (5 , " Passed #it{#varphi}" );
120- histos.get <TH1 >(HIST (" partSelection" ))->GetXaxis ()->SetBinLabel (6 , " Passed Prim." );
121- histos.get <TH1 >(HIST (" partSelection" ))->GetXaxis ()->SetBinLabel (7 , Form (" Passed PDG %i" , pdg));
131+ histos.get <TH1 >(HIST (" partSelection" ))->GetXaxis ()->SetBinLabel (6 , " Passed y" );
132+ histos.get <TH1 >(HIST (" partSelection" ))->GetXaxis ()->SetBinLabel (7 , " Passed Prim." );
133+ histos.get <TH1 >(HIST (" partSelection" ))->GetXaxis ()->SetBinLabel (8 , Form (" Passed PDG %i" , pdg));
134+ histos.get <TH1 >(HIST (" partSelection" ))->GetXaxis ()->SetBinLabel (9 , " Passed Prim. MC" );
122135
123136 histos.add (" eventMultiplicity" , " Event Selection" , kTH1D , {{1000 , 0 , 5000 }});
124137 histos.add (" trackLength" , " Track length;Track length (cm)" , kTH1D , {{2000 , -1000 , 1000 }});
125138
126- const TString tagPt = Form (" %s #it{#eta} [%.2f,%.2f] #it{#varphi} [%.2f,%.2f] Prim %i" ,
139+ const TString tagPt = Form (" %s #it{#eta} [%.2f,%.2f] #it{y} [%.2f,%.2f] #it{ #varphi} [%.2f,%.2f] Prim %i" ,
127140 o2::track::pid_constants::sNames [particle],
128141 etaMin.value , etaMax.value ,
142+ yMin.value , yMax.value ,
129143 phiMin.value , phiMax.value ,
130144 selPrim.value );
131145 histos.add (" pt/num" , " Numerator " + tagPt, kTH1D , {axisPt});
146+ histos.add (" pt/numtof" , " Numerator TOF " + tagPt, kTH1D , {axisPt});
132147 histos.add (" pt/den" , " Denominator " + tagPt, kTH1D , {axisPt});
133148
134149 histos.add (" p/num" , " Numerator " + tagPt, kTH1D , {axisP});
150+ histos.add (" p/numtof" , " Numerator TOF " + tagPt, kTH1D , {axisP});
135151 histos.add (" p/den" , " Denominator " + tagPt, kTH1D , {axisP});
136152
137- const TString tagEta = Form (" %s #it{p}_{T} [%.2f,%.2f] #it{#varphi} [%.2f,%.2f] Prim %i" ,
153+ const TString tagEta = Form (" %s #it{p}_{T} [%.2f,%.2f] #it{y} [%.2f,%.2f] #it{ #varphi} [%.2f,%.2f] Prim %i" ,
138154 o2::track::pid_constants::sNames [particle],
139155 ptMin.value , ptMax.value ,
156+ yMin.value , yMax.value ,
140157 phiMin.value , phiMax.value ,
141158 selPrim.value );
142159 histos.add (" eta/num" , " Numerator " + tagEta, kTH1D , {axisEta});
160+ histos.add (" eta/numtof" , " Numerator TOF " + tagEta, kTH1D , {axisEta});
143161 histos.add (" eta/den" , " Denominator " + tagEta, kTH1D , {axisEta});
144162
145- const TString tagPhi = Form (" %s #it{#eta} [%.2f,%.2f] #it{p}_{T} [%.2f,%.2f] Prim %i" ,
163+ const TString tagY = Form (" %s #it{p}_{T} [%.2f,%.2f] #it{#eta} [%.2f,%.2f] #it{#varphi} [%.2f,%.2f] Prim %i" ,
164+ o2::track::pid_constants::sNames [particle],
165+ ptMin.value , ptMax.value ,
166+ etaMin.value , etaMax.value ,
167+ phiMin.value , phiMax.value ,
168+ selPrim.value );
169+ histos.add (" y/num" , " Numerator " + tagY, kTH1D , {axisY});
170+ histos.add (" y/numtof" , " Numerator TOF " + tagY, kTH1D , {axisY});
171+ histos.add (" y/den" , " Denominator " + tagY, kTH1D , {axisY});
172+
173+ const TString tagPhi = Form (" %s #it{p}_{T} [%.2f,%.2f] #it{#eta} [%.2f,%.2f] #it{y} [%.2f,%.2f] Prim %i" ,
146174 o2::track::pid_constants::sNames [particle],
147- etaMin.value , etaMax.value ,
148175 ptMin.value , ptMax.value ,
176+ etaMin.value , etaMax.value ,
177+ yMin.value , yMax.value ,
149178 selPrim.value );
150179 histos.add (" phi/num" , " Numerator " + tagPhi, kTH1D , {axisPhi});
180+ histos.add (" phi/numtof" , " Numerator TOF " + tagPhi, kTH1D , {axisPhi});
151181 histos.add (" phi/den" , " Denominator " + tagPhi, kTH1D , {axisPhi});
152182
153- const TString tagPtEta = Form (" %s #it{#varphi} [%.2f,%.2f] Prim %i" ,
183+ const TString tagPtEta = Form (" %s #it{#varphi} [%.2f,%.2f] #it{y} [%.2f,%.2f] Prim %i" ,
154184 o2::track::pid_constants::sNames [particle],
155185 phiMin.value , phiMax.value ,
186+ yMin.value , yMax.value ,
156187 selPrim.value );
157188 histos.add (" pteta/num" , " Numerator " + tagPtEta, kTH2D , {axisPt, axisEta});
158189 histos.add (" pteta/den" , " Denominator " + tagPtEta, kTH2D , {axisPt, axisEta});
@@ -186,8 +217,8 @@ struct QaTrackingEfficiency {
186217 }
187218
188219 void process (const o2::aod::McParticles& mcParticles,
189- const o2::soa::Join<o2::aod::Collisions, o2::aod::McCollisionLabels>& collisions,
190- const o2::soa::Join<o2::aod::Tracks, o2::aod::TracksExtra, o2::aod::McTrackLabels>& tracks,
220+ const o2::soa::Join<o2::aod::Collisions, o2::aod::McCollisionLabels, o2::aod::EvSels >& collisions,
221+ const o2::soa::Join<o2::aod::Tracks, o2::aod::TracksExtra, o2::aod::McTrackLabels, o2::aod::TrackSelection >& tracks,
191222 const o2::aod::McCollisions&)
192223 {
193224
@@ -204,6 +235,10 @@ struct QaTrackingEfficiency {
204235 continue ;
205236 }
206237 histos.fill (HIST (" eventSelection" ), 3 );
238+ if (!collision.sel8 ()) {
239+ continue ;
240+ }
241+ histos.fill (HIST (" eventSelection" ), 4 );
207242 recoEvt[nevts++] = mcCollision.globalIndex ();
208243 }
209244 recoEvt.resize (nevts);
@@ -228,10 +263,14 @@ struct QaTrackingEfficiency {
228263 return true ;
229264 }
230265 histos.fill (h, 5 );
231- if ((selPrim == 1 ) && (! MC::isPhysicalPrimary (p) )) { // Requiring is physical primary
266+ if ((p. y () < yMin || p. y () > yMax )) { // Check rapidity
232267 return true ;
233268 }
234269 histos.fill (h, 6 );
270+ if ((selPrim == 1 ) && (!MC::isPhysicalPrimary (p))) { // Requiring is physical primary
271+ return true ;
272+ }
273+ histos.fill (h, 7 );
235274
236275 // Selecting PDG code
237276 switch ((int )pdgSign) {
@@ -254,7 +293,15 @@ struct QaTrackingEfficiency {
254293 LOG (fatal) << " Provide pdgSign as 0, 1, -1. Provided: " << pdgSign.value ;
255294 break ;
256295 }
257- histos.fill (h, 7 );
296+ histos.fill (h, 8 );
297+ // Select primaries based on position
298+ const float dx = p.vx () - p.mcCollision ().posX ();
299+ const float dy = p.vy () - p.mcCollision ().posY ();
300+ const float dz = p.vz () - p.mcCollision ().posZ ();
301+ if (sqrt (dx * dx + dy * dy + dz * dz) > 0.0001 ) {
302+ return true ;
303+ }
304+ histos.fill (h, 9 );
258305
259306 return false ;
260307 };
@@ -278,13 +325,31 @@ struct QaTrackingEfficiency {
278325 }
279326 }
280327
281- histos.fill (HIST (" trackSelection" ), 8 );
328+ histos.fill (HIST (" trackSelection" ), 10 );
329+ if (!track.isGlobalTrack ()) { // Check general cuts
330+ continue ;
331+ }
332+ histos.fill (HIST (" trackSelection" ), 11 );
333+ if (!track.has_collision ()) {
334+ continue ;
335+ }
336+ histos.fill (HIST (" trackSelection" ), 12 );
282337 histos.fill (HIST (" trackLength" ), track.length ());
283338 histos.fill (HIST (" p/num" ), mcParticle.p ());
284339 histos.fill (HIST (" pt/num" ), mcParticle.pt ());
285340 histos.fill (HIST (" eta/num" ), mcParticle.eta ());
341+ histos.fill (HIST (" y/num" ), mcParticle.y ());
286342 histos.fill (HIST (" phi/num" ), mcParticle.phi ());
287343 histos.fill (HIST (" pteta/num" ), mcParticle.pt (), mcParticle.eta ());
344+ if (!track.hasTOF ()) {
345+ continue ;
346+ }
347+ histos.fill (HIST (" trackSelection" ), 13 );
348+ histos.fill (HIST (" p/numtof" ), mcParticle.p ());
349+ histos.fill (HIST (" pt/numtof" ), mcParticle.pt ());
350+ histos.fill (HIST (" eta/numtof" ), mcParticle.eta ());
351+ histos.fill (HIST (" y/numtof" ), mcParticle.y ());
352+ histos.fill (HIST (" phi/numtof" ), mcParticle.phi ());
288353 }
289354
290355 float dNdEta = 0 ;
@@ -299,6 +364,7 @@ struct QaTrackingEfficiency {
299364 histos.fill (HIST (" p/den" ), mcParticle.p ());
300365 histos.fill (HIST (" pt/den" ), mcParticle.pt ());
301366 histos.fill (HIST (" eta/den" ), mcParticle.eta ());
367+ histos.fill (HIST (" y/den" ), mcParticle.y ());
302368 histos.fill (HIST (" phi/den" ), mcParticle.phi ());
303369 histos.fill (HIST (" pteta/den" ), mcParticle.pt (), mcParticle.eta ());
304370 }
0 commit comments