Merge branch 'master' of https://git.cern.ch/reps/AliRoot
[u/mrichter/AliRoot.git] / PWGGA / GammaConv / AliAnalysisTaskGammaConvCalo.cxx
CommitLineData
8bdca7f1 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: Baldo Sahlmueller, Friederike Bock *
5 * Version 1.0 *
6 * *
7 * *
8 * Permission to use, copy, modify and distribute this software and its *
9 * documentation strictly for non-commercial purposes is hereby granted *
10 * without fee, provided that the above copyright notice appears in all *
11 * copies and that both the copyright notice and this permission notice *
12 * appear in the supporting documentation. The authors make no claims *
13 * about the suitability of this software for any purpose. It is *
14 * provided "as is" without express or implied warranty. *
15 **************************************************************************/
16
17//////////////////////////////////////////////////////////////////
18//----------------------------------------------------------------
19// Class used to do analysis on conversion photons + calo photons
20//----------------------------------------------------------------
21//////////////////////////////////////////////////////////////////
22#include "TChain.h"
23#include "TTree.h"
24#include "TBranch.h"
25#include "TFile.h"
26#include "TH1F.h"
27#include "TH2F.h"
28#include "TH3F.h"
29#include "THnSparse.h"
30#include "TCanvas.h"
31#include "TNtuple.h"
32#include "AliAnalysisTask.h"
33#include "AliAnalysisManager.h"
34#include "AliESDEvent.h"
35#include "AliESDInputHandler.h"
36#include "AliMCEventHandler.h"
37#include "AliMCEvent.h"
38#include "AliMCParticle.h"
39#include "AliCentrality.h"
40#include "AliESDVZERO.h"
41#include "AliESDpid.h"
42#include "AliAnalysisTaskGammaConvCalo.h"
43#include "AliVParticle.h"
44#include "AliESDtrack.h"
45#include "AliESDtrackCuts.h"
46#include "AliKFVertex.h"
47#include "AliV0ReaderV1.h"
48#include "AliGenCocktailEventHeader.h"
49#include "AliConversionAODBGHandlerRP.h"
50#include "AliAODMCParticle.h"
51#include "AliAODMCHeader.h"
52#include "AliEventplane.h"
53#include "AliAnalysisTaskEMCALClusterizeFast.h"
54#include "AliAODEvent.h"
55#include "AliAODInputHandler.h"
56#include "AliESDEvent.h"
57#include "AliESDInputHandler.h"
58#include "AliInputEventHandler.h"
59
60ClassImp(AliAnalysisTaskGammaConvCalo)
61
62//________________________________________________________________________
63AliAnalysisTaskGammaConvCalo::AliAnalysisTaskGammaConvCalo(): AliAnalysisTaskSE(),
64 fV0Reader(NULL),
65 fBGHandler(NULL),
66 fBGHandlerRP(NULL),
67 fBGClusHandler(NULL),
68 fBGClusHandlerRP(NULL),
69 fInputEvent(NULL),
70 fMCEvent(NULL),
71 fMCStack(NULL),
72 fCutFolder(NULL),
73 fESDList(NULL),
74 fBackList(NULL),
75 fMotherList(NULL),
76 fPhotonDCAList(NULL),
77 fMesonDCAList(NULL),
78 fTrueList(NULL),
79 fMCList(NULL),
80 fHeaderNameList(NULL),
81 fTagOutputList(NULL),
82 fOutputContainer(NULL),
83 fReaderGammas(NULL),
84 fGammaCandidates(NULL),
85 fClusterCandidates(NULL),
344100c4 86 fEventCutArray(NULL),
87 fEventCuts(NULL),
8bdca7f1 88 fCutArray(NULL),
89 fConversionCuts(NULL),
90 fClusterCutArray(NULL),
91 fCaloPhotonCuts(NULL),
92 fMesonCutArray(NULL),
93 fMesonCuts(NULL),
94 fHistoConvGammaPt(NULL),
95 fHistoConvGammaR(NULL),
96 fHistoConvGammaEta(NULL),
97 fTreeConvGammaPtDcazCat(NULL),
98 fPtGamma(0),
99 fDCAzPhoton(0),
100 fRConvPhoton(0),
101 fEtaPhoton(0),
102 fCharCatPhoton(0),
103 fCharPhotonMCInfo(0),
104 fHistoMotherInvMassPt(NULL),
d53bf4ac 105 fHistoMotherMatchedInvMassPt(NULL),
8bdca7f1 106 fSparseMotherInvMassPtZM(NULL),
107 fHistoMotherBackInvMassPt(NULL),
108 fSparseMotherBackInvMassPtZM(NULL),
109 fHistoMotherInvMassEalpha(NULL),
110 fHistoMotherPi0PtY(NULL),
111 fHistoMotherEtaPtY(NULL),
112 fHistoMotherPi0PtAlpha(NULL),
113 fHistoMotherEtaPtAlpha(NULL),
114 fHistoMotherPi0PtOpenAngle(NULL),
115 fHistoMotherEtaPtOpenAngle(NULL),
20af4b69 116 fHistoMotherInvMassECalib(NULL),
117 fHistoMotherInvMassECalibalpha(NULL),
8bdca7f1 118 fTreeMesonsInvMassPtDcazMinDcazMaxFlag(NULL),
119 fInvMass(0),
120 fPt(0),
121 fDCAzGammaMin(0),
122 fDCAzGammaMax(0),
123 fCharFlag(0),
124 fCharMesonMCInfo(0),
125 fHistoConvGammaUntagged(NULL),
126 fHistoConvGammaTagged(NULL),
127 fHistoConvGammaPi0Tagged(NULL),
128 fHistoConvGammaEtaTagged(NULL),
129 fHistoPhotonPairAll(NULL),
130 fHistoPhotonPairAllGam(NULL),
131 fHistoClusGammaPt(NULL),
132 fHistoMCHeaders(NULL),
133 fHistoMCAllGammaPt(NULL),
20af4b69 134 fHistoMCAllGammaEMCALAccPt(NULL),
8bdca7f1 135 fHistoMCDecayGammaPi0Pt(NULL),
136 fHistoMCDecayGammaRhoPt(NULL),
137 fHistoMCDecayGammaEtaPt(NULL),
138 fHistoMCDecayGammaOmegaPt(NULL),
139 fHistoMCDecayGammaEtapPt(NULL),
140 fHistoMCDecayGammaPhiPt(NULL),
141 fHistoMCDecayGammaSigmaPt(NULL),
142 fHistoMCConvGammaPt(NULL),
143 fHistoMCConvGammaR(NULL),
144 fHistoMCConvGammaEta(NULL),
145 fHistoMCPi0Pt(NULL),
146 fHistoMCPi0WOWeightPt(NULL),
147 fHistoMCEtaPt(NULL),
148 fHistoMCEtaWOWeightPt(NULL),
149 fHistoMCPi0InAccPt(NULL),
150 fHistoMCEtaInAccPt(NULL),
151 fHistoMCPi0PtY(NULL),
152 fHistoMCEtaPtY(NULL),
153 fHistoMCK0sPt(NULL),
154 fHistoMCK0sWOWeightPt(NULL),
155 fHistoMCK0sPtY(NULL),
156 fHistoMCSecPi0PtvsSource(NULL),
157 fHistoMCSecPi0Source(NULL),
158 fHistoMCSecEtaPt(NULL),
159 fHistoMCSecEtaSource(NULL),
160 fHistoTrueMotherInvMassPt(NULL),
fd94f234 161 fHistoTrueMotherCaloPhotonInvMassPt(NULL),
162 fHistoTrueMotherCaloConvertedPhotonInvMassPt(NULL),
20af4b69 163 fHistoTruePi0CaloConvertedPhotonInvMassPt(NULL),
164 fHistoTruePi0CaloConvertedPhotonMatchedInvMassPt(NULL),
165 fHistoTrueEtaCaloConvertedPhotonInvMassPt(NULL),
166 fHistoTrueEtaCaloConvertedPhotonMatchedInvMassPt(NULL),
fd94f234 167 fHistoTrueMotherCaloElectronInvMassPt(NULL),
168 fHistoTrueMotherCaloMergedClusterInvMassPt(NULL),
169 fHistoTrueMotherCaloEMNonLeadingInvMassPt(NULL),
170 fHistoTrueMotherCaloMergedClusterPartConvInvMassPt(NULL),
8bdca7f1 171 fHistoTruePrimaryMotherInvMassPt(NULL),
172 fHistoTruePrimaryMotherW0WeightingInvMassPt(NULL),
173 fProfileTruePrimaryMotherWeightsInvMassPt(NULL),
174 fHistoTruePrimaryPi0MCPtResolPt(NULL),
175 fHistoTruePrimaryEtaMCPtResolPt(NULL),
176 fHistoTrueSecondaryMotherInvMassPt(NULL),
177 fHistoTrueSecondaryMotherFromK0sInvMassPt(NULL),
178 fHistoTrueK0sWithPi0DaughterMCPt(NULL),
179 fHistoTrueSecondaryMotherFromEtaInvMassPt(NULL),
180 fHistoTrueEtaWithPi0DaughterMCPt(NULL),
181 fHistoTrueSecondaryMotherFromLambdaInvMassPt(NULL),
182 fHistoTrueLambdaWithPi0DaughterMCPt(NULL),
183 fHistoTrueBckGGInvMassPt(NULL),
184 fHistoTrueBckContInvMassPt(NULL),
185 fHistoTruePi0PtY(NULL),
186 fHistoTrueEtaPtY(NULL),
187 fHistoTruePi0PtAlpha(NULL),
188 fHistoTrueEtaPtAlpha(NULL),
189 fHistoTruePi0PtOpenAngle(NULL),
190 fHistoTrueEtaPtOpenAngle(NULL),
8bdca7f1 191 fHistoTrueConvGammaPt(NULL),
192 fHistoTrueConvPi0GammaPt(NULL),
193 fHistoTrueConvGammaEta(NULL),
194 fHistoCombinatorialPt(NULL),
195 fHistoTruePrimaryConvGammaPt(NULL),
196 fHistoTruePrimaryConvGammaESDPtMCPt(NULL),
197 fHistoTrueSecondaryConvGammaPt(NULL),
198 fHistoTrueSecondaryConvGammaFromXFromK0sPt(NULL),
199 fHistoTrueSecondaryConvGammaFromXFromLambdaPt(NULL),
8bdca7f1 200 fHistoTrueClusGammaPt(NULL),
fd94f234 201 fHistoTrueClusUnConvGammaPt(NULL),
20af4b69 202 fHistoTrueClusUnConvGammaMCPt(NULL),
fd94f234 203 fHistoTrueClusElectronPt(NULL),
204 fHistoTrueClusConvGammaPt(NULL),
20af4b69 205 fHistoTrueClusConvGammaMCPt(NULL),
fd94f234 206 fHistoTrueClusConvGammaFullyPt(NULL),
207 fHistoTrueClusMergedGammaPt(NULL),
208 fHistoTrueClusMergedPartConvGammaPt(NULL),
209 fHistoTrueClusDalitzPt(NULL),
210 fHistoTrueClusDalitzMergedPt(NULL),
211 fHistoTrueClusPhotonFromElecMotherPt(NULL),
212 fHistoTrueClusShowerPt(NULL),
cc579963 213 fHistoTrueClusSubLeadingPt(NULL),
214 fHistoTrueClusNParticles(NULL),
fd94f234 215 fHistoTrueClusEMNonLeadingPt(NULL),
216 fHistoTrueNLabelsInClus(NULL),
8bdca7f1 217 fHistoTruePrimaryClusGammaPt(NULL),
218 fHistoTruePrimaryClusGammaESDPtMCPt(NULL),
219 fHistoNEvents(NULL),
220 fHistoNGoodESDTracks(NULL),
221 fHistoNGammaCandidates(NULL),
222 fHistoNGoodESDTracksVsNGammaCanditates(NULL),
223 fHistoNV0Tracks(NULL),
224 fProfileEtaShift(NULL),
225 fEventPlaneAngle(-100),
226 fRandom(0),
227 fNGammaCandidates(0),
228 fUnsmearedPx(NULL),
229 fUnsmearedPy(NULL),
230 fUnsmearedPz(NULL),
231 fUnsmearedE(NULL),
232 fMCStackPos(NULL),
233 fMCStackNeg(NULL),
234 fESDArrayPos(NULL),
235 fESDArrayNeg(NULL),
236 fnCuts(0),
237 fiCut(0),
238 fMoveParticleAccordingToVertex(kTRUE),
239 fIsHeavyIon(0),
240 fDoMesonAnalysis(kTRUE),
241 fDoMesonQA(0),
242 fDoPhotonQA(0),
fd94f234 243 fDoClusterQA(0),
8bdca7f1 244 fIsFromMBHeader(kTRUE),
d53bf4ac 245 fIsMC(kFALSE)
8bdca7f1 246{
247
248}
249
250//________________________________________________________________________
251AliAnalysisTaskGammaConvCalo::AliAnalysisTaskGammaConvCalo(const char *name):
252 AliAnalysisTaskSE(name),
253 fV0Reader(NULL),
254 fBGHandler(NULL),
255 fBGHandlerRP(NULL),
256 fBGClusHandler(NULL),
257 fBGClusHandlerRP(NULL),
258 fInputEvent(NULL),
259 fMCEvent(NULL),
260 fMCStack(NULL),
261 fCutFolder(NULL),
262 fESDList(NULL),
263 fBackList(NULL),
264 fMotherList(NULL),
265 fPhotonDCAList(NULL),
266 fMesonDCAList(NULL),
267 fTrueList(NULL),
268 fMCList(NULL),
269 fHeaderNameList(NULL),
270 fTagOutputList(NULL),
271 fOutputContainer(0),
272 fReaderGammas(NULL),
273 fGammaCandidates(NULL),
274 fClusterCandidates(NULL),
344100c4 275 fEventCutArray(NULL),
276 fEventCuts(NULL),
8bdca7f1 277 fCutArray(NULL),
278 fConversionCuts(NULL),
279 fClusterCutArray(NULL),
280 fCaloPhotonCuts(NULL),
281 fMesonCutArray(NULL),
282 fMesonCuts(NULL),
283 fHistoConvGammaPt(NULL),
284 fHistoConvGammaR(NULL),
285 fHistoConvGammaEta(NULL),
286 fTreeConvGammaPtDcazCat(NULL),
287 fPtGamma(0),
288 fDCAzPhoton(0),
289 fRConvPhoton(0),
290 fEtaPhoton(0),
291 fCharCatPhoton(0),
292 fCharPhotonMCInfo(0),
293 fHistoMotherInvMassPt(NULL),
d53bf4ac 294 fHistoMotherMatchedInvMassPt(NULL),
8bdca7f1 295 fSparseMotherInvMassPtZM(NULL),
296 fHistoMotherBackInvMassPt(NULL),
297 fSparseMotherBackInvMassPtZM(NULL),
298 fHistoMotherInvMassEalpha(NULL),
299 fHistoMotherPi0PtY(NULL),
300 fHistoMotherEtaPtY(NULL),
301 fHistoMotherPi0PtAlpha(NULL),
302 fHistoMotherEtaPtAlpha(NULL),
303 fHistoMotherPi0PtOpenAngle(NULL),
304 fHistoMotherEtaPtOpenAngle(NULL),
20af4b69 305 fHistoMotherInvMassECalib(NULL),
306 fHistoMotherInvMassECalibalpha(NULL),
8bdca7f1 307 fTreeMesonsInvMassPtDcazMinDcazMaxFlag(NULL),
308 fInvMass(0),
309 fPt(0),
310 fDCAzGammaMin(0),
311 fDCAzGammaMax(0),
312 fCharFlag(0),
313 fCharMesonMCInfo(0),
314 fHistoConvGammaUntagged(NULL),
315 fHistoConvGammaTagged(NULL),
316 fHistoConvGammaPi0Tagged(NULL),
317 fHistoConvGammaEtaTagged(NULL),
318 fHistoPhotonPairAll(NULL),
319 fHistoPhotonPairAllGam(NULL),
320 fHistoClusGammaPt(NULL),
321 fHistoMCHeaders(NULL),
322 fHistoMCAllGammaPt(NULL),
20af4b69 323 fHistoMCAllGammaEMCALAccPt(NULL),
8bdca7f1 324 fHistoMCDecayGammaPi0Pt(NULL),
325 fHistoMCDecayGammaRhoPt(NULL),
326 fHistoMCDecayGammaEtaPt(NULL),
327 fHistoMCDecayGammaOmegaPt(NULL),
328 fHistoMCDecayGammaEtapPt(NULL),
329 fHistoMCDecayGammaPhiPt(NULL),
330 fHistoMCDecayGammaSigmaPt(NULL),
331 fHistoMCConvGammaPt(NULL),
332 fHistoMCConvGammaR(NULL),
333 fHistoMCConvGammaEta(NULL),
334 fHistoMCPi0Pt(NULL),
335 fHistoMCPi0WOWeightPt(NULL),
336 fHistoMCEtaPt(NULL),
337 fHistoMCEtaWOWeightPt(NULL),
338 fHistoMCPi0InAccPt(NULL),
339 fHistoMCEtaInAccPt(NULL),
340 fHistoMCPi0PtY(NULL),
341 fHistoMCEtaPtY(NULL),
342 fHistoMCK0sPt(NULL),
343 fHistoMCK0sWOWeightPt(NULL),
344 fHistoMCK0sPtY(NULL),
345 fHistoMCSecPi0PtvsSource(NULL),
346 fHistoMCSecPi0Source(NULL),
347 fHistoMCSecEtaPt(NULL),
348 fHistoMCSecEtaSource(NULL),
349 fHistoTrueMotherInvMassPt(NULL),
fd94f234 350 fHistoTrueMotherCaloPhotonInvMassPt(NULL),
351 fHistoTrueMotherCaloConvertedPhotonInvMassPt(NULL),
20af4b69 352 fHistoTruePi0CaloConvertedPhotonInvMassPt(NULL),
353 fHistoTruePi0CaloConvertedPhotonMatchedInvMassPt(NULL),
354 fHistoTrueEtaCaloConvertedPhotonInvMassPt(NULL),
355 fHistoTrueEtaCaloConvertedPhotonMatchedInvMassPt(NULL),
fd94f234 356 fHistoTrueMotherCaloElectronInvMassPt(NULL),
357 fHistoTrueMotherCaloMergedClusterInvMassPt(NULL),
358 fHistoTrueMotherCaloEMNonLeadingInvMassPt(NULL),
359 fHistoTrueMotherCaloMergedClusterPartConvInvMassPt(NULL),
8bdca7f1 360 fHistoTruePrimaryMotherInvMassPt(NULL),
361 fHistoTruePrimaryMotherW0WeightingInvMassPt(NULL),
362 fProfileTruePrimaryMotherWeightsInvMassPt(NULL),
363 fHistoTruePrimaryPi0MCPtResolPt(NULL),
364 fHistoTruePrimaryEtaMCPtResolPt(NULL),
365 fHistoTrueSecondaryMotherInvMassPt(NULL),
366 fHistoTrueSecondaryMotherFromK0sInvMassPt(NULL),
367 fHistoTrueK0sWithPi0DaughterMCPt(NULL),
368 fHistoTrueSecondaryMotherFromEtaInvMassPt(NULL),
369 fHistoTrueEtaWithPi0DaughterMCPt(NULL),
370 fHistoTrueSecondaryMotherFromLambdaInvMassPt(NULL),
371 fHistoTrueLambdaWithPi0DaughterMCPt(NULL),
372 fHistoTrueBckGGInvMassPt(NULL),
373 fHistoTrueBckContInvMassPt(NULL),
374 fHistoTruePi0PtY(NULL),
375 fHistoTrueEtaPtY(NULL),
376 fHistoTruePi0PtAlpha(NULL),
377 fHistoTrueEtaPtAlpha(NULL),
378 fHistoTruePi0PtOpenAngle(NULL),
379 fHistoTrueEtaPtOpenAngle(NULL),
8bdca7f1 380 fHistoTrueConvGammaPt(NULL),
381 fHistoTrueConvPi0GammaPt(NULL),
382 fHistoTrueConvGammaEta(NULL),
383 fHistoCombinatorialPt(NULL),
384 fHistoTruePrimaryConvGammaPt(NULL),
385 fHistoTruePrimaryConvGammaESDPtMCPt(NULL),
386 fHistoTrueSecondaryConvGammaPt(NULL),
387 fHistoTrueSecondaryConvGammaFromXFromK0sPt(NULL),
388 fHistoTrueSecondaryConvGammaFromXFromLambdaPt(NULL),
8bdca7f1 389 fHistoTrueClusGammaPt(NULL),
fd94f234 390 fHistoTrueClusUnConvGammaPt(NULL),
20af4b69 391 fHistoTrueClusUnConvGammaMCPt(NULL),
fd94f234 392 fHistoTrueClusElectronPt(NULL),
393 fHistoTrueClusConvGammaPt(NULL),
20af4b69 394 fHistoTrueClusConvGammaMCPt(NULL),
fd94f234 395 fHistoTrueClusConvGammaFullyPt(NULL),
396 fHistoTrueClusMergedGammaPt(NULL),
397 fHistoTrueClusMergedPartConvGammaPt(NULL),
398 fHistoTrueClusDalitzPt(NULL),
399 fHistoTrueClusDalitzMergedPt(NULL),
400 fHistoTrueClusPhotonFromElecMotherPt(NULL),
401 fHistoTrueClusShowerPt(NULL),
cc579963 402 fHistoTrueClusSubLeadingPt(NULL),
403 fHistoTrueClusNParticles(NULL),
fd94f234 404 fHistoTrueClusEMNonLeadingPt(NULL),
405 fHistoTrueNLabelsInClus(NULL),
8bdca7f1 406 fHistoTruePrimaryClusGammaPt(NULL),
407 fHistoTruePrimaryClusGammaESDPtMCPt(NULL),
408 fHistoNEvents(NULL),
409 fHistoNGoodESDTracks(NULL),
410 fHistoNGammaCandidates(NULL),
411 fHistoNGoodESDTracksVsNGammaCanditates(NULL),
412 fHistoNV0Tracks(NULL),
413 fProfileEtaShift(NULL),
414 fEventPlaneAngle(-100),
415 fRandom(0),
416 fNGammaCandidates(0),
417 fUnsmearedPx(NULL),
418 fUnsmearedPy(NULL),
419 fUnsmearedPz(NULL),
420 fUnsmearedE(NULL),
421 fMCStackPos(NULL),
422 fMCStackNeg(NULL),
423 fESDArrayPos(NULL),
424 fESDArrayNeg(NULL),
425 fnCuts(0),
426 fiCut(0),
427 fMoveParticleAccordingToVertex(kTRUE),
428 fIsHeavyIon(0),
429 fDoMesonAnalysis(kTRUE),
430 fDoMesonQA(0),
431 fDoPhotonQA(0),
fd94f234 432 fDoClusterQA(0),
8bdca7f1 433 fIsFromMBHeader(kTRUE),
d53bf4ac 434 fIsMC(kFALSE)
8bdca7f1 435{
436 // Define output slots here
437 DefineOutput(1, TList::Class());
438}
439
440AliAnalysisTaskGammaConvCalo::~AliAnalysisTaskGammaConvCalo()
441{
442 if(fGammaCandidates){
443 delete fGammaCandidates;
444 fGammaCandidates = 0x0;
445 }
446 if(fClusterCandidates){
447 delete fClusterCandidates;
448 fClusterCandidates = 0x0;
449 }
450 if(fBGHandler){
451 delete[] fBGHandler;
452 fBGHandler = 0x0;
453 }
454 if(fBGHandlerRP){
455 delete[] fBGHandlerRP;
456 fBGHandlerRP = 0x0;
457 }
458 if(fBGClusHandler){
459 delete[] fBGClusHandler;
460 fBGClusHandler = 0x0;
461 }
462 if(fBGClusHandlerRP){
463 delete[] fBGClusHandlerRP;
464 fBGClusHandlerRP = 0x0;
465 }
466}
467//___________________________________________________________
468void AliAnalysisTaskGammaConvCalo::InitBack(){
469
470 const Int_t nDim = 4;
471 Int_t nBins[nDim] = {800,250,7,4};
472 Double_t xMin[nDim] = {0,0, 0,0};
473 Double_t xMax[nDim] = {0.8,25,7,4};
474
475 fSparseMotherInvMassPtZM = new THnSparseF*[fnCuts];
476 fSparseMotherBackInvMassPtZM = new THnSparseF*[fnCuts];
477
478 fBGHandler = new AliGammaConversionAODBGHandler*[fnCuts];
479 fBGHandlerRP = new AliConversionAODBGHandlerRP*[fnCuts];
480
481 fBGClusHandler = new AliGammaConversionAODBGHandler*[fnCuts];
482 fBGClusHandlerRP = new AliConversionAODBGHandlerRP*[fnCuts];
483
484 for(Int_t iCut = 0; iCut<fnCuts;iCut++){
485 if (((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->DoBGCalculation()){
344100c4 486 TString cutstringEvent = ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber();
487 TString cutstringPhoton = ((AliConversionPhotonCuts*)fCutArray->At(iCut))->GetCutNumber();
488 TString cutstringCalo = ((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetCutNumber();
489 TString cutstringMeson = ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutNumber();
8bdca7f1 490
344100c4 491 Int_t collisionSystem = atoi((TString)(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber())(0,1));
492 Int_t centMin = atoi((TString)(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber())(1,1));
493 Int_t centMax = atoi((TString)(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber())(2,1));
8bdca7f1 494
495 if(collisionSystem == 1 || collisionSystem == 2 ||
496 collisionSystem == 5 || collisionSystem == 8 ||
497 collisionSystem == 9){
498 centMin = centMin*10;
499 centMax = centMax*10;
500 if(centMax ==0 && centMax!=centMin) centMax=100;
501 } else if(collisionSystem == 3 || collisionSystem == 6){
502 centMin = centMin*5;
503 centMax = centMax*5;
504 } else if(collisionSystem == 4 || collisionSystem == 7){
505 centMin = ((centMin*5)+45);
506 centMax = ((centMax*5)+45);
507 }
508
509 fBackList[iCut] = new TList();
344100c4 510 fBackList[iCut]->SetName(Form("%s_%s_%s_%s Back histograms",cutstringEvent.Data(),cutstringPhoton.Data(),cutstringCalo.Data(), cutstringMeson.Data()));
8bdca7f1 511 fBackList[iCut]->SetOwner(kTRUE);
512 fCutFolder[iCut]->Add(fBackList[iCut]);
513
514 fSparseMotherBackInvMassPtZM[iCut] = new THnSparseF("Back_Back_InvMass_Pt_z_m","Back_Back_InvMass_Pt_z_m",nDim,nBins,xMin,xMax);
515 fBackList[iCut]->Add(fSparseMotherBackInvMassPtZM[iCut]);
516
517 fMotherList[iCut] = new TList();
344100c4 518 fMotherList[iCut]->SetName(Form("%s_%s_%s_%s Mother histograms",cutstringEvent.Data(),cutstringPhoton.Data(),cutstringCalo.Data(),cutstringMeson.Data()));
8bdca7f1 519 fMotherList[iCut]->SetOwner(kTRUE);
520 fCutFolder[iCut]->Add(fMotherList[iCut]);
521
522 fSparseMotherInvMassPtZM[iCut] = new THnSparseF("Back_Mother_InvMass_Pt_z_m","Back_Mother_InvMass_Pt_z_m",nDim,nBins,xMin,xMax);
523 fMotherList[iCut]->Add(fSparseMotherInvMassPtZM[iCut]);
524
525 if(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->BackgroundHandlerType() == 0){
526 fBGHandler[iCut] = new AliGammaConversionAODBGHandler(
527 collisionSystem,centMin,centMax,
528 ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetNumberOfBGEvents(),
529 ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->UseTrackMultiplicity());
530 fBGClusHandler[iCut] = new AliGammaConversionAODBGHandler(
531 collisionSystem,centMin,centMax,
532 ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetNumberOfBGEvents(),
533 ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->UseTrackMultiplicity());
534 fBGHandlerRP[iCut] = NULL;
535 } else{
536 fBGHandlerRP[iCut] = new AliConversionAODBGHandlerRP(
344100c4 537 ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsHeavyIon(),
8bdca7f1 538 ((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->UseTrackMultiplicity(),
539 ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetNumberOfBGEvents());
540 fBGClusHandlerRP[iCut] = new AliConversionAODBGHandlerRP(
344100c4 541 ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsHeavyIon(),
8bdca7f1 542 ((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->UseTrackMultiplicity(),
543 ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetNumberOfBGEvents());
544 fBGHandler[iCut] = NULL;
545 }
546 }
547 }
548}
549//________________________________________________________________________
550void AliAnalysisTaskGammaConvCalo::UserCreateOutputObjects(){
551
552 // Create histograms
553 if(fOutputContainer != NULL){
554 delete fOutputContainer;
555 fOutputContainer = NULL;
556 }
557 if(fOutputContainer == NULL){
558 fOutputContainer = new TList();
559 fOutputContainer->SetOwner(kTRUE);
560 }
561
562 // Array of current cut's gammas
563 fGammaCandidates = new TList();
564 fClusterCandidates = new TList();
565
566 fCutFolder = new TList*[fnCuts];
567 fESDList = new TList*[fnCuts];
568 fBackList = new TList*[fnCuts];
569 fMotherList = new TList*[fnCuts];
570 fHistoNEvents = new TH1I*[fnCuts];
571 fHistoNGoodESDTracks = new TH1I*[fnCuts];
572 fHistoNGammaCandidates = new TH1I*[fnCuts];
573 fHistoNGoodESDTracksVsNGammaCanditates = new TH2F*[fnCuts];
574 fHistoNV0Tracks = new TH1I*[fnCuts];
575 fProfileEtaShift = new TProfile*[fnCuts];
576 fHistoConvGammaPt = new TH1F*[fnCuts];
577
578 if (fDoPhotonQA == 2){
579 fPhotonDCAList = new TList*[fnCuts];
580 fTreeConvGammaPtDcazCat = new TTree*[fnCuts];
581 }
582 if (fDoPhotonQA > 0){
583 fHistoConvGammaR = new TH1F*[fnCuts];
584 fHistoConvGammaEta = new TH1F*[fnCuts];
585 }
586
587 if(fDoMesonAnalysis){
588 fHistoMotherInvMassPt = new TH2F*[fnCuts];
d53bf4ac 589 fHistoMotherMatchedInvMassPt = new TH2F*[fnCuts];
8bdca7f1 590 fHistoMotherBackInvMassPt = new TH2F*[fnCuts];
591 fHistoMotherInvMassEalpha = new TH2F*[fnCuts];
592 if (fDoMesonQA == 2){
593 fMesonDCAList = new TList*[fnCuts];
594 fTreeMesonsInvMassPtDcazMinDcazMaxFlag = new TTree*[fnCuts];
595 }
596 if (fDoMesonQA > 0){
597 fHistoMotherPi0PtY = new TH2F*[fnCuts];
598 fHistoMotherEtaPtY = new TH2F*[fnCuts];
599 fHistoMotherPi0PtAlpha = new TH2F*[fnCuts];
600 fHistoMotherEtaPtAlpha = new TH2F*[fnCuts];
601 fHistoMotherPi0PtOpenAngle = new TH2F*[fnCuts];
602 fHistoMotherEtaPtOpenAngle = new TH2F*[fnCuts];
603 }
20af4b69 604 if(fDoMesonQA == 1){
605 fHistoMotherInvMassECalib = new TH2F*[fnCuts];
606 fHistoMotherInvMassECalibalpha = new TH2F*[fnCuts];
607 }
8bdca7f1 608 }
609 fTagOutputList = new TList*[fnCuts];
610
611 fHistoConvGammaUntagged = new TH1F*[fnCuts];
612 fHistoConvGammaTagged = new TH1F*[fnCuts];
613 fHistoConvGammaPi0Tagged = new TH1F*[fnCuts];
614 fHistoConvGammaEtaTagged = new TH1F*[fnCuts];
615 fHistoPhotonPairAll = new TH2F*[fnCuts];
616 fHistoPhotonPairAllGam = new TH2F*[fnCuts];
617
618 fHistoClusGammaPt = new TH1F*[fnCuts];
619
620 for(Int_t iCut = 0; iCut<fnCuts;iCut++){
344100c4 621 TString cutstringEvent = ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber();
622 TString cutstringPhoton = ((AliConversionPhotonCuts*)fCutArray->At(iCut))->GetCutNumber();
623 TString cutstringCalo = ((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetCutNumber();
624 TString cutstringMeson = "NoMesonCut";
8bdca7f1 625 if(fDoMesonAnalysis)cutstringMeson = ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutNumber();
626
627 fCutFolder[iCut] = new TList();
344100c4 628 fCutFolder[iCut]->SetName(Form("Cut Number %s_%s_%s_%s",cutstringEvent.Data(),cutstringPhoton.Data(),cutstringCalo.Data(),cutstringMeson.Data()));
8bdca7f1 629 fCutFolder[iCut]->SetOwner(kTRUE);
630 fOutputContainer->Add(fCutFolder[iCut]);
631 fESDList[iCut] = new TList();
344100c4 632 fESDList[iCut]->SetName(Form("%s_%s_%s_%s ESD histograms",cutstringEvent.Data(),cutstringPhoton.Data(),cutstringCalo.Data(),cutstringMeson.Data()));
8bdca7f1 633 fESDList[iCut]->SetOwner(kTRUE);
634 fCutFolder[iCut]->Add(fESDList[iCut]);
635
636 fHistoNEvents[iCut] = new TH1I("NEvents","NEvents",9,-0.5,8.5);
637 fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(1,"Accepted");
638 fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(2,"Centrality");
639 fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(3,"Missing MC");
344100c4 640 if (((AliConvEventCuts*)fEventCutArray->At(iCut))->IsSpecialTrigger() == 4 ){
8bdca7f1 641 TString TriggerNames = "Not Trigger: ";
344100c4 642 TriggerNames = TriggerNames+ ( (AliConvEventCuts*)fEventCutArray->At(iCut))->GetSpecialTriggerName();
8bdca7f1 643 fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(4,TriggerNames.Data());
644 } else {
645 fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(4,"Trigger");
646 }
647 fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(5,"Vertex Z");
648 fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(6,"Cont. Vertex");
649 fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(7,"Pile-Up");
650 fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(8,"no SDD");
651 fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(9,"no V0AND");
652 fESDList[iCut]->Add(fHistoNEvents[iCut]);
653
654 if(fIsHeavyIon == 1) fHistoNGoodESDTracks[iCut] = new TH1I("GoodESDTracks","GoodESDTracks",4000,0,4000);
655 else if(fIsHeavyIon == 2) fHistoNGoodESDTracks[iCut] = new TH1I("GoodESDTracks","GoodESDTracks",400,0,400);
656 else fHistoNGoodESDTracks[iCut] = new TH1I("GoodESDTracks","GoodESDTracks",200,0,200);
657 fESDList[iCut]->Add(fHistoNGoodESDTracks[iCut]);
658 if(fIsHeavyIon == 1) fHistoNGammaCandidates[iCut] = new TH1I("GammaCandidates","GammaCandidates",100,0,100);
659 else if(fIsHeavyIon == 2) fHistoNGammaCandidates[iCut] = new TH1I("GammaCandidates","GammaCandidates",50,0,50);
660 else fHistoNGammaCandidates[iCut] = new TH1I("GammaCandidates","GammaCandidates",50,0,50);
661 fESDList[iCut]->Add(fHistoNGammaCandidates[iCut]);
662 if(fIsHeavyIon == 1) fHistoNGoodESDTracksVsNGammaCanditates[iCut] = new TH2F("GoodESDTracksVsGammaCandidates","GoodESDTracksVsGammaCandidates",4000,0,4000,100,0,100);
663 else if(fIsHeavyIon == 2) fHistoNGoodESDTracksVsNGammaCanditates[iCut] = new TH2F("GoodESDTracksVsGammaCandidates","GoodESDTracksVsGammaCandidates",400,0,400,50,0,50);
664 else fHistoNGoodESDTracksVsNGammaCanditates[iCut] = new TH2F("GoodESDTracksVsGammaCandidates","GoodESDTracksVsGammaCandidates",200,0,200,50,0,50);
665 fESDList[iCut]->Add(fHistoNGoodESDTracksVsNGammaCanditates[iCut]);
666
667
668 if(fIsHeavyIon == 1) fHistoNV0Tracks[iCut] = new TH1I("V0 Multiplicity","V0 Multiplicity",30000,0,30000);
669 else if(fIsHeavyIon == 2) fHistoNV0Tracks[iCut] = new TH1I("V0 Multiplicity","V0 Multiplicity",2500,0,2500);
670 else fHistoNV0Tracks[iCut] = new TH1I("V0 Multiplicity","V0 Multiplicity",1500,0,1500);
671 fESDList[iCut]->Add(fHistoNV0Tracks[iCut]);
672 fProfileEtaShift[iCut] = new TProfile("Eta Shift","Eta Shift",1, -0.5,0.5);
673 fESDList[iCut]->Add(fProfileEtaShift[iCut]);
674 fHistoConvGammaPt[iCut] = new TH1F("ESD_ConvGamma_Pt","ESD_ConvGamma_Pt",250,0,25);
675 fESDList[iCut]->Add(fHistoConvGammaPt[iCut]);
676
677 if (fDoPhotonQA == 2){
678 fPhotonDCAList[iCut] = new TList();
344100c4 679 fPhotonDCAList[iCut]->SetName(Form("%s_%s_%s_%s Photon DCA tree",cutstringEvent.Data(),cutstringPhoton.Data(),cutstringCalo.Data(),cutstringMeson.Data()));
8bdca7f1 680 fPhotonDCAList[iCut]->SetOwner(kTRUE);
681 fCutFolder[iCut]->Add(fPhotonDCAList[iCut]);
682
683 fTreeConvGammaPtDcazCat[iCut] = new TTree("ESD_ConvGamma_Pt_Dcaz_R_Eta","ESD_ConvGamma_Pt_Dcaz_R_Eta_Cat");
684 fTreeConvGammaPtDcazCat[iCut]->Branch("Pt",&fPtGamma,"fPtGamma/F");
685 fTreeConvGammaPtDcazCat[iCut]->Branch("DcaZPhoton",&fDCAzPhoton,"fDCAzPhoton/F");
686 // fTreeConvGammaPtDcazCat[iCut]->Branch("R",&fRConvPhoton,"fRConvPhoton/F");
687 // fTreeConvGammaPtDcazCat[iCut]->Branch("Eta",&fEtaPhoton,"fEtaPhoton/F");
688
689 fTreeConvGammaPtDcazCat[iCut]->Branch("cat",&fCharCatPhoton,"fCharCatPhoton/b");
690 if(fIsMC){
691 fTreeConvGammaPtDcazCat[iCut]->Branch("photonMCInfo",&fCharPhotonMCInfo,"fCharPhotonMCInfo/b");
692 }
693 fPhotonDCAList[iCut]->Add(fTreeConvGammaPtDcazCat[iCut]);
694 }
695
696 if (fDoPhotonQA > 0){
697 fHistoConvGammaR[iCut] = new TH1F("ESD_ConvGamma_R","ESD_ConvGamma_R",800,0,200);
698 fESDList[iCut]->Add(fHistoConvGammaR[iCut]);
699 fHistoConvGammaEta[iCut] = new TH1F("ESD_ConvGamma_Eta","ESD_ConvGamma_Eta",2000,-2,2);
700 fESDList[iCut]->Add(fHistoConvGammaEta[iCut]);
701 }
702
703 fTagOutputList[iCut] = new TList();
344100c4 704 fTagOutputList[iCut]->SetName(Form("%s_%s_%s_%s Tagging Output",cutstringEvent.Data(),cutstringPhoton.Data(),cutstringCalo.Data(),cutstringMeson.Data()));
8bdca7f1 705 fTagOutputList[iCut]->SetOwner(1);
706 fCutFolder[iCut]->Add(fTagOutputList[iCut]);
707
708 const Int_t nptbins = 200;
709 const Double_t ptmin = 0.;
710 const Double_t ptmax = 20.;
711
712 const Int_t nmbins = 180;
713 const Double_t mmin = 0.;
714 const Double_t mmax = 0.9;
715
716 // photon candidates
717 // this is maybe not necessary ...
718
719 fHistoConvGammaUntagged[iCut] = new TH1F("ConvGammaUntagged","",nptbins,ptmin,ptmax);
720 fHistoConvGammaUntagged[iCut]->SetXTitle("p_{T} (GeV/c)");
721 fTagOutputList[iCut]->Add(fHistoConvGammaUntagged[iCut]);
722
723 fHistoConvGammaTagged[iCut] = new TH1F("ConvGammaTagged","",nptbins,ptmin,ptmax);
724 fHistoConvGammaTagged[iCut]->SetXTitle("p_{T} (GeV/c)");
725 fTagOutputList[iCut]->Add(fHistoConvGammaTagged[iCut]);
726
727 fHistoConvGammaPi0Tagged[iCut] = new TH1F("ConvGammaPi0Tagged","",nptbins,ptmin,ptmax);
728 fHistoConvGammaPi0Tagged[iCut]->SetXTitle("p_{T} (GeV/c)");
729 fTagOutputList[iCut]->Add(fHistoConvGammaPi0Tagged[iCut]);
730
731 fHistoConvGammaEtaTagged[iCut] = new TH1F("ConvGammaEtaTagged","",nptbins,ptmin,ptmax);
732 fHistoConvGammaEtaTagged[iCut]->SetXTitle("p_{T} (GeV/c)");
733 fTagOutputList[iCut]->Add(fHistoConvGammaEtaTagged[iCut]);
734
735 // pairs
736 fHistoPhotonPairAll[iCut] = new TH2F("PhotonPairAll","",nmbins,mmin,mmax,nptbins,ptmin,ptmax);
737 fHistoPhotonPairAll[iCut]->SetXTitle("M_{inv} (GeV/cc)");
738 fHistoPhotonPairAll[iCut]->SetYTitle("p_{T} (GeV/c)");
739 fTagOutputList[iCut]->Add(fHistoPhotonPairAll[iCut]);
740
741 fHistoPhotonPairAllGam[iCut] = new TH2F("PhotonPairAllGammaConvPt","",nmbins,mmin,mmax,nptbins,ptmin,ptmax);
742 fHistoPhotonPairAllGam[iCut]->SetXTitle("M_{inv} (GeV/cc)");
743 fHistoPhotonPairAllGam[iCut]->SetYTitle("#gamma^{conv} p_{T} (GeV/c)");
744 fTagOutputList[iCut]->Add(fHistoPhotonPairAllGam[iCut]);
745
746 fHistoClusGammaPt[iCut] = new TH1F("ClusGamma_Pt","ClusGamma_Pt",250,0,25);
747 fTagOutputList[iCut]->Add(fHistoClusGammaPt[iCut]);
748
749
750 if(fDoMesonAnalysis){
751 fHistoMotherInvMassPt[iCut] = new TH2F("ESD_Mother_InvMass_Pt","ESD_Mother_InvMass_Pt",800,0,0.8,250,0,25);
752 fESDList[iCut]->Add(fHistoMotherInvMassPt[iCut]);
d53bf4ac 753 fHistoMotherMatchedInvMassPt[iCut] = new TH2F("ESD_MotherMatched_InvMass_Pt","ESD_MotherMatched_InvMass_Pt",800,0,0.8,250,0,25);
754 fESDList[iCut]->Add(fHistoMotherMatchedInvMassPt[iCut]);
8bdca7f1 755 fHistoMotherBackInvMassPt[iCut] = new TH2F("ESD_Background_InvMass_Pt","ESD_Background_InvMass_Pt",800,0,0.8,250,0,25);
756 fESDList[iCut]->Add(fHistoMotherBackInvMassPt[iCut]);
757 fHistoMotherInvMassEalpha[iCut] = new TH2F("ESD_Mother_InvMass_vs_E_alpha","ESD_Mother_InvMass_vs_E_alpha",800,0,0.8,250,0,25);
758 fESDList[iCut]->Add(fHistoMotherInvMassEalpha[iCut]);
759 if (fDoMesonQA == 2){
760 fMesonDCAList[iCut] = new TList();
344100c4 761 fMesonDCAList[iCut]->SetName(Form("%s_%s_%s_%s Meson DCA tree",cutstringEvent.Data(),cutstringPhoton.Data(),cutstringCalo.Data(),cutstringMeson.Data()));
8bdca7f1 762 fMesonDCAList[iCut]->SetOwner(kTRUE);
763 fCutFolder[iCut]->Add(fMesonDCAList[iCut]);
764
765 fTreeMesonsInvMassPtDcazMinDcazMaxFlag[iCut] = new TTree("ESD_Mesons_InvMass_Pt_DcazMin_DcazMax_Flag","ESD_Mesons_InvMass_Pt_DcazMin_DcazMax_Flag");
766 fTreeMesonsInvMassPtDcazMinDcazMaxFlag[iCut]->Branch("InvMass",&fInvMass,"fInvMass/F");
767 fTreeMesonsInvMassPtDcazMinDcazMaxFlag[iCut]->Branch("Pt",&fPt,"fPt/F");
768 fTreeMesonsInvMassPtDcazMinDcazMaxFlag[iCut]->Branch("DcaZMin",&fDCAzGammaMin,"fDCAzGammaMin/F");
769 fTreeMesonsInvMassPtDcazMinDcazMaxFlag[iCut]->Branch("DcaZMax",&fDCAzGammaMax,"fDCAzGammaMax/F");
770 fTreeMesonsInvMassPtDcazMinDcazMaxFlag[iCut]->Branch("kind",&fCharFlag,"fCharFlag/b");
771 if(fIsMC){
772 fTreeMesonsInvMassPtDcazMinDcazMaxFlag[iCut]->Branch("mesonMCInfo",&fCharMesonMCInfo,"fCharMesonMCInfo/b");
773 }
774 fMesonDCAList[iCut]->Add(fTreeMesonsInvMassPtDcazMinDcazMaxFlag[iCut]);
775
776 }
20af4b69 777 if(fDoMesonQA == 1){
778 fHistoMotherInvMassECalib[iCut] = new TH2F("ESD_Mother_InvMass_Pt_Calib","ESD_Mother_InvMass_Pt_Calib",800,0,0.8,250,0,25);
779 fESDList[iCut]->Add(fHistoMotherInvMassECalib[iCut]);
780 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);
781 fESDList[iCut]->Add(fHistoMotherInvMassECalibalpha[iCut]);
782 }
783
8bdca7f1 784 if (fDoMesonQA > 0 ){
785 fHistoMotherPi0PtY[iCut] = new TH2F("ESD_MotherPi0_Pt_Y","ESD_MotherPi0_Pt_Y",150,0.03,15.,150,-1.5,1.5);
786 SetLogBinningXTH2(fHistoMotherPi0PtY[iCut]);
787 fESDList[iCut]->Add(fHistoMotherPi0PtY[iCut]);
788 fHistoMotherEtaPtY[iCut] = new TH2F("ESD_MotherEta_Pt_Y","ESD_MotherEta_Pt_Y",150,0.03,15.,150,-1.5,1.5);
789 SetLogBinningXTH2(fHistoMotherEtaPtY[iCut]);
790 fESDList[iCut]->Add(fHistoMotherEtaPtY[iCut]);
791 fHistoMotherPi0PtAlpha[iCut] = new TH2F("ESD_MotherPi0_Pt_Alpha","ESD_MotherPi0_Pt_Alpha",150,0.03,15.,100,0,1);
792 SetLogBinningXTH2(fHistoMotherPi0PtAlpha[iCut]);
793 fESDList[iCut]->Add(fHistoMotherPi0PtAlpha[iCut]);
794 fHistoMotherEtaPtAlpha[iCut] = new TH2F("ESD_MotherEta_Pt_Alpha","ESD_MotherEta_Pt_Alpha",150,0.03,15.,100,0,1);
795 SetLogBinningXTH2(fHistoMotherEtaPtAlpha[iCut]);
796 fESDList[iCut]->Add(fHistoMotherEtaPtAlpha[iCut]);
797 fHistoMotherPi0PtOpenAngle[iCut] = new TH2F("ESD_MotherPi0_Pt_OpenAngle","ESD_MotherPi0_Pt_OpenAngle",150,0.03,15.,200,0,2*TMath::Pi());
798 SetLogBinningXTH2(fHistoMotherPi0PtOpenAngle[iCut]);
799 fESDList[iCut]->Add(fHistoMotherPi0PtOpenAngle[iCut]);
800 fHistoMotherEtaPtOpenAngle[iCut] = new TH2F("ESD_MotherEta_Pt_OpenAngle","ESD_MotherEta_Pt_OpenAngle",150,0.03,15.,200,0,2*TMath::Pi());
801 SetLogBinningXTH2(fHistoMotherEtaPtOpenAngle[iCut]);
802 fESDList[iCut]->Add(fHistoMotherEtaPtOpenAngle[iCut]);
803 }
804 }
805 }
806 if(fDoMesonAnalysis){
807 InitBack(); // Init Background Handler
808 }
809
810 if(fIsMC){
811 // MC Histogramms
fd94f234 812 fMCList = new TList*[fnCuts];
8bdca7f1 813 // True Histogramms
fd94f234 814 fTrueList = new TList*[fnCuts];
8bdca7f1 815 // Selected Header List
fd94f234 816 fHeaderNameList = new TList*[fnCuts];
817 fHistoMCHeaders = new TH1I*[fnCuts];
818 fHistoMCAllGammaPt = new TH1F*[fnCuts];
20af4b69 819 fHistoMCAllGammaEMCALAccPt = new TH1F*[fnCuts];
fd94f234 820 fHistoMCDecayGammaPi0Pt = new TH1F*[fnCuts];
821 fHistoMCDecayGammaRhoPt = new TH1F*[fnCuts];
822 fHistoMCDecayGammaEtaPt = new TH1F*[fnCuts];
823 fHistoMCDecayGammaOmegaPt = new TH1F*[fnCuts];
824 fHistoMCDecayGammaEtapPt = new TH1F*[fnCuts];
825 fHistoMCDecayGammaPhiPt = new TH1F*[fnCuts];
826 fHistoMCDecayGammaSigmaPt = new TH1F*[fnCuts];
827 fHistoMCConvGammaPt = new TH1F*[fnCuts];
828 fHistoTrueConvGammaPt = new TH1F*[fnCuts];
829 fHistoTrueConvPi0GammaPt = new TH1F*[fnCuts];
8bdca7f1 830
fd94f234 831 fHistoCombinatorialPt = new TH2F*[fnCuts];
832 fHistoTruePrimaryConvGammaPt = new TH1F*[fnCuts];
833 fHistoTruePrimaryConvGammaESDPtMCPt = new TH2F*[fnCuts];
834 fHistoTrueSecondaryConvGammaPt = new TH1F*[fnCuts];
835 fHistoTrueSecondaryConvGammaFromXFromK0sPt = new TH1F*[fnCuts];
836 fHistoTrueSecondaryConvGammaFromXFromLambdaPt = new TH1F*[fnCuts];
8bdca7f1 837
fd94f234 838 fHistoTrueClusGammaPt = new TH1F*[fnCuts];
839 fHistoTruePrimaryClusGammaPt = new TH1F*[fnCuts];
8bdca7f1 840 fHistoTruePrimaryClusGammaESDPtMCPt = new TH2F*[fnCuts];
841
842 if (fDoPhotonQA > 0){
fd94f234 843 fHistoMCConvGammaR = new TH1F*[fnCuts];
844 fHistoMCConvGammaEta = new TH1F*[fnCuts];
845 fHistoTrueConvGammaEta = new TH1F*[fnCuts];
846 }
847 if (fDoClusterQA > 0){
848 fHistoTrueClusUnConvGammaPt = new TH1F*[fnCuts];
20af4b69 849 fHistoTrueClusUnConvGammaMCPt = new TH1F*[fnCuts];
fd94f234 850 fHistoTrueClusElectronPt = new TH1F*[fnCuts];
851 fHistoTrueClusConvGammaPt = new TH1F*[fnCuts];
20af4b69 852 fHistoTrueClusConvGammaMCPt = new TH1F*[fnCuts];
fd94f234 853 fHistoTrueClusConvGammaFullyPt = new TH1F*[fnCuts];
854 fHistoTrueClusMergedGammaPt = new TH1F*[fnCuts];
855 fHistoTrueClusMergedPartConvGammaPt = new TH1F*[fnCuts];
856 fHistoTrueClusDalitzPt = new TH1F*[fnCuts];
857 fHistoTrueClusDalitzMergedPt = new TH1F*[fnCuts];
858 fHistoTrueClusPhotonFromElecMotherPt= new TH1F*[fnCuts];
859 fHistoTrueClusShowerPt = new TH1F*[fnCuts];
cc579963 860 fHistoTrueClusSubLeadingPt = new TH1F*[fnCuts];
861 fHistoTrueClusNParticles = new TH1I*[fnCuts];
fd94f234 862 fHistoTrueClusEMNonLeadingPt = new TH1F*[fnCuts];
863 fHistoTrueNLabelsInClus = new TH1F*[fnCuts];
8bdca7f1 864 }
865
866 if(fDoMesonAnalysis){
fd94f234 867 fHistoMCPi0Pt = new TH1F*[fnCuts];
868 fHistoMCPi0WOWeightPt = new TH1F*[fnCuts];
869 fHistoMCEtaPt = new TH1F*[fnCuts];
870 fHistoMCEtaWOWeightPt = new TH1F*[fnCuts];
871 fHistoMCPi0InAccPt = new TH1F*[fnCuts];
872 fHistoMCEtaInAccPt = new TH1F*[fnCuts];
8bdca7f1 873
fd94f234 874 fHistoTrueMotherInvMassPt = new TH2F*[fnCuts];
875 fHistoTruePrimaryMotherInvMassPt = new TH2F*[fnCuts];
8bdca7f1 876 fHistoTruePrimaryMotherW0WeightingInvMassPt = new TH2F*[fnCuts];
fd94f234 877 fProfileTruePrimaryMotherWeightsInvMassPt = new TProfile2D*[fnCuts];
878 fHistoTrueSecondaryMotherInvMassPt = new TH2F*[fnCuts];
879 fHistoTrueSecondaryMotherFromK0sInvMassPt = new TH2F*[fnCuts];
880 fHistoTrueSecondaryMotherFromEtaInvMassPt = new TH2F*[fnCuts];
8bdca7f1 881 fHistoTrueSecondaryMotherFromLambdaInvMassPt = new TH2F*[fnCuts];
8bdca7f1 882 if (fDoMesonQA > 0){
fd94f234 883 fHistoMCPi0PtY = new TH2F*[fnCuts];
884 fHistoMCEtaPtY = new TH2F*[fnCuts];
885 fHistoMCK0sPt = new TH1F*[fnCuts];
886 fHistoMCK0sWOWeightPt = new TH1F*[fnCuts];
887 fHistoMCK0sPtY = new TH2F*[fnCuts];
888 fHistoMCSecPi0PtvsSource = new TH2F*[fnCuts];
889 fHistoMCSecPi0Source = new TH1F*[fnCuts];
890 fHistoMCSecEtaPt = new TH1F*[fnCuts];
891 fHistoMCSecEtaSource = new TH1F*[fnCuts];
892 fHistoTrueMotherCaloPhotonInvMassPt = new TH2F*[fnCuts];
893 fHistoTrueMotherCaloConvertedPhotonInvMassPt= new TH2F*[fnCuts];
20af4b69 894 fHistoTruePi0CaloConvertedPhotonInvMassPt = new TH2F*[fnCuts];
895 fHistoTruePi0CaloConvertedPhotonMatchedInvMassPt = new TH2F*[fnCuts];
896 fHistoTrueEtaCaloConvertedPhotonInvMassPt = new TH2F*[fnCuts];
897 fHistoTrueEtaCaloConvertedPhotonMatchedInvMassPt = new TH2F*[fnCuts];
fd94f234 898 fHistoTrueMotherCaloElectronInvMassPt = new TH2F*[fnCuts];
899 fHistoTrueMotherCaloMergedClusterInvMassPt = new TH2F*[fnCuts];
900 fHistoTrueMotherCaloMergedClusterPartConvInvMassPt = new TH2F*[fnCuts];
901 fHistoTrueMotherCaloEMNonLeadingInvMassPt = new TH2F*[fnCuts];
902 fHistoTruePrimaryPi0MCPtResolPt = new TH2F*[fnCuts];
903 fHistoTruePrimaryEtaMCPtResolPt = new TH2F*[fnCuts];
904 fHistoTrueK0sWithPi0DaughterMCPt = new TH1F*[fnCuts];
905 fHistoTrueEtaWithPi0DaughterMCPt = new TH1F*[fnCuts];
906 fHistoTrueLambdaWithPi0DaughterMCPt = new TH1F*[fnCuts];
907 fHistoTrueBckGGInvMassPt = new TH2F*[fnCuts];
908 fHistoTrueBckContInvMassPt = new TH2F*[fnCuts];
909 fHistoTruePi0PtY = new TH2F*[fnCuts];
910 fHistoTrueEtaPtY = new TH2F*[fnCuts];
911 fHistoTruePi0PtAlpha = new TH2F*[fnCuts];
912 fHistoTrueEtaPtAlpha = new TH2F*[fnCuts];
913 fHistoTruePi0PtOpenAngle = new TH2F*[fnCuts];
914 fHistoTrueEtaPtOpenAngle = new TH2F*[fnCuts];
8bdca7f1 915 }
916 }
917
918
919
920 for(Int_t iCut = 0; iCut<fnCuts;iCut++){
344100c4 921 TString cutstringEvent = ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber();
922 TString cutstringPhoton = ((AliConversionPhotonCuts*)fCutArray->At(iCut))->GetCutNumber();
923 TString cutstringCalo = ((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetCutNumber();
924 TString cutstringMeson = "NoMesonCut";
8bdca7f1 925 if(fDoMesonAnalysis)cutstringMeson = ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutNumber();
926
927 fMCList[iCut] = new TList();
344100c4 928 fMCList[iCut]->SetName(Form("%s_%s_%s_%s MC histograms",cutstringEvent.Data(),cutstringPhoton.Data(),cutstringCalo.Data(),cutstringMeson.Data()));
8bdca7f1 929 fMCList[iCut]->SetOwner(kTRUE);
930 fCutFolder[iCut]->Add(fMCList[iCut]);
931 fHistoMCHeaders[iCut] = new TH1I("MC_Headers","MC_Headers",20,0,20);
932 fMCList[iCut]->Add(fHistoMCHeaders[iCut]);
933 fHistoMCAllGammaPt[iCut] = new TH1F("MC_AllGamma_Pt","MC_AllGamma_Pt",250,0,25);
934 fMCList[iCut]->Add(fHistoMCAllGammaPt[iCut]);
20af4b69 935 fHistoMCAllGammaEMCALAccPt[iCut] = new TH1F("MC_AllGammaEMCALAcc_Pt","MC_AllGamma_Pt",250,0,25);
936 fMCList[iCut]->Add(fHistoMCAllGammaEMCALAccPt[iCut]);
8bdca7f1 937 fHistoMCDecayGammaPi0Pt[iCut] = new TH1F("MC_DecayGammaPi0_Pt","MC_DecayGammaPi0_Pt",250,0,25);
938 fMCList[iCut]->Add(fHistoMCDecayGammaPi0Pt[iCut]);
939 fHistoMCDecayGammaRhoPt[iCut] = new TH1F("MC_DecayGammaRho_Pt","MC_DecayGammaRho_Pt",250,0,25);
940 fMCList[iCut]->Add(fHistoMCDecayGammaRhoPt[iCut]);
941 fHistoMCDecayGammaEtaPt[iCut] = new TH1F("MC_DecayGammaEta_Pt","MC_DecayGammaEta_Pt",250,0,25);
942 fMCList[iCut]->Add(fHistoMCDecayGammaEtaPt[iCut]);
943 fHistoMCDecayGammaOmegaPt[iCut] = new TH1F("MC_DecayGammaOmega_Pt","MC_DecayGammaOmmega_Pt",250,0,25);
944 fMCList[iCut]->Add(fHistoMCDecayGammaOmegaPt[iCut]);
945 fHistoMCDecayGammaEtapPt[iCut] = new TH1F("MC_DecayGammaEtap_Pt","MC_DecayGammaEtap_Pt",250,0,25);
946 fMCList[iCut]->Add(fHistoMCDecayGammaEtapPt[iCut]);
947 fHistoMCDecayGammaPhiPt[iCut] = new TH1F("MC_DecayGammaPhi_Pt","MC_DecayGammaPhi_Pt",250,0,25);
948 fMCList[iCut]->Add(fHistoMCDecayGammaPhiPt[iCut]);
949 fHistoMCDecayGammaSigmaPt[iCut] = new TH1F("MC_DecayGammaSigma_Pt","MC_DecayGammaSigma_Pt",250,0,25);
950 fMCList[iCut]->Add(fHistoMCDecayGammaSigmaPt[iCut]);
951 fHistoMCConvGammaPt[iCut] = new TH1F("MC_ConvGamma_Pt","MC_ConvGamma_Pt",250,0,25);
952 fMCList[iCut]->Add(fHistoMCConvGammaPt[iCut]);
953
954 if (fDoPhotonQA > 0){
955 fHistoMCConvGammaR[iCut] = new TH1F("MC_ConvGamma_R","MC_ConvGamma_R",800,0,200);
956 fMCList[iCut]->Add(fHistoMCConvGammaR[iCut]);
957 fHistoMCConvGammaEta[iCut] = new TH1F("MC_ConvGamma_Eta","MC_ConvGamma_Eta",2000,-2,2);
958 fMCList[iCut]->Add(fHistoMCConvGammaEta[iCut]);
959 }
960
961 if(fDoMesonAnalysis){
962 fHistoMCPi0Pt[iCut] = new TH1F("MC_Pi0_Pt","MC_Pi0_Pt",250,0,25);
963 fHistoMCPi0Pt[iCut]->Sumw2();
964 fMCList[iCut]->Add(fHistoMCPi0Pt[iCut]);
965 fHistoMCPi0WOWeightPt[iCut] = new TH1F("MC_Pi0_WOWeights_Pt","MC_Pi0_WOWeights_Pt",250,0,25);
966 fHistoMCPi0WOWeightPt[iCut]->Sumw2();
967 fMCList[iCut]->Add(fHistoMCPi0WOWeightPt[iCut]);
968
969 fHistoMCEtaPt[iCut] = new TH1F("MC_Eta_Pt","MC_Eta_Pt",250,0,25);
970 fHistoMCEtaPt[iCut]->Sumw2();
971 fMCList[iCut]->Add(fHistoMCEtaPt[iCut]);
972 fHistoMCEtaWOWeightPt[iCut] = new TH1F("MC_Eta_WOWeights_Pt","MC_Eta_WOWeights_Pt",250,0,25);
973 fHistoMCEtaWOWeightPt[iCut]->Sumw2();
974 fMCList[iCut]->Add(fHistoMCEtaWOWeightPt[iCut]);
975 fHistoMCPi0InAccPt[iCut] = new TH1F("MC_Pi0InAcc_Pt","MC_Pi0InAcc_Pt",250,0,25);
976 fHistoMCPi0InAccPt[iCut]->Sumw2();
977 fMCList[iCut]->Add(fHistoMCPi0InAccPt[iCut]);
978 fHistoMCEtaInAccPt[iCut] = new TH1F("MC_EtaInAcc_Pt","MC_EtaInAcc_Pt",250,0,25);
979 fHistoMCEtaInAccPt[iCut]->Sumw2();
980 fMCList[iCut]->Add(fHistoMCEtaInAccPt[iCut]);
981 if (fDoMesonQA > 0){
982 fHistoMCPi0PtY[iCut] = new TH2F("MC_Pi0_Pt_Y","MC_Pi0_Pt_Y",150,0.03,15.,150,-1.5,1.5);
983 fHistoMCPi0PtY[iCut]->Sumw2();
984 SetLogBinningXTH2(fHistoMCPi0PtY[iCut]);
985 fMCList[iCut]->Add(fHistoMCPi0PtY[iCut]);
986 fHistoMCEtaPtY[iCut] = new TH2F("MC_Eta_Pt_Y","MC_Eta_Pt_Y",150,0.03,15.,150,-1.5,1.5);
987 fHistoMCEtaPtY[iCut]->Sumw2();
988 SetLogBinningXTH2(fHistoMCEtaPtY[iCut]);
989 fMCList[iCut]->Add(fHistoMCEtaPtY[iCut]);
990 fHistoMCK0sPt[iCut] = new TH1F("MC_K0s_Pt","MC_K0s_Pt",150,0,15);
991 fHistoMCK0sPt[iCut]->Sumw2();
992 fMCList[iCut]->Add(fHistoMCK0sPt[iCut]);
993 fHistoMCK0sWOWeightPt[iCut] = new TH1F("MC_K0s_WOWeights_Pt","MC_K0s_WOWeights_Pt",150,0,15);
994 fHistoMCK0sWOWeightPt[iCut]->Sumw2();
995 fMCList[iCut]->Add(fHistoMCK0sWOWeightPt[iCut]);
996 fHistoMCK0sPtY[iCut] = new TH2F("MC_K0s_Pt_Y","MC_K0s_Pt_Y",150,0.03,15.,150,-1.5,1.5);
997 fHistoMCK0sPtY[iCut]->Sumw2();
998 SetLogBinningXTH2(fHistoMCK0sPtY[iCut]);
999 fMCList[iCut]->Add(fHistoMCK0sPtY[iCut]);
1000
1001 fHistoMCSecPi0Source[iCut] = new TH1F("MC_SecPi0_Source","MC_SecPi0_Source",5000,0.,5000);
1002 fMCList[iCut]->Add(fHistoMCSecPi0Source[iCut]);
1003 fHistoMCSecEtaSource[iCut] = new TH1F("MC_SecEta_Source","MC_SecEta_Source",5000,0,5000);
1004 fMCList[iCut]->Add(fHistoMCSecEtaSource[iCut]);
1005 fHistoMCSecPi0PtvsSource[iCut] = new TH2F("MC_SecPi0_Pt_Source","MC_SecPi0_Pt_Source",250,0.0,25.,16,-0.5,15.5);
1006 fHistoMCSecPi0PtvsSource[iCut]->Sumw2();
1007 fMCList[iCut]->Add(fHistoMCSecPi0PtvsSource[iCut]);
1008 fHistoMCSecEtaPt[iCut] = new TH1F("MC_SecEta_Pt","MC_SecEta_Pt",250,0,25);
1009 fHistoMCSecEtaPt[iCut]->Sumw2();
1010 fMCList[iCut]->Add(fHistoMCSecEtaPt[iCut]);
1011 }
1012
1013 }
1014 fTrueList[iCut] = new TList();
344100c4 1015 fTrueList[iCut]->SetName(Form("%s_%s_%s_%s True histograms",cutstringEvent.Data(),cutstringPhoton.Data(),cutstringCalo.Data(),cutstringMeson.Data()));
8bdca7f1 1016 fTrueList[iCut]->SetOwner(kTRUE);
1017 fCutFolder[iCut]->Add(fTrueList[iCut]);
1018
1019 fHistoTrueConvGammaPt[iCut] = new TH1F("ESD_TrueConvGamma_Pt","ESD_TrueConvGamma_Pt",250,0,25);
1020 fTrueList[iCut]->Add(fHistoTrueConvGammaPt[iCut]);
1021
1022 fHistoTrueConvPi0GammaPt[iCut] = new TH1F("ESD_TrueConvGamma_Pt","ESD_TrueConvGamma_Pt",250,0,25);
1023 fTrueList[iCut]->Add(fHistoTrueConvPi0GammaPt[iCut]);
1024
1025 fHistoCombinatorialPt[iCut] = new TH2F("ESD_TrueCombinatorial_Pt","ESD_TrueCombinatorial_Pt",250,0,25,16,-0.5,15.5);
1026 fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel( 1,"Elec+Elec");
1027 fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel( 2,"Elec+Pion");
1028 fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel( 3,"Elec+Kaon");
1029 fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel( 4,"Elec+Proton");
1030 fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel( 5,"Elec+Muon");
1031 fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel( 6,"Pion+Pion");
1032 fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel( 7,"Pion+Kaon");
1033 fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel( 8,"Pion+Proton");
1034 fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel( 9,"Pion+Muon");
1035 fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel(10,"Kaon+Kaon");
1036 fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel(11,"Kaon+Proton");
1037 fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel(12,"Kaon+Muon");
1038 fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel(13,"Proton+Proton");
1039 fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel(14,"Proton+Muon");
1040 fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel(15,"Muon+Muon");
1041 fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel(16,"Rest");
1042 fTrueList[iCut]->Add(fHistoCombinatorialPt[iCut]);
1043 fHistoTruePrimaryConvGammaPt[iCut] = new TH1F("ESD_TruePrimaryConvGamma_Pt","ESD_TruePrimaryConvGamma_Pt",250,0,25);
1044 fTrueList[iCut]->Add(fHistoTruePrimaryConvGammaPt[iCut]);
1045 fHistoTrueSecondaryConvGammaPt[iCut] = new TH1F("ESD_TrueSecondaryConvGamma_Pt","ESD_TrueSecondaryConvGamma_Pt",250,0,25);
1046 fTrueList[iCut]->Add(fHistoTrueSecondaryConvGammaPt[iCut]);
1047
1048 fHistoTrueSecondaryConvGammaFromXFromK0sPt[iCut] = new TH1F("ESD_TrueSecondaryConvGammaFromXFromK0s_Pt", "ESD_TrueSecondaryConvGammaFromXFromK0s_Pt",250,0,25);
1049 fTrueList[iCut]->Add(fHistoTrueSecondaryConvGammaFromXFromK0sPt[iCut]);
1050 fHistoTrueSecondaryConvGammaFromXFromLambdaPt[iCut] = new TH1F("ESD_TrueSecondaryConvGammaFromXFromLambda_Pt", "ESD_TrueSecondaryConvGammaFromXFromLambda_Pt",250,0,25);
1051 fTrueList[iCut]->Add(fHistoTrueSecondaryConvGammaFromXFromLambdaPt[iCut]);
fd94f234 1052
8bdca7f1 1053 fHistoTruePrimaryConvGammaESDPtMCPt[iCut] = new TH2F("ESD_TruePrimaryConvGammaESD_PtMCPt", "ESD_TruePrimaryConvGammaESD_PtMCPt",250,0,25,250,0,25);
1054 fTrueList[iCut]->Add(fHistoTruePrimaryConvGammaESDPtMCPt[iCut]);
1055
fd94f234 1056 fHistoTrueClusGammaPt[iCut] = new TH1F("TrueClusGamma_Pt","ESD_TrueClusGamma_Pt",250,0,25);
8bdca7f1 1057 fTagOutputList[iCut]->Add(fHistoTrueClusGammaPt[iCut]);
1058 fHistoTruePrimaryClusGammaPt[iCut] = new TH1F("TruePrimaryClusGamma_Pt","ESD_TruePrimaryClusGamma_Pt",250,0,25);
1059 fTagOutputList[iCut]->Add(fHistoTruePrimaryClusGammaPt[iCut]);
1060 fHistoTruePrimaryClusGammaESDPtMCPt[iCut] = new TH2F("TruePrimaryClusGamma_Pt_MCPt","ESD_TruePrimaryClusGamma_MCPt",250,0,25,250,0,25);
1061 fTagOutputList[iCut]->Add(fHistoTruePrimaryClusGammaESDPtMCPt[iCut]);
1062
fd94f234 1063 if (fDoPhotonQA > 0){
1064 fHistoTrueConvGammaEta[iCut] = new TH1F("ESD_TrueConvGamma_Eta","ESD_TrueConvGamma_Eta",2000,-2,2);
1065 fTrueList[iCut]->Add(fHistoTrueConvGammaEta[iCut]);
1066 }
1067 if (fDoClusterQA > 0){
1068 fHistoTrueClusUnConvGammaPt[iCut] = new TH1F("TrueClusUnConvGamma_Pt","TrueClusUnConvGamma_Pt",250,0,25);
1069 fTagOutputList[iCut]->Add(fHistoTrueClusUnConvGammaPt[iCut]);
20af4b69 1070 fHistoTrueClusUnConvGammaMCPt[iCut] = new TH1F("TrueClusUnConvGamma_MCPt","TrueClusUnConvGamma_MCPt",250,0,25);
1071 fTagOutputList[iCut]->Add(fHistoTrueClusUnConvGammaMCPt[iCut]);
fd94f234 1072 fHistoTrueClusElectronPt[iCut] = new TH1F("TrueClusElectron_Pt","TrueElectronGamma_Pt",250,0,25);
1073 fTagOutputList[iCut]->Add(fHistoTrueClusElectronPt[iCut]);
fd94f234 1074 fHistoTrueClusConvGammaPt[iCut] = new TH1F("TrueClusConvGamma_Pt","TrueClusConvGamma_Pt",250,0,25);
1075 fTagOutputList[iCut]->Add(fHistoTrueClusConvGammaPt[iCut]);
20af4b69 1076 fHistoTrueClusConvGammaMCPt[iCut] = new TH1F("TrueClusConvGamma_MCPt","TrueClusConvGamma_MCPt",250,0,25);
1077 fTagOutputList[iCut]->Add(fHistoTrueClusConvGammaMCPt[iCut]);
fd94f234 1078 fHistoTrueClusConvGammaFullyPt[iCut] = new TH1F("TrueClusConvGammaFullyContained_Pt","TrueClusConvGammaFullyContained_Pt",250,0,25);
1079 fTagOutputList[iCut]->Add(fHistoTrueClusConvGammaFullyPt[iCut]);
1080 fHistoTrueClusMergedGammaPt[iCut] = new TH1F("TrueClusMergedGamma_Pt","TrueClusMergedGamma_Pt",250,0,25);
1081 fTagOutputList[iCut]->Add(fHistoTrueClusMergedGammaPt[iCut]);
1082 fHistoTrueClusMergedPartConvGammaPt[iCut] = new TH1F("TrueClusMergedPartConvGamma_Pt","TrueClusMergedPartConvGamma_Pt",250,0,25);
1083 fTagOutputList[iCut]->Add(fHistoTrueClusMergedPartConvGammaPt[iCut]);
1084 fHistoTrueClusDalitzPt[iCut] = new TH1F("TrueClusDalitz_Pt","TrueClusDalitz_Pt",250,0,25);
1085 fTagOutputList[iCut]->Add(fHistoTrueClusDalitzPt[iCut]);
1086 fHistoTrueClusDalitzMergedPt[iCut] = new TH1F("TrueClusDalitzMerged_Pt","TrueClusDalitzMerged_Pt",250,0,25);
1087 fTagOutputList[iCut]->Add(fHistoTrueClusDalitzMergedPt[iCut]);
1088 fHistoTrueClusPhotonFromElecMotherPt[iCut] = new TH1F("TrueClusPhotonFromElecMother_Pt","TrueClusPhotonFromElecMother_Pt",250,0,25);
1089 fTagOutputList[iCut]->Add(fHistoTrueClusPhotonFromElecMotherPt[iCut]);
1090 fHistoTrueClusShowerPt[iCut] = new TH1F("TrueClusShower_Pt","TrueClusShower_Pt",250,0,25);
1091 fTagOutputList[iCut]->Add(fHistoTrueClusShowerPt[iCut]);
cc579963 1092 fHistoTrueClusSubLeadingPt[iCut] = new TH1F("TrueClusSubleading_Pt","TrueClusSubleading_Pt",250,0,25);
1093 fTagOutputList[iCut]->Add(fHistoTrueClusSubLeadingPt[iCut]);
1094 fHistoTrueClusNParticles[iCut] = new TH1I("TrueClusNParticles","TrueClusNParticles",20,0,20);
1095 fTagOutputList[iCut]->Add(fHistoTrueClusNParticles[iCut]);
fd94f234 1096 fHistoTrueClusEMNonLeadingPt[iCut] = new TH1F("TrueClusEMNonLeading_Pt","TrueClusEMNonLeading_Pt",250,0,25);
1097 fTagOutputList[iCut]->Add(fHistoTrueClusEMNonLeadingPt[iCut]);
1098 fHistoTrueNLabelsInClus[iCut] = new TH1F("TrueNLabelsInClus","TrueNLabelsInClus",100,-0.5,99.5);
1099 fTagOutputList[iCut]->Add(fHistoTrueNLabelsInClus[iCut]);
1100 }
1101
8bdca7f1 1102 if(fDoMesonAnalysis){
1103 fHistoTrueMotherInvMassPt[iCut] = new TH2F("ESD_TrueMother_InvMass_Pt","ESD_TrueMother_InvMass_Pt",800,0,0.8,250,0,25);
1104 fTrueList[iCut]->Add(fHistoTrueMotherInvMassPt[iCut]);
1105 fHistoTruePrimaryMotherInvMassPt[iCut] = new TH2F("ESD_TruePrimaryMother_InvMass_Pt", "ESD_TruePrimaryMother_InvMass_Pt", 800,0,0.8,250,0,25);
1106 fHistoTruePrimaryMotherInvMassPt[iCut]->Sumw2();
1107 fTrueList[iCut]->Add(fHistoTruePrimaryMotherInvMassPt[iCut]);
1108 fHistoTruePrimaryMotherW0WeightingInvMassPt[iCut] = new TH2F("ESD_TruePrimaryMotherW0Weights_InvMass_Pt", "ESD_TruePrimaryMotherW0Weights_InvMass_Pt", 800,0,0.8,250,0,25);
1109 fHistoTruePrimaryMotherW0WeightingInvMassPt[iCut]->Sumw2();
1110 fTrueList[iCut]->Add(fHistoTruePrimaryMotherW0WeightingInvMassPt[iCut]);
1111 fProfileTruePrimaryMotherWeightsInvMassPt[iCut] = new TProfile2D("ESD_TruePrimaryMotherWeights_InvMass_Pt", "ESD_TruePrimaryMotherWeights_InvMass_Pt", 800,0,0.8,250,0,25);
1112 fProfileTruePrimaryMotherWeightsInvMassPt[iCut]->Sumw2();
1113 fTrueList[iCut]->Add(fProfileTruePrimaryMotherWeightsInvMassPt[iCut]);
1114 fHistoTrueSecondaryMotherInvMassPt[iCut] = new TH2F("ESD_TrueSecondaryMother_InvMass_Pt", "ESD_TrueSecondaryMother_InvMass_Pt", 800,0,0.8,250,0,25);
1115 fHistoTrueSecondaryMotherInvMassPt[iCut]->Sumw2();
1116 fTrueList[iCut]->Add(fHistoTrueSecondaryMotherInvMassPt[iCut]);
1117 fHistoTrueSecondaryMotherFromK0sInvMassPt[iCut] = new TH2F("ESD_TrueSecondaryMotherFromK0s_InvMass_Pt","ESD_TrueSecondaryMotherFromK0s_InvMass_Pt",800,0,0.8,250,0,25);
1118 fHistoTrueSecondaryMotherFromK0sInvMassPt[iCut]->Sumw2();
1119 fTrueList[iCut]->Add(fHistoTrueSecondaryMotherFromK0sInvMassPt[iCut]);
1120 fHistoTrueSecondaryMotherFromEtaInvMassPt[iCut] = new TH2F("ESD_TrueSecondaryMotherFromEta_InvMass_Pt","ESD_TrueSecondaryMotherFromEta_InvMass_Pt",800,0,0.8,250,0,25);
1121 fTrueList[iCut]->Add(fHistoTrueSecondaryMotherFromEtaInvMassPt[iCut]);
1122 fHistoTrueSecondaryMotherFromLambdaInvMassPt[iCut] = new TH2F("ESD_TrueSecondaryMotherFromLambda_InvMass_Pt","ESD_TrueSecondaryMotherFromLambda_InvMass_Pt",800,0,0.8,250,0,25);
1123 fTrueList[iCut]->Add(fHistoTrueSecondaryMotherFromLambdaInvMassPt[iCut]);
8bdca7f1 1124 if (fDoMesonQA > 0){
fd94f234 1125 fHistoTrueMotherCaloPhotonInvMassPt[iCut] = new TH2F("ESD_TrueMotherCaloPhoton_InvMass_Pt","ESD_TrueMotherCaloPhoton_InvMass_Pt",800,0,0.8,250,0,25);
1126 fTrueList[iCut]->Add(fHistoTrueMotherCaloPhotonInvMassPt[iCut]);
1127 fHistoTrueMotherCaloConvertedPhotonInvMassPt[iCut] = new TH2F("ESD_TrueMotherCaloConvertedPhoton_InvMass_Pt","ESD_TrueMotherCaloConvertedPhoton_InvMass_Pt",800,0,0.8,250,0,25);
1128 fTrueList[iCut]->Add(fHistoTrueMotherCaloConvertedPhotonInvMassPt[iCut]);
20af4b69 1129
1130 fHistoTruePi0CaloConvertedPhotonInvMassPt[iCut] = new TH2F("ESD_TruePi0CaloConvertedPhoton_InvMass_Pt","ESD_TruePi0CaloConvertedPhoton_InvMass_Pt",800,0,0.8,250,0,25);
1131 fTrueList[iCut]->Add(fHistoTruePi0CaloConvertedPhotonInvMassPt[iCut]);
1132 fHistoTruePi0CaloConvertedPhotonMatchedInvMassPt[iCut] = new TH2F("ESD_TruePi0CaloConvertedPhotonMatched_InvMass_Pt","ESD_TruePi0CaloConvertedPhotonMatched_InvMass_Pt",800,0,0.8,250,0,25);
1133 fTrueList[iCut]->Add(fHistoTruePi0CaloConvertedPhotonMatchedInvMassPt[iCut]);
1134
1135 fHistoTrueEtaCaloConvertedPhotonInvMassPt[iCut] = new TH2F("ESD_TrueEtaCaloConvertedPhoton_InvMass_Pt","ESD_TrueEtaCaloConvertedPhoton_InvMass_Pt",800,0,0.8,250,0,25);
1136 fTrueList[iCut]->Add(fHistoTrueEtaCaloConvertedPhotonInvMassPt[iCut]);
1137 fHistoTrueEtaCaloConvertedPhotonMatchedInvMassPt[iCut] = new TH2F("ESD_TrueEtaCaloConvertedPhotonMatched_InvMass_Pt","ESD_TrueEtaCaloConvertedPhotonMatched_InvMass_Pt",800,0,0.8,250,0,25);
1138 fTrueList[iCut]->Add(fHistoTrueEtaCaloConvertedPhotonMatchedInvMassPt[iCut]);
1139
fd94f234 1140 fHistoTrueMotherCaloElectronInvMassPt[iCut] = new TH2F("ESD_TrueMotherCaloElectron_InvMass_Pt","ESD_TrueMotherCaloElectron_InvMass_Pt",800,0,0.8,250,0,25);
1141 fTrueList[iCut]->Add(fHistoTrueMotherCaloElectronInvMassPt[iCut]);
1142 fHistoTrueMotherCaloMergedClusterInvMassPt[iCut] = new TH2F("ESD_TrueMotherCaloMergedCluster_InvMass_Pt","ESD_TrueMotherCaloMergedCluster_InvMass_Pt",800,0,0.8,250,0,25);
1143 fTrueList[iCut]->Add(fHistoTrueMotherCaloMergedClusterInvMassPt[iCut]);
1144 fHistoTrueMotherCaloEMNonLeadingInvMassPt[iCut] = new TH2F("ESD_TrueMotherCaloEMNonLeading_InvMass_Pt","ESD_TrueMotherCaloEMNonLeading_InvMass_Pt",800,0,0.8,250,0,25);
1145 fTrueList[iCut]->Add(fHistoTrueMotherCaloEMNonLeadingInvMassPt[iCut]);
1146 fHistoTrueMotherCaloMergedClusterPartConvInvMassPt[iCut] = new TH2F("ESD_TrueMotherCaloMergedClusterPartConv_InvMass_Pt","ESD_TrueMotherCaloMergedClusterPartConv_InvMass_Pt",800,0,0.8,250,0,25);
1147 fTrueList[iCut]->Add(fHistoTrueMotherCaloMergedClusterPartConvInvMassPt[iCut]);
1148
8bdca7f1 1149 fHistoTruePrimaryPi0MCPtResolPt[iCut] = new TH2F("ESD_TruePrimaryPi0_MCPt_ResolPt","ESD_TruePrimaryPi0_ResolPt_MCPt",500,0.03,25,1000,-1.,1.);
1150 fHistoTruePrimaryPi0MCPtResolPt[iCut]->Sumw2();
1151 SetLogBinningXTH2(fHistoTruePrimaryPi0MCPtResolPt[iCut]);
1152 fTrueList[iCut]->Add(fHistoTruePrimaryPi0MCPtResolPt[iCut]);
1153 fHistoTruePrimaryEtaMCPtResolPt[iCut] = new TH2F("ESD_TruePrimaryEta_MCPt_ResolPt","ESD_TruePrimaryEta_ResolPt_MCPt",500,0.03,25,1000,-1.,1.);
1154 fHistoTruePrimaryEtaMCPtResolPt[iCut]->Sumw2();
1155 SetLogBinningXTH2(fHistoTruePrimaryEtaMCPtResolPt[iCut]);
1156 fTrueList[iCut]->Add(fHistoTruePrimaryEtaMCPtResolPt[iCut]);
1157 fHistoTrueBckGGInvMassPt[iCut] = new TH2F("ESD_TrueBckGG_InvMass_Pt","ESD_TrueBckGG_InvMass_Pt",800,0,0.8,250,0,25);
1158 fTrueList[iCut]->Add(fHistoTrueBckGGInvMassPt[iCut]);
1159 fHistoTrueBckContInvMassPt[iCut] = new TH2F("ESD_TrueBckCont_InvMass_Pt","ESD_TrueBckCont_InvMass_Pt",800,0,0.8,250,0,25);
1160 fTrueList[iCut]->Add(fHistoTrueBckContInvMassPt[iCut]);
1161 fHistoTrueK0sWithPi0DaughterMCPt[iCut] = new TH1F("ESD_TrueK0sWithPi0Daughter_MCPt","ESD_TrueK0sWithPi0Daughter_MCPt",250,0,25);
1162 fTrueList[iCut]->Add(fHistoTrueK0sWithPi0DaughterMCPt[iCut]);
1163 fHistoTrueEtaWithPi0DaughterMCPt[iCut] = new TH1F("ESD_TrueEtaWithPi0Daughter_MCPt","ESD_TrueEtaWithPi0Daughter_MCPt",250,0,25);
1164 fTrueList[iCut]->Add(fHistoTrueEtaWithPi0DaughterMCPt[iCut]);
1165 fHistoTrueLambdaWithPi0DaughterMCPt[iCut] = new TH1F("ESD_TrueLambdaWithPi0Daughter_MCPt","ESD_TrueLambdaWithPi0Daughter_MCPt",250,0,25);
1166 fTrueList[iCut]->Add(fHistoTrueLambdaWithPi0DaughterMCPt[iCut]);
1167
1168 fHistoTruePi0PtY[iCut] = new TH2F("ESD_TruePi0_Pt_Y","ESD_TruePi0_Pt_Y",150,0.03,15.,150,-1.5,1.5);
1169 SetLogBinningXTH2(fHistoTruePi0PtY[iCut]);
1170 fTrueList[iCut]->Add(fHistoTruePi0PtY[iCut]);
1171 fHistoTrueEtaPtY[iCut] = new TH2F("ESD_TrueEta_Pt_Y","ESD_TrueEta_Pt_Y",150,0.03,15.,150,-1.5,1.5);
1172 SetLogBinningXTH2(fHistoTrueEtaPtY[iCut]);
1173 fTrueList[iCut]->Add(fHistoTrueEtaPtY[iCut]);
1174 fHistoTruePi0PtAlpha[iCut] = new TH2F("ESD_TruePi0_Pt_Alpha","ESD_TruePi0_Pt_Alpha",150,0.03,15.,100,0,1);
1175 SetLogBinningXTH2(fHistoTruePi0PtAlpha[iCut]);
1176 fTrueList[iCut]->Add(fHistoTruePi0PtAlpha[iCut]);
1177 fHistoTrueEtaPtAlpha[iCut] = new TH2F("ESD_TrueEta_Pt_Alpha","ESD_TrueEta_Pt_Alpha",150,0.03,15.,100,0,1);
1178 SetLogBinningXTH2(fHistoTrueEtaPtAlpha[iCut]);
1179 fTrueList[iCut]->Add(fHistoTrueEtaPtAlpha[iCut]);
1180
1181 fHistoTruePi0PtOpenAngle[iCut] = new TH2F("ESD_TruePi0_Pt_OpenAngle","ESD_TruePi0_Pt_OpenAngle",150,0.03,15.,200,0,2*TMath::Pi());
1182 SetLogBinningXTH2(fHistoTruePi0PtOpenAngle[iCut]);
1183 fTrueList[iCut]->Add(fHistoTruePi0PtOpenAngle[iCut]);
1184 fHistoTrueEtaPtOpenAngle[iCut] = new TH2F("ESD_TrueEta_Pt_OpenAngle","ESD_TrueEta_Pt_OpenAngle",150,0.03,15.,200,0,2*TMath::Pi());
1185 SetLogBinningXTH2(fHistoTrueEtaPtOpenAngle[iCut]);
1186 fTrueList[iCut]->Add(fHistoTrueEtaPtOpenAngle[iCut]);
8bdca7f1 1187 }
1188 }
1189 }
1190 }
1191
1192 fV0Reader=(AliV0ReaderV1*)AliAnalysisManager::GetAnalysisManager()->GetTask("V0ReaderV1");
1193 if(!fV0Reader){printf("Error: No V0 Reader");return;} // GetV0Reader
1194
1195 if(fV0Reader)
344100c4 1196 if((AliConversionPhotonCuts*)fV0Reader->GetConversionCuts())
1197 if(((AliConversionPhotonCuts*)fV0Reader->GetConversionCuts())->GetCutHistograms())
1198 fOutputContainer->Add(((AliConversionPhotonCuts*)fV0Reader->GetConversionCuts())->GetCutHistograms());
1199 if(fV0Reader)
1200 if((AliConvEventCuts*)fV0Reader->GetEventCuts())
1201 if(((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetCutHistograms())
1202 fOutputContainer->Add(((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetCutHistograms());
1203
1204
8bdca7f1 1205 for(Int_t iCut = 0; iCut<fnCuts;iCut++){
344100c4 1206 if(!((AliConvEventCuts*)fEventCutArray->At(iCut))) continue;
1207 if(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutHistograms()){
1208 fCutFolder[iCut]->Add(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutHistograms());
1209 }
1210 if(!((AliConversionPhotonCuts*)fCutArray->At(iCut))) continue;
1211 if(((AliConversionPhotonCuts*)fCutArray->At(iCut))->GetCutHistograms()){
1212 fCutFolder[iCut]->Add(((AliConversionPhotonCuts*)fCutArray->At(iCut))->GetCutHistograms());
8bdca7f1 1213 }
1214 if(!((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))) continue;
1215 if(((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetCutHistograms()){
1216 fCutFolder[iCut]->Add(((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetCutHistograms());
1217 }
1218 if(fDoMesonAnalysis){
1219 if(!((AliConversionMesonCuts*)fMesonCutArray->At(iCut))) continue;
1220 if(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutHistograms()){
1221 fCutFolder[iCut]->Add(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutHistograms());
1222 }
1223 }
1224 }
1225 PostData(1, fOutputContainer);
1226}
1227//_____________________________________________________________________________
1228Bool_t AliAnalysisTaskGammaConvCalo::Notify()
1229{
1230 for(Int_t iCut = 0; iCut<fnCuts;iCut++){
344100c4 1231 if(!((AliConvEventCuts*)fEventCutArray->At(iCut))->GetDoEtaShift()){
1232 fProfileEtaShift[iCut]->Fill(0.,(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift()));
8bdca7f1 1233 continue; // No Eta Shift requested, continue
1234 }
344100c4 1235 if(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift() == 0.0){ // Eta Shift requested but not set, get shift automatically
1236 ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCorrectEtaShiftFromPeriod(fV0Reader->GetPeriodName());
1237 fProfileEtaShift[iCut]->Fill(0.,(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift()));
1238 ((AliConvEventCuts*)fEventCutArray->At(iCut))->DoEtaShift(kFALSE); // Eta Shift Set, make sure that it is called only once
8bdca7f1 1239 continue;
1240 }
1241 else{
1242 printf(" Gamma Conversion Task %s :: Eta Shift Manually Set to %f \n\n",
344100c4 1243 (((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber()).Data(),((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift());
1244 fProfileEtaShift[iCut]->Fill(0.,(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift()));
1245 ((AliConvEventCuts*)fEventCutArray->At(iCut))->DoEtaShift(kFALSE); // Eta Shift Set, make sure that it is called only once
8bdca7f1 1246 }
1247 }
1248
1249 return kTRUE;
1250}
1251//_____________________________________________________________________________
1252void AliAnalysisTaskGammaConvCalo::UserExec(Option_t *)
1253{
1254 //
1255 // Called for each event
1256 //
344100c4 1257 Int_t eventQuality = ((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetEventQuality();
8bdca7f1 1258 if(eventQuality == 2 || eventQuality == 3){// Event Not Accepted due to MC event missing or wrong trigger for V0ReaderV1
1259 for(Int_t iCut = 0; iCut<fnCuts; iCut++){
1260 fHistoNEvents[iCut]->Fill(eventQuality);
1261 }
1262 return;
1263 }
1264
1265 if(fIsMC) fMCEvent = MCEvent();
1266 if(fMCEvent == NULL) fIsMC = kFALSE;
1267
1268 fInputEvent = InputEvent();
1269
1270 if(fIsMC && fInputEvent->IsA()==AliESDEvent::Class()){
1271 fMCStack = fMCEvent->Stack();
1272 if(fMCStack == NULL) fIsMC = kFALSE;
1273 }
1274
1275 fReaderGammas = fV0Reader->GetReconstructedGammas(); // Gammas from default Cut
1276
1277 // ------------------- BeginEvent ----------------------------
1278
1279 AliEventplane *EventPlane = fInputEvent->GetEventplane();
1280 if(fIsHeavyIon ==1)fEventPlaneAngle = EventPlane->GetEventplane("V0",fInputEvent,2);
1281 else fEventPlaneAngle=0.0;
1282
1283 if(fIsMC && fInputEvent->IsA()==AliAODEvent::Class() && !(fV0Reader->AreAODsRelabeled())){
1284 RelabelAODPhotonCandidates(kTRUE); // In case of AODMC relabeling MC
1285 fV0Reader->RelabelAODs(kTRUE);
1286 }
1287
1288
1289 for(Int_t iCut = 0; iCut<fnCuts; iCut++){
1290
1291 fiCut = iCut;
344100c4 1292 Int_t eventNotAccepted = ((AliConvEventCuts*)fEventCutArray->At(iCut))->IsEventAcceptedByCut(fV0Reader->GetEventCuts(),fInputEvent,fMCEvent,fIsHeavyIon);
8bdca7f1 1293
1294 if(eventNotAccepted){
1295 // cout << "event rejected due to wrong trigger: " <<eventNotAccepted << endl;
1296 fHistoNEvents[iCut]->Fill(eventNotAccepted); // Check Centrality, PileUp, SDD and V0AND --> Not Accepted => eventQuality = 1
1297 continue;
1298 }
1299
1300 if(eventQuality != 0){// Event Not Accepted
1301 //cout << "event rejected due to: " <<eventQuality << endl;
1302 fHistoNEvents[iCut]->Fill(eventQuality);
1303 continue;
1304 }
1305
1306 fHistoNEvents[iCut]->Fill(eventQuality); // Should be 0 here
1307 fHistoNGoodESDTracks[iCut]->Fill(fV0Reader->GetNumberOfPrimaryTracks());
344100c4 1308 if(((AliConvEventCuts*)fEventCutArray->At(iCut))->IsHeavyIon() == 2) fHistoNV0Tracks[iCut]->Fill(fInputEvent->GetVZEROData()->GetMTotV0A());
8bdca7f1 1309 else fHistoNV0Tracks[iCut]->Fill(fInputEvent->GetVZEROData()->GetMTotV0A()+fInputEvent->GetVZEROData()->GetMTotV0C());
1310
1311 if(fIsMC){
1312 // Process MC Particle
344100c4 1313 if(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetSignalRejection() != 0){
8bdca7f1 1314 if(fInputEvent->IsA()==AliESDEvent::Class()){
344100c4 1315 ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetNotRejectedParticles(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetSignalRejection(),
1316 ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetAcceptedHeader(),
8bdca7f1 1317 fMCEvent);
1318 }
1319 else if(fInputEvent->IsA()==AliAODEvent::Class()){
344100c4 1320 ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetNotRejectedParticles(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetSignalRejection(),
1321 ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetAcceptedHeader(),
8bdca7f1 1322 fInputEvent);
1323 }
1324
344100c4 1325 if(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetAcceptedHeader()){
1326 for(Int_t i = 0;i<(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetAcceptedHeader())->GetEntries();i++){
8bdca7f1 1327 TString nameBin= fHistoMCHeaders[iCut]->GetXaxis()->GetBinLabel(i+1);
1328 if (nameBin.CompareTo("")== 0){
344100c4 1329 TString nameHeader = ((TObjString*)((TList*)((AliConvEventCuts*)fEventCutArray->At(iCut))
1330 ->GetAcceptedHeader())->At(i))->GetString();
1331 fHistoMCHeaders[iCut]->GetXaxis()->SetBinLabel(i+1,nameHeader.Data());
8bdca7f1 1332 }
1333 }
1334 }
1335 }
1336 }
1337 if(fIsMC){
1338 if(fInputEvent->IsA()==AliESDEvent::Class())
1339 ProcessMCParticles();
1340 if(fInputEvent->IsA()==AliAODEvent::Class())
1341 ProcessAODMCParticles();
1342 }
1343
1344 // 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)
1345 ProcessClusters(); // process calo clusters
1346 ProcessPhotonCandidates(); // Process this cuts gammas
1347
1348 fHistoNGammaCandidates[iCut]->Fill(fGammaCandidates->GetEntries());
1349 fHistoNGoodESDTracksVsNGammaCanditates[iCut]->Fill(fV0Reader->GetNumberOfPrimaryTracks(),fGammaCandidates->GetEntries());
1350 if(fDoMesonAnalysis){ // Meson Analysis
1351 if(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->UseMCPSmearing() && fIsMC){
1352 fUnsmearedPx = new Double_t[fGammaCandidates->GetEntries()]; // Store unsmeared Momenta
1353 fUnsmearedPy = new Double_t[fGammaCandidates->GetEntries()];
1354 fUnsmearedPz = new Double_t[fGammaCandidates->GetEntries()];
1355 fUnsmearedE = new Double_t[fGammaCandidates->GetEntries()];
1356
1357 for(Int_t gamma=0;gamma<fGammaCandidates->GetEntries();gamma++){ // Smear the AODPhotons in MC
1358 fUnsmearedPx[gamma] = ((AliAODConversionPhoton*)fGammaCandidates->At(gamma))->Px();
1359 fUnsmearedPy[gamma] = ((AliAODConversionPhoton*)fGammaCandidates->At(gamma))->Py();
1360 fUnsmearedPz[gamma] = ((AliAODConversionPhoton*)fGammaCandidates->At(gamma))->Pz();
1361 fUnsmearedE[gamma] = ((AliAODConversionPhoton*)fGammaCandidates->At(gamma))->E();
1362 ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->SmearParticle(dynamic_cast<AliAODConversionPhoton*>(fGammaCandidates->At(gamma)));
1363 }
1364 }
1365
1366 PhotonTagging(); // tag PCM photons with calorimeter
1367
1368 CalculatePi0Candidates(); // Combine Gammas from conversion and from calo
1369
1370 if(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->DoBGCalculation()){
1371 if(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->BackgroundHandlerType() == 0){
1372 CalculateBackground(); // Combinatorial Background
1373 UpdateEventByEventData(); // Store Event for mixed Events
1374 }
1375 else{
1376 CalculateBackgroundRP(); // Combinatorial Background
1377 fBGHandlerRP[iCut]->AddEvent(fGammaCandidates,fInputEvent); // Store Event for mixed Events
1378 fBGClusHandlerRP[iCut]->AddEvent(fClusterCandidates,fInputEvent); // Store Event for mixed Events
1379 }
1380 }
1381 if(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->UseMCPSmearing() && fIsMC){
1382 for(Int_t gamma=0;gamma<fGammaCandidates->GetEntries();gamma++){ // Smear the AODPhotons in MC
1383 ((AliAODConversionPhoton*)fGammaCandidates->At(gamma))->SetPx(fUnsmearedPx[gamma]); // Reset Unsmeared Momenta
1384 ((AliAODConversionPhoton*)fGammaCandidates->At(gamma))->SetPy(fUnsmearedPy[gamma]);
1385 ((AliAODConversionPhoton*)fGammaCandidates->At(gamma))->SetPz(fUnsmearedPz[gamma]);
1386 ((AliAODConversionPhoton*)fGammaCandidates->At(gamma))->SetE(fUnsmearedE[gamma]);
1387 }
1388 delete[] fUnsmearedPx; fUnsmearedPx = 0x0;
1389 delete[] fUnsmearedPy; fUnsmearedPy = 0x0;
1390 delete[] fUnsmearedPz; fUnsmearedPz = 0x0;
1391 delete[] fUnsmearedE; fUnsmearedE = 0x0;
1392 }
1393 }
1394
1395 fGammaCandidates->Clear(); // delete this cuts good gammas
1396 fClusterCandidates->Clear(); // delete cluster candidates
1397 }
1398
1399 if(fIsMC && fInputEvent->IsA()==AliAODEvent::Class() && !(fV0Reader->AreAODsRelabeled())){
1400 RelabelAODPhotonCandidates(kFALSE); // Back to ESDMC Label
1401 fV0Reader->RelabelAODs(kFALSE);
1402 }
1403
1404 PostData(1, fOutputContainer);
1405}
1406
1407//________________________________________________________________________
1408void AliAnalysisTaskGammaConvCalo::ProcessClusters()
1409{
1410
1411 Int_t nclus = 0;
1412 nclus = fInputEvent->GetNumberOfCaloClusters();
1413
9df9736d 1414// cout << nclus << endl;
8bdca7f1 1415
1416 if(nclus == 0) return;
1417
1418 // vertex
1419 Double_t vertex[3] = {0};
1420 InputEvent()->GetPrimaryVertex()->GetXYZ(vertex);
1421
1422 // Loop over EMCal clusters
d53bf4ac 1423 for(Long_t i = 0; i < nclus; i++){
8bdca7f1 1424
20af4b69 1425 AliVCluster* clus = NULL;
1426 clus = fInputEvent->GetCaloCluster(i);
8bdca7f1 1427 if (!clus) continue;
1428 if(!((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelected(clus,fInputEvent,fIsMC)) continue;
1429 // TLorentzvector with cluster
1430 TLorentzVector clusterVector;
1431 clus->GetMomentum(clusterVector,vertex);
1432
1433 TLorentzVector* tmpvec = new TLorentzVector();
1434 tmpvec->SetPxPyPzE(clusterVector.Px(),clusterVector.Py(),clusterVector.Pz(),clusterVector.E());
1435
1436 // convert to AODConversionPhoton
1437 AliAODConversionPhoton *PhotonCandidate=new AliAODConversionPhoton(tmpvec);
1438 if(!PhotonCandidate) continue;
fd94f234 1439
1440 // Flag Photon as CaloPhoton
1441 PhotonCandidate->SetIsCaloPhoton();
d53bf4ac 1442 PhotonCandidate->SetCaloClusterRef(i);
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++){
d53bf4ac 2311 Bool_t matched = kFALSE;
8bdca7f1 2312 AliAODConversionPhoton *gamma1=dynamic_cast<AliAODConversionPhoton*>(fClusterCandidates->At(secondGammaIndex));
2313 if (gamma1==NULL) continue;
2314
d53bf4ac 2315 if (gamma1->GetIsCaloPhoton()){
2316 AliVCluster* cluster = fInputEvent->GetCaloCluster(gamma1->GetCaloClusterRef());
2317 matched = ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->MatchConvPhotonToCluster(gamma0,cluster, fInputEvent );
2318 }
2319
8bdca7f1 2320 AliAODConversionMother *pi0cand = new AliAODConversionMother(gamma0,gamma1);
2321 pi0cand->SetLabels(firstGammaIndex,secondGammaIndex);
2322
d53bf4ac 2323
2324
344100c4 2325 if((((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->MesonIsSelected(pi0cand,kTRUE,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift()))){
d53bf4ac 2326 if (matched){
2327 fHistoMotherMatchedInvMassPt[fiCut]->Fill(pi0cand->M(),pi0cand->Pt());
2328 } else {
2329 fHistoMotherInvMassPt[fiCut]->Fill(pi0cand->M(),pi0cand->Pt());
2330 }
8bdca7f1 2331 // fill new histograms
d53bf4ac 2332 if (!matched){
2333 fHistoPhotonPairAll[fiCut]->Fill(pi0cand->M(),pi0cand->Pt());
2334 fHistoPhotonPairAllGam[fiCut]->Fill(pi0cand->M(),gamma0->Pt());
8bdca7f1 2335
d53bf4ac 2336 if(pi0cand->GetAlpha()<0.1)
2337 fHistoMotherInvMassEalpha[fiCut]->Fill(pi0cand->M(),pi0cand->E());
2338
2339 if (fDoMesonQA > 0){
2340 if ( pi0cand->M() > 0.05 && pi0cand->M() < 0.17){
2341 fHistoMotherPi0PtY[fiCut]->Fill(pi0cand->Pt(),pi0cand->Rapidity()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift());
2342 fHistoMotherPi0PtAlpha[fiCut]->Fill(pi0cand->Pt(),pi0cand->GetAlpha());
2343 fHistoMotherPi0PtOpenAngle[fiCut]->Fill(pi0cand->Pt(),pi0cand->GetOpeningAngle());
8bdca7f1 2344 }
d53bf4ac 2345 if ( pi0cand->M() > 0.45 && pi0cand->M() < 0.65){
2346 fHistoMotherEtaPtY[fiCut]->Fill(pi0cand->Pt(),pi0cand->Rapidity()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift());
2347 fHistoMotherEtaPtAlpha[fiCut]->Fill(pi0cand->Pt(),pi0cand->GetAlpha());
2348 fHistoMotherEtaPtOpenAngle[fiCut]->Fill(pi0cand->Pt(),pi0cand->GetOpeningAngle());
2349 }
2350 }
2351 if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->DoBGCalculation()){
2352 Int_t zbin = 0;
2353 Int_t mbin = 0;
2354
2355 if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->BackgroundHandlerType() == 0){
2356 zbin = fBGHandler[fiCut]->GetZBinIndex(fInputEvent->GetPrimaryVertex()->GetZ());
2357 if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->UseTrackMultiplicity()){
2358 mbin = fBGHandler[fiCut]->GetMultiplicityBinIndex(fV0Reader->GetNumberOfPrimaryTracks());
2359 } else {
2360 mbin = fBGHandler[fiCut]->GetMultiplicityBinIndex(fGammaCandidates->GetEntries());
2361 }
2362 } else{
2363 zbin = fBGHandlerRP[fiCut]->GetZBinIndex(fInputEvent->GetPrimaryVertex()->GetZ());
2364 if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->UseTrackMultiplicity()){
2365 mbin = fBGHandlerRP[fiCut]->GetMultiplicityBinIndex(fV0Reader->GetNumberOfPrimaryTracks());
2366 } else {
2367 mbin = fBGHandlerRP[fiCut]->GetMultiplicityBinIndex(fGammaCandidates->GetEntries());
2368 }
8bdca7f1 2369 }
d53bf4ac 2370 Double_t sparesFill[4] = {pi0cand->M(),pi0cand->Pt(),(Double_t)zbin,(Double_t)mbin};
2371 fSparseMotherInvMassPtZM[fiCut]->Fill(sparesFill,1);
8bdca7f1 2372 }
8bdca7f1 2373 }
2374
8bdca7f1 2375 if(fIsMC){
2376 if(fInputEvent->IsA()==AliESDEvent::Class())
d53bf4ac 2377 ProcessTrueMesonCandidates(pi0cand,gamma0,gamma1, matched);
8bdca7f1 2378 if(fInputEvent->IsA()==AliAODEvent::Class())
d53bf4ac 2379 ProcessTrueMesonCandidatesAOD(pi0cand,gamma0,gamma1, matched);
8bdca7f1 2380 }
d53bf4ac 2381 if (!matched){
2382 if (fDoMesonQA == 2){
2383 fInvMass = pi0cand->M();
2384 fPt = pi0cand->Pt();
2385 if (abs(gamma0->GetDCAzToPrimVtx()) < abs(gamma1->GetDCAzToPrimVtx())){
2386 fDCAzGammaMin = gamma0->GetDCAzToPrimVtx();
2387 fDCAzGammaMax = gamma1->GetDCAzToPrimVtx();
2388 } else {
2389 fDCAzGammaMin = gamma1->GetDCAzToPrimVtx();
2390 fDCAzGammaMax = gamma0->GetDCAzToPrimVtx();
2391 }
2392 fCharFlag = pi0cand->GetMesonQuality();
2393 // cout << "gamma 0: " << gamma0->GetV0Index()<< "\t" << gamma0->GetPx() << "\t" << gamma0->GetPy() << "\t" << gamma0->GetPz() << "\t" << endl;
2394 // cout << "gamma 1: " << gamma1->GetV0Index()<< "\t"<< gamma1->GetPx() << "\t" << gamma1->GetPy() << "\t" << gamma1->GetPz() << "\t" << endl;
2395 // cout << "pi0: "<<fInvMass << "\t" << fPt <<"\t" << fDCAzGammaMin << "\t" << fDCAzGammaMax << "\t" << (Int_t)fCharFlag << "\t" << (Int_t)fCharMesonMCInfo <<endl;
2396 if (fIsHeavyIon == 1 && fPt > 0.399 && fPt < 20. ) {
2397 if (fInvMass > 0.08 && fInvMass < 0.2) fTreeMesonsInvMassPtDcazMinDcazMaxFlag[fiCut]->Fill();
2398 if ((fInvMass > 0.45 && fInvMass < 0.6) && (fPt > 0.999 && fPt < 20.) )fTreeMesonsInvMassPtDcazMinDcazMaxFlag[fiCut]->Fill();
2399 } else if (fPt > 0.299 && fPt < 20. ) {
2400 if ( (fInvMass > 0.08 && fInvMass < 0.2) || (fInvMass > 0.45 && fInvMass < 0.6)) fTreeMesonsInvMassPtDcazMinDcazMaxFlag[fiCut]->Fill();
2401 }
8bdca7f1 2402 }
d53bf4ac 2403 if (fDoMesonQA == 1){
2404 fHistoMotherInvMassECalib[fiCut]->Fill(pi0cand->M(),gamma1->E());
2405 if(pi0cand->GetAlpha()<0.1)
2406 fHistoMotherInvMassECalibalpha[fiCut]->Fill(pi0cand->M(),gamma1->E());
8bdca7f1 2407 }
2408 }
2409 }
2410 delete pi0cand;
2411 pi0cand=0x0;
2412 }
2413 }
2414 }
2415}
2416//______________________________________________________________________
d53bf4ac 2417void AliAnalysisTaskGammaConvCalo::ProcessTrueMesonCandidates(AliAODConversionMother *Pi0Candidate, AliAODConversionPhoton *TrueGammaCandidate0, AliAODConversionPhoton *TrueGammaCandidate1, Bool_t matched)
8bdca7f1 2418{
2419 // Process True Mesons
2420 AliStack *MCStack = fMCEvent->Stack();
2421 fCharMesonMCInfo = 0;
2422 if(TrueGammaCandidate0->GetV0Index()<fInputEvent->GetNumberOfV0s()){
2423 Bool_t isTruePi0 = kFALSE;
2424 Bool_t isTrueEta = kFALSE;
8bdca7f1 2425 Int_t gamma0MCLabel = TrueGammaCandidate0->GetMCParticleLabel(MCStack);
2426 Int_t gamma0MotherLabel = -1;
2427 if(gamma0MCLabel != -1){ // Gamma is Combinatorial; MC Particles don't belong to the same Mother
fd94f234 2428 // Daughters Gamma 0
2429 TParticle * negativeMC = (TParticle*)TrueGammaCandidate0->GetNegativeMCDaughter(MCStack);
2430 TParticle * positiveMC = (TParticle*)TrueGammaCandidate0->GetPositiveMCDaughter(MCStack);
2431 TParticle * gammaMC0 = (TParticle*)MCStack->Particle(gamma0MCLabel);
2432 if(abs(negativeMC->GetPdgCode())==11 && abs(positiveMC->GetPdgCode())==11){ // Electrons ...
2433 if(negativeMC->GetUniqueID() == 5 && positiveMC->GetUniqueID() ==5){ // ... From Conversion ...
2434 if(gammaMC0->GetPdgCode() == 22){ // ... with Gamma Mother
2435 gamma0MotherLabel=gammaMC0->GetFirstMother();
2436 }
8bdca7f1 2437 }
2438 }
fd94f234 2439 }
2440 if (!TrueGammaCandidate1->GetIsCaloPhoton()) AliFatal("CaloPhotonFlag has not been set. Aborting");
2441
2442 Int_t gamma1MCLabel = TrueGammaCandidate1->GetCaloPhotonMCLabel(0); // get most probable MC label
2443 Int_t gamma1MotherLabel = -1;
2444 // check if
2445
2446 if(gamma1MCLabel != -1){ // Gamma is Combinatorial; MC Particles don't belong to the same Mother
2447 // Daughters Gamma 1
2448 TParticle * gammaMC1 = (TParticle*)MCStack->Particle(gamma1MCLabel);
2449 if (TrueGammaCandidate1->IsLargestComponentPhoton() || TrueGammaCandidate1->IsLargestComponentElectron()){ // largest component is electro magnetic
2450 // get mother of interest (pi0 or eta)
2451 if (TrueGammaCandidate1->IsLargestComponentPhoton()){ // for photons its the direct mother
2452 gamma1MotherLabel=gammaMC1->GetMother(0);
2453 } else if (TrueGammaCandidate1->IsLargestComponentElectron()){ // for electrons its either the direct mother or for conversions the grandmother
2454 if (TrueGammaCandidate1->IsConversion()) gamma1MotherLabel=MCStack->Particle(gammaMC1->GetMother(0))->GetMother(0);
2455 else gamma1MotherLabel=gammaMC1->GetMother(0);
2456 }
2457 } else {
2458 if (fDoMesonQA > 0) fHistoTrueMotherCaloEMNonLeadingInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2459 }
2460 }
2461
2462 if(gamma0MotherLabel>=0 && gamma0MotherLabel==gamma1MotherLabel){
2463 if(((TParticle*)MCStack->Particle(gamma1MotherLabel))->GetPdgCode() == 111){
2464 isTruePi0=kTRUE;
8bdca7f1 2465 }
fd94f234 2466 if(((TParticle*)MCStack->Particle(gamma1MotherLabel))->GetPdgCode() == 221){
2467 isTrueEta=kTRUE;
8bdca7f1 2468 }
2469 }
fd94f234 2470
2471 if(isTruePi0 || isTrueEta){// True Pion or Eta
d53bf4ac 2472 if (!matched)fHistoTrueMotherInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
fd94f234 2473 if (fDoMesonQA > 0){
d53bf4ac 2474 if (TrueGammaCandidate1->IsLargestComponentPhoton() && !matched)
fd94f234 2475 fHistoTrueMotherCaloPhotonInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
d53bf4ac 2476 if (TrueGammaCandidate1->IsLargestComponentElectron() && !matched)
fd94f234 2477 fHistoTrueMotherCaloElectronInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
d53bf4ac 2478 if (TrueGammaCandidate1->IsLargestComponentElectron() && TrueGammaCandidate1->IsConversion() ){
2479 if (!matched)fHistoTrueMotherCaloConvertedPhotonInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2480 if (isTruePi0 && !matched)fHistoTruePi0CaloConvertedPhotonInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2481 if (isTrueEta && !matched)fHistoTrueEtaCaloConvertedPhotonInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2482 if ((TrueGammaCandidate0->GetMCLabelPositive() == gamma1MCLabel || TrueGammaCandidate0->GetMCLabelNegative() == gamma1MCLabel) && isTruePi0){
20af4b69 2483 fHistoTruePi0CaloConvertedPhotonMatchedInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
d53bf4ac 2484 }
2485 if ((TrueGammaCandidate0->GetMCLabelPositive() == gamma1MCLabel || TrueGammaCandidate0->GetMCLabelNegative() == gamma1MCLabel) && isTrueEta){
20af4b69 2486 fHistoTrueEtaCaloConvertedPhotonMatchedInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
d53bf4ac 2487 }
20af4b69 2488 }
d53bf4ac 2489 if ((TrueGammaCandidate1->IsMerged() || TrueGammaCandidate1->IsMergedPartConv() || TrueGammaCandidate1->IsDalitzMerged()) && !matched )
fd94f234 2490 fHistoTrueMotherCaloMergedClusterInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
d53bf4ac 2491 if (TrueGammaCandidate1->IsMergedPartConv() && !matched)
fd94f234 2492 fHistoTrueMotherCaloMergedClusterPartConvInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2493 }
d53bf4ac 2494 if (!matched){
2495 if (fDoMesonQA > 0){
2496 if (isTruePi0){
2497 if ( Pi0Candidate->M() > 0.05 && Pi0Candidate->M() < 0.17){
2498 fHistoTruePi0PtY[fiCut]->Fill(Pi0Candidate->Pt(),Pi0Candidate->Rapidity()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift());
2499 fHistoTruePi0PtAlpha[fiCut]->Fill(Pi0Candidate->Pt(),Pi0Candidate->GetAlpha());
2500 fHistoTruePi0PtOpenAngle[fiCut]->Fill(Pi0Candidate->Pt(),Pi0Candidate->GetOpeningAngle());
2501 }
2502 } else if (isTrueEta){
2503 if ( Pi0Candidate->M() > 0.45 && Pi0Candidate->M() < 0.65){
2504 fHistoTrueEtaPtY[fiCut]->Fill(Pi0Candidate->Pt(),Pi0Candidate->Rapidity()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift());
2505 fHistoTrueEtaPtAlpha[fiCut]->Fill(Pi0Candidate->Pt(),Pi0Candidate->GetAlpha());
2506 fHistoTrueEtaPtOpenAngle[fiCut]->Fill(Pi0Candidate->Pt(),Pi0Candidate->GetOpeningAngle());
2507 }
8bdca7f1 2508 }
2509 }
d53bf4ac 2510
2511 if(gamma0MotherLabel >= MCStack->GetNprimary()){ // Secondary Meson
2512 Int_t secMotherLabel = ((TParticle*)MCStack->Particle(gamma0MotherLabel))->GetMother(0);
2513 Float_t weightedSec= 1;
2514 if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(secMotherLabel, fMCStack, fInputEvent) && MCStack->Particle(secMotherLabel)->GetPdgCode()==310){
2515 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
2516 //cout << "MC input \t"<<i << "\t" << particle->Pt()<<"\t"<<weighted << endl;
8bdca7f1 2517 }
d53bf4ac 2518 fHistoTrueSecondaryMotherInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weightedSec);
2519 fCharMesonMCInfo = 2;
2520 if (secMotherLabel >-1){
2521 if(MCStack->Particle(secMotherLabel)->GetPdgCode()==310){
2522 fCharMesonMCInfo = 4;
2523 fHistoTrueSecondaryMotherFromK0sInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weightedSec);
2524 if (fDoMesonQA > 0)fHistoTrueK0sWithPi0DaughterMCPt[fiCut]->Fill(MCStack->Particle(secMotherLabel)->Pt());
2525 }
2526 if(MCStack->Particle(secMotherLabel)->GetPdgCode()==221){
2527 fCharMesonMCInfo = 3;
2528 fHistoTrueSecondaryMotherFromEtaInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weightedSec);
2529 if (fDoMesonQA > 0)fHistoTrueEtaWithPi0DaughterMCPt[fiCut]->Fill(MCStack->Particle(secMotherLabel)->Pt());
2530 }
2531 if(MCStack->Particle(secMotherLabel)->GetPdgCode()==3122){
2532 fCharMesonMCInfo = 7;
2533 fHistoTrueSecondaryMotherFromLambdaInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weightedSec);
2534 if (fDoMesonQA > 0)fHistoTrueLambdaWithPi0DaughterMCPt[fiCut]->Fill(MCStack->Particle(secMotherLabel)->Pt());
2535 }
8bdca7f1 2536 }
d53bf4ac 2537 } else { // Only primary pi0 for efficiency calculation
2538 fCharMesonMCInfo = 6;
2539 Float_t weighted= 1;
2540 if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(gamma1MotherLabel, fMCStack, fInputEvent)){
2541 if (((TParticle*)MCStack->Particle(gamma1MotherLabel))->Pt()>0.005){
2542 weighted= ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetWeightForMeson(fV0Reader->GetPeriodName(),gamma1MotherLabel, fMCStack, fInputEvent);
2543 // cout << "rec \t " <<gamma1MotherLabel << "\t" << weighted << endl;
2544 }
fd94f234 2545 }
d53bf4ac 2546 fHistoTruePrimaryMotherInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weighted);
2547 fHistoTruePrimaryMotherW0WeightingInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2548 fProfileTruePrimaryMotherWeightsInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weighted);
2549
2550 if (fDoMesonQA > 0){
2551 if(isTruePi0){ // Only primary pi0 for resolution
2552 fHistoTruePrimaryPi0MCPtResolPt[fiCut]->Fill(((TParticle*)MCStack->Particle(gamma1MotherLabel))->Pt(),(Pi0Candidate->Pt()-((TParticle*)MCStack->Particle(gamma1MotherLabel))->Pt())/((TParticle*)MCStack->Particle(gamma1MotherLabel))->Pt(),weighted);
2553 }
2554 if (isTrueEta){ // Only primary eta for resolution
2555 fHistoTruePrimaryEtaMCPtResolPt[fiCut]->Fill(((TParticle*)MCStack->Particle(gamma1MotherLabel))->Pt(),(Pi0Candidate->Pt()-((TParticle*)MCStack->Particle(gamma1MotherLabel))->Pt())/((TParticle*)MCStack->Particle(gamma1MotherLabel))->Pt(),weighted);
2556 }
8bdca7f1 2557 }
2558 }
d53bf4ac 2559 }
fd94f234 2560 } else if(!isTruePi0 && !isTrueEta){ // Background
2561 if (fDoMesonQA > 0){
2562 if(gamma0MotherLabel>-1 && gamma1MotherLabel>-1){ // Both Tracks are Photons and have a mother but not Pi0 or Eta
2563 fHistoTrueBckGGInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2564 fCharMesonMCInfo = 1;
2565 } else { // No photon or without mother
2566 fHistoTrueBckContInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
8bdca7f1 2567 }
2568 }
2569 }
2570 }
2571}
2572//______________________________________________________________________
d53bf4ac 2573void AliAnalysisTaskGammaConvCalo::ProcessTrueMesonCandidatesAOD(AliAODConversionMother *Pi0Candidate, AliAODConversionPhoton *TrueGammaCandidate0, AliAODConversionPhoton *TrueGammaCandidate1, Bool_t matched)
8bdca7f1 2574{
2575
2576 // Process True Mesons
2577 TClonesArray *AODMCTrackArray = dynamic_cast<TClonesArray*>(fInputEvent->FindListObject(AliAODMCParticle::StdBranchName()));
2578 Bool_t isTruePi0 = kFALSE;
2579 Bool_t isTrueEta = kFALSE;
8bdca7f1 2580
2581 AliAODMCParticle *positiveMC = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(TrueGammaCandidate0->GetMCLabelPositive()));
2582 AliAODMCParticle *negativeMC = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(TrueGammaCandidate0->GetMCLabelNegative()));
2583
2584 fCharMesonMCInfo = 0;
2585 Int_t gamma0MCLabel = -1;
2586 Int_t gamma0MotherLabel = -1;
2587 if(!positiveMC||!negativeMC)
2588 return;
2589
2590 if(positiveMC->GetMother()>-1&&(negativeMC->GetMother() == positiveMC->GetMother())){
2591 gamma0MCLabel = positiveMC->GetMother();
2592 }
2593
2594 if(gamma0MCLabel != -1){ // Gamma is Combinatorial; MC Particles don't belong to the same Mother
2595 // Daughters Gamma 0
2596 AliAODMCParticle * gammaMC0 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma0MCLabel));
2597 if(abs(negativeMC->GetPdgCode())==11 && abs(positiveMC->GetPdgCode())==11){ // Electrons ...
2598 if(((positiveMC->GetMCProcessCode())) == 5 && ((negativeMC->GetMCProcessCode())) == 5){ // ... From Conversion ...
2599 if(gammaMC0->GetPdgCode() == 22){ // ... with Gamma Mother
2600 gamma0MotherLabel=gammaMC0->GetMother();
2601 }
2602 }
8bdca7f1 2603 }
fd94f234 2604 }
2605
2606 Int_t gamma1MCLabel = TrueGammaCandidate1->GetCaloPhotonMCLabel(0); // get most probable MC label
8bdca7f1 2607 Int_t gamma1MotherLabel = -1;
fd94f234 2608 // check if
2609
8bdca7f1 2610 if(gamma1MCLabel != -1){ // Gamma is Combinatorial; MC Particles don't belong to the same Mother
2611 // Daughters Gamma 1
2612 AliAODMCParticle * gammaMC1 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma1MCLabel));
fd94f234 2613 if (TrueGammaCandidate1->IsLargestComponentPhoton() || TrueGammaCandidate1->IsLargestComponentElectron()){ // largest component is electro magnetic
2614 // get mother of interest (pi0 or eta)
2615 if (TrueGammaCandidate1->IsLargestComponentPhoton()){ // for photons its the direct mother
8bdca7f1 2616 gamma1MotherLabel=gammaMC1->GetMother();
fd94f234 2617 } else if (TrueGammaCandidate1->IsLargestComponentElectron()){ // for electrons its either the direct mother or for conversions the grandmother
2618 if (TrueGammaCandidate1->IsConversion()){
2619 AliAODMCParticle * gammaGrandMotherMC1 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gammaMC1->GetMother()));
2620 gamma1MotherLabel=gammaGrandMotherMC1->GetMother();
2621 } else gamma1MotherLabel=gammaMC1->GetMother();
8bdca7f1 2622 }
fd94f234 2623 } else {
2624 if (fDoMesonQA > 0) fHistoTrueMotherCaloEMNonLeadingInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2625 }
8bdca7f1 2626 }
fd94f234 2627
8bdca7f1 2628 if(gamma0MotherLabel>=0 && gamma0MotherLabel==gamma1MotherLabel){
fd94f234 2629 if(((AliAODMCParticle*)AODMCTrackArray->At(gamma1MotherLabel))->GetPdgCode() == 111){
8bdca7f1 2630 isTruePi0=kTRUE;
2631 }
fd94f234 2632 if(((AliAODMCParticle*)AODMCTrackArray->At(gamma1MotherLabel))->GetPdgCode() == 221){
8bdca7f1 2633 isTrueEta=kTRUE;
2634 }
2635 }
2636
8bdca7f1 2637 if(isTruePi0 || isTrueEta){// True Pion or Eta
d53bf4ac 2638 if (!matched)fHistoTrueMotherInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
8bdca7f1 2639 if (fDoMesonQA > 0){
d53bf4ac 2640 if (TrueGammaCandidate1->IsLargestComponentPhoton() && !matched)
fd94f234 2641 fHistoTrueMotherCaloPhotonInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
d53bf4ac 2642 if (TrueGammaCandidate1->IsLargestComponentElectron() && !matched)
fd94f234 2643 fHistoTrueMotherCaloElectronInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
20af4b69 2644 if (TrueGammaCandidate1->IsLargestComponentElectron() && TrueGammaCandidate1->IsConversion()){
d53bf4ac 2645 if (!matched)fHistoTrueMotherCaloConvertedPhotonInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2646 if (isTruePi0 && !matched)fHistoTruePi0CaloConvertedPhotonInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2647 if (isTrueEta && !matched)fHistoTrueEtaCaloConvertedPhotonInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
20af4b69 2648 if ((TrueGammaCandidate0->GetMCLabelPositive() == gamma1MCLabel || TrueGammaCandidate0->GetMCLabelNegative() == gamma1MCLabel) && isTruePi0)
2649 fHistoTruePi0CaloConvertedPhotonMatchedInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2650 if ((TrueGammaCandidate0->GetMCLabelPositive() == gamma1MCLabel || TrueGammaCandidate0->GetMCLabelNegative() == gamma1MCLabel) && isTrueEta)
2651 fHistoTrueEtaCaloConvertedPhotonMatchedInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2652 }
d53bf4ac 2653 if ((TrueGammaCandidate1->IsMerged() || TrueGammaCandidate1->IsMergedPartConv() || TrueGammaCandidate1->IsDalitzMerged()) && !matched )
fd94f234 2654 fHistoTrueMotherCaloMergedClusterInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
d53bf4ac 2655 if (TrueGammaCandidate1->IsMergedPartConv() && !matched)
fd94f234 2656 fHistoTrueMotherCaloMergedClusterPartConvInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2657 }
2658
d53bf4ac 2659 if ( !matched){
2660 if (fDoMesonQA > 0){
2661 if (isTruePi0){
2662 if ( Pi0Candidate->M() > 0.05 && Pi0Candidate->M() < 0.17){
2663 fHistoTruePi0PtY[fiCut]->Fill(Pi0Candidate->Pt(),Pi0Candidate->Rapidity()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift());
2664 fHistoTruePi0PtAlpha[fiCut]->Fill(Pi0Candidate->Pt(),Pi0Candidate->GetAlpha());
2665 fHistoTruePi0PtOpenAngle[fiCut]->Fill(Pi0Candidate->Pt(),Pi0Candidate->GetOpeningAngle());
2666 }
2667 } else if (isTrueEta){
2668 if ( Pi0Candidate->M() > 0.45 && Pi0Candidate->M() < 0.65){
2669 fHistoTrueEtaPtY[fiCut]->Fill(Pi0Candidate->Pt(),Pi0Candidate->Rapidity()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift());
2670 fHistoTrueEtaPtAlpha[fiCut]->Fill(Pi0Candidate->Pt(),Pi0Candidate->GetAlpha());
2671 fHistoTrueEtaPtOpenAngle[fiCut]->Fill(Pi0Candidate->Pt(),Pi0Candidate->GetOpeningAngle());
2672 }
8bdca7f1 2673 }
2674 }
d53bf4ac 2675 if(!(static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma0MotherLabel))->IsPrimary())){ // Secondary Meson
2676 Int_t secMotherLabel = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma1MotherLabel))->GetMother();
2677 Float_t weightedSec= 1;
2678 if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(secMotherLabel, 0x0, fInputEvent) && static_cast<AliAODMCParticle*>(AODMCTrackArray->At(secMotherLabel))->GetPdgCode()==310){
2679 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
2680 //cout << "MC input \t"<<i << "\t" << particle->Pt()<<"\t"<<weighted << endl;
8bdca7f1 2681 }
d53bf4ac 2682 fHistoTrueSecondaryMotherInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weightedSec);
2683 fCharMesonMCInfo = 2;
2684 if (secMotherLabel >-1){
2685 if(static_cast<AliAODMCParticle*>(AODMCTrackArray->At(secMotherLabel))->GetPdgCode()==310){
2686 fCharMesonMCInfo = 4;
2687 fHistoTrueSecondaryMotherFromK0sInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weightedSec);
2688 if (fDoMesonQA > 0)fHistoTrueK0sWithPi0DaughterMCPt[fiCut]->Fill(static_cast<AliAODMCParticle*>(AODMCTrackArray->At(secMotherLabel))->Pt());
2689 }
2690 if(static_cast<AliAODMCParticle*>(AODMCTrackArray->At(secMotherLabel))->GetPdgCode()==221){
2691 fCharMesonMCInfo = 3;
2692 fHistoTrueSecondaryMotherFromEtaInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weightedSec);
2693 if (fDoMesonQA > 0)fHistoTrueEtaWithPi0DaughterMCPt[fiCut]->Fill(static_cast<AliAODMCParticle*>(AODMCTrackArray->At(secMotherLabel))->Pt());
2694 }
2695 if(static_cast<AliAODMCParticle*>(AODMCTrackArray->At(secMotherLabel))->GetPdgCode()==3122){
2696 fCharMesonMCInfo = 7;
2697 fHistoTrueSecondaryMotherFromLambdaInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weightedSec);
2698 if (fDoMesonQA > 0)fHistoTrueLambdaWithPi0DaughterMCPt[fiCut]->Fill(static_cast<AliAODMCParticle*>(AODMCTrackArray->At(secMotherLabel))->Pt());
2699 }
8bdca7f1 2700 }
d53bf4ac 2701 } else{ // Only primary pi0 for efficiency calculation
2702 Float_t weighted= 1;
2703 fCharMesonMCInfo = 6;
2704 if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(gamma1MotherLabel, 0x0, fInputEvent)){
2705 if (static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma1MotherLabel))->Pt()>0.005){
2706 weighted= ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetWeightForMeson(fV0Reader->GetPeriodName(),gamma1MotherLabel, 0x0, fInputEvent);
2707 // cout << "rec \t " <<gamma1MotherLabel << "\t" << weighted << endl;
2708 }
8bdca7f1 2709 }
d53bf4ac 2710 fHistoTruePrimaryMotherInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weighted);
2711 fHistoTruePrimaryMotherW0WeightingInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2712 fProfileTruePrimaryMotherWeightsInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weighted);
8bdca7f1 2713
d53bf4ac 2714 if (fDoMesonQA > 0){
2715 if(isTruePi0){ // Only primary pi0 for resolution
2716 fHistoTruePrimaryPi0MCPtResolPt[fiCut]->Fill(static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma1MotherLabel))->Pt(),
2717 (Pi0Candidate->Pt()-static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma1MotherLabel))->Pt())/static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma1MotherLabel))->Pt(),weighted);
2718
2719 }
2720 if (isTrueEta){ // Only primary eta for resolution
2721 fHistoTruePrimaryEtaMCPtResolPt[fiCut]->Fill(static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma1MotherLabel))->Pt(),
2722 (Pi0Candidate->Pt()-static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma1MotherLabel))->Pt())/static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma1MotherLabel))->Pt(),weighted);
2723 }
8bdca7f1 2724 }
2725 }
d53bf4ac 2726 }
8bdca7f1 2727 } else if(!isTruePi0 && !isTrueEta) { // Background
2728 if (fDoMesonQA > 0){
2729 if(gamma0MotherLabel>-1 && gamma1MotherLabel>-1){ // Both Tracks are Photons and have a mother but not Pi0 or Eta
2730 fHistoTrueBckGGInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2731 fCharMesonMCInfo = 1;
2732 } else { // No photon or without mother
2733 fHistoTrueBckContInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2734 }
2735 }
8bdca7f1 2736 }
2737}
344100c4 2738
8bdca7f1 2739//________________________________________________________________________
2740void AliAnalysisTaskGammaConvCalo::CalculateBackground(){
2741
2742 Int_t zbin= fBGClusHandler[fiCut]->GetZBinIndex(fInputEvent->GetPrimaryVertex()->GetZ());
2743 Int_t mbin = 0;
2744
2745 if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->UseTrackMultiplicity()){
2746 mbin = fBGClusHandler[fiCut]->GetMultiplicityBinIndex(fV0Reader->GetNumberOfPrimaryTracks());
2747 } else {
2748 mbin = fBGClusHandler[fiCut]->GetMultiplicityBinIndex(fGammaCandidates->GetEntries());
2749 }
2750
2751 AliGammaConversionAODBGHandler::GammaConversionVertex *bgEventVertex = NULL;
2752 if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->UseTrackMultiplicity()){
2753 for(Int_t nEventsInBG=0;nEventsInBG<fBGClusHandler[fiCut]->GetNBGEvents();nEventsInBG++){
2754 AliGammaConversionAODVector *previousEventV0s = fBGClusHandler[fiCut]->GetBGGoodV0s(zbin,mbin,nEventsInBG);
2755 if(fMoveParticleAccordingToVertex == kTRUE){
2756 bgEventVertex = fBGClusHandler[fiCut]->GetBGEventVertex(zbin,mbin,nEventsInBG);
2757 }
2758
2759 for(Int_t iCurrent=0;iCurrent<fGammaCandidates->GetEntries();iCurrent++){
2760 AliAODConversionPhoton currentEventGoodV0 = *(AliAODConversionPhoton*)(fGammaCandidates->At(iCurrent));
2761 for(UInt_t iPrevious=0;iPrevious<previousEventV0s->size();iPrevious++){
2762 AliAODConversionPhoton previousGoodV0 = (AliAODConversionPhoton)(*(previousEventV0s->at(iPrevious)));
2763 if(fMoveParticleAccordingToVertex == kTRUE){
2764 MoveParticleAccordingToVertex(&previousGoodV0,bgEventVertex);
2765 }
344100c4 2766 if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->GetInPlaneOutOfPlaneCut() != 0){
8bdca7f1 2767 RotateParticleAccordingToEP(&previousGoodV0,bgEventVertex->fEP,fEventPlaneAngle);
2768 }
2769
2770 AliAODConversionMother *backgroundCandidate = new AliAODConversionMother(&currentEventGoodV0,&previousGoodV0);
2771 backgroundCandidate->CalculateDistanceOfClossetApproachToPrimVtx(fInputEvent->GetPrimaryVertex());
2772 if((((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))
344100c4 2773 ->MesonIsSelected(backgroundCandidate,kFALSE,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift()))){
8bdca7f1 2774 fHistoMotherBackInvMassPt[fiCut]->Fill(backgroundCandidate->M(),backgroundCandidate->Pt());
2775 Double_t sparesFill[4] = {backgroundCandidate->M(),backgroundCandidate->Pt(),(Double_t)zbin,(Double_t)mbin};
2776 fSparseMotherBackInvMassPtZM[fiCut]->Fill(sparesFill,1);
2777 }
2778 delete backgroundCandidate;
2779 backgroundCandidate = 0x0;
2780 }
2781 }
2782 }
2783 } else {
2784 for(Int_t nEventsInBG=0;nEventsInBG <fBGClusHandler[fiCut]->GetNBGEvents();nEventsInBG++){
2785 AliGammaConversionAODVector *previousEventV0s = fBGClusHandler[fiCut]->GetBGGoodV0s(zbin,mbin,nEventsInBG);
2786 if(previousEventV0s){
2787 if(fMoveParticleAccordingToVertex == kTRUE){
2788 bgEventVertex = fBGClusHandler[fiCut]->GetBGEventVertex(zbin,mbin,nEventsInBG);
2789 }
2790 for(Int_t iCurrent=0;iCurrent<fGammaCandidates->GetEntries();iCurrent++){
2791 AliAODConversionPhoton currentEventGoodV0 = *(AliAODConversionPhoton*)(fGammaCandidates->At(iCurrent));
2792 for(UInt_t iPrevious=0;iPrevious<previousEventV0s->size();iPrevious++){
2793
2794 AliAODConversionPhoton previousGoodV0 = (AliAODConversionPhoton)(*(previousEventV0s->at(iPrevious)));
2795
2796 if(fMoveParticleAccordingToVertex == kTRUE){
2797 MoveParticleAccordingToVertex(&previousGoodV0,bgEventVertex);
2798 }
344100c4 2799 if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->GetInPlaneOutOfPlaneCut() != 0){
8bdca7f1 2800 RotateParticleAccordingToEP(&previousGoodV0,bgEventVertex->fEP,fEventPlaneAngle);
2801 }
2802
8bdca7f1 2803 AliAODConversionMother *backgroundCandidate = new AliAODConversionMother(&currentEventGoodV0,&previousGoodV0);
2804 backgroundCandidate->CalculateDistanceOfClossetApproachToPrimVtx(fInputEvent->GetPrimaryVertex());
344100c4 2805 if((((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->MesonIsSelected(backgroundCandidate,kFALSE,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift()))){
8bdca7f1 2806 fHistoMotherBackInvMassPt[fiCut]->Fill(backgroundCandidate->M(),backgroundCandidate->Pt());
2807 Double_t sparesFill[4] = {backgroundCandidate->M(),backgroundCandidate->Pt(),(Double_t)zbin,(Double_t)mbin};
2808 fSparseMotherBackInvMassPtZM[fiCut]->Fill(sparesFill,1);
2809 }
2810 delete backgroundCandidate;
2811 backgroundCandidate = 0x0;
2812 }
2813 }
2814 }
2815 }
2816 }
2817}
2818
2819//________________________________________________________________________
2820void AliAnalysisTaskGammaConvCalo::CalculateBackgroundRP(){
2821
2822 Int_t zbin= fBGHandlerRP[fiCut]->GetZBinIndex(fInputEvent->GetPrimaryVertex()->GetZ());
2823 Int_t mbin = 0;
2824 if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->UseTrackMultiplicity()){
2825 mbin = fBGHandlerRP[fiCut]->GetMultiplicityBinIndex(fV0Reader->GetNumberOfPrimaryTracks());
2826 } else {
2827 mbin = fBGHandlerRP[fiCut]->GetMultiplicityBinIndex(fGammaCandidates->GetEntries());
2828 }
2829
2830
2831 //Rotation Method
2832 if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->UseRotationMethod()){
2833 // Correct for the number of rotations
2834 // BG is for rotation the same, except for factor NRotations
2835 Double_t weight=1./Double_t(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->GetNumberOfBGEvents());
2836
2837 for(Int_t firstGammaIndex=0;firstGammaIndex<fGammaCandidates->GetEntries();firstGammaIndex++){
2838
2839 AliAODConversionPhoton *gamma0=dynamic_cast<AliAODConversionPhoton*>(fGammaCandidates->At(firstGammaIndex));
2840 if (gamma0==NULL) continue;
2841 for(Int_t secondGammaIndex=firstGammaIndex+1;secondGammaIndex<fGammaCandidates->GetEntries();secondGammaIndex++){
2842 AliAODConversionPhoton *gamma1=dynamic_cast<AliAODConversionPhoton*>(fGammaCandidates->At(secondGammaIndex));
2843 if (gamma1 == NULL) continue;
344100c4 2844 if(!((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelected(gamma1,fInputEvent))continue;
8bdca7f1 2845 for(Int_t nRandom=0;nRandom<((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->GetNumberOfBGEvents();nRandom++){
2846
2847 RotateParticle(gamma1);
2848 AliAODConversionMother backgroundCandidate(gamma0,gamma1);
2849 backgroundCandidate.CalculateDistanceOfClossetApproachToPrimVtx(fInputEvent->GetPrimaryVertex());
2850 if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))
344100c4 2851 ->MesonIsSelected(&backgroundCandidate,kFALSE,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift())){
8bdca7f1 2852 fHistoMotherBackInvMassPt[fiCut]->Fill(backgroundCandidate.M(),backgroundCandidate.Pt());
2853 Double_t sparesFill[4] = {backgroundCandidate.M(),backgroundCandidate.Pt(),(Double_t)zbin,(Double_t)mbin};
2854 fSparseMotherBackInvMassPtZM[fiCut]->Fill(sparesFill,weight);
2855 }
2856 }
2857 }
2858 }
344100c4 2859 } else {
8bdca7f1 2860 // Do Event Mixing
2861 for(Int_t nEventsInBG=0;nEventsInBG <fBGHandlerRP[fiCut]->GetNBGEvents(fGammaCandidates,fInputEvent);nEventsInBG++){
2862
2863 AliGammaConversionPhotonVector *previousEventGammas = fBGHandlerRP[fiCut]->GetBGGoodGammas(fGammaCandidates,fInputEvent,nEventsInBG);
2864
2865 if(previousEventGammas){
2866 // test weighted background
2867 Double_t weight=1.0;
2868 // Correct for the number of eventmixing:
2869 // N gammas -> (N-1) + (N-2) +(N-3) ...+ (N-(N-1)) using sum formula sum(i)=N*(N-1)/2 -> N*(N-1)/2
2870 // real combinations (since you cannot combine a photon with its own)
2871 // but BG leads to N_{a}*N_{b} combinations
2872 weight*=0.5*(Double_t(fGammaCandidates->GetEntries()-1))/Double_t(previousEventGammas->size());
2873
2874 for(Int_t iCurrent=0;iCurrent<fGammaCandidates->GetEntries();iCurrent++){
2875 AliAODConversionPhoton *gamma0 = (AliAODConversionPhoton*)(fGammaCandidates->At(iCurrent));
2876 for(UInt_t iPrevious=0;iPrevious<previousEventGammas->size();iPrevious++){
2877
2878 AliAODConversionPhoton *gamma1 = (AliAODConversionPhoton*)(previousEventGammas->at(iPrevious));
2879
2880 AliAODConversionMother backgroundCandidate(gamma0,gamma1);
2881 backgroundCandidate.CalculateDistanceOfClossetApproachToPrimVtx(fInputEvent->GetPrimaryVertex());
2882 if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))
344100c4 2883 ->MesonIsSelected(&backgroundCandidate,kFALSE,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift())){
8bdca7f1 2884 fHistoMotherBackInvMassPt[fiCut]->Fill(backgroundCandidate.M(),backgroundCandidate.Pt());
2885 Double_t sparesFill[4] = {backgroundCandidate.M(),backgroundCandidate.Pt(),(Double_t)zbin,(Double_t)mbin};
2886 fSparseMotherBackInvMassPtZM[fiCut]->Fill(sparesFill,weight);
2887 }
2888 }
2889 }
2890 }
2891 }
2892 }
2893}
2894//________________________________________________________________________
2895void AliAnalysisTaskGammaConvCalo::RotateParticle(AliAODConversionPhoton *gamma){
2896 Int_t fNDegreesPMBackground= ((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->NDegreesRotation();
2897 Double_t nRadiansPM = fNDegreesPMBackground*TMath::Pi()/180;
2898 Double_t rotationValue = fRandom.Rndm()*2*nRadiansPM + TMath::Pi()-nRadiansPM;
2899 gamma->RotateZ(rotationValue);
2900}
2901
2902//________________________________________________________________________
2903void AliAnalysisTaskGammaConvCalo::RotateParticleAccordingToEP(AliAODConversionPhoton *gamma, Double_t previousEventEP, Double_t thisEventEP){
2904
2905 previousEventEP=previousEventEP+TMath::Pi();
2906 thisEventEP=thisEventEP+TMath::Pi();
2907 Double_t rotationValue= thisEventEP-previousEventEP;
2908 gamma->RotateZ(rotationValue);
2909}
2910
2911//________________________________________________________________________
2912void AliAnalysisTaskGammaConvCalo::MoveParticleAccordingToVertex(AliAODConversionPhoton* particle,const AliGammaConversionAODBGHandler::GammaConversionVertex *vertex){
2913 //see header file for documentation
2914
2915 Double_t dx = vertex->fX - fInputEvent->GetPrimaryVertex()->GetX();
2916 Double_t dy = vertex->fY - fInputEvent->GetPrimaryVertex()->GetY();
2917 Double_t dz = vertex->fZ - fInputEvent->GetPrimaryVertex()->GetZ();
2918
2919 Double_t movedPlace[3] = {particle->GetConversionX() - dx,particle->GetConversionY() - dy,particle->GetConversionZ() - dz};
2920 particle->SetConversionPoint(movedPlace);
2921}
2922//________________________________________________________________________
2923void AliAnalysisTaskGammaConvCalo::UpdateEventByEventData(){
2924 //see header file for documentation
2925 if(fGammaCandidates->GetEntries() >0 ){
2926 if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->UseTrackMultiplicity()){
2927 fBGHandler[fiCut]->AddEvent(fGammaCandidates,fInputEvent->GetPrimaryVertex()->GetX(),fInputEvent->GetPrimaryVertex()->GetY(),fInputEvent->GetPrimaryVertex()->GetZ(),fV0Reader->GetNumberOfPrimaryTracks(),fEventPlaneAngle);
2928 fBGClusHandler[fiCut]->AddEvent(fClusterCandidates,fInputEvent->GetPrimaryVertex()->GetX(),fInputEvent->GetPrimaryVertex()->GetY(),fInputEvent->GetPrimaryVertex()->GetZ(),fV0Reader->GetNumberOfPrimaryTracks(),fEventPlaneAngle);
2929 } else { // means we use #V0s for multiplicity
2930 fBGHandler[fiCut]->AddEvent(fGammaCandidates,fInputEvent->GetPrimaryVertex()->GetX(),fInputEvent->GetPrimaryVertex()->GetY(),fInputEvent->GetPrimaryVertex()->GetZ(),fGammaCandidates->GetEntries(),fEventPlaneAngle);
2931 fBGClusHandler[fiCut]->AddEvent(fClusterCandidates,fInputEvent->GetPrimaryVertex()->GetX(),fInputEvent->GetPrimaryVertex()->GetY(),fInputEvent->GetPrimaryVertex()->GetZ(),fGammaCandidates->GetEntries(),fEventPlaneAngle);
2932 }
2933 }
2934}
2935
2936
2937//________________________________________________________________________
2938void AliAnalysisTaskGammaConvCalo::FillPhotonCombinatorialBackgroundHist(AliAODConversionPhoton *TruePhotonCandidate, Int_t pdgCode[])
2939{
2940 // 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
2941 if(pdgCode[0]==11 && pdgCode[1]==11){if(fIsFromMBHeader)fHistoCombinatorialPt[fiCut]->Fill(TruePhotonCandidate->Pt(),0);}
2942 else if( (pdgCode[0]==11 && pdgCode[1]==211) || (pdgCode[0]==211 && pdgCode[1]==11) )
2943 {if(fIsFromMBHeader)fHistoCombinatorialPt[fiCut]->Fill(TruePhotonCandidate->Pt(),1);}
2944 else if( (pdgCode[0]==11 && pdgCode[1]==321) || (pdgCode[0]==321 && pdgCode[1]==11) )
2945 {if(fIsFromMBHeader)fHistoCombinatorialPt[fiCut]->Fill(TruePhotonCandidate->Pt(),2);}
2946 else if( (pdgCode[0]==11 && pdgCode[1]==2212) || (pdgCode[0]==2212 && pdgCode[1]==11) )
2947 {if(fIsFromMBHeader)fHistoCombinatorialPt[fiCut]->Fill(TruePhotonCandidate->Pt(),3);}
2948 else if( (pdgCode[0]==11 && pdgCode[1]==13) || (pdgCode[0]==13 && pdgCode[1]==11) )
2949 {if(fIsFromMBHeader)fHistoCombinatorialPt[fiCut]->Fill(TruePhotonCandidate->Pt(),4);}
2950 else if( pdgCode[0]==211 && pdgCode[1]==211 ){if(fIsFromMBHeader)fHistoCombinatorialPt[fiCut]->Fill(TruePhotonCandidate->Pt(),5);}
2951 else if( (pdgCode[0]==211 && pdgCode[1]==321) || (pdgCode[0]==321 && pdgCode[1]==211) )
2952 {if(fIsFromMBHeader)fHistoCombinatorialPt[fiCut]->Fill(TruePhotonCandidate->Pt(),6);}
2953 else if( (pdgCode[0]==211 && pdgCode[1]==2212) || (pdgCode[0]==2212 && pdgCode[1]==211) )
2954 {if(fIsFromMBHeader)fHistoCombinatorialPt[fiCut]->Fill(TruePhotonCandidate->Pt(),7);}
2955 else if( (pdgCode[0]==211 && pdgCode[1]==13) || (pdgCode[0]==13 && pdgCode[1]==211) )
2956 {if(fIsFromMBHeader)fHistoCombinatorialPt[fiCut]->Fill(TruePhotonCandidate->Pt(),8);}
2957 else if( pdgCode[0]==321 && pdgCode[1]==321 ){if(fIsFromMBHeader)fHistoCombinatorialPt[fiCut]->Fill(TruePhotonCandidate->Pt(),9);}
2958 else if( (pdgCode[0]==321 && pdgCode[1]==2212) || (pdgCode[0]==2212 && pdgCode[1]==321) )
2959 {if(fIsFromMBHeader)fHistoCombinatorialPt[fiCut]->Fill(TruePhotonCandidate->Pt(),10);}
2960 else if( (pdgCode[0]==321 && pdgCode[1]==13) || (pdgCode[0]==13 && pdgCode[1]==321) )
2961 {if(fIsFromMBHeader)fHistoCombinatorialPt[fiCut]->Fill(TruePhotonCandidate->Pt(),11);}
2962 else if( pdgCode[0]==2212 && pdgCode[1]==2212 ){if(fIsFromMBHeader)fHistoCombinatorialPt[fiCut]->Fill(TruePhotonCandidate->Pt(),12);}
2963 else if( (pdgCode[0]==2212 && pdgCode[1]==13) || (pdgCode[0]==13 && pdgCode[1]==2212) )
2964 {if(fIsFromMBHeader)fHistoCombinatorialPt[fiCut]->Fill(TruePhotonCandidate->Pt(),13);}
2965 else if( pdgCode[0]==13 && pdgCode[1]==13 ){if(fIsFromMBHeader)fHistoCombinatorialPt[fiCut]->Fill(TruePhotonCandidate->Pt(),14);}
2966 else {if(fIsFromMBHeader)fHistoCombinatorialPt[fiCut]->Fill(TruePhotonCandidate->Pt(),15);}
2967}