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