fix warning: unused variables
[u/mrichter/AliRoot.git] / PWG / FLOW / Tasks / AliAnalysisTaskPIDflowQA.cxx
CommitLineData
f98ea3f1 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 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 **************************************************************************/
15
16/* $Id$ */
17
18// AliAnalysisTaskPIDflowQA:
19// QA for pid
20//
21//origin: Marek Chojnacki, Marek.Chojnacki@cern.ch
22//modified: Mikolaj Krzewicki, Mikolaj.Krzewicki@cern.ch
23
2b1eaa10 24#include <stdio.h>
25
f98ea3f1 26#include "AliAnalysisTaskPIDflowQA.h"
27#include "AliAnalysisManager.h"
28#include "AliESDEvent.h"
f98ea3f1 29#include "AliStack.h"
30#include "AliMCEvent.h"
1a80f9f6 31#include "TH1F.h"
f98ea3f1 32#include "TH2F.h"
5104aa35 33#include "TProfile.h"
f98ea3f1 34#include "TMath.h"
f98ea3f1 35#include "AliVEvent.h"
f98ea3f1 36#include "AliPID.h"
37#include "AliCDBManager.h"
38#include "AliFlowEventCuts.h"
cdc20344 39#include "AliFlowTrackCuts.h"
2b1eaa10 40#include "AliVEventHandler.h"
41#include "AliInputEventHandler.h"
42#include "TTree.h"
43#include "TFile.h"
f98ea3f1 44
45ClassImp( AliAnalysisTaskPIDflowQA)
46
47//________________________________________________________________________
48AliAnalysisTaskPIDflowQA:: AliAnalysisTaskPIDflowQA():
49 AliAnalysisTaskSE("AliAnalysisTaskPIDflowQA"),
50 fESD(NULL),
51 fCuts(NULL),
52 fEventCuts(NULL),
53 fESDpid(NULL),
2b1eaa10 54 fUseDebugFile(kFALSE),
55 fFile(NULL),
f98ea3f1 56 fTPCsignal(NULL),
1a80f9f6 57 fTPCsignalPi(NULL),
58 fTPCsignalK(NULL),
59 fTPCsignalP(NULL),
60 fTPCsignalPimc(NULL),
61 fTPCsignalKmc(NULL),
62 fTPCsignalPmc(NULL),
7288f660 63 fTOFtime(NULL),
64 fTOFtimeE(NULL),
65 fTOFtimePi(NULL),
66 fTOFtimeK(NULL),
67 fTOFtimeP(NULL),
1a80f9f6 68 fTOFbeta(NULL),
69 fTOFbetaE(NULL),
70 fTOFbetaPi(NULL),
71 fTOFbetaK(NULL),
72 fTOFbetaP(NULL),
73 fTOFinvbeta(NULL),
74 fTOFinvbetaE(NULL),
75 fTOFinvbetaPi(NULL),
76 fTOFinvbetaK(NULL),
77 fTOFinvbetaP(NULL),
9b692328 78 fTOFrawtime(NULL),
79 fTOFrawtimeE(NULL),
80 fTOFrawtimePi(NULL),
81 fTOFrawtimeK(NULL),
82 fTOFrawtimeP(NULL),
83 fTOFrawbeta(NULL),
84 fTOFrawbetaE(NULL),
85 fTOFrawbetaPi(NULL),
86 fTOFrawbetaK(NULL),
87 fTOFrawbetaP(NULL),
88 fTOFrawinvbeta(NULL),
89 fTOFrawinvbetaE(NULL),
90 fTOFrawinvbetaPi(NULL),
91 fTOFrawinvbetaK(NULL),
92 fTOFrawinvbetaP(NULL),
f98ea3f1 93 fPvsPt(NULL),
5104aa35 94 fMeanPvsP(NULL),
cdc20344 95 fTPCvsGlobalMult(NULL),
96 fStandardGlobalCuts(NULL),
97 fStandardTPCCuts(NULL),
9b692328 98 fCutsTOFbetaElectrons(NULL),
99 fCutsTOFbetaPions(NULL),
100 fCutsTOFbetaKaons(NULL),
101 fCutsTOFbetaProtons(NULL),
102 fCutsTOFbetaSimpleElectrons(NULL),
103 fCutsTOFbetaSimplePions(NULL),
104 fCutsTOFbetaSimpleKaons(NULL),
105 fCutsTOFbetaSimpleProtons(NULL),
b9cf8f8e 106 fCutsTOFbayesianElectrons(NULL),
107 fCutsTOFbayesianPions(NULL),
108 fCutsTOFbayesianKaons(NULL),
109 fCutsTOFbayesianProtons(NULL),
9b692328 110 fCutsTPCdedxElectrons(NULL),
111 fCutsTPCdedxPions(NULL),
112 fCutsTPCdedxKaons(NULL),
113 fCutsTPCdedxProtons(NULL),
114 fCutsTPCpidElectrons(NULL),
115 fCutsTPCpidPions(NULL),
116 fCutsTPCpidKaons(NULL),
117 fCutsTPCpidProtons(NULL),
b9cf8f8e 118 fCutsTPCbayesianElectrons(NULL),
119 fCutsTPCbayesianPions(NULL),
120 fCutsTPCbayesianKaons(NULL),
121 fCutsTPCbayesianProtons(NULL),
122 fCutsMCelectrons(NULL),
123 fCutsMCpions(NULL),
124 fCutsMCkaons(NULL),
125 fCutsMCprotons(NULL),
126 fCutsMCprimaryelectrons(NULL),
127 fCutsMCprimarypions(NULL),
128 fCutsMCprimarykaons(NULL),
129 fCutsMCprimaryprotons(NULL),
5104aa35 130 fOutputList(NULL)
f98ea3f1 131{
132 //def ctor
133}
134
135//________________________________________________________________________
136AliAnalysisTaskPIDflowQA:: AliAnalysisTaskPIDflowQA(const char *name):
137 AliAnalysisTaskSE(name),
138 fESD(NULL),
139 fCuts(NULL),
140 fEventCuts(NULL),
141 fESDpid(NULL),
2b1eaa10 142 fUseDebugFile(kFALSE),
143 fFile(NULL),
f98ea3f1 144 fTPCsignal(NULL),
1a80f9f6 145 fTPCsignalPi(NULL),
146 fTPCsignalK(NULL),
147 fTPCsignalP(NULL),
148 fTPCsignalPimc(NULL),
149 fTPCsignalKmc(NULL),
150 fTPCsignalPmc(NULL),
7288f660 151 fTOFtime(NULL),
152 fTOFtimeE(NULL),
153 fTOFtimePi(NULL),
154 fTOFtimeK(NULL),
155 fTOFtimeP(NULL),
1a80f9f6 156 fTOFbeta(NULL),
157 fTOFbetaE(NULL),
158 fTOFbetaPi(NULL),
159 fTOFbetaK(NULL),
160 fTOFbetaP(NULL),
161 fTOFinvbeta(NULL),
162 fTOFinvbetaE(NULL),
163 fTOFinvbetaPi(NULL),
164 fTOFinvbetaK(NULL),
165 fTOFinvbetaP(NULL),
9b692328 166 fTOFrawtime(NULL),
167 fTOFrawtimeE(NULL),
168 fTOFrawtimePi(NULL),
169 fTOFrawtimeK(NULL),
170 fTOFrawtimeP(NULL),
171 fTOFrawbeta(NULL),
172 fTOFrawbetaE(NULL),
173 fTOFrawbetaPi(NULL),
174 fTOFrawbetaK(NULL),
175 fTOFrawbetaP(NULL),
176 fTOFrawinvbeta(NULL),
177 fTOFrawinvbetaE(NULL),
178 fTOFrawinvbetaPi(NULL),
179 fTOFrawinvbetaK(NULL),
180 fTOFrawinvbetaP(NULL),
f98ea3f1 181 fPvsPt(NULL),
5104aa35 182 fMeanPvsP(NULL),
cdc20344 183 fTPCvsGlobalMult(NULL),
184 fStandardGlobalCuts(NULL),
185 fStandardTPCCuts(NULL),
9b692328 186 fCutsTOFbetaElectrons(NULL),
187 fCutsTOFbetaPions(NULL),
188 fCutsTOFbetaKaons(NULL),
189 fCutsTOFbetaProtons(NULL),
190 fCutsTOFbetaSimpleElectrons(NULL),
191 fCutsTOFbetaSimplePions(NULL),
192 fCutsTOFbetaSimpleKaons(NULL),
193 fCutsTOFbetaSimpleProtons(NULL),
b9cf8f8e 194 fCutsTOFbayesianElectrons(NULL),
195 fCutsTOFbayesianPions(NULL),
196 fCutsTOFbayesianKaons(NULL),
197 fCutsTOFbayesianProtons(NULL),
9b692328 198 fCutsTPCdedxElectrons(NULL),
199 fCutsTPCdedxPions(NULL),
200 fCutsTPCdedxKaons(NULL),
201 fCutsTPCdedxProtons(NULL),
202 fCutsTPCpidElectrons(NULL),
203 fCutsTPCpidPions(NULL),
204 fCutsTPCpidKaons(NULL),
205 fCutsTPCpidProtons(NULL),
b9cf8f8e 206 fCutsTPCbayesianElectrons(NULL),
207 fCutsTPCbayesianPions(NULL),
208 fCutsTPCbayesianKaons(NULL),
209 fCutsTPCbayesianProtons(NULL),
210 fCutsMCelectrons(NULL),
211 fCutsMCpions(NULL),
212 fCutsMCkaons(NULL),
213 fCutsMCprotons(NULL),
214 fCutsMCprimaryelectrons(NULL),
215 fCutsMCprimarypions(NULL),
216 fCutsMCprimarykaons(NULL),
217 fCutsMCprimaryprotons(NULL),
5104aa35 218 fOutputList(NULL)
f98ea3f1 219{
220 //Constructor
221 fESDpid=new AliESDpid();
222
223 //old
224 fESDpid->GetTPCResponse().SetBetheBlochParameters(0.0283086,
225 2.63394e+01,
226 5.04114e-11,
227 2.12543e+00,
228 4.88663e+00 );
229 //new
230 //fESDpid->GetTPCResponse().SetBetheBlochParameters(1.28949/50.,
231 // 2.74095e+01,
232 // TMath::Exp(-3.21763e+01),
233 // 2.44026,
234 // 6.58800);
235
236 DefineOutput(1, TList::Class());
237}
238
239//________________________________________________________________________
240void AliAnalysisTaskPIDflowQA::UserCreateOutputObjects()
241{
242 //UserCreateOutputObject
5104aa35 243 if (fOutputList) fOutputList->Delete();
244 delete fOutputList;
245 fOutputList=new TList();
ef7cafb6 246 fOutputList->SetOwner(kTRUE);
f98ea3f1 247
2d1435c2 248/* COMMENTED OUT ON 04122014 to squash unused variable warning
f98ea3f1 249 const Int_t ndec=2;
250 Int_t startvalue=-1;
251 const Int_t npredec=50;
252 Double_t tabx[ndec*npredec+1];
253 for (Int_t i=0; i<ndec; i++)
254 {
255 for (Int_t j=0; j<npredec; j++)
256 {
257 tabx[npredec*i+j]=TMath::Power(10,((Double_t)i)+((Double_t)startvalue)+((Double_t)j)/((Double_t)npredec));
258 }
259 }
260 tabx[ndec*npredec]=TMath::Power(10,ndec+startvalue);
2d1435c2 261*/
f98ea3f1 262 Int_t kPtBins=60;
263 Double_t binsPtDummy[kPtBins+1];
264 binsPtDummy[0]=0.0;
265 for(int i=1; i<=kPtBins+1; i++)
266 {
267 if(binsPtDummy[i-1]+0.05<1.01)
268 binsPtDummy[i]=binsPtDummy[i-1]+0.05;
269 else
270 binsPtDummy[i]=binsPtDummy[i-1]+0.1;
271 }
272
273 Int_t kPBins=60;
274 Double_t binsPDummy[kPBins+1];
275 binsPDummy[0]=0.0;
276 for(int i=1; i<=kPBins+1; i++)
277 {
278 if(binsPDummy[i-1]+0.05<1.01)
279 binsPDummy[i]=binsPDummy[i-1]+0.05;
280 else
281 binsPDummy[i]=binsPDummy[i-1]+0.1;
282 }
283
1a80f9f6 284 fTPCsignal=new TH2F("fTPCsignal",";p [GeV/c];dEdx",kPBins,binsPDummy,500,0,500);
285 fOutputList->Add(fTPCsignal);
6a043318 286 fTPCsignalPi=new TH2F("fTPCsignalPi",";p [GeV/c];signal",kPBins,binsPDummy,500,-2,2);//TPC PID signal as function of p for pi+
287 fTPCsignalK=new TH2F("fTPCsignalK",";p [GeV/c];signal",kPBins,binsPDummy,500,-2,2);//TPC PID signal as function of p for K+
288 fTPCsignalP=new TH2F("fTPCsignalP",";p [GeV/c];signal",kPBins,binsPDummy,500,-2,2);//TPC PID signal as function of p for p
1a80f9f6 289 fOutputList->Add(fTPCsignalPi);
290 fOutputList->Add(fTPCsignalK);
291 fOutputList->Add(fTPCsignalP);
1a80f9f6 292
f21bdf48 293 fTOFtime=new TH2F("fTOFtime",";p[GeV/c];#time",kPBins,binsPDummy,1000, 12000, 80000);//
7288f660 294 fOutputList->Add(fTOFtime);
6a043318 295 fTOFtimeE=new TH2F("fTOFtimeE",";p [GeV/c];#time-#time_{#pi}",kPBins,binsPDummy,1000, -8000, 8000);//
296 fTOFtimePi=new TH2F("fTOFtimePi",";p [GeV/c];#time-#time_{#pi}",kPBins,binsPDummy,1000, -8000, 8000);//
297 fTOFtimeK=new TH2F("fTOFtimeK",";p [GeV/c];#time-#time_{K}",kPBins,binsPDummy,1000, -8000, 8000);//
298 fTOFtimeP=new TH2F("fTOFtimeP",";p [GeV/c];#time-#time_{p}",kPBins,binsPDummy,1000, -8000, 8000);//
9b692328 299 fOutputList->Add(fTOFtimeE);
300 fOutputList->Add(fTOFtimePi);
301 fOutputList->Add(fTOFtimeK);
302 fOutputList->Add(fTOFtimeP);
7288f660 303
1a80f9f6 304 fTOFbeta=new TH2F("fTOFbeta",";p[GeV/c];#beta",kPBins,binsPDummy,1000, 0.4, 1.1);//
305 fOutputList->Add(fTOFbeta);
6a043318 306 fTOFbetaE=new TH2F("fTOFbetaE",";p [GeV/c];#beta-#beta_{#pi}",kPBins,binsPDummy,1000, -0.25, 0.25);//
307 fTOFbetaPi=new TH2F("fTOFbetaPi",";p [GeV/c];#beta-#beta_{#pi}",kPBins,binsPDummy,1000, -0.25, 0.25);//
308 fTOFbetaK=new TH2F("fTOFbetaK",";p [GeV/c];#beta-#beta_{K}",kPBins,binsPDummy,1000, -0.25, 0.25);//
309 fTOFbetaP=new TH2F("fTOFbetaP",";p [GeV/c];#beta-#beta_{p}",kPBins,binsPDummy,1000, -0.25, 0.25);//
1a80f9f6 310 fOutputList->Add(fTOFbetaE);
311 fOutputList->Add(fTOFbetaPi);
312 fOutputList->Add(fTOFbetaK);
313 fOutputList->Add(fTOFbetaP);
314
315 fTOFinvbeta=new TH2F("fTOFinvbeta",";p[GeV/c];1/#beta",kPBins,binsPDummy,1000, 0.90, 2.5);//
316 fOutputList->Add(fTOFinvbeta);
6a043318 317 fTOFinvbetaE=new TH2F("fTOFinvbetaE",";p [GeV/c];1/#beta-1/#beta_{#pi}",kPBins,binsPDummy,1000, -0.3, 0.3);//
318 fTOFinvbetaPi=new TH2F("fTOFinvbetaPi",";p [GeV/c];1/#beta-1/#beta_{#pi}",kPBins,binsPDummy,1000, -0.3, 0.3);//
319 fTOFinvbetaK=new TH2F("fTOFinvbetaK",";p [GeV/c];1/#beta-1/#beta_{K}",kPBins,binsPDummy,1000, -0.3, 0.3);//
320 fTOFinvbetaP=new TH2F("fTOFinvbetaP",";p [GeV/c];1/#beta-1/#beta_{p}",kPBins,binsPDummy,1000, -0.3, 0.3);//
1a80f9f6 321 fOutputList->Add(fTOFinvbetaE);
322 fOutputList->Add(fTOFinvbetaPi);
323 fOutputList->Add(fTOFinvbetaK);
324 fOutputList->Add(fTOFinvbetaP);
325
9b692328 326 fTOFrawtime=new TH2F("fTOFrawtime",";p[GeV/c];#time",kPBins,binsPDummy,1000, 12000, 80000);//
327 fOutputList->Add(fTOFrawtime);
6a043318 328 fTOFrawtimeE=new TH2F("fTOFrawtimeE",";p [GeV/c];#time-#time_{#pi}",kPBins,binsPDummy,1000, -8000, 8000);//
329 fTOFrawtimePi=new TH2F("fTOFrawtimePi",";p [GeV/c];#time-#time_{#pi}",kPBins,binsPDummy,1000, -8000, 8000);//
330 fTOFrawtimeK=new TH2F("fTOFrawtimeK",";p [GeV/c];#time-#time_{K}",kPBins,binsPDummy,1000, -8000, 8000);//
331 fTOFrawtimeP=new TH2F("fTOFrawtimeP",";p [GeV/c];#time-#time_{p}",kPBins,binsPDummy,1000, -8000, 8000);//
9b692328 332 fOutputList->Add(fTOFrawtimeE);
333 fOutputList->Add(fTOFrawtimePi);
334 fOutputList->Add(fTOFrawtimeK);
335 fOutputList->Add(fTOFrawtimeP);
336
337 fTOFrawbeta=new TH2F("fTOFrawbeta",";p[GeV/c];#beta",kPBins,binsPDummy,1000, 0.4, 1.1);//
338 fOutputList->Add(fTOFrawbeta);
6a043318 339 fTOFrawbetaE=new TH2F("fTOFrawbetaE",";p [GeV/c];#beta-#beta_{#pi}",kPBins,binsPDummy,1000, -0.25, 0.25);//
340 fTOFrawbetaPi=new TH2F("fTOFrawbetaPi",";p [GeV/c];#beta-#beta_{#pi}",kPBins,binsPDummy,1000, -0.25, 0.25);//
341 fTOFrawbetaK=new TH2F("fTOFrawbetaK",";p [GeV/c];#beta-#beta_{K}",kPBins,binsPDummy,1000, -0.25, 0.25);//
342 fTOFrawbetaP=new TH2F("fTOFrawbetaP",";p [GeV/c];#beta-#beta_{p}",kPBins,binsPDummy,1000, -0.25, 0.25);//
9b692328 343 fOutputList->Add(fTOFrawbetaE);
344 fOutputList->Add(fTOFrawbetaPi);
345 fOutputList->Add(fTOFrawbetaK);
346 fOutputList->Add(fTOFrawbetaP);
347
348 fTOFrawinvbeta=new TH2F("fTOFrawinvbeta",";p[GeV/c];1/#beta",kPBins,binsPDummy,1000, 0.90, 2.5);//
349 fOutputList->Add(fTOFrawinvbeta);
6a043318 350 fTOFrawinvbetaE=new TH2F("fTOFrawinvbetaE",";p [GeV/c];1/#beta-1/#beta_{#pi}",kPBins,binsPDummy,1000, -0.3, 0.3);//
351 fTOFrawinvbetaPi=new TH2F("fTOFrawinvbetaPi",";p [GeV/c];1/#beta-1/#beta_{#pi}",kPBins,binsPDummy,1000, -0.3, 0.3);//
352 fTOFrawinvbetaK=new TH2F("fTOFrawinvbetaK",";p [GeV/c];1/#beta-1/#beta_{K}",kPBins,binsPDummy,1000, -0.3, 0.3);//
353 fTOFrawinvbetaP=new TH2F("fTOFrawinvbetaP",";p [GeV/c];1/#beta-1/#beta_{p}",kPBins,binsPDummy,1000, -0.3, 0.3);//
9b692328 354 fOutputList->Add(fTOFrawinvbetaE);
355 fOutputList->Add(fTOFrawinvbetaPi);
356 fOutputList->Add(fTOFrawinvbetaK);
357 fOutputList->Add(fTOFrawinvbetaP);
f98ea3f1 358
a0241c3a 359 fPvsPt=new TH2F("fPvsPt","p vs p_{t};p [GeV/c];p_{t} [GeV/c]",kPBins,binsPDummy,kPtBins,binsPtDummy);
5104aa35 360 fOutputList->Add(fPvsPt);
f98ea3f1 361
a0241c3a 362 fMeanPvsP = new TProfile("fMeanPvsP","Mean P vs P;p [Gev/c];<p> [GeV/c]",kPBins,binsPDummy);
5104aa35 363 fOutputList->Add(fMeanPvsP);
a0241c3a 364
cdc20344 365 fTPCvsGlobalMult = new TH2F("fTPCvsGlobalMult","TPC only vs Global track multiplicity;global;TPC only",500,0,2500,500,0,3500);
366 fOutputList->Add(fTPCvsGlobalMult);
367
368 fStandardGlobalCuts = AliFlowTrackCuts::GetStandardGlobalTrackCuts2010();
1a80f9f6 369 fStandardTPCCuts = AliFlowTrackCuts::GetStandardTPCStandaloneTrackCuts2010();
370
9b692328 371 fCutsTOFbetaElectrons = new AliFlowTrackCuts("TOFbeta e");
372 fCutsTOFbetaElectrons->SetPID(AliPID::kElectron, AliFlowTrackCuts::kTOFbeta);
373 fCutsTOFbetaElectrons->SetRequireStrictTOFTPCagreement();
374 fCutsTOFbetaElectrons->SetQA();
375 fCutsTOFbetaPions = new AliFlowTrackCuts("TOFbeta pi");
376 fCutsTOFbetaPions->SetPID(AliPID::kPion, AliFlowTrackCuts::kTOFbeta);
377 fCutsTOFbetaPions->SetRequireStrictTOFTPCagreement();
378 fCutsTOFbetaPions->SetQA();
379 fCutsTOFbetaKaons = new AliFlowTrackCuts("TOFbeta K");
380 fCutsTOFbetaKaons->SetPID(AliPID::kKaon, AliFlowTrackCuts::kTOFbeta);
381 fCutsTOFbetaKaons->SetRequireStrictTOFTPCagreement();
382 fCutsTOFbetaKaons->SetQA();
383 fCutsTOFbetaProtons = new AliFlowTrackCuts("TOFbeta p");
384 fCutsTOFbetaProtons->SetPID(AliPID::kProton, AliFlowTrackCuts::kTOFbeta);
385 fCutsTOFbetaProtons->SetRequireStrictTOFTPCagreement();
386 fCutsTOFbetaProtons->SetQA();
387
388 fCutsTOFbetaSimpleElectrons = new AliFlowTrackCuts("TOFbetaSimple e");
389 fCutsTOFbetaSimpleElectrons->SetPID(AliPID::kElectron, AliFlowTrackCuts::kTOFbetaSimple);
390 fCutsTOFbetaSimpleElectrons->SetRequireStrictTOFTPCagreement();
391 fCutsTOFbetaSimpleElectrons->SetQA();
392 fCutsTOFbetaSimplePions = new AliFlowTrackCuts("TOFbetaSimple pi");
393 fCutsTOFbetaSimplePions->SetPID(AliPID::kPion, AliFlowTrackCuts::kTOFbetaSimple);
394 fCutsTOFbetaSimplePions->SetRequireStrictTOFTPCagreement();
395 fCutsTOFbetaSimplePions->SetQA();
396 fCutsTOFbetaSimpleKaons = new AliFlowTrackCuts("TOFbetaSimple K");
397 fCutsTOFbetaSimpleKaons->SetPID(AliPID::kKaon, AliFlowTrackCuts::kTOFbetaSimple);
398 fCutsTOFbetaSimpleKaons->SetRequireStrictTOFTPCagreement();
399 fCutsTOFbetaSimpleKaons->SetQA();
400 fCutsTOFbetaSimpleProtons = new AliFlowTrackCuts("TOFbetaSimple p");
401 fCutsTOFbetaSimpleProtons->SetPID(AliPID::kProton, AliFlowTrackCuts::kTOFbetaSimple);
402 fCutsTOFbetaSimpleProtons->SetRequireStrictTOFTPCagreement();
403 fCutsTOFbetaSimpleProtons->SetQA();
404
b9cf8f8e 405 fCutsTOFbayesianElectrons = new AliFlowTrackCuts("TOFbayesian e");
406 fCutsTOFbayesianElectrons->SetPID(AliPID::kElectron, AliFlowTrackCuts::kTOFbayesian);
407 fCutsTOFbayesianElectrons->SetRequireStrictTOFTPCagreement();
408 fCutsTOFbayesianElectrons->SetQA();
409 fCutsTOFbayesianPions = new AliFlowTrackCuts("TOFbayesian pi");
410 fCutsTOFbayesianPions->SetPID(AliPID::kPion, AliFlowTrackCuts::kTOFbayesian);
411 fCutsTOFbayesianPions->SetRequireStrictTOFTPCagreement();
412 fCutsTOFbayesianPions->SetQA();
413 fCutsTOFbayesianKaons = new AliFlowTrackCuts("TOFbayesian K");
414 fCutsTOFbayesianKaons->SetPID(AliPID::kKaon, AliFlowTrackCuts::kTOFbayesian);
415 fCutsTOFbayesianKaons->SetRequireStrictTOFTPCagreement();
416 fCutsTOFbayesianKaons->SetQA();
417 fCutsTOFbayesianProtons = new AliFlowTrackCuts("TOFbayesian p");
418 fCutsTOFbayesianProtons->SetPID(AliPID::kProton, AliFlowTrackCuts::kTOFbayesian);
419 fCutsTOFbayesianProtons->SetRequireStrictTOFTPCagreement();
420 fCutsTOFbayesianProtons->SetQA();
421
9b692328 422 fCutsTPCdedxElectrons = new AliFlowTrackCuts("TPCdedx e");
423 fCutsTPCdedxElectrons->SetPID(AliPID::kElectron, AliFlowTrackCuts::kTPCdedx);
424 fCutsTPCdedxElectrons->SetQA();
b9cf8f8e 425 fCutsTPCdedxPions = new AliFlowTrackCuts("TPCdedx pi");
9b692328 426 fCutsTPCdedxPions->SetPID(AliPID::kPion, AliFlowTrackCuts::kTPCdedx);
427 fCutsTPCdedxPions->SetQA();
428 fCutsTPCdedxKaons = new AliFlowTrackCuts("TPCdedx K");
429 fCutsTPCdedxKaons->SetPID(AliPID::kKaon, AliFlowTrackCuts::kTPCdedx);
430 fCutsTPCdedxKaons->SetQA();
431 fCutsTPCdedxProtons = new AliFlowTrackCuts("TPCdedx p");
432 fCutsTPCdedxProtons->SetPID(AliPID::kProton, AliFlowTrackCuts::kTPCdedx);
433 fCutsTPCdedxProtons->SetQA();
434
435 fCutsTPCpidElectrons = new AliFlowTrackCuts("TPCpid e");
436 fCutsTPCpidElectrons->SetPID(AliPID::kElectron, AliFlowTrackCuts::kTPCpid);
437 fCutsTPCpidElectrons->SetQA();
b9cf8f8e 438 fCutsTPCpidPions = new AliFlowTrackCuts("TPCpid pi");
9b692328 439 fCutsTPCpidPions->SetPID(AliPID::kPion, AliFlowTrackCuts::kTPCpid);
440 fCutsTPCpidPions->SetQA();
441 fCutsTPCpidKaons = new AliFlowTrackCuts("TPCpid K");
442 fCutsTPCpidKaons->SetPID(AliPID::kKaon, AliFlowTrackCuts::kTPCpid);
443 fCutsTPCpidKaons->SetQA();
444 fCutsTPCpidProtons = new AliFlowTrackCuts("TPCpid p");
445 fCutsTPCpidProtons->SetPID(AliPID::kProton, AliFlowTrackCuts::kTPCpid);
446 fCutsTPCpidProtons->SetQA();
cdc20344 447
b9cf8f8e 448 fCutsTPCbayesianElectrons = new AliFlowTrackCuts("TPCbayesian e");
449 fCutsTPCbayesianElectrons->SetPID(AliPID::kElectron, AliFlowTrackCuts::kTPCbayesian);
450 fCutsTPCbayesianElectrons->SetQA();
451 fCutsTPCbayesianPions = new AliFlowTrackCuts("TPCbayesian pi");
452 fCutsTPCbayesianPions->SetPID(AliPID::kPion, AliFlowTrackCuts::kTPCbayesian);
453 fCutsTPCbayesianPions->SetQA();
454 fCutsTPCbayesianKaons = new AliFlowTrackCuts("TPCbayesian K");
455 fCutsTPCbayesianKaons->SetPID(AliPID::kKaon, AliFlowTrackCuts::kTPCbayesian);
456 fCutsTPCbayesianKaons->SetQA();
457 fCutsTPCbayesianProtons = new AliFlowTrackCuts("TPCbayesian p");
458 fCutsTPCbayesianProtons->SetPID(AliPID::kProton, AliFlowTrackCuts::kTPCbayesian);
459 fCutsTPCbayesianProtons->SetQA();
460
461 fCutsMCelectrons=new AliFlowTrackCuts("MC e");
462 fCutsMCelectrons->SetMCPID(11);
463 fCutsMCelectrons->SetIgnoreSignInMCPID();
464 fCutsMCelectrons->SetQA();
465 fCutsMCpions=new AliFlowTrackCuts("MC pi");
466 fCutsMCpions->SetMCPID(211);
467 fCutsMCpions->SetIgnoreSignInMCPID();
468 fCutsMCpions->SetQA();
469 fCutsMCkaons=new AliFlowTrackCuts("MC K");
6a043318 470 fCutsMCkaons->SetMCPID(321);
471 fCutsMCkaons->SetIgnoreSignInMCPID();
472 fCutsMCkaons->SetQA();
b9cf8f8e 473 fCutsMCprotons=new AliFlowTrackCuts("MC p");
6a043318 474 fCutsMCprotons->SetMCPID(2212);
475 fCutsMCprotons->SetIgnoreSignInMCPID();
476 fCutsMCprotons->SetQA();
b9cf8f8e 477
478 fCutsMCprimaryelectrons=new AliFlowTrackCuts("MCprimary e");
479 fCutsMCprimaryelectrons->SetMCPID(11);
480 fCutsMCprimaryelectrons->SetIgnoreSignInMCPID();
481 fCutsMCprimaryelectrons->SetMCisPrimary();
482 fCutsMCprimaryelectrons->SetQA();
483 fCutsMCprimarypions=new AliFlowTrackCuts("MCprimary pi");
484 fCutsMCprimarypions->SetMCPID(211);
485 fCutsMCprimarypions->SetIgnoreSignInMCPID();
486 fCutsMCprimarypions->SetMCisPrimary();
487 fCutsMCprimarypions->SetQA();
488 fCutsMCprimarykaons=new AliFlowTrackCuts("MCprimary K");
6a043318 489 fCutsMCprimarykaons->SetMCPID(321);
490 fCutsMCprimarykaons->SetIgnoreSignInMCPID();
491 fCutsMCprimarykaons->SetMCisPrimary();
492 fCutsMCprimarykaons->SetQA();
b9cf8f8e 493 fCutsMCprimaryprotons=new AliFlowTrackCuts("MCprimary p");
6a043318 494 fCutsMCprimaryprotons->SetMCPID(2212);
495 fCutsMCprimaryprotons->SetIgnoreSignInMCPID();
496 fCutsMCprimaryprotons->SetMCisPrimary();
497 fCutsMCprimaryprotons->SetQA();
b9cf8f8e 498
a0241c3a 499 //fOutputList->Add(fESDpid);
5104aa35 500
9b692328 501 fOutputList->Add(fCutsTPCdedxElectrons->GetQA());
502 fOutputList->Add(fCutsTPCdedxPions->GetQA());
503 fOutputList->Add(fCutsTPCdedxKaons->GetQA());
504 fOutputList->Add(fCutsTPCdedxProtons->GetQA());
505 fOutputList->Add(fCutsTPCpidElectrons->GetQA());
506 fOutputList->Add(fCutsTPCpidPions->GetQA());
507 fOutputList->Add(fCutsTPCpidKaons->GetQA());
508 fOutputList->Add(fCutsTPCpidProtons->GetQA());
b9cf8f8e 509 fOutputList->Add(fCutsTPCbayesianElectrons->GetQA());
510 fOutputList->Add(fCutsTPCbayesianPions->GetQA());
511 fOutputList->Add(fCutsTPCbayesianKaons->GetQA());
512 fOutputList->Add(fCutsTPCbayesianProtons->GetQA());
9b692328 513 fOutputList->Add(fCutsTOFbetaElectrons->GetQA());
514 fOutputList->Add(fCutsTOFbetaPions->GetQA());
515 fOutputList->Add(fCutsTOFbetaKaons->GetQA());
516 fOutputList->Add(fCutsTOFbetaProtons->GetQA());
517 fOutputList->Add(fCutsTOFbetaSimpleElectrons->GetQA());
518 fOutputList->Add(fCutsTOFbetaSimplePions->GetQA());
519 fOutputList->Add(fCutsTOFbetaSimpleKaons->GetQA());
520 fOutputList->Add(fCutsTOFbetaSimpleProtons->GetQA());
b9cf8f8e 521 fOutputList->Add(fCutsTOFbayesianElectrons->GetQA());
522 fOutputList->Add(fCutsTOFbayesianPions->GetQA());
523 fOutputList->Add(fCutsTOFbayesianKaons->GetQA());
524 fOutputList->Add(fCutsTOFbayesianProtons->GetQA());
525 fOutputList->Add(fCutsMCelectrons->GetQA());
526 fOutputList->Add(fCutsMCpions->GetQA());
527 fOutputList->Add(fCutsMCkaons->GetQA());
528 fOutputList->Add(fCutsMCprotons->GetQA());
529 fOutputList->Add(fCutsMCprimaryelectrons->GetQA());
530 fOutputList->Add(fCutsMCprimarypions->GetQA());
531 fOutputList->Add(fCutsMCprimarykaons->GetQA());
532 fOutputList->Add(fCutsMCprimaryprotons->GetQA());
1a80f9f6 533
2b1eaa10 534 if (fUseDebugFile) fFile = fopen("debug.txt","w");
535
5104aa35 536 PostData(1, fOutputList);
f98ea3f1 537}
538
539//________________________________________________________________________
540void AliAnalysisTaskPIDflowQA::UserExec(Option_t *)
541{
cc0afcfc 542 //user exec
f98ea3f1 543 fESD = dynamic_cast<AliESDEvent*> (InputEvent());
544 if (!fESD) return;
545
cb070a12 546 //do the calibration bit
547 fESDpid->SetTOFResponse(fESD,AliESDpid::kTOF_T0); // to use T0-TOF
548 fESDpid->MakePID(fESD,kFALSE);
549
f98ea3f1 550 if(!fCuts || !fEventCuts)
551 {
552 Printf("No CUTS Defined.........\n");
5104aa35 553 PostData(1, fOutputList);
f98ea3f1 554 return;
555 }
556
e821bc8b 557 if (!(fEventCuts->IsSelected(fESD,0x0)))
f98ea3f1 558 {
559 return;
560 }
561
9b692328 562 AliStack* stack=NULL;
563 AliMCEvent* mcEvent = MCEvent();
564 if (mcEvent) stack = mcEvent->Stack();
565 if (mcEvent) Printf("MC particles: %d", mcEvent->GetNumberOfTracks());
f98ea3f1 566
567 Printf("There are %d tracks in this event", fESD->GetNumberOfTracks());
568 Int_t nTracks=fESD->GetNumberOfTracks();
569
570 AliESDtrack *trackESD=0;
571
9b692328 572 fCuts->SetEvent(fESD,mcEvent);
573 fCutsTPCdedxElectrons->SetEvent(fESD,mcEvent);
574 fCutsTPCdedxPions->SetEvent(fESD,mcEvent);
575 fCutsTPCdedxKaons->SetEvent(fESD,mcEvent);
576 fCutsTPCdedxProtons->SetEvent(fESD,mcEvent);
577 fCutsTPCpidElectrons->SetEvent(fESD,mcEvent);
578 fCutsTPCpidPions->SetEvent(fESD,mcEvent);
579 fCutsTPCpidKaons->SetEvent(fESD,mcEvent);
580 fCutsTPCpidProtons->SetEvent(fESD,mcEvent);
b9cf8f8e 581 fCutsTPCbayesianElectrons->SetEvent(fESD,mcEvent);
582 fCutsTPCbayesianPions->SetEvent(fESD,mcEvent);
583 fCutsTPCbayesianKaons->SetEvent(fESD,mcEvent);
584 fCutsTPCbayesianProtons->SetEvent(fESD,mcEvent);
9b692328 585 fCutsTOFbetaElectrons->SetEvent(fESD,mcEvent);
586 fCutsTOFbetaPions->SetEvent(fESD,mcEvent);
587 fCutsTOFbetaKaons->SetEvent(fESD,mcEvent);
588 fCutsTOFbetaProtons->SetEvent(fESD,mcEvent);
589 fCutsTOFbetaSimpleElectrons->SetEvent(fESD,mcEvent);
590 fCutsTOFbetaSimplePions->SetEvent(fESD,mcEvent);
591 fCutsTOFbetaSimpleKaons->SetEvent(fESD,mcEvent);
592 fCutsTOFbetaSimpleProtons->SetEvent(fESD,mcEvent);
b9cf8f8e 593 fCutsTOFbayesianElectrons->SetEvent(fESD,mcEvent);
594 fCutsTOFbayesianPions->SetEvent(fESD,mcEvent);
595 fCutsTOFbayesianKaons->SetEvent(fESD,mcEvent);
596 fCutsTOFbayesianProtons->SetEvent(fESD,mcEvent);
597 fCutsMCelectrons->SetEvent(fESD,mcEvent);
598 fCutsMCpions->SetEvent(fESD,mcEvent);
599 fCutsMCkaons->SetEvent(fESD,mcEvent);
600 fCutsMCprotons->SetEvent(fESD,mcEvent);
601 fCutsMCprimaryelectrons->SetEvent(fESD,mcEvent);
602 fCutsMCprimarypions->SetEvent(fESD,mcEvent);
603 fCutsMCprimarykaons->SetEvent(fESD,mcEvent);
604 fCutsMCprimaryprotons->SetEvent(fESD,mcEvent);
499fe731 605
f98ea3f1 606 for(int tr1=0; tr1<nTracks; tr1++)
607 {
608 trackESD=fESD->GetTrack(tr1);
609 if (!trackESD) continue;
610
1a80f9f6 611 Double_t p=trackESD->GetP();
612 Double_t pt=trackESD->Pt();
613
2b1eaa10 614 if(!(fCuts->IsSelected(trackESD))) continue;
f98ea3f1 615
616 Int_t label=-1;
9b692328 617 if(mcEvent) label=trackESD->GetLabel();
f98ea3f1 618
619 Int_t pdgcode=0;
9b692328 620 if(stack)
f98ea3f1 621 {
622 TParticle* particle2 = stack->Particle(TMath::Abs(label));
623 pdgcode=particle2->GetPdgCode();
624 }
625
f98ea3f1 626 fPvsPt->Fill(p,pt);
5104aa35 627 fMeanPvsP->Fill(p,p);
f98ea3f1 628
cc0afcfc 629 PidTPC(trackESD,pdgcode);
630 PidTOF(trackESD,pdgcode);
f98ea3f1 631 }
632
6a043318 633 //for (Int_t imc=0; imc<(mcEvent!=NULL)?mcEvent->GetNumberOfTracks():0;imc++)
634 if (mcEvent)
b9cf8f8e 635 {
6a043318 636 for (Int_t imc=0; imc<mcEvent->GetNumberOfTracks();imc++)
637 {
638 printf("imc: %i label:%i\n",imc,mcEvent->GetTrack(imc)->GetLabel());
639 fCutsMCelectrons->IsSelected(mcEvent->GetTrack(imc));
640 fCutsMCpions->IsSelected(mcEvent->GetTrack(imc));
641 fCutsMCkaons->IsSelected(mcEvent->GetTrack(imc));
642 fCutsMCprotons->IsSelected(mcEvent->GetTrack(imc));
643 fCutsMCprimaryelectrons->IsSelected(mcEvent->GetTrack(imc));
644 fCutsMCprimarypions->IsSelected(mcEvent->GetTrack(imc));
645 fCutsMCprimarykaons->IsSelected(mcEvent->GetTrack(imc));
646 fCutsMCprimaryprotons->IsSelected(mcEvent->GetTrack(imc));
647 }
b9cf8f8e 648 }
649
cdc20344 650 //check the correlation between the global and TPConly number of tracks
651 fStandardGlobalCuts->SetEvent(fESD);
652 fStandardTPCCuts->SetEvent(fESD);
2b1eaa10 653 Int_t multGlobal = fStandardGlobalCuts->Count();
654 Int_t multTPC = fStandardTPCCuts->Count();
655 fTPCvsGlobalMult->Fill(multGlobal,multTPC);
cdc20344 656
2b1eaa10 657 if (fFile)
658 {
659 const AliESDVertex* pvtx = fESD->GetPrimaryVertex();
660 const AliESDVertex* tpcvtx = fESD->GetPrimaryVertexTPC();
661 const AliESDVertex* spdvtx = fESD->GetPrimaryVertexSPD();
662 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
663 AliVEventHandler* handler = mgr->GetInputEventHandler();
664 TTree* tree = handler->GetTree();
665 TFile* file = tree->GetCurrentFile();
666 if (multTPC>(23+1.216*multGlobal) || multTPC<(-20+1.087*multGlobal))
667 {
668 fprintf(fFile, "%i %i %s %i\n",multTPC,multGlobal,file->GetName(),fESD->GetEventNumberInFile());
669 fprintf(fFile, " primary vertex: x: %.2f, y: %.2f, z: %.2f, n: %i\n", pvtx->GetX(), pvtx->GetY(), pvtx->GetZ(), pvtx->GetNContributors());
670 fprintf(fFile, " SPD vertex: x: %.2f, y: %.2f, z: %.2f, n: %i\n", spdvtx->GetX(), spdvtx->GetY(), spdvtx->GetZ(), spdvtx->GetNContributors());
671 fprintf(fFile, " TPC vertex: x: %.2f, y: %.2f, z: %.2f, n: %i\n", tpcvtx->GetX(), tpcvtx->GetY(), tpcvtx->GetZ(), tpcvtx->GetNContributors());
672 }
673 }
f98ea3f1 674}
675
676//________________________________________________________________________
677void AliAnalysisTaskPIDflowQA::Terminate(Option_t *)
678{
679 //Terminate
680 if(fCuts)
681 fCuts->Dump();
f98ea3f1 682
683 Printf("AliAnalysisTaskPIDflowQA: end of Terminate");
684}
685
f98ea3f1 686
687//________________________________________________________________________
cc0afcfc 688void AliAnalysisTaskPIDflowQA::PidTPC(AliESDtrack* t, Int_t)
f98ea3f1 689{
1a80f9f6 690 //do TPC pid
4ea2bb6b 691 const AliExternalTrackParam* innerParam = t->GetInnerParam();
692 if (!innerParam) return;
693 Double_t pinTPCglobal=innerParam->GetP();
499fe731 694 Double_t tpcSignal =t->GetTPCsignal();
1a80f9f6 695 Float_t p=innerParam->P();
f98ea3f1 696 Float_t sigPion = fESDpid->GetTPCResponse().GetExpectedSignal(pinTPCglobal, AliPID::kPion);
697 Float_t sigKaon = fESDpid->GetTPCResponse().GetExpectedSignal(pinTPCglobal, AliPID::kKaon);
698 Float_t sigProton = fESDpid->GetTPCResponse().GetExpectedSignal(pinTPCglobal, AliPID::kProton);
f98ea3f1 699 if(!(sigPion>0.0&&sigKaon>0.0&&sigProton>0.0))
700 return;
701
702 fTPCsignal->Fill(pinTPCglobal,tpcSignal);
703
1a80f9f6 704 fTPCsignalPi->Fill(p,(tpcSignal-sigPion)/sigPion);
705 fTPCsignalK->Fill(p,(tpcSignal-sigKaon)/sigKaon);
706 fTPCsignalP->Fill(p,(tpcSignal-sigProton)/sigProton);
707
9b692328 708 fCutsTPCdedxElectrons->IsSelected(t);
709 fCutsTPCdedxPions->IsSelected(t);
710 fCutsTPCdedxKaons->IsSelected(t);
711 fCutsTPCdedxProtons->IsSelected(t);
712 fCutsTPCpidElectrons->IsSelected(t);
713 fCutsTPCpidPions->IsSelected(t);
714 fCutsTPCpidKaons->IsSelected(t);
715 fCutsTPCpidProtons->IsSelected(t);
b9cf8f8e 716 fCutsTPCbayesianElectrons->IsSelected(t);
717 fCutsTPCbayesianPions->IsSelected(t);
718 fCutsTPCbayesianKaons->IsSelected(t);
719 fCutsTPCbayesianProtons->IsSelected(t);
f98ea3f1 720}
721
1a80f9f6 722//______________________________________________________________________________
cc0afcfc 723void AliAnalysisTaskPIDflowQA::PidTOF(AliESDtrack* track, Int_t)
f98ea3f1 724{
1a80f9f6 725 //do TOF pid
726 Bool_t goodtrack = (track) &&
727 (track->GetStatus() & AliESDtrack::kTOFpid) &&
728 (track->GetTOFsignal() > 12000) &&
729 (track->GetTOFsignal() < 100000) &&
f21bdf48 730 (track->GetIntegratedLength() > 365);
731
f98ea3f1 732 if (!goodtrack) return;
733
1a80f9f6 734 const Float_t c = 2.99792457999999984e-02;
735 Float_t p = track->GetP();
1a80f9f6 736 Float_t l = track->GetIntegratedLength();
737 Float_t trackT0 = fESDpid->GetTOFResponse().GetStartTime(p);
9b692328 738 //time
1a80f9f6 739 Float_t timeTOF = track->GetTOFsignal()- trackT0;
740 Double_t integratedTimes[5] = {-1.0,-1.0,-1.0,-1.0,-1.0};
741 track->GetIntegratedTimes(integratedTimes);
1a80f9f6 742 //beta
743 Float_t beta = l/timeTOF/c;
5104aa35 744 Float_t betaHypothesis[5] = {0.0,0.0,0.0,0.0,0.0};
1a80f9f6 745 Float_t betadiff[5] = {0.0,0.0,0.0,0.0,0.0};
5104aa35 746 for (Int_t i=0;i<5;i++)
747 {
1a80f9f6 748 betaHypothesis[i] = l/integratedTimes[i]/c;
749 betadiff[i] = beta-betaHypothesis[i];
5104aa35 750 }
1a80f9f6 751 //inverse beta
752 Float_t invbeta = 1/beta;
753 Float_t invbetaHypothesis[5] = {0.0,0.0,0.0,0.0,0.0};
754 Float_t invbetadiff[5] = {0.0,0.0,0.0,0.0,0.0};
755 for (Int_t i=0;i<5;i++)
756 {
757 invbetaHypothesis[i] = 1/betaHypothesis[i];
758 invbetadiff[i] = invbeta-invbetaHypothesis[i];
759 }
f98ea3f1 760
9b692328 761 Double_t tpcpid[AliPID::kSPECIES];
762 track->GetTPCpid(tpcpid);
763
764 //base hists
765 fTOFrawtime->Fill(p,timeTOF);
766 fTOFrawtimeE->Fill(p,timeTOF-integratedTimes[0]);
644f1368 767 fTOFrawtimePi->Fill(p,timeTOF-integratedTimes[2]);
768 fTOFrawtimeK->Fill(p,timeTOF-integratedTimes[3]);
769 fTOFrawtimeP->Fill(p,timeTOF-integratedTimes[4]);
9b692328 770
771 fTOFrawbeta->Fill(p,beta);
772 fTOFrawbetaE->Fill(p,betadiff[0]);
773 fTOFrawbetaPi->Fill(p,betadiff[2]);
774 fTOFrawbetaK->Fill(p,betadiff[3]);
775 fTOFrawbetaP->Fill(p,betadiff[4]);
776
777 fTOFrawinvbeta->Fill(p,invbeta);
778 fTOFrawinvbetaE->Fill(p,invbetadiff[0]);
779 fTOFrawinvbetaPi->Fill(p,invbetadiff[2]);
780 fTOFrawinvbetaK->Fill(p,invbetadiff[3]);
781 fTOFrawinvbetaP->Fill(p,invbetadiff[4]);
782
783 //cleanup with TPC
784 if (track->GetStatus() & AliESDtrack::kTOFmismatch) return;
785 if (!TPCTOFagree(track)) return;
786
1a80f9f6 787 //responses
f21bdf48 788 fTOFtime->Fill(p,timeTOF);
9b692328 789 fTOFtimeE->Fill(p,timeTOF-integratedTimes[0]);
644f1368 790 fTOFtimePi->Fill(p,timeTOF-integratedTimes[2]);
791 fTOFtimeK->Fill(p,timeTOF-integratedTimes[3]);
792 fTOFtimeP->Fill(p,timeTOF-integratedTimes[4]);
f21bdf48 793
1a80f9f6 794 fTOFbeta->Fill(p,beta);
795 fTOFbetaE->Fill(p,betadiff[0]);
796 fTOFbetaPi->Fill(p,betadiff[2]);
797 fTOFbetaK->Fill(p,betadiff[3]);
798 fTOFbetaP->Fill(p,betadiff[4]);
799
800 fTOFinvbeta->Fill(p,invbeta);
801 fTOFinvbetaE->Fill(p,invbetadiff[0]);
802 fTOFinvbetaPi->Fill(p,invbetadiff[2]);
803 fTOFinvbetaK->Fill(p,invbetadiff[3]);
804 fTOFinvbetaP->Fill(p,invbetadiff[4]);
805
9b692328 806 fCutsTOFbetaElectrons->IsSelected(track);
807 fCutsTOFbetaPions->IsSelected(track);
808 fCutsTOFbetaKaons->IsSelected(track);
809 fCutsTOFbetaProtons->IsSelected(track);
810 fCutsTOFbetaSimpleElectrons->IsSelected(track);
811 fCutsTOFbetaSimplePions->IsSelected(track);
812 fCutsTOFbetaSimpleKaons->IsSelected(track);
813 fCutsTOFbetaSimpleProtons->IsSelected(track);
b9cf8f8e 814 fCutsTOFbayesianElectrons->IsSelected(track);
815 fCutsTOFbayesianPions->IsSelected(track);
816 fCutsTOFbayesianKaons->IsSelected(track);
817 fCutsTOFbayesianProtons->IsSelected(track);
f98ea3f1 818}
819
1a80f9f6 820//______________________________________________________________________________
5104aa35 821Float_t AliAnalysisTaskPIDflowQA::Beta(Float_t m, Float_t p)
822{
823 //get theoretical beta
824 return TMath::Sqrt(1. / (1. + m * m / (p * p)));
825}
9b692328 826
827//---------------------------------------------------------------//
828Bool_t AliAnalysisTaskPIDflowQA::TPCTOFagree(const AliESDtrack *track)
829{
cc0afcfc 830 //check agreement between TOF and TPC pid
9b692328 831 Bool_t status = kFALSE;
832
833 Float_t mass[5] = {5.10998909999999971e-04,1.05658000000000002e-01,1.39570000000000000e-01,4.93676999999999977e-01,9.38271999999999995e-01};
834
835
836 Double_t exptimes[5];
837 track->GetIntegratedTimes(exptimes);
838
839 Float_t dedx = track->GetTPCsignal();
840
841 Float_t p = track->P();
842 Float_t time = track->GetTOFsignal()- fESDpid->GetTOFResponse().GetStartTime(p);
843 Float_t tl = track->GetIntegratedLength();
844
845 Float_t betagammares = fESDpid->GetTOFResponse().GetExpectedSigma(p, exptimes[4], mass[4]);
846
847 Float_t betagamma1 = tl/(time-5 *betagammares) * 33.3564095198152043;
848
849// printf("betagamma1 = %f\n",betagamma1);
850
851 if(betagamma1 < 0.1) betagamma1 = 0.1;
852
853 if(betagamma1 < 0.99999) betagamma1 /= TMath::Sqrt(1-betagamma1*betagamma1);
854 else betagamma1 = 100;
855
856 Float_t betagamma2 = tl/(time+5 *betagammares) * 33.3564095198152043;
857// printf("betagamma2 = %f\n",betagamma2);
858
859 if(betagamma2 < 0.1) betagamma2 = 0.1;
860
861 if(betagamma2 < 0.99999) betagamma2 /= TMath::Sqrt(1-betagamma2*betagamma2);
862 else betagamma2 = 100;
863
864
865 Double_t ptpc[3];
866 track->GetInnerPxPyPz(ptpc);
867 Float_t momtpc=TMath::Sqrt(ptpc[0]*ptpc[0] + ptpc[1]*ptpc[1] + ptpc[2]*ptpc[2]);
868
869 for(Int_t i=0;i < 5;i++){
870 Float_t resolutionTOF = fESDpid->GetTOFResponse().GetExpectedSigma(p, exptimes[i], mass[i]);
871 if(TMath::Abs(exptimes[i] - time) < 5 * resolutionTOF){
872 Float_t dedxExp = 0;
873 if(i==0) dedxExp = fESDpid->GetTPCResponse().GetExpectedSignal(momtpc,AliPID::kElectron);
874 else if(i==1) dedxExp = fESDpid->GetTPCResponse().GetExpectedSignal(momtpc,AliPID::kMuon);
875 else if(i==2) dedxExp = fESDpid->GetTPCResponse().GetExpectedSignal(momtpc,AliPID::kPion);
876 else if(i==3) dedxExp = fESDpid->GetTPCResponse().GetExpectedSignal(momtpc,AliPID::kKaon);
877 else if(i==4) dedxExp = fESDpid->GetTPCResponse().GetExpectedSignal(momtpc,AliPID::kProton);
878
879 Float_t resolutionTPC = 2;
880 if(i==0) resolutionTPC = fESDpid->GetTPCResponse().GetExpectedSigma(momtpc,track->GetTPCsignalN(),AliPID::kElectron);
881 else if(i==1) resolutionTPC = fESDpid->GetTPCResponse().GetExpectedSigma(momtpc,track->GetTPCsignalN(),AliPID::kMuon);
882 else if(i==2) resolutionTPC = fESDpid->GetTPCResponse().GetExpectedSigma(momtpc,track->GetTPCsignalN(),AliPID::kPion);
883 else if(i==3) resolutionTPC = fESDpid->GetTPCResponse().GetExpectedSigma(momtpc,track->GetTPCsignalN(),AliPID::kKaon);
884 else if(i==4) resolutionTPC = fESDpid->GetTPCResponse().GetExpectedSigma(momtpc,track->GetTPCsignalN(),AliPID::kProton);
885
886 if(TMath::Abs(dedx - dedxExp) < 3 * resolutionTPC){
887 status = kTRUE;
888 }
889 }
890 }
891
892 Float_t bb1 = fESDpid->GetTPCResponse().Bethe(betagamma1);
893 Float_t bb2 = fESDpid->GetTPCResponse().Bethe(betagamma2);
894 Float_t bbM = fESDpid->GetTPCResponse().Bethe((betagamma1+betagamma2)*0.5);
895
896
897 // status = kFALSE;
898 // for nuclei
899 Float_t resolutionTOFpr = fESDpid->GetTOFResponse().GetExpectedSigma(p, exptimes[4], mass[4]);
900 Float_t resolutionTPCpr = fESDpid->GetTPCResponse().GetExpectedSigma(momtpc,track->GetTPCsignalN(),AliPID::kProton);
901 if(TMath::Abs(dedx-bb1) < resolutionTPCpr*3 && exptimes[4] < time-7*resolutionTOFpr){
902 status = kTRUE;
903 }
904 else if(TMath::Abs(dedx-bb2) < resolutionTPCpr*3 && exptimes[4] < time-7*resolutionTOFpr){
905 status = kTRUE;
906 }
907 else if(TMath::Abs(dedx-bbM) < resolutionTPCpr*3 && exptimes[4] < time-7*resolutionTOFpr){
908 status = kTRUE;
909 }
910
911 return status;
912}
5104aa35 913