]>
Commit | Line | Data |
---|---|---|
896d3200 | 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 | // QA task | |
17 | // | |
18 | // Authors: | |
19 | // Raphaelle Bailhache <R.Bailhache@gsi.de> | |
20 | // | |
21 | #include "TROOT.h" | |
22 | #include "TChain.h" | |
23 | #include "TMath.h" | |
24 | #include <TString.h> | |
25 | #include <TBits.h> | |
26 | #include <TH1F.h> | |
27 | ||
28 | #include <TDirectory.h> | |
29 | #include <TTreeStream.h> | |
30 | ||
31 | #include "AliVEventHandler.h" | |
32 | #include "AliMCEventHandler.h" | |
33 | #include "AliAnalysisTaskSE.h" | |
34 | #include "AliAnalysisManager.h" | |
35 | ||
36 | #include "AliVEvent.h" | |
37 | #include "AliESDInputHandler.h" | |
38 | #include "AliMCEvent.h" | |
39 | #include "AliESD.h" | |
40 | #include "AliESDEvent.h" | |
41 | #include "AliPID.h" | |
42 | #include "AliPIDResponse.h" | |
43 | #include "AliESDUtils.h" | |
44 | #include "AliMCParticle.h" | |
45 | #include "AliAODMCParticle.h" | |
46 | #include "AliAODEvent.h" | |
47 | #include "AliAODVertex.h" | |
48 | #include "AliAODTrack.h" | |
49 | #include "AliVTrack.h" | |
50 | #include "AliESDtrack.h" | |
51 | #include "AliESDtrackCuts.h" | |
52 | #include "AliAODTrack.h" | |
53 | #include "AliStack.h" | |
54 | #include "AliMCEvent.h" | |
55 | ||
56 | #include "AliHFEcuts.h" | |
57 | #include "AliHFEpid.h" | |
58 | #include "AliHFEpidQAmanager.h" | |
59 | #include "AliHFEtools.h" | |
60 | ||
61 | #include "AliCentrality.h" | |
62 | #include "AliEventplane.h" | |
63 | #include "AliAnalysisTaskHFEQA.h" | |
64 | #include "AliAODMCHeader.h" | |
65 | ||
66 | ||
67 | ClassImp(AliAnalysisTaskHFEQA) | |
68 | ||
69 | //____________________________________________________________________ | |
70 | AliAnalysisTaskHFEQA::AliAnalysisTaskHFEQA() : | |
71 | AliAnalysisTaskSE(), | |
72 | fListHist(0x0), | |
73 | fAODAnalysis(kFALSE), | |
74 | fAODMCHeader(NULL), | |
75 | fAODArrayMCInfo(NULL), | |
76 | fHFECuts(0), | |
77 | fPIDTPConly(0), | |
78 | fPIDTRDonly(0), | |
79 | fPIDTOFTPC(0), | |
80 | fPIDTPCTRD(0), | |
81 | fPIDTPCEMCal(0), | |
82 | fPIDqaTRDonly(0), | |
83 | fPIDqaTOFTPC(0), | |
84 | fPIDqaTPCTRD(0), | |
85 | fPIDqaTPCEMCal(0), | |
86 | fCentralityEstimator("V0M"), | |
87 | fCollisionSystem(3), | |
88 | fNbEvent(0), | |
89 | fTPConly(0), | |
90 | fTOFTPC(0), | |
91 | fTPCTRD(0), | |
92 | fTPCEMCal(0), | |
93 | fTPConlydo(kFALSE), | |
94 | fTRDonlydo(kFALSE), | |
95 | fTOFTPCdo(kFALSE), | |
96 | fTPCTRDdo(kFALSE), | |
97 | fTPCEMCaldo(kFALSE) | |
98 | { | |
99 | // Constructor | |
100 | ||
101 | } | |
102 | //______________________________________________________________________________ | |
103 | AliAnalysisTaskHFEQA:: AliAnalysisTaskHFEQA(const char *name) : | |
104 | AliAnalysisTaskSE(name), | |
105 | fListHist(0x0), | |
106 | fAODAnalysis(kFALSE), | |
107 | fAODMCHeader(NULL), | |
108 | fAODArrayMCInfo(NULL), | |
109 | fHFECuts(0), | |
110 | fPIDTPConly(0), | |
111 | fPIDTRDonly(0), | |
112 | fPIDTOFTPC(0), | |
113 | fPIDTPCTRD(0), | |
114 | fPIDTPCEMCal(0), | |
115 | fPIDqaTRDonly(0), | |
116 | fPIDqaTOFTPC(0), | |
117 | fPIDqaTPCTRD(0), | |
118 | fPIDqaTPCEMCal(0), | |
119 | fCentralityEstimator("V0M"), | |
120 | fCollisionSystem(3), | |
121 | fNbEvent(0), | |
122 | fTPConly(0), | |
123 | fTOFTPC(0), | |
124 | fTPCTRD(0), | |
125 | fTPCEMCal(0), | |
126 | fTPConlydo(kFALSE), | |
127 | fTRDonlydo(kFALSE), | |
128 | fTOFTPCdo(kFALSE), | |
129 | fTPCTRDdo(kFALSE), | |
130 | fTPCEMCaldo(kFALSE) | |
131 | { | |
132 | // | |
133 | // named ctor | |
134 | // | |
135 | ||
136 | fPIDTPConly = new AliHFEpid("hfePidTPConly"); | |
137 | fPIDTRDonly = new AliHFEpid("hfePidTRDonly"); | |
138 | fPIDTOFTPC = new AliHFEpid("hfePidTOFTPC"); | |
139 | fPIDTPCTRD = new AliHFEpid("hfePidTPCTRD"); | |
140 | fPIDTPCEMCal = new AliHFEpid("hfePidTPCEMCal"); | |
141 | ||
142 | fPIDqaTRDonly = new AliHFEpidQAmanager; | |
143 | fPIDqaTOFTPC = new AliHFEpidQAmanager; | |
144 | fPIDqaTPCTRD = new AliHFEpidQAmanager; | |
145 | fPIDqaTPCEMCal = new AliHFEpidQAmanager; | |
146 | ||
147 | SetPbPbAnalysis(); | |
148 | ||
149 | DefineInput(0,TChain::Class()); | |
150 | DefineOutput(1, TList::Class()); | |
151 | ||
152 | } | |
153 | //____________________________________________________________ | |
154 | AliAnalysisTaskHFEQA::AliAnalysisTaskHFEQA(const AliAnalysisTaskHFEQA &ref): | |
155 | AliAnalysisTaskSE(ref), | |
156 | fListHist(NULL), | |
157 | fAODAnalysis(ref.fAODAnalysis), | |
158 | fAODMCHeader(ref.fAODMCHeader), | |
159 | fAODArrayMCInfo(ref.fAODArrayMCInfo), | |
160 | fHFECuts(NULL), | |
161 | fPIDTPConly(0), | |
162 | fPIDTRDonly(0), | |
163 | fPIDTOFTPC(0), | |
164 | fPIDTPCTRD(0), | |
165 | fPIDTPCEMCal(0), | |
166 | fPIDqaTRDonly(0), | |
167 | fPIDqaTOFTPC(0), | |
168 | fPIDqaTPCTRD(0), | |
169 | fPIDqaTPCEMCal(0), | |
170 | fCentralityEstimator(ref.fCentralityEstimator), | |
171 | fCollisionSystem(ref.fCollisionSystem), | |
172 | fNbEvent(ref.fNbEvent), | |
173 | fTPConly(ref.fTPConly), | |
174 | fTOFTPC(ref.fTOFTPC), | |
175 | fTPCTRD(ref.fTPCTRD), | |
176 | fTPCEMCal(ref.fTPCEMCal), | |
177 | fTPConlydo(ref.fTPConlydo), | |
178 | fTRDonlydo(ref.fTRDonlydo), | |
179 | fTOFTPCdo(ref.fTOFTPCdo), | |
180 | fTPCTRDdo(ref.fTPCTRDdo), | |
181 | fTPCEMCaldo(ref.fTPCEMCaldo) | |
182 | { | |
183 | // | |
184 | // Copy Constructor | |
185 | // | |
186 | ||
187 | ref.Copy(*this); | |
188 | } | |
189 | ||
190 | //____________________________________________________________ | |
191 | AliAnalysisTaskHFEQA &AliAnalysisTaskHFEQA::operator=(const AliAnalysisTaskHFEQA &ref){ | |
192 | // | |
193 | // Assignment operator | |
194 | // | |
195 | if(this == &ref) | |
196 | ref.Copy(*this); | |
197 | return *this; | |
198 | } | |
199 | ||
200 | //____________________________________________________________ | |
201 | void AliAnalysisTaskHFEQA::Copy(TObject &o) const { | |
202 | // | |
203 | // Copy into object o | |
204 | // | |
205 | AliAnalysisTaskHFEQA &target = dynamic_cast<AliAnalysisTaskHFEQA &>(o); | |
206 | target.fListHist = fListHist; | |
207 | target.fAODAnalysis = fAODAnalysis; | |
208 | target.fAODMCHeader = fAODMCHeader; | |
209 | target.fAODArrayMCInfo = fAODArrayMCInfo; | |
210 | target.fHFECuts = fHFECuts; | |
211 | target.fPIDTPConly = fPIDTPConly; | |
212 | target.fPIDTRDonly = fPIDTRDonly; | |
213 | target.fPIDTOFTPC = fPIDTOFTPC; | |
214 | target.fPIDTPCTRD = fPIDTPCTRD; | |
215 | target.fPIDTPCEMCal = fPIDTPCEMCal; | |
216 | target.fPIDqaTRDonly = fPIDqaTRDonly; | |
217 | target.fPIDqaTOFTPC = fPIDqaTOFTPC; | |
218 | target.fPIDqaTPCTRD = fPIDqaTPCTRD; | |
219 | target.fPIDqaTPCEMCal = fPIDqaTPCEMCal; | |
220 | target.fCentralityEstimator = fCentralityEstimator; | |
221 | target.fCollisionSystem = fCollisionSystem; | |
222 | target.fNbEvent = fNbEvent; | |
223 | target.fTPConly = fTPConly; | |
224 | target.fTOFTPC = fTOFTPC; | |
225 | target.fTPCTRD = fTPCTRD; | |
226 | target.fTPCEMCal = fTPCEMCal; | |
227 | target.fTPConlydo = fTPConlydo; | |
228 | target.fTRDonlydo = fTRDonlydo; | |
229 | target.fTOFTPCdo = fTOFTPCdo; | |
230 | target.fTPCTRDdo = fTPCTRDdo; | |
231 | target.fTPCEMCaldo = fTPCEMCaldo; | |
232 | ||
233 | ||
234 | } | |
235 | //____________________________________________________________ | |
236 | AliAnalysisTaskHFEQA::~AliAnalysisTaskHFEQA(){ | |
237 | // | |
238 | // Destructor | |
239 | // | |
240 | ||
241 | ||
242 | if(fListHist) delete fListHist; | |
243 | if(fHFECuts) delete fHFECuts; | |
244 | if(fPIDTPConly) delete fPIDTPConly; | |
245 | if(fPIDTRDonly) delete fPIDTRDonly; | |
246 | if(fPIDTOFTPC) delete fPIDTOFTPC; | |
247 | if(fPIDTPCTRD) delete fPIDTPCTRD; | |
248 | if(fPIDTPCEMCal) delete fPIDTPCEMCal; | |
249 | ||
250 | ||
251 | } | |
252 | //________________________________________________________________________ | |
253 | void AliAnalysisTaskHFEQA::UserCreateOutputObjects() | |
254 | { | |
255 | ||
256 | //******************** | |
257 | // Create histograms | |
258 | //******************** | |
259 | AliDebug(2,"AliAnalysisTaskHFEQA: User create output objects"); | |
260 | ||
261 | ||
262 | // AOD or ESD | |
263 | AliVEventHandler *inputHandler = dynamic_cast<AliVEventHandler *>(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()); | |
264 | if(!TString(inputHandler->IsA()->GetName()).CompareTo("AliAODInputHandler")){ | |
265 | SetAODAnalysis(kTRUE); | |
266 | AliDebug(2,"Put AOD analysis on"); | |
267 | } else { | |
268 | SetAODAnalysis(kFALSE); | |
269 | } | |
270 | ||
271 | AliDebug(2,"AliAnalysisTaskHFEQA: AOD ESD"); | |
272 | ||
273 | // HFE cuts | |
274 | ||
275 | if(!fHFECuts){ | |
276 | fHFECuts = new AliHFEcuts; | |
277 | fHFECuts->CreateStandardCuts(); | |
278 | } | |
279 | fHFECuts->Initialize(); | |
280 | if(fAODAnalysis) { | |
281 | fHFECuts->SetAOD(); | |
282 | } | |
283 | ||
284 | AliDebug(2,"AliAnalysisTaskHFEQA: HFE cuts"); | |
285 | ||
286 | ||
287 | // PIDTPConly HFE | |
288 | if(!fPIDTPConly) { | |
289 | fPIDTPConly =new AliHFEpid("hfePidTPConly"); | |
290 | } | |
291 | if(!fPIDTPConly->GetNumberOfPIDdetectors()) fPIDTPConly->AddDetector("TPC", 0); | |
292 | fPIDTPConly->InitializePID(); | |
293 | fPIDTPConly->SortDetectors(); | |
294 | ||
295 | // PIDTRDonly HFE | |
296 | if(!fPIDTRDonly) { | |
297 | fPIDTRDonly =new AliHFEpid("hfePidTRDonly"); | |
298 | } | |
299 | if(!fPIDTRDonly->GetNumberOfPIDdetectors()) fPIDTRDonly->AddDetector("TRD", 0); | |
300 | fPIDTRDonly->InitializePID(); | |
301 | fPIDqaTRDonly->Initialize(fPIDTRDonly); | |
302 | fPIDTRDonly->SortDetectors(); | |
303 | ||
304 | // PIDTOFTPC HFE | |
305 | if(!fPIDTOFTPC) { | |
306 | fPIDTOFTPC =new AliHFEpid("hfePidTOFTPC"); | |
307 | } | |
308 | if(!fPIDTOFTPC->GetNumberOfPIDdetectors()) { | |
309 | fPIDTOFTPC->AddDetector("TOF", 0); | |
310 | fPIDTOFTPC->AddDetector("TPC", 1); | |
311 | } | |
312 | fPIDTOFTPC->InitializePID(); | |
313 | fPIDqaTOFTPC->Initialize(fPIDTOFTPC); | |
314 | fPIDTOFTPC->SortDetectors(); | |
315 | ||
316 | ||
317 | // PIDTPCTRD HFE | |
318 | if(!fPIDTPCTRD) { | |
319 | fPIDTPCTRD =new AliHFEpid("hfePidTPCTRD"); | |
320 | } | |
321 | if(!fPIDTPCTRD->GetNumberOfPIDdetectors()) { | |
322 | fPIDTPCTRD->AddDetector("TPC", 0); | |
323 | fPIDTPCTRD->AddDetector("TRD", 1); | |
324 | } | |
325 | fPIDTPCTRD->InitializePID(); | |
326 | fPIDqaTPCTRD->Initialize(fPIDTPCTRD); | |
327 | fPIDTPCTRD->SortDetectors(); | |
328 | ||
329 | // PIDTPCEMCal HFE | |
330 | if(!fPIDTPCEMCal) { | |
331 | fPIDTPCEMCal =new AliHFEpid("hfePidTPCEMCal"); | |
332 | } | |
333 | if(!fPIDTPCEMCal->GetNumberOfPIDdetectors()) { | |
334 | fPIDTPCEMCal->AddDetector("TPC", 0); | |
335 | fPIDTPCEMCal->AddDetector("EMCal", 1); | |
336 | } | |
337 | fPIDTPCEMCal->InitializePID(); | |
338 | fPIDqaTPCEMCal->Initialize(fPIDTPCEMCal); | |
339 | fPIDTPCEMCal->SortDetectors(); | |
340 | ||
341 | // Histograms | |
342 | fNbEvent = new TH1F("NbEvent", "",11,0,11); | |
343 | fNbEvent->Sumw2(); | |
344 | Double_t ptbinning[36] = {0., 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1., 1.1, 1.2, 1.3, 1.4, 1.5, 1.75, 2., 2.25, 2.5, 2.75, 3., 3.5, 4., 4.5, 5., 5.5, 6., 7., 8., 10., 12., 14., 16., 18., 20.}; | |
345 | fTPConly = new TH1F("TPCOnly", "",35,&ptbinning[0]); | |
346 | fTPConly->Sumw2(); | |
347 | fTOFTPC = new TH1F("TOFTPC", "",35,&ptbinning[0]); | |
348 | fTOFTPC->Sumw2(); | |
349 | fTPCTRD = new TH1F("TPCTRD", "",35,&ptbinning[0]); | |
350 | fTPCTRD->Sumw2(); | |
351 | fTPCEMCal = new TH1F("TPCEMCal", "",35,&ptbinning[0]); | |
352 | fTPCEMCal->Sumw2(); | |
353 | ||
354 | ||
355 | // List | |
356 | ||
357 | fListHist = new TList(); | |
358 | fListHist->SetOwner(); | |
359 | ||
360 | fListHist->Add(fPIDqaTRDonly->MakeList("HFEpidQATRDonly")); | |
361 | fListHist->Add(fPIDqaTOFTPC->MakeList("HFEpidQATOFTPC")); | |
362 | fListHist->Add(fPIDqaTPCTRD->MakeList("HFEpidQATPCTRD")); | |
363 | fListHist->Add(fPIDqaTPCEMCal->MakeList("HFEpidQATPCEMCal")); | |
364 | ||
365 | fListHist->Add(fNbEvent); | |
366 | fListHist->Add(fTPConly); | |
367 | fListHist->Add(fTOFTPC); | |
368 | fListHist->Add(fTPCTRD); | |
369 | fListHist->Add(fTPCEMCal); | |
370 | ||
371 | AliDebug(2,"AliAnalysisTaskHFEQA: list"); | |
372 | ||
373 | ||
374 | fListHist->Print(); | |
375 | ||
376 | PostData(1, fListHist); | |
377 | ||
378 | AliDebug(2,"AliAnalysisTaskHFEQA: post"); | |
379 | ||
380 | ||
381 | } | |
382 | ||
383 | //________________________________________________________________________ | |
384 | void AliAnalysisTaskHFEQA::UserExec(Option_t */*option*/) | |
385 | { | |
386 | // | |
387 | // Loop over event | |
388 | // | |
389 | ||
390 | Double_t binct = 11.5; | |
391 | ||
392 | AliMCEvent *mcEvent = MCEvent(); | |
393 | ||
394 | ||
395 | AliDebug(2,"MC info"); | |
396 | // MC info | |
397 | Bool_t mcthere = kTRUE; | |
398 | if(fAODAnalysis) { | |
399 | AliAODEvent *aodE = dynamic_cast<AliAODEvent *>(fInputEvent); | |
400 | if(!aodE){ | |
401 | AliError("No AOD Event"); | |
402 | return; | |
403 | } | |
404 | fAODMCHeader = dynamic_cast<AliAODMCHeader *>(fInputEvent->FindListObject(AliAODMCHeader::StdBranchName())); | |
405 | if(!fAODMCHeader){ | |
406 | mcthere = kFALSE; | |
407 | } | |
408 | fAODArrayMCInfo = dynamic_cast<TClonesArray *>(fInputEvent->FindListObject(AliAODMCParticle::StdBranchName())); | |
409 | if(!fAODArrayMCInfo){ | |
410 | mcthere = kFALSE; | |
411 | } | |
412 | else { | |
413 | fHFECuts->SetMCEvent(aodE); | |
414 | } | |
415 | } | |
416 | else { | |
417 | AliMCEventHandler *mcH = dynamic_cast<AliMCEventHandler *>(AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler()); | |
418 | if(!mcH){ | |
419 | mcthere=kFALSE; | |
420 | } | |
421 | if(mcEvent) fHFECuts->SetMCEvent(mcEvent); | |
422 | } | |
423 | ||
424 | ||
425 | //////////////////////////////////// | |
426 | // Number of contributors | |
427 | /////////////////////////////////// | |
428 | AliDebug(2,"Number of contributors"); | |
429 | Int_t ncontribVtx = 0; | |
430 | if(fAODAnalysis) { | |
431 | AliAODEvent *fAOD = dynamic_cast<AliAODEvent *>(fInputEvent); | |
432 | if(!fAOD){ | |
433 | AliError("AOD Event required for AOD Analysis"); | |
434 | return; | |
435 | } | |
436 | AliAODVertex *priVtx = fAOD->GetPrimaryVertex(); | |
437 | if(priVtx){ | |
438 | ncontribVtx = priVtx->GetNContributors(); | |
439 | } | |
440 | } | |
441 | else { | |
442 | AliESDEvent *fESD = dynamic_cast<AliESDEvent *>(fInputEvent); | |
443 | if(!fESD){ | |
444 | AliError("ESD Event required for ESD Analysis"); | |
445 | return; | |
446 | } | |
447 | const AliESDVertex *priVtx = fESD->GetPrimaryVertexTracks(); | |
448 | if(priVtx){ | |
449 | ncontribVtx = priVtx->GetNContributors(); | |
450 | } | |
451 | } | |
452 | AliDebug(2,Form("Number of contributors %d",ncontribVtx)); | |
453 | ||
454 | ||
455 | ///////////////////////////////// | |
456 | // centrality | |
457 | //////////////////////////////// | |
458 | ||
459 | //printf("Centrality \n"); | |
460 | AliCentrality *centrality = fInputEvent->GetCentrality(); | |
461 | AliDebug(2,"Got the centrality"); | |
462 | Float_t cntr = 0.; | |
463 | if(centrality && (! Ispp())) { | |
464 | cntr = centrality->GetCentralityPercentile(fCentralityEstimator.Data()); | |
465 | if((0.0< cntr) && (cntr<5.0)) binct = 0.5; | |
466 | if((5.0< cntr) && (cntr<10.0)) binct = 1.5; | |
467 | if((10.0< cntr) && (cntr<20.0)) binct = 2.5; | |
468 | if((20.0< cntr) && (cntr<30.0)) binct = 3.5; | |
469 | if((30.0< cntr) && (cntr<40.0)) binct = 4.5; | |
470 | if((40.0< cntr) && (cntr<50.0)) binct = 5.5; | |
471 | if((50.0< cntr) && (cntr<60.0)) binct = 6.5; | |
472 | if((60.0< cntr) && (cntr<70.0)) binct = 7.5; | |
473 | if((70.0< cntr) && (cntr<80.0)) binct = 8.5; | |
474 | if((80.0< cntr) && (cntr<90.0)) binct = 9.5; | |
475 | if((90.0< cntr) && (cntr<100.0)) binct = 10.5; | |
476 | if(binct > 11.0) return; | |
477 | } | |
478 | else binct = 0.5; | |
479 | AliDebug(2,Form("Centrality %f with %s",binct,fCentralityEstimator.Data())); | |
480 | ||
481 | ////////////////////// | |
482 | // run number | |
483 | ////////////////////// | |
484 | ||
485 | Int_t runnumber = fInputEvent->GetRunNumber(); | |
486 | AliDebug(2,Form("Run number %d",runnumber)); | |
487 | ||
488 | if(!fPIDTPConly->IsInitialized()){ | |
489 | fPIDTPConly->InitializePID(runnumber); | |
490 | } | |
491 | if(!fPIDTRDonly->IsInitialized()){ | |
492 | fPIDTRDonly->InitializePID(runnumber); | |
493 | } | |
494 | if(!fPIDTOFTPC->IsInitialized()){ | |
495 | fPIDTOFTPC->InitializePID(runnumber); | |
496 | } | |
497 | if(!fPIDTPCTRD->IsInitialized()){ | |
498 | fPIDTPCTRD->InitializePID(runnumber); | |
499 | } | |
500 | if(!fPIDTPCEMCal->IsInitialized()){ | |
501 | fPIDTPCEMCal->InitializePID(runnumber); | |
502 | } | |
503 | ||
504 | // | |
505 | fHFECuts->SetRecEvent(fInputEvent); | |
506 | ||
507 | ||
508 | ||
509 | ////////// | |
510 | // PID | |
511 | ////////// | |
512 | AliDebug(2,"PID response"); | |
513 | AliPIDResponse *pidResponse = fInputHandler->GetPIDResponse(); | |
514 | if(!pidResponse){ | |
515 | AliDebug(2,"No PID response set"); | |
516 | return; | |
517 | } | |
518 | fPIDTPConly->SetPIDResponse(pidResponse); | |
519 | fPIDTRDonly->SetPIDResponse(pidResponse); | |
520 | fPIDTOFTPC->SetPIDResponse(pidResponse); | |
521 | fPIDTPCTRD->SetPIDResponse(pidResponse); | |
522 | fPIDTPCEMCal->SetPIDResponse(pidResponse); | |
523 | ||
524 | ////////////////// | |
525 | // Event cut | |
526 | ////////////////// | |
527 | AliDebug(2,"Event cut"); | |
528 | if(!fHFECuts->CheckEventCuts("fEvRecCuts", fInputEvent)) { | |
529 | AliDebug(2,"Does not pass the event cut"); | |
530 | PostData(1, fListHist); | |
531 | return; | |
532 | } | |
533 | fNbEvent->Fill(binct); | |
534 | ||
535 | ////////////////////////// | |
536 | // Loop over track | |
537 | ////////////////////////// | |
538 | Int_t nbtracks = fInputEvent->GetNumberOfTracks(); | |
539 | AliDebug(2,Form("Number of tracks %d",nbtracks)); | |
540 | for(Int_t k = 0; k < nbtracks; k++){ | |
541 | ||
542 | AliVTrack *track = (AliVTrack *) fInputEvent->GetTrack(k); | |
543 | if(!track) continue; | |
544 | Double_t pt = track->Pt(); | |
545 | ||
546 | AliDebug(2,"test 0\n"); | |
547 | ||
548 | // RecKine: ITSTPC cuts | |
549 | if(!fHFECuts->CheckParticleCuts(AliHFEcuts::kStepRecKineITSTPC + AliHFEcuts::kNcutStepsMCTrack, (TObject *)track)) continue; | |
550 | AliDebug(2,"test 1\n"); | |
551 | ||
552 | // RecPrim | |
553 | if(!fHFECuts->CheckParticleCuts(AliHFEcuts::kStepRecPrim + AliHFEcuts::kNcutStepsMCTrack, (TObject *)track)) continue; | |
554 | AliDebug(2,"test 2\n"); | |
555 | ||
556 | // HFEcuts: ITS layers cuts | |
557 | if(!fHFECuts->CheckParticleCuts(AliHFEcuts::kStepHFEcutsITS + AliHFEcuts::kNcutStepsMCTrack, (TObject *)track)) continue; | |
558 | AliDebug(2,"test 3\n"); | |
559 | ||
560 | // HFE cuts: TOF and mismatch flag | |
561 | if(!fHFECuts->CheckParticleCuts(AliHFEcuts::kStepHFEcutsTOF + AliHFEcuts::kNcutStepsMCTrack, (TObject *)track)) continue; | |
562 | AliDebug(2,"test 4\n"); | |
563 | ||
564 | // HFE cuts: TPC PID cleanup | |
565 | if(!fHFECuts->CheckParticleCuts(AliHFEcuts::kStepHFEcutsTPC + AliHFEcuts::kNcutStepsMCTrack, (TObject *)track)) continue; | |
566 | AliDebug(2,"test 5\n"); | |
567 | ||
568 | // HFEcuts: Nb of tracklets TRD0 | |
569 | if(!fHFECuts->CheckParticleCuts(AliHFEcuts::kStepHFEcutsTRD + AliHFEcuts::kNcutStepsMCTrack, (TObject *)track)) continue; | |
570 | ||
571 | AliDebug(2,"Survived"); | |
572 | ||
573 | ||
574 | //////////////////////// | |
575 | // Apply PID | |
576 | //////////////////////// | |
577 | AliHFEpidObject hfetrack; | |
578 | if(!fAODAnalysis) hfetrack.SetAnalysisType(AliHFEpidObject::kESDanalysis); | |
579 | else hfetrack.SetAnalysisType(AliHFEpidObject::kAODanalysis); | |
580 | hfetrack.SetRecTrack(track); | |
581 | hfetrack.SetCentrality((Int_t)binct); | |
582 | hfetrack.SetMulitplicity(ncontribVtx); // for correction | |
583 | if(IsPbPb()) hfetrack.SetPbPb(); | |
584 | else{ | |
585 | if(IspPb()) hfetrack.SetpPb(); | |
586 | else { | |
587 | hfetrack.SetPP(); | |
588 | //printf("pp\n"); | |
589 | } | |
590 | } | |
591 | AliDebug(2,Form("centrality %f and %d",binct,hfetrack.GetCentrality())); | |
592 | ||
593 | //printf("test 7\n"); | |
594 | ||
595 | // Complete PID TPC alone | |
596 | if(fTPConlydo) { | |
597 | if(fPIDTPConly->IsSelected(&hfetrack,0x0,"recTrackCont",0x0)) { | |
598 | fTPConly->Fill(pt); | |
599 | } | |
600 | } | |
601 | AliDebug(2,"TPC only PID\n"); | |
602 | ||
603 | // Complete PID TRD alone | |
604 | if(fTRDonlydo) { | |
605 | if(fPIDTRDonly->IsSelected(&hfetrack,0x0,"recTrackCont",fPIDqaTRDonly)) { | |
606 | AliDebug(2,"Passed TRD only PID\n"); | |
607 | } | |
608 | } | |
609 | AliDebug(2,"TRD only PID\n"); | |
610 | ||
611 | ||
612 | // Complete PID TPC TOF | |
613 | if(fTOFTPCdo) { | |
614 | if(fPIDTOFTPC->IsSelected(&hfetrack,0x0,"recTrackCont",fPIDqaTOFTPC)) { | |
615 | fTOFTPC->Fill(pt); | |
616 | } | |
617 | } | |
618 | AliDebug(2,"TOF TPC PID\n"); | |
619 | ||
620 | // Complete PID TPC TRD | |
621 | if(fTPCTRDdo) { | |
622 | if(fPIDTPCTRD->IsSelected(&hfetrack,0x0,"recTrackCont",fPIDqaTPCTRD)) { | |
623 | fTPCTRD->Fill(pt); | |
624 | } | |
625 | } | |
626 | AliDebug(2,"TPC TRD PID\n"); | |
627 | ||
628 | ||
629 | if(fTPCEMCaldo) { | |
630 | if(!fAODAnalysis) { | |
631 | // Complete PID TPC TRD | |
632 | if(fPIDTPCEMCal->IsSelected(&hfetrack,0x0,"recTrackCont",fPIDqaTPCEMCal)) { | |
633 | fTPCEMCal->Fill(pt); | |
634 | } | |
635 | } | |
636 | } | |
637 | AliDebug(2,"TPC EMCal PID\n"); | |
638 | ||
639 | ||
640 | } | |
641 | ||
642 | PostData(1, fListHist); | |
643 | ||
644 | } |