]>
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'] |
11ff28c5 | 855 | Double_t dataDca[8]; // [source, pT, dca, dcaSig, centrality] |
856 | Double_t eDca[6]; // [source, pT, dca, dcaSig, centrality] | |
75d81601 | 857 | Int_t nElectronCandidates = 0; |
9bcfd1ab | 858 | AliESDtrack *track = NULL, *htrack = NULL; |
859 | AliMCParticle *mctrack = NULL; | |
8c1c76e9 | 860 | AliMCParticle *mctrackmother = NULL; |
259c3296 | 861 | Int_t pid = 0; |
dbe3abbe | 862 | |
78ea5ef4 | 863 | Bool_t signal = kTRUE; |
864 | ||
554e120d | 865 | fCFM->SetRecEventInfo(fESD); |
8c1c76e9 | 866 | |
867 | // minjung for IP QA(temporary ~ 2weeks) | |
868 | if(!fExtraCuts){ | |
869 | fExtraCuts = new AliHFEextraCuts("hfetmpCuts","HFE tmp Cuts"); | |
870 | } | |
871 | fExtraCuts->SetRecEventInfo(fESD); | |
872 | ||
d2af20c5 | 873 | // Electron background analysis |
874 | if (GetPlugin(kIsElecBackGround)) { | |
875 | ||
876 | AliDebug(2, "Running BackGround Analysis"); | |
877 | ||
878 | fElecBackGround->Reset(); | |
879 | ||
880 | } // end of electron background analysis | |
9bcfd1ab | 881 | // |
882 | // Loop ESD | |
883 | // | |
faee3b18 | 884 | AliDebug(3, Form("Number of Tracks: %d", fESD->GetNumberOfTracks())); |
dbe3abbe | 885 | for(Int_t itrack = 0; itrack < fESD->GetNumberOfTracks(); itrack++){ |
3a72645a | 886 | AliDebug(4, "New ESD track"); |
dbe3abbe | 887 | track = fESD->GetTrack(itrack); |
c2690925 | 888 | track->SetESDEvent(fESD); |
faee3b18 | 889 | |
e3fc062d | 890 | // fill counts of v0-identified particles |
891 | Int_t v0pid = -1; | |
892 | if(track->TestBit(BIT(14))) v0pid = AliPID::kElectron; | |
893 | else if(track->TestBit(BIT(15))) v0pid = AliPID::kPion; | |
894 | else if(track->TestBit(BIT(16))) v0pid = AliPID::kProton; | |
3a72645a | 895 | // here the tagged track analysis will run |
896 | if(fTaggedTrackAnalysis && v0pid > -1){ | |
897 | AliDebug(1, Form("Track identified as %s", AliPID::ParticleName(v0pid))); | |
898 | fTaggedTrackAnalysis->ProcessTrack(track, v0pid); | |
899 | } | |
e3fc062d | 900 | |
faee3b18 | 901 | AliDebug(3, Form("Doing track %d, %p", itrack, track)); |
e3fc062d | 902 | |
903 | ////////////////////////////////////// | |
904 | // preselect | |
905 | ///////////////////////////////////// | |
906 | if(fPIDpreselect && fCutspreselect) { | |
907 | if(!PreSelectTrack(track)) continue; | |
908 | } | |
78ea5ef4 | 909 | |
910 | signal = kTRUE; | |
faee3b18 | 911 | |
70da6c5a | 912 | // Fill step without any cut |
dbe3abbe | 913 | |
9bcfd1ab | 914 | if(HasMCData()){ |
915 | // Check if it is electrons near the vertex | |
d2af20c5 | 916 | if(!(mctrack = dynamic_cast<AliMCParticle *>(fMCEvent->GetTrack(TMath::Abs(track->GetLabel()))))) continue; |
faee3b18 | 917 | |
c2690925 | 918 | if(fFillSignalOnly && !fCFM->CheckParticleCuts(AliHFEcuts::kStepMCGenerated, mctrack)) signal = kFALSE; |
faee3b18 | 919 | else AliDebug(3, "Signal Electron"); |
8c1c76e9 | 920 | |
921 | // Fill K pt for Ke3 contributions | |
922 | if(mctrack && (TMath::Abs(mctrack->Particle()->GetPdgCode())==321)) fQACollection->Fill("Kptspectra",mctrack->Pt()); | |
923 | else if(mctrack && (TMath::Abs(mctrack->Particle()->GetPdgCode())==130)) fQACollection->Fill("K0Lptspectra",mctrack->Pt()); | |
e3fc062d | 924 | } |
3a72645a | 925 | // Cache new Track information inside the var manager |
926 | fVarManager->NewTrack(track, mctrack, fCentralityF, -1, signal); | |
927 | ||
e156c3bb | 928 | if(fFillNoCuts) { |
929 | if(signal || !fFillSignalOnly){ | |
930 | fVarManager->FillContainer(fContainer, "recTrackContReco", AliHFEcuts::kStepRecNoCut, kFALSE); | |
931 | fVarManager->FillContainer(fContainer, "recTrackContMC", AliHFEcuts::kStepRecNoCut, kTRUE); | |
e3ae862b | 932 | } |
dbe3abbe | 933 | } |
934 | ||
70da6c5a | 935 | // RecKine: ITSTPC cuts |
3a72645a | 936 | if(!ProcessCutStep(AliHFEcuts::kStepRecKineITSTPC, track)) continue; |
70da6c5a | 937 | |
dbe3abbe | 938 | |
939 | // RecPrim | |
fd6b8522 | 940 | if(fRejectKinkMother) { |
941 | if(track->GetKinkIndex(0) != 0) continue; } // Quick and dirty fix to reject both kink mothers and daughters | |
3a72645a | 942 | if(!ProcessCutStep(AliHFEcuts::kStepRecPrim, track)) continue; |
dbe3abbe | 943 | |
944 | // HFEcuts: ITS layers cuts | |
3a72645a | 945 | if(!ProcessCutStep(AliHFEcuts::kStepHFEcutsITS, track)) continue; |
fd6b8522 | 946 | |
947 | // HFE cuts: TOF PID and mismatch flag | |
948 | if(!ProcessCutStep(AliHFEcuts::kStepHFEcutsTOF, track)) continue; | |
3a72645a | 949 | |
8c1c76e9 | 950 | // HFE cuts: TPC PID cleanup |
951 | if(!ProcessCutStep(AliHFEcuts::kStepHFEcutsTPC, track)) continue; | |
952 | ||
3a72645a | 953 | // HFEcuts: Nb of tracklets TRD0 |
954 | if(!ProcessCutStep(AliHFEcuts::kStepHFEcutsTRD, track)) continue; | |
955 | ||
6555e2ad | 956 | // Fill correlation maps before PID |
957 | if(signal && fContainer->GetCorrelationMatrix("correlationstepbeforePID")) { | |
958 | //printf("Fill correlation maps before PID\n"); | |
959 | fVarManager->FillCorrelationMatrix(fContainer->GetCorrelationMatrix("correlationstepbeforePID")); | |
960 | } | |
961 | ||
faee3b18 | 962 | if(HasMCData()){ |
963 | FillProductionVertex(track); | |
faee3b18 | 964 | |
a8ef1999 | 965 | if(fMCQA && signal){ |
8c1c76e9 | 966 | fMCQA->SetCentrality(fCentralityF); |
967 | if(mctrack && (TMath::Abs(mctrack->Particle()->GetPdgCode()) == 11)){ | |
968 | Double_t weightElecBgV0[kBgLevels] = {0.,0.,0.}; | |
a8ef1999 | 969 | Double_t hfeimpactRtmp=0., hfeimpactnsigmaRtmp=0.; |
970 | fExtraCuts->GetHFEImpactParameters(track, hfeimpactRtmp, hfeimpactnsigmaRtmp); | |
971 | UChar_t itsPixel = track->GetITSClusterMap(); | |
972 | Double_t ilyrhit=0, ilyrstat=0; | |
973 | for(Int_t ilyr=0; ilyr<6; ilyr++){ | |
974 | if(TESTBIT(itsPixel, ilyr)) ilyrhit += TMath::Power(2,ilyr); | |
975 | if(fExtraCuts->CheckITSstatus(fExtraCuts->GetITSstatus(track,ilyr))) ilyrstat += TMath::Power(2,ilyr); | |
976 | } | |
977 | fMCQA->SetITSInfo(ilyrhit,ilyrstat); | |
978 | fMCQA->SetHFEImpactParameters(hfeimpactRtmp, hfeimpactnsigmaRtmp); | |
979 | fMCQA->SetTrkKine(track->Pt(),track->Eta(), track->Phi()); | |
980 | fMCQA->SetContainerStep(3); | |
8c1c76e9 | 981 | for(Int_t iLevel = 0; iLevel < kBgLevels; iLevel++){ |
982 | weightElecBgV0[iLevel] = fMCQA->GetWeightFactor(mctrack, iLevel); // positive:conversion e, negative: nonHFE | |
983 | if(!fisNonHFEsystematics)break; | |
984 | } | |
985 | ||
986 | if(fisNonHFEsystematics){ | |
987 | //Fill additional containers for electron source distinction | |
988 | Int_t elecSource = 0; | |
989 | elecSource = fMCQA->GetElecSource(mctrack->Particle()); | |
990 | const Char_t *sourceName[kElecBgSpecies]={"Pion","Eta","Omega","Phi","EtaPrime","Rho"}; | |
991 | const Char_t *levelName[kBgLevels]={"Best","Lower","Upper"}; | |
992 | Int_t iName = 0; | |
993 | for(Int_t iSource = AliHFEmcQA::kPi0; iSource <= AliHFEmcQA::kGammaRho0; iSource++){ | |
994 | if((iSource == AliHFEmcQA::kElse)||(iSource == AliHFEmcQA::kMisID)) continue; | |
995 | if(elecSource == iSource){ | |
996 | for(Int_t iLevel = 0; iLevel < kBgLevels; iLevel++){ | |
a8ef1999 | 997 | if(weightElecBgV0[iLevel]>0){ |
998 | fVarManager->FillContainer(fContainer, Form("conversionElecs%s%s",sourceName[iName], levelName[iLevel]), 3, kFALSE, weightElecBgV0[iLevel]); | |
999 | } | |
1000 | else if(weightElecBgV0[iLevel]<0){ | |
1001 | fVarManager->FillContainer(fContainer, Form("mesonElecs%s%s",sourceName[iName], levelName[iLevel]), 3, kFALSE, -1*weightElecBgV0[iLevel]); | |
1002 | } | |
8c1c76e9 | 1003 | } |
1004 | break; | |
1005 | } | |
1006 | iName++; | |
1007 | if(iName == kElecBgSpecies)iName = 0; | |
1008 | } | |
1009 | } | |
1010 | //else{ | |
a8ef1999 | 1011 | if(weightElecBgV0[0]>0) { |
1012 | fVarManager->FillContainer(fContainer, "conversionElecs", 3, kFALSE, weightElecBgV0[0]); | |
1013 | fVarManager->FillContainer(fContainer, "conversionElecs", 4, kTRUE, weightElecBgV0[0]); | |
1014 | } | |
1015 | else if(weightElecBgV0[0]<0) { | |
1016 | fVarManager->FillContainer(fContainer, "mesonElecs", 3, kFALSE, -1*weightElecBgV0[0]); | |
1017 | fVarManager->FillContainer(fContainer, "mesonElecs", 4, kTRUE, -1*weightElecBgV0[0]); | |
1018 | } | |
8c1c76e9 | 1019 | //} |
1020 | } | |
1021 | } | |
11ff28c5 | 1022 | |
1023 | // check if it is the proton from the lambda decay, and yes fill the dca info | |
1024 | Double_t hfeimpactR4p=0., hfeimpactnsigmaR4p=0.; | |
1025 | if(mctrack && (TMath::Abs(mctrack->Particle()->GetPdgCode()) == 211)){ | |
1026 | if(track->Pt()>4.){ | |
1027 | fExtraCuts->GetHFEImpactParameters(track, hfeimpactR4p, hfeimpactnsigmaR4p); | |
1028 | fQACollection->Fill("pionDcaSig",track->Pt(),hfeimpactnsigmaR4p); | |
1029 | } | |
1030 | } | |
1031 | else if(mctrack && (TMath::Abs(mctrack->Particle()->GetPdgCode()) == 2212)){ | |
1032 | fExtraCuts->GetHFEImpactParameters(track, hfeimpactR4p, hfeimpactnsigmaR4p); | |
1033 | fQACollection->Fill("protonDcaSig",track->Pt(),hfeimpactnsigmaR4p); | |
1034 | Int_t glabel=TMath::Abs(mctrack->GetMother()); | |
1035 | if((mctrackmother = dynamic_cast<AliMCParticle *>(fMCEvent->GetTrack(glabel)))){ | |
1036 | if(TMath::Abs(mctrackmother->Particle()->GetPdgCode())==3122){ | |
1037 | fQACollection->Fill("secondaryprotonDcaSig",track->Pt(),hfeimpactnsigmaR4p); | |
1038 | } | |
1039 | } | |
1040 | } | |
1041 | else if(mctrack && (TMath::Abs(mctrack->Particle()->GetPdgCode()) == 11)){ // to increas statistics for Martin | |
1042 | if(signal){ | |
1043 | fExtraCuts->GetHFEImpactParameters(track, hfeimpactR4p, hfeimpactnsigmaR4p); | |
1044 | Int_t sourceDca =-1; | |
1045 | if(fSignalCuts->IsCharmElectron(track)){ | |
1046 | sourceDca=1; | |
1047 | } | |
1048 | else if(fSignalCuts->IsBeautyElectron(track)){ | |
1049 | sourceDca=2; | |
1050 | } | |
1051 | else if(fSignalCuts->IsGammaElectron(track)){ | |
1052 | sourceDca=3; | |
1053 | } | |
1054 | else if(fSignalCuts->IsNonHFElectron(track)){ | |
1055 | sourceDca=4; | |
1056 | } | |
1057 | else if(fSignalCuts->IsJpsiElectron(track)){ | |
1058 | sourceDca=5; | |
1059 | } | |
1060 | else if(mctrack && (TMath::Abs(mctrack->Particle()->GetPdgCode()) != 11)){ | |
1061 | sourceDca=6; | |
1062 | fQACollection->Fill("hadronsBeforeIPcut",track->Pt()); | |
1063 | fQACollection->Fill("hadronsBeforeIPcutMC",mctrack->Pt()); | |
1064 | } | |
1065 | else { | |
1066 | sourceDca=7; | |
1067 | } | |
1068 | eDca[0]=sourceDca; | |
1069 | eDca[1]=track->Pt(); | |
1070 | eDca[2]=hfeimpactR4p; | |
1071 | eDca[3]=hfeimpactnsigmaR4p; | |
1072 | eDca[4]=fCentralityF; | |
1073 | eDca[5] = track->Charge()/3; | |
1074 | ||
1075 | fQACollection->Fill("eDca", eDca); | |
1076 | } | |
1077 | } | |
8c1c76e9 | 1078 | } |
e17c1f86 | 1079 | |
1080 | if(TMath::Abs(track->Eta()) < 0.5){ | |
a8ef1999 | 1081 | if(track->GetInnerParam()) |
1082 | fQACollection->Fill("TPCdEdxBeforePID", track->GetInnerParam()->P(), track->GetTPCsignal()); | |
e17c1f86 | 1083 | fQACollection->Fill("TPCnSigmaBeforePID", track->P(), fInputHandler->GetPIDResponse()->NumberOfSigmasTPC(track, AliPID::kElectron)); |
1084 | } | |
1085 | ||
722347d8 | 1086 | AliHFEpidObject hfetrack; |
3a72645a | 1087 | hfetrack.SetAnalysisType(AliHFEpidObject::kESDanalysis); |
1088 | hfetrack.SetRecTrack(track); | |
1089 | if(HasMCData()) hfetrack.SetMCTrack(mctrack); | |
1090 | hfetrack.SetCentrality(fCentralityF); | |
e156c3bb | 1091 | if(IsPbPb()) hfetrack.SetPbPb(); |
1092 | else hfetrack.SetPP(); | |
3a72645a | 1093 | fPID->SetVarManager(fVarManager); |
1094 | if(!fPID->IsSelected(&hfetrack, fContainer, "recTrackCont", fPIDqa)) continue; | |
75d81601 | 1095 | nElectronCandidates++; |
dbe3abbe | 1096 | |
8c1c76e9 | 1097 | // Temporary histogram for chi2/ITS cluster |
1098 | if(IsPbPb()) { | |
1099 | TBits shared = track->GetTPCSharedMap(); | |
965de368 | 1100 | Int_t sharebit=0; |
8c1c76e9 | 1101 | if(shared.CountBits() >= 2) sharebit=1; |
1102 | ||
965de368 | 1103 | Double_t itschi2percluster = 0.0; |
317ae21b | 1104 | Double_t itsnbcls = static_cast<Double_t>(track->GetNcls(0)); |
1105 | if(itsnbcls > 0) itschi2percluster = track->GetITSchi2()/itsnbcls; | |
965de368 | 1106 | |
8c1c76e9 | 1107 | Double_t itsChi2[7] = {track->Pt(),track->Eta(), track->Phi(), |
a8ef1999 | 1108 | fCentralityF,track->GetTPCsignalN(), sharebit,itschi2percluster}; |
8c1c76e9 | 1109 | fQACollection->Fill("fChi2perITScluster", itsChi2); |
1110 | } | |
1111 | else{ | |
a8ef1999 | 1112 | |
965de368 | 1113 | Double_t itschi2percluster = 0.0; |
317ae21b | 1114 | Double_t itsnbcls = static_cast<Double_t>(track->GetNcls(0)); |
1115 | if(itsnbcls > 0) itschi2percluster = track->GetITSchi2()/itsnbcls; | |
965de368 | 1116 | |
1117 | Double_t itsChi2[3] = {track->Pt(), fCentralityF, itschi2percluster}; | |
1118 | fQACollection->Fill("fChi2perITScluster", itsChi2); | |
8c1c76e9 | 1119 | } |
1120 | ||
faee3b18 | 1121 | // Fill Histogram for Hadronic Background |
1122 | if(HasMCData()){ | |
1123 | if(mctrack && (TMath::Abs(mctrack->Particle()->GetPdgCode()) != 11)) | |
3a72645a | 1124 | fVarManager->FillContainer(fContainer, "hadronicBackground", UInt_t(0), kFALSE); |
8c1c76e9 | 1125 | else if(mctrack){ |
1126 | // Fill Ke3 contributions | |
1127 | Int_t glabel=TMath::Abs(mctrack->GetMother()); | |
1128 | if((mctrackmother = dynamic_cast<AliMCParticle *>(fMCEvent->GetTrack(glabel)))){ | |
1129 | if(TMath::Abs(mctrackmother->Particle()->GetPdgCode())==321) | |
a8ef1999 | 1130 | fQACollection->Fill("Ke3Kecorr",mctrack->Pt(),mctrackmother->Pt()); |
8c1c76e9 | 1131 | else if(TMath::Abs(mctrackmother->Particle()->GetPdgCode())==130) |
a8ef1999 | 1132 | fQACollection->Fill("Ke3K0Lecorr",mctrack->Pt(),mctrackmother->Pt()); |
8c1c76e9 | 1133 | } |
1134 | } | |
faee3b18 | 1135 | } |
1136 | ||
dbe3abbe | 1137 | // Fill Containers |
dbe3abbe | 1138 | if(signal) { |
e3fc062d | 1139 | // Apply weight for background contamination |
8c1c76e9 | 1140 | if(fBackGroundFactorApply) { |
1141 | if(IsPbPb() && fCentralityF >= 0) fWeightBackGround = fkBackGroundFactorArray[fCentralityF >= 0 ? fCentralityF : 0]->Eval(TMath::Abs(track->P())); | |
1142 | else fWeightBackGround = fkBackGroundFactorArray[0]->Eval(TMath::Abs(track->P())); // pp case | |
c2690925 | 1143 | |
8c1c76e9 | 1144 | if(fWeightBackGround < 0.0) fWeightBackGround = 0.0; |
1145 | else if(fWeightBackGround > 1.0) fWeightBackGround = 1.0; | |
3a72645a | 1146 | // weightBackGround as special weight |
c2690925 | 1147 | fVarManager->FillContainer(fContainer, "hadronicBackground", 1, kFALSE, fWeightBackGround); |
dbe3abbe | 1148 | } |
3a72645a | 1149 | fVarManager->FillCorrelationMatrix(fContainer->GetCorrelationMatrix("correlationstepafterPID")); |
dbe3abbe | 1150 | } |
1151 | ||
fd6b8522 | 1152 | Bool_t bTagged=kFALSE; |
faee3b18 | 1153 | if(GetPlugin(kSecVtx)) { |
9bcfd1ab | 1154 | AliDebug(2, "Running Secondary Vertex Analysis"); |
c2690925 | 1155 | if(fSecVtx->Process(track) && signal) { |
1156 | fVarManager->FillContainer(fContainer, "recTrackContSecvtxReco", AliHFEcuts::kStepHFEcutsSecvtx, kFALSE); | |
1157 | fVarManager->FillContainer(fContainer, "recTrackContSecvtxMC", AliHFEcuts::kStepHFEcutsSecvtx, kTRUE); | |
e156c3bb | 1158 | bTagged=kTRUE; |
c2690925 | 1159 | } |
78ea5ef4 | 1160 | } |
9bcfd1ab | 1161 | |
1162 | if(HasMCData()){ | |
3a72645a | 1163 | dataE[0] = track->Pt(); |
1164 | dataE[1] = track->Eta(); | |
1165 | dataE[2] = track->Phi(); | |
1166 | dataE[3] = track->Charge(); | |
1167 | dataE[4] = -1.; | |
1168 | dataE[5] = -1.; | |
1169 | ||
9bcfd1ab | 1170 | // Track selected: distinguish between true and fake |
1171 | AliDebug(1, Form("Candidate Selected, filling THnSparse, PID: %d\n", mctrack->Particle()->GetPdgCode())); | |
1172 | if((pid = TMath::Abs(mctrack->Particle()->GetPdgCode())) == 11){ | |
3a72645a | 1173 | Int_t type = 0; |
1174 | if(fSignalCuts->IsCharmElectron(track)) | |
1175 | type = 1; | |
1176 | else if(fSignalCuts->IsBeautyElectron(track)) | |
1177 | type = 2; | |
9bcfd1ab | 1178 | AliDebug(1, Form("Type: %d\n", type)); |
1179 | if(type){ | |
8c1c76e9 | 1180 | dataE[5] = type; // beauty[1] or charm[2] |
1181 | dataE[4] = 2; // signal electron | |
9bcfd1ab | 1182 | } |
1183 | else{ | |
8c1c76e9 | 1184 | dataE[4] = 1; // not a signal electron |
1185 | dataE[5] = 0; | |
9bcfd1ab | 1186 | } |
1187 | } | |
1188 | else { | |
1189 | // Fill THnSparse with the information for Fake Electrons | |
9bcfd1ab | 1190 | dataE[4] = 0; |
70da6c5a | 1191 | dataE[5] = 0; |
9bcfd1ab | 1192 | } |
1193 | // fill the performance THnSparse, if the mc origin could be defined | |
70da6c5a | 1194 | if(dataE[4] > -1){ |
1195 | AliDebug(1, Form("Entries: [%.3f|%.3f|%.3f|%f|%f|%f]\n", dataE[0],dataE[1],dataE[2],dataE[3],dataE[4],dataE[5])); | |
3a72645a | 1196 | fQACollection->Fill("PIDperformance", dataE); |
9bcfd1ab | 1197 | } |
259c3296 | 1198 | } |
8c1c76e9 | 1199 | |
9bcfd1ab | 1200 | // Electron background analysis |
1201 | if (GetPlugin(kIsElecBackGround)) { | |
1202 | ||
1203 | AliDebug(2, "Running BackGround Analysis"); | |
1204 | ||
1205 | for(Int_t jtrack = 0; jtrack < fESD->GetNumberOfTracks(); jtrack++){ | |
fd6b8522 | 1206 | htrack = fESD->GetTrack(jtrack); |
8c1c76e9 | 1207 | if ( itrack == jtrack ) continue; |
1208 | fElecBackGround->PairAnalysis(track, htrack); | |
9bcfd1ab | 1209 | } |
1210 | } // end of electron background analysis | |
1211 | ||
8c1c76e9 | 1212 | |
a8ef1999 | 1213 | Int_t sourceDca =-1; |
3a72645a | 1214 | if (GetPlugin(kDEstep)) { |
8c1c76e9 | 1215 | Double_t weightElecBgV0[kBgLevels] = {0.,0.,0.,}; |
1216 | Int_t elecSource = 0; | |
1217 | // minjung for IP QA(temporary ~ 2weeks) | |
1218 | Double_t hfeimpactR=0., hfeimpactnsigmaR=0.; | |
1219 | fExtraCuts->GetHFEImpactParameters(track, hfeimpactR, hfeimpactnsigmaR); | |
a8ef1999 | 1220 | sourceDca=0; |
1221 | if(HasMCData()) | |
1222 | { | |
11ff28c5 | 1223 | if(fSignalCuts->IsCharmElectron(track)){ |
1224 | sourceDca=1; | |
1225 | } | |
1226 | else if(fSignalCuts->IsBeautyElectron(track)){ | |
1227 | sourceDca=2; | |
8c1c76e9 | 1228 | } |
11ff28c5 | 1229 | else if(fSignalCuts->IsGammaElectron(track)){ |
1230 | sourceDca=3; | |
8c1c76e9 | 1231 | } |
11ff28c5 | 1232 | else if(fSignalCuts->IsNonHFElectron(track)){ |
1233 | sourceDca=4; | |
8c1c76e9 | 1234 | } |
11ff28c5 | 1235 | else if(fSignalCuts->IsJpsiElectron(track)){ |
1236 | sourceDca=5; | |
8c1c76e9 | 1237 | } |
11ff28c5 | 1238 | else if(mctrack && (TMath::Abs(mctrack->Particle()->GetPdgCode()) != 11)){ |
1239 | sourceDca=6; | |
6555e2ad | 1240 | fQACollection->Fill("hadronsBeforeIPcut",track->Pt()); |
1241 | fQACollection->Fill("hadronsBeforeIPcutMC",mctrack->Pt()); | |
1242 | } | |
11ff28c5 | 1243 | else { |
1244 | sourceDca=7; | |
a8ef1999 | 1245 | } |
1246 | ||
1247 | if(fMCQA && signal) { | |
8c1c76e9 | 1248 | |
a8ef1999 | 1249 | fMCQA->SetContainerStep(0); |
8c1c76e9 | 1250 | for(Int_t iLevel = 0; iLevel < kBgLevels; iLevel++){ |
1251 | weightElecBgV0[iLevel] = fMCQA->GetWeightFactor(mctrack, iLevel); // positive:conversion e, negative: nonHFE | |
1252 | if(!fisNonHFEsystematics)break; | |
1253 | } | |
1254 | ||
1255 | if(fisNonHFEsystematics){ | |
1256 | //Fill additional containers for electron source distinction | |
1257 | elecSource = fMCQA->GetElecSource(mctrack->Particle()); | |
1258 | const Char_t *sourceName[kElecBgSpecies]={"Pion","Eta","Omega","Phi","EtaPrime","Rho"}; | |
1259 | const Char_t *levelName[kBgLevels]={"Best","Lower","Upper"}; | |
1260 | Int_t iName = 0; | |
1261 | for(Int_t iSource = AliHFEmcQA::kPi0; iSource <= AliHFEmcQA::kGammaRho0; iSource++){ | |
1262 | if((iSource == AliHFEmcQA::kElse)||(iSource == AliHFEmcQA::kMisID)) continue; | |
1263 | if(elecSource == iSource){ | |
1264 | for(Int_t iLevel = 0; iLevel < kBgLevels; iLevel++){ | |
1265 | if(weightElecBgV0[iLevel]>0) fVarManager->FillContainer(fContainer, Form("conversionElecs%s%s",sourceName[iName], levelName[iLevel]), 0, kFALSE, weightElecBgV0[iLevel]); | |
1266 | else if(weightElecBgV0[iLevel]<0) fVarManager->FillContainer(fContainer, Form("mesonElecs%s%s",sourceName[iName], levelName[iLevel]), 0, kFALSE, -1*weightElecBgV0[iLevel]); | |
1267 | } | |
1268 | break; | |
1269 | } | |
1270 | iName++; | |
1271 | if(iName == kElecBgSpecies)iName = 0; | |
1272 | } | |
1273 | } | |
1274 | //else{ | |
a8ef1999 | 1275 | if(weightElecBgV0[0]>0) { |
1276 | fVarManager->FillContainer(fContainer, "conversionElecs", 0, kFALSE, weightElecBgV0[0]); | |
1277 | fVarManager->FillContainer(fContainer, "conversionElecs", 5, kTRUE, weightElecBgV0[0]); | |
1278 | } | |
1279 | else if(weightElecBgV0[0]<0) { | |
1280 | fVarManager->FillContainer(fContainer, "mesonElecs", 0, kFALSE, -1*weightElecBgV0[0]); | |
1281 | fVarManager->FillContainer(fContainer, "mesonElecs", 5, kTRUE, -1*weightElecBgV0[0]); | |
1282 | } | |
e17c1f86 | 1283 | //} |
1284 | if(bTagged){ // bg estimation for the secondary vertex tagged signals | |
1285 | if(weightElecBgV0[0]>0) fVarManager->FillContainer(fContainer, "conversionElecs", 2, kFALSE, weightElecBgV0[0]); | |
1286 | else if(weightElecBgV0[0]<0) fVarManager->FillContainer(fContainer, "mesonElecs", 2, kFALSE, -1*weightElecBgV0[0]); | |
1287 | } | |
8c1c76e9 | 1288 | } |
a8ef1999 | 1289 | } // end of MC |
1290 | ||
1291 | dataDca[0]=sourceDca; | |
1292 | dataDca[1]=track->Pt(); | |
1293 | dataDca[2]=hfeimpactR; | |
1294 | dataDca[3]=hfeimpactnsigmaR; | |
1295 | dataDca[4]=fCentralityF; | |
1296 | dataDca[5] = 49; | |
1297 | Double_t xr[3]={49,49,49}; | |
1298 | if(HasMCData()) { | |
1299 | mctrack->XvYvZv(xr); | |
1300 | dataDca[5] = TMath::Sqrt(xr[0]*xr[0]+xr[1]*xr[1]); | |
1301 | } | |
1302 | dataDca[6] = v0pid; | |
11ff28c5 | 1303 | dataDca[7] = track->Charge()/3; |
a8ef1999 | 1304 | |
1305 | // printf("Entries dca: [%.3f|%.3f|%.3f|%f|%f]\n", dataDca[0],dataDca[1],dataDca[2],dataDca[3],dataDca[4]); | |
1306 | if (!HasMCData()) fQACollection->Fill("Dca", dataDca); | |
1307 | else if(signal) fQACollection->Fill("Dca", dataDca); | |
1308 | ||
1309 | ||
3a72645a | 1310 | // Fill Containers for impact parameter analysis |
1311 | if(!fCFM->CheckParticleCuts(AliHFEcuts::kStepHFEcutsDca + AliHFEcuts::kNcutStepsMCTrack + AliHFEcuts::kNcutStepsRecTrack,track)) continue; | |
fd6b8522 | 1312 | if(HasMCData()){ |
a8ef1999 | 1313 | if(fMCQA && signal) { |
1314 | fMCQA->SetContainerStep(1); | |
8c1c76e9 | 1315 | for(Int_t iLevel = 0; iLevel < kBgLevels; iLevel++){ |
1316 | weightElecBgV0[iLevel] = fMCQA->GetWeightFactor(mctrack, iLevel); // positive:conversion e, negative: nonHFE | |
1317 | if(!fisNonHFEsystematics)break; | |
1318 | } | |
1319 | if(fisNonHFEsystematics){ | |
1320 | //Fill additional containers for electron source distinction | |
1321 | elecSource = fMCQA->GetElecSource(mctrack->Particle()); | |
1322 | const Char_t *sourceName[kElecBgSpecies]={"Pion","Eta","Omega","Phi","EtaPrime","Rho"}; | |
1323 | const Char_t *levelName[kBgLevels]={"Best","Lower","Upper"}; | |
1324 | Int_t iName = 0; | |
1325 | for(Int_t iSource = AliHFEmcQA::kPi0; iSource <= AliHFEmcQA::kGammaRho0; iSource++){ | |
1326 | if((iSource == AliHFEmcQA::kElse)||(iSource == AliHFEmcQA::kMisID)) continue; | |
1327 | if(elecSource == iSource){ | |
1328 | for(Int_t iLevel = 0; iLevel < kBgLevels; iLevel++){ | |
1329 | if(weightElecBgV0[iLevel]>0) fVarManager->FillContainer(fContainer, Form("conversionElecs%s%s",sourceName[iName], levelName[iLevel]), 1, kFALSE, weightElecBgV0[iLevel]); | |
1330 | else if(weightElecBgV0[iLevel]<0) fVarManager->FillContainer(fContainer, Form("mesonElecs%s%s",sourceName[iName], levelName[iLevel]), 1, kFALSE, -1*weightElecBgV0[iLevel]); | |
1331 | } | |
1332 | break; | |
1333 | } | |
1334 | iName++; | |
1335 | if(iName == kElecBgSpecies)iName = 0; | |
1336 | } | |
1337 | } | |
1338 | // else{ | |
a8ef1999 | 1339 | if(weightElecBgV0[0]>0) { |
1340 | fVarManager->FillContainer(fContainer, "conversionElecs", 1, kFALSE, weightElecBgV0[0]); | |
1341 | fVarManager->FillContainer(fContainer, "conversionElecs", 6, kTRUE, weightElecBgV0[0]); | |
1342 | } | |
1343 | else if(weightElecBgV0[0]<0) { | |
1344 | fVarManager->FillContainer(fContainer, "mesonElecs", 1, kFALSE, -1*weightElecBgV0[0]); | |
1345 | fVarManager->FillContainer(fContainer, "mesonElecs", 6, kTRUE, -1*weightElecBgV0[0]); | |
1346 | } | |
8c1c76e9 | 1347 | //} |
1348 | } | |
fd6b8522 | 1349 | } |
3a72645a | 1350 | if(signal) { |
1351 | fVarManager->FillContainer(fContainer, "recTrackContDEReco", AliHFEcuts::kStepHFEcutsDca, kFALSE); | |
1352 | fVarManager->FillContainer(fContainer, "recTrackContDEMC", AliHFEcuts::kStepHFEcutsDca, kTRUE); | |
1353 | fVarManager->FillCorrelationMatrix(fContainer->GetCorrelationMatrix("correlationstepafterDE")); | |
1354 | } | |
1355 | if(HasMCData()){ | |
6555e2ad | 1356 | if(mctrack && (TMath::Abs(mctrack->Particle()->GetPdgCode()) != 11)){ |
6555e2ad | 1357 | fQACollection->Fill("hadronsAfterIPcut",track->Pt()); |
1358 | fQACollection->Fill("hadronsAfterIPcutMC",mctrack->Pt()); | |
1359 | } | |
3a72645a | 1360 | } |
1361 | } | |
1362 | ||
dbe3abbe | 1363 | } |
3a72645a | 1364 | fQACollection->Fill("nElectronTracksEvent", nElectronCandidates); |
809a4336 | 1365 | } |
1366 | ||
1367 | //____________________________________________________________ | |
9bcfd1ab | 1368 | void AliAnalysisTaskHFE::ProcessAOD(){ |
dbe3abbe | 1369 | // |
9bcfd1ab | 1370 | // Run Analysis in AOD Mode |
1371 | // Function is still in development | |
dbe3abbe | 1372 | // |
11ff28c5 | 1373 | //printf("Process AOD\n"); |
9bcfd1ab | 1374 | AliDebug(3, "Processing AOD Event"); |
c2690925 | 1375 | Double_t eventContainer[4]; |
1376 | if(HasMCData()) eventContainer[0] = fVz; | |
1377 | else { | |
1378 | eventContainer[0] = fInputEvent->GetPrimaryVertex()->GetZ(); | |
1379 | } | |
69ac0e6f | 1380 | eventContainer[1] = 1.; // No Information available in AOD analysis, assume all events have V0AND |
bf892a6a | 1381 | eventContainer[2] = fCentralityF; |
c2690925 | 1382 | eventContainer[3] = fContributors; |
bf892a6a | 1383 | |
11ff28c5 | 1384 | //printf("value event container %f, %f, %f, %f\n",eventContainer[0],eventContainer[1],eventContainer[2],eventContainer[3]); |
1385 | ||
d2af20c5 | 1386 | AliAODEvent *fAOD = dynamic_cast<AliAODEvent *>(fInputEvent); |
9bcfd1ab | 1387 | if(!fAOD){ |
13242232 | 1388 | AliError("AOD Event required for AOD Analysis"); |
e156c3bb | 1389 | return; |
9bcfd1ab | 1390 | } |
3a72645a | 1391 | |
11ff28c5 | 1392 | //printf("Will fill\n"); |
3a72645a | 1393 | // |
1394 | fCFM->GetEventContainer()->Fill(eventContainer, AliHFEcuts::kEventStepRecNoCut); | |
11ff28c5 | 1395 | //printf("Fill\n"); |
3a72645a | 1396 | // |
1397 | if(fIdentifiedAsPileUp) return; | |
1398 | fCFM->GetEventContainer()->Fill(eventContainer, AliHFEcuts::kEventStepRecNoPileUp); | |
1399 | ||
1400 | // | |
1401 | if(fIdentifiedAsOutInz) return; | |
1402 | fCFM->GetEventContainer()->Fill(eventContainer, AliHFEcuts::kEventStepZRange); | |
1403 | ||
1404 | // | |
1405 | if(!fPassTheEventCut) return; | |
1406 | fCFM->GetEventContainer()->Fill(eventContainer, AliHFEcuts::kEventStepReconstructed); | |
11ff28c5 | 1407 | //printf("pass\n"); |
3a72645a | 1408 | |
1409 | fContainer->NewEvent(); | |
9bcfd1ab | 1410 | |
1411 | AliAODTrack *track = NULL; | |
1412 | AliAODMCParticle *mctrack = NULL; | |
70da6c5a | 1413 | Double_t dataE[6]; // [pT, eta, Phi, Charge, type, 'C' or 'B'] |
9bcfd1ab | 1414 | Int_t nElectronCandidates = 0; |
1415 | Int_t pid; | |
3a72645a | 1416 | Bool_t signal; |
11ff28c5 | 1417 | //printf("Number of track %d\n",(Int_t) fAOD->GetNumberOfTracks()); |
9bcfd1ab | 1418 | for(Int_t itrack = 0; itrack < fAOD->GetNumberOfTracks(); itrack++){ |
f9f097c0 | 1419 | track = fAOD->GetTrack(itrack); mctrack = NULL; |
9bcfd1ab | 1420 | if(!track) continue; |
11ff28c5 | 1421 | if(fUseFlagAOD){ |
1422 | if(track->GetFlags() != fFlags) continue; // Only process AOD tracks where the HFE is set | |
1423 | } | |
1424 | //printf("Pass the flag\n"); | |
9bcfd1ab | 1425 | |
3a72645a | 1426 | signal = kTRUE; |
9bcfd1ab | 1427 | if(HasMCData()){ |
faee3b18 | 1428 | |
9bcfd1ab | 1429 | Int_t label = TMath::Abs(track->GetLabel()); |
3a72645a | 1430 | if(label) |
d2af20c5 | 1431 | mctrack = dynamic_cast<AliAODMCParticle *>(fMCEvent->GetTrack(label)); |
3a72645a | 1432 | if(fFillSignalOnly && !fCFM->CheckParticleCuts(AliHFEcuts::kStepMCGenerated, mctrack)) signal = kFALSE; |
9bcfd1ab | 1433 | } |
3a72645a | 1434 | fVarManager->NewTrack(track, mctrack, fCentralityF, -1, kTRUE); |
11ff28c5 | 1435 | |
1436 | if(fFillNoCuts) { | |
1437 | if(signal || !fFillSignalOnly){ | |
1438 | fVarManager->FillContainer(fContainer, "recTrackContReco", AliHFEcuts::kStepRecNoCut, kFALSE); | |
1439 | fVarManager->FillContainer(fContainer, "recTrackContMC", AliHFEcuts::kStepRecNoCut, kTRUE); | |
1440 | } | |
1441 | } | |
1442 | ||
1443 | if(fApplyCutAOD) { | |
1444 | // RecKine: ITSTPC cuts | |
1445 | if(!ProcessCutStep(AliHFEcuts::kStepRecKineITSTPC, track)) continue; | |
1446 | ||
1447 | // RecPrim | |
1448 | if(!ProcessCutStep(AliHFEcuts::kStepRecPrim, track)) continue; | |
1449 | ||
1450 | // HFEcuts: ITS layers cuts | |
1451 | if(!ProcessCutStep(AliHFEcuts::kStepHFEcutsITS, track)) continue; | |
1452 | ||
1453 | // HFE cuts: TOF PID and mismatch flag | |
1454 | if(!ProcessCutStep(AliHFEcuts::kStepHFEcutsTOF, track)) continue; | |
1455 | ||
1456 | // HFE cuts: TPC PID cleanup | |
1457 | if(!ProcessCutStep(AliHFEcuts::kStepHFEcutsTPC, track)) continue; | |
1458 | ||
1459 | // HFEcuts: Nb of tracklets TRD0 | |
1460 | if(!ProcessCutStep(AliHFEcuts::kStepHFEcutsTRD, track)) continue; | |
1461 | } | |
1462 | ||
1463 | // Fill correlation maps before PID | |
1464 | if(signal && fContainer->GetCorrelationMatrix("correlationstepbeforePID")) { | |
1465 | //printf("Fill correlation maps before PID\n"); | |
1466 | fVarManager->FillCorrelationMatrix(fContainer->GetCorrelationMatrix("correlationstepbeforePID")); | |
1467 | } | |
1468 | ||
1469 | //printf("Will process to PID\n"); | |
1470 | ||
9bcfd1ab | 1471 | // track accepted, do PID |
1472 | AliHFEpidObject hfetrack; | |
3a72645a | 1473 | hfetrack.SetAnalysisType(AliHFEpidObject::kAODanalysis); |
1474 | hfetrack.SetRecTrack(track); | |
1475 | if(HasMCData()) hfetrack.SetMCTrack(mctrack); | |
1476 | hfetrack.SetCentrality(fCentralityF); | |
11ff28c5 | 1477 | if(IsPbPb()) hfetrack.SetPbPb(); |
1478 | else hfetrack.SetPP(); | |
3a72645a | 1479 | fPID->SetVarManager(fVarManager); |
1480 | if(!fPID->IsSelected(&hfetrack, fContainer, "recTrackCont", fPIDqa)) continue; // we will do PID here as soon as possible | |
c2690925 | 1481 | |
11ff28c5 | 1482 | |
1483 | // Apply weight for background contamination | |
1484 | //Double_t weightBackGround = 1.0; | |
1485 | if(signal) { | |
1486 | // Apply weight for background contamination | |
1487 | if(fBackGroundFactorApply) { | |
1488 | if(IsPbPb() && fCentralityF >= 0) fWeightBackGround = fkBackGroundFactorArray[fCentralityF >= 0 ? fCentralityF : 0]->Eval(TMath::Abs(track->P())); | |
1489 | else fWeightBackGround = fkBackGroundFactorArray[0]->Eval(TMath::Abs(track->P())); // pp case | |
1490 | ||
1491 | if(fWeightBackGround < 0.0) fWeightBackGround = 0.0; | |
1492 | else if(fWeightBackGround > 1.0) fWeightBackGround = 1.0; | |
1493 | // weightBackGround as special weight | |
1494 | fVarManager->FillContainer(fContainer, "hadronicBackground", 1, kFALSE, fWeightBackGround); | |
1495 | } | |
1496 | fVarManager->FillCorrelationMatrix(fContainer->GetCorrelationMatrix("correlationstepafterPID")); | |
e3fc062d | 1497 | } |
11ff28c5 | 1498 | |
9bcfd1ab | 1499 | nElectronCandidates++; |
1500 | if(HasMCData()){ | |
3a72645a | 1501 | dataE[0] = track->Pt(); |
1502 | dataE[1] = track->Eta(); | |
1503 | dataE[2] = track->Phi(); | |
1504 | dataE[3] = track->Charge(); | |
1505 | dataE[4] = -1; | |
1506 | dataE[5] = -1; | |
c2690925 | 1507 | // Track selected: distinguish between true and fake |
f9f097c0 | 1508 | AliDebug(1, Form("Candidate Selected, filling THnSparse, PID: %d\n", mctrack ? mctrack->GetPdgCode(): -1)); |
1509 | if(mctrack && ((pid = TMath::Abs(mctrack->GetPdgCode())) == 11)){ | |
3a72645a | 1510 | |
1511 | Int_t type = 0; | |
1512 | if(fSignalCuts->IsCharmElectron(track)) | |
1513 | type = 1; | |
1514 | else if(fSignalCuts->IsBeautyElectron(track)) | |
1515 | type = 2; | |
9bcfd1ab | 1516 | AliDebug(1, Form("Type: %d\n", type)); |
1517 | if(type){ | |
8c1c76e9 | 1518 | dataE[5] = type; // beauty[1] or charm[2] |
1519 | dataE[4] = 2; // signal electron | |
9bcfd1ab | 1520 | } |
1521 | else{ | |
8c1c76e9 | 1522 | dataE[4] = 1; // not a signal electron |
1523 | dataE[5] = 0; | |
9bcfd1ab | 1524 | } |
1525 | } | |
1526 | else { | |
1527 | // Fill THnSparse with the information for Fake Electrons | |
9bcfd1ab | 1528 | dataE[4] = 0; |
70da6c5a | 1529 | dataE[5] = 0; |
9bcfd1ab | 1530 | } |
1531 | // fill the performance THnSparse, if the mc origin could be defined | |
70da6c5a | 1532 | if(dataE[4] > -1){ |
1533 | AliDebug(1, Form("Entries: [%.3f|%.3f|%.3f|%f|%f|%f]\n", dataE[0],dataE[1],dataE[2],dataE[3],dataE[4],dataE[5])); | |
3a72645a | 1534 | fQACollection->Fill("PIDperformance", dataE); |
9bcfd1ab | 1535 | } |
6ad05e72 | 1536 | } |
6ad05e72 | 1537 | } |
3a72645a | 1538 | fQACollection->Fill("nElectronTracksEvent", nElectronCandidates); |
6ad05e72 | 1539 | } |
1540 | ||
1541 | //____________________________________________________________ | |
9bcfd1ab | 1542 | Bool_t AliAnalysisTaskHFE::ProcessMCtrack(AliVParticle *track){ |
6ad05e72 | 1543 | // |
9bcfd1ab | 1544 | // Filter the Monte Carlo Track |
1545 | // Additionally Fill a THnSparse for Signal To Background Studies | |
1546 | // Works for AOD and MC analysis Type | |
6ad05e72 | 1547 | // |
c2690925 | 1548 | fVarManager->NewTrack(track, NULL, fCentralityF, -1, kTRUE); |
3a72645a | 1549 | Double_t signalContainer[6]; |
9bcfd1ab | 1550 | |
3a72645a | 1551 | signalContainer[0] = track->Pt(); |
1552 | signalContainer[1] = track->Eta(); | |
1553 | signalContainer[2] = track->Phi(); | |
1554 | signalContainer[3] = track->Charge()/3; | |
9bcfd1ab | 1555 | |
965de368 | 1556 | 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 | 1557 | if(IsESDanalysis()){ |
1558 | AliMCParticle *mctrack = dynamic_cast<AliMCParticle *>(track); | |
bf892a6a | 1559 | if(mctrack){ |
1560 | vertex[0] = mctrack->Particle()->Vx(); | |
1561 | vertex[1] = mctrack->Particle()->Vy(); | |
1562 | } | |
9bcfd1ab | 1563 | } else { |
1564 | AliAODMCParticle *aodmctrack = dynamic_cast<AliAODMCParticle *>(track); | |
bf892a6a | 1565 | if(aodmctrack) aodmctrack->XvYvZv(vertex); |
6ad05e72 | 1566 | } |
3a72645a | 1567 | |
1568 | if(!fCFM->CheckParticleCuts(AliHFEcuts::kStepMCGenerated, track)) return kFALSE; | |
3a72645a | 1569 | fVarManager->FillContainer(fContainer, "MCTrackCont", AliHFEcuts::kStepMCGenerated, kFALSE); |
1570 | signalContainer[4] = 0; | |
1571 | if(fSignalCuts->IsSelected(track)){ | |
1572 | //fVarManager->FillContainer(fContainer, "MCTrackCont", AliHFEcuts::kStepMCsignal, kFALSE); | |
1573 | // Filling of the Signal/Background histogram using the | |
1574 | // definition of the codes for charm and beauty as below in | |
1575 | // th crearion of the histogram | |
1576 | if(fSignalCuts->IsCharmElectron(track)) | |
1577 | signalContainer[4] = 1; | |
1578 | else | |
1579 | signalContainer[4] = 2; | |
1580 | } else { | |
1581 | signalContainer[4] = 0; // (and other background) | |
1582 | } | |
70da6c5a | 1583 | signalContainer[5] = 0; |
9bcfd1ab | 1584 | // apply cut on the sqrt of the production vertex |
1585 | Double_t radVertex = TMath::Sqrt(vertex[0]*vertex[0] + vertex[1] * vertex[1]); | |
1586 | if(radVertex < 3.5){ | |
1587 | // Within first ITS layer(2) -> Background we cannot reject by ITS cut, let it pass | |
70da6c5a | 1588 | signalContainer[5] = 1; |
9bcfd1ab | 1589 | } else if (radVertex < 7.5){ |
70da6c5a | 1590 | signalContainer[5] = 2; |
9bcfd1ab | 1591 | } |
3a72645a | 1592 | fQACollection->Fill("SignalToBackgroundMC", signalContainer); |
3a72645a | 1593 | |
1594 | // Step GeneratedZOutNoPileUp | |
e156c3bb | 1595 | if((fIdentifiedAsPileUp) || (TMath::Abs(fVz) > fCuts->GetVertexRange()) || (fCentralityF < 0)) return kFALSE; |
c2690925 | 1596 | fVarManager->FillContainer(fContainer, "MCTrackCont", AliHFEcuts::kStepMCGeneratedZOutNoPileUpCentralityFine, kFALSE); |
1597 | //printf("In ProcessMCtrack %f\n",fCentralityF); | |
3a72645a | 1598 | |
1599 | // Step Generated Event Cut | |
1600 | if(!fPassTheEventCut) return kFALSE; | |
1601 | fVarManager->FillContainer(fContainer, "MCTrackCont", AliHFEcuts::kStepMCGeneratedEventCut, kFALSE); | |
1602 | ||
1603 | if(!fCFM->CheckParticleCuts(AliHFEcuts::kStepMCInAcceptance, track)) return kFALSE; | |
1604 | fVarManager->FillContainer(fContainer, "MCTrackCont", AliHFEcuts::kStepMCInAcceptance, kFALSE); | |
9bcfd1ab | 1605 | return kTRUE; |
6ad05e72 | 1606 | } |
1607 | ||
e3fc062d | 1608 | //____________________________________________________________ |
1609 | Bool_t AliAnalysisTaskHFE::PreSelectTrack(AliESDtrack *track) const { | |
1610 | // | |
1611 | // Preselect tracks | |
1612 | // | |
1613 | ||
1614 | ||
1615 | Bool_t survived = kTRUE; | |
1616 | ||
1617 | if(!fCutspreselect->CheckParticleCuts(AliHFEcuts::kStepRecKineITSTPC, track)) { | |
1618 | survived = kFALSE; | |
1619 | //printf("Did not pass AliHFEcuts::kStepRecKineITSTPC\n"); | |
1620 | } | |
1621 | //else printf("Pass AliHFEcuts::kStepRecKineITSTPC\n"); | |
1622 | if(!fCutspreselect->CheckParticleCuts(AliHFEcuts::kStepRecPrim, track)) { | |
1623 | survived = kFALSE; | |
1624 | //printf("Did not pass AliHFEcuts::kStepRecPrim\n"); | |
1625 | } | |
1626 | //else printf("Pass AliHFEcuts::kStepRecPrim\n"); | |
1627 | if(!fCutspreselect->CheckParticleCuts(AliHFEcuts::kStepHFEcutsITS, track)) { | |
1628 | survived = kFALSE; | |
1629 | //printf("Did not pass AliHFEcuts::kStepHFEcutsITS\n"); | |
1630 | } | |
1631 | //else printf("Pass AliHFEcuts::kStepHFEcutsITS\n"); | |
fd6b8522 | 1632 | if(!fCutspreselect->CheckParticleCuts(AliHFEcuts::kStepHFEcutsTOF, track)) { |
1633 | survived = kFALSE; | |
1634 | //printf("Did not pass AliHFEcuts::kStepHFEcutsTOF\n"); | |
1635 | } | |
1636 | //else printf("Pass AliHFEcuts::kStepHFEcutsTOF\n"); | |
e3fc062d | 1637 | if(!fCutspreselect->CheckParticleCuts(AliHFEcuts::kStepHFEcutsTRD, track)) { |
1638 | survived = kFALSE; | |
1639 | //printf("Did not pass AliHFEcuts::kStepHFEcutsTRD\n"); | |
1640 | } | |
1641 | //else printf("Pass AliHFEcuts::kStepHFEcutsTRD\n"); | |
1642 | ||
1643 | if(survived){ | |
1644 | // Apply PID | |
1645 | AliHFEpidObject hfetrack; | |
3a72645a | 1646 | hfetrack.SetAnalysisType(AliHFEpidObject::kESDanalysis); |
1647 | hfetrack.SetRecTrack(track); | |
e3fc062d | 1648 | if(!fPIDpreselect->IsSelected(&hfetrack)) { |
1649 | //printf("Did not pass AliHFEcuts::kPID\n"); | |
1650 | survived = kFALSE; | |
1651 | } | |
1652 | //else printf("Pass AliHFEcuts::kPID\n"); | |
1653 | } | |
1654 | ||
1655 | return survived; | |
1656 | ||
1657 | } | |
70da6c5a | 1658 | //____________________________________________________________ |
1659 | void AliAnalysisTaskHFE::MakeEventContainer(){ | |
1660 | // | |
1661 | // Create the event container for the correction framework and link it | |
3a72645a | 1662 | // 1st bin: Vertex z-position |
1663 | // 2nd bin: V0AND decision (normalization to sigma_inel) | |
c2690925 | 1664 | // 3rd bin: Centrality class (for pp defined as number of contributors in vertex.) |
8c1c76e9 | 1665 | // 4th bin: Number of contributors > 0 |
70da6c5a | 1666 | // |
c2690925 | 1667 | |
8c1c76e9 | 1668 | const Int_t kNvar = 4; // number of variables on the grid: |
1669 | Int_t nBins[kNvar] = {120, 2, 11, 2}; | |
1670 | Double_t binMin[kNvar] = {-30. , 0., 0.0, 0.}; | |
1671 | Double_t binMax[kNvar] = {30., 2., 11.0, 2.}; | |
1672 | ||
1673 | AliCFContainer *evCont = new AliCFContainer("eventContainer", "Container for events", AliHFEcuts::kNcutStepsEvent, kNvar, nBins); | |
c2690925 | 1674 | |
8c1c76e9 | 1675 | Double_t *vertexBins = AliHFEtools::MakeLinearBinning(nBins[0], binMin[0], binMax[0]); |
1676 | Double_t *v0andBins = AliHFEtools::MakeLinearBinning(nBins[1], binMin[1], binMax[1]); | |
1677 | Double_t *centralityBins = AliHFEtools::MakeLinearBinning(nBins[2], binMin[2], binMax[2]); | |
1678 | Double_t *contributorsBins = AliHFEtools::MakeLinearBinning(nBins[3], binMin[3], binMax[3]); | |
1679 | evCont->SetBinLimits(0, vertexBins); | |
1680 | evCont->SetBinLimits(1, v0andBins); | |
1681 | evCont->SetBinLimits(2, centralityBins); | |
1682 | evCont->SetBinLimits(3, contributorsBins); | |
1683 | delete[] vertexBins; delete[] v0andBins; delete[] centralityBins; delete[] contributorsBins; | |
1684 | ||
1685 | fCFM->SetEventContainer(evCont); | |
70da6c5a | 1686 | } |
1687 | ||
809a4336 | 1688 | //____________________________________________________________ |
1689 | void AliAnalysisTaskHFE::MakeParticleContainer(){ | |
1690 | // | |
1691 | // Create the particle container for the correction framework manager and | |
1692 | // link it | |
1693 | // | |
3a72645a | 1694 | if(!fContainer) fContainer = new AliHFEcontainer("trackContainer"); |
1695 | fVarManager->DefineVariables(fContainer); | |
1696 | ||
1697 | // Create Correction Framework containers | |
1698 | fContainer->CreateContainer("MCTrackCont", "Track Container filled with MC information", AliHFEcuts::kNcutStepsMCTrack); | |
1699 | fContainer->CreateContainer("recTrackContReco", "Track Container filled with MC information", AliHFEcuts::kNcutStepsRecTrack + fPID->GetNumberOfPIDdetectors()); | |
1700 | fContainer->CreateContainer("recTrackContMC", "Track Container filled with MC information", AliHFEcuts::kNcutStepsRecTrack + fPID->GetNumberOfPIDdetectors()); | |
1701 | ||
c2690925 | 1702 | fContainer->CreateContainer("hadronicBackground", "Container for Hadronic Background", 2); |
3a72645a | 1703 | fContainer->CreateContainer("recTrackContDEReco", "Container for displaced electron analysis with Reco information", 1); |
1704 | fContainer->CreateContainer("recTrackContDEMC", "Container for displaced electron analysis with MC information", 1); | |
c2690925 | 1705 | fContainer->CreateContainer("recTrackContSecvtxReco", "Container for secondary vertexing analysis with Reco information", 1); |
1706 | fContainer->CreateContainer("recTrackContSecvtxMC", "Container for secondary vertexing analysis with MC information", 1); | |
fd6b8522 | 1707 | |
1708 | if(HasMCData()){ | |
a8ef1999 | 1709 | fContainer->CreateContainer("conversionElecs", "Container for weighted conversion electrons",7); |
1710 | fContainer->CreateContainer("mesonElecs", "Container for weighted electrons from meson decays",7); | |
e17c1f86 | 1711 | fContainer->Sumw2("conversionElecs"); |
1712 | fContainer->Sumw2("mesonElecs"); | |
8c1c76e9 | 1713 | |
1714 | if(fisNonHFEsystematics){ | |
1715 | const Char_t *sourceName[kElecBgSpecies]={"Pion","Eta","Omega","Phi","EtaPrime","Rho"}; | |
1716 | const Char_t *levelName[kBgLevels]={"Best","Lower","Upper"}; | |
1717 | for(Int_t iSource = 0; iSource < kElecBgSpecies; iSource++){ | |
1718 | for(Int_t iLevel = 0; iLevel < kBgLevels; iLevel++){ | |
1719 | 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); | |
1720 | 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 | 1721 | fContainer->Sumw2(Form("conversionElecs%s%s",sourceName[iSource],levelName[iLevel])); |
1722 | fContainer->Sumw2(Form("mesonElecs%s%s",sourceName[iSource],levelName[iLevel])); | |
8c1c76e9 | 1723 | } |
1724 | } | |
1725 | } | |
fd6b8522 | 1726 | //fContainer->CreateContainer("charmElecs", "Container for weighted charm electrons",2); |
1727 | } | |
1728 | ||
3a72645a | 1729 | fContainer->CreateCorrelationMatrix("correlationstepafterPID","THnSparse with correlations"); |
1730 | fContainer->CreateCorrelationMatrix("correlationstepafterDE","THnSparse with correlations"); | |
6555e2ad | 1731 | if(!fVarManager->IsVariableDefined("centrality")) { |
1732 | //printf("Create the two other correlation maps\n"); | |
1733 | fContainer->CreateCorrelationMatrix("correlationstepbeforePID","THnSparse with correlations"); | |
1734 | fContainer->CreateCorrelationMatrix("correlationstepafterTOF","THnSparse with correlations"); | |
1735 | } | |
3a72645a | 1736 | |
1737 | // Define the step names | |
1738 | for(UInt_t istep = 0; istep < AliHFEcuts::kNcutStepsMCTrack; istep++){ | |
1739 | fContainer->SetStepTitle("MCTrackCont", AliHFEcuts::MCCutName(istep), istep); | |
faee3b18 | 1740 | } |
3a72645a | 1741 | for(UInt_t istep = 0; istep < AliHFEcuts::kNcutStepsRecTrack; istep++){ |
1742 | fContainer->SetStepTitle("recTrackContReco", AliHFEcuts::RecoCutName(istep), istep); | |
1743 | fContainer->SetStepTitle("recTrackContMC", AliHFEcuts::RecoCutName(istep), istep); | |
259c3296 | 1744 | } |
3a72645a | 1745 | for(UInt_t ipid = 0; ipid < fPID->GetNumberOfPIDdetectors(); ipid++){ |
1746 | fContainer->SetStepTitle("recTrackContReco", fPID->SortedDetectorName(ipid), AliHFEcuts::kNcutStepsRecTrack + ipid); | |
1747 | fContainer->SetStepTitle("recTrackContMC", fPID->SortedDetectorName(ipid), AliHFEcuts::kNcutStepsRecTrack + ipid); | |
259c3296 | 1748 | } |
3a72645a | 1749 | } |
1750 | ||
1751 | //____________________________________________________________ | |
1752 | void AliAnalysisTaskHFE::InitPIDperformanceQA(){ | |
259c3296 | 1753 | // Add a histogram for Fake electrons |
70da6c5a | 1754 | const Int_t nDim=6; |
1755 | Int_t nBin[nDim] = {40, 8, 18, 2, 3, 3}; | |
3a72645a | 1756 | //number of variables on the grid:pt,eta,phi,charge, |
1757 | const Double_t kPtbound[2] = {0.1, 20.}; | |
1758 | const Double_t kEtabound[2] = {-0.8, 0.8}; | |
1759 | const Double_t kPhibound[2] = {0., 2. * TMath::Pi()}; | |
1760 | const Double_t kChargebound[2] = {-1.1, 1.1}; | |
1761 | const Double_t kAddInf1bound[2] = {0., 3.}; | |
1762 | const Double_t kAddInf2bound[2] = {0., 3.}; | |
1763 | Double_t minima[nDim] = {kPtbound[0], kEtabound[0], kPhibound[0], kChargebound[0], kAddInf1bound[0], kAddInf2bound[0]}; | |
1764 | Double_t maxima[nDim] = {kPtbound[1], kEtabound[1], kPhibound[1], kChargebound[1], kAddInf1bound[1], kAddInf2bound[1]}; | |
1765 | ||
1766 | 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); | |
1767 | 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 | 1768 | |
3a72645a | 1769 | fQACollection->BinLogAxis("PIDperformance", 0); |
1770 | fQACollection->BinLogAxis("SignalToBackgroundMC", 0); | |
1771 | fQACollection->Sumw2("PIDperformance"); | |
1772 | fQACollection->Sumw2("SignalToBackgroundMC"); | |
75d81601 | 1773 | } |
1774 | ||
6555e2ad | 1775 | //____________________________________________________________ |
1776 | void AliAnalysisTaskHFE::InitContaminationQA(){ | |
c2690925 | 1777 | // |
1778 | // Add QA for Impact Parameter cut | |
1779 | // | |
a8ef1999 | 1780 | |
1781 | TObjArray *array = fVarManager->GetVariables(); | |
1782 | Int_t nvars = array->GetEntriesFast(); | |
1783 | for(Int_t v = 0; v < nvars; v++) { | |
1784 | AliHFEvarManager::AliHFEvariable *variable = (AliHFEvarManager::AliHFEvariable *) array->At(v); | |
1785 | if(!variable) continue; | |
1786 | TString name(((AliHFEvarManager::AliHFEvariable *)variable)->GetName()); | |
1787 | if(!name.CompareTo("pt")) { | |
1788 | const Int_t nBinPt = variable->GetNumberOfBins(); | |
1789 | const Double_t *kPtRange = variable->GetBinning(); | |
1790 | ||
1791 | fQACollection->CreateTH1Farray("hadronsBeforeIPcut", "Hadrons before IP cut", nBinPt, kPtRange); | |
1792 | fQACollection->CreateTH1Farray("hadronsAfterIPcut", "Hadrons after IP cut", nBinPt, kPtRange); | |
1793 | fQACollection->CreateTH1Farray("hadronsBeforeIPcutMC", "Hadrons before IP cut; MC p_{t}", nBinPt, kPtRange); | |
1794 | fQACollection->CreateTH1Farray("hadronsAfterIPcutMC", "Hadrons after IP cut; MC p_{t} ", nBinPt, kPtRange); | |
1795 | ||
1796 | fQACollection->CreateTH2Farray("Ke3Kecorr", "Ke3 decay e and K correlation; Ke3K p_{t}; Ke3e p_{t}; ", nBinPt, kPtRange, 20,0.,20.); | |
1797 | fQACollection->CreateTH2Farray("Ke3K0Lecorr", "Ke3 decay e and K0L correlation; Ke3K0L p_{t}; Ke3e p_{t}; ", nBinPt, kPtRange, 20,0.,20.); | |
1798 | fQACollection->CreateTH1Farray("Kptspectra", "Charged Kaons: MC p_{t} ", nBinPt, kPtRange); | |
1799 | fQACollection->CreateTH1Farray("K0Lptspectra", "K0L: MC p_{t} ", nBinPt, kPtRange); | |
1800 | ||
1801 | const Double_t kDCAbound[2] = {-5., 5.}; | |
1802 | const Double_t kDCAsigbound[2] = {-50., 50.}; | |
1803 | ||
11ff28c5 | 1804 | const Int_t nDimDca=8; |
1805 | const Int_t nBinDca[nDimDca] = { 9, nBinPt, 2000, 2000, 12, 500, 6, 2}; | |
1806 | const Int_t nDimeDca=6; | |
1807 | const Int_t nBineDca[nDimeDca] = { 9, nBinPt, 2000, 2000, 12, 2}; | |
1808 | Double_t minimaDca[nDimDca] = { -1., 0., kDCAbound[0], kDCAsigbound[0], -1., 0, -1, -1.1}; | |
1809 | Double_t maximaDca[nDimDca] = { 8., 20., kDCAbound[1], kDCAsigbound[1], 11., 50, 5, 1.1}; | |
a8ef1999 | 1810 | |
1811 | Double_t *sourceBins = AliHFEtools::MakeLinearBinning(nBinDca[0], minimaDca[0], maximaDca[0]); | |
1812 | Double_t *dcaBins = AliHFEtools::MakeLinearBinning(nBinDca[2], minimaDca[2], maximaDca[2]); | |
1813 | Double_t *dcaSigBins = AliHFEtools::MakeLinearBinning(nBinDca[3], minimaDca[3], maximaDca[3]); | |
1814 | Double_t *centralityBins = AliHFEtools::MakeLinearBinning(nBinDca[4], minimaDca[4], maximaDca[4]); | |
1815 | Double_t *eProdRBins = AliHFEtools::MakeLinearBinning(nBinDca[5], minimaDca[5], maximaDca[5]); | |
1816 | Double_t *v0PIDBins = AliHFEtools::MakeLinearBinning(nBinDca[6], minimaDca[6], maximaDca[6]); | |
11ff28c5 | 1817 | Double_t *chargeBins = AliHFEtools::MakeLinearBinning(nBinDca[7], minimaDca[7], maximaDca[7]); |
a8ef1999 | 1818 | |
11ff28c5 | 1819 | fQACollection->CreateTHnSparseNoLimits("Dca", "Dca; source (0-all, 1-charm,etc); pT [GeV/c]; dca; dcasig; centrality bin; eProdR; v0pid; charge", nDimDca, nBinDca); |
a8ef1999 | 1820 | ((THnSparse*)(fQACollection->Get("Dca")))->SetBinEdges(0, sourceBins); |
1821 | ((THnSparse*)(fQACollection->Get("Dca")))->SetBinEdges(1, kPtRange); | |
1822 | ((THnSparse*)(fQACollection->Get("Dca")))->SetBinEdges(2, dcaBins); | |
1823 | ((THnSparse*)(fQACollection->Get("Dca")))->SetBinEdges(3, dcaSigBins); | |
1824 | ((THnSparse*)(fQACollection->Get("Dca")))->SetBinEdges(4, centralityBins); | |
1825 | ((THnSparse*)(fQACollection->Get("Dca")))->SetBinEdges(5, eProdRBins); | |
1826 | ((THnSparse*)(fQACollection->Get("Dca")))->SetBinEdges(6, v0PIDBins); | |
11ff28c5 | 1827 | ((THnSparse*)(fQACollection->Get("Dca")))->SetBinEdges(7, chargeBins); |
1828 | ||
1829 | fQACollection->CreateTHnSparseNoLimits("eDca", "eDca; source (0-all, 1-charm,etc); pT [GeV/c]; dca; dcasig; centrality bin; charge", nDimeDca, nBineDca); | |
1830 | ((THnSparse*)(fQACollection->Get("eDca")))->SetBinEdges(0, sourceBins); | |
1831 | ((THnSparse*)(fQACollection->Get("eDca")))->SetBinEdges(1, kPtRange); | |
1832 | ((THnSparse*)(fQACollection->Get("eDca")))->SetBinEdges(2, dcaBins); | |
1833 | ((THnSparse*)(fQACollection->Get("eDca")))->SetBinEdges(3, dcaSigBins); | |
1834 | ((THnSparse*)(fQACollection->Get("eDca")))->SetBinEdges(4, centralityBins); | |
1835 | ((THnSparse*)(fQACollection->Get("eDca")))->SetBinEdges(5, chargeBins); | |
1836 | ||
1837 | fQACollection->CreateTH2Farray("secondaryprotonDcaSig", "secondary proton dca significance: dca sig ", nBinPt, kPtRange, 2000, kDCAsigbound[0], kDCAsigbound[1]); | |
1838 | fQACollection->CreateTH2Farray("protonDcaSig", "proton dca significance: dca sig ", nBinPt, kPtRange, 2000, kDCAsigbound[0], kDCAsigbound[1]); | |
1839 | fQACollection->CreateTH2Farray("pionDcaSig", "pion dca significance: dca sig ", nBinPt, kPtRange, 2000, kDCAsigbound[0], kDCAsigbound[1]); | |
a8ef1999 | 1840 | |
1841 | break; | |
1842 | } | |
1843 | } | |
1844 | ||
8c1c76e9 | 1845 | } |
1846 | ||
1847 | //____________________________________________________________ | |
1848 | void AliAnalysisTaskHFE::InitHistoITScluster(){ | |
1849 | // | |
1850 | // Initialize a temporary histogram to monitor the chi2/ITS cluster | |
1851 | if(IsPbPb()) { | |
1852 | const Int_t kNDim = 7; | |
1853 | const Int_t kNBins[kNDim] = {88, 20,90,11, 160, 2, 1000}; | |
1854 | const Double_t kMin[kNDim] = {0.1, -1,0, 0.,0., 0, 0.}; | |
1855 | const Double_t kMax[kNDim] = {20., 1, 2.*TMath::Pi(), 11.,160, 2, 100.}; | |
1856 | fQACollection->CreateTHnSparse("fChi2perITScluster", "chi2/ITS cluster; p_{T} (GeV/c);eta;phi; centrality class;nclus;sharebit; #chi^{2}/ITS cluster", kNDim, kNBins, kMin, kMax); | |
1857 | fQACollection->BinLogAxis("fChi2perITScluster", 0); | |
1858 | } | |
1859 | else | |
1860 | { | |
1861 | const Int_t kNDim = 3; | |
1862 | const Int_t kNBins[kNDim] = {44, 11, 1000}; | |
1863 | const Double_t kMin[kNDim] = {0.1, 0., 0.}; | |
1864 | const Double_t kMax[kNDim] = {20., 11., 100.}; | |
1865 | fQACollection->CreateTHnSparse("fChi2perITScluster", "chi2/ITS cluster; p_{T} (GeV/c); centrality class; #chi^{2}/ITS cluster", kNDim, kNBins, kMin, kMax); | |
1866 | fQACollection->BinLogAxis("fChi2perITScluster", 0); | |
1867 | } | |
1868 | } | |
1869 | ||
1870 | //____________________________________________________________ | |
1871 | void AliAnalysisTaskHFE::SelectSpecialTrigger(const Char_t *trgclust, Int_t runMin, Int_t runMax){ | |
1872 | // | |
1873 | // Select only events triggered by a special trigeer cluster | |
1874 | // | |
1875 | if(!fSpecialTrigger) fSpecialTrigger = new AliOADBContainer("SpecialTrigger"); | |
1876 | fSpecialTrigger->AppendObject(new TObjString(trgclust), runMin, runMax); | |
1877 | } | |
1878 | ||
1879 | //____________________________________________________________ | |
1880 | const Char_t * AliAnalysisTaskHFE::GetSpecialTrigger(Int_t run){ | |
1881 | // | |
1882 | // Derive selected trigger string for given run | |
1883 | // | |
1884 | if(!fSpecialTrigger) return NULL; | |
1885 | TObjString *trg = dynamic_cast<TObjString *>(fSpecialTrigger->GetObject(run)); | |
1886 | if(!trg) return NULL; | |
1887 | return trg->String().Data(); | |
6555e2ad | 1888 | } |
1889 | ||
75d81601 | 1890 | //____________________________________________________________ |
50685501 | 1891 | void AliAnalysisTaskHFE::PrintStatus() const { |
78ea5ef4 | 1892 | // |
1893 | // Print Analysis status | |
1894 | // | |
75d81601 | 1895 | printf("\n\tAnalysis Settings\n\t========================================\n\n"); |
9bcfd1ab | 1896 | printf("\tSecondary Vertex finding: %s\n", GetPlugin(kSecVtx) ? "YES" : "NO"); |
1897 | printf("\tPrimary Vertex resolution: %s\n", GetPlugin(kPriVtx) ? "YES" : "NO"); | |
3a72645a | 1898 | printf("\tDisplaced electron analysis step: %s\n", GetPlugin(kDEstep) ? "YES" : "NO"); |
1899 | printf("\tTagged Track Analysis: %s\n", GetPlugin(kTaggedTrackAnalysis) ? "YES" : "NO"); | |
75d81601 | 1900 | printf("\n"); |
1901 | printf("\tParticle Identification Detectors:\n"); | |
3a72645a | 1902 | fPID->PrintStatus(); |
75d81601 | 1903 | printf("\n"); |
1904 | printf("\tQA: \n"); | |
1905 | printf("\t\tPID: %s\n", IsQAOn(kPIDqa) ? "YES" : "NO"); | |
e3fc062d | 1906 | printf("\t\tCUTS: %s\n", (fCuts != NULL && fCuts->IsQAOn()) ? "YES" : "NO"); |
75d81601 | 1907 | printf("\t\tMC: %s\n", IsQAOn(kMCqa) ? "YES" : "NO"); |
1908 | printf("\n"); | |
1909 | } | |
78ea5ef4 | 1910 | |
faee3b18 | 1911 | //____________________________________________________________ |
1912 | Bool_t AliAnalysisTaskHFE::FillProductionVertex(const AliVParticle * const track) const{ | |
1913 | // | |
1914 | // Find the production vertex of the associated MC track | |
1915 | // | |
1916 | if(!fMCEvent) return kFALSE; | |
1917 | const AliVParticle *mctrack = NULL; | |
1918 | TString objectType = track->IsA()->GetName(); | |
1919 | if(objectType.CompareTo("AliESDtrack") == 0 || objectType.CompareTo("AliAODTrack") == 0){ | |
1920 | // Reconstructed track | |
1921 | mctrack = fMCEvent->GetTrack(TMath::Abs(track->GetLabel())); | |
1922 | } else { | |
1923 | // MCParticle | |
1924 | mctrack = track; | |
1925 | } | |
1926 | ||
1927 | if(!mctrack) return kFALSE; | |
1928 | ||
1929 | Double_t xv = 0.0; | |
1930 | Double_t yv = 0.0; | |
1931 | ||
1932 | if(TString(mctrack->IsA()->GetName()).CompareTo("AliMCParticle") == 0){ | |
1933 | // case MCParticle | |
bf892a6a | 1934 | const AliMCParticle *mcpart = dynamic_cast<const AliMCParticle *>(mctrack); |
1935 | if(mcpart){ | |
1936 | xv = mcpart->Xv(); | |
1937 | yv = mcpart->Yv(); | |
1938 | } | |
faee3b18 | 1939 | } else { |
1940 | // case AODMCParticle | |
bf892a6a | 1941 | const AliAODMCParticle *mcpart = dynamic_cast<const AliAODMCParticle *>(mctrack); |
1942 | if(mcpart){ | |
1943 | xv = mcpart->Xv(); | |
1944 | yv = mcpart->Yv(); | |
1945 | } | |
faee3b18 | 1946 | } |
1947 | ||
1948 | //printf("xv %f, yv %f\n",xv,yv); | |
69ac0e6f | 1949 | fQACollection->Fill("radius", TMath::Abs(xv),TMath::Abs(yv)); |
faee3b18 | 1950 | |
1951 | return kTRUE; | |
1952 | ||
1953 | } | |
9bcfd1ab | 1954 | //__________________________________________ |
1955 | void AliAnalysisTaskHFE::SwitchOnPlugin(Int_t plug){ | |
1956 | // | |
1957 | // Switch on Plugin | |
1958 | // Available: | |
1959 | // - Primary vertex studies | |
1960 | // - Secondary vertex Studies | |
1961 | // - Post Processing | |
1962 | // | |
1963 | switch(plug){ | |
1964 | case kPriVtx: SETBIT(fPlugins, plug); break; | |
1965 | case kSecVtx: SETBIT(fPlugins, plug); break; | |
1966 | case kIsElecBackGround: SETBIT(fPlugins, plug); break; | |
1967 | case kPostProcess: SETBIT(fPlugins, plug); break; | |
3a72645a | 1968 | case kDEstep: SETBIT(fPlugins, plug); break; |
1969 | case kTaggedTrackAnalysis: SETBIT(fPlugins, plug); break; | |
9bcfd1ab | 1970 | default: AliError("Unknown Plugin"); |
1971 | }; | |
1972 | } | |
9bcfd1ab | 1973 | //__________________________________________ |
3a72645a | 1974 | Bool_t AliAnalysisTaskHFE::ProcessCutStep(Int_t cutStep, AliVParticle *track){ |
9bcfd1ab | 1975 | // |
1976 | // Check single track cuts for a given cut step | |
1977 | // Fill the particle container | |
1978 | // | |
3a72645a | 1979 | const Int_t kMCOffset = AliHFEcuts::kNcutStepsMCTrack; |
1980 | if(!fCFM->CheckParticleCuts(cutStep + kMCOffset, track)) return kFALSE; | |
1981 | if(fVarManager->IsSignalTrack()) { | |
1982 | fVarManager->FillContainer(fContainer, "recTrackContReco", cutStep, kFALSE); | |
1983 | fVarManager->FillContainer(fContainer, "recTrackContMC", cutStep, kTRUE); | |
9bcfd1ab | 1984 | } |
1985 | return kTRUE; | |
1986 | } | |
3a72645a | 1987 | //___________________________________________________ |
c2690925 | 1988 | Bool_t AliAnalysisTaskHFE::ReadCentrality() { |
3a72645a | 1989 | // |
1990 | // Recover the centrality of the event from ESD or AOD | |
1991 | // | |
11ff28c5 | 1992 | |
1993 | Float_t fCentralityLimitstemp[12]; | |
1994 | Float_t fCentralityLimitsdefault[12]= {0.,5.,10., 20., 30., 40., 50., 60.,70.,80., 90., 100.}; | |
1995 | if(!fPbPbUserCentralityBinning) memcpy(fCentralityLimitstemp,fCentralityLimitsdefault,sizeof(fCentralityLimitsdefault)); | |
1996 | else memcpy(fCentralityLimitstemp,fCentralityLimits,sizeof(fCentralityLimitsdefault)); | |
1997 | ||
1998 | ||
e156c3bb | 1999 | Int_t bin = -1; |
2000 | if(IsPbPb()) { | |
2001 | // Centrality | |
2002 | AliCentrality *centrality = fInputEvent->GetCentrality(); | |
11ff28c5 | 2003 | fCentralityPercent = centrality->GetCentralityPercentile("V0M"); |
2004 | //printf("centrality %f\n",fCentralityPercent); | |
2005 | ||
e156c3bb | 2006 | for(Int_t ibin = 0; ibin < 11; ibin++){ |
11ff28c5 | 2007 | if(fCentralityPercent >= fCentralityLimitstemp[ibin] && fCentralityPercent < fCentralityLimitstemp[ibin+1]){ |
2008 | bin = ibin; | |
2009 | //printf("test bin %f, low %f, high %f, %d\n",fCentralityPercent,fCentralityLimitstemp[ibin],fCentralityLimitstemp[ibin+1],ibin); | |
e156c3bb | 2010 | break; |
2011 | } | |
11ff28c5 | 2012 | } |
2013 | ||
e156c3bb | 2014 | if(bin == -1) bin = 11; // Overflow |
2015 | } else { | |
2016 | // PP: Tracklet multiplicity, use common definition | |
2017 | Int_t itsMultiplicity = GetITSMultiplicity(fInputEvent); | |
2018 | Int_t multiplicityLimits[8] = {0, 1, 9, 17, 25, 36, 60, 500}; | |
2019 | for(Int_t ibin = 0; ibin < 7; ibin++){ | |
2020 | if(itsMultiplicity >= multiplicityLimits[ibin] && itsMultiplicity < multiplicityLimits[ibin + 1]){ | |
2021 | bin = ibin; | |
2022 | break; | |
2023 | } | |
2024 | } | |
2025 | if(bin == -1) bin = 7; // Overflow | |
2026 | } | |
2027 | fCentralityF = bin; | |
2028 | AliDebug(2, Form("Centrality class %d\n", fCentralityF)); | |
11ff28c5 | 2029 | |
c2690925 | 2030 | |
e156c3bb | 2031 | // contributors, to be outsourced |
2032 | const AliVVertex *vtx; | |
2033 | if(IsAODanalysis()){ | |
2034 | AliAODEvent *fAOD = dynamic_cast<AliAODEvent *>(fInputEvent); | |
2035 | if(!fAOD){ | |
2036 | AliError("AOD Event required for AOD Analysis"); | |
2037 | return kFALSE; | |
2038 | } | |
2039 | vtx = fAOD->GetPrimaryVertex(); | |
2040 | } else { | |
2041 | AliESDEvent *fESD = dynamic_cast<AliESDEvent *>(fInputEvent); | |
2042 | if(!fESD){ | |
2043 | AliError("ESD Event required for ESD Analysis"); | |
2044 | return kFALSE; | |
2045 | } | |
2046 | vtx = fESD->GetPrimaryVertexSPD(); | |
2047 | } | |
2048 | if(!vtx){ | |
2049 | fContributors = 0.5; | |
2050 | return kFALSE; | |
2051 | } | |
2052 | else { | |
2053 | Int_t contributorstemp = vtx->GetNContributors(); | |
2054 | if( contributorstemp <= 0) fContributors = 0.5; | |
2055 | else fContributors = 1.5; | |
11ff28c5 | 2056 | //printf("Number of contributors %d\n",contributorstemp); |
e156c3bb | 2057 | } |
2058 | return kTRUE; | |
2059 | } | |
3a72645a | 2060 | |
e156c3bb | 2061 | //___________________________________________________ |
2062 | Int_t AliAnalysisTaskHFE::GetITSMultiplicity(AliVEvent *ev){ | |
2063 | // | |
2064 | // Definition of the Multiplicity according to the JPSI group (F. Kramer) | |
2065 | // | |
2066 | Int_t nTracklets = 0; | |
2067 | Int_t nAcc = 0; | |
2068 | Double_t etaRange = 1.6; | |
2069 | ||
2070 | if (ev->IsA() == AliAODEvent::Class()) { | |
2071 | AliAODTracklets *tracklets = ((AliAODEvent*)ev)->GetTracklets(); | |
2072 | nTracklets = tracklets->GetNumberOfTracklets(); | |
2073 | for (Int_t nn = 0; nn < nTracklets; nn++) { | |
2074 | Double_t theta = tracklets->GetTheta(nn); | |
2075 | Double_t eta = -TMath::Log(TMath::Tan(theta/2.0)); | |
2076 | if (TMath::Abs(eta) < etaRange) nAcc++; | |
2077 | } | |
2078 | } else if (ev->IsA() == AliESDEvent::Class()) { | |
2079 | nTracklets = ((AliESDEvent*)ev)->GetMultiplicity()->GetNumberOfTracklets(); | |
2080 | for (Int_t nn = 0; nn < nTracklets; nn++) { | |
2081 | Double_t eta = ((AliESDEvent*)ev)->GetMultiplicity()->GetEta(nn); | |
2082 | if (TMath::Abs(eta) < etaRange) nAcc++; | |
2083 | } | |
2084 | } else return -1; | |
c2690925 | 2085 | |
e156c3bb | 2086 | return nAcc; |
3a72645a | 2087 | } |
e156c3bb | 2088 | |
8c1c76e9 | 2089 | //___________________________________________________ |
2090 | Bool_t AliAnalysisTaskHFE::InitializeHadronBackground(Int_t run){ | |
2091 | // | |
2092 | // Initialize background factors array from the AliOADBContainer | |
2093 | // The container is expected to provide a TObjArray with the name | |
2094 | // "hadronBackground" and the size 12 for the given run number | |
2095 | // | |
2096 | AliDebug(1, "Deriving hadronic background parameterization from OADB container"); | |
2097 | TObjArray *functions = dynamic_cast<TObjArray *>(fHadronBackgroundOADB->GetObject(run, "hadronBackground")); | |
2098 | if(!functions){ | |
2099 | AliDebug(1, "Content in the OADB Container is not a TObjArray"); | |
2100 | fBackGroundFactorApply = kFALSE; | |
2101 | return kFALSE; | |
2102 | } | |
2103 | if(functions->GetSize() < 12){ | |
2104 | AliDebug(1, Form("Size not matching: 12 expected, %d provided", functions->GetSize())); | |
2105 | fBackGroundFactorApply = kFALSE; | |
2106 | return kFALSE; | |
2107 | } | |
2108 | for(Int_t icent = 0; icent < 12; icent++) fkBackGroundFactorArray[icent] = dynamic_cast<const TF1 *>(functions->UncheckedAt(icent)); | |
2109 | return kTRUE; | |
2110 | } | |
2111 | ||
3a72645a | 2112 | //___________________________________________________ |
2113 | void AliAnalysisTaskHFE::RejectionPileUpVertexRangeEventCut() { | |
2114 | // | |
2115 | // Recover the centrality of the event from ESD or AOD | |
2116 | // | |
2117 | if(IsAODanalysis()){ | |
2118 | ||
2119 | AliAODEvent *fAOD = dynamic_cast<AliAODEvent *>(fInputEvent); | |
2120 | if(!fAOD){ | |
13242232 | 2121 | AliError("AOD Event required for AOD Analysis"); |
e156c3bb | 2122 | return; |
3a72645a | 2123 | } |
2124 | // PileUp | |
11ff28c5 | 2125 | fIdentifiedAsPileUp = kFALSE; |
3a72645a | 2126 | if(fRemovePileUp && fAOD->IsPileupFromSPD()) fIdentifiedAsPileUp = kTRUE; |
2127 | // Z vertex | |
11ff28c5 | 2128 | fIdentifiedAsOutInz = kFALSE; |
2129 | //printf("Z vertex %f and out %f\n",fAOD->GetPrimaryVertex()->GetZ(),fCuts->GetVertexRange()); | |
3a72645a | 2130 | if(TMath::Abs(fAOD->GetPrimaryVertex()->GetZ()) > fCuts->GetVertexRange()) fIdentifiedAsOutInz = kTRUE; |
2131 | // Event Cut | |
2132 | fPassTheEventCut = kTRUE; | |
2133 | if(!fCFM->CheckEventCuts(AliHFEcuts::kEventStepReconstructed, fAOD)) fPassTheEventCut = kFALSE; | |
2134 | ||
2135 | ||
2136 | } else { | |
2137 | ||
2138 | AliDebug(3, "Processing ESD Centrality"); | |
2139 | AliESDEvent *fESD = dynamic_cast<AliESDEvent *>(fInputEvent); | |
2140 | if(!fESD){ | |
13242232 | 2141 | AliError("ESD Event required for ESD Analysis"); |
e156c3bb | 2142 | return; |
3a72645a | 2143 | } |
2144 | // PileUp | |
2145 | fIdentifiedAsPileUp = kFALSE; | |
2146 | if(fRemovePileUp && fESD->IsPileupFromSPD()) fIdentifiedAsPileUp = kTRUE; | |
2147 | // Z vertex | |
2148 | fIdentifiedAsOutInz = kFALSE; | |
fd6b8522 | 2149 | if (IsPbPb()) { |
2150 | //printf("PbPb\n"); | |
2151 | if(fESD->GetPrimaryVertex()){ | |
2152 | if(TMath::Abs(fESD->GetPrimaryVertex()->GetZ()) > fCuts->GetVertexRange()) fIdentifiedAsOutInz = kTRUE; | |
2153 | } | |
2154 | } | |
2155 | else { | |
2156 | //printf("pp\n"); | |
2157 | if(fESD->GetPrimaryVertexTracks()){ | |
c2690925 | 2158 | if(TMath::Abs(fESD->GetPrimaryVertexTracks()->GetZ()) > fCuts->GetVertexRange()) fIdentifiedAsOutInz = kTRUE; |
fd6b8522 | 2159 | } |
3a72645a | 2160 | } |
2161 | //Event Cut | |
2162 | fPassTheEventCut = kTRUE; | |
2163 | if(!fCFM->CheckEventCuts(AliHFEcuts::kEventStepReconstructed, fESD)) fPassTheEventCut = kFALSE; | |
2164 | ||
2165 | ||
2166 | } | |
2167 | ||
2168 | } | |
70da6c5a | 2169 |