Updates
[u/mrichter/AliRoot.git] / ANALYSIS / AliAnalysisTaskPIDqa.cxx
CommitLineData
f25dc3ef 1/**************************************************************************\r
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *\r
3 * *\r
4 * Author: The ALICE Off-line Project. *\r
5 * Contributors are mentioned in the code where appropriate. *\r
6 * *\r
7 * Permission to use, copy, modify and distribute this software and its *\r
8 * documentation strictly for non-commercial purposes is hereby granted *\r
9 * without fee, provided that the above copyright notice appears in all *\r
10 * copies and that both the copyright notice and this permission notice *\r
11 * appear in the supporting documentation. The authors make no claims *\r
12 * about the suitability of this software for any purpose. It is *\r
13 * provided "as is" without express or implied warranty. *\r
14 **************************************************************************/\r
15\r
16/* $Id: AliAnalysisTaskPIDqa.cxx 43811 2010-09-23 14:13:31Z wiechula $ */\r
17#include <TList.h>\r
18#include <TVectorD.h>\r
19#include <TObjArray.h>\r
20#include <TH2.h>\r
21#include <TFile.h>\r
22#include <TPRegexp.h>\r
23#include <TChain.h>\r
24#include <TF1.h>\r
25#include <TSpline.h>\r
26\r
27#include <AliAnalysisManager.h>\r
28#include <AliInputEventHandler.h>\r
29#include <AliVEventHandler.h>\r
30#include <AliVEvent.h>\r
31#include <AliVParticle.h>\r
32#include <AliVTrack.h>\r
33#include <AliLog.h>\r
34#include <AliPID.h>\r
35#include <AliPIDResponse.h>\r
36#include <AliITSPIDResponse.h>\r
37#include <AliTPCPIDResponse.h>\r
38#include <AliTRDPIDResponse.h>\r
39#include <AliTOFPIDResponse.h>\r
40\r
41#include <AliESDEvent.h>\r
11fd38f5 42#include <AliAODEvent.h>\r
43#include <AliESDv0.h>\r
44#include <AliAODv0.h>\r
45#include <AliESDv0KineCuts.h>\r
f25dc3ef 46\r
47#include "AliAnalysisTaskPIDqa.h"\r
48\r
49\r
50ClassImp(AliAnalysisTaskPIDqa)\r
51\r
52//______________________________________________________________________________\r
53AliAnalysisTaskPIDqa::AliAnalysisTaskPIDqa():\r
54AliAnalysisTaskSE(),\r
55fPIDResponse(0x0),\r
11fd38f5 56fV0cuts(0x0),\r
57fV0electrons(0x0),\r
58fV0pions(0x0),\r
59fV0kaons(0x0),\r
60fV0protons(0x0),\r
f25dc3ef 61fListQA(0x0),\r
62fListQAits(0x0),\r
63fListQAitsSA(0x0),\r
64fListQAitsPureSA(0x0),\r
65fListQAtpc(0x0),\r
66fListQAtrd(0x0),\r
67fListQAtof(0x0),\r
68fListQAemcal(0x0),\r
69fListQAhmpid(0x0),\r
70fListQAtofhmpid(0x0),\r
11fd38f5 71fListQAtpctof(0x0),\r
324348e5 72fListQAV0(0x0),\r
73fListQAinfo(0x0)\r
f25dc3ef 74{\r
75 //\r
76 // Dummy constructor\r
77 //\r
78}\r
79\r
80//______________________________________________________________________________\r
81AliAnalysisTaskPIDqa::AliAnalysisTaskPIDqa(const char* name):\r
82AliAnalysisTaskSE(name),\r
83fPIDResponse(0x0),\r
11fd38f5 84fV0cuts(0x0),\r
85fV0electrons(0x0),\r
86fV0pions(0x0),\r
87fV0kaons(0x0),\r
88fV0protons(0x0),\r
f25dc3ef 89fListQA(0x0),\r
90fListQAits(0x0),\r
91fListQAitsSA(0x0),\r
92fListQAitsPureSA(0x0),\r
93fListQAtpc(0x0),\r
94fListQAtrd(0x0),\r
95fListQAtof(0x0),\r
96fListQAemcal(0x0),\r
97fListQAhmpid(0x0),\r
98fListQAtofhmpid(0x0),\r
11fd38f5 99fListQAtpctof(0x0),\r
324348e5 100fListQAV0(0x0),\r
101fListQAinfo(0x0)\r
f25dc3ef 102{\r
103 //\r
104 // Default constructor\r
105 //\r
106 DefineInput(0,TChain::Class());\r
107 DefineOutput(1,TList::Class());\r
108}\r
109\r
110//______________________________________________________________________________\r
111AliAnalysisTaskPIDqa::~AliAnalysisTaskPIDqa()\r
112{\r
113 //\r
114 // Destructor\r
115 //\r
11fd38f5 116\r
117 delete fV0cuts;\r
118 delete fV0electrons;\r
119 delete fV0pions;\r
120 delete fV0kaons;\r
121 delete fV0protons;\r
122\r
f25dc3ef 123 if (!AliAnalysisManager::GetAnalysisManager()->IsProofMode()) delete fListQA;\r
124}\r
125\r
126//______________________________________________________________________________\r
127void AliAnalysisTaskPIDqa::UserCreateOutputObjects()\r
128{\r
129 //\r
130 // Create the output QA objects\r
131 //\r
132\r
133 AliLog::SetClassDebugLevel("AliAnalysisTaskPIDqa",10);\r
134\r
135 //input hander\r
136 AliAnalysisManager *man=AliAnalysisManager::GetAnalysisManager();\r
137 AliInputEventHandler *inputHandler=dynamic_cast<AliInputEventHandler*>(man->GetInputEventHandler());\r
138 if (!inputHandler) AliFatal("Input handler needed");\r
139\r
140 //pid response object\r
141 fPIDResponse=inputHandler->GetPIDResponse();\r
142 if (!fPIDResponse) AliError("PIDResponse object was not created");\r
143 \r
11fd38f5 144 // V0 Kine cuts \r
145 fV0cuts = new AliESDv0KineCuts;\r
146 \r
147 // V0 PID Obj arrays\r
148 fV0electrons = new TObjArray;\r
149 fV0pions = new TObjArray;\r
150 fV0kaons = new TObjArray;\r
151 fV0protons = new TObjArray;\r
152\r
f25dc3ef 153 //\r
154 fListQA=new TList;\r
155 fListQA->SetOwner();\r
156 \r
157 fListQAits=new TList;\r
158 fListQAits->SetOwner();\r
159 fListQAits->SetName("ITS");\r
160\r
161 fListQAitsSA=new TList;\r
162 fListQAitsSA->SetOwner();\r
163 fListQAitsSA->SetName("ITS_SA");\r
164\r
165 fListQAitsPureSA=new TList;\r
166 fListQAitsPureSA->SetOwner();\r
167 fListQAitsPureSA->SetName("ITS_PureSA");\r
168\r
169 fListQAtpc=new TList;\r
170 fListQAtpc->SetOwner();\r
171 fListQAtpc->SetName("TPC");\r
172 \r
173 fListQAtrd=new TList;\r
174 fListQAtrd->SetOwner();\r
175 fListQAtrd->SetName("TRD");\r
176 \r
177 fListQAtof=new TList;\r
178 fListQAtof->SetOwner();\r
179 fListQAtof->SetName("TOF");\r
180 \r
181 fListQAemcal=new TList;\r
182 fListQAemcal->SetOwner();\r
183 fListQAemcal->SetName("EMCAL");\r
184 \r
185 fListQAhmpid=new TList;\r
186 fListQAhmpid->SetOwner();\r
187 fListQAhmpid->SetName("HMPID");\r
188 \r
189 fListQAtpctof=new TList;\r
190 fListQAtpctof->SetOwner();\r
191 fListQAtpctof->SetName("TPC_TOF");\r
192\r
193 fListQAtofhmpid=new TList;\r
194 fListQAtofhmpid->SetOwner();\r
195 fListQAtofhmpid->SetName("TOF_HMPID");\r
196 \r
11fd38f5 197 fListQAV0=new TList;\r
198 fListQAV0->SetOwner();\r
199 fListQAV0->SetName("V0decay");\r
324348e5 200\r
201 fListQAinfo=new TList;\r
202 fListQAinfo->SetOwner();\r
203 fListQAinfo->SetName("QAinfo");\r
11fd38f5 204 \r
f25dc3ef 205 fListQA->Add(fListQAits);\r
206 fListQA->Add(fListQAitsSA);\r
207 fListQA->Add(fListQAitsPureSA);\r
208 fListQA->Add(fListQAtpc);\r
209 fListQA->Add(fListQAtrd);\r
210 fListQA->Add(fListQAtof);\r
211 fListQA->Add(fListQAemcal);\r
212 fListQA->Add(fListQAhmpid);\r
213 fListQA->Add(fListQAtpctof);\r
214 fListQA->Add(fListQAtofhmpid);\r
11fd38f5 215 fListQA->Add(fListQAV0);\r
324348e5 216 fListQA->Add(fListQAinfo);\r
f25dc3ef 217\r
218 SetupITSqa();\r
219 SetupTPCqa();\r
220 SetupTRDqa();\r
221 SetupTOFqa();\r
222 SetupEMCALqa();\r
223 SetupHMPIDqa();\r
224 SetupTPCTOFqa();\r
225 SetupTOFHMPIDqa();\r
11fd38f5 226 SetupV0qa();\r
324348e5 227 SetupQAinfo();\r
f25dc3ef 228 \r
229 PostData(1,fListQA);\r
230}\r
231\r
232\r
233//______________________________________________________________________________\r
234void AliAnalysisTaskPIDqa::UserExec(Option_t */*option*/)\r
235{\r
236 //\r
237 // Setup the PID response functions and fill the QA histograms\r
238 //\r
239\r
240 AliVEvent *event=InputEvent();\r
241 if (!event||!fPIDResponse) return;\r
242\r
11fd38f5 243 // Start with the V0 task (only possible for ESDs?)\r
244 FillV0PIDlist();\r
f25dc3ef 245 \r
246 FillITSqa();\r
247 FillTPCqa();\r
248 FillTRDqa();\r
249 FillTOFqa();\r
250 FillEMCALqa();\r
251 FillHMPIDqa();\r
252 \r
253 //combined detector QA\r
254 FillTPCTOFqa();\r
255 FillTOFHMPIDqa();\r
256 \r
11fd38f5 257 // Clear the V0 PID arrays\r
258 ClearV0PIDlist();\r
259\r
324348e5 260 //QA info\r
261 FillQAinfo();\r
11fd38f5 262 \r
f25dc3ef 263 PostData(1,fListQA);\r
264}\r
265\r
266//______________________________________________________________________________\r
11fd38f5 267void AliAnalysisTaskPIDqa::FillV0PIDlist(){\r
268\r
269 //\r
270 // Fill the PID object arrays holding the pointers to identified particle tracks\r
271 //\r
272\r
273 // Dynamic cast to ESD events (DO NOTHING for AOD events)\r
274 AliESDEvent *event = dynamic_cast<AliESDEvent *>(InputEvent());\r
275 if ( !event ) return;\r
276 \r
277 if(TString(event->GetBeamType())=="Pb-Pb" || TString(event->GetBeamType())=="A-A"){\r
278 fV0cuts->SetMode(AliESDv0KineCuts::kPurity,AliESDv0KineCuts::kPbPb); \r
279 }\r
280 else{\r
281 fV0cuts->SetMode(AliESDv0KineCuts::kPurity,AliESDv0KineCuts::kPP); \r
282 }\r
283\r
284 // V0 selection\r
285 // set event\r
286 fV0cuts->SetEvent(event);\r
287\r
288 // loop over V0 particles\r
289 for(Int_t iv0=0; iv0<event->GetNumberOfV0s();iv0++){\r
290\r
291 AliESDv0 *v0 = (AliESDv0 *) event->GetV0(iv0);\r
292 \r
293 if(!v0) continue;\r
294 if(v0->GetOnFlyStatus()) continue; \r
295 \r
296 // Get the particle selection \r
297 Bool_t foundV0 = kFALSE;\r
298 Int_t pdgV0, pdgP, pdgN;\r
299\r
300 foundV0 = fV0cuts->ProcessV0(v0, pdgV0, pdgP, pdgN);\r
301 if(!foundV0) continue;\r
302 \r
303 Int_t iTrackP = v0->GetPindex(); // positive track\r
304 Int_t iTrackN = v0->GetNindex(); // negative track\r
305\r
306 // v0 Armenteros plot (QA)\r
307 Float_t armVar[2] = {0.0,0.0};\r
308 fV0cuts->Armenteros(v0, armVar);\r
309\r
310 TH2 *h=(TH2*)fListQAV0->At(0);\r
311 if (!h) continue;\r
312 h->Fill(armVar[0],armVar[1]);\r
313\r
314 // fill the Object arrays\r
315 // positive particles\r
316 if( pdgP == -11){\r
317 fV0electrons->Add((AliVTrack*)event->GetTrack(iTrackP));\r
318 }\r
319 else if( pdgP == 211){\r
320 fV0pions->Add((AliVTrack*)event->GetTrack(iTrackP));\r
321 }\r
322 else if( pdgP == 321){\r
323 fV0kaons->Add((AliVTrack*)event->GetTrack(iTrackP));\r
324 }\r
325 else if( pdgP == 2212){\r
326 fV0protons->Add((AliVTrack*)event->GetTrack(iTrackP));\r
327 }\r
328\r
329 // negative particles\r
330 if( pdgN == 11){\r
331 fV0electrons->Add((AliVTrack*)event->GetTrack(iTrackN));\r
332 }\r
333 else if( pdgN == -211){\r
334 fV0pions->Add((AliVTrack*)event->GetTrack(iTrackN));\r
335 }\r
336 else if( pdgN == -321){\r
337 fV0kaons->Add((AliVTrack*)event->GetTrack(iTrackN));\r
338 }\r
339 else if( pdgN == -2212){\r
340 fV0protons->Add((AliVTrack*)event->GetTrack(iTrackN));\r
341 }\r
342 \r
343\r
344 }\r
345}\r
346//______________________________________________________________________________\r
347void AliAnalysisTaskPIDqa::ClearV0PIDlist(){\r
348\r
349 //\r
350 // Clear the PID object arrays\r
351 //\r
352\r
353 fV0electrons->Clear();\r
354 fV0pions->Clear();\r
355 fV0kaons->Clear();\r
356 fV0protons->Clear();\r
357\r
358}\r
359//______________________________________________________________________________\r
f25dc3ef 360void AliAnalysisTaskPIDqa::FillITSqa()\r
361{\r
362 //\r
363 // Fill PID qa histograms for the ITS\r
364 //\r
365\r
366 AliVEvent *event=InputEvent();\r
367 \r
368 Int_t ntracks=event->GetNumberOfTracks();\r
369 for(Int_t itrack = 0; itrack < ntracks; itrack++){\r
370 AliVTrack *track=(AliVTrack*)event->GetTrack(itrack);\r
371 ULong_t status=track->GetStatus();\r
372 // not that nice. status bits not in virtual interface\r
373 // ITS refit + ITS pid selection\r
374 if (!( ( (status & AliVTrack::kITSrefit)==AliVTrack::kITSrefit ) ||\r
375 ! ( (status & AliVTrack::kITSpid )==AliVTrack::kITSpid ) )) continue;\r
376 Double_t mom=track->P();\r
377 \r
378 TList *theList = 0x0;\r
379 if(( (status & AliVTrack::kTPCin)==AliVTrack::kTPCin )){\r
380 //ITS+TPC tracks\r
381 theList=fListQAits;\r
382 }else{\r
383 if(!( (status & AliVTrack::kITSpureSA)==AliVTrack::kITSpureSA )){ \r
384 //ITS Standalone tracks\r
385 theList=fListQAitsSA;\r
386 }else{\r
387 //ITS Pure Standalone tracks\r
388 theList=fListQAitsPureSA;\r
389 }\r
390 }\r
391 \r
392 \r
00a38d07 393 for (Int_t ispecie=0; ispecie<AliPID::kSPECIESC; ++ispecie){\r
f25dc3ef 394 TH2 *h=(TH2*)theList->At(ispecie);\r
395 if (!h) continue;\r
396 Double_t nSigma=fPIDResponse->NumberOfSigmasITS(track, (AliPID::EParticleType)ispecie);\r
397 h->Fill(mom,nSigma);\r
398 }\r
00a38d07 399 TH2 *h=(TH2*)theList->At(AliPID::kSPECIESC);\r
f25dc3ef 400 if (h) {\r
401 Double_t sig=track->GetITSsignal();\r
402 h->Fill(mom,sig);\r
403 }\r
404 }\r
405}\r
406\r
407//______________________________________________________________________________\r
408void AliAnalysisTaskPIDqa::FillTPCqa()\r
409{\r
410 //\r
411 // Fill PID qa histograms for the TPC\r
412 //\r
413 \r
414 AliVEvent *event=InputEvent();\r
415 \r
416 Int_t ntracks=event->GetNumberOfTracks();\r
417 for(Int_t itrack = 0; itrack < ntracks; itrack++){\r
418 AliVTrack *track=(AliVTrack*)event->GetTrack(itrack);\r
419 \r
420 //\r
421 //basic track cuts\r
422 //\r
423 ULong_t status=track->GetStatus();\r
424 // not that nice. status bits not in virtual interface\r
425 // TPC refit + ITS refit + TPC pid\r
426 if (!( (status & AliVTrack::kTPCrefit) == AliVTrack::kTPCrefit) ||\r
427 !( (status & AliVTrack::kITSrefit) == AliVTrack::kITSrefit) ) continue;\r
428\r
429 // The TPC pid cut removes the light nuclei (>5 sigma from proton line)\r
430 //|| !( (status & AliVTrack::kTPCpid ) == AliVTrack::kTPCpid )\r
431 Float_t nCrossedRowsTPC = track->GetTPCClusterInfo(2,1);\r
432 Float_t ratioCrossedRowsOverFindableClustersTPC = 1.0;\r
433 if (track->GetTPCNclsF()>0) {\r
434 ratioCrossedRowsOverFindableClustersTPC = nCrossedRowsTPC/track->GetTPCNclsF();\r
435 }\r
436 \r
437 if ( nCrossedRowsTPC<70 || ratioCrossedRowsOverFindableClustersTPC<.8 ) continue;\r
438 \r
439 Double_t mom=track->GetTPCmomentum();\r
644666df 440 // the default scenario\r
00a38d07 441 for (Int_t ispecie=0; ispecie<AliPID::kSPECIESC; ++ispecie){\r
f25dc3ef 442 TH2 *h=(TH2*)fListQAtpc->At(ispecie);\r
443 if (!h) continue;\r
444 Double_t nSigma=fPIDResponse->NumberOfSigmasTPC(track, (AliPID::EParticleType)ispecie);\r
445 h->Fill(mom,nSigma);\r
446 }\r
644666df 447 // the "hybrid" scenario\r
448 for (Int_t ispecie=0; ispecie<AliPID::kSPECIESC; ++ispecie){\r
449 TH2 *h=(TH2*)fListQAtpc->At(ispecie+AliPID::kSPECIESC);\r
450 if (!h) continue;\r
451 Double_t nSigma=fPIDResponse->NumberOfSigmasTPC(track, (AliPID::EParticleType)ispecie, AliTPCPIDResponse::kdEdxHybrid);\r
452 h->Fill(mom,nSigma);\r
453 }\r
454 \r
455 // the "OROC" scenario\r
456 for (Int_t ispecie=0; ispecie<AliPID::kSPECIESC; ++ispecie){\r
457 TH2 *h=(TH2*)fListQAtpc->At(ispecie+2*AliPID::kSPECIESC);\r
458 if (!h) continue;\r
459 Double_t nSigma=fPIDResponse->NumberOfSigmasTPC(track, (AliPID::EParticleType)ispecie, AliTPCPIDResponse::kdEdxOROC);\r
460 //TSpline3* spline = fPIDResponse->GetTPCResponse().GetCurrentResponseFunction();\r
461 //std::cout<<ispecie<<" "<<nSigma<<" phi:"<<track->Phi()<<". "<<std::endl;\r
462 //if (spline) {cout<<spline->GetName()<<endl;}\r
463 //else {cout<<"NULL spline"<<endl;}\r
464 h->Fill(mom,nSigma);\r
465 }\r
f25dc3ef 466 \r
644666df 467 TH2 *h=(TH2*)fListQAtpc->At(3*AliPID::kSPECIESC);\r
468\r
f25dc3ef 469 if (h) {\r
470 Double_t sig=track->GetTPCsignal();\r
471 h->Fill(mom,sig);\r
472 }\r
473 }\r
474}\r
475\r
476//______________________________________________________________________________\r
477void AliAnalysisTaskPIDqa::FillTRDqa()\r
478{\r
479 //\r
480 // Fill PID qa histograms for the TRD\r
481 //\r
482 AliVEvent *event=InputEvent();\r
483 Int_t ntracks = event->GetNumberOfTracks();\r
484 for(Int_t itrack = 0; itrack < ntracks; itrack++){\r
485 AliVTrack *track = (AliVTrack *)event->GetTrack(itrack);\r
486\r
487 //\r
488 //basic track cuts\r
489 //\r
490 ULong_t status=track->GetStatus();\r
491 // not that nice. status bits not in virtual interface\r
492 // TPC refit + ITS refit + TPC pid + TRD out\r
493 if (!( (status & AliVTrack::kTPCrefit) == AliVTrack::kTPCrefit) ||\r
494 !( (status & AliVTrack::kITSrefit) == AliVTrack::kITSrefit) ||\r
495// !( (status & AliVTrack::kTPCpid ) == AliVTrack::kTPCpid ) || //removes light nuclei. So it is out for the moment\r
496 !( (status & AliVTrack::kTRDout ) == AliVTrack::kTRDout )) continue;\r
497 \r
498 Float_t nCrossedRowsTPC = track->GetTPCClusterInfo(2,1);\r
499 Float_t ratioCrossedRowsOverFindableClustersTPC = 1.0;\r
500 if (track->GetTPCNclsF()>0) {\r
501 ratioCrossedRowsOverFindableClustersTPC = nCrossedRowsTPC/track->GetTPCNclsF();\r
502 }\r
503 \r
504 if ( nCrossedRowsTPC<70 || ratioCrossedRowsOverFindableClustersTPC<.8 ) continue;\r
505\r
506 Double_t likelihoods[AliPID::kSPECIES];\r
507 if(fPIDResponse->ComputeTRDProbability(track, AliPID::kSPECIES, likelihoods) != AliPIDResponse::kDetPidOk) continue;\r
508 Int_t ntracklets = 0;\r
509 Double_t momentum = -1.;\r
510 for(Int_t itl = 0; itl < 6; itl++)\r
511 if(track->GetTRDmomentum(itl) > 0.){\r
512 ntracklets++;\r
513 if(momentum < 0) momentum = track->GetTRDmomentum(itl);\r
514 } \r
515 for(Int_t ispecie = 0; ispecie < AliPID::kSPECIES; ispecie++){\r
516 TH2F *hLike = (TH2F *)fListQAtrd->At(ntracklets*AliPID::kSPECIES+ispecie);\r
517 if (hLike) hLike->Fill(momentum,likelihoods[ispecie]);\r
518 }\r
519 }\r
520}\r
521\r
522//______________________________________________________________________________\r
523void AliAnalysisTaskPIDqa::FillTOFqa()\r
524{\r
525 //\r
526 // Fill TOF information\r
527 //\r
528 AliVEvent *event=InputEvent();\r
529\r
530 Int_t ntracks=event->GetNumberOfTracks();\r
531 Int_t tracksAtTof = 0;\r
532 for(Int_t itrack = 0; itrack < ntracks; itrack++){\r
533 AliVTrack *track=(AliVTrack*)event->GetTrack(itrack);\r
534\r
535 //\r
536 //basic track cuts\r
537 //\r
538 ULong_t status=track->GetStatus();\r
539 // TPC refit + ITS refit +\r
540 // TOF out + TOFpid +\r
541 // kTIME\r
542 // (we don't use kTOFmismatch because it depends on TPC....)\r
543 if (!((status & AliVTrack::kTPCrefit) == AliVTrack::kTPCrefit) ||\r
544 !((status & AliVTrack::kITSrefit) == AliVTrack::kITSrefit) ||\r
545 !((status & AliVTrack::kTOFout ) == AliVTrack::kTOFout ) ||\r
546 !((status & AliVTrack::kTOFpid ) == AliVTrack::kTOFpid ) ||\r
547 !((status & AliVTrack::kTIME ) == AliVTrack::kTIME ) ) continue;\r
548\r
549 Float_t nCrossedRowsTPC = track->GetTPCClusterInfo(2,1);\r
550 Float_t ratioCrossedRowsOverFindableClustersTPC = 1.0;\r
551 if (track->GetTPCNclsF()>0) {\r
552 ratioCrossedRowsOverFindableClustersTPC = nCrossedRowsTPC/track->GetTPCNclsF();\r
553 }\r
554\r
555 if ( nCrossedRowsTPC<70 || ratioCrossedRowsOverFindableClustersTPC<.8 ) continue;\r
556\r
557 tracksAtTof++;\r
558\r
559 Double_t mom=track->P();\r
560\r
00a38d07 561 for (Int_t ispecie=0; ispecie<AliPID::kSPECIESC; ++ispecie){\r
f25dc3ef 562 TH2 *h=(TH2*)fListQAtof->At(ispecie);\r
563 if (!h) continue;\r
564 Double_t nSigma=fPIDResponse->NumberOfSigmasTOF(track, (AliPID::EParticleType)ispecie);\r
565 h->Fill(mom,nSigma);\r
566 }\r
567\r
568 TH2 *h=(TH2*)fListQAtof->FindObject("hSigP_TOF");\r
569 if (h) {\r
570 Double_t sig=track->GetTOFsignal()/1000.;\r
571 h->Fill(mom,sig);\r
572 }\r
573\r
574 Int_t mask = fPIDResponse->GetTOFResponse().GetStartTimeMask(mom);\r
575 ((TH1F*)fListQAtof->FindObject("hStartTimeMask_TOF"))->Fill((Double_t)(mask+0.5));\r
576\r
577 if (mom >= 0.75 && mom <= 1.25 ) {\r
578 Double_t nsigma= fPIDResponse->NumberOfSigmasTOF(track, (AliPID::EParticleType)AliPID::kPion);\r
579 if (mask == 0) {\r
580 ((TH1F*)fListQAtof->FindObject("hNsigma_TOF_Pion_T0-Fill"))->Fill(nsigma);\r
581 } else if (mask == 1) {\r
582 ((TH1F*)fListQAtof->FindObject("hNsigma_TOF_Pion_T0-TOF"))->Fill(nsigma);\r
583 } else if ( (mask == 2) || (mask == 4) || (mask == 6) ) {\r
584 ((TH1F*)fListQAtof->FindObject("hNsigma_TOF_Pion_T0-T0"))->Fill(nsigma);\r
585 } else {\r
586 ((TH1F*)fListQAtof->FindObject("hNsigma_TOF_Pion_T0-Best"))->Fill(nsigma);\r
587 }\r
588 }\r
589\r
590 Double_t res = (Double_t)fPIDResponse->GetTOFResponse().GetStartTimeRes(mom);\r
591 ((TH1F*)fListQAtof->FindObject("hStartTimeRes_TOF"))->Fill(res);\r
592\r
593 AliESDEvent *esd = dynamic_cast<AliESDEvent *>(event);\r
594 if (esd) {\r
595 Double_t startTime = esd->GetT0TOF(0);\r
596 if (startTime < 90000) ((TH1F*)fListQAtof->FindObject("hStartTimeAC_T0"))->Fill(startTime);\r
597 else {\r
598 startTime = esd->GetT0TOF(1);\r
599 if (startTime < 90000) ((TH1F*)fListQAtof->FindObject("hStartTimeA_T0"))->Fill(startTime);\r
600 startTime = esd->GetT0TOF(2);\r
601 if (startTime < 90000) ((TH1F*)fListQAtof->FindObject("hStartTimeC_T0"))->Fill(startTime);\r
602 }\r
603 }\r
604 }\r
605 if (tracksAtTof > 0) {\r
606 ((TH1F* )fListQAtof->FindObject("hnTracksAt_TOF"))->Fill(tracksAtTof);\r
607 Int_t mask = fPIDResponse->GetTOFResponse().GetStartTimeMask(5.);\r
608 if (mask & 0x1) ((TH1F*)fListQAtof->FindObject("hT0MakerEff"))->Fill(tracksAtTof);\r
609 }\r
610}\r
611\r
612\r
613//______________________________________________________________________________\r
614void AliAnalysisTaskPIDqa::FillEMCALqa()\r
615{\r
616 //\r
617 // Fill PID qa histograms for the EMCAL\r
618 //\r
619\r
620 AliVEvent *event=InputEvent();\r
621 \r
622 Int_t ntracks=event->GetNumberOfTracks();\r
623 for(Int_t itrack = 0; itrack < ntracks; itrack++){\r
624 AliVTrack *track=(AliVTrack*)event->GetTrack(itrack);\r
625 \r
626 //\r
627 //basic track cuts\r
628 //\r
629 ULong_t status=track->GetStatus();\r
630 // not that nice. status bits not in virtual interface\r
631 if (!( (status & AliVTrack::kEMCALmatch) == AliVTrack::kEMCALmatch) ) continue;\r
632\r
633 Double_t pt=track->Pt();\r
634 \r
635 //EMCAL nSigma (only for electrons at the moment)\r
636 TH2 *h=(TH2*)fListQAemcal->At(0);\r
637 if (!h) continue;\r
638 Double_t nSigma=fPIDResponse->NumberOfSigmasEMCAL(track, (AliPID::EParticleType)0);\r
639 h->Fill(pt,nSigma);\r
640 \r
11fd38f5 641 }\r
642\r
643 //EMCAL signal (E/p vs. pT) for electrons from V0\r
644 for(Int_t itrack = 0; itrack < fV0electrons->GetEntries(); itrack++){\r
645 AliVTrack *track=(AliVTrack*)fV0electrons->At(itrack);\r
646\r
647 //\r
648 //basic track cuts\r
649 //\r
650 ULong_t status=track->GetStatus();\r
651 // not that nice. status bits not in virtual interface\r
652 if (!( (status & AliVTrack::kEMCALmatch) == AliVTrack::kEMCALmatch) ) continue;\r
653\r
654 Double_t pt=track->Pt();\r
655\r
656 TH2 *h=(TH2*)fListQAemcal->At(1);\r
f25dc3ef 657 if (h) {\r
658\r
659 Int_t nMatchClus = track->GetEMCALcluster();\r
660 Double_t mom = track->P();\r
661 Double_t eop = -1.;\r
662\r
663 if(nMatchClus > -1){\r
664 \r
665 AliVCluster *matchedClus = (AliVCluster*)event->GetCaloCluster(nMatchClus);\r
666\r
667 if(matchedClus){\r
668\r
669 // matched cluster is EMCAL\r
670 if(matchedClus->IsEMCAL()){\r
671\r
672 Double_t fClsE = matchedClus->E();\r
673 eop = fClsE/mom;\r
674\r
675 h->Fill(pt,eop);\r
676\r
677 }\r
678 }\r
679 }\r
680 }\r
681 }\r
11fd38f5 682\r
683 //EMCAL signal (E/p vs. pT) for pions from V0\r
684 for(Int_t itrack = 0; itrack < fV0pions->GetEntries(); itrack++){\r
685 AliVTrack *track=(AliVTrack*)fV0pions->At(itrack);\r
686\r
687 //\r
688 //basic track cuts\r
689 //\r
690 ULong_t status=track->GetStatus();\r
691 // not that nice. status bits not in virtual interface\r
692 if (!( (status & AliVTrack::kEMCALmatch) == AliVTrack::kEMCALmatch) ) continue;\r
693\r
694 Double_t pt=track->Pt();\r
695\r
696 TH2 *h=(TH2*)fListQAemcal->At(2);\r
697 if (h) {\r
698\r
699 Int_t nMatchClus = track->GetEMCALcluster();\r
700 Double_t mom = track->P();\r
701 Double_t eop = -1.;\r
702\r
703 if(nMatchClus > -1){\r
704 \r
705 AliVCluster *matchedClus = (AliVCluster*)event->GetCaloCluster(nMatchClus);\r
706\r
707 if(matchedClus){\r
708\r
709 // matched cluster is EMCAL\r
710 if(matchedClus->IsEMCAL()){\r
711\r
712 Double_t fClsE = matchedClus->E();\r
713 eop = fClsE/mom;\r
714\r
715 h->Fill(pt,eop);\r
716\r
717 }\r
718 }\r
719 }\r
720 }\r
721 }\r
722\r
723 //EMCAL signal (E/p vs. pT) for protons from V0\r
724 for(Int_t itrack = 0; itrack < fV0protons->GetEntries(); itrack++){\r
725 AliVTrack *track=(AliVTrack*)fV0protons->At(itrack);\r
726\r
727 //\r
728 //basic track cuts\r
729 //\r
730 ULong_t status=track->GetStatus();\r
731 // not that nice. status bits not in virtual interface\r
732 if (!( (status & AliVTrack::kEMCALmatch) == AliVTrack::kEMCALmatch) ) continue;\r
733\r
734 Double_t pt=track->Pt();\r
735\r
736 TH2 *hP=(TH2*)fListQAemcal->At(3);\r
737 TH2 *hAP=(TH2*)fListQAemcal->At(4);\r
738 if (hP && hAP) {\r
739\r
740 Int_t nMatchClus = track->GetEMCALcluster();\r
741 Double_t mom = track->P();\r
742 Int_t charge = track->Charge(); \r
743 Double_t eop = -1.;\r
744\r
745 if(nMatchClus > -1){\r
746 \r
747 AliVCluster *matchedClus = (AliVCluster*)event->GetCaloCluster(nMatchClus);\r
748\r
749 if(matchedClus){\r
750\r
751 // matched cluster is EMCAL\r
752 if(matchedClus->IsEMCAL()){\r
753\r
754 Double_t fClsE = matchedClus->E();\r
755 eop = fClsE/mom;\r
756\r
757 if(charge > 0) hP->Fill(pt,eop);\r
758 else if(charge < 0) hAP->Fill(pt,eop);\r
759\r
760 }\r
761 }\r
762 }\r
763 }\r
764 }\r
765\r
f25dc3ef 766}\r
767\r
768\r
769//______________________________________________________________________________\r
770void AliAnalysisTaskPIDqa::FillHMPIDqa()\r
771{\r
772 //\r
773 // Fill PID qa histograms for the HMPID\r
774 //\r
775 \r
776 AliVEvent *event=InputEvent();\r
777 \r
778 Int_t ntracks=event->GetNumberOfTracks();\r
779 for(Int_t itrack = 0; itrack < ntracks; itrack++){\r
780 AliVTrack *track=(AliVTrack*)event->GetTrack(itrack);\r
781 \r
782 //\r
783 //basic track cuts\r
784 //\r
785 ULong_t status=track->GetStatus();\r
786 // not that nice. status bits not in virtual interface\r
787 // TPC refit + ITS refit +\r
788 // TOF out + TOFpid +\r
789 // kTIME\r
790 if (!((status & AliVTrack::kTPCrefit) == AliVTrack::kTPCrefit) ||\r
791 !((status & AliVTrack::kITSrefit) == AliVTrack::kITSrefit) ) continue;\r
792\r
793 Float_t nCrossedRowsTPC = track->GetTPCClusterInfo(2,1);\r
794 Float_t ratioCrossedRowsOverFindableClustersTPC = 1.0;\r
795 if (track->GetTPCNclsF()>0) {\r
796 ratioCrossedRowsOverFindableClustersTPC = nCrossedRowsTPC/track->GetTPCNclsF();\r
797 }\r
798\r
799 if ( nCrossedRowsTPC<70 || ratioCrossedRowsOverFindableClustersTPC<.8 ) continue;\r
800 \r
801 Double_t mom = track->P();\r
802 Double_t ckovAngle = track->GetHMPIDsignal();\r
803 \r
804 TH1F *hThetavsMom = (TH1F*)fListQAhmpid->At(0);;\r
805 \r
806 hThetavsMom->Fill(mom,ckovAngle); \r
807 \r
808 }\r
809}\r
810//______________________________________________________________________________\r
811void AliAnalysisTaskPIDqa::FillTOFHMPIDqa()\r
812{\r
813 //\r
814 // Fill PID qa histograms for the HMPID\r
815 //\r
816 \r
817 AliVEvent *event=InputEvent();\r
818 \r
819 Int_t ntracks=event->GetNumberOfTracks();\r
820 for(Int_t itrack = 0; itrack < ntracks; itrack++){\r
821 AliVTrack *track=(AliVTrack*)event->GetTrack(itrack);\r
822 \r
823 //\r
824 //basic track cuts\r
825 //\r
826 ULong_t status=track->GetStatus();\r
827 // not that nice. status bits not in virtual interface\r
828 // TPC refit + ITS refit +\r
829 // TOF out + TOFpid +\r
830 // kTIME\r
831 if (!((status & AliVTrack::kTPCrefit) == AliVTrack::kTPCrefit) ||\r
832 !((status & AliVTrack::kITSrefit) == AliVTrack::kITSrefit) ||\r
833 !((status & AliVTrack::kTOFout ) == AliVTrack::kTOFout ) ||\r
834 !((status & AliVTrack::kTOFpid ) == AliVTrack::kTOFpid ) ||\r
835 !((status & AliVTrack::kTIME ) == AliVTrack::kTIME ) ) continue;\r
836\r
837 Float_t nCrossedRowsTPC = track->GetTPCClusterInfo(2,1);\r
838 Float_t ratioCrossedRowsOverFindableClustersTPC = 1.0;\r
839 if (track->GetTPCNclsF()>0) {\r
840 ratioCrossedRowsOverFindableClustersTPC = nCrossedRowsTPC/track->GetTPCNclsF();\r
841 }\r
842\r
843 if ( nCrossedRowsTPC<70 || ratioCrossedRowsOverFindableClustersTPC<.8 ) continue;\r
844 \r
845 Double_t mom = track->P();\r
846 Double_t ckovAngle = track->GetHMPIDsignal();\r
847 \r
848 Double_t nSigmaTOF[3]; \r
849 TH1F *h[3];\r
850 \r
851 for (Int_t ispecie=2; ispecie<5; ++ispecie){\r
852 //TOF nSigma\r
853 nSigmaTOF[ispecie-2]=fPIDResponse->NumberOfSigmasTOF(track, (AliPID::EParticleType)ispecie);\r
854 h[ispecie-2] = (TH1F*)fListQAtofhmpid->At(ispecie-2);}\r
855 \r
856 if(TMath::Abs(nSigmaTOF[0])<2) h[0]->Fill(mom,ckovAngle);\r
857 \r
858 if(TMath::Abs(nSigmaTOF[1])<2 && TMath::Abs(nSigmaTOF[0])>3) h[1]->Fill(mom,ckovAngle);\r
859\r
860 if(TMath::Abs(nSigmaTOF[2])<2 && TMath::Abs(nSigmaTOF[1])>3 && TMath::Abs(nSigmaTOF[0])>3) h[2]->Fill(mom,ckovAngle);\r
861 \r
862 }\r
863 \r
864}\r
865\r
866//______________________________________________________________________________\r
867void AliAnalysisTaskPIDqa::FillTPCTOFqa()\r
868{\r
869 //\r
870 // Fill PID qa histograms for the TOF\r
871 // Here also the TPC histograms after TOF selection are filled\r
872 //\r
873\r
874 AliVEvent *event=InputEvent();\r
875\r
876 Int_t ntracks=event->GetNumberOfTracks();\r
877 for(Int_t itrack = 0; itrack < ntracks; itrack++){\r
878 AliVTrack *track=(AliVTrack*)event->GetTrack(itrack);\r
879\r
880 //\r
881 //basic track cuts\r
882 //\r
883 ULong_t status=track->GetStatus();\r
884 // not that nice. status bits not in virtual interface\r
885 // TPC refit + ITS refit +\r
886 // TOF out + TOFpid +\r
887 // kTIME\r
888 if (!((status & AliVTrack::kTPCrefit) == AliVTrack::kTPCrefit) ||\r
889 !((status & AliVTrack::kITSrefit) == AliVTrack::kITSrefit) ||\r
890// !( (status & AliVTrack::kTPCpid ) == AliVTrack::kTPCpid ) || //removes light nuclei, so it is out for the moment\r
891 !((status & AliVTrack::kTOFout ) == AliVTrack::kTOFout ) ||\r
892 !((status & AliVTrack::kTOFpid ) == AliVTrack::kTOFpid ) ||\r
893 !((status & AliVTrack::kTIME ) == AliVTrack::kTIME ) ) continue;\r
894\r
895 Float_t nCrossedRowsTPC = track->GetTPCClusterInfo(2,1);\r
896 Float_t ratioCrossedRowsOverFindableClustersTPC = 1.0;\r
897 if (track->GetTPCNclsF()>0) {\r
898 ratioCrossedRowsOverFindableClustersTPC = nCrossedRowsTPC/track->GetTPCNclsF();\r
899 }\r
900\r
901 if ( nCrossedRowsTPC<70 || ratioCrossedRowsOverFindableClustersTPC<.8 ) continue;\r
902\r
903\r
904 Double_t mom=track->P();\r
905 Double_t momTPC=track->GetTPCmomentum();\r
906\r
00a38d07 907 for (Int_t ispecie=0; ispecie<AliPID::kSPECIESC; ++ispecie){\r
f25dc3ef 908 //TOF nSigma\r
909 Double_t nSigmaTOF=fPIDResponse->NumberOfSigmasTOF(track, (AliPID::EParticleType)ispecie);\r
910 Double_t nSigmaTPC=fPIDResponse->NumberOfSigmasTPC(track, (AliPID::EParticleType)ispecie);\r
911\r
912 //TPC after TOF cut\r
913 TH2 *h=(TH2*)fListQAtpctof->At(ispecie);\r
914 if (h && TMath::Abs(nSigmaTOF)<3.) h->Fill(momTPC,nSigmaTPC);\r
915\r
916 //TOF after TPC cut\r
00a38d07 917 h=(TH2*)fListQAtpctof->At(ispecie+AliPID::kSPECIESC);\r
f25dc3ef 918 if (h && TMath::Abs(nSigmaTPC)<3.) h->Fill(mom,nSigmaTOF);\r
919\r
920 //EMCAL after TOF and TPC cut\r
00a38d07 921 h=(TH2*)fListQAtpctof->At(ispecie+2*AliPID::kSPECIESC);\r
f25dc3ef 922 if (h && TMath::Abs(nSigmaTOF)<3. && TMath::Abs(nSigmaTPC)<3. ){\r
923\r
924 Int_t nMatchClus = track->GetEMCALcluster();\r
925 Double_t pt = track->Pt();\r
926 Double_t eop = -1.;\r
927 \r
928 if(nMatchClus > -1){\r
929 \r
930 AliVCluster *matchedClus = (AliVCluster*)event->GetCaloCluster(nMatchClus);\r
931 \r
932 if(matchedClus){\r
933 \r
934 // matched cluster is EMCAL\r
935 if(matchedClus->IsEMCAL()){\r
936 \r
937 Double_t fClsE = matchedClus->E();\r
938 eop = fClsE/mom;\r
939\r
940 h->Fill(pt,eop);\r
941 \r
942 \r
943 }\r
944 }\r
945 }\r
946 }\r
947 }\r
948 }\r
949}\r
950\r
324348e5 951//_____________________________________________________________________________\r
952void AliAnalysisTaskPIDqa::FillQAinfo()\r
953{\r
954 //\r
955 // Fill the QA information\r
956 //\r
957\r
958\r
959 //TPC QA info\r
960 TObjArray *arrTPC=static_cast<TObjArray*>(fListQAinfo->At(0));\r
961 if (fPIDResponse && arrTPC){\r
962 AliTPCPIDResponse &tpcResp=fPIDResponse->GetTPCResponse();\r
963 // fill spline names\r
964 if (!arrTPC->UncheckedAt(0)){\r
965 \r
966 TObjArray *arrTPCsplineNames=new TObjArray(AliPID::kSPECIESC);\r
967 arrTPCsplineNames->SetOwner();\r
968 arrTPCsplineNames->SetName("TPC_spline_names");\r
969 arrTPC->AddAt(arrTPCsplineNames,0);\r
970 \r
971 for (Int_t iresp=0; iresp<AliPID::kSPECIESC; ++iresp){\r
972 const TObject *o=tpcResp.GetResponseFunction((AliPID::EParticleType)iresp);\r
973 if (!o) continue;\r
974 arrTPCsplineNames->Add(new TObjString(Form("%02d: %s",iresp, o->GetName())));\r
975 }\r
976 }\r
977\r
978 // tpc response config\r
979 if (!arrTPC->UncheckedAt(1)){\r
980 \r
981 TObjArray *arrTPCconfigInfo=new TObjArray;\r
982 arrTPCconfigInfo->SetOwner();\r
983 arrTPCconfigInfo->SetName("TPC_config_info");\r
984 arrTPC->AddAt(arrTPCconfigInfo,1);\r
985\r
986 TObjString *ostr=0x0;\r
987 ostr=new TObjString;\r
988 ostr->String().Form("Eta Corr map: %s", tpcResp.GetEtaCorrMap()?tpcResp.GetEtaCorrMap()->GetName():"none");\r
989 arrTPCconfigInfo->Add(ostr);\r
990\r
991 ostr=new TObjString;\r
992 ostr->String().Form("Sigma Par map: %s", tpcResp.GetSigmaPar1Map()?tpcResp.GetSigmaPar1Map()->GetName():"none");\r
993 arrTPCconfigInfo->Add(ostr);\r
994\r
995 ostr=new TObjString;\r
996 ostr->String().Form("MIP: %.2f", tpcResp.GetMIP());\r
997 arrTPCconfigInfo->Add(ostr);\r
998 \r
999 ostr=new TObjString;\r
1000 ostr->String().Form("Res: Def %.3g (%.3g) : AllHigh %.3g (%.3g) : OROC high %.3g (%.3g)",\r
1001 tpcResp.GetRes0(AliTPCPIDResponse::kDefault), tpcResp.GetResN2(AliTPCPIDResponse::kDefault),\r
1002 tpcResp.GetRes0(AliTPCPIDResponse::kALLhigh), tpcResp.GetResN2(AliTPCPIDResponse::kALLhigh),\r
1003 tpcResp.GetRes0(AliTPCPIDResponse::kOROChigh), tpcResp.GetResN2(AliTPCPIDResponse::kOROChigh)\r
1004 );\r
1005 arrTPCconfigInfo->Add(ostr);\r
1006 }\r
1007 }\r
1008}\r
1009\r
f25dc3ef 1010//______________________________________________________________________________\r
1011void AliAnalysisTaskPIDqa::SetupITSqa()\r
1012{\r
1013 //\r
1014 // Create the ITS qa objects\r
1015 //\r
1016 \r
1017 TVectorD *vX=MakeLogBinning(200,.1,30);\r
1018 \r
1019 //ITS+TPC tracks\r
00a38d07 1020 for (Int_t ispecie=0; ispecie<AliPID::kSPECIESC; ++ispecie){\r
f25dc3ef 1021 TH2F *hNsigmaP = new TH2F(Form("hNsigmaP_ITS_%s",AliPID::ParticleName(ispecie)),\r
1022 Form("ITS n#sigma %s vs. p;p [GeV]; n#sigma",AliPID::ParticleName(ispecie)),\r
1023 vX->GetNrows()-1,vX->GetMatrixArray(),\r
1024 200,-10,10);\r
1025 fListQAits->Add(hNsigmaP);\r
1026 }\r
1027 TH2F *hSig = new TH2F("hSigP_ITS",\r
1028 "ITS signal vs. p;p [GeV]; ITS signal [arb. units]",\r
1029 vX->GetNrows()-1,vX->GetMatrixArray(),\r
1030 300,0,300);\r
1031 fListQAits->Add(hSig);\r
1032\r
1033 //ITS Standalone tracks\r
00a38d07 1034 for (Int_t ispecie=0; ispecie<AliPID::kSPECIESC; ++ispecie){\r
f25dc3ef 1035 TH2F *hNsigmaPSA = new TH2F(Form("hNsigmaP_ITSSA_%s",AliPID::ParticleName(ispecie)),\r
1036 Form("ITS n#sigma %s vs. p;p [GeV]; n#sigma",AliPID::ParticleName(ispecie)),\r
1037 vX->GetNrows()-1,vX->GetMatrixArray(),\r
1038 200,-10,10);\r
1039 fListQAitsSA->Add(hNsigmaPSA);\r
1040 }\r
1041 TH2F *hSigSA = new TH2F("hSigP_ITSSA",\r
1042 "ITS signal vs. p;p [GeV]; ITS signal [arb. units]",\r
1043 vX->GetNrows()-1,vX->GetMatrixArray(),\r
1044 300,0,300);\r
1045 fListQAitsSA->Add(hSigSA);\r
1046 \r
1047 //ITS Pure Standalone tracks\r
00a38d07 1048 for (Int_t ispecie=0; ispecie<AliPID::kSPECIESC; ++ispecie){\r
f25dc3ef 1049 TH2F *hNsigmaPPureSA = new TH2F(Form("hNsigmaP_ITSPureSA_%s",AliPID::ParticleName(ispecie)),\r
1050 Form("ITS n#sigma %s vs. p;p [GeV]; n#sigma",AliPID::ParticleName(ispecie)),\r
1051 vX->GetNrows()-1,vX->GetMatrixArray(),\r
1052 200,-10,10);\r
1053 fListQAitsPureSA->Add(hNsigmaPPureSA);\r
1054 }\r
1055 TH2F *hSigPureSA = new TH2F("hSigP_ITSPureSA",\r
1056 "ITS signal vs. p;p [GeV]; ITS signal [arb. units]",\r
1057 vX->GetNrows()-1,vX->GetMatrixArray(),\r
1058 300,0,300);\r
1059 fListQAitsPureSA->Add(hSigPureSA);\r
1060 \r
1061 delete vX; \r
1062}\r
1063\r
1064//______________________________________________________________________________\r
1065void AliAnalysisTaskPIDqa::SetupTPCqa()\r
1066{\r
1067 //\r
1068 // Create the TPC qa objects\r
1069 //\r
1070 \r
1071 TVectorD *vX=MakeLogBinning(200,.1,30);\r
1072 \r
00a38d07 1073 for (Int_t ispecie=0; ispecie<AliPID::kSPECIESC; ++ispecie){\r
f25dc3ef 1074 TH2F *hNsigmaP = new TH2F(Form("hNsigmaP_TPC_%s",AliPID::ParticleName(ispecie)),\r
1075 Form("TPC n#sigma %s vs. p;p [GeV]; n#sigma",AliPID::ParticleName(ispecie)),\r
1076 vX->GetNrows()-1,vX->GetMatrixArray(),\r
1077 200,-10,10);\r
1078 fListQAtpc->Add(hNsigmaP);\r
1079 }\r
644666df 1080\r
1081 // the "hybrid" scenario\r
1082 for (Int_t ispecie=0; ispecie<AliPID::kSPECIESC; ++ispecie){\r
1083 TH2F *hNsigmaP = new TH2F(Form("hNsigmaP_TPC_%s_Hybrid",AliPID::ParticleName(ispecie)),\r
1084 Form("TPC n#sigma %s vs. p (Hybrid gain scenario);p [GeV]; n#sigma",AliPID::ParticleName(ispecie)),\r
1085 vX->GetNrows()-1,vX->GetMatrixArray(),\r
1086 200,-10,10);\r
1087 fListQAtpc->Add(hNsigmaP);\r
1088 }\r
1089 \r
1090 // the "OROC high" scenario\r
1091 for (Int_t ispecie=0; ispecie<AliPID::kSPECIESC; ++ispecie){\r
1092 TH2F *hNsigmaP = new TH2F(Form("hNsigmaP_TPC_%s_OROChigh",AliPID::ParticleName(ispecie)),\r
1093 Form("TPC n#sigma %s vs. p (OROChigh gain scenario);p [GeV]; n#sigma",AliPID::ParticleName(ispecie)),\r
1094 vX->GetNrows()-1,vX->GetMatrixArray(),\r
1095 200,-10,10);\r
1096 fListQAtpc->Add(hNsigmaP);\r
1097 }\r
1098 \r
f25dc3ef 1099 \r
1100 \r
1101 TH2F *hSig = new TH2F("hSigP_TPC",\r
1102 "TPC signal vs. p;p [GeV]; TPC signal [arb. units]",\r
1103 vX->GetNrows()-1,vX->GetMatrixArray(),\r
1104 300,0,300);\r
644666df 1105 fListQAtpc->Add(hSig); //3*AliPID::kSPECIESC\r
f25dc3ef 1106\r
1107 delete vX; \r
1108}\r
1109\r
1110//______________________________________________________________________________\r
1111void AliAnalysisTaskPIDqa::SetupTRDqa()\r
1112{\r
1113 //\r
1114 // Create the TRD qa objects\r
1115 //\r
1116 TVectorD *vX=MakeLogBinning(200,.1,30);\r
1117 for(Int_t itl = 0; itl < 6; ++itl){\r
1118 for(Int_t ispecie = 0; ispecie < AliPID::kSPECIES; ispecie++){\r
1119 TH2F *hLikeP = new TH2F(Form("hLikeP_TRD_%dtls_%s", itl, AliPID::ParticleName(ispecie)),\r
1120 Form("TRD Likelihood to be %s %s for tracks having %d %s; p (GeV/c); TRD %s Likelihood", ispecie == 0 ? "an" : "a", AliPID::ParticleName(ispecie), itl+1, itl == 0 ? "tracklet" : "tracklets", AliPID::ParticleName(ispecie)),\r
1121 vX->GetNrows()-1, vX->GetMatrixArray(),\r
1122 100, 0., 1.);\r
1123 fListQAtrd->Add(hLikeP);\r
1124 }\r
1125 }\r
1126 delete vX;\r
1127}\r
1128\r
1129//______________________________________________________________________________\r
1130void AliAnalysisTaskPIDqa::SetupTOFqa()\r
1131{\r
1132 //\r
1133 // Create the TOF qa objects\r
1134 //\r
1135 \r
1136 TVectorD *vX=MakeLogBinning(200,.1,30);\r
1137\r
00a38d07 1138 for (Int_t ispecie=0; ispecie<AliPID::kSPECIESC; ++ispecie){\r
f25dc3ef 1139 TH2F *hNsigmaP = new TH2F(Form("hNsigmaP_TOF_%s",AliPID::ParticleName(ispecie)),\r
1140 Form("TOF n#sigma %s vs. p;p [GeV]; n#sigma",AliPID::ParticleName(ispecie)),\r
1141 vX->GetNrows()-1,vX->GetMatrixArray(),\r
1142 200,-10,10);\r
1143 fListQAtof->Add(hNsigmaP);\r
1144 }\r
1145\r
1146 // for Kaons PID we differentiate on Time Zero\r
1147 TH1F *hnSigT0Fill = new TH1F("hNsigma_TOF_Pion_T0-Fill","TOF n#sigma (Pion) T0-FILL [0.75-1.25. GeV/c]",200,-10,10);\r
1148 fListQAtof->Add(hnSigT0Fill);\r
1149 TH1F *hnSigT0T0 = new TH1F("hNsigma_TOF_Pion_T0-T0","TOF n#sigma (Pion) T0-T0 [0.75-1.25 GeV/c]",200,-10,10);\r
1150 fListQAtof->Add(hnSigT0T0);\r
1151 TH1F *hnSigT0TOF = new TH1F("hNsigma_TOF_Pion_T0-TOF","TOF n#sigma (Pion) T0-TOF [0.75-1.25 GeV/c]",200,-10,10);\r
1152 fListQAtof->Add(hnSigT0TOF);\r
1153 TH1F *hnSigT0Best = new TH1F("hNsigma_TOF_Pion_T0-Best","TOF n#sigma (Pion) T0-Best [0.75-1.25 GeV/c]",200,-10,10);\r
1154 fListQAtof->Add(hnSigT0Best);\r
1155\r
1156 TH2F *hSig = new TH2F("hSigP_TOF",\r
1157 "TOF signal vs. p;p [GeV]; TOF signal [ns]",\r
1158 vX->GetNrows()-1,vX->GetMatrixArray(),\r
1159 300,0,30);\r
1160\r
1161 delete vX;\r
1162 \r
1163 fListQAtof->Add(hSig);\r
1164\r
1165 TH1F *hStartTimeMaskTOF = new TH1F("hStartTimeMask_TOF","StartTime mask",8,0,8);\r
1166 fListQAtof->Add(hStartTimeMaskTOF);\r
1167 TH1F *hStartTimeResTOF = new TH1F("hStartTimeRes_TOF","StartTime resolution [ps]",100,0,500);\r
1168 fListQAtof->Add(hStartTimeResTOF);\r
1169\r
1170 TH1F *hnTracksAtTOF = new TH1F("hnTracksAt_TOF","Matched tracks at TOF",20,0,20);\r
1171 fListQAtof->Add(hnTracksAtTOF);\r
1172 TH1F *hT0MakerEff = new TH1F("hT0MakerEff","Events with T0-TOF vs nTracks",20,0,20);\r
1173 fListQAtof->Add(hT0MakerEff);\r
1174\r
1175 // this in principle should stay on a T0 PID QA, but are just the data prepared for TOF use\r
1176 TH1F *hStartTimeAT0 = new TH1F("hStartTimeA_T0","StartTime from T0A [ps]",1000,-1000,1000);\r
1177 fListQAtof->Add(hStartTimeAT0);\r
1178 TH1F *hStartTimeCT0 = new TH1F("hStartTimeC_T0","StartTime from T0C [ps]",1000,-1000,1000);\r
1179 fListQAtof->Add(hStartTimeCT0);\r
1180 TH1F *hStartTimeACT0 = new TH1F("hStartTimeAC_T0","StartTime from T0AC [ps]",1000,-1000,1000);;\r
1181 fListQAtof->Add(hStartTimeACT0);\r
1182}\r
1183\r
1184//______________________________________________________________________________\r
1185void AliAnalysisTaskPIDqa::SetupEMCALqa()\r
1186{\r
1187 //\r
1188 // Create the EMCAL qa objects\r
1189 //\r
1190\r
1191 TVectorD *vX=MakeLogBinning(200,.1,30);\r
1192 \r
1193 TH2F *hNsigmaPt = new TH2F(Form("hNsigmaPt_EMCAL_%s",AliPID::ParticleName(0)),\r
1194 Form("EMCAL n#sigma %s vs. p_{T};p_{T} [GeV]; n#sigma",AliPID::ParticleName(0)),\r
1195 vX->GetNrows()-1,vX->GetMatrixArray(),\r
1196 200,-10,10);\r
1197 fListQAemcal->Add(hNsigmaPt); \r
1198 \r
11fd38f5 1199\r
1200 TH2F *hSigPtEle = new TH2F("hSigPt_EMCAL_Ele",\r
1201 "EMCAL signal (E/p) vs. p_{T} for electrons;p_{T} [GeV]; EMCAL signal (E/p) [arb. units]",\r
1202 vX->GetNrows()-1,vX->GetMatrixArray(),\r
1203 200,0,2);\r
1204 fListQAemcal->Add(hSigPtEle);\r
1205\r
1206 TH2F *hSigPtPions = new TH2F("hSigPt_EMCAL_Pions",\r
1207 "EMCAL signal (E/p) vs. p_{T} for pions;p_{T} [GeV]; EMCAL signal (E/p) [arb. units]",\r
1208 vX->GetNrows()-1,vX->GetMatrixArray(),\r
1209 200,0,2);\r
1210 fListQAemcal->Add(hSigPtPions);\r
1211\r
1212 TH2F *hSigPtProtons = new TH2F("hSigPt_EMCAL_Protons",\r
1213 "EMCAL signal (E/p) vs. p_{T} for protons;p_{T} [GeV]; EMCAL signal (E/p) [arb. units]",\r
1214 vX->GetNrows()-1,vX->GetMatrixArray(),\r
1215 200,0,2);\r
1216 fListQAemcal->Add(hSigPtProtons);\r
1217\r
1218 TH2F *hSigPtAntiProtons = new TH2F("hSigPt_EMCAL_Antiprotons",\r
1219 "EMCAL signal (E/p) vs. p_{T} for antiprotons;p_{T} [GeV]; EMCAL signal (E/p) [arb. units]",\r
f25dc3ef 1220 vX->GetNrows()-1,vX->GetMatrixArray(),\r
1221 200,0,2);\r
11fd38f5 1222 fListQAemcal->Add(hSigPtAntiProtons);\r
f25dc3ef 1223\r
1224 delete vX; \r
1225}\r
1226\r
1227//______________________________________________________________________________\r
1228void AliAnalysisTaskPIDqa::SetupHMPIDqa()\r
1229{\r
1230 //\r
1231 // Create the HMPID qa objects\r
1232 //\r
1233 \r
1234 TH2F *hCkovAnglevsMom = new TH2F("hCkovAnglevsMom", "Cherenkov angle vs momnetum",500,0,5.,500,0,1);\r
1235 fListQAhmpid->Add(hCkovAnglevsMom);\r
1236 \r
1237}\r
1238\r
1239//______________________________________________________________________________\r
1240void AliAnalysisTaskPIDqa::SetupTOFHMPIDqa()\r
1241{\r
1242 //\r
1243 // Create the HMPID qa objects\r
1244 //\r
1245 \r
1246 TH2F *hCkovAnglevsMomPion = new TH2F("hCkovAnglevsMom_pion", "Cherenkov angle vs momnetum for pions",500,0,5.,500,0,1);\r
1247 fListQAtofhmpid->Add(hCkovAnglevsMomPion);\r
1248 \r
1249 TH2F *hCkovAnglevsMomKaon = new TH2F("hCkovAnglevsMom_kaon", "Cherenkov angle vs momnetum for kaons",500,0,5.,500,0,1);\r
1250 fListQAtofhmpid->Add(hCkovAnglevsMomKaon);\r
1251 \r
1252 TH2F *hCkovAnglevsMomProton = new TH2F("hCkovAnglevsMom_proton","Cherenkov angle vs momnetum for protons",500,0,5.,500,0,1);\r
1253 fListQAtofhmpid->Add(hCkovAnglevsMomProton);\r
1254 \r
1255 \r
1256} \r
1257\r
1258//______________________________________________________________________________\r
1259void AliAnalysisTaskPIDqa::SetupTPCTOFqa()\r
1260{\r
1261 //\r
1262 // Create the qa objects for TPC + TOF combination\r
1263 //\r
1264 \r
1265 TVectorD *vX=MakeLogBinning(200,.1,30);\r
1266\r
1267 //TPC signals after TOF cut\r
00a38d07 1268 for (Int_t ispecie=0; ispecie<AliPID::kSPECIESC; ++ispecie){\r
f25dc3ef 1269 TH2F *hNsigmaP = new TH2F(Form("hNsigmaP_TPC_TOF_%s",AliPID::ParticleName(ispecie)),\r
1270 Form("TPC n#sigma %s vs. p (after TOF 3#sigma cut);p_{TPC} [GeV]; n#sigma",AliPID::ParticleName(ispecie)),\r
1271 vX->GetNrows()-1,vX->GetMatrixArray(),\r
1272 200,-10,10);\r
1273 fListQAtpctof->Add(hNsigmaP);\r
1274 }\r
1275\r
1276 //TOF signals after TPC cut\r
00a38d07 1277 for (Int_t ispecie=0; ispecie<AliPID::kSPECIESC; ++ispecie){\r
f25dc3ef 1278 TH2F *hNsigmaP = new TH2F(Form("hNsigmaP_TOF_TPC_%s",AliPID::ParticleName(ispecie)),\r
1279 Form("TOF n#sigma %s vs. p (after TPC n#sigma cut);p [GeV]; n#sigma",AliPID::ParticleName(ispecie)),\r
1280 vX->GetNrows()-1,vX->GetMatrixArray(),\r
1281 200,-10,10);\r
1282 fListQAtpctof->Add(hNsigmaP);\r
1283 }\r
1284\r
1285 //EMCAL signal after TOF and TPC cut\r
1286 for (Int_t ispecie=0; ispecie<AliPID::kSPECIES; ++ispecie){\r
1287 TH2F *heopPt = new TH2F(Form("heopPt_TOF_TPC_%s",AliPID::ParticleName(ispecie)),\r
1288 Form("EMCAL signal (E/p) %s vs. p_{T};p_{T} [GeV]; EMCAL signal (E/p) [arb. units]",AliPID::ParticleName(ispecie)),\r
1289 vX->GetNrows()-1,vX->GetMatrixArray(),\r
1290 200,0,2);\r
1291 fListQAtpctof->Add(heopPt);\r
1292 }\r
1293\r
1294 delete vX;\r
1295}\r
11fd38f5 1296//______________________________________________________________________________\r
1297void AliAnalysisTaskPIDqa::SetupV0qa()\r
1298{\r
1299 //\r
1300 // Create the qa objects for V0 Kine cuts\r
1301 //\r
1302 \r
1303 TH2F *hArmenteros = new TH2F("hArmenteros", "Armenteros plot",200,-1.,1.,200,0.,0.4);\r
1304 fListQAV0->Add(hArmenteros);\r
1305 \r
1306}\r
f25dc3ef 1307\r
324348e5 1308//_____________________________________________________________________________\r
1309void AliAnalysisTaskPIDqa::SetupQAinfo(){\r
1310 //\r
1311 // Setup the info of QA objects\r
1312 //\r
1313\r
1314 TObjArray *arr=new TObjArray;\r
1315 arr->SetName("TPC_info");\r
1316 fListQAinfo->Add(arr);\r
1317}\r
1318\r
f25dc3ef 1319//______________________________________________________________________________\r
1320TVectorD* AliAnalysisTaskPIDqa::MakeLogBinning(Int_t nbinsX, Double_t xmin, Double_t xmax)\r
1321{\r
1322 //\r
1323 // Make logarithmic binning\r
1324 // the user has to delete the array afterwards!!!\r
1325 //\r
1326 \r
1327 //check limits\r
1328 if (xmin<1e-20 || xmax<1e-20){\r
1329 AliError("For Log binning xmin and xmax must be > 1e-20. Using linear binning instead!");\r
1330 return MakeLinBinning(nbinsX, xmin, xmax);\r
1331 }\r
1332 if (xmax<xmin){\r
1333 Double_t tmp=xmin;\r
1334 xmin=xmax;\r
1335 xmax=tmp;\r
1336 }\r
1337 TVectorD *binLim=new TVectorD(nbinsX+1);\r
1338 Double_t first=xmin;\r
1339 Double_t last=xmax;\r
1340 Double_t expMax=TMath::Log(last/first);\r
1341 for (Int_t i=0; i<nbinsX+1; ++i){\r
1342 (*binLim)[i]=first*TMath::Exp(expMax/nbinsX*(Double_t)i);\r
1343 }\r
1344 return binLim;\r
1345}\r
1346\r
1347//______________________________________________________________________________\r
1348TVectorD* AliAnalysisTaskPIDqa::MakeLinBinning(Int_t nbinsX, Double_t xmin, Double_t xmax)\r
1349{\r
1350 //\r
1351 // Make linear binning\r
1352 // the user has to delete the array afterwards!!!\r
1353 //\r
1354 if (xmax<xmin){\r
1355 Double_t tmp=xmin;\r
1356 xmin=xmax;\r
1357 xmax=tmp;\r
1358 }\r
1359 TVectorD *binLim=new TVectorD(nbinsX+1);\r
1360 Double_t first=xmin;\r
1361 Double_t last=xmax;\r
1362 Double_t binWidth=(last-first)/nbinsX;\r
1363 for (Int_t i=0; i<nbinsX+1; ++i){\r
1364 (*binLim)[i]=first+binWidth*(Double_t)i;\r
1365 }\r
1366 return binLim;\r
1367}\r
1368\r
1369//_____________________________________________________________________________\r
1370TVectorD* AliAnalysisTaskPIDqa::MakeArbitraryBinning(const char* bins)\r
1371{\r
1372 //\r
1373 // Make arbitrary binning, bins separated by a ','\r
1374 //\r
1375 TString limits(bins);\r
1376 if (limits.IsNull()){\r
1377 AliError("Bin Limit string is empty, cannot add the variable");\r
1378 return 0x0;\r
1379 }\r
1380 \r
1381 TObjArray *arr=limits.Tokenize(",");\r
1382 Int_t nLimits=arr->GetEntries();\r
1383 if (nLimits<2){\r
1384 AliError("Need at leas 2 bin limits, cannot add the variable");\r
1385 delete arr;\r
1386 return 0x0;\r
1387 }\r
1388 \r
1389 TVectorD *binLimits=new TVectorD(nLimits);\r
1390 for (Int_t iLim=0; iLim<nLimits; ++iLim){\r
1391 (*binLimits)[iLim]=(static_cast<TObjString*>(arr->At(iLim)))->GetString().Atof();\r
1392 }\r
1393 \r
1394 delete arr;\r
1395 return binLimits;\r
1396}\r
1397\r