1 /* created by fbellini@cern.ch on 14/09/2010 */
2 /* last modified by fbellini on 31/03/2010 */
5 #ifndef ALIANALYSISTASKTOFQA_CXX
6 #define ALIANALYSISTASKTOFQA_CXX
13 #include "AliAnalysisTaskSE.h"
14 #include "AliAnalysisManager.h"
15 #include "AliESDEvent.h"
16 #include "AliESDInputHandler.h"
17 #include "AliESDpid.h"
18 #include "AliAnalysisTaskTOFqa.h"
19 #include "AliAnalysisFilter.h"
20 #include "AliESDtrackCuts.h"
22 #include "AliTOFRawStream.h"
23 #include "AliTOFGeometry.h"
25 ClassImp(AliAnalysisTaskTOFqa)
27 //________________________________________________________________________
28 AliAnalysisTaskTOFqa::AliAnalysisTaskTOFqa() :
33 fESDpid(new AliESDpid()),
35 // fNPrimaryTracks(0),
40 // Default constructor
42 for (Int_t j=0;j<3;j++ ) {
49 //________________________________________________________________________
50 AliAnalysisTaskTOFqa::AliAnalysisTaskTOFqa(const char *name) :
51 AliAnalysisTaskSE(name),
56 fESDpid(new AliESDpid()),
58 // fNPrimaryTracks(0),
64 // Define input and output slots here
65 Info("AliAnalysisTaskTOFqa","Calling Constructor");
67 for (Int_t j=0;j<5;j++ ) {
73 // Input slot #0 works with a TChain
74 DefineInput(0, TChain::Class());
76 // Output slot #0 writes into a TH1 container
77 // Output slot #1 writes into a user defined container
78 DefineOutput(1, TList::Class());
79 DefineOutput(2, TList::Class());
80 DefineOutput(3, TList::Class());
83 //________________________________________________________________________
84 AliAnalysisTaskTOFqa::AliAnalysisTaskTOFqa(const AliAnalysisTaskTOFqa& copy)
85 : AliAnalysisTaskSE(),
86 fRunNumber(copy.fRunNumber),
88 fTrackFilter(copy.fTrackFilter),
89 fVertex(copy.fVertex),
90 fESDpid(copy.fESDpid),
91 fNTOFtracks(copy.fNTOFtracks),
92 //fNPrimaryTracks(copy.fNPrimaryTracks),
94 fHlistTimeZero(copy.fHlistTimeZero),
95 fHlistPID(copy.fHlistPID)
98 for (Int_t j=0;j<5;j++ ) {
99 if (j<3) fT0[j]=copy.fT0[j];
100 fSigmaSpecie[j]=copy.fSigmaSpecie[j];
101 fTrkExpTimes[j]=copy.fTrkExpTimes[j];
102 fThExpTimes[j]=copy.fThExpTimes[j];
108 //___________________________________________________________________________
109 AliAnalysisTaskTOFqa& AliAnalysisTaskTOFqa::operator=(const AliAnalysisTaskTOFqa& copy)
112 // Assignment operator
115 AliAnalysisTaskSE::operator=(copy) ;
116 fRunNumber=copy.fRunNumber;
118 fTrackFilter=copy.fTrackFilter;
119 fVertex=copy.fVertex;
120 fESDpid=copy.fESDpid;
121 fNTOFtracks=copy.fNTOFtracks;
122 //fNPrimaryTracks=copy.fNPrimaryTracks;
123 for (Int_t j=0;j<5;j++ ) {
124 if (j<3) fT0[j]=copy.fT0[j];
125 fSigmaSpecie[j]=copy.fSigmaSpecie[j];
126 fTrkExpTimes[j]=copy.fTrkExpTimes[j];
127 fThExpTimes[j]=copy.fThExpTimes[j];
130 fHlistTimeZero=copy.fHlistTimeZero;
131 fHlistPID=copy.fHlistPID;
136 //___________________________________________________________________________
137 AliAnalysisTaskTOFqa::~AliAnalysisTaskTOFqa() {
142 Info("~AliAnalysisTaskTOFqa","Calling Destructor");
143 if (fESDpid) delete fESDpid;
144 if (fVertex) delete fVertex;
145 if (fTrackFilter) delete fTrackFilter;
147 if (AliAnalysisManager::GetAnalysisManager()->IsProofMode()) return;
152 if (fHlistTimeZero) {
153 delete fHlistTimeZero;
162 //________________________________________________________________________
163 void AliAnalysisTaskTOFqa::UserCreateOutputObjects()
165 //Defines output objects and histograms
166 Info("CreateOutputObjects","CreateOutputObjects (TList) of task %s", GetName());
168 if (!fHlist) fHlist = new TList();
169 fHlist->SetOwner(kTRUE);
170 if (!fHlistTimeZero) fHlistTimeZero = new TList();
171 fHlistTimeZero->SetOwner(kTRUE);
172 if (!fHlistPID) fHlistPID = new TList();
173 fHlistPID->SetOwner(kTRUE);
176 TH1I* hTOFmatchedESDperEvt = new TH1I("hTOFmatchedPerEvt", "Matched TOF tracks per event (|#eta| #leq 0.9 and pT #geq 0.3 GeV/c);TOF-matched ESD tracks;Events", 100, 0, 100) ;
177 hTOFmatchedESDperEvt->Sumw2() ;
178 hTOFmatchedESDperEvt->SetLineWidth(2);
179 hTOFmatchedESDperEvt->SetLineColor(kBlue);
180 hTOFmatchedESDperEvt->SetMarkerStyle(20);
181 hTOFmatchedESDperEvt->SetMarkerSize(0.8);
182 hTOFmatchedESDperEvt->SetMarkerColor(kBlue);
183 fHlist->AddLast(hTOFmatchedESDperEvt) ;
185 TH1F* hTOFmatchedESDtime = new TH1F("hTOFmatchedESDtime", "Matched ESDs tracks: TOF Time spectrum; t [ns];Counts", 250, 0., 610. ) ;
186 hTOFmatchedESDtime->Sumw2() ;
187 hTOFmatchedESDtime->SetLineWidth(2);
188 hTOFmatchedESDtime->SetLineColor(kBlue);
189 hTOFmatchedESDtime->SetFillColor(kBlue);
190 hTOFmatchedESDtime->SetDrawOption("BAR");
191 fHlist->AddLast(hTOFmatchedESDtime) ;
193 TH1F* hTOFmatchedESDrawTime = new TH1F("hTOFmatchedESDrawTime", "Matched ESDs tracks: TOF raw Time spectrum;t_{raw} [ns];Counts", 250, 0., 610.) ;
194 hTOFmatchedESDrawTime->Sumw2() ;
195 hTOFmatchedESDrawTime->SetLineWidth(2);
196 hTOFmatchedESDrawTime->SetLineColor(kAzure+2);
197 hTOFmatchedESDrawTime->SetFillColor(kAzure+2);
198 hTOFmatchedESDrawTime->SetDrawOption("BAR");
199 fHlist->AddLast(hTOFmatchedESDrawTime) ;
201 TH1F* hTOFmatchedESDToT = new TH1F("hTOFmatchedESDToT", "Matched ESDs tracks: TOF ToT spectrum; ToT [ns];Counts",100, 0., 48.8) ;
202 hTOFmatchedESDToT->Sumw2() ;
203 hTOFmatchedESDToT->SetLineColor(kOrange+1);
204 hTOFmatchedESDToT->SetMarkerColor(kOrange+1);
205 hTOFmatchedESDToT->SetFillColor(kOrange+1);
206 hTOFmatchedESDToT->SetDrawOption("BAR");
207 fHlist->AddLast(hTOFmatchedESDToT) ;
209 TH1F* hTOFmatchedESDtrkLength = new TH1F("hTOFmatchedESDtrkLength", "Matched ESDs tracks length; Track length [cm];Counts", 1200, -400., 800) ;
210 hTOFmatchedESDtrkLength->Sumw2();
211 hTOFmatchedESDtrkLength->SetLineColor(kViolet-3);
212 hTOFmatchedESDtrkLength->SetMarkerColor(kViolet-3);
213 hTOFmatchedESDtrkLength->SetFillColor(kViolet-3);
214 hTOFmatchedESDtrkLength->SetDrawOption("BAR");
215 fHlist->AddLast(hTOFmatchedESDtrkLength);
217 TH1F* hTOFmatchedESDP = new TH1F("hTOFmatchedESDP", "TPC-TOF matched tracks momentum distribution (GeV/c); p (GeV/c);tracks", 500,0.,5.) ;
218 hTOFmatchedESDP->Sumw2() ;
219 hTOFmatchedESDP->SetLineColor(kBlue);
220 hTOFmatchedESDP->SetMarkerStyle(20);
221 hTOFmatchedESDP->SetMarkerSize(0.7);
222 hTOFmatchedESDP->SetMarkerColor(kBlue);
223 fHlist->AddLast(hTOFmatchedESDP) ;
225 TH1F* hTOFmatchedESDPt = new TH1F("hTOFmatchedESDPt", "TPC-TOF matched tracks p_{T} distribution (GeV/c); p_{T}(GeV/c);tracks", 500,0.,5.) ;
226 hTOFmatchedESDPt->Sumw2() ;
227 hTOFmatchedESDPt->SetLineColor(kBlue);
228 hTOFmatchedESDPt->SetMarkerStyle(21);
229 hTOFmatchedESDPt->SetMarkerSize(0.7);
230 hTOFmatchedESDPt->SetMarkerColor(kBlue);
231 fHlist->AddLast(hTOFmatchedESDPt) ;
234 TH1F* hTOFmatchedESDeta = new TH1F("hTOFmatchedESDeta", "Matched ESDtracks #eta (p_{T} #geq 0.5 GeV/c); #eta;Counts", 200, -1., 1.) ;
235 hTOFmatchedESDeta->Sumw2();
236 hTOFmatchedESDeta->SetLineColor(kBlue);
237 fHlist->AddLast(hTOFmatchedESDeta) ;
239 TH1F* hTOFmatchedESDphi = new TH1F("hTOFmatchedESDphi", "Matched ESDtracks #phi; #phi (deg);Counts", 72, 0., 360.) ;
240 hTOFmatchedESDphi->Sumw2();
241 hTOFmatchedESDphi->SetLineColor(kBlue);
242 fHlist->AddLast(hTOFmatchedESDphi) ;
245 TH1F* hESDprimaryTrackP = new TH1F("hESDprimaryTrackP", "All ESDs tracks p_{T} distribution (GeV/c); p_{T}(GeV/c);tracks", 500, 0., 5.0) ;
246 hESDprimaryTrackP->Sumw2();
247 hESDprimaryTrackP->SetLineWidth(1);
248 hESDprimaryTrackP->SetMarkerStyle(24);
249 hESDprimaryTrackP->SetMarkerSize(0.7);
250 hESDprimaryTrackP->SetMarkerColor(kRed);
251 hESDprimaryTrackP->SetLineColor(kRed);
252 fHlist->AddLast(hESDprimaryTrackP);
254 TH1F* hESDprimaryTrackPt = new TH1F("hESDprimaryTrackPt", "ESDs primary tracks p_{T} distribution (GeV/c); p_{T}(GeV/c);tracks", 500, 0.0, 5.0) ;
255 hESDprimaryTrackPt->Sumw2();
256 hESDprimaryTrackPt->SetLineWidth(1);
257 hESDprimaryTrackPt->SetMarkerStyle(25);
258 hESDprimaryTrackPt->SetMarkerSize(0.7);
259 hESDprimaryTrackPt->SetLineColor(kRed);
260 hESDprimaryTrackPt->SetMarkerColor(kRed);
261 fHlist->AddLast(hESDprimaryTrackPt);
263 TH1F* hTOFprimaryESDeta = new TH1F("hTOFprimaryESDeta", "Primary ESDtracks #eta (p_{T} #geq 0.5 GeV/c); #eta;Counts",200, -1., 1.) ;
264 hTOFprimaryESDeta->Sumw2();
265 hTOFprimaryESDeta->SetLineColor(kRed);
266 fHlist->AddLast(hTOFprimaryESDeta) ;
268 TH1F* hTOFprimaryESDphi = new TH1F("hTOFprimaryESDphi", "Primary ESDtracks #phi;#phi (deg);Counts", 72, 0., 360.) ;
269 hTOFprimaryESDphi->Sumw2();
270 hTOFprimaryESDphi->SetLineColor(kRed);
271 fHlist->AddLast(hTOFprimaryESDphi) ;
273 TH2F* hTOFmatchedDxVsPtPos = new TH2F("hTOFmatchedDxVsPtPos", "Dx vs p_{T} for positive tracks;p_{T} (GeV/c); Dx [cm]; hits", 500,0.,5.,200, -10., 10.) ;
274 hTOFmatchedDxVsPtPos->Sumw2();
275 fHlist->AddLast(hTOFmatchedDxVsPtPos) ;
277 TH2F* hTOFmatchedDxVsPtNeg = new TH2F("hTOFmatchedDxVsPtNeg", "Dx vs p_{T} for negative tracks;p_{T} (GeV/c); Dx [cm]; hits", 500,0.,5.,200, -10., 10.) ;
278 hTOFmatchedDxVsPtNeg->Sumw2();
279 fHlist->AddLast(hTOFmatchedDxVsPtNeg) ;
282 TH2F* hTOFmatchedDzVsStrip = new TH2F("hTOFmatchedDzVsStrip", "Dz vs strip; strip (#eta); Dz [cm]; hits", 92,0.,92.,200, -10., 10.) ;
283 hTOFmatchedDzVsStrip->Sumw2();
284 fHlist->AddLast(hTOFmatchedDzVsStrip) ;
286 //----------------------------------------------timeZero QA plots
288 TH1D* hEventT0DetAND = new TH1D("hEventT0DetAND", "Event timeZero from T0AC detector ; t0 [ps]; events", 1000, -25000., 25000. ) ;
289 hEventT0DetAND->Sumw2() ;
290 hEventT0DetAND->SetLineWidth(2);
291 hEventT0DetAND->SetLineColor(kRed);
292 hEventT0DetAND->SetFillColor(kRed);
293 fHlistTimeZero->AddLast(hEventT0DetAND) ;
296 TH1D* hEventT0DetA = new TH1D("hEventT0DetA", "Event timeZero from T0A detector; t0 [ps]; events", 1000, -25000., 25000. ) ;
297 hEventT0DetA->Sumw2() ;
298 hEventT0DetA->SetLineWidth(2);
299 hEventT0DetA->SetLineColor(kBlue);
300 hEventT0DetA->SetFillColor(kBlue);
301 fHlistTimeZero->AddLast(hEventT0DetA) ;
304 TH1D* hEventT0DetC = new TH1D("hEventT0DetC", "Event timeZero from T0C detector; t0 [ps]; events", 1000, -25000., 25000.) ;
305 hEventT0DetC->Sumw2() ;
306 hEventT0DetC->SetLineWidth(2);
307 hEventT0DetC->SetLineColor(kGreen);
308 hEventT0DetC->SetFillColor(kGreen);
309 fHlistTimeZero->AddLast(hEventT0DetC);
312 TH1F* hT0DetRes = new TH1F("hT0DetRes", "T0 detector (T0A-T0C)/2; (T0A-T0C)/2 [ps]; events", 200, -500.,500. ) ;
314 hT0DetRes->SetMarkerStyle(24);
315 hT0DetRes->SetMarkerSize(0.7);
316 hT0DetRes->SetMarkerColor(kMagenta+2);
317 hT0DetRes->SetLineColor(kMagenta+2);
318 hT0DetRes->SetFillColor(kMagenta+2);
319 fHlistTimeZero->AddLast(hT0DetRes) ;
322 TH1F* hT0fill = new TH1F("hT0fill", "Event timeZero of fill; t0 [ps]; events", 1000, -25000., 25000. ) ;
324 hT0fill->SetMarkerStyle(20);
325 hT0fill->SetMarkerColor(kBlack);
326 hT0fill->SetLineColor(kBlack);
327 fHlistTimeZero->AddLast(hT0fill) ;
330 TH1F* hT0TOF = new TH1F("hT0TOF", "Event timeZero estimated by TOF; t0 [ps]; events", 1000, -25000., 25000. ) ;
332 hT0TOF->SetMarkerStyle(20);
333 hT0TOF->SetMarkerColor(kBlue);
334 hT0TOF->SetLineColor(kBlue);
335 hT0TOF->SetFillColor(kBlue);
336 fHlistTimeZero->AddLast(hT0TOF) ;
340 TH1F* hT0T0 = new TH1F("hT0T0", "Event timeZero measured by T0 detector (best between AC, A, C); t0 [ps]; events", 1000, -25000.,25000. ) ;
342 hT0T0->SetMarkerStyle(20);
343 hT0T0->SetMarkerColor(kGreen+1);
344 hT0T0->SetLineColor(kGreen+1);
345 hT0T0->SetFillColor(kGreen+1);
346 fHlistTimeZero->AddLast(hT0T0) ;
349 TH1F* hT0best = new TH1F("hT0best", "Event timeZero estimated as T0best; t0 [ps]; events", 1000, -25000.,25000. ) ;
351 hT0best->SetMarkerStyle(20);
352 hT0best->SetMarkerColor(kRed);
353 hT0best->SetLineColor(kRed);
354 hT0best->SetFillColor(kRed);
355 fHlistTimeZero->AddLast(hT0best) ;
358 TH1F* hT0fillRes = new TH1F("hT0fillRes", "Resolution of fillT0; #sigma_{bestT0} [ps];events", 250, 0.,250. ) ;
359 hT0fillRes->Sumw2() ;
360 hT0fillRes->SetMarkerStyle(21);
361 hT0fillRes->SetMarkerColor(kBlack);
362 hT0fillRes->SetLineColor(kBlack);
363 hT0fillRes->SetFillColor(kBlack);
364 fHlistTimeZero->AddLast(hT0fillRes) ;
367 TH1F* hT0TOFRes = new TH1F("hT0TOFRes", "Resolution of timeZero from TOF; #sigma_{TOFT0} [ps];events", 250, 0.,250. ) ;
369 hT0TOFRes->SetLineWidth(1);
370 hT0TOFRes->SetMarkerStyle(21);
371 hT0TOFRes->SetMarkerColor(kBlue);
372 hT0TOFRes->SetLineColor(kBlue);
373 hT0TOFRes->SetFillColor(kBlue);
374 fHlistTimeZero->AddLast(hT0TOFRes) ;
377 TH1F* hT0T0res = new TH1F("hT0T0res", "Resolution of timeZero from T0;#sigma_{T0T0} [ps];events", 250, -0., 250. ) ;
379 hT0T0res->SetMarkerStyle(21);
380 hT0T0res->SetMarkerColor(kGreen+1);
381 hT0T0res->SetLineColor(kGreen+1);
382 hT0T0res->SetFillColor(kGreen+1);
383 fHlistTimeZero->AddLast(hT0T0res) ;
386 TH1F* hT0bestRes = new TH1F("hT0bestRes", "Resolution of bestT0; #sigma_{bestT0} [ps];events", 250, 0.,250. ) ;
387 hT0bestRes->Sumw2() ;
388 hT0fillRes->SetMarkerStyle(21);
389 hT0fillRes->SetMarkerColor(kRed);
390 hT0fillRes->SetLineColor(kRed);
391 hT0fillRes->SetFillColor(kRed);
392 fHlistTimeZero->AddLast(hT0bestRes) ;
395 TH2F* hT0TOFvsNtrk = new TH2F("hT0TOFvsNtrk", "Event timeZero estimated by TOF vs. number of tracks in event;TOF-matching tracks; t0 [ps]", 100, 0., 100.,1000,-25000.,25000. ) ;
396 hT0TOFvsNtrk->Sumw2() ;
397 fHlistTimeZero->AddLast(hT0TOFvsNtrk) ;
399 //--------------------------------------------- TOF PID QA plots
401 TH2F* hTOFmatchedESDpVsBeta = new TH2F("hTOFmatchedESDpVsBeta", "Matched ESDs tracks beta vs. p; p(GeV/c); beta", 500, 0.0, 5.0, 150,0., 1.5) ;
402 fHlistPID->AddLast(hTOFmatchedESDpVsBeta);
405 TH1F* hTOFmatchedMass= new TH1F("hTOFmatchedMass","Matched ESD tracks mass distribution - (L>0); M (GeV/c^{2}); entries", 500,0., 5. );
406 hTOFmatchedMass->Sumw2();
407 hTOFmatchedMass->SetLineWidth(2);
408 hTOFmatchedMass->SetLineColor(kBlue);
409 hTOFmatchedMass->SetLineColor(kBlue);
410 fHlistPID->AddLast(hTOFmatchedMass);
413 TH2F* hTOFmatchedExpTimePiVsEta = new TH2F("hTOFmatchedExpTimePiVsEta", "ESDs t_{TOF}-t_{#pi,exp} (from tracking); strip (#eta); t_{TOF}-t_{#pi,exp} [ps]",92,0,92,2000, -5000., 5000. ) ;
414 hTOFmatchedExpTimePiVsEta->Sumw2() ;
415 fHlistPID->AddLast(hTOFmatchedExpTimePiVsEta) ;
418 TH1F* hTOFmatchedExpTimePi = new TH1F("hTOFmatchedExpTimePi", "ESDs t_{TOF}-t_{#pi,exp} (from tracking); t_{TOF}-t_{#pi,exp} [ps];Counts",5000, -25000., 25000. ) ;
419 hTOFmatchedExpTimePi->Sumw2() ;
420 hTOFmatchedExpTimePi->SetLineWidth(1);
421 hTOFmatchedExpTimePi->SetLineColor(kRed);
422 hTOFmatchedExpTimePi->SetMarkerStyle(20);
423 hTOFmatchedExpTimePi->SetMarkerSize(0.8);
424 hTOFmatchedExpTimePi->SetMarkerColor(kRed);
425 fHlistPID->AddLast(hTOFmatchedExpTimePi) ;
428 TH2F* hTOFmatchedExpTimePiVsP = new TH2F("hTOFmatchedExpTimePiVsP", "ESDs t_{TOF}-t_{#pi,exp} (from tracking) Vs P ; p (GeV/c);t_{TOF}-t_{#pi,exp} [ps];Counts",500, 0.,5.,1000, -25000., 25000. ) ;
429 hTOFmatchedExpTimePiVsP->Sumw2() ;
430 fHlistPID->AddLast(hTOFmatchedExpTimePiVsP) ;
433 TH1F* hTOFtheoreticalExpTimePi = new TH1F("hTOFtheoreticalExpTimePi", "ESDs t_{TOF}-t_{#pi,exp} (theoretical); t_{TOF}-t_{#pi,exp} [ps];Counts", 5000, -25000., 25000. ) ;
434 hTOFtheoreticalExpTimePi->Sumw2() ;
435 hTOFtheoreticalExpTimePi->SetLineWidth(1);
436 hTOFtheoreticalExpTimePi->SetLineColor(kRed);
437 hTOFtheoreticalExpTimePi->SetMarkerStyle(24);
438 hTOFtheoreticalExpTimePi->SetMarkerSize(0.8);
439 hTOFtheoreticalExpTimePi->SetMarkerColor(kRed);
440 fHlistPID->AddLast(hTOFtheoreticalExpTimePi) ;
443 TH2F* hTOFtheoreticalExpTimePiVsP = new TH2F("hTOFtheoreticalExpTimePiVsP", "ESDs t_{TOF}-t_{#pi,exp} (theoretical) Vs P ; p (GeV/c);t_{TOF}-t_{#pi,exp} [ps];Counts",500, 0.,5.,1000, -25000., 25000. ) ;
444 hTOFtheoreticalExpTimePiVsP->Sumw2() ;
445 fHlistPID->AddLast(hTOFtheoreticalExpTimePiVsP) ;
448 TH2F* hTOFExpSigmaPi = new TH2F("hTOFExpSigmaPi", "ESDs TOF n#sigma_{PID,#pi} vs p_{T}; p_{T} (GeV/c); n#sigma_{PID,#pi};Tracks", 500,0.,5.,200, -10., 10. ) ;
449 hTOFExpSigmaPi->Sumw2() ;
450 fHlistPID->AddLast(hTOFExpSigmaPi) ;
453 TH1F* hTOFmatchedExpTimeKa = new TH1F("hTOFmatchedExpTimeKa", "ESDs t_{TOF}-t_{K,exp} (from tracking); t_{TOF}-t_{K,exp} [ps];Counts", 500, -5000., 5000. ) ;
454 hTOFmatchedExpTimeKa->Sumw2() ;
455 hTOFmatchedExpTimeKa->SetLineWidth(1);
456 hTOFmatchedExpTimeKa->SetLineColor(kBlue);
457 hTOFmatchedExpTimeKa->SetMarkerStyle(21);
458 hTOFmatchedExpTimeKa->SetMarkerSize(0.8);
459 hTOFmatchedExpTimeKa->SetMarkerColor(kBlue);
460 fHlistPID->AddLast(hTOFmatchedExpTimeKa);
463 TH2F* hTOFmatchedExpTimeKaVsP = new TH2F("hTOFmatchedExpTimeKaVsP", "ESDs t_{TOF}-t_{K,exp} (from tracking) Vs P ; p (GeV/c);t_{TOF}-t_{K,exp} [ps];Counts",500, 0.,5.,1000, -25000., 25000. ) ;
464 hTOFmatchedExpTimeKaVsP->Sumw2() ;
465 fHlistPID->AddLast(hTOFmatchedExpTimeKaVsP) ;
468 TH1F* hTOFtheoreticalExpTimeKa = new TH1F("hTOFtheoreticalExpTimeKa", "ESDs t_{TOF}-t_{K,exp} (theoretical); t_{TOF}-t_{K,exp} [ps];Counts", 5000, -25000., 25000. ) ;
469 hTOFtheoreticalExpTimeKa->Sumw2() ;
470 hTOFtheoreticalExpTimeKa->SetLineWidth(1);
471 hTOFtheoreticalExpTimeKa->SetLineColor(kBlue);
472 hTOFtheoreticalExpTimeKa->SetMarkerStyle(24);
473 hTOFtheoreticalExpTimeKa->SetMarkerSize(0.8);
474 hTOFtheoreticalExpTimeKa->SetMarkerColor(kBlue);
475 fHlistPID->AddLast(hTOFtheoreticalExpTimeKa) ;
478 TH2F* hTOFtheoreticalExpTimeKaVsP = new TH2F("hTOFtheoreticalExpTimeKaVsP", "ESDs t_{TOF}-t_{K,exp} (theoretical) Vs P ; p (GeV/c);t_{TOF}-t_{K,exp} [ps];Counts",500, 0.,5.,1000, -25000., 25000. ) ;
479 hTOFtheoreticalExpTimeKaVsP->Sumw2() ;
480 fHlistPID->AddLast(hTOFtheoreticalExpTimeKaVsP) ;
483 TH2F* hTOFExpSigmaKa = new TH2F("hTOFExpSigmaKa", "ESDs TOF n#sigma_{PID,K} vs p_{T}; p_{T} (GeV/c);n#sigma_{PID,K};Tracks", 500, 0.,5.,200, -10., 10. ) ;
484 hTOFExpSigmaKa->Sumw2() ;
485 fHlistPID->AddLast(hTOFExpSigmaKa) ;
488 TH1F* hTOFmatchedExpTimePro = new TH1F("hTOFmatchedExpTimePro", "ESDs t_{TOF}-t_{p,exp} (from tracking); t_{TOF}-t_{p,exp} [ps];Counts", 500, -5000., 5000. ) ;
489 hTOFmatchedExpTimePro->Sumw2() ;
490 hTOFmatchedExpTimePro->SetLineWidth(1);
491 hTOFmatchedExpTimePro->SetLineColor(kGreen+1);
492 hTOFmatchedExpTimePro->SetMarkerStyle(22);
493 hTOFmatchedExpTimePro->SetMarkerSize(0.8);
494 hTOFmatchedExpTimePro->SetMarkerColor(kGreen+1);
495 fHlistPID->AddLast(hTOFmatchedExpTimePro) ;
498 TH2F* hTOFmatchedExpTimeProVsP = new TH2F("hTOFmatchedExpTimeProVsP", "ESDs t_{TOF}-t_{p,exp} (from tracking) Vs P ; p (GeV/c);t_{TOF}-t_{p,exp} [ps];Counts",500, 0.,5.,1000, -25000., 25000. ) ;
499 hTOFmatchedExpTimeProVsP->Sumw2() ;
500 fHlistPID->AddLast(hTOFmatchedExpTimeProVsP) ;
503 TH1F* hTOFtheoreticalExpTimePro = new TH1F("hTOFtheoreticalExpTimePro", "ESDs t_{TOF}-t_{p,exp} (theoretical); t_{TOF}-t_{p,exp} [ps];Counts", 500, -5000., 5000. ) ;
504 hTOFtheoreticalExpTimePro->Sumw2() ;
505 hTOFtheoreticalExpTimePro->SetLineWidth(1);
506 hTOFtheoreticalExpTimePro->SetLineColor(kGreen+1);
507 hTOFtheoreticalExpTimePro->SetMarkerStyle(26);
508 hTOFtheoreticalExpTimePro->SetMarkerSize(0.8);
509 hTOFtheoreticalExpTimePro->SetMarkerColor(kGreen+1);
510 fHlistPID->AddLast(hTOFtheoreticalExpTimePro) ;
513 TH2F* hTOFtheoreticalExpTimeProVsP = new TH2F("hTOFtheoreticalExpTimeProVsP", "ESDs t_{TOF}-t_{p,exp} (theoretical) Vs P ; p (GeV/c);t_{TOF}-t_{p,exp} [ps];Counts",500, 0.,5.,1000, -25000., 25000. ) ;
514 hTOFtheoreticalExpTimeProVsP->Sumw2() ;
515 fHlistPID->AddLast(hTOFtheoreticalExpTimeProVsP) ;
518 TH2F* hTOFExpSigmaPro = new TH2F("hTOFExpSigmaPro", "ESDs TOF n#sigma_{PID,p} vs. p_{T}; p_{T} (GeV/c); n#sigma_{PID,p};Tracks", 500, 0.,5.,200, -10., 10. ) ;
519 hTOFExpSigmaPro->Sumw2() ;
520 fHlistPID->AddLast(hTOFExpSigmaPro) ;
523 PostData(2, fHlistTimeZero);
524 PostData(3, fHlistPID);
527 //________________________________________________________________________
528 void AliAnalysisTaskTOFqa::UserExec(Option_t *)
530 /* Main - executed for each event.
531 It extracts event information and track information after selecting
532 primary tracks via standard cuts. */
534 AliESDInputHandler *esdH = dynamic_cast<AliESDInputHandler*> (AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());
536 Printf("ERROR: Could not get ESDInputHandler");
539 fESD = (AliESDEvent*) esdH->GetEvent();
543 Printf("ERROR: fESD not available");
547 /* info from T0 detector QA */
548 for (Int_t j=0;j<3;j++){
549 fT0[j]= (Float_t) fESD->GetT0TOF(j);//ps
550 if (fT0[j]>90000.) fT0[j]=99999.;//fix old default values to the new one
552 Float_t t0cut = 90000.;
553 //Float_t t0cut =3 * t0spread; //use this cut to check t0 used in tof response
554 // if(t0cut < 500) t0cut = 500;
556 if(TMath::Abs(fT0[1]) < t0cut && TMath::Abs(fT0[2]) < t0cut ) {
557 //&& TMath::Abs(fT0[2]-fT0[1]) < 500) //add this condition to check t0 used in tof response
558 ((TH1F*)fHlistTimeZero->At(3))->Fill((fT0[2]-fT0[1])*0.5);
559 ((TH1F*)fHlistTimeZero->At(0))->Fill(fT0[0]);
561 if(TMath::Abs(fT0[1]) < t0cut){
562 ((TH1F*)fHlistTimeZero->At(1))->Fill(fT0[1]);
564 if(TMath::Abs(fT0[2]) < t0cut){
565 ((TH1F*)fHlistTimeZero->At(2))->Fill(fT0[2]);
568 /* event timeZero QA via AliESDpid::SetTOFResponse() */
569 Double_t timeZero[4]={99999.,99999.,99999.,99999.};
570 Double_t timeZeroRes[4]={99999.,99999.,99999.,99999.};
572 for (Int_t j=0;j<4;j++){
573 fESDpid->SetTOFResponse(fESD, (AliESDpid::EStartTimeType_t) j);//(fill_t0, tof_t0, t0_t0, best_t0)
574 timeZero[j]=fESDpid->GetTOFResponse().GetStartTime(10.); //timeZero for bin pT>10GeV/c
575 timeZeroRes[j]=fESDpid->GetTOFResponse().GetStartTimeRes(10.); //timeZero for bin pT>10GeV/c
576 ((TH1D*)fHlistTimeZero->At(4+j))->Fill(timeZero[j]);
577 ((TH1D*)fHlistTimeZero->At(8+j))->Fill(timeZeroRes[j]);
581 /* loop over ESD tracks */
583 // fNPrimaryTracks=0;
585 for (Int_t iTracks = 0; iTracks < fESD->GetNumberOfTracks(); iTracks++) {
586 AliESDtrack* track = fESD->GetTrack(iTracks);
588 Printf("ERROR: Could not receive track %d", iTracks);
592 //primary tracks selection: kTPCrefit and std cuts
593 if(!fTrackFilter->IsSelected(track)) continue;
594 Double_t eta=track->Eta();
595 if (TMath::Abs(eta)>0.9) continue; //cut for acceptance
597 Double_t mom=track->P();
598 Double_t mom2 = mom*mom;
599 Double_t length=track->GetIntegratedLength();
600 Double_t pT = track->Pt();
601 Double_t phi=track->Phi()*TMath::RadToDeg();
602 track->GetIntegratedTimes(fTrkExpTimes);
604 ((TH1F*)fHlist->At(9))->Fill(mom);
605 ((TH1F*)fHlist->At(10))->Fill(pT);
607 ((TH1F*)fHlist->At(11))->Fill(eta);
608 ((TH1F*)fHlist->At(12))->Fill(phi);
610 //matched tracks selection: kTOFout and kTIME
611 if ((track->GetStatus() & AliESDtrack::kTOFout) &&
612 (track->GetStatus() & AliESDtrack::kTIME)) {
614 Double_t tofTime=track->GetTOFsignal();//in ps
615 Double_t tofTimeRaw=track->GetTOFsignalRaw();//in ps
616 Double_t tofToT=track->GetTOFsignalToT(); //in ps
617 Int_t channel=track->GetTOFCalChannel();
618 Int_t volId[5]; //(sector, plate,strip,padZ,padX)
619 AliTOFGeometry::GetVolumeIndices(channel,volId);
621 if (pT>=0.3) fNTOFtracks++; //matched counter
622 Double_t tof= tofTime*1E-3; // ns, average T0 fill subtracted, no info from T0detector
623 ((TH1F*)fHlist->At(1))->Fill(tof); //ns
624 ((TH1F*)fHlist->At(2))->Fill(tofTimeRaw*1E-3); //ns
625 ((TH1F*)fHlist->At(3))->Fill(tofToT);
626 ((TH1F*)fHlist->At(4))->Fill(length);
627 ((TH1F*)fHlist->At(5))->Fill(mom);
628 ((TH1F*)fHlist->At(6))->Fill(pT);
630 ((TH1F*)fHlist->At(7))->Fill(eta);
631 ((TH1F*)fHlist->At(8))->Fill(phi);
632 if (track->GetSign()>0)
633 ((TH2F*)fHlist->At(13))->Fill(pT,track->GetTOFsignalDx());
634 else ((TH2F*)fHlist->At(14))->Fill(pT,track->GetTOFsignalDx());
635 ((TH2F*)fHlist->At(15))->Fill((Int_t)GetStripIndex(volId),track->GetTOFsignalDz());
637 //basic PID performance check
639 printf("WARNING: track with negative TOF time found! Skipping this track for PID checks\n");
643 printf("WARNING: track with negative square momentum found! Skipping this track for PID checks\n");
647 printf("WARNING: track with negative length found!Skipping this track for PID checks\n");
650 Double_t c=TMath::C()*1.E-9;// m/ns
651 Double_t mass=0.; //GeV
652 length =length*0.01; // in meters
654 Double_t beta=length/tof;
655 Double_t fact= (tof/length)*(tof/length) -1.;
657 mass = -mom*TMath::Sqrt(-fact);
659 mass = mom*TMath::Sqrt(fact);
661 ((TH2F*)fHlistPID->At(0))->Fill(mom,beta);
662 ((TH1F*) fHlistPID->At(1))->Fill(mass);
665 Bool_t isValidBeta[AliPID::kSPECIES]={0,0,0,0,0};
666 for (Int_t specie = 0; specie < AliPID::kSPECIES; specie++){
667 fSigmaSpecie[specie] = fESDpid->GetTOFResponse().GetExpectedSigma(mom, fTrkExpTimes[specie], AliPID::ParticleMass(specie));
668 beta=1/TMath::Sqrt(1+AliPID::ParticleMass(specie)*AliPID::ParticleMass(specie)/(mom2));
670 fThExpTimes[specie]=length*1.E3/(beta*c);//ps
671 isValidBeta[specie]=kTRUE;
673 fThExpTimes[specie]=1E-10;
674 isValidBeta[specie]=kFALSE;
678 if (isValidBeta[AliPID::kPion]){
679 ((TH2F*)fHlistPID->At(2))->Fill((Int_t)GetStripIndex(volId),tofTime-fTrkExpTimes[AliPID::kPion]);//ps
680 ((TH1F*)fHlistPID->At(3))->Fill(tofTime-fTrkExpTimes[AliPID::kPion]);//ps
681 ((TH2F*)fHlistPID->At(4))->Fill(mom,(tofTime-fTrkExpTimes[AliPID::kPion]));
682 ((TH1F*)fHlistPID->At(5))->Fill(tofTime-fThExpTimes[AliPID::kPion]);//ps
683 ((TH2F*)fHlistPID->At(6))->Fill(mom,(tofTime-fThExpTimes[AliPID::kPion]));
684 ((TH2F*)fHlistPID->At(7))->Fill(pT,(tofTime-fTrkExpTimes[AliPID::kPion])/fSigmaSpecie[AliPID::kPion]);
687 if (isValidBeta[AliPID::kKaon]){
688 ((TH1F*)fHlistPID->At(8))->Fill(tofTime-fTrkExpTimes[AliPID::kKaon]);//ps
689 ((TH2F*)fHlistPID->At(9))->Fill(mom,(tofTime-fTrkExpTimes[AliPID::kKaon]));
690 ((TH1F*)fHlistPID->At(10))->Fill(tofTime-fThExpTimes[AliPID::kKaon]);//ps
691 ((TH2F*)fHlistPID->At(11))->Fill(mom,(tofTime-fThExpTimes[AliPID::kKaon]));
692 ((TH2F*)fHlistPID->At(12))->Fill(pT,(tofTime-fTrkExpTimes[AliPID::kKaon])/fSigmaSpecie[AliPID::kKaon]);
694 if (isValidBeta[AliPID::kProton]){
695 ((TH1F*)fHlistPID->At(13))->Fill(tofTime-fTrkExpTimes[AliPID::kProton]);//ps
696 ((TH2F*)fHlistPID->At(14))->Fill(mom,(tofTime-fTrkExpTimes[AliPID::kProton]));
697 ((TH1F*)fHlistPID->At(15))->Fill(tofTime-fThExpTimes[AliPID::kProton]);//ps
698 ((TH2F*)fHlistPID->At(16))->Fill(mom,(tofTime-fThExpTimes[AliPID::kProton]));
699 ((TH2F*)fHlistPID->At(17))->Fill(pT,(tofTime-fTrkExpTimes[AliPID::kProton])/fSigmaSpecie[AliPID::kProton]);
702 }//end loop on tracks
704 ((TH1F*)fHlist->At(0))->Fill(fNTOFtracks) ;
705 ((TH2F*)fHlistTimeZero->At(12))->Fill(fNTOFtracks,timeZero[AliESDpid::kTOF_T0]);
708 PostData(2, fHlistTimeZero);
709 PostData(3, fHlistPID);
714 //________________________________________________________________________
715 void AliAnalysisTaskTOFqa::Terminate(Option_t *)
717 //check on output validity
718 fHlist = dynamic_cast<TList*> (GetOutputData(1));
719 if (!fHlist || !fHlistTimeZero) {
720 Printf("ERROR: lists not available");
726 //---------------------------------------------------------------
727 Int_t AliAnalysisTaskTOFqa::GetStripIndex(const Int_t * const in)
729 /* return tof strip index between 0 and 91 */
731 Int_t nStripA = AliTOFGeometry::NStripA();
732 Int_t nStripB = AliTOFGeometry::NStripB();
733 Int_t nStripC = AliTOFGeometry::NStripC();
735 Int_t iplate = in[1];
736 Int_t istrip = in[2];
738 Int_t stripOffset = 0;
744 stripOffset = nStripC;
747 stripOffset = nStripC+nStripB;
750 stripOffset = nStripC+nStripB+nStripA;
753 stripOffset = nStripC+nStripB+nStripA+nStripB;
760 if (stripOffset<0 || stripOffset>92) return -1;
762 return (stripOffset+istrip);