]>
Commit | Line | Data |
---|---|---|
01745870 | 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 | // The analysis task: | |
17 | // Filling an AliCFContainer with the quantities pt, eta and phi | |
18 | // for tracks which survivied the particle cuts (MC resp. ESD tracks) | |
19 | // Track selection is done using the AliHFE package | |
20 | // | |
21 | // Author: | |
22 | // Raphaelle Bailhache <R.Bailhache@gsi.de> | |
23 | // Markus Fasel <M.Fasel@gsi.de> | |
24 | // Matus Kalisky <matus.kalisky@cern.ch> | |
25 | // MinJung Kweon <minjung@physi.uni-heidelberg.de> | |
26 | // | |
27 | #include <TAxis.h> | |
28 | #include <TBits.h> | |
29 | #include <TCanvas.h> | |
30 | #include <TChain.h> | |
31 | #include <TDirectory.h> | |
32 | #include <TFile.h> | |
33 | #include <TH3D.h> | |
34 | #include <TIterator.h> | |
35 | #include <TList.h> | |
36 | #include <TLegend.h> | |
37 | #include <TMath.h> | |
38 | #include <TObjArray.h> | |
39 | #include <TObjString.h> | |
40 | #include <TParticle.h> | |
41 | #include <TProfile.h> | |
42 | #include <TString.h> | |
43 | #include <TF1.h> | |
44 | #include <TTree.h> | |
45 | ||
46 | #include "AliESDtrackCuts.h" | |
47 | #include "AliAnalysisManager.h" | |
48 | #include "AliAnalysisUtils.h" | |
49 | #include "AliAODInputHandler.h" | |
50 | #include "AliAODMCParticle.h" | |
51 | #include "AliAODTrack.h" | |
52 | #include "AliAODVertex.h" | |
53 | #include "AliCentrality.h" | |
54 | #include "AliCFContainer.h" | |
55 | #include "AliCFManager.h" | |
56 | #include "AliESDEvent.h" | |
57 | #include "AliESDInputHandler.h" | |
58 | #include "AliESDtrack.h" | |
59 | #include "AliLog.h" | |
60 | #include "AliMCEvent.h" | |
61 | #include "AliMCEventHandler.h" | |
62 | #include "AliMCParticle.h" | |
63 | #include "AliMultiplicity.h" | |
64 | #include "AliPID.h" | |
65 | #include "AliPIDResponse.h" | |
66 | #include "AliOADBContainer.h" | |
67 | #include "AliStack.h" | |
68 | #include "AliTriggerAnalysis.h" | |
4437a0d2 | 69 | #include "AliTRDTriggerAnalysis.h" |
01745870 | 70 | #include "AliVVertex.h" |
71 | ||
72 | #include "AliHFEcollection.h" | |
73 | #include "AliHFEcontainer.h" | |
74 | #include "AliHFEcuts.h" | |
75 | #include "AliHFEelecbackground.h" | |
76 | #include "AliHFENonPhotonicElectron.h" | |
77 | #include "AliHFEmcQA.h" | |
78 | #include "AliHFEpairs.h" | |
79 | #include "AliHFEpid.h" | |
80 | #include "AliHFEpidQAmanager.h" | |
81 | #include "AliHFEsecVtxs.h" | |
82 | #include "AliHFEsecVtx.h" | |
83 | #include "AliHFEsignalCuts.h" | |
84 | #include "AliHFEtaggedTrackAnalysis.h" | |
85 | #include "AliHFEtools.h" | |
7986e54e | 86 | #include "AliHFEV0taginfo.h" |
01745870 | 87 | #include "AliHFEvarManager.h" |
88 | #include "AliAnalysisTaskHFE.h" | |
89 | #include "AliAODMCHeader.h" | |
90 | #include "TClonesArray.h" | |
91 | ||
92 | ClassImp(AliAnalysisTaskHFE) | |
93 | ||
94 | //____________________________________________________________ | |
95 | AliAnalysisTaskHFE::AliAnalysisTaskHFE(): | |
96 | AliAnalysisTaskSE("PID efficiency Analysis") | |
97 | , fAODMCHeader(NULL) | |
98 | , fAODArrayMCInfo(NULL) | |
99 | , fQAlevel(0) | |
100 | , fPlugins(0) | |
101 | , fCollisionSystem(3) | |
102 | , fFillSignalOnly(kTRUE) | |
2e4ed823 | 103 | , fRejectMCFakeTracks(kFALSE) |
01745870 | 104 | , fFillNoCuts(kFALSE) |
01745870 | 105 | , fBackGroundFactorApply(kFALSE) |
106 | , fRemovePileUp(kFALSE) | |
107 | , fIdentifiedAsPileUp(kFALSE) | |
108 | , fIdentifiedAsOutInz(kFALSE) | |
109 | , fPassTheEventCut(kFALSE) | |
110 | , fRejectKinkMother(kTRUE) | |
111 | , fisppMultiBin(kFALSE) | |
112 | , fPbPbUserCentralityBinning(kFALSE) | |
113 | , fRemoveFirstEvent(kFALSE) | |
114 | , fisNonHFEsystematics(kFALSE) | |
115 | , fSpecialTrigger(NULL) | |
116 | , fCentralityF(-1) | |
117 | , fCentralityPercent(-1) | |
118 | , fCentralityEstimator("V0M") | |
119 | , fContributors(0.5) | |
120 | , fWeightBackGround(0.) | |
121 | , fVz(0.0) | |
122 | , fContainer(NULL) | |
123 | , fVarManager(NULL) | |
124 | , fSignalCuts(NULL) | |
125 | , fCFM(NULL) | |
126 | , fTriggerAnalysis(NULL) | |
127 | , fPID(NULL) | |
128 | , fPIDqa(NULL) | |
afb48e1d | 129 | , fTRDTriggerAnalysismb(NULL) |
130 | , fTRDTriggerAnalysistrg(NULL) | |
01745870 | 131 | , fPIDpreselect(NULL) |
132 | , fCuts(NULL) | |
133 | , fTaggedTrackCuts(NULL) | |
134 | , fCleanTaggedTrack(kFALSE) | |
135 | , fVariablesTRDTaggedTrack(kFALSE) | |
136 | , fAnalysisUtils(NULL) | |
137 | , fCutspreselect(NULL) | |
138 | , fSecVtx(NULL) | |
139 | , fElecBackGround(NULL) | |
140 | , fMCQA(NULL) | |
141 | , fTaggedTrackAnalysis(NULL) | |
142 | , fExtraCuts(NULL) | |
143 | , fBackgroundSubtraction(NULL) | |
144 | , fTRDTrigger(kFALSE) | |
145 | , fWhichTRDTrigger(0) | |
7986e54e | 146 | , fV0Tagger(NULL) |
01745870 | 147 | , fQA(NULL) |
148 | , fOutput(NULL) | |
149 | , fHistMCQA(NULL) | |
150 | , fHistSECVTX(NULL) | |
151 | , fHistELECBACKGROUND(NULL) | |
152 | , fQACollection(NULL) | |
153 | { | |
154 | // | |
155 | // Dummy constructor | |
156 | // | |
157 | memset(fElecBackgroundFactor, 0, sizeof(Double_t) * kElecBgSpecies * kBgPtBins * kCentBins * kBgLevels); | |
158 | memset(fkBackGroundFactorArray, 0, sizeof(TF1 *) * 12); | |
159 | memset(fBinLimit, 0, sizeof(Double_t) * (kBgPtBins+1)); | |
160 | memset(&fisppMultiBin, kFALSE, sizeof(fisppMultiBin)); | |
161 | memset(fCentralityLimits, 0, sizeof(Float_t) * 12); | |
162 | ||
163 | SetppAnalysis(); | |
164 | } | |
165 | ||
166 | //____________________________________________________________ | |
167 | AliAnalysisTaskHFE::AliAnalysisTaskHFE(const char * name): | |
168 | AliAnalysisTaskSE(name) | |
169 | , fAODMCHeader(NULL) | |
170 | , fAODArrayMCInfo(NULL) | |
171 | , fQAlevel(0) | |
172 | , fPlugins(0) | |
173 | , fCollisionSystem(3) | |
174 | , fFillSignalOnly(kTRUE) | |
2e4ed823 | 175 | , fRejectMCFakeTracks(kFALSE) |
01745870 | 176 | , fFillNoCuts(kFALSE) |
01745870 | 177 | , fBackGroundFactorApply(kFALSE) |
178 | , fRemovePileUp(kFALSE) | |
179 | , fIdentifiedAsPileUp(kFALSE) | |
180 | , fIdentifiedAsOutInz(kFALSE) | |
181 | , fPassTheEventCut(kFALSE) | |
182 | , fRejectKinkMother(kTRUE) | |
183 | , fisppMultiBin(kFALSE) | |
184 | , fPbPbUserCentralityBinning(kFALSE) | |
185 | , fRemoveFirstEvent(kFALSE) | |
186 | , fisNonHFEsystematics(kFALSE) | |
187 | , fSpecialTrigger(NULL) | |
188 | , fCentralityF(-1) | |
189 | , fCentralityPercent(-1) | |
190 | , fCentralityEstimator("V0M") | |
191 | , fContributors(0.5) | |
192 | , fWeightBackGround(0.) | |
193 | , fVz(0.0) | |
194 | , fContainer(NULL) | |
195 | , fVarManager(NULL) | |
196 | , fSignalCuts(NULL) | |
197 | , fCFM(NULL) | |
198 | , fTriggerAnalysis(NULL) | |
199 | , fPID(NULL) | |
200 | , fPIDqa(NULL) | |
afb48e1d | 201 | , fTRDTriggerAnalysismb(NULL) |
202 | , fTRDTriggerAnalysistrg(NULL) | |
01745870 | 203 | , fPIDpreselect(NULL) |
204 | , fCuts(NULL) | |
205 | , fTaggedTrackCuts(NULL) | |
206 | , fCleanTaggedTrack(kFALSE) | |
207 | , fVariablesTRDTaggedTrack(kFALSE) | |
208 | , fAnalysisUtils(NULL) | |
209 | , fCutspreselect(NULL) | |
210 | , fSecVtx(NULL) | |
211 | , fElecBackGround(NULL) | |
212 | , fMCQA(NULL) | |
213 | , fTaggedTrackAnalysis(NULL) | |
214 | , fExtraCuts(NULL) | |
215 | , fBackgroundSubtraction(NULL) | |
216 | , fTRDTrigger(kFALSE) | |
217 | , fWhichTRDTrigger(0) | |
7986e54e | 218 | , fV0Tagger(NULL) |
01745870 | 219 | , fQA(NULL) |
220 | , fOutput(NULL) | |
221 | , fHistMCQA(NULL) | |
222 | , fHistSECVTX(NULL) | |
223 | , fHistELECBACKGROUND(NULL) | |
224 | , fQACollection(0x0) | |
225 | { | |
226 | // | |
227 | // Default constructor | |
228 | // | |
229 | DefineOutput(1, TList::Class()); | |
230 | DefineOutput(2, TList::Class()); | |
231 | ||
7986e54e | 232 | fV0Tagger = new AliHFEV0taginfo("Tagger"); |
01745870 | 233 | fPID = new AliHFEpid("hfePid"); |
234 | fPIDqa = new AliHFEpidQAmanager; | |
235 | fVarManager = new AliHFEvarManager("hfeVarManager"); | |
236 | fAnalysisUtils = new AliAnalysisUtils; | |
afb48e1d | 237 | fTRDTriggerAnalysismb = new AliTRDTriggerAnalysis(); |
238 | fTRDTriggerAnalysistrg = new AliTRDTriggerAnalysis(); | |
239 | fTRDTriggerAnalysistrg->SetRequireMatchElectron(kTRUE); | |
01745870 | 240 | |
241 | memset(fElecBackgroundFactor, 0, sizeof(Double_t) * kElecBgSpecies * kBgPtBins * kCentBins * kBgLevels); | |
242 | memset(fkBackGroundFactorArray, 0, sizeof(TF1 *) * 12); | |
243 | memset(fBinLimit, 0, sizeof(Double_t) * (kBgPtBins+1)); | |
244 | memset(&fisppMultiBin, kFALSE, sizeof(fisppMultiBin)); | |
245 | memset(fCentralityLimits, 0, sizeof(Float_t) * 12); | |
246 | ||
247 | SetppAnalysis(); | |
248 | } | |
249 | ||
250 | //____________________________________________________________ | |
251 | AliAnalysisTaskHFE::AliAnalysisTaskHFE(const AliAnalysisTaskHFE &ref): | |
252 | AliAnalysisTaskSE(ref) | |
253 | , fAODMCHeader(NULL) | |
254 | , fAODArrayMCInfo(NULL) | |
255 | , fQAlevel(0) | |
256 | , fPlugins(0) | |
257 | , fCollisionSystem(ref.fCollisionSystem) | |
258 | , fFillSignalOnly(ref.fFillSignalOnly) | |
2e4ed823 | 259 | , fRejectMCFakeTracks(ref.fRejectMCFakeTracks) |
01745870 | 260 | , fFillNoCuts(ref.fFillNoCuts) |
01745870 | 261 | , fBackGroundFactorApply(ref.fBackGroundFactorApply) |
262 | , fRemovePileUp(ref.fRemovePileUp) | |
263 | , fIdentifiedAsPileUp(ref.fIdentifiedAsPileUp) | |
264 | , fIdentifiedAsOutInz(ref.fIdentifiedAsOutInz) | |
265 | , fPassTheEventCut(ref.fPassTheEventCut) | |
266 | , fRejectKinkMother(ref.fRejectKinkMother) | |
267 | , fisppMultiBin(ref.fisppMultiBin) | |
268 | , fPbPbUserCentralityBinning(ref.fPbPbUserCentralityBinning) | |
269 | , fRemoveFirstEvent(ref.fRemoveFirstEvent) | |
270 | , fisNonHFEsystematics(ref.fisNonHFEsystematics) | |
271 | , fSpecialTrigger(ref.fSpecialTrigger) | |
272 | , fCentralityF(ref.fCentralityF) | |
273 | , fCentralityPercent(ref.fCentralityPercent) | |
274 | , fCentralityEstimator(ref.fCentralityEstimator) | |
275 | , fContributors(ref.fContributors) | |
276 | , fWeightBackGround(ref.fWeightBackGround) | |
277 | , fVz(ref.fVz) | |
278 | , fContainer(NULL) | |
279 | , fVarManager(NULL) | |
280 | , fSignalCuts(NULL) | |
281 | , fCFM(NULL) | |
282 | , fTriggerAnalysis(NULL) | |
283 | , fPID(NULL) | |
284 | , fPIDqa(NULL) | |
afb48e1d | 285 | , fTRDTriggerAnalysismb(NULL) |
286 | , fTRDTriggerAnalysistrg(NULL) | |
01745870 | 287 | , fPIDpreselect(NULL) |
288 | , fCuts(NULL) | |
289 | , fTaggedTrackCuts(NULL) | |
290 | , fCleanTaggedTrack(ref.fCleanTaggedTrack) | |
291 | , fVariablesTRDTaggedTrack(ref.fVariablesTRDTaggedTrack) | |
292 | , fAnalysisUtils(NULL) | |
293 | , fCutspreselect(NULL) | |
294 | , fSecVtx(NULL) | |
295 | , fElecBackGround(NULL) | |
296 | , fMCQA(NULL) | |
297 | , fTaggedTrackAnalysis(NULL) | |
298 | , fExtraCuts(NULL) | |
299 | , fBackgroundSubtraction(NULL) | |
300 | , fTRDTrigger(ref.fTRDTrigger) | |
301 | , fWhichTRDTrigger(ref.fWhichTRDTrigger) | |
7986e54e | 302 | , fV0Tagger(NULL) |
01745870 | 303 | , fQA(NULL) |
304 | , fOutput(NULL) | |
305 | , fHistMCQA(NULL) | |
306 | , fHistSECVTX(NULL) | |
307 | , fHistELECBACKGROUND(NULL) | |
308 | , fQACollection(NULL) | |
309 | { | |
310 | // | |
311 | // Copy Constructor | |
312 | // | |
313 | ref.Copy(*this); | |
314 | } | |
315 | ||
316 | //____________________________________________________________ | |
317 | AliAnalysisTaskHFE &AliAnalysisTaskHFE::operator=(const AliAnalysisTaskHFE &ref){ | |
318 | // | |
319 | // Assignment operator | |
320 | // | |
321 | if(this == &ref) | |
322 | ref.Copy(*this); | |
323 | return *this; | |
324 | } | |
325 | ||
326 | //____________________________________________________________ | |
327 | void AliAnalysisTaskHFE::Copy(TObject &o) const { | |
328 | // | |
329 | // Copy into object o | |
330 | // | |
331 | AliAnalysisTaskHFE &target = dynamic_cast<AliAnalysisTaskHFE &>(o); | |
332 | target.fAODMCHeader = fAODMCHeader; | |
333 | target.fAODArrayMCInfo = fAODArrayMCInfo; | |
334 | target.fQAlevel = fQAlevel; | |
335 | target.fPlugins = fPlugins; | |
336 | target.fCollisionSystem = fCollisionSystem; | |
337 | target.fFillSignalOnly = fFillSignalOnly; | |
2e4ed823 | 338 | target.fRejectMCFakeTracks = fRejectMCFakeTracks; |
01745870 | 339 | target.fFillNoCuts = fFillNoCuts; |
01745870 | 340 | target.fBackGroundFactorApply = fBackGroundFactorApply; |
341 | target.fRemovePileUp = fRemovePileUp; | |
342 | target.fIdentifiedAsPileUp = fIdentifiedAsPileUp; | |
343 | target.fIdentifiedAsOutInz = fIdentifiedAsOutInz; | |
344 | target.fPassTheEventCut = fPassTheEventCut; | |
345 | target.fRejectKinkMother = fRejectKinkMother; | |
346 | target.fisppMultiBin = fisppMultiBin; | |
347 | target.fPbPbUserCentralityBinning = fPbPbUserCentralityBinning; | |
348 | target.fRemoveFirstEvent = fRemoveFirstEvent; | |
349 | target.fisNonHFEsystematics = fisNonHFEsystematics; | |
350 | target.fSpecialTrigger = fSpecialTrigger; | |
351 | target.fCentralityF = fCentralityF; | |
352 | target.fCentralityPercent = fCentralityPercent; | |
353 | target.fCentralityEstimator = fCentralityEstimator; | |
354 | target.fContributors = fContributors; | |
355 | target.fWeightBackGround = fWeightBackGround; | |
356 | target.fVz = fVz; | |
357 | target.fContainer = fContainer; | |
358 | target.fVarManager = fVarManager; | |
359 | target.fSignalCuts = fSignalCuts; | |
360 | target.fCFM = fCFM; | |
361 | target.fTriggerAnalysis = fTriggerAnalysis; | |
362 | target.fPID = fPID; | |
363 | target.fPIDqa = fPIDqa; | |
afb48e1d | 364 | target.fTRDTriggerAnalysismb = fTRDTriggerAnalysismb; |
365 | target.fTRDTriggerAnalysistrg = fTRDTriggerAnalysistrg; | |
01745870 | 366 | target.fPIDpreselect = fPIDpreselect; |
367 | target.fCuts = fCuts; | |
368 | target.fTaggedTrackCuts = fTaggedTrackCuts; | |
369 | target.fCleanTaggedTrack = fCleanTaggedTrack; | |
370 | target.fVariablesTRDTaggedTrack = fVariablesTRDTaggedTrack; | |
371 | target.fAnalysisUtils = fAnalysisUtils; | |
372 | target.fCutspreselect = fCutspreselect; | |
373 | target.fSecVtx = fSecVtx; | |
374 | target.fElecBackGround = fElecBackGround; | |
375 | target.fMCQA = fMCQA; | |
376 | target.fTaggedTrackAnalysis = fTaggedTrackAnalysis; | |
377 | target.fExtraCuts = fExtraCuts; | |
378 | target.fBackgroundSubtraction = fBackgroundSubtraction; | |
379 | target.fTRDTrigger = fTRDTrigger; | |
380 | target.fWhichTRDTrigger = fWhichTRDTrigger; | |
7986e54e | 381 | target.fV0Tagger = fV0Tagger; |
01745870 | 382 | target.fQA = fQA; |
383 | target.fOutput = fOutput; | |
384 | target.fHistMCQA = fHistMCQA; | |
385 | target.fHistSECVTX = fHistSECVTX; | |
386 | target.fHistELECBACKGROUND = fHistELECBACKGROUND; | |
387 | target.fQACollection = fQACollection; | |
388 | } | |
389 | ||
390 | //____________________________________________________________ | |
391 | AliAnalysisTaskHFE::~AliAnalysisTaskHFE(){ | |
392 | // | |
393 | // Destructor | |
394 | // | |
395 | if(fPID) delete fPID; | |
396 | if(fPIDpreselect) delete fPIDpreselect; | |
397 | if(fVarManager) delete fVarManager; | |
afb48e1d | 398 | if(fTRDTriggerAnalysismb) delete fTRDTriggerAnalysismb; |
399 | if(fTRDTriggerAnalysistrg) delete fTRDTriggerAnalysistrg; | |
01745870 | 400 | if(fCFM) delete fCFM; |
401 | if(fTriggerAnalysis) delete fTriggerAnalysis; | |
402 | if(fSignalCuts) delete fSignalCuts; | |
403 | if(fSecVtx) delete fSecVtx; | |
404 | if(fMCQA) delete fMCQA; | |
405 | if(fElecBackGround) delete fElecBackGround; | |
406 | if(fBackgroundSubtraction) delete fBackgroundSubtraction; | |
407 | if(fSpecialTrigger) delete fSpecialTrigger; | |
408 | if(fAnalysisUtils) delete fAnalysisUtils; | |
7986e54e | 409 | if(fV0Tagger) delete fV0Tagger; |
01745870 | 410 | // Delete output objects only if we are not running in PROOF mode because otherwise this produces a crash during merging |
411 | AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager(); | |
412 | if(mgr && mgr->GetAnalysisType() != AliAnalysisManager::kProofAnalysis){ | |
413 | if(fPIDqa) delete fPIDqa; | |
414 | if(fOutput) delete fOutput; | |
415 | if(fQA) delete fQA; | |
416 | } | |
417 | } | |
418 | ||
419 | //____________________________________________________________ | |
420 | void AliAnalysisTaskHFE::UserCreateOutputObjects(){ | |
421 | // | |
422 | // Creating output container and output objects | |
423 | // Here we also Initialize the correction framework container and | |
424 | // the objects for | |
425 | // - PID | |
426 | // - MC QA | |
427 | // - SecVtx | |
428 | // QA histograms are created if requested | |
429 | // Called once per worker | |
430 | // | |
431 | AliDebug(3, "Creating Output Objects"); | |
432 | ||
433 | // Make lists for Output | |
434 | if(!fQA) fQA = new TList; | |
435 | fQA->SetOwner(); | |
436 | if(!fOutput) fOutput = new TList; | |
437 | fOutput->SetOwner(); | |
438 | ||
439 | // Automatic determination of the analysis mode | |
440 | AliVEventHandler *inputHandler = dynamic_cast<AliVEventHandler *>(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()); | |
441 | if(!TString(inputHandler->IsA()->GetName()).CompareTo("AliAODInputHandler")){ | |
442 | SetAODAnalysis(); | |
443 | } else { | |
444 | SetESDAnalysis(); | |
445 | if(AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler()) | |
446 | SetHasMCData(); | |
447 | } | |
448 | printf("Analysis Mode: %s Analysis\n", IsAODanalysis() ? "AOD" : "ESD"); | |
449 | printf("MC Data available %s\n", HasMCData() ? "Yes" : "No"); | |
450 | ||
451 | // Enable Trigger Analysis | |
452 | fTriggerAnalysis = new AliTriggerAnalysis; | |
453 | fTriggerAnalysis->EnableHistograms(); | |
454 | fTriggerAnalysis->SetAnalyzeMC(HasMCData()); | |
455 | ||
456 | // First Part: Make QA histograms | |
457 | fQACollection = new AliHFEcollection("TaskQA", "QA histos from the Electron Task"); | |
458 | fQACollection->CreateTH1F("nElectronTracksEvent", "Number of Electron Candidates", 100, 0, 100); | |
459 | fQACollection->CreateTH1F("nElectron", "Number of electrons", 100, 0, 100); | |
460 | fQACollection->CreateTH2F("radius", "Production Vertex", 100, 0.0, 5.0, 100, 0.0, 5.0); | |
461 | fQACollection->CreateTH1F("nTriggerBit", "Histo Trigger Bit", 22, 0, 22); | |
afb48e1d | 462 | fQACollection->CreateTH2F("TriggerAnalysis","TRD Trigger Analysis",10,0.,10.,10,0.,10.); |
e2861c1a | 463 | fQACollection->CreateTH1F("Filterbegin", "AOD filter of tracks after all cuts", 21, -1, 20); |
47faab26 | 464 | fQACollection->CreateTH1F("Filterend", "AOD filter of tracks after all cuts", 21, -1, 20); |
2e4ed823 | 465 | fQACollection->CreateTH2F("Kinkbefore", "Kink status before filter; p_{T} (GeV/c); kink status", 100, 0., 20., 3, -0.5, 2.5); |
466 | fQACollection->CreateTH2F("Kinkafter", "Kink status after filter; p_{T} (GeV/c); kink status", 100, 0., 20., 3, -0.5, 2.5); | |
467 | fQACollection->CreateTH1F("HFPuzzle", "Source definition for electrons from HF", 11, -0.5, 10.5); | |
01745870 | 468 | |
469 | InitHistoITScluster(); | |
470 | InitContaminationQA(); | |
471 | fQA->Add(fQACollection); | |
472 | ||
473 | // Initialize PID | |
474 | fPID->SetHasMCData(HasMCData()); | |
475 | if(!fPID->GetNumberOfPIDdetectors()) fPID->AddDetector("TPC", 0); | |
476 | if(IsQAOn(kPIDqa)){ | |
477 | AliInfo("PID QA switched on"); | |
478 | fPIDqa->Initialize(fPID); | |
479 | fQA->Add(fPIDqa->MakeList("HFEpidQA")); | |
480 | } | |
481 | fPID->SortDetectors(); | |
482 | ||
483 | // Background subtraction------------------------------------------------------------------- | |
afb48e1d | 484 | if (GetPlugin(kNonPhotonicElectron)||GetPlugin(kNonPhotonicElectronBeauty)) { |
01745870 | 485 | if(!fBackgroundSubtraction) fBackgroundSubtraction = new AliHFENonPhotonicElectron(); |
486 | if(IsAODanalysis()) fBackgroundSubtraction->SetAOD(kTRUE); | |
487 | fBackgroundSubtraction->Init(); | |
488 | fOutput->Add(fBackgroundSubtraction->GetListOutput()); | |
489 | } | |
490 | //------------------------------------------------------------------------------------------ | |
491 | ||
492 | ||
493 | // Initialize correction Framework and Cuts | |
494 | const Int_t kNcutSteps = AliHFEcuts::kNcutStepsMCTrack + AliHFEcuts::kNcutStepsRecTrack + AliHFEcuts::kNcutStepsDETrack + AliHFEcuts::kNcutStepsSecvtxTrack; | |
495 | fCFM = new AliCFManager; | |
496 | fCFM->SetNStepParticle(kNcutSteps); | |
497 | MakeParticleContainer(); | |
498 | MakeEventContainer(); | |
499 | // Temporary fix: Initialize particle cuts with NULL | |
500 | for(Int_t istep = 0; istep < kNcutSteps; istep++) | |
501 | fCFM->SetParticleCutsList(istep, NULL); | |
502 | if(!fCuts){ | |
503 | AliWarning("Cuts not available. Default cuts will be used"); | |
504 | fCuts = new AliHFEcuts; | |
505 | fCuts->CreateStandardCuts(); | |
506 | } | |
507 | if(IsAODanalysis()) fCuts->SetAOD(); | |
508 | // Make clone for V0 tagging step | |
509 | fCuts->Initialize(fCFM); | |
510 | if(fCuts->IsQAOn()) fQA->Add(fCuts->GetQAhistograms()); | |
511 | fSignalCuts = new AliHFEsignalCuts("HFEsignalCuts", "HFE MC Signal definition"); | |
512 | fVarManager->SetSignalCuts(fSignalCuts); | |
513 | ||
514 | // add output objects to the List | |
515 | fOutput->AddAt(fContainer, 0); | |
516 | fOutput->AddAt(fCFM->GetEventContainer(), 1); | |
517 | ||
518 | // mcQA---------------------------------- | |
519 | if (HasMCData() && IsQAOn(kMCqa)) { | |
520 | AliInfo("MC QA on"); | |
521 | if(!fMCQA) fMCQA = new AliHFEmcQA; | |
522 | if(!fHistMCQA) fHistMCQA = new TList(); | |
523 | fHistMCQA->SetOwner(); | |
524 | if(IsPbPb()) fMCQA->SetPbPb(); | |
525 | if(fisppMultiBin) fMCQA->SetPPMultiBin(); | |
526 | if(TestBit(kTreeStream)){ | |
527 | fMCQA->EnableDebugStreamer(); | |
528 | } | |
529 | fMCQA->CreatDefaultHistograms(fHistMCQA); | |
530 | fMCQA->SetBackgroundWeightFactor(fElecBackgroundFactor[0][0][0],fBinLimit); | |
531 | fQA->Add(fHistMCQA); | |
532 | } | |
533 | ||
534 | // secvtx---------------------------------- | |
535 | if (GetPlugin(kSecVtx)) { | |
536 | AliInfo("Secondary Vertex Analysis on"); | |
537 | if(!fSecVtx) fSecVtx = new AliHFEsecVtx; | |
538 | fSecVtx->SetHasMCData(HasMCData()); | |
539 | ||
540 | if(!fHistSECVTX) fHistSECVTX = new TList(); | |
541 | fHistSECVTX->SetOwner(); | |
542 | fSecVtx->CreateHistograms(fHistSECVTX); | |
543 | fOutput->Add(fHistSECVTX); | |
544 | } | |
545 | ||
546 | // background---------------------------------- | |
547 | if (GetPlugin(kIsElecBackGround)) { | |
548 | AliInfo("Electron BackGround Analysis on"); | |
549 | if(!fElecBackGround){ | |
550 | AliWarning("ElecBackGround not available. Default elecbackground will be used"); | |
551 | fElecBackGround = new AliHFEelecbackground; | |
552 | } | |
553 | fElecBackGround->SetHasMCData(HasMCData()); | |
554 | ||
555 | if(!fHistELECBACKGROUND) fHistELECBACKGROUND = new TList(); | |
556 | fHistELECBACKGROUND->SetOwner(); | |
557 | fElecBackGround->CreateHistograms(fHistELECBACKGROUND); | |
558 | fOutput->Add(fHistELECBACKGROUND); | |
559 | } | |
560 | ||
561 | // tagged tracks | |
562 | if(GetPlugin(kTaggedTrackAnalysis)){ | |
563 | AliInfo("Analysis on V0-tagged tracks enabled"); | |
564 | fTaggedTrackAnalysis = new AliHFEtaggedTrackAnalysis(Form("taggedTrackAnalysis%s", GetName())); | |
565 | fTaggedTrackAnalysis->SetCuts(fTaggedTrackCuts); | |
566 | fTaggedTrackAnalysis->SetClean(fCleanTaggedTrack); | |
afb48e1d | 567 | if(IsAODanalysis()) fTaggedTrackAnalysis->SetAOD(); |
01745870 | 568 | AliHFEvarManager *varManager = fTaggedTrackAnalysis->GetVarManager(); |
569 | TObjArray *array = fVarManager->GetVariables(); | |
570 | Int_t nvars = array->GetEntriesFast(); | |
571 | TString namee; | |
572 | for(Int_t v = 0; v < nvars; v++) { | |
573 | AliHFEvarManager::AliHFEvariable *variable = (AliHFEvarManager::AliHFEvariable *) array->At(v); | |
574 | if(!variable) continue; | |
575 | TString name(((AliHFEvarManager::AliHFEvariable *)variable)->GetName()); | |
576 | if(!name.CompareTo("source")) namee = TString("species"); | |
577 | else namee = TString(name); | |
578 | Int_t nbins = variable->GetNumberOfBins(); | |
579 | if(variable->HasUserDefinedBinning()){ | |
580 | varManager->AddVariable(namee, nbins, variable->GetBinning()); | |
581 | } else { | |
582 | varManager->AddVariable(namee, nbins, variable->GetMinimum(), variable->GetMaximum()); | |
583 | } | |
584 | //printf("For AliTaggedTrackAnalysis, had the variable %s and the one used %s\n",(const char*)variable->GetName(),(const char*) namee); | |
585 | } | |
586 | if(fPIDqa->HasHighResolutionHistos()) | |
587 | fTaggedTrackAnalysis->GetPIDqa()->SetHighResolutionHistos(); | |
588 | fTaggedTrackAnalysis->SetPID(fPID); | |
589 | fTaggedTrackAnalysis->SetVariablesTRD(fVariablesTRDTaggedTrack); | |
590 | fTaggedTrackAnalysis->InitContainer(); | |
591 | fOutput->Add(fTaggedTrackAnalysis->GetContainer()); | |
592 | fQA->Add(fTaggedTrackAnalysis->GetPIDQA()); | |
593 | fQA->Add(fTaggedTrackAnalysis->GetCutQA()); | |
594 | fQA->Add(fTaggedTrackAnalysis->GetQAcollection()); | |
595 | } | |
596 | ||
597 | //fQA->Print(); | |
598 | ||
599 | PrintStatus(); | |
600 | // Done!!! | |
601 | PostData(1, fOutput); | |
602 | PostData(2, fQA); | |
603 | } | |
604 | ||
605 | //____________________________________________________________ | |
606 | void AliAnalysisTaskHFE::UserExec(Option_t *){ | |
607 | // | |
608 | // Run the analysis | |
609 | // | |
610 | ||
611 | //printf("test00\n"); | |
612 | ||
613 | AliDebug(3, "Starting Single Event Analysis"); | |
614 | if(!fInputEvent){ | |
615 | AliError("Reconstructed Event not available"); | |
616 | //printf("Reconstructed Event not available"); | |
617 | return; | |
618 | } | |
619 | if(HasMCData() && IsESDanalysis()){ | |
620 | AliDebug(4, Form("MC Event: %p", fMCEvent)); | |
621 | if(!fMCEvent){ | |
622 | AliError("No MC Event, but MC Data required"); | |
623 | //printf("No MC Event, but MC Data required"); | |
624 | return; | |
625 | } | |
626 | } | |
627 | if(!fCuts){ | |
628 | AliError("HFE cuts not available"); | |
629 | //printf("HFE cuts not available"); | |
630 | return; | |
631 | } | |
632 | if(!fPID->IsInitialized()){ | |
633 | // Initialize PID with the given run number | |
634 | fPID->InitializePID(fInputEvent->GetRunNumber()); | |
635 | } | |
636 | ||
637 | if(fRemoveFirstEvent){ | |
638 | if(fAnalysisUtils->IsFirstEventInChunk(fInputEvent)) return; | |
639 | } | |
640 | ||
641 | AliESDEvent *ev = dynamic_cast<AliESDEvent *>(fInputEvent); | |
4437a0d2 | 642 | if(ev && fTRDTrigger && (fWhichTRDTrigger<6)) |
01745870 | 643 | { |
4437a0d2 | 644 | if(!CheckTRDTriggerESD(ev)) return; |
645 | } | |
646 | if(fInputEvent && fTRDTrigger && (fWhichTRDTrigger>5)) | |
647 | { | |
648 | if(!CheckTRDTrigger(fInputEvent)) return; | |
01745870 | 649 | } |
01745870 | 650 | |
651 | if(IsESDanalysis() && HasMCData()){ | |
652 | // Protect against missing MC trees | |
653 | AliMCEventHandler *mcH = dynamic_cast<AliMCEventHandler *>(AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler()); | |
654 | if(!mcH){ | |
655 | AliError("No MC Event Handler available"); | |
656 | return; | |
657 | } | |
658 | if(!mcH->InitOk()) return; | |
659 | if(!mcH->TreeK()) return; | |
660 | if(!mcH->TreeTR()) return; | |
661 | ||
662 | // Background subtraction------------------------------------------------------------------- | |
663 | if(GetPlugin(kNonPhotonicElectron)) fBackgroundSubtraction->SetMCEvent(fMCEvent); | |
664 | //------------------------------------------------------------------------------------------ | |
665 | } | |
666 | ||
667 | if(IsAODanalysis() && HasMCData()){ | |
668 | // take MC info | |
669 | AliAODEvent *aodE = dynamic_cast<AliAODEvent *>(fInputEvent); | |
670 | if(!aodE){ | |
671 | AliError("No AOD Event"); | |
672 | return; | |
673 | } | |
674 | fAODMCHeader = dynamic_cast<AliAODMCHeader *>(fInputEvent->FindListObject(AliAODMCHeader::StdBranchName())); | |
675 | if(!fAODMCHeader){ | |
676 | AliError("No AliAODMCHeader"); | |
677 | //printf("No AliAODMCHeader"); | |
678 | return; | |
679 | } | |
680 | fAODArrayMCInfo = dynamic_cast<TClonesArray *>(fInputEvent->FindListObject(AliAODMCParticle::StdBranchName())); | |
681 | if(!fAODArrayMCInfo){ | |
682 | AliError("No AOD MC particles"); | |
683 | //printf("No AOD MC particles"); | |
684 | return; | |
685 | } | |
686 | fSignalCuts->SetMCAODInfo(fAODArrayMCInfo); | |
687 | // Background subtraction------------------------------------------------------------------- | |
afb48e1d | 688 | if (GetPlugin(kNonPhotonicElectron)||GetPlugin(kNonPhotonicElectronBeauty)) fBackgroundSubtraction->SetAODArrayMCInfo(fAODArrayMCInfo); |
01745870 | 689 | //------------------------------------------------------------------------------------------ |
690 | } | |
691 | ||
692 | //printf("test2\n"); | |
693 | ||
694 | // need the centrality for everything (MC also) | |
695 | fCentralityF = -1; | |
696 | if(!ReadCentrality()) fCentralityF = -1; | |
697 | //printf("pass centrality\n"); | |
698 | //printf("Reading fCentralityF %d\n",fCentralityF); | |
699 | ||
700 | // See if pile up and z in the range | |
701 | RejectionPileUpVertexRangeEventCut(); | |
702 | ||
703 | //printf("test3\n"); | |
704 | ||
705 | // Protect agains missing | |
706 | if(HasMCData()){ | |
707 | //printf("Has MC data\n"); | |
708 | fSignalCuts->SetMCEvent(fMCEvent); | |
709 | ProcessMC(); // Run the MC loop + MC QA in case MC Data are available | |
710 | } | |
711 | ||
712 | AliPIDResponse *pidResponse = fInputHandler->GetPIDResponse(); | |
713 | if(!pidResponse){ | |
714 | AliDebug(1, "Using default PID Response"); | |
715 | pidResponse = AliHFEtools::GetDefaultPID(HasMCData(), fInputEvent->IsA() == AliESDEvent::Class()); | |
716 | } | |
717 | fPID->SetPIDResponse(pidResponse); | |
718 | if(fPIDpreselect) fPIDpreselect->SetPIDResponse(pidResponse); | |
719 | ||
720 | // Background subtraction------------------------------------------------------------------- | |
afb48e1d | 721 | if(GetPlugin(kNonPhotonicElectron)||GetPlugin(kNonPhotonicElectronBeauty)) fBackgroundSubtraction->InitRun(fInputEvent,pidResponse); |
01745870 | 722 | //------------------------------------------------------------------------------------------ |
723 | ||
724 | // Event loop | |
725 | if(IsAODanalysis()){ | |
726 | //printf("test4\n"); | |
727 | ProcessAOD(); | |
728 | } else { | |
729 | const char *specialTrigger = GetSpecialTrigger(fInputEvent->GetRunNumber()); | |
730 | // Check Trigger selection | |
731 | if(specialTrigger){ | |
732 | AliDebug(2, Form("Special Trigger requested: %s", specialTrigger)); | |
733 | if(!(ev && ev->IsTriggerClassFired(specialTrigger))){ | |
734 | AliDebug(2, "Event not selected"); | |
735 | return; | |
736 | } else AliDebug(2, "Event Selected"); | |
737 | } else AliDebug(2, "No Special Trigger requested"); | |
738 | ||
739 | ProcessESD(); | |
740 | } | |
741 | // Done!!! | |
742 | PostData(1, fOutput); | |
743 | PostData(2, fQA); | |
744 | } | |
745 | ||
746 | //____________________________________________________________ | |
747 | void AliAnalysisTaskHFE::Terminate(Option_t *){ | |
748 | // | |
749 | // Terminate not implemented at the moment | |
750 | // | |
751 | } | |
752 | ||
753 | //_______________________________________________________________ | |
754 | Bool_t AliAnalysisTaskHFE::IsEventInBinZero() { | |
755 | // | |
756 | // | |
757 | // | |
758 | ||
759 | //printf("test in IsEventInBinZero\n"); | |
760 | if(!fInputEvent){ | |
761 | AliError("Reconstructed Event not available"); | |
762 | return kFALSE; | |
763 | } | |
764 | ||
765 | // check vertex | |
766 | const AliVVertex *vertex = fInputEvent->GetPrimaryVertex(); | |
767 | if(!vertex) return kTRUE; | |
768 | //if(vertex) return kTRUE; | |
769 | ||
770 | // check tracks | |
771 | if(fInputEvent->GetNumberOfTracks()<=0) return kTRUE; | |
772 | //if(fInputEvent->GetNumberOfTracks()>0) return kTRUE; | |
773 | ||
774 | ||
775 | return kFALSE; | |
776 | ||
777 | } | |
778 | //____________________________________________________________ | |
779 | void AliAnalysisTaskHFE::ProcessMC(){ | |
780 | // | |
781 | // Runs the MC Loop (filling the container for the MC Cut Steps with the observables pt, eta and phi) | |
782 | // In case MC QA is on also MC QA loop is done | |
783 | // | |
784 | AliDebug(3, "Processing MC Information"); | |
785 | Double_t eventContainer [4] = {0., 0., 0., 0.}; | |
786 | if(IsESDanalysis()) eventContainer[0] = fMCEvent->GetPrimaryVertex()->GetZ(); | |
787 | else eventContainer[0] = fAODMCHeader->GetVtxZ(); | |
788 | eventContainer[2] = fCentralityF; | |
789 | eventContainer[3] = fContributors; | |
790 | fVz = eventContainer[0]; | |
791 | //printf("z position is %f\n",eventContainer[0]); | |
792 | //if(fCFM->CheckEventCuts(AliHFEcuts::kEventStepGenerated, fMCEvent)) | |
793 | fCFM->GetEventContainer()->Fill(eventContainer,AliHFEcuts::kEventStepGenerated); | |
794 | Int_t nElectrons = 0; | |
795 | if(IsESDanalysis()){ | |
796 | if(!((fIdentifiedAsPileUp) || (TMath::Abs(fVz) > fCuts->GetVertexRange()) || (fCentralityF < 0))){ //kStepMCGeneratedZOutNoPileUpCentralityFine | |
797 | if (HasMCData() && IsQAOn(kMCqa)) { | |
798 | AliDebug(2, "Running MC QA"); | |
799 | ||
800 | if(fMCEvent->Stack()){ | |
801 | fMCQA->SetMCEvent(fMCEvent); | |
802 | fMCQA->SetGenEventHeader(fMCEvent->GenEventHeader()); | |
803 | fMCQA->SetCentrality(fCentralityF); | |
804 | fMCQA->SetPercentrality(static_cast<Int_t>(fCentralityPercent)); | |
805 | if(IsPbPb()) { fMCQA->SetPbPb();} | |
806 | else | |
807 | { | |
808 | if(fisppMultiBin) fMCQA->SetPPMultiBin(); | |
809 | else fMCQA->SetPP(); | |
810 | } | |
811 | fMCQA->Init(); | |
812 | ||
813 | fMCQA->GetMesonKine(); | |
814 | ||
815 | // loop over all tracks for decayed electrons | |
816 | for (Int_t igen = 0; igen < fMCEvent->GetNumberOfTracks(); igen++){ | |
817 | TParticle* mcpart = fMCEvent->Stack()->Particle(igen); | |
818 | if(!mcpart) continue; | |
819 | fMCQA->GetQuarkKine(mcpart, igen, AliHFEmcQA::kCharm); | |
820 | fMCQA->GetQuarkKine(mcpart, igen, AliHFEmcQA::kBeauty); | |
821 | fMCQA->GetHadronKine(mcpart, AliHFEmcQA::kCharm); | |
822 | fMCQA->GetHadronKine(mcpart, AliHFEmcQA::kBeauty); | |
823 | fMCQA->GetDecayedKine(mcpart, AliHFEmcQA::kCharm, AliHFEmcQA::kElectronPDG); // no accept cut | |
824 | fMCQA->GetDecayedKine(mcpart, AliHFEmcQA::kBeauty, AliHFEmcQA::kElectronPDG); // no accept cut | |
825 | fMCQA->GetDecayedKine(mcpart, AliHFEmcQA::kOthers, AliHFEmcQA::kElectronPDG); // no accept cut | |
826 | } | |
827 | //fMCQA->EndOfEventAna(AliHFEmcQA::kCharm); | |
828 | //fMCQA->EndOfEventAna(AliHFEmcQA::kBeauty); | |
829 | } | |
830 | ||
831 | } // end of MC QA loop | |
832 | } | |
833 | // ----------------------------------------------------------------- | |
834 | fCFM->SetMCEventInfo(fMCEvent); | |
835 | // fCFM->CheckEventCuts(AliCFManager::kEvtRecCuts, fESD); | |
836 | } else { | |
2e4ed823 | 837 | fMCQA->SetMCArray(fAODArrayMCInfo); |
afb48e1d | 838 | |
839 | if(!((fIdentifiedAsPileUp) || (TMath::Abs(fVz) > fCuts->GetVertexRange()) || (fCentralityF < 0))){ //kStepMCGeneratedZOutNoPileUpCentralityFine | |
840 | if (HasMCData() && IsQAOn(kMCqa)) { | |
841 | AliDebug(2, "Running MC QA"); | |
842 | ||
843 | fMCQA->SetCentrality(fCentralityF); | |
844 | fMCQA->SetPercentrality(static_cast<Int_t>(fCentralityPercent)); | |
845 | ||
846 | if(IsPbPb()) { fMCQA->SetPbPb();} | |
847 | else | |
848 | { | |
849 | if(fisppMultiBin) fMCQA->SetPPMultiBin(); | |
850 | else fMCQA->SetPP(); | |
851 | } | |
852 | fMCQA->Init(); | |
853 | ||
854 | //fMCQA->GetMesonKine(); | |
855 | ||
856 | // loop over all tracks for decayed electrons | |
857 | AliAODMCParticle * mcpart; | |
858 | for (Int_t igen = 0; igen < fAODArrayMCInfo->GetEntriesFast(); igen++){ | |
859 | mcpart = dynamic_cast<AliAODMCParticle *>(fAODArrayMCInfo->At(igen)); | |
860 | if(!mcpart) continue; | |
861 | fMCQA->GetDecayedKine(mcpart, AliHFEmcQA::kCharm, AliHFEmcQA::kElectronPDG); // no accept cut | |
862 | fMCQA->GetDecayedKine(mcpart, AliHFEmcQA::kBeauty, AliHFEmcQA::kElectronPDG); // no accept cut | |
863 | fMCQA->GetDecayedKine(mcpart, AliHFEmcQA::kOthers, AliHFEmcQA::kElectronPDG); // no accept cut | |
864 | } | |
865 | ||
866 | } // end of MC QA loop | |
867 | } | |
868 | ||
01745870 | 869 | fCFM->SetMCEventInfo(fInputEvent); |
870 | } | |
871 | // Run MC loop | |
872 | AliVParticle *mctrack = NULL; | |
873 | Int_t numberofmctracks = 0; | |
874 | if(IsESDanalysis()){ | |
875 | numberofmctracks = fMCEvent->GetNumberOfTracks(); | |
876 | } | |
877 | else { | |
878 | numberofmctracks = fAODArrayMCInfo->GetEntriesFast(); | |
879 | } | |
880 | AliDebug(3, Form("Number of Tracks: %d",numberofmctracks)); | |
881 | //printf("Number of MC track %d\n",numberofmctracks); | |
882 | for(Int_t imc = 0; imc <numberofmctracks; imc++){ | |
883 | if(IsESDanalysis()) { | |
884 | if(!(mctrack = fMCEvent->GetTrack(imc))) continue; | |
885 | } | |
886 | else { | |
887 | if(!(mctrack = (AliVParticle *) fAODArrayMCInfo->At(imc))) continue; | |
888 | } | |
889 | //printf("Test in ProcessMC\n"); | |
890 | AliDebug(4, "Next MC Track"); | |
891 | if(ProcessMCtrack(mctrack)) nElectrons++; | |
892 | } | |
893 | ||
894 | // fCFM->CheckEventCuts(AliCFManager::kEvtRecCuts, fESD); | |
895 | fQACollection->Fill("nElectron", nElectrons); | |
896 | } | |
897 | ||
898 | //____________________________________________________________ | |
899 | void AliAnalysisTaskHFE::ProcessESD(){ | |
900 | // | |
901 | // Run Analysis of reconstructed event in ESD Mode | |
902 | // Loop over Tracks, filter according cut steps defined in AliHFEcuts | |
903 | // | |
904 | AliDebug(1, Form("Task %s", GetName())); | |
905 | AliDebug(3, "Processing ESD Event"); | |
906 | AliESDEvent *fESD = dynamic_cast<AliESDEvent *>(fInputEvent); | |
907 | if(!fESD){ | |
908 | AliError("ESD Event required for ESD Analysis"); | |
909 | return; | |
910 | } | |
911 | ||
912 | // Set magnetic field if V0 task on | |
913 | if(fTaggedTrackAnalysis) { | |
2e4ed823 | 914 | // Tag all v0s in current event |
915 | if(fV0Tagger){ | |
916 | fV0Tagger->Reset(); | |
917 | fV0Tagger->TagV0Tracks(fESD); | |
918 | } | |
01745870 | 919 | fTaggedTrackAnalysis->SetMagneticField(fESD->GetMagneticField()); |
920 | fTaggedTrackAnalysis->SetCentrality(fCentralityF); | |
4437a0d2 | 921 | if(IsPbPb()) fTaggedTrackAnalysis->SetPbPb(); |
922 | else { | |
2e4ed823 | 923 | if(IspPb()) fTaggedTrackAnalysis->SetpPb(); |
924 | else fTaggedTrackAnalysis->SetPP(); | |
4437a0d2 | 925 | } |
01745870 | 926 | } |
927 | ||
928 | // Do event Normalization | |
929 | Double_t eventContainer[4]; | |
930 | eventContainer[0] = 0.; | |
931 | if(HasMCData()) eventContainer[0] = fVz; | |
932 | else { | |
933 | const AliESDVertex* vtxESD = fESD->GetPrimaryVertex(); | |
934 | if(vtxESD) eventContainer[0] = vtxESD->GetZ(); | |
935 | } | |
936 | eventContainer[1] = 0.; | |
937 | eventContainer[2] = fCentralityF; | |
938 | eventContainer[3] = fContributors; | |
939 | if(fTriggerAnalysis->IsOfflineTriggerFired(fESD, AliTriggerAnalysis::kV0AND)) | |
940 | eventContainer[1] = 1.; | |
941 | ||
942 | // | |
943 | fCFM->GetEventContainer()->Fill(eventContainer, AliHFEcuts::kEventStepRecNoCut); | |
944 | ||
945 | // | |
946 | if(fIdentifiedAsPileUp) return; | |
947 | fCFM->GetEventContainer()->Fill(eventContainer, AliHFEcuts::kEventStepRecNoPileUp); | |
948 | ||
949 | // | |
950 | if(TMath::Abs(fCentralityF) < 0) return; | |
951 | fCFM->GetEventContainer()->Fill(eventContainer, AliHFEcuts::kEventStepRecCentralityOk); | |
952 | //printf("In ProcessESD %f\n",fCentralityF); | |
953 | ||
954 | // | |
955 | if(fIdentifiedAsOutInz) return; | |
956 | fCFM->GetEventContainer()->Fill(eventContainer, AliHFEcuts::kEventStepZRange); | |
957 | ||
958 | // | |
959 | if(!fPassTheEventCut) return; | |
960 | fCFM->GetEventContainer()->Fill(eventContainer, AliHFEcuts::kEventStepReconstructed); | |
961 | ||
962 | ||
963 | fContainer->NewEvent(); | |
964 | ||
965 | if (GetPlugin(kIsElecBackGround)) { | |
966 | fElecBackGround->SetEvent(fESD); | |
967 | } | |
968 | if (GetPlugin(kSecVtx)) { | |
969 | fSecVtx->SetEvent(fESD); | |
970 | fSecVtx->GetPrimaryCondition(); | |
971 | } | |
972 | ||
973 | if(HasMCData()){ | |
974 | if (GetPlugin(kSecVtx)) { | |
975 | fSecVtx->SetMCEvent(fMCEvent); | |
976 | fSecVtx->SetMCQA(fMCQA); | |
977 | } | |
978 | if (GetPlugin(kIsElecBackGround)) { | |
979 | fElecBackGround->SetMCEvent(fMCEvent); | |
980 | } | |
981 | } | |
982 | ||
983 | Double_t container[10]; | |
984 | memset(container, 0, sizeof(Double_t) * 10); | |
985 | // container for the output THnSparse | |
986 | Double_t dataDca[6]; // [source, pT, dca, centrality] | |
987 | Int_t nElectronCandidates = 0; | |
988 | AliESDtrack *track = NULL, *htrack = NULL; | |
989 | AliMCParticle *mctrack = NULL; | |
990 | AliMCParticle *mctrackmother = NULL; | |
991 | ||
992 | Bool_t signal = kTRUE; | |
993 | ||
994 | fCFM->SetRecEventInfo(fESD); | |
995 | ||
996 | // Get Number of contributors to the primary vertex for multiplicity-dependent correction | |
997 | Int_t ncontribVtx = 0; | |
998 | const AliESDVertex *priVtx = fESD->GetPrimaryVertexTracks(); | |
999 | if(priVtx){ | |
1000 | ncontribVtx = priVtx->GetNContributors(); | |
1001 | } | |
1002 | ||
1003 | // minjung for IP QA(temporary ~ 2weeks) | |
1004 | if(!fExtraCuts){ | |
1005 | fExtraCuts = new AliHFEextraCuts("hfetmpCuts","HFE tmp Cuts"); | |
1006 | } | |
1007 | fExtraCuts->SetRecEventInfo(fESD); | |
1008 | ||
1009 | // Electron background analysis | |
1010 | if (GetPlugin(kIsElecBackGround)) { | |
1011 | ||
1012 | AliDebug(2, "Running BackGround Analysis"); | |
1013 | ||
1014 | fElecBackGround->Reset(); | |
1015 | ||
1016 | } // end of electron background analysis | |
1017 | ||
1018 | ||
1019 | // Background subtraction------------------------------------------------------------------- | |
1020 | if (GetPlugin(kNonPhotonicElectron)) fBackgroundSubtraction->FillPoolAssociatedTracks(fInputEvent, fCentralityF); | |
1021 | //------------------------------------------------------------------------------------------ | |
1022 | ||
1023 | // | |
1024 | // Loop ESD | |
1025 | // | |
1026 | AliDebug(3, Form("Number of Tracks: %d", fESD->GetNumberOfTracks())); | |
2e4ed823 | 1027 | Bool_t kinkmother(kFALSE), kinkdaughter(kFALSE); Double_t kinkstatus(0); |
01745870 | 1028 | for(Int_t itrack = 0; itrack < fESD->GetNumberOfTracks(); itrack++){ |
1029 | AliDebug(4, "New ESD track"); | |
1030 | track = fESD->GetTrack(itrack); | |
1031 | track->SetESDEvent(fESD); | |
2e4ed823 | 1032 | kinkmother = track->GetKinkIndex(0) < 0; kinkdaughter = track->GetKinkIndex(0) > 0; |
1033 | kinkstatus = 0.; | |
1034 | if(kinkmother) kinkstatus = 1.; | |
1035 | else if(kinkdaughter) kinkstatus = 2.; | |
4437a0d2 | 1036 | |
01745870 | 1037 | // fill counts of v0-identified particles |
dab4f95d | 1038 | AliPID::EParticleType v0pid = fV0Tagger ? fV0Tagger->GetV0Info(track->GetID()) : AliPID::kUnknown; |
01745870 | 1039 | // here the tagged track analysis will run |
7986e54e | 1040 | if(fTaggedTrackAnalysis && v0pid != AliPID::kUnknown){ |
01745870 | 1041 | AliDebug(1, Form("Track identified as %s", AliPID::ParticleName(v0pid))); |
1042 | fTaggedTrackAnalysis->ProcessTrack(track, v0pid); | |
1043 | AliDebug(1, "V0 PID done"); | |
1044 | } | |
1045 | ||
1046 | ||
1047 | //Fill non-HFE source containers at reconstructed events cut step | |
1048 | AliDebug(3, Form("Doing track %d, %p", itrack, track)); | |
1049 | ||
1050 | ||
1051 | ////////////////////////////////////// | |
1052 | // preselect | |
1053 | ////////////////////////////////////// | |
1054 | if(fPIDpreselect || fCutspreselect) { | |
1055 | if(!PreSelectTrack(track)) continue; | |
1056 | } | |
1057 | ||
1058 | signal = kTRUE; | |
1059 | ||
1060 | // Fill step without any cut | |
1061 | ||
1062 | if(HasMCData()){ | |
1063 | // Check if it is electrons near the vertex | |
1064 | if(!(mctrack = dynamic_cast<AliMCParticle *>(fMCEvent->GetTrack(TMath::Abs(track->GetLabel()))))) continue; | |
1065 | ||
1066 | if(fFillSignalOnly && !fCFM->CheckParticleCuts(AliHFEcuts::kStepMCGenerated, mctrack)) signal = kFALSE; | |
2e4ed823 | 1067 | if(fRejectMCFakeTracks && IsMCFakeTrack(track)) signal = kFALSE; |
01745870 | 1068 | else AliDebug(3, "Signal Electron"); |
1069 | ||
1070 | // Fill K pt for Ke3 contributions | |
1071 | if(mctrack && (TMath::Abs(mctrack->Particle()->GetPdgCode())==321)) fQACollection->Fill("Kptspectra",mctrack->Pt()); | |
1072 | else if(mctrack && (TMath::Abs(mctrack->Particle()->GetPdgCode())==130)) fQACollection->Fill("K0Lptspectra",mctrack->Pt()); | |
1073 | } | |
1074 | // Cache new Track information inside the var manager | |
1075 | fVarManager->NewTrack(track, mctrack, fCentralityF, -1, signal); | |
1076 | ||
1077 | if(fFillNoCuts) { | |
1078 | if(signal || !fFillSignalOnly){ | |
1079 | fVarManager->FillContainer(fContainer, "recTrackContReco", AliHFEcuts::kStepRecNoCut, kFALSE); | |
1080 | fVarManager->FillContainer(fContainer, "recTrackContMC", AliHFEcuts::kStepRecNoCut, kTRUE); | |
1081 | } | |
1082 | } | |
1083 | ||
1084 | // RecKine: ITSTPC cuts | |
1085 | if(!ProcessCutStep(AliHFEcuts::kStepRecKineITSTPC, track)) continue; | |
1086 | ||
2e4ed823 | 1087 | fQACollection->Fill("Kinkbefore", track->Pt(), kinkstatus); |
01745870 | 1088 | // RecPrim |
1089 | if(fRejectKinkMother) { | |
1090 | if(track->GetKinkIndex(0) != 0) continue; } // Quick and dirty fix to reject both kink mothers and daughters | |
1091 | if(!ProcessCutStep(AliHFEcuts::kStepRecPrim, track)) continue; | |
2e4ed823 | 1092 | fQACollection->Fill("Kinkafter", track->Pt(), kinkstatus); |
01745870 | 1093 | |
1094 | // HFEcuts: ITS layers cuts | |
1095 | if(!ProcessCutStep(AliHFEcuts::kStepHFEcutsITS, track)) continue; | |
1096 | ||
1097 | // HFE cuts: TOF PID and mismatch flag | |
1098 | if(!ProcessCutStep(AliHFEcuts::kStepHFEcutsTOF, track)) continue; | |
1099 | ||
1100 | // HFE cuts: TPC PID cleanup | |
1101 | if(!ProcessCutStep(AliHFEcuts::kStepHFEcutsTPC, track)) continue; | |
1102 | ||
1103 | // HFEcuts: Nb of tracklets TRD0 | |
1104 | if(!ProcessCutStep(AliHFEcuts::kStepHFEcutsTRD, track)) continue; | |
1105 | ||
1106 | // Fill correlation maps before PID | |
1107 | if(signal && fContainer->GetCorrelationMatrix("correlationstepbeforePID")) { | |
1108 | //printf("Fill correlation maps before PID\n"); | |
1109 | fVarManager->FillCorrelationMatrix(fContainer->GetCorrelationMatrix("correlationstepbeforePID")); | |
1110 | } | |
1111 | ||
1112 | if(HasMCData()){ | |
1113 | FillProductionVertex(track); | |
1114 | ||
1115 | if(fMCQA && signal){ | |
1116 | fMCQA->SetCentrality(fCentralityF); | |
1117 | if(mctrack && (TMath::Abs(mctrack->Particle()->GetPdgCode()) == 11)){ | |
1118 | Double_t weightElecBgV0[kBgLevels] = {0.,0.,0.}; | |
1119 | Double_t hfeimpactRtmp=0., hfeimpactnsigmaRtmp=0.; | |
1120 | fExtraCuts->GetHFEImpactParameters(track, hfeimpactRtmp, hfeimpactnsigmaRtmp); | |
1121 | UChar_t itsPixel = track->GetITSClusterMap(); | |
1122 | Double_t ilyrhit=0, ilyrstat=0; | |
1123 | for(Int_t ilyr=0; ilyr<6; ilyr++){ | |
1124 | if(TESTBIT(itsPixel, ilyr)) ilyrhit += TMath::Power(2,ilyr); | |
1125 | if(fExtraCuts->CheckITSstatus(fExtraCuts->GetITSstatus(track,ilyr))) ilyrstat += TMath::Power(2,ilyr); | |
1126 | } | |
1127 | fMCQA->SetITSInfo(ilyrhit,ilyrstat); | |
1128 | fMCQA->SetHFEImpactParameters(hfeimpactRtmp, hfeimpactnsigmaRtmp); | |
1129 | fMCQA->SetTrkKine(track->Pt(),track->Eta(), track->Phi()); | |
1130 | fMCQA->SetContainerStep(3); | |
1131 | for(Int_t iLevel = 0; iLevel < kBgLevels; iLevel++){ | |
1132 | weightElecBgV0[iLevel] = fMCQA->GetWeightFactor(mctrack, iLevel); // positive:conversion e, negative: nonHFE | |
1133 | if(!fisNonHFEsystematics || IsPbPb())break; | |
1134 | } | |
1135 | ||
1136 | if(fisNonHFEsystematics){ | |
1137 | //Fill additional containers for electron source distinction | |
1138 | Int_t elecSource = 0; | |
1139 | elecSource = fMCQA->GetElecSource(mctrack->Particle()); | |
1140 | const Char_t *sourceName[kElecBgSpecies]={"Pion","Eta","Omega","Phi","EtaPrime","Rho"}; | |
1141 | const Char_t *levelName[kBgLevels]={"Best","Lower","Upper"}; | |
1142 | Int_t iName = 0; | |
1143 | for(Int_t iSource = AliHFEmcQA::kPi0; iSource <= AliHFEmcQA::kGammaRho0; iSource++){ | |
1144 | if((iSource == AliHFEmcQA::kElse)||(iSource == AliHFEmcQA::kMisID)) continue; | |
1145 | if(elecSource == iSource){ | |
1146 | for(Int_t iLevel = 0; iLevel < kBgLevels; iLevel++){ | |
1147 | if(weightElecBgV0[iLevel]>0){ | |
1148 | fVarManager->FillContainer(fContainer, Form("conversionElecs%s%s",sourceName[iName], levelName[iLevel]), 3, kFALSE, weightElecBgV0[iLevel]); | |
1149 | } | |
1150 | else if(weightElecBgV0[iLevel]<0){ | |
1151 | fVarManager->FillContainer(fContainer, Form("mesonElecs%s%s",sourceName[iName], levelName[iLevel]), 3, kFALSE, -1*weightElecBgV0[iLevel]); | |
1152 | } | |
1153 | if(IsPbPb())break; | |
1154 | } | |
1155 | break; | |
1156 | } | |
1157 | iName++; | |
1158 | if(iName == kElecBgSpecies)iName = 0; | |
1159 | } | |
1160 | } | |
1161 | //else{ | |
1162 | if(weightElecBgV0[0]>0) { | |
1163 | fVarManager->FillContainer(fContainer, "conversionElecs", 3, kFALSE, weightElecBgV0[0]); | |
1164 | fVarManager->FillContainer(fContainer, "conversionElecs", 4, kTRUE, weightElecBgV0[0]); | |
1165 | } | |
1166 | else if(weightElecBgV0[0]<0) { | |
1167 | fVarManager->FillContainer(fContainer, "mesonElecs", 3, kFALSE, -1*weightElecBgV0[0]); | |
1168 | fVarManager->FillContainer(fContainer, "mesonElecs", 4, kTRUE, -1*weightElecBgV0[0]); | |
1169 | } | |
1170 | //} | |
1171 | } | |
1172 | } | |
1173 | ||
1174 | Double_t hfeimpactR4all=0., hfeimpactnsigmaR4all=0.; | |
1175 | Int_t sourceDca =-1; | |
1176 | if(mctrack && (TMath::Abs(mctrack->Particle()->GetPdgCode()) == 211)){ | |
1177 | if(track->Pt()>4.){ | |
1178 | fExtraCuts->GetHFEImpactParameters(track, hfeimpactR4all, hfeimpactnsigmaR4all); | |
1179 | dataDca[0]=0; //pion | |
1180 | dataDca[1]=track->Pt(); | |
1181 | dataDca[2]=hfeimpactR4all; | |
1182 | dataDca[3]=fCentralityF; | |
1183 | dataDca[4] = v0pid; | |
1184 | dataDca[5] = double(track->Charge()); | |
1185 | fQACollection->Fill("Dca", dataDca); | |
1186 | } | |
1187 | } | |
1188 | else if(mctrack && (TMath::Abs(mctrack->Particle()->GetPdgCode()) == 11)){ // to increas statistics for Martin | |
1189 | if(signal){ | |
1190 | fExtraCuts->GetHFEImpactParameters(track, hfeimpactR4all, hfeimpactnsigmaR4all); | |
1191 | if(fSignalCuts->IsCharmElectron(track)){ | |
1192 | sourceDca=1; | |
1193 | } | |
1194 | else if(fSignalCuts->IsBeautyElectron(track)){ | |
1195 | sourceDca=2; | |
1196 | } | |
1197 | else if(fSignalCuts->IsGammaElectron(track)){ | |
1198 | sourceDca=3; | |
1199 | } | |
1200 | else if(fSignalCuts->IsNonHFElectron(track)){ | |
1201 | sourceDca=4; | |
1202 | } | |
1203 | else if(fSignalCuts->IsJpsiElectron(track)){ | |
1204 | sourceDca=5; | |
1205 | } | |
1206 | else { | |
1207 | sourceDca=6; | |
1208 | } | |
1209 | dataDca[0]=sourceDca; | |
1210 | dataDca[1]=track->Pt(); | |
1211 | dataDca[2]=hfeimpactR4all; | |
1212 | dataDca[3]=fCentralityF; | |
1213 | dataDca[4] = v0pid; | |
1214 | dataDca[5] = double(track->Charge()); | |
1215 | if(signal) fQACollection->Fill("Dca", dataDca); | |
1216 | } | |
1217 | } | |
1218 | } | |
1219 | ||
1220 | AliHFEpidObject hfetrack; | |
1221 | hfetrack.SetAnalysisType(AliHFEpidObject::kESDanalysis); | |
1222 | hfetrack.SetRecTrack(track); | |
1223 | if(HasMCData()) hfetrack.SetMCTrack(mctrack); | |
1224 | hfetrack.SetCentrality(fCentralityF); | |
1225 | hfetrack.SetMulitplicity(ncontribVtx); | |
4437a0d2 | 1226 | if(IsPbPb()) hfetrack.SetPbPb(); |
1227 | else { | |
1228 | if(IspPb()) hfetrack.SetpPb(); | |
1229 | else hfetrack.SetPP(); | |
1230 | } | |
01745870 | 1231 | fPID->SetVarManager(fVarManager); |
1232 | if(!fPID->IsSelected(&hfetrack, fContainer, "recTrackCont", fPIDqa)) continue; | |
1233 | nElectronCandidates++; | |
1234 | ||
1235 | // Background subtraction------------------------------------------------------------------------------------------ | |
1236 | if (GetPlugin(kNonPhotonicElectron)) { | |
1237 | Int_t indexmother = -1; | |
1238 | Int_t mcsource = -1; | |
afb48e1d | 1239 | Int_t mcQAsource = -1; |
1240 | Double_t weightNonPhotonicFactor = 1.; | |
01745870 | 1241 | if(HasMCData()){ |
1242 | mcsource = fBackgroundSubtraction->FindMother(mctrack->GetLabel(),indexmother); | |
afb48e1d | 1243 | if(fBackgroundSubtraction->GetLevelBack()>=0) { |
1244 | if(fMCQA) { | |
1245 | mcQAsource = fMCQA->GetElecSource(mctrack); | |
1246 | weightNonPhotonicFactor = TMath::Abs(fMCQA->GetWeightFactor(mctrack, fBackgroundSubtraction->GetLevelBack())); // positive:conversion e, negative: nonHFE | |
1247 | } | |
1248 | } | |
01745870 | 1249 | } |
afb48e1d | 1250 | fBackgroundSubtraction->LookAtNonHFE(itrack, track, fInputEvent, weightNonPhotonicFactor, fCentralityF, -1, mcsource, indexmother,mcQAsource); |
01745870 | 1251 | } |
1252 | //----------------------------------------------------------------------------------------------------------------- | |
1253 | ||
1254 | // Temporary histogram for chi2/ITS cluster | |
1255 | if(IsPbPb()) { | |
1256 | TBits shared = track->GetTPCSharedMap(); | |
1257 | Int_t sharebit=0; | |
1258 | if(shared.CountBits() >= 2) sharebit=1; | |
1259 | ||
1260 | Double_t itschi2percluster = 0.0; | |
1261 | Double_t itsnbcls = static_cast<Double_t>(track->GetNcls(0)); | |
1262 | if(itsnbcls > 0) itschi2percluster = track->GetITSchi2()/itsnbcls; | |
1263 | ||
1264 | Double_t itsChi2[7] = {track->Pt(),track->Eta(), track->Phi(), | |
1265 | static_cast<Double_t>(fCentralityF),static_cast<Double_t>(track->GetTPCsignalN()), static_cast<Double_t>(sharebit),itschi2percluster}; | |
1266 | fQACollection->Fill("fChi2perITScluster", itsChi2); | |
1267 | } | |
1268 | else{ | |
1269 | ||
1270 | Double_t itschi2percluster = 0.0; | |
1271 | Double_t itsnbcls = static_cast<Double_t>(track->GetNcls(0)); | |
1272 | if(itsnbcls > 0) itschi2percluster = track->GetITSchi2()/itsnbcls; | |
1273 | ||
1274 | Double_t itsChi2[3] = {track->Pt(), static_cast<Double_t>(fCentralityF), itschi2percluster}; | |
1275 | fQACollection->Fill("fChi2perITScluster", itsChi2); | |
1276 | } | |
1277 | ||
1278 | // Fill Histogram for Hadronic Background | |
1279 | if(HasMCData()){ | |
1280 | if(mctrack && (TMath::Abs(mctrack->Particle()->GetPdgCode()) != 11)) | |
1281 | fVarManager->FillContainer(fContainer, "hadronicBackground", UInt_t(0), kFALSE); | |
1282 | else if(mctrack){ | |
1283 | // Fill Ke3 contributions | |
1284 | Int_t glabel=TMath::Abs(mctrack->GetMother()); | |
1285 | if((mctrackmother = dynamic_cast<AliMCParticle *>(fMCEvent->GetTrack(glabel)))){ | |
1286 | if(TMath::Abs(mctrackmother->Particle()->GetPdgCode())==321) | |
1287 | fQACollection->Fill("Ke3Kecorr",mctrack->Pt(),mctrackmother->Pt()); | |
1288 | else if(TMath::Abs(mctrackmother->Particle()->GetPdgCode())==130) | |
1289 | fQACollection->Fill("Ke3K0Lecorr",mctrack->Pt(),mctrackmother->Pt()); | |
1290 | } | |
1291 | } | |
1292 | } | |
1293 | ||
1294 | // Fill Containers | |
1295 | if(signal) { | |
1296 | // Apply weight for background contamination | |
1297 | if(fBackGroundFactorApply) { | |
4437a0d2 | 1298 | if(IsPbPb() && fCentralityF >= 0) fWeightBackGround = fkBackGroundFactorArray[fCentralityF >= 0 ? fCentralityF : 0]->Eval(TMath::Abs(track->P())); |
1299 | else fWeightBackGround = fkBackGroundFactorArray[0]->Eval(TMath::Abs(track->P())); // for pp and pPb | |
01745870 | 1300 | |
1301 | if(fWeightBackGround < 0.0) fWeightBackGround = 0.0; | |
1302 | else if(fWeightBackGround > 1.0) fWeightBackGround = 1.0; | |
1303 | // weightBackGround as special weight | |
1304 | fVarManager->FillContainer(fContainer, "hadronicBackground", 1, kFALSE, fWeightBackGround); | |
1305 | } | |
1306 | fVarManager->FillCorrelationMatrix(fContainer->GetCorrelationMatrix("correlationstepafterPID")); | |
1307 | } | |
1308 | ||
1309 | Bool_t bTagged=kFALSE; | |
1310 | if(GetPlugin(kSecVtx)) { | |
1311 | AliDebug(2, "Running Secondary Vertex Analysis"); | |
1312 | if(fSecVtx->Process(track) && signal) { | |
1313 | fVarManager->FillContainer(fContainer, "recTrackContSecvtxReco", AliHFEcuts::kStepHFEcutsSecvtx, kFALSE); | |
1314 | fVarManager->FillContainer(fContainer, "recTrackContSecvtxMC", AliHFEcuts::kStepHFEcutsSecvtx, kTRUE); | |
1315 | bTagged=kTRUE; | |
1316 | } | |
1317 | } | |
1318 | ||
1319 | // Electron background analysis | |
1320 | if (GetPlugin(kIsElecBackGround)) { | |
1321 | ||
1322 | AliDebug(2, "Running BackGround Analysis"); | |
1323 | ||
1324 | for(Int_t jtrack = 0; jtrack < fESD->GetNumberOfTracks(); jtrack++){ | |
1325 | htrack = fESD->GetTrack(jtrack); | |
1326 | if ( itrack == jtrack ) continue; | |
1327 | fElecBackGround->PairAnalysis(track, htrack); | |
1328 | } | |
1329 | } // end of electron background analysis | |
1330 | ||
1331 | if (GetPlugin(kDEstep)) { | |
1332 | Double_t weightElecBgV0[kBgLevels] = {0.,0.,0.,}; | |
1333 | Int_t elecSource = 0; | |
1334 | Double_t hfeimpactR=0., hfeimpactnsigmaR=0.; | |
1335 | fExtraCuts->GetHFEImpactParameters(track, hfeimpactR, hfeimpactnsigmaR); | |
1336 | if(HasMCData()) | |
1337 | { | |
1338 | if(mctrack && (TMath::Abs(mctrack->Particle()->GetPdgCode()) != 11)){ | |
1339 | fQACollection->Fill("hadronsBeforeIPcut",track->Pt()); | |
1340 | } | |
1341 | if(fMCQA && signal) { | |
1342 | ||
1343 | fMCQA->SetContainerStep(0); | |
1344 | for(Int_t iLevel = 0; iLevel < kBgLevels; iLevel++){ | |
1345 | weightElecBgV0[iLevel] = fMCQA->GetWeightFactor(mctrack, iLevel); // positive:conversion e, negative: nonHFE | |
1346 | if(!fisNonHFEsystematics || IsPbPb())break; | |
1347 | } | |
1348 | ||
1349 | if(fisNonHFEsystematics){ | |
1350 | //Fill additional containers for electron source distinction | |
1351 | elecSource = fMCQA->GetElecSource(mctrack->Particle()); | |
1352 | const Char_t *sourceName[kElecBgSpecies]={"Pion","Eta","Omega","Phi","EtaPrime","Rho"}; | |
1353 | const Char_t *levelName[kBgLevels]={"Best","Lower","Upper"}; | |
1354 | Int_t iName = 0; | |
1355 | for(Int_t iSource = AliHFEmcQA::kPi0; iSource <= AliHFEmcQA::kGammaRho0; iSource++){ | |
1356 | if((iSource == AliHFEmcQA::kElse)||(iSource == AliHFEmcQA::kMisID)) continue; | |
1357 | if(elecSource == iSource){ | |
1358 | for(Int_t iLevel = 0; iLevel < kBgLevels; iLevel++){ | |
1359 | if(weightElecBgV0[iLevel]>0) fVarManager->FillContainer(fContainer, Form("conversionElecs%s%s",sourceName[iName], levelName[iLevel]), 0, kFALSE, weightElecBgV0[iLevel]); | |
1360 | else if(weightElecBgV0[iLevel]<0) fVarManager->FillContainer(fContainer, Form("mesonElecs%s%s",sourceName[iName], levelName[iLevel]), 0, kFALSE, -1*weightElecBgV0[iLevel]); | |
1361 | if(IsPbPb())break; | |
1362 | } | |
1363 | break; | |
1364 | } | |
1365 | iName++; | |
1366 | if(iName == kElecBgSpecies)iName = 0; | |
1367 | } | |
1368 | } | |
1369 | //else{ | |
1370 | if(weightElecBgV0[0]>0) { | |
1371 | fVarManager->FillContainer(fContainer, "conversionElecs", 0, kFALSE, weightElecBgV0[0]); | |
1372 | fVarManager->FillContainer(fContainer, "conversionElecs", 5, kTRUE, weightElecBgV0[0]); | |
1373 | } | |
1374 | else if(weightElecBgV0[0]<0) { | |
1375 | fVarManager->FillContainer(fContainer, "mesonElecs", 0, kFALSE, -1*weightElecBgV0[0]); | |
1376 | fVarManager->FillContainer(fContainer, "mesonElecs", 5, kTRUE, -1*weightElecBgV0[0]); | |
1377 | } | |
1378 | //} | |
1379 | if(bTagged){ // bg estimation for the secondary vertex tagged signals | |
1380 | if(weightElecBgV0[0]>0) fVarManager->FillContainer(fContainer, "conversionElecs", 2, kFALSE, weightElecBgV0[0]); | |
1381 | else if(weightElecBgV0[0]<0) fVarManager->FillContainer(fContainer, "mesonElecs", 2, kFALSE, -1*weightElecBgV0[0]); | |
1382 | } | |
1383 | } | |
1384 | } // end of MC | |
1385 | ||
1386 | dataDca[0]=-1; //for data, don't know the origin | |
1387 | dataDca[1]=track->Pt(); | |
1388 | dataDca[2]=hfeimpactR; | |
1389 | dataDca[3]=fCentralityF; | |
1390 | dataDca[4] = v0pid; | |
1391 | dataDca[5] = double(track->Charge()); | |
1392 | if (!HasMCData()) fQACollection->Fill("Dca", dataDca); | |
1393 | ||
1394 | // Fill Containers for impact parameter analysis | |
1395 | if(!fCFM->CheckParticleCuts(AliHFEcuts::kStepHFEcutsDca + AliHFEcuts::kNcutStepsMCTrack + AliHFEcuts::kNcutStepsRecTrack,track)) continue; | |
1396 | if(signal) { | |
1397 | // Apply weight for background contamination after ip cut | |
1398 | if(fBackGroundFactorApply) { | |
1399 | fWeightBackGround = fkBackGroundFactorArray[0]->Eval(TMath::Abs(track->P())); // pp case | |
1400 | if(fWeightBackGround < 0.0) fWeightBackGround = 0.0; | |
1401 | else if(fWeightBackGround > 1.0) fWeightBackGround = 1.0; | |
1402 | // weightBackGround as special weight | |
1403 | fVarManager->FillContainer(fContainer, "hadronicBackground", 2, kFALSE, fWeightBackGround); | |
1404 | } | |
1405 | } | |
1406 | ||
1407 | if(HasMCData()){ | |
1408 | if(fMCQA && signal) { | |
1409 | fMCQA->SetContainerStep(1); | |
1410 | for(Int_t iLevel = 0; iLevel < kBgLevels; iLevel++){ | |
1411 | weightElecBgV0[iLevel] = fMCQA->GetWeightFactor(mctrack, iLevel); // positive:conversion e, negative: nonHFE | |
1412 | if(!fisNonHFEsystematics || IsPbPb())break; | |
1413 | } | |
1414 | if(fisNonHFEsystematics){ | |
1415 | //Fill additional containers for electron source distinction | |
1416 | elecSource = fMCQA->GetElecSource(mctrack->Particle()); | |
1417 | const Char_t *sourceName[kElecBgSpecies]={"Pion","Eta","Omega","Phi","EtaPrime","Rho"}; | |
1418 | const Char_t *levelName[kBgLevels]={"Best","Lower","Upper"}; | |
1419 | Int_t iName = 0; | |
1420 | for(Int_t iSource = AliHFEmcQA::kPi0; iSource <= AliHFEmcQA::kGammaRho0; iSource++){ | |
1421 | if((iSource == AliHFEmcQA::kElse)||(iSource == AliHFEmcQA::kMisID)) continue; | |
1422 | if(elecSource == iSource){ | |
1423 | for(Int_t iLevel = 0; iLevel < kBgLevels; iLevel++){ | |
1424 | if(weightElecBgV0[iLevel]>0) fVarManager->FillContainer(fContainer, Form("conversionElecs%s%s",sourceName[iName], levelName[iLevel]), 1, kFALSE, weightElecBgV0[iLevel]); | |
1425 | else if(weightElecBgV0[iLevel]<0) fVarManager->FillContainer(fContainer, Form("mesonElecs%s%s",sourceName[iName], levelName[iLevel]), 1, kFALSE, -1*weightElecBgV0[iLevel]); | |
1426 | if(IsPbPb())break; | |
1427 | } | |
1428 | break; | |
1429 | } | |
1430 | iName++; | |
1431 | if(iName == kElecBgSpecies)iName = 0; | |
1432 | } | |
1433 | } | |
1434 | // else{ | |
1435 | if(weightElecBgV0[0]>0) { | |
1436 | fVarManager->FillContainer(fContainer, "conversionElecs", 1, kFALSE, weightElecBgV0[0]); | |
1437 | fVarManager->FillContainer(fContainer, "conversionElecs", 6, kTRUE, weightElecBgV0[0]); | |
1438 | } | |
1439 | else if(weightElecBgV0[0]<0) { | |
1440 | fVarManager->FillContainer(fContainer, "mesonElecs", 1, kFALSE, -1*weightElecBgV0[0]); | |
1441 | fVarManager->FillContainer(fContainer, "mesonElecs", 6, kTRUE, -1*weightElecBgV0[0]); | |
1442 | } | |
1443 | //} | |
1444 | } | |
1445 | } | |
1446 | if(signal) { | |
1447 | fVarManager->FillContainer(fContainer, "recTrackContDEReco", AliHFEcuts::kStepHFEcutsDca, kFALSE); | |
1448 | fVarManager->FillContainer(fContainer, "recTrackContDEMC", AliHFEcuts::kStepHFEcutsDca, kTRUE); | |
1449 | fVarManager->FillCorrelationMatrix(fContainer->GetCorrelationMatrix("correlationstepafterDE")); | |
1450 | } | |
1451 | if(HasMCData()){ | |
1452 | if(mctrack && (TMath::Abs(mctrack->Particle()->GetPdgCode()) != 11)){ | |
1453 | fQACollection->Fill("hadronsAfterIPcut",track->Pt()); | |
1454 | } | |
1455 | } | |
1456 | } | |
1457 | ||
1458 | } | |
1459 | ||
1460 | // Background subtraction------------------------------------------------------------------- | |
1461 | if (GetPlugin(kNonPhotonicElectron)) fBackgroundSubtraction->CountPoolAssociated(fInputEvent, fCentralityF); | |
1462 | //------------------------------------------------------------------------------------------ | |
1463 | ||
1464 | fQACollection->Fill("nElectronTracksEvent", nElectronCandidates); | |
1465 | } | |
1466 | ||
1467 | //____________________________________________________________ | |
1468 | void AliAnalysisTaskHFE::ProcessAOD(){ | |
1469 | // | |
1470 | // Run Analysis in AOD Mode | |
1471 | // Function is still in development | |
1472 | // | |
1473 | //printf("Process AOD\n"); | |
1474 | AliDebug(3, "Processing AOD Event"); | |
1475 | Double_t eventContainer[4]; | |
1476 | eventContainer[0] = 0.0; | |
1477 | if(HasMCData()) eventContainer[0] = fVz; | |
1478 | else { | |
1479 | if(fInputEvent->GetPrimaryVertex()) eventContainer[0] = fInputEvent->GetPrimaryVertex()->GetZ(); | |
1480 | } | |
1481 | eventContainer[1] = 1.; // No Information available in AOD analysis, assume all events have V0AND | |
1482 | eventContainer[2] = fCentralityF; | |
1483 | eventContainer[3] = fContributors; | |
1484 | ||
1485 | //printf("value event container %f, %f, %f, %f\n",eventContainer[0],eventContainer[1],eventContainer[2],eventContainer[3]); | |
1486 | ||
1487 | AliAODEvent *fAOD = dynamic_cast<AliAODEvent *>(fInputEvent); | |
1488 | if(!fAOD){ | |
1489 | AliError("AOD Event required for AOD Analysis"); | |
1490 | return; | |
1491 | } | |
e2861c1a | 1492 | |
e2861c1a | 1493 | // Set magnetic field if V0 task on |
1494 | if(fTaggedTrackAnalysis) { | |
2e4ed823 | 1495 | // Tag all v0s in current event |
1496 | if(fV0Tagger){ | |
1497 | fV0Tagger->Reset(); | |
1498 | fV0Tagger->TagV0Tracks(fAOD); | |
1499 | } | |
e2861c1a | 1500 | fTaggedTrackAnalysis->SetMagneticField(fAOD->GetMagneticField()); |
1501 | fTaggedTrackAnalysis->SetCentrality(fCentralityF); | |
1502 | if(IsPbPb()) fTaggedTrackAnalysis->SetPbPb(); | |
1503 | else { | |
dab4f95d | 1504 | if(IspPb()) fTaggedTrackAnalysis->SetpPb(); |
1505 | else fTaggedTrackAnalysis->SetPP(); | |
e2861c1a | 1506 | } |
1507 | } | |
01745870 | 1508 | |
1509 | //printf("Will fill\n"); | |
1510 | // | |
1511 | fCFM->GetEventContainer()->Fill(eventContainer, AliHFEcuts::kEventStepRecNoCut); | |
1512 | //printf("Fill\n"); | |
1513 | // | |
1514 | if(fIdentifiedAsPileUp) return; | |
1515 | fCFM->GetEventContainer()->Fill(eventContainer, AliHFEcuts::kEventStepRecNoPileUp); | |
1516 | ||
1517 | // | |
1518 | if(fIdentifiedAsOutInz) return; | |
1519 | fCFM->GetEventContainer()->Fill(eventContainer, AliHFEcuts::kEventStepZRange); | |
1520 | ||
1521 | // | |
1522 | if(!fPassTheEventCut) return; | |
1523 | fCFM->GetEventContainer()->Fill(eventContainer, AliHFEcuts::kEventStepReconstructed); | |
1524 | //printf("pass\n"); | |
1525 | ||
1526 | fContainer->NewEvent(); | |
1527 | ||
1528 | fCFM->SetRecEventInfo(fAOD); | |
1529 | ||
1530 | if(!fExtraCuts){ | |
1531 | fExtraCuts = new AliHFEextraCuts("hfeExtraCuts","HFE Extra Cuts"); | |
1532 | } | |
1533 | fExtraCuts->SetRecEventInfo(fAOD); | |
1534 | ||
1535 | // Get Number of contributors to the primary vertex for multiplicity-dependent correction | |
1536 | Int_t ncontribVtx = 0; | |
1537 | AliAODVertex *priVtx = fAOD->GetPrimaryVertex(); | |
1538 | if(priVtx){ | |
1539 | ncontribVtx = priVtx->GetNContributors(); | |
1540 | } | |
1541 | ||
1542 | // Look for kink mother | |
1543 | Int_t numberofvertices = fAOD->GetNumberOfVertices(); | |
1544 | Double_t listofmotherkink[numberofvertices]; | |
1545 | Int_t numberofmotherkink = 0; | |
1546 | for(Int_t ivertex=0; ivertex < numberofvertices; ivertex++) { | |
1547 | AliAODVertex *aodvertex = fAOD->GetVertex(ivertex); | |
1548 | if(!aodvertex) continue; | |
1549 | if(aodvertex->GetType()==AliAODVertex::kKink) { | |
1550 | AliAODTrack *mother = (AliAODTrack *) aodvertex->GetParent(); | |
1551 | if(!mother) continue; | |
1552 | Int_t idmother = mother->GetID(); | |
1553 | listofmotherkink[numberofmotherkink] = idmother; | |
1554 | //printf("ID %d\n",idmother); | |
1555 | numberofmotherkink++; | |
1556 | } | |
1557 | } | |
1558 | //printf("Number of kink mother in the events %d\n",numberofmotherkink); | |
1559 | ||
1560 | // Background subtraction------------------------------------------------------------------- | |
afb48e1d | 1561 | if (GetPlugin(kNonPhotonicElectron)||GetPlugin(kNonPhotonicElectronBeauty)) fBackgroundSubtraction->FillPoolAssociatedTracks(fInputEvent, fCentralityF); |
01745870 | 1562 | //------------------------------------------------------------------------------------------ |
1563 | ||
1564 | // Loop over tracks | |
1565 | AliAODTrack *track = NULL; | |
1566 | AliAODMCParticle *mctrack = NULL; | |
1567 | Double_t dataDca[6]; // [source, pT, dca, centrality] | |
1568 | Int_t nElectronCandidates = 0; | |
1569 | Bool_t signal; | |
1570 | ||
1571 | //printf("Number of track %d\n",(Int_t) fAOD->GetNumberOfTracks()); | |
2e4ed823 | 1572 | Bool_t kinkmother(kFALSE), kinkdaughter(kFALSE); Double_t kinkstatus(0); |
01745870 | 1573 | for(Int_t itrack = 0; itrack < fAOD->GetNumberOfTracks(); itrack++){ |
2e4ed823 | 1574 | kinkmother=kFALSE; |
1575 | kinkdaughter=kFALSE; | |
1576 | kinkstatus = 0.; | |
01745870 | 1577 | track = fAOD->GetTrack(itrack); mctrack = NULL; |
1578 | if(!track) continue; | |
e2861c1a | 1579 | |
2e4ed823 | 1580 | for(int ivx = 0; ivx < numberofmotherkink; ivx++){ |
1581 | if(track->GetID() == listofmotherkink[ivx]){ | |
1582 | kinkmother = kTRUE; | |
1583 | break; | |
1584 | } | |
1585 | } | |
1586 | AliAODVertex *pvx = track->GetProdVertex(); | |
1587 | if(pvx && (pvx->GetType() == AliAODVertex::kKink)) kinkdaughter = kTRUE; | |
1588 | kinkstatus = 0.; | |
1589 | if(kinkmother) kinkstatus = 1.; | |
1590 | else if(kinkdaughter) kinkstatus = 2.; | |
1591 | ||
e2861c1a | 1592 | // fill counts of v0-identified particles |
dab4f95d | 1593 | AliPID::EParticleType v0pid = fV0Tagger ? fV0Tagger->GetV0Info(track->GetID()) : AliPID::kUnknown; |
e2861c1a | 1594 | // here the tagged track analysis will run |
1595 | if(fTaggedTrackAnalysis && v0pid != AliPID::kUnknown){ | |
1596 | AliDebug(1, Form("Track identified as %s", AliPID::ParticleName(v0pid))); | |
1597 | fTaggedTrackAnalysis->ProcessTrack(track, v0pid); | |
1598 | AliDebug(1, "V0 PID done"); | |
1599 | } | |
01745870 | 1600 | |
1601 | signal = kTRUE; | |
1602 | if(HasMCData()){ | |
01745870 | 1603 | Int_t label = TMath::Abs(track->GetLabel()); |
1604 | if(label && label < fAODArrayMCInfo->GetEntriesFast()) | |
1605 | mctrack = dynamic_cast<AliAODMCParticle *>(fAODArrayMCInfo->At(label)); | |
1606 | if(fFillSignalOnly && !fCFM->CheckParticleCuts(AliHFEcuts::kStepMCGenerated, mctrack)) signal = kFALSE; | |
2e4ed823 | 1607 | if(fRejectMCFakeTracks && IsMCFakeTrack(track)) signal = kFALSE; |
01745870 | 1608 | } |
1609 | ||
1610 | fVarManager->NewTrack(track, mctrack, fCentralityF, -1, signal); | |
1611 | ||
1612 | if(fFillNoCuts) { | |
1613 | if(signal || !fFillSignalOnly){ | |
1614 | fVarManager->FillContainer(fContainer, "recTrackContReco", AliHFEcuts::kStepRecNoCut, kFALSE); | |
1615 | fVarManager->FillContainer(fContainer, "recTrackContMC", AliHFEcuts::kStepRecNoCut, kTRUE); | |
1616 | } | |
1617 | } | |
1618 | ||
e2861c1a | 1619 | // begin AOD QA |
1620 | fQACollection->Fill("Filterbegin", -1); | |
1621 | for(Int_t k=0; k<20; k++) { | |
1622 | Int_t u = 1<<k; | |
1623 | if((track->TestFilterBit(u))) { | |
2e4ed823 | 1624 | fQACollection->Fill("Filterbegin", k); |
e2861c1a | 1625 | } |
1626 | } | |
1627 | ||
2e4ed823 | 1628 | // RecKine: ITSTPC cuts |
1629 | if(!ProcessCutStep(AliHFEcuts::kStepRecKineITSTPC, track)) continue; | |
1630 | ||
1631 | fQACollection->Fill("Kinkbefore", track->Pt(), kinkstatus); | |
1632 | // Reject kink mother | |
1633 | if(fRejectKinkMother) { | |
1634 | Bool_t kinkmotherpass = kTRUE; | |
1635 | for(Int_t ikinkmother = 0; ikinkmother < numberofmotherkink; ikinkmother++) { | |
1636 | if(track->GetID() == listofmotherkink[ikinkmother]) { | |
1637 | kinkmotherpass = kFALSE; | |
1638 | continue; | |
1639 | } | |
01745870 | 1640 | } |
2e4ed823 | 1641 | if(!kinkmotherpass) continue; |
1642 | } | |
1643 | ||
1644 | // RecPrim | |
1645 | if(!ProcessCutStep(AliHFEcuts::kStepRecPrim, track)) continue; | |
1646 | fQACollection->Fill("Kinkafter", track->Pt(), kinkstatus); | |
1647 | ||
1648 | // HFEcuts: ITS layers cuts | |
1649 | if(!ProcessCutStep(AliHFEcuts::kStepHFEcutsITS, track)) continue; | |
01745870 | 1650 | |
2e4ed823 | 1651 | // HFE cuts: TOF PID and mismatch flag |
1652 | if(!ProcessCutStep(AliHFEcuts::kStepHFEcutsTOF, track)) continue; | |
01745870 | 1653 | |
2e4ed823 | 1654 | // HFE cuts: TPC PID cleanup |
1655 | if(!ProcessCutStep(AliHFEcuts::kStepHFEcutsTPC, track)) continue; | |
1656 | ||
1657 | // HFEcuts: Nb of tracklets TRD0 | |
1658 | if(!ProcessCutStep(AliHFEcuts::kStepHFEcutsTRD, track)) continue; | |
01745870 | 1659 | |
1660 | // Fill correlation maps before PID | |
1661 | if(signal && fContainer->GetCorrelationMatrix("correlationstepbeforePID")) { | |
1662 | //printf("Fill correlation maps before PID\n"); | |
1663 | fVarManager->FillCorrelationMatrix(fContainer->GetCorrelationMatrix("correlationstepbeforePID")); | |
1664 | } | |
1665 | ||
1666 | if(HasMCData()){ | |
afb48e1d | 1667 | |
1668 | if(fMCQA && signal){ | |
1669 | fMCQA->SetCentrality(fCentralityF); | |
1670 | if(mctrack && (TMath::Abs(mctrack->GetPdgCode()) == 11)){ | |
1671 | Double_t weightElecBgV0[kBgLevels] = {0.,0.,0.}; | |
1672 | for(Int_t iLevel = 0; iLevel < kBgLevels; iLevel++){ | |
1673 | weightElecBgV0[iLevel] = fMCQA->GetWeightFactor(mctrack, iLevel); // positive:conversion e, negative: nonHFE | |
1674 | } | |
1675 | if(weightElecBgV0[0]>0) { | |
1676 | fVarManager->FillContainer(fContainer, "conversionElecs", 3, kFALSE, weightElecBgV0[0]); | |
1677 | fVarManager->FillContainer(fContainer, "conversionElecs", 4, kTRUE, weightElecBgV0[0]); | |
1678 | } | |
1679 | else if(weightElecBgV0[0]<0) { | |
1680 | fVarManager->FillContainer(fContainer, "mesonElecs", 3, kFALSE, -1*weightElecBgV0[0]); | |
1681 | fVarManager->FillContainer(fContainer, "mesonElecs", 4, kTRUE, -1*weightElecBgV0[0]); | |
1682 | } | |
1683 | } | |
1684 | } | |
1685 | ||
01745870 | 1686 | Double_t hfeimpactR4all=0., hfeimpactnsigmaR4all=0.; |
1687 | Int_t sourceDca =-1; | |
1688 | if(mctrack && (TMath::Abs(mctrack->GetPdgCode()) == 211)){ | |
1689 | if(track->Pt()>4.){ | |
1690 | fExtraCuts->GetHFEImpactParameters(track, hfeimpactR4all, hfeimpactnsigmaR4all); | |
1691 | dataDca[0]=0; //pion | |
1692 | dataDca[1]=track->Pt(); | |
1693 | dataDca[2]=hfeimpactR4all; | |
1694 | dataDca[3]=fCentralityF; | |
1695 | dataDca[4] = -1; // not store V0 for the moment | |
1696 | dataDca[5] = double(track->Charge()); | |
1697 | fQACollection->Fill("Dca", dataDca); | |
1698 | } | |
1699 | } | |
1700 | else if(mctrack && (TMath::Abs(mctrack->GetPdgCode()) == 11)){ // to increas statistics for Martin | |
1701 | if(signal){ | |
1702 | fExtraCuts->GetHFEImpactParameters(track, hfeimpactR4all, hfeimpactnsigmaR4all); | |
1703 | if(fSignalCuts->IsCharmElectron(track)){ | |
1704 | sourceDca=1; | |
1705 | } | |
1706 | else if(fSignalCuts->IsBeautyElectron(track)){ | |
1707 | sourceDca=2; | |
1708 | } | |
1709 | else if(fSignalCuts->IsGammaElectron(track)){ | |
1710 | sourceDca=3; | |
1711 | } | |
1712 | else if(fSignalCuts->IsNonHFElectron(track)){ | |
1713 | sourceDca=4; | |
1714 | } | |
1715 | else if(fSignalCuts->IsJpsiElectron(track)){ | |
1716 | sourceDca=5; | |
1717 | } | |
1718 | else { | |
1719 | sourceDca=6; | |
1720 | } | |
1721 | dataDca[0]=sourceDca; | |
1722 | dataDca[1]=track->Pt(); | |
1723 | dataDca[2]=hfeimpactR4all; | |
1724 | dataDca[3]=fCentralityF; | |
1725 | dataDca[4] = -1; // not store V0 for the moment | |
1726 | dataDca[5] = double(track->Charge()); | |
1727 | if(signal) fQACollection->Fill("Dca", dataDca); | |
1728 | } | |
1729 | } | |
1730 | } | |
1731 | ||
1732 | //printf("Will process to PID\n"); | |
1733 | ||
1734 | // track accepted, do PID | |
1735 | AliHFEpidObject hfetrack; | |
1736 | hfetrack.SetAnalysisType(AliHFEpidObject::kAODanalysis); | |
1737 | hfetrack.SetRecTrack(track); | |
1738 | if(HasMCData()) hfetrack.SetMCTrack(mctrack); | |
1739 | hfetrack.SetCentrality(fCentralityF); | |
1740 | hfetrack.SetMulitplicity(ncontribVtx); // for correction | |
4437a0d2 | 1741 | if(IsPbPb()) hfetrack.SetPbPb(); |
1742 | else{ | |
1743 | if(IspPb()) hfetrack.SetpPb(); | |
1744 | else hfetrack.SetPP(); | |
1745 | } | |
01745870 | 1746 | fPID->SetVarManager(fVarManager); |
1747 | if(!fPID->IsSelected(&hfetrack, fContainer, "recTrackCont", fPIDqa)) continue; | |
1748 | // we will do PID here as soon as possible | |
1749 | ||
1750 | // Background subtraction---------------------------------------------------------------------------------------------- | |
afb48e1d | 1751 | if (GetPlugin(kNonPhotonicElectron)&&!GetPlugin(kNonPhotonicElectronBeauty)) { |
01745870 | 1752 | Int_t indexmother = -1; |
afb48e1d | 1753 | Int_t mcsource = -1; |
1754 | Int_t mcQAsource = -1; | |
1755 | Double_t weightNonPhotonicFactor = 1.; | |
1756 | //printf("weight %f \n",weightNonPhotonicFactor); | |
2e4ed823 | 1757 | if(HasMCData() && mctrack){ |
1758 | mcsource = fBackgroundSubtraction->FindMother(TMath::Abs(track->GetLabel()),indexmother); | |
afb48e1d | 1759 | if(fBackgroundSubtraction->GetLevelBack()>=0) { |
1760 | if(fMCQA) { | |
1761 | mcQAsource = fMCQA->GetElecSource(mctrack); | |
1762 | weightNonPhotonicFactor = TMath::Abs(fMCQA->GetWeightFactor(mctrack, fBackgroundSubtraction->GetLevelBack())); // positive:conversion e, negative: nonHFE | |
1763 | } | |
1764 | } | |
2e4ed823 | 1765 | } |
afb48e1d | 1766 | fBackgroundSubtraction->LookAtNonHFE(itrack, track, fInputEvent, weightNonPhotonicFactor, fCentralityF, -1,mcsource, indexmother,mcQAsource); |
01745870 | 1767 | } |
1768 | //--------------------------------------------------------------------------------------------------------------------- | |
1769 | ||
1770 | // end AOD QA | |
1771 | fQACollection->Fill("Filterend", -1); | |
1772 | for(Int_t k=0; k<20; k++) { | |
1773 | Int_t u = 1<<k; | |
1774 | if((track->TestFilterBit(u))) { | |
1775 | fQACollection->Fill("Filterend", k); | |
1776 | } | |
1777 | } | |
1778 | ||
1779 | // Apply weight for background contamination | |
1780 | //Double_t weightBackGround = 1.0; | |
1781 | if(signal) { | |
1782 | // Apply weight for background contamination | |
1783 | if(fBackGroundFactorApply) { | |
4437a0d2 | 1784 | if(IsPbPb() && fCentralityF >= 0) fWeightBackGround = fkBackGroundFactorArray[fCentralityF >= 0 ? fCentralityF : 0]->Eval(TMath::Abs(track->P())); |
01745870 | 1785 | else fWeightBackGround = fkBackGroundFactorArray[0]->Eval(TMath::Abs(track->P())); // pp case |
1786 | ||
1787 | if(fWeightBackGround < 0.0) fWeightBackGround = 0.0; | |
1788 | else if(fWeightBackGround > 1.0) fWeightBackGround = 1.0; | |
1789 | // weightBackGround as special weight | |
1790 | fVarManager->FillContainer(fContainer, "hadronicBackground", 1, kFALSE, fWeightBackGround); | |
1791 | } | |
1792 | fVarManager->FillCorrelationMatrix(fContainer->GetCorrelationMatrix("correlationstepafterPID")); | |
1793 | } | |
1794 | ||
1795 | nElectronCandidates++; | |
1796 | ||
1797 | if (GetPlugin(kDEstep)) { | |
1798 | if (!HasMCData()){ | |
1799 | Double_t hfeimpactR=0., hfeimpactnsigmaR=0.; | |
1800 | fExtraCuts->GetHFEImpactParameters(track, hfeimpactR, hfeimpactnsigmaR); | |
1801 | dataDca[0]=-1; //for data, don't know the origin | |
1802 | dataDca[1]=track->Pt(); | |
1803 | dataDca[2]=hfeimpactR; | |
1804 | dataDca[3]=fCentralityF; | |
1805 | dataDca[4] = -1; // not store V0 for the moment | |
1806 | dataDca[5] = double(track->Charge()); | |
1807 | fQACollection->Fill("Dca", dataDca); | |
1808 | } | |
1809 | ||
1810 | // Fill Containers for impact parameter analysis | |
1811 | if(!fCFM->CheckParticleCuts(AliHFEcuts::kStepHFEcutsDca + AliHFEcuts::kNcutStepsMCTrack + AliHFEcuts::kNcutStepsRecTrack,track)) continue; | |
1812 | if(signal) { | |
1813 | // Apply weight for background contamination after ip cut | |
1814 | if(fBackGroundFactorApply) { | |
1815 | fWeightBackGround = fkBackGroundFactorArray[0]->Eval(TMath::Abs(track->P())); // pp case | |
1816 | if(fWeightBackGround < 0.0) fWeightBackGround = 0.0; | |
1817 | else if(fWeightBackGround > 1.0) fWeightBackGround = 1.0; | |
1818 | // weightBackGround as special weight | |
1819 | fVarManager->FillContainer(fContainer, "hadronicBackground", 2, kFALSE, fWeightBackGround); | |
1820 | } | |
afb48e1d | 1821 | |
1822 | fVarManager->FillContainer(fContainer, "recTrackContDEReco", AliHFEcuts::kStepHFEcutsDca, kFALSE); | |
1823 | fVarManager->FillContainer(fContainer, "recTrackContDEMC", AliHFEcuts::kStepHFEcutsDca, kTRUE); | |
1824 | fVarManager->FillCorrelationMatrix(fContainer->GetCorrelationMatrix("correlationstepafterDE")); | |
1825 | } | |
1826 | } | |
1827 | ||
1828 | // Background subtraction---------------------------------------------------------------------------------------------- | |
1829 | if (!GetPlugin(kNonPhotonicElectron)&&GetPlugin(kNonPhotonicElectronBeauty)) { | |
1830 | Int_t indexmother = -1; | |
1831 | Int_t mcsource = -1; | |
1832 | Int_t mcQAsource = -1; | |
1833 | Double_t weightNonPhotonicFactor = 1.; | |
1834 | //printf("weight %f \n",weightNonPhotonicFactor); | |
1835 | if(HasMCData() && mctrack){ | |
1836 | mcsource = fBackgroundSubtraction->FindMother(TMath::Abs(track->GetLabel()),indexmother); | |
1837 | if(fBackgroundSubtraction->GetLevelBack()>=0) { | |
1838 | if(fMCQA) { | |
1839 | mcQAsource = fMCQA->GetElecSource(mctrack); | |
1840 | weightNonPhotonicFactor = TMath::Abs(fMCQA->GetWeightFactor(mctrack, fBackgroundSubtraction->GetLevelBack())); // positive:conversion e, negative: nonHFE | |
1841 | } | |
1842 | } | |
01745870 | 1843 | } |
afb48e1d | 1844 | fBackgroundSubtraction->LookAtNonHFE(itrack, track, fInputEvent, weightNonPhotonicFactor, fCentralityF, -1,mcsource, indexmother,mcQAsource); |
01745870 | 1845 | } |
afb48e1d | 1846 | //--------------------------------------------------------------------------------------------------------------------- |
1847 | ||
01745870 | 1848 | } |
1849 | ||
1850 | // Background subtraction------------------------------------------------------------------- | |
afb48e1d | 1851 | if (GetPlugin(kNonPhotonicElectron)||GetPlugin(kNonPhotonicElectronBeauty)) fBackgroundSubtraction->CountPoolAssociated(fInputEvent, fCentralityF); |
01745870 | 1852 | //------------------------------------------------------------------------------------------ |
1853 | ||
1854 | fQACollection->Fill("nElectronTracksEvent", nElectronCandidates); | |
1855 | } | |
1856 | ||
1857 | //____________________________________________________________ | |
1858 | Bool_t AliAnalysisTaskHFE::ProcessMCtrack(AliVParticle *track){ | |
1859 | // | |
1860 | // Filter the Monte Carlo Track | |
1861 | // Additionally Fill a THnSparse for Signal To Background Studies | |
1862 | // Works for AOD and MC analysis Type | |
1863 | // | |
1864 | fVarManager->NewTrack(track, NULL, fCentralityF, -1, kTRUE); | |
1865 | ||
1866 | ||
1867 | Double_t vertex[3] = {0.,0.,0.}; // Production vertex cut to mask gammas which are NOT supposed to have hits in the first ITS layer(s) | |
1868 | if(IsESDanalysis()){ | |
1869 | AliMCParticle *mctrack = dynamic_cast<AliMCParticle *>(track); | |
1870 | if(mctrack){ | |
1871 | vertex[0] = mctrack->Particle()->Vx(); | |
1872 | vertex[1] = mctrack->Particle()->Vy(); | |
1873 | } | |
1874 | } else { | |
1875 | AliAODMCParticle *aodmctrack = dynamic_cast<AliAODMCParticle *>(track); | |
1876 | if(aodmctrack) aodmctrack->XvYvZv(vertex); | |
1877 | } | |
1878 | ||
1879 | //printf("MC Generated\n"); | |
1880 | if(!fCFM->CheckParticleCuts(AliHFEcuts::kStepMCGenerated, track)) return kFALSE; | |
1881 | //printf("MC Generated pass\n"); | |
1882 | fVarManager->FillContainer(fContainer, "MCTrackCont", AliHFEcuts::kStepMCGenerated, kFALSE); | |
1883 | ||
1884 | // Step GeneratedZOutNoPileUp | |
1885 | if((fIdentifiedAsPileUp) || (TMath::Abs(fVz) > fCuts->GetVertexRange()) || (fCentralityF < 0)) return kFALSE; | |
1886 | fVarManager->FillContainer(fContainer, "MCTrackCont", AliHFEcuts::kStepMCGeneratedZOutNoPileUpCentralityFine, kFALSE); | |
1887 | //printf("In ProcessMCtrack %f\n",fCentralityF); | |
1888 | ||
1889 | // Step Generated Event Cut | |
1890 | if(!fPassTheEventCut) return kFALSE; | |
1891 | fVarManager->FillContainer(fContainer, "MCTrackCont", AliHFEcuts::kStepMCGeneratedEventCut, kFALSE); | |
1892 | ||
e2861c1a | 1893 | if(IsESDanalysis()){ |
1894 | if(!fCFM->CheckParticleCuts(AliHFEcuts::kStepMCInAcceptance, track)) return kFALSE; | |
1895 | fVarManager->FillContainer(fContainer, "MCTrackCont", AliHFEcuts::kStepMCInAcceptance, kFALSE); | |
1896 | } | |
01745870 | 1897 | return kTRUE; |
1898 | } | |
1899 | ||
1900 | //____________________________________________________________ | |
1901 | Bool_t AliAnalysisTaskHFE::PreSelectTrack(AliESDtrack *track) const { | |
1902 | // | |
1903 | // Preselect tracks | |
1904 | // | |
1905 | ||
1906 | ||
1907 | Bool_t survived = kTRUE; | |
1908 | ||
1909 | if(fCutspreselect) { | |
1910 | //printf("test preselect\n"); | |
1911 | if(!fCutspreselect->IsSelected(track)) survived=kFALSE; | |
1912 | } | |
1913 | //printf("survived %d\n",(Int_t)survived); | |
1914 | ||
1915 | if(survived && fPIDpreselect){ | |
1916 | // Apply PID | |
1917 | AliHFEpidObject hfetrack; | |
1918 | hfetrack.SetAnalysisType(AliHFEpidObject::kESDanalysis); | |
1919 | hfetrack.SetRecTrack(track); | |
1920 | if(!fPIDpreselect->IsSelected(&hfetrack)) { | |
1921 | //printf("Did not pass AliHFEcuts::kPID\n"); | |
1922 | survived = kFALSE; | |
1923 | } | |
1924 | //else printf("Pass AliHFEcuts::kPID\n"); | |
1925 | } | |
1926 | ||
1927 | return survived; | |
1928 | ||
1929 | } | |
1930 | //____________________________________________________________ | |
1931 | void AliAnalysisTaskHFE::MakeEventContainer(){ | |
1932 | // | |
1933 | // Create the event container for the correction framework and link it | |
1934 | // 1st bin: Vertex z-position | |
1935 | // 2nd bin: V0AND decision (normalization to sigma_inel) | |
1936 | // 3rd bin: Centrality class (for pp defined as number of contributors in vertex.) | |
1937 | // 4th bin: Number of contributors > 0 | |
1938 | // | |
1939 | ||
1940 | const Int_t kNvar = 4; // number of variables on the grid: | |
1941 | Int_t nBins[kNvar] = {120, 2, 11, 2}; | |
1942 | Double_t binMin[kNvar] = {-30. , 0., 0.0, 0.}; | |
1943 | Double_t binMax[kNvar] = {30., 2., 11.0, 2.}; | |
1944 | ||
1945 | AliCFContainer *evCont = new AliCFContainer("eventContainer", "Container for events", AliHFEcuts::kNcutStepsEvent, kNvar, nBins); | |
1946 | ||
1947 | Double_t *vertexBins = AliHFEtools::MakeLinearBinning(nBins[0], binMin[0], binMax[0]); | |
1948 | Double_t *v0andBins = AliHFEtools::MakeLinearBinning(nBins[1], binMin[1], binMax[1]); | |
1949 | Double_t *centralityBins = AliHFEtools::MakeLinearBinning(nBins[2], binMin[2], binMax[2]); | |
1950 | Double_t *contributorsBins = AliHFEtools::MakeLinearBinning(nBins[3], binMin[3], binMax[3]); | |
1951 | evCont->SetBinLimits(0, vertexBins); | |
1952 | evCont->SetBinLimits(1, v0andBins); | |
1953 | evCont->SetBinLimits(2, centralityBins); | |
1954 | evCont->SetBinLimits(3, contributorsBins); | |
1955 | delete[] vertexBins; delete[] v0andBins; delete[] centralityBins; delete[] contributorsBins; | |
1956 | ||
1957 | fCFM->SetEventContainer(evCont); | |
1958 | } | |
1959 | ||
1960 | //____________________________________________________________ | |
1961 | void AliAnalysisTaskHFE::MakeParticleContainer(){ | |
1962 | // | |
1963 | // Create the particle container for the correction framework manager and | |
1964 | // link it | |
1965 | // | |
1966 | if(!fContainer) fContainer = new AliHFEcontainer("trackContainer"); | |
1967 | fVarManager->DefineVariables(fContainer); | |
1968 | ||
1969 | // Create Correction Framework containers | |
1970 | fContainer->CreateContainer("MCTrackCont", "Track Container filled with MC information", AliHFEcuts::kNcutStepsMCTrack); | |
1971 | fContainer->CreateContainer("recTrackContReco", "Track Container filled with MC information", AliHFEcuts::kNcutStepsRecTrack + fPID->GetNumberOfPIDdetectors()); | |
1972 | fContainer->CreateContainer("recTrackContMC", "Track Container filled with MC information", AliHFEcuts::kNcutStepsRecTrack + fPID->GetNumberOfPIDdetectors()); | |
1973 | ||
1974 | fContainer->CreateContainer("hadronicBackground", "Container for Hadronic Background", 3); | |
1975 | fContainer->CreateContainer("recTrackContDEReco", "Container for displaced electron analysis with Reco information", 1); | |
1976 | fContainer->CreateContainer("recTrackContDEMC", "Container for displaced electron analysis with MC information", 1); | |
1977 | fContainer->CreateContainer("recTrackContSecvtxReco", "Container for secondary vertexing analysis with Reco information", 1); | |
1978 | fContainer->CreateContainer("recTrackContSecvtxMC", "Container for secondary vertexing analysis with MC information", 1); | |
1979 | ||
1980 | if(HasMCData()){ | |
1981 | fContainer->CreateContainer("conversionElecs", "Container for weighted conversion electrons",7); | |
1982 | fContainer->CreateContainer("mesonElecs", "Container for weighted electrons from meson decays",7); | |
1983 | fContainer->Sumw2("conversionElecs"); | |
1984 | fContainer->Sumw2("mesonElecs"); | |
1985 | ||
1986 | if(fisNonHFEsystematics){ | |
1987 | const Char_t *sourceName[kElecBgSpecies]={"Pion","Eta","Omega","Phi","EtaPrime","Rho"}; | |
1988 | const Char_t *levelName[kBgLevels]={"Best","Lower","Upper"}; | |
1989 | for(Int_t iSource = 0; iSource < kElecBgSpecies; iSource++){ | |
1990 | for(Int_t iLevel = 0; iLevel < kBgLevels; iLevel++){ | |
1991 | fContainer->CreateContainer(Form("conversionElecs%s%s",sourceName[iSource],levelName[iLevel]), Form("Container for weighted conversion electrons from %s grandm., %s level",sourceName[iSource],levelName[iLevel]),5); | |
1992 | fContainer->CreateContainer(Form("mesonElecs%s%s",sourceName[iSource],levelName[iLevel]), Form("Container for weighted electrons from %s decays, %s level",sourceName[iSource],levelName[iLevel]),5); | |
1993 | fContainer->Sumw2(Form("conversionElecs%s%s",sourceName[iSource],levelName[iLevel])); | |
1994 | fContainer->Sumw2(Form("mesonElecs%s%s",sourceName[iSource],levelName[iLevel])); | |
1995 | if(IsPbPb())break; | |
1996 | } | |
1997 | } | |
1998 | } | |
1999 | //fContainer->CreateContainer("charmElecs", "Container for weighted charm electrons",2); | |
2000 | } | |
2001 | ||
2002 | fContainer->CreateCorrelationMatrix("correlationstepafterPID","THnSparse with correlations"); | |
2003 | fContainer->CreateCorrelationMatrix("correlationstepafterDE","THnSparse with correlations"); | |
2004 | if(!fVarManager->IsVariableDefined("centrality")) { | |
2005 | //printf("Create the two other correlation maps\n"); | |
2006 | fContainer->CreateCorrelationMatrix("correlationstepbeforePID","THnSparse with correlations"); | |
2007 | fContainer->CreateCorrelationMatrix("correlationstepafterTOF","THnSparse with correlations"); | |
2008 | } | |
2009 | ||
2010 | // Define the step names | |
2011 | for(UInt_t istep = 0; istep < AliHFEcuts::kNcutStepsMCTrack; istep++){ | |
2012 | fContainer->SetStepTitle("MCTrackCont", AliHFEcuts::MCCutName(istep), istep); | |
2013 | } | |
2014 | for(UInt_t istep = 0; istep < AliHFEcuts::kNcutStepsRecTrack; istep++){ | |
2015 | fContainer->SetStepTitle("recTrackContReco", AliHFEcuts::RecoCutName(istep), istep); | |
2016 | fContainer->SetStepTitle("recTrackContMC", AliHFEcuts::RecoCutName(istep), istep); | |
2017 | } | |
2018 | for(UInt_t ipid = 0; ipid < fPID->GetNumberOfPIDdetectors(); ipid++){ | |
2019 | fContainer->SetStepTitle("recTrackContReco", fPID->SortedDetectorName(ipid), AliHFEcuts::kNcutStepsRecTrack + ipid); | |
2020 | fContainer->SetStepTitle("recTrackContMC", fPID->SortedDetectorName(ipid), AliHFEcuts::kNcutStepsRecTrack + ipid); | |
2021 | } | |
2022 | } | |
2023 | //____________________________________________________________ | |
2024 | void AliAnalysisTaskHFE::InitContaminationQA(){ | |
2025 | // | |
2026 | // Add QA for Impact Parameter cut | |
2027 | // | |
2028 | ||
2029 | TObjArray *array = fVarManager->GetVariables(); | |
2030 | Int_t nvars = array->GetEntriesFast(); | |
2031 | for(Int_t v = 0; v < nvars; v++) { | |
2032 | AliHFEvarManager::AliHFEvariable *variable = (AliHFEvarManager::AliHFEvariable *) array->At(v); | |
2033 | if(!variable) continue; | |
2034 | TString name(((AliHFEvarManager::AliHFEvariable *)variable)->GetName()); | |
2035 | if(!name.CompareTo("pt")) { | |
2036 | const Int_t nBinPt = variable->GetNumberOfBins(); | |
2037 | const Double_t *kPtRange = variable->GetBinning(); | |
2038 | ||
2039 | fQACollection->CreateTH1Farray("hadronsBeforeIPcut", "Hadrons before IP cut", nBinPt, kPtRange); | |
2040 | fQACollection->CreateTH1Farray("hadronsAfterIPcut", "Hadrons after IP cut", nBinPt, kPtRange); | |
2041 | ||
2042 | fQACollection->CreateTH2Farray("Ke3Kecorr", "Ke3 decay e and K correlation; Ke3K p_{t}; Ke3e p_{t}; ", nBinPt, kPtRange, 20,0.,20.); | |
2043 | fQACollection->CreateTH2Farray("Ke3K0Lecorr", "Ke3 decay e and K0L correlation; Ke3K0L p_{t}; Ke3e p_{t}; ", nBinPt, kPtRange, 20,0.,20.); | |
2044 | fQACollection->CreateTH1Farray("Kptspectra", "Charged Kaons: MC p_{t} ", nBinPt, kPtRange); | |
2045 | fQACollection->CreateTH1Farray("K0Lptspectra", "K0L: MC p_{t} ", nBinPt, kPtRange); | |
2046 | ||
2047 | const Double_t kDCAbound[2] = {-0.2, 0.2}; | |
2048 | ||
2049 | const Int_t nDimDca=6; | |
2050 | const Int_t nBinDca[nDimDca] = { 8, nBinPt, 800, 12, 6, 2}; | |
2051 | Double_t minimaDca[nDimDca] = { -1., 0., kDCAbound[0], -1., -1, -1.1}; | |
2052 | Double_t maximaDca[nDimDca] = { 7., 20., kDCAbound[1], 11., 5, 1.1}; | |
2053 | ||
2054 | Double_t *sourceBins = AliHFEtools::MakeLinearBinning(nBinDca[0], minimaDca[0], maximaDca[0]); | |
2055 | Double_t *dcaBins = AliHFEtools::MakeLinearBinning(nBinDca[2], minimaDca[2], maximaDca[2]); | |
2056 | Double_t *centralityBins = AliHFEtools::MakeLinearBinning(nBinDca[3], minimaDca[3], maximaDca[3]); | |
2057 | Double_t *v0PIDBins = AliHFEtools::MakeLinearBinning(nBinDca[4], minimaDca[4], maximaDca[4]); | |
2058 | Double_t *chargeBins = AliHFEtools::MakeLinearBinning(nBinDca[5], minimaDca[5], maximaDca[5]); | |
2059 | ||
2060 | fQACollection->CreateTHnSparseNoLimits("Dca", "Dca; source (0-all, 1-charm,etc); pT [GeV/c]; dca; centrality bin; v0pid; charge", nDimDca, nBinDca); | |
2061 | ((THnSparse*)(fQACollection->Get("Dca")))->SetBinEdges(0, sourceBins); | |
2062 | ((THnSparse*)(fQACollection->Get("Dca")))->SetBinEdges(1, kPtRange); | |
2063 | ((THnSparse*)(fQACollection->Get("Dca")))->SetBinEdges(2, dcaBins); | |
2064 | ((THnSparse*)(fQACollection->Get("Dca")))->SetBinEdges(3, centralityBins); | |
2065 | ((THnSparse*)(fQACollection->Get("Dca")))->SetBinEdges(4, v0PIDBins); | |
2066 | ((THnSparse*)(fQACollection->Get("Dca")))->SetBinEdges(5, chargeBins); | |
2067 | ||
2068 | break; | |
2069 | } | |
2070 | } | |
2071 | ||
2072 | } | |
2073 | ||
2074 | //____________________________________________________________ | |
2075 | void AliAnalysisTaskHFE::InitHistoITScluster(){ | |
2076 | // | |
2077 | // Initialize a temporary histogram to monitor the chi2/ITS cluster | |
2078 | if(IsPbPb()) { | |
2079 | const Int_t kNDim = 7; | |
2080 | const Int_t kNBins[kNDim] = {88, 20,90,11, 160, 2, 1000}; | |
2081 | const Double_t kMin[kNDim] = {0.1, -1,0, 0.,0., 0, 0.}; | |
2082 | const Double_t kMax[kNDim] = {20., 1, 2.*TMath::Pi(), 11.,160, 2, 100.}; | |
2083 | fQACollection->CreateTHnSparse("fChi2perITScluster", "chi2/ITS cluster; p_{T} (GeV/c);eta;phi; centrality class;nclus;sharebit; #chi^{2}/ITS cluster", kNDim, kNBins, kMin, kMax); | |
2084 | fQACollection->BinLogAxis("fChi2perITScluster", 0); | |
2085 | } | |
2086 | else | |
2087 | { | |
2088 | const Int_t kNDim = 3; | |
2089 | const Int_t kNBins[kNDim] = {44, 11, 1000}; | |
2090 | const Double_t kMin[kNDim] = {0.1, 0., 0.}; | |
2091 | const Double_t kMax[kNDim] = {20., 11., 100.}; | |
2092 | fQACollection->CreateTHnSparse("fChi2perITScluster", "chi2/ITS cluster; p_{T} (GeV/c); centrality class; #chi^{2}/ITS cluster", kNDim, kNBins, kMin, kMax); | |
2093 | fQACollection->BinLogAxis("fChi2perITScluster", 0); | |
2094 | } | |
2095 | } | |
2096 | ||
2097 | //____________________________________________________________ | |
2098 | void AliAnalysisTaskHFE::SelectSpecialTrigger(const Char_t *trgclust, Int_t runMin, Int_t runMax){ | |
2099 | // | |
2100 | // Select only events triggered by a special trigeer cluster | |
2101 | // | |
2102 | if(!fSpecialTrigger) fSpecialTrigger = new AliOADBContainer("SpecialTrigger"); | |
2103 | fSpecialTrigger->AppendObject(new TObjString(trgclust), runMin, runMax); | |
2104 | } | |
2105 | ||
2106 | //____________________________________________________________ | |
2107 | const Char_t * AliAnalysisTaskHFE::GetSpecialTrigger(Int_t run){ | |
2108 | // | |
2109 | // Derive selected trigger string for given run | |
2110 | // | |
2111 | if(!fSpecialTrigger) return NULL; | |
2112 | TObjString *trg = dynamic_cast<TObjString *>(fSpecialTrigger->GetObject(run)); | |
2113 | if(!trg) return NULL; | |
2114 | return trg->String().Data(); | |
2115 | } | |
2116 | ||
2117 | //____________________________________________________________ | |
2118 | void AliAnalysisTaskHFE::PrintStatus() const { | |
2119 | // | |
2120 | // Print Analysis status | |
2121 | // | |
2122 | printf("\n\tAnalysis Settings\n\t========================================\n\n"); | |
2123 | printf("\tSecondary Vertex finding: %s\n", GetPlugin(kSecVtx) ? "YES" : "NO"); | |
2124 | printf("\tPrimary Vertex resolution: %s\n", GetPlugin(kPriVtx) ? "YES" : "NO"); | |
2125 | printf("\tDisplaced electron analysis step: %s\n", GetPlugin(kDEstep) ? "YES" : "NO"); | |
2126 | printf("\tTagged Track Analysis: %s\n", GetPlugin(kTaggedTrackAnalysis) ? "YES" : "NO"); | |
2127 | printf("\n"); | |
2128 | printf("\tParticle Identification Detectors:\n"); | |
2129 | fPID->PrintStatus(); | |
2130 | printf("\n"); | |
2131 | printf("\tQA: \n"); | |
2132 | printf("\t\tPID: %s\n", IsQAOn(kPIDqa) ? "YES" : "NO"); | |
2133 | printf("\t\tCUTS: %s\n", (fCuts != NULL && fCuts->IsQAOn()) ? "YES" : "NO"); | |
2134 | printf("\t\tMC: %s\n", IsQAOn(kMCqa) ? "YES" : "NO"); | |
2135 | printf("\n"); | |
2136 | } | |
2137 | ||
2138 | //____________________________________________________________ | |
2139 | Bool_t AliAnalysisTaskHFE::FillProductionVertex(const AliVParticle * const track) const{ | |
2140 | // | |
2141 | // Find the production vertex of the associated MC track | |
2142 | // | |
2143 | if(!fMCEvent) return kFALSE; | |
2144 | const AliVParticle *mctrack = NULL; | |
2145 | TString objectType = track->IsA()->GetName(); | |
2146 | if(objectType.CompareTo("AliESDtrack") == 0 || objectType.CompareTo("AliAODTrack") == 0){ | |
2147 | // Reconstructed track | |
2148 | mctrack = fMCEvent->GetTrack(TMath::Abs(track->GetLabel())); | |
2149 | } else { | |
2150 | // MCParticle | |
2151 | mctrack = track; | |
2152 | } | |
2153 | ||
2154 | if(!mctrack) return kFALSE; | |
2155 | ||
2156 | Double_t xv = 0.0; | |
2157 | Double_t yv = 0.0; | |
2158 | ||
2159 | if(TString(mctrack->IsA()->GetName()).CompareTo("AliMCParticle") == 0){ | |
2160 | // case MCParticle | |
2161 | const AliMCParticle *mcpart = dynamic_cast<const AliMCParticle *>(mctrack); | |
2162 | if(mcpart){ | |
2163 | xv = mcpart->Xv(); | |
2164 | yv = mcpart->Yv(); | |
2165 | } | |
2166 | } else { | |
2167 | // case AODMCParticle | |
2168 | const AliAODMCParticle *mcpart = dynamic_cast<const AliAODMCParticle *>(mctrack); | |
2169 | if(mcpart){ | |
2170 | xv = mcpart->Xv(); | |
2171 | yv = mcpart->Yv(); | |
2172 | } | |
2173 | } | |
2174 | ||
2175 | //printf("xv %f, yv %f\n",xv,yv); | |
2176 | fQACollection->Fill("radius", TMath::Abs(xv),TMath::Abs(yv)); | |
2177 | ||
2178 | return kTRUE; | |
2179 | ||
2180 | } | |
2181 | //__________________________________________ | |
2182 | void AliAnalysisTaskHFE::SwitchOnPlugin(Int_t plug){ | |
2183 | // | |
2184 | // Switch on Plugin | |
2185 | // Available: | |
2186 | // - Primary vertex studies | |
2187 | // - Secondary vertex Studies | |
2188 | // - Post Processing | |
2189 | // | |
2190 | switch(plug){ | |
2191 | case kPriVtx: SETBIT(fPlugins, plug); break; | |
2192 | case kSecVtx: SETBIT(fPlugins, plug); break; | |
2193 | case kIsElecBackGround: SETBIT(fPlugins, plug); break; | |
2194 | case kPostProcess: SETBIT(fPlugins, plug); break; | |
2195 | case kDEstep: SETBIT(fPlugins, plug); break; | |
2196 | case kTaggedTrackAnalysis: SETBIT(fPlugins, plug); break; | |
2197 | case kNonPhotonicElectron: SETBIT(fPlugins, plug); break; | |
afb48e1d | 2198 | case kNonPhotonicElectronBeauty: SETBIT(fPlugins, plug); break; |
01745870 | 2199 | default: AliError("Unknown Plugin"); |
2200 | }; | |
2201 | } | |
2202 | //__________________________________________ | |
2203 | Bool_t AliAnalysisTaskHFE::ProcessCutStep(Int_t cutStep, AliVParticle *track){ | |
2204 | // | |
2205 | // Check single track cuts for a given cut step | |
2206 | // Fill the particle container | |
2207 | // | |
2208 | const Int_t kMCOffset = AliHFEcuts::kNcutStepsMCTrack; | |
2209 | if(!fCFM->CheckParticleCuts(cutStep + kMCOffset, track)) return kFALSE; | |
2210 | if(fVarManager->IsSignalTrack()) { | |
2211 | fVarManager->FillContainer(fContainer, "recTrackContReco", cutStep, kFALSE); | |
2212 | fVarManager->FillContainer(fContainer, "recTrackContMC", cutStep, kTRUE); | |
2213 | } | |
2214 | return kTRUE; | |
2215 | } | |
2216 | //___________________________________________________ | |
2217 | Bool_t AliAnalysisTaskHFE::ReadCentrality() { | |
2218 | // | |
2219 | // Recover the centrality of the event from ESD or AOD | |
2220 | // | |
2221 | ||
2222 | Float_t fCentralityLimitstemp[12]; | |
2e4ed823 | 2223 | Float_t fCentralityLimitsdefault[12]= {0.,5.,10., 20., 30., 40., 50., 60.,70.,80., 90., 100.00001}; |
01745870 | 2224 | if(!fPbPbUserCentralityBinning) memcpy(fCentralityLimitstemp,fCentralityLimitsdefault,sizeof(fCentralityLimitsdefault)); |
2225 | else memcpy(fCentralityLimitstemp,fCentralityLimits,sizeof(fCentralityLimitsdefault)); | |
2226 | ||
2227 | ||
2228 | Int_t bin = -1; | |
4437a0d2 | 2229 | if(IsPbPb()||IspPb()) { |
01745870 | 2230 | // Centrality |
2231 | AliCentrality *centrality = fInputEvent->GetCentrality(); | |
2232 | fCentralityPercent = centrality->GetCentralityPercentile(fCentralityEstimator.Data()); | |
2233 | //printf("centrality %f\n",fCentralityPercent); | |
2234 | ||
2235 | for(Int_t ibin = 0; ibin < 11; ibin++){ | |
2236 | if(fCentralityPercent >= fCentralityLimitstemp[ibin] && fCentralityPercent < fCentralityLimitstemp[ibin+1]){ | |
2237 | bin = ibin; | |
2238 | //printf("test bin %f, low %f, high %f, %d\n",fCentralityPercent,fCentralityLimitstemp[ibin],fCentralityLimitstemp[ibin+1],ibin); | |
2239 | break; | |
2240 | } | |
2241 | } | |
2242 | ||
2243 | if(bin == -1) bin = 11; // Overflow | |
2244 | } else { | |
2245 | // PP: Tracklet multiplicity, use common definition | |
2246 | Int_t itsMultiplicity = GetITSMultiplicity(fInputEvent); | |
2247 | Int_t multiplicityLimits[8] = {0, 1, 9, 17, 25, 36, 60, 500}; | |
2248 | for(Int_t ibin = 0; ibin < 7; ibin++){ | |
2249 | if(itsMultiplicity >= multiplicityLimits[ibin] && itsMultiplicity < multiplicityLimits[ibin + 1]){ | |
2250 | bin = ibin; | |
2251 | break; | |
2252 | } | |
2253 | } | |
2254 | if(bin == -1) bin = 7; // Overflow | |
2255 | } | |
2256 | fCentralityF = bin; | |
2257 | AliDebug(2, Form("Centrality class %d\n", fCentralityF)); | |
2258 | ||
2259 | ||
2260 | // contributors, to be outsourced | |
2261 | const AliVVertex *vtx; | |
2262 | if(IsAODanalysis()){ | |
2263 | AliAODEvent *fAOD = dynamic_cast<AliAODEvent *>(fInputEvent); | |
2264 | if(!fAOD){ | |
2265 | AliError("AOD Event required for AOD Analysis"); | |
2266 | return kFALSE; | |
2267 | } | |
2268 | vtx = fAOD->GetPrimaryVertex(); | |
2269 | } else { | |
2270 | AliESDEvent *fESD = dynamic_cast<AliESDEvent *>(fInputEvent); | |
2271 | if(!fESD){ | |
2272 | AliError("ESD Event required for ESD Analysis"); | |
2273 | return kFALSE; | |
2274 | } | |
2275 | vtx = fESD->GetPrimaryVertex() ; | |
2276 | } | |
2277 | if(!vtx){ | |
2278 | fContributors = 0.5; | |
2279 | return kFALSE; | |
2280 | } | |
2281 | else { | |
2282 | Int_t contributorstemp = vtx->GetNContributors(); | |
2283 | if( contributorstemp <= 0) { | |
2284 | fContributors = 0.5; | |
2285 | //printf("Number of contributors %d and vz %f\n",contributorstemp,vtx->GetZ()); | |
2286 | } | |
2287 | else fContributors = 1.5; | |
2288 | //printf("Number of contributors %d\n",contributorstemp); | |
2289 | } | |
2290 | return kTRUE; | |
2291 | } | |
2292 | ||
2293 | //___________________________________________________ | |
2294 | Int_t AliAnalysisTaskHFE::GetITSMultiplicity(AliVEvent *ev){ | |
2295 | // | |
2296 | // Definition of the Multiplicity according to the JPSI group (F. Kramer) | |
2297 | // | |
2298 | Int_t nTracklets = 0; | |
2299 | Int_t nAcc = 0; | |
2300 | Double_t etaRange = 1.6; | |
2301 | ||
2302 | if (ev->IsA() == AliAODEvent::Class()) { | |
2303 | AliAODTracklets *tracklets = ((AliAODEvent*)ev)->GetTracklets(); | |
2304 | nTracklets = tracklets->GetNumberOfTracklets(); | |
2305 | for (Int_t nn = 0; nn < nTracklets; nn++) { | |
2306 | Double_t theta = tracklets->GetTheta(nn); | |
2307 | Double_t eta = -TMath::Log(TMath::Tan(theta/2.0)); | |
2308 | if (TMath::Abs(eta) < etaRange) nAcc++; | |
2309 | } | |
2310 | } else if (ev->IsA() == AliESDEvent::Class()) { | |
2311 | nTracklets = ((AliESDEvent*)ev)->GetMultiplicity()->GetNumberOfTracklets(); | |
2312 | for (Int_t nn = 0; nn < nTracklets; nn++) { | |
2313 | Double_t eta = ((AliESDEvent*)ev)->GetMultiplicity()->GetEta(nn); | |
2314 | if (TMath::Abs(eta) < etaRange) nAcc++; | |
2315 | } | |
2316 | } else return -1; | |
2317 | ||
2318 | return nAcc; | |
2319 | } | |
2320 | ||
2321 | //___________________________________________________ | |
2322 | void AliAnalysisTaskHFE::RejectionPileUpVertexRangeEventCut() { | |
2323 | // | |
2324 | // Recover the centrality of the event from ESD or AOD | |
2325 | // | |
2326 | if(IsAODanalysis()){ | |
2327 | ||
2328 | AliAODEvent *fAOD = dynamic_cast<AliAODEvent *>(fInputEvent); | |
2329 | if(!fAOD){ | |
2330 | AliError("AOD Event required for AOD Analysis"); | |
2331 | return; | |
2332 | } | |
2333 | // PileUp | |
2334 | fIdentifiedAsPileUp = kFALSE; | |
2335 | if(fRemovePileUp && fAOD->IsPileupFromSPD()) fIdentifiedAsPileUp = kTRUE; | |
2336 | // Z vertex | |
2337 | fIdentifiedAsOutInz = kFALSE; | |
2338 | //printf("Z vertex %f and out %f\n",fAOD->GetPrimaryVertex()->GetZ(),fCuts->GetVertexRange()); | |
2339 | if(TMath::Abs(fAOD->GetPrimaryVertex()->GetZ()) > fCuts->GetVertexRange()) fIdentifiedAsOutInz = kTRUE; | |
2340 | // Event Cut | |
2341 | fPassTheEventCut = kTRUE; | |
2342 | if(!fCFM->CheckEventCuts(AliHFEcuts::kEventStepReconstructed, fAOD)) fPassTheEventCut = kFALSE; | |
2343 | ||
2344 | ||
2345 | } else { | |
2346 | ||
2347 | AliDebug(3, "Processing ESD Centrality"); | |
2348 | AliESDEvent *fESD = dynamic_cast<AliESDEvent *>(fInputEvent); | |
2349 | if(!fESD){ | |
2350 | AliError("ESD Event required for ESD Analysis"); | |
2351 | return; | |
2352 | } | |
2353 | // PileUp | |
2354 | fIdentifiedAsPileUp = kFALSE; | |
2355 | if(fRemovePileUp && fESD->IsPileupFromSPD()) fIdentifiedAsPileUp = kTRUE; | |
2356 | ||
2357 | ||
2358 | ||
2359 | // Z vertex | |
2360 | fIdentifiedAsOutInz = kFALSE; | |
2361 | Bool_t findvertex = kTRUE; | |
2362 | const AliESDVertex* vtxESD = fESD->GetPrimaryVertex(); | |
2363 | if((!vtxESD) || (vtxESD->GetNContributors() <= 0)) findvertex = kFALSE; | |
2364 | if(findvertex) { | |
2365 | if(TMath::Abs(vtxESD->GetZ()) > fCuts->GetVertexRange()) fIdentifiedAsOutInz = kTRUE; | |
2366 | } | |
2367 | ||
2368 | //Event Cut | |
2369 | fPassTheEventCut = kTRUE; | |
2370 | if(!fCFM->CheckEventCuts(AliHFEcuts::kEventStepReconstructed, fESD)) fPassTheEventCut = kFALSE; | |
2371 | ||
2372 | } | |
2373 | ||
2374 | } | |
8c07fb0d | 2375 | |
2376 | //___________________________________________________ | |
4437a0d2 | 2377 | Bool_t AliAnalysisTaskHFE::CheckTRDTriggerESD(AliESDEvent *ev) { |
8c07fb0d | 2378 | // |
2379 | // Check TRD trigger; pPb settings | |
2380 | // | |
2381 | Bool_t cint8=kFALSE; | |
2382 | Bool_t cint7=kFALSE; | |
2383 | Bool_t cint5=kFALSE; | |
2e4ed823 | 2384 | Bool_t cint8s=kFALSE; |
2385 | Bool_t cint7s=kFALSE; | |
2386 | Bool_t cint7ppb=kFALSE; | |
8c07fb0d | 2387 | Bool_t trdtrgevent=kFALSE; |
2388 | ||
2e4ed823 | 2389 | // printf("TRIGGERS %s \n",ev->GetFiredTriggerClasses().Data()); |
4437a0d2 | 2390 | |
afb48e1d | 2391 | fTRDTriggerAnalysismb->CalcTriggers(ev); |
2392 | ||
4437a0d2 | 2393 | // mb selection of WU events |
8c07fb0d | 2394 | if(fWhichTRDTrigger==1) |
2395 | { | |
afb48e1d | 2396 | // if(ev->IsTriggerClassFired("CINT7WU-B-NOPF-ALL")) |
2397 | if((ev->IsTriggerClassFired("CINT7WU-B-NOPF-ALL"))||(ev->IsTriggerClassFired("CINT7WU-S-NOPF-ALL"))||(ev->IsTriggerClassFired("CINT8WU-S-NOPF-ALL"))) | |
8c07fb0d | 2398 | { |
2399 | DrawTRDTrigger(ev); | |
afb48e1d | 2400 | DrawTRDTriggerAnalysis(ev); |
8c07fb0d | 2401 | return kTRUE; |
2402 | } | |
4437a0d2 | 2403 | else return kFALSE; |
8c07fb0d | 2404 | } |
618038b6 | 2405 | |
4437a0d2 | 2406 | |
2407 | // HSE no cleanup | |
8c07fb0d | 2408 | if(fWhichTRDTrigger==2) |
2409 | { | |
4437a0d2 | 2410 | cint8= ev->IsTriggerClassFired("CINT8WUHSE-B-NOPF-CENT"); |
2e4ed823 | 2411 | cint7= ev->IsTriggerClassFired("CINT7WUHSE-B-NOPF-CENT"); // pPb rare |
2412 | cint7ppb= ev->IsTriggerClassFired("CINT7WUHSE-B-NOPF-ALL"); // pPb mb | |
2413 | cint8s= ev->IsTriggerClassFired("CINT7WUHSE-S-NOPF-CENT"); | |
2414 | cint7s= ev->IsTriggerClassFired("CINT8WUHSE-S-NOPF-CENT"); | |
4437a0d2 | 2415 | cint5= (ev->IsTriggerClassFired("CINT5WU-B-NOPF-ALL")) && |
2416 | (ev->GetHeader()->GetL1TriggerInputs() & (1 << 10)); | |
2e4ed823 | 2417 | // printf("hse trigger %i %i %i %i %i \n",cint7,cint7ppb,cint8,cint7s,cint8s); |
2418 | if((cint7==kFALSE)&&(cint7ppb==kFALSE)&&(cint8==kFALSE)&&(cint7s==kFALSE)&&(cint8s==kFALSE)&&(cint5==kFALSE)) return kFALSE; | |
8c07fb0d | 2419 | else |
2420 | { | |
2421 | DrawTRDTrigger(ev); | |
afb48e1d | 2422 | DrawTRDTriggerAnalysis(ev); |
8c07fb0d | 2423 | return kTRUE; |
2424 | } | |
2425 | } | |
2426 | ||
4437a0d2 | 2427 | |
2428 | ||
618038b6 | 2429 | //HQU no cleanup |
8c07fb0d | 2430 | if(fWhichTRDTrigger==3) |
2431 | { | |
8c07fb0d | 2432 | cint8= ev->IsTriggerClassFired("CINT8WUHQU-B-NOPF-CENT"); |
2e4ed823 | 2433 | cint7= ev->IsTriggerClassFired("CINT7WUHQU-B-NOPF-CENT"); // pPb rare |
2434 | cint7ppb= ev->IsTriggerClassFired("CINT7WUHQU-B-NOPF-ALL"); // pPb mb | |
2435 | cint8s= ev->IsTriggerClassFired("CINT7WUHQU-S-NOPF-CENT"); | |
2436 | cint7s= ev->IsTriggerClassFired("CINT8WUHQU-S-NOPF-CENT"); | |
8c07fb0d | 2437 | cint5= (ev->IsTriggerClassFired("CINT5WU-B-NOPF-ALL")) && |
2438 | (ev->GetHeader()->GetL1TriggerInputs() & (1 << 12)); | |
2e4ed823 | 2439 | // printf("hqu trigger %i %i %i %i %i \n",cint7,cint7ppb,cint8,cint7s,cint8s); |
2440 | if((cint7==kFALSE)&&(cint7ppb==kFALSE)&&(cint8==kFALSE)&&(cint7s==kFALSE)&&(cint8s==kFALSE)&&(cint5==kFALSE)) return kFALSE; | |
8c07fb0d | 2441 | else |
2442 | { | |
2443 | DrawTRDTrigger(ev); | |
afb48e1d | 2444 | DrawTRDTriggerAnalysis(ev); |
8c07fb0d | 2445 | return kTRUE; |
2446 | } | |
8c07fb0d | 2447 | } |
618038b6 | 2448 | |
2e4ed823 | 2449 | if(fWhichTRDTrigger==4) |
2450 | { | |
2451 | // printf("trigger %i %i \n", ev->GetHeader()->IsTriggerInputFired("1HSE"),(ev->GetHeader()->GetL1TriggerInputs() & (1 << 10))); // bug in IsTriggerInputFired; reported in savannah | |
2452 | ||
afb48e1d | 2453 | // if(ev->IsTriggerClassFired("CINT7WU-B-NOPF-ALL")) |
2454 | // { | |
2455 | // Int_t trginput=0; | |
2456 | // trginput=ev->GetHeader()->GetL1TriggerInputs() & (1 << 10); // HSE | |
2457 | // if(trginput==1024) | |
2458 | // if(fTRDTriggerAnalysismb->CheckCondition(AliTRDTriggerAnalysis::kHSE)) | |
2459 | // if(fTRDTriggerAnalysismb->HasFired(AliTRDTriggerAnalysis::kHSE)) | |
2460 | if(fTRDTriggerAnalysismb->HasTriggered(AliTRDTriggerAnalysis::kHSE)) | |
2e4ed823 | 2461 | { |
2462 | DrawTRDTrigger(ev); | |
afb48e1d | 2463 | DrawTRDTriggerAnalysis(ev); |
2e4ed823 | 2464 | return kTRUE; |
2465 | } else return kFALSE; | |
afb48e1d | 2466 | }// else return kFALSE; |
2467 | // } | |
2e4ed823 | 2468 | if(fWhichTRDTrigger==5) |
2469 | { | |
2470 | // printf("trigger %i %i \n", ev->GetHeader()->IsTriggerInputFired("1HQU"),(ev->GetHeader()->GetL1TriggerInputs() & (1 << 12))); // bug in IsTriggerInputFired; reported in savannah | |
afb48e1d | 2471 | // if(ev->IsTriggerClassFired("CINT7WU-B-NOPF-ALL")) |
2472 | // { | |
2e4ed823 | 2473 | |
afb48e1d | 2474 | // Int_t trginput=0; |
2475 | // trginput=ev->GetHeader()->GetL1TriggerInputs() & (1 << 12); //HQU | |
2e4ed823 | 2476 | // printf("triggerinput %i \n",trginput); |
afb48e1d | 2477 | // if(trginput==4096) |
2478 | // if(fTRDTriggerAnalysismb->CheckCondition(AliTRDTriggerAnalysis::kHQU)) | |
2479 | // if(fTRDTriggerAnalysismb->HasFired(AliTRDTriggerAnalysis::kHQU)) | |
2480 | if(fTRDTriggerAnalysismb->HasTriggered(AliTRDTriggerAnalysis::kHQU)) | |
2e4ed823 | 2481 | { |
2482 | DrawTRDTrigger(ev); | |
afb48e1d | 2483 | DrawTRDTriggerAnalysis(ev); |
2e4ed823 | 2484 | return kTRUE; |
2485 | } else return kFALSE; | |
afb48e1d | 2486 | } //else return kFALSE; |
2487 | // } | |
4437a0d2 | 2488 | |
2489 | ||
2490 | return trdtrgevent; | |
2491 | ||
2492 | } | |
2493 | ||
2494 | ||
2495 | //___________________________________________________ | |
2496 | Bool_t AliAnalysisTaskHFE::CheckTRDTrigger(AliVEvent *ev) { | |
2497 | // | |
2498 | // Check TRD trigger; pPb settings | |
2499 | // | |
2500 | ||
afb48e1d | 2501 | fTRDTriggerAnalysistrg->CalcTriggers(ev); |
4437a0d2 | 2502 | |
2503 | // HSE cleanup | |
2504 | if(fWhichTRDTrigger==6) | |
2505 | { | |
afb48e1d | 2506 | if(!fTRDTriggerAnalysistrg->HasTriggeredConfirmed(AliTRDTriggerAnalysis::kHSE)) |
4437a0d2 | 2507 | { |
2508 | return kFALSE; | |
2509 | } | |
2510 | else | |
2511 | { | |
afb48e1d | 2512 | // DrawTRDTrigger(ev); |
2513 | DrawTRDTriggerAnalysis(ev); | |
4437a0d2 | 2514 | return kTRUE; |
2515 | } | |
2516 | } | |
2517 | ||
2518 | ||
2519 | ||
618038b6 | 2520 | // HQU cleanup |
4437a0d2 | 2521 | if(fWhichTRDTrigger==7) |
8c07fb0d | 2522 | { |
618038b6 | 2523 | |
afb48e1d | 2524 | if(!fTRDTriggerAnalysistrg->HasTriggeredConfirmed(AliTRDTriggerAnalysis::kHQU)) |
618038b6 | 2525 | { |
2526 | return kFALSE; | |
2527 | } | |
8c07fb0d | 2528 | else |
2529 | { | |
afb48e1d | 2530 | // DrawTRDTrigger(ev); |
2531 | DrawTRDTriggerAnalysis(ev); | |
8c07fb0d | 2532 | return kTRUE; |
2533 | } | |
2534 | } | |
4437a0d2 | 2535 | |
2536 | // HSE or HQU cleanup | |
2537 | if(fWhichTRDTrigger==8) | |
2538 | { | |
afb48e1d | 2539 | if((fTRDTriggerAnalysistrg->HasTriggeredConfirmed(AliTRDTriggerAnalysis::kHSE))||(fTRDTriggerAnalysistrg->HasTriggeredConfirmed(AliTRDTriggerAnalysis::kHQU))) |
4437a0d2 | 2540 | { |
afb48e1d | 2541 | // DrawTRDTrigger(ev); |
2542 | DrawTRDTriggerAnalysis(ev); | |
4437a0d2 | 2543 | return kTRUE; |
2544 | } | |
2545 | else | |
2546 | { | |
2547 | return kFALSE; | |
2548 | } | |
2549 | } | |
2550 | ||
2551 | return kFALSE; | |
8c07fb0d | 2552 | |
2553 | } | |
2554 | ||
2e4ed823 | 2555 | //___________________________________________________ |
8c07fb0d | 2556 | void AliAnalysisTaskHFE::DrawTRDTrigger(AliESDEvent *ev) { |
2557 | ||
2558 | Int_t ntriggerbit=0; | |
2559 | fQACollection->Fill("nTriggerBit",ntriggerbit); | |
2560 | if(ev->IsTriggerClassFired("CINT7-B-NOPF-ALLNOTRD")) | |
2561 | { | |
2562 | ntriggerbit=2; | |
2563 | fQACollection->Fill("nTriggerBit",ntriggerbit); | |
2564 | } | |
2565 | if(ev->IsTriggerClassFired("CINT7WU-B-NOPF-ALL")) | |
2566 | { | |
2567 | ntriggerbit=3; | |
2568 | fQACollection->Fill("nTriggerBit",ntriggerbit); | |
2569 | if(ev->IsTriggerClassFired("CINT7WUHSE-B-NOPF-CENT")) { | |
2570 | ntriggerbit=18; | |
2571 | fQACollection->Fill("nTriggerBit",ntriggerbit); | |
2572 | } | |
2573 | if(ev->IsTriggerClassFired("CINT7WUHQU-B-NOPF-CENT")) { | |
2574 | ntriggerbit=19; | |
2575 | fQACollection->Fill("nTriggerBit",ntriggerbit); | |
2576 | } | |
2577 | } | |
2578 | if(ev->IsTriggerClassFired("CINT7WUHJT-B-NOPF-CENT")) | |
2579 | { | |
2580 | ntriggerbit=4; | |
2581 | fQACollection->Fill("nTriggerBit",ntriggerbit); | |
2582 | ||
2583 | if(ev->IsTriggerClassFired("CINT7WUHSE-B-NOPF-CENT")) { | |
2584 | ntriggerbit=13; | |
2585 | fQACollection->Fill("nTriggerBit",ntriggerbit); | |
2586 | } | |
2587 | if(ev->IsTriggerClassFired("CINT7WUHQU-B-NOPF-CENT")) { | |
2588 | ntriggerbit=14; | |
2589 | fQACollection->Fill("nTriggerBit",ntriggerbit); | |
2590 | if(ev->IsTriggerClassFired("CINT7WUHSE-B-NOPF-CENT")) { | |
2591 | ntriggerbit=17; | |
2592 | fQACollection->Fill("nTriggerBit",ntriggerbit); | |
2593 | } | |
2594 | } | |
2595 | } | |
2596 | if(ev->IsTriggerClassFired("CINT7WUHQU-B-NOPF-CENT")) | |
2597 | { | |
2598 | ntriggerbit=5; | |
2599 | fQACollection->Fill("nTriggerBit",ntriggerbit); | |
2600 | if(ev->IsTriggerClassFired("CINT7WUHSE-B-NOPF-CENT")) { | |
2601 | ntriggerbit=11; | |
2602 | fQACollection->Fill("nTriggerBit",ntriggerbit); | |
2603 | } | |
2604 | if((!(ev->IsTriggerClassFired("CINT7WUHSE-B-NOPF-CENT")))&&(!(ev->IsTriggerClassFired("CINT7WUHJT-B-NOPF-CENT")))) { | |
2605 | ntriggerbit=21; | |
2606 | fQACollection->Fill("nTriggerBit",ntriggerbit); | |
2607 | ||
2608 | /* | |
2609 | Int_t nTrdTracks = ev->GetNumberOfTrdTracks(); | |
2610 | for (Int_t iTrack = 0; iTrack < nTrdTracks; ++iTrack) { | |
2611 | AliESDTrdTrack* trdTrack = ev->GetTrdTrack(iTrack); | |
2612 | printf("GTU track %3i: pt = %5.1f, PID = %3i\n", iTrack, trdTrack->Pt(), trdTrack->GetPID()); | |
2613 | }*/ | |
2614 | ||
2615 | ||
2616 | } | |
2617 | ||
2618 | } | |
2619 | if(ev->IsTriggerClassFired("CINT7WUHSE-B-NOPF-CENT")) | |
2620 | { | |
2621 | ntriggerbit=6; | |
2622 | fQACollection->Fill("nTriggerBit",ntriggerbit); | |
2623 | if(ev->IsTriggerClassFired("CINT7WUHQU-B-NOPF-CENT")) { | |
2624 | ntriggerbit=12; | |
2625 | fQACollection->Fill("nTriggerBit",ntriggerbit); | |
2626 | } | |
2627 | if(ev->IsTriggerClassFired("CINT7WUHSE-B-NOPF-FAST")){ | |
2628 | ntriggerbit=15; | |
2629 | fQACollection->Fill("nTriggerBit",ntriggerbit); | |
2630 | ||
2631 | if((!(ev->IsTriggerClassFired("CINT7WUHQU-B-NOPF-CENT")))&&(!(ev->IsTriggerClassFired("CINT7WUHJT-B-NOPF-CENT")))) { | |
2632 | ntriggerbit=20; | |
2633 | fQACollection->Fill("nTriggerBit",ntriggerbit); | |
2634 | /* | |
2635 | Int_t nTrdTracks = ev->GetNumberOfTrdTracks(); | |
2636 | for (Int_t iTrack = 0; iTrack < nTrdTracks; ++iTrack) { | |
2637 | AliESDTrdTrack* trdTrack = ev->GetTrdTrack(iTrack); | |
2638 | printf("HSE GTU track %3i: pt = %5.1f, PID = %3i\n", iTrack, trdTrack->Pt(), trdTrack->GetPID()); | |
2639 | } */ | |
2640 | ||
2641 | } | |
2642 | ||
2643 | } | |
2644 | ||
2645 | } | |
2646 | if(ev->IsTriggerClassFired("CEMC7WUHEE-B-NOPF-CENT")) { | |
2647 | ntriggerbit=7; | |
2648 | fQACollection->Fill("nTriggerBit",ntriggerbit); | |
2649 | } | |
2650 | if(ev->IsTriggerClassFired("CINT7WUHJT-B-NOPF-FAST")){ | |
2651 | ntriggerbit=8; | |
2652 | fQACollection->Fill("nTriggerBit",ntriggerbit); | |
2653 | } | |
2654 | if(ev->IsTriggerClassFired("CINT7WUHQU-B-NOPF-FAST")){ | |
2655 | ntriggerbit=9; | |
2656 | fQACollection->Fill("nTriggerBit",ntriggerbit); | |
2657 | } | |
2658 | if(ev->IsTriggerClassFired("CINT7WUHSE-B-NOPF-FAST")){ | |
2659 | ntriggerbit=10; | |
2660 | fQACollection->Fill("nTriggerBit",ntriggerbit); | |
2661 | if(ev->IsTriggerClassFired("CINT7WUHSE-B-NOPF-CENT")) { | |
2662 | ntriggerbit=16; | |
2663 | fQACollection->Fill("nTriggerBit",ntriggerbit); | |
2664 | } | |
2665 | } | |
2666 | if(ntriggerbit==0) fQACollection->Fill("nTriggerBit",1); | |
2667 | ||
01745870 | 2668 | } |
2e4ed823 | 2669 | |
afb48e1d | 2670 | |
2671 | //___________________________________________________ | |
2672 | void AliAnalysisTaskHFE::DrawTRDTriggerAnalysis(AliVEvent *ev) { | |
2673 | ||
2674 | fTRDTriggerAnalysistrg->CalcTriggers(ev); | |
2675 | for(Int_t itrg=0;itrg<AliTRDTriggerAnalysis::kHlast;itrg++) | |
2676 | { | |
2677 | Int_t trdtrgstatus=0; | |
2678 | if(fTRDTriggerAnalysistrg->CheckCondition((AliTRDTriggerAnalysis::TRDTrigger_t) itrg))trdtrgstatus=1; | |
2679 | if(fTRDTriggerAnalysistrg->HasFired((AliTRDTriggerAnalysis::TRDTrigger_t) itrg))trdtrgstatus=2; | |
2680 | if(fTRDTriggerAnalysistrg->HasTriggered((AliTRDTriggerAnalysis::TRDTrigger_t) itrg))trdtrgstatus=3; | |
2681 | if(fTRDTriggerAnalysistrg->HasTriggeredConfirmed((AliTRDTriggerAnalysis::TRDTrigger_t) itrg))trdtrgstatus=4; | |
2682 | fQACollection->Fill("TriggerAnalysis",(Float_t)itrg,(Float_t)trdtrgstatus); | |
2683 | } | |
2684 | } | |
2685 | ||
2e4ed823 | 2686 | //___________________________________________________ |
2687 | Bool_t AliAnalysisTaskHFE::IsMCFakeTrack(const AliVTrack *const trk) const { | |
2688 | // | |
2689 | // Check whether track is MC Fake track using the sign of the track label | |
2690 | // | |
2691 | return trk->GetLabel() < 0; | |
2692 | } |