support for LHC10de + some code reshuffling
[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
3fdfb2cd 540 // TOF out + kTIME\r
f25dc3ef 541 // kTIME\r
3fdfb2cd 542 // (we don't use kTOFmismatch because it depends on TPC and kTOFpid because it prevents light nuclei\r
f25dc3ef 543 if (!((status & AliVTrack::kTPCrefit) == AliVTrack::kTPCrefit) ||\r
544 !((status & AliVTrack::kITSrefit) == AliVTrack::kITSrefit) ||\r
545 !((status & AliVTrack::kTOFout ) == AliVTrack::kTOFout ) ||\r
3fdfb2cd 546 // !((status & AliVTrack::kTOFpid ) == AliVTrack::kTOFpid ) ||\r
f25dc3ef 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
3fdfb2cd 593 Double_t startTimeT0 = event->GetT0TOF(0);\r
594 if (startTimeT0 < 90000) ((TH1F*)fListQAtof->FindObject("hStartTimeAC_T0"))->Fill(startTimeT0);\r
595 else {\r
596 startTimeT0 = event->GetT0TOF(1);\r
597 if (startTimeT0 < 90000) ((TH1F*)fListQAtof->FindObject("hStartTimeA_T0"))->Fill(startTimeT0);\r
598 startTimeT0 = event->GetT0TOF(2);\r
599 if (startTimeT0 < 90000) ((TH1F*)fListQAtof->FindObject("hStartTimeC_T0"))->Fill(startTimeT0);\r
f25dc3ef 600 }\r
601 }\r
602 if (tracksAtTof > 0) {\r
603 ((TH1F* )fListQAtof->FindObject("hnTracksAt_TOF"))->Fill(tracksAtTof);\r
604 Int_t mask = fPIDResponse->GetTOFResponse().GetStartTimeMask(5.);\r
605 if (mask & 0x1) ((TH1F*)fListQAtof->FindObject("hT0MakerEff"))->Fill(tracksAtTof);\r
606 }\r
607}\r
608\r
609\r
610//______________________________________________________________________________\r
611void AliAnalysisTaskPIDqa::FillEMCALqa()\r
612{\r
613 //\r
614 // Fill PID qa histograms for the EMCAL\r
615 //\r
616\r
617 AliVEvent *event=InputEvent();\r
618 \r
619 Int_t ntracks=event->GetNumberOfTracks();\r
620 for(Int_t itrack = 0; itrack < ntracks; itrack++){\r
621 AliVTrack *track=(AliVTrack*)event->GetTrack(itrack);\r
622 \r
623 //\r
624 //basic track cuts\r
625 //\r
626 ULong_t status=track->GetStatus();\r
627 // not that nice. status bits not in virtual interface\r
628 if (!( (status & AliVTrack::kEMCALmatch) == AliVTrack::kEMCALmatch) ) continue;\r
629\r
630 Double_t pt=track->Pt();\r
631 \r
632 //EMCAL nSigma (only for electrons at the moment)\r
633 TH2 *h=(TH2*)fListQAemcal->At(0);\r
634 if (!h) continue;\r
635 Double_t nSigma=fPIDResponse->NumberOfSigmasEMCAL(track, (AliPID::EParticleType)0);\r
636 h->Fill(pt,nSigma);\r
637 \r
11fd38f5 638 }\r
639\r
640 //EMCAL signal (E/p vs. pT) for electrons from V0\r
641 for(Int_t itrack = 0; itrack < fV0electrons->GetEntries(); itrack++){\r
642 AliVTrack *track=(AliVTrack*)fV0electrons->At(itrack);\r
643\r
644 //\r
645 //basic track cuts\r
646 //\r
647 ULong_t status=track->GetStatus();\r
648 // not that nice. status bits not in virtual interface\r
649 if (!( (status & AliVTrack::kEMCALmatch) == AliVTrack::kEMCALmatch) ) continue;\r
650\r
651 Double_t pt=track->Pt();\r
652\r
653 TH2 *h=(TH2*)fListQAemcal->At(1);\r
f25dc3ef 654 if (h) {\r
655\r
656 Int_t nMatchClus = track->GetEMCALcluster();\r
657 Double_t mom = track->P();\r
658 Double_t eop = -1.;\r
659\r
660 if(nMatchClus > -1){\r
661 \r
662 AliVCluster *matchedClus = (AliVCluster*)event->GetCaloCluster(nMatchClus);\r
663\r
664 if(matchedClus){\r
665\r
666 // matched cluster is EMCAL\r
667 if(matchedClus->IsEMCAL()){\r
668\r
669 Double_t fClsE = matchedClus->E();\r
670 eop = fClsE/mom;\r
671\r
672 h->Fill(pt,eop);\r
673\r
674 }\r
675 }\r
676 }\r
677 }\r
678 }\r
11fd38f5 679\r
680 //EMCAL signal (E/p vs. pT) for pions from V0\r
681 for(Int_t itrack = 0; itrack < fV0pions->GetEntries(); itrack++){\r
682 AliVTrack *track=(AliVTrack*)fV0pions->At(itrack);\r
683\r
684 //\r
685 //basic track cuts\r
686 //\r
687 ULong_t status=track->GetStatus();\r
688 // not that nice. status bits not in virtual interface\r
689 if (!( (status & AliVTrack::kEMCALmatch) == AliVTrack::kEMCALmatch) ) continue;\r
690\r
691 Double_t pt=track->Pt();\r
692\r
693 TH2 *h=(TH2*)fListQAemcal->At(2);\r
694 if (h) {\r
695\r
696 Int_t nMatchClus = track->GetEMCALcluster();\r
697 Double_t mom = track->P();\r
698 Double_t eop = -1.;\r
699\r
700 if(nMatchClus > -1){\r
701 \r
702 AliVCluster *matchedClus = (AliVCluster*)event->GetCaloCluster(nMatchClus);\r
703\r
704 if(matchedClus){\r
705\r
706 // matched cluster is EMCAL\r
707 if(matchedClus->IsEMCAL()){\r
708\r
709 Double_t fClsE = matchedClus->E();\r
710 eop = fClsE/mom;\r
711\r
712 h->Fill(pt,eop);\r
713\r
714 }\r
715 }\r
716 }\r
717 }\r
718 }\r
719\r
720 //EMCAL signal (E/p vs. pT) for protons from V0\r
721 for(Int_t itrack = 0; itrack < fV0protons->GetEntries(); itrack++){\r
722 AliVTrack *track=(AliVTrack*)fV0protons->At(itrack);\r
723\r
724 //\r
725 //basic track cuts\r
726 //\r
727 ULong_t status=track->GetStatus();\r
728 // not that nice. status bits not in virtual interface\r
729 if (!( (status & AliVTrack::kEMCALmatch) == AliVTrack::kEMCALmatch) ) continue;\r
730\r
731 Double_t pt=track->Pt();\r
732\r
733 TH2 *hP=(TH2*)fListQAemcal->At(3);\r
734 TH2 *hAP=(TH2*)fListQAemcal->At(4);\r
735 if (hP && hAP) {\r
736\r
737 Int_t nMatchClus = track->GetEMCALcluster();\r
738 Double_t mom = track->P();\r
739 Int_t charge = track->Charge(); \r
740 Double_t eop = -1.;\r
741\r
742 if(nMatchClus > -1){\r
743 \r
744 AliVCluster *matchedClus = (AliVCluster*)event->GetCaloCluster(nMatchClus);\r
745\r
746 if(matchedClus){\r
747\r
748 // matched cluster is EMCAL\r
749 if(matchedClus->IsEMCAL()){\r
750\r
751 Double_t fClsE = matchedClus->E();\r
752 eop = fClsE/mom;\r
753\r
754 if(charge > 0) hP->Fill(pt,eop);\r
755 else if(charge < 0) hAP->Fill(pt,eop);\r
756\r
757 }\r
758 }\r
759 }\r
760 }\r
761 }\r
762\r
f25dc3ef 763}\r
764\r
765\r
766//______________________________________________________________________________\r
767void AliAnalysisTaskPIDqa::FillHMPIDqa()\r
768{\r
769 //\r
770 // Fill PID qa histograms for the HMPID\r
771 //\r
772 \r
773 AliVEvent *event=InputEvent();\r
774 \r
775 Int_t ntracks=event->GetNumberOfTracks();\r
776 for(Int_t itrack = 0; itrack < ntracks; itrack++){\r
777 AliVTrack *track=(AliVTrack*)event->GetTrack(itrack);\r
778 \r
779 //\r
780 //basic track cuts\r
781 //\r
782 ULong_t status=track->GetStatus();\r
783 // not that nice. status bits not in virtual interface\r
784 // TPC refit + ITS refit +\r
785 // TOF out + TOFpid +\r
786 // kTIME\r
787 if (!((status & AliVTrack::kTPCrefit) == AliVTrack::kTPCrefit) ||\r
788 !((status & AliVTrack::kITSrefit) == AliVTrack::kITSrefit) ) continue;\r
789\r
790 Float_t nCrossedRowsTPC = track->GetTPCClusterInfo(2,1);\r
791 Float_t ratioCrossedRowsOverFindableClustersTPC = 1.0;\r
792 if (track->GetTPCNclsF()>0) {\r
793 ratioCrossedRowsOverFindableClustersTPC = nCrossedRowsTPC/track->GetTPCNclsF();\r
794 }\r
795\r
796 if ( nCrossedRowsTPC<70 || ratioCrossedRowsOverFindableClustersTPC<.8 ) continue;\r
797 \r
798 Double_t mom = track->P();\r
799 Double_t ckovAngle = track->GetHMPIDsignal();\r
800 \r
801 TH1F *hThetavsMom = (TH1F*)fListQAhmpid->At(0);;\r
802 \r
803 hThetavsMom->Fill(mom,ckovAngle); \r
804 \r
805 }\r
806}\r
807//______________________________________________________________________________\r
808void AliAnalysisTaskPIDqa::FillTOFHMPIDqa()\r
809{\r
810 //\r
811 // Fill PID qa histograms for the HMPID\r
812 //\r
813 \r
814 AliVEvent *event=InputEvent();\r
815 \r
816 Int_t ntracks=event->GetNumberOfTracks();\r
817 for(Int_t itrack = 0; itrack < ntracks; itrack++){\r
818 AliVTrack *track=(AliVTrack*)event->GetTrack(itrack);\r
819 \r
820 //\r
821 //basic track cuts\r
822 //\r
823 ULong_t status=track->GetStatus();\r
824 // not that nice. status bits not in virtual interface\r
825 // TPC refit + ITS refit +\r
826 // TOF out + TOFpid +\r
827 // kTIME\r
828 if (!((status & AliVTrack::kTPCrefit) == AliVTrack::kTPCrefit) ||\r
829 !((status & AliVTrack::kITSrefit) == AliVTrack::kITSrefit) ||\r
830 !((status & AliVTrack::kTOFout ) == AliVTrack::kTOFout ) ||\r
831 !((status & AliVTrack::kTOFpid ) == AliVTrack::kTOFpid ) ||\r
832 !((status & AliVTrack::kTIME ) == AliVTrack::kTIME ) ) continue;\r
833\r
834 Float_t nCrossedRowsTPC = track->GetTPCClusterInfo(2,1);\r
835 Float_t ratioCrossedRowsOverFindableClustersTPC = 1.0;\r
836 if (track->GetTPCNclsF()>0) {\r
837 ratioCrossedRowsOverFindableClustersTPC = nCrossedRowsTPC/track->GetTPCNclsF();\r
838 }\r
839\r
840 if ( nCrossedRowsTPC<70 || ratioCrossedRowsOverFindableClustersTPC<.8 ) continue;\r
841 \r
842 Double_t mom = track->P();\r
843 Double_t ckovAngle = track->GetHMPIDsignal();\r
844 \r
845 Double_t nSigmaTOF[3]; \r
846 TH1F *h[3];\r
847 \r
848 for (Int_t ispecie=2; ispecie<5; ++ispecie){\r
849 //TOF nSigma\r
850 nSigmaTOF[ispecie-2]=fPIDResponse->NumberOfSigmasTOF(track, (AliPID::EParticleType)ispecie);\r
851 h[ispecie-2] = (TH1F*)fListQAtofhmpid->At(ispecie-2);}\r
852 \r
853 if(TMath::Abs(nSigmaTOF[0])<2) h[0]->Fill(mom,ckovAngle);\r
854 \r
855 if(TMath::Abs(nSigmaTOF[1])<2 && TMath::Abs(nSigmaTOF[0])>3) h[1]->Fill(mom,ckovAngle);\r
856\r
857 if(TMath::Abs(nSigmaTOF[2])<2 && TMath::Abs(nSigmaTOF[1])>3 && TMath::Abs(nSigmaTOF[0])>3) h[2]->Fill(mom,ckovAngle);\r
858 \r
859 }\r
860 \r
861}\r
862\r
863//______________________________________________________________________________\r
864void AliAnalysisTaskPIDqa::FillTPCTOFqa()\r
865{\r
866 //\r
867 // Fill PID qa histograms for the TOF\r
868 // Here also the TPC histograms after TOF selection are filled\r
869 //\r
870\r
871 AliVEvent *event=InputEvent();\r
872\r
873 Int_t ntracks=event->GetNumberOfTracks();\r
874 for(Int_t itrack = 0; itrack < ntracks; itrack++){\r
875 AliVTrack *track=(AliVTrack*)event->GetTrack(itrack);\r
876\r
877 //\r
878 //basic track cuts\r
879 //\r
880 ULong_t status=track->GetStatus();\r
881 // not that nice. status bits not in virtual interface\r
882 // TPC refit + ITS refit +\r
883 // TOF out + TOFpid +\r
884 // kTIME\r
885 if (!((status & AliVTrack::kTPCrefit) == AliVTrack::kTPCrefit) ||\r
886 !((status & AliVTrack::kITSrefit) == AliVTrack::kITSrefit) ||\r
887// !( (status & AliVTrack::kTPCpid ) == AliVTrack::kTPCpid ) || //removes light nuclei, so it is out for the moment\r
888 !((status & AliVTrack::kTOFout ) == AliVTrack::kTOFout ) ||\r
889 !((status & AliVTrack::kTOFpid ) == AliVTrack::kTOFpid ) ||\r
890 !((status & AliVTrack::kTIME ) == AliVTrack::kTIME ) ) continue;\r
891\r
892 Float_t nCrossedRowsTPC = track->GetTPCClusterInfo(2,1);\r
893 Float_t ratioCrossedRowsOverFindableClustersTPC = 1.0;\r
894 if (track->GetTPCNclsF()>0) {\r
895 ratioCrossedRowsOverFindableClustersTPC = nCrossedRowsTPC/track->GetTPCNclsF();\r
896 }\r
897\r
898 if ( nCrossedRowsTPC<70 || ratioCrossedRowsOverFindableClustersTPC<.8 ) continue;\r
899\r
900\r
901 Double_t mom=track->P();\r
902 Double_t momTPC=track->GetTPCmomentum();\r
903\r
00a38d07 904 for (Int_t ispecie=0; ispecie<AliPID::kSPECIESC; ++ispecie){\r
f25dc3ef 905 //TOF nSigma\r
906 Double_t nSigmaTOF=fPIDResponse->NumberOfSigmasTOF(track, (AliPID::EParticleType)ispecie);\r
907 Double_t nSigmaTPC=fPIDResponse->NumberOfSigmasTPC(track, (AliPID::EParticleType)ispecie);\r
908\r
909 //TPC after TOF cut\r
910 TH2 *h=(TH2*)fListQAtpctof->At(ispecie);\r
911 if (h && TMath::Abs(nSigmaTOF)<3.) h->Fill(momTPC,nSigmaTPC);\r
912\r
913 //TOF after TPC cut\r
00a38d07 914 h=(TH2*)fListQAtpctof->At(ispecie+AliPID::kSPECIESC);\r
f25dc3ef 915 if (h && TMath::Abs(nSigmaTPC)<3.) h->Fill(mom,nSigmaTOF);\r
916\r
917 //EMCAL after TOF and TPC cut\r
00a38d07 918 h=(TH2*)fListQAtpctof->At(ispecie+2*AliPID::kSPECIESC);\r
f25dc3ef 919 if (h && TMath::Abs(nSigmaTOF)<3. && TMath::Abs(nSigmaTPC)<3. ){\r
920\r
921 Int_t nMatchClus = track->GetEMCALcluster();\r
922 Double_t pt = track->Pt();\r
923 Double_t eop = -1.;\r
924 \r
925 if(nMatchClus > -1){\r
926 \r
927 AliVCluster *matchedClus = (AliVCluster*)event->GetCaloCluster(nMatchClus);\r
928 \r
929 if(matchedClus){\r
930 \r
931 // matched cluster is EMCAL\r
932 if(matchedClus->IsEMCAL()){\r
933 \r
934 Double_t fClsE = matchedClus->E();\r
935 eop = fClsE/mom;\r
936\r
937 h->Fill(pt,eop);\r
938 \r
939 \r
940 }\r
941 }\r
942 }\r
943 }\r
944 }\r
945 }\r
946}\r
947\r
324348e5 948//_____________________________________________________________________________\r
949void AliAnalysisTaskPIDqa::FillQAinfo()\r
950{\r
951 //\r
952 // Fill the QA information\r
953 //\r
954\r
955\r
956 //TPC QA info\r
957 TObjArray *arrTPC=static_cast<TObjArray*>(fListQAinfo->At(0));\r
958 if (fPIDResponse && arrTPC){\r
959 AliTPCPIDResponse &tpcResp=fPIDResponse->GetTPCResponse();\r
960 // fill spline names\r
961 if (!arrTPC->UncheckedAt(0)){\r
962 \r
963 TObjArray *arrTPCsplineNames=new TObjArray(AliPID::kSPECIESC);\r
964 arrTPCsplineNames->SetOwner();\r
965 arrTPCsplineNames->SetName("TPC_spline_names");\r
966 arrTPC->AddAt(arrTPCsplineNames,0);\r
967 \r
968 for (Int_t iresp=0; iresp<AliPID::kSPECIESC; ++iresp){\r
969 const TObject *o=tpcResp.GetResponseFunction((AliPID::EParticleType)iresp);\r
970 if (!o) continue;\r
971 arrTPCsplineNames->Add(new TObjString(Form("%02d: %s",iresp, o->GetName())));\r
972 }\r
973 }\r
974\r
975 // tpc response config\r
976 if (!arrTPC->UncheckedAt(1)){\r
977 \r
978 TObjArray *arrTPCconfigInfo=new TObjArray;\r
979 arrTPCconfigInfo->SetOwner();\r
980 arrTPCconfigInfo->SetName("TPC_config_info");\r
981 arrTPC->AddAt(arrTPCconfigInfo,1);\r
982\r
983 TObjString *ostr=0x0;\r
984 ostr=new TObjString;\r
985 ostr->String().Form("Eta Corr map: %s", tpcResp.GetEtaCorrMap()?tpcResp.GetEtaCorrMap()->GetName():"none");\r
986 arrTPCconfigInfo->Add(ostr);\r
987\r
988 ostr=new TObjString;\r
989 ostr->String().Form("Sigma Par map: %s", tpcResp.GetSigmaPar1Map()?tpcResp.GetSigmaPar1Map()->GetName():"none");\r
990 arrTPCconfigInfo->Add(ostr);\r
991\r
992 ostr=new TObjString;\r
993 ostr->String().Form("MIP: %.2f", tpcResp.GetMIP());\r
994 arrTPCconfigInfo->Add(ostr);\r
995 \r
996 ostr=new TObjString;\r
997 ostr->String().Form("Res: Def %.3g (%.3g) : AllHigh %.3g (%.3g) : OROC high %.3g (%.3g)",\r
998 tpcResp.GetRes0(AliTPCPIDResponse::kDefault), tpcResp.GetResN2(AliTPCPIDResponse::kDefault),\r
999 tpcResp.GetRes0(AliTPCPIDResponse::kALLhigh), tpcResp.GetResN2(AliTPCPIDResponse::kALLhigh),\r
1000 tpcResp.GetRes0(AliTPCPIDResponse::kOROChigh), tpcResp.GetResN2(AliTPCPIDResponse::kOROChigh)\r
1001 );\r
1002 arrTPCconfigInfo->Add(ostr);\r
1003 }\r
1004 }\r
1005}\r
1006\r
f25dc3ef 1007//______________________________________________________________________________\r
1008void AliAnalysisTaskPIDqa::SetupITSqa()\r
1009{\r
1010 //\r
1011 // Create the ITS qa objects\r
1012 //\r
1013 \r
1014 TVectorD *vX=MakeLogBinning(200,.1,30);\r
1015 \r
1016 //ITS+TPC tracks\r
00a38d07 1017 for (Int_t ispecie=0; ispecie<AliPID::kSPECIESC; ++ispecie){\r
f25dc3ef 1018 TH2F *hNsigmaP = new TH2F(Form("hNsigmaP_ITS_%s",AliPID::ParticleName(ispecie)),\r
1019 Form("ITS n#sigma %s vs. p;p [GeV]; n#sigma",AliPID::ParticleName(ispecie)),\r
1020 vX->GetNrows()-1,vX->GetMatrixArray(),\r
1021 200,-10,10);\r
1022 fListQAits->Add(hNsigmaP);\r
1023 }\r
1024 TH2F *hSig = new TH2F("hSigP_ITS",\r
1025 "ITS signal vs. p;p [GeV]; ITS signal [arb. units]",\r
1026 vX->GetNrows()-1,vX->GetMatrixArray(),\r
1027 300,0,300);\r
1028 fListQAits->Add(hSig);\r
1029\r
1030 //ITS Standalone tracks\r
00a38d07 1031 for (Int_t ispecie=0; ispecie<AliPID::kSPECIESC; ++ispecie){\r
f25dc3ef 1032 TH2F *hNsigmaPSA = new TH2F(Form("hNsigmaP_ITSSA_%s",AliPID::ParticleName(ispecie)),\r
1033 Form("ITS n#sigma %s vs. p;p [GeV]; n#sigma",AliPID::ParticleName(ispecie)),\r
1034 vX->GetNrows()-1,vX->GetMatrixArray(),\r
1035 200,-10,10);\r
1036 fListQAitsSA->Add(hNsigmaPSA);\r
1037 }\r
1038 TH2F *hSigSA = new TH2F("hSigP_ITSSA",\r
1039 "ITS signal vs. p;p [GeV]; ITS signal [arb. units]",\r
1040 vX->GetNrows()-1,vX->GetMatrixArray(),\r
1041 300,0,300);\r
1042 fListQAitsSA->Add(hSigSA);\r
1043 \r
1044 //ITS Pure Standalone tracks\r
00a38d07 1045 for (Int_t ispecie=0; ispecie<AliPID::kSPECIESC; ++ispecie){\r
f25dc3ef 1046 TH2F *hNsigmaPPureSA = new TH2F(Form("hNsigmaP_ITSPureSA_%s",AliPID::ParticleName(ispecie)),\r
1047 Form("ITS n#sigma %s vs. p;p [GeV]; n#sigma",AliPID::ParticleName(ispecie)),\r
1048 vX->GetNrows()-1,vX->GetMatrixArray(),\r
1049 200,-10,10);\r
1050 fListQAitsPureSA->Add(hNsigmaPPureSA);\r
1051 }\r
1052 TH2F *hSigPureSA = new TH2F("hSigP_ITSPureSA",\r
1053 "ITS signal vs. p;p [GeV]; ITS signal [arb. units]",\r
1054 vX->GetNrows()-1,vX->GetMatrixArray(),\r
1055 300,0,300);\r
1056 fListQAitsPureSA->Add(hSigPureSA);\r
1057 \r
1058 delete vX; \r
1059}\r
1060\r
1061//______________________________________________________________________________\r
1062void AliAnalysisTaskPIDqa::SetupTPCqa()\r
1063{\r
1064 //\r
1065 // Create the TPC qa objects\r
1066 //\r
1067 \r
1068 TVectorD *vX=MakeLogBinning(200,.1,30);\r
1069 \r
00a38d07 1070 for (Int_t ispecie=0; ispecie<AliPID::kSPECIESC; ++ispecie){\r
f25dc3ef 1071 TH2F *hNsigmaP = new TH2F(Form("hNsigmaP_TPC_%s",AliPID::ParticleName(ispecie)),\r
1072 Form("TPC n#sigma %s vs. p;p [GeV]; n#sigma",AliPID::ParticleName(ispecie)),\r
1073 vX->GetNrows()-1,vX->GetMatrixArray(),\r
1074 200,-10,10);\r
1075 fListQAtpc->Add(hNsigmaP);\r
1076 }\r
644666df 1077\r
1078 // the "hybrid" scenario\r
1079 for (Int_t ispecie=0; ispecie<AliPID::kSPECIESC; ++ispecie){\r
1080 TH2F *hNsigmaP = new TH2F(Form("hNsigmaP_TPC_%s_Hybrid",AliPID::ParticleName(ispecie)),\r
1081 Form("TPC n#sigma %s vs. p (Hybrid gain scenario);p [GeV]; n#sigma",AliPID::ParticleName(ispecie)),\r
1082 vX->GetNrows()-1,vX->GetMatrixArray(),\r
1083 200,-10,10);\r
1084 fListQAtpc->Add(hNsigmaP);\r
1085 }\r
1086 \r
1087 // the "OROC high" scenario\r
1088 for (Int_t ispecie=0; ispecie<AliPID::kSPECIESC; ++ispecie){\r
1089 TH2F *hNsigmaP = new TH2F(Form("hNsigmaP_TPC_%s_OROChigh",AliPID::ParticleName(ispecie)),\r
1090 Form("TPC n#sigma %s vs. p (OROChigh gain scenario);p [GeV]; n#sigma",AliPID::ParticleName(ispecie)),\r
1091 vX->GetNrows()-1,vX->GetMatrixArray(),\r
1092 200,-10,10);\r
1093 fListQAtpc->Add(hNsigmaP);\r
1094 }\r
1095 \r
f25dc3ef 1096 \r
1097 \r
1098 TH2F *hSig = new TH2F("hSigP_TPC",\r
1099 "TPC signal vs. p;p [GeV]; TPC signal [arb. units]",\r
1100 vX->GetNrows()-1,vX->GetMatrixArray(),\r
1101 300,0,300);\r
644666df 1102 fListQAtpc->Add(hSig); //3*AliPID::kSPECIESC\r
f25dc3ef 1103\r
1104 delete vX; \r
1105}\r
1106\r
1107//______________________________________________________________________________\r
1108void AliAnalysisTaskPIDqa::SetupTRDqa()\r
1109{\r
1110 //\r
1111 // Create the TRD qa objects\r
1112 //\r
1113 TVectorD *vX=MakeLogBinning(200,.1,30);\r
1114 for(Int_t itl = 0; itl < 6; ++itl){\r
1115 for(Int_t ispecie = 0; ispecie < AliPID::kSPECIES; ispecie++){\r
1116 TH2F *hLikeP = new TH2F(Form("hLikeP_TRD_%dtls_%s", itl, AliPID::ParticleName(ispecie)),\r
1117 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
1118 vX->GetNrows()-1, vX->GetMatrixArray(),\r
1119 100, 0., 1.);\r
1120 fListQAtrd->Add(hLikeP);\r
1121 }\r
1122 }\r
1123 delete vX;\r
1124}\r
1125\r
1126//______________________________________________________________________________\r
1127void AliAnalysisTaskPIDqa::SetupTOFqa()\r
1128{\r
1129 //\r
1130 // Create the TOF qa objects\r
1131 //\r
1132 \r
1133 TVectorD *vX=MakeLogBinning(200,.1,30);\r
1134\r
00a38d07 1135 for (Int_t ispecie=0; ispecie<AliPID::kSPECIESC; ++ispecie){\r
f25dc3ef 1136 TH2F *hNsigmaP = new TH2F(Form("hNsigmaP_TOF_%s",AliPID::ParticleName(ispecie)),\r
1137 Form("TOF n#sigma %s vs. p;p [GeV]; n#sigma",AliPID::ParticleName(ispecie)),\r
1138 vX->GetNrows()-1,vX->GetMatrixArray(),\r
1139 200,-10,10);\r
1140 fListQAtof->Add(hNsigmaP);\r
1141 }\r
1142\r
1143 // for Kaons PID we differentiate on Time Zero\r
1144 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
1145 fListQAtof->Add(hnSigT0Fill);\r
1146 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
1147 fListQAtof->Add(hnSigT0T0);\r
1148 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
1149 fListQAtof->Add(hnSigT0TOF);\r
1150 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
1151 fListQAtof->Add(hnSigT0Best);\r
1152\r
1153 TH2F *hSig = new TH2F("hSigP_TOF",\r
1154 "TOF signal vs. p;p [GeV]; TOF signal [ns]",\r
1155 vX->GetNrows()-1,vX->GetMatrixArray(),\r
1156 300,0,30);\r
1157\r
1158 delete vX;\r
1159 \r
1160 fListQAtof->Add(hSig);\r
1161\r
1162 TH1F *hStartTimeMaskTOF = new TH1F("hStartTimeMask_TOF","StartTime mask",8,0,8);\r
1163 fListQAtof->Add(hStartTimeMaskTOF);\r
1164 TH1F *hStartTimeResTOF = new TH1F("hStartTimeRes_TOF","StartTime resolution [ps]",100,0,500);\r
1165 fListQAtof->Add(hStartTimeResTOF);\r
1166\r
1167 TH1F *hnTracksAtTOF = new TH1F("hnTracksAt_TOF","Matched tracks at TOF",20,0,20);\r
1168 fListQAtof->Add(hnTracksAtTOF);\r
1169 TH1F *hT0MakerEff = new TH1F("hT0MakerEff","Events with T0-TOF vs nTracks",20,0,20);\r
1170 fListQAtof->Add(hT0MakerEff);\r
1171\r
1172 // this in principle should stay on a T0 PID QA, but are just the data prepared for TOF use\r
1173 TH1F *hStartTimeAT0 = new TH1F("hStartTimeA_T0","StartTime from T0A [ps]",1000,-1000,1000);\r
1174 fListQAtof->Add(hStartTimeAT0);\r
1175 TH1F *hStartTimeCT0 = new TH1F("hStartTimeC_T0","StartTime from T0C [ps]",1000,-1000,1000);\r
1176 fListQAtof->Add(hStartTimeCT0);\r
1177 TH1F *hStartTimeACT0 = new TH1F("hStartTimeAC_T0","StartTime from T0AC [ps]",1000,-1000,1000);;\r
1178 fListQAtof->Add(hStartTimeACT0);\r
1179}\r
1180\r
1181//______________________________________________________________________________\r
1182void AliAnalysisTaskPIDqa::SetupEMCALqa()\r
1183{\r
1184 //\r
1185 // Create the EMCAL qa objects\r
1186 //\r
1187\r
1188 TVectorD *vX=MakeLogBinning(200,.1,30);\r
1189 \r
1190 TH2F *hNsigmaPt = new TH2F(Form("hNsigmaPt_EMCAL_%s",AliPID::ParticleName(0)),\r
1191 Form("EMCAL n#sigma %s vs. p_{T};p_{T} [GeV]; n#sigma",AliPID::ParticleName(0)),\r
1192 vX->GetNrows()-1,vX->GetMatrixArray(),\r
1193 200,-10,10);\r
1194 fListQAemcal->Add(hNsigmaPt); \r
1195 \r
11fd38f5 1196\r
1197 TH2F *hSigPtEle = new TH2F("hSigPt_EMCAL_Ele",\r
1198 "EMCAL signal (E/p) vs. p_{T} for electrons;p_{T} [GeV]; EMCAL signal (E/p) [arb. units]",\r
1199 vX->GetNrows()-1,vX->GetMatrixArray(),\r
1200 200,0,2);\r
1201 fListQAemcal->Add(hSigPtEle);\r
1202\r
1203 TH2F *hSigPtPions = new TH2F("hSigPt_EMCAL_Pions",\r
1204 "EMCAL signal (E/p) vs. p_{T} for pions;p_{T} [GeV]; EMCAL signal (E/p) [arb. units]",\r
1205 vX->GetNrows()-1,vX->GetMatrixArray(),\r
1206 200,0,2);\r
1207 fListQAemcal->Add(hSigPtPions);\r
1208\r
1209 TH2F *hSigPtProtons = new TH2F("hSigPt_EMCAL_Protons",\r
1210 "EMCAL signal (E/p) vs. p_{T} for protons;p_{T} [GeV]; EMCAL signal (E/p) [arb. units]",\r
1211 vX->GetNrows()-1,vX->GetMatrixArray(),\r
1212 200,0,2);\r
1213 fListQAemcal->Add(hSigPtProtons);\r
1214\r
1215 TH2F *hSigPtAntiProtons = new TH2F("hSigPt_EMCAL_Antiprotons",\r
1216 "EMCAL signal (E/p) vs. p_{T} for antiprotons;p_{T} [GeV]; EMCAL signal (E/p) [arb. units]",\r
f25dc3ef 1217 vX->GetNrows()-1,vX->GetMatrixArray(),\r
1218 200,0,2);\r
11fd38f5 1219 fListQAemcal->Add(hSigPtAntiProtons);\r
f25dc3ef 1220\r
1221 delete vX; \r
1222}\r
1223\r
1224//______________________________________________________________________________\r
1225void AliAnalysisTaskPIDqa::SetupHMPIDqa()\r
1226{\r
1227 //\r
1228 // Create the HMPID qa objects\r
1229 //\r
1230 \r
1231 TH2F *hCkovAnglevsMom = new TH2F("hCkovAnglevsMom", "Cherenkov angle vs momnetum",500,0,5.,500,0,1);\r
1232 fListQAhmpid->Add(hCkovAnglevsMom);\r
1233 \r
1234}\r
1235\r
1236//______________________________________________________________________________\r
1237void AliAnalysisTaskPIDqa::SetupTOFHMPIDqa()\r
1238{\r
1239 //\r
1240 // Create the HMPID qa objects\r
1241 //\r
1242 \r
1243 TH2F *hCkovAnglevsMomPion = new TH2F("hCkovAnglevsMom_pion", "Cherenkov angle vs momnetum for pions",500,0,5.,500,0,1);\r
1244 fListQAtofhmpid->Add(hCkovAnglevsMomPion);\r
1245 \r
1246 TH2F *hCkovAnglevsMomKaon = new TH2F("hCkovAnglevsMom_kaon", "Cherenkov angle vs momnetum for kaons",500,0,5.,500,0,1);\r
1247 fListQAtofhmpid->Add(hCkovAnglevsMomKaon);\r
1248 \r
1249 TH2F *hCkovAnglevsMomProton = new TH2F("hCkovAnglevsMom_proton","Cherenkov angle vs momnetum for protons",500,0,5.,500,0,1);\r
1250 fListQAtofhmpid->Add(hCkovAnglevsMomProton);\r
1251 \r
1252 \r
1253} \r
1254\r
1255//______________________________________________________________________________\r
1256void AliAnalysisTaskPIDqa::SetupTPCTOFqa()\r
1257{\r
1258 //\r
1259 // Create the qa objects for TPC + TOF combination\r
1260 //\r
1261 \r
1262 TVectorD *vX=MakeLogBinning(200,.1,30);\r
1263\r
1264 //TPC signals after TOF cut\r
00a38d07 1265 for (Int_t ispecie=0; ispecie<AliPID::kSPECIESC; ++ispecie){\r
f25dc3ef 1266 TH2F *hNsigmaP = new TH2F(Form("hNsigmaP_TPC_TOF_%s",AliPID::ParticleName(ispecie)),\r
1267 Form("TPC n#sigma %s vs. p (after TOF 3#sigma cut);p_{TPC} [GeV]; n#sigma",AliPID::ParticleName(ispecie)),\r
1268 vX->GetNrows()-1,vX->GetMatrixArray(),\r
1269 200,-10,10);\r
1270 fListQAtpctof->Add(hNsigmaP);\r
1271 }\r
1272\r
1273 //TOF signals after TPC cut\r
00a38d07 1274 for (Int_t ispecie=0; ispecie<AliPID::kSPECIESC; ++ispecie){\r
f25dc3ef 1275 TH2F *hNsigmaP = new TH2F(Form("hNsigmaP_TOF_TPC_%s",AliPID::ParticleName(ispecie)),\r
1276 Form("TOF n#sigma %s vs. p (after TPC n#sigma cut);p [GeV]; n#sigma",AliPID::ParticleName(ispecie)),\r
1277 vX->GetNrows()-1,vX->GetMatrixArray(),\r
1278 200,-10,10);\r
1279 fListQAtpctof->Add(hNsigmaP);\r
1280 }\r
1281\r
1282 //EMCAL signal after TOF and TPC cut\r
1283 for (Int_t ispecie=0; ispecie<AliPID::kSPECIES; ++ispecie){\r
1284 TH2F *heopPt = new TH2F(Form("heopPt_TOF_TPC_%s",AliPID::ParticleName(ispecie)),\r
1285 Form("EMCAL signal (E/p) %s vs. p_{T};p_{T} [GeV]; EMCAL signal (E/p) [arb. units]",AliPID::ParticleName(ispecie)),\r
1286 vX->GetNrows()-1,vX->GetMatrixArray(),\r
1287 200,0,2);\r
1288 fListQAtpctof->Add(heopPt);\r
1289 }\r
1290\r
1291 delete vX;\r
1292}\r
11fd38f5 1293//______________________________________________________________________________\r
1294void AliAnalysisTaskPIDqa::SetupV0qa()\r
1295{\r
1296 //\r
1297 // Create the qa objects for V0 Kine cuts\r
1298 //\r
1299 \r
1300 TH2F *hArmenteros = new TH2F("hArmenteros", "Armenteros plot",200,-1.,1.,200,0.,0.4);\r
1301 fListQAV0->Add(hArmenteros);\r
1302 \r
1303}\r
f25dc3ef 1304\r
324348e5 1305//_____________________________________________________________________________\r
1306void AliAnalysisTaskPIDqa::SetupQAinfo(){\r
1307 //\r
1308 // Setup the info of QA objects\r
1309 //\r
1310\r
1311 TObjArray *arr=new TObjArray;\r
1312 arr->SetName("TPC_info");\r
1313 fListQAinfo->Add(arr);\r
1314}\r
1315\r
f25dc3ef 1316//______________________________________________________________________________\r
1317TVectorD* AliAnalysisTaskPIDqa::MakeLogBinning(Int_t nbinsX, Double_t xmin, Double_t xmax)\r
1318{\r
1319 //\r
1320 // Make logarithmic binning\r
1321 // the user has to delete the array afterwards!!!\r
1322 //\r
1323 \r
1324 //check limits\r
1325 if (xmin<1e-20 || xmax<1e-20){\r
1326 AliError("For Log binning xmin and xmax must be > 1e-20. Using linear binning instead!");\r
1327 return MakeLinBinning(nbinsX, xmin, xmax);\r
1328 }\r
1329 if (xmax<xmin){\r
1330 Double_t tmp=xmin;\r
1331 xmin=xmax;\r
1332 xmax=tmp;\r
1333 }\r
1334 TVectorD *binLim=new TVectorD(nbinsX+1);\r
1335 Double_t first=xmin;\r
1336 Double_t last=xmax;\r
1337 Double_t expMax=TMath::Log(last/first);\r
1338 for (Int_t i=0; i<nbinsX+1; ++i){\r
1339 (*binLim)[i]=first*TMath::Exp(expMax/nbinsX*(Double_t)i);\r
1340 }\r
1341 return binLim;\r
1342}\r
1343\r
1344//______________________________________________________________________________\r
1345TVectorD* AliAnalysisTaskPIDqa::MakeLinBinning(Int_t nbinsX, Double_t xmin, Double_t xmax)\r
1346{\r
1347 //\r
1348 // Make linear binning\r
1349 // the user has to delete the array afterwards!!!\r
1350 //\r
1351 if (xmax<xmin){\r
1352 Double_t tmp=xmin;\r
1353 xmin=xmax;\r
1354 xmax=tmp;\r
1355 }\r
1356 TVectorD *binLim=new TVectorD(nbinsX+1);\r
1357 Double_t first=xmin;\r
1358 Double_t last=xmax;\r
1359 Double_t binWidth=(last-first)/nbinsX;\r
1360 for (Int_t i=0; i<nbinsX+1; ++i){\r
1361 (*binLim)[i]=first+binWidth*(Double_t)i;\r
1362 }\r
1363 return binLim;\r
1364}\r
1365\r
1366//_____________________________________________________________________________\r
1367TVectorD* AliAnalysisTaskPIDqa::MakeArbitraryBinning(const char* bins)\r
1368{\r
1369 //\r
1370 // Make arbitrary binning, bins separated by a ','\r
1371 //\r
1372 TString limits(bins);\r
1373 if (limits.IsNull()){\r
1374 AliError("Bin Limit string is empty, cannot add the variable");\r
1375 return 0x0;\r
1376 }\r
1377 \r
1378 TObjArray *arr=limits.Tokenize(",");\r
1379 Int_t nLimits=arr->GetEntries();\r
1380 if (nLimits<2){\r
1381 AliError("Need at leas 2 bin limits, cannot add the variable");\r
1382 delete arr;\r
1383 return 0x0;\r
1384 }\r
1385 \r
1386 TVectorD *binLimits=new TVectorD(nLimits);\r
1387 for (Int_t iLim=0; iLim<nLimits; ++iLim){\r
1388 (*binLimits)[iLim]=(static_cast<TObjString*>(arr->At(iLim)))->GetString().Atof();\r
1389 }\r
1390 \r
1391 delete arr;\r
1392 return binLimits;\r
1393}\r
1394\r