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