1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial pures 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 pure. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
18 // AliAnalysisTaskPIDflowQA:
21 //origin: Marek Chojnacki, Marek.Chojnacki@cern.ch
22 //modified: Mikolaj Krzewicki, Mikolaj.Krzewicki@cern.ch
26 #include "AliAnalysisTaskPIDflowQA.h"
27 #include "AliAnalysisManager.h"
28 #include "AliESDEvent.h"
30 #include "AliMCEvent.h"
35 #include "AliVEvent.h"
37 #include "AliCDBManager.h"
38 #include "AliFlowEventCuts.h"
39 #include "AliFlowTrackCuts.h"
40 #include "AliVEventHandler.h"
41 #include "AliInputEventHandler.h"
45 ClassImp( AliAnalysisTaskPIDflowQA)
47 //________________________________________________________________________
48 AliAnalysisTaskPIDflowQA:: AliAnalysisTaskPIDflowQA():
49 AliAnalysisTaskSE("AliAnalysisTaskPIDflowQA"),
54 fUseDebugFile(kFALSE),
89 fTOFrawinvbetaE(NULL),
90 fTOFrawinvbetaPi(NULL),
91 fTOFrawinvbetaK(NULL),
92 fTOFrawinvbetaP(NULL),
95 fTPCvsGlobalMult(NULL),
96 fStandardGlobalCuts(NULL),
97 fStandardTPCCuts(NULL),
98 fCutsTOFbetaElectrons(NULL),
99 fCutsTOFbetaPions(NULL),
100 fCutsTOFbetaKaons(NULL),
101 fCutsTOFbetaProtons(NULL),
102 fCutsTOFbetaSimpleElectrons(NULL),
103 fCutsTOFbetaSimplePions(NULL),
104 fCutsTOFbetaSimpleKaons(NULL),
105 fCutsTOFbetaSimpleProtons(NULL),
106 fCutsTOFbayesianElectrons(NULL),
107 fCutsTOFbayesianPions(NULL),
108 fCutsTOFbayesianKaons(NULL),
109 fCutsTOFbayesianProtons(NULL),
110 fCutsTPCdedxElectrons(NULL),
111 fCutsTPCdedxPions(NULL),
112 fCutsTPCdedxKaons(NULL),
113 fCutsTPCdedxProtons(NULL),
114 fCutsTPCpidElectrons(NULL),
115 fCutsTPCpidPions(NULL),
116 fCutsTPCpidKaons(NULL),
117 fCutsTPCpidProtons(NULL),
118 fCutsTPCbayesianElectrons(NULL),
119 fCutsTPCbayesianPions(NULL),
120 fCutsTPCbayesianKaons(NULL),
121 fCutsTPCbayesianProtons(NULL),
122 fCutsMCelectrons(NULL),
125 fCutsMCprotons(NULL),
126 fCutsMCprimaryelectrons(NULL),
127 fCutsMCprimarypions(NULL),
128 fCutsMCprimarykaons(NULL),
129 fCutsMCprimaryprotons(NULL),
135 //________________________________________________________________________
136 AliAnalysisTaskPIDflowQA:: AliAnalysisTaskPIDflowQA(const char *name):
137 AliAnalysisTaskSE(name),
142 fUseDebugFile(kFALSE),
148 fTPCsignalPimc(NULL),
176 fTOFrawinvbeta(NULL),
177 fTOFrawinvbetaE(NULL),
178 fTOFrawinvbetaPi(NULL),
179 fTOFrawinvbetaK(NULL),
180 fTOFrawinvbetaP(NULL),
183 fTPCvsGlobalMult(NULL),
184 fStandardGlobalCuts(NULL),
185 fStandardTPCCuts(NULL),
186 fCutsTOFbetaElectrons(NULL),
187 fCutsTOFbetaPions(NULL),
188 fCutsTOFbetaKaons(NULL),
189 fCutsTOFbetaProtons(NULL),
190 fCutsTOFbetaSimpleElectrons(NULL),
191 fCutsTOFbetaSimplePions(NULL),
192 fCutsTOFbetaSimpleKaons(NULL),
193 fCutsTOFbetaSimpleProtons(NULL),
194 fCutsTOFbayesianElectrons(NULL),
195 fCutsTOFbayesianPions(NULL),
196 fCutsTOFbayesianKaons(NULL),
197 fCutsTOFbayesianProtons(NULL),
198 fCutsTPCdedxElectrons(NULL),
199 fCutsTPCdedxPions(NULL),
200 fCutsTPCdedxKaons(NULL),
201 fCutsTPCdedxProtons(NULL),
202 fCutsTPCpidElectrons(NULL),
203 fCutsTPCpidPions(NULL),
204 fCutsTPCpidKaons(NULL),
205 fCutsTPCpidProtons(NULL),
206 fCutsTPCbayesianElectrons(NULL),
207 fCutsTPCbayesianPions(NULL),
208 fCutsTPCbayesianKaons(NULL),
209 fCutsTPCbayesianProtons(NULL),
210 fCutsMCelectrons(NULL),
213 fCutsMCprotons(NULL),
214 fCutsMCprimaryelectrons(NULL),
215 fCutsMCprimarypions(NULL),
216 fCutsMCprimarykaons(NULL),
217 fCutsMCprimaryprotons(NULL),
221 fESDpid=new AliESDpid();
224 fESDpid->GetTPCResponse().SetBetheBlochParameters(0.0283086,
230 //fESDpid->GetTPCResponse().SetBetheBlochParameters(1.28949/50.,
232 // TMath::Exp(-3.21763e+01),
236 DefineOutput(1, TList::Class());
239 //________________________________________________________________________
240 void AliAnalysisTaskPIDflowQA::UserCreateOutputObjects()
242 //UserCreateOutputObject
243 if (fOutputList) fOutputList->Delete();
245 fOutputList=new TList();
246 fOutputList->SetOwner(kTRUE);
250 const Int_t npredec=50;
251 Double_t tabx[ndec*npredec+1];
252 for (Int_t i=0; i<ndec; i++)
254 for (Int_t j=0; j<npredec; j++)
256 tabx[npredec*i+j]=TMath::Power(10,((Double_t)i)+((Double_t)startvalue)+((Double_t)j)/((Double_t)npredec));
259 tabx[ndec*npredec]=TMath::Power(10,ndec+startvalue);
262 Double_t binsPtDummy[kPtBins+1];
264 for(int i=1; i<=kPtBins+1; i++)
266 if(binsPtDummy[i-1]+0.05<1.01)
267 binsPtDummy[i]=binsPtDummy[i-1]+0.05;
269 binsPtDummy[i]=binsPtDummy[i-1]+0.1;
273 Double_t binsPDummy[kPBins+1];
275 for(int i=1; i<=kPBins+1; i++)
277 if(binsPDummy[i-1]+0.05<1.01)
278 binsPDummy[i]=binsPDummy[i-1]+0.05;
280 binsPDummy[i]=binsPDummy[i-1]+0.1;
283 fTPCsignal=new TH2F("fTPCsignal",";p [GeV/c];dEdx",kPBins,binsPDummy,500,0,500);
284 fOutputList->Add(fTPCsignal);
285 fTPCsignalPi=new TH2F("fTPCsignalPi",";p [GeV/c];signal",kPBins,binsPDummy,500,-2,2);//TPC PID signal as function of p for pi+
286 fTPCsignalK=new TH2F("fTPCsignalK",";p [GeV/c];signal",kPBins,binsPDummy,500,-2,2);//TPC PID signal as function of p for K+
287 fTPCsignalP=new TH2F("fTPCsignalP",";p [GeV/c];signal",kPBins,binsPDummy,500,-2,2);//TPC PID signal as function of p for p
288 fOutputList->Add(fTPCsignalPi);
289 fOutputList->Add(fTPCsignalK);
290 fOutputList->Add(fTPCsignalP);
292 fTOFtime=new TH2F("fTOFtime",";p[GeV/c];#time",kPBins,binsPDummy,1000, 12000, 80000);//
293 fOutputList->Add(fTOFtime);
294 fTOFtimeE=new TH2F("fTOFtimeE",";p [GeV/c];#time-#time_{#pi}",kPBins,binsPDummy,1000, -8000, 8000);//
295 fTOFtimePi=new TH2F("fTOFtimePi",";p [GeV/c];#time-#time_{#pi}",kPBins,binsPDummy,1000, -8000, 8000);//
296 fTOFtimeK=new TH2F("fTOFtimeK",";p [GeV/c];#time-#time_{K}",kPBins,binsPDummy,1000, -8000, 8000);//
297 fTOFtimeP=new TH2F("fTOFtimeP",";p [GeV/c];#time-#time_{p}",kPBins,binsPDummy,1000, -8000, 8000);//
298 fOutputList->Add(fTOFtimeE);
299 fOutputList->Add(fTOFtimePi);
300 fOutputList->Add(fTOFtimeK);
301 fOutputList->Add(fTOFtimeP);
303 fTOFbeta=new TH2F("fTOFbeta",";p[GeV/c];#beta",kPBins,binsPDummy,1000, 0.4, 1.1);//
304 fOutputList->Add(fTOFbeta);
305 fTOFbetaE=new TH2F("fTOFbetaE",";p [GeV/c];#beta-#beta_{#pi}",kPBins,binsPDummy,1000, -0.25, 0.25);//
306 fTOFbetaPi=new TH2F("fTOFbetaPi",";p [GeV/c];#beta-#beta_{#pi}",kPBins,binsPDummy,1000, -0.25, 0.25);//
307 fTOFbetaK=new TH2F("fTOFbetaK",";p [GeV/c];#beta-#beta_{K}",kPBins,binsPDummy,1000, -0.25, 0.25);//
308 fTOFbetaP=new TH2F("fTOFbetaP",";p [GeV/c];#beta-#beta_{p}",kPBins,binsPDummy,1000, -0.25, 0.25);//
309 fOutputList->Add(fTOFbetaE);
310 fOutputList->Add(fTOFbetaPi);
311 fOutputList->Add(fTOFbetaK);
312 fOutputList->Add(fTOFbetaP);
314 fTOFinvbeta=new TH2F("fTOFinvbeta",";p[GeV/c];1/#beta",kPBins,binsPDummy,1000, 0.90, 2.5);//
315 fOutputList->Add(fTOFinvbeta);
316 fTOFinvbetaE=new TH2F("fTOFinvbetaE",";p [GeV/c];1/#beta-1/#beta_{#pi}",kPBins,binsPDummy,1000, -0.3, 0.3);//
317 fTOFinvbetaPi=new TH2F("fTOFinvbetaPi",";p [GeV/c];1/#beta-1/#beta_{#pi}",kPBins,binsPDummy,1000, -0.3, 0.3);//
318 fTOFinvbetaK=new TH2F("fTOFinvbetaK",";p [GeV/c];1/#beta-1/#beta_{K}",kPBins,binsPDummy,1000, -0.3, 0.3);//
319 fTOFinvbetaP=new TH2F("fTOFinvbetaP",";p [GeV/c];1/#beta-1/#beta_{p}",kPBins,binsPDummy,1000, -0.3, 0.3);//
320 fOutputList->Add(fTOFinvbetaE);
321 fOutputList->Add(fTOFinvbetaPi);
322 fOutputList->Add(fTOFinvbetaK);
323 fOutputList->Add(fTOFinvbetaP);
325 fTOFrawtime=new TH2F("fTOFrawtime",";p[GeV/c];#time",kPBins,binsPDummy,1000, 12000, 80000);//
326 fOutputList->Add(fTOFrawtime);
327 fTOFrawtimeE=new TH2F("fTOFrawtimeE",";p [GeV/c];#time-#time_{#pi}",kPBins,binsPDummy,1000, -8000, 8000);//
328 fTOFrawtimePi=new TH2F("fTOFrawtimePi",";p [GeV/c];#time-#time_{#pi}",kPBins,binsPDummy,1000, -8000, 8000);//
329 fTOFrawtimeK=new TH2F("fTOFrawtimeK",";p [GeV/c];#time-#time_{K}",kPBins,binsPDummy,1000, -8000, 8000);//
330 fTOFrawtimeP=new TH2F("fTOFrawtimeP",";p [GeV/c];#time-#time_{p}",kPBins,binsPDummy,1000, -8000, 8000);//
331 fOutputList->Add(fTOFrawtimeE);
332 fOutputList->Add(fTOFrawtimePi);
333 fOutputList->Add(fTOFrawtimeK);
334 fOutputList->Add(fTOFrawtimeP);
336 fTOFrawbeta=new TH2F("fTOFrawbeta",";p[GeV/c];#beta",kPBins,binsPDummy,1000, 0.4, 1.1);//
337 fOutputList->Add(fTOFrawbeta);
338 fTOFrawbetaE=new TH2F("fTOFrawbetaE",";p [GeV/c];#beta-#beta_{#pi}",kPBins,binsPDummy,1000, -0.25, 0.25);//
339 fTOFrawbetaPi=new TH2F("fTOFrawbetaPi",";p [GeV/c];#beta-#beta_{#pi}",kPBins,binsPDummy,1000, -0.25, 0.25);//
340 fTOFrawbetaK=new TH2F("fTOFrawbetaK",";p [GeV/c];#beta-#beta_{K}",kPBins,binsPDummy,1000, -0.25, 0.25);//
341 fTOFrawbetaP=new TH2F("fTOFrawbetaP",";p [GeV/c];#beta-#beta_{p}",kPBins,binsPDummy,1000, -0.25, 0.25);//
342 fOutputList->Add(fTOFrawbetaE);
343 fOutputList->Add(fTOFrawbetaPi);
344 fOutputList->Add(fTOFrawbetaK);
345 fOutputList->Add(fTOFrawbetaP);
347 fTOFrawinvbeta=new TH2F("fTOFrawinvbeta",";p[GeV/c];1/#beta",kPBins,binsPDummy,1000, 0.90, 2.5);//
348 fOutputList->Add(fTOFrawinvbeta);
349 fTOFrawinvbetaE=new TH2F("fTOFrawinvbetaE",";p [GeV/c];1/#beta-1/#beta_{#pi}",kPBins,binsPDummy,1000, -0.3, 0.3);//
350 fTOFrawinvbetaPi=new TH2F("fTOFrawinvbetaPi",";p [GeV/c];1/#beta-1/#beta_{#pi}",kPBins,binsPDummy,1000, -0.3, 0.3);//
351 fTOFrawinvbetaK=new TH2F("fTOFrawinvbetaK",";p [GeV/c];1/#beta-1/#beta_{K}",kPBins,binsPDummy,1000, -0.3, 0.3);//
352 fTOFrawinvbetaP=new TH2F("fTOFrawinvbetaP",";p [GeV/c];1/#beta-1/#beta_{p}",kPBins,binsPDummy,1000, -0.3, 0.3);//
353 fOutputList->Add(fTOFrawinvbetaE);
354 fOutputList->Add(fTOFrawinvbetaPi);
355 fOutputList->Add(fTOFrawinvbetaK);
356 fOutputList->Add(fTOFrawinvbetaP);
358 fPvsPt=new TH2F("fPvsPt","p vs p_{t};p [GeV/c];p_{t} [GeV/c]",kPBins,binsPDummy,kPtBins,binsPtDummy);
359 fOutputList->Add(fPvsPt);
361 fMeanPvsP = new TProfile("fMeanPvsP","Mean P vs P;p [Gev/c];<p> [GeV/c]",kPBins,binsPDummy);
362 fOutputList->Add(fMeanPvsP);
364 fTPCvsGlobalMult = new TH2F("fTPCvsGlobalMult","TPC only vs Global track multiplicity;global;TPC only",500,0,2500,500,0,3500);
365 fOutputList->Add(fTPCvsGlobalMult);
367 fStandardGlobalCuts = AliFlowTrackCuts::GetStandardGlobalTrackCuts2010();
368 fStandardTPCCuts = AliFlowTrackCuts::GetStandardTPCStandaloneTrackCuts2010();
370 fCutsTOFbetaElectrons = new AliFlowTrackCuts("TOFbeta e");
371 fCutsTOFbetaElectrons->SetPID(AliPID::kElectron, AliFlowTrackCuts::kTOFbeta);
372 fCutsTOFbetaElectrons->SetRequireStrictTOFTPCagreement();
373 fCutsTOFbetaElectrons->SetQA();
374 fCutsTOFbetaPions = new AliFlowTrackCuts("TOFbeta pi");
375 fCutsTOFbetaPions->SetPID(AliPID::kPion, AliFlowTrackCuts::kTOFbeta);
376 fCutsTOFbetaPions->SetRequireStrictTOFTPCagreement();
377 fCutsTOFbetaPions->SetQA();
378 fCutsTOFbetaKaons = new AliFlowTrackCuts("TOFbeta K");
379 fCutsTOFbetaKaons->SetPID(AliPID::kKaon, AliFlowTrackCuts::kTOFbeta);
380 fCutsTOFbetaKaons->SetRequireStrictTOFTPCagreement();
381 fCutsTOFbetaKaons->SetQA();
382 fCutsTOFbetaProtons = new AliFlowTrackCuts("TOFbeta p");
383 fCutsTOFbetaProtons->SetPID(AliPID::kProton, AliFlowTrackCuts::kTOFbeta);
384 fCutsTOFbetaProtons->SetRequireStrictTOFTPCagreement();
385 fCutsTOFbetaProtons->SetQA();
387 fCutsTOFbetaSimpleElectrons = new AliFlowTrackCuts("TOFbetaSimple e");
388 fCutsTOFbetaSimpleElectrons->SetPID(AliPID::kElectron, AliFlowTrackCuts::kTOFbetaSimple);
389 fCutsTOFbetaSimpleElectrons->SetRequireStrictTOFTPCagreement();
390 fCutsTOFbetaSimpleElectrons->SetQA();
391 fCutsTOFbetaSimplePions = new AliFlowTrackCuts("TOFbetaSimple pi");
392 fCutsTOFbetaSimplePions->SetPID(AliPID::kPion, AliFlowTrackCuts::kTOFbetaSimple);
393 fCutsTOFbetaSimplePions->SetRequireStrictTOFTPCagreement();
394 fCutsTOFbetaSimplePions->SetQA();
395 fCutsTOFbetaSimpleKaons = new AliFlowTrackCuts("TOFbetaSimple K");
396 fCutsTOFbetaSimpleKaons->SetPID(AliPID::kKaon, AliFlowTrackCuts::kTOFbetaSimple);
397 fCutsTOFbetaSimpleKaons->SetRequireStrictTOFTPCagreement();
398 fCutsTOFbetaSimpleKaons->SetQA();
399 fCutsTOFbetaSimpleProtons = new AliFlowTrackCuts("TOFbetaSimple p");
400 fCutsTOFbetaSimpleProtons->SetPID(AliPID::kProton, AliFlowTrackCuts::kTOFbetaSimple);
401 fCutsTOFbetaSimpleProtons->SetRequireStrictTOFTPCagreement();
402 fCutsTOFbetaSimpleProtons->SetQA();
404 fCutsTOFbayesianElectrons = new AliFlowTrackCuts("TOFbayesian e");
405 fCutsTOFbayesianElectrons->SetPID(AliPID::kElectron, AliFlowTrackCuts::kTOFbayesian);
406 fCutsTOFbayesianElectrons->SetRequireStrictTOFTPCagreement();
407 fCutsTOFbayesianElectrons->SetQA();
408 fCutsTOFbayesianPions = new AliFlowTrackCuts("TOFbayesian pi");
409 fCutsTOFbayesianPions->SetPID(AliPID::kPion, AliFlowTrackCuts::kTOFbayesian);
410 fCutsTOFbayesianPions->SetRequireStrictTOFTPCagreement();
411 fCutsTOFbayesianPions->SetQA();
412 fCutsTOFbayesianKaons = new AliFlowTrackCuts("TOFbayesian K");
413 fCutsTOFbayesianKaons->SetPID(AliPID::kKaon, AliFlowTrackCuts::kTOFbayesian);
414 fCutsTOFbayesianKaons->SetRequireStrictTOFTPCagreement();
415 fCutsTOFbayesianKaons->SetQA();
416 fCutsTOFbayesianProtons = new AliFlowTrackCuts("TOFbayesian p");
417 fCutsTOFbayesianProtons->SetPID(AliPID::kProton, AliFlowTrackCuts::kTOFbayesian);
418 fCutsTOFbayesianProtons->SetRequireStrictTOFTPCagreement();
419 fCutsTOFbayesianProtons->SetQA();
421 fCutsTPCdedxElectrons = new AliFlowTrackCuts("TPCdedx e");
422 fCutsTPCdedxElectrons->SetPID(AliPID::kElectron, AliFlowTrackCuts::kTPCdedx);
423 fCutsTPCdedxElectrons->SetQA();
424 fCutsTPCdedxPions = new AliFlowTrackCuts("TPCdedx pi");
425 fCutsTPCdedxPions->SetPID(AliPID::kPion, AliFlowTrackCuts::kTPCdedx);
426 fCutsTPCdedxPions->SetQA();
427 fCutsTPCdedxKaons = new AliFlowTrackCuts("TPCdedx K");
428 fCutsTPCdedxKaons->SetPID(AliPID::kKaon, AliFlowTrackCuts::kTPCdedx);
429 fCutsTPCdedxKaons->SetQA();
430 fCutsTPCdedxProtons = new AliFlowTrackCuts("TPCdedx p");
431 fCutsTPCdedxProtons->SetPID(AliPID::kProton, AliFlowTrackCuts::kTPCdedx);
432 fCutsTPCdedxProtons->SetQA();
434 fCutsTPCpidElectrons = new AliFlowTrackCuts("TPCpid e");
435 fCutsTPCpidElectrons->SetPID(AliPID::kElectron, AliFlowTrackCuts::kTPCpid);
436 fCutsTPCpidElectrons->SetQA();
437 fCutsTPCpidPions = new AliFlowTrackCuts("TPCpid pi");
438 fCutsTPCpidPions->SetPID(AliPID::kPion, AliFlowTrackCuts::kTPCpid);
439 fCutsTPCpidPions->SetQA();
440 fCutsTPCpidKaons = new AliFlowTrackCuts("TPCpid K");
441 fCutsTPCpidKaons->SetPID(AliPID::kKaon, AliFlowTrackCuts::kTPCpid);
442 fCutsTPCpidKaons->SetQA();
443 fCutsTPCpidProtons = new AliFlowTrackCuts("TPCpid p");
444 fCutsTPCpidProtons->SetPID(AliPID::kProton, AliFlowTrackCuts::kTPCpid);
445 fCutsTPCpidProtons->SetQA();
447 fCutsTPCbayesianElectrons = new AliFlowTrackCuts("TPCbayesian e");
448 fCutsTPCbayesianElectrons->SetPID(AliPID::kElectron, AliFlowTrackCuts::kTPCbayesian);
449 fCutsTPCbayesianElectrons->SetQA();
450 fCutsTPCbayesianPions = new AliFlowTrackCuts("TPCbayesian pi");
451 fCutsTPCbayesianPions->SetPID(AliPID::kPion, AliFlowTrackCuts::kTPCbayesian);
452 fCutsTPCbayesianPions->SetQA();
453 fCutsTPCbayesianKaons = new AliFlowTrackCuts("TPCbayesian K");
454 fCutsTPCbayesianKaons->SetPID(AliPID::kKaon, AliFlowTrackCuts::kTPCbayesian);
455 fCutsTPCbayesianKaons->SetQA();
456 fCutsTPCbayesianProtons = new AliFlowTrackCuts("TPCbayesian p");
457 fCutsTPCbayesianProtons->SetPID(AliPID::kProton, AliFlowTrackCuts::kTPCbayesian);
458 fCutsTPCbayesianProtons->SetQA();
460 fCutsMCelectrons=new AliFlowTrackCuts("MC e");
461 fCutsMCelectrons->SetMCPID(11);
462 fCutsMCelectrons->SetIgnoreSignInMCPID();
463 fCutsMCelectrons->SetQA();
464 fCutsMCpions=new AliFlowTrackCuts("MC pi");
465 fCutsMCpions->SetMCPID(211);
466 fCutsMCpions->SetIgnoreSignInMCPID();
467 fCutsMCpions->SetQA();
468 fCutsMCkaons=new AliFlowTrackCuts("MC K");
469 fCutsMCkaons->SetMCPID(321);
470 fCutsMCkaons->SetIgnoreSignInMCPID();
471 fCutsMCkaons->SetQA();
472 fCutsMCprotons=new AliFlowTrackCuts("MC p");
473 fCutsMCprotons->SetMCPID(2212);
474 fCutsMCprotons->SetIgnoreSignInMCPID();
475 fCutsMCprotons->SetQA();
477 fCutsMCprimaryelectrons=new AliFlowTrackCuts("MCprimary e");
478 fCutsMCprimaryelectrons->SetMCPID(11);
479 fCutsMCprimaryelectrons->SetIgnoreSignInMCPID();
480 fCutsMCprimaryelectrons->SetMCisPrimary();
481 fCutsMCprimaryelectrons->SetQA();
482 fCutsMCprimarypions=new AliFlowTrackCuts("MCprimary pi");
483 fCutsMCprimarypions->SetMCPID(211);
484 fCutsMCprimarypions->SetIgnoreSignInMCPID();
485 fCutsMCprimarypions->SetMCisPrimary();
486 fCutsMCprimarypions->SetQA();
487 fCutsMCprimarykaons=new AliFlowTrackCuts("MCprimary K");
488 fCutsMCprimarykaons->SetMCPID(321);
489 fCutsMCprimarykaons->SetIgnoreSignInMCPID();
490 fCutsMCprimarykaons->SetMCisPrimary();
491 fCutsMCprimarykaons->SetQA();
492 fCutsMCprimaryprotons=new AliFlowTrackCuts("MCprimary p");
493 fCutsMCprimaryprotons->SetMCPID(2212);
494 fCutsMCprimaryprotons->SetIgnoreSignInMCPID();
495 fCutsMCprimaryprotons->SetMCisPrimary();
496 fCutsMCprimaryprotons->SetQA();
498 //fOutputList->Add(fESDpid);
500 fOutputList->Add(fCutsTPCdedxElectrons->GetQA());
501 fOutputList->Add(fCutsTPCdedxPions->GetQA());
502 fOutputList->Add(fCutsTPCdedxKaons->GetQA());
503 fOutputList->Add(fCutsTPCdedxProtons->GetQA());
504 fOutputList->Add(fCutsTPCpidElectrons->GetQA());
505 fOutputList->Add(fCutsTPCpidPions->GetQA());
506 fOutputList->Add(fCutsTPCpidKaons->GetQA());
507 fOutputList->Add(fCutsTPCpidProtons->GetQA());
508 fOutputList->Add(fCutsTPCbayesianElectrons->GetQA());
509 fOutputList->Add(fCutsTPCbayesianPions->GetQA());
510 fOutputList->Add(fCutsTPCbayesianKaons->GetQA());
511 fOutputList->Add(fCutsTPCbayesianProtons->GetQA());
512 fOutputList->Add(fCutsTOFbetaElectrons->GetQA());
513 fOutputList->Add(fCutsTOFbetaPions->GetQA());
514 fOutputList->Add(fCutsTOFbetaKaons->GetQA());
515 fOutputList->Add(fCutsTOFbetaProtons->GetQA());
516 fOutputList->Add(fCutsTOFbetaSimpleElectrons->GetQA());
517 fOutputList->Add(fCutsTOFbetaSimplePions->GetQA());
518 fOutputList->Add(fCutsTOFbetaSimpleKaons->GetQA());
519 fOutputList->Add(fCutsTOFbetaSimpleProtons->GetQA());
520 fOutputList->Add(fCutsTOFbayesianElectrons->GetQA());
521 fOutputList->Add(fCutsTOFbayesianPions->GetQA());
522 fOutputList->Add(fCutsTOFbayesianKaons->GetQA());
523 fOutputList->Add(fCutsTOFbayesianProtons->GetQA());
524 fOutputList->Add(fCutsMCelectrons->GetQA());
525 fOutputList->Add(fCutsMCpions->GetQA());
526 fOutputList->Add(fCutsMCkaons->GetQA());
527 fOutputList->Add(fCutsMCprotons->GetQA());
528 fOutputList->Add(fCutsMCprimaryelectrons->GetQA());
529 fOutputList->Add(fCutsMCprimarypions->GetQA());
530 fOutputList->Add(fCutsMCprimarykaons->GetQA());
531 fOutputList->Add(fCutsMCprimaryprotons->GetQA());
533 if (fUseDebugFile) fFile = fopen("debug.txt","w");
535 PostData(1, fOutputList);
538 //________________________________________________________________________
539 void AliAnalysisTaskPIDflowQA::UserExec(Option_t *)
542 fESD = dynamic_cast<AliESDEvent*> (InputEvent());
545 //do the calibration bit
546 fESDpid->SetTOFResponse(fESD,AliESDpid::kTOF_T0); // to use T0-TOF
547 fESDpid->MakePID(fESD,kFALSE);
549 if(!fCuts || !fEventCuts)
551 Printf("No CUTS Defined.........\n");
552 PostData(1, fOutputList);
556 if (!(fEventCuts->IsSelected(fESD,0x0)))
561 AliStack* stack=NULL;
562 AliMCEvent* mcEvent = MCEvent();
563 if (mcEvent) stack = mcEvent->Stack();
564 if (mcEvent) Printf("MC particles: %d", mcEvent->GetNumberOfTracks());
566 Printf("There are %d tracks in this event", fESD->GetNumberOfTracks());
567 Int_t nTracks=fESD->GetNumberOfTracks();
569 AliESDtrack *trackESD=0;
571 fCuts->SetEvent(fESD,mcEvent);
572 fCutsTPCdedxElectrons->SetEvent(fESD,mcEvent);
573 fCutsTPCdedxPions->SetEvent(fESD,mcEvent);
574 fCutsTPCdedxKaons->SetEvent(fESD,mcEvent);
575 fCutsTPCdedxProtons->SetEvent(fESD,mcEvent);
576 fCutsTPCpidElectrons->SetEvent(fESD,mcEvent);
577 fCutsTPCpidPions->SetEvent(fESD,mcEvent);
578 fCutsTPCpidKaons->SetEvent(fESD,mcEvent);
579 fCutsTPCpidProtons->SetEvent(fESD,mcEvent);
580 fCutsTPCbayesianElectrons->SetEvent(fESD,mcEvent);
581 fCutsTPCbayesianPions->SetEvent(fESD,mcEvent);
582 fCutsTPCbayesianKaons->SetEvent(fESD,mcEvent);
583 fCutsTPCbayesianProtons->SetEvent(fESD,mcEvent);
584 fCutsTOFbetaElectrons->SetEvent(fESD,mcEvent);
585 fCutsTOFbetaPions->SetEvent(fESD,mcEvent);
586 fCutsTOFbetaKaons->SetEvent(fESD,mcEvent);
587 fCutsTOFbetaProtons->SetEvent(fESD,mcEvent);
588 fCutsTOFbetaSimpleElectrons->SetEvent(fESD,mcEvent);
589 fCutsTOFbetaSimplePions->SetEvent(fESD,mcEvent);
590 fCutsTOFbetaSimpleKaons->SetEvent(fESD,mcEvent);
591 fCutsTOFbetaSimpleProtons->SetEvent(fESD,mcEvent);
592 fCutsTOFbayesianElectrons->SetEvent(fESD,mcEvent);
593 fCutsTOFbayesianPions->SetEvent(fESD,mcEvent);
594 fCutsTOFbayesianKaons->SetEvent(fESD,mcEvent);
595 fCutsTOFbayesianProtons->SetEvent(fESD,mcEvent);
596 fCutsMCelectrons->SetEvent(fESD,mcEvent);
597 fCutsMCpions->SetEvent(fESD,mcEvent);
598 fCutsMCkaons->SetEvent(fESD,mcEvent);
599 fCutsMCprotons->SetEvent(fESD,mcEvent);
600 fCutsMCprimaryelectrons->SetEvent(fESD,mcEvent);
601 fCutsMCprimarypions->SetEvent(fESD,mcEvent);
602 fCutsMCprimarykaons->SetEvent(fESD,mcEvent);
603 fCutsMCprimaryprotons->SetEvent(fESD,mcEvent);
605 for(int tr1=0; tr1<nTracks; tr1++)
607 trackESD=fESD->GetTrack(tr1);
608 if (!trackESD) continue;
610 Double_t p=trackESD->GetP();
611 Double_t pt=trackESD->Pt();
613 if(!(fCuts->IsSelected(trackESD))) continue;
616 if(mcEvent) label=trackESD->GetLabel();
621 TParticle* particle2 = stack->Particle(TMath::Abs(label));
622 pdgcode=particle2->GetPdgCode();
626 fMeanPvsP->Fill(p,p);
628 PidTPC(trackESD,pdgcode);
629 PidTOF(trackESD,pdgcode);
632 //for (Int_t imc=0; imc<(mcEvent!=NULL)?mcEvent->GetNumberOfTracks():0;imc++)
635 for (Int_t imc=0; imc<mcEvent->GetNumberOfTracks();imc++)
637 printf("imc: %i label:%i\n",imc,mcEvent->GetTrack(imc)->GetLabel());
638 fCutsMCelectrons->IsSelected(mcEvent->GetTrack(imc));
639 fCutsMCpions->IsSelected(mcEvent->GetTrack(imc));
640 fCutsMCkaons->IsSelected(mcEvent->GetTrack(imc));
641 fCutsMCprotons->IsSelected(mcEvent->GetTrack(imc));
642 fCutsMCprimaryelectrons->IsSelected(mcEvent->GetTrack(imc));
643 fCutsMCprimarypions->IsSelected(mcEvent->GetTrack(imc));
644 fCutsMCprimarykaons->IsSelected(mcEvent->GetTrack(imc));
645 fCutsMCprimaryprotons->IsSelected(mcEvent->GetTrack(imc));
649 //check the correlation between the global and TPConly number of tracks
650 fStandardGlobalCuts->SetEvent(fESD);
651 fStandardTPCCuts->SetEvent(fESD);
652 Int_t multGlobal = fStandardGlobalCuts->Count();
653 Int_t multTPC = fStandardTPCCuts->Count();
654 fTPCvsGlobalMult->Fill(multGlobal,multTPC);
658 const AliESDVertex* pvtx = fESD->GetPrimaryVertex();
659 const AliESDVertex* tpcvtx = fESD->GetPrimaryVertexTPC();
660 const AliESDVertex* spdvtx = fESD->GetPrimaryVertexSPD();
661 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
662 AliVEventHandler* handler = mgr->GetInputEventHandler();
663 TTree* tree = handler->GetTree();
664 TFile* file = tree->GetCurrentFile();
665 if (multTPC>(23+1.216*multGlobal) || multTPC<(-20+1.087*multGlobal))
667 fprintf(fFile, "%i %i %s %i\n",multTPC,multGlobal,file->GetName(),fESD->GetEventNumberInFile());
668 fprintf(fFile, " primary vertex: x: %.2f, y: %.2f, z: %.2f, n: %i\n", pvtx->GetX(), pvtx->GetY(), pvtx->GetZ(), pvtx->GetNContributors());
669 fprintf(fFile, " SPD vertex: x: %.2f, y: %.2f, z: %.2f, n: %i\n", spdvtx->GetX(), spdvtx->GetY(), spdvtx->GetZ(), spdvtx->GetNContributors());
670 fprintf(fFile, " TPC vertex: x: %.2f, y: %.2f, z: %.2f, n: %i\n", tpcvtx->GetX(), tpcvtx->GetY(), tpcvtx->GetZ(), tpcvtx->GetNContributors());
675 //________________________________________________________________________
676 void AliAnalysisTaskPIDflowQA::Terminate(Option_t *)
682 Printf("AliAnalysisTaskPIDflowQA: end of Terminate");
686 //________________________________________________________________________
687 void AliAnalysisTaskPIDflowQA::PidTPC(AliESDtrack* t, Int_t)
690 const AliExternalTrackParam* innerParam = t->GetInnerParam();
691 if (!innerParam) return;
692 Double_t pinTPCglobal=innerParam->GetP();
693 Double_t tpcSignal =t->GetTPCsignal();
694 Float_t p=innerParam->P();
695 Float_t sigPion = fESDpid->GetTPCResponse().GetExpectedSignal(pinTPCglobal, AliPID::kPion);
696 Float_t sigKaon = fESDpid->GetTPCResponse().GetExpectedSignal(pinTPCglobal, AliPID::kKaon);
697 Float_t sigProton = fESDpid->GetTPCResponse().GetExpectedSignal(pinTPCglobal, AliPID::kProton);
698 if(!(sigPion>0.0&&sigKaon>0.0&&sigProton>0.0))
701 fTPCsignal->Fill(pinTPCglobal,tpcSignal);
703 fTPCsignalPi->Fill(p,(tpcSignal-sigPion)/sigPion);
704 fTPCsignalK->Fill(p,(tpcSignal-sigKaon)/sigKaon);
705 fTPCsignalP->Fill(p,(tpcSignal-sigProton)/sigProton);
707 fCutsTPCdedxElectrons->IsSelected(t);
708 fCutsTPCdedxPions->IsSelected(t);
709 fCutsTPCdedxKaons->IsSelected(t);
710 fCutsTPCdedxProtons->IsSelected(t);
711 fCutsTPCpidElectrons->IsSelected(t);
712 fCutsTPCpidPions->IsSelected(t);
713 fCutsTPCpidKaons->IsSelected(t);
714 fCutsTPCpidProtons->IsSelected(t);
715 fCutsTPCbayesianElectrons->IsSelected(t);
716 fCutsTPCbayesianPions->IsSelected(t);
717 fCutsTPCbayesianKaons->IsSelected(t);
718 fCutsTPCbayesianProtons->IsSelected(t);
721 //______________________________________________________________________________
722 void AliAnalysisTaskPIDflowQA::PidTOF(AliESDtrack* track, Int_t)
725 Bool_t goodtrack = (track) &&
726 (track->GetStatus() & AliESDtrack::kTOFpid) &&
727 (track->GetTOFsignal() > 12000) &&
728 (track->GetTOFsignal() < 100000) &&
729 (track->GetIntegratedLength() > 365);
731 if (!goodtrack) return;
733 const Float_t c = 2.99792457999999984e-02;
734 Float_t p = track->GetP();
735 Float_t l = track->GetIntegratedLength();
736 Float_t trackT0 = fESDpid->GetTOFResponse().GetStartTime(p);
738 Float_t timeTOF = track->GetTOFsignal()- trackT0;
739 Double_t integratedTimes[5] = {-1.0,-1.0,-1.0,-1.0,-1.0};
740 track->GetIntegratedTimes(integratedTimes);
742 Float_t beta = l/timeTOF/c;
743 Float_t betaHypothesis[5] = {0.0,0.0,0.0,0.0,0.0};
744 Float_t betadiff[5] = {0.0,0.0,0.0,0.0,0.0};
745 for (Int_t i=0;i<5;i++)
747 betaHypothesis[i] = l/integratedTimes[i]/c;
748 betadiff[i] = beta-betaHypothesis[i];
751 Float_t invbeta = 1/beta;
752 Float_t invbetaHypothesis[5] = {0.0,0.0,0.0,0.0,0.0};
753 Float_t invbetadiff[5] = {0.0,0.0,0.0,0.0,0.0};
754 for (Int_t i=0;i<5;i++)
756 invbetaHypothesis[i] = 1/betaHypothesis[i];
757 invbetadiff[i] = invbeta-invbetaHypothesis[i];
760 Double_t tpcpid[AliPID::kSPECIES];
761 track->GetTPCpid(tpcpid);
764 fTOFrawtime->Fill(p,timeTOF);
765 fTOFrawtimeE->Fill(p,timeTOF-integratedTimes[0]);
766 fTOFrawtimePi->Fill(p,timeTOF-integratedTimes[2]);
767 fTOFrawtimeK->Fill(p,timeTOF-integratedTimes[3]);
768 fTOFrawtimeP->Fill(p,timeTOF-integratedTimes[4]);
770 fTOFrawbeta->Fill(p,beta);
771 fTOFrawbetaE->Fill(p,betadiff[0]);
772 fTOFrawbetaPi->Fill(p,betadiff[2]);
773 fTOFrawbetaK->Fill(p,betadiff[3]);
774 fTOFrawbetaP->Fill(p,betadiff[4]);
776 fTOFrawinvbeta->Fill(p,invbeta);
777 fTOFrawinvbetaE->Fill(p,invbetadiff[0]);
778 fTOFrawinvbetaPi->Fill(p,invbetadiff[2]);
779 fTOFrawinvbetaK->Fill(p,invbetadiff[3]);
780 fTOFrawinvbetaP->Fill(p,invbetadiff[4]);
783 if (track->GetStatus() & AliESDtrack::kTOFmismatch) return;
784 if (!TPCTOFagree(track)) return;
787 fTOFtime->Fill(p,timeTOF);
788 fTOFtimeE->Fill(p,timeTOF-integratedTimes[0]);
789 fTOFtimePi->Fill(p,timeTOF-integratedTimes[2]);
790 fTOFtimeK->Fill(p,timeTOF-integratedTimes[3]);
791 fTOFtimeP->Fill(p,timeTOF-integratedTimes[4]);
793 fTOFbeta->Fill(p,beta);
794 fTOFbetaE->Fill(p,betadiff[0]);
795 fTOFbetaPi->Fill(p,betadiff[2]);
796 fTOFbetaK->Fill(p,betadiff[3]);
797 fTOFbetaP->Fill(p,betadiff[4]);
799 fTOFinvbeta->Fill(p,invbeta);
800 fTOFinvbetaE->Fill(p,invbetadiff[0]);
801 fTOFinvbetaPi->Fill(p,invbetadiff[2]);
802 fTOFinvbetaK->Fill(p,invbetadiff[3]);
803 fTOFinvbetaP->Fill(p,invbetadiff[4]);
805 fCutsTOFbetaElectrons->IsSelected(track);
806 fCutsTOFbetaPions->IsSelected(track);
807 fCutsTOFbetaKaons->IsSelected(track);
808 fCutsTOFbetaProtons->IsSelected(track);
809 fCutsTOFbetaSimpleElectrons->IsSelected(track);
810 fCutsTOFbetaSimplePions->IsSelected(track);
811 fCutsTOFbetaSimpleKaons->IsSelected(track);
812 fCutsTOFbetaSimpleProtons->IsSelected(track);
813 fCutsTOFbayesianElectrons->IsSelected(track);
814 fCutsTOFbayesianPions->IsSelected(track);
815 fCutsTOFbayesianKaons->IsSelected(track);
816 fCutsTOFbayesianProtons->IsSelected(track);
819 //______________________________________________________________________________
820 Float_t AliAnalysisTaskPIDflowQA::Beta(Float_t m, Float_t p)
822 //get theoretical beta
823 return TMath::Sqrt(1. / (1. + m * m / (p * p)));
826 //---------------------------------------------------------------//
827 Bool_t AliAnalysisTaskPIDflowQA::TPCTOFagree(const AliESDtrack *track)
829 //check agreement between TOF and TPC pid
830 Bool_t status = kFALSE;
832 Float_t mass[5] = {5.10998909999999971e-04,1.05658000000000002e-01,1.39570000000000000e-01,4.93676999999999977e-01,9.38271999999999995e-01};
835 Double_t exptimes[5];
836 track->GetIntegratedTimes(exptimes);
838 Float_t dedx = track->GetTPCsignal();
840 Float_t p = track->P();
841 Float_t time = track->GetTOFsignal()- fESDpid->GetTOFResponse().GetStartTime(p);
842 Float_t tl = track->GetIntegratedLength();
844 Float_t betagammares = fESDpid->GetTOFResponse().GetExpectedSigma(p, exptimes[4], mass[4]);
846 Float_t betagamma1 = tl/(time-5 *betagammares) * 33.3564095198152043;
848 // printf("betagamma1 = %f\n",betagamma1);
850 if(betagamma1 < 0.1) betagamma1 = 0.1;
852 if(betagamma1 < 0.99999) betagamma1 /= TMath::Sqrt(1-betagamma1*betagamma1);
853 else betagamma1 = 100;
855 Float_t betagamma2 = tl/(time+5 *betagammares) * 33.3564095198152043;
856 // printf("betagamma2 = %f\n",betagamma2);
858 if(betagamma2 < 0.1) betagamma2 = 0.1;
860 if(betagamma2 < 0.99999) betagamma2 /= TMath::Sqrt(1-betagamma2*betagamma2);
861 else betagamma2 = 100;
865 track->GetInnerPxPyPz(ptpc);
866 Float_t momtpc=TMath::Sqrt(ptpc[0]*ptpc[0] + ptpc[1]*ptpc[1] + ptpc[2]*ptpc[2]);
868 for(Int_t i=0;i < 5;i++){
869 Float_t resolutionTOF = fESDpid->GetTOFResponse().GetExpectedSigma(p, exptimes[i], mass[i]);
870 if(TMath::Abs(exptimes[i] - time) < 5 * resolutionTOF){
872 if(i==0) dedxExp = fESDpid->GetTPCResponse().GetExpectedSignal(momtpc,AliPID::kElectron);
873 else if(i==1) dedxExp = fESDpid->GetTPCResponse().GetExpectedSignal(momtpc,AliPID::kMuon);
874 else if(i==2) dedxExp = fESDpid->GetTPCResponse().GetExpectedSignal(momtpc,AliPID::kPion);
875 else if(i==3) dedxExp = fESDpid->GetTPCResponse().GetExpectedSignal(momtpc,AliPID::kKaon);
876 else if(i==4) dedxExp = fESDpid->GetTPCResponse().GetExpectedSignal(momtpc,AliPID::kProton);
878 Float_t resolutionTPC = 2;
879 if(i==0) resolutionTPC = fESDpid->GetTPCResponse().GetExpectedSigma(momtpc,track->GetTPCsignalN(),AliPID::kElectron);
880 else if(i==1) resolutionTPC = fESDpid->GetTPCResponse().GetExpectedSigma(momtpc,track->GetTPCsignalN(),AliPID::kMuon);
881 else if(i==2) resolutionTPC = fESDpid->GetTPCResponse().GetExpectedSigma(momtpc,track->GetTPCsignalN(),AliPID::kPion);
882 else if(i==3) resolutionTPC = fESDpid->GetTPCResponse().GetExpectedSigma(momtpc,track->GetTPCsignalN(),AliPID::kKaon);
883 else if(i==4) resolutionTPC = fESDpid->GetTPCResponse().GetExpectedSigma(momtpc,track->GetTPCsignalN(),AliPID::kProton);
885 if(TMath::Abs(dedx - dedxExp) < 3 * resolutionTPC){
891 Float_t bb1 = fESDpid->GetTPCResponse().Bethe(betagamma1);
892 Float_t bb2 = fESDpid->GetTPCResponse().Bethe(betagamma2);
893 Float_t bbM = fESDpid->GetTPCResponse().Bethe((betagamma1+betagamma2)*0.5);
898 Float_t resolutionTOFpr = fESDpid->GetTOFResponse().GetExpectedSigma(p, exptimes[4], mass[4]);
899 Float_t resolutionTPCpr = fESDpid->GetTPCResponse().GetExpectedSigma(momtpc,track->GetTPCsignalN(),AliPID::kProton);
900 if(TMath::Abs(dedx-bb1) < resolutionTPCpr*3 && exptimes[4] < time-7*resolutionTOFpr){
903 else if(TMath::Abs(dedx-bb2) < resolutionTPCpr*3 && exptimes[4] < time-7*resolutionTOFpr){
906 else if(TMath::Abs(dedx-bbM) < resolutionTPCpr*3 && exptimes[4] < time-7*resolutionTOFpr){