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