bugfixes + extended track matching histograms
[u/mrichter/AliRoot.git] / PWGGA / GammaConv / AliAnalysisTaskGammaConvCalo.cxx
CommitLineData
8bdca7f1 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: Baldo Sahlmueller, Friederike Bock *
5 * Version 1.0 *
6 * *
7 * *
8 * Permission to use, copy, modify and distribute this software and its *
9 * documentation strictly for non-commercial purposes is hereby granted *
10 * without fee, provided that the above copyright notice appears in all *
11 * copies and that both the copyright notice and this permission notice *
12 * appear in the supporting documentation. The authors make no claims *
13 * about the suitability of this software for any purpose. It is *
14 * provided "as is" without express or implied warranty. *
15 **************************************************************************/
16
17//////////////////////////////////////////////////////////////////
18//----------------------------------------------------------------
19// Class used to do analysis on conversion photons + calo photons
20//----------------------------------------------------------------
21//////////////////////////////////////////////////////////////////
22#include "TChain.h"
23#include "TTree.h"
24#include "TBranch.h"
25#include "TFile.h"
26#include "TH1F.h"
27#include "TH2F.h"
28#include "TH3F.h"
29#include "THnSparse.h"
30#include "TCanvas.h"
31#include "TNtuple.h"
32#include "AliAnalysisTask.h"
33#include "AliAnalysisManager.h"
34#include "AliESDEvent.h"
35#include "AliESDInputHandler.h"
36#include "AliMCEventHandler.h"
37#include "AliMCEvent.h"
38#include "AliMCParticle.h"
39#include "AliCentrality.h"
40#include "AliESDVZERO.h"
41#include "AliESDpid.h"
42#include "AliAnalysisTaskGammaConvCalo.h"
43#include "AliVParticle.h"
44#include "AliESDtrack.h"
45#include "AliESDtrackCuts.h"
46#include "AliKFVertex.h"
47#include "AliV0ReaderV1.h"
48#include "AliGenCocktailEventHeader.h"
49#include "AliConversionAODBGHandlerRP.h"
50#include "AliAODMCParticle.h"
51#include "AliAODMCHeader.h"
52#include "AliEventplane.h"
53#include "AliAnalysisTaskEMCALClusterizeFast.h"
54#include "AliAODEvent.h"
55#include "AliAODInputHandler.h"
56#include "AliESDEvent.h"
57#include "AliESDInputHandler.h"
58#include "AliInputEventHandler.h"
59
60ClassImp(AliAnalysisTaskGammaConvCalo)
61
62//________________________________________________________________________
63AliAnalysisTaskGammaConvCalo::AliAnalysisTaskGammaConvCalo(): AliAnalysisTaskSE(),
64 fV0Reader(NULL),
65 fBGHandler(NULL),
66 fBGHandlerRP(NULL),
67 fBGClusHandler(NULL),
68 fBGClusHandlerRP(NULL),
69 fInputEvent(NULL),
70 fMCEvent(NULL),
71 fMCStack(NULL),
72 fCutFolder(NULL),
73 fESDList(NULL),
74 fBackList(NULL),
75 fMotherList(NULL),
76 fPhotonDCAList(NULL),
77 fMesonDCAList(NULL),
78 fTrueList(NULL),
79 fMCList(NULL),
80 fHeaderNameList(NULL),
81 fTagOutputList(NULL),
82 fOutputContainer(NULL),
83 fReaderGammas(NULL),
84 fGammaCandidates(NULL),
85 fClusterCandidates(NULL),
344100c4 86 fEventCutArray(NULL),
87 fEventCuts(NULL),
8bdca7f1 88 fCutArray(NULL),
89 fConversionCuts(NULL),
90 fClusterCutArray(NULL),
91 fCaloPhotonCuts(NULL),
92 fMesonCutArray(NULL),
93 fMesonCuts(NULL),
94 fHistoConvGammaPt(NULL),
95 fHistoConvGammaR(NULL),
96 fHistoConvGammaEta(NULL),
97 fTreeConvGammaPtDcazCat(NULL),
98 fPtGamma(0),
99 fDCAzPhoton(0),
100 fRConvPhoton(0),
101 fEtaPhoton(0),
102 fCharCatPhoton(0),
103 fCharPhotonMCInfo(0),
104 fHistoMotherInvMassPt(NULL),
d53bf4ac 105 fHistoMotherMatchedInvMassPt(NULL),
8bdca7f1 106 fSparseMotherInvMassPtZM(NULL),
107 fHistoMotherBackInvMassPt(NULL),
108 fSparseMotherBackInvMassPtZM(NULL),
109 fHistoMotherInvMassEalpha(NULL),
110 fHistoMotherPi0PtY(NULL),
111 fHistoMotherEtaPtY(NULL),
112 fHistoMotherPi0PtAlpha(NULL),
113 fHistoMotherEtaPtAlpha(NULL),
114 fHistoMotherPi0PtOpenAngle(NULL),
115 fHistoMotherEtaPtOpenAngle(NULL),
4e8dcc76 116 fHistoMotherPi0ConvPhotonEtaPhi(NULL),
117 fHistoMotherEtaConvPhotonEtaPhi(NULL),
20af4b69 118 fHistoMotherInvMassECalib(NULL),
119 fHistoMotherInvMassECalibalpha(NULL),
8bdca7f1 120 fTreeMesonsInvMassPtDcazMinDcazMaxFlag(NULL),
121 fInvMass(0),
122 fPt(0),
123 fDCAzGammaMin(0),
124 fDCAzGammaMax(0),
125 fCharFlag(0),
126 fCharMesonMCInfo(0),
127 fHistoConvGammaUntagged(NULL),
128 fHistoConvGammaTagged(NULL),
129 fHistoConvGammaPi0Tagged(NULL),
130 fHistoConvGammaEtaTagged(NULL),
131 fHistoPhotonPairAll(NULL),
132 fHistoPhotonPairAllGam(NULL),
133 fHistoClusGammaPt(NULL),
134 fHistoMCHeaders(NULL),
135 fHistoMCAllGammaPt(NULL),
20af4b69 136 fHistoMCAllGammaEMCALAccPt(NULL),
8bdca7f1 137 fHistoMCDecayGammaPi0Pt(NULL),
138 fHistoMCDecayGammaRhoPt(NULL),
139 fHistoMCDecayGammaEtaPt(NULL),
140 fHistoMCDecayGammaOmegaPt(NULL),
141 fHistoMCDecayGammaEtapPt(NULL),
142 fHistoMCDecayGammaPhiPt(NULL),
143 fHistoMCDecayGammaSigmaPt(NULL),
144 fHistoMCConvGammaPt(NULL),
145 fHistoMCConvGammaR(NULL),
146 fHistoMCConvGammaEta(NULL),
147 fHistoMCPi0Pt(NULL),
148 fHistoMCPi0WOWeightPt(NULL),
149 fHistoMCEtaPt(NULL),
150 fHistoMCEtaWOWeightPt(NULL),
151 fHistoMCPi0InAccPt(NULL),
152 fHistoMCEtaInAccPt(NULL),
153 fHistoMCPi0PtY(NULL),
154 fHistoMCEtaPtY(NULL),
de752898 155 fHistoMCPi0PtAlpha(NULL),
156 fHistoMCEtaPtAlpha(NULL),
8bdca7f1 157 fHistoMCK0sPt(NULL),
158 fHistoMCK0sWOWeightPt(NULL),
159 fHistoMCK0sPtY(NULL),
160 fHistoMCSecPi0PtvsSource(NULL),
161 fHistoMCSecPi0Source(NULL),
162 fHistoMCSecEtaPt(NULL),
163 fHistoMCSecEtaSource(NULL),
ed8bc1ca 164 fHistoTruePi0InvMassPt(NULL),
165 fHistoTrueEtaInvMassPt(NULL),
166 fHistoTruePi0CaloPhotonInvMassPt(NULL),
167 fHistoTrueEtaCaloPhotonInvMassPt(NULL),
20af4b69 168 fHistoTruePi0CaloConvertedPhotonInvMassPt(NULL),
169 fHistoTruePi0CaloConvertedPhotonMatchedInvMassPt(NULL),
170 fHistoTrueEtaCaloConvertedPhotonInvMassPt(NULL),
171 fHistoTrueEtaCaloConvertedPhotonMatchedInvMassPt(NULL),
ed8bc1ca 172 fHistoTruePi0CaloElectronInvMassPt(NULL),
173 fHistoTrueEtaCaloElectronInvMassPt(NULL),
174 fHistoTruePi0CaloMergedClusterInvMassPt(NULL),
175 fHistoTrueEtaCaloMergedClusterInvMassPt(NULL),
fd94f234 176 fHistoTrueMotherCaloEMNonLeadingInvMassPt(NULL),
ed8bc1ca 177 fHistoTruePi0CaloMergedClusterPartConvInvMassPt(NULL),
178 fHistoTrueEtaCaloMergedClusterPartConvInvMassPt(NULL),
179 fHistoTruePrimaryPi0InvMassPt(NULL),
180 fHistoTruePrimaryEtaInvMassPt(NULL),
181 fHistoTruePrimaryPi0W0WeightingInvMassPt(NULL),
182 fHistoTruePrimaryEtaW0WeightingInvMassPt(NULL),
183 fProfileTruePrimaryPi0WeightsInvMassPt(NULL),
184 fProfileTruePrimaryEtaWeightsInvMassPt(NULL),
8bdca7f1 185 fHistoTruePrimaryPi0MCPtResolPt(NULL),
186 fHistoTruePrimaryEtaMCPtResolPt(NULL),
ed8bc1ca 187 fHistoTrueSecondaryPi0InvMassPt(NULL),
188 fHistoTrueSecondaryEtaInvMassPt(NULL),
189 fHistoTrueSecondaryPi0FromK0sInvMassPt(NULL),
8bdca7f1 190 fHistoTrueK0sWithPi0DaughterMCPt(NULL),
ed8bc1ca 191 fHistoTrueSecondaryPi0FromEtaInvMassPt(NULL),
8bdca7f1 192 fHistoTrueEtaWithPi0DaughterMCPt(NULL),
ed8bc1ca 193 fHistoTrueSecondaryPi0FromLambdaInvMassPt(NULL),
8bdca7f1 194 fHistoTrueLambdaWithPi0DaughterMCPt(NULL),
195 fHistoTrueBckGGInvMassPt(NULL),
196 fHistoTrueBckContInvMassPt(NULL),
197 fHistoTruePi0PtY(NULL),
198 fHistoTrueEtaPtY(NULL),
199 fHistoTruePi0PtAlpha(NULL),
200 fHistoTrueEtaPtAlpha(NULL),
201 fHistoTruePi0PtOpenAngle(NULL),
202 fHistoTrueEtaPtOpenAngle(NULL),
8bdca7f1 203 fHistoTrueConvGammaPt(NULL),
204 fHistoTrueConvPi0GammaPt(NULL),
205 fHistoTrueConvGammaEta(NULL),
206 fHistoCombinatorialPt(NULL),
207 fHistoTruePrimaryConvGammaPt(NULL),
208 fHistoTruePrimaryConvGammaESDPtMCPt(NULL),
209 fHistoTrueSecondaryConvGammaPt(NULL),
210 fHistoTrueSecondaryConvGammaFromXFromK0sPt(NULL),
211 fHistoTrueSecondaryConvGammaFromXFromLambdaPt(NULL),
8bdca7f1 212 fHistoTrueClusGammaPt(NULL),
fd94f234 213 fHistoTrueClusUnConvGammaPt(NULL),
20af4b69 214 fHistoTrueClusUnConvGammaMCPt(NULL),
fd94f234 215 fHistoTrueClusElectronPt(NULL),
216 fHistoTrueClusConvGammaPt(NULL),
20af4b69 217 fHistoTrueClusConvGammaMCPt(NULL),
fd94f234 218 fHistoTrueClusConvGammaFullyPt(NULL),
219 fHistoTrueClusMergedGammaPt(NULL),
220 fHistoTrueClusMergedPartConvGammaPt(NULL),
221 fHistoTrueClusDalitzPt(NULL),
222 fHistoTrueClusDalitzMergedPt(NULL),
223 fHistoTrueClusPhotonFromElecMotherPt(NULL),
224 fHistoTrueClusShowerPt(NULL),
cc579963 225 fHistoTrueClusSubLeadingPt(NULL),
226 fHistoTrueClusNParticles(NULL),
fd94f234 227 fHistoTrueClusEMNonLeadingPt(NULL),
228 fHistoTrueNLabelsInClus(NULL),
8bdca7f1 229 fHistoTruePrimaryClusGammaPt(NULL),
230 fHistoTruePrimaryClusGammaESDPtMCPt(NULL),
231 fHistoNEvents(NULL),
232 fHistoNGoodESDTracks(NULL),
233 fHistoNGammaCandidates(NULL),
234 fHistoNGoodESDTracksVsNGammaCanditates(NULL),
235 fHistoNV0Tracks(NULL),
236 fProfileEtaShift(NULL),
237 fEventPlaneAngle(-100),
238 fRandom(0),
239 fNGammaCandidates(0),
240 fUnsmearedPx(NULL),
241 fUnsmearedPy(NULL),
242 fUnsmearedPz(NULL),
243 fUnsmearedE(NULL),
244 fMCStackPos(NULL),
245 fMCStackNeg(NULL),
246 fESDArrayPos(NULL),
247 fESDArrayNeg(NULL),
248 fnCuts(0),
249 fiCut(0),
250 fMoveParticleAccordingToVertex(kTRUE),
251 fIsHeavyIon(0),
252 fDoMesonAnalysis(kTRUE),
253 fDoMesonQA(0),
254 fDoPhotonQA(0),
fd94f234 255 fDoClusterQA(0),
8bdca7f1 256 fIsFromMBHeader(kTRUE),
d53bf4ac 257 fIsMC(kFALSE)
8bdca7f1 258{
259
260}
261
262//________________________________________________________________________
263AliAnalysisTaskGammaConvCalo::AliAnalysisTaskGammaConvCalo(const char *name):
264 AliAnalysisTaskSE(name),
265 fV0Reader(NULL),
266 fBGHandler(NULL),
267 fBGHandlerRP(NULL),
268 fBGClusHandler(NULL),
269 fBGClusHandlerRP(NULL),
270 fInputEvent(NULL),
271 fMCEvent(NULL),
272 fMCStack(NULL),
273 fCutFolder(NULL),
274 fESDList(NULL),
275 fBackList(NULL),
276 fMotherList(NULL),
277 fPhotonDCAList(NULL),
278 fMesonDCAList(NULL),
279 fTrueList(NULL),
280 fMCList(NULL),
281 fHeaderNameList(NULL),
282 fTagOutputList(NULL),
283 fOutputContainer(0),
284 fReaderGammas(NULL),
285 fGammaCandidates(NULL),
286 fClusterCandidates(NULL),
344100c4 287 fEventCutArray(NULL),
288 fEventCuts(NULL),
8bdca7f1 289 fCutArray(NULL),
290 fConversionCuts(NULL),
291 fClusterCutArray(NULL),
292 fCaloPhotonCuts(NULL),
293 fMesonCutArray(NULL),
294 fMesonCuts(NULL),
295 fHistoConvGammaPt(NULL),
296 fHistoConvGammaR(NULL),
297 fHistoConvGammaEta(NULL),
298 fTreeConvGammaPtDcazCat(NULL),
299 fPtGamma(0),
300 fDCAzPhoton(0),
301 fRConvPhoton(0),
302 fEtaPhoton(0),
303 fCharCatPhoton(0),
304 fCharPhotonMCInfo(0),
305 fHistoMotherInvMassPt(NULL),
d53bf4ac 306 fHistoMotherMatchedInvMassPt(NULL),
8bdca7f1 307 fSparseMotherInvMassPtZM(NULL),
308 fHistoMotherBackInvMassPt(NULL),
309 fSparseMotherBackInvMassPtZM(NULL),
310 fHistoMotherInvMassEalpha(NULL),
311 fHistoMotherPi0PtY(NULL),
312 fHistoMotherEtaPtY(NULL),
313 fHistoMotherPi0PtAlpha(NULL),
314 fHistoMotherEtaPtAlpha(NULL),
315 fHistoMotherPi0PtOpenAngle(NULL),
316 fHistoMotherEtaPtOpenAngle(NULL),
4e8dcc76 317 fHistoMotherPi0ConvPhotonEtaPhi(NULL),
318 fHistoMotherEtaConvPhotonEtaPhi(NULL),
20af4b69 319 fHistoMotherInvMassECalib(NULL),
320 fHistoMotherInvMassECalibalpha(NULL),
8bdca7f1 321 fTreeMesonsInvMassPtDcazMinDcazMaxFlag(NULL),
322 fInvMass(0),
323 fPt(0),
324 fDCAzGammaMin(0),
325 fDCAzGammaMax(0),
326 fCharFlag(0),
327 fCharMesonMCInfo(0),
328 fHistoConvGammaUntagged(NULL),
329 fHistoConvGammaTagged(NULL),
330 fHistoConvGammaPi0Tagged(NULL),
331 fHistoConvGammaEtaTagged(NULL),
332 fHistoPhotonPairAll(NULL),
333 fHistoPhotonPairAllGam(NULL),
334 fHistoClusGammaPt(NULL),
335 fHistoMCHeaders(NULL),
336 fHistoMCAllGammaPt(NULL),
20af4b69 337 fHistoMCAllGammaEMCALAccPt(NULL),
8bdca7f1 338 fHistoMCDecayGammaPi0Pt(NULL),
339 fHistoMCDecayGammaRhoPt(NULL),
340 fHistoMCDecayGammaEtaPt(NULL),
341 fHistoMCDecayGammaOmegaPt(NULL),
342 fHistoMCDecayGammaEtapPt(NULL),
343 fHistoMCDecayGammaPhiPt(NULL),
344 fHistoMCDecayGammaSigmaPt(NULL),
345 fHistoMCConvGammaPt(NULL),
346 fHistoMCConvGammaR(NULL),
347 fHistoMCConvGammaEta(NULL),
348 fHistoMCPi0Pt(NULL),
349 fHistoMCPi0WOWeightPt(NULL),
350 fHistoMCEtaPt(NULL),
351 fHistoMCEtaWOWeightPt(NULL),
352 fHistoMCPi0InAccPt(NULL),
353 fHistoMCEtaInAccPt(NULL),
354 fHistoMCPi0PtY(NULL),
355 fHistoMCEtaPtY(NULL),
de752898 356 fHistoMCPi0PtAlpha(NULL),
357 fHistoMCEtaPtAlpha(NULL),
8bdca7f1 358 fHistoMCK0sPt(NULL),
359 fHistoMCK0sWOWeightPt(NULL),
360 fHistoMCK0sPtY(NULL),
361 fHistoMCSecPi0PtvsSource(NULL),
362 fHistoMCSecPi0Source(NULL),
363 fHistoMCSecEtaPt(NULL),
364 fHistoMCSecEtaSource(NULL),
ed8bc1ca 365 fHistoTruePi0InvMassPt(NULL),
366 fHistoTrueEtaInvMassPt(NULL),
367 fHistoTruePi0CaloPhotonInvMassPt(NULL),
368 fHistoTrueEtaCaloPhotonInvMassPt(NULL),
20af4b69 369 fHistoTruePi0CaloConvertedPhotonInvMassPt(NULL),
370 fHistoTruePi0CaloConvertedPhotonMatchedInvMassPt(NULL),
371 fHistoTrueEtaCaloConvertedPhotonInvMassPt(NULL),
372 fHistoTrueEtaCaloConvertedPhotonMatchedInvMassPt(NULL),
ed8bc1ca 373 fHistoTruePi0CaloElectronInvMassPt(NULL),
374 fHistoTrueEtaCaloElectronInvMassPt(NULL),
375 fHistoTruePi0CaloMergedClusterInvMassPt(NULL),
376 fHistoTrueEtaCaloMergedClusterInvMassPt(NULL),
fd94f234 377 fHistoTrueMotherCaloEMNonLeadingInvMassPt(NULL),
ed8bc1ca 378 fHistoTruePi0CaloMergedClusterPartConvInvMassPt(NULL),
379 fHistoTrueEtaCaloMergedClusterPartConvInvMassPt(NULL),
380 fHistoTruePrimaryPi0InvMassPt(NULL),
381 fHistoTruePrimaryEtaInvMassPt(NULL),
382 fHistoTruePrimaryPi0W0WeightingInvMassPt(NULL),
383 fHistoTruePrimaryEtaW0WeightingInvMassPt(NULL),
384 fProfileTruePrimaryPi0WeightsInvMassPt(NULL),
385 fProfileTruePrimaryEtaWeightsInvMassPt(NULL),
8bdca7f1 386 fHistoTruePrimaryPi0MCPtResolPt(NULL),
387 fHistoTruePrimaryEtaMCPtResolPt(NULL),
ed8bc1ca 388 fHistoTrueSecondaryPi0InvMassPt(NULL),
389 fHistoTrueSecondaryEtaInvMassPt(NULL),
390 fHistoTrueSecondaryPi0FromK0sInvMassPt(NULL),
8bdca7f1 391 fHistoTrueK0sWithPi0DaughterMCPt(NULL),
ed8bc1ca 392 fHistoTrueSecondaryPi0FromEtaInvMassPt(NULL),
8bdca7f1 393 fHistoTrueEtaWithPi0DaughterMCPt(NULL),
ed8bc1ca 394 fHistoTrueSecondaryPi0FromLambdaInvMassPt(NULL),
8bdca7f1 395 fHistoTrueLambdaWithPi0DaughterMCPt(NULL),
396 fHistoTrueBckGGInvMassPt(NULL),
397 fHistoTrueBckContInvMassPt(NULL),
398 fHistoTruePi0PtY(NULL),
399 fHistoTrueEtaPtY(NULL),
400 fHistoTruePi0PtAlpha(NULL),
401 fHistoTrueEtaPtAlpha(NULL),
402 fHistoTruePi0PtOpenAngle(NULL),
403 fHistoTrueEtaPtOpenAngle(NULL),
8bdca7f1 404 fHistoTrueConvGammaPt(NULL),
405 fHistoTrueConvPi0GammaPt(NULL),
406 fHistoTrueConvGammaEta(NULL),
407 fHistoCombinatorialPt(NULL),
408 fHistoTruePrimaryConvGammaPt(NULL),
409 fHistoTruePrimaryConvGammaESDPtMCPt(NULL),
410 fHistoTrueSecondaryConvGammaPt(NULL),
411 fHistoTrueSecondaryConvGammaFromXFromK0sPt(NULL),
412 fHistoTrueSecondaryConvGammaFromXFromLambdaPt(NULL),
8bdca7f1 413 fHistoTrueClusGammaPt(NULL),
fd94f234 414 fHistoTrueClusUnConvGammaPt(NULL),
20af4b69 415 fHistoTrueClusUnConvGammaMCPt(NULL),
fd94f234 416 fHistoTrueClusElectronPt(NULL),
417 fHistoTrueClusConvGammaPt(NULL),
20af4b69 418 fHistoTrueClusConvGammaMCPt(NULL),
fd94f234 419 fHistoTrueClusConvGammaFullyPt(NULL),
420 fHistoTrueClusMergedGammaPt(NULL),
421 fHistoTrueClusMergedPartConvGammaPt(NULL),
422 fHistoTrueClusDalitzPt(NULL),
423 fHistoTrueClusDalitzMergedPt(NULL),
424 fHistoTrueClusPhotonFromElecMotherPt(NULL),
425 fHistoTrueClusShowerPt(NULL),
cc579963 426 fHistoTrueClusSubLeadingPt(NULL),
427 fHistoTrueClusNParticles(NULL),
fd94f234 428 fHistoTrueClusEMNonLeadingPt(NULL),
429 fHistoTrueNLabelsInClus(NULL),
8bdca7f1 430 fHistoTruePrimaryClusGammaPt(NULL),
431 fHistoTruePrimaryClusGammaESDPtMCPt(NULL),
432 fHistoNEvents(NULL),
433 fHistoNGoodESDTracks(NULL),
434 fHistoNGammaCandidates(NULL),
435 fHistoNGoodESDTracksVsNGammaCanditates(NULL),
436 fHistoNV0Tracks(NULL),
437 fProfileEtaShift(NULL),
438 fEventPlaneAngle(-100),
439 fRandom(0),
440 fNGammaCandidates(0),
441 fUnsmearedPx(NULL),
442 fUnsmearedPy(NULL),
443 fUnsmearedPz(NULL),
444 fUnsmearedE(NULL),
445 fMCStackPos(NULL),
446 fMCStackNeg(NULL),
447 fESDArrayPos(NULL),
448 fESDArrayNeg(NULL),
449 fnCuts(0),
450 fiCut(0),
451 fMoveParticleAccordingToVertex(kTRUE),
452 fIsHeavyIon(0),
453 fDoMesonAnalysis(kTRUE),
454 fDoMesonQA(0),
455 fDoPhotonQA(0),
fd94f234 456 fDoClusterQA(0),
8bdca7f1 457 fIsFromMBHeader(kTRUE),
d53bf4ac 458 fIsMC(kFALSE)
8bdca7f1 459{
460 // Define output slots here
461 DefineOutput(1, TList::Class());
462}
463
464AliAnalysisTaskGammaConvCalo::~AliAnalysisTaskGammaConvCalo()
465{
466 if(fGammaCandidates){
467 delete fGammaCandidates;
468 fGammaCandidates = 0x0;
469 }
470 if(fClusterCandidates){
471 delete fClusterCandidates;
472 fClusterCandidates = 0x0;
473 }
474 if(fBGHandler){
475 delete[] fBGHandler;
476 fBGHandler = 0x0;
477 }
478 if(fBGHandlerRP){
479 delete[] fBGHandlerRP;
480 fBGHandlerRP = 0x0;
481 }
482 if(fBGClusHandler){
483 delete[] fBGClusHandler;
484 fBGClusHandler = 0x0;
485 }
486 if(fBGClusHandlerRP){
487 delete[] fBGClusHandlerRP;
488 fBGClusHandlerRP = 0x0;
489 }
490}
491//___________________________________________________________
492void AliAnalysisTaskGammaConvCalo::InitBack(){
493
494 const Int_t nDim = 4;
495 Int_t nBins[nDim] = {800,250,7,4};
496 Double_t xMin[nDim] = {0,0, 0,0};
497 Double_t xMax[nDim] = {0.8,25,7,4};
498
499 fSparseMotherInvMassPtZM = new THnSparseF*[fnCuts];
500 fSparseMotherBackInvMassPtZM = new THnSparseF*[fnCuts];
501
502 fBGHandler = new AliGammaConversionAODBGHandler*[fnCuts];
503 fBGHandlerRP = new AliConversionAODBGHandlerRP*[fnCuts];
504
505 fBGClusHandler = new AliGammaConversionAODBGHandler*[fnCuts];
506 fBGClusHandlerRP = new AliConversionAODBGHandlerRP*[fnCuts];
507
508 for(Int_t iCut = 0; iCut<fnCuts;iCut++){
509 if (((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->DoBGCalculation()){
344100c4 510 TString cutstringEvent = ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber();
511 TString cutstringPhoton = ((AliConversionPhotonCuts*)fCutArray->At(iCut))->GetCutNumber();
512 TString cutstringCalo = ((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetCutNumber();
513 TString cutstringMeson = ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutNumber();
8bdca7f1 514
344100c4 515 Int_t collisionSystem = atoi((TString)(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber())(0,1));
516 Int_t centMin = atoi((TString)(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber())(1,1));
517 Int_t centMax = atoi((TString)(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber())(2,1));
8bdca7f1 518
519 if(collisionSystem == 1 || collisionSystem == 2 ||
520 collisionSystem == 5 || collisionSystem == 8 ||
521 collisionSystem == 9){
522 centMin = centMin*10;
523 centMax = centMax*10;
524 if(centMax ==0 && centMax!=centMin) centMax=100;
525 } else if(collisionSystem == 3 || collisionSystem == 6){
526 centMin = centMin*5;
527 centMax = centMax*5;
528 } else if(collisionSystem == 4 || collisionSystem == 7){
529 centMin = ((centMin*5)+45);
530 centMax = ((centMax*5)+45);
531 }
532
533 fBackList[iCut] = new TList();
344100c4 534 fBackList[iCut]->SetName(Form("%s_%s_%s_%s Back histograms",cutstringEvent.Data(),cutstringPhoton.Data(),cutstringCalo.Data(), cutstringMeson.Data()));
8bdca7f1 535 fBackList[iCut]->SetOwner(kTRUE);
536 fCutFolder[iCut]->Add(fBackList[iCut]);
537
538 fSparseMotherBackInvMassPtZM[iCut] = new THnSparseF("Back_Back_InvMass_Pt_z_m","Back_Back_InvMass_Pt_z_m",nDim,nBins,xMin,xMax);
539 fBackList[iCut]->Add(fSparseMotherBackInvMassPtZM[iCut]);
540
541 fMotherList[iCut] = new TList();
344100c4 542 fMotherList[iCut]->SetName(Form("%s_%s_%s_%s Mother histograms",cutstringEvent.Data(),cutstringPhoton.Data(),cutstringCalo.Data(),cutstringMeson.Data()));
8bdca7f1 543 fMotherList[iCut]->SetOwner(kTRUE);
544 fCutFolder[iCut]->Add(fMotherList[iCut]);
545
546 fSparseMotherInvMassPtZM[iCut] = new THnSparseF("Back_Mother_InvMass_Pt_z_m","Back_Mother_InvMass_Pt_z_m",nDim,nBins,xMin,xMax);
547 fMotherList[iCut]->Add(fSparseMotherInvMassPtZM[iCut]);
548
549 if(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->BackgroundHandlerType() == 0){
550 fBGHandler[iCut] = new AliGammaConversionAODBGHandler(
551 collisionSystem,centMin,centMax,
552 ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetNumberOfBGEvents(),
cfd87ccd 553 ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->UseTrackMultiplicity(),
554 2,8,7);
8bdca7f1 555 fBGClusHandler[iCut] = new AliGammaConversionAODBGHandler(
556 collisionSystem,centMin,centMax,
557 ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetNumberOfBGEvents(),
cfd87ccd 558 ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->UseTrackMultiplicity(),
559 2,8,7);
8bdca7f1 560 fBGHandlerRP[iCut] = NULL;
561 } else{
562 fBGHandlerRP[iCut] = new AliConversionAODBGHandlerRP(
344100c4 563 ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsHeavyIon(),
8bdca7f1 564 ((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->UseTrackMultiplicity(),
565 ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetNumberOfBGEvents());
566 fBGClusHandlerRP[iCut] = new AliConversionAODBGHandlerRP(
344100c4 567 ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsHeavyIon(),
8bdca7f1 568 ((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->UseTrackMultiplicity(),
569 ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetNumberOfBGEvents());
570 fBGHandler[iCut] = NULL;
571 }
572 }
573 }
574}
575//________________________________________________________________________
576void AliAnalysisTaskGammaConvCalo::UserCreateOutputObjects(){
577
578 // Create histograms
579 if(fOutputContainer != NULL){
580 delete fOutputContainer;
581 fOutputContainer = NULL;
582 }
583 if(fOutputContainer == NULL){
584 fOutputContainer = new TList();
585 fOutputContainer->SetOwner(kTRUE);
586 }
587
588 // Array of current cut's gammas
589 fGammaCandidates = new TList();
590 fClusterCandidates = new TList();
591
592 fCutFolder = new TList*[fnCuts];
593 fESDList = new TList*[fnCuts];
594 fBackList = new TList*[fnCuts];
595 fMotherList = new TList*[fnCuts];
596 fHistoNEvents = new TH1I*[fnCuts];
597 fHistoNGoodESDTracks = new TH1I*[fnCuts];
598 fHistoNGammaCandidates = new TH1I*[fnCuts];
599 fHistoNGoodESDTracksVsNGammaCanditates = new TH2F*[fnCuts];
600 fHistoNV0Tracks = new TH1I*[fnCuts];
601 fProfileEtaShift = new TProfile*[fnCuts];
602 fHistoConvGammaPt = new TH1F*[fnCuts];
603
604 if (fDoPhotonQA == 2){
605 fPhotonDCAList = new TList*[fnCuts];
606 fTreeConvGammaPtDcazCat = new TTree*[fnCuts];
607 }
608 if (fDoPhotonQA > 0){
609 fHistoConvGammaR = new TH1F*[fnCuts];
610 fHistoConvGammaEta = new TH1F*[fnCuts];
611 }
612
613 if(fDoMesonAnalysis){
614 fHistoMotherInvMassPt = new TH2F*[fnCuts];
d53bf4ac 615 fHistoMotherMatchedInvMassPt = new TH2F*[fnCuts];
8bdca7f1 616 fHistoMotherBackInvMassPt = new TH2F*[fnCuts];
617 fHistoMotherInvMassEalpha = new TH2F*[fnCuts];
618 if (fDoMesonQA == 2){
619 fMesonDCAList = new TList*[fnCuts];
620 fTreeMesonsInvMassPtDcazMinDcazMaxFlag = new TTree*[fnCuts];
621 }
622 if (fDoMesonQA > 0){
623 fHistoMotherPi0PtY = new TH2F*[fnCuts];
624 fHistoMotherEtaPtY = new TH2F*[fnCuts];
625 fHistoMotherPi0PtAlpha = new TH2F*[fnCuts];
626 fHistoMotherEtaPtAlpha = new TH2F*[fnCuts];
627 fHistoMotherPi0PtOpenAngle = new TH2F*[fnCuts];
628 fHistoMotherEtaPtOpenAngle = new TH2F*[fnCuts];
4e8dcc76 629 fHistoMotherPi0ConvPhotonEtaPhi = new TH2F*[fnCuts];
630 fHistoMotherEtaConvPhotonEtaPhi = new TH2F*[fnCuts];
8bdca7f1 631 }
20af4b69 632 if(fDoMesonQA == 1){
633 fHistoMotherInvMassECalib = new TH2F*[fnCuts];
634 fHistoMotherInvMassECalibalpha = new TH2F*[fnCuts];
635 }
8bdca7f1 636 }
637 fTagOutputList = new TList*[fnCuts];
638
639 fHistoConvGammaUntagged = new TH1F*[fnCuts];
640 fHistoConvGammaTagged = new TH1F*[fnCuts];
641 fHistoConvGammaPi0Tagged = new TH1F*[fnCuts];
642 fHistoConvGammaEtaTagged = new TH1F*[fnCuts];
643 fHistoPhotonPairAll = new TH2F*[fnCuts];
644 fHistoPhotonPairAllGam = new TH2F*[fnCuts];
645
646 fHistoClusGammaPt = new TH1F*[fnCuts];
647
648 for(Int_t iCut = 0; iCut<fnCuts;iCut++){
344100c4 649 TString cutstringEvent = ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber();
650 TString cutstringPhoton = ((AliConversionPhotonCuts*)fCutArray->At(iCut))->GetCutNumber();
651 TString cutstringCalo = ((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetCutNumber();
652 TString cutstringMeson = "NoMesonCut";
8bdca7f1 653 if(fDoMesonAnalysis)cutstringMeson = ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutNumber();
654
655 fCutFolder[iCut] = new TList();
344100c4 656 fCutFolder[iCut]->SetName(Form("Cut Number %s_%s_%s_%s",cutstringEvent.Data(),cutstringPhoton.Data(),cutstringCalo.Data(),cutstringMeson.Data()));
8bdca7f1 657 fCutFolder[iCut]->SetOwner(kTRUE);
658 fOutputContainer->Add(fCutFolder[iCut]);
659 fESDList[iCut] = new TList();
344100c4 660 fESDList[iCut]->SetName(Form("%s_%s_%s_%s ESD histograms",cutstringEvent.Data(),cutstringPhoton.Data(),cutstringCalo.Data(),cutstringMeson.Data()));
8bdca7f1 661 fESDList[iCut]->SetOwner(kTRUE);
662 fCutFolder[iCut]->Add(fESDList[iCut]);
663
664 fHistoNEvents[iCut] = new TH1I("NEvents","NEvents",9,-0.5,8.5);
665 fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(1,"Accepted");
666 fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(2,"Centrality");
667 fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(3,"Missing MC");
f57c67ac 668 if (((AliConvEventCuts*)fEventCutArray->At(iCut))->IsSpecialTrigger() > 1 ){
8bdca7f1 669 TString TriggerNames = "Not Trigger: ";
344100c4 670 TriggerNames = TriggerNames+ ( (AliConvEventCuts*)fEventCutArray->At(iCut))->GetSpecialTriggerName();
8bdca7f1 671 fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(4,TriggerNames.Data());
672 } else {
673 fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(4,"Trigger");
674 }
675 fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(5,"Vertex Z");
676 fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(6,"Cont. Vertex");
677 fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(7,"Pile-Up");
678 fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(8,"no SDD");
679 fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(9,"no V0AND");
680 fESDList[iCut]->Add(fHistoNEvents[iCut]);
681
682 if(fIsHeavyIon == 1) fHistoNGoodESDTracks[iCut] = new TH1I("GoodESDTracks","GoodESDTracks",4000,0,4000);
683 else if(fIsHeavyIon == 2) fHistoNGoodESDTracks[iCut] = new TH1I("GoodESDTracks","GoodESDTracks",400,0,400);
684 else fHistoNGoodESDTracks[iCut] = new TH1I("GoodESDTracks","GoodESDTracks",200,0,200);
685 fESDList[iCut]->Add(fHistoNGoodESDTracks[iCut]);
686 if(fIsHeavyIon == 1) fHistoNGammaCandidates[iCut] = new TH1I("GammaCandidates","GammaCandidates",100,0,100);
687 else if(fIsHeavyIon == 2) fHistoNGammaCandidates[iCut] = new TH1I("GammaCandidates","GammaCandidates",50,0,50);
688 else fHistoNGammaCandidates[iCut] = new TH1I("GammaCandidates","GammaCandidates",50,0,50);
689 fESDList[iCut]->Add(fHistoNGammaCandidates[iCut]);
690 if(fIsHeavyIon == 1) fHistoNGoodESDTracksVsNGammaCanditates[iCut] = new TH2F("GoodESDTracksVsGammaCandidates","GoodESDTracksVsGammaCandidates",4000,0,4000,100,0,100);
691 else if(fIsHeavyIon == 2) fHistoNGoodESDTracksVsNGammaCanditates[iCut] = new TH2F("GoodESDTracksVsGammaCandidates","GoodESDTracksVsGammaCandidates",400,0,400,50,0,50);
692 else fHistoNGoodESDTracksVsNGammaCanditates[iCut] = new TH2F("GoodESDTracksVsGammaCandidates","GoodESDTracksVsGammaCandidates",200,0,200,50,0,50);
693 fESDList[iCut]->Add(fHistoNGoodESDTracksVsNGammaCanditates[iCut]);
694
695
696 if(fIsHeavyIon == 1) fHistoNV0Tracks[iCut] = new TH1I("V0 Multiplicity","V0 Multiplicity",30000,0,30000);
697 else if(fIsHeavyIon == 2) fHistoNV0Tracks[iCut] = new TH1I("V0 Multiplicity","V0 Multiplicity",2500,0,2500);
698 else fHistoNV0Tracks[iCut] = new TH1I("V0 Multiplicity","V0 Multiplicity",1500,0,1500);
699 fESDList[iCut]->Add(fHistoNV0Tracks[iCut]);
700 fProfileEtaShift[iCut] = new TProfile("Eta Shift","Eta Shift",1, -0.5,0.5);
701 fESDList[iCut]->Add(fProfileEtaShift[iCut]);
702 fHistoConvGammaPt[iCut] = new TH1F("ESD_ConvGamma_Pt","ESD_ConvGamma_Pt",250,0,25);
703 fESDList[iCut]->Add(fHistoConvGammaPt[iCut]);
704
705 if (fDoPhotonQA == 2){
706 fPhotonDCAList[iCut] = new TList();
344100c4 707 fPhotonDCAList[iCut]->SetName(Form("%s_%s_%s_%s Photon DCA tree",cutstringEvent.Data(),cutstringPhoton.Data(),cutstringCalo.Data(),cutstringMeson.Data()));
8bdca7f1 708 fPhotonDCAList[iCut]->SetOwner(kTRUE);
709 fCutFolder[iCut]->Add(fPhotonDCAList[iCut]);
710
711 fTreeConvGammaPtDcazCat[iCut] = new TTree("ESD_ConvGamma_Pt_Dcaz_R_Eta","ESD_ConvGamma_Pt_Dcaz_R_Eta_Cat");
712 fTreeConvGammaPtDcazCat[iCut]->Branch("Pt",&fPtGamma,"fPtGamma/F");
713 fTreeConvGammaPtDcazCat[iCut]->Branch("DcaZPhoton",&fDCAzPhoton,"fDCAzPhoton/F");
714 // fTreeConvGammaPtDcazCat[iCut]->Branch("R",&fRConvPhoton,"fRConvPhoton/F");
715 // fTreeConvGammaPtDcazCat[iCut]->Branch("Eta",&fEtaPhoton,"fEtaPhoton/F");
716
717 fTreeConvGammaPtDcazCat[iCut]->Branch("cat",&fCharCatPhoton,"fCharCatPhoton/b");
718 if(fIsMC){
719 fTreeConvGammaPtDcazCat[iCut]->Branch("photonMCInfo",&fCharPhotonMCInfo,"fCharPhotonMCInfo/b");
720 }
721 fPhotonDCAList[iCut]->Add(fTreeConvGammaPtDcazCat[iCut]);
722 }
723
724 if (fDoPhotonQA > 0){
725 fHistoConvGammaR[iCut] = new TH1F("ESD_ConvGamma_R","ESD_ConvGamma_R",800,0,200);
726 fESDList[iCut]->Add(fHistoConvGammaR[iCut]);
727 fHistoConvGammaEta[iCut] = new TH1F("ESD_ConvGamma_Eta","ESD_ConvGamma_Eta",2000,-2,2);
728 fESDList[iCut]->Add(fHistoConvGammaEta[iCut]);
729 }
730
731 fTagOutputList[iCut] = new TList();
344100c4 732 fTagOutputList[iCut]->SetName(Form("%s_%s_%s_%s Tagging Output",cutstringEvent.Data(),cutstringPhoton.Data(),cutstringCalo.Data(),cutstringMeson.Data()));
8bdca7f1 733 fTagOutputList[iCut]->SetOwner(1);
734 fCutFolder[iCut]->Add(fTagOutputList[iCut]);
735
736 const Int_t nptbins = 200;
737 const Double_t ptmin = 0.;
738 const Double_t ptmax = 20.;
739
740 const Int_t nmbins = 180;
741 const Double_t mmin = 0.;
742 const Double_t mmax = 0.9;
743
744 // photon candidates
745 // this is maybe not necessary ...
746
747 fHistoConvGammaUntagged[iCut] = new TH1F("ConvGammaUntagged","",nptbins,ptmin,ptmax);
748 fHistoConvGammaUntagged[iCut]->SetXTitle("p_{T} (GeV/c)");
749 fTagOutputList[iCut]->Add(fHistoConvGammaUntagged[iCut]);
750
751 fHistoConvGammaTagged[iCut] = new TH1F("ConvGammaTagged","",nptbins,ptmin,ptmax);
752 fHistoConvGammaTagged[iCut]->SetXTitle("p_{T} (GeV/c)");
753 fTagOutputList[iCut]->Add(fHistoConvGammaTagged[iCut]);
754
755 fHistoConvGammaPi0Tagged[iCut] = new TH1F("ConvGammaPi0Tagged","",nptbins,ptmin,ptmax);
756 fHistoConvGammaPi0Tagged[iCut]->SetXTitle("p_{T} (GeV/c)");
757 fTagOutputList[iCut]->Add(fHistoConvGammaPi0Tagged[iCut]);
758
759 fHistoConvGammaEtaTagged[iCut] = new TH1F("ConvGammaEtaTagged","",nptbins,ptmin,ptmax);
760 fHistoConvGammaEtaTagged[iCut]->SetXTitle("p_{T} (GeV/c)");
761 fTagOutputList[iCut]->Add(fHistoConvGammaEtaTagged[iCut]);
762
763 // pairs
764 fHistoPhotonPairAll[iCut] = new TH2F("PhotonPairAll","",nmbins,mmin,mmax,nptbins,ptmin,ptmax);
765 fHistoPhotonPairAll[iCut]->SetXTitle("M_{inv} (GeV/cc)");
766 fHistoPhotonPairAll[iCut]->SetYTitle("p_{T} (GeV/c)");
767 fTagOutputList[iCut]->Add(fHistoPhotonPairAll[iCut]);
768
769 fHistoPhotonPairAllGam[iCut] = new TH2F("PhotonPairAllGammaConvPt","",nmbins,mmin,mmax,nptbins,ptmin,ptmax);
770 fHistoPhotonPairAllGam[iCut]->SetXTitle("M_{inv} (GeV/cc)");
771 fHistoPhotonPairAllGam[iCut]->SetYTitle("#gamma^{conv} p_{T} (GeV/c)");
772 fTagOutputList[iCut]->Add(fHistoPhotonPairAllGam[iCut]);
773
774 fHistoClusGammaPt[iCut] = new TH1F("ClusGamma_Pt","ClusGamma_Pt",250,0,25);
775 fTagOutputList[iCut]->Add(fHistoClusGammaPt[iCut]);
776
777
778 if(fDoMesonAnalysis){
779 fHistoMotherInvMassPt[iCut] = new TH2F("ESD_Mother_InvMass_Pt","ESD_Mother_InvMass_Pt",800,0,0.8,250,0,25);
780 fESDList[iCut]->Add(fHistoMotherInvMassPt[iCut]);
d53bf4ac 781 fHistoMotherMatchedInvMassPt[iCut] = new TH2F("ESD_MotherMatched_InvMass_Pt","ESD_MotherMatched_InvMass_Pt",800,0,0.8,250,0,25);
782 fESDList[iCut]->Add(fHistoMotherMatchedInvMassPt[iCut]);
8bdca7f1 783 fHistoMotherBackInvMassPt[iCut] = new TH2F("ESD_Background_InvMass_Pt","ESD_Background_InvMass_Pt",800,0,0.8,250,0,25);
784 fESDList[iCut]->Add(fHistoMotherBackInvMassPt[iCut]);
785 fHistoMotherInvMassEalpha[iCut] = new TH2F("ESD_Mother_InvMass_vs_E_alpha","ESD_Mother_InvMass_vs_E_alpha",800,0,0.8,250,0,25);
786 fESDList[iCut]->Add(fHistoMotherInvMassEalpha[iCut]);
787 if (fDoMesonQA == 2){
788 fMesonDCAList[iCut] = new TList();
344100c4 789 fMesonDCAList[iCut]->SetName(Form("%s_%s_%s_%s Meson DCA tree",cutstringEvent.Data(),cutstringPhoton.Data(),cutstringCalo.Data(),cutstringMeson.Data()));
8bdca7f1 790 fMesonDCAList[iCut]->SetOwner(kTRUE);
791 fCutFolder[iCut]->Add(fMesonDCAList[iCut]);
792
793 fTreeMesonsInvMassPtDcazMinDcazMaxFlag[iCut] = new TTree("ESD_Mesons_InvMass_Pt_DcazMin_DcazMax_Flag","ESD_Mesons_InvMass_Pt_DcazMin_DcazMax_Flag");
794 fTreeMesonsInvMassPtDcazMinDcazMaxFlag[iCut]->Branch("InvMass",&fInvMass,"fInvMass/F");
795 fTreeMesonsInvMassPtDcazMinDcazMaxFlag[iCut]->Branch("Pt",&fPt,"fPt/F");
796 fTreeMesonsInvMassPtDcazMinDcazMaxFlag[iCut]->Branch("DcaZMin",&fDCAzGammaMin,"fDCAzGammaMin/F");
797 fTreeMesonsInvMassPtDcazMinDcazMaxFlag[iCut]->Branch("DcaZMax",&fDCAzGammaMax,"fDCAzGammaMax/F");
798 fTreeMesonsInvMassPtDcazMinDcazMaxFlag[iCut]->Branch("kind",&fCharFlag,"fCharFlag/b");
799 if(fIsMC){
800 fTreeMesonsInvMassPtDcazMinDcazMaxFlag[iCut]->Branch("mesonMCInfo",&fCharMesonMCInfo,"fCharMesonMCInfo/b");
801 }
802 fMesonDCAList[iCut]->Add(fTreeMesonsInvMassPtDcazMinDcazMaxFlag[iCut]);
803
804 }
20af4b69 805 if(fDoMesonQA == 1){
41ed7315 806 fHistoMotherInvMassECalib[iCut] = new TH2F("ESD_Mother_InvMass_E_Calib","ESD_Mother_InvMass_E_Calib",800,0,0.8,250,0,25);
20af4b69 807 fESDList[iCut]->Add(fHistoMotherInvMassECalib[iCut]);
808 fHistoMotherInvMassECalibalpha[iCut] = new TH2F("ESD_Mother_InvMass_vs_E_Calib_alpha","ESD_Mother_InvMass_vs_E_Calib_alpha",800,0,0.8,250,0,25);
809 fESDList[iCut]->Add(fHistoMotherInvMassECalibalpha[iCut]);
810 }
811
8bdca7f1 812 if (fDoMesonQA > 0 ){
813 fHistoMotherPi0PtY[iCut] = new TH2F("ESD_MotherPi0_Pt_Y","ESD_MotherPi0_Pt_Y",150,0.03,15.,150,-1.5,1.5);
814 SetLogBinningXTH2(fHistoMotherPi0PtY[iCut]);
815 fESDList[iCut]->Add(fHistoMotherPi0PtY[iCut]);
816 fHistoMotherEtaPtY[iCut] = new TH2F("ESD_MotherEta_Pt_Y","ESD_MotherEta_Pt_Y",150,0.03,15.,150,-1.5,1.5);
817 SetLogBinningXTH2(fHistoMotherEtaPtY[iCut]);
818 fESDList[iCut]->Add(fHistoMotherEtaPtY[iCut]);
819 fHistoMotherPi0PtAlpha[iCut] = new TH2F("ESD_MotherPi0_Pt_Alpha","ESD_MotherPi0_Pt_Alpha",150,0.03,15.,100,0,1);
820 SetLogBinningXTH2(fHistoMotherPi0PtAlpha[iCut]);
821 fESDList[iCut]->Add(fHistoMotherPi0PtAlpha[iCut]);
822 fHistoMotherEtaPtAlpha[iCut] = new TH2F("ESD_MotherEta_Pt_Alpha","ESD_MotherEta_Pt_Alpha",150,0.03,15.,100,0,1);
823 SetLogBinningXTH2(fHistoMotherEtaPtAlpha[iCut]);
824 fESDList[iCut]->Add(fHistoMotherEtaPtAlpha[iCut]);
f57c67ac 825 fHistoMotherPi0PtOpenAngle[iCut] = new TH2F("ESD_MotherPi0_Pt_OpenAngle","ESD_MotherPi0_Pt_OpenAngle",150,0.03,15.,100,0,TMath::Pi());
8bdca7f1 826 SetLogBinningXTH2(fHistoMotherPi0PtOpenAngle[iCut]);
827 fESDList[iCut]->Add(fHistoMotherPi0PtOpenAngle[iCut]);
f57c67ac 828 fHistoMotherEtaPtOpenAngle[iCut] = new TH2F("ESD_MotherEta_Pt_OpenAngle","ESD_MotherEta_Pt_OpenAngle",150,0.03,15.,100,0,TMath::Pi());
8bdca7f1 829 SetLogBinningXTH2(fHistoMotherEtaPtOpenAngle[iCut]);
830 fESDList[iCut]->Add(fHistoMotherEtaPtOpenAngle[iCut]);
4e8dcc76 831 fHistoMotherPi0ConvPhotonEtaPhi[iCut] = new TH2F("ESD_MotherPi0ConvPhoton_Eta_Phi","ESD_MotherPi0ConvPhoton_Eta_Phi",600,0,2*TMath::Pi(),400,-2,2);
832 fESDList[iCut]->Add(fHistoMotherPi0ConvPhotonEtaPhi[iCut]);
833 fHistoMotherEtaConvPhotonEtaPhi[iCut] = new TH2F("ESD_MotherEtaConvPhoton_Eta_Phi","ESD_MotherEtaConvPhoton_Eta_Phi",600,0,2*TMath::Pi(),400,-2,2);
834 fESDList[iCut]->Add(fHistoMotherEtaConvPhotonEtaPhi[iCut]);
8bdca7f1 835 }
836 }
837 }
838 if(fDoMesonAnalysis){
839 InitBack(); // Init Background Handler
840 }
841
842 if(fIsMC){
843 // MC Histogramms
fd94f234 844 fMCList = new TList*[fnCuts];
8bdca7f1 845 // True Histogramms
fd94f234 846 fTrueList = new TList*[fnCuts];
8bdca7f1 847 // Selected Header List
fd94f234 848 fHeaderNameList = new TList*[fnCuts];
849 fHistoMCHeaders = new TH1I*[fnCuts];
850 fHistoMCAllGammaPt = new TH1F*[fnCuts];
20af4b69 851 fHistoMCAllGammaEMCALAccPt = new TH1F*[fnCuts];
fd94f234 852 fHistoMCDecayGammaPi0Pt = new TH1F*[fnCuts];
853 fHistoMCDecayGammaRhoPt = new TH1F*[fnCuts];
854 fHistoMCDecayGammaEtaPt = new TH1F*[fnCuts];
855 fHistoMCDecayGammaOmegaPt = new TH1F*[fnCuts];
856 fHistoMCDecayGammaEtapPt = new TH1F*[fnCuts];
857 fHistoMCDecayGammaPhiPt = new TH1F*[fnCuts];
858 fHistoMCDecayGammaSigmaPt = new TH1F*[fnCuts];
859 fHistoMCConvGammaPt = new TH1F*[fnCuts];
860 fHistoTrueConvGammaPt = new TH1F*[fnCuts];
861 fHistoTrueConvPi0GammaPt = new TH1F*[fnCuts];
8bdca7f1 862
fd94f234 863 fHistoCombinatorialPt = new TH2F*[fnCuts];
864 fHistoTruePrimaryConvGammaPt = new TH1F*[fnCuts];
865 fHistoTruePrimaryConvGammaESDPtMCPt = new TH2F*[fnCuts];
866 fHistoTrueSecondaryConvGammaPt = new TH1F*[fnCuts];
867 fHistoTrueSecondaryConvGammaFromXFromK0sPt = new TH1F*[fnCuts];
868 fHistoTrueSecondaryConvGammaFromXFromLambdaPt = new TH1F*[fnCuts];
8bdca7f1 869
fd94f234 870 fHistoTrueClusGammaPt = new TH1F*[fnCuts];
871 fHistoTruePrimaryClusGammaPt = new TH1F*[fnCuts];
8bdca7f1 872 fHistoTruePrimaryClusGammaESDPtMCPt = new TH2F*[fnCuts];
873
874 if (fDoPhotonQA > 0){
fd94f234 875 fHistoMCConvGammaR = new TH1F*[fnCuts];
876 fHistoMCConvGammaEta = new TH1F*[fnCuts];
877 fHistoTrueConvGammaEta = new TH1F*[fnCuts];
878 }
879 if (fDoClusterQA > 0){
880 fHistoTrueClusUnConvGammaPt = new TH1F*[fnCuts];
20af4b69 881 fHistoTrueClusUnConvGammaMCPt = new TH1F*[fnCuts];
fd94f234 882 fHistoTrueClusElectronPt = new TH1F*[fnCuts];
883 fHistoTrueClusConvGammaPt = new TH1F*[fnCuts];
20af4b69 884 fHistoTrueClusConvGammaMCPt = new TH1F*[fnCuts];
fd94f234 885 fHistoTrueClusConvGammaFullyPt = new TH1F*[fnCuts];
886 fHistoTrueClusMergedGammaPt = new TH1F*[fnCuts];
887 fHistoTrueClusMergedPartConvGammaPt = new TH1F*[fnCuts];
888 fHistoTrueClusDalitzPt = new TH1F*[fnCuts];
889 fHistoTrueClusDalitzMergedPt = new TH1F*[fnCuts];
890 fHistoTrueClusPhotonFromElecMotherPt= new TH1F*[fnCuts];
891 fHistoTrueClusShowerPt = new TH1F*[fnCuts];
cc579963 892 fHistoTrueClusSubLeadingPt = new TH1F*[fnCuts];
893 fHistoTrueClusNParticles = new TH1I*[fnCuts];
fd94f234 894 fHistoTrueClusEMNonLeadingPt = new TH1F*[fnCuts];
895 fHistoTrueNLabelsInClus = new TH1F*[fnCuts];
8bdca7f1 896 }
897
898 if(fDoMesonAnalysis){
fd94f234 899 fHistoMCPi0Pt = new TH1F*[fnCuts];
900 fHistoMCPi0WOWeightPt = new TH1F*[fnCuts];
901 fHistoMCEtaPt = new TH1F*[fnCuts];
902 fHistoMCEtaWOWeightPt = new TH1F*[fnCuts];
903 fHistoMCPi0InAccPt = new TH1F*[fnCuts];
904 fHistoMCEtaInAccPt = new TH1F*[fnCuts];
8bdca7f1 905
ed8bc1ca 906 fHistoTruePi0InvMassPt = new TH2F*[fnCuts];
907 fHistoTrueEtaInvMassPt = new TH2F*[fnCuts];
908 fHistoTruePrimaryPi0InvMassPt = new TH2F*[fnCuts];
909 fHistoTruePrimaryEtaInvMassPt = new TH2F*[fnCuts];
910 fHistoTruePrimaryPi0W0WeightingInvMassPt = new TH2F*[fnCuts];
911 fHistoTruePrimaryEtaW0WeightingInvMassPt = new TH2F*[fnCuts];
912 fProfileTruePrimaryPi0WeightsInvMassPt = new TProfile2D*[fnCuts];
913 fProfileTruePrimaryEtaWeightsInvMassPt = new TProfile2D*[fnCuts];
914 fHistoTrueSecondaryPi0InvMassPt = new TH2F*[fnCuts];
915 fHistoTrueSecondaryEtaInvMassPt = new TH2F*[fnCuts];
916 fHistoTrueSecondaryPi0FromK0sInvMassPt = new TH2F*[fnCuts];
917 fHistoTrueSecondaryPi0FromEtaInvMassPt = new TH2F*[fnCuts];
918 fHistoTrueSecondaryPi0FromLambdaInvMassPt = new TH2F*[fnCuts];
8bdca7f1 919 if (fDoMesonQA > 0){
fd94f234 920 fHistoMCPi0PtY = new TH2F*[fnCuts];
921 fHistoMCEtaPtY = new TH2F*[fnCuts];
de752898 922 fHistoMCPi0PtAlpha = new TH2F*[fnCuts];
923 fHistoMCEtaPtAlpha = new TH2F*[fnCuts];
fd94f234 924 fHistoMCK0sPt = new TH1F*[fnCuts];
925 fHistoMCK0sWOWeightPt = new TH1F*[fnCuts];
926 fHistoMCK0sPtY = new TH2F*[fnCuts];
927 fHistoMCSecPi0PtvsSource = new TH2F*[fnCuts];
928 fHistoMCSecPi0Source = new TH1F*[fnCuts];
929 fHistoMCSecEtaPt = new TH1F*[fnCuts];
930 fHistoMCSecEtaSource = new TH1F*[fnCuts];
ed8bc1ca 931 fHistoTruePi0CaloPhotonInvMassPt = new TH2F*[fnCuts];
932 fHistoTrueEtaCaloPhotonInvMassPt = new TH2F*[fnCuts];
20af4b69 933 fHistoTruePi0CaloConvertedPhotonInvMassPt = new TH2F*[fnCuts];
934 fHistoTruePi0CaloConvertedPhotonMatchedInvMassPt = new TH2F*[fnCuts];
935 fHistoTrueEtaCaloConvertedPhotonInvMassPt = new TH2F*[fnCuts];
936 fHistoTrueEtaCaloConvertedPhotonMatchedInvMassPt = new TH2F*[fnCuts];
ed8bc1ca 937 fHistoTruePi0CaloElectronInvMassPt = new TH2F*[fnCuts];
938 fHistoTrueEtaCaloElectronInvMassPt = new TH2F*[fnCuts];
939 fHistoTruePi0CaloMergedClusterInvMassPt = new TH2F*[fnCuts];
940 fHistoTrueEtaCaloMergedClusterInvMassPt = new TH2F*[fnCuts];
941 fHistoTruePi0CaloMergedClusterPartConvInvMassPt = new TH2F*[fnCuts];
942 fHistoTrueEtaCaloMergedClusterPartConvInvMassPt = new TH2F*[fnCuts];
fd94f234 943 fHistoTrueMotherCaloEMNonLeadingInvMassPt = new TH2F*[fnCuts];
944 fHistoTruePrimaryPi0MCPtResolPt = new TH2F*[fnCuts];
945 fHistoTruePrimaryEtaMCPtResolPt = new TH2F*[fnCuts];
946 fHistoTrueK0sWithPi0DaughterMCPt = new TH1F*[fnCuts];
947 fHistoTrueEtaWithPi0DaughterMCPt = new TH1F*[fnCuts];
948 fHistoTrueLambdaWithPi0DaughterMCPt = new TH1F*[fnCuts];
949 fHistoTrueBckGGInvMassPt = new TH2F*[fnCuts];
950 fHistoTrueBckContInvMassPt = new TH2F*[fnCuts];
951 fHistoTruePi0PtY = new TH2F*[fnCuts];
952 fHistoTrueEtaPtY = new TH2F*[fnCuts];
953 fHistoTruePi0PtAlpha = new TH2F*[fnCuts];
954 fHistoTrueEtaPtAlpha = new TH2F*[fnCuts];
955 fHistoTruePi0PtOpenAngle = new TH2F*[fnCuts];
956 fHistoTrueEtaPtOpenAngle = new TH2F*[fnCuts];
8bdca7f1 957 }
958 }
959
960
961
962 for(Int_t iCut = 0; iCut<fnCuts;iCut++){
344100c4 963 TString cutstringEvent = ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber();
964 TString cutstringPhoton = ((AliConversionPhotonCuts*)fCutArray->At(iCut))->GetCutNumber();
965 TString cutstringCalo = ((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetCutNumber();
966 TString cutstringMeson = "NoMesonCut";
8bdca7f1 967 if(fDoMesonAnalysis)cutstringMeson = ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutNumber();
968
969 fMCList[iCut] = new TList();
344100c4 970 fMCList[iCut]->SetName(Form("%s_%s_%s_%s MC histograms",cutstringEvent.Data(),cutstringPhoton.Data(),cutstringCalo.Data(),cutstringMeson.Data()));
8bdca7f1 971 fMCList[iCut]->SetOwner(kTRUE);
972 fCutFolder[iCut]->Add(fMCList[iCut]);
973 fHistoMCHeaders[iCut] = new TH1I("MC_Headers","MC_Headers",20,0,20);
974 fMCList[iCut]->Add(fHistoMCHeaders[iCut]);
975 fHistoMCAllGammaPt[iCut] = new TH1F("MC_AllGamma_Pt","MC_AllGamma_Pt",250,0,25);
976 fMCList[iCut]->Add(fHistoMCAllGammaPt[iCut]);
d404157c 977 fHistoMCAllGammaEMCALAccPt[iCut] = new TH1F("MC_AllGammaEMCALAcc_Pt","MC_AllGammaEMCALAcc_Pt",250,0,25);
20af4b69 978 fMCList[iCut]->Add(fHistoMCAllGammaEMCALAccPt[iCut]);
8bdca7f1 979 fHistoMCDecayGammaPi0Pt[iCut] = new TH1F("MC_DecayGammaPi0_Pt","MC_DecayGammaPi0_Pt",250,0,25);
980 fMCList[iCut]->Add(fHistoMCDecayGammaPi0Pt[iCut]);
981 fHistoMCDecayGammaRhoPt[iCut] = new TH1F("MC_DecayGammaRho_Pt","MC_DecayGammaRho_Pt",250,0,25);
982 fMCList[iCut]->Add(fHistoMCDecayGammaRhoPt[iCut]);
983 fHistoMCDecayGammaEtaPt[iCut] = new TH1F("MC_DecayGammaEta_Pt","MC_DecayGammaEta_Pt",250,0,25);
984 fMCList[iCut]->Add(fHistoMCDecayGammaEtaPt[iCut]);
985 fHistoMCDecayGammaOmegaPt[iCut] = new TH1F("MC_DecayGammaOmega_Pt","MC_DecayGammaOmmega_Pt",250,0,25);
986 fMCList[iCut]->Add(fHistoMCDecayGammaOmegaPt[iCut]);
987 fHistoMCDecayGammaEtapPt[iCut] = new TH1F("MC_DecayGammaEtap_Pt","MC_DecayGammaEtap_Pt",250,0,25);
988 fMCList[iCut]->Add(fHistoMCDecayGammaEtapPt[iCut]);
989 fHistoMCDecayGammaPhiPt[iCut] = new TH1F("MC_DecayGammaPhi_Pt","MC_DecayGammaPhi_Pt",250,0,25);
990 fMCList[iCut]->Add(fHistoMCDecayGammaPhiPt[iCut]);
991 fHistoMCDecayGammaSigmaPt[iCut] = new TH1F("MC_DecayGammaSigma_Pt","MC_DecayGammaSigma_Pt",250,0,25);
992 fMCList[iCut]->Add(fHistoMCDecayGammaSigmaPt[iCut]);
993 fHistoMCConvGammaPt[iCut] = new TH1F("MC_ConvGamma_Pt","MC_ConvGamma_Pt",250,0,25);
994 fMCList[iCut]->Add(fHistoMCConvGammaPt[iCut]);
995
996 if (fDoPhotonQA > 0){
997 fHistoMCConvGammaR[iCut] = new TH1F("MC_ConvGamma_R","MC_ConvGamma_R",800,0,200);
998 fMCList[iCut]->Add(fHistoMCConvGammaR[iCut]);
999 fHistoMCConvGammaEta[iCut] = new TH1F("MC_ConvGamma_Eta","MC_ConvGamma_Eta",2000,-2,2);
1000 fMCList[iCut]->Add(fHistoMCConvGammaEta[iCut]);
1001 }
1002
1003 if(fDoMesonAnalysis){
1004 fHistoMCPi0Pt[iCut] = new TH1F("MC_Pi0_Pt","MC_Pi0_Pt",250,0,25);
1005 fHistoMCPi0Pt[iCut]->Sumw2();
1006 fMCList[iCut]->Add(fHistoMCPi0Pt[iCut]);
1007 fHistoMCPi0WOWeightPt[iCut] = new TH1F("MC_Pi0_WOWeights_Pt","MC_Pi0_WOWeights_Pt",250,0,25);
1008 fHistoMCPi0WOWeightPt[iCut]->Sumw2();
1009 fMCList[iCut]->Add(fHistoMCPi0WOWeightPt[iCut]);
1010
1011 fHistoMCEtaPt[iCut] = new TH1F("MC_Eta_Pt","MC_Eta_Pt",250,0,25);
1012 fHistoMCEtaPt[iCut]->Sumw2();
1013 fMCList[iCut]->Add(fHistoMCEtaPt[iCut]);
1014 fHistoMCEtaWOWeightPt[iCut] = new TH1F("MC_Eta_WOWeights_Pt","MC_Eta_WOWeights_Pt",250,0,25);
1015 fHistoMCEtaWOWeightPt[iCut]->Sumw2();
1016 fMCList[iCut]->Add(fHistoMCEtaWOWeightPt[iCut]);
1017 fHistoMCPi0InAccPt[iCut] = new TH1F("MC_Pi0InAcc_Pt","MC_Pi0InAcc_Pt",250,0,25);
1018 fHistoMCPi0InAccPt[iCut]->Sumw2();
1019 fMCList[iCut]->Add(fHistoMCPi0InAccPt[iCut]);
1020 fHistoMCEtaInAccPt[iCut] = new TH1F("MC_EtaInAcc_Pt","MC_EtaInAcc_Pt",250,0,25);
1021 fHistoMCEtaInAccPt[iCut]->Sumw2();
1022 fMCList[iCut]->Add(fHistoMCEtaInAccPt[iCut]);
1023 if (fDoMesonQA > 0){
1024 fHistoMCPi0PtY[iCut] = new TH2F("MC_Pi0_Pt_Y","MC_Pi0_Pt_Y",150,0.03,15.,150,-1.5,1.5);
1025 fHistoMCPi0PtY[iCut]->Sumw2();
1026 SetLogBinningXTH2(fHistoMCPi0PtY[iCut]);
1027 fMCList[iCut]->Add(fHistoMCPi0PtY[iCut]);
1028 fHistoMCEtaPtY[iCut] = new TH2F("MC_Eta_Pt_Y","MC_Eta_Pt_Y",150,0.03,15.,150,-1.5,1.5);
1029 fHistoMCEtaPtY[iCut]->Sumw2();
1030 SetLogBinningXTH2(fHistoMCEtaPtY[iCut]);
1031 fMCList[iCut]->Add(fHistoMCEtaPtY[iCut]);
de752898 1032 fHistoMCPi0PtAlpha[iCut] = new TH2F("MC_Pi0_Pt_Alpha","MC_Pi0_Pt_Alpha",150,0.03,15.,100,0,1);
1033 SetLogBinningXTH2(fHistoMCPi0PtAlpha[iCut]);
1034 fMCList[iCut]->Add(fHistoMCPi0PtAlpha[iCut]);
1035 fHistoMCEtaPtAlpha[iCut] = new TH2F("MC_Eta_Pt_Alpha","MC_Eta_Pt_Alpha",150,0.03,15.,100,0,1);
1036 SetLogBinningXTH2(fHistoMCEtaPtAlpha[iCut]);
1037 fMCList[iCut]->Add(fHistoMCEtaPtAlpha[iCut]);
1038
8bdca7f1 1039 fHistoMCK0sPt[iCut] = new TH1F("MC_K0s_Pt","MC_K0s_Pt",150,0,15);
1040 fHistoMCK0sPt[iCut]->Sumw2();
1041 fMCList[iCut]->Add(fHistoMCK0sPt[iCut]);
1042 fHistoMCK0sWOWeightPt[iCut] = new TH1F("MC_K0s_WOWeights_Pt","MC_K0s_WOWeights_Pt",150,0,15);
1043 fHistoMCK0sWOWeightPt[iCut]->Sumw2();
1044 fMCList[iCut]->Add(fHistoMCK0sWOWeightPt[iCut]);
1045 fHistoMCK0sPtY[iCut] = new TH2F("MC_K0s_Pt_Y","MC_K0s_Pt_Y",150,0.03,15.,150,-1.5,1.5);
1046 fHistoMCK0sPtY[iCut]->Sumw2();
1047 SetLogBinningXTH2(fHistoMCK0sPtY[iCut]);
1048 fMCList[iCut]->Add(fHistoMCK0sPtY[iCut]);
1049
1050 fHistoMCSecPi0Source[iCut] = new TH1F("MC_SecPi0_Source","MC_SecPi0_Source",5000,0.,5000);
1051 fMCList[iCut]->Add(fHistoMCSecPi0Source[iCut]);
1052 fHistoMCSecEtaSource[iCut] = new TH1F("MC_SecEta_Source","MC_SecEta_Source",5000,0,5000);
1053 fMCList[iCut]->Add(fHistoMCSecEtaSource[iCut]);
1054 fHistoMCSecPi0PtvsSource[iCut] = new TH2F("MC_SecPi0_Pt_Source","MC_SecPi0_Pt_Source",250,0.0,25.,16,-0.5,15.5);
1055 fHistoMCSecPi0PtvsSource[iCut]->Sumw2();
1056 fMCList[iCut]->Add(fHistoMCSecPi0PtvsSource[iCut]);
1057 fHistoMCSecEtaPt[iCut] = new TH1F("MC_SecEta_Pt","MC_SecEta_Pt",250,0,25);
1058 fHistoMCSecEtaPt[iCut]->Sumw2();
1059 fMCList[iCut]->Add(fHistoMCSecEtaPt[iCut]);
1060 }
1061
1062 }
1063 fTrueList[iCut] = new TList();
344100c4 1064 fTrueList[iCut]->SetName(Form("%s_%s_%s_%s True histograms",cutstringEvent.Data(),cutstringPhoton.Data(),cutstringCalo.Data(),cutstringMeson.Data()));
8bdca7f1 1065 fTrueList[iCut]->SetOwner(kTRUE);
1066 fCutFolder[iCut]->Add(fTrueList[iCut]);
1067
1068 fHistoTrueConvGammaPt[iCut] = new TH1F("ESD_TrueConvGamma_Pt","ESD_TrueConvGamma_Pt",250,0,25);
1069 fTrueList[iCut]->Add(fHistoTrueConvGammaPt[iCut]);
1070
41ed7315 1071 fHistoTrueConvPi0GammaPt[iCut] = new TH1F("ESD_TrueConvPi0Gamma_Pt","ESD_TrueConvPi0Gamma_Pt",250,0,25);
8bdca7f1 1072 fTrueList[iCut]->Add(fHistoTrueConvPi0GammaPt[iCut]);
1073
1074 fHistoCombinatorialPt[iCut] = new TH2F("ESD_TrueCombinatorial_Pt","ESD_TrueCombinatorial_Pt",250,0,25,16,-0.5,15.5);
1075 fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel( 1,"Elec+Elec");
1076 fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel( 2,"Elec+Pion");
1077 fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel( 3,"Elec+Kaon");
1078 fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel( 4,"Elec+Proton");
1079 fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel( 5,"Elec+Muon");
1080 fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel( 6,"Pion+Pion");
1081 fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel( 7,"Pion+Kaon");
1082 fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel( 8,"Pion+Proton");
1083 fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel( 9,"Pion+Muon");
1084 fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel(10,"Kaon+Kaon");
1085 fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel(11,"Kaon+Proton");
1086 fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel(12,"Kaon+Muon");
1087 fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel(13,"Proton+Proton");
1088 fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel(14,"Proton+Muon");
1089 fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel(15,"Muon+Muon");
1090 fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel(16,"Rest");
1091 fTrueList[iCut]->Add(fHistoCombinatorialPt[iCut]);
1092 fHistoTruePrimaryConvGammaPt[iCut] = new TH1F("ESD_TruePrimaryConvGamma_Pt","ESD_TruePrimaryConvGamma_Pt",250,0,25);
1093 fTrueList[iCut]->Add(fHistoTruePrimaryConvGammaPt[iCut]);
1094 fHistoTrueSecondaryConvGammaPt[iCut] = new TH1F("ESD_TrueSecondaryConvGamma_Pt","ESD_TrueSecondaryConvGamma_Pt",250,0,25);
1095 fTrueList[iCut]->Add(fHistoTrueSecondaryConvGammaPt[iCut]);
1096
1097 fHistoTrueSecondaryConvGammaFromXFromK0sPt[iCut] = new TH1F("ESD_TrueSecondaryConvGammaFromXFromK0s_Pt", "ESD_TrueSecondaryConvGammaFromXFromK0s_Pt",250,0,25);
1098 fTrueList[iCut]->Add(fHistoTrueSecondaryConvGammaFromXFromK0sPt[iCut]);
1099 fHistoTrueSecondaryConvGammaFromXFromLambdaPt[iCut] = new TH1F("ESD_TrueSecondaryConvGammaFromXFromLambda_Pt", "ESD_TrueSecondaryConvGammaFromXFromLambda_Pt",250,0,25);
1100 fTrueList[iCut]->Add(fHistoTrueSecondaryConvGammaFromXFromLambdaPt[iCut]);
fd94f234 1101
8bdca7f1 1102 fHistoTruePrimaryConvGammaESDPtMCPt[iCut] = new TH2F("ESD_TruePrimaryConvGammaESD_PtMCPt", "ESD_TruePrimaryConvGammaESD_PtMCPt",250,0,25,250,0,25);
1103 fTrueList[iCut]->Add(fHistoTruePrimaryConvGammaESDPtMCPt[iCut]);
1104
fd94f234 1105 fHistoTrueClusGammaPt[iCut] = new TH1F("TrueClusGamma_Pt","ESD_TrueClusGamma_Pt",250,0,25);
8bdca7f1 1106 fTagOutputList[iCut]->Add(fHistoTrueClusGammaPt[iCut]);
1107 fHistoTruePrimaryClusGammaPt[iCut] = new TH1F("TruePrimaryClusGamma_Pt","ESD_TruePrimaryClusGamma_Pt",250,0,25);
1108 fTagOutputList[iCut]->Add(fHistoTruePrimaryClusGammaPt[iCut]);
1109 fHistoTruePrimaryClusGammaESDPtMCPt[iCut] = new TH2F("TruePrimaryClusGamma_Pt_MCPt","ESD_TruePrimaryClusGamma_MCPt",250,0,25,250,0,25);
1110 fTagOutputList[iCut]->Add(fHistoTruePrimaryClusGammaESDPtMCPt[iCut]);
1111
fd94f234 1112 if (fDoPhotonQA > 0){
1113 fHistoTrueConvGammaEta[iCut] = new TH1F("ESD_TrueConvGamma_Eta","ESD_TrueConvGamma_Eta",2000,-2,2);
1114 fTrueList[iCut]->Add(fHistoTrueConvGammaEta[iCut]);
1115 }
1116 if (fDoClusterQA > 0){
1117 fHistoTrueClusUnConvGammaPt[iCut] = new TH1F("TrueClusUnConvGamma_Pt","TrueClusUnConvGamma_Pt",250,0,25);
1118 fTagOutputList[iCut]->Add(fHistoTrueClusUnConvGammaPt[iCut]);
20af4b69 1119 fHistoTrueClusUnConvGammaMCPt[iCut] = new TH1F("TrueClusUnConvGamma_MCPt","TrueClusUnConvGamma_MCPt",250,0,25);
1120 fTagOutputList[iCut]->Add(fHistoTrueClusUnConvGammaMCPt[iCut]);
fd94f234 1121 fHistoTrueClusElectronPt[iCut] = new TH1F("TrueClusElectron_Pt","TrueElectronGamma_Pt",250,0,25);
1122 fTagOutputList[iCut]->Add(fHistoTrueClusElectronPt[iCut]);
fd94f234 1123 fHistoTrueClusConvGammaPt[iCut] = new TH1F("TrueClusConvGamma_Pt","TrueClusConvGamma_Pt",250,0,25);
1124 fTagOutputList[iCut]->Add(fHistoTrueClusConvGammaPt[iCut]);
20af4b69 1125 fHistoTrueClusConvGammaMCPt[iCut] = new TH1F("TrueClusConvGamma_MCPt","TrueClusConvGamma_MCPt",250,0,25);
1126 fTagOutputList[iCut]->Add(fHistoTrueClusConvGammaMCPt[iCut]);
fd94f234 1127 fHistoTrueClusConvGammaFullyPt[iCut] = new TH1F("TrueClusConvGammaFullyContained_Pt","TrueClusConvGammaFullyContained_Pt",250,0,25);
1128 fTagOutputList[iCut]->Add(fHistoTrueClusConvGammaFullyPt[iCut]);
1129 fHistoTrueClusMergedGammaPt[iCut] = new TH1F("TrueClusMergedGamma_Pt","TrueClusMergedGamma_Pt",250,0,25);
1130 fTagOutputList[iCut]->Add(fHistoTrueClusMergedGammaPt[iCut]);
1131 fHistoTrueClusMergedPartConvGammaPt[iCut] = new TH1F("TrueClusMergedPartConvGamma_Pt","TrueClusMergedPartConvGamma_Pt",250,0,25);
1132 fTagOutputList[iCut]->Add(fHistoTrueClusMergedPartConvGammaPt[iCut]);
1133 fHistoTrueClusDalitzPt[iCut] = new TH1F("TrueClusDalitz_Pt","TrueClusDalitz_Pt",250,0,25);
1134 fTagOutputList[iCut]->Add(fHistoTrueClusDalitzPt[iCut]);
1135 fHistoTrueClusDalitzMergedPt[iCut] = new TH1F("TrueClusDalitzMerged_Pt","TrueClusDalitzMerged_Pt",250,0,25);
1136 fTagOutputList[iCut]->Add(fHistoTrueClusDalitzMergedPt[iCut]);
1137 fHistoTrueClusPhotonFromElecMotherPt[iCut] = new TH1F("TrueClusPhotonFromElecMother_Pt","TrueClusPhotonFromElecMother_Pt",250,0,25);
1138 fTagOutputList[iCut]->Add(fHistoTrueClusPhotonFromElecMotherPt[iCut]);
1139 fHistoTrueClusShowerPt[iCut] = new TH1F("TrueClusShower_Pt","TrueClusShower_Pt",250,0,25);
1140 fTagOutputList[iCut]->Add(fHistoTrueClusShowerPt[iCut]);
cc579963 1141 fHistoTrueClusSubLeadingPt[iCut] = new TH1F("TrueClusSubleading_Pt","TrueClusSubleading_Pt",250,0,25);
1142 fTagOutputList[iCut]->Add(fHistoTrueClusSubLeadingPt[iCut]);
1143 fHistoTrueClusNParticles[iCut] = new TH1I("TrueClusNParticles","TrueClusNParticles",20,0,20);
1144 fTagOutputList[iCut]->Add(fHistoTrueClusNParticles[iCut]);
fd94f234 1145 fHistoTrueClusEMNonLeadingPt[iCut] = new TH1F("TrueClusEMNonLeading_Pt","TrueClusEMNonLeading_Pt",250,0,25);
1146 fTagOutputList[iCut]->Add(fHistoTrueClusEMNonLeadingPt[iCut]);
1147 fHistoTrueNLabelsInClus[iCut] = new TH1F("TrueNLabelsInClus","TrueNLabelsInClus",100,-0.5,99.5);
1148 fTagOutputList[iCut]->Add(fHistoTrueNLabelsInClus[iCut]);
1149 }
1150
8bdca7f1 1151 if(fDoMesonAnalysis){
ed8bc1ca 1152 fHistoTruePi0InvMassPt[iCut] = new TH2F("ESD_TruePi0_InvMass_Pt","ESD_TruePi0_InvMass_Pt",800,0,0.8,250,0,25);
1153 fTrueList[iCut]->Add(fHistoTruePi0InvMassPt[iCut]);
1154 fHistoTrueEtaInvMassPt[iCut] = new TH2F("ESD_TrueEta_InvMass_Pt","ESD_TrueEta_InvMass_Pt",800,0,0.8,250,0,25);
1155 fTrueList[iCut]->Add(fHistoTrueEtaInvMassPt[iCut]);
1156
1157 fHistoTruePrimaryPi0InvMassPt[iCut] = new TH2F("ESD_TruePrimaryPi0_InvMass_Pt", "ESD_TruePrimaryPi0_InvMass_Pt", 800,0,0.8,250,0,25);
1158 fHistoTruePrimaryPi0InvMassPt[iCut]->Sumw2();
1159 fTrueList[iCut]->Add(fHistoTruePrimaryPi0InvMassPt[iCut]);
1160 fHistoTruePrimaryEtaInvMassPt[iCut] = new TH2F("ESD_TruePrimaryEta_InvMass_Pt", "ESD_TruePrimaryEta_InvMass_Pt", 800,0,0.8,250,0,25);
1161 fHistoTruePrimaryEtaInvMassPt[iCut]->Sumw2();
1162 fTrueList[iCut]->Add(fHistoTruePrimaryEtaInvMassPt[iCut]);
1163
1164 fHistoTruePrimaryPi0W0WeightingInvMassPt[iCut] = new TH2F("ESD_TruePrimaryPi0W0Weights_InvMass_Pt", "ESD_TruePrimaryPi0W0Weights_InvMass_Pt", 800,0,0.8,250,0,25);
1165 fHistoTruePrimaryPi0W0WeightingInvMassPt[iCut]->Sumw2();
1166 fTrueList[iCut]->Add(fHistoTruePrimaryPi0W0WeightingInvMassPt[iCut]);
1167 fHistoTruePrimaryEtaW0WeightingInvMassPt[iCut] = new TH2F("ESD_TruePrimaryEtaW0Weights_InvMass_Pt", "ESD_TruePrimaryEtaW0Weights_InvMass_Pt", 800,0,0.8,250,0,25);
1168 fHistoTruePrimaryEtaW0WeightingInvMassPt[iCut]->Sumw2();
1169 fTrueList[iCut]->Add(fHistoTruePrimaryEtaW0WeightingInvMassPt[iCut]);
1170
1171 fProfileTruePrimaryPi0WeightsInvMassPt[iCut] = new TProfile2D("ESD_TruePrimaryPi0Weights_InvMass_Pt", "ESD_TruePrimaryPi0Weights_InvMass_Pt", 800,0,0.8,250,0,25);
1172 fProfileTruePrimaryPi0WeightsInvMassPt[iCut]->Sumw2();
1173 fTrueList[iCut]->Add(fProfileTruePrimaryPi0WeightsInvMassPt[iCut]);
1174 fProfileTruePrimaryEtaWeightsInvMassPt[iCut] = new TProfile2D("ESD_TruePrimaryEtaWeights_InvMass_Pt", "ESD_TruePrimaryEtaWeights_InvMass_Pt", 800,0,0.8,250,0,25);
1175 fProfileTruePrimaryEtaWeightsInvMassPt[iCut]->Sumw2();
1176 fTrueList[iCut]->Add(fProfileTruePrimaryEtaWeightsInvMassPt[iCut]);
20af4b69 1177
ed8bc1ca 1178 fHistoTrueSecondaryPi0InvMassPt[iCut] = new TH2F("ESD_TrueSecondaryPi0_InvMass_Pt", "ESD_TrueSecondaryPi0_InvMass_Pt", 800,0,0.8,250,0,25);
1179 fHistoTrueSecondaryPi0InvMassPt[iCut]->Sumw2();
1180 fTrueList[iCut]->Add(fHistoTrueSecondaryPi0InvMassPt[iCut]);
1181 fHistoTrueSecondaryEtaInvMassPt[iCut] = new TH2F("ESD_TrueSecondaryEta_InvMass_Pt", "ESD_TrueSecondaryEta_InvMass_Pt", 800,0,0.8,250,0,25);
1182 fHistoTrueSecondaryEtaInvMassPt[iCut]->Sumw2();
1183 fTrueList[iCut]->Add(fHistoTrueSecondaryEtaInvMassPt[iCut]);
1184
1185 fHistoTrueSecondaryPi0FromK0sInvMassPt[iCut] = new TH2F("ESD_TrueSecondaryPi0FromK0s_InvMass_Pt","ESD_TrueSecondaryPi0FromK0s_InvMass_Pt",800,0,0.8,250,0,25);
1186 fHistoTrueSecondaryPi0FromK0sInvMassPt[iCut]->Sumw2();
1187 fTrueList[iCut]->Add(fHistoTrueSecondaryPi0FromK0sInvMassPt[iCut]);
1188 fHistoTrueSecondaryPi0FromEtaInvMassPt[iCut] = new TH2F("ESD_TrueSecondaryPi0FromEta_InvMass_Pt","ESD_TrueSecondaryPi0FromEta_InvMass_Pt",800,0,0.8,250,0,25);
1189 fTrueList[iCut]->Add(fHistoTrueSecondaryPi0FromEtaInvMassPt[iCut]);
1190 fHistoTrueSecondaryPi0FromLambdaInvMassPt[iCut] = new TH2F("ESD_TrueSecondaryPi0FromLambda_InvMass_Pt","ESD_TrueSecondaryPi0FromLambda_InvMass_Pt",800,0,0.8,250,0,25);
1191 fTrueList[iCut]->Add(fHistoTrueSecondaryPi0FromLambdaInvMassPt[iCut]);
1192 if (fDoMesonQA > 0){
1193 fHistoTruePi0CaloPhotonInvMassPt[iCut] = new TH2F("ESD_TruePi0CaloPhoton_InvMass_Pt","ESD_TruePi0CaloPhoton_InvMass_Pt",800,0,0.8,250,0,25);
1194 fTrueList[iCut]->Add(fHistoTruePi0CaloPhotonInvMassPt[iCut]);
1195 fHistoTrueEtaCaloPhotonInvMassPt[iCut] = new TH2F("ESD_TrueEtaCaloPhoton_InvMass_Pt","ESD_TrueEtaCaloPhoton_InvMass_Pt",800,0,0.8,250,0,25);
1196 fTrueList[iCut]->Add(fHistoTrueEtaCaloPhotonInvMassPt[iCut]);
20af4b69 1197 fHistoTruePi0CaloConvertedPhotonInvMassPt[iCut] = new TH2F("ESD_TruePi0CaloConvertedPhoton_InvMass_Pt","ESD_TruePi0CaloConvertedPhoton_InvMass_Pt",800,0,0.8,250,0,25);
1198 fTrueList[iCut]->Add(fHistoTruePi0CaloConvertedPhotonInvMassPt[iCut]);
1199 fHistoTruePi0CaloConvertedPhotonMatchedInvMassPt[iCut] = new TH2F("ESD_TruePi0CaloConvertedPhotonMatched_InvMass_Pt","ESD_TruePi0CaloConvertedPhotonMatched_InvMass_Pt",800,0,0.8,250,0,25);
1200 fTrueList[iCut]->Add(fHistoTruePi0CaloConvertedPhotonMatchedInvMassPt[iCut]);
20af4b69 1201 fHistoTrueEtaCaloConvertedPhotonInvMassPt[iCut] = new TH2F("ESD_TrueEtaCaloConvertedPhoton_InvMass_Pt","ESD_TrueEtaCaloConvertedPhoton_InvMass_Pt",800,0,0.8,250,0,25);
1202 fTrueList[iCut]->Add(fHistoTrueEtaCaloConvertedPhotonInvMassPt[iCut]);
1203 fHistoTrueEtaCaloConvertedPhotonMatchedInvMassPt[iCut] = new TH2F("ESD_TrueEtaCaloConvertedPhotonMatched_InvMass_Pt","ESD_TrueEtaCaloConvertedPhotonMatched_InvMass_Pt",800,0,0.8,250,0,25);
1204 fTrueList[iCut]->Add(fHistoTrueEtaCaloConvertedPhotonMatchedInvMassPt[iCut]);
1205
d404157c 1206 fHistoTruePi0CaloElectronInvMassPt[iCut] = new TH2F("ESD_TruePi0CaloElectron_InvMass_Pt","ESD_TruePi0CaloElectron_InvMass_Pt",800,0,0.8,250,0,25);
ed8bc1ca 1207 fTrueList[iCut]->Add(fHistoTruePi0CaloElectronInvMassPt[iCut]);
1208 fHistoTrueEtaCaloElectronInvMassPt[iCut] = new TH2F("ESD_TrueEtaCaloElectron_InvMass_Pt","ESD_TrueEtaCaloElectron_InvMass_Pt",800,0,0.8,250,0,25);
1209 fTrueList[iCut]->Add(fHistoTrueEtaCaloElectronInvMassPt[iCut]);
1210
1211 fHistoTruePi0CaloMergedClusterInvMassPt[iCut] = new TH2F("ESD_TruePi0CaloMergedCluster_InvMass_Pt","ESD_TruePi0CaloMergedCluster_InvMass_Pt",800,0,0.8,250,0,25);
1212 fTrueList[iCut]->Add(fHistoTruePi0CaloMergedClusterInvMassPt[iCut]);
1213 fHistoTrueEtaCaloMergedClusterInvMassPt[iCut] = new TH2F("ESD_TrueEtaCaloMergedCluster_InvMass_Pt","ESD_TrueEtaCaloMergedCluster_InvMass_Pt",800,0,0.8,250,0,25);
1214 fTrueList[iCut]->Add(fHistoTrueEtaCaloMergedClusterInvMassPt[iCut]);
1215
fd94f234 1216 fHistoTrueMotherCaloEMNonLeadingInvMassPt[iCut] = new TH2F("ESD_TrueMotherCaloEMNonLeading_InvMass_Pt","ESD_TrueMotherCaloEMNonLeading_InvMass_Pt",800,0,0.8,250,0,25);
1217 fTrueList[iCut]->Add(fHistoTrueMotherCaloEMNonLeadingInvMassPt[iCut]);
ed8bc1ca 1218 fHistoTruePi0CaloMergedClusterPartConvInvMassPt[iCut] = new TH2F("ESD_TruePi0CaloMergedClusterPartConv_InvMass_Pt","ESD_TruePi0CaloMergedClusterPartConv_InvMass_Pt",800,0,0.8,250,0,25);
1219 fTrueList[iCut]->Add(fHistoTruePi0CaloMergedClusterPartConvInvMassPt[iCut]);
1220 fHistoTrueEtaCaloMergedClusterPartConvInvMassPt[iCut] = new TH2F("ESD_TrueEtaCaloMergedClusterPartConv_InvMass_Pt","ESD_TrueEtaCaloMergedClusterPartConv_InvMass_Pt",800,0,0.8,250,0,25);
1221 fTrueList[iCut]->Add(fHistoTrueEtaCaloMergedClusterPartConvInvMassPt[iCut]);
fd94f234 1222
8bdca7f1 1223 fHistoTruePrimaryPi0MCPtResolPt[iCut] = new TH2F("ESD_TruePrimaryPi0_MCPt_ResolPt","ESD_TruePrimaryPi0_ResolPt_MCPt",500,0.03,25,1000,-1.,1.);
1224 fHistoTruePrimaryPi0MCPtResolPt[iCut]->Sumw2();
1225 SetLogBinningXTH2(fHistoTruePrimaryPi0MCPtResolPt[iCut]);
1226 fTrueList[iCut]->Add(fHistoTruePrimaryPi0MCPtResolPt[iCut]);
1227 fHistoTruePrimaryEtaMCPtResolPt[iCut] = new TH2F("ESD_TruePrimaryEta_MCPt_ResolPt","ESD_TruePrimaryEta_ResolPt_MCPt",500,0.03,25,1000,-1.,1.);
1228 fHistoTruePrimaryEtaMCPtResolPt[iCut]->Sumw2();
1229 SetLogBinningXTH2(fHistoTruePrimaryEtaMCPtResolPt[iCut]);
1230 fTrueList[iCut]->Add(fHistoTruePrimaryEtaMCPtResolPt[iCut]);
1231 fHistoTrueBckGGInvMassPt[iCut] = new TH2F("ESD_TrueBckGG_InvMass_Pt","ESD_TrueBckGG_InvMass_Pt",800,0,0.8,250,0,25);
1232 fTrueList[iCut]->Add(fHistoTrueBckGGInvMassPt[iCut]);
1233 fHistoTrueBckContInvMassPt[iCut] = new TH2F("ESD_TrueBckCont_InvMass_Pt","ESD_TrueBckCont_InvMass_Pt",800,0,0.8,250,0,25);
1234 fTrueList[iCut]->Add(fHistoTrueBckContInvMassPt[iCut]);
1235 fHistoTrueK0sWithPi0DaughterMCPt[iCut] = new TH1F("ESD_TrueK0sWithPi0Daughter_MCPt","ESD_TrueK0sWithPi0Daughter_MCPt",250,0,25);
1236 fTrueList[iCut]->Add(fHistoTrueK0sWithPi0DaughterMCPt[iCut]);
1237 fHistoTrueEtaWithPi0DaughterMCPt[iCut] = new TH1F("ESD_TrueEtaWithPi0Daughter_MCPt","ESD_TrueEtaWithPi0Daughter_MCPt",250,0,25);
1238 fTrueList[iCut]->Add(fHistoTrueEtaWithPi0DaughterMCPt[iCut]);
1239 fHistoTrueLambdaWithPi0DaughterMCPt[iCut] = new TH1F("ESD_TrueLambdaWithPi0Daughter_MCPt","ESD_TrueLambdaWithPi0Daughter_MCPt",250,0,25);
1240 fTrueList[iCut]->Add(fHistoTrueLambdaWithPi0DaughterMCPt[iCut]);
1241
1242 fHistoTruePi0PtY[iCut] = new TH2F("ESD_TruePi0_Pt_Y","ESD_TruePi0_Pt_Y",150,0.03,15.,150,-1.5,1.5);
1243 SetLogBinningXTH2(fHistoTruePi0PtY[iCut]);
1244 fTrueList[iCut]->Add(fHistoTruePi0PtY[iCut]);
1245 fHistoTrueEtaPtY[iCut] = new TH2F("ESD_TrueEta_Pt_Y","ESD_TrueEta_Pt_Y",150,0.03,15.,150,-1.5,1.5);
1246 SetLogBinningXTH2(fHistoTrueEtaPtY[iCut]);
1247 fTrueList[iCut]->Add(fHistoTrueEtaPtY[iCut]);
1248 fHistoTruePi0PtAlpha[iCut] = new TH2F("ESD_TruePi0_Pt_Alpha","ESD_TruePi0_Pt_Alpha",150,0.03,15.,100,0,1);
1249 SetLogBinningXTH2(fHistoTruePi0PtAlpha[iCut]);
1250 fTrueList[iCut]->Add(fHistoTruePi0PtAlpha[iCut]);
1251 fHistoTrueEtaPtAlpha[iCut] = new TH2F("ESD_TrueEta_Pt_Alpha","ESD_TrueEta_Pt_Alpha",150,0.03,15.,100,0,1);
1252 SetLogBinningXTH2(fHistoTrueEtaPtAlpha[iCut]);
1253 fTrueList[iCut]->Add(fHistoTrueEtaPtAlpha[iCut]);
1254
1255 fHistoTruePi0PtOpenAngle[iCut] = new TH2F("ESD_TruePi0_Pt_OpenAngle","ESD_TruePi0_Pt_OpenAngle",150,0.03,15.,200,0,2*TMath::Pi());
1256 SetLogBinningXTH2(fHistoTruePi0PtOpenAngle[iCut]);
1257 fTrueList[iCut]->Add(fHistoTruePi0PtOpenAngle[iCut]);
1258 fHistoTrueEtaPtOpenAngle[iCut] = new TH2F("ESD_TrueEta_Pt_OpenAngle","ESD_TrueEta_Pt_OpenAngle",150,0.03,15.,200,0,2*TMath::Pi());
1259 SetLogBinningXTH2(fHistoTrueEtaPtOpenAngle[iCut]);
1260 fTrueList[iCut]->Add(fHistoTrueEtaPtOpenAngle[iCut]);
8bdca7f1 1261 }
1262 }
1263 }
1264 }
1265
1266 fV0Reader=(AliV0ReaderV1*)AliAnalysisManager::GetAnalysisManager()->GetTask("V0ReaderV1");
1267 if(!fV0Reader){printf("Error: No V0 Reader");return;} // GetV0Reader
1268
1269 if(fV0Reader)
344100c4 1270 if((AliConversionPhotonCuts*)fV0Reader->GetConversionCuts())
1271 if(((AliConversionPhotonCuts*)fV0Reader->GetConversionCuts())->GetCutHistograms())
1272 fOutputContainer->Add(((AliConversionPhotonCuts*)fV0Reader->GetConversionCuts())->GetCutHistograms());
1273 if(fV0Reader)
1274 if((AliConvEventCuts*)fV0Reader->GetEventCuts())
1275 if(((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetCutHistograms())
1276 fOutputContainer->Add(((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetCutHistograms());
1277
1278
8bdca7f1 1279 for(Int_t iCut = 0; iCut<fnCuts;iCut++){
344100c4 1280 if(!((AliConvEventCuts*)fEventCutArray->At(iCut))) continue;
1281 if(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutHistograms()){
1282 fCutFolder[iCut]->Add(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutHistograms());
1283 }
1284 if(!((AliConversionPhotonCuts*)fCutArray->At(iCut))) continue;
1285 if(((AliConversionPhotonCuts*)fCutArray->At(iCut))->GetCutHistograms()){
1286 fCutFolder[iCut]->Add(((AliConversionPhotonCuts*)fCutArray->At(iCut))->GetCutHistograms());
8bdca7f1 1287 }
1288 if(!((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))) continue;
1289 if(((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetCutHistograms()){
1290 fCutFolder[iCut]->Add(((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetCutHistograms());
1291 }
1292 if(fDoMesonAnalysis){
1293 if(!((AliConversionMesonCuts*)fMesonCutArray->At(iCut))) continue;
1294 if(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutHistograms()){
1295 fCutFolder[iCut]->Add(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutHistograms());
1296 }
1297 }
1298 }
1299 PostData(1, fOutputContainer);
1300}
1301//_____________________________________________________________________________
1302Bool_t AliAnalysisTaskGammaConvCalo::Notify()
1303{
1304 for(Int_t iCut = 0; iCut<fnCuts;iCut++){
344100c4 1305 if(!((AliConvEventCuts*)fEventCutArray->At(iCut))->GetDoEtaShift()){
1306 fProfileEtaShift[iCut]->Fill(0.,(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift()));
8bdca7f1 1307 continue; // No Eta Shift requested, continue
1308 }
344100c4 1309 if(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift() == 0.0){ // Eta Shift requested but not set, get shift automatically
1310 ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCorrectEtaShiftFromPeriod(fV0Reader->GetPeriodName());
1311 fProfileEtaShift[iCut]->Fill(0.,(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift()));
1312 ((AliConvEventCuts*)fEventCutArray->At(iCut))->DoEtaShift(kFALSE); // Eta Shift Set, make sure that it is called only once
8bdca7f1 1313 continue;
1314 }
1315 else{
1316 printf(" Gamma Conversion Task %s :: Eta Shift Manually Set to %f \n\n",
344100c4 1317 (((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber()).Data(),((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift());
1318 fProfileEtaShift[iCut]->Fill(0.,(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift()));
1319 ((AliConvEventCuts*)fEventCutArray->At(iCut))->DoEtaShift(kFALSE); // Eta Shift Set, make sure that it is called only once
8bdca7f1 1320 }
1321 }
1322
1323 return kTRUE;
1324}
1325//_____________________________________________________________________________
1326void AliAnalysisTaskGammaConvCalo::UserExec(Option_t *)
1327{
1328 //
1329 // Called for each event
1330 //
344100c4 1331 Int_t eventQuality = ((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetEventQuality();
8bdca7f1 1332 if(eventQuality == 2 || eventQuality == 3){// Event Not Accepted due to MC event missing or wrong trigger for V0ReaderV1
1333 for(Int_t iCut = 0; iCut<fnCuts; iCut++){
1334 fHistoNEvents[iCut]->Fill(eventQuality);
1335 }
1336 return;
1337 }
1338
1339 if(fIsMC) fMCEvent = MCEvent();
1340 if(fMCEvent == NULL) fIsMC = kFALSE;
1341
1342 fInputEvent = InputEvent();
1343
1344 if(fIsMC && fInputEvent->IsA()==AliESDEvent::Class()){
1345 fMCStack = fMCEvent->Stack();
1346 if(fMCStack == NULL) fIsMC = kFALSE;
1347 }
1348
d404157c 1349 if(fInputEvent->IsA()==AliAODEvent::Class()){
1350 fInputEvent->InitMagneticField();
1351 }
1352
8bdca7f1 1353 fReaderGammas = fV0Reader->GetReconstructedGammas(); // Gammas from default Cut
1354
1355 // ------------------- BeginEvent ----------------------------
1356
1357 AliEventplane *EventPlane = fInputEvent->GetEventplane();
1358 if(fIsHeavyIon ==1)fEventPlaneAngle = EventPlane->GetEventplane("V0",fInputEvent,2);
1359 else fEventPlaneAngle=0.0;
1360
1361 if(fIsMC && fInputEvent->IsA()==AliAODEvent::Class() && !(fV0Reader->AreAODsRelabeled())){
1362 RelabelAODPhotonCandidates(kTRUE); // In case of AODMC relabeling MC
1363 fV0Reader->RelabelAODs(kTRUE);
1364 }
1365
1366
1367 for(Int_t iCut = 0; iCut<fnCuts; iCut++){
1368
1369 fiCut = iCut;
344100c4 1370 Int_t eventNotAccepted = ((AliConvEventCuts*)fEventCutArray->At(iCut))->IsEventAcceptedByCut(fV0Reader->GetEventCuts(),fInputEvent,fMCEvent,fIsHeavyIon);
8bdca7f1 1371
1372 if(eventNotAccepted){
1373 // cout << "event rejected due to wrong trigger: " <<eventNotAccepted << endl;
1374 fHistoNEvents[iCut]->Fill(eventNotAccepted); // Check Centrality, PileUp, SDD and V0AND --> Not Accepted => eventQuality = 1
1375 continue;
1376 }
1377
1378 if(eventQuality != 0){// Event Not Accepted
1379 //cout << "event rejected due to: " <<eventQuality << endl;
1380 fHistoNEvents[iCut]->Fill(eventQuality);
1381 continue;
1382 }
1383
1384 fHistoNEvents[iCut]->Fill(eventQuality); // Should be 0 here
1385 fHistoNGoodESDTracks[iCut]->Fill(fV0Reader->GetNumberOfPrimaryTracks());
344100c4 1386 if(((AliConvEventCuts*)fEventCutArray->At(iCut))->IsHeavyIon() == 2) fHistoNV0Tracks[iCut]->Fill(fInputEvent->GetVZEROData()->GetMTotV0A());
8bdca7f1 1387 else fHistoNV0Tracks[iCut]->Fill(fInputEvent->GetVZEROData()->GetMTotV0A()+fInputEvent->GetVZEROData()->GetMTotV0C());
1388
1389 if(fIsMC){
1390 // Process MC Particle
344100c4 1391 if(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetSignalRejection() != 0){
8bdca7f1 1392 if(fInputEvent->IsA()==AliESDEvent::Class()){
344100c4 1393 ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetNotRejectedParticles(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetSignalRejection(),
1394 ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetAcceptedHeader(),
8bdca7f1 1395 fMCEvent);
1396 }
1397 else if(fInputEvent->IsA()==AliAODEvent::Class()){
344100c4 1398 ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetNotRejectedParticles(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetSignalRejection(),
1399 ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetAcceptedHeader(),
8bdca7f1 1400 fInputEvent);
1401 }
1402
344100c4 1403 if(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetAcceptedHeader()){
1404 for(Int_t i = 0;i<(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetAcceptedHeader())->GetEntries();i++){
8bdca7f1 1405 TString nameBin= fHistoMCHeaders[iCut]->GetXaxis()->GetBinLabel(i+1);
1406 if (nameBin.CompareTo("")== 0){
344100c4 1407 TString nameHeader = ((TObjString*)((TList*)((AliConvEventCuts*)fEventCutArray->At(iCut))
1408 ->GetAcceptedHeader())->At(i))->GetString();
1409 fHistoMCHeaders[iCut]->GetXaxis()->SetBinLabel(i+1,nameHeader.Data());
8bdca7f1 1410 }
1411 }
1412 }
1413 }
1414 }
1415 if(fIsMC){
1416 if(fInputEvent->IsA()==AliESDEvent::Class())
1417 ProcessMCParticles();
1418 if(fInputEvent->IsA()==AliAODEvent::Class())
1419 ProcessAODMCParticles();
1420 }
1421
1422 // it is in the loop to have the same conversion cut string (used also for MC stuff that should be same for V0 and Cluster)
1423 ProcessClusters(); // process calo clusters
1424 ProcessPhotonCandidates(); // Process this cuts gammas
1425
1426 fHistoNGammaCandidates[iCut]->Fill(fGammaCandidates->GetEntries());
1427 fHistoNGoodESDTracksVsNGammaCanditates[iCut]->Fill(fV0Reader->GetNumberOfPrimaryTracks(),fGammaCandidates->GetEntries());
1428 if(fDoMesonAnalysis){ // Meson Analysis
1429 if(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->UseMCPSmearing() && fIsMC){
1430 fUnsmearedPx = new Double_t[fGammaCandidates->GetEntries()]; // Store unsmeared Momenta
1431 fUnsmearedPy = new Double_t[fGammaCandidates->GetEntries()];
1432 fUnsmearedPz = new Double_t[fGammaCandidates->GetEntries()];
1433 fUnsmearedE = new Double_t[fGammaCandidates->GetEntries()];
1434
1435 for(Int_t gamma=0;gamma<fGammaCandidates->GetEntries();gamma++){ // Smear the AODPhotons in MC
1436 fUnsmearedPx[gamma] = ((AliAODConversionPhoton*)fGammaCandidates->At(gamma))->Px();
1437 fUnsmearedPy[gamma] = ((AliAODConversionPhoton*)fGammaCandidates->At(gamma))->Py();
1438 fUnsmearedPz[gamma] = ((AliAODConversionPhoton*)fGammaCandidates->At(gamma))->Pz();
1439 fUnsmearedE[gamma] = ((AliAODConversionPhoton*)fGammaCandidates->At(gamma))->E();
1440 ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->SmearParticle(dynamic_cast<AliAODConversionPhoton*>(fGammaCandidates->At(gamma)));
1441 }
1442 }
1443
1444 PhotonTagging(); // tag PCM photons with calorimeter
1445
1446 CalculatePi0Candidates(); // Combine Gammas from conversion and from calo
1447
1448 if(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->DoBGCalculation()){
1449 if(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->BackgroundHandlerType() == 0){
1450 CalculateBackground(); // Combinatorial Background
1451 UpdateEventByEventData(); // Store Event for mixed Events
1452 }
1453 else{
1454 CalculateBackgroundRP(); // Combinatorial Background
1455 fBGHandlerRP[iCut]->AddEvent(fGammaCandidates,fInputEvent); // Store Event for mixed Events
1456 fBGClusHandlerRP[iCut]->AddEvent(fClusterCandidates,fInputEvent); // Store Event for mixed Events
1457 }
1458 }
1459 if(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->UseMCPSmearing() && fIsMC){
1460 for(Int_t gamma=0;gamma<fGammaCandidates->GetEntries();gamma++){ // Smear the AODPhotons in MC
1461 ((AliAODConversionPhoton*)fGammaCandidates->At(gamma))->SetPx(fUnsmearedPx[gamma]); // Reset Unsmeared Momenta
1462 ((AliAODConversionPhoton*)fGammaCandidates->At(gamma))->SetPy(fUnsmearedPy[gamma]);
1463 ((AliAODConversionPhoton*)fGammaCandidates->At(gamma))->SetPz(fUnsmearedPz[gamma]);
1464 ((AliAODConversionPhoton*)fGammaCandidates->At(gamma))->SetE(fUnsmearedE[gamma]);
1465 }
1466 delete[] fUnsmearedPx; fUnsmearedPx = 0x0;
1467 delete[] fUnsmearedPy; fUnsmearedPy = 0x0;
1468 delete[] fUnsmearedPz; fUnsmearedPz = 0x0;
1469 delete[] fUnsmearedE; fUnsmearedE = 0x0;
1470 }
1471 }
1472
1473 fGammaCandidates->Clear(); // delete this cuts good gammas
1474 fClusterCandidates->Clear(); // delete cluster candidates
1475 }
1476
1477 if(fIsMC && fInputEvent->IsA()==AliAODEvent::Class() && !(fV0Reader->AreAODsRelabeled())){
1478 RelabelAODPhotonCandidates(kFALSE); // Back to ESDMC Label
1479 fV0Reader->RelabelAODs(kFALSE);
1480 }
1481
1482 PostData(1, fOutputContainer);
1483}
1484
1485//________________________________________________________________________
1486void AliAnalysisTaskGammaConvCalo::ProcessClusters()
1487{
1488
1489 Int_t nclus = 0;
1490 nclus = fInputEvent->GetNumberOfCaloClusters();
1491
9df9736d 1492// cout << nclus << endl;
8bdca7f1 1493
1494 if(nclus == 0) return;
1495
1496 // vertex
1497 Double_t vertex[3] = {0};
1498 InputEvent()->GetPrimaryVertex()->GetXYZ(vertex);
1499
1500 // Loop over EMCal clusters
d53bf4ac 1501 for(Long_t i = 0; i < nclus; i++){
8bdca7f1 1502
20af4b69 1503 AliVCluster* clus = NULL;
1504 clus = fInputEvent->GetCaloCluster(i);
8bdca7f1 1505 if (!clus) continue;
1506 if(!((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelected(clus,fInputEvent,fIsMC)) continue;
1507 // TLorentzvector with cluster
1508 TLorentzVector clusterVector;
1509 clus->GetMomentum(clusterVector,vertex);
1510
1511 TLorentzVector* tmpvec = new TLorentzVector();
1512 tmpvec->SetPxPyPzE(clusterVector.Px(),clusterVector.Py(),clusterVector.Pz(),clusterVector.E());
1513
1514 // convert to AODConversionPhoton
1515 AliAODConversionPhoton *PhotonCandidate=new AliAODConversionPhoton(tmpvec);
1516 if(!PhotonCandidate) continue;
fd94f234 1517
1518 // Flag Photon as CaloPhoton
1519 PhotonCandidate->SetIsCaloPhoton();
d53bf4ac 1520 PhotonCandidate->SetCaloClusterRef(i);
8bdca7f1 1521 // get MC label
8bdca7f1 1522 if(fIsMC){
fd94f234 1523 Int_t* mclabelsCluster = clus->GetLabels();
1524 PhotonCandidate->SetNCaloPhotonMCLabels(clus->GetNLabels());
1525// cout << clus->GetNLabels() << endl;
1526 if (clus->GetNLabels()>0){
1527 for (Int_t k =0; k< (Int_t)clus->GetNLabels(); k++){
cc579963 1528 if (k< 20)PhotonCandidate->SetCaloPhotonMCLabel(k,mclabelsCluster[k]);
fd94f234 1529// Int_t pdgCode = fMCStack->Particle(mclabelsCluster[k])->GetPdgCode();
1530// cout << "label " << k << "\t" << mclabelsCluster[k] << " pdg code: " << pdgCode << endl;
1531 }
1532 }
8bdca7f1 1533 }
1534
fd94f234 1535 fIsFromMBHeader = kTRUE;
1536 // test whether largest contribution to cluster orginates in added signals
1537 if (fIsMC && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(PhotonCandidate->GetCaloPhotonMCLabel(0), fMCStack, fInputEvent) == 0) fIsFromMBHeader = kFALSE;
8bdca7f1 1538
1539 fHistoClusGammaPt[fiCut]->Fill(PhotonCandidate->Pt());
1540 fClusterCandidates->Add(PhotonCandidate); // if no second loop is required add to events good gammas
1541
8bdca7f1 1542 if(fIsMC){
fd94f234 1543 if(fInputEvent->IsA()==AliESDEvent::Class()){
1544 ProcessTrueClusterCandidates(PhotonCandidate);
1545 } else {
1546 ProcessTrueClusterCandidatesAOD(PhotonCandidate);
1547 }
8bdca7f1 1548 }
1549
344100c4 1550 delete tmpvec;
8bdca7f1 1551 }
1552
1553}
1554
1555//________________________________________________________________________
1556void AliAnalysisTaskGammaConvCalo::ProcessTrueClusterCandidates(AliAODConversionPhoton *TruePhotonCandidate)
1557{
fd94f234 1558
1559 TParticle *Photon = NULL;
1560 if (!TruePhotonCandidate->GetIsCaloPhoton()) AliFatal("CaloPhotonFlag has not been set task will abort");
1561 fHistoTrueNLabelsInClus[fiCut]->Fill(TruePhotonCandidate->GetNCaloPhotonMCLabels());
8bdca7f1 1562
fd94f234 1563 if (TruePhotonCandidate->GetNCaloPhotonMCLabels()>0)Photon = fMCStack->Particle(TruePhotonCandidate->GetCaloPhotonMCLabel(0));
1564 else return;
1565
8bdca7f1 1566 if(Photon == NULL){
1567 // cout << "no photon" << endl;
1568 return;
1569 }
fd94f234 1570
1571 TruePhotonCandidate->SetCaloPhotonMCFlags(fMCStack);
8bdca7f1 1572
1573 // True Photon
1574 if(fIsFromMBHeader){
fd94f234 1575 if (TruePhotonCandidate->IsLargestComponentPhoton() || TruePhotonCandidate->IsLargestComponentElectron() )fHistoTrueClusGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1576 else fHistoTrueClusEMNonLeadingPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1577 if (fDoClusterQA > 0){
20af4b69 1578 if (TruePhotonCandidate->IsLargestComponentPhoton()){
fd94f234 1579 fHistoTrueClusUnConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
20af4b69 1580 fHistoTrueClusUnConvGammaMCPt[fiCut]->Fill(Photon->Pt());
1581 }
fd94f234 1582 if (TruePhotonCandidate->IsLargestComponentElectron())
1583 fHistoTrueClusElectronPt[fiCut]->Fill(TruePhotonCandidate->Pt());
20af4b69 1584 if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion()){
fd94f234 1585 fHistoTrueClusConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
20af4b69 1586 fHistoTrueClusConvGammaMCPt[fiCut]->Fill(((TParticle*)fMCStack->Particle(Photon->GetMother(0)))->Pt());
1587 }
fd94f234 1588 if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion() && TruePhotonCandidate->IsConversionFullyContained())
1589 fHistoTrueClusConvGammaFullyPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1590 if (TruePhotonCandidate->IsMerged() || TruePhotonCandidate->IsMergedPartConv() || TruePhotonCandidate->IsDalitzMerged())
1591 fHistoTrueClusMergedGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1592 if (TruePhotonCandidate->IsMergedPartConv())
1593 fHistoTrueClusMergedPartConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1594 if (TruePhotonCandidate->IsDalitz())
1595 fHistoTrueClusDalitzPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1596 if (TruePhotonCandidate->IsDalitzMerged())
1597 fHistoTrueClusDalitzMergedPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1598 if (TruePhotonCandidate->IsPhotonWithElecMother())
1599 fHistoTrueClusPhotonFromElecMotherPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1600 if (TruePhotonCandidate->IsShower())
1601 fHistoTrueClusShowerPt[fiCut]->Fill(TruePhotonCandidate->Pt());
cc579963 1602 if (TruePhotonCandidate->IsSubLeadingEM())
1603 fHistoTrueClusSubLeadingPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1604 fHistoTrueClusNParticles[fiCut]->Fill(TruePhotonCandidate->GetNCaloPhotonMotherMCLabels());
fd94f234 1605 }
8bdca7f1 1606 }
1607
1608 if(Photon->GetMother(0) <= fMCStack->GetNprimary()){
1609 // Count just primary MC Gammas as true --> For Ratio esdtruegamma / mcconvgamma
1610 if(fIsFromMBHeader){
344100c4 1611 fHistoTruePrimaryClusGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1612 fHistoTruePrimaryClusGammaESDPtMCPt[fiCut]->Fill(TruePhotonCandidate->Pt(),Photon->Pt()); // Allways Filled
8bdca7f1 1613 }
fd94f234 1614 }
1615 return;
1616}
1617
1618
1619//________________________________________________________________________
1620void AliAnalysisTaskGammaConvCalo::ProcessTrueClusterCandidatesAOD(AliAODConversionPhoton *TruePhotonCandidate)
1621{
1622 AliAODMCParticle *Photon = NULL;
1623 TClonesArray *AODMCTrackArray = dynamic_cast<TClonesArray*>(fInputEvent->FindListObject(AliAODMCParticle::StdBranchName()));
1624 if (AODMCTrackArray){
1625 if (!TruePhotonCandidate->GetIsCaloPhoton()) AliFatal("CaloPhotonFlag has not been set task will abort");
1626 if (TruePhotonCandidate->GetNCaloPhotonMCLabels()>0) Photon = (AliAODMCParticle*) AODMCTrackArray->At(TruePhotonCandidate->GetCaloPhotonMCLabel(0));
1627 else return;
1628 } else {
1629 AliInfo("AODMCTrackArray could not be loaded");
1630 return;
8bdca7f1 1631 }
1632
fd94f234 1633 if(Photon == NULL){
cc579963 1634 // cout << "no photon" << endl;
fd94f234 1635 return;
1636 }
1637 TruePhotonCandidate->SetCaloPhotonMCFlagsAOD(fInputEvent);
d404157c 1638 fHistoTrueNLabelsInClus[fiCut]->Fill(TruePhotonCandidate->GetNCaloPhotonMCLabels());
fd94f234 1639 // True Photon
1640 if(fIsFromMBHeader){
1641 if (TruePhotonCandidate->IsLargestComponentPhoton() || TruePhotonCandidate->IsLargestComponentElectron() )fHistoTrueClusGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1642 else fHistoTrueClusEMNonLeadingPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1643 if (fDoClusterQA > 0){
20af4b69 1644 if (TruePhotonCandidate->IsLargestComponentPhoton()) {
fd94f234 1645 fHistoTrueClusUnConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
20af4b69 1646 fHistoTrueClusUnConvGammaMCPt[fiCut]->Fill(Photon->Pt());
1647 }
fd94f234 1648 if (TruePhotonCandidate->IsLargestComponentElectron())
1649 fHistoTrueClusElectronPt[fiCut]->Fill(TruePhotonCandidate->Pt());
20af4b69 1650 if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion()) {
fd94f234 1651 fHistoTrueClusConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
20af4b69 1652 AliAODMCParticle *Mother = (AliAODMCParticle*) AODMCTrackArray->At(Photon->GetMother());
1653 fHistoTrueClusConvGammaMCPt[fiCut]->Fill(Mother->Pt());
1654 }
fd94f234 1655 if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion() && TruePhotonCandidate->IsConversionFullyContained())
1656 fHistoTrueClusConvGammaFullyPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1657 if (TruePhotonCandidate->IsMerged() || TruePhotonCandidate->IsMergedPartConv() || TruePhotonCandidate->IsDalitzMerged())
1658 fHistoTrueClusMergedGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1659 if (TruePhotonCandidate->IsMergedPartConv())
1660 fHistoTrueClusMergedPartConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1661 if (TruePhotonCandidate->IsDalitz())
1662 fHistoTrueClusDalitzPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1663 if (TruePhotonCandidate->IsDalitzMerged())
1664 fHistoTrueClusDalitzMergedPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1665 if (TruePhotonCandidate->IsPhotonWithElecMother())
1666 fHistoTrueClusPhotonFromElecMotherPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1667 if (TruePhotonCandidate->IsShower())
1668 fHistoTrueClusShowerPt[fiCut]->Fill(TruePhotonCandidate->Pt());
cc579963 1669 if (TruePhotonCandidate->IsSubLeadingEM())
1670 fHistoTrueClusSubLeadingPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1671 fHistoTrueClusNParticles[fiCut]->Fill(TruePhotonCandidate->GetNCaloPhotonMotherMCLabels());
fd94f234 1672 }
1673 }
8bdca7f1 1674
fd94f234 1675 // True Photon
1676 if(fIsFromMBHeader){
1677 fHistoTrueClusGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1678// if (fDoPhotonQA > 0) fHistoTrueConvGammaEta[fiCut]->Fill(TruePhotonCandidate->Eta());
1679 }
1680
1681 if(Photon->IsPrimary()){
1682 // Count just primary MC Gammas as true --> For Ratio esdtruegamma / mcconvgamma
1683 if(fIsFromMBHeader){
1684 fHistoTruePrimaryClusGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1685 fHistoTruePrimaryClusGammaESDPtMCPt[fiCut]->Fill(TruePhotonCandidate->Pt(),Photon->Pt()); // Allways Filled
1686 }
1687 }
1688}
8bdca7f1 1689
1690//________________________________________________________________________
1691void AliAnalysisTaskGammaConvCalo::ProcessPhotonCandidates()
1692{
1693 Int_t nV0 = 0;
1694 TList *GammaCandidatesStepOne = new TList();
1695 TList *GammaCandidatesStepTwo = new TList();
1696 // Loop over Photon Candidates allocated by ReaderV1
1697 for(Int_t i = 0; i < fReaderGammas->GetEntriesFast(); i++){
1698 AliAODConversionPhoton* PhotonCandidate = (AliAODConversionPhoton*) fReaderGammas->At(i);
1699 if(!PhotonCandidate) continue;
1700 fIsFromMBHeader = kTRUE;
344100c4 1701 if(fIsMC && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 0){
1702 Int_t isPosFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(PhotonCandidate->GetMCLabelPositive(), fMCStack, fInputEvent);
1703 if(isPosFromMBHeader == 0 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 3) continue;
1704 Int_t isNegFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(PhotonCandidate->GetMCLabelNegative(), fMCStack, fInputEvent);
1705 if(isNegFromMBHeader == 0 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 3) continue;
8bdca7f1 1706 if( (isNegFromMBHeader+isPosFromMBHeader) != 4) fIsFromMBHeader = kFALSE;
1707 }
1708
344100c4 1709 if(!((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelected(PhotonCandidate,fInputEvent)) continue;
1710 if(!((AliConversionPhotonCuts*)fCutArray->At(fiCut))->InPlaneOutOfPlaneCut(PhotonCandidate->GetPhotonPhi(),fEventPlaneAngle)) continue;
1711 if(!((AliConversionPhotonCuts*)fCutArray->At(fiCut))->UseElecSharingCut() &&
1712 !((AliConversionPhotonCuts*)fCutArray->At(fiCut))->UseToCloseV0sCut()){
8bdca7f1 1713 fGammaCandidates->Add(PhotonCandidate); // if no second loop is required add to events good gammas
1714
1715 if(fIsFromMBHeader){
1716 fHistoConvGammaPt[fiCut]->Fill(PhotonCandidate->Pt());
1717 if (fDoPhotonQA > 0){
1718 fHistoConvGammaR[fiCut]->Fill(PhotonCandidate->GetConversionRadius());
1719 fHistoConvGammaEta[fiCut]->Fill(PhotonCandidate->Eta());
1720 }
1721 }
1722 if(fIsMC){
1723 if(fInputEvent->IsA()==AliESDEvent::Class())
1724 ProcessTruePhotonCandidates(PhotonCandidate);
1725 if(fInputEvent->IsA()==AliAODEvent::Class())
1726 ProcessTruePhotonCandidatesAOD(PhotonCandidate);
1727 }
1728 if (fIsFromMBHeader && fDoPhotonQA == 2){
1729 if (fIsHeavyIon == 1 && PhotonCandidate->Pt() > 0.399 && PhotonCandidate->Pt() < 12.){
344100c4 1730 fPtGamma = PhotonCandidate->Pt();
1731 fDCAzPhoton = PhotonCandidate->GetDCAzToPrimVtx();
1732 fRConvPhoton = PhotonCandidate->GetConversionRadius();
1733 fEtaPhoton = PhotonCandidate->GetPhotonEta();
1734 fCharCatPhoton = PhotonCandidate->GetPhotonQuality();
1735 fTreeConvGammaPtDcazCat[fiCut]->Fill();
8bdca7f1 1736 } else if ( PhotonCandidate->Pt() > 0.299 && PhotonCandidate->Pt() < 16.){
344100c4 1737 fPtGamma = PhotonCandidate->Pt();
1738 fDCAzPhoton = PhotonCandidate->GetDCAzToPrimVtx();
1739 fRConvPhoton = PhotonCandidate->GetConversionRadius();
1740 fEtaPhoton = PhotonCandidate->GetPhotonEta();
1741 fCharCatPhoton = PhotonCandidate->GetPhotonQuality();
1742 fTreeConvGammaPtDcazCat[fiCut]->Fill();
8bdca7f1 1743 }
1744 }
344100c4 1745 } else if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->UseElecSharingCut()){ // if Shared Electron cut is enabled, Fill array, add to step one
1746 ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->FillElectonLabelArray(PhotonCandidate,nV0);
8bdca7f1 1747 nV0++;
1748 GammaCandidatesStepOne->Add(PhotonCandidate);
344100c4 1749 } else if(!((AliConversionPhotonCuts*)fCutArray->At(fiCut))->UseElecSharingCut() &&
1750 ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->UseToCloseV0sCut()){ // shared electron is disabled, step one not needed -> step two
8bdca7f1 1751 GammaCandidatesStepTwo->Add(PhotonCandidate);
1752 }
1753 }
344100c4 1754 if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->UseElecSharingCut()){
8bdca7f1 1755 for(Int_t i = 0;i<GammaCandidatesStepOne->GetEntries();i++){
1756 AliAODConversionPhoton *PhotonCandidate= (AliAODConversionPhoton*) GammaCandidatesStepOne->At(i);
1757 if(!PhotonCandidate) continue;
1758 fIsFromMBHeader = kTRUE;
344100c4 1759 if(fMCStack && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 0){
1760 Int_t isPosFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(PhotonCandidate->GetMCLabelPositive(), fMCStack, fInputEvent);
1761 Int_t isNegFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(PhotonCandidate->GetMCLabelNegative(), fMCStack, fInputEvent);
8bdca7f1 1762 if( (isNegFromMBHeader+isPosFromMBHeader) != 4) fIsFromMBHeader = kFALSE;
1763 }
344100c4 1764 if(!((AliConversionPhotonCuts*)fCutArray->At(fiCut))->RejectSharedElectronV0s(PhotonCandidate,i,GammaCandidatesStepOne->GetEntries())) continue;
1765 if(!((AliConversionPhotonCuts*)fCutArray->At(fiCut))->UseToCloseV0sCut()){ // To Colse v0s cut diabled, step two not needed
8bdca7f1 1766 fGammaCandidates->Add(PhotonCandidate);
1767 if(fIsFromMBHeader){
1768 fHistoConvGammaPt[fiCut]->Fill(PhotonCandidate->Pt());
1769 if (fDoPhotonQA > 0){
1770 fHistoConvGammaR[fiCut]->Fill(PhotonCandidate->GetConversionRadius());
1771 fHistoConvGammaEta[fiCut]->Fill(PhotonCandidate->Eta());
1772 }
1773 }
1774 }
1775 if(fIsMC){
1776 if(fInputEvent->IsA()==AliESDEvent::Class())
1777 ProcessTruePhotonCandidates(PhotonCandidate);
1778 if(fInputEvent->IsA()==AliAODEvent::Class())
1779 ProcessTruePhotonCandidatesAOD(PhotonCandidate);
1780 } else GammaCandidatesStepTwo->Add(PhotonCandidate); // Close v0s cut enabled -> add to list two
1781
1782 if (fIsFromMBHeader && fDoPhotonQA == 2){
1783 if (fIsHeavyIon ==1 && PhotonCandidate->Pt() > 0.399 && PhotonCandidate->Pt() < 12.){
1784 fPtGamma = PhotonCandidate->Pt();
1785 fDCAzPhoton = PhotonCandidate->GetDCAzToPrimVtx();
1786 fRConvPhoton = PhotonCandidate->GetConversionRadius();
1787 fEtaPhoton = PhotonCandidate->GetPhotonEta();
1788 fCharCatPhoton = PhotonCandidate->GetPhotonQuality();
1789 fTreeConvGammaPtDcazCat[fiCut]->Fill();
1790 } else if ( PhotonCandidate->Pt() > 0.299 && PhotonCandidate->Pt() < 16.){
1791 fPtGamma = PhotonCandidate->Pt();
1792 fDCAzPhoton = PhotonCandidate->GetDCAzToPrimVtx();
1793 fRConvPhoton = PhotonCandidate->GetConversionRadius();
1794 fEtaPhoton = PhotonCandidate->GetPhotonEta();
1795 fCharCatPhoton = PhotonCandidate->GetPhotonQuality();
1796 fTreeConvGammaPtDcazCat[fiCut]->Fill();
1797 }
1798 }
1799 }
1800 }
344100c4 1801 if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->UseToCloseV0sCut()){
8bdca7f1 1802 for(Int_t i = 0;i<GammaCandidatesStepTwo->GetEntries();i++){
1803 AliAODConversionPhoton* PhotonCandidate = (AliAODConversionPhoton*) GammaCandidatesStepTwo->At(i);
1804 if(!PhotonCandidate) continue;
1805 fIsFromMBHeader = kTRUE;
344100c4 1806 if(fMCStack && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 0){
1807 Int_t isPosFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(PhotonCandidate->GetMCLabelPositive(), fMCStack, fInputEvent);
1808 Int_t isNegFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(PhotonCandidate->GetMCLabelNegative(), fMCStack, fInputEvent);
8bdca7f1 1809 if( (isNegFromMBHeader+isPosFromMBHeader) != 4) fIsFromMBHeader = kFALSE;
1810 }
344100c4 1811 if(!((AliConversionPhotonCuts*)fCutArray->At(fiCut))->RejectToCloseV0s(PhotonCandidate,GammaCandidatesStepTwo,i)) continue;
8bdca7f1 1812 fGammaCandidates->Add(PhotonCandidate); // Add gamma to current cut TList
1813 if(fIsFromMBHeader){
1814 fHistoConvGammaPt[fiCut]->Fill(PhotonCandidate->Pt());
1815 if (fDoPhotonQA > 0){
1816 fHistoConvGammaR[fiCut]->Fill(PhotonCandidate->GetConversionRadius());
1817 fHistoConvGammaEta[fiCut]->Fill(PhotonCandidate->Eta());
1818 }
1819 }
1820 if(fIsMC){
1821 if(fInputEvent->IsA()==AliESDEvent::Class())
1822 ProcessTruePhotonCandidates(PhotonCandidate);
1823 if(fInputEvent->IsA()==AliAODEvent::Class())
1824 ProcessTruePhotonCandidatesAOD(PhotonCandidate);
1825 }
1826 if (fIsFromMBHeader){
1827 if (fIsHeavyIon == 1 && PhotonCandidate->Pt() > 0.399 && PhotonCandidate->Pt() < 12.){
1828 fPtGamma = PhotonCandidate->Pt();
1829 fDCAzPhoton = PhotonCandidate->GetDCAzToPrimVtx();
1830 fRConvPhoton = PhotonCandidate->GetConversionRadius();
1831 fEtaPhoton = PhotonCandidate->GetPhotonEta();
1832 fCharCatPhoton = PhotonCandidate->GetPhotonQuality();
1833 fTreeConvGammaPtDcazCat[fiCut]->Fill();
1834 } else if ( PhotonCandidate->Pt() > 0.299 && PhotonCandidate->Pt() < 16.){
1835 fPtGamma = PhotonCandidate->Pt();
1836 fDCAzPhoton = PhotonCandidate->GetDCAzToPrimVtx();
1837 fRConvPhoton = PhotonCandidate->GetConversionRadius();
1838 fEtaPhoton = PhotonCandidate->GetPhotonEta();
1839 fCharCatPhoton = PhotonCandidate->GetPhotonQuality();
1840 fTreeConvGammaPtDcazCat[fiCut]->Fill();
1841 }
1842 }
1843 }
1844 }
1845
1846 delete GammaCandidatesStepOne;
1847 GammaCandidatesStepOne = 0x0;
1848 delete GammaCandidatesStepTwo;
1849 GammaCandidatesStepTwo = 0x0;
1850
1851}
1852//________________________________________________________________________
1853void AliAnalysisTaskGammaConvCalo::ProcessTruePhotonCandidatesAOD(AliAODConversionPhoton *TruePhotonCandidate)
1854{
1855
1856 Double_t magField = fInputEvent->GetMagneticField();
1857 if( magField < 0.0 ){
1858 magField = 1.0;
1859 }
1860 else {
1861 magField = -1.0;
1862 }
1863
1864 TClonesArray *AODMCTrackArray = dynamic_cast<TClonesArray*>(fInputEvent->FindListObject(AliAODMCParticle::StdBranchName()));
1865 AliAODMCParticle *posDaughter = (AliAODMCParticle*) AODMCTrackArray->At(TruePhotonCandidate->GetMCLabelPositive());
1866 AliAODMCParticle *negDaughter = (AliAODMCParticle*) AODMCTrackArray->At(TruePhotonCandidate->GetMCLabelNegative());
1867 fCharPhotonMCInfo = 0;
1868
1869 if(posDaughter == NULL || negDaughter == NULL) return; // One particle does not exist
1870 Int_t pdgCode[2] = {abs(posDaughter->GetPdgCode()),abs(negDaughter->GetPdgCode())};
1871
1872 if(posDaughter->GetMother() != negDaughter->GetMother()){
1873 FillPhotonCombinatorialBackgroundHist(TruePhotonCandidate, pdgCode);
1874 fCharPhotonMCInfo = 1;
1875 return;
1876 }
1877 else if(posDaughter->GetMother() == -1){
1878 FillPhotonCombinatorialBackgroundHist(TruePhotonCandidate, pdgCode);
1879 fCharPhotonMCInfo = 1;
1880 return;
1881 }
1882
1883 if(pdgCode[0]!=11 || pdgCode[1]!=11){
1884 fCharPhotonMCInfo = 1;
1885 return; //One Particle is not a electron
1886 }
fd94f234 1887
8bdca7f1 1888 if(posDaughter->GetPdgCode()==negDaughter->GetPdgCode()){
1889 fCharPhotonMCInfo = 1;
1890 return; // Same Charge
1891 }
1892
fd94f234 1893 AliAODMCParticle *Photon = (AliAODMCParticle*) AODMCTrackArray->At(posDaughter->GetMother());
8bdca7f1 1894 if(Photon->GetPdgCode() != 22){
8bdca7f1 1895 fCharPhotonMCInfo = 1;
1896 return; // Mother is no Photon
1897 }
1898
1899 if(((posDaughter->GetMCProcessCode())) != 5 || ((negDaughter->GetMCProcessCode())) != 5){
1900 fCharPhotonMCInfo = 1;
1901 return;// check if the daughters come from a conversion
1902 }
1903 // STILL A BUG IN ALIROOT >>8 HAS TPO BE REMOVED AFTER FIX
1904
1905
1906
1907 // True Photon
1908 if(fIsFromMBHeader){
1909 fHistoTrueConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1910 if (fDoPhotonQA > 0) fHistoTrueConvGammaEta[fiCut]->Fill(TruePhotonCandidate->Eta());
1911 }
8bdca7f1 1912 if(Photon->IsPrimary()){
1913 // Count just primary MC Gammas as true --> For Ratio esdtruegamma / mcconvgamma
1914 if(fIsFromMBHeader){
1915 fCharPhotonMCInfo = 6;
1916 fHistoTruePrimaryConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1917 fHistoTruePrimaryConvGammaESDPtMCPt[fiCut]->Fill(TruePhotonCandidate->Pt(),Photon->Pt()); // Allways Filled
1918 }
1919 // (Not Filled for i6, Extra Signal Gamma (parambox) are secondary)
1920 } else {
1921 if(fIsFromMBHeader){
1922 fHistoTrueSecondaryConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1923 fCharPhotonMCInfo = 2;
1924 if(((AliAODMCParticle*)AODMCTrackArray->At(Photon->GetMother()))->GetMother() > -1 &&
1925 ((AliAODMCParticle*)AODMCTrackArray->At(((AliAODMCParticle*)AODMCTrackArray->At(Photon->GetMother()))->GetMother()))->GetPdgCode() == 3122){
1926 fCharPhotonMCInfo = 5;
1927 fHistoTrueSecondaryConvGammaFromXFromLambdaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1928 }
1929 if(((AliAODMCParticle*)AODMCTrackArray->At(Photon->GetMother()))->GetMother() > -1 &&
1930 ((AliAODMCParticle*)AODMCTrackArray->At(((AliAODMCParticle*)AODMCTrackArray->At(Photon->GetMother()))->GetMother()))->GetPdgCode() == 310){
1931 fCharPhotonMCInfo = 4;
1932 fHistoTrueSecondaryConvGammaFromXFromK0sPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1933 }
1934 if(((AliAODMCParticle*)AODMCTrackArray->At(Photon->GetMother()))->GetMother() > -1 &&
1935 ((AliAODMCParticle*)AODMCTrackArray->At(((AliAODMCParticle*)AODMCTrackArray->At(Photon->GetMother()))->GetMother()))->GetPdgCode() == 221){
1936 fCharPhotonMCInfo = 3;
1937 }
1938 }
41ed7315 1939 }
1940 if( ((AliAODMCParticle*)AODMCTrackArray->At(Photon->GetMother()))->GetPdgCode() == 111 ){
1941 fHistoTrueConvPi0GammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1942 }
8bdca7f1 1943}
1944//________________________________________________________________________
1945void AliAnalysisTaskGammaConvCalo::ProcessTruePhotonCandidates(AliAODConversionPhoton *TruePhotonCandidate)
1946{
cc579963 1947
8bdca7f1 1948 Double_t magField = fInputEvent->GetMagneticField();
1949 if( magField < 0.0 ){
1950 magField = 1.0;
1951 }
1952 else {
1953 magField = -1.0;
1954 }
cc579963 1955
8bdca7f1 1956 // Process True Photons
1957 TParticle *posDaughter = TruePhotonCandidate->GetPositiveMCDaughter(fMCStack);
1958 TParticle *negDaughter = TruePhotonCandidate->GetNegativeMCDaughter(fMCStack);
1959 fCharPhotonMCInfo = 0;
1960
1961 if(posDaughter == NULL || negDaughter == NULL) return; // One particle does not exist
1962 Int_t pdgCode[2] = {abs(posDaughter->GetPdgCode()),abs(negDaughter->GetPdgCode())};
1963 fCharPhotonMCInfo = 1;
1964 if(posDaughter->GetMother(0) != negDaughter->GetMother(0)){
1965 FillPhotonCombinatorialBackgroundHist(TruePhotonCandidate, pdgCode);
1966 return;
1967 }
1968 else if(posDaughter->GetMother(0) == -1){
1969 FillPhotonCombinatorialBackgroundHist(TruePhotonCandidate, pdgCode);
1970 return;
1971 }
1972
1973 if(pdgCode[0]!=11 || pdgCode[1]!=11) return; //One Particle is not a electron
1974
1975 if(posDaughter->GetPdgCode()==negDaughter->GetPdgCode()) return; // Same Charge
cc579963 1976
8bdca7f1 1977 TParticle *Photon = TruePhotonCandidate->GetMCParticle(fMCStack);
8bdca7f1 1978
1979 if(Photon->GetPdgCode() != 22){
8bdca7f1 1980 return; // Mother is no Photon
1981 }
1982
1983 if(posDaughter->GetUniqueID() != 5 || negDaughter->GetUniqueID() !=5) return;// check if the daughters come from a conversion
1984
8bdca7f1 1985 // True Photon
1986 if(fIsFromMBHeader){
1987 fHistoTrueConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1988 if (fDoPhotonQA > 0) fHistoTrueConvGammaEta[fiCut]->Fill(TruePhotonCandidate->Eta());
1989 }
8bdca7f1 1990 if(posDaughter->GetMother(0) <= fMCStack->GetNprimary()){
1991 // Count just primary MC Gammas as true --> For Ratio esdtruegamma / mcconvgamma
1992 if(fIsFromMBHeader){
1993 fCharPhotonMCInfo = 6;
1994 fHistoTruePrimaryConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1995 fHistoTruePrimaryConvGammaESDPtMCPt[fiCut]->Fill(TruePhotonCandidate->Pt(),Photon->Pt()); // Allways Filled
1996
1997 }
1998 // (Not Filled for i6, Extra Signal Gamma (parambox) are secondary)
1999 }
2000 else{
2001 if(fIsFromMBHeader){
2002 fCharPhotonMCInfo = 2;
2003 fHistoTrueSecondaryConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
2004 if(fMCStack->Particle(Photon->GetMother(0))->GetMother(0) > -1 &&
2005 fMCStack->Particle(fMCStack->Particle(Photon->GetMother(0))->GetMother(0))->GetPdgCode() == 3122){
2006 fHistoTrueSecondaryConvGammaFromXFromLambdaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
2007 fCharPhotonMCInfo = 5;
2008 }
2009 if(fMCStack->Particle(Photon->GetMother(0))->GetMother(0) > -1 &&
2010 fMCStack->Particle(fMCStack->Particle(Photon->GetMother(0))->GetMother(0))->GetPdgCode() == 310){
2011 fHistoTrueSecondaryConvGammaFromXFromK0sPt[fiCut]->Fill(TruePhotonCandidate->Pt());
2012 fCharPhotonMCInfo = 4;
2013 }
2014 if(fMCStack->Particle(Photon->GetMother(0))->GetMother(0) > -1 &&
2015 fMCStack->Particle(fMCStack->Particle(Photon->GetMother(0))->GetMother(0))->GetPdgCode() == 221){
2016 fCharPhotonMCInfo = 3;
2017 }
2018 }
2019 }
cc579963 2020
8bdca7f1 2021 // pi0 photon
2022 //Bool_t bpi0 = 0;
2023 Int_t imother = Photon->GetMother(0);
cc579963 2024 if(imother > -1){
2025 AliMCParticle* McMother = static_cast<AliMCParticle*>(fMCEvent->GetTrack(imother));
2026 //cout << fMCEvent->GetRunNumber() << " " << imother << " " << fMCEvent->GetNumberOfTracks() << endl;
2027 if(McMother->PdgCode() == 111) fHistoTrueConvPi0GammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
8bdca7f1 2028 }
cc579963 2029 return;
8bdca7f1 2030}
2031//________________________________________________________________________
2032void AliAnalysisTaskGammaConvCalo::ProcessAODMCParticles()
2033{
2034
2035 TClonesArray *AODMCTrackArray = dynamic_cast<TClonesArray*>(fInputEvent->FindListObject(AliAODMCParticle::StdBranchName()));
2036
2037 // Loop over all primary MC particle
2038 for(Int_t i = 0; i < AODMCTrackArray->GetEntriesFast(); i++) {
2039
2040 AliAODMCParticle* particle = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(i));
2041 if (!particle) continue;
2042 if (!particle->IsPrimary()) continue;
2043
2044 Int_t isMCFromMBHeader = -1;
344100c4 2045 if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 0){
2046 isMCFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCStack, fInputEvent);
2047 if(isMCFromMBHeader == 0 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 3) continue;
8bdca7f1 2048 }
2049
344100c4 2050 if(!((AliConversionPhotonCuts*)fCutArray->At(fiCut))->InPlaneOutOfPlaneCut(particle->Phi(),fEventPlaneAngle,kFALSE)) continue;
2051 if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedAODMC(particle,AODMCTrackArray,kFALSE)){
8bdca7f1 2052 fHistoMCAllGammaPt[fiCut]->Fill(particle->Pt()); // All MC Gamma
d404157c 2053 if (abs(particle->Eta()) < 0.66 ){
2054 if (particle->Phi() > 1.39626 && particle->Phi() < 3.125) fHistoMCAllGammaEMCALAccPt[fiCut]->Fill(particle->Pt());
8bdca7f1 2055 }
d404157c 2056 if(particle->GetMother() >-1){ // Meson Decay Gamma
2057 switch((static_cast<AliAODMCParticle*>(AODMCTrackArray->At(particle->GetMother())))->GetPdgCode()){
2058 case 111: // Pi0
2059 fHistoMCDecayGammaPi0Pt[fiCut]->Fill(particle->Pt());
2060 break;
2061 case 113: // Rho0
2062 fHistoMCDecayGammaRhoPt[fiCut]->Fill(particle->Pt());
2063 break;
2064 case 221: // Eta
2065 fHistoMCDecayGammaEtaPt[fiCut]->Fill(particle->Pt());
2066 break;
2067 case 223: // Omega
2068 fHistoMCDecayGammaOmegaPt[fiCut]->Fill(particle->Pt());
2069 break;
2070 case 331: // Eta'
2071 fHistoMCDecayGammaEtapPt[fiCut]->Fill(particle->Pt());
2072 break;
2073 case 333: // Phi
2074 fHistoMCDecayGammaPhiPt[fiCut]->Fill(particle->Pt());
2075 break;
2076 case 3212: // Sigma
2077 fHistoMCDecayGammaSigmaPt[fiCut]->Fill(particle->Pt());
2078 break;
8bdca7f1 2079 }
d404157c 2080 }
2081 }
2082 if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedAODMC(particle,AODMCTrackArray,kTRUE)){
2083 Double_t rConv = 0;
2084 for(Int_t daughterIndex=particle->GetDaughter(0);daughterIndex<=particle->GetDaughter(1);daughterIndex++){
2085 AliAODMCParticle *tmpDaughter = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(daughterIndex));
2086 if(!tmpDaughter) continue;
2087 if(abs(tmpDaughter->GetPdgCode()) == 11){
2088 rConv = sqrt( (tmpDaughter->Xv()*tmpDaughter->Xv()) + (tmpDaughter->Yv()*tmpDaughter->Yv()) );
8bdca7f1 2089 }
2090 }
d404157c 2091 fHistoMCConvGammaPt[fiCut]->Fill(particle->Pt());
2092 if (fDoPhotonQA > 0){
2093 fHistoMCConvGammaR[fiCut]->Fill(rConv);
2094 fHistoMCConvGammaEta[fiCut]->Fill(particle->Eta());
2095 }
2096 }
2097 // Converted MC Gamma
2098 if(fDoMesonAnalysis){
8bdca7f1 2099 if(particle->GetPdgCode() == 310 && fDoMesonQA > 0){
2100 Double_t mesonY = 10.;
2101 if(particle->E() - particle->Pz() == 0 || particle->E() + particle->Pz() == 0){
344100c4 2102 mesonY=10.-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
8bdca7f1 2103 } else {
344100c4 2104 mesonY = 0.5*(TMath::Log((particle->E()+particle->Pz()) / (particle->E()-particle->Pz())))-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
8bdca7f1 2105 }
2106 Float_t weightedK0s= 1;
344100c4 2107 if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCStack, fInputEvent)){
8bdca7f1 2108 if (particle->Pt()>0.005){
344100c4 2109 weightedK0s= ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetWeightForMeson(fV0Reader->GetPeriodName(),i, 0x0, fInputEvent);
8bdca7f1 2110 //cout << "MC input \t"<<i << "\t" << particle->Pt()<<"\t"<<weighted << endl;
2111 }
2112 }
2113 fHistoMCK0sPt[fiCut]->Fill(particle->Pt(),weightedK0s);
2114 fHistoMCK0sWOWeightPt[fiCut]->Fill(particle->Pt());
2115 fHistoMCK0sPtY[fiCut]->Fill(particle->Pt(),mesonY,weightedK0s);
2116 }
2117 if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))
344100c4 2118 ->MesonIsSelectedAODMC(particle,AODMCTrackArray,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift())){
8bdca7f1 2119 AliAODMCParticle* daughter0 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(particle->GetDaughter(0)));
2120 AliAODMCParticle* daughter1 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(particle->GetDaughter(1)));
2121 Float_t weighted= 1;
344100c4 2122 if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCStack, fInputEvent)){
8bdca7f1 2123 if (particle->Pt()>0.005){
344100c4 2124 weighted= ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetWeightForMeson(fV0Reader->GetPeriodName(),i, 0x0, fInputEvent);
8bdca7f1 2125 // if(particle->GetPdgCode() == 221){
2126 // cout << "MC input \t"<<i << "\t" << particle->Pt()<<"\t"<<weighted << endl;
2127 // }
2128 }
2129 }
2130 Double_t mesonY = 10.;
2131 if(particle->E() - particle->Pz() == 0 || particle->E() + particle->Pz() == 0){
344100c4 2132 mesonY=10.-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
8bdca7f1 2133 } else{
344100c4 2134 mesonY = 0.5*(TMath::Log((particle->E()+particle->Pz()) / (particle->E()-particle->Pz())))-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
8bdca7f1 2135 }
2136
de752898 2137 Double_t alpha = -1;
2138 if (particle->GetPdgCode() == 111 || particle->GetPdgCode() == 221){
2139 alpha = TMath::Abs((daughter0->E() - daughter1->E()))/(daughter0->E() + daughter1->E());
2140 }
2141
2142
8bdca7f1 2143 if(particle->GetPdgCode() == 111){
2144 fHistoMCPi0Pt[fiCut]->Fill(particle->Pt(),weighted); // All MC Pi0
2145 fHistoMCPi0WOWeightPt[fiCut]->Fill(particle->Pt());
de752898 2146 if (fDoMesonQA > 0){
2147 fHistoMCPi0PtY[fiCut]->Fill(particle->Pt(),mesonY,weighted); // All MC Pi0
2148 fHistoMCPi0PtAlpha[fiCut]->Fill(particle->Pt(),alpha); // All MC Pi0
2149 }
8bdca7f1 2150 } else if(particle->GetPdgCode() == 221){
2151 fHistoMCEtaPt[fiCut]->Fill(particle->Pt(),weighted); // All MC Eta
2152 fHistoMCEtaWOWeightPt[fiCut]->Fill(particle->Pt());
de752898 2153 if (fDoMesonQA > 0){
2154 fHistoMCEtaPtY[fiCut]->Fill(particle->Pt(),mesonY,weighted); // All MC Pi0
2155 fHistoMCEtaPtAlpha[fiCut]->Fill(particle->Pt(),alpha); // All MC Pi0
2156 }
8bdca7f1 2157 }
2158
2159 // Check the acceptance for both gammas
344100c4 2160 if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedAODMC(daughter0,AODMCTrackArray,kFALSE) &&
2161 ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedAODMC(daughter1,AODMCTrackArray,kFALSE) &&
2162 ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->InPlaneOutOfPlaneCut(daughter0->Phi(),fEventPlaneAngle,kFALSE) &&
2163 ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->InPlaneOutOfPlaneCut(daughter1->Phi(),fEventPlaneAngle,kFALSE)){
8bdca7f1 2164
2165 if(particle->GetPdgCode() == 111){
2166 fHistoMCPi0InAccPt[fiCut]->Fill(particle->Pt(),weighted); // MC Pi0 with gamma in acc
2167 } else if(particle->GetPdgCode() == 221){
2168 fHistoMCEtaInAccPt[fiCut]->Fill(particle->Pt(),weighted); // MC Eta with gamma in acc
2169 }
2170 }
2171 }
2172 }
2173 }
2174
2175}
2176//________________________________________________________________________
2177void AliAnalysisTaskGammaConvCalo::ProcessMCParticles()
2178{
2179 // Loop over all primary MC particle
2180 for(Int_t i = 0; i < fMCStack->GetNprimary(); i++) {
2181 TParticle* particle = (TParticle *)fMCStack->Particle(i);
2182 if (!particle) continue;
2183
2184 Int_t isMCFromMBHeader = -1;
344100c4 2185 if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 0){
2186 isMCFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCStack, fInputEvent);
2187 if(isMCFromMBHeader == 0 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 3) continue;
8bdca7f1 2188 }
2189
344100c4 2190 if(!((AliConversionPhotonCuts*)fCutArray->At(fiCut))->InPlaneOutOfPlaneCut(particle->Phi(),fEventPlaneAngle,kFALSE)) continue;
2191 if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedMC(particle,fMCStack,kFALSE)){
8bdca7f1 2192 fHistoMCAllGammaPt[fiCut]->Fill(particle->Pt()); // All MC Gamma
20af4b69 2193 if (abs(particle->Eta()) < 0.66 ){
2194 if (particle->Phi() > 1.39626 && particle->Phi() < 3.125) fHistoMCAllGammaEMCALAccPt[fiCut]->Fill(particle->Pt());
2195 }
2196
8bdca7f1 2197 if(particle->GetMother(0) >-1){ // Meson Decay Gamma
2198 switch(fMCStack->Particle(particle->GetMother(0))->GetPdgCode()){
2199 case 111: // Pi0
2200 fHistoMCDecayGammaPi0Pt[fiCut]->Fill(particle->Pt());
2201 break;
2202 case 113: // Rho0
2203 fHistoMCDecayGammaRhoPt[fiCut]->Fill(particle->Pt());
2204 break;
2205 case 221: // Eta
2206 fHistoMCDecayGammaEtaPt[fiCut]->Fill(particle->Pt());
2207 break;
2208 case 223: // Omega
2209 fHistoMCDecayGammaOmegaPt[fiCut]->Fill(particle->Pt());
2210 break;
2211 case 331: // Eta'
2212 fHistoMCDecayGammaEtapPt[fiCut]->Fill(particle->Pt());
2213 break;
2214 case 333: // Phi
2215 fHistoMCDecayGammaPhiPt[fiCut]->Fill(particle->Pt());
2216 break;
2217 case 3212: // Sigma
2218 fHistoMCDecayGammaSigmaPt[fiCut]->Fill(particle->Pt());
2219 break;
2220 }
2221 }
2222 }
344100c4 2223 if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedMC(particle,fMCStack,kTRUE)){
8bdca7f1 2224 fHistoMCConvGammaPt[fiCut]->Fill(particle->Pt());
2225 if (fDoPhotonQA > 0){
2226 fHistoMCConvGammaR[fiCut]->Fill(((TParticle*)fMCStack->Particle(particle->GetFirstDaughter()))->R());
2227 fHistoMCConvGammaEta[fiCut]->Fill(particle->Eta());
2228 }
2229 } // Converted MC Gamma
2230 if(fDoMesonAnalysis){
2231 if(particle->GetPdgCode() == 310 && fDoMesonQA > 0){
2232 Double_t mesonY = 10.;
2233 if(particle->Energy() - particle->Pz() == 0 || particle->Energy() + particle->Pz() == 0){
344100c4 2234 mesonY=10.-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
8bdca7f1 2235 } else{
344100c4 2236 mesonY = 0.5*(TMath::Log((particle->Energy()+particle->Pz()) / (particle->Energy()-particle->Pz())))-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
8bdca7f1 2237 }
2238 Float_t weightedK0s= 1;
344100c4 2239 if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCStack, fInputEvent)){
8bdca7f1 2240 if (particle->Pt()>0.005){
344100c4 2241 weightedK0s= ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetWeightForMeson(fV0Reader->GetPeriodName(),i, fMCStack, fInputEvent);
8bdca7f1 2242 //cout << "MC input \t"<<i << "\t" << particle->Pt()<<"\t"<<weighted << endl;
2243 }
2244 }
2245 if (fMCStack->IsPhysicalPrimary(i)){
2246 fHistoMCK0sPt[fiCut]->Fill(particle->Pt(),weightedK0s);
2247 fHistoMCK0sWOWeightPt[fiCut]->Fill(particle->Pt());
2248 fHistoMCK0sPtY[fiCut]->Fill(particle->Pt(),mesonY,weightedK0s);
2249 }
2250 }
2251 if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))
344100c4 2252 ->MesonIsSelectedMC(particle,fMCStack,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift())){
8bdca7f1 2253 TParticle* daughter0 = (TParticle*)fMCStack->Particle(particle->GetFirstDaughter());
2254 TParticle* daughter1 = (TParticle*)fMCStack->Particle(particle->GetLastDaughter());
2255
2256 Float_t weighted= 1;
344100c4 2257 if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCStack, fInputEvent)){
8bdca7f1 2258 if (particle->Pt()>0.005){
344100c4 2259 weighted= ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetWeightForMeson(fV0Reader->GetPeriodName(),i, fMCStack, fInputEvent);
8bdca7f1 2260 // if(particle->GetPdgCode() == 221){
2261 // cout << "MC input \t"<<i << "\t" << particle->Pt()<<"\t"<<weighted << endl;
2262 // }
2263 }
2264 }
2265 Double_t mesonY = 10.;
2266 if(particle->Energy() - particle->Pz() == 0 || particle->Energy() + particle->Pz() == 0){
344100c4 2267 mesonY=10.-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
8bdca7f1 2268 } else{
344100c4 2269 mesonY = 0.5*(TMath::Log((particle->Energy()+particle->Pz()) / (particle->Energy()-particle->Pz())))-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
8bdca7f1 2270 }
de752898 2271
2272 Double_t alpha = -1;
2273 if (particle->GetPdgCode() == 111 || particle->GetPdgCode() == 221){
2274 alpha = TMath::Abs((daughter0->Energy() - daughter1->Energy()))/(daughter0->Energy() + daughter1->Energy());
2275 }
2276
8bdca7f1 2277 if(particle->GetPdgCode() == 111){
2278 fHistoMCPi0Pt[fiCut]->Fill(particle->Pt(),weighted); // All MC Pi0
2279 fHistoMCPi0WOWeightPt[fiCut]->Fill(particle->Pt());
de752898 2280 if (fDoMesonQA > 0){
2281 fHistoMCPi0PtY[fiCut]->Fill(particle->Pt(),mesonY,weighted); // All MC Pi0
2282 fHistoMCPi0PtAlpha[fiCut]->Fill(particle->Pt(),alpha); // All MC Pi0
2283 }
8bdca7f1 2284 } else if(particle->GetPdgCode() == 221){
2285 fHistoMCEtaPt[fiCut]->Fill(particle->Pt(),weighted); // All MC Eta
2286 fHistoMCEtaWOWeightPt[fiCut]->Fill(particle->Pt());
de752898 2287 if (fDoMesonQA > 0){
2288 fHistoMCEtaPtY[fiCut]->Fill(particle->Pt(),mesonY,weighted); // All MC Pi0
2289 fHistoMCEtaPtAlpha[fiCut]->Fill(particle->Pt(),alpha); // All MC Pi0
2290 }
8bdca7f1 2291 }
2292
2293 // Check the acceptance for both gammas
344100c4 2294 if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedMC(daughter0,fMCStack,kFALSE) &&
2295 ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedMC(daughter1,fMCStack,kFALSE) &&
2296 ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->InPlaneOutOfPlaneCut(daughter0->Phi(),fEventPlaneAngle,kFALSE) &&
2297 ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->InPlaneOutOfPlaneCut(daughter1->Phi(),fEventPlaneAngle,kFALSE)){
8bdca7f1 2298
2299 if(particle->GetPdgCode() == 111){
2300 fHistoMCPi0InAccPt[fiCut]->Fill(particle->Pt(),weighted); // MC Pi0 with gamma in acc
2301 } else if(particle->GetPdgCode() == 221){
2302 fHistoMCEtaInAccPt[fiCut]->Fill(particle->Pt(),weighted); // MC Eta with gamma in acc
2303 }
2304 }
2305 }
2306 }
2307 }
2308
2309 if (fDoMesonQA){
2310 for(Int_t i = fMCStack->GetNprimary(); i < fMCStack->GetNtrack(); i++) {
2311 TParticle* particle = (TParticle *)fMCStack->Particle(i);
2312 if (!particle) continue;
2313
2314 Int_t isMCFromMBHeader = -1;
344100c4 2315 if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 0){
2316 isMCFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCStack, fInputEvent);
2317 if(isMCFromMBHeader == 0 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 3) continue;
8bdca7f1 2318 }
2319
2320 if(fDoMesonAnalysis){
344100c4 2321 if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->MesonIsSelectedMC(particle,fMCStack,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift())){
8bdca7f1 2322 Float_t weighted= 1;
344100c4 2323 if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCStack, fInputEvent)){
8bdca7f1 2324 if (particle->Pt()>0.005){
344100c4 2325 weighted= ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetWeightForMeson(fV0Reader->GetPeriodName(),i, fMCStack, fInputEvent);
8bdca7f1 2326 // if(particle->GetPdgCode() == 221){
2327 // cout << "MC input \t"<<i << "\t" << particle->Pt()<<"\t"<<weighted << endl;
2328 // }
2329 }
2330 }
2331
2332 if(particle->GetPdgCode() == 111){
2333 Int_t pdgCode = ((TParticle*)fMCStack->Particle( particle->GetFirstMother() ))->GetPdgCode();
2334 Int_t source = GetSourceClassification(111,pdgCode);
2335 fHistoMCSecPi0PtvsSource[fiCut]->Fill(particle->Pt(),source,weighted); // All MC Pi0
2336 fHistoMCSecPi0Source[fiCut]->Fill(pdgCode);
2337 } else if(particle->GetPdgCode() == 221){
2338 Int_t pdgCode = ((TParticle*)fMCStack->Particle( particle->GetFirstMother() ))->GetPdgCode();
2339 fHistoMCSecEtaPt[fiCut]->Fill(particle->Pt(),weighted); // All MC Pi0
2340 fHistoMCSecEtaSource[fiCut]->Fill(pdgCode);
2341 }
2342 }
2343 }
2344 }
2345 }
2346}
2347
2348//________________________________________________________________________
2349void AliAnalysisTaskGammaConvCalo::PhotonTagging(){
2350
2351 // Conversion Gammas
2352 if(fGammaCandidates->GetEntries()>0){
2353
2354 for(Int_t firstGammaIndex=0;firstGammaIndex<fGammaCandidates->GetEntries()-1;firstGammaIndex++){
2355
2356 // get conversion photon
2357 AliAODConversionPhoton *gamma0=dynamic_cast<AliAODConversionPhoton*>(fGammaCandidates->At(firstGammaIndex));
2358 if (gamma0==NULL) continue;
2359
2360 TLorentzVector photonVector;
2361 photonVector.SetPxPyPzE(gamma0->GetPx(),gamma0->GetPy(),gamma0->GetPz(),gamma0->GetPhotonP());
2362
2363 Bool_t btagpi0 = 0;
2364 Bool_t btageta = 0;
2365
2366 // loop over clusters
2367 for(Int_t secondGammaIndex = 0; secondGammaIndex<fClusterCandidates->GetEntries(); ++secondGammaIndex) {
2368
2369 AliAODConversionPhoton *gamma1=dynamic_cast<AliAODConversionPhoton*>(fClusterCandidates->At(secondGammaIndex));
2370 if (gamma1==NULL) continue;
2371
2372 TLorentzVector clusterVector;
2373 clusterVector.SetPxPyPzE(gamma1->GetPx(),gamma1->GetPy(),gamma1->GetPz(),gamma1->GetPhotonP());
2374
2375 // do the tagging
2376 TLorentzVector pairVector = photonVector+clusterVector;
2377
2378 // see if pi0?
2379 if((pairVector.M() > 0.11 && pairVector.M() < 0.15)){
344100c4 2380 btagpi0 = 1;
8bdca7f1 2381 }
2382 // or eta
2383 if((pairVector.M() > 0.50 && pairVector.M() < 0.6)){
344100c4 2384 btageta = 1;
8bdca7f1 2385 }
2386 }// end loop over clusters
2387
2388 if(btagpi0 && btageta)
2389 fHistoConvGammaTagged[fiCut]->Fill(photonVector.Pt());
2390 else if(btagpi0 && !btageta)
2391 fHistoConvGammaPi0Tagged[fiCut]->Fill(photonVector.Pt());
2392 else if(btageta && !btagpi0)
2393 fHistoConvGammaEtaTagged[fiCut]->Fill(photonVector.Pt());
2394 else
2395 fHistoConvGammaUntagged[fiCut]->Fill(photonVector.Pt());
2396
2397 }// end loop over gammas
2398 }// end if
2399 return;
2400}
2401
2402//________________________________________________________________________
2403void AliAnalysisTaskGammaConvCalo::CalculatePi0Candidates(){
2404
2405 // Conversion Gammas
2406 if(fGammaCandidates->GetEntries()>0){
2407
2408 // vertex
2409 Double_t vertex[3] = {0};
2410 InputEvent()->GetPrimaryVertex()->GetXYZ(vertex);
2411
2412 for(Int_t firstGammaIndex=0;firstGammaIndex<fGammaCandidates->GetEntries();firstGammaIndex++){
2413 AliAODConversionPhoton *gamma0=dynamic_cast<AliAODConversionPhoton*>(fGammaCandidates->At(firstGammaIndex));
2414 if (gamma0==NULL) continue;
2415
2416 for(Int_t secondGammaIndex=0;secondGammaIndex<fClusterCandidates->GetEntries();secondGammaIndex++){
d53bf4ac 2417 Bool_t matched = kFALSE;
8bdca7f1 2418 AliAODConversionPhoton *gamma1=dynamic_cast<AliAODConversionPhoton*>(fClusterCandidates->At(secondGammaIndex));
2419 if (gamma1==NULL) continue;
2420
d53bf4ac 2421 if (gamma1->GetIsCaloPhoton()){
2422 AliVCluster* cluster = fInputEvent->GetCaloCluster(gamma1->GetCaloClusterRef());
2423 matched = ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->MatchConvPhotonToCluster(gamma0,cluster, fInputEvent );
2424 }
2425
8bdca7f1 2426 AliAODConversionMother *pi0cand = new AliAODConversionMother(gamma0,gamma1);
2427 pi0cand->SetLabels(firstGammaIndex,secondGammaIndex);
2428
d53bf4ac 2429
2430
344100c4 2431 if((((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->MesonIsSelected(pi0cand,kTRUE,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift()))){
d53bf4ac 2432 if (matched){
2433 fHistoMotherMatchedInvMassPt[fiCut]->Fill(pi0cand->M(),pi0cand->Pt());
2434 } else {
2435 fHistoMotherInvMassPt[fiCut]->Fill(pi0cand->M(),pi0cand->Pt());
2436 }
8bdca7f1 2437 // fill new histograms
d53bf4ac 2438 if (!matched){
2439 fHistoPhotonPairAll[fiCut]->Fill(pi0cand->M(),pi0cand->Pt());
2440 fHistoPhotonPairAllGam[fiCut]->Fill(pi0cand->M(),gamma0->Pt());
8bdca7f1 2441
d53bf4ac 2442 if(pi0cand->GetAlpha()<0.1)
2443 fHistoMotherInvMassEalpha[fiCut]->Fill(pi0cand->M(),pi0cand->E());
2444
2445 if (fDoMesonQA > 0){
2446 if ( pi0cand->M() > 0.05 && pi0cand->M() < 0.17){
2447 fHistoMotherPi0PtY[fiCut]->Fill(pi0cand->Pt(),pi0cand->Rapidity()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift());
2448 fHistoMotherPi0PtAlpha[fiCut]->Fill(pi0cand->Pt(),pi0cand->GetAlpha());
4e8dcc76 2449 fHistoMotherPi0PtOpenAngle[fiCut]->Fill(pi0cand->Pt(),pi0cand->GetOpeningAngle());
2450 fHistoMotherPi0ConvPhotonEtaPhi[fiCut]->Fill(gamma0->GetPhotonPhi(), gamma0->GetPhotonEta());
8bdca7f1 2451 }
d53bf4ac 2452 if ( pi0cand->M() > 0.45 && pi0cand->M() < 0.65){
2453 fHistoMotherEtaPtY[fiCut]->Fill(pi0cand->Pt(),pi0cand->Rapidity()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift());
2454 fHistoMotherEtaPtAlpha[fiCut]->Fill(pi0cand->Pt(),pi0cand->GetAlpha());
2455 fHistoMotherEtaPtOpenAngle[fiCut]->Fill(pi0cand->Pt(),pi0cand->GetOpeningAngle());
4e8dcc76 2456 fHistoMotherEtaConvPhotonEtaPhi[fiCut]->Fill(gamma0->GetPhotonPhi(), gamma0->GetPhotonEta());
d53bf4ac 2457 }
2458 }
2459 if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->DoBGCalculation()){
2460 Int_t zbin = 0;
2461 Int_t mbin = 0;
2462
2463 if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->BackgroundHandlerType() == 0){
2464 zbin = fBGHandler[fiCut]->GetZBinIndex(fInputEvent->GetPrimaryVertex()->GetZ());
2465 if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->UseTrackMultiplicity()){
2466 mbin = fBGHandler[fiCut]->GetMultiplicityBinIndex(fV0Reader->GetNumberOfPrimaryTracks());
2467 } else {
2468 mbin = fBGHandler[fiCut]->GetMultiplicityBinIndex(fGammaCandidates->GetEntries());
2469 }
2470 } else{
2471 zbin = fBGHandlerRP[fiCut]->GetZBinIndex(fInputEvent->GetPrimaryVertex()->GetZ());
2472 if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->UseTrackMultiplicity()){
2473 mbin = fBGHandlerRP[fiCut]->GetMultiplicityBinIndex(fV0Reader->GetNumberOfPrimaryTracks());
2474 } else {
2475 mbin = fBGHandlerRP[fiCut]->GetMultiplicityBinIndex(fGammaCandidates->GetEntries());
2476 }
8bdca7f1 2477 }
d53bf4ac 2478 Double_t sparesFill[4] = {pi0cand->M(),pi0cand->Pt(),(Double_t)zbin,(Double_t)mbin};
2479 fSparseMotherInvMassPtZM[fiCut]->Fill(sparesFill,1);
8bdca7f1 2480 }
8bdca7f1 2481 }
2482
8bdca7f1 2483 if(fIsMC){
2484 if(fInputEvent->IsA()==AliESDEvent::Class())
d53bf4ac 2485 ProcessTrueMesonCandidates(pi0cand,gamma0,gamma1, matched);
8bdca7f1 2486 if(fInputEvent->IsA()==AliAODEvent::Class())
d53bf4ac 2487 ProcessTrueMesonCandidatesAOD(pi0cand,gamma0,gamma1, matched);
8bdca7f1 2488 }
d53bf4ac 2489 if (!matched){
2490 if (fDoMesonQA == 2){
2491 fInvMass = pi0cand->M();
2492 fPt = pi0cand->Pt();
2493 if (abs(gamma0->GetDCAzToPrimVtx()) < abs(gamma1->GetDCAzToPrimVtx())){
2494 fDCAzGammaMin = gamma0->GetDCAzToPrimVtx();
2495 fDCAzGammaMax = gamma1->GetDCAzToPrimVtx();
2496 } else {
2497 fDCAzGammaMin = gamma1->GetDCAzToPrimVtx();
2498 fDCAzGammaMax = gamma0->GetDCAzToPrimVtx();
2499 }
2500 fCharFlag = pi0cand->GetMesonQuality();
2501 // cout << "gamma 0: " << gamma0->GetV0Index()<< "\t" << gamma0->GetPx() << "\t" << gamma0->GetPy() << "\t" << gamma0->GetPz() << "\t" << endl;
2502 // cout << "gamma 1: " << gamma1->GetV0Index()<< "\t"<< gamma1->GetPx() << "\t" << gamma1->GetPy() << "\t" << gamma1->GetPz() << "\t" << endl;
2503 // cout << "pi0: "<<fInvMass << "\t" << fPt <<"\t" << fDCAzGammaMin << "\t" << fDCAzGammaMax << "\t" << (Int_t)fCharFlag << "\t" << (Int_t)fCharMesonMCInfo <<endl;
2504 if (fIsHeavyIon == 1 && fPt > 0.399 && fPt < 20. ) {
2505 if (fInvMass > 0.08 && fInvMass < 0.2) fTreeMesonsInvMassPtDcazMinDcazMaxFlag[fiCut]->Fill();
2506 if ((fInvMass > 0.45 && fInvMass < 0.6) && (fPt > 0.999 && fPt < 20.) )fTreeMesonsInvMassPtDcazMinDcazMaxFlag[fiCut]->Fill();
2507 } else if (fPt > 0.299 && fPt < 20. ) {
2508 if ( (fInvMass > 0.08 && fInvMass < 0.2) || (fInvMass > 0.45 && fInvMass < 0.6)) fTreeMesonsInvMassPtDcazMinDcazMaxFlag[fiCut]->Fill();
2509 }
8bdca7f1 2510 }
d53bf4ac 2511 if (fDoMesonQA == 1){
2512 fHistoMotherInvMassECalib[fiCut]->Fill(pi0cand->M(),gamma1->E());
2513 if(pi0cand->GetAlpha()<0.1)
2514 fHistoMotherInvMassECalibalpha[fiCut]->Fill(pi0cand->M(),gamma1->E());
8bdca7f1 2515 }
2516 }
2517 }
2518 delete pi0cand;
2519 pi0cand=0x0;
2520 }
2521 }
2522 }
2523}
2524//______________________________________________________________________
d53bf4ac 2525void AliAnalysisTaskGammaConvCalo::ProcessTrueMesonCandidates(AliAODConversionMother *Pi0Candidate, AliAODConversionPhoton *TrueGammaCandidate0, AliAODConversionPhoton *TrueGammaCandidate1, Bool_t matched)
8bdca7f1 2526{
2527 // Process True Mesons
2528 AliStack *MCStack = fMCEvent->Stack();
2529 fCharMesonMCInfo = 0;
2530 if(TrueGammaCandidate0->GetV0Index()<fInputEvent->GetNumberOfV0s()){
2531 Bool_t isTruePi0 = kFALSE;
2532 Bool_t isTrueEta = kFALSE;
8bdca7f1 2533 Int_t gamma0MCLabel = TrueGammaCandidate0->GetMCParticleLabel(MCStack);
2534 Int_t gamma0MotherLabel = -1;
2535 if(gamma0MCLabel != -1){ // Gamma is Combinatorial; MC Particles don't belong to the same Mother
fd94f234 2536 // Daughters Gamma 0
2537 TParticle * negativeMC = (TParticle*)TrueGammaCandidate0->GetNegativeMCDaughter(MCStack);
2538 TParticle * positiveMC = (TParticle*)TrueGammaCandidate0->GetPositiveMCDaughter(MCStack);
2539 TParticle * gammaMC0 = (TParticle*)MCStack->Particle(gamma0MCLabel);
2540 if(abs(negativeMC->GetPdgCode())==11 && abs(positiveMC->GetPdgCode())==11){ // Electrons ...
2541 if(negativeMC->GetUniqueID() == 5 && positiveMC->GetUniqueID() ==5){ // ... From Conversion ...
2542 if(gammaMC0->GetPdgCode() == 22){ // ... with Gamma Mother
2543 gamma0MotherLabel=gammaMC0->GetFirstMother();
2544 }
8bdca7f1 2545 }
2546 }
fd94f234 2547 }
2548 if (!TrueGammaCandidate1->GetIsCaloPhoton()) AliFatal("CaloPhotonFlag has not been set. Aborting");
2549
2550 Int_t gamma1MCLabel = TrueGammaCandidate1->GetCaloPhotonMCLabel(0); // get most probable MC label
2551 Int_t gamma1MotherLabel = -1;
2552 // check if
2553
2554 if(gamma1MCLabel != -1){ // Gamma is Combinatorial; MC Particles don't belong to the same Mother
2555 // Daughters Gamma 1
2556 TParticle * gammaMC1 = (TParticle*)MCStack->Particle(gamma1MCLabel);
2557 if (TrueGammaCandidate1->IsLargestComponentPhoton() || TrueGammaCandidate1->IsLargestComponentElectron()){ // largest component is electro magnetic
2558 // get mother of interest (pi0 or eta)
2559 if (TrueGammaCandidate1->IsLargestComponentPhoton()){ // for photons its the direct mother
2560 gamma1MotherLabel=gammaMC1->GetMother(0);
2561 } else if (TrueGammaCandidate1->IsLargestComponentElectron()){ // for electrons its either the direct mother or for conversions the grandmother
2562 if (TrueGammaCandidate1->IsConversion()) gamma1MotherLabel=MCStack->Particle(gammaMC1->GetMother(0))->GetMother(0);
2563 else gamma1MotherLabel=gammaMC1->GetMother(0);
2564 }
2565 } else {
2566 if (fDoMesonQA > 0) fHistoTrueMotherCaloEMNonLeadingInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2567 }
2568 }
2569
2570 if(gamma0MotherLabel>=0 && gamma0MotherLabel==gamma1MotherLabel){
2571 if(((TParticle*)MCStack->Particle(gamma1MotherLabel))->GetPdgCode() == 111){
2572 isTruePi0=kTRUE;
8bdca7f1 2573 }
fd94f234 2574 if(((TParticle*)MCStack->Particle(gamma1MotherLabel))->GetPdgCode() == 221){
2575 isTrueEta=kTRUE;
8bdca7f1 2576 }
2577 }
fd94f234 2578
2579 if(isTruePi0 || isTrueEta){// True Pion or Eta
ed8bc1ca 2580 if (!matched){
2581 if (isTruePi0)fHistoTruePi0InvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2582 if (isTrueEta)fHistoTrueEtaInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2583 }
fd94f234 2584 if (fDoMesonQA > 0){
ed8bc1ca 2585 if (TrueGammaCandidate1->IsLargestComponentPhoton() && !matched){
2586 if(isTruePi0) fHistoTruePi0CaloPhotonInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2587 if(isTrueEta) fHistoTrueEtaCaloPhotonInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2588 }
2589 if (TrueGammaCandidate1->IsLargestComponentElectron() && !matched){
2590 if(isTruePi0) fHistoTruePi0CaloElectronInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2591 if(isTrueEta) fHistoTrueEtaCaloElectronInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2592 }
d53bf4ac 2593 if (TrueGammaCandidate1->IsLargestComponentElectron() && TrueGammaCandidate1->IsConversion() ){
d53bf4ac 2594 if (isTruePi0 && !matched)fHistoTruePi0CaloConvertedPhotonInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2595 if (isTrueEta && !matched)fHistoTrueEtaCaloConvertedPhotonInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2596 if ((TrueGammaCandidate0->GetMCLabelPositive() == gamma1MCLabel || TrueGammaCandidate0->GetMCLabelNegative() == gamma1MCLabel) && isTruePi0){
20af4b69 2597 fHistoTruePi0CaloConvertedPhotonMatchedInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
d53bf4ac 2598 }
2599 if ((TrueGammaCandidate0->GetMCLabelPositive() == gamma1MCLabel || TrueGammaCandidate0->GetMCLabelNegative() == gamma1MCLabel) && isTrueEta){
20af4b69 2600 fHistoTrueEtaCaloConvertedPhotonMatchedInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
d53bf4ac 2601 }
20af4b69 2602 }
ed8bc1ca 2603 if ((TrueGammaCandidate1->IsMerged() || TrueGammaCandidate1->IsMergedPartConv() || TrueGammaCandidate1->IsDalitzMerged()) && !matched ){
2604 if (isTruePi0 )fHistoTruePi0CaloMergedClusterInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2605 if (isTrueEta )fHistoTrueEtaCaloMergedClusterInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2606 }
2607 if (TrueGammaCandidate1->IsMergedPartConv() && !matched){
2608 if (isTruePi0) fHistoTruePi0CaloMergedClusterPartConvInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2609 if (isTrueEta) fHistoTrueEtaCaloMergedClusterPartConvInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2610 }
fd94f234 2611 }
d53bf4ac 2612 if (!matched){
2613 if (fDoMesonQA > 0){
2614 if (isTruePi0){
2615 if ( Pi0Candidate->M() > 0.05 && Pi0Candidate->M() < 0.17){
2616 fHistoTruePi0PtY[fiCut]->Fill(Pi0Candidate->Pt(),Pi0Candidate->Rapidity()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift());
2617 fHistoTruePi0PtAlpha[fiCut]->Fill(Pi0Candidate->Pt(),Pi0Candidate->GetAlpha());
2618 fHistoTruePi0PtOpenAngle[fiCut]->Fill(Pi0Candidate->Pt(),Pi0Candidate->GetOpeningAngle());
2619 }
2620 } else if (isTrueEta){
2621 if ( Pi0Candidate->M() > 0.45 && Pi0Candidate->M() < 0.65){
2622 fHistoTrueEtaPtY[fiCut]->Fill(Pi0Candidate->Pt(),Pi0Candidate->Rapidity()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift());
2623 fHistoTrueEtaPtAlpha[fiCut]->Fill(Pi0Candidate->Pt(),Pi0Candidate->GetAlpha());
2624 fHistoTrueEtaPtOpenAngle[fiCut]->Fill(Pi0Candidate->Pt(),Pi0Candidate->GetOpeningAngle());
2625 }
8bdca7f1 2626 }
2627 }
d53bf4ac 2628
2629 if(gamma0MotherLabel >= MCStack->GetNprimary()){ // Secondary Meson
2630 Int_t secMotherLabel = ((TParticle*)MCStack->Particle(gamma0MotherLabel))->GetMother(0);
2631 Float_t weightedSec= 1;
2632 if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(secMotherLabel, fMCStack, fInputEvent) && MCStack->Particle(secMotherLabel)->GetPdgCode()==310){
2633 weightedSec= ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetWeightForMeson(fV0Reader->GetPeriodName(),secMotherLabel, fMCStack, fInputEvent)/2.; //invariant mass is additive thus the weight for the daughters has to be devide by two for the K0s at a certain pt
2634 //cout << "MC input \t"<<i << "\t" << particle->Pt()<<"\t"<<weighted << endl;
8bdca7f1 2635 }
ed8bc1ca 2636 if (isTruePi0) fHistoTrueSecondaryPi0InvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weightedSec);
2637 if (isTrueEta) fHistoTrueSecondaryEtaInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weightedSec);
d53bf4ac 2638 fCharMesonMCInfo = 2;
2639 if (secMotherLabel >-1){
ed8bc1ca 2640 if(MCStack->Particle(secMotherLabel)->GetPdgCode()==310 && isTruePi0 ){
d53bf4ac 2641 fCharMesonMCInfo = 4;
ed8bc1ca 2642 fHistoTrueSecondaryPi0FromK0sInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weightedSec);
d53bf4ac 2643 if (fDoMesonQA > 0)fHistoTrueK0sWithPi0DaughterMCPt[fiCut]->Fill(MCStack->Particle(secMotherLabel)->Pt());
2644 }
ed8bc1ca 2645 if(MCStack->Particle(secMotherLabel)->GetPdgCode()==221 && isTruePi0){
d53bf4ac 2646 fCharMesonMCInfo = 3;
ed8bc1ca 2647 fHistoTrueSecondaryPi0FromEtaInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weightedSec);
d53bf4ac 2648 if (fDoMesonQA > 0)fHistoTrueEtaWithPi0DaughterMCPt[fiCut]->Fill(MCStack->Particle(secMotherLabel)->Pt());
2649 }
ed8bc1ca 2650 if(MCStack->Particle(secMotherLabel)->GetPdgCode()==3122 && isTruePi0){
d53bf4ac 2651 fCharMesonMCInfo = 7;
ed8bc1ca 2652 fHistoTrueSecondaryPi0FromLambdaInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weightedSec);
d53bf4ac 2653 if (fDoMesonQA > 0)fHistoTrueLambdaWithPi0DaughterMCPt[fiCut]->Fill(MCStack->Particle(secMotherLabel)->Pt());
2654 }
8bdca7f1 2655 }
d53bf4ac 2656 } else { // Only primary pi0 for efficiency calculation
2657 fCharMesonMCInfo = 6;
2658 Float_t weighted= 1;
2659 if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(gamma1MotherLabel, fMCStack, fInputEvent)){
2660 if (((TParticle*)MCStack->Particle(gamma1MotherLabel))->Pt()>0.005){
2661 weighted= ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetWeightForMeson(fV0Reader->GetPeriodName(),gamma1MotherLabel, fMCStack, fInputEvent);
2662 // cout << "rec \t " <<gamma1MotherLabel << "\t" << weighted << endl;
2663 }
fd94f234 2664 }
ed8bc1ca 2665 if (isTruePi0){
2666 fHistoTruePrimaryPi0InvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weighted);
2667 fHistoTruePrimaryPi0W0WeightingInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2668 fProfileTruePrimaryPi0WeightsInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weighted);
2669 } else if (isTrueEta) {
2670 fHistoTruePrimaryEtaInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weighted);
2671 fHistoTruePrimaryEtaW0WeightingInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2672 fProfileTruePrimaryEtaWeightsInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weighted);
2673 }
d53bf4ac 2674
2675 if (fDoMesonQA > 0){
2676 if(isTruePi0){ // Only primary pi0 for resolution
2677 fHistoTruePrimaryPi0MCPtResolPt[fiCut]->Fill(((TParticle*)MCStack->Particle(gamma1MotherLabel))->Pt(),(Pi0Candidate->Pt()-((TParticle*)MCStack->Particle(gamma1MotherLabel))->Pt())/((TParticle*)MCStack->Particle(gamma1MotherLabel))->Pt(),weighted);
2678 }
2679 if (isTrueEta){ // Only primary eta for resolution
2680 fHistoTruePrimaryEtaMCPtResolPt[fiCut]->Fill(((TParticle*)MCStack->Particle(gamma1MotherLabel))->Pt(),(Pi0Candidate->Pt()-((TParticle*)MCStack->Particle(gamma1MotherLabel))->Pt())/((TParticle*)MCStack->Particle(gamma1MotherLabel))->Pt(),weighted);
2681 }
8bdca7f1 2682 }
2683 }
d53bf4ac 2684 }
fd94f234 2685 } else if(!isTruePi0 && !isTrueEta){ // Background
2686 if (fDoMesonQA > 0){
2687 if(gamma0MotherLabel>-1 && gamma1MotherLabel>-1){ // Both Tracks are Photons and have a mother but not Pi0 or Eta
2688 fHistoTrueBckGGInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2689 fCharMesonMCInfo = 1;
2690 } else { // No photon or without mother
2691 fHistoTrueBckContInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
8bdca7f1 2692 }
2693 }
2694 }
2695 }
2696}
2697//______________________________________________________________________
d53bf4ac 2698void AliAnalysisTaskGammaConvCalo::ProcessTrueMesonCandidatesAOD(AliAODConversionMother *Pi0Candidate, AliAODConversionPhoton *TrueGammaCandidate0, AliAODConversionPhoton *TrueGammaCandidate1, Bool_t matched)
8bdca7f1 2699{
2700
2701 // Process True Mesons
2702 TClonesArray *AODMCTrackArray = dynamic_cast<TClonesArray*>(fInputEvent->FindListObject(AliAODMCParticle::StdBranchName()));
2703 Bool_t isTruePi0 = kFALSE;
2704 Bool_t isTrueEta = kFALSE;
8bdca7f1 2705
2706 AliAODMCParticle *positiveMC = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(TrueGammaCandidate0->GetMCLabelPositive()));
2707 AliAODMCParticle *negativeMC = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(TrueGammaCandidate0->GetMCLabelNegative()));
2708
2709 fCharMesonMCInfo = 0;
2710 Int_t gamma0MCLabel = -1;
2711 Int_t gamma0MotherLabel = -1;
2712 if(!positiveMC||!negativeMC)
2713 return;
2714
2715 if(positiveMC->GetMother()>-1&&(negativeMC->GetMother() == positiveMC->GetMother())){
2716 gamma0MCLabel = positiveMC->GetMother();
2717 }
2718
2719 if(gamma0MCLabel != -1){ // Gamma is Combinatorial; MC Particles don't belong to the same Mother
2720 // Daughters Gamma 0
2721 AliAODMCParticle * gammaMC0 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma0MCLabel));
2722 if(abs(negativeMC->GetPdgCode())==11 && abs(positiveMC->GetPdgCode())==11){ // Electrons ...
2723 if(((positiveMC->GetMCProcessCode())) == 5 && ((negativeMC->GetMCProcessCode())) == 5){ // ... From Conversion ...
2724 if(gammaMC0->GetPdgCode() == 22){ // ... with Gamma Mother
2725 gamma0MotherLabel=gammaMC0->GetMother();
2726 }
2727 }
8bdca7f1 2728 }
fd94f234 2729 }
2730
2731 Int_t gamma1MCLabel = TrueGammaCandidate1->GetCaloPhotonMCLabel(0); // get most probable MC label
8bdca7f1 2732 Int_t gamma1MotherLabel = -1;
fd94f234 2733 // check if
2734
8bdca7f1 2735 if(gamma1MCLabel != -1){ // Gamma is Combinatorial; MC Particles don't belong to the same Mother
2736 // Daughters Gamma 1
2737 AliAODMCParticle * gammaMC1 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma1MCLabel));
fd94f234 2738 if (TrueGammaCandidate1->IsLargestComponentPhoton() || TrueGammaCandidate1->IsLargestComponentElectron()){ // largest component is electro magnetic
2739 // get mother of interest (pi0 or eta)
2740 if (TrueGammaCandidate1->IsLargestComponentPhoton()){ // for photons its the direct mother
8bdca7f1 2741 gamma1MotherLabel=gammaMC1->GetMother();
fd94f234 2742 } else if (TrueGammaCandidate1->IsLargestComponentElectron()){ // for electrons its either the direct mother or for conversions the grandmother
2743 if (TrueGammaCandidate1->IsConversion()){
2744 AliAODMCParticle * gammaGrandMotherMC1 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gammaMC1->GetMother()));
2745 gamma1MotherLabel=gammaGrandMotherMC1->GetMother();
2746 } else gamma1MotherLabel=gammaMC1->GetMother();
8bdca7f1 2747 }
fd94f234 2748 } else {
2749 if (fDoMesonQA > 0) fHistoTrueMotherCaloEMNonLeadingInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2750 }
8bdca7f1 2751 }
fd94f234 2752
8bdca7f1 2753 if(gamma0MotherLabel>=0 && gamma0MotherLabel==gamma1MotherLabel){
fd94f234 2754 if(((AliAODMCParticle*)AODMCTrackArray->At(gamma1MotherLabel))->GetPdgCode() == 111){
8bdca7f1 2755 isTruePi0=kTRUE;
2756 }
fd94f234 2757 if(((AliAODMCParticle*)AODMCTrackArray->At(gamma1MotherLabel))->GetPdgCode() == 221){
8bdca7f1 2758 isTrueEta=kTRUE;
2759 }
2760 }
2761
8bdca7f1 2762 if(isTruePi0 || isTrueEta){// True Pion or Eta
ed8bc1ca 2763 if (!matched){
2764 if (isTruePi0)fHistoTruePi0InvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2765 if (isTrueEta)fHistoTrueEtaInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2766 }
8bdca7f1 2767 if (fDoMesonQA > 0){
ed8bc1ca 2768 if (TrueGammaCandidate1->IsLargestComponentPhoton() && !matched){
2769 if (isTruePi0) fHistoTruePi0CaloPhotonInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2770 if (isTrueEta) fHistoTrueEtaCaloPhotonInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2771 }
2772 if (TrueGammaCandidate1->IsLargestComponentElectron() && !matched) {
2773 if (isTruePi0) fHistoTruePi0CaloElectronInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2774 if (isTrueEta) fHistoTrueEtaCaloElectronInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2775 }
20af4b69 2776 if (TrueGammaCandidate1->IsLargestComponentElectron() && TrueGammaCandidate1->IsConversion()){
d53bf4ac 2777 if (isTruePi0 && !matched)fHistoTruePi0CaloConvertedPhotonInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2778 if (isTrueEta && !matched)fHistoTrueEtaCaloConvertedPhotonInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
20af4b69 2779 if ((TrueGammaCandidate0->GetMCLabelPositive() == gamma1MCLabel || TrueGammaCandidate0->GetMCLabelNegative() == gamma1MCLabel) && isTruePi0)
2780 fHistoTruePi0CaloConvertedPhotonMatchedInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2781 if ((TrueGammaCandidate0->GetMCLabelPositive() == gamma1MCLabel || TrueGammaCandidate0->GetMCLabelNegative() == gamma1MCLabel) && isTrueEta)
2782 fHistoTrueEtaCaloConvertedPhotonMatchedInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2783 }
ed8bc1ca 2784 if ((TrueGammaCandidate1->IsMerged() || TrueGammaCandidate1->IsMergedPartConv() || TrueGammaCandidate1->IsDalitzMerged()) && !matched ){
2785 if (isTruePi0) fHistoTruePi0CaloMergedClusterInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2786 if (isTrueEta) fHistoTrueEtaCaloMergedClusterInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2787 }
2788 if (TrueGammaCandidate1->IsMergedPartConv() && !matched) {
2789 if (isTruePi0) fHistoTruePi0CaloMergedClusterPartConvInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2790 if (isTrueEta) fHistoTrueEtaCaloMergedClusterPartConvInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2791 }
fd94f234 2792 }
2793
d53bf4ac 2794 if ( !matched){
2795 if (fDoMesonQA > 0){
2796 if (isTruePi0){
2797 if ( Pi0Candidate->M() > 0.05 && Pi0Candidate->M() < 0.17){
2798 fHistoTruePi0PtY[fiCut]->Fill(Pi0Candidate->Pt(),Pi0Candidate->Rapidity()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift());
2799 fHistoTruePi0PtAlpha[fiCut]->Fill(Pi0Candidate->Pt(),Pi0Candidate->GetAlpha());
2800 fHistoTruePi0PtOpenAngle[fiCut]->Fill(Pi0Candidate->Pt(),Pi0Candidate->GetOpeningAngle());
2801 }
2802 } else if (isTrueEta){
2803 if ( Pi0Candidate->M() > 0.45 && Pi0Candidate->M() < 0.65){
2804 fHistoTrueEtaPtY[fiCut]->Fill(Pi0Candidate->Pt(),Pi0Candidate->Rapidity()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift());
2805 fHistoTrueEtaPtAlpha[fiCut]->Fill(Pi0Candidate->Pt(),Pi0Candidate->GetAlpha());
2806 fHistoTrueEtaPtOpenAngle[fiCut]->Fill(Pi0Candidate->Pt(),Pi0Candidate->GetOpeningAngle());
2807 }
8bdca7f1 2808 }
2809 }
d53bf4ac 2810 if(!(static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma0MotherLabel))->IsPrimary())){ // Secondary Meson
2811 Int_t secMotherLabel = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma1MotherLabel))->GetMother();
2812 Float_t weightedSec= 1;
2813 if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(secMotherLabel, 0x0, fInputEvent) && static_cast<AliAODMCParticle*>(AODMCTrackArray->At(secMotherLabel))->GetPdgCode()==310){
2814 weightedSec= ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetWeightForMeson(fV0Reader->GetPeriodName(),secMotherLabel, 0x0, fInputEvent)/2.; //invariant mass is additive thus the weight for the daughters has to be devide by two for the K0s at a certain pt
2815 //cout << "MC input \t"<<i << "\t" << particle->Pt()<<"\t"<<weighted << endl;
8bdca7f1 2816 }
ed8bc1ca 2817 if (isTruePi0) fHistoTrueSecondaryPi0InvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weightedSec);
2818 if (isTrueEta) fHistoTrueSecondaryEtaInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weightedSec);
2819
d53bf4ac 2820 fCharMesonMCInfo = 2;
2821 if (secMotherLabel >-1){
ed8bc1ca 2822 if(static_cast<AliAODMCParticle*>(AODMCTrackArray->At(secMotherLabel))->GetPdgCode()==310 && isTruePi0){
d53bf4ac 2823 fCharMesonMCInfo = 4;
ed8bc1ca 2824 fHistoTrueSecondaryPi0FromK0sInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weightedSec);
d53bf4ac 2825 if (fDoMesonQA > 0)fHistoTrueK0sWithPi0DaughterMCPt[fiCut]->Fill(static_cast<AliAODMCParticle*>(AODMCTrackArray->At(secMotherLabel))->Pt());
2826 }
ed8bc1ca 2827 if(static_cast<AliAODMCParticle*>(AODMCTrackArray->At(secMotherLabel))->GetPdgCode()==221 && isTruePi0){
d53bf4ac 2828 fCharMesonMCInfo = 3;
ed8bc1ca 2829 fHistoTrueSecondaryPi0FromEtaInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weightedSec);
d53bf4ac 2830 if (fDoMesonQA > 0)fHistoTrueEtaWithPi0DaughterMCPt[fiCut]->Fill(static_cast<AliAODMCParticle*>(AODMCTrackArray->At(secMotherLabel))->Pt());
2831 }
ed8bc1ca 2832 if(static_cast<AliAODMCParticle*>(AODMCTrackArray->At(secMotherLabel))->GetPdgCode()==3122 && isTruePi0){
d53bf4ac 2833 fCharMesonMCInfo = 7;
ed8bc1ca 2834 fHistoTrueSecondaryPi0FromLambdaInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weightedSec);
d53bf4ac 2835 if (fDoMesonQA > 0)fHistoTrueLambdaWithPi0DaughterMCPt[fiCut]->Fill(static_cast<AliAODMCParticle*>(AODMCTrackArray->At(secMotherLabel))->Pt());
2836 }
8bdca7f1 2837 }
d53bf4ac 2838 } else{ // Only primary pi0 for efficiency calculation
2839 Float_t weighted= 1;
2840 fCharMesonMCInfo = 6;
2841 if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(gamma1MotherLabel, 0x0, fInputEvent)){
2842 if (static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma1MotherLabel))->Pt()>0.005){
2843 weighted= ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetWeightForMeson(fV0Reader->GetPeriodName(),gamma1MotherLabel, 0x0, fInputEvent);
2844 // cout << "rec \t " <<gamma1MotherLabel << "\t" << weighted << endl;
2845 }
8bdca7f1 2846 }
ed8bc1ca 2847 if (isTruePi0){
2848 fHistoTruePrimaryPi0InvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weighted);
2849 fHistoTruePrimaryPi0W0WeightingInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2850 fProfileTruePrimaryPi0WeightsInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weighted);
2851 } else if (isTrueEta){
2852 fHistoTruePrimaryEtaInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weighted);
2853 fHistoTruePrimaryEtaW0WeightingInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2854 fProfileTruePrimaryEtaWeightsInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weighted);
2855 }
d53bf4ac 2856 if (fDoMesonQA > 0){
2857 if(isTruePi0){ // Only primary pi0 for resolution
2858 fHistoTruePrimaryPi0MCPtResolPt[fiCut]->Fill(static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma1MotherLabel))->Pt(),
2859 (Pi0Candidate->Pt()-static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma1MotherLabel))->Pt())/static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma1MotherLabel))->Pt(),weighted);
2860
2861 }
2862 if (isTrueEta){ // Only primary eta for resolution
2863 fHistoTruePrimaryEtaMCPtResolPt[fiCut]->Fill(static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma1MotherLabel))->Pt(),
2864 (Pi0Candidate->Pt()-static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma1MotherLabel))->Pt())/static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma1MotherLabel))->Pt(),weighted);
2865 }
8bdca7f1 2866 }
2867 }
d53bf4ac 2868 }
8bdca7f1 2869 } else if(!isTruePi0 && !isTrueEta) { // Background
2870 if (fDoMesonQA > 0){
2871 if(gamma0MotherLabel>-1 && gamma1MotherLabel>-1){ // Both Tracks are Photons and have a mother but not Pi0 or Eta
2872 fHistoTrueBckGGInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2873 fCharMesonMCInfo = 1;
2874 } else { // No photon or without mother
2875 fHistoTrueBckContInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2876 }
2877 }
8bdca7f1 2878 }
2879}
344100c4 2880
8bdca7f1 2881//________________________________________________________________________
2882void AliAnalysisTaskGammaConvCalo::CalculateBackground(){
2883
2884 Int_t zbin= fBGClusHandler[fiCut]->GetZBinIndex(fInputEvent->GetPrimaryVertex()->GetZ());
2885 Int_t mbin = 0;
2886
2887 if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->UseTrackMultiplicity()){
2888 mbin = fBGClusHandler[fiCut]->GetMultiplicityBinIndex(fV0Reader->GetNumberOfPrimaryTracks());
2889 } else {
2890 mbin = fBGClusHandler[fiCut]->GetMultiplicityBinIndex(fGammaCandidates->GetEntries());
2891 }
2892
2893 AliGammaConversionAODBGHandler::GammaConversionVertex *bgEventVertex = NULL;
2894 if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->UseTrackMultiplicity()){
2895 for(Int_t nEventsInBG=0;nEventsInBG<fBGClusHandler[fiCut]->GetNBGEvents();nEventsInBG++){
2896 AliGammaConversionAODVector *previousEventV0s = fBGClusHandler[fiCut]->GetBGGoodV0s(zbin,mbin,nEventsInBG);
2897 if(fMoveParticleAccordingToVertex == kTRUE){
2898 bgEventVertex = fBGClusHandler[fiCut]->GetBGEventVertex(zbin,mbin,nEventsInBG);
2899 }
2900
2901 for(Int_t iCurrent=0;iCurrent<fGammaCandidates->GetEntries();iCurrent++){
2902 AliAODConversionPhoton currentEventGoodV0 = *(AliAODConversionPhoton*)(fGammaCandidates->At(iCurrent));
2903 for(UInt_t iPrevious=0;iPrevious<previousEventV0s->size();iPrevious++){
2904 AliAODConversionPhoton previousGoodV0 = (AliAODConversionPhoton)(*(previousEventV0s->at(iPrevious)));
2905 if(fMoveParticleAccordingToVertex == kTRUE){
2906 MoveParticleAccordingToVertex(&previousGoodV0,bgEventVertex);
2907 }
344100c4 2908 if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->GetInPlaneOutOfPlaneCut() != 0){
8bdca7f1 2909 RotateParticleAccordingToEP(&previousGoodV0,bgEventVertex->fEP,fEventPlaneAngle);
2910 }
2911
2912 AliAODConversionMother *backgroundCandidate = new AliAODConversionMother(&currentEventGoodV0,&previousGoodV0);
2913 backgroundCandidate->CalculateDistanceOfClossetApproachToPrimVtx(fInputEvent->GetPrimaryVertex());
2914 if((((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))
344100c4 2915 ->MesonIsSelected(backgroundCandidate,kFALSE,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift()))){
8bdca7f1 2916 fHistoMotherBackInvMassPt[fiCut]->Fill(backgroundCandidate->M(),backgroundCandidate->Pt());
2917 Double_t sparesFill[4] = {backgroundCandidate->M(),backgroundCandidate->Pt(),(Double_t)zbin,(Double_t)mbin};
2918 fSparseMotherBackInvMassPtZM[fiCut]->Fill(sparesFill,1);
2919 }
2920 delete backgroundCandidate;
2921 backgroundCandidate = 0x0;
2922 }
2923 }
2924 }