]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGGA/GammaConv/AliAnalysisTaskGammaCalo.cxx
added validated histograms vs conversion pt for AliAnalysisTaskGammaConvCalo.cxx...
[u/mrichter/AliRoot.git] / PWGGA / GammaConv / AliAnalysisTaskGammaCalo.cxx
CommitLineData
d53bf4ac 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 "AliAnalysisTaskGammaCalo.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 "AliAODMCParticle.h"
50#include "AliAODMCHeader.h"
51#include "AliEventplane.h"
52#include "AliAnalysisTaskEMCALClusterizeFast.h"
53#include "AliAODEvent.h"
54#include "AliAODInputHandler.h"
55#include "AliESDEvent.h"
56#include "AliESDInputHandler.h"
57#include "AliInputEventHandler.h"
58
59ClassImp(AliAnalysisTaskGammaCalo)
60
61//________________________________________________________________________
62AliAnalysisTaskGammaCalo::AliAnalysisTaskGammaCalo(): AliAnalysisTaskSE(),
63 fV0Reader(NULL),
64 fBGHandler(NULL),
65 fInputEvent(NULL),
66 fMCEvent(NULL),
67 fMCStack(NULL),
68 fCutFolder(NULL),
69 fESDList(NULL),
70 fBackList(NULL),
71 fMotherList(NULL),
72 fTrueList(NULL),
73 fMCList(NULL),
74 fHeaderNameList(NULL),
75 fOutputContainer(NULL),
76 fClusterCandidates(NULL),
77 fEventCutArray(NULL),
78 fEventCuts(NULL),
79 fClusterCutArray(NULL),
80 fCaloPhotonCuts(NULL),
81 fMesonCutArray(NULL),
82 fMesonCuts(NULL),
83 fHistoMotherInvMassPt(NULL),
8c96b4f9 84 fHistoMotherInvMass3ClusterPt(NULL),
d53bf4ac 85 fSparseMotherInvMassPtZM(NULL),
86 fHistoMotherBackInvMassPt(NULL),
87 fSparseMotherBackInvMassPtZM(NULL),
88 fHistoMotherInvMassEalpha(NULL),
89 fHistoMotherPi0PtY(NULL),
90 fHistoMotherEtaPtY(NULL),
91 fHistoMotherPi0PtAlpha(NULL),
92 fHistoMotherEtaPtAlpha(NULL),
93 fHistoMotherPi0PtOpenAngle(NULL),
94 fHistoMotherEtaPtOpenAngle(NULL),
95 fHistoMotherInvMassECalib(NULL),
96 fHistoMotherInvMassECalibalpha(NULL),
97 fHistoClusGammaPt(NULL),
ecd3e131 98 fHistoClusOverlapHeadersGammaPt(NULL),
d53bf4ac 99 fHistoMCHeaders(NULL),
100 fHistoMCAllGammaPt(NULL),
101 fHistoMCDecayGammaPi0Pt(NULL),
102 fHistoMCDecayGammaRhoPt(NULL),
103 fHistoMCDecayGammaEtaPt(NULL),
104 fHistoMCDecayGammaOmegaPt(NULL),
105 fHistoMCDecayGammaEtapPt(NULL),
106 fHistoMCDecayGammaPhiPt(NULL),
107 fHistoMCDecayGammaSigmaPt(NULL),
108 fHistoMCPi0Pt(NULL),
109 fHistoMCPi0WOWeightPt(NULL),
110 fHistoMCEtaPt(NULL),
111 fHistoMCEtaWOWeightPt(NULL),
112 fHistoMCPi0InAccPt(NULL),
113 fHistoMCEtaInAccPt(NULL),
114 fHistoMCPi0PtY(NULL),
115 fHistoMCEtaPtY(NULL),
de752898 116 fHistoMCPi0PtAlpha(NULL),
117 fHistoMCEtaPtAlpha(NULL),
d53bf4ac 118 fHistoMCK0sPt(NULL),
119 fHistoMCK0sWOWeightPt(NULL),
120 fHistoMCK0sPtY(NULL),
121 fHistoMCSecPi0PtvsSource(NULL),
122 fHistoMCSecPi0Source(NULL),
123 fHistoMCSecEtaPt(NULL),
124 fHistoMCSecEtaSource(NULL),
ed8bc1ca 125 fHistoTruePi0InvMassPt(NULL),
126 fHistoTrueEtaInvMassPt(NULL),
127 fHistoTruePi0CaloPhotonInvMassPt(NULL),
128 fHistoTrueEtaCaloPhotonInvMassPt(NULL),
d53bf4ac 129 fHistoTruePi0CaloConvertedPhotonInvMassPt(NULL),
130 fHistoTrueEtaCaloConvertedPhotonInvMassPt(NULL),
ed8bc1ca 131 fHistoTruePi0CaloMixedPhotonConvPhotonInvMassPt(NULL),
132 fHistoTrueEtaCaloMixedPhotonConvPhotonInvMassPt(NULL),
133 fHistoTruePi0CaloElectronInvMassPt(NULL),
134 fHistoTrueEtaCaloElectronInvMassPt(NULL),
135 fHistoTruePi0CaloMergedClusterInvMassPt(NULL),
136 fHistoTrueEtaCaloMergedClusterInvMassPt(NULL),
137 fHistoTruePi0CaloMergedClusterPartConvInvMassPt(NULL),
138 fHistoTrueEtaCaloMergedClusterPartConvInvMassPt(NULL),
def90c8b 139 fHistoTruePi0NonMergedElectronPhotonInvMassPt(NULL),
140 fHistoTruePi0NonMergedElectronMergedPhotonInvMassPt(NULL),
5cd70387 141 fHistoTruePi0Category1(NULL),
142 fHistoTrueEtaCategory1(NULL),
143 fHistoTruePi0Category2(NULL),
144 fHistoTrueEtaCategory2(NULL),
145 fHistoTruePi0Category3(NULL),
146 fHistoTrueEtaCategory3(NULL),
147 fHistoTruePi0Category4_6(NULL),
148 fHistoTrueEtaCategory4_6(NULL),
149 fHistoTruePi0Category5(NULL),
150 fHistoTrueEtaCategory5(NULL),
151 fHistoTruePi0Category7(NULL),
152 fHistoTrueEtaCategory7(NULL),
153 fHistoTruePi0Category8(NULL),
154 fHistoTrueEtaCategory8(NULL),
ed8bc1ca 155 fHistoTruePrimaryPi0InvMassPt(NULL),
156 fHistoTruePrimaryEtaInvMassPt(NULL),
157 fHistoTruePrimaryPi0W0WeightingInvMassPt(NULL),
158 fHistoTruePrimaryEtaW0WeightingInvMassPt(NULL),
159 fProfileTruePrimaryPi0WeightsInvMassPt(NULL),
160 fProfileTruePrimaryEtaWeightsInvMassPt(NULL),
d53bf4ac 161 fHistoTruePrimaryPi0MCPtResolPt(NULL),
162 fHistoTruePrimaryEtaMCPtResolPt(NULL),
ed8bc1ca 163 fHistoTrueSecondaryPi0InvMassPt(NULL),
164 fHistoTrueSecondaryEtaInvMassPt(NULL),
165 fHistoTrueSecondaryPi0FromK0sInvMassPt(NULL),
d53bf4ac 166 fHistoTrueK0sWithPi0DaughterMCPt(NULL),
ed8bc1ca 167 fHistoTrueSecondaryPi0FromEtaInvMassPt(NULL),
d53bf4ac 168 fHistoTrueEtaWithPi0DaughterMCPt(NULL),
ed8bc1ca 169 fHistoTrueSecondaryPi0FromLambdaInvMassPt(NULL),
d53bf4ac 170 fHistoTrueLambdaWithPi0DaughterMCPt(NULL),
171 fHistoTrueBckGGInvMassPt(NULL),
172 fHistoTrueBckContInvMassPt(NULL),
173 fHistoTruePi0PtY(NULL),
174 fHistoTrueEtaPtY(NULL),
175 fHistoTruePi0PtAlpha(NULL),
176 fHistoTrueEtaPtAlpha(NULL),
177 fHistoTruePi0PtOpenAngle(NULL),
178 fHistoTrueEtaPtOpenAngle(NULL),
179 fHistoClusPhotonBGPt(NULL),
180 fHistoClusPhotonPlusConvBGPt(NULL),
181 fHistoTrueClusGammaPt(NULL),
182 fHistoTrueClusUnConvGammaPt(NULL),
183 fHistoTrueClusUnConvGammaMCPt(NULL),
184 fHistoTrueClusElectronPt(NULL),
185 fHistoTrueClusConvGammaPt(NULL),
186 fHistoTrueClusConvGammaMCPt(NULL),
187 fHistoTrueClusConvGammaFullyPt(NULL),
188 fHistoTrueClusMergedGammaPt(NULL),
189 fHistoTrueClusMergedPartConvGammaPt(NULL),
190 fHistoTrueClusDalitzPt(NULL),
191 fHistoTrueClusDalitzMergedPt(NULL),
192 fHistoTrueClusPhotonFromElecMotherPt(NULL),
193 fHistoTrueClusShowerPt(NULL),
194 fHistoTrueClusSubLeadingPt(NULL),
195 fHistoTrueClusNParticles(NULL),
196 fHistoTrueClusEMNonLeadingPt(NULL),
197 fHistoTrueNLabelsInClus(NULL),
198 fHistoTruePrimaryClusGammaPt(NULL),
199 fHistoTruePrimaryClusGammaESDPtMCPt(NULL),
200 fHistoTruePrimaryClusConvGammaPt(NULL),
201 fHistoTruePrimaryClusConvGammaESDPtMCPt(NULL),
202 fHistoTrueSecondaryClusGammaPt(NULL),
203 fHistoTrueSecondaryClusConvGammaPt(NULL),
204 fHistoTrueSecondaryClusGammaFromXFromK0sPt(NULL),
205 fHistoTrueSecondaryClusConvGammaFromXFromK0sPt(NULL),
206 fHistoTrueSecondaryClusGammaFromXFromLambdaPt(NULL),
207 fHistoTrueSecondaryClusConvGammaFromXFromLambdaPt(NULL),
208 fHistoTrueSecondaryClusGammaFromXFromEtasPt(NULL),
209 fHistoTrueSecondaryClusConvGammaFromXFromEtasPt(NULL),
210 fHistoNEvents(NULL),
211 fHistoNGoodESDTracks(NULL),
212 fHistoNGammaCandidates(NULL),
213 fHistoNGoodESDTracksVsNGammaCanditates(NULL),
214 fHistoNV0Tracks(NULL),
215 fProfileEtaShift(NULL),
216 fEventPlaneAngle(-100),
217 fRandom(0),
218 fnCuts(0),
219 fiCut(0),
220 fIsHeavyIon(0),
221 fDoMesonAnalysis(kTRUE),
222 fDoMesonQA(0),
223 fDoClusterQA(0),
224 fIsFromMBHeader(kTRUE),
ecd3e131 225 fIsOverlappingWithOtherHeader(kFALSE),
d53bf4ac 226 fIsMC(kFALSE)
227{
228
229}
230
231//________________________________________________________________________
232AliAnalysisTaskGammaCalo::AliAnalysisTaskGammaCalo(const char *name):
233 AliAnalysisTaskSE(name),
234 fV0Reader(NULL),
235 fBGHandler(NULL),
236 fInputEvent(NULL),
237 fMCEvent(NULL),
238 fMCStack(NULL),
239 fCutFolder(NULL),
240 fESDList(NULL),
241 fBackList(NULL),
242 fMotherList(NULL),
243 fTrueList(NULL),
244 fMCList(NULL),
245 fHeaderNameList(NULL),
246 fOutputContainer(0),
247 fClusterCandidates(NULL),
248 fEventCutArray(NULL),
249 fEventCuts(NULL),
250 fClusterCutArray(NULL),
251 fCaloPhotonCuts(NULL),
252 fMesonCutArray(NULL),
253 fMesonCuts(NULL),
254 fHistoMotherInvMassPt(NULL),
8c96b4f9 255 fHistoMotherInvMass3ClusterPt(NULL),
d53bf4ac 256 fSparseMotherInvMassPtZM(NULL),
257 fHistoMotherBackInvMassPt(NULL),
258 fSparseMotherBackInvMassPtZM(NULL),
259 fHistoMotherInvMassEalpha(NULL),
260 fHistoMotherPi0PtY(NULL),
261 fHistoMotherEtaPtY(NULL),
262 fHistoMotherPi0PtAlpha(NULL),
263 fHistoMotherEtaPtAlpha(NULL),
264 fHistoMotherPi0PtOpenAngle(NULL),
265 fHistoMotherEtaPtOpenAngle(NULL),
266 fHistoMotherInvMassECalib(NULL),
267 fHistoMotherInvMassECalibalpha(NULL),
268 fHistoClusGammaPt(NULL),
ecd3e131 269 fHistoClusOverlapHeadersGammaPt(NULL),
d53bf4ac 270 fHistoMCHeaders(NULL),
271 fHistoMCAllGammaPt(NULL),
272 fHistoMCDecayGammaPi0Pt(NULL),
273 fHistoMCDecayGammaRhoPt(NULL),
274 fHistoMCDecayGammaEtaPt(NULL),
275 fHistoMCDecayGammaOmegaPt(NULL),
276 fHistoMCDecayGammaEtapPt(NULL),
277 fHistoMCDecayGammaPhiPt(NULL),
278 fHistoMCDecayGammaSigmaPt(NULL),
279 fHistoMCPi0Pt(NULL),
280 fHistoMCPi0WOWeightPt(NULL),
281 fHistoMCEtaPt(NULL),
282 fHistoMCEtaWOWeightPt(NULL),
283 fHistoMCPi0InAccPt(NULL),
284 fHistoMCEtaInAccPt(NULL),
285 fHistoMCPi0PtY(NULL),
286 fHistoMCEtaPtY(NULL),
de752898 287 fHistoMCPi0PtAlpha(NULL),
288 fHistoMCEtaPtAlpha(NULL),
d53bf4ac 289 fHistoMCK0sPt(NULL),
290 fHistoMCK0sWOWeightPt(NULL),
291 fHistoMCK0sPtY(NULL),
292 fHistoMCSecPi0PtvsSource(NULL),
293 fHistoMCSecPi0Source(NULL),
294 fHistoMCSecEtaPt(NULL),
295 fHistoMCSecEtaSource(NULL),
ed8bc1ca 296 fHistoTruePi0InvMassPt(NULL),
297 fHistoTrueEtaInvMassPt(NULL),
298 fHistoTruePi0CaloPhotonInvMassPt(NULL),
299 fHistoTrueEtaCaloPhotonInvMassPt(NULL),
d53bf4ac 300 fHistoTruePi0CaloConvertedPhotonInvMassPt(NULL),
301 fHistoTrueEtaCaloConvertedPhotonInvMassPt(NULL),
ed8bc1ca 302 fHistoTruePi0CaloMixedPhotonConvPhotonInvMassPt(NULL),
303 fHistoTrueEtaCaloMixedPhotonConvPhotonInvMassPt(NULL),
304 fHistoTruePi0CaloElectronInvMassPt(NULL),
305 fHistoTrueEtaCaloElectronInvMassPt(NULL),
306 fHistoTruePi0CaloMergedClusterInvMassPt(NULL),
307 fHistoTrueEtaCaloMergedClusterInvMassPt(NULL),
308 fHistoTruePi0CaloMergedClusterPartConvInvMassPt(NULL),
309 fHistoTrueEtaCaloMergedClusterPartConvInvMassPt(NULL),
def90c8b 310 fHistoTruePi0NonMergedElectronPhotonInvMassPt(NULL),
311 fHistoTruePi0NonMergedElectronMergedPhotonInvMassPt(NULL),
5cd70387 312 fHistoTruePi0Category1(NULL),
313 fHistoTrueEtaCategory1(NULL),
314 fHistoTruePi0Category2(NULL),
315 fHistoTrueEtaCategory2(NULL),
316 fHistoTruePi0Category3(NULL),
317 fHistoTrueEtaCategory3(NULL),
318 fHistoTruePi0Category4_6(NULL),
319 fHistoTrueEtaCategory4_6(NULL),
320 fHistoTruePi0Category5(NULL),
321 fHistoTrueEtaCategory5(NULL),
322 fHistoTruePi0Category7(NULL),
323 fHistoTrueEtaCategory7(NULL),
324 fHistoTruePi0Category8(NULL),
325 fHistoTrueEtaCategory8(NULL),
ed8bc1ca 326 fHistoTruePrimaryPi0InvMassPt(NULL),
327 fHistoTruePrimaryEtaInvMassPt(NULL),
328 fHistoTruePrimaryPi0W0WeightingInvMassPt(NULL),
329 fHistoTruePrimaryEtaW0WeightingInvMassPt(NULL),
330 fProfileTruePrimaryPi0WeightsInvMassPt(NULL),
331 fProfileTruePrimaryEtaWeightsInvMassPt(NULL),
d53bf4ac 332 fHistoTruePrimaryPi0MCPtResolPt(NULL),
333 fHistoTruePrimaryEtaMCPtResolPt(NULL),
ed8bc1ca 334 fHistoTrueSecondaryPi0InvMassPt(NULL),
335 fHistoTrueSecondaryEtaInvMassPt(NULL),
336 fHistoTrueSecondaryPi0FromK0sInvMassPt(NULL),
d53bf4ac 337 fHistoTrueK0sWithPi0DaughterMCPt(NULL),
ed8bc1ca 338 fHistoTrueSecondaryPi0FromEtaInvMassPt(NULL),
d53bf4ac 339 fHistoTrueEtaWithPi0DaughterMCPt(NULL),
ed8bc1ca 340 fHistoTrueSecondaryPi0FromLambdaInvMassPt(NULL),
d53bf4ac 341 fHistoTrueLambdaWithPi0DaughterMCPt(NULL),
342 fHistoTrueBckGGInvMassPt(NULL),
343 fHistoTrueBckContInvMassPt(NULL),
344 fHistoTruePi0PtY(NULL),
345 fHistoTrueEtaPtY(NULL),
346 fHistoTruePi0PtAlpha(NULL),
347 fHistoTrueEtaPtAlpha(NULL),
348 fHistoTruePi0PtOpenAngle(NULL),
349 fHistoTrueEtaPtOpenAngle(NULL),
350 fHistoClusPhotonBGPt(NULL),
351 fHistoClusPhotonPlusConvBGPt(NULL),
352 fHistoTrueClusGammaPt(NULL),
353 fHistoTrueClusUnConvGammaPt(NULL),
354 fHistoTrueClusUnConvGammaMCPt(NULL),
355 fHistoTrueClusElectronPt(NULL),
356 fHistoTrueClusConvGammaPt(NULL),
357 fHistoTrueClusConvGammaMCPt(NULL),
358 fHistoTrueClusConvGammaFullyPt(NULL),
359 fHistoTrueClusMergedGammaPt(NULL),
360 fHistoTrueClusMergedPartConvGammaPt(NULL),
361 fHistoTrueClusDalitzPt(NULL),
362 fHistoTrueClusDalitzMergedPt(NULL),
363 fHistoTrueClusPhotonFromElecMotherPt(NULL),
364 fHistoTrueClusShowerPt(NULL),
365 fHistoTrueClusSubLeadingPt(NULL),
366 fHistoTrueClusNParticles(NULL),
367 fHistoTrueClusEMNonLeadingPt(NULL),
368 fHistoTrueNLabelsInClus(NULL),
369 fHistoTruePrimaryClusGammaPt(NULL),
370 fHistoTruePrimaryClusGammaESDPtMCPt(NULL),
371 fHistoTruePrimaryClusConvGammaPt(NULL),
372 fHistoTruePrimaryClusConvGammaESDPtMCPt(NULL),
373 fHistoTrueSecondaryClusGammaPt(NULL),
374 fHistoTrueSecondaryClusConvGammaPt(NULL),
375 fHistoTrueSecondaryClusGammaFromXFromK0sPt(NULL),
376 fHistoTrueSecondaryClusConvGammaFromXFromK0sPt(NULL),
377 fHistoTrueSecondaryClusGammaFromXFromLambdaPt(NULL),
378 fHistoTrueSecondaryClusConvGammaFromXFromLambdaPt(NULL),
379 fHistoTrueSecondaryClusGammaFromXFromEtasPt(NULL),
380 fHistoTrueSecondaryClusConvGammaFromXFromEtasPt(NULL),
381 fHistoNEvents(NULL),
382 fHistoNGoodESDTracks(NULL),
383 fHistoNGammaCandidates(NULL),
384 fHistoNGoodESDTracksVsNGammaCanditates(NULL),
385 fHistoNV0Tracks(NULL),
386 fProfileEtaShift(NULL),
387 fEventPlaneAngle(-100),
388 fRandom(0),
389 fnCuts(0),
390 fiCut(0),
391 fIsHeavyIon(0),
392 fDoMesonAnalysis(kTRUE),
393 fDoMesonQA(0),
394 fDoClusterQA(0),
395 fIsFromMBHeader(kTRUE),
ecd3e131 396 fIsOverlappingWithOtherHeader(kFALSE),
d53bf4ac 397 fIsMC(kFALSE)
398{
399 // Define output slots here
400 DefineOutput(1, TList::Class());
401}
402
403AliAnalysisTaskGammaCalo::~AliAnalysisTaskGammaCalo()
404{
405 if(fClusterCandidates){
406 delete fClusterCandidates;
407 fClusterCandidates = 0x0;
408 }
409 if(fBGHandler){
410 delete[] fBGHandler;
411 fBGHandler = 0x0;
412 }
413}
414//___________________________________________________________
415void AliAnalysisTaskGammaCalo::InitBack(){
416
417 const Int_t nDim = 4;
cfd87ccd 418 Int_t nBins[nDim] = {800,250,7,6};
d53bf4ac 419 Double_t xMin[nDim] = {0,0, 0,0};
cfd87ccd 420 Double_t xMax[nDim] = {0.8,25,7,6};
d53bf4ac 421
422 fSparseMotherInvMassPtZM = new THnSparseF*[fnCuts];
423 fSparseMotherBackInvMassPtZM = new THnSparseF*[fnCuts];
424
425 fBGHandler = new AliGammaConversionAODBGHandler*[fnCuts];
426
427
428 for(Int_t iCut = 0; iCut<fnCuts;iCut++){
429 if (((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->DoBGCalculation()){
430 TString cutstringEvent = ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber();
431 TString cutstringCalo = ((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetCutNumber();
432 TString cutstringMeson = ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutNumber();
433
434 Int_t collisionSystem = atoi((TString)(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber())(0,1));
435 Int_t centMin = atoi((TString)(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber())(1,1));
436 Int_t centMax = atoi((TString)(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber())(2,1));
437
438 if(collisionSystem == 1 || collisionSystem == 2 ||
439 collisionSystem == 5 || collisionSystem == 8 ||
440 collisionSystem == 9){
441 centMin = centMin*10;
442 centMax = centMax*10;
443 if(centMax ==0 && centMax!=centMin) centMax=100;
444 } else if(collisionSystem == 3 || collisionSystem == 6){
445 centMin = centMin*5;
446 centMax = centMax*5;
447 } else if(collisionSystem == 4 || collisionSystem == 7){
448 centMin = ((centMin*5)+45);
449 centMax = ((centMax*5)+45);
450 }
451
452 fBackList[iCut] = new TList();
453 fBackList[iCut]->SetName(Form("%s_%s_%s Back histograms",cutstringEvent.Data(),cutstringCalo.Data(), cutstringMeson.Data()));
454 fBackList[iCut]->SetOwner(kTRUE);
455 fCutFolder[iCut]->Add(fBackList[iCut]);
456
457 fSparseMotherBackInvMassPtZM[iCut] = new THnSparseF("Back_Back_InvMass_Pt_z_m","Back_Back_InvMass_Pt_z_m",nDim,nBins,xMin,xMax);
458 fBackList[iCut]->Add(fSparseMotherBackInvMassPtZM[iCut]);
459
460 fMotherList[iCut] = new TList();
461 fMotherList[iCut]->SetName(Form("%s_%s_%s Mother histograms",cutstringEvent.Data(),cutstringCalo.Data(),cutstringMeson.Data()));
462 fMotherList[iCut]->SetOwner(kTRUE);
463 fCutFolder[iCut]->Add(fMotherList[iCut]);
464
465 fSparseMotherInvMassPtZM[iCut] = new THnSparseF("Back_Mother_InvMass_Pt_z_m","Back_Mother_InvMass_Pt_z_m",nDim,nBins,xMin,xMax);
466 fMotherList[iCut]->Add(fSparseMotherInvMassPtZM[iCut]);
467
468 if(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->BackgroundHandlerType() == 0){
469 fBGHandler[iCut] = new AliGammaConversionAODBGHandler(
470 collisionSystem,centMin,centMax,
471 ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetNumberOfBGEvents(),
cfd87ccd 472 ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->UseTrackMultiplicity(),
473 4,8,7);
d53bf4ac 474 }
475 }
476 }
477}
478//________________________________________________________________________
479void AliAnalysisTaskGammaCalo::UserCreateOutputObjects(){
480
481 // Create histograms
482 if(fOutputContainer != NULL){
483 delete fOutputContainer;
484 fOutputContainer = NULL;
485 }
486 if(fOutputContainer == NULL){
487 fOutputContainer = new TList();
488 fOutputContainer->SetOwner(kTRUE);
489 }
490
491 // Array of current cut's gammas
492 fClusterCandidates = new TList();
493
494 fCutFolder = new TList*[fnCuts];
495 fESDList = new TList*[fnCuts];
496 fBackList = new TList*[fnCuts];
497 fMotherList = new TList*[fnCuts];
498 fHistoNEvents = new TH1I*[fnCuts];
499 fHistoNGoodESDTracks = new TH1I*[fnCuts];
500 fHistoNGammaCandidates = new TH1I*[fnCuts];
501 fHistoNGoodESDTracksVsNGammaCanditates = new TH2F*[fnCuts];
502 fHistoNV0Tracks = new TH1I*[fnCuts];
503 fProfileEtaShift = new TProfile*[fnCuts];
504
505 if(fDoMesonAnalysis){
506 fHistoMotherInvMassPt = new TH2F*[fnCuts];
8c96b4f9 507 fHistoMotherInvMass3ClusterPt = new TH2F*[fnCuts];
d53bf4ac 508 fHistoMotherBackInvMassPt = new TH2F*[fnCuts];
509 fHistoMotherInvMassEalpha = new TH2F*[fnCuts];
510 if (fDoMesonQA > 0){
511 fHistoMotherPi0PtY = new TH2F*[fnCuts];
512 fHistoMotherEtaPtY = new TH2F*[fnCuts];
513 fHistoMotherPi0PtAlpha = new TH2F*[fnCuts];
514 fHistoMotherEtaPtAlpha = new TH2F*[fnCuts];
515 fHistoMotherPi0PtOpenAngle = new TH2F*[fnCuts];
516 fHistoMotherEtaPtOpenAngle = new TH2F*[fnCuts];
517 }
518 if(fDoMesonQA == 1){
519 fHistoMotherInvMassECalib = new TH2F*[fnCuts];
520 fHistoMotherInvMassECalibalpha = new TH2F*[fnCuts];
521 }
522 }
523
524 fHistoClusGammaPt = new TH1F*[fnCuts];
ecd3e131 525 fHistoClusOverlapHeadersGammaPt = new TH1F*[fnCuts];
d53bf4ac 526
527 for(Int_t iCut = 0; iCut<fnCuts;iCut++){
528 TString cutstringEvent = ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber();
529 TString cutstringCalo = ((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetCutNumber();
530 TString cutstringMeson = "NoMesonCut";
531 if(fDoMesonAnalysis)cutstringMeson = ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutNumber();
532
533 fCutFolder[iCut] = new TList();
534 fCutFolder[iCut]->SetName(Form("Cut Number %s_%s_%s",cutstringEvent.Data(),cutstringCalo.Data(),cutstringMeson.Data()));
535 fCutFolder[iCut]->SetOwner(kTRUE);
536 fOutputContainer->Add(fCutFolder[iCut]);
537 fESDList[iCut] = new TList();
538 fESDList[iCut]->SetName(Form("%s_%s_%s ESD histograms",cutstringEvent.Data(),cutstringCalo.Data(),cutstringMeson.Data()));
539 fESDList[iCut]->SetOwner(kTRUE);
540 fCutFolder[iCut]->Add(fESDList[iCut]);
541
7f070437 542 fHistoNEvents[iCut] = new TH1I("NEvents","NEvents",10,-0.5,9.5);
d53bf4ac 543 fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(1,"Accepted");
544 fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(2,"Centrality");
545 fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(3,"Missing MC");
f57c67ac 546 if (((AliConvEventCuts*)fEventCutArray->At(iCut))->IsSpecialTrigger() > 1 ){
d53bf4ac 547 TString TriggerNames = "Not Trigger: ";
548 TriggerNames = TriggerNames+ ( (AliConvEventCuts*)fEventCutArray->At(iCut))->GetSpecialTriggerName();
549 fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(4,TriggerNames.Data());
550 } else {
551 fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(4,"Trigger");
552 }
553 fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(5,"Vertex Z");
554 fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(6,"Cont. Vertex");
555 fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(7,"Pile-Up");
556 fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(8,"no SDD");
557 fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(9,"no V0AND");
7f070437 558 fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(10,"EMCAL problems");
d53bf4ac 559 fESDList[iCut]->Add(fHistoNEvents[iCut]);
560
561 if(fIsHeavyIon == 1) fHistoNGoodESDTracks[iCut] = new TH1I("GoodESDTracks","GoodESDTracks",4000,0,4000);
562 else if(fIsHeavyIon == 2) fHistoNGoodESDTracks[iCut] = new TH1I("GoodESDTracks","GoodESDTracks",400,0,400);
563 else fHistoNGoodESDTracks[iCut] = new TH1I("GoodESDTracks","GoodESDTracks",200,0,200);
564 fESDList[iCut]->Add(fHistoNGoodESDTracks[iCut]);
565 if(fIsHeavyIon == 1) fHistoNGammaCandidates[iCut] = new TH1I("GammaCandidates","GammaCandidates",600,0,600);
566 else if(fIsHeavyIon == 2) fHistoNGammaCandidates[iCut] = new TH1I("GammaCandidates","GammaCandidates",400,0,400);
567 else fHistoNGammaCandidates[iCut] = new TH1I("GammaCandidates","GammaCandidates",100,0,100);
568 fESDList[iCut]->Add(fHistoNGammaCandidates[iCut]);
569 if(fIsHeavyIon == 1) fHistoNGoodESDTracksVsNGammaCanditates[iCut] = new TH2F("GoodESDTracksVsGammaCandidates","GoodESDTracksVsGammaCandidates",4000,0,4000,600,0,600);
570 else if(fIsHeavyIon == 2) fHistoNGoodESDTracksVsNGammaCanditates[iCut] = new TH2F("GoodESDTracksVsGammaCandidates","GoodESDTracksVsGammaCandidates",400,0,400,400,0,400);
571 else fHistoNGoodESDTracksVsNGammaCanditates[iCut] = new TH2F("GoodESDTracksVsGammaCandidates","GoodESDTracksVsGammaCandidates",200,0,200,100,0,100);
572 fESDList[iCut]->Add(fHistoNGoodESDTracksVsNGammaCanditates[iCut]);
573
574
575 if(fIsHeavyIon == 1) fHistoNV0Tracks[iCut] = new TH1I("V0 Multiplicity","V0 Multiplicity",30000,0,30000);
576 else if(fIsHeavyIon == 2) fHistoNV0Tracks[iCut] = new TH1I("V0 Multiplicity","V0 Multiplicity",2500,0,2500);
577 else fHistoNV0Tracks[iCut] = new TH1I("V0 Multiplicity","V0 Multiplicity",1500,0,1500);
578 fESDList[iCut]->Add(fHistoNV0Tracks[iCut]);
579 fProfileEtaShift[iCut] = new TProfile("Eta Shift","Eta Shift",1, -0.5,0.5);
580 fESDList[iCut]->Add(fProfileEtaShift[iCut]);
581
582 fHistoClusGammaPt[iCut] = new TH1F("ClusGamma_Pt","ClusGamma_Pt",250,0,25);
583 fESDList[iCut]->Add(fHistoClusGammaPt[iCut]);
ecd3e131 584 fHistoClusOverlapHeadersGammaPt[iCut] = new TH1F("ClusGammaOverlapHeaders_Pt","ClusGammaOverlapHeaders_Pt",250,0,25);
585 fESDList[iCut]->Add(fHistoClusOverlapHeadersGammaPt[iCut]);
d53bf4ac 586
587 if(fDoMesonAnalysis){
588 fHistoMotherInvMassPt[iCut] = new TH2F("ESD_Mother_InvMass_Pt","ESD_Mother_InvMass_Pt",800,0,0.8,250,0,25);
589 fESDList[iCut]->Add(fHistoMotherInvMassPt[iCut]);
8c96b4f9 590 fHistoMotherInvMass3ClusterPt[iCut] = new TH2F("ESD_Mother_InvMass3Cluster_Pt","ESD_Mother_InvMass3Cluster_Pt",800,0,0.8,250,0,25);
591 fESDList[iCut]->Add(fHistoMotherInvMass3ClusterPt[iCut]);
d53bf4ac 592 fHistoMotherBackInvMassPt[iCut] = new TH2F("ESD_Background_InvMass_Pt","ESD_Background_InvMass_Pt",800,0,0.8,250,0,25);
593 fESDList[iCut]->Add(fHistoMotherBackInvMassPt[iCut]);
594 fHistoMotherInvMassEalpha[iCut] = new TH2F("ESD_Mother_InvMass_vs_E_alpha","ESD_Mother_InvMass_vs_E_alpha",800,0,0.8,250,0,25);
595 fESDList[iCut]->Add(fHistoMotherInvMassEalpha[iCut]);
596 if(fDoMesonQA == 1){
597 fHistoMotherInvMassECalib[iCut] = new TH2F("ESD_Mother_InvMass_Pt_Calib","ESD_Mother_InvMass_Pt_Calib",800,0,0.8,250,0,25);
598 fESDList[iCut]->Add(fHistoMotherInvMassECalib[iCut]);
599 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);
600 fESDList[iCut]->Add(fHistoMotherInvMassECalibalpha[iCut]);
601 }
602
603 if (fDoMesonQA > 0 ){
604 fHistoMotherPi0PtY[iCut] = new TH2F("ESD_MotherPi0_Pt_Y","ESD_MotherPi0_Pt_Y",150,0.03,15.,150,-1.5,1.5);
605 SetLogBinningXTH2(fHistoMotherPi0PtY[iCut]);
606 fESDList[iCut]->Add(fHistoMotherPi0PtY[iCut]);
607 fHistoMotherEtaPtY[iCut] = new TH2F("ESD_MotherEta_Pt_Y","ESD_MotherEta_Pt_Y",150,0.03,15.,150,-1.5,1.5);
608 SetLogBinningXTH2(fHistoMotherEtaPtY[iCut]);
609 fESDList[iCut]->Add(fHistoMotherEtaPtY[iCut]);
610 fHistoMotherPi0PtAlpha[iCut] = new TH2F("ESD_MotherPi0_Pt_Alpha","ESD_MotherPi0_Pt_Alpha",150,0.03,15.,100,0,1);
611 SetLogBinningXTH2(fHistoMotherPi0PtAlpha[iCut]);
612 fESDList[iCut]->Add(fHistoMotherPi0PtAlpha[iCut]);
613 fHistoMotherEtaPtAlpha[iCut] = new TH2F("ESD_MotherEta_Pt_Alpha","ESD_MotherEta_Pt_Alpha",150,0.03,15.,100,0,1);
614 SetLogBinningXTH2(fHistoMotherEtaPtAlpha[iCut]);
615 fESDList[iCut]->Add(fHistoMotherEtaPtAlpha[iCut]);
f57c67ac 616 fHistoMotherPi0PtOpenAngle[iCut] = new TH2F("ESD_MotherPi0_Pt_OpenAngle","ESD_MotherPi0_Pt_OpenAngle",150,0.03,15.,100,0,TMath::Pi());
d53bf4ac 617 SetLogBinningXTH2(fHistoMotherPi0PtOpenAngle[iCut]);
618 fESDList[iCut]->Add(fHistoMotherPi0PtOpenAngle[iCut]);
f57c67ac 619 fHistoMotherEtaPtOpenAngle[iCut] = new TH2F("ESD_MotherEta_Pt_OpenAngle","ESD_MotherEta_Pt_OpenAngle",150,0.03,15.,100,0,TMath::Pi());
d53bf4ac 620 SetLogBinningXTH2(fHistoMotherEtaPtOpenAngle[iCut]);
621 fESDList[iCut]->Add(fHistoMotherEtaPtOpenAngle[iCut]);
622 }
623 }
624 }
625 if(fDoMesonAnalysis){
626 InitBack(); // Init Background Handler
627 }
628
629 if(fIsMC){
630 // MC Histogramms
631 fMCList = new TList*[fnCuts];
632 // True Histogramms
633 fTrueList = new TList*[fnCuts];
634 // Selected Header List
635 fHeaderNameList = new TList*[fnCuts];
636 fHistoMCHeaders = new TH1I*[fnCuts];
637 fHistoMCAllGammaPt = new TH1F*[fnCuts];
638 fHistoMCDecayGammaPi0Pt = new TH1F*[fnCuts];
639 fHistoMCDecayGammaRhoPt = new TH1F*[fnCuts];
640 fHistoMCDecayGammaEtaPt = new TH1F*[fnCuts];
641 fHistoMCDecayGammaOmegaPt = new TH1F*[fnCuts];
642 fHistoMCDecayGammaEtapPt = new TH1F*[fnCuts];
643 fHistoMCDecayGammaPhiPt = new TH1F*[fnCuts];
644 fHistoMCDecayGammaSigmaPt = new TH1F*[fnCuts];
645
646 fHistoClusPhotonBGPt = new TH2F*[fnCuts];
647 fHistoClusPhotonPlusConvBGPt = new TH2F*[fnCuts];
648
649 fHistoTrueClusGammaPt = new TH1F*[fnCuts];
650 fHistoTruePrimaryClusGammaPt = new TH1F*[fnCuts];
651 fHistoTruePrimaryClusGammaESDPtMCPt = new TH2F*[fnCuts];
652 fHistoTruePrimaryClusConvGammaPt = new TH1F*[fnCuts];
653 fHistoTruePrimaryClusConvGammaESDPtMCPt = new TH2F*[fnCuts];
654 fHistoTrueSecondaryClusGammaPt = new TH1F*[fnCuts];
655 fHistoTrueSecondaryClusConvGammaPt = new TH1F*[fnCuts];
656 fHistoTrueSecondaryClusGammaFromXFromK0sPt = new TH1F*[fnCuts];
657 fHistoTrueSecondaryClusConvGammaFromXFromK0sPt = new TH1F*[fnCuts];
658 fHistoTrueSecondaryClusGammaFromXFromLambdaPt = new TH1F*[fnCuts];
659 fHistoTrueSecondaryClusConvGammaFromXFromLambdaPt = new TH1F*[fnCuts];
660 fHistoTrueSecondaryClusGammaFromXFromEtasPt = new TH1F*[fnCuts];
661 fHistoTrueSecondaryClusConvGammaFromXFromEtasPt = new TH1F*[fnCuts];
662
d53bf4ac 663 if (fDoClusterQA > 0){
664 fHistoTrueClusUnConvGammaPt = new TH1F*[fnCuts];
665 fHistoTrueClusUnConvGammaMCPt = new TH1F*[fnCuts];
666 fHistoTrueClusElectronPt = new TH1F*[fnCuts];
667 fHistoTrueClusConvGammaPt = new TH1F*[fnCuts];
668 fHistoTrueClusConvGammaMCPt = new TH1F*[fnCuts];
669 fHistoTrueClusConvGammaFullyPt = new TH1F*[fnCuts];
670 fHistoTrueClusMergedGammaPt = new TH1F*[fnCuts];
671 fHistoTrueClusMergedPartConvGammaPt = new TH1F*[fnCuts];
672 fHistoTrueClusDalitzPt = new TH1F*[fnCuts];
673 fHistoTrueClusDalitzMergedPt = new TH1F*[fnCuts];
674 fHistoTrueClusPhotonFromElecMotherPt= new TH1F*[fnCuts];
675 fHistoTrueClusShowerPt = new TH1F*[fnCuts];
676 fHistoTrueClusSubLeadingPt = new TH1F*[fnCuts];
677 fHistoTrueClusNParticles = new TH1I*[fnCuts];
678 fHistoTrueClusEMNonLeadingPt = new TH1F*[fnCuts];
679 fHistoTrueNLabelsInClus = new TH1F*[fnCuts];
680 }
681
682 if(fDoMesonAnalysis){
683 fHistoMCPi0Pt = new TH1F*[fnCuts];
684 fHistoMCPi0WOWeightPt = new TH1F*[fnCuts];
685 fHistoMCEtaPt = new TH1F*[fnCuts];
686 fHistoMCEtaWOWeightPt = new TH1F*[fnCuts];
687 fHistoMCPi0InAccPt = new TH1F*[fnCuts];
688 fHistoMCEtaInAccPt = new TH1F*[fnCuts];
689
ed8bc1ca 690 fHistoTruePi0InvMassPt = new TH2F*[fnCuts];
691 fHistoTrueEtaInvMassPt = new TH2F*[fnCuts];
692 fHistoTruePrimaryPi0InvMassPt = new TH2F*[fnCuts];
693 fHistoTruePrimaryEtaInvMassPt = new TH2F*[fnCuts];
694 fHistoTruePrimaryPi0W0WeightingInvMassPt = new TH2F*[fnCuts];
695 fHistoTruePrimaryEtaW0WeightingInvMassPt = new TH2F*[fnCuts];
696 fProfileTruePrimaryPi0WeightsInvMassPt = new TProfile2D*[fnCuts];
697 fProfileTruePrimaryEtaWeightsInvMassPt = new TProfile2D*[fnCuts];
698 fHistoTrueSecondaryPi0InvMassPt = new TH2F*[fnCuts];
699 fHistoTrueSecondaryEtaInvMassPt = new TH2F*[fnCuts];
700 fHistoTrueSecondaryPi0FromK0sInvMassPt = new TH2F*[fnCuts];
701 fHistoTrueSecondaryPi0FromEtaInvMassPt = new TH2F*[fnCuts];
702 fHistoTrueSecondaryPi0FromLambdaInvMassPt = new TH2F*[fnCuts];
d53bf4ac 703 if (fDoMesonQA > 0){
704 fHistoMCPi0PtY = new TH2F*[fnCuts];
705 fHistoMCEtaPtY = new TH2F*[fnCuts];
de752898 706 fHistoMCPi0PtAlpha = new TH2F*[fnCuts];
707 fHistoMCEtaPtAlpha = new TH2F*[fnCuts];
d53bf4ac 708 fHistoMCK0sPt = new TH1F*[fnCuts];
709 fHistoMCK0sWOWeightPt = new TH1F*[fnCuts];
710 fHistoMCK0sPtY = new TH2F*[fnCuts];
711 fHistoMCSecPi0PtvsSource = new TH2F*[fnCuts];
712 fHistoMCSecPi0Source = new TH1F*[fnCuts];
713 fHistoMCSecEtaPt = new TH1F*[fnCuts];
714 fHistoMCSecEtaSource = new TH1F*[fnCuts];
ed8bc1ca 715 fHistoTruePi0CaloPhotonInvMassPt = new TH2F*[fnCuts];
716 fHistoTrueEtaCaloPhotonInvMassPt = new TH2F*[fnCuts];
717 fHistoTruePi0CaloMixedPhotonConvPhotonInvMassPt= new TH2F*[fnCuts];
718 fHistoTrueEtaCaloMixedPhotonConvPhotonInvMassPt= new TH2F*[fnCuts];
d53bf4ac 719 fHistoTruePi0CaloConvertedPhotonInvMassPt = new TH2F*[fnCuts];
720 fHistoTrueEtaCaloConvertedPhotonInvMassPt = new TH2F*[fnCuts];
ed8bc1ca 721 fHistoTruePi0CaloElectronInvMassPt = new TH2F*[fnCuts];
722 fHistoTrueEtaCaloElectronInvMassPt = new TH2F*[fnCuts];
723 fHistoTruePi0CaloMergedClusterInvMassPt = new TH2F*[fnCuts];
724 fHistoTrueEtaCaloMergedClusterInvMassPt = new TH2F*[fnCuts];
725 fHistoTruePi0CaloMergedClusterPartConvInvMassPt = new TH2F*[fnCuts];
726 fHistoTrueEtaCaloMergedClusterPartConvInvMassPt = new TH2F*[fnCuts];
def90c8b 727 fHistoTruePi0NonMergedElectronPhotonInvMassPt = new TH2F*[fnCuts];
728 fHistoTruePi0NonMergedElectronMergedPhotonInvMassPt = new TH2F*[fnCuts];
d53bf4ac 729 fHistoTruePrimaryPi0MCPtResolPt = new TH2F*[fnCuts];
730 fHistoTruePrimaryEtaMCPtResolPt = new TH2F*[fnCuts];
731 fHistoTrueK0sWithPi0DaughterMCPt = new TH1F*[fnCuts];
732 fHistoTrueEtaWithPi0DaughterMCPt = new TH1F*[fnCuts];
733 fHistoTrueLambdaWithPi0DaughterMCPt = new TH1F*[fnCuts];
734 fHistoTrueBckGGInvMassPt = new TH2F*[fnCuts];
735 fHistoTrueBckContInvMassPt = new TH2F*[fnCuts];
736 fHistoTruePi0PtY = new TH2F*[fnCuts];
737 fHistoTrueEtaPtY = new TH2F*[fnCuts];
738 fHistoTruePi0PtAlpha = new TH2F*[fnCuts];
739 fHistoTrueEtaPtAlpha = new TH2F*[fnCuts];
740 fHistoTruePi0PtOpenAngle = new TH2F*[fnCuts];
741 fHistoTrueEtaPtOpenAngle = new TH2F*[fnCuts];
742 }
5cd70387 743 if (fDoMesonQA==2){
744 fHistoTruePi0Category1 = new TH2F*[fnCuts];
745 fHistoTrueEtaCategory1 = new TH2F*[fnCuts];
746 fHistoTruePi0Category2 = new TH2F*[fnCuts];
747 fHistoTrueEtaCategory2 = new TH2F*[fnCuts];
748 fHistoTruePi0Category3 = new TH2F*[fnCuts];
749 fHistoTrueEtaCategory3 = new TH2F*[fnCuts];
750 fHistoTruePi0Category4_6 = new TH2F*[fnCuts];
751 fHistoTrueEtaCategory4_6 = new TH2F*[fnCuts];
752 fHistoTruePi0Category5 = new TH2F*[fnCuts];
753 fHistoTrueEtaCategory5 = new TH2F*[fnCuts];
754 fHistoTruePi0Category7 = new TH2F*[fnCuts];
755 fHistoTrueEtaCategory7 = new TH2F*[fnCuts];
756 fHistoTruePi0Category8 = new TH2F*[fnCuts];
757 fHistoTrueEtaCategory8 = new TH2F*[fnCuts];
758 }
d53bf4ac 759 }
760
761
762
763 for(Int_t iCut = 0; iCut<fnCuts;iCut++){
764 TString cutstringEvent = ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber();
765 TString cutstringCalo = ((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetCutNumber();
766 TString cutstringMeson = "NoMesonCut";
767 if(fDoMesonAnalysis)cutstringMeson = ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutNumber();
768
769 fMCList[iCut] = new TList();
770 fMCList[iCut]->SetName(Form("%s_%s_%s MC histograms",cutstringEvent.Data(),cutstringCalo.Data(),cutstringMeson.Data()));
771 fMCList[iCut]->SetOwner(kTRUE);
772 fCutFolder[iCut]->Add(fMCList[iCut]);
773 fHistoMCHeaders[iCut] = new TH1I("MC_Headers","MC_Headers",20,0,20);
774 fMCList[iCut]->Add(fHistoMCHeaders[iCut]);
775 fHistoMCAllGammaPt[iCut] = new TH1F("MC_AllGamma_Pt","MC_AllGamma_Pt",250,0,25);
776 fMCList[iCut]->Add(fHistoMCAllGammaPt[iCut]);
777 fHistoMCDecayGammaPi0Pt[iCut] = new TH1F("MC_DecayGammaPi0_Pt","MC_DecayGammaPi0_Pt",250,0,25);
778 fMCList[iCut]->Add(fHistoMCDecayGammaPi0Pt[iCut]);
779 fHistoMCDecayGammaRhoPt[iCut] = new TH1F("MC_DecayGammaRho_Pt","MC_DecayGammaRho_Pt",250,0,25);
780 fMCList[iCut]->Add(fHistoMCDecayGammaRhoPt[iCut]);
781 fHistoMCDecayGammaEtaPt[iCut] = new TH1F("MC_DecayGammaEta_Pt","MC_DecayGammaEta_Pt",250,0,25);
782 fMCList[iCut]->Add(fHistoMCDecayGammaEtaPt[iCut]);
783 fHistoMCDecayGammaOmegaPt[iCut] = new TH1F("MC_DecayGammaOmega_Pt","MC_DecayGammaOmmega_Pt",250,0,25);
784 fMCList[iCut]->Add(fHistoMCDecayGammaOmegaPt[iCut]);
785 fHistoMCDecayGammaEtapPt[iCut] = new TH1F("MC_DecayGammaEtap_Pt","MC_DecayGammaEtap_Pt",250,0,25);
786 fMCList[iCut]->Add(fHistoMCDecayGammaEtapPt[iCut]);
787 fHistoMCDecayGammaPhiPt[iCut] = new TH1F("MC_DecayGammaPhi_Pt","MC_DecayGammaPhi_Pt",250,0,25);
788 fMCList[iCut]->Add(fHistoMCDecayGammaPhiPt[iCut]);
789 fHistoMCDecayGammaSigmaPt[iCut] = new TH1F("MC_DecayGammaSigma_Pt","MC_DecayGammaSigma_Pt",250,0,25);
790 fMCList[iCut]->Add(fHistoMCDecayGammaSigmaPt[iCut]);
791
792 if(fDoMesonAnalysis){
793 fHistoMCPi0Pt[iCut] = new TH1F("MC_Pi0_Pt","MC_Pi0_Pt",250,0,25);
794 fHistoMCPi0Pt[iCut]->Sumw2();
795 fMCList[iCut]->Add(fHistoMCPi0Pt[iCut]);
796 fHistoMCPi0WOWeightPt[iCut] = new TH1F("MC_Pi0_WOWeights_Pt","MC_Pi0_WOWeights_Pt",250,0,25);
797 fHistoMCPi0WOWeightPt[iCut]->Sumw2();
798 fMCList[iCut]->Add(fHistoMCPi0WOWeightPt[iCut]);
799
800 fHistoMCEtaPt[iCut] = new TH1F("MC_Eta_Pt","MC_Eta_Pt",250,0,25);
801 fHistoMCEtaPt[iCut]->Sumw2();
802 fMCList[iCut]->Add(fHistoMCEtaPt[iCut]);
803 fHistoMCEtaWOWeightPt[iCut] = new TH1F("MC_Eta_WOWeights_Pt","MC_Eta_WOWeights_Pt",250,0,25);
804 fHistoMCEtaWOWeightPt[iCut]->Sumw2();
805 fMCList[iCut]->Add(fHistoMCEtaWOWeightPt[iCut]);
806 fHistoMCPi0InAccPt[iCut] = new TH1F("MC_Pi0InAcc_Pt","MC_Pi0InAcc_Pt",250,0,25);
807 fHistoMCPi0InAccPt[iCut]->Sumw2();
808 fMCList[iCut]->Add(fHistoMCPi0InAccPt[iCut]);
809 fHistoMCEtaInAccPt[iCut] = new TH1F("MC_EtaInAcc_Pt","MC_EtaInAcc_Pt",250,0,25);
810 fHistoMCEtaInAccPt[iCut]->Sumw2();
811 fMCList[iCut]->Add(fHistoMCEtaInAccPt[iCut]);
812 if (fDoMesonQA > 0){
813 fHistoMCPi0PtY[iCut] = new TH2F("MC_Pi0_Pt_Y","MC_Pi0_Pt_Y",150,0.03,15.,150,-1.5,1.5);
814 fHistoMCPi0PtY[iCut]->Sumw2();
815 SetLogBinningXTH2(fHistoMCPi0PtY[iCut]);
816 fMCList[iCut]->Add(fHistoMCPi0PtY[iCut]);
817 fHistoMCEtaPtY[iCut] = new TH2F("MC_Eta_Pt_Y","MC_Eta_Pt_Y",150,0.03,15.,150,-1.5,1.5);
818 fHistoMCEtaPtY[iCut]->Sumw2();
819 SetLogBinningXTH2(fHistoMCEtaPtY[iCut]);
820 fMCList[iCut]->Add(fHistoMCEtaPtY[iCut]);
de752898 821 fHistoMCPi0PtAlpha[iCut] = new TH2F("MC_Pi0_Pt_Alpha","MC_Pi0_Pt_Alpha",150,0.03,15.,100,0,1);
822 SetLogBinningXTH2(fHistoMCPi0PtAlpha[iCut]);
823 fMCList[iCut]->Add(fHistoMCPi0PtAlpha[iCut]);
824 fHistoMCEtaPtAlpha[iCut] = new TH2F("MC_Eta_Pt_Alpha","MC_Eta_Pt_Alpha",150,0.03,15.,100,0,1);
825 SetLogBinningXTH2(fHistoMCEtaPtAlpha[iCut]);
826 fMCList[iCut]->Add(fHistoMCEtaPtAlpha[iCut]);
827
d53bf4ac 828 fHistoMCK0sPt[iCut] = new TH1F("MC_K0s_Pt","MC_K0s_Pt",150,0,15);
829 fHistoMCK0sPt[iCut]->Sumw2();
830 fMCList[iCut]->Add(fHistoMCK0sPt[iCut]);
831 fHistoMCK0sWOWeightPt[iCut] = new TH1F("MC_K0s_WOWeights_Pt","MC_K0s_WOWeights_Pt",150,0,15);
832 fHistoMCK0sWOWeightPt[iCut]->Sumw2();
833 fMCList[iCut]->Add(fHistoMCK0sWOWeightPt[iCut]);
834 fHistoMCK0sPtY[iCut] = new TH2F("MC_K0s_Pt_Y","MC_K0s_Pt_Y",150,0.03,15.,150,-1.5,1.5);
835 fHistoMCK0sPtY[iCut]->Sumw2();
836 SetLogBinningXTH2(fHistoMCK0sPtY[iCut]);
837 fMCList[iCut]->Add(fHistoMCK0sPtY[iCut]);
838
839 fHistoMCSecPi0Source[iCut] = new TH1F("MC_SecPi0_Source","MC_SecPi0_Source",5000,0.,5000);
840 fMCList[iCut]->Add(fHistoMCSecPi0Source[iCut]);
841 fHistoMCSecEtaSource[iCut] = new TH1F("MC_SecEta_Source","MC_SecEta_Source",5000,0,5000);
842 fMCList[iCut]->Add(fHistoMCSecEtaSource[iCut]);
843 fHistoMCSecPi0PtvsSource[iCut] = new TH2F("MC_SecPi0_Pt_Source","MC_SecPi0_Pt_Source",250,0.0,25.,16,-0.5,15.5);
844 fHistoMCSecPi0PtvsSource[iCut]->Sumw2();
845 fMCList[iCut]->Add(fHistoMCSecPi0PtvsSource[iCut]);
846 fHistoMCSecEtaPt[iCut] = new TH1F("MC_SecEta_Pt","MC_SecEta_Pt",250,0,25);
847 fHistoMCSecEtaPt[iCut]->Sumw2();
848 fMCList[iCut]->Add(fHistoMCSecEtaPt[iCut]);
849 }
850
851 }
852 fTrueList[iCut] = new TList();
853 fTrueList[iCut]->SetName(Form("%s_%s_%s True histograms",cutstringEvent.Data(),cutstringCalo.Data(),cutstringMeson.Data()));
854 fTrueList[iCut]->SetOwner(kTRUE);
855 fCutFolder[iCut]->Add(fTrueList[iCut]);
856
857 fHistoClusPhotonBGPt[iCut] = new TH2F("ESD_TrueClusPhotonBG_Pt","ESD_TrueClusPhotonBG_Pt",250,0,25,9,-0.5,8.5);
858 fHistoClusPhotonBGPt[iCut]->GetYaxis()->SetBinLabel( 1,"Elec");
859 fHistoClusPhotonBGPt[iCut]->GetYaxis()->SetBinLabel( 2,"Pion");
860 fHistoClusPhotonBGPt[iCut]->GetYaxis()->SetBinLabel( 3,"Proton");
861 fHistoClusPhotonBGPt[iCut]->GetYaxis()->SetBinLabel( 4,"Kaon");
862 fHistoClusPhotonBGPt[iCut]->GetYaxis()->SetBinLabel( 5,"Neutron");
863 fHistoClusPhotonBGPt[iCut]->GetYaxis()->SetBinLabel( 6,"K0s");
864 fHistoClusPhotonBGPt[iCut]->GetYaxis()->SetBinLabel( 7,"Lambda");
865 fHistoClusPhotonBGPt[iCut]->GetYaxis()->SetBinLabel( 8,"Muon");
866 fHistoClusPhotonBGPt[iCut]->GetYaxis()->SetBinLabel(9,"Rest");
867 fTrueList[iCut]->Add(fHistoClusPhotonBGPt[iCut]);
868 fHistoClusPhotonPlusConvBGPt[iCut] = new TH2F("ESD_TrueClusPhotonPlusConvBG_Pt","ESD_TrueClusPhotonPlusConvBG_Pt",250,0,25,9,-0.5,8.5);
869 fHistoClusPhotonPlusConvBGPt[iCut]->GetYaxis()->SetBinLabel( 1,"Elec");
870 fHistoClusPhotonPlusConvBGPt[iCut]->GetYaxis()->SetBinLabel( 2,"Pion");
871 fHistoClusPhotonPlusConvBGPt[iCut]->GetYaxis()->SetBinLabel( 3,"Proton");
872 fHistoClusPhotonPlusConvBGPt[iCut]->GetYaxis()->SetBinLabel( 4,"Kaon");
873 fHistoClusPhotonPlusConvBGPt[iCut]->GetYaxis()->SetBinLabel( 5,"Neutron");
874 fHistoClusPhotonPlusConvBGPt[iCut]->GetYaxis()->SetBinLabel( 6,"K0s");
875 fHistoClusPhotonPlusConvBGPt[iCut]->GetYaxis()->SetBinLabel( 7,"Lambda");
876 fHistoClusPhotonPlusConvBGPt[iCut]->GetYaxis()->SetBinLabel( 8,"Muon");
877 fHistoClusPhotonPlusConvBGPt[iCut]->GetYaxis()->SetBinLabel(9,"Rest");
878 fTrueList[iCut]->Add(fHistoClusPhotonPlusConvBGPt[iCut]);
879
880 fHistoTrueClusGammaPt[iCut] = new TH1F("TrueClusGamma_Pt","ESD_TrueClusGamma_Pt",250,0,25);
881 fTrueList[iCut]->Add(fHistoTrueClusGammaPt[iCut]);
882 fHistoTruePrimaryClusGammaPt[iCut] = new TH1F("TruePrimaryClusGamma_Pt","ESD_TruePrimaryClusGamma_Pt",250,0,25);
883 fTrueList[iCut]->Add(fHistoTruePrimaryClusGammaPt[iCut]);
884 fHistoTruePrimaryClusGammaESDPtMCPt[iCut] = new TH2F("TruePrimaryClusGamma_Pt_MCPt","ESD_TruePrimaryClusGamma_MCPt",250,0,25,250,0,25);
885 fTrueList[iCut]->Add(fHistoTruePrimaryClusGammaESDPtMCPt[iCut]);
886 fHistoTruePrimaryClusConvGammaPt[iCut] = new TH1F("TruePrimaryClusConvGamma_Pt","ESD_TruePrimaryClusConvGamma_Pt",250,0,25);
887 fTrueList[iCut]->Add(fHistoTruePrimaryClusConvGammaPt[iCut]);
888 fHistoTruePrimaryClusConvGammaESDPtMCPt[iCut] = new TH2F("TruePrimaryClusConvGamma_Pt_MCPt","ESD_TruePrimaryClusConvGamma_MCPt",250,0,25,250,0,25);
889 fTrueList[iCut]->Add(fHistoTruePrimaryClusConvGammaESDPtMCPt[iCut]);
890 fHistoTrueSecondaryClusGammaPt[iCut] = new TH1F("ESD_TrueSecondaryClusGamma_Pt","ESD_TrueSecondaryClusGamma_Pt",250,0,25);
891 fTrueList[iCut]->Add(fHistoTrueSecondaryClusGammaPt[iCut]);
892 fHistoTrueSecondaryClusConvGammaPt[iCut] = new TH1F("ESD_TrueSecondaryClusConvGamma_Pt","ESD_TrueSecondaryClusConvGamma_Pt",250,0,25);
893 fTrueList[iCut]->Add(fHistoTrueSecondaryClusConvGammaPt[iCut]);
894
895 fHistoTrueSecondaryClusGammaFromXFromK0sPt[iCut] = new TH1F("ESD_TrueSecondaryClusGammaFromXFromK0s_Pt", "ESD_TrueSecondaryClusGammaFromXFromK0s_Pt",250,0,25);
896 fTrueList[iCut]->Add(fHistoTrueSecondaryClusGammaFromXFromK0sPt[iCut]);
897 fHistoTrueSecondaryClusConvGammaFromXFromK0sPt[iCut] = new TH1F("ESD_TrueSecondaryClusConvGammaFromXFromK0s_Pt", "ESD_TrueSecondaryClusConvGammaFromXFromK0s_Pt",250,0,25);
898 fTrueList[iCut]->Add(fHistoTrueSecondaryClusConvGammaFromXFromK0sPt[iCut]);
899 fHistoTrueSecondaryClusGammaFromXFromLambdaPt[iCut] = new TH1F("ESD_TrueSecondaryClusGammaFromXFromLambda_Pt", "ESD_TrueSecondaryClusGammaFromXFromLambda_Pt",250,0,25);
900 fTrueList[iCut]->Add(fHistoTrueSecondaryClusGammaFromXFromLambdaPt[iCut]);
901 fHistoTrueSecondaryClusConvGammaFromXFromLambdaPt[iCut] = new TH1F("ESD_TrueSecondaryClusConvGammaFromXFromLambda_Pt", "ESD_TrueSecondaryClusConvGammaFromXFromLambda_Pt",250,0,25);
902 fTrueList[iCut]->Add(fHistoTrueSecondaryClusConvGammaFromXFromLambdaPt[iCut]);
903 fHistoTrueSecondaryClusGammaFromXFromEtasPt[iCut] = new TH1F("ESD_TrueSecondaryClusGammaFromXFromEtas_Pt", "ESD_TrueSecondaryClusGammaFromXFromEtas_Pt",250,0,25);
904 fTrueList[iCut]->Add(fHistoTrueSecondaryClusGammaFromXFromEtasPt[iCut]);
905 fHistoTrueSecondaryClusConvGammaFromXFromEtasPt[iCut] = new TH1F("ESD_TrueSecondaryClusConvGammaFromXFromEtas_Pt", "ESD_TrueSecondaryClusConvGammaFromXFromEtas_Pt",250,0,25);
906 fTrueList[iCut]->Add(fHistoTrueSecondaryClusConvGammaFromXFromEtasPt[iCut]);
907
908
909 if (fDoClusterQA > 0){
910 fHistoTrueClusUnConvGammaPt[iCut] = new TH1F("TrueClusUnConvGamma_Pt","TrueClusUnConvGamma_Pt",250,0,25);
911 fTrueList[iCut]->Add(fHistoTrueClusUnConvGammaPt[iCut]);
912 fHistoTrueClusUnConvGammaMCPt[iCut] = new TH1F("TrueClusUnConvGamma_MCPt","TrueClusUnConvGamma_MCPt",250,0,25);
913 fTrueList[iCut]->Add(fHistoTrueClusUnConvGammaMCPt[iCut]);
914 fHistoTrueClusElectronPt[iCut] = new TH1F("TrueClusElectron_Pt","TrueElectronGamma_Pt",250,0,25);
915 fTrueList[iCut]->Add(fHistoTrueClusElectronPt[iCut]);
916 fHistoTrueClusConvGammaPt[iCut] = new TH1F("TrueClusConvGamma_Pt","TrueClusConvGamma_Pt",250,0,25);
917 fTrueList[iCut]->Add(fHistoTrueClusConvGammaPt[iCut]);
918 fHistoTrueClusConvGammaMCPt[iCut] = new TH1F("TrueClusConvGamma_MCPt","TrueClusConvGamma_MCPt",250,0,25);
919 fTrueList[iCut]->Add(fHistoTrueClusConvGammaMCPt[iCut]);
920 fHistoTrueClusConvGammaFullyPt[iCut] = new TH1F("TrueClusConvGammaFullyContained_Pt","TrueClusConvGammaFullyContained_Pt",250,0,25);
921 fTrueList[iCut]->Add(fHistoTrueClusConvGammaFullyPt[iCut]);
922 fHistoTrueClusMergedGammaPt[iCut] = new TH1F("TrueClusMergedGamma_Pt","TrueClusMergedGamma_Pt",250,0,25);
923 fTrueList[iCut]->Add(fHistoTrueClusMergedGammaPt[iCut]);
924 fHistoTrueClusMergedPartConvGammaPt[iCut] = new TH1F("TrueClusMergedPartConvGamma_Pt","TrueClusMergedPartConvGamma_Pt",250,0,25);
925 fTrueList[iCut]->Add(fHistoTrueClusMergedPartConvGammaPt[iCut]);
926 fHistoTrueClusDalitzPt[iCut] = new TH1F("TrueClusDalitz_Pt","TrueClusDalitz_Pt",250,0,25);
927 fTrueList[iCut]->Add(fHistoTrueClusDalitzPt[iCut]);
928 fHistoTrueClusDalitzMergedPt[iCut] = new TH1F("TrueClusDalitzMerged_Pt","TrueClusDalitzMerged_Pt",250,0,25);
929 fTrueList[iCut]->Add(fHistoTrueClusDalitzMergedPt[iCut]);
930 fHistoTrueClusPhotonFromElecMotherPt[iCut] = new TH1F("TrueClusPhotonFromElecMother_Pt","TrueClusPhotonFromElecMother_Pt",250,0,25);
931 fTrueList[iCut]->Add(fHistoTrueClusPhotonFromElecMotherPt[iCut]);
932 fHistoTrueClusShowerPt[iCut] = new TH1F("TrueClusShower_Pt","TrueClusShower_Pt",250,0,25);
933 fTrueList[iCut]->Add(fHistoTrueClusShowerPt[iCut]);
934 fHistoTrueClusSubLeadingPt[iCut] = new TH1F("TrueClusSubleading_Pt","TrueClusSubleading_Pt",250,0,25);
935 fTrueList[iCut]->Add(fHistoTrueClusSubLeadingPt[iCut]);
936 fHistoTrueClusNParticles[iCut] = new TH1I("TrueClusNParticles","TrueClusNParticles",20,0,20);
937 fTrueList[iCut]->Add(fHistoTrueClusNParticles[iCut]);
938 fHistoTrueClusEMNonLeadingPt[iCut] = new TH1F("TrueClusEMNonLeading_Pt","TrueClusEMNonLeading_Pt",250,0,25);
939 fTrueList[iCut]->Add(fHistoTrueClusEMNonLeadingPt[iCut]);
940 fHistoTrueNLabelsInClus[iCut] = new TH1F("TrueNLabelsInClus","TrueNLabelsInClus",100,-0.5,99.5);
941 fTrueList[iCut]->Add(fHistoTrueNLabelsInClus[iCut]);
942 }
943
944 if(fDoMesonAnalysis){
ed8bc1ca 945 fHistoTruePi0InvMassPt[iCut] = new TH2F("ESD_TruePi0_InvMass_Pt","ESD_TruePi0_InvMass_Pt",800,0,0.8,250,0,25);
946 fTrueList[iCut]->Add(fHistoTruePi0InvMassPt[iCut]);
947 fHistoTrueEtaInvMassPt[iCut] = new TH2F("ESD_TrueEta_InvMass_Pt","ESD_TrueEta_InvMass_Pt",800,0,0.8,250,0,25);
948 fTrueList[iCut]->Add(fHistoTrueEtaInvMassPt[iCut]);
949
950 fHistoTruePrimaryPi0InvMassPt[iCut] = new TH2F("ESD_TruePrimaryPi0_InvMass_Pt", "ESD_TruePrimaryPi0_InvMass_Pt", 800,0,0.8,250,0,25);
951 fHistoTruePrimaryPi0InvMassPt[iCut]->Sumw2();
952 fTrueList[iCut]->Add(fHistoTruePrimaryPi0InvMassPt[iCut]);
953 fHistoTruePrimaryEtaInvMassPt[iCut] = new TH2F("ESD_TruePrimaryEta_InvMass_Pt", "ESD_TruePrimaryEta_InvMass_Pt", 800,0,0.8,250,0,25);
954 fHistoTruePrimaryEtaInvMassPt[iCut]->Sumw2();
955 fTrueList[iCut]->Add(fHistoTruePrimaryEtaInvMassPt[iCut]);
956
957 fHistoTruePrimaryPi0W0WeightingInvMassPt[iCut] = new TH2F("ESD_TruePrimaryPi0W0Weights_InvMass_Pt", "ESD_TruePrimaryPi0W0Weights_InvMass_Pt", 800,0,0.8,250,0,25);
958 fHistoTruePrimaryPi0W0WeightingInvMassPt[iCut]->Sumw2();
959 fTrueList[iCut]->Add(fHistoTruePrimaryPi0W0WeightingInvMassPt[iCut]);
960 fHistoTruePrimaryEtaW0WeightingInvMassPt[iCut] = new TH2F("ESD_TruePrimaryEtaW0Weights_InvMass_Pt", "ESD_TruePrimaryEtaW0Weights_InvMass_Pt", 800,0,0.8,250,0,25);
961 fHistoTruePrimaryEtaW0WeightingInvMassPt[iCut]->Sumw2();
962 fTrueList[iCut]->Add(fHistoTruePrimaryEtaW0WeightingInvMassPt[iCut]);
963
964 fProfileTruePrimaryPi0WeightsInvMassPt[iCut] = new TProfile2D("ESD_TruePrimaryPi0Weights_InvMass_Pt", "ESD_TruePrimaryPi0Weights_InvMass_Pt", 800,0,0.8,250,0,25);
965 fProfileTruePrimaryPi0WeightsInvMassPt[iCut]->Sumw2();
966 fTrueList[iCut]->Add(fProfileTruePrimaryPi0WeightsInvMassPt[iCut]);
967 fProfileTruePrimaryEtaWeightsInvMassPt[iCut] = new TProfile2D("ESD_TruePrimaryEtaWeights_InvMass_Pt", "ESD_TruePrimaryEtaWeights_InvMass_Pt", 800,0,0.8,250,0,25);
968 fProfileTruePrimaryEtaWeightsInvMassPt[iCut]->Sumw2();
969 fTrueList[iCut]->Add(fProfileTruePrimaryEtaWeightsInvMassPt[iCut]);
970
971 fHistoTrueSecondaryPi0InvMassPt[iCut] = new TH2F("ESD_TrueSecondaryPi0_InvMass_Pt", "ESD_TrueSecondaryPi0_InvMass_Pt", 800,0,0.8,250,0,25);
972 fHistoTrueSecondaryPi0InvMassPt[iCut]->Sumw2();
973 fTrueList[iCut]->Add(fHistoTrueSecondaryPi0InvMassPt[iCut]);
974 fHistoTrueSecondaryEtaInvMassPt[iCut] = new TH2F("ESD_TrueSecondaryEta_InvMass_Pt", "ESD_TrueSecondaryEta_InvMass_Pt", 800,0,0.8,250,0,25);
975 fHistoTrueSecondaryEtaInvMassPt[iCut]->Sumw2();
976 fTrueList[iCut]->Add(fHistoTrueSecondaryEtaInvMassPt[iCut]);
977
978 fHistoTrueSecondaryPi0FromK0sInvMassPt[iCut] = new TH2F("ESD_TrueSecondaryPi0FromK0s_InvMass_Pt","ESD_TrueSecondaryPi0FromK0s_InvMass_Pt",800,0,0.8,250,0,25);
979 fHistoTrueSecondaryPi0FromK0sInvMassPt[iCut]->Sumw2();
980 fTrueList[iCut]->Add(fHistoTrueSecondaryPi0FromK0sInvMassPt[iCut]);
981 fHistoTrueSecondaryPi0FromEtaInvMassPt[iCut] = new TH2F("ESD_TrueSecondaryPi0FromEta_InvMass_Pt","ESD_TrueSecondaryPi0FromEta_InvMass_Pt",800,0,0.8,250,0,25);
982 fTrueList[iCut]->Add(fHistoTrueSecondaryPi0FromEtaInvMassPt[iCut]);
983 fHistoTrueSecondaryPi0FromLambdaInvMassPt[iCut] = new TH2F("ESD_TrueSecondaryPi0FromLambda_InvMass_Pt","ESD_TrueSecondaryPi0FromLambda_InvMass_Pt",800,0,0.8,250,0,25);
984 fTrueList[iCut]->Add(fHistoTrueSecondaryPi0FromLambdaInvMassPt[iCut]);
d53bf4ac 985 if (fDoMesonQA > 0){
ed8bc1ca 986 fHistoTruePi0CaloPhotonInvMassPt[iCut] = new TH2F("ESD_TruePi0CaloPhoton_InvMass_Pt","ESD_TruePi0CaloPhoton_InvMass_Pt",800,0,0.8,250,0,25);
987 fTrueList[iCut]->Add(fHistoTruePi0CaloPhotonInvMassPt[iCut]);
988 fHistoTrueEtaCaloPhotonInvMassPt[iCut] = new TH2F("ESD_TrueEtaCaloPhoton_InvMass_Pt","ESD_TrueEtaCaloPhoton_InvMass_Pt",800,0,0.8,250,0,25);
989 fTrueList[iCut]->Add(fHistoTrueEtaCaloPhotonInvMassPt[iCut]);
990
991 fHistoTruePi0CaloMixedPhotonConvPhotonInvMassPt[iCut] = new TH2F("ESD_TruePi0CaloMixedPhotonConvertedPhoton_InvMass_Pt","ESD_TruePi0CaloMixedPhotonConvertedPhoton_InvMass_Pt",800,0,0.8,250,0,25);
992 fTrueList[iCut]->Add(fHistoTruePi0CaloMixedPhotonConvPhotonInvMassPt[iCut]);
993 fHistoTrueEtaCaloMixedPhotonConvPhotonInvMassPt[iCut] = new TH2F("ESD_TrueEtaCaloMixedPhotonConvertedPhoton_InvMass_Pt","ESD_TrueEtaCaloMixedPhotonConvertedPhoton_InvMass_Pt",800,0,0.8,250,0,25);
994 fTrueList[iCut]->Add(fHistoTrueEtaCaloMixedPhotonConvPhotonInvMassPt[iCut]);
d53bf4ac 995
996 fHistoTruePi0CaloConvertedPhotonInvMassPt[iCut] = new TH2F("ESD_TruePi0CaloConvertedPhoton_InvMass_Pt","ESD_TruePi0CaloConvertedPhoton_InvMass_Pt",800,0,0.8,250,0,25);
997 fTrueList[iCut]->Add(fHistoTruePi0CaloConvertedPhotonInvMassPt[iCut]);
d53bf4ac 998 fHistoTrueEtaCaloConvertedPhotonInvMassPt[iCut] = new TH2F("ESD_TrueEtaCaloConvertedPhoton_InvMass_Pt","ESD_TrueEtaCaloConvertedPhoton_InvMass_Pt",800,0,0.8,250,0,25);
999 fTrueList[iCut]->Add(fHistoTrueEtaCaloConvertedPhotonInvMassPt[iCut]);
1000
ed8bc1ca 1001 fHistoTruePi0CaloElectronInvMassPt[iCut] = new TH2F("ESD_TruePi0CaloElectron_InvMass_Pt","ESD_TruePi0CaloElectron_InvMass_Pt",800,0,0.8,250,0,25);
1002 fTrueList[iCut]->Add(fHistoTruePi0CaloElectronInvMassPt[iCut]);
1003 fHistoTrueEtaCaloElectronInvMassPt[iCut] = new TH2F("ESD_TrueEtaCaloElectron_InvMass_Pt","ESD_TrueEtaCaloElectron_InvMass_Pt",800,0,0.8,250,0,25);
1004 fTrueList[iCut]->Add(fHistoTrueEtaCaloElectronInvMassPt[iCut]);
1005
1006 fHistoTruePi0CaloMergedClusterInvMassPt[iCut] = new TH2F("ESD_TruePi0CaloMergedCluster_InvMass_Pt","ESD_TruePi0CaloMergedCluster_InvMass_Pt",800,0,0.8,250,0,25);
1007 fTrueList[iCut]->Add(fHistoTruePi0CaloMergedClusterInvMassPt[iCut]);
1008 fHistoTrueEtaCaloMergedClusterInvMassPt[iCut] = new TH2F("ESD_TrueEtaCaloMergedCluster_InvMass_Pt","ESD_TrueEtaCaloMergedCluster_InvMass_Pt",800,0,0.8,250,0,25);
1009 fTrueList[iCut]->Add(fHistoTrueEtaCaloMergedClusterInvMassPt[iCut]);
1010
1011 fHistoTruePi0CaloMergedClusterPartConvInvMassPt[iCut] = new TH2F("ESD_TruePi0CaloMergedClusterPartConv_InvMass_Pt","ESD_TruePi0CaloMergedClusterPartConv_InvMass_Pt",800,0,0.8,250,0,25);
1012 fTrueList[iCut]->Add(fHistoTruePi0CaloMergedClusterPartConvInvMassPt[iCut]);
1013 fHistoTrueEtaCaloMergedClusterPartConvInvMassPt[iCut] = new TH2F("ESD_TrueEtaCaloMergedClusterPartConv_InvMass_Pt","ESD_TrueEtaCaloMergedClusterPartConv_InvMass_Pt",800,0,0.8,250,0,25);
1014 fTrueList[iCut]->Add(fHistoTrueEtaCaloMergedClusterPartConvInvMassPt[iCut]);
1015
def90c8b 1016 fHistoTruePi0NonMergedElectronPhotonInvMassPt[iCut] = new TH2F("ESD_TruePi0NonMergedElectronPhoton_InvMass_Pt","ESD_TruePi0NonMergedElectronPhoton_InvMass_Pt",800,0,0.8,250,0,25);
1017 fTrueList[iCut]->Add(fHistoTruePi0NonMergedElectronPhotonInvMassPt[iCut]);
1018 fHistoTruePi0NonMergedElectronMergedPhotonInvMassPt[iCut] = new TH2F("ESD_TruePi0NonMergedElectronMergedPhoton_InvMass_Pt","ESD_TruePi0NonMergedElectronMergedPhoton_InvMass_Pt",800,0,0.8,250,0,25);
1019 fTrueList[iCut]->Add(fHistoTruePi0NonMergedElectronMergedPhotonInvMassPt[iCut]);
d53bf4ac 1020
1021 fHistoTruePrimaryPi0MCPtResolPt[iCut] = new TH2F("ESD_TruePrimaryPi0_MCPt_ResolPt","ESD_TruePrimaryPi0_ResolPt_MCPt",500,0.03,25,1000,-1.,1.);
1022 fHistoTruePrimaryPi0MCPtResolPt[iCut]->Sumw2();
1023 SetLogBinningXTH2(fHistoTruePrimaryPi0MCPtResolPt[iCut]);
1024 fTrueList[iCut]->Add(fHistoTruePrimaryPi0MCPtResolPt[iCut]);
1025 fHistoTruePrimaryEtaMCPtResolPt[iCut] = new TH2F("ESD_TruePrimaryEta_MCPt_ResolPt","ESD_TruePrimaryEta_ResolPt_MCPt",500,0.03,25,1000,-1.,1.);
1026 fHistoTruePrimaryEtaMCPtResolPt[iCut]->Sumw2();
1027 SetLogBinningXTH2(fHistoTruePrimaryEtaMCPtResolPt[iCut]);
1028 fTrueList[iCut]->Add(fHistoTruePrimaryEtaMCPtResolPt[iCut]);
1029 fHistoTrueBckGGInvMassPt[iCut] = new TH2F("ESD_TrueBckGG_InvMass_Pt","ESD_TrueBckGG_InvMass_Pt",800,0,0.8,250,0,25);
1030 fTrueList[iCut]->Add(fHistoTrueBckGGInvMassPt[iCut]);
1031 fHistoTrueBckContInvMassPt[iCut] = new TH2F("ESD_TrueBckCont_InvMass_Pt","ESD_TrueBckCont_InvMass_Pt",800,0,0.8,250,0,25);
1032 fTrueList[iCut]->Add(fHistoTrueBckContInvMassPt[iCut]);
1033 fHistoTrueK0sWithPi0DaughterMCPt[iCut] = new TH1F("ESD_TrueK0sWithPi0Daughter_MCPt","ESD_TrueK0sWithPi0Daughter_MCPt",250,0,25);
1034 fTrueList[iCut]->Add(fHistoTrueK0sWithPi0DaughterMCPt[iCut]);
1035 fHistoTrueEtaWithPi0DaughterMCPt[iCut] = new TH1F("ESD_TrueEtaWithPi0Daughter_MCPt","ESD_TrueEtaWithPi0Daughter_MCPt",250,0,25);
1036 fTrueList[iCut]->Add(fHistoTrueEtaWithPi0DaughterMCPt[iCut]);
1037 fHistoTrueLambdaWithPi0DaughterMCPt[iCut] = new TH1F("ESD_TrueLambdaWithPi0Daughter_MCPt","ESD_TrueLambdaWithPi0Daughter_MCPt",250,0,25);
1038 fTrueList[iCut]->Add(fHistoTrueLambdaWithPi0DaughterMCPt[iCut]);
1039
1040 fHistoTruePi0PtY[iCut] = new TH2F("ESD_TruePi0_Pt_Y","ESD_TruePi0_Pt_Y",150,0.03,15.,150,-1.5,1.5);
1041 SetLogBinningXTH2(fHistoTruePi0PtY[iCut]);
1042 fTrueList[iCut]->Add(fHistoTruePi0PtY[iCut]);
1043 fHistoTrueEtaPtY[iCut] = new TH2F("ESD_TrueEta_Pt_Y","ESD_TrueEta_Pt_Y",150,0.03,15.,150,-1.5,1.5);
1044 SetLogBinningXTH2(fHistoTrueEtaPtY[iCut]);
1045 fTrueList[iCut]->Add(fHistoTrueEtaPtY[iCut]);
1046 fHistoTruePi0PtAlpha[iCut] = new TH2F("ESD_TruePi0_Pt_Alpha","ESD_TruePi0_Pt_Alpha",150,0.03,15.,100,0,1);
1047 SetLogBinningXTH2(fHistoTruePi0PtAlpha[iCut]);
1048 fTrueList[iCut]->Add(fHistoTruePi0PtAlpha[iCut]);
1049 fHistoTrueEtaPtAlpha[iCut] = new TH2F("ESD_TrueEta_Pt_Alpha","ESD_TrueEta_Pt_Alpha",150,0.03,15.,100,0,1);
1050 SetLogBinningXTH2(fHistoTrueEtaPtAlpha[iCut]);
1051 fTrueList[iCut]->Add(fHistoTrueEtaPtAlpha[iCut]);
1052
1053 fHistoTruePi0PtOpenAngle[iCut] = new TH2F("ESD_TruePi0_Pt_OpenAngle","ESD_TruePi0_Pt_OpenAngle",150,0.03,15.,200,0,2*TMath::Pi());
1054 SetLogBinningXTH2(fHistoTruePi0PtOpenAngle[iCut]);
1055 fTrueList[iCut]->Add(fHistoTruePi0PtOpenAngle[iCut]);
1056 fHistoTrueEtaPtOpenAngle[iCut] = new TH2F("ESD_TrueEta_Pt_OpenAngle","ESD_TrueEta_Pt_OpenAngle",150,0.03,15.,200,0,2*TMath::Pi());
1057 SetLogBinningXTH2(fHistoTrueEtaPtOpenAngle[iCut]);
1058 fTrueList[iCut]->Add(fHistoTrueEtaPtOpenAngle[iCut]);
1059 }
5cd70387 1060
1061 if (fDoMesonQA == 2){
1062 fHistoTruePi0Category1[iCut] = new TH2F("ESD_TruePi0Category1_InvMass_Pt","ESD_TruePi0Category1_InvMass_Pt",800,0,0.8,250,0,25);
1063 fTrueList[iCut]->Add(fHistoTruePi0Category1[iCut]);
1064 fHistoTrueEtaCategory1[iCut] = new TH2F("ESD_TrueEtaCategory1_InvMass_Pt","ESD_TrueEtaCategory1_InvMass_Pt",800,0,0.8,250,0,25);
1065 fTrueList[iCut]->Add(fHistoTrueEtaCategory1[iCut]);
1066 fHistoTruePi0Category2[iCut] = new TH2F("ESD_TruePi0Category2_InvMass_Pt","ESD_TruePi0Category2_InvMass_Pt",800,0,0.8,250,0,25);
1067 fTrueList[iCut]->Add(fHistoTruePi0Category2[iCut]);
1068 fHistoTrueEtaCategory2[iCut] = new TH2F("ESD_TrueEtaCategory2_InvMass_Pt","ESD_TrueEtaCategory2_InvMass_Pt",800,0,0.8,250,0,25);
1069 fTrueList[iCut]->Add(fHistoTrueEtaCategory2[iCut]);
1070 fHistoTruePi0Category3[iCut] = new TH2F("ESD_TruePi0Category3_InvMass_Pt","ESD_TruePi0Category3_InvMass_Pt",800,0,0.8,250,0,25);
1071 fTrueList[iCut]->Add(fHistoTruePi0Category3[iCut]);
1072 fHistoTrueEtaCategory3[iCut] = new TH2F("ESD_TrueEtaCategory3_InvMass_Pt","ESD_TrueEtaCategory3_InvMass_Pt",800,0,0.8,250,0,25);
1073 fTrueList[iCut]->Add(fHistoTrueEtaCategory3[iCut]);
1074 fHistoTruePi0Category4_6[iCut] = new TH2F("ESD_TruePi0Category4_6_InvMass_Pt","ESD_TruePi0Category4_6_InvMass_Pt",800,0,0.8,250,0,25);
1075 fTrueList[iCut]->Add(fHistoTruePi0Category4_6[iCut]);
1076 fHistoTrueEtaCategory4_6[iCut] = new TH2F("ESD_TrueEtaCategory4_6_InvMass_Pt","ESD_TrueEtaCategory4_6_InvMass_Pt",800,0,0.8,250,0,25);
1077 fTrueList[iCut]->Add(fHistoTrueEtaCategory4_6[iCut]);
1078 fHistoTruePi0Category5[iCut] = new TH2F("ESD_TruePi0Category5_InvMass_Pt","ESD_TruePi0Category5_InvMass_Pt",800,0,0.8,250,0,25);
1079 fTrueList[iCut]->Add(fHistoTruePi0Category5[iCut]);
1080 fHistoTrueEtaCategory5[iCut] = new TH2F("ESD_TrueEtaCategory5_InvMass_Pt","ESD_TrueEtaCategory5_InvMass_Pt",800,0,0.8,250,0,25);
1081 fTrueList[iCut]->Add(fHistoTrueEtaCategory5[iCut]);
1082 fHistoTruePi0Category7[iCut] = new TH2F("ESD_TruePi0Category7_InvMass_Pt","ESD_TruePi0Category7_InvMass_Pt",800,0,0.8,250,0,25);
1083 fTrueList[iCut]->Add(fHistoTruePi0Category7[iCut]);
1084 fHistoTrueEtaCategory7[iCut] = new TH2F("ESD_TrueEtaCategory7_InvMass_Pt","ESD_TrueEtaCategory7_InvMass_Pt",800,0,0.8,250,0,25);
1085 fTrueList[iCut]->Add(fHistoTrueEtaCategory7[iCut]);
1086 fHistoTruePi0Category8[iCut] = new TH2F("ESD_TruePi0Category8_InvMass_Pt","ESD_TruePi0Category8_InvMass_Pt",800,0,0.8,250,0,25);
1087 fTrueList[iCut]->Add(fHistoTruePi0Category8[iCut]);
1088 fHistoTrueEtaCategory8[iCut] = new TH2F("ESD_TrueEtaCategory8_InvMass_Pt","ESD_TrueEtaCategory8_InvMass_Pt",800,0,0.8,250,0,25);
1089 fTrueList[iCut]->Add(fHistoTrueEtaCategory8[iCut]);
1090 }
d53bf4ac 1091 }
1092 }
1093 }
1094
1095 fV0Reader=(AliV0ReaderV1*)AliAnalysisManager::GetAnalysisManager()->GetTask("V0ReaderV1");
1096 if(!fV0Reader){printf("Error: No V0 Reader");return;} // GetV0Reader
1097
1098 if(fV0Reader)
1099 if((AliConversionPhotonCuts*)fV0Reader->GetConversionCuts())
1100 if(((AliConversionPhotonCuts*)fV0Reader->GetConversionCuts())->GetCutHistograms())
1101 fOutputContainer->Add(((AliConversionPhotonCuts*)fV0Reader->GetConversionCuts())->GetCutHistograms());
1102 if(fV0Reader)
1103 if((AliConvEventCuts*)fV0Reader->GetEventCuts())
1104 if(((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetCutHistograms())
1105 fOutputContainer->Add(((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetCutHistograms());
1106
1107
1108 for(Int_t iCut = 0; iCut<fnCuts;iCut++){
1109 if(!((AliConvEventCuts*)fEventCutArray->At(iCut))) continue;
1110 if(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutHistograms()){
1111 fCutFolder[iCut]->Add(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutHistograms());
1112 }
1113 if(!((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))) continue;
1114 if(((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetCutHistograms()){
1115 fCutFolder[iCut]->Add(((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetCutHistograms());
1116 }
1117 if(fDoMesonAnalysis){
1118 if(!((AliConversionMesonCuts*)fMesonCutArray->At(iCut))) continue;
1119 if(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutHistograms()){
1120 fCutFolder[iCut]->Add(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutHistograms());
1121 }
1122 }
1123 }
1124 PostData(1, fOutputContainer);
1125}
1126//_____________________________________________________________________________
1127Bool_t AliAnalysisTaskGammaCalo::Notify()
1128{
1129 for(Int_t iCut = 0; iCut<fnCuts;iCut++){
1130 if(!((AliConvEventCuts*)fEventCutArray->At(iCut))->GetDoEtaShift()){
1131 fProfileEtaShift[iCut]->Fill(0.,(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift()));
1132 continue; // No Eta Shift requested, continue
1133 }
1134 if(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift() == 0.0){ // Eta Shift requested but not set, get shift automatically
1135 ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCorrectEtaShiftFromPeriod(fV0Reader->GetPeriodName());
1136 fProfileEtaShift[iCut]->Fill(0.,(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift()));
1137 ((AliConvEventCuts*)fEventCutArray->At(iCut))->DoEtaShift(kFALSE); // Eta Shift Set, make sure that it is called only once
1138 continue;
1139 }
1140 else{
1141 printf(" Gamma Conversion Task %s :: Eta Shift Manually Set to %f \n\n",
1142 (((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber()).Data(),((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift());
1143 fProfileEtaShift[iCut]->Fill(0.,(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift()));
1144 ((AliConvEventCuts*)fEventCutArray->At(iCut))->DoEtaShift(kFALSE); // Eta Shift Set, make sure that it is called only once
1145 }
1146 }
1147
1148 return kTRUE;
1149}
1150//_____________________________________________________________________________
1151void AliAnalysisTaskGammaCalo::UserExec(Option_t *)
1152{
1153 //
1154 // Called for each event
1155 //
1156 Int_t eventQuality = ((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetEventQuality();
1157 if(eventQuality == 2 || eventQuality == 3){// Event Not Accepted due to MC event missing or wrong trigger for V0ReaderV1
1158 for(Int_t iCut = 0; iCut<fnCuts; iCut++){
1159 fHistoNEvents[iCut]->Fill(eventQuality);
1160 }
1161 return;
1162 }
1163
1164 if(fIsMC) fMCEvent = MCEvent();
1165 if(fMCEvent == NULL) fIsMC = kFALSE;
1166
1167 fInputEvent = InputEvent();
1168
1169 if(fIsMC && fInputEvent->IsA()==AliESDEvent::Class()){
1170 fMCStack = fMCEvent->Stack();
1171 if(fMCStack == NULL) fIsMC = kFALSE;
1172 }
1173
1174 // ------------------- BeginEvent ----------------------------
1175
1176 AliEventplane *EventPlane = fInputEvent->GetEventplane();
1177 if(fIsHeavyIon ==1)fEventPlaneAngle = EventPlane->GetEventplane("V0",fInputEvent,2);
1178 else fEventPlaneAngle=0.0;
1179
1180 for(Int_t iCut = 0; iCut<fnCuts; iCut++){
1181
1182 fiCut = iCut;
7f070437 1183
1184 Bool_t isRunningEMCALrelAna = kFALSE;
1185 if (((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->GetClusterType() == 1) isRunningEMCALrelAna = kTRUE;
1186
1187 Int_t eventNotAccepted = ((AliConvEventCuts*)fEventCutArray->At(iCut))->IsEventAcceptedByCut(fV0Reader->GetEventCuts(),fInputEvent,fMCEvent,fIsHeavyIon, isRunningEMCALrelAna);
d53bf4ac 1188
1189 if(eventNotAccepted){
1190 // cout << "event rejected due to wrong trigger: " <<eventNotAccepted << endl;
1191 fHistoNEvents[iCut]->Fill(eventNotAccepted); // Check Centrality, PileUp, SDD and V0AND --> Not Accepted => eventQuality = 1
1192 continue;
1193 }
1194
1195 if(eventQuality != 0){// Event Not Accepted
1196 //cout << "event rejected due to: " <<eventQuality << endl;
1197 fHistoNEvents[iCut]->Fill(eventQuality);
1198 continue;
1199 }
1200
1201 fHistoNEvents[iCut]->Fill(eventQuality); // Should be 0 here
1202 fHistoNGoodESDTracks[iCut]->Fill(fV0Reader->GetNumberOfPrimaryTracks());
1203 if(((AliConvEventCuts*)fEventCutArray->At(iCut))->IsHeavyIon() == 2) fHistoNV0Tracks[iCut]->Fill(fInputEvent->GetVZEROData()->GetMTotV0A());
1204 else fHistoNV0Tracks[iCut]->Fill(fInputEvent->GetVZEROData()->GetMTotV0A()+fInputEvent->GetVZEROData()->GetMTotV0C());
1205
1206 if(fIsMC){
1207 // Process MC Particle
1208 if(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetSignalRejection() != 0){
1209 if(fInputEvent->IsA()==AliESDEvent::Class()){
1210 ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetNotRejectedParticles(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetSignalRejection(),
1211 ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetAcceptedHeader(),
1212 fMCEvent);
1213 }
1214 else if(fInputEvent->IsA()==AliAODEvent::Class()){
1215 ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetNotRejectedParticles(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetSignalRejection(),
1216 ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetAcceptedHeader(),
1217 fInputEvent);
1218 }
1219
1220 if(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetAcceptedHeader()){
1221 for(Int_t i = 0;i<(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetAcceptedHeader())->GetEntries();i++){
1222 TString nameBin= fHistoMCHeaders[iCut]->GetXaxis()->GetBinLabel(i+1);
1223 if (nameBin.CompareTo("")== 0){
1224 TString nameHeader = ((TObjString*)((TList*)((AliConvEventCuts*)fEventCutArray->At(iCut))
1225 ->GetAcceptedHeader())->At(i))->GetString();
1226 fHistoMCHeaders[iCut]->GetXaxis()->SetBinLabel(i+1,nameHeader.Data());
1227 }
1228 }
1229 }
1230 }
1231 }
1232 if(fIsMC){
1233 if(fInputEvent->IsA()==AliESDEvent::Class())
1234 ProcessMCParticles();
1235 if(fInputEvent->IsA()==AliAODEvent::Class())
1236 ProcessAODMCParticles();
1237 }
1238
1239 // 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)
1240 ProcessClusters(); // process calo clusters
1241
1242 fHistoNGammaCandidates[iCut]->Fill(fClusterCandidates->GetEntries());
1243 fHistoNGoodESDTracksVsNGammaCanditates[iCut]->Fill(fV0Reader->GetNumberOfPrimaryTracks(),fClusterCandidates->GetEntries());
1244 if(fDoMesonAnalysis){ // Meson Analysis
cfd87ccd 1245
d53bf4ac 1246 CalculatePi0Candidates(); // Combine Gammas from conversion and from calo
d53bf4ac 1247 if(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->DoBGCalculation()){
1248 if(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->BackgroundHandlerType() == 0){
cfd87ccd 1249
d53bf4ac 1250 CalculateBackground(); // Combinatorial Background
1251 UpdateEventByEventData(); // Store Event for mixed Events
1252 }
1253
1254 }
1255 }
1256
1257 fClusterCandidates->Clear(); // delete cluster candidates
1258 }
1259
1260 PostData(1, fOutputContainer);
1261}
1262
1263//________________________________________________________________________
1264void AliAnalysisTaskGammaCalo::ProcessClusters()
1265{
1266
1267 Int_t nclus = 0;
1268 nclus = fInputEvent->GetNumberOfCaloClusters();
1269
1270// cout << nclus << endl;
1271
1272 if(nclus == 0) return;
1273
1274 // vertex
1275 Double_t vertex[3] = {0};
1276 InputEvent()->GetPrimaryVertex()->GetXYZ(vertex);
1277
1278 // Loop over EMCal clusters
1279 for(Long_t i = 0; i < nclus; i++){
1280
1281 AliVCluster* clus = NULL;
1282 clus = fInputEvent->GetCaloCluster(i);
1283 if (!clus) continue;
1284 if(!((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelected(clus,fInputEvent,fIsMC)) continue;
1285 // TLorentzvector with cluster
1286 TLorentzVector clusterVector;
1287 clus->GetMomentum(clusterVector,vertex);
1288
1289 TLorentzVector* tmpvec = new TLorentzVector();
1290 tmpvec->SetPxPyPzE(clusterVector.Px(),clusterVector.Py(),clusterVector.Pz(),clusterVector.E());
1291
1292 // convert to AODConversionPhoton
1293 AliAODConversionPhoton *PhotonCandidate=new AliAODConversionPhoton(tmpvec);
1294 if(!PhotonCandidate) continue;
1295
1296 // Flag Photon as CaloPhoton
1297 PhotonCandidate->SetIsCaloPhoton();
1298 PhotonCandidate->SetCaloClusterRef(i);
1299 // get MC label
1300 if(fIsMC){
1301 Int_t* mclabelsCluster = clus->GetLabels();
1302 PhotonCandidate->SetNCaloPhotonMCLabels(clus->GetNLabels());
1303// cout << clus->GetNLabels() << endl;
1304 if (clus->GetNLabels()>0){
1305 for (Int_t k =0; k< (Int_t)clus->GetNLabels(); k++){
1306 if (k< 20)PhotonCandidate->SetCaloPhotonMCLabel(k,mclabelsCluster[k]);
1307// Int_t pdgCode = fMCStack->Particle(mclabelsCluster[k])->GetPdgCode();
1308// cout << "label " << k << "\t" << mclabelsCluster[k] << " pdg code: " << pdgCode << endl;
1309 }
1310 }
1311 }
1312
1313 fIsFromMBHeader = kTRUE;
ecd3e131 1314 fIsOverlappingWithOtherHeader = kFALSE;
d53bf4ac 1315 // test whether largest contribution to cluster orginates in added signals
1316 if (fIsMC && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(PhotonCandidate->GetCaloPhotonMCLabel(0), fMCStack, fInputEvent) == 0) fIsFromMBHeader = kFALSE;
ecd3e131 1317 if (fIsMC ){
1318 if (clus->GetNLabels()>1){
1319 Int_t* mclabelsCluster = clus->GetLabels();
1320 for (Int_t l = 1; l < (Int_t)clus->GetNLabels(); l++ ){
1321 if (((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(mclabelsCluster[l], fMCStack, fInputEvent) == 0) fIsOverlappingWithOtherHeader = kTRUE;
1322 }
1323 }
1324 }
d53bf4ac 1325
ecd3e131 1326 if (fIsFromMBHeader && !fIsOverlappingWithOtherHeader){
1327 fHistoClusGammaPt[fiCut]->Fill(PhotonCandidate->Pt());
1328 fClusterCandidates->Add(PhotonCandidate);
1329 }
1330 if (fIsFromMBHeader && fIsOverlappingWithOtherHeader) fHistoClusOverlapHeadersGammaPt[fiCut]->Fill(PhotonCandidate->Pt());
1331 // if no second loop is required add to events good gammas
d53bf4ac 1332
1333 if(fIsMC){
1334 if(fInputEvent->IsA()==AliESDEvent::Class()){
1335 ProcessTrueClusterCandidates(PhotonCandidate);
1336 } else {
1337 ProcessTrueClusterCandidatesAOD(PhotonCandidate);
1338 }
1339 }
1340
1341 delete tmpvec;
1342 }
1343
1344}
1345
1346//________________________________________________________________________
1347void AliAnalysisTaskGammaCalo::ProcessTrueClusterCandidates(AliAODConversionPhoton *TruePhotonCandidate)
1348{
1349
1350 TParticle *Photon = NULL;
1351 if (!TruePhotonCandidate->GetIsCaloPhoton()) AliFatal("CaloPhotonFlag has not been set task will abort");
d404157c 1352 if (fDoClusterQA > 0) fHistoTrueNLabelsInClus[fiCut]->Fill(TruePhotonCandidate->GetNCaloPhotonMCLabels());
d53bf4ac 1353
1354 if (TruePhotonCandidate->GetNCaloPhotonMCLabels()>0)Photon = fMCStack->Particle(TruePhotonCandidate->GetCaloPhotonMCLabel(0));
1355 else return;
1356
1357 if(Photon == NULL){
1358 // cout << "no photon" << endl;
1359 return;
1360 }
1361
1362 Int_t pdgCodeParticle = Photon->GetPdgCode();
1363 TruePhotonCandidate->SetCaloPhotonMCFlags(fMCStack);
1364
1365 // True Photon
ecd3e131 1366 if(fIsFromMBHeader && !fIsOverlappingWithOtherHeader){
d53bf4ac 1367 if (TruePhotonCandidate->IsLargestComponentPhoton() || TruePhotonCandidate->IsLargestComponentElectron() )fHistoTrueClusGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1368 else fHistoTrueClusEMNonLeadingPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1369 if (fDoClusterQA > 0){
1370 if (TruePhotonCandidate->IsLargestComponentPhoton()){
1371 fHistoTrueClusUnConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1372 fHistoTrueClusUnConvGammaMCPt[fiCut]->Fill(Photon->Pt());
1373 }
1374 if (TruePhotonCandidate->IsLargestComponentElectron())
1375 fHistoTrueClusElectronPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1376 if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion()){
1377 fHistoTrueClusConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1378 fHistoTrueClusConvGammaMCPt[fiCut]->Fill(((TParticle*)fMCStack->Particle(Photon->GetMother(0)))->Pt());
1379 }
1380 if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion() && TruePhotonCandidate->IsConversionFullyContained())
1381 fHistoTrueClusConvGammaFullyPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1382 if (TruePhotonCandidate->IsMerged() || TruePhotonCandidate->IsMergedPartConv() || TruePhotonCandidate->IsDalitzMerged())
1383 fHistoTrueClusMergedGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1384 if (TruePhotonCandidate->IsMergedPartConv())
1385 fHistoTrueClusMergedPartConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1386 if (TruePhotonCandidate->IsDalitz())
1387 fHistoTrueClusDalitzPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1388 if (TruePhotonCandidate->IsDalitzMerged())
1389 fHistoTrueClusDalitzMergedPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1390 if (TruePhotonCandidate->IsPhotonWithElecMother())
1391 fHistoTrueClusPhotonFromElecMotherPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1392 if (TruePhotonCandidate->IsShower())
1393 fHistoTrueClusShowerPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1394 if (TruePhotonCandidate->IsSubLeadingEM())
1395 fHistoTrueClusSubLeadingPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1396 fHistoTrueClusNParticles[fiCut]->Fill(TruePhotonCandidate->GetNCaloPhotonMotherMCLabels());
1397 if (!TruePhotonCandidate->IsLargestComponentPhoton())
1398 FillPhotonBackgroundHist(TruePhotonCandidate,pdgCodeParticle);
1399 if (!(TruePhotonCandidate->IsLargestComponentPhoton() || (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion())) )
1400 FillPhotonPlusConversionBackgroundHist(TruePhotonCandidate,pdgCodeParticle);
1401 }
1402
1403 if(Photon->GetMother(0) <= fMCStack->GetNprimary()){
1404 if (TruePhotonCandidate->IsLargestComponentPhoton()){
1405 fHistoTruePrimaryClusGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1406 fHistoTruePrimaryClusGammaESDPtMCPt[fiCut]->Fill(TruePhotonCandidate->Pt(),Photon->Pt()); // Allways Filled
1407 }
1408 if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion()){
1409 fHistoTruePrimaryClusConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1410 fHistoTruePrimaryClusConvGammaESDPtMCPt[fiCut]->Fill(TruePhotonCandidate->Pt(),Photon->Pt()); // Allways Filled
1411 }
1412
1413 } else {
1414 if (TruePhotonCandidate->IsLargestComponentPhoton())
1415 fHistoTrueSecondaryClusGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1416 if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion())
1417 fHistoTrueSecondaryClusConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1418 if(fMCStack->Particle(Photon->GetMother(0))->GetMother(0) > -1){
1419 if(fMCStack->Particle(fMCStack->Particle(Photon->GetMother(0))->GetMother(0))->GetPdgCode() == 3122){
1420 if (TruePhotonCandidate->IsLargestComponentPhoton())
1421 fHistoTrueSecondaryClusGammaFromXFromLambdaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1422 if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion())
1423 fHistoTrueSecondaryClusConvGammaFromXFromLambdaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1424 }
1425 if(fMCStack->Particle(fMCStack->Particle(Photon->GetMother(0))->GetMother(0))->GetPdgCode() == 310){
1426 if (TruePhotonCandidate->IsLargestComponentPhoton())
1427 fHistoTrueSecondaryClusGammaFromXFromK0sPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1428 if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion())
1429 fHistoTrueSecondaryClusConvGammaFromXFromK0sPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1430 }
1431 if(fMCStack->Particle(fMCStack->Particle(Photon->GetMother(0))->GetMother(0))->GetPdgCode() == 221){
1432 if (TruePhotonCandidate->IsLargestComponentPhoton())
1433 fHistoTrueSecondaryClusGammaFromXFromEtasPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1434 if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion())
1435 fHistoTrueSecondaryClusConvGammaFromXFromEtasPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1436
1437 }
1438 }
1439 }
1440 }
1441 return;
1442}
1443
1444
1445//________________________________________________________________________
1446void AliAnalysisTaskGammaCalo::ProcessTrueClusterCandidatesAOD(AliAODConversionPhoton *TruePhotonCandidate)
1447{
1448 AliAODMCParticle *Photon = NULL;
1449 TClonesArray *AODMCTrackArray = dynamic_cast<TClonesArray*>(fInputEvent->FindListObject(AliAODMCParticle::StdBranchName()));
d404157c 1450 if (fDoClusterQA > 0) fHistoTrueNLabelsInClus[fiCut]->Fill(TruePhotonCandidate->GetNCaloPhotonMCLabels());
d53bf4ac 1451 if (AODMCTrackArray){
1452 if (!TruePhotonCandidate->GetIsCaloPhoton()) AliFatal("CaloPhotonFlag has not been set task will abort");
1453 if (TruePhotonCandidate->GetNCaloPhotonMCLabels()>0) Photon = (AliAODMCParticle*) AODMCTrackArray->At(TruePhotonCandidate->GetCaloPhotonMCLabel(0));
1454 else return;
1455 } else {
1456 AliInfo("AODMCTrackArray could not be loaded");
1457 return;
1458 }
1459
1460 if(Photon == NULL){
1461 // cout << "no photon" << endl;
1462 return;
1463 }
1464 Int_t pdgCodeParticle = Photon->GetPdgCode();
1465 TruePhotonCandidate->SetCaloPhotonMCFlagsAOD(fInputEvent);
1466
1467 // True Photon
ecd3e131 1468 if(fIsFromMBHeader && !fIsOverlappingWithOtherHeader){
d53bf4ac 1469 if (TruePhotonCandidate->IsLargestComponentPhoton() || TruePhotonCandidate->IsLargestComponentElectron() )fHistoTrueClusGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1470 else fHistoTrueClusEMNonLeadingPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1471 if (fDoClusterQA > 0){
1472 if (TruePhotonCandidate->IsLargestComponentPhoton()) {
1473 fHistoTrueClusUnConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1474 fHistoTrueClusUnConvGammaMCPt[fiCut]->Fill(Photon->Pt());
1475 }
1476 if (TruePhotonCandidate->IsLargestComponentElectron())
1477 fHistoTrueClusElectronPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1478 if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion()) {
1479 fHistoTrueClusConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1480 AliAODMCParticle *Mother = (AliAODMCParticle*) AODMCTrackArray->At(Photon->GetMother());
1481 fHistoTrueClusConvGammaMCPt[fiCut]->Fill(Mother->Pt());
1482 }
1483 if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion() && TruePhotonCandidate->IsConversionFullyContained())
1484 fHistoTrueClusConvGammaFullyPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1485 if (TruePhotonCandidate->IsMerged() || TruePhotonCandidate->IsMergedPartConv() || TruePhotonCandidate->IsDalitzMerged())
1486 fHistoTrueClusMergedGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1487 if (TruePhotonCandidate->IsMergedPartConv())
1488 fHistoTrueClusMergedPartConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1489 if (TruePhotonCandidate->IsDalitz())
1490 fHistoTrueClusDalitzPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1491 if (TruePhotonCandidate->IsDalitzMerged())
1492 fHistoTrueClusDalitzMergedPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1493 if (TruePhotonCandidate->IsPhotonWithElecMother())
1494 fHistoTrueClusPhotonFromElecMotherPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1495 if (TruePhotonCandidate->IsShower())
1496 fHistoTrueClusShowerPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1497 if (TruePhotonCandidate->IsSubLeadingEM())
1498 fHistoTrueClusSubLeadingPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1499 fHistoTrueClusNParticles[fiCut]->Fill(TruePhotonCandidate->GetNCaloPhotonMotherMCLabels());
1500
1501 if (!TruePhotonCandidate->IsLargestComponentPhoton())
1502 FillPhotonBackgroundHist(TruePhotonCandidate,pdgCodeParticle);
1503 if (!(TruePhotonCandidate->IsLargestComponentPhoton() || (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion())) )
1504 FillPhotonPlusConversionBackgroundHist(TruePhotonCandidate,pdgCodeParticle);
1505 }
1506
1507 if(Photon->IsPrimary()){
1508 if (TruePhotonCandidate->IsLargestComponentPhoton()){
1509 fHistoTruePrimaryClusGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1510 fHistoTruePrimaryClusGammaESDPtMCPt[fiCut]->Fill(TruePhotonCandidate->Pt(),Photon->Pt()); // Allways Filled
1511 }
1512 if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion()){
1513 fHistoTruePrimaryClusConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1514 fHistoTruePrimaryClusConvGammaESDPtMCPt[fiCut]->Fill(TruePhotonCandidate->Pt(),Photon->Pt()); // Allways Filled
1515 }
1516
1517 } else {
1518 if (TruePhotonCandidate->IsLargestComponentPhoton())
1519 fHistoTrueSecondaryClusGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1520 if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion())
1521 fHistoTrueSecondaryClusConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1522 if(((AliAODMCParticle*)AODMCTrackArray->At(Photon->GetMother()))->GetMother() > -1){
1523 if(((AliAODMCParticle*)AODMCTrackArray->At(((AliAODMCParticle*)AODMCTrackArray->At(Photon->GetMother()))->GetMother()))->GetPdgCode() == 3122){
1524 if (TruePhotonCandidate->IsLargestComponentPhoton())
1525 fHistoTrueSecondaryClusGammaFromXFromLambdaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1526 if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion())
1527 fHistoTrueSecondaryClusConvGammaFromXFromLambdaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1528 }
1529 if(((AliAODMCParticle*)AODMCTrackArray->At(((AliAODMCParticle*)AODMCTrackArray->At(Photon->GetMother()))->GetMother()))->GetPdgCode() == 310){
1530 if (TruePhotonCandidate->IsLargestComponentPhoton())
1531 fHistoTrueSecondaryClusGammaFromXFromK0sPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1532 if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion())
1533 fHistoTrueSecondaryClusConvGammaFromXFromK0sPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1534 }
1535 if(((AliAODMCParticle*)AODMCTrackArray->At(((AliAODMCParticle*)AODMCTrackArray->At(Photon->GetMother()))->GetMother()))->GetPdgCode() == 221){
1536 if (TruePhotonCandidate->IsLargestComponentPhoton())
1537 fHistoTrueSecondaryClusGammaFromXFromEtasPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1538 if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion())
1539 fHistoTrueSecondaryClusConvGammaFromXFromEtasPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1540
1541 }
1542 }
1543 }
1544 }
1545}
1546
1547//________________________________________________________________________
1548void AliAnalysisTaskGammaCalo::ProcessAODMCParticles()
1549{
1550
1551 TClonesArray *AODMCTrackArray = dynamic_cast<TClonesArray*>(fInputEvent->FindListObject(AliAODMCParticle::StdBranchName()));
1552
1553 // Loop over all primary MC particle
1554 for(Int_t i = 0; i < AODMCTrackArray->GetEntriesFast(); i++) {
1555
1556 AliAODMCParticle* particle = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(i));
1557 if (!particle) continue;
1558 if (!particle->IsPrimary()) continue;
1559
1560 Int_t isMCFromMBHeader = -1;
1561 if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 0){
1562 isMCFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCStack, fInputEvent);
1563 if(isMCFromMBHeader == 0 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 3) continue;
1564 }
1565
1566 if(((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedAODMC(particle,AODMCTrackArray)){
1567 fHistoMCAllGammaPt[fiCut]->Fill(particle->Pt()); // All MC Gamma
1568 if(particle->GetMother() >-1){ // Meson Decay Gamma
1569 switch((static_cast<AliAODMCParticle*>(AODMCTrackArray->At(particle->GetMother())))->GetPdgCode()){
1570 case 111: // Pi0
1571 fHistoMCDecayGammaPi0Pt[fiCut]->Fill(particle->Pt());
1572 break;
1573 case 113: // Rho0
1574 fHistoMCDecayGammaRhoPt[fiCut]->Fill(particle->Pt());
1575 break;
1576 case 221: // Eta
1577 fHistoMCDecayGammaEtaPt[fiCut]->Fill(particle->Pt());
1578 break;
1579 case 223: // Omega
1580 fHistoMCDecayGammaOmegaPt[fiCut]->Fill(particle->Pt());
1581 break;
1582 case 331: // Eta'
1583 fHistoMCDecayGammaEtapPt[fiCut]->Fill(particle->Pt());
1584 break;
1585 case 333: // Phi
1586 fHistoMCDecayGammaPhiPt[fiCut]->Fill(particle->Pt());
1587 break;
1588 case 3212: // Sigma
1589 fHistoMCDecayGammaSigmaPt[fiCut]->Fill(particle->Pt());
1590 break;
1591 }
1592 }
1593 }
de752898 1594 // Converted MC Gamma
d53bf4ac 1595 if(fDoMesonAnalysis){
1596 if(particle->GetPdgCode() == 310 && fDoMesonQA > 0){
1597 Double_t mesonY = 10.;
1598 if(particle->E() - particle->Pz() == 0 || particle->E() + particle->Pz() == 0){
1599 mesonY=10.-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
1600 } else {
1601 mesonY = 0.5*(TMath::Log((particle->E()+particle->Pz()) / (particle->E()-particle->Pz())))-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
1602 }
1603 Float_t weightedK0s= 1;
1604 if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCStack, fInputEvent)){
1605 if (particle->Pt()>0.005){
1606 weightedK0s= ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetWeightForMeson(fV0Reader->GetPeriodName(),i, 0x0, fInputEvent);
1607 //cout << "MC input \t"<<i << "\t" << particle->Pt()<<"\t"<<weighted << endl;
1608 }
1609 }
1610 fHistoMCK0sPt[fiCut]->Fill(particle->Pt(),weightedK0s);
1611 fHistoMCK0sWOWeightPt[fiCut]->Fill(particle->Pt());
1612 fHistoMCK0sPtY[fiCut]->Fill(particle->Pt(),mesonY,weightedK0s);
1613 }
1614 if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))
1615 ->MesonIsSelectedAODMC(particle,AODMCTrackArray,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift())){
1616 AliAODMCParticle* daughter0 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(particle->GetDaughter(0)));
1617 AliAODMCParticle* daughter1 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(particle->GetDaughter(1)));
1618 Float_t weighted= 1;
1619 if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCStack, fInputEvent)){
1620 if (particle->Pt()>0.005){
1621 weighted= ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetWeightForMeson(fV0Reader->GetPeriodName(),i, 0x0, fInputEvent);
d53bf4ac 1622 }
1623 }
de752898 1624
d53bf4ac 1625 Double_t mesonY = 10.;
1626 if(particle->E() - particle->Pz() == 0 || particle->E() + particle->Pz() == 0){
1627 mesonY=10.-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
1628 } else{
1629 mesonY = 0.5*(TMath::Log((particle->E()+particle->Pz()) / (particle->E()-particle->Pz())))-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
1630 }
de752898 1631 Double_t alpha = -1;
1632 if (particle->GetPdgCode() == 111 || particle->GetPdgCode() == 221){
1633 alpha = TMath::Abs((daughter0->E() - daughter1->E()))/(daughter0->E() + daughter1->E());
1634 }
d53bf4ac 1635
1636 if(particle->GetPdgCode() == 111){
1637 fHistoMCPi0Pt[fiCut]->Fill(particle->Pt(),weighted); // All MC Pi0
1638 fHistoMCPi0WOWeightPt[fiCut]->Fill(particle->Pt());
de752898 1639 if (fDoMesonQA > 0){
1640 fHistoMCPi0PtY[fiCut]->Fill(particle->Pt(),mesonY,weighted); // All MC Pi0
1641 fHistoMCPi0PtAlpha[fiCut]->Fill(particle->Pt(),alpha);
1642 }
d53bf4ac 1643 } else if(particle->GetPdgCode() == 221){
1644 fHistoMCEtaPt[fiCut]->Fill(particle->Pt(),weighted); // All MC Eta
1645 fHistoMCEtaWOWeightPt[fiCut]->Fill(particle->Pt());
de752898 1646 if (fDoMesonQA > 0){
1647 fHistoMCEtaPtY[fiCut]->Fill(particle->Pt(),mesonY,weighted); // All MC Pi0
1648 fHistoMCEtaPtAlpha[fiCut]->Fill(particle->Pt(),alpha);
1649 }
d53bf4ac 1650 }
1651
1652 // Check the acceptance for both gammas
1653 if(((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedAODMC(daughter0,AODMCTrackArray) &&
1654 ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedAODMC(daughter1,AODMCTrackArray) ){
1655
1656 if(particle->GetPdgCode() == 111){
1657 fHistoMCPi0InAccPt[fiCut]->Fill(particle->Pt(),weighted); // MC Pi0 with gamma in acc
1658 } else if(particle->GetPdgCode() == 221){
1659 fHistoMCEtaInAccPt[fiCut]->Fill(particle->Pt(),weighted); // MC Eta with gamma in acc
1660 }
1661 }
1662 }
1663 }
1664 }
1665
1666}
1667//________________________________________________________________________
1668void AliAnalysisTaskGammaCalo::ProcessMCParticles()
1669{
1670 // Loop over all primary MC particle
1671 for(Int_t i = 0; i < fMCStack->GetNprimary(); i++) {
1672 TParticle* particle = (TParticle *)fMCStack->Particle(i);
1673 if (!particle) continue;
1674
1675 Int_t isMCFromMBHeader = -1;
1676 if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 0){
1677 isMCFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCStack, fInputEvent);
1678 if(isMCFromMBHeader == 0 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 3) continue;
1679 }
1680
1681 if(((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedMC(particle,fMCStack)){
1682 fHistoMCAllGammaPt[fiCut]->Fill(particle->Pt()); // All MC Gamma
1683 if(particle->GetMother(0) >-1){ // Meson Decay Gamma
1684 switch(fMCStack->Particle(particle->GetMother(0))->GetPdgCode()){
1685 case 111: // Pi0
1686 fHistoMCDecayGammaPi0Pt[fiCut]->Fill(particle->Pt());
1687 break;
1688 case 113: // Rho0
1689 fHistoMCDecayGammaRhoPt[fiCut]->Fill(particle->Pt());
1690 break;
1691 case 221: // Eta
1692 fHistoMCDecayGammaEtaPt[fiCut]->Fill(particle->Pt());
1693 break;
1694 case 223: // Omega
1695 fHistoMCDecayGammaOmegaPt[fiCut]->Fill(particle->Pt());
1696 break;
1697 case 331: // Eta'
1698 fHistoMCDecayGammaEtapPt[fiCut]->Fill(particle->Pt());
1699 break;
1700 case 333: // Phi
1701 fHistoMCDecayGammaPhiPt[fiCut]->Fill(particle->Pt());
1702 break;
1703 case 3212: // Sigma
1704 fHistoMCDecayGammaSigmaPt[fiCut]->Fill(particle->Pt());
1705 break;
1706 }
1707 }
1708 }
1709 if(fDoMesonAnalysis){
1710 if(particle->GetPdgCode() == 310 && fDoMesonQA > 0){
1711 Double_t mesonY = 10.;
1712 if(particle->Energy() - particle->Pz() == 0 || particle->Energy() + particle->Pz() == 0){
1713 mesonY=10.-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
1714 } else{
1715 mesonY = 0.5*(TMath::Log((particle->Energy()+particle->Pz()) / (particle->Energy()-particle->Pz())))-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
1716 }
1717 Float_t weightedK0s= 1;
1718 if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCStack, fInputEvent)){
1719 if (particle->Pt()>0.005){
1720 weightedK0s= ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetWeightForMeson(fV0Reader->GetPeriodName(),i, fMCStack, fInputEvent);
1721 //cout << "MC input \t"<<i << "\t" << particle->Pt()<<"\t"<<weighted << endl;
1722 }
1723 }
1724 if (fMCStack->IsPhysicalPrimary(i)){
1725 fHistoMCK0sPt[fiCut]->Fill(particle->Pt(),weightedK0s);
1726 fHistoMCK0sWOWeightPt[fiCut]->Fill(particle->Pt());
1727 fHistoMCK0sPtY[fiCut]->Fill(particle->Pt(),mesonY,weightedK0s);
1728 }
1729 }
1730 if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))
1731 ->MesonIsSelectedMC(particle,fMCStack,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift())){
1732 TParticle* daughter0 = (TParticle*)fMCStack->Particle(particle->GetFirstDaughter());
1733 TParticle* daughter1 = (TParticle*)fMCStack->Particle(particle->GetLastDaughter());
1734
1735 Float_t weighted= 1;
1736 if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCStack, fInputEvent)){
1737 if (particle->Pt()>0.005){
1738 weighted= ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetWeightForMeson(fV0Reader->GetPeriodName(),i, fMCStack, fInputEvent);
1739 // if(particle->GetPdgCode() == 221){
1740 // cout << "MC input \t"<<i << "\t" << particle->Pt()<<"\t"<<weighted << endl;
1741 // }
1742 }
1743 }
1744 Double_t mesonY = 10.;
1745 if(particle->Energy() - particle->Pz() == 0 || particle->Energy() + particle->Pz() == 0){
1746 mesonY=10.-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
1747 } else{
1748 mesonY = 0.5*(TMath::Log((particle->Energy()+particle->Pz()) / (particle->Energy()-particle->Pz())))-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
1749 }
de752898 1750
1751 Double_t alpha = -1;
1752 if (particle->GetPdgCode() == 111 || particle->GetPdgCode() == 221){
1753 alpha = TMath::Abs((daughter0->Energy() - daughter1->Energy()))/(daughter0->Energy() + daughter1->Energy());
1754 }
1755
d53bf4ac 1756 if(particle->GetPdgCode() == 111){
1757 fHistoMCPi0Pt[fiCut]->Fill(particle->Pt(),weighted); // All MC Pi0
1758 fHistoMCPi0WOWeightPt[fiCut]->Fill(particle->Pt());
de752898 1759 if (fDoMesonQA > 0){
1760 fHistoMCPi0PtY[fiCut]->Fill(particle->Pt(),mesonY,weighted); // All MC Pi0
1761 fHistoMCPi0PtAlpha[fiCut]->Fill(particle->Pt(),alpha); // All MC Pi0
1762 }
d53bf4ac 1763 } else if(particle->GetPdgCode() == 221){
1764 fHistoMCEtaPt[fiCut]->Fill(particle->Pt(),weighted); // All MC Eta
1765 fHistoMCEtaWOWeightPt[fiCut]->Fill(particle->Pt());
de752898 1766 if (fDoMesonQA > 0){
1767 fHistoMCEtaPtY[fiCut]->Fill(particle->Pt(),mesonY,weighted); // All MC Pi0
1768 fHistoMCEtaPtAlpha[fiCut]->Fill(particle->Pt(),alpha); // All MC Pi0
1769 }
d53bf4ac 1770 }
1771
1772 // Check the acceptance for both gammas
1773 if(((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedMC(daughter0,fMCStack) &&
1774 ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedMC(daughter1,fMCStack) ){
1775 if(particle->GetPdgCode() == 111){
1776 fHistoMCPi0InAccPt[fiCut]->Fill(particle->Pt(),weighted); // MC Pi0 with gamma in acc
1777 } else if(particle->GetPdgCode() == 221){
1778 fHistoMCEtaInAccPt[fiCut]->Fill(particle->Pt(),weighted); // MC Eta with gamma in acc
1779 }
1780 }
1781 }
1782 }
1783 }
1784
1785 if (fDoMesonQA){
1786 for(Int_t i = fMCStack->GetNprimary(); i < fMCStack->GetNtrack(); i++) {
1787 TParticle* particle = (TParticle *)fMCStack->Particle(i);
1788 if (!particle) continue;
1789
1790 Int_t isMCFromMBHeader = -1;
1791 if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 0){
1792 isMCFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCStack, fInputEvent);
1793 if(isMCFromMBHeader == 0 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 3) continue;
1794 }
1795
1796 if(fDoMesonAnalysis){
1797 if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->MesonIsSelectedMC(particle,fMCStack,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift())){
1798 Float_t weighted= 1;
1799 if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCStack, fInputEvent)){
1800 if (particle->Pt()>0.005){
1801 weighted= ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetWeightForMeson(fV0Reader->GetPeriodName(),i, fMCStack, fInputEvent);
1802 // if(particle->GetPdgCode() == 221){
1803 // cout << "MC input \t"<<i << "\t" << particle->Pt()<<"\t"<<weighted << endl;
1804 // }
1805 }
1806 }
1807
1808 if(particle->GetPdgCode() == 111){
1809 Int_t pdgCode = ((TParticle*)fMCStack->Particle( particle->GetFirstMother() ))->GetPdgCode();
1810 Int_t source = GetSourceClassification(111,pdgCode);
1811 fHistoMCSecPi0PtvsSource[fiCut]->Fill(particle->Pt(),source,weighted); // All MC Pi0
1812 fHistoMCSecPi0Source[fiCut]->Fill(pdgCode);
1813 } else if(particle->GetPdgCode() == 221){
1814 Int_t pdgCode = ((TParticle*)fMCStack->Particle( particle->GetFirstMother() ))->GetPdgCode();
1815 fHistoMCSecEtaPt[fiCut]->Fill(particle->Pt(),weighted); // All MC Pi0
1816 fHistoMCSecEtaSource[fiCut]->Fill(pdgCode);
1817 }
1818 }
1819 }
1820 }
1821 }
1822}
1823
1824//________________________________________________________________________
1825void AliAnalysisTaskGammaCalo::CalculatePi0Candidates(){
1826
1827 // Conversion Gammas
1828 if(fClusterCandidates->GetEntries()>0){
1829
1830 // vertex
1831 Double_t vertex[3] = {0};
1832 InputEvent()->GetPrimaryVertex()->GetXYZ(vertex);
1833
1834 for(Int_t firstGammaIndex=0;firstGammaIndex<fClusterCandidates->GetEntries();firstGammaIndex++){
1835 AliAODConversionPhoton *gamma0=dynamic_cast<AliAODConversionPhoton*>(fClusterCandidates->At(firstGammaIndex));
1836 if (gamma0==NULL) continue;
1837
72cfe7c8 1838 for(Int_t secondGammaIndex=firstGammaIndex+1;secondGammaIndex<fClusterCandidates->GetEntries();secondGammaIndex++){
d53bf4ac 1839 AliAODConversionPhoton *gamma1=dynamic_cast<AliAODConversionPhoton*>(fClusterCandidates->At(secondGammaIndex));
1840 if (gamma1==NULL) continue;
8c96b4f9 1841
d53bf4ac 1842 AliAODConversionMother *pi0cand = new AliAODConversionMother(gamma0,gamma1);
1843 pi0cand->SetLabels(firstGammaIndex,secondGammaIndex);
cfd87ccd 1844
d53bf4ac 1845 if((((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->MesonIsSelected(pi0cand,kTRUE,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift()))){
1846 fHistoMotherInvMassPt[fiCut]->Fill(pi0cand->M(),pi0cand->Pt());
1847 // fill new histograms
1848 if(pi0cand->GetAlpha()<0.1)
1849 fHistoMotherInvMassEalpha[fiCut]->Fill(pi0cand->M(),pi0cand->E());
1850
1851 if (fDoMesonQA > 0){
1852 if ( pi0cand->M() > 0.05 && pi0cand->M() < 0.17){
1853 fHistoMotherPi0PtY[fiCut]->Fill(pi0cand->Pt(),pi0cand->Rapidity()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift());
1854 fHistoMotherPi0PtAlpha[fiCut]->Fill(pi0cand->Pt(),pi0cand->GetAlpha());
1855 fHistoMotherPi0PtOpenAngle[fiCut]->Fill(pi0cand->Pt(),pi0cand->GetOpeningAngle());
1856 }
1857 if ( pi0cand->M() > 0.45 && pi0cand->M() < 0.65){
1858 fHistoMotherEtaPtY[fiCut]->Fill(pi0cand->Pt(),pi0cand->Rapidity()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift());
1859 fHistoMotherEtaPtAlpha[fiCut]->Fill(pi0cand->Pt(),pi0cand->GetAlpha());
1860 fHistoMotherEtaPtOpenAngle[fiCut]->Fill(pi0cand->Pt(),pi0cand->GetOpeningAngle());
1861 }
1862 }
1863 if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->DoBGCalculation()){
1864 Int_t zbin = 0;
1865 Int_t mbin = 0;
1866
1867 if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->BackgroundHandlerType() == 0){
1868 zbin = fBGHandler[fiCut]->GetZBinIndex(fInputEvent->GetPrimaryVertex()->GetZ());
1869 if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->UseTrackMultiplicity()){
1870 mbin = fBGHandler[fiCut]->GetMultiplicityBinIndex(fV0Reader->GetNumberOfPrimaryTracks());
1871 } else {
1872 mbin = fBGHandler[fiCut]->GetMultiplicityBinIndex(fClusterCandidates->GetEntries());
1873 }
1874 }
1875 Double_t sparesFill[4] = {pi0cand->M(),pi0cand->Pt(),(Double_t)zbin,(Double_t)mbin};
1876 fSparseMotherInvMassPtZM[fiCut]->Fill(sparesFill,1);
1877 }
1878
1879 if(fIsMC){
1880 if(fInputEvent->IsA()==AliESDEvent::Class())
1881 ProcessTrueMesonCandidates(pi0cand,gamma0,gamma1);
1882 if(fInputEvent->IsA()==AliAODEvent::Class())
1883 ProcessTrueMesonCandidatesAOD(pi0cand,gamma0,gamma1);
1884 }
1885
1886 if (fDoMesonQA == 1){
1887 fHistoMotherInvMassECalib[fiCut]->Fill(pi0cand->M(),gamma1->E());
1888 if(pi0cand->GetAlpha()<0.1)
1889 fHistoMotherInvMassECalibalpha[fiCut]->Fill(pi0cand->M(),gamma1->E());
1890 }
1891
1892 }
8c96b4f9 1893 for (Int_t thirdGammaIndex=0;thirdGammaIndex<fClusterCandidates->GetEntries();thirdGammaIndex++){
1894 if (firstGammaIndex == thirdGammaIndex || secondGammaIndex == thirdGammaIndex ) continue;
1895 AliAODConversionPhoton *gamma2=dynamic_cast<AliAODConversionPhoton*>(fClusterCandidates->At(thirdGammaIndex));
1896 if (gamma2==NULL) continue;
1897
1898 AliAODConversionMother *pi0cand2 = new AliAODConversionMother(pi0cand,gamma2);
1899 if((((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->MesonIsSelected(pi0cand2,kTRUE,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift()))){
1900 fHistoMotherInvMass3ClusterPt[fiCut]->Fill(pi0cand2->M(),pi0cand2->Pt());
1901 }
1902 delete pi0cand2;
1903 pi0cand2=0x0;
1904
1905 }
1906
d53bf4ac 1907 delete pi0cand;
1908 pi0cand=0x0;
1909 }
1910 }
1911 }
1912}
1913//______________________________________________________________________
1914void AliAnalysisTaskGammaCalo::ProcessTrueMesonCandidates(AliAODConversionMother *Pi0Candidate, AliAODConversionPhoton *TrueGammaCandidate0, AliAODConversionPhoton *TrueGammaCandidate1)
1915{
1916 // Process True Mesons
1917 AliStack *MCStack = fMCEvent->Stack();
1918
5cd70387 1919 Bool_t isTruePi0 = kFALSE;
1920 Bool_t isTrueEta = kFALSE;
1921 Bool_t isSameConvertedGamma = kFALSE;
1922 Int_t convertedPhotonLabel0 = -1;
1923 Int_t convertedPhotonLabel1 = -1;
1924
d53bf4ac 1925 Int_t gamma0MCLabel = TrueGammaCandidate0->GetCaloPhotonMCLabel(0); // get most probable MC label
1926 Int_t gamma0MotherLabel = -1;
1927
1928 if(gamma0MCLabel != -1){ // Gamma is Combinatorial; MC Particles don't belong to the same Mother
1929 TParticle * gammaMC0 = (TParticle*)MCStack->Particle(gamma0MCLabel);
1930 if (TrueGammaCandidate0->IsLargestComponentPhoton() || TrueGammaCandidate0->IsLargestComponentElectron()){ // largest component is electro magnetic
1931 // get mother of interest (pi0 or eta)
1932 if (TrueGammaCandidate0->IsLargestComponentPhoton()){ // for photons its the direct mother
1933 gamma0MotherLabel=gammaMC0->GetMother(0);
1934 } else if (TrueGammaCandidate0->IsLargestComponentElectron()){ // for electrons its either the direct mother or for conversions the grandmother
5cd70387 1935 convertedPhotonLabel0 = gammaMC0->GetMother(0);
d53bf4ac 1936 if (TrueGammaCandidate0->IsConversion()) gamma0MotherLabel=MCStack->Particle(gammaMC0->GetMother(0))->GetMother(0);
1937 else gamma0MotherLabel=gammaMC0->GetMother(0);
1938 }
1939 }
1940 }
1941 if (!TrueGammaCandidate1->GetIsCaloPhoton()) AliFatal("CaloPhotonFlag has not been set. Aborting");
1942
1943 Int_t gamma1MCLabel = TrueGammaCandidate1->GetCaloPhotonMCLabel(0); // get most probable MC label
1944 Int_t gamma1MotherLabel = -1;
1945 // check if
1946
1947 if(gamma1MCLabel != -1){ // Gamma is Combinatorial; MC Particles don't belong to the same Mother
1948 // Daughters Gamma 1
1949 TParticle * gammaMC1 = (TParticle*)MCStack->Particle(gamma1MCLabel);
1950 if (TrueGammaCandidate1->IsLargestComponentPhoton() || TrueGammaCandidate1->IsLargestComponentElectron()){ // largest component is electro magnetic
1951 // get mother of interest (pi0 or eta)
1952 if (TrueGammaCandidate1->IsLargestComponentPhoton()){ // for photons its the direct mother
1953 gamma1MotherLabel=gammaMC1->GetMother(0);
1954 } else if (TrueGammaCandidate1->IsLargestComponentElectron()){ // for electrons its either the direct mother or for conversions the grandmother
5cd70387 1955 convertedPhotonLabel1 = gammaMC1->GetMother(0);
d53bf4ac 1956 if (TrueGammaCandidate1->IsConversion()) gamma1MotherLabel=MCStack->Particle(gammaMC1->GetMother(0))->GetMother(0);
1957 else gamma1MotherLabel=gammaMC1->GetMother(0);
1958 }
1959 }
1960 }
1961
1962 if(gamma0MotherLabel>=0 && gamma0MotherLabel==gamma1MotherLabel){
1963 if(((TParticle*)MCStack->Particle(gamma1MotherLabel))->GetPdgCode() == 111){
1964 isTruePi0=kTRUE;
1965 }
1966 if(((TParticle*)MCStack->Particle(gamma1MotherLabel))->GetPdgCode() == 221){
1967 isTrueEta=kTRUE;
1968 }
1969 }
1970
ea1bc51e 1971 if (convertedPhotonLabel0 > -1 && convertedPhotonLabel1 > -1){
5cd70387 1972 if (convertedPhotonLabel0==convertedPhotonLabel1) isSameConvertedGamma = kTRUE;
1973 }
1974
d53bf4ac 1975 if(isTruePi0 || isTrueEta){// True Pion or Eta
ed8bc1ca 1976 if (isTruePi0) fHistoTruePi0InvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
1977 if (isTrueEta) fHistoTrueEtaInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
d53bf4ac 1978 if (fDoMesonQA > 0){
1979 // both gammas are real gammas
ed8bc1ca 1980 if (TrueGammaCandidate0->IsLargestComponentPhoton() && TrueGammaCandidate1->IsLargestComponentPhoton()) {
1981 if (isTruePi0) fHistoTruePi0CaloPhotonInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
1982 if (isTrueEta) fHistoTrueEtaCaloPhotonInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
1983 }
d53bf4ac 1984 // both particles are electrons
ed8bc1ca 1985 if (TrueGammaCandidate0->IsLargestComponentElectron() && TrueGammaCandidate1->IsLargestComponentElectron() ) {
1986 if (isTruePi0) fHistoTruePi0CaloElectronInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
1987 if (isTrueEta) fHistoTrueEtaCaloElectronInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
1988 }
d53bf4ac 1989 // both particles are converted electrons
1990 if ((TrueGammaCandidate0->IsLargestComponentElectron() && TrueGammaCandidate0->IsConversion()) && (TrueGammaCandidate1->IsLargestComponentElectron() && TrueGammaCandidate1->IsConversion()) ){
d53bf4ac 1991 if (isTruePi0 )fHistoTruePi0CaloConvertedPhotonInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
1992 if (isTrueEta )fHistoTrueEtaCaloConvertedPhotonInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
1993 }
1994 // 1 gamma is converted the other one is normals
1995 if ( (TrueGammaCandidate0->IsLargestComponentPhoton() && TrueGammaCandidate1->IsLargestComponentElectron() && TrueGammaCandidate1->IsConversion()) ||
1996 (TrueGammaCandidate1->IsLargestComponentPhoton() && TrueGammaCandidate0->IsLargestComponentElectron() && TrueGammaCandidate0->IsConversion())
ed8bc1ca 1997 ) {
1998 if (isTruePi0) fHistoTruePi0CaloMixedPhotonConvPhotonInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
1999 if (isTrueEta) fHistoTrueEtaCaloMixedPhotonConvPhotonInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2000 }
def90c8b 2001
2002 if ( (TrueGammaCandidate0->IsLargestComponentElectron() && TrueGammaCandidate0->IsConversion() && TrueGammaCandidate1->IsLargestComponentPhoton() && !TrueGammaCandidate1->IsMerged()) ||
2003 (TrueGammaCandidate1->IsLargestComponentElectron() && TrueGammaCandidate1->IsConversion() && TrueGammaCandidate0->IsLargestComponentPhoton() && !TrueGammaCandidate0->IsMerged())
2004 ) {
2005 if (isTruePi0) fHistoTruePi0NonMergedElectronPhotonInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2006 }
2007
2008 if ( (TrueGammaCandidate0->IsLargestComponentElectron() && TrueGammaCandidate0->IsConversion() && TrueGammaCandidate1->IsLargestComponentPhoton() && TrueGammaCandidate1->IsMerged()) ||
2009 (TrueGammaCandidate1->IsLargestComponentElectron() && TrueGammaCandidate1->IsConversion() && TrueGammaCandidate0->IsLargestComponentPhoton() && TrueGammaCandidate0->IsMerged())
2010 ) {
2011 if (isTruePi0) fHistoTruePi0NonMergedElectronMergedPhotonInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2012 }
2013
d53bf4ac 2014 // at least one of the photon is merged
ed8bc1ca 2015 if (TrueGammaCandidate0->IsMerged() || TrueGammaCandidate0->IsMergedPartConv() || TrueGammaCandidate0->IsDalitzMerged() || TrueGammaCandidate1->IsMerged() || TrueGammaCandidate1->IsMergedPartConv() || TrueGammaCandidate1->IsDalitzMerged() ){
2016 if (isTruePi0) fHistoTruePi0CaloMergedClusterInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2017 if (isTrueEta) fHistoTruePi0CaloMergedClusterInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2018 }
d53bf4ac 2019 // at least one of the photon is merged and part conv
ed8bc1ca 2020 if (TrueGammaCandidate1->IsMergedPartConv() || TrueGammaCandidate0->IsMergedPartConv()) {
2021 if (isTruePi0) fHistoTruePi0CaloMergedClusterPartConvInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2022 if (isTrueEta) fHistoTrueEtaCaloMergedClusterPartConvInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2023 }
d53bf4ac 2024 }
2025
5cd70387 2026 if (fDoMesonQA == 2){
2027 // category 1: 2 real photons unmerged
2028 if (TrueGammaCandidate0->IsLargestComponentPhoton() && !TrueGammaCandidate0->IsMerged() && TrueGammaCandidate1->IsLargestComponentPhoton() && !TrueGammaCandidate1->IsMerged()) {
2029 if (isTruePi0) fHistoTruePi0Category1[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2030 if (isTrueEta) fHistoTrueEtaCategory1[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2031 }
2032 // category 2, 3: 1 real photons unmerged, 1 electron (category 2 merged, category 3 unmerged )
2033 // -> photon 0 is unconverted
2034 if ( (TrueGammaCandidate0->IsLargestComponentPhoton() && !TrueGammaCandidate0->IsMerged()) && (TrueGammaCandidate1->IsLargestComponentElectron() && TrueGammaCandidate1->IsConversion())) {
2035 if (isTruePi0){
ecd3e131 2036 if (TrueGammaCandidate1->IsMergedPartConv()) fHistoTruePi0Category2[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
ea1bc51e 2037 if (!TrueGammaCandidate1->IsMergedPartConv()){
2038 fHistoTruePi0Category3[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2039 }
5cd70387 2040 }
2041 if (isTrueEta){
ecd3e131 2042 if (TrueGammaCandidate1->IsMergedPartConv()) fHistoTrueEtaCategory2[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2043 if (!TrueGammaCandidate1->IsMergedPartConv()) fHistoTrueEtaCategory3[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
5cd70387 2044 }
2045 }
2046 // -> photon 1 is unconverted
2047 if ( ( TrueGammaCandidate1->IsLargestComponentPhoton() && !TrueGammaCandidate1->IsMerged()) && (TrueGammaCandidate0->IsLargestComponentElectron() && TrueGammaCandidate0->IsConversion())) {
2048 if (isTruePi0){
ecd3e131 2049 if (TrueGammaCandidate0->IsMergedPartConv()) fHistoTruePi0Category2[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
ea1bc51e 2050 if (!TrueGammaCandidate0->IsMergedPartConv()){
2051 fHistoTruePi0Category3[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2052 }
5cd70387 2053 }
2054 if (isTrueEta){
ecd3e131 2055 if (TrueGammaCandidate0->IsMergedPartConv()) fHistoTrueEtaCategory2[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2056 if (!TrueGammaCandidate0->IsMergedPartConv()) fHistoTrueEtaCategory3[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
5cd70387 2057 }
2058 }
2059
2060 // category 4 & 6, 5, 7, 8
2061 if ( (TrueGammaCandidate0->IsLargestComponentElectron() && TrueGammaCandidate0->IsConversion()) && (TrueGammaCandidate1->IsLargestComponentElectron() && TrueGammaCandidate1->IsConversion()) ){
2062 if (isTruePi0){
2063 // category 4: both electrons are from same conversion
ecd3e131 2064 if (isSameConvertedGamma && !TrueGammaCandidate0->IsMergedPartConv() && !TrueGammaCandidate1->IsMergedPartConv() ) fHistoTruePi0Category4_6[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
5cd70387 2065 if (!isSameConvertedGamma ){
ecd3e131 2066 if (!TrueGammaCandidate0->IsMergedPartConv() && !TrueGammaCandidate1->IsMergedPartConv()){ // category 5: both electrons from different converted photons, electrons not merged
5cd70387 2067 fHistoTruePi0Category5[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
ecd3e131 2068 } else if (TrueGammaCandidate0->IsMergedPartConv() && TrueGammaCandidate1->IsMergedPartConv()){ // category 8: both electrons from different converted photons, both electrons merged
5cd70387 2069 fHistoTruePi0Category8[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2070 } else { // category 7: both electrons from different converted photons, 1 electrons not merged, 1 electron merged
2071 fHistoTruePi0Category7[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2072 }
2073 }
2074 }
2075 if (isTrueEta){
2076 // category 4: both electrons are from same conversion
ecd3e131 2077 if (isSameConvertedGamma && !TrueGammaCandidate0->IsMergedPartConv() && !TrueGammaCandidate1->IsMergedPartConv()) fHistoTrueEtaCategory4_6[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
5cd70387 2078 if (!isSameConvertedGamma ){
ecd3e131 2079 if (!TrueGammaCandidate0->IsMergedPartConv() && !TrueGammaCandidate1->IsMergedPartConv()){ // category 5: both electrons from different converted photons, electrons not merged
5cd70387 2080 fHistoTrueEtaCategory5[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
ecd3e131 2081 } else if (TrueGammaCandidate0->IsMergedPartConv() && TrueGammaCandidate1->IsMergedPartConv()){ // category 8: both electrons from different converted photons, both electrons merged
5cd70387 2082 fHistoTrueEtaCategory8[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2083 } else { // category 7: both electrons from different converted photons, 1 electrons not merged, 1 electron merged
2084 fHistoTrueEtaCategory7[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2085 }
2086 }
2087 }
2088 }
2089 }
2090
d53bf4ac 2091 if (fDoMesonQA > 0){
2092 if (isTruePi0){
2093 if ( Pi0Candidate->M() > 0.05 && Pi0Candidate->M() < 0.17){
2094 fHistoTruePi0PtY[fiCut]->Fill(Pi0Candidate->Pt(),Pi0Candidate->Rapidity()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift());
2095 fHistoTruePi0PtAlpha[fiCut]->Fill(Pi0Candidate->Pt(),Pi0Candidate->GetAlpha());
2096 fHistoTruePi0PtOpenAngle[fiCut]->Fill(Pi0Candidate->Pt(),Pi0Candidate->GetOpeningAngle());
2097 }
2098 } else if (isTrueEta){
2099 if ( Pi0Candidate->M() > 0.45 && Pi0Candidate->M() < 0.65){
2100 fHistoTrueEtaPtY[fiCut]->Fill(Pi0Candidate->Pt(),Pi0Candidate->Rapidity()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift());
2101 fHistoTrueEtaPtAlpha[fiCut]->Fill(Pi0Candidate->Pt(),Pi0Candidate->GetAlpha());
2102 fHistoTrueEtaPtOpenAngle[fiCut]->Fill(Pi0Candidate->Pt(),Pi0Candidate->GetOpeningAngle());
2103 }
2104 }
2105 }
2106
2107 if(gamma0MotherLabel >= MCStack->GetNprimary()){ // Secondary Meson
2108 Int_t secMotherLabel = ((TParticle*)MCStack->Particle(gamma0MotherLabel))->GetMother(0);
2109 Float_t weightedSec= 1;
2110 if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(secMotherLabel, fMCStack, fInputEvent) && MCStack->Particle(secMotherLabel)->GetPdgCode()==310){
2111 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
2112 //cout << "MC input \t"<<i << "\t" << particle->Pt()<<"\t"<<weighted << endl;
2113 }
ed8bc1ca 2114 if (isTruePi0) fHistoTrueSecondaryPi0InvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weightedSec);
2115 if (isTrueEta) fHistoTrueSecondaryEtaInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weightedSec);
d53bf4ac 2116 if (secMotherLabel >-1){
ed8bc1ca 2117 if(MCStack->Particle(secMotherLabel)->GetPdgCode()==310 && isTruePi0){
2118 fHistoTrueSecondaryPi0FromK0sInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weightedSec);
d53bf4ac 2119 if (fDoMesonQA > 0)fHistoTrueK0sWithPi0DaughterMCPt[fiCut]->Fill(MCStack->Particle(secMotherLabel)->Pt());
2120 }
ed8bc1ca 2121 if(MCStack->Particle(secMotherLabel)->GetPdgCode()==221 && isTruePi0){
2122 fHistoTrueSecondaryPi0FromEtaInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weightedSec);
d53bf4ac 2123 if (fDoMesonQA > 0)fHistoTrueEtaWithPi0DaughterMCPt[fiCut]->Fill(MCStack->Particle(secMotherLabel)->Pt());
2124 }
ed8bc1ca 2125 if(MCStack->Particle(secMotherLabel)->GetPdgCode()==3122 && isTruePi0){
2126 fHistoTrueSecondaryPi0FromLambdaInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weightedSec);
d53bf4ac 2127 if (fDoMesonQA > 0)fHistoTrueLambdaWithPi0DaughterMCPt[fiCut]->Fill(MCStack->Particle(secMotherLabel)->Pt());
2128 }
2129 }
2130 } else { // Only primary pi0 for efficiency calculation
2131 Float_t weighted= 1;
2132 if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(gamma1MotherLabel, fMCStack, fInputEvent)){
2133 if (((TParticle*)MCStack->Particle(gamma1MotherLabel))->Pt()>0.005){
2134 weighted= ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetWeightForMeson(fV0Reader->GetPeriodName(),gamma1MotherLabel, fMCStack, fInputEvent);
2135 // cout << "rec \t " <<gamma1MotherLabel << "\t" << weighted << endl;
2136 }
2137 }
ed8bc1ca 2138 if (isTruePi0){
2139 fHistoTruePrimaryPi0InvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weighted);
2140 fHistoTruePrimaryPi0W0WeightingInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2141 fProfileTruePrimaryPi0WeightsInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weighted);
2142 } else if (isTrueEta){
2143 fHistoTruePrimaryEtaInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weighted);
2144 fHistoTruePrimaryEtaW0WeightingInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2145 fProfileTruePrimaryEtaWeightsInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weighted);
2146 }
d53bf4ac 2147
2148 if (fDoMesonQA > 0){
2149 if(isTruePi0){ // Only primary pi0 for resolution
2150 fHistoTruePrimaryPi0MCPtResolPt[fiCut]->Fill(((TParticle*)MCStack->Particle(gamma1MotherLabel))->Pt(),(Pi0Candidate->Pt()-((TParticle*)MCStack->Particle(gamma1MotherLabel))->Pt())/((TParticle*)MCStack->Particle(gamma1MotherLabel))->Pt(),weighted);
2151 }
2152 if (isTrueEta){ // Only primary eta for resolution
2153 fHistoTruePrimaryEtaMCPtResolPt[fiCut]->Fill(((TParticle*)MCStack->Particle(gamma1MotherLabel))->Pt(),(Pi0Candidate->Pt()-((TParticle*)MCStack->Particle(gamma1MotherLabel))->Pt())/((TParticle*)MCStack->Particle(gamma1MotherLabel))->Pt(),weighted);
2154 }
2155 }
2156 }
2157 } else if(!isTruePi0 && !isTrueEta){ // Background
2158 if (fDoMesonQA > 0){
2159 if(gamma0MotherLabel>-1 && gamma1MotherLabel>-1){ // Both Tracks are Photons and have a mother but not Pi0 or Eta
2160 fHistoTrueBckGGInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2161 } else { // No photon or without mother
2162 fHistoTrueBckContInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2163 }
2164 }
2165 }
2166
2167}
2168//______________________________________________________________________
2169void AliAnalysisTaskGammaCalo::ProcessTrueMesonCandidatesAOD(AliAODConversionMother *Pi0Candidate, AliAODConversionPhoton *TrueGammaCandidate0, AliAODConversionPhoton *TrueGammaCandidate1)
2170{
2171
2172 // Process True Mesons
2173 TClonesArray *AODMCTrackArray = dynamic_cast<TClonesArray*>(fInputEvent->FindListObject(AliAODMCParticle::StdBranchName()));
5cd70387 2174 Bool_t isTruePi0 = kFALSE;
2175 Bool_t isTrueEta = kFALSE;
2176 Bool_t isSameConvertedGamma = kFALSE;
2177 Int_t convertedPhotonLabel0 = -1;
2178 Int_t convertedPhotonLabel1 = -1;
d53bf4ac 2179
5cd70387 2180 Int_t gamma0MCLabel = TrueGammaCandidate0->GetCaloPhotonMCLabel(0); // get most probable MC label
2181 Int_t gamma0MotherLabel = -1;
2182
2183 // check if
d53bf4ac 2184 if(gamma0MCLabel != -1){ // Gamma is Combinatorial; MC Particles don't belong to the same Mother
2185 // Daughters Gamma 0
2186 AliAODMCParticle * gammaMC0 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma0MCLabel));
2187 if (TrueGammaCandidate0->IsLargestComponentPhoton() || TrueGammaCandidate0->IsLargestComponentElectron()){ // largest component is electro magnetic
2188 // get mother of interest (pi0 or eta)
2189 if (TrueGammaCandidate0->IsLargestComponentPhoton()){ // for photons its the direct mother
2190 gamma0MotherLabel=gammaMC0->GetMother();
2191 } else if (TrueGammaCandidate0->IsLargestComponentElectron()){ // for electrons its either the direct mother or for conversions the grandmother
2192 if (TrueGammaCandidate0->IsConversion()){
5cd70387 2193 convertedPhotonLabel0 = gammaMC0->GetMother();
d53bf4ac 2194 AliAODMCParticle * gammaGrandMotherMC0 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gammaMC0->GetMother()));
2195 gamma0MotherLabel=gammaGrandMotherMC0->GetMother();
2196 } else gamma0MotherLabel=gammaMC0->GetMother();
2197 }
2198 }
2199 }
2200
5cd70387 2201 Int_t gamma1MCLabel = TrueGammaCandidate1->GetCaloPhotonMCLabel(0); // get most probable MC label
2202 Int_t gamma1MotherLabel = -1;
2203
2204 // check if
d53bf4ac 2205 if(gamma1MCLabel != -1){ // Gamma is Combinatorial; MC Particles don't belong to the same Mother
2206 // Daughters Gamma 1
2207 AliAODMCParticle * gammaMC1 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma1MCLabel));
2208 if (TrueGammaCandidate1->IsLargestComponentPhoton() || TrueGammaCandidate1->IsLargestComponentElectron()){ // largest component is electro magnetic
2209 // get mother of interest (pi0 or eta)
2210 if (TrueGammaCandidate1->IsLargestComponentPhoton()){ // for photons its the direct mother
2211 gamma1MotherLabel=gammaMC1->GetMother();
2212 } else if (TrueGammaCandidate1->IsLargestComponentElectron()){ // for electrons its either the direct mother or for conversions the grandmother
2213 if (TrueGammaCandidate1->IsConversion()){
5cd70387 2214 convertedPhotonLabel1 = gammaMC1->GetMother();
d53bf4ac 2215 AliAODMCParticle * gammaGrandMotherMC1 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gammaMC1->GetMother()));
2216 gamma1MotherLabel=gammaGrandMotherMC1->GetMother();
2217 } else gamma1MotherLabel=gammaMC1->GetMother();
2218 }
2219 }
2220 }
2221
2222 if(gamma0MotherLabel>=0 && gamma0MotherLabel==gamma1MotherLabel){
2223 if(((AliAODMCParticle*)AODMCTrackArray->At(gamma1MotherLabel))->GetPdgCode() == 111){
2224 isTruePi0=kTRUE;
2225 }
2226 if(((AliAODMCParticle*)AODMCTrackArray->At(gamma1MotherLabel))->GetPdgCode() == 221){
2227 isTrueEta=kTRUE;
2228 }
2229 }
5cd70387 2230
2231 if (convertedPhotonLabel0 > -1 && convertedPhotonLabel1 > 1){
2232 if (convertedPhotonLabel0==convertedPhotonLabel1) isSameConvertedGamma = kTRUE;
2233 }
2234
d53bf4ac 2235
2236 if(isTruePi0 || isTrueEta){// True Pion or Eta
ed8bc1ca 2237 if (isTruePi0)fHistoTruePi0InvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2238 if (isTrueEta)fHistoTrueEtaInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
d53bf4ac 2239 if (fDoMesonQA > 0){
2240 // both gammas are real gammas
ed8bc1ca 2241 if (TrueGammaCandidate0->IsLargestComponentPhoton() && TrueGammaCandidate1->IsLargestComponentPhoton()) {
2242 if (isTruePi0)fHistoTruePi0CaloPhotonInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2243 if (isTrueEta)fHistoTrueEtaCaloPhotonInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2244 }
d53bf4ac 2245 // both particles are electrons
ed8bc1ca 2246 if (TrueGammaCandidate0->IsLargestComponentElectron() && TrueGammaCandidate1->IsLargestComponentElectron() ) {
2247 if (isTruePi0) fHistoTruePi0CaloElectronInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2248 if (isTrueEta) fHistoTrueEtaCaloElectronInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2249 }
d53bf4ac 2250 // both particles are converted electrons
2251 if ((TrueGammaCandidate0->IsLargestComponentElectron() && TrueGammaCandidate0->IsConversion()) && (TrueGammaCandidate1->IsLargestComponentElectron() && TrueGammaCandidate1->IsConversion()) ){
d53bf4ac 2252 if (isTruePi0 )fHistoTruePi0CaloConvertedPhotonInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2253 if (isTrueEta )fHistoTrueEtaCaloConvertedPhotonInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2254 }
2255 // 1 gamma is converted the other one is normals
2256 if ( (TrueGammaCandidate0->IsLargestComponentPhoton() && TrueGammaCandidate1->IsLargestComponentElectron() && TrueGammaCandidate1->IsConversion()) ||
2257 (TrueGammaCandidate1->IsLargestComponentPhoton() && TrueGammaCandidate0->IsLargestComponentElectron() && TrueGammaCandidate0->IsConversion())
ed8bc1ca 2258 ) {
2259 if (isTruePi0) fHistoTruePi0CaloMixedPhotonConvPhotonInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2260 if (isTrueEta) fHistoTrueEtaCaloMixedPhotonConvPhotonInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2261 }
def90c8b 2262
2263 if ( (TrueGammaCandidate0->IsLargestComponentElectron() && TrueGammaCandidate0->IsConversion() && TrueGammaCandidate1->IsLargestComponentPhoton() && !TrueGammaCandidate1->IsMerged()) ||
2264 (TrueGammaCandidate1->IsLargestComponentElectron() && TrueGammaCandidate1->IsConversion() && TrueGammaCandidate0->IsLargestComponentPhoton() && !TrueGammaCandidate0->IsMerged())
2265 ) {
2266 if (isTruePi0) fHistoTruePi0NonMergedElectronPhotonInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2267 }
2268
2269 if ( (TrueGammaCandidate0->IsLargestComponentElectron() && TrueGammaCandidate0->IsConversion() && TrueGammaCandidate1->IsLargestComponentPhoton() && TrueGammaCandidate1->IsMerged()) ||
2270 (TrueGammaCandidate1->IsLargestComponentElectron() && TrueGammaCandidate1->IsConversion() && TrueGammaCandidate0->IsLargestComponentPhoton() && TrueGammaCandidate0->IsMerged())
2271 ) {
2272 if (isTruePi0) fHistoTruePi0NonMergedElectronMergedPhotonInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2273 }
2274
d53bf4ac 2275 // at least one of the photon is merged
ed8bc1ca 2276 if (TrueGammaCandidate0->IsMerged() || TrueGammaCandidate0->IsMergedPartConv() || TrueGammaCandidate0->IsDalitzMerged() || TrueGammaCandidate1->IsMerged() || TrueGammaCandidate1->IsMergedPartConv() || TrueGammaCandidate1->IsDalitzMerged() ){
2277 if (isTruePi0) fHistoTruePi0CaloMergedClusterInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2278 if (isTrueEta) fHistoTrueEtaCaloMergedClusterInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2279 }
d53bf4ac 2280 // at least one of the photon is merged and part conv
ed8bc1ca 2281 if (TrueGammaCandidate1->IsMergedPartConv() || TrueGammaCandidate0->IsMergedPartConv()) {
2282 if (isTruePi0)fHistoTruePi0CaloMergedClusterPartConvInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2283 if (isTrueEta)fHistoTrueEtaCaloMergedClusterPartConvInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2284 }
d53bf4ac 2285 }
2286
5cd70387 2287 if (fDoMesonQA == 2){
2288 // category 1: 2 real photons unmerged
2289 if (TrueGammaCandidate0->IsLargestComponentPhoton() && !TrueGammaCandidate0->IsMerged() && TrueGammaCandidate1->IsLargestComponentPhoton() && !TrueGammaCandidate1->IsMerged()) {
2290 if (isTruePi0) fHistoTruePi0Category1[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2291 if (isTrueEta) fHistoTrueEtaCategory1[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2292 }
2293 // category 2, 3: 1 real photons unmerged, 1 electron (category 2 merged, category 3 unmerged )
2294 // -> photon 0 is unconverted
2295 if ( (TrueGammaCandidate0->IsLargestComponentPhoton() && !TrueGammaCandidate0->IsMerged()) && (TrueGammaCandidate1->IsLargestComponentElectron() && TrueGammaCandidate1->IsConversion())) {
2296 if (isTruePi0){
ecd3e131 2297 if (TrueGammaCandidate1->IsMergedPartConv()) fHistoTruePi0Category2[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2298 if (!TrueGammaCandidate1->IsMergedPartConv()) fHistoTruePi0Category3[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
5cd70387 2299 }
2300 if (isTrueEta){
ecd3e131 2301 if (TrueGammaCandidate1->IsMergedPartConv()) fHistoTrueEtaCategory2[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2302 if (!TrueGammaCandidate1->IsMergedPartConv()) fHistoTrueEtaCategory3[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
5cd70387 2303 }
2304 }
2305 // -> photon 1 is unconverted
2306 if ( ( TrueGammaCandidate1->IsLargestComponentPhoton() && !TrueGammaCandidate1->IsMerged()) && (TrueGammaCandidate0->IsLargestComponentElectron() && TrueGammaCandidate0->IsConversion())) {
2307 if (isTruePi0){
ecd3e131 2308 if (TrueGammaCandidate0->IsMergedPartConv()) fHistoTruePi0Category2[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2309 if (!TrueGammaCandidate0->IsMergedPartConv()) fHistoTruePi0Category3[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
5cd70387 2310 }
2311 if (isTrueEta){
ecd3e131 2312 if (TrueGammaCandidate0->IsMergedPartConv()) fHistoTrueEtaCategory2[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2313 if (!TrueGammaCandidate0->IsMergedPartConv()) fHistoTrueEtaCategory3[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
5cd70387 2314 }
2315 }
2316
2317 // category 4 & 6, 5, 7, 8
2318 if ( (TrueGammaCandidate0->IsLargestComponentElectron() && TrueGammaCandidate0->IsConversion()) && (TrueGammaCandidate1->IsLargestComponentElectron() && TrueGammaCandidate1->IsConversion()) ){
2319 if (isTruePi0){
2320 // category 4: both electrons are from same conversion
ecd3e131 2321 if (isSameConvertedGamma && !TrueGammaCandidate0->IsMergedPartConv() && !TrueGammaCandidate1->IsMergedPartConv() ) fHistoTruePi0Category4_6[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
5cd70387 2322 if (!isSameConvertedGamma ){
ecd3e131 2323 if (!TrueGammaCandidate0->IsMergedPartConv() && !TrueGammaCandidate1->IsMerged()){ // category 5: both electrons from different converted photons, electrons not merged
5cd70387 2324 fHistoTruePi0Category5[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
ecd3e131 2325 } else if (TrueGammaCandidate0->IsMergedPartConv() && TrueGammaCandidate1->IsMerged()){ // category 8: both electrons from different converted photons, both electrons merged
5cd70387 2326 fHistoTruePi0Category8[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2327 } else { // category 7: both electrons from different converted photons, 1 electrons not merged, 1 electron merged
2328 fHistoTruePi0Category7[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2329 }
2330 }
2331 }
2332 if (isTrueEta){
2333 // category 4: both electrons are from same conversion
ecd3e131 2334 if (isSameConvertedGamma && !TrueGammaCandidate0->IsMergedPartConv() && !TrueGammaCandidate1->IsMergedPartConv()) fHistoTrueEtaCategory4_6[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
5cd70387 2335 if (!isSameConvertedGamma ){
ecd3e131 2336 if (!TrueGammaCandidate0->IsMergedPartConv() && !TrueGammaCandidate1->IsMergedPartConv()){ // category 5: both electrons from different converted photons, electrons not merged
5cd70387 2337 fHistoTrueEtaCategory5[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
ecd3e131 2338 } else if (TrueGammaCandidate0->IsMergedPartConv() && TrueGammaCandidate1->IsMergedPartConv()){ // category 8: both electrons from different converted photons, both electrons merged
5cd70387 2339 fHistoTrueEtaCategory8[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2340 } else { // category 7: both electrons from different converted photons, 1 electrons not merged, 1 electron merged
2341 fHistoTrueEtaCategory7[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2342 }
2343 }
2344 }
2345 }
2346 }
2347
d53bf4ac 2348 if (fDoMesonQA > 0){
2349 if (isTruePi0){
2350 if ( Pi0Candidate->M() > 0.05 && Pi0Candidate->M() < 0.17){
2351 fHistoTruePi0PtY[fiCut]->Fill(Pi0Candidate->Pt(),Pi0Candidate->Rapidity()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift());
2352 fHistoTruePi0PtAlpha[fiCut]->Fill(Pi0Candidate->Pt(),Pi0Candidate->GetAlpha());
2353 fHistoTruePi0PtOpenAngle[fiCut]->Fill(Pi0Candidate->Pt(),Pi0Candidate->GetOpeningAngle());
2354 }
2355 } else if (isTrueEta){
2356 if ( Pi0Candidate->M() > 0.45 && Pi0Candidate->M() < 0.65){
2357 fHistoTrueEtaPtY[fiCut]->Fill(Pi0Candidate->Pt(),Pi0Candidate->Rapidity()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift());
2358 fHistoTrueEtaPtAlpha[fiCut]->Fill(Pi0Candidate->Pt(),Pi0Candidate->GetAlpha());
2359 fHistoTrueEtaPtOpenAngle[fiCut]->Fill(Pi0Candidate->Pt(),Pi0Candidate->GetOpeningAngle());
2360 }
2361 }
2362 }
2363 if(!(static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma0MotherLabel))->IsPrimary())){ // Secondary Meson
2364 Int_t secMotherLabel = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma1MotherLabel))->GetMother();
2365 Float_t weightedSec= 1;
2366 if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(secMotherLabel, 0x0, fInputEvent) && static_cast<AliAODMCParticle*>(AODMCTrackArray->At(secMotherLabel))->GetPdgCode()==310){
2367 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
2368 //cout << "MC input \t"<<i << "\t" << particle->Pt()<<"\t"<<weighted << endl;
2369 }
ed8bc1ca 2370 if (isTruePi0) fHistoTrueSecondaryPi0InvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weightedSec);
2371 if (isTrueEta) fHistoTrueSecondaryEtaInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weightedSec);
d53bf4ac 2372 if (secMotherLabel >-1){
ed8bc1ca 2373 if(static_cast<AliAODMCParticle*>(AODMCTrackArray->At(secMotherLabel))->GetPdgCode()==310 && isTruePi0 ){
2374 fHistoTrueSecondaryPi0FromK0sInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weightedSec);
d53bf4ac 2375 if (fDoMesonQA > 0)fHistoTrueK0sWithPi0DaughterMCPt[fiCut]->Fill(static_cast<AliAODMCParticle*>(AODMCTrackArray->At(secMotherLabel))->Pt());
2376 }
ed8bc1ca 2377 if(static_cast<AliAODMCParticle*>(AODMCTrackArray->At(secMotherLabel))->GetPdgCode()==221 && isTruePi0){
2378 fHistoTrueSecondaryPi0FromEtaInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weightedSec);
d53bf4ac 2379 if (fDoMesonQA > 0)fHistoTrueEtaWithPi0DaughterMCPt[fiCut]->Fill(static_cast<AliAODMCParticle*>(AODMCTrackArray->At(secMotherLabel))->Pt());
2380 }
ed8bc1ca 2381 if(static_cast<AliAODMCParticle*>(AODMCTrackArray->At(secMotherLabel))->GetPdgCode()==3122 && isTruePi0){
2382 fHistoTrueSecondaryPi0FromLambdaInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weightedSec);
d53bf4ac 2383 if (fDoMesonQA > 0)fHistoTrueLambdaWithPi0DaughterMCPt[fiCut]->Fill(static_cast<AliAODMCParticle*>(AODMCTrackArray->At(secMotherLabel))->Pt());
2384 }
2385 }
2386 } else{ // Only primary pi0 for efficiency calculation
2387 Float_t weighted= 1;
2388 if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(gamma1MotherLabel, 0x0, fInputEvent)){
2389 if (static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma1MotherLabel))->Pt()>0.005){
2390 weighted= ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetWeightForMeson(fV0Reader->GetPeriodName(),gamma1MotherLabel, 0x0, fInputEvent);
2391 // cout << "rec \t " <<gamma1MotherLabel << "\t" << weighted << endl;
2392 }
2393 }
ed8bc1ca 2394 if (isTruePi0){
2395 fHistoTruePrimaryPi0InvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weighted);
2396 fHistoTruePrimaryPi0W0WeightingInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2397 fProfileTruePrimaryPi0WeightsInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weighted);
2398 } else if (isTrueEta){
2399 fHistoTruePrimaryEtaInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weighted);
2400 fHistoTruePrimaryEtaW0WeightingInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2401 fProfileTruePrimaryEtaWeightsInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weighted);
2402 }
d53bf4ac 2403 if (fDoMesonQA > 0){
2404 if(isTruePi0){ // Only primary pi0 for resolution
2405 fHistoTruePrimaryPi0MCPtResolPt[fiCut]->Fill(static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma1MotherLabel))->Pt(),
2406 (Pi0Candidate->Pt()-static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma1MotherLabel))->Pt())/static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma1MotherLabel))->Pt(),weighted);
2407
2408 }
2409 if (isTrueEta){ // Only primary eta for resolution
2410 fHistoTruePrimaryEtaMCPtResolPt[fiCut]->Fill(static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma1MotherLabel))->Pt(),
2411 (Pi0Candidate->Pt()-static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma1MotherLabel))->Pt())/static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma1MotherLabel))->Pt(),weighted);
2412 }
2413 }
2414 }
2415 } else if(!isTruePi0 && !isTrueEta) { // Background
2416 if (fDoMesonQA > 0){
2417 if(gamma0MotherLabel>-1 && gamma1MotherLabel>-1){ // Both Tracks are Photons and have a mother but not Pi0 or Eta
2418 fHistoTrueBckGGInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2419 } else { // No photon or without mother
2420 fHistoTrueBckContInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2421 }
2422 }
2423 }
2424}
2425
2426//________________________________________________________________________
2427void AliAnalysisTaskGammaCalo::CalculateBackground(){
2428
2429 Int_t zbin= fBGHandler[fiCut]->GetZBinIndex(fInputEvent->GetPrimaryVertex()->GetZ());
2430 Int_t mbin = 0;
2431
2432 if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->UseTrackMultiplicity()){
2433 mbin = fBGHandler[fiCut]->GetMultiplicityBinIndex(fV0Reader->GetNumberOfPrimaryTracks());
2434 } else {
2435 mbin = fBGHandler[fiCut]->GetMultiplicityBinIndex(fClusterCandidates->GetEntries());
2436 }
2437
2438 if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->UseTrackMultiplicity()){
2439 for(Int_t nEventsInBG=0;nEventsInBG<fBGHandler[fiCut]->GetNBGEvents();nEventsInBG++){
2440 AliGammaConversionAODVector *previousEventV0s = fBGHandler[fiCut]->GetBGGoodV0s(zbin,mbin,nEventsInBG);
d53bf4ac 2441 for(Int_t iCurrent=0;iCurrent<fClusterCandidates->GetEntries();iCurrent++){
2442 AliAODConversionPhoton currentEventGoodV0 = *(AliAODConversionPhoton*)(fClusterCandidates->At(iCurrent));
2443 for(UInt_t iPrevious=0;iPrevious<previousEventV0s->size();iPrevious++){
2444 AliAODConversionPhoton previousGoodV0 = (AliAODConversionPhoton)(*(previousEventV0s->at(iPrevious)));
2445 AliAODConversionMother *backgroundCandidate = new AliAODConversionMother(&currentEventGoodV0,&previousGoodV0);
2446 backgroundCandidate->CalculateDistanceOfClossetApproachToPrimVtx(fInputEvent->GetPrimaryVertex());
cfd87ccd 2447
d53bf4ac 2448 if((((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))
2449 ->MesonIsSelected(backgroundCandidate,kFALSE,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift()))){
2450 fHistoMotherBackInvMassPt[fiCut]->Fill(backgroundCandidate->M(),backgroundCandidate->Pt());
2451 Double_t sparesFill[4] = {backgroundCandidate->M(),backgroundCandidate->Pt(),(Double_t)zbin,(Double_t)mbin};
2452 fSparseMotherBackInvMassPtZM[fiCut]->Fill(sparesFill,1);
2453 }
2454 delete backgroundCandidate;
2455 backgroundCandidate = 0x0;
2456 }
2457 }
2458 }
2459 } else {
2460 for(Int_t nEventsInBG=0;nEventsInBG <fBGHandler[fiCut]->GetNBGEvents();nEventsInBG++){
2461 AliGammaConversionAODVector *previousEventV0s = fBGHandler[fiCut]->GetBGGoodV0s(zbin,mbin,nEventsInBG);
2462 if(previousEventV0s){
2463 for(Int_t iCurrent=0;iCurrent<fClusterCandidates->GetEntries();iCurrent++){
2464 AliAODConversionPhoton currentEventGoodV0 = *(AliAODConversionPhoton*)(fClusterCandidates->At(iCurrent));
2465 for(UInt_t iPrevious=0;iPrevious<previousEventV0s->size();iPrevious++){
2466
2467 AliAODConversionPhoton previousGoodV0 = (AliAODConversionPhoton)(*(previousEventV0s->at(iPrevious)));
2468 AliAODConversionMother *backgroundCandidate = new AliAODConversionMother(&currentEventGoodV0,&previousGoodV0);
2469 backgroundCandidate->CalculateDistanceOfClossetApproachToPrimVtx(fInputEvent->GetPrimaryVertex());
cfd87ccd 2470
d53bf4ac 2471 if((((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->MesonIsSelected(backgroundCandidate,kFALSE,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift()))){
2472 fHistoMotherBackInvMassPt[fiCut]->Fill(backgroundCandidate->M(),backgroundCandidate->Pt());
2473 Double_t sparesFill[4] = {backgroundCandidate->M(),backgroundCandidate->Pt(),(Double_t)zbin,(Double_t)mbin};
2474 fSparseMotherBackInvMassPtZM[fiCut]->Fill(sparesFill,1);
2475 }
2476 delete backgroundCandidate;
2477 backgroundCandidate = 0x0;
2478 }
2479 }
2480 }
2481 }
2482 }
2483}
2484
2485//________________________________________________________________________
2486void AliAnalysisTaskGammaCalo::RotateParticle(AliAODConversionPhoton *gamma){
2487 Int_t fNDegreesPMBackground= ((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->NDegreesRotation();
2488 Double_t nRadiansPM = fNDegreesPMBackground*TMath::Pi()/180;
2489 Double_t rotationValue = fRandom.Rndm()*2*nRadiansPM + TMath::Pi()-nRadiansPM;
2490 gamma->RotateZ(rotationValue);
2491}
2492
2493//________________________________________________________________________
2494void AliAnalysisTaskGammaCalo::UpdateEventByEventData(){
2495 //see header file for documentation
2496 if(fClusterCandidates->GetEntries() >0 ){
2497 if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->UseTrackMultiplicity()){
2498 fBGHandler[fiCut]->AddEvent(fClusterCandidates,fInputEvent->GetPrimaryVertex()->GetX(),fInputEvent->GetPrimaryVertex()->GetY(),fInputEvent->GetPrimaryVertex()->GetZ(),fV0Reader->GetNumberOfPrimaryTracks(),fEventPlaneAngle);
2499 } else { // means we use #V0s for multiplicity
2500 fBGHandler[fiCut]->AddEvent(fClusterCandidates,fInputEvent->GetPrimaryVertex()->GetX(),fInputEvent->GetPrimaryVertex()->GetY(),fInputEvent->GetPrimaryVertex()->GetZ(),fClusterCandidates->GetEntries(),fEventPlaneAngle);
2501 }
2502 }
2503}
2504
2505
2506//________________________________________________________________________
2507void AliAnalysisTaskGammaCalo::FillPhotonBackgroundHist(AliAODConversionPhoton *TruePhotonCandidate, Int_t pdgCode)
2508{
2509 // Bck = 0 e+-, 1 pi+-, 2 p+-, 3 K+-, 4 n, 5 K0s, 6 Lambda, 7 mu+-, 8 rest
2510 if(fIsFromMBHeader){
2511 if(abs(pdgCode) == 11) fHistoClusPhotonBGPt[fiCut]->Fill(TruePhotonCandidate->Pt(),0);
2512 else if( abs(pdgCode)==211) fHistoClusPhotonBGPt[fiCut]->Fill(TruePhotonCandidate->Pt(),1);
2513 else if( abs(pdgCode)==2212) fHistoClusPhotonBGPt[fiCut]->Fill(TruePhotonCandidate->Pt(),2);
2514 else if( abs(pdgCode)==321) fHistoClusPhotonBGPt[fiCut]->Fill(TruePhotonCandidate->Pt(),3);
2515 else if( abs(pdgCode)==2112) fHistoClusPhotonBGPt[fiCut]->Fill(TruePhotonCandidate->Pt(),4);
2516 else if( abs(pdgCode)==310) fHistoClusPhotonBGPt[fiCut]->Fill(TruePhotonCandidate->Pt(),5);
2517 else if( abs(pdgCode)==3122) fHistoClusPhotonBGPt[fiCut]->Fill(TruePhotonCandidate->Pt(),6);
2518 else if( abs(pdgCode)==13) fHistoClusPhotonBGPt[fiCut]->Fill(TruePhotonCandidate->Pt(),7);
2519 else fHistoClusPhotonBGPt[fiCut]->Fill(TruePhotonCandidate->Pt(),8);
2520 }
2521}
2522
2523//________________________________________________________________________
2524void AliAnalysisTaskGammaCalo::FillPhotonPlusConversionBackgroundHist(AliAODConversionPhoton *TruePhotonCandidate, Int_t pdgCode)
2525{
2526 // Bck = 0 e+-, 1 pi+-, 2 p+-, 3 K+-, 4 n, 5 K0s, 6 Lambda, 7 mu+-, 8 rest
2527 if(fIsFromMBHeader){
2528 if(abs(pdgCode) == 11) fHistoClusPhotonPlusConvBGPt[fiCut]->Fill(TruePhotonCandidate->Pt(),0);
2529 else if( abs(pdgCode)==211) fHistoClusPhotonPlusConvBGPt[fiCut]->Fill(TruePhotonCandidate->Pt(),1);
2530 else if( abs(pdgCode)==2212) fHistoClusPhotonPlusConvBGPt[fiCut]->Fill(TruePhotonCandidate->Pt(),2);
2531 else if( abs(pdgCode)==321) fHistoClusPhotonPlusConvBGPt[fiCut]->Fill(TruePhotonCandidate->Pt(),3);
2532 else if( abs(pdgCode)==2112) fHistoClusPhotonPlusConvBGPt[fiCut]->Fill(TruePhotonCandidate->Pt(),4);
2533 else if( abs(pdgCode)==310) fHistoClusPhotonPlusConvBGPt[fiCut]->Fill(TruePhotonCandidate->Pt(),5);
2534 else if( abs(pdgCode)==3122) fHistoClusPhotonPlusConvBGPt[fiCut]->Fill(TruePhotonCandidate->Pt(),6);
2535 else if( abs(pdgCode)==13) fHistoClusPhotonPlusConvBGPt[fiCut]->Fill(TruePhotonCandidate->Pt(),7);
2536 else fHistoClusPhotonPlusConvBGPt[fiCut]->Fill(TruePhotonCandidate->Pt(),8);
2537 }
2538}
2539
2540
2541void AliAnalysisTaskGammaCalo::SetLogBinningXTH2(TH2* histoRebin){
2542 TAxis *axisafter = histoRebin->GetXaxis();
2543 Int_t bins = axisafter->GetNbins();
2544 Double_t from = axisafter->GetXmin();
2545 Double_t to = axisafter->GetXmax();
2546 Double_t *newbins = new Double_t[bins+1];
2547 newbins[0] = from;
2548 Double_t factor = TMath::Power(to/from, 1./bins);
2549 for(Int_t i=1; i<=bins; ++i) newbins[i] = factor * newbins[i-1];
2550 axisafter->Set(bins, newbins);
2551 delete [] newbins;
2552}
2553
2554//________________________________________________________________________
2555void AliAnalysisTaskGammaCalo::Terminate(const Option_t *)
2556{
2557
2558 //fOutputContainer->Print(); // Will crash on GRID
2559}
2560
2561//________________________________________________________________________
2562Int_t AliAnalysisTaskGammaCalo::GetSourceClassification(Int_t daughter, Int_t pdgCode){
2563
2564 if (daughter == 111) {
2565 if (abs(pdgCode) == 310) return 1; // k0s
2566 else if (abs(pdgCode) == 3122) return 2; // Lambda
2567 else if (abs(pdgCode) == 130) return 3; // K0L
2568 else if (abs(pdgCode) == 2212) return 4; // proton
2569 else if (abs(pdgCode) == 2112) return 5; // neutron
2570 else if (abs(pdgCode) == 211) return 6; // pion
2571 else if (abs(pdgCode) == 321) return 7; // kaon
2572 else if (abs(pdgCode) == 113 || abs(pdgCode) == 213 ) return 8; // rho 0,+,-
2573 else if (abs(pdgCode) == 3222 || abs(pdgCode) == 3212 || abs(pdgCode) == 3112 ) return 9; // Sigma
2574 else if (abs(pdgCode) == 2224 || abs(pdgCode) == 2214 || abs(pdgCode) == 2114 || abs(pdgCode) == 1114 ) return 10; // Delta
2575 else if (abs(pdgCode) == 313 || abs(pdgCode) == 323 ) return 11; // K*
2576 else return 15;
2577 }
2578 return 15;
2579
2580}