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