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