]>
Commit | Line | Data |
---|---|---|
809a4336 | 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 | **************************************************************************/ | |
50685501 | 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 | // | |
809a4336 | 27 | #include <TAxis.h> |
8c1c76e9 | 28 | #include <TBits.h> |
809a4336 | 29 | #include <TCanvas.h> |
30 | #include <TChain.h> | |
259c3296 | 31 | #include <TDirectory.h> |
6ad05e72 | 32 | #include <TFile.h> |
faee3b18 | 33 | #include <TH3D.h> |
809a4336 | 34 | #include <TIterator.h> |
35 | #include <TList.h> | |
36 | #include <TLegend.h> | |
37 | #include <TMath.h> | |
38 | #include <TObjArray.h> | |
8c1c76e9 | 39 | #include <TObjString.h> |
809a4336 | 40 | #include <TParticle.h> |
41 | #include <TProfile.h> | |
8c1c76e9 | 42 | #include <TString.h> |
faee3b18 | 43 | #include <TF1.h> |
809a4336 | 44 | #include <TTree.h> |
45 | ||
8c1c76e9 | 46 | #include "AliAnalysisManager.h" |
9bcfd1ab | 47 | #include "AliAODInputHandler.h" |
48 | #include "AliAODMCParticle.h" | |
49 | #include "AliAODTrack.h" | |
c2690925 | 50 | #include "AliAODVertex.h" |
8c1c76e9 | 51 | #include "AliCentrality.h" |
809a4336 | 52 | #include "AliCFContainer.h" |
53 | #include "AliCFManager.h" | |
54 | #include "AliESDEvent.h" | |
55 | #include "AliESDInputHandler.h" | |
56 | #include "AliESDtrack.h" | |
809a4336 | 57 | #include "AliLog.h" |
809a4336 | 58 | #include "AliMCEvent.h" |
59 | #include "AliMCEventHandler.h" | |
60 | #include "AliMCParticle.h" | |
e156c3bb | 61 | #include "AliMultiplicity.h" |
809a4336 | 62 | #include "AliPID.h" |
8c1c76e9 | 63 | #include "AliPIDResponse.h" |
64 | #include "AliOADBContainer.h" | |
259c3296 | 65 | #include "AliStack.h" |
69ac0e6f | 66 | #include "AliTriggerAnalysis.h" |
70da6c5a | 67 | #include "AliVVertex.h" |
809a4336 | 68 | |
9bcfd1ab | 69 | #include "AliHFEcollection.h" |
3a72645a | 70 | #include "AliHFEcontainer.h" |
809a4336 | 71 | #include "AliHFEcuts.h" |
3a72645a | 72 | #include "AliHFEelecbackground.h" |
259c3296 | 73 | #include "AliHFEmcQA.h" |
9bcfd1ab | 74 | #include "AliHFEpairs.h" |
3a72645a | 75 | #include "AliHFEpid.h" |
76 | #include "AliHFEpidQAmanager.h" | |
d2af20c5 | 77 | #include "AliHFEpostAnalysis.h" |
9bcfd1ab | 78 | #include "AliHFEsecVtxs.h" |
259c3296 | 79 | #include "AliHFEsecVtx.h" |
3a72645a | 80 | #include "AliHFEsignalCuts.h" |
81 | #include "AliHFEtaggedTrackAnalysis.h" | |
70da6c5a | 82 | #include "AliHFEtools.h" |
3a72645a | 83 | #include "AliHFEvarManager.h" |
809a4336 | 84 | #include "AliAnalysisTaskHFE.h" |
85 | ||
faee3b18 | 86 | ClassImp(AliAnalysisTaskHFE) |
87 | ||
809a4336 | 88 | //____________________________________________________________ |
89 | AliAnalysisTaskHFE::AliAnalysisTaskHFE(): | |
d2af20c5 | 90 | AliAnalysisTaskSE("PID efficiency Analysis") |
75d81601 | 91 | , fQAlevel(0) |
9bcfd1ab | 92 | , fPlugins(0) |
3a72645a | 93 | , fFillSignalOnly(kTRUE) |
e156c3bb | 94 | , fFillNoCuts(kFALSE) |
11ff28c5 | 95 | , fUseFlagAOD(kTRUE) |
96 | , fApplyCutAOD(kFALSE) | |
97 | , fFlags(1<<4) | |
c2690925 | 98 | , fBackGroundFactorApply(kFALSE) |
3a72645a | 99 | , fRemovePileUp(kFALSE) |
100 | , fIdentifiedAsPileUp(kFALSE) | |
101 | , fIdentifiedAsOutInz(kFALSE) | |
102 | , fPassTheEventCut(kFALSE) | |
fd6b8522 | 103 | , fRejectKinkMother(kTRUE) |
8c1c76e9 | 104 | , fisppMultiBin(kFALSE) |
11ff28c5 | 105 | , fPbPbUserCentralityBinning(kFALSE) |
8c1c76e9 | 106 | , fisNonHFEsystematics(kFALSE) |
107 | , fSpecialTrigger(NULL) | |
e156c3bb | 108 | , fCentralityF(-1) |
11ff28c5 | 109 | , fCentralityPercent(-1) |
c2690925 | 110 | , fContributors(0.5) |
111 | , fWeightBackGround(0.) | |
112 | , fVz(0.0) | |
8c1c76e9 | 113 | , fHadronBackgroundOADB(NULL) |
3a72645a | 114 | , fContainer(NULL) |
115 | , fVarManager(NULL) | |
116 | , fSignalCuts(NULL) | |
9bcfd1ab | 117 | , fCFM(NULL) |
69ac0e6f | 118 | , fTriggerAnalysis(NULL) |
9bcfd1ab | 119 | , fPID(NULL) |
3a72645a | 120 | , fPIDqa(NULL) |
e3fc062d | 121 | , fPIDpreselect(NULL) |
9bcfd1ab | 122 | , fCuts(NULL) |
3a72645a | 123 | , fTaggedTrackCuts(NULL) |
6555e2ad | 124 | , fCleanTaggedTrack(kFALSE) |
e3ae862b | 125 | , fVariablesTRDTaggedTrack(kFALSE) |
e3fc062d | 126 | , fCutspreselect(NULL) |
9bcfd1ab | 127 | , fSecVtx(NULL) |
128 | , fElecBackGround(NULL) | |
129 | , fMCQA(NULL) | |
3a72645a | 130 | , fTaggedTrackAnalysis(NULL) |
8c1c76e9 | 131 | , fExtraCuts(NULL) |
9bcfd1ab | 132 | , fQA(NULL) |
133 | , fOutput(NULL) | |
134 | , fHistMCQA(NULL) | |
135 | , fHistSECVTX(NULL) | |
136 | , fHistELECBACKGROUND(NULL) | |
69ac0e6f | 137 | , fQACollection(NULL) |
0792aa82 | 138 | { |
139 | // | |
50685501 | 140 | // Dummy constructor |
0792aa82 | 141 | // |
8c1c76e9 | 142 | memset(fElecBackgroundFactor, 0, sizeof(Double_t) * kElecBgSpecies * kBgPtBins * kCentBins * kBgLevels); |
143 | memset(fkBackGroundFactorArray, 0, sizeof(TF1 *) * 12); | |
144 | memset(fBinLimit, 0, sizeof(Double_t) * (kBgPtBins+1)); | |
145 | memset(&fisppMultiBin, kFALSE, sizeof(fisppMultiBin)); | |
4d82fe01 | 146 | memset(fCentralityLimits, 0, sizeof(Float_t) * 12); |
11ff28c5 | 147 | |
148 | ||
0792aa82 | 149 | } |
150 | ||
151 | //____________________________________________________________ | |
152 | AliAnalysisTaskHFE::AliAnalysisTaskHFE(const char * name): | |
d2af20c5 | 153 | AliAnalysisTaskSE(name) |
0792aa82 | 154 | , fQAlevel(0) |
9bcfd1ab | 155 | , fPlugins(0) |
3a72645a | 156 | , fFillSignalOnly(kTRUE) |
e156c3bb | 157 | , fFillNoCuts(kFALSE) |
11ff28c5 | 158 | , fUseFlagAOD(kTRUE) |
159 | , fApplyCutAOD(kFALSE) | |
160 | , fFlags(1<<4) | |
c2690925 | 161 | , fBackGroundFactorApply(kFALSE) |
3a72645a | 162 | , fRemovePileUp(kFALSE) |
163 | , fIdentifiedAsPileUp(kFALSE) | |
164 | , fIdentifiedAsOutInz(kFALSE) | |
165 | , fPassTheEventCut(kFALSE) | |
fd6b8522 | 166 | , fRejectKinkMother(kTRUE) |
8c1c76e9 | 167 | , fisppMultiBin(kFALSE) |
11ff28c5 | 168 | , fPbPbUserCentralityBinning(kFALSE) |
8c1c76e9 | 169 | , fisNonHFEsystematics(kFALSE) |
170 | , fSpecialTrigger(NULL) | |
e156c3bb | 171 | , fCentralityF(-1) |
11ff28c5 | 172 | , fCentralityPercent(-1) |
c2690925 | 173 | , fContributors(0.5) |
174 | , fWeightBackGround(0.) | |
175 | , fVz(0.0) | |
8c1c76e9 | 176 | , fHadronBackgroundOADB(NULL) |
3a72645a | 177 | , fContainer(NULL) |
178 | , fVarManager(NULL) | |
179 | , fSignalCuts(NULL) | |
9bcfd1ab | 180 | , fCFM(NULL) |
69ac0e6f | 181 | , fTriggerAnalysis(NULL) |
9bcfd1ab | 182 | , fPID(NULL) |
3a72645a | 183 | , fPIDqa(NULL) |
e3fc062d | 184 | , fPIDpreselect(NULL) |
9bcfd1ab | 185 | , fCuts(NULL) |
3a72645a | 186 | , fTaggedTrackCuts(NULL) |
6555e2ad | 187 | , fCleanTaggedTrack(kFALSE) |
e3ae862b | 188 | , fVariablesTRDTaggedTrack(kFALSE) |
e3fc062d | 189 | , fCutspreselect(NULL) |
9bcfd1ab | 190 | , fSecVtx(NULL) |
191 | , fElecBackGround(NULL) | |
192 | , fMCQA(NULL) | |
3a72645a | 193 | , fTaggedTrackAnalysis(NULL) |
8c1c76e9 | 194 | , fExtraCuts(NULL) |
9bcfd1ab | 195 | , fQA(NULL) |
196 | , fOutput(NULL) | |
197 | , fHistMCQA(NULL) | |
198 | , fHistSECVTX(NULL) | |
199 | , fHistELECBACKGROUND(NULL) | |
69ac0e6f | 200 | , fQACollection(0x0) |
809a4336 | 201 | { |
dbe3abbe | 202 | // |
203 | // Default constructor | |
9bcfd1ab | 204 | // |
3a72645a | 205 | DefineOutput(1, TList::Class()); |
259c3296 | 206 | DefineOutput(2, TList::Class()); |
809a4336 | 207 | |
3a72645a | 208 | fPID = new AliHFEpid("hfePid"); |
bf892a6a | 209 | fPIDqa = new AliHFEpidQAmanager; |
3a72645a | 210 | fVarManager = new AliHFEvarManager("hfeVarManager"); |
fd6b8522 | 211 | |
8c1c76e9 | 212 | memset(fElecBackgroundFactor, 0, sizeof(Double_t) * kElecBgSpecies * kBgPtBins * kCentBins * kBgLevels); |
213 | memset(fkBackGroundFactorArray, 0, sizeof(TF1 *) * 12); | |
fd6b8522 | 214 | memset(fBinLimit, 0, sizeof(Double_t) * (kBgPtBins+1)); |
8c1c76e9 | 215 | memset(&fisppMultiBin, kFALSE, sizeof(fisppMultiBin)); |
4d82fe01 | 216 | memset(fCentralityLimits, 0, sizeof(Float_t) * 12); |
11ff28c5 | 217 | |
809a4336 | 218 | } |
219 | ||
dbe3abbe | 220 | //____________________________________________________________ |
221 | AliAnalysisTaskHFE::AliAnalysisTaskHFE(const AliAnalysisTaskHFE &ref): | |
d2af20c5 | 222 | AliAnalysisTaskSE(ref) |
faee3b18 | 223 | , fQAlevel(0) |
faee3b18 | 224 | , fPlugins(0) |
3a72645a | 225 | , fFillSignalOnly(ref.fFillSignalOnly) |
e156c3bb | 226 | , fFillNoCuts(ref.fFillNoCuts) |
11ff28c5 | 227 | , fUseFlagAOD(ref.fUseFlagAOD) |
228 | , fApplyCutAOD(ref.fApplyCutAOD) | |
229 | , fFlags(ref.fFlags) | |
c2690925 | 230 | , fBackGroundFactorApply(ref.fBackGroundFactorApply) |
3a72645a | 231 | , fRemovePileUp(ref.fRemovePileUp) |
232 | , fIdentifiedAsPileUp(ref.fIdentifiedAsPileUp) | |
233 | , fIdentifiedAsOutInz(ref.fIdentifiedAsOutInz) | |
234 | , fPassTheEventCut(ref.fPassTheEventCut) | |
fd6b8522 | 235 | , fRejectKinkMother(ref.fRejectKinkMother) |
8c1c76e9 | 236 | , fisppMultiBin(ref.fisppMultiBin) |
11ff28c5 | 237 | , fPbPbUserCentralityBinning(ref.fPbPbUserCentralityBinning) |
8c1c76e9 | 238 | , fisNonHFEsystematics(ref.fisNonHFEsystematics) |
c2690925 | 239 | , fSpecialTrigger(ref.fSpecialTrigger) |
3a72645a | 240 | , fCentralityF(ref.fCentralityF) |
11ff28c5 | 241 | , fCentralityPercent(ref.fCentralityPercent) |
c2690925 | 242 | , fContributors(ref.fContributors) |
243 | , fWeightBackGround(ref.fWeightBackGround) | |
244 | , fVz(ref.fVz) | |
8c1c76e9 | 245 | , fHadronBackgroundOADB(ref.fHadronBackgroundOADB) |
3a72645a | 246 | , fContainer(NULL) |
247 | , fVarManager(NULL) | |
248 | , fSignalCuts(NULL) | |
faee3b18 | 249 | , fCFM(NULL) |
69ac0e6f | 250 | , fTriggerAnalysis(NULL) |
faee3b18 | 251 | , fPID(NULL) |
3a72645a | 252 | , fPIDqa(NULL) |
e3fc062d | 253 | , fPIDpreselect(NULL) |
faee3b18 | 254 | , fCuts(NULL) |
3a72645a | 255 | , fTaggedTrackCuts(NULL) |
6555e2ad | 256 | , fCleanTaggedTrack(ref.fCleanTaggedTrack) |
e3ae862b | 257 | , fVariablesTRDTaggedTrack(ref.fVariablesTRDTaggedTrack) |
e3fc062d | 258 | , fCutspreselect(NULL) |
faee3b18 | 259 | , fSecVtx(NULL) |
260 | , fElecBackGround(NULL) | |
261 | , fMCQA(NULL) | |
3a72645a | 262 | , fTaggedTrackAnalysis(NULL) |
8c1c76e9 | 263 | , fExtraCuts(NULL) |
faee3b18 | 264 | , fQA(NULL) |
265 | , fOutput(NULL) | |
266 | , fHistMCQA(NULL) | |
267 | , fHistSECVTX(NULL) | |
268 | , fHistELECBACKGROUND(NULL) | |
69ac0e6f | 269 | , fQACollection(NULL) |
dbe3abbe | 270 | { |
271 | // | |
272 | // Copy Constructor | |
273 | // | |
faee3b18 | 274 | ref.Copy(*this); |
dbe3abbe | 275 | } |
276 | ||
277 | //____________________________________________________________ | |
278 | AliAnalysisTaskHFE &AliAnalysisTaskHFE::operator=(const AliAnalysisTaskHFE &ref){ | |
279 | // | |
280 | // Assignment operator | |
281 | // | |
faee3b18 | 282 | if(this == &ref) |
283 | ref.Copy(*this); | |
dbe3abbe | 284 | return *this; |
285 | } | |
286 | ||
faee3b18 | 287 | //____________________________________________________________ |
288 | void AliAnalysisTaskHFE::Copy(TObject &o) const { | |
289 | // | |
290 | // Copy into object o | |
291 | // | |
292 | AliAnalysisTaskHFE &target = dynamic_cast<AliAnalysisTaskHFE &>(o); | |
293 | target.fQAlevel = fQAlevel; | |
faee3b18 | 294 | target.fPlugins = fPlugins; |
3a72645a | 295 | target.fFillSignalOnly = fFillSignalOnly; |
e156c3bb | 296 | target.fFillNoCuts = fFillNoCuts; |
11ff28c5 | 297 | target.fUseFlagAOD = fUseFlagAOD; |
298 | target.fApplyCutAOD = fApplyCutAOD; | |
299 | target.fFlags = fFlags; | |
c2690925 | 300 | target.fBackGroundFactorApply = fBackGroundFactorApply; |
3a72645a | 301 | target.fRemovePileUp = fRemovePileUp; |
302 | target.fIdentifiedAsPileUp = fIdentifiedAsPileUp; | |
303 | target.fIdentifiedAsOutInz = fIdentifiedAsOutInz; | |
304 | target.fPassTheEventCut = fPassTheEventCut; | |
fd6b8522 | 305 | target.fRejectKinkMother = fRejectKinkMother; |
8c1c76e9 | 306 | target.fisppMultiBin = fisppMultiBin; |
11ff28c5 | 307 | target.fPbPbUserCentralityBinning = fPbPbUserCentralityBinning; |
8c1c76e9 | 308 | target.fisNonHFEsystematics = fisNonHFEsystematics; |
c2690925 | 309 | target.fSpecialTrigger = fSpecialTrigger; |
3a72645a | 310 | target.fCentralityF = fCentralityF; |
11ff28c5 | 311 | target.fCentralityPercent = fCentralityPercent; |
c2690925 | 312 | target.fContributors = fContributors; |
313 | target.fWeightBackGround = fWeightBackGround; | |
314 | target.fVz = fVz; | |
8c1c76e9 | 315 | target.fHadronBackgroundOADB = fHadronBackgroundOADB; |
3a72645a | 316 | target.fContainer = fContainer; |
317 | target.fVarManager = fVarManager; | |
318 | target.fSignalCuts = fSignalCuts; | |
faee3b18 | 319 | target.fCFM = fCFM; |
69ac0e6f | 320 | target.fTriggerAnalysis = fTriggerAnalysis; |
faee3b18 | 321 | target.fPID = fPID; |
3a72645a | 322 | target.fPIDqa = fPIDqa; |
e3fc062d | 323 | target.fPIDpreselect = fPIDpreselect; |
faee3b18 | 324 | target.fCuts = fCuts; |
3a72645a | 325 | target.fTaggedTrackCuts = fTaggedTrackCuts; |
6555e2ad | 326 | target.fCleanTaggedTrack = fCleanTaggedTrack; |
e3ae862b | 327 | target.fVariablesTRDTaggedTrack = fVariablesTRDTaggedTrack; |
e3fc062d | 328 | target.fCutspreselect = fCutspreselect; |
faee3b18 | 329 | target.fSecVtx = fSecVtx; |
330 | target.fElecBackGround = fElecBackGround; | |
331 | target.fMCQA = fMCQA; | |
3a72645a | 332 | target.fTaggedTrackAnalysis = fTaggedTrackAnalysis; |
8c1c76e9 | 333 | target.fExtraCuts = fExtraCuts; |
faee3b18 | 334 | target.fQA = fQA; |
335 | target.fOutput = fOutput; | |
336 | target.fHistMCQA = fHistMCQA; | |
337 | target.fHistSECVTX = fHistSECVTX; | |
338 | target.fHistELECBACKGROUND = fHistELECBACKGROUND; | |
69ac0e6f | 339 | target.fQACollection = fQACollection; |
faee3b18 | 340 | } |
341 | ||
809a4336 | 342 | //____________________________________________________________ |
343 | AliAnalysisTaskHFE::~AliAnalysisTaskHFE(){ | |
dbe3abbe | 344 | // |
345 | // Destructor | |
346 | // | |
dbe3abbe | 347 | if(fPID) delete fPID; |
8c1c76e9 | 348 | if(fPIDpreselect) delete fPIDpreselect; |
3a72645a | 349 | if(fVarManager) delete fVarManager; |
3a72645a | 350 | if(fCFM) delete fCFM; |
8c1c76e9 | 351 | if(fTriggerAnalysis) delete fTriggerAnalysis; |
352 | if(fSignalCuts) delete fSignalCuts; | |
259c3296 | 353 | if(fSecVtx) delete fSecVtx; |
dbe3abbe | 354 | if(fMCQA) delete fMCQA; |
3a72645a | 355 | if(fElecBackGround) delete fElecBackGround; |
8c1c76e9 | 356 | if(fSpecialTrigger) delete fSpecialTrigger; |
357 | // Delete output objects only if we are not running in PROOF mode because otherwise this produces a crash during merging | |
358 | AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager(); | |
359 | if(mgr && mgr->GetAnalysisType() != AliAnalysisManager::kProofAnalysis){ | |
360 | if(fPIDqa) delete fPIDqa; | |
361 | if(fOutput) delete fOutput; | |
362 | if(fQA) delete fQA; | |
8c1c76e9 | 363 | } |
809a4336 | 364 | } |
365 | ||
366 | //____________________________________________________________ | |
d2af20c5 | 367 | void AliAnalysisTaskHFE::UserCreateOutputObjects(){ |
50685501 | 368 | // |
369 | // Creating output container and output objects | |
370 | // Here we also Initialize the correction framework container and | |
371 | // the objects for | |
372 | // - PID | |
373 | // - MC QA | |
374 | // - SecVtx | |
375 | // QA histograms are created if requested | |
376 | // Called once per worker | |
377 | // | |
9bcfd1ab | 378 | AliDebug(3, "Creating Output Objects"); |
70da6c5a | 379 | // Automatic determination of the analysis mode |
faee3b18 | 380 | AliVEventHandler *inputHandler = dynamic_cast<AliVEventHandler *>(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()); |
70da6c5a | 381 | if(!TString(inputHandler->IsA()->GetName()).CompareTo("AliAODInputHandler")){ |
382 | SetAODAnalysis(); | |
383 | } else { | |
384 | SetESDAnalysis(); | |
385 | if(AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler()) | |
386 | SetHasMCData(); | |
387 | } | |
9bcfd1ab | 388 | printf("Analysis Mode: %s Analysis\n", IsAODanalysis() ? "AOD" : "ESD"); |
389 | printf("MC Data available %s\n", HasMCData() ? "Yes" : "No"); | |
390 | ||
69ac0e6f | 391 | // Enable Trigger Analysis |
392 | fTriggerAnalysis = new AliTriggerAnalysis; | |
393 | fTriggerAnalysis->EnableHistograms(); | |
394 | fTriggerAnalysis->SetAnalyzeMC(HasMCData()); | |
395 | ||
3a72645a | 396 | |
397 | // Make lists for Output | |
dbe3abbe | 398 | if(!fQA) fQA = new TList; |
3a72645a | 399 | fQA->SetOwner(); |
400 | if(!fOutput) fOutput = new TList; | |
401 | fOutput->SetOwner(); | |
69ac0e6f | 402 | |
3a72645a | 403 | // First Part: Make QA histograms |
69ac0e6f | 404 | fQACollection = new AliHFEcollection("TaskQA", "QA histos from the Electron Task"); |
3a72645a | 405 | fQACollection->CreateTH1F("nElectronTracksEvent", "Number of Electron Candidates", 100, 0, 100); |
69ac0e6f | 406 | fQACollection->CreateTH1F("nElectron", "Number of electrons", 100, 0, 100); |
69ac0e6f | 407 | fQACollection->CreateTH2F("radius", "Production Vertex", 100, 0.0, 5.0, 100, 0.0, 5.0); |
e17c1f86 | 408 | fQACollection->CreateTH2F("TPCdEdxBeforePID", "TPC dE/dx; p (GeV/c); TPC dE/dx (a.u.)", 1000, 0., 10., 200, 0., 200.); |
409 | fQACollection->CreateTH2F("TPCnSigmaBeforePID", "TPC dE/dx; p (GeV/c); TPC dE/dx - <TPC dE/dx>|_{el} (#sigma)", 1000, 0., 10., 1000, -10., 10.); | |
8c1c76e9 | 410 | |
3a72645a | 411 | InitPIDperformanceQA(); |
6555e2ad | 412 | InitContaminationQA(); |
8c1c76e9 | 413 | InitHistoITScluster(); |
414 | fQA->Add(fQACollection); | |
809a4336 | 415 | |
3a72645a | 416 | // Initialize PID |
417 | fPID->SetHasMCData(HasMCData()); | |
418 | if(!fPID->GetNumberOfPIDdetectors()) fPID->AddDetector("TPC", 0); | |
3a72645a | 419 | if(IsQAOn(kPIDqa)){ |
420 | AliInfo("PID QA switched on"); | |
3a72645a | 421 | fPIDqa->Initialize(fPID); |
422 | fQA->Add(fPIDqa->MakeList("HFEpidQA")); | |
423 | } | |
8c1c76e9 | 424 | fPID->SortDetectors(); |
3a72645a | 425 | |
809a4336 | 426 | // Initialize correction Framework and Cuts |
c2690925 | 427 | const Int_t kNcutSteps = AliHFEcuts::kNcutStepsMCTrack + AliHFEcuts::kNcutStepsRecTrack + AliHFEcuts::kNcutStepsDETrack + AliHFEcuts::kNcutStepsSecvtxTrack; |
809a4336 | 428 | fCFM = new AliCFManager; |
3a72645a | 429 | fCFM->SetNStepParticle(kNcutSteps); |
809a4336 | 430 | MakeParticleContainer(); |
70da6c5a | 431 | MakeEventContainer(); |
9bcfd1ab | 432 | // Temporary fix: Initialize particle cuts with NULL |
3a72645a | 433 | for(Int_t istep = 0; istep < kNcutSteps; istep++) |
9bcfd1ab | 434 | fCFM->SetParticleCutsList(istep, NULL); |
0792aa82 | 435 | if(!fCuts){ |
436 | AliWarning("Cuts not available. Default cuts will be used"); | |
437 | fCuts = new AliHFEcuts; | |
438 | fCuts->CreateStandardCuts(); | |
809a4336 | 439 | } |
9bcfd1ab | 440 | if(IsAODanalysis()) fCuts->SetAOD(); |
e3fc062d | 441 | // Make clone for V0 tagging step |
0792aa82 | 442 | fCuts->Initialize(fCFM); |
e3fc062d | 443 | if(fCuts->IsQAOn()) fQA->Add(fCuts->GetQAhistograms()); |
3a72645a | 444 | fSignalCuts = new AliHFEsignalCuts("HFEsignalCuts", "HFE MC Signal definition"); |
445 | fVarManager->SetSignalCuts(fSignalCuts); | |
0792aa82 | 446 | |
259c3296 | 447 | // add output objects to the List |
3a72645a | 448 | fOutput->AddAt(fContainer, 0); |
70da6c5a | 449 | fOutput->AddAt(fCFM->GetEventContainer(), 1); |
3a72645a | 450 | |
dbe3abbe | 451 | // mcQA---------------------------------- |
9bcfd1ab | 452 | if (HasMCData() && IsQAOn(kMCqa)) { |
dbe3abbe | 453 | AliInfo("MC QA on"); |
454 | if(!fMCQA) fMCQA = new AliHFEmcQA; | |
259c3296 | 455 | if(!fHistMCQA) fHistMCQA = new TList(); |
3a72645a | 456 | fHistMCQA->SetOwner(); |
8c1c76e9 | 457 | if(IsPbPb()) fMCQA->SetPbPb(); |
458 | if(fisppMultiBin) fMCQA->SetPPMultiBin(); | |
a8ef1999 | 459 | if(TestBit(kTreeStream)){ |
460 | fMCQA->EnableDebugStreamer(); | |
461 | } | |
e3fc062d | 462 | fMCQA->CreatDefaultHistograms(fHistMCQA); |
e17c1f86 | 463 | fMCQA->SetBackgroundWeightFactor(fElecBackgroundFactor[0][0][0],fBinLimit); |
259c3296 | 464 | fQA->Add(fHistMCQA); |
dbe3abbe | 465 | } |
259c3296 | 466 | |
dbe3abbe | 467 | // secvtx---------------------------------- |
9bcfd1ab | 468 | if (GetPlugin(kSecVtx)) { |
dbe3abbe | 469 | AliInfo("Secondary Vertex Analysis on"); |
e3fc062d | 470 | if(!fSecVtx) fSecVtx = new AliHFEsecVtx; |
9bcfd1ab | 471 | fSecVtx->SetHasMCData(HasMCData()); |
dbe3abbe | 472 | |
259c3296 | 473 | if(!fHistSECVTX) fHistSECVTX = new TList(); |
3a72645a | 474 | fHistSECVTX->SetOwner(); |
9bcfd1ab | 475 | fSecVtx->CreateHistograms(fHistSECVTX); |
75d81601 | 476 | fOutput->Add(fHistSECVTX); |
9bcfd1ab | 477 | } |
478 | ||
479 | // background---------------------------------- | |
480 | if (GetPlugin(kIsElecBackGround)) { | |
481 | AliInfo("Electron BackGround Analysis on"); | |
70da6c5a | 482 | if(!fElecBackGround){ |
483 | AliWarning("ElecBackGround not available. Default elecbackground will be used"); | |
484 | fElecBackGround = new AliHFEelecbackground; | |
485 | } | |
9bcfd1ab | 486 | fElecBackGround->SetHasMCData(HasMCData()); |
487 | ||
488 | if(!fHistELECBACKGROUND) fHistELECBACKGROUND = new TList(); | |
3a72645a | 489 | fHistELECBACKGROUND->SetOwner(); |
9bcfd1ab | 490 | fElecBackGround->CreateHistograms(fHistELECBACKGROUND); |
491 | fOutput->Add(fHistELECBACKGROUND); | |
492 | } | |
3a72645a | 493 | |
494 | // tagged tracks | |
495 | if(GetPlugin(kTaggedTrackAnalysis)){ | |
496 | AliInfo("Analysis on V0-tagged tracks enabled"); | |
c2690925 | 497 | fTaggedTrackAnalysis = new AliHFEtaggedTrackAnalysis(Form("taggedTrackAnalysis%s", GetName())); |
3a72645a | 498 | fTaggedTrackAnalysis->SetCuts(fTaggedTrackCuts); |
6555e2ad | 499 | fTaggedTrackAnalysis->SetClean(fCleanTaggedTrack); |
c2690925 | 500 | AliHFEvarManager *varManager = fTaggedTrackAnalysis->GetVarManager(); |
501 | TObjArray *array = fVarManager->GetVariables(); | |
502 | Int_t nvars = array->GetEntriesFast(); | |
503 | TString namee; | |
504 | for(Int_t v = 0; v < nvars; v++) { | |
505 | AliHFEvarManager::AliHFEvariable *variable = (AliHFEvarManager::AliHFEvariable *) array->At(v); | |
506 | if(!variable) continue; | |
507 | TString name(((AliHFEvarManager::AliHFEvariable *)variable)->GetName()); | |
508 | if(!name.CompareTo("source")) namee = TString("species"); | |
509 | else namee = TString(name); | |
8c1c76e9 | 510 | Int_t nbins = variable->GetNumberOfBins(); |
511 | if(variable->HasUserDefinedBinning()){ | |
512 | varManager->AddVariable(namee, nbins, variable->GetBinning()); | |
513 | } else { | |
514 | varManager->AddVariable(namee, nbins, variable->GetMinimum(), variable->GetMaximum()); | |
515 | } | |
c2690925 | 516 | //printf("For AliTaggedTrackAnalysis, had the variable %s and the one used %s\n",(const char*)variable->GetName(),(const char*) namee); |
517 | } | |
e3ae862b | 518 | if(fPIDqa->HasHighResolutionHistos()) |
519 | fTaggedTrackAnalysis->GetPIDqa()->SetHighResolutionHistos(); | |
3a72645a | 520 | fTaggedTrackAnalysis->SetPID(fPID); |
e3ae862b | 521 | fTaggedTrackAnalysis->SetVariablesTRD(fVariablesTRDTaggedTrack); |
3a72645a | 522 | fTaggedTrackAnalysis->InitContainer(); |
523 | fOutput->Add(fTaggedTrackAnalysis->GetContainer()); | |
524 | fQA->Add(fTaggedTrackAnalysis->GetPIDQA()); | |
525 | fQA->Add(fTaggedTrackAnalysis->GetCutQA()); | |
bf892a6a | 526 | fQA->Add(fTaggedTrackAnalysis->GetQAcollection()); |
3a72645a | 527 | } |
8c1c76e9 | 528 | |
3a72645a | 529 | PrintStatus(); |
4fb7b1f0 | 530 | // Done!!! |
531 | PostData(1, fOutput); | |
532 | PostData(2, fQA); | |
809a4336 | 533 | } |
534 | ||
535 | //____________________________________________________________ | |
d2af20c5 | 536 | void AliAnalysisTaskHFE::UserExec(Option_t *){ |
dbe3abbe | 537 | // |
538 | // Run the analysis | |
539 | // | |
9bcfd1ab | 540 | AliDebug(3, "Starting Single Event Analysis"); |
d2af20c5 | 541 | if(!fInputEvent){ |
9bcfd1ab | 542 | AliError("Reconstructed Event not available"); |
dbe3abbe | 543 | return; |
544 | } | |
9bcfd1ab | 545 | if(HasMCData()){ |
d2af20c5 | 546 | AliDebug(4, Form("MC Event: %p", fMCEvent)); |
547 | if(!fMCEvent){ | |
9bcfd1ab | 548 | AliError("No MC Event, but MC Data required"); |
549 | return; | |
550 | } | |
dbe3abbe | 551 | } |
722347d8 | 552 | if(!fCuts){ |
553 | AliError("HFE cuts not available"); | |
554 | return; | |
555 | } | |
8c1c76e9 | 556 | if(!fPID->IsInitialized()){ |
557 | // Initialize PID with the given run number | |
558 | fPID->InitializePID(fInputEvent->GetRunNumber()); | |
559 | } | |
809a4336 | 560 | |
8c1c76e9 | 561 | // Initialize hadronic background from OADB Container |
562 | AliDebug(2, Form("Apply background factors: %s, OADB Container %p", fBackGroundFactorApply ? "Yes" : "No", fHadronBackgroundOADB)); | |
563 | if(fBackGroundFactorApply && !TestBit(kBackgroundInitialized)){ | |
564 | AliDebug(2, "Initializing Background from OADB"); | |
565 | if(!InitializeHadronBackground(fInputEvent->GetRunNumber())) AliError("Failed initializing hadronic background parameterization from OADB"); | |
566 | else AliDebug(2, "Successfully loaded Background from OADB"); | |
567 | SetBit(kBackgroundInitialized); | |
568 | } | |
c2690925 | 569 | |
faee3b18 | 570 | if(IsESDanalysis() && HasMCData()){ |
571 | // Protect against missing MC trees | |
572 | AliMCEventHandler *mcH = dynamic_cast<AliMCEventHandler *>(AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler()); | |
69ac0e6f | 573 | if(!mcH){ |
574 | AliError("No MC Event Handler available"); | |
575 | return; | |
576 | } | |
faee3b18 | 577 | if(!mcH->InitOk()) return; |
578 | if(!mcH->TreeK()) return; | |
579 | if(!mcH->TreeTR()) return; | |
580 | } | |
581 | ||
3a72645a | 582 | // need the centrality for everything (MC also) |
e156c3bb | 583 | fCentralityF = -1; |
584 | if(!ReadCentrality()) fCentralityF = -1; | |
c2690925 | 585 | //printf("pass centrality\n"); |
586 | //printf("Reading fCentralityF %f\n",fCentralityF); | |
3a72645a | 587 | |
588 | // See if pile up and z in the range | |
589 | RejectionPileUpVertexRangeEventCut(); | |
590 | ||
faee3b18 | 591 | // Protect agains missing |
3a72645a | 592 | if(HasMCData()){ |
bf892a6a | 593 | //printf("Has MC data\n"); |
3a72645a | 594 | fSignalCuts->SetMCEvent(fMCEvent); |
595 | ProcessMC(); // Run the MC loop + MC QA in case MC Data are available | |
596 | } | |
809a4336 | 597 | |
8c1c76e9 | 598 | AliPIDResponse *pidResponse = fInputHandler->GetPIDResponse(); |
599 | if(!pidResponse){ | |
600 | AliDebug(1, "Using default PID Response"); | |
601 | pidResponse = AliHFEtools::GetDefaultPID(HasMCData(), fInputEvent->IsA() == AliAODEvent::Class()); | |
602 | } | |
603 | fPID->SetPIDResponse(pidResponse); | |
604 | if(fPIDpreselect) fPIDpreselect->SetPIDResponse(pidResponse); | |
605 | ||
606 | // Event loop | |
3a72645a | 607 | if(IsAODanalysis()){ |
11ff28c5 | 608 | //printf("test\n"); |
3a72645a | 609 | ProcessAOD(); |
610 | } else { | |
8c1c76e9 | 611 | const char *specialTrigger = GetSpecialTrigger(fInputEvent->GetRunNumber()); |
c2690925 | 612 | // Check Trigger selection |
8c1c76e9 | 613 | if(specialTrigger){ |
614 | AliDebug(2, Form("Special Trigger requested: %s", specialTrigger)); | |
c2690925 | 615 | AliESDEvent *ev = dynamic_cast<AliESDEvent *>(fInputEvent); |
8c1c76e9 | 616 | if(!(ev && ev->IsTriggerClassFired(specialTrigger))){ |
617 | AliDebug(2, "Event not selected"); | |
618 | return; | |
619 | } else AliDebug(2, "Event Selected"); | |
620 | } else AliDebug(2, "No Special Trigger requested"); | |
621 | ||
faee3b18 | 622 | ProcessESD(); |
623 | } | |
9bcfd1ab | 624 | // Done!!! |
3a72645a | 625 | PostData(1, fOutput); |
626 | PostData(2, fQA); | |
9bcfd1ab | 627 | } |
259c3296 | 628 | |
9bcfd1ab | 629 | //____________________________________________________________ |
630 | void AliAnalysisTaskHFE::Terminate(Option_t *){ | |
631 | // | |
632 | // Terminate not implemented at the moment | |
633 | // | |
634 | if(GetPlugin(kPostProcess)){ | |
3a72645a | 635 | fOutput = dynamic_cast<TList *>(GetOutputData(1)); |
636 | fQA = dynamic_cast<TList *>(GetOutputData(2)); | |
9bcfd1ab | 637 | if(!fOutput){ |
638 | AliError("Results not available"); | |
639 | return; | |
259c3296 | 640 | } |
3a72645a | 641 | if(!fQA){ |
642 | AliError("QA output not available"); | |
643 | return; | |
644 | } | |
645 | fContainer = dynamic_cast<AliHFEcontainer *>(fOutput->FindObject("trackContainer")); | |
646 | if(!fContainer){ | |
647 | AliError("Track container not found"); | |
648 | return; | |
649 | } | |
d2af20c5 | 650 | AliHFEpostAnalysis postanalysis; |
3a72645a | 651 | postanalysis.SetTaskResults(fContainer); |
652 | TList *qalist = dynamic_cast<TList *>(fQA->FindObject("list_TaskQA")); | |
653 | if(!qalist){ | |
654 | AliError("QA List not found"); | |
655 | return; | |
656 | } | |
657 | postanalysis.SetTaskQA(qalist); | |
658 | printf("Running post analysis\n"); | |
659 | //if(HasMCData()) | |
660 | postanalysis.DrawMCSignal2Background(); | |
d2af20c5 | 661 | postanalysis.DrawEfficiency(); |
662 | postanalysis.DrawPIDperformance(); | |
70da6c5a | 663 | postanalysis.DrawCutEfficiency(); |
664 | ||
665 | if (GetPlugin(kIsElecBackGround)) { | |
666 | AliHFEelecbackground elecBackGround; | |
667 | TList *oe = 0x0; | |
668 | if(!(oe = (TList*)dynamic_cast<TList *>(fOutput->FindObject("HFEelecbackground")))){ | |
8c1c76e9 | 669 | return; |
70da6c5a | 670 | } |
671 | elecBackGround.Load(oe); | |
672 | elecBackGround.Plot(); | |
673 | elecBackGround.PostProcess(); | |
674 | } | |
9bcfd1ab | 675 | } |
9bcfd1ab | 676 | } |
faee3b18 | 677 | //_______________________________________________________________ |
678 | Bool_t AliAnalysisTaskHFE::IsEventInBinZero() { | |
679 | // | |
680 | // | |
681 | // | |
682 | ||
683 | //printf("test in IsEventInBinZero\n"); | |
684 | if(!fInputEvent){ | |
685 | AliError("Reconstructed Event not available"); | |
686 | return kFALSE; | |
687 | } | |
dbe3abbe | 688 | |
faee3b18 | 689 | // check vertex |
690 | const AliVVertex *vertex = fInputEvent->GetPrimaryVertex(); | |
691 | if(!vertex) return kTRUE; | |
692 | //if(vertex) return kTRUE; | |
693 | ||
694 | // check tracks | |
695 | if(fInputEvent->GetNumberOfTracks()<=0) return kTRUE; | |
696 | //if(fInputEvent->GetNumberOfTracks()>0) return kTRUE; | |
697 | ||
698 | ||
699 | return kFALSE; | |
700 | ||
701 | } | |
9bcfd1ab | 702 | //____________________________________________________________ |
703 | void AliAnalysisTaskHFE::ProcessMC(){ | |
704 | // | |
705 | // Runs the MC Loop (filling the container for the MC Cut Steps with the observables pt, eta and phi) | |
706 | // In case MC QA is on also MC QA loop is done | |
707 | // | |
708 | AliDebug(3, "Processing MC Information"); | |
c2690925 | 709 | Double_t eventContainer [4]; |
69ac0e6f | 710 | eventContainer[0] = fMCEvent->GetPrimaryVertex()->GetZ(); |
3a72645a | 711 | eventContainer[2] = fCentralityF; |
c2690925 | 712 | eventContainer[3] = fContributors; |
713 | fVz = eventContainer[0]; | |
bf892a6a | 714 | //printf("z position is %f\n",eventContainer[0]); |
715 | //if(fCFM->CheckEventCuts(AliHFEcuts::kEventStepGenerated, fMCEvent)) | |
716 | fCFM->GetEventContainer()->Fill(eventContainer,AliHFEcuts::kEventStepGenerated); | |
9bcfd1ab | 717 | Int_t nElectrons = 0; |
718 | if(IsESDanalysis()){ | |
e156c3bb | 719 | if(!((fIdentifiedAsPileUp) || (TMath::Abs(fVz) > fCuts->GetVertexRange()) || (fCentralityF < 0))){ //kStepMCGeneratedZOutNoPileUpCentralityFine |
9bcfd1ab | 720 | if (HasMCData() && IsQAOn(kMCqa)) { |
721 | AliDebug(2, "Running MC QA"); | |
722 | ||
70da6c5a | 723 | if(fMCEvent->Stack()){ |
8c1c76e9 | 724 | fMCQA->SetMCEvent(fMCEvent); |
70da6c5a | 725 | fMCQA->SetGenEventHeader(fMCEvent->GenEventHeader()); |
8c1c76e9 | 726 | fMCQA->SetCentrality(fCentralityF); |
11ff28c5 | 727 | fMCQA->SetPercentrality(fCentralityPercent); |
8c1c76e9 | 728 | if(IsPbPb()) { fMCQA->SetPbPb();} |
729 | else | |
730 | { | |
731 | if(fisppMultiBin) fMCQA->SetPPMultiBin(); | |
732 | else fMCQA->SetPP(); | |
733 | } | |
70da6c5a | 734 | fMCQA->Init(); |
8c1c76e9 | 735 | |
c2690925 | 736 | fMCQA->GetMesonKine(); |
70da6c5a | 737 | |
70da6c5a | 738 | // loop over all tracks for decayed electrons |
e3ae862b | 739 | for (Int_t igen = 0; igen < fMCEvent->GetNumberOfTracks(); igen++){ |
70da6c5a | 740 | TParticle* mcpart = fMCEvent->Stack()->Particle(igen); |
8c1c76e9 | 741 | if(!mcpart) continue; |
70da6c5a | 742 | fMCQA->GetQuarkKine(mcpart, igen, AliHFEmcQA::kCharm); |
743 | fMCQA->GetQuarkKine(mcpart, igen, AliHFEmcQA::kBeauty); | |
744 | fMCQA->GetHadronKine(mcpart, AliHFEmcQA::kCharm); | |
745 | fMCQA->GetHadronKine(mcpart, AliHFEmcQA::kBeauty); | |
a8ef1999 | 746 | fMCQA->GetDecayedKine(mcpart, AliHFEmcQA::kCharm, AliHFEmcQA::kElectronPDG); // no accept cut |
747 | fMCQA->GetDecayedKine(mcpart, AliHFEmcQA::kBeauty, AliHFEmcQA::kElectronPDG); // no accept cut | |
748 | fMCQA->GetDecayedKine(mcpart, AliHFEmcQA::kOthers, AliHFEmcQA::kElectronPDG); // no accept cut | |
9bcfd1ab | 749 | } |
8c1c76e9 | 750 | //fMCQA->EndOfEventAna(AliHFEmcQA::kCharm); |
751 | //fMCQA->EndOfEventAna(AliHFEmcQA::kBeauty); | |
9bcfd1ab | 752 | } |
809a4336 | 753 | |
9bcfd1ab | 754 | } // end of MC QA loop |
c2690925 | 755 | } |
756 | // ----------------------------------------------------------------- | |
757 | fCFM->SetMCEventInfo(fMCEvent); | |
758 | // fCFM->CheckEventCuts(AliCFManager::kEvtRecCuts, fESD); | |
9bcfd1ab | 759 | } else { |
d2af20c5 | 760 | fCFM->SetMCEventInfo(fInputEvent); |
9bcfd1ab | 761 | } |
762 | // Run MC loop | |
70da6c5a | 763 | AliVParticle *mctrack = NULL; |
faee3b18 | 764 | AliDebug(3, Form("Number of Tracks: %d", fMCEvent->GetNumberOfTracks())); |
70da6c5a | 765 | for(Int_t imc = 0; imc <fMCEvent->GetNumberOfTracks(); imc++){ |
766 | if(!(mctrack = fMCEvent->GetTrack(imc))) continue; | |
3a72645a | 767 | AliDebug(4, "Next MC Track"); |
70da6c5a | 768 | if(ProcessMCtrack(mctrack)) nElectrons++; |
dbe3abbe | 769 | } |
dbe3abbe | 770 | |
771 | // fCFM->CheckEventCuts(AliCFManager::kEvtRecCuts, fESD); | |
69ac0e6f | 772 | fQACollection->Fill("nElectron", nElectrons); |
9bcfd1ab | 773 | } |
dbe3abbe | 774 | |
9bcfd1ab | 775 | //____________________________________________________________ |
776 | void AliAnalysisTaskHFE::ProcessESD(){ | |
dbe3abbe | 777 | // |
9bcfd1ab | 778 | // Run Analysis of reconstructed event in ESD Mode |
779 | // Loop over Tracks, filter according cut steps defined in AliHFEcuts | |
dbe3abbe | 780 | // |
9bcfd1ab | 781 | AliDebug(3, "Processing ESD Event"); |
d2af20c5 | 782 | AliESDEvent *fESD = dynamic_cast<AliESDEvent *>(fInputEvent); |
9bcfd1ab | 783 | if(!fESD){ |
13242232 | 784 | AliError("ESD Event required for ESD Analysis"); |
9bcfd1ab | 785 | return; |
786 | } | |
69ac0e6f | 787 | |
e3ae862b | 788 | // Set magnetic field if V0 task on |
c2690925 | 789 | if(fTaggedTrackAnalysis) { |
790 | fTaggedTrackAnalysis->SetMagneticField(fESD->GetMagneticField()); | |
791 | fTaggedTrackAnalysis->SetCentrality(fCentralityF); | |
e156c3bb | 792 | if(IsPbPb()) fTaggedTrackAnalysis->SetPbPb(); |
793 | else fTaggedTrackAnalysis->SetPP(); | |
c2690925 | 794 | } |
e3ae862b | 795 | |
69ac0e6f | 796 | // Do event Normalization |
c2690925 | 797 | Double_t eventContainer[4]; |
8c1c76e9 | 798 | eventContainer[0] = 0.; |
c2690925 | 799 | if(HasMCData()) eventContainer[0] = fVz; |
800 | else { | |
8c1c76e9 | 801 | if(fESD->GetPrimaryVertexSPD()) eventContainer[0] = fESD->GetPrimaryVertexSPD()->GetZ(); |
c2690925 | 802 | } |
69ac0e6f | 803 | eventContainer[1] = 0.; |
3a72645a | 804 | eventContainer[2] = fCentralityF; |
c2690925 | 805 | eventContainer[3] = fContributors; |
69ac0e6f | 806 | if(fTriggerAnalysis->IsOfflineTriggerFired(fESD, AliTriggerAnalysis::kV0AND)) |
807 | eventContainer[1] = 1.; | |
3a72645a | 808 | |
809 | // | |
69ac0e6f | 810 | fCFM->GetEventContainer()->Fill(eventContainer, AliHFEcuts::kEventStepRecNoCut); |
3a72645a | 811 | |
812 | // | |
813 | if(fIdentifiedAsPileUp) return; | |
814 | fCFM->GetEventContainer()->Fill(eventContainer, AliHFEcuts::kEventStepRecNoPileUp); | |
815 | ||
c2690925 | 816 | // |
e156c3bb | 817 | if(TMath::Abs(fCentralityF) < 0) return; |
c2690925 | 818 | fCFM->GetEventContainer()->Fill(eventContainer, AliHFEcuts::kEventStepRecCentralityOk); |
819 | //printf("In ProcessESD %f\n",fCentralityF); | |
820 | ||
3a72645a | 821 | // |
822 | if(fIdentifiedAsOutInz) return; | |
823 | fCFM->GetEventContainer()->Fill(eventContainer, AliHFEcuts::kEventStepZRange); | |
824 | ||
825 | // | |
826 | if(!fPassTheEventCut) return; | |
69ac0e6f | 827 | fCFM->GetEventContainer()->Fill(eventContainer, AliHFEcuts::kEventStepReconstructed); |
828 | ||
3a72645a | 829 | |
830 | ||
831 | fContainer->NewEvent(); | |
832 | ||
9bcfd1ab | 833 | if (GetPlugin(kIsElecBackGround)) { |
834 | fElecBackGround->SetEvent(fESD); | |
835 | } | |
836 | if (GetPlugin(kSecVtx)) { | |
837 | fSecVtx->SetEvent(fESD); | |
838 | fSecVtx->GetPrimaryCondition(); | |
839 | } | |
840 | ||
841 | if(HasMCData()){ | |
842 | if (GetPlugin(kSecVtx)) { | |
faee3b18 | 843 | fSecVtx->SetMCEvent(fMCEvent); |
3a72645a | 844 | fSecVtx->SetMCQA(fMCQA); |
9bcfd1ab | 845 | } |
846 | if (GetPlugin(kIsElecBackGround)) { | |
d2af20c5 | 847 | fElecBackGround->SetMCEvent(fMCEvent); |
9bcfd1ab | 848 | } |
849 | } | |
850 | ||
faee3b18 | 851 | Double_t container[10]; |
852 | memset(container, 0, sizeof(Double_t) * 10); | |
9bcfd1ab | 853 | // container for the output THnSparse |
67fe7bd0 | 854 | Double_t dataE[6]; // [pT, eta, Phi, type, 'C' or 'B'] |
0e30407a | 855 | Double_t dataDca[6]; // [source, pT, dca, centrality] |
75d81601 | 856 | Int_t nElectronCandidates = 0; |
9bcfd1ab | 857 | AliESDtrack *track = NULL, *htrack = NULL; |
858 | AliMCParticle *mctrack = NULL; | |
8c1c76e9 | 859 | AliMCParticle *mctrackmother = NULL; |
259c3296 | 860 | Int_t pid = 0; |
dbe3abbe | 861 | |
78ea5ef4 | 862 | Bool_t signal = kTRUE; |
863 | ||
554e120d | 864 | fCFM->SetRecEventInfo(fESD); |
8c1c76e9 | 865 | |
866 | // minjung for IP QA(temporary ~ 2weeks) | |
867 | if(!fExtraCuts){ | |
868 | fExtraCuts = new AliHFEextraCuts("hfetmpCuts","HFE tmp Cuts"); | |
869 | } | |
870 | fExtraCuts->SetRecEventInfo(fESD); | |
871 | ||
d2af20c5 | 872 | // Electron background analysis |
873 | if (GetPlugin(kIsElecBackGround)) { | |
874 | ||
875 | AliDebug(2, "Running BackGround Analysis"); | |
876 | ||
877 | fElecBackGround->Reset(); | |
878 | ||
879 | } // end of electron background analysis | |
9bcfd1ab | 880 | // |
881 | // Loop ESD | |
882 | // | |
faee3b18 | 883 | AliDebug(3, Form("Number of Tracks: %d", fESD->GetNumberOfTracks())); |
dbe3abbe | 884 | for(Int_t itrack = 0; itrack < fESD->GetNumberOfTracks(); itrack++){ |
3a72645a | 885 | AliDebug(4, "New ESD track"); |
dbe3abbe | 886 | track = fESD->GetTrack(itrack); |
c2690925 | 887 | track->SetESDEvent(fESD); |
faee3b18 | 888 | |
e3fc062d | 889 | // fill counts of v0-identified particles |
890 | Int_t v0pid = -1; | |
891 | if(track->TestBit(BIT(14))) v0pid = AliPID::kElectron; | |
892 | else if(track->TestBit(BIT(15))) v0pid = AliPID::kPion; | |
893 | else if(track->TestBit(BIT(16))) v0pid = AliPID::kProton; | |
3a72645a | 894 | // here the tagged track analysis will run |
895 | if(fTaggedTrackAnalysis && v0pid > -1){ | |
896 | AliDebug(1, Form("Track identified as %s", AliPID::ParticleName(v0pid))); | |
897 | fTaggedTrackAnalysis->ProcessTrack(track, v0pid); | |
898 | } | |
e3fc062d | 899 | |
faee3b18 | 900 | AliDebug(3, Form("Doing track %d, %p", itrack, track)); |
e3fc062d | 901 | |
902 | ////////////////////////////////////// | |
903 | // preselect | |
904 | ///////////////////////////////////// | |
905 | if(fPIDpreselect && fCutspreselect) { | |
906 | if(!PreSelectTrack(track)) continue; | |
907 | } | |
78ea5ef4 | 908 | |
909 | signal = kTRUE; | |
faee3b18 | 910 | |
70da6c5a | 911 | // Fill step without any cut |
dbe3abbe | 912 | |
9bcfd1ab | 913 | if(HasMCData()){ |
914 | // Check if it is electrons near the vertex | |
d2af20c5 | 915 | if(!(mctrack = dynamic_cast<AliMCParticle *>(fMCEvent->GetTrack(TMath::Abs(track->GetLabel()))))) continue; |
faee3b18 | 916 | |
c2690925 | 917 | if(fFillSignalOnly && !fCFM->CheckParticleCuts(AliHFEcuts::kStepMCGenerated, mctrack)) signal = kFALSE; |
faee3b18 | 918 | else AliDebug(3, "Signal Electron"); |
8c1c76e9 | 919 | |
920 | // Fill K pt for Ke3 contributions | |
921 | if(mctrack && (TMath::Abs(mctrack->Particle()->GetPdgCode())==321)) fQACollection->Fill("Kptspectra",mctrack->Pt()); | |
922 | else if(mctrack && (TMath::Abs(mctrack->Particle()->GetPdgCode())==130)) fQACollection->Fill("K0Lptspectra",mctrack->Pt()); | |
e3fc062d | 923 | } |
3a72645a | 924 | // Cache new Track information inside the var manager |
925 | fVarManager->NewTrack(track, mctrack, fCentralityF, -1, signal); | |
926 | ||
e156c3bb | 927 | if(fFillNoCuts) { |
928 | if(signal || !fFillSignalOnly){ | |
929 | fVarManager->FillContainer(fContainer, "recTrackContReco", AliHFEcuts::kStepRecNoCut, kFALSE); | |
930 | fVarManager->FillContainer(fContainer, "recTrackContMC", AliHFEcuts::kStepRecNoCut, kTRUE); | |
e3ae862b | 931 | } |
dbe3abbe | 932 | } |
933 | ||
70da6c5a | 934 | // RecKine: ITSTPC cuts |
3a72645a | 935 | if(!ProcessCutStep(AliHFEcuts::kStepRecKineITSTPC, track)) continue; |
70da6c5a | 936 | |
dbe3abbe | 937 | |
938 | // RecPrim | |
fd6b8522 | 939 | if(fRejectKinkMother) { |
940 | if(track->GetKinkIndex(0) != 0) continue; } // Quick and dirty fix to reject both kink mothers and daughters | |
3a72645a | 941 | if(!ProcessCutStep(AliHFEcuts::kStepRecPrim, track)) continue; |
dbe3abbe | 942 | |
943 | // HFEcuts: ITS layers cuts | |
3a72645a | 944 | if(!ProcessCutStep(AliHFEcuts::kStepHFEcutsITS, track)) continue; |
fd6b8522 | 945 | |
946 | // HFE cuts: TOF PID and mismatch flag | |
947 | if(!ProcessCutStep(AliHFEcuts::kStepHFEcutsTOF, track)) continue; | |
3a72645a | 948 | |
8c1c76e9 | 949 | // HFE cuts: TPC PID cleanup |
950 | if(!ProcessCutStep(AliHFEcuts::kStepHFEcutsTPC, track)) continue; | |
951 | ||
3a72645a | 952 | // HFEcuts: Nb of tracklets TRD0 |
953 | if(!ProcessCutStep(AliHFEcuts::kStepHFEcutsTRD, track)) continue; | |
954 | ||
6555e2ad | 955 | // Fill correlation maps before PID |
956 | if(signal && fContainer->GetCorrelationMatrix("correlationstepbeforePID")) { | |
957 | //printf("Fill correlation maps before PID\n"); | |
958 | fVarManager->FillCorrelationMatrix(fContainer->GetCorrelationMatrix("correlationstepbeforePID")); | |
959 | } | |
960 | ||
faee3b18 | 961 | if(HasMCData()){ |
962 | FillProductionVertex(track); | |
faee3b18 | 963 | |
a8ef1999 | 964 | if(fMCQA && signal){ |
8c1c76e9 | 965 | fMCQA->SetCentrality(fCentralityF); |
966 | if(mctrack && (TMath::Abs(mctrack->Particle()->GetPdgCode()) == 11)){ | |
967 | Double_t weightElecBgV0[kBgLevels] = {0.,0.,0.}; | |
a8ef1999 | 968 | Double_t hfeimpactRtmp=0., hfeimpactnsigmaRtmp=0.; |
969 | fExtraCuts->GetHFEImpactParameters(track, hfeimpactRtmp, hfeimpactnsigmaRtmp); | |
970 | UChar_t itsPixel = track->GetITSClusterMap(); | |
971 | Double_t ilyrhit=0, ilyrstat=0; | |
972 | for(Int_t ilyr=0; ilyr<6; ilyr++){ | |
973 | if(TESTBIT(itsPixel, ilyr)) ilyrhit += TMath::Power(2,ilyr); | |
974 | if(fExtraCuts->CheckITSstatus(fExtraCuts->GetITSstatus(track,ilyr))) ilyrstat += TMath::Power(2,ilyr); | |
975 | } | |
976 | fMCQA->SetITSInfo(ilyrhit,ilyrstat); | |
977 | fMCQA->SetHFEImpactParameters(hfeimpactRtmp, hfeimpactnsigmaRtmp); | |
978 | fMCQA->SetTrkKine(track->Pt(),track->Eta(), track->Phi()); | |
979 | fMCQA->SetContainerStep(3); | |
8c1c76e9 | 980 | for(Int_t iLevel = 0; iLevel < kBgLevels; iLevel++){ |
981 | weightElecBgV0[iLevel] = fMCQA->GetWeightFactor(mctrack, iLevel); // positive:conversion e, negative: nonHFE | |
982 | if(!fisNonHFEsystematics)break; | |
983 | } | |
984 | ||
985 | if(fisNonHFEsystematics){ | |
986 | //Fill additional containers for electron source distinction | |
987 | Int_t elecSource = 0; | |
988 | elecSource = fMCQA->GetElecSource(mctrack->Particle()); | |
989 | const Char_t *sourceName[kElecBgSpecies]={"Pion","Eta","Omega","Phi","EtaPrime","Rho"}; | |
990 | const Char_t *levelName[kBgLevels]={"Best","Lower","Upper"}; | |
991 | Int_t iName = 0; | |
992 | for(Int_t iSource = AliHFEmcQA::kPi0; iSource <= AliHFEmcQA::kGammaRho0; iSource++){ | |
993 | if((iSource == AliHFEmcQA::kElse)||(iSource == AliHFEmcQA::kMisID)) continue; | |
994 | if(elecSource == iSource){ | |
995 | for(Int_t iLevel = 0; iLevel < kBgLevels; iLevel++){ | |
a8ef1999 | 996 | if(weightElecBgV0[iLevel]>0){ |
997 | fVarManager->FillContainer(fContainer, Form("conversionElecs%s%s",sourceName[iName], levelName[iLevel]), 3, kFALSE, weightElecBgV0[iLevel]); | |
998 | } | |
999 | else if(weightElecBgV0[iLevel]<0){ | |
1000 | fVarManager->FillContainer(fContainer, Form("mesonElecs%s%s",sourceName[iName], levelName[iLevel]), 3, kFALSE, -1*weightElecBgV0[iLevel]); | |
1001 | } | |
8c1c76e9 | 1002 | } |
1003 | break; | |
1004 | } | |
1005 | iName++; | |
1006 | if(iName == kElecBgSpecies)iName = 0; | |
1007 | } | |
1008 | } | |
1009 | //else{ | |
a8ef1999 | 1010 | if(weightElecBgV0[0]>0) { |
1011 | fVarManager->FillContainer(fContainer, "conversionElecs", 3, kFALSE, weightElecBgV0[0]); | |
1012 | fVarManager->FillContainer(fContainer, "conversionElecs", 4, kTRUE, weightElecBgV0[0]); | |
1013 | } | |
1014 | else if(weightElecBgV0[0]<0) { | |
1015 | fVarManager->FillContainer(fContainer, "mesonElecs", 3, kFALSE, -1*weightElecBgV0[0]); | |
1016 | fVarManager->FillContainer(fContainer, "mesonElecs", 4, kTRUE, -1*weightElecBgV0[0]); | |
1017 | } | |
8c1c76e9 | 1018 | //} |
1019 | } | |
1020 | } | |
11ff28c5 | 1021 | |
0e30407a | 1022 | Double_t hfeimpactR4all=0., hfeimpactnsigmaR4all=0.; |
1023 | Int_t sourceDca =-1; | |
11ff28c5 | 1024 | if(mctrack && (TMath::Abs(mctrack->Particle()->GetPdgCode()) == 211)){ |
1025 | if(track->Pt()>4.){ | |
0e30407a | 1026 | fExtraCuts->GetHFEImpactParameters(track, hfeimpactR4all, hfeimpactnsigmaR4all); |
1027 | dataDca[0]=0; //pion | |
1028 | dataDca[1]=track->Pt(); | |
1029 | dataDca[2]=hfeimpactR4all; | |
1030 | dataDca[3]=fCentralityF; | |
1031 | dataDca[4] = v0pid; | |
1032 | dataDca[5] = double(track->Charge()); | |
1033 | fQACollection->Fill("Dca", dataDca); | |
11ff28c5 | 1034 | } |
1035 | } | |
1036 | else if(mctrack && (TMath::Abs(mctrack->Particle()->GetPdgCode()) == 11)){ // to increas statistics for Martin | |
1037 | if(signal){ | |
0e30407a | 1038 | fExtraCuts->GetHFEImpactParameters(track, hfeimpactR4all, hfeimpactnsigmaR4all); |
11ff28c5 | 1039 | if(fSignalCuts->IsCharmElectron(track)){ |
1040 | sourceDca=1; | |
1041 | } | |
1042 | else if(fSignalCuts->IsBeautyElectron(track)){ | |
1043 | sourceDca=2; | |
1044 | } | |
1045 | else if(fSignalCuts->IsGammaElectron(track)){ | |
1046 | sourceDca=3; | |
1047 | } | |
1048 | else if(fSignalCuts->IsNonHFElectron(track)){ | |
1049 | sourceDca=4; | |
1050 | } | |
1051 | else if(fSignalCuts->IsJpsiElectron(track)){ | |
1052 | sourceDca=5; | |
1053 | } | |
11ff28c5 | 1054 | else { |
0e30407a | 1055 | sourceDca=6; |
11ff28c5 | 1056 | } |
0e30407a | 1057 | dataDca[0]=sourceDca; |
1058 | dataDca[1]=track->Pt(); | |
1059 | dataDca[2]=hfeimpactR4all; | |
1060 | dataDca[3]=fCentralityF; | |
1061 | dataDca[4] = v0pid; | |
1062 | dataDca[5] = double(track->Charge()); | |
1063 | if(signal) fQACollection->Fill("Dca", dataDca); | |
11ff28c5 | 1064 | } |
1065 | } | |
8c1c76e9 | 1066 | } |
e17c1f86 | 1067 | |
1068 | if(TMath::Abs(track->Eta()) < 0.5){ | |
a8ef1999 | 1069 | if(track->GetInnerParam()) |
1070 | fQACollection->Fill("TPCdEdxBeforePID", track->GetInnerParam()->P(), track->GetTPCsignal()); | |
e17c1f86 | 1071 | fQACollection->Fill("TPCnSigmaBeforePID", track->P(), fInputHandler->GetPIDResponse()->NumberOfSigmasTPC(track, AliPID::kElectron)); |
1072 | } | |
1073 | ||
722347d8 | 1074 | AliHFEpidObject hfetrack; |
3a72645a | 1075 | hfetrack.SetAnalysisType(AliHFEpidObject::kESDanalysis); |
1076 | hfetrack.SetRecTrack(track); | |
1077 | if(HasMCData()) hfetrack.SetMCTrack(mctrack); | |
1078 | hfetrack.SetCentrality(fCentralityF); | |
e156c3bb | 1079 | if(IsPbPb()) hfetrack.SetPbPb(); |
1080 | else hfetrack.SetPP(); | |
3a72645a | 1081 | fPID->SetVarManager(fVarManager); |
1082 | if(!fPID->IsSelected(&hfetrack, fContainer, "recTrackCont", fPIDqa)) continue; | |
75d81601 | 1083 | nElectronCandidates++; |
dbe3abbe | 1084 | |
8c1c76e9 | 1085 | // Temporary histogram for chi2/ITS cluster |
1086 | if(IsPbPb()) { | |
1087 | TBits shared = track->GetTPCSharedMap(); | |
965de368 | 1088 | Int_t sharebit=0; |
8c1c76e9 | 1089 | if(shared.CountBits() >= 2) sharebit=1; |
1090 | ||
965de368 | 1091 | Double_t itschi2percluster = 0.0; |
317ae21b | 1092 | Double_t itsnbcls = static_cast<Double_t>(track->GetNcls(0)); |
1093 | if(itsnbcls > 0) itschi2percluster = track->GetITSchi2()/itsnbcls; | |
965de368 | 1094 | |
8c1c76e9 | 1095 | Double_t itsChi2[7] = {track->Pt(),track->Eta(), track->Phi(), |
a8ef1999 | 1096 | fCentralityF,track->GetTPCsignalN(), sharebit,itschi2percluster}; |
8c1c76e9 | 1097 | fQACollection->Fill("fChi2perITScluster", itsChi2); |
1098 | } | |
1099 | else{ | |
a8ef1999 | 1100 | |
965de368 | 1101 | Double_t itschi2percluster = 0.0; |
317ae21b | 1102 | Double_t itsnbcls = static_cast<Double_t>(track->GetNcls(0)); |
1103 | if(itsnbcls > 0) itschi2percluster = track->GetITSchi2()/itsnbcls; | |
965de368 | 1104 | |
1105 | Double_t itsChi2[3] = {track->Pt(), fCentralityF, itschi2percluster}; | |
1106 | fQACollection->Fill("fChi2perITScluster", itsChi2); | |
8c1c76e9 | 1107 | } |
1108 | ||
faee3b18 | 1109 | // Fill Histogram for Hadronic Background |
1110 | if(HasMCData()){ | |
1111 | if(mctrack && (TMath::Abs(mctrack->Particle()->GetPdgCode()) != 11)) | |
3a72645a | 1112 | fVarManager->FillContainer(fContainer, "hadronicBackground", UInt_t(0), kFALSE); |
8c1c76e9 | 1113 | else if(mctrack){ |
1114 | // Fill Ke3 contributions | |
1115 | Int_t glabel=TMath::Abs(mctrack->GetMother()); | |
1116 | if((mctrackmother = dynamic_cast<AliMCParticle *>(fMCEvent->GetTrack(glabel)))){ | |
1117 | if(TMath::Abs(mctrackmother->Particle()->GetPdgCode())==321) | |
a8ef1999 | 1118 | fQACollection->Fill("Ke3Kecorr",mctrack->Pt(),mctrackmother->Pt()); |
8c1c76e9 | 1119 | else if(TMath::Abs(mctrackmother->Particle()->GetPdgCode())==130) |
a8ef1999 | 1120 | fQACollection->Fill("Ke3K0Lecorr",mctrack->Pt(),mctrackmother->Pt()); |
8c1c76e9 | 1121 | } |
1122 | } | |
faee3b18 | 1123 | } |
1124 | ||
dbe3abbe | 1125 | // Fill Containers |
dbe3abbe | 1126 | if(signal) { |
e3fc062d | 1127 | // Apply weight for background contamination |
8c1c76e9 | 1128 | if(fBackGroundFactorApply) { |
1129 | if(IsPbPb() && fCentralityF >= 0) fWeightBackGround = fkBackGroundFactorArray[fCentralityF >= 0 ? fCentralityF : 0]->Eval(TMath::Abs(track->P())); | |
1130 | else fWeightBackGround = fkBackGroundFactorArray[0]->Eval(TMath::Abs(track->P())); // pp case | |
c2690925 | 1131 | |
8c1c76e9 | 1132 | if(fWeightBackGround < 0.0) fWeightBackGround = 0.0; |
1133 | else if(fWeightBackGround > 1.0) fWeightBackGround = 1.0; | |
3a72645a | 1134 | // weightBackGround as special weight |
c2690925 | 1135 | fVarManager->FillContainer(fContainer, "hadronicBackground", 1, kFALSE, fWeightBackGround); |
dbe3abbe | 1136 | } |
3a72645a | 1137 | fVarManager->FillCorrelationMatrix(fContainer->GetCorrelationMatrix("correlationstepafterPID")); |
dbe3abbe | 1138 | } |
1139 | ||
fd6b8522 | 1140 | Bool_t bTagged=kFALSE; |
faee3b18 | 1141 | if(GetPlugin(kSecVtx)) { |
9bcfd1ab | 1142 | AliDebug(2, "Running Secondary Vertex Analysis"); |
c2690925 | 1143 | if(fSecVtx->Process(track) && signal) { |
1144 | fVarManager->FillContainer(fContainer, "recTrackContSecvtxReco", AliHFEcuts::kStepHFEcutsSecvtx, kFALSE); | |
1145 | fVarManager->FillContainer(fContainer, "recTrackContSecvtxMC", AliHFEcuts::kStepHFEcutsSecvtx, kTRUE); | |
e156c3bb | 1146 | bTagged=kTRUE; |
c2690925 | 1147 | } |
78ea5ef4 | 1148 | } |
9bcfd1ab | 1149 | |
1150 | if(HasMCData()){ | |
3a72645a | 1151 | dataE[0] = track->Pt(); |
1152 | dataE[1] = track->Eta(); | |
1153 | dataE[2] = track->Phi(); | |
1154 | dataE[3] = track->Charge(); | |
1155 | dataE[4] = -1.; | |
1156 | dataE[5] = -1.; | |
1157 | ||
9bcfd1ab | 1158 | // Track selected: distinguish between true and fake |
1159 | AliDebug(1, Form("Candidate Selected, filling THnSparse, PID: %d\n", mctrack->Particle()->GetPdgCode())); | |
1160 | if((pid = TMath::Abs(mctrack->Particle()->GetPdgCode())) == 11){ | |
3a72645a | 1161 | Int_t type = 0; |
1162 | if(fSignalCuts->IsCharmElectron(track)) | |
1163 | type = 1; | |
1164 | else if(fSignalCuts->IsBeautyElectron(track)) | |
1165 | type = 2; | |
9bcfd1ab | 1166 | AliDebug(1, Form("Type: %d\n", type)); |
1167 | if(type){ | |
8c1c76e9 | 1168 | dataE[5] = type; // beauty[1] or charm[2] |
1169 | dataE[4] = 2; // signal electron | |
9bcfd1ab | 1170 | } |
1171 | else{ | |
8c1c76e9 | 1172 | dataE[4] = 1; // not a signal electron |
1173 | dataE[5] = 0; | |
9bcfd1ab | 1174 | } |
1175 | } | |
1176 | else { | |
1177 | // Fill THnSparse with the information for Fake Electrons | |
9bcfd1ab | 1178 | dataE[4] = 0; |
70da6c5a | 1179 | dataE[5] = 0; |
9bcfd1ab | 1180 | } |
1181 | // fill the performance THnSparse, if the mc origin could be defined | |
70da6c5a | 1182 | if(dataE[4] > -1){ |
1183 | AliDebug(1, Form("Entries: [%.3f|%.3f|%.3f|%f|%f|%f]\n", dataE[0],dataE[1],dataE[2],dataE[3],dataE[4],dataE[5])); | |
3a72645a | 1184 | fQACollection->Fill("PIDperformance", dataE); |
9bcfd1ab | 1185 | } |
259c3296 | 1186 | } |
8c1c76e9 | 1187 | |
9bcfd1ab | 1188 | // Electron background analysis |
1189 | if (GetPlugin(kIsElecBackGround)) { | |
1190 | ||
1191 | AliDebug(2, "Running BackGround Analysis"); | |
1192 | ||
1193 | for(Int_t jtrack = 0; jtrack < fESD->GetNumberOfTracks(); jtrack++){ | |
fd6b8522 | 1194 | htrack = fESD->GetTrack(jtrack); |
8c1c76e9 | 1195 | if ( itrack == jtrack ) continue; |
1196 | fElecBackGround->PairAnalysis(track, htrack); | |
9bcfd1ab | 1197 | } |
1198 | } // end of electron background analysis | |
1199 | ||
3a72645a | 1200 | if (GetPlugin(kDEstep)) { |
8c1c76e9 | 1201 | Double_t weightElecBgV0[kBgLevels] = {0.,0.,0.,}; |
1202 | Int_t elecSource = 0; | |
8c1c76e9 | 1203 | Double_t hfeimpactR=0., hfeimpactnsigmaR=0.; |
1204 | fExtraCuts->GetHFEImpactParameters(track, hfeimpactR, hfeimpactnsigmaR); | |
a8ef1999 | 1205 | if(HasMCData()) |
1206 | { | |
0e30407a | 1207 | if(mctrack && (TMath::Abs(mctrack->Particle()->GetPdgCode()) != 11)){ |
1208 | fQACollection->Fill("hadronsBeforeIPcut",track->Pt()); | |
1209 | } | |
a8ef1999 | 1210 | if(fMCQA && signal) { |
8c1c76e9 | 1211 | |
a8ef1999 | 1212 | fMCQA->SetContainerStep(0); |
8c1c76e9 | 1213 | for(Int_t iLevel = 0; iLevel < kBgLevels; iLevel++){ |
1214 | weightElecBgV0[iLevel] = fMCQA->GetWeightFactor(mctrack, iLevel); // positive:conversion e, negative: nonHFE | |
1215 | if(!fisNonHFEsystematics)break; | |
1216 | } | |
1217 | ||
1218 | if(fisNonHFEsystematics){ | |
1219 | //Fill additional containers for electron source distinction | |
1220 | elecSource = fMCQA->GetElecSource(mctrack->Particle()); | |
1221 | const Char_t *sourceName[kElecBgSpecies]={"Pion","Eta","Omega","Phi","EtaPrime","Rho"}; | |
1222 | const Char_t *levelName[kBgLevels]={"Best","Lower","Upper"}; | |
1223 | Int_t iName = 0; | |
1224 | for(Int_t iSource = AliHFEmcQA::kPi0; iSource <= AliHFEmcQA::kGammaRho0; iSource++){ | |
1225 | if((iSource == AliHFEmcQA::kElse)||(iSource == AliHFEmcQA::kMisID)) continue; | |
1226 | if(elecSource == iSource){ | |
1227 | for(Int_t iLevel = 0; iLevel < kBgLevels; iLevel++){ | |
1228 | if(weightElecBgV0[iLevel]>0) fVarManager->FillContainer(fContainer, Form("conversionElecs%s%s",sourceName[iName], levelName[iLevel]), 0, kFALSE, weightElecBgV0[iLevel]); | |
1229 | else if(weightElecBgV0[iLevel]<0) fVarManager->FillContainer(fContainer, Form("mesonElecs%s%s",sourceName[iName], levelName[iLevel]), 0, kFALSE, -1*weightElecBgV0[iLevel]); | |
1230 | } | |
1231 | break; | |
1232 | } | |
1233 | iName++; | |
1234 | if(iName == kElecBgSpecies)iName = 0; | |
1235 | } | |
1236 | } | |
1237 | //else{ | |
a8ef1999 | 1238 | if(weightElecBgV0[0]>0) { |
1239 | fVarManager->FillContainer(fContainer, "conversionElecs", 0, kFALSE, weightElecBgV0[0]); | |
1240 | fVarManager->FillContainer(fContainer, "conversionElecs", 5, kTRUE, weightElecBgV0[0]); | |
1241 | } | |
1242 | else if(weightElecBgV0[0]<0) { | |
1243 | fVarManager->FillContainer(fContainer, "mesonElecs", 0, kFALSE, -1*weightElecBgV0[0]); | |
1244 | fVarManager->FillContainer(fContainer, "mesonElecs", 5, kTRUE, -1*weightElecBgV0[0]); | |
1245 | } | |
e17c1f86 | 1246 | //} |
1247 | if(bTagged){ // bg estimation for the secondary vertex tagged signals | |
1248 | if(weightElecBgV0[0]>0) fVarManager->FillContainer(fContainer, "conversionElecs", 2, kFALSE, weightElecBgV0[0]); | |
1249 | else if(weightElecBgV0[0]<0) fVarManager->FillContainer(fContainer, "mesonElecs", 2, kFALSE, -1*weightElecBgV0[0]); | |
1250 | } | |
8c1c76e9 | 1251 | } |
a8ef1999 | 1252 | } // end of MC |
1253 | ||
0e30407a | 1254 | dataDca[0]=-1; //for data, don't know the origin |
a8ef1999 | 1255 | dataDca[1]=track->Pt(); |
1256 | dataDca[2]=hfeimpactR; | |
0e30407a | 1257 | dataDca[3]=fCentralityF; |
1258 | dataDca[4] = v0pid; | |
1259 | dataDca[5] = double(track->Charge()); | |
a8ef1999 | 1260 | if (!HasMCData()) fQACollection->Fill("Dca", dataDca); |
a8ef1999 | 1261 | |
3a72645a | 1262 | // Fill Containers for impact parameter analysis |
1263 | if(!fCFM->CheckParticleCuts(AliHFEcuts::kStepHFEcutsDca + AliHFEcuts::kNcutStepsMCTrack + AliHFEcuts::kNcutStepsRecTrack,track)) continue; | |
fd6b8522 | 1264 | if(HasMCData()){ |
a8ef1999 | 1265 | if(fMCQA && signal) { |
1266 | fMCQA->SetContainerStep(1); | |
8c1c76e9 | 1267 | for(Int_t iLevel = 0; iLevel < kBgLevels; iLevel++){ |
1268 | weightElecBgV0[iLevel] = fMCQA->GetWeightFactor(mctrack, iLevel); // positive:conversion e, negative: nonHFE | |
1269 | if(!fisNonHFEsystematics)break; | |
1270 | } | |
1271 | if(fisNonHFEsystematics){ | |
1272 | //Fill additional containers for electron source distinction | |
1273 | elecSource = fMCQA->GetElecSource(mctrack->Particle()); | |
1274 | const Char_t *sourceName[kElecBgSpecies]={"Pion","Eta","Omega","Phi","EtaPrime","Rho"}; | |
1275 | const Char_t *levelName[kBgLevels]={"Best","Lower","Upper"}; | |
1276 | Int_t iName = 0; | |
1277 | for(Int_t iSource = AliHFEmcQA::kPi0; iSource <= AliHFEmcQA::kGammaRho0; iSource++){ | |
1278 | if((iSource == AliHFEmcQA::kElse)||(iSource == AliHFEmcQA::kMisID)) continue; | |
1279 | if(elecSource == iSource){ | |
1280 | for(Int_t iLevel = 0; iLevel < kBgLevels; iLevel++){ | |
1281 | if(weightElecBgV0[iLevel]>0) fVarManager->FillContainer(fContainer, Form("conversionElecs%s%s",sourceName[iName], levelName[iLevel]), 1, kFALSE, weightElecBgV0[iLevel]); | |
1282 | else if(weightElecBgV0[iLevel]<0) fVarManager->FillContainer(fContainer, Form("mesonElecs%s%s",sourceName[iName], levelName[iLevel]), 1, kFALSE, -1*weightElecBgV0[iLevel]); | |
1283 | } | |
1284 | break; | |
1285 | } | |
1286 | iName++; | |
1287 | if(iName == kElecBgSpecies)iName = 0; | |
1288 | } | |
1289 | } | |
1290 | // else{ | |
a8ef1999 | 1291 | if(weightElecBgV0[0]>0) { |
1292 | fVarManager->FillContainer(fContainer, "conversionElecs", 1, kFALSE, weightElecBgV0[0]); | |
1293 | fVarManager->FillContainer(fContainer, "conversionElecs", 6, kTRUE, weightElecBgV0[0]); | |
1294 | } | |
1295 | else if(weightElecBgV0[0]<0) { | |
1296 | fVarManager->FillContainer(fContainer, "mesonElecs", 1, kFALSE, -1*weightElecBgV0[0]); | |
1297 | fVarManager->FillContainer(fContainer, "mesonElecs", 6, kTRUE, -1*weightElecBgV0[0]); | |
1298 | } | |
8c1c76e9 | 1299 | //} |
1300 | } | |
fd6b8522 | 1301 | } |
3a72645a | 1302 | if(signal) { |
1303 | fVarManager->FillContainer(fContainer, "recTrackContDEReco", AliHFEcuts::kStepHFEcutsDca, kFALSE); | |
1304 | fVarManager->FillContainer(fContainer, "recTrackContDEMC", AliHFEcuts::kStepHFEcutsDca, kTRUE); | |
1305 | fVarManager->FillCorrelationMatrix(fContainer->GetCorrelationMatrix("correlationstepafterDE")); | |
1306 | } | |
1307 | if(HasMCData()){ | |
6555e2ad | 1308 | if(mctrack && (TMath::Abs(mctrack->Particle()->GetPdgCode()) != 11)){ |
6555e2ad | 1309 | fQACollection->Fill("hadronsAfterIPcut",track->Pt()); |
6555e2ad | 1310 | } |
3a72645a | 1311 | } |
1312 | } | |
1313 | ||
dbe3abbe | 1314 | } |
3a72645a | 1315 | fQACollection->Fill("nElectronTracksEvent", nElectronCandidates); |
809a4336 | 1316 | } |
1317 | ||
1318 | //____________________________________________________________ | |
9bcfd1ab | 1319 | void AliAnalysisTaskHFE::ProcessAOD(){ |
dbe3abbe | 1320 | // |
9bcfd1ab | 1321 | // Run Analysis in AOD Mode |
1322 | // Function is still in development | |
dbe3abbe | 1323 | // |
11ff28c5 | 1324 | //printf("Process AOD\n"); |
9bcfd1ab | 1325 | AliDebug(3, "Processing AOD Event"); |
c2690925 | 1326 | Double_t eventContainer[4]; |
1327 | if(HasMCData()) eventContainer[0] = fVz; | |
1328 | else { | |
1329 | eventContainer[0] = fInputEvent->GetPrimaryVertex()->GetZ(); | |
1330 | } | |
69ac0e6f | 1331 | eventContainer[1] = 1.; // No Information available in AOD analysis, assume all events have V0AND |
bf892a6a | 1332 | eventContainer[2] = fCentralityF; |
c2690925 | 1333 | eventContainer[3] = fContributors; |
bf892a6a | 1334 | |
11ff28c5 | 1335 | //printf("value event container %f, %f, %f, %f\n",eventContainer[0],eventContainer[1],eventContainer[2],eventContainer[3]); |
1336 | ||
d2af20c5 | 1337 | AliAODEvent *fAOD = dynamic_cast<AliAODEvent *>(fInputEvent); |
9bcfd1ab | 1338 | if(!fAOD){ |
13242232 | 1339 | AliError("AOD Event required for AOD Analysis"); |
e156c3bb | 1340 | return; |
9bcfd1ab | 1341 | } |
3a72645a | 1342 | |
11ff28c5 | 1343 | //printf("Will fill\n"); |
3a72645a | 1344 | // |
1345 | fCFM->GetEventContainer()->Fill(eventContainer, AliHFEcuts::kEventStepRecNoCut); | |
11ff28c5 | 1346 | //printf("Fill\n"); |
3a72645a | 1347 | // |
1348 | if(fIdentifiedAsPileUp) return; | |
1349 | fCFM->GetEventContainer()->Fill(eventContainer, AliHFEcuts::kEventStepRecNoPileUp); | |
1350 | ||
1351 | // | |
1352 | if(fIdentifiedAsOutInz) return; | |
1353 | fCFM->GetEventContainer()->Fill(eventContainer, AliHFEcuts::kEventStepZRange); | |
1354 | ||
1355 | // | |
1356 | if(!fPassTheEventCut) return; | |
1357 | fCFM->GetEventContainer()->Fill(eventContainer, AliHFEcuts::kEventStepReconstructed); | |
11ff28c5 | 1358 | //printf("pass\n"); |
3a72645a | 1359 | |
1360 | fContainer->NewEvent(); | |
0e30407a | 1361 | |
1362 | // Look for kink mother | |
1363 | Int_t numberofvertices = fAOD->GetNumberOfVertices(); | |
1364 | Double_t listofmotherkink[numberofvertices]; | |
1365 | Int_t numberofmotherkink = 0; | |
1366 | for(Int_t ivertex=0; ivertex < numberofvertices; ivertex++) { | |
1367 | AliAODVertex *aodvertex = fAOD->GetVertex(ivertex); | |
1368 | if(!aodvertex) continue; | |
1369 | if(aodvertex->GetType()==AliAODVertex::kKink) { | |
1370 | AliAODTrack *mother = (AliAODTrack *) aodvertex->GetParent(); | |
1371 | if(!mother) continue; | |
1372 | Int_t idmother = mother->GetID(); | |
1373 | listofmotherkink[numberofmotherkink] = idmother; | |
1374 | //printf("ID %d\n",idmother); | |
1375 | numberofmotherkink++; | |
1376 | } | |
1377 | } | |
1378 | //printf("Number of kink mother in the events %d\n",numberofmotherkink); | |
1379 | ||
1380 | ||
1381 | // Loop over tracks | |
9bcfd1ab | 1382 | AliAODTrack *track = NULL; |
1383 | AliAODMCParticle *mctrack = NULL; | |
70da6c5a | 1384 | Double_t dataE[6]; // [pT, eta, Phi, Charge, type, 'C' or 'B'] |
9bcfd1ab | 1385 | Int_t nElectronCandidates = 0; |
1386 | Int_t pid; | |
3a72645a | 1387 | Bool_t signal; |
11ff28c5 | 1388 | //printf("Number of track %d\n",(Int_t) fAOD->GetNumberOfTracks()); |
9bcfd1ab | 1389 | for(Int_t itrack = 0; itrack < fAOD->GetNumberOfTracks(); itrack++){ |
f9f097c0 | 1390 | track = fAOD->GetTrack(itrack); mctrack = NULL; |
9bcfd1ab | 1391 | if(!track) continue; |
11ff28c5 | 1392 | if(fUseFlagAOD){ |
1393 | if(track->GetFlags() != fFlags) continue; // Only process AOD tracks where the HFE is set | |
1394 | } | |
1395 | //printf("Pass the flag\n"); | |
9bcfd1ab | 1396 | |
3a72645a | 1397 | signal = kTRUE; |
9bcfd1ab | 1398 | if(HasMCData()){ |
faee3b18 | 1399 | |
9bcfd1ab | 1400 | Int_t label = TMath::Abs(track->GetLabel()); |
3a72645a | 1401 | if(label) |
d2af20c5 | 1402 | mctrack = dynamic_cast<AliAODMCParticle *>(fMCEvent->GetTrack(label)); |
3a72645a | 1403 | if(fFillSignalOnly && !fCFM->CheckParticleCuts(AliHFEcuts::kStepMCGenerated, mctrack)) signal = kFALSE; |
9bcfd1ab | 1404 | } |
3a72645a | 1405 | fVarManager->NewTrack(track, mctrack, fCentralityF, -1, kTRUE); |
11ff28c5 | 1406 | |
1407 | if(fFillNoCuts) { | |
1408 | if(signal || !fFillSignalOnly){ | |
1409 | fVarManager->FillContainer(fContainer, "recTrackContReco", AliHFEcuts::kStepRecNoCut, kFALSE); | |
1410 | fVarManager->FillContainer(fContainer, "recTrackContMC", AliHFEcuts::kStepRecNoCut, kTRUE); | |
1411 | } | |
1412 | } | |
1413 | ||
1414 | if(fApplyCutAOD) { | |
1415 | // RecKine: ITSTPC cuts | |
1416 | if(!ProcessCutStep(AliHFEcuts::kStepRecKineITSTPC, track)) continue; | |
0e30407a | 1417 | |
1418 | // Reject kink mother | |
1419 | Bool_t kinkmotherpass = kTRUE; | |
1420 | for(Int_t kinkmother = 0; kinkmother < numberofmotherkink; kinkmother++) { | |
1421 | if(track->GetID() == listofmotherkink[kinkmother]) { | |
1422 | kinkmotherpass = kFALSE; | |
1423 | continue; | |
1424 | } | |
1425 | } | |
1426 | if(!kinkmotherpass) continue; | |
11ff28c5 | 1427 | |
1428 | // RecPrim | |
1429 | if(!ProcessCutStep(AliHFEcuts::kStepRecPrim, track)) continue; | |
1430 | ||
1431 | // HFEcuts: ITS layers cuts | |
1432 | if(!ProcessCutStep(AliHFEcuts::kStepHFEcutsITS, track)) continue; | |
1433 | ||
1434 | // HFE cuts: TOF PID and mismatch flag | |
1435 | if(!ProcessCutStep(AliHFEcuts::kStepHFEcutsTOF, track)) continue; | |
1436 | ||
1437 | // HFE cuts: TPC PID cleanup | |
1438 | if(!ProcessCutStep(AliHFEcuts::kStepHFEcutsTPC, track)) continue; | |
1439 | ||
1440 | // HFEcuts: Nb of tracklets TRD0 | |
1441 | if(!ProcessCutStep(AliHFEcuts::kStepHFEcutsTRD, track)) continue; | |
1442 | } | |
1443 | ||
1444 | // Fill correlation maps before PID | |
1445 | if(signal && fContainer->GetCorrelationMatrix("correlationstepbeforePID")) { | |
1446 | //printf("Fill correlation maps before PID\n"); | |
1447 | fVarManager->FillCorrelationMatrix(fContainer->GetCorrelationMatrix("correlationstepbeforePID")); | |
1448 | } | |
1449 | ||
1450 | //printf("Will process to PID\n"); | |
1451 | ||
9bcfd1ab | 1452 | // track accepted, do PID |
1453 | AliHFEpidObject hfetrack; | |
3a72645a | 1454 | hfetrack.SetAnalysisType(AliHFEpidObject::kAODanalysis); |
1455 | hfetrack.SetRecTrack(track); | |
1456 | if(HasMCData()) hfetrack.SetMCTrack(mctrack); | |
1457 | hfetrack.SetCentrality(fCentralityF); | |
11ff28c5 | 1458 | if(IsPbPb()) hfetrack.SetPbPb(); |
1459 | else hfetrack.SetPP(); | |
3a72645a | 1460 | fPID->SetVarManager(fVarManager); |
1461 | if(!fPID->IsSelected(&hfetrack, fContainer, "recTrackCont", fPIDqa)) continue; // we will do PID here as soon as possible | |
c2690925 | 1462 | |
11ff28c5 | 1463 | |
1464 | // Apply weight for background contamination | |
1465 | //Double_t weightBackGround = 1.0; | |
1466 | if(signal) { | |
1467 | // Apply weight for background contamination | |
1468 | if(fBackGroundFactorApply) { | |
1469 | if(IsPbPb() && fCentralityF >= 0) fWeightBackGround = fkBackGroundFactorArray[fCentralityF >= 0 ? fCentralityF : 0]->Eval(TMath::Abs(track->P())); | |
1470 | else fWeightBackGround = fkBackGroundFactorArray[0]->Eval(TMath::Abs(track->P())); // pp case | |
1471 | ||
1472 | if(fWeightBackGround < 0.0) fWeightBackGround = 0.0; | |
1473 | else if(fWeightBackGround > 1.0) fWeightBackGround = 1.0; | |
1474 | // weightBackGround as special weight | |
1475 | fVarManager->FillContainer(fContainer, "hadronicBackground", 1, kFALSE, fWeightBackGround); | |
1476 | } | |
1477 | fVarManager->FillCorrelationMatrix(fContainer->GetCorrelationMatrix("correlationstepafterPID")); | |
e3fc062d | 1478 | } |
11ff28c5 | 1479 | |
9bcfd1ab | 1480 | nElectronCandidates++; |
1481 | if(HasMCData()){ | |
3a72645a | 1482 | dataE[0] = track->Pt(); |
1483 | dataE[1] = track->Eta(); | |
1484 | dataE[2] = track->Phi(); | |
1485 | dataE[3] = track->Charge(); | |
1486 | dataE[4] = -1; | |
1487 | dataE[5] = -1; | |
c2690925 | 1488 | // Track selected: distinguish between true and fake |
f9f097c0 | 1489 | AliDebug(1, Form("Candidate Selected, filling THnSparse, PID: %d\n", mctrack ? mctrack->GetPdgCode(): -1)); |
1490 | if(mctrack && ((pid = TMath::Abs(mctrack->GetPdgCode())) == 11)){ | |
3a72645a | 1491 | |
1492 | Int_t type = 0; | |
1493 | if(fSignalCuts->IsCharmElectron(track)) | |
1494 | type = 1; | |
1495 | else if(fSignalCuts->IsBeautyElectron(track)) | |
1496 | type = 2; | |
9bcfd1ab | 1497 | AliDebug(1, Form("Type: %d\n", type)); |
1498 | if(type){ | |
8c1c76e9 | 1499 | dataE[5] = type; // beauty[1] or charm[2] |
1500 | dataE[4] = 2; // signal electron | |
9bcfd1ab | 1501 | } |
1502 | else{ | |
8c1c76e9 | 1503 | dataE[4] = 1; // not a signal electron |
1504 | dataE[5] = 0; | |
9bcfd1ab | 1505 | } |
1506 | } | |
1507 | else { | |
1508 | // Fill THnSparse with the information for Fake Electrons | |
9bcfd1ab | 1509 | dataE[4] = 0; |
70da6c5a | 1510 | dataE[5] = 0; |
9bcfd1ab | 1511 | } |
1512 | // fill the performance THnSparse, if the mc origin could be defined | |
70da6c5a | 1513 | if(dataE[4] > -1){ |
1514 | AliDebug(1, Form("Entries: [%.3f|%.3f|%.3f|%f|%f|%f]\n", dataE[0],dataE[1],dataE[2],dataE[3],dataE[4],dataE[5])); | |
3a72645a | 1515 | fQACollection->Fill("PIDperformance", dataE); |
9bcfd1ab | 1516 | } |
6ad05e72 | 1517 | } |
6ad05e72 | 1518 | } |
3a72645a | 1519 | fQACollection->Fill("nElectronTracksEvent", nElectronCandidates); |
6ad05e72 | 1520 | } |
1521 | ||
1522 | //____________________________________________________________ | |
9bcfd1ab | 1523 | Bool_t AliAnalysisTaskHFE::ProcessMCtrack(AliVParticle *track){ |
6ad05e72 | 1524 | // |
9bcfd1ab | 1525 | // Filter the Monte Carlo Track |
1526 | // Additionally Fill a THnSparse for Signal To Background Studies | |
1527 | // Works for AOD and MC analysis Type | |
6ad05e72 | 1528 | // |
c2690925 | 1529 | fVarManager->NewTrack(track, NULL, fCentralityF, -1, kTRUE); |
3a72645a | 1530 | Double_t signalContainer[6]; |
9bcfd1ab | 1531 | |
3a72645a | 1532 | signalContainer[0] = track->Pt(); |
1533 | signalContainer[1] = track->Eta(); | |
1534 | signalContainer[2] = track->Phi(); | |
1535 | signalContainer[3] = track->Charge()/3; | |
9bcfd1ab | 1536 | |
965de368 | 1537 | 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) |
3a72645a | 1538 | if(IsESDanalysis()){ |
1539 | AliMCParticle *mctrack = dynamic_cast<AliMCParticle *>(track); | |
bf892a6a | 1540 | if(mctrack){ |
1541 | vertex[0] = mctrack->Particle()->Vx(); | |
1542 | vertex[1] = mctrack->Particle()->Vy(); | |
1543 | } | |
9bcfd1ab | 1544 | } else { |
1545 | AliAODMCParticle *aodmctrack = dynamic_cast<AliAODMCParticle *>(track); | |
bf892a6a | 1546 | if(aodmctrack) aodmctrack->XvYvZv(vertex); |
6ad05e72 | 1547 | } |
3a72645a | 1548 | |
1549 | if(!fCFM->CheckParticleCuts(AliHFEcuts::kStepMCGenerated, track)) return kFALSE; | |
3a72645a | 1550 | fVarManager->FillContainer(fContainer, "MCTrackCont", AliHFEcuts::kStepMCGenerated, kFALSE); |
1551 | signalContainer[4] = 0; | |
1552 | if(fSignalCuts->IsSelected(track)){ | |
1553 | //fVarManager->FillContainer(fContainer, "MCTrackCont", AliHFEcuts::kStepMCsignal, kFALSE); | |
1554 | // Filling of the Signal/Background histogram using the | |
1555 | // definition of the codes for charm and beauty as below in | |
1556 | // th crearion of the histogram | |
1557 | if(fSignalCuts->IsCharmElectron(track)) | |
1558 | signalContainer[4] = 1; | |
1559 | else | |
1560 | signalContainer[4] = 2; | |
1561 | } else { | |
1562 | signalContainer[4] = 0; // (and other background) | |
1563 | } | |
70da6c5a | 1564 | signalContainer[5] = 0; |
9bcfd1ab | 1565 | // apply cut on the sqrt of the production vertex |
1566 | Double_t radVertex = TMath::Sqrt(vertex[0]*vertex[0] + vertex[1] * vertex[1]); | |
1567 | if(radVertex < 3.5){ | |
1568 | // Within first ITS layer(2) -> Background we cannot reject by ITS cut, let it pass | |
70da6c5a | 1569 | signalContainer[5] = 1; |
9bcfd1ab | 1570 | } else if (radVertex < 7.5){ |
70da6c5a | 1571 | signalContainer[5] = 2; |
9bcfd1ab | 1572 | } |
3a72645a | 1573 | fQACollection->Fill("SignalToBackgroundMC", signalContainer); |
3a72645a | 1574 | |
1575 | // Step GeneratedZOutNoPileUp | |
e156c3bb | 1576 | if((fIdentifiedAsPileUp) || (TMath::Abs(fVz) > fCuts->GetVertexRange()) || (fCentralityF < 0)) return kFALSE; |
c2690925 | 1577 | fVarManager->FillContainer(fContainer, "MCTrackCont", AliHFEcuts::kStepMCGeneratedZOutNoPileUpCentralityFine, kFALSE); |
1578 | //printf("In ProcessMCtrack %f\n",fCentralityF); | |
3a72645a | 1579 | |
1580 | // Step Generated Event Cut | |
1581 | if(!fPassTheEventCut) return kFALSE; | |
1582 | fVarManager->FillContainer(fContainer, "MCTrackCont", AliHFEcuts::kStepMCGeneratedEventCut, kFALSE); | |
1583 | ||
1584 | if(!fCFM->CheckParticleCuts(AliHFEcuts::kStepMCInAcceptance, track)) return kFALSE; | |
1585 | fVarManager->FillContainer(fContainer, "MCTrackCont", AliHFEcuts::kStepMCInAcceptance, kFALSE); | |
9bcfd1ab | 1586 | return kTRUE; |
6ad05e72 | 1587 | } |
1588 | ||
e3fc062d | 1589 | //____________________________________________________________ |
1590 | Bool_t AliAnalysisTaskHFE::PreSelectTrack(AliESDtrack *track) const { | |
1591 | // | |
1592 | // Preselect tracks | |
1593 | // | |
1594 | ||
1595 | ||
1596 | Bool_t survived = kTRUE; | |
1597 | ||
1598 | if(!fCutspreselect->CheckParticleCuts(AliHFEcuts::kStepRecKineITSTPC, track)) { | |
1599 | survived = kFALSE; | |
1600 | //printf("Did not pass AliHFEcuts::kStepRecKineITSTPC\n"); | |
1601 | } | |
1602 | //else printf("Pass AliHFEcuts::kStepRecKineITSTPC\n"); | |
1603 | if(!fCutspreselect->CheckParticleCuts(AliHFEcuts::kStepRecPrim, track)) { | |
1604 | survived = kFALSE; | |
1605 | //printf("Did not pass AliHFEcuts::kStepRecPrim\n"); | |
1606 | } | |
1607 | //else printf("Pass AliHFEcuts::kStepRecPrim\n"); | |
1608 | if(!fCutspreselect->CheckParticleCuts(AliHFEcuts::kStepHFEcutsITS, track)) { | |
1609 | survived = kFALSE; | |
1610 | //printf("Did not pass AliHFEcuts::kStepHFEcutsITS\n"); | |
1611 | } | |
1612 | //else printf("Pass AliHFEcuts::kStepHFEcutsITS\n"); | |
fd6b8522 | 1613 | if(!fCutspreselect->CheckParticleCuts(AliHFEcuts::kStepHFEcutsTOF, track)) { |
1614 | survived = kFALSE; | |
1615 | //printf("Did not pass AliHFEcuts::kStepHFEcutsTOF\n"); | |
1616 | } | |
1617 | //else printf("Pass AliHFEcuts::kStepHFEcutsTOF\n"); | |
e3fc062d | 1618 | if(!fCutspreselect->CheckParticleCuts(AliHFEcuts::kStepHFEcutsTRD, track)) { |
1619 | survived = kFALSE; | |
1620 | //printf("Did not pass AliHFEcuts::kStepHFEcutsTRD\n"); | |
1621 | } | |
1622 | //else printf("Pass AliHFEcuts::kStepHFEcutsTRD\n"); | |
1623 | ||
1624 | if(survived){ | |
1625 | // Apply PID | |
1626 | AliHFEpidObject hfetrack; | |
3a72645a | 1627 | hfetrack.SetAnalysisType(AliHFEpidObject::kESDanalysis); |
1628 | hfetrack.SetRecTrack(track); | |
e3fc062d | 1629 | if(!fPIDpreselect->IsSelected(&hfetrack)) { |
1630 | //printf("Did not pass AliHFEcuts::kPID\n"); | |
1631 | survived = kFALSE; | |
1632 | } | |
1633 | //else printf("Pass AliHFEcuts::kPID\n"); | |
1634 | } | |
1635 | ||
1636 | return survived; | |
1637 | ||
1638 | } | |
70da6c5a | 1639 | //____________________________________________________________ |
1640 | void AliAnalysisTaskHFE::MakeEventContainer(){ | |
1641 | // | |
1642 | // Create the event container for the correction framework and link it | |
3a72645a | 1643 | // 1st bin: Vertex z-position |
1644 | // 2nd bin: V0AND decision (normalization to sigma_inel) | |
c2690925 | 1645 | // 3rd bin: Centrality class (for pp defined as number of contributors in vertex.) |
8c1c76e9 | 1646 | // 4th bin: Number of contributors > 0 |
70da6c5a | 1647 | // |
c2690925 | 1648 | |
8c1c76e9 | 1649 | const Int_t kNvar = 4; // number of variables on the grid: |
1650 | Int_t nBins[kNvar] = {120, 2, 11, 2}; | |
1651 | Double_t binMin[kNvar] = {-30. , 0., 0.0, 0.}; | |
1652 | Double_t binMax[kNvar] = {30., 2., 11.0, 2.}; | |
1653 | ||
1654 | AliCFContainer *evCont = new AliCFContainer("eventContainer", "Container for events", AliHFEcuts::kNcutStepsEvent, kNvar, nBins); | |
c2690925 | 1655 | |
8c1c76e9 | 1656 | Double_t *vertexBins = AliHFEtools::MakeLinearBinning(nBins[0], binMin[0], binMax[0]); |
1657 | Double_t *v0andBins = AliHFEtools::MakeLinearBinning(nBins[1], binMin[1], binMax[1]); | |
1658 | Double_t *centralityBins = AliHFEtools::MakeLinearBinning(nBins[2], binMin[2], binMax[2]); | |
1659 | Double_t *contributorsBins = AliHFEtools::MakeLinearBinning(nBins[3], binMin[3], binMax[3]); | |
1660 | evCont->SetBinLimits(0, vertexBins); | |
1661 | evCont->SetBinLimits(1, v0andBins); | |
1662 | evCont->SetBinLimits(2, centralityBins); | |
1663 | evCont->SetBinLimits(3, contributorsBins); | |
1664 | delete[] vertexBins; delete[] v0andBins; delete[] centralityBins; delete[] contributorsBins; | |
1665 | ||
1666 | fCFM->SetEventContainer(evCont); | |
70da6c5a | 1667 | } |
1668 | ||
809a4336 | 1669 | //____________________________________________________________ |
1670 | void AliAnalysisTaskHFE::MakeParticleContainer(){ | |
1671 | // | |
1672 | // Create the particle container for the correction framework manager and | |
1673 | // link it | |
1674 | // | |
3a72645a | 1675 | if(!fContainer) fContainer = new AliHFEcontainer("trackContainer"); |
1676 | fVarManager->DefineVariables(fContainer); | |
1677 | ||
1678 | // Create Correction Framework containers | |
1679 | fContainer->CreateContainer("MCTrackCont", "Track Container filled with MC information", AliHFEcuts::kNcutStepsMCTrack); | |
1680 | fContainer->CreateContainer("recTrackContReco", "Track Container filled with MC information", AliHFEcuts::kNcutStepsRecTrack + fPID->GetNumberOfPIDdetectors()); | |
1681 | fContainer->CreateContainer("recTrackContMC", "Track Container filled with MC information", AliHFEcuts::kNcutStepsRecTrack + fPID->GetNumberOfPIDdetectors()); | |
1682 | ||
c2690925 | 1683 | fContainer->CreateContainer("hadronicBackground", "Container for Hadronic Background", 2); |
3a72645a | 1684 | fContainer->CreateContainer("recTrackContDEReco", "Container for displaced electron analysis with Reco information", 1); |
1685 | fContainer->CreateContainer("recTrackContDEMC", "Container for displaced electron analysis with MC information", 1); | |
c2690925 | 1686 | fContainer->CreateContainer("recTrackContSecvtxReco", "Container for secondary vertexing analysis with Reco information", 1); |
1687 | fContainer->CreateContainer("recTrackContSecvtxMC", "Container for secondary vertexing analysis with MC information", 1); | |
fd6b8522 | 1688 | |
1689 | if(HasMCData()){ | |
a8ef1999 | 1690 | fContainer->CreateContainer("conversionElecs", "Container for weighted conversion electrons",7); |
1691 | fContainer->CreateContainer("mesonElecs", "Container for weighted electrons from meson decays",7); | |
e17c1f86 | 1692 | fContainer->Sumw2("conversionElecs"); |
1693 | fContainer->Sumw2("mesonElecs"); | |
8c1c76e9 | 1694 | |
1695 | if(fisNonHFEsystematics){ | |
1696 | const Char_t *sourceName[kElecBgSpecies]={"Pion","Eta","Omega","Phi","EtaPrime","Rho"}; | |
1697 | const Char_t *levelName[kBgLevels]={"Best","Lower","Upper"}; | |
1698 | for(Int_t iSource = 0; iSource < kElecBgSpecies; iSource++){ | |
1699 | for(Int_t iLevel = 0; iLevel < kBgLevels; iLevel++){ | |
1700 | 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]),4); | |
1701 | fContainer->CreateContainer(Form("mesonElecs%s%s",sourceName[iSource],levelName[iLevel]), Form("Container for weighted electrons from %s decays, %s level",sourceName[iSource],levelName[iLevel]),4); | |
e17c1f86 | 1702 | fContainer->Sumw2(Form("conversionElecs%s%s",sourceName[iSource],levelName[iLevel])); |
1703 | fContainer->Sumw2(Form("mesonElecs%s%s",sourceName[iSource],levelName[iLevel])); | |
8c1c76e9 | 1704 | } |
1705 | } | |
1706 | } | |
fd6b8522 | 1707 | //fContainer->CreateContainer("charmElecs", "Container for weighted charm electrons",2); |
1708 | } | |
1709 | ||
3a72645a | 1710 | fContainer->CreateCorrelationMatrix("correlationstepafterPID","THnSparse with correlations"); |
1711 | fContainer->CreateCorrelationMatrix("correlationstepafterDE","THnSparse with correlations"); | |
6555e2ad | 1712 | if(!fVarManager->IsVariableDefined("centrality")) { |
1713 | //printf("Create the two other correlation maps\n"); | |
1714 | fContainer->CreateCorrelationMatrix("correlationstepbeforePID","THnSparse with correlations"); | |
1715 | fContainer->CreateCorrelationMatrix("correlationstepafterTOF","THnSparse with correlations"); | |
1716 | } | |
3a72645a | 1717 | |
1718 | // Define the step names | |
1719 | for(UInt_t istep = 0; istep < AliHFEcuts::kNcutStepsMCTrack; istep++){ | |
1720 | fContainer->SetStepTitle("MCTrackCont", AliHFEcuts::MCCutName(istep), istep); | |
faee3b18 | 1721 | } |
3a72645a | 1722 | for(UInt_t istep = 0; istep < AliHFEcuts::kNcutStepsRecTrack; istep++){ |
1723 | fContainer->SetStepTitle("recTrackContReco", AliHFEcuts::RecoCutName(istep), istep); | |
1724 | fContainer->SetStepTitle("recTrackContMC", AliHFEcuts::RecoCutName(istep), istep); | |
259c3296 | 1725 | } |
3a72645a | 1726 | for(UInt_t ipid = 0; ipid < fPID->GetNumberOfPIDdetectors(); ipid++){ |
1727 | fContainer->SetStepTitle("recTrackContReco", fPID->SortedDetectorName(ipid), AliHFEcuts::kNcutStepsRecTrack + ipid); | |
1728 | fContainer->SetStepTitle("recTrackContMC", fPID->SortedDetectorName(ipid), AliHFEcuts::kNcutStepsRecTrack + ipid); | |
259c3296 | 1729 | } |
3a72645a | 1730 | } |
1731 | ||
1732 | //____________________________________________________________ | |
1733 | void AliAnalysisTaskHFE::InitPIDperformanceQA(){ | |
259c3296 | 1734 | // Add a histogram for Fake electrons |
70da6c5a | 1735 | const Int_t nDim=6; |
1736 | Int_t nBin[nDim] = {40, 8, 18, 2, 3, 3}; | |
3a72645a | 1737 | //number of variables on the grid:pt,eta,phi,charge, |
1738 | const Double_t kPtbound[2] = {0.1, 20.}; | |
1739 | const Double_t kEtabound[2] = {-0.8, 0.8}; | |
1740 | const Double_t kPhibound[2] = {0., 2. * TMath::Pi()}; | |
1741 | const Double_t kChargebound[2] = {-1.1, 1.1}; | |
1742 | const Double_t kAddInf1bound[2] = {0., 3.}; | |
1743 | const Double_t kAddInf2bound[2] = {0., 3.}; | |
1744 | Double_t minima[nDim] = {kPtbound[0], kEtabound[0], kPhibound[0], kChargebound[0], kAddInf1bound[0], kAddInf2bound[0]}; | |
1745 | Double_t maxima[nDim] = {kPtbound[1], kEtabound[1], kPhibound[1], kChargebound[1], kAddInf1bound[1], kAddInf2bound[1]}; | |
1746 | ||
1747 | fQACollection->CreateTHnSparse("PIDperformance", "PID performance; pT [GeV/c]; theta [rad]; phi [rad]; charge; type (0 - not el, 1 - other el, 2 - HF el; flavor (0 - no, 1 - charm, 2 - bottom)", nDim, nBin, minima, maxima); | |
1748 | fQACollection->CreateTHnSparse("SignalToBackgroundMC", "PID performance; pT [GeV/c]; theta [rad]; phi [rad]; charge; flavor (0 - no, 1 - charm, 2 - bottom); ITS Cluster (0 - no, 1 - first (and maybe second), 2 - second)", nDim, nBin, minima, maxima); | |
dbe3abbe | 1749 | |
3a72645a | 1750 | fQACollection->BinLogAxis("PIDperformance", 0); |
1751 | fQACollection->BinLogAxis("SignalToBackgroundMC", 0); | |
1752 | fQACollection->Sumw2("PIDperformance"); | |
1753 | fQACollection->Sumw2("SignalToBackgroundMC"); | |
75d81601 | 1754 | } |
1755 | ||
6555e2ad | 1756 | //____________________________________________________________ |
1757 | void AliAnalysisTaskHFE::InitContaminationQA(){ | |
c2690925 | 1758 | // |
1759 | // Add QA for Impact Parameter cut | |
1760 | // | |
a8ef1999 | 1761 | |
1762 | TObjArray *array = fVarManager->GetVariables(); | |
1763 | Int_t nvars = array->GetEntriesFast(); | |
1764 | for(Int_t v = 0; v < nvars; v++) { | |
1765 | AliHFEvarManager::AliHFEvariable *variable = (AliHFEvarManager::AliHFEvariable *) array->At(v); | |
1766 | if(!variable) continue; | |
1767 | TString name(((AliHFEvarManager::AliHFEvariable *)variable)->GetName()); | |
1768 | if(!name.CompareTo("pt")) { | |
1769 | const Int_t nBinPt = variable->GetNumberOfBins(); | |
1770 | const Double_t *kPtRange = variable->GetBinning(); | |
1771 | ||
1772 | fQACollection->CreateTH1Farray("hadronsBeforeIPcut", "Hadrons before IP cut", nBinPt, kPtRange); | |
1773 | fQACollection->CreateTH1Farray("hadronsAfterIPcut", "Hadrons after IP cut", nBinPt, kPtRange); | |
a8ef1999 | 1774 | |
1775 | fQACollection->CreateTH2Farray("Ke3Kecorr", "Ke3 decay e and K correlation; Ke3K p_{t}; Ke3e p_{t}; ", nBinPt, kPtRange, 20,0.,20.); | |
1776 | fQACollection->CreateTH2Farray("Ke3K0Lecorr", "Ke3 decay e and K0L correlation; Ke3K0L p_{t}; Ke3e p_{t}; ", nBinPt, kPtRange, 20,0.,20.); | |
1777 | fQACollection->CreateTH1Farray("Kptspectra", "Charged Kaons: MC p_{t} ", nBinPt, kPtRange); | |
1778 | fQACollection->CreateTH1Farray("K0Lptspectra", "K0L: MC p_{t} ", nBinPt, kPtRange); | |
1779 | ||
0e30407a | 1780 | const Double_t kDCAbound[2] = {-0.2, 0.2}; |
a8ef1999 | 1781 | |
0e30407a | 1782 | const Int_t nDimDca=6; |
1783 | const Int_t nBinDca[nDimDca] = { 8, nBinPt, 800, 12, 6, 2}; | |
1784 | Double_t minimaDca[nDimDca] = { -1., 0., kDCAbound[0], -1., -1, -1.1}; | |
1785 | Double_t maximaDca[nDimDca] = { 7., 20., kDCAbound[1], 11., 5, 1.1}; | |
a8ef1999 | 1786 | |
1787 | Double_t *sourceBins = AliHFEtools::MakeLinearBinning(nBinDca[0], minimaDca[0], maximaDca[0]); | |
1788 | Double_t *dcaBins = AliHFEtools::MakeLinearBinning(nBinDca[2], minimaDca[2], maximaDca[2]); | |
0e30407a | 1789 | Double_t *centralityBins = AliHFEtools::MakeLinearBinning(nBinDca[3], minimaDca[3], maximaDca[3]); |
1790 | Double_t *v0PIDBins = AliHFEtools::MakeLinearBinning(nBinDca[4], minimaDca[4], maximaDca[4]); | |
1791 | Double_t *chargeBins = AliHFEtools::MakeLinearBinning(nBinDca[5], minimaDca[5], maximaDca[5]); | |
a8ef1999 | 1792 | |
0e30407a | 1793 | fQACollection->CreateTHnSparseNoLimits("Dca", "Dca; source (0-all, 1-charm,etc); pT [GeV/c]; dca; centrality bin; v0pid; charge", nDimDca, nBinDca); |
a8ef1999 | 1794 | ((THnSparse*)(fQACollection->Get("Dca")))->SetBinEdges(0, sourceBins); |
1795 | ((THnSparse*)(fQACollection->Get("Dca")))->SetBinEdges(1, kPtRange); | |
1796 | ((THnSparse*)(fQACollection->Get("Dca")))->SetBinEdges(2, dcaBins); | |
0e30407a | 1797 | ((THnSparse*)(fQACollection->Get("Dca")))->SetBinEdges(3, centralityBins); |
1798 | ((THnSparse*)(fQACollection->Get("Dca")))->SetBinEdges(4, v0PIDBins); | |
1799 | ((THnSparse*)(fQACollection->Get("Dca")))->SetBinEdges(5, chargeBins); | |
a8ef1999 | 1800 | |
1801 | break; | |
1802 | } | |
1803 | } | |
1804 | ||
8c1c76e9 | 1805 | } |
1806 | ||
1807 | //____________________________________________________________ | |
1808 | void AliAnalysisTaskHFE::InitHistoITScluster(){ | |
1809 | // | |
1810 | // Initialize a temporary histogram to monitor the chi2/ITS cluster | |
1811 | if(IsPbPb()) { | |
1812 | const Int_t kNDim = 7; | |
1813 | const Int_t kNBins[kNDim] = {88, 20,90,11, 160, 2, 1000}; | |
1814 | const Double_t kMin[kNDim] = {0.1, -1,0, 0.,0., 0, 0.}; | |
1815 | const Double_t kMax[kNDim] = {20., 1, 2.*TMath::Pi(), 11.,160, 2, 100.}; | |
1816 | fQACollection->CreateTHnSparse("fChi2perITScluster", "chi2/ITS cluster; p_{T} (GeV/c);eta;phi; centrality class;nclus;sharebit; #chi^{2}/ITS cluster", kNDim, kNBins, kMin, kMax); | |
1817 | fQACollection->BinLogAxis("fChi2perITScluster", 0); | |
1818 | } | |
1819 | else | |
1820 | { | |
1821 | const Int_t kNDim = 3; | |
1822 | const Int_t kNBins[kNDim] = {44, 11, 1000}; | |
1823 | const Double_t kMin[kNDim] = {0.1, 0., 0.}; | |
1824 | const Double_t kMax[kNDim] = {20., 11., 100.}; | |
1825 | fQACollection->CreateTHnSparse("fChi2perITScluster", "chi2/ITS cluster; p_{T} (GeV/c); centrality class; #chi^{2}/ITS cluster", kNDim, kNBins, kMin, kMax); | |
1826 | fQACollection->BinLogAxis("fChi2perITScluster", 0); | |
1827 | } | |
1828 | } | |
1829 | ||
1830 | //____________________________________________________________ | |
1831 | void AliAnalysisTaskHFE::SelectSpecialTrigger(const Char_t *trgclust, Int_t runMin, Int_t runMax){ | |
1832 | // | |
1833 | // Select only events triggered by a special trigeer cluster | |
1834 | // | |
1835 | if(!fSpecialTrigger) fSpecialTrigger = new AliOADBContainer("SpecialTrigger"); | |
1836 | fSpecialTrigger->AppendObject(new TObjString(trgclust), runMin, runMax); | |
1837 | } | |
1838 | ||
1839 | //____________________________________________________________ | |
1840 | const Char_t * AliAnalysisTaskHFE::GetSpecialTrigger(Int_t run){ | |
1841 | // | |
1842 | // Derive selected trigger string for given run | |
1843 | // | |
1844 | if(!fSpecialTrigger) return NULL; | |
1845 | TObjString *trg = dynamic_cast<TObjString *>(fSpecialTrigger->GetObject(run)); | |
1846 | if(!trg) return NULL; | |
1847 | return trg->String().Data(); | |
6555e2ad | 1848 | } |
1849 | ||
75d81601 | 1850 | //____________________________________________________________ |
50685501 | 1851 | void AliAnalysisTaskHFE::PrintStatus() const { |
78ea5ef4 | 1852 | // |
1853 | // Print Analysis status | |
1854 | // | |
75d81601 | 1855 | printf("\n\tAnalysis Settings\n\t========================================\n\n"); |
9bcfd1ab | 1856 | printf("\tSecondary Vertex finding: %s\n", GetPlugin(kSecVtx) ? "YES" : "NO"); |
1857 | printf("\tPrimary Vertex resolution: %s\n", GetPlugin(kPriVtx) ? "YES" : "NO"); | |
3a72645a | 1858 | printf("\tDisplaced electron analysis step: %s\n", GetPlugin(kDEstep) ? "YES" : "NO"); |
1859 | printf("\tTagged Track Analysis: %s\n", GetPlugin(kTaggedTrackAnalysis) ? "YES" : "NO"); | |
75d81601 | 1860 | printf("\n"); |
1861 | printf("\tParticle Identification Detectors:\n"); | |
3a72645a | 1862 | fPID->PrintStatus(); |
75d81601 | 1863 | printf("\n"); |
1864 | printf("\tQA: \n"); | |
1865 | printf("\t\tPID: %s\n", IsQAOn(kPIDqa) ? "YES" : "NO"); | |
e3fc062d | 1866 | printf("\t\tCUTS: %s\n", (fCuts != NULL && fCuts->IsQAOn()) ? "YES" : "NO"); |
75d81601 | 1867 | printf("\t\tMC: %s\n", IsQAOn(kMCqa) ? "YES" : "NO"); |
1868 | printf("\n"); | |
1869 | } | |
78ea5ef4 | 1870 | |
faee3b18 | 1871 | //____________________________________________________________ |
1872 | Bool_t AliAnalysisTaskHFE::FillProductionVertex(const AliVParticle * const track) const{ | |
1873 | // | |
1874 | // Find the production vertex of the associated MC track | |
1875 | // | |
1876 | if(!fMCEvent) return kFALSE; | |
1877 | const AliVParticle *mctrack = NULL; | |
1878 | TString objectType = track->IsA()->GetName(); | |
1879 | if(objectType.CompareTo("AliESDtrack") == 0 || objectType.CompareTo("AliAODTrack") == 0){ | |
1880 | // Reconstructed track | |
1881 | mctrack = fMCEvent->GetTrack(TMath::Abs(track->GetLabel())); | |
1882 | } else { | |
1883 | // MCParticle | |
1884 | mctrack = track; | |
1885 | } | |
1886 | ||
1887 | if(!mctrack) return kFALSE; | |
1888 | ||
1889 | Double_t xv = 0.0; | |
1890 | Double_t yv = 0.0; | |
1891 | ||
1892 | if(TString(mctrack->IsA()->GetName()).CompareTo("AliMCParticle") == 0){ | |
1893 | // case MCParticle | |
bf892a6a | 1894 | const AliMCParticle *mcpart = dynamic_cast<const AliMCParticle *>(mctrack); |
1895 | if(mcpart){ | |
1896 | xv = mcpart->Xv(); | |
1897 | yv = mcpart->Yv(); | |
1898 | } | |
faee3b18 | 1899 | } else { |
1900 | // case AODMCParticle | |
bf892a6a | 1901 | const AliAODMCParticle *mcpart = dynamic_cast<const AliAODMCParticle *>(mctrack); |
1902 | if(mcpart){ | |
1903 | xv = mcpart->Xv(); | |
1904 | yv = mcpart->Yv(); | |
1905 | } | |
faee3b18 | 1906 | } |
1907 | ||
1908 | //printf("xv %f, yv %f\n",xv,yv); | |
69ac0e6f | 1909 | fQACollection->Fill("radius", TMath::Abs(xv),TMath::Abs(yv)); |
faee3b18 | 1910 | |
1911 | return kTRUE; | |
1912 | ||
1913 | } | |
9bcfd1ab | 1914 | //__________________________________________ |
1915 | void AliAnalysisTaskHFE::SwitchOnPlugin(Int_t plug){ | |
1916 | // | |
1917 | // Switch on Plugin | |
1918 | // Available: | |
1919 | // - Primary vertex studies | |
1920 | // - Secondary vertex Studies | |
1921 | // - Post Processing | |
1922 | // | |
1923 | switch(plug){ | |
1924 | case kPriVtx: SETBIT(fPlugins, plug); break; | |
1925 | case kSecVtx: SETBIT(fPlugins, plug); break; | |
1926 | case kIsElecBackGround: SETBIT(fPlugins, plug); break; | |
1927 | case kPostProcess: SETBIT(fPlugins, plug); break; | |
3a72645a | 1928 | case kDEstep: SETBIT(fPlugins, plug); break; |
1929 | case kTaggedTrackAnalysis: SETBIT(fPlugins, plug); break; | |
9bcfd1ab | 1930 | default: AliError("Unknown Plugin"); |
1931 | }; | |
1932 | } | |
9bcfd1ab | 1933 | //__________________________________________ |
3a72645a | 1934 | Bool_t AliAnalysisTaskHFE::ProcessCutStep(Int_t cutStep, AliVParticle *track){ |
9bcfd1ab | 1935 | // |
1936 | // Check single track cuts for a given cut step | |
1937 | // Fill the particle container | |
1938 | // | |
3a72645a | 1939 | const Int_t kMCOffset = AliHFEcuts::kNcutStepsMCTrack; |
1940 | if(!fCFM->CheckParticleCuts(cutStep + kMCOffset, track)) return kFALSE; | |
1941 | if(fVarManager->IsSignalTrack()) { | |
1942 | fVarManager->FillContainer(fContainer, "recTrackContReco", cutStep, kFALSE); | |
1943 | fVarManager->FillContainer(fContainer, "recTrackContMC", cutStep, kTRUE); | |
9bcfd1ab | 1944 | } |
1945 | return kTRUE; | |
1946 | } | |
3a72645a | 1947 | //___________________________________________________ |
c2690925 | 1948 | Bool_t AliAnalysisTaskHFE::ReadCentrality() { |
3a72645a | 1949 | // |
1950 | // Recover the centrality of the event from ESD or AOD | |
1951 | // | |
11ff28c5 | 1952 | |
1953 | Float_t fCentralityLimitstemp[12]; | |
1954 | Float_t fCentralityLimitsdefault[12]= {0.,5.,10., 20., 30., 40., 50., 60.,70.,80., 90., 100.}; | |
1955 | if(!fPbPbUserCentralityBinning) memcpy(fCentralityLimitstemp,fCentralityLimitsdefault,sizeof(fCentralityLimitsdefault)); | |
1956 | else memcpy(fCentralityLimitstemp,fCentralityLimits,sizeof(fCentralityLimitsdefault)); | |
1957 | ||
1958 | ||
e156c3bb | 1959 | Int_t bin = -1; |
1960 | if(IsPbPb()) { | |
1961 | // Centrality | |
1962 | AliCentrality *centrality = fInputEvent->GetCentrality(); | |
11ff28c5 | 1963 | fCentralityPercent = centrality->GetCentralityPercentile("V0M"); |
1964 | //printf("centrality %f\n",fCentralityPercent); | |
1965 | ||
e156c3bb | 1966 | for(Int_t ibin = 0; ibin < 11; ibin++){ |
11ff28c5 | 1967 | if(fCentralityPercent >= fCentralityLimitstemp[ibin] && fCentralityPercent < fCentralityLimitstemp[ibin+1]){ |
1968 | bin = ibin; | |
1969 | //printf("test bin %f, low %f, high %f, %d\n",fCentralityPercent,fCentralityLimitstemp[ibin],fCentralityLimitstemp[ibin+1],ibin); | |
e156c3bb | 1970 | break; |
1971 | } | |
11ff28c5 | 1972 | } |
1973 | ||
e156c3bb | 1974 | if(bin == -1) bin = 11; // Overflow |
1975 | } else { | |
1976 | // PP: Tracklet multiplicity, use common definition | |
1977 | Int_t itsMultiplicity = GetITSMultiplicity(fInputEvent); | |
1978 | Int_t multiplicityLimits[8] = {0, 1, 9, 17, 25, 36, 60, 500}; | |
1979 | for(Int_t ibin = 0; ibin < 7; ibin++){ | |
1980 | if(itsMultiplicity >= multiplicityLimits[ibin] && itsMultiplicity < multiplicityLimits[ibin + 1]){ | |
1981 | bin = ibin; | |
1982 | break; | |
1983 | } | |
1984 | } | |
1985 | if(bin == -1) bin = 7; // Overflow | |
1986 | } | |
1987 | fCentralityF = bin; | |
1988 | AliDebug(2, Form("Centrality class %d\n", fCentralityF)); | |
11ff28c5 | 1989 | |
c2690925 | 1990 | |
e156c3bb | 1991 | // contributors, to be outsourced |
1992 | const AliVVertex *vtx; | |
1993 | if(IsAODanalysis()){ | |
1994 | AliAODEvent *fAOD = dynamic_cast<AliAODEvent *>(fInputEvent); | |
1995 | if(!fAOD){ | |
1996 | AliError("AOD Event required for AOD Analysis"); | |
1997 | return kFALSE; | |
1998 | } | |
1999 | vtx = fAOD->GetPrimaryVertex(); | |
2000 | } else { | |
2001 | AliESDEvent *fESD = dynamic_cast<AliESDEvent *>(fInputEvent); | |
2002 | if(!fESD){ | |
2003 | AliError("ESD Event required for ESD Analysis"); | |
2004 | return kFALSE; | |
2005 | } | |
2006 | vtx = fESD->GetPrimaryVertexSPD(); | |
2007 | } | |
2008 | if(!vtx){ | |
2009 | fContributors = 0.5; | |
2010 | return kFALSE; | |
2011 | } | |
2012 | else { | |
2013 | Int_t contributorstemp = vtx->GetNContributors(); | |
2014 | if( contributorstemp <= 0) fContributors = 0.5; | |
2015 | else fContributors = 1.5; | |
11ff28c5 | 2016 | //printf("Number of contributors %d\n",contributorstemp); |
e156c3bb | 2017 | } |
2018 | return kTRUE; | |
2019 | } | |
3a72645a | 2020 | |
e156c3bb | 2021 | //___________________________________________________ |
2022 | Int_t AliAnalysisTaskHFE::GetITSMultiplicity(AliVEvent *ev){ | |
2023 | // | |
2024 | // Definition of the Multiplicity according to the JPSI group (F. Kramer) | |
2025 | // | |
2026 | Int_t nTracklets = 0; | |
2027 | Int_t nAcc = 0; | |
2028 | Double_t etaRange = 1.6; | |
2029 | ||
2030 | if (ev->IsA() == AliAODEvent::Class()) { | |
2031 | AliAODTracklets *tracklets = ((AliAODEvent*)ev)->GetTracklets(); | |
2032 | nTracklets = tracklets->GetNumberOfTracklets(); | |
2033 | for (Int_t nn = 0; nn < nTracklets; nn++) { | |
2034 | Double_t theta = tracklets->GetTheta(nn); | |
2035 | Double_t eta = -TMath::Log(TMath::Tan(theta/2.0)); | |
2036 | if (TMath::Abs(eta) < etaRange) nAcc++; | |
2037 | } | |
2038 | } else if (ev->IsA() == AliESDEvent::Class()) { | |
2039 | nTracklets = ((AliESDEvent*)ev)->GetMultiplicity()->GetNumberOfTracklets(); | |
2040 | for (Int_t nn = 0; nn < nTracklets; nn++) { | |
2041 | Double_t eta = ((AliESDEvent*)ev)->GetMultiplicity()->GetEta(nn); | |
2042 | if (TMath::Abs(eta) < etaRange) nAcc++; | |
2043 | } | |
2044 | } else return -1; | |
c2690925 | 2045 | |
e156c3bb | 2046 | return nAcc; |
3a72645a | 2047 | } |
e156c3bb | 2048 | |
8c1c76e9 | 2049 | //___________________________________________________ |
2050 | Bool_t AliAnalysisTaskHFE::InitializeHadronBackground(Int_t run){ | |
2051 | // | |
2052 | // Initialize background factors array from the AliOADBContainer | |
2053 | // The container is expected to provide a TObjArray with the name | |
2054 | // "hadronBackground" and the size 12 for the given run number | |
2055 | // | |
2056 | AliDebug(1, "Deriving hadronic background parameterization from OADB container"); | |
2057 | TObjArray *functions = dynamic_cast<TObjArray *>(fHadronBackgroundOADB->GetObject(run, "hadronBackground")); | |
2058 | if(!functions){ | |
2059 | AliDebug(1, "Content in the OADB Container is not a TObjArray"); | |
2060 | fBackGroundFactorApply = kFALSE; | |
2061 | return kFALSE; | |
2062 | } | |
2063 | if(functions->GetSize() < 12){ | |
2064 | AliDebug(1, Form("Size not matching: 12 expected, %d provided", functions->GetSize())); | |
2065 | fBackGroundFactorApply = kFALSE; | |
2066 | return kFALSE; | |
2067 | } | |
2068 | for(Int_t icent = 0; icent < 12; icent++) fkBackGroundFactorArray[icent] = dynamic_cast<const TF1 *>(functions->UncheckedAt(icent)); | |
2069 | return kTRUE; | |
2070 | } | |
2071 | ||
3a72645a | 2072 | //___________________________________________________ |
2073 | void AliAnalysisTaskHFE::RejectionPileUpVertexRangeEventCut() { | |
2074 | // | |
2075 | // Recover the centrality of the event from ESD or AOD | |
2076 | // | |
2077 | if(IsAODanalysis()){ | |
2078 | ||
2079 | AliAODEvent *fAOD = dynamic_cast<AliAODEvent *>(fInputEvent); | |
2080 | if(!fAOD){ | |
13242232 | 2081 | AliError("AOD Event required for AOD Analysis"); |
e156c3bb | 2082 | return; |
3a72645a | 2083 | } |
2084 | // PileUp | |
11ff28c5 | 2085 | fIdentifiedAsPileUp = kFALSE; |
3a72645a | 2086 | if(fRemovePileUp && fAOD->IsPileupFromSPD()) fIdentifiedAsPileUp = kTRUE; |
2087 | // Z vertex | |
11ff28c5 | 2088 | fIdentifiedAsOutInz = kFALSE; |
2089 | //printf("Z vertex %f and out %f\n",fAOD->GetPrimaryVertex()->GetZ(),fCuts->GetVertexRange()); | |
3a72645a | 2090 | if(TMath::Abs(fAOD->GetPrimaryVertex()->GetZ()) > fCuts->GetVertexRange()) fIdentifiedAsOutInz = kTRUE; |
2091 | // Event Cut | |
2092 | fPassTheEventCut = kTRUE; | |
2093 | if(!fCFM->CheckEventCuts(AliHFEcuts::kEventStepReconstructed, fAOD)) fPassTheEventCut = kFALSE; | |
2094 | ||
2095 | ||
2096 | } else { | |
2097 | ||
2098 | AliDebug(3, "Processing ESD Centrality"); | |
2099 | AliESDEvent *fESD = dynamic_cast<AliESDEvent *>(fInputEvent); | |
2100 | if(!fESD){ | |
13242232 | 2101 | AliError("ESD Event required for ESD Analysis"); |
e156c3bb | 2102 | return; |
3a72645a | 2103 | } |
2104 | // PileUp | |
2105 | fIdentifiedAsPileUp = kFALSE; | |
2106 | if(fRemovePileUp && fESD->IsPileupFromSPD()) fIdentifiedAsPileUp = kTRUE; | |
2107 | // Z vertex | |
2108 | fIdentifiedAsOutInz = kFALSE; | |
fd6b8522 | 2109 | if (IsPbPb()) { |
2110 | //printf("PbPb\n"); | |
2111 | if(fESD->GetPrimaryVertex()){ | |
2112 | if(TMath::Abs(fESD->GetPrimaryVertex()->GetZ()) > fCuts->GetVertexRange()) fIdentifiedAsOutInz = kTRUE; | |
2113 | } | |
2114 | } | |
2115 | else { | |
2116 | //printf("pp\n"); | |
2117 | if(fESD->GetPrimaryVertexTracks()){ | |
c2690925 | 2118 | if(TMath::Abs(fESD->GetPrimaryVertexTracks()->GetZ()) > fCuts->GetVertexRange()) fIdentifiedAsOutInz = kTRUE; |
fd6b8522 | 2119 | } |
3a72645a | 2120 | } |
2121 | //Event Cut | |
2122 | fPassTheEventCut = kTRUE; | |
2123 | if(!fCFM->CheckEventCuts(AliHFEcuts::kEventStepReconstructed, fESD)) fPassTheEventCut = kFALSE; | |
2124 | ||
2125 | ||
2126 | } | |
2127 | ||
2128 | } | |
70da6c5a | 2129 |