AliPhysics  master (3d17d9d)
AliAnalysisTaskGammaCaloMerged.cxx
Go to the documentation of this file.
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  * *
4  * Author: 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 
18 //----------------------------------------------------------------
19 // Class used to do analysis on conversion photons + calo photons
20 //----------------------------------------------------------------
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"
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"
53 #include "AliAODEvent.h"
54 #include "AliAODInputHandler.h"
55 #include "AliESDEvent.h"
56 #include "AliESDInputHandler.h"
57 #include "AliInputEventHandler.h"
58 #include "AliCaloTrackMatcher.h"
59 #include <vector>
60 #include <map>
61 
62 
64 
65 //________________________________________________________________________
67  fV0Reader(NULL),
68  fV0ReaderName("V0ReaderV1"),
69  fCorrTaskSetting(""),
70  fDoLightOutput(kFALSE),
71  fInputEvent(NULL),
72  fMCEvent(NULL),
73  fCutFolder(NULL),
74  fESDList(NULL),
75  fTrueList(NULL),
76  fMCList(NULL),
77  fHeaderNameList(NULL),
78  fOutputContainer(NULL),
79  fNClusterCandidates(0),
80  fNClusterMergedCandidates(0),
81  fEventCutArray(NULL),
82  fEventCuts(NULL),
83  fClusterCutArray(NULL),
84  fClusterMergedCutArray(NULL),
85  fMesonCutArray(NULL),
86  fMesonCuts(NULL),
87  fOutlierJetReader(NULL),
88  fHistoMotherInvMassPt(NULL),
89  fHistoMotherPtY(NULL),
90  fHistoMotherPtAlpha(NULL),
91  fHistoClusGammaPt(NULL),
92  fHistoClusGammaE(NULL),
93  fHistoClusOverlapHeadersGammaPt(NULL),
94  fHistoClusNLMPt(NULL),
95  fHistoClusMergedPtvsM02(NULL),
96  fHistoClusMergedPtvsM02Accepted(NULL),
97  fHistoClusMergedEvsM02Accepted(NULL),
98  fHistoClusNCellsPt(NULL),
99  fHistoClusMergedNCellsPt(NULL),
100  fHistoClusMergedNParticlePt(NULL),
101  fHistoClusMergedNCellsAroundPt(NULL),
102  fHistoClusMergedNCellsAroundAndInPt(NULL),
103  fHistoClusMergedEAroundE(NULL),
104  fHistoMCHeaders(NULL),
105  fHistoMCPi0Pt(NULL),
106  fHistoMCPi0ReducedPt(NULL),
107  fHistoMCPi0WOWeightPt(NULL),
108  fHistoMCPi0WOEvtWeightPt(NULL),
109  fHistoMCEtaPt(NULL),
110  fHistoMCEtaWOWeightPt(NULL),
111  fHistoMCEtaWOEvtWeightPt(NULL),
112  fHistoMCPi0DalitzPt(NULL),
113  fHistoMCPi0DalitzWOWeightPt(NULL),
114  fHistoMCPi0DalitzWOEvtWeightPt(NULL),
115  fHistoMCEtaDalitzPt(NULL),
116  fHistoMCEtaDalitzWOWeightPt(NULL),
117  fHistoMCEtaDalitzWOEvtWeightPt(NULL),
118  fHistoMCPi0InAccPt(NULL),
119  fHistoMCPi0ReducedInAccPt(NULL),
120  fHistoMCEtaInAccPt(NULL),
121  fHistoMCPi0WOEvtWeightInAccPt(NULL),
122  fHistoMCEtaWOEvtWeightInAccPt(NULL),
123  fHistoMCPi0DalitzInAccPt(NULL),
124  fHistoMCEtaDalitzInAccPt(NULL),
125  fHistoMCPi0DalitzWOEvtWeightInAccPt(NULL),
126  fHistoMCEtaDalitzWOEvtWeightInAccPt(NULL),
127  fHistoMCSecPi0PtvsSource(NULL),
128  fHistoMCSecPi0InAccPtvsSource(NULL),
129  fHistoMCPi0PtJetPt(NULL),
130  fHistoMCEtaPtJetPt(NULL),
131  fHistoMCPrimaryPtvsSource(NULL),
132  fHistoMCPrimaryYvsSource(NULL),
133  fHistoMCDecayGammaPt(NULL),
134  fHistoMCAllGammaPt(NULL),
135  fHistoTrueClusEFracFirstLabel(NULL),
136  fHistoTrueClusEFracLeadingPi0(NULL),
137  fHistoTrueClusNeutralContamination(NULL),
138  fHistoTrueClusPhotonContamination(NULL),
139  fHistoTrueClusElectronContamination(NULL),
140  fHistoTrueClusOtherContamination(NULL),
141  fHistoTrueClusMergedPtvsM02(NULL),
142  fHistoTrueClusPi0PtvsM02(NULL),
143  fHistoTrueClusMultiplePi0PtvsM02(NULL),
144  fHistoTrueClusPi0DalitzPtvsM02(NULL),
145  fHistoTrueClusPrimPi0PtvsM02(NULL),
146  fHistoTrueClusPrimPi0PtMCPt(NULL),
147  fHistoTruePureMergedClusPrimPi0PtvsM02(NULL),
148  fHistoTruePartConvClusPrimPi0PtvsM02(NULL),
149  fHistoTrueClusPrimPi0PureMergedPtMCPt(NULL),
150  fHistoTrueClusPrimPi0PartConvMergedPtMCPt(NULL),
151  fHistoTrueClusPrimPi01GammaMergedPtMCPt(NULL),
152  fHistoTrueClusPrimPi01ElectronMergedPtMCPt(NULL),
153  fHistoTrueClusMultiplePrimPi0PtvsM02(NULL),
154  fHistoTrueClusSecPi0PtvsM02(NULL),
155  fHistoTrueClusSecPi0FromK0sPtvsM02(NULL),
156  fHistoTrueClusSecPi0FromK0lPtvsM02(NULL),
157  fHistoTrueClusSecPi0FromLambdaPtvsM02(NULL),
158  fHistoTrueClusEtaPtvsM02(NULL),
159  fHistoTrueClusEtaDalitzPtvsM02(NULL),
160  fHistoTrueClusMergedPureFromPi0PtvsM02(NULL),
161  fHistoTrueClusMergedPureFromEtaPtvsM02(NULL),
162  fHistoTrueClusMergedPartConvFromPi0PtvsM02(NULL),
163  fHistoTrueClusMergedPartConvFromEtaPtvsM02(NULL),
164  fHistoNTrueMultiplePi0vsPt(NULL),
165  fHistoTrueClusGammaFromPi0PtvsM02(NULL),
166  fHistoTrueClusGammaFromEtaPtvsM02(NULL),
167  fHistoTrueClusElectronFromPi0PtvsM02(NULL),
168  fHistoTrueClusElectronFromEtaPtvsM02(NULL),
169  fHistoTrueSecPi0PtvsDiffReco(NULL),
170  fHistoTrueClusBGPtvsM02(NULL),
171  fHistoTrueClusGammaPtvsM02(NULL),
172  fHistoTrueClusGammaPartConvPtvsM02(NULL),
173  fHistoTrueClusElectronPtvsM02(NULL),
174  fHistoTrueClusElectronFromGammaPtvsM02(NULL),
175  fHistoTrueClusMergedInvMassvsPt(NULL),
176  fHistoTrueClusPi0InvMassvsPt(NULL),
177  fHistoTrueClusPrimPi0InvMassvsPt(NULL),
178  fHistoTrueClusEtaInvMassvsPt(NULL),
179  fHistoTrueClusBGInvMassvsPt(NULL),
180  fHistoTrueClusGammaInvMassvsPt(NULL),
181  fHistoTrueClusElectronInvMassvsPt(NULL),
182  fHistoTrueClusBGPtvsSource(NULL),
183  fHistoTrueClusGammaPtvsSource(NULL),
184  fHistoTrueClusElectronPtvsSource(NULL),
185 // fHistoTrueClusElectronPtvsMotherID(NULL),
186 // fHistoTrueClusElectronPtvsTopMotherID(NULL),
187 // fHistoTrueClusElectronPtvsConvPhotonTopMotherID(NULL),
188  fHistoTrueMergedMissedPDG(NULL),
189  fHistoTruePi0PtY(NULL),
190  fHistoTrueEtaPtY(NULL),
191  fHistoTruePi0PtAlpha(NULL),
192  fHistoTrueEtaPtAlpha(NULL),
193  fHistoTrueClusGammaEM02(NULL),
194  fHistoTrueClusElectronEM02(NULL),
195  fHistoTrueClusPi0EM02(NULL),
196  fHistoTrueClusEtaEM02(NULL),
197  fHistoTruePrimaryPi0MCPtResolPt(NULL),
198  fHistoTruePrimaryPi0PureMergedMCPtResolPt(NULL),
199  fHistoTruePrimaryPi0MergedPartConvMCPtResolPt(NULL),
200  fHistoTruePrimaryPi01GammaMCPtResolPt(NULL),
201  fHistoTruePrimaryPi01ElectronMCPtResolPt(NULL),
202  fHistoTruePrimaryEtaMCPtResolPt(NULL),
203  fHistoTrueSecondaryPi0MCPtResolPt(NULL),
204  fHistoDoubleCountTruePi0PtvsM02(NULL),
205  fHistoDoubleCountTrueSecPi0Pt(NULL),
206  fHistoDoubleCountTrueMultiplePi0PtvsM02(NULL),
207  fHistoDoubleCountTrueMultipleSecPi0Pt(NULL),
208  fHistoDoubleCountTrueEtaPtvsM02(NULL),
209  fVectorLabelsLeadingPi0(0),
210  fVectorLabelsMultiplePi0(0),
211  fVectorLabelsMultiplePi0Reduced(0),
212  fVectorDoubleCountTruePi0s(0),
213  fVectorDoubleCountTrueMultilePi0s(0),
214  fVectorDoubleCountTrueEtas(0),
215  fHistoNEvents(NULL),
216  fHistoNEventsWOWeight(NULL),
217  fHistoNGoodESDTracks(NULL),
218  fHistoVertexZ(NULL),
219  fHistoNClusterCandidates(NULL),
220  fHistoNClusterMergedCandidates(NULL),
221  fHistoNGoodESDTracksVsNClusterCandidates(NULL),
222  fHistoSPDClusterTrackletBackground(NULL),
223  fHistoNV0Tracks(NULL),
224  fProfileEtaShift(NULL),
225  fProfileJetJetXSection(NULL),
226  fHistoJetJetNTrials(NULL),
227  fRandom(0),
228  fnCuts(0),
229  fiCut(0),
230  fIsHeavyIon(0),
231  fDoMesonQA(0),
232  fDoClusterQA(0),
233  fIsFromMBHeader(kTRUE),
234  fIsOverlappingWithOtherHeader(kFALSE),
235  fIsMC(0),
236  fSetPlotHistsExtQA(kFALSE),
237  fWeightJetJetMC(1),
238  fSelectedMesonID(0),
239  fEnableDetailedPrintOut(kFALSE),
240  fEnableSortForClusMC(kFALSE),
241  tBrokenFiles(NULL),
242  fFileNameBroken(NULL),
243  fDoDetailedM02(kFALSE),
244  fTrackMatcherRunningMode(0),
245  fMaxAllowedPi0OverlapsMC(-1),
246  fHistoPi0EvsGammaOverlapE(NULL)
247 {
248 
249 }
250 
251 //________________________________________________________________________
253  AliAnalysisTaskSE(name),
254  fV0Reader(NULL),
255  fV0ReaderName("V0ReaderV1"),
256  fCorrTaskSetting(""),
257  fDoLightOutput(kFALSE),
258  fInputEvent(NULL),
259  fMCEvent(NULL),
260  fCutFolder(NULL),
261  fESDList(NULL),
262  fTrueList(NULL),
263  fMCList(NULL),
264  fHeaderNameList(NULL),
265  fOutputContainer(NULL),
266  fNClusterCandidates(0),
267  fNClusterMergedCandidates(0),
268  fEventCutArray(NULL),
269  fEventCuts(NULL),
270  fClusterCutArray(NULL),
271  fClusterMergedCutArray(NULL),
272  fMesonCutArray(NULL),
273  fMesonCuts(NULL),
274  fOutlierJetReader(NULL),
275  fHistoMotherInvMassPt(NULL),
276  fHistoMotherPtY(NULL),
277  fHistoMotherPtAlpha(NULL),
278  fHistoClusGammaPt(NULL),
279  fHistoClusGammaE(NULL),
280  fHistoClusOverlapHeadersGammaPt(NULL),
281  fHistoClusNLMPt(NULL),
282  fHistoClusMergedPtvsM02(NULL),
283  fHistoClusMergedPtvsM02Accepted(NULL),
284  fHistoClusMergedEvsM02Accepted(NULL),
285  fHistoClusNCellsPt(NULL),
286  fHistoClusMergedNCellsPt(NULL),
287  fHistoClusMergedNParticlePt(NULL),
288  fHistoClusMergedNCellsAroundPt(NULL),
289  fHistoClusMergedNCellsAroundAndInPt(NULL),
290  fHistoClusMergedEAroundE(NULL),
291  fHistoMCHeaders(NULL),
292  fHistoMCPi0Pt(NULL),
293  fHistoMCPi0ReducedPt(NULL),
294  fHistoMCPi0WOWeightPt(NULL),
295  fHistoMCPi0WOEvtWeightPt(NULL),
296  fHistoMCEtaPt(NULL),
297  fHistoMCEtaWOWeightPt(NULL),
298  fHistoMCEtaWOEvtWeightPt(NULL),
299  fHistoMCPi0DalitzPt(NULL),
300  fHistoMCPi0DalitzWOWeightPt(NULL),
301  fHistoMCPi0DalitzWOEvtWeightPt(NULL),
302  fHistoMCEtaDalitzPt(NULL),
303  fHistoMCEtaDalitzWOWeightPt(NULL),
304  fHistoMCEtaDalitzWOEvtWeightPt(NULL),
305  fHistoMCPi0InAccPt(NULL),
306  fHistoMCPi0ReducedInAccPt(NULL),
307  fHistoMCEtaInAccPt(NULL),
308  fHistoMCPi0WOEvtWeightInAccPt(NULL),
309  fHistoMCEtaWOEvtWeightInAccPt(NULL),
310  fHistoMCPi0DalitzInAccPt(NULL),
311  fHistoMCEtaDalitzInAccPt(NULL),
312  fHistoMCPi0DalitzWOEvtWeightInAccPt(NULL),
313  fHistoMCEtaDalitzWOEvtWeightInAccPt(NULL),
314  fHistoMCSecPi0PtvsSource(NULL),
315  fHistoMCSecPi0InAccPtvsSource(NULL),
316  fHistoMCPi0PtJetPt(NULL),
317  fHistoMCEtaPtJetPt(NULL),
318  fHistoMCPrimaryPtvsSource(NULL),
319  fHistoMCPrimaryYvsSource(NULL),
320  fHistoMCDecayGammaPt(NULL),
321  fHistoMCAllGammaPt(NULL),
322  fHistoTrueClusEFracFirstLabel(NULL),
323  fHistoTrueClusEFracLeadingPi0(NULL),
324  fHistoTrueClusNeutralContamination(NULL),
325  fHistoTrueClusPhotonContamination(NULL),
326  fHistoTrueClusElectronContamination(NULL),
327  fHistoTrueClusOtherContamination(NULL),
328  fHistoTrueClusMergedPtvsM02(NULL),
329  fHistoTrueClusPi0PtvsM02(NULL),
330  fHistoTrueClusMultiplePi0PtvsM02(NULL),
331  fHistoTrueClusPi0DalitzPtvsM02(NULL),
332  fHistoTrueClusPrimPi0PtvsM02(NULL),
333  fHistoTrueClusPrimPi0PtMCPt(NULL),
334  fHistoTruePureMergedClusPrimPi0PtvsM02(NULL),
335  fHistoTruePartConvClusPrimPi0PtvsM02(NULL),
336  fHistoTrueClusPrimPi0PureMergedPtMCPt(NULL),
337  fHistoTrueClusPrimPi0PartConvMergedPtMCPt(NULL),
338  fHistoTrueClusPrimPi01GammaMergedPtMCPt(NULL),
339  fHistoTrueClusPrimPi01ElectronMergedPtMCPt(NULL),
340  fHistoTrueClusMultiplePrimPi0PtvsM02(NULL),
341  fHistoTrueClusSecPi0PtvsM02(NULL),
342  fHistoTrueClusSecPi0FromK0sPtvsM02(NULL),
343  fHistoTrueClusSecPi0FromK0lPtvsM02(NULL),
344  fHistoTrueClusSecPi0FromLambdaPtvsM02(NULL),
345  fHistoTrueClusEtaPtvsM02(NULL),
346  fHistoTrueClusEtaDalitzPtvsM02(NULL),
347  fHistoTrueClusMergedPureFromPi0PtvsM02(NULL),
348  fHistoTrueClusMergedPureFromEtaPtvsM02(NULL),
349  fHistoTrueClusMergedPartConvFromPi0PtvsM02(NULL),
350  fHistoTrueClusMergedPartConvFromEtaPtvsM02(NULL),
351  fHistoNTrueMultiplePi0vsPt(NULL),
352  fHistoTrueClusGammaFromPi0PtvsM02(NULL),
353  fHistoTrueClusGammaFromEtaPtvsM02(NULL),
354  fHistoTrueClusElectronFromPi0PtvsM02(NULL),
355  fHistoTrueClusElectronFromEtaPtvsM02(NULL),
356  fHistoTrueSecPi0PtvsDiffReco(NULL),
357  fHistoTrueClusBGPtvsM02(NULL),
358  fHistoTrueClusGammaPtvsM02(NULL),
359  fHistoTrueClusGammaPartConvPtvsM02(NULL),
360  fHistoTrueClusElectronPtvsM02(NULL),
361  fHistoTrueClusElectronFromGammaPtvsM02(NULL),
362  fHistoTrueClusMergedInvMassvsPt(NULL),
363  fHistoTrueClusPi0InvMassvsPt(NULL),
364  fHistoTrueClusPrimPi0InvMassvsPt(NULL),
365  fHistoTrueClusEtaInvMassvsPt(NULL),
366  fHistoTrueClusBGInvMassvsPt(NULL),
367  fHistoTrueClusGammaInvMassvsPt(NULL),
368  fHistoTrueClusElectronInvMassvsPt(NULL),
369  fHistoTrueClusBGPtvsSource(NULL),
370  fHistoTrueClusGammaPtvsSource(NULL),
371  fHistoTrueClusElectronPtvsSource(NULL),
372 // fHistoTrueClusElectronPtvsMotherID(NULL),
373 // fHistoTrueClusElectronPtvsTopMotherID(NULL),
374 // fHistoTrueClusElectronPtvsConvPhotonTopMotherID(NULL),
375  fHistoTrueMergedMissedPDG(NULL),
376  fHistoTruePi0PtY(NULL),
377  fHistoTrueEtaPtY(NULL),
378  fHistoTruePi0PtAlpha(NULL),
379  fHistoTrueEtaPtAlpha(NULL),
380  fHistoTrueClusGammaEM02(NULL),
381  fHistoTrueClusElectronEM02(NULL),
382  fHistoTrueClusPi0EM02(NULL),
383  fHistoTrueClusEtaEM02(NULL),
384  fHistoTruePrimaryPi0MCPtResolPt(NULL),
385  fHistoTruePrimaryPi0PureMergedMCPtResolPt(NULL),
386  fHistoTruePrimaryPi0MergedPartConvMCPtResolPt(NULL),
387  fHistoTruePrimaryPi01GammaMCPtResolPt(NULL),
388  fHistoTruePrimaryPi01ElectronMCPtResolPt(NULL),
389  fHistoTruePrimaryEtaMCPtResolPt(NULL),
390  fHistoTrueSecondaryPi0MCPtResolPt(NULL),
391  fHistoDoubleCountTruePi0PtvsM02(NULL),
392  fHistoDoubleCountTrueSecPi0Pt(NULL),
393  fHistoDoubleCountTrueMultiplePi0PtvsM02(NULL),
394  fHistoDoubleCountTrueMultipleSecPi0Pt(NULL),
395  fHistoDoubleCountTrueEtaPtvsM02(NULL),
396  fVectorLabelsLeadingPi0(0),
397  fVectorLabelsMultiplePi0(0),
398  fVectorLabelsMultiplePi0Reduced(0),
399  fVectorDoubleCountTruePi0s(0),
400  fVectorDoubleCountTrueMultilePi0s(0),
401  fVectorDoubleCountTrueEtas(0),
402  fHistoNEvents(NULL),
403  fHistoNEventsWOWeight(NULL),
404  fHistoNGoodESDTracks(NULL),
405  fHistoVertexZ(NULL),
406  fHistoNClusterCandidates(NULL),
407  fHistoNClusterMergedCandidates(NULL),
408  fHistoNGoodESDTracksVsNClusterCandidates(NULL),
409  fHistoSPDClusterTrackletBackground(NULL),
410  fHistoNV0Tracks(NULL),
411  fProfileEtaShift(NULL),
412  fProfileJetJetXSection(NULL),
413  fHistoJetJetNTrials(NULL),
414  fRandom(0),
415  fnCuts(0),
416  fiCut(0),
417  fIsHeavyIon(0),
418  fDoMesonQA(0),
419  fDoClusterQA(0),
420  fIsFromMBHeader(kTRUE),
421  fIsOverlappingWithOtherHeader(kFALSE),
422  fIsMC(0),
423  fSetPlotHistsExtQA(kFALSE),
424  fWeightJetJetMC(1),
425  fSelectedMesonID(0),
426  fEnableDetailedPrintOut(kFALSE),
427  fEnableSortForClusMC(kFALSE),
428  tBrokenFiles(NULL),
429  fFileNameBroken(NULL),
430  fDoDetailedM02(kFALSE),
431  fTrackMatcherRunningMode(0),
432  fMaxAllowedPi0OverlapsMC(-1),
433  fHistoPi0EvsGammaOverlapE(NULL)
434 {
435  // Define output slots here
436  DefineOutput(1, TList::Class());
437 }
438 
440 {
441 
442 }
443 
444 //________________________________________________________________________
446 
447  fV0Reader=(AliV0ReaderV1*)AliAnalysisManager::GetAnalysisManager()->GetTask(fV0ReaderName.Data());
448  if(!fV0Reader){printf("Error: No V0 Reader");return;} // GetV0Reader
449 
450  if(((AliConvEventCuts*)fEventCutArray->At(0))->GetUseJetFinderForOutliers()){
451  fOutlierJetReader=(AliAnalysisTaskJetOutlierRemoval*)AliAnalysisManager::GetAnalysisManager()->GetTask("AliAnalysisTaskJetOutlierRemoval");
452  if(!fOutlierJetReader){AliFatal("Error: No AliAnalysisTaskJetOutlierRemoval");} // GetV0Reader
453  else{printf("Found AliAnalysisTaskJetOutlierRemoval used for outlier removal!\n");}
454  }
455 
456  Int_t invMassBins = 800;
457  Float_t startMass = 0;
458  Float_t endMass = 0.8;
459  Double_t *arrPtBinning = new Double_t[1000];
460 
461  if (GetSelectedMesonID() == 1) {
462  invMassBins = 400;
463  startMass = 0;
464  endMass = 0.4;
465  } else if (GetSelectedMesonID() == 2) {
466  invMassBins = 800;
467  startMass = 0.;
468  endMass = 0.8;
469  }
470 
471  Int_t ptBinsDefClus = 500;
472  Float_t startPtDefClus = 0;
473  Float_t endPtDefClus = 50;
474 
475  Int_t ptBins = 400;
476  Float_t startPt = 10;
477  Float_t endPt = 50;
478 
479  Int_t ptBinsLog = 200;
480  Float_t startPtLog = 10;
481  Float_t endPtLog = 50;
482  if (GetSelectedMesonID() == 2 ) {
483  ptBins = 500;
484  startPt = 20;
485  endPt = 70;
486  for(Int_t i=0; i<ptBins+1;i++){
487  arrPtBinning[i] = 10.+((endPt-startPt)/ptBins)*i;
488  }
489  ptBinsLog = 250;
490  startPtLog = 20;
491  endPtLog = 70;
492  } else if (((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetEnergyEnum() == AliConvEventCuts::k5TeV ||
493  ((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetEnergyEnum() == AliConvEventCuts::k7TeV ||
494  ((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetEnergyEnum() == AliConvEventCuts::k8TeV ||
495  ((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetEnergyEnum() == AliConvEventCuts::k13TeV ||
496  ((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetEnergyEnum() == AliConvEventCuts::kpPb8TeV ||
497  ((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetEnergyEnum() == AliConvEventCuts::kpPb5TeVR2 ||
498  ((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetEnergyEnum() == AliConvEventCuts::kpPb5TeV ||
499  ((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetEnergyEnum() == AliConvEventCuts::kPbPb5TeV){
500  ptBins = 120;
501  startPt = 0;
502  endPt = 200;
503  // pT dependent binning for very high pT analyses
504  for(Int_t i=0; i<ptBins+1;i++){
505  if(i<100) arrPtBinning[i] = 1.0*i;
506  else if(i<120) arrPtBinning[i] = 100.+5*(i-100);
507  else arrPtBinning[i] = endPt;
508  }
509  ptBinsLog = 475;
510  startPtLog = 10;
511  endPtLog = 200;
512  ptBinsDefClus = 1000;
513  startPtDefClus = 0;
514  endPtDefClus = 200;
515  } else if (((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetEnergyEnum() == AliConvEventCuts::k13TeVLowB ){
516  ptBins = 900;
517  startPt = 10;
518  endPt = 100;
519  for(Int_t i=0; i<ptBins+1;i++){
520  arrPtBinning[i] = 10.+((endPt-startPt)/ptBins)*i;
521  }
522  ptBinsLog = 450;
523  startPtLog = 10;
524  endPtLog = 100;
525  ptBinsDefClus = 1000;
526  startPtDefClus = 0;
527  endPtDefClus = 100;
528  } else {
529  for(Int_t i=0; i<ptBins+1;i++){
530  arrPtBinning[i] = 10.+((endPt-startPt)/ptBins)*i;
531  }
532  }
533 
534  Int_t showerShapeBins = 500;
535  Float_t startShowerShape = 0;
536  Float_t endShowerShape = 5;
537 
538  if (fDoDetailedM02) showerShapeBins = 5000;
539 
540  // Create histograms
541  if(fOutputContainer != NULL){
542  delete fOutputContainer;
543  fOutputContainer = NULL;
544  }
545  if(fOutputContainer == NULL){
546  fOutputContainer = new TList();
547  fOutputContainer->SetOwner(kTRUE);
548  }
549 
550  fCutFolder = new TList*[fnCuts];
551  fESDList = new TList*[fnCuts];
552 
553  fHistoNEvents = new TH1F*[fnCuts];
554  if(fIsMC == 2){
555  fHistoNEventsWOWeight = new TH1F*[fnCuts];
556  fProfileJetJetXSection = new TProfile*[fnCuts];
557  fHistoJetJetNTrials = new TH1F*[fnCuts];
558  }
559 
560  fHistoNGoodESDTracks = new TH1F*[fnCuts];
561  fHistoVertexZ = new TH1F*[fnCuts];
562  fHistoNClusterCandidates = new TH1F*[fnCuts];
566  fHistoNV0Tracks = new TH1F*[fnCuts];
567  fProfileEtaShift = new TProfile*[fnCuts];
568 
570  if (fDoMesonQA > 0 ){
571  fHistoMotherPtY = new TH2F*[fnCuts];
573  }
574 
575  fHistoClusGammaPt = new TH1F*[fnCuts];
576  fHistoClusGammaE = new TH1F*[fnCuts];
581  fHistoClusNLMPt = new TH2F*[fnCuts];
582  if (fDoClusterQA > 0){
588 
589  if (fIsMC > 0){
591  }
592 
593  }
594 
595  for(Int_t iCut = 0; iCut<fnCuts;iCut++){
596  TString cutstringEvent = ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber();
597  TString cutstringCalo = ((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetCutNumber();
598  TString cutstringCaloMerged = ((AliCaloPhotonCuts*)fClusterMergedCutArray->At(iCut))->GetCutNumber();
599  TString cutstringMeson = ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutNumber();
600 
601  //Int_t nLMCut = ((AliCaloPhotonCuts*)fClusterMergedCutArray->At(iCut))->GetMinNLMCut();
602 
603  fCutFolder[iCut] = new TList();
604  fCutFolder[iCut]->SetName(Form("Cut Number %s_%s_%s_%s",cutstringEvent.Data(), cutstringCalo.Data(), cutstringCaloMerged.Data(), cutstringMeson.Data()));
605  fCutFolder[iCut]->SetOwner(kTRUE);
606  fOutputContainer->Add(fCutFolder[iCut]);
607  fESDList[iCut] = new TList();
608  fESDList[iCut]->SetName(Form("%s_%s_%s_%s ESD histograms",cutstringEvent.Data(), cutstringCalo.Data(), cutstringCaloMerged.Data(), cutstringMeson.Data()));
609  fESDList[iCut]->SetOwner(kTRUE);
610  fCutFolder[iCut]->Add(fESDList[iCut]);
611 
612  fHistoNEvents[iCut] = new TH1F("NEvents","NEvents",14,-0.5,13.5);
613  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(1,"Accepted");
614  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(2,"Centrality");
615  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(3,"Miss. MC or inc. ev.");
616  if (((AliConvEventCuts*)fEventCutArray->At(iCut))->IsSpecialTrigger() > 1 ){
617  TString TriggerNames = "Not Trigger: ";
618  TriggerNames = TriggerNames+ ( (AliConvEventCuts*)fEventCutArray->At(iCut))->GetSpecialTriggerName();
619  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(4,TriggerNames.Data());
620  } else {
621  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(4,"Trigger");
622  }
623  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(5,"Vertex Z");
624  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(6,"Cont. Vertex");
625  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(7,"Pile-Up");
626  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(8,"no SDD");
627  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(9,"no V0AND");
628  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(10,"EMCAL problems");
629  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(11,"rejectedForJetJetMC");
630  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(12,"SPD hits vs tracklet");
631  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(13,"Out-of-Bunch pileup Past-Future");
632  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(14,"Pileup V0M-TPCout Tracks");
633  fESDList[iCut]->Add(fHistoNEvents[iCut]);
634 
635  if (fIsMC == 2){
636  fHistoNEventsWOWeight[iCut] = new TH1F("NEventsWOWeight","NEventsWOWeight",14,-0.5,13.5);
637  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(1,"Accepted");
638  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(2,"Centrality");
639  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(3,"Miss. MC or inc. ev.");
640  if (((AliConvEventCuts*)fEventCutArray->At(iCut))->IsSpecialTrigger() > 1 ){
641  TString TriggerNames = "Not Trigger: ";
642  TriggerNames = TriggerNames+ ( (AliConvEventCuts*)fEventCutArray->At(iCut))->GetSpecialTriggerName();
643  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(4,TriggerNames.Data());
644  } else {
645  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(4,"Trigger");
646  }
647  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(5,"Vertex Z");
648  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(6,"Cont. Vertex");
649  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(7,"Pile-Up");
650  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(8,"no SDD");
651  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(9,"no V0AND");
652  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(10,"EMCAL problem");
653  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(11,"rejectedForJetJetMC");
654  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(12,"SPD hits vs tracklet");
655  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(13,"Out-of-Bunch pileup Past-Future");
656  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(14,"Pileup V0M-TPCout Tracks");
657  fESDList[iCut]->Add(fHistoNEventsWOWeight[iCut]);
658 
659  fProfileJetJetXSection[iCut] = new TProfile("XSection","XSection",1,-0.5,0.5);
660  fESDList[iCut]->Add(fProfileJetJetXSection[iCut]);
661  fHistoJetJetNTrials[iCut] = new TH1F("NTrials","#sum{NTrials}",1,0,1);
662  fHistoJetJetNTrials[iCut]->GetXaxis()->SetBinLabel(1,"#sum{NTrials}");
663  fESDList[iCut]->Add(fHistoJetJetNTrials[iCut]);
664  }
665 
666  if(fIsHeavyIon == 1)
667  fHistoNGoodESDTracks[iCut] = new TH1F("GoodESDTracks","GoodESDTracks",4000,-0.5,3999.5);
668  else if(fIsHeavyIon == 2)
669  fHistoNGoodESDTracks[iCut] = new TH1F("GoodESDTracks","GoodESDTracks",400,-0.5,399.5);
670  else
671  fHistoNGoodESDTracks[iCut] = new TH1F("GoodESDTracks","GoodESDTracks",200,-0.5,199.5);
672  fESDList[iCut]->Add(fHistoNGoodESDTracks[iCut]);
673 
674  fHistoVertexZ[iCut] = new TH1F("VertexZ","VertexZ",1000,-50,50);
675  fESDList[iCut]->Add(fHistoVertexZ[iCut]);
676 
677  if(fIsHeavyIon == 1)
678  fHistoNClusterCandidates[iCut] = new TH1F("GammaCandidates","GammaCandidates",600,-0.5,599.5);
679  else if(fIsHeavyIon == 2)
680  fHistoNClusterCandidates[iCut] = new TH1F("GammaCandidates","GammaCandidates",400,-0.5,399.5);
681  else
682  fHistoNClusterCandidates[iCut] = new TH1F("GammaCandidates","GammaCandidates",100,-0.5,99.5);
683  fESDList[iCut]->Add(fHistoNClusterCandidates[iCut]);
684 
685  if(fIsHeavyIon == 1)
686  fHistoNClusterMergedCandidates[iCut] = new TH1F("MergedCandidates","MergedCandidates",300,-0.5,299.5);
687  else if(fIsHeavyIon == 2)
688  fHistoNClusterMergedCandidates[iCut] = new TH1F("MergedCandidates","MergedCandidates",200,-0.5,199.5);
689  else
690  fHistoNClusterMergedCandidates[iCut] = new TH1F("MergedCandidates","MergedCandidates",50,-0.5,49.5);
691  fESDList[iCut]->Add(fHistoNClusterMergedCandidates[iCut]);
692 
693 
694  if(fIsHeavyIon == 1)
695  fHistoNGoodESDTracksVsNClusterCandidates[iCut] = new TH2F("GoodESDTracksVsGammaCandidates","GoodESDTracksVsGammaCandidates",4000,-0.5,3999.5,600,-0.5,599.5);
696  else if(fIsHeavyIon == 2)
697  fHistoNGoodESDTracksVsNClusterCandidates[iCut] = new TH2F("GoodESDTracksVsGammaCandidates","GoodESDTracksVsGammaCandidates",400,-0.5,399.5,400,-0.5,399.5);
698  else
699  fHistoNGoodESDTracksVsNClusterCandidates[iCut] = new TH2F("GoodESDTracksVsGammaCandidates","GoodESDTracksVsGammaCandidates",200,-0.5,199.5,100,-0.5,99.5);
701 
702  fHistoSPDClusterTrackletBackground[iCut] = new TH2F("SPD tracklets vs SPD clusters","SPD tracklets vs SPD clusters",100,0,200,250,0,1000);
704 
705  if(fIsHeavyIon == 1)
706  fHistoNV0Tracks[iCut] = new TH1F("V0 Multiplicity","V0 Multiplicity",30000,-0.5,29999.5);
707  else if(fIsHeavyIon == 2)
708  fHistoNV0Tracks[iCut] = new TH1F("V0 Multiplicity","V0 Multiplicity",2500,-0.5,2499.5);
709  else
710  fHistoNV0Tracks[iCut] = new TH1F("V0 Multiplicity","V0 Multiplicity",1500,-0.5,1499.5);
711  fESDList[iCut]->Add(fHistoNV0Tracks[iCut]);
712  fProfileEtaShift[iCut] = new TProfile("Eta Shift","Eta Shift",1, -0.5,0.5);
713  fESDList[iCut]->Add(fProfileEtaShift[iCut]);
714 
715  if (fIsMC == 2){
716  fHistoNEvents[iCut]->Sumw2();
717  fHistoNGoodESDTracks[iCut]->Sumw2();
718  fHistoVertexZ[iCut]->Sumw2();
719  fHistoNClusterCandidates[iCut]->Sumw2();
721  fHistoSPDClusterTrackletBackground[iCut]->Sumw2();
722  fHistoNV0Tracks[iCut]->Sumw2();
723  fProfileEtaShift[iCut]->Sumw2();
724  }
725 
726  fHistoClusGammaPt[iCut] = new TH1F("ClusGamma_Pt","ClusGamma_Pt",ptBinsDefClus, startPtDefClus, endPtDefClus);
727  fESDList[iCut]->Add(fHistoClusGammaPt[iCut]);
728  fHistoClusGammaE[iCut] = new TH1F("ClusGamma_E","ClusGamma_E",ptBinsDefClus, startPtDefClus, endPtDefClus);
729  fESDList[iCut]->Add(fHistoClusGammaE[iCut]);
730  fHistoClusOverlapHeadersGammaPt[iCut] = new TH1F("ClusGammaOverlapHeaders_Pt","ClusGammaOverlapHeaders_Pt",ptBins, arrPtBinning);
731  fESDList[iCut]->Add(fHistoClusOverlapHeadersGammaPt[iCut]);
732  fHistoClusMergedPtvsM02[iCut] = new TH2F("ClusMerged_Pt_M02","ClusMerged_Pt_M02",ptBins, arrPtBinning,showerShapeBins, startShowerShape, endShowerShape);
733  fESDList[iCut]->Add(fHistoClusMergedPtvsM02[iCut]);
734  fHistoClusMergedPtvsM02Accepted[iCut] = new TH2F("ClusMerged_Pt_M02_AcceptedMeson","ClusMerged_Pt_M02_AcceptedMeson",ptBins, arrPtBinning,showerShapeBins, startShowerShape, endShowerShape);
735  fESDList[iCut]->Add(fHistoClusMergedPtvsM02Accepted[iCut]);
736  fHistoClusMergedEvsM02Accepted[iCut] = new TH2F("ClusMerged_E_M02_AcceptedMeson","ClusMerged_E_M02_AcceptedMeson",ptBins, arrPtBinning, showerShapeBins, startShowerShape, endShowerShape);
737  fESDList[iCut]->Add(fHistoClusMergedEvsM02Accepted[iCut]);
738  fHistoClusNLMPt[iCut] = new TH2F("ClusMerged_NLM_Pt_AcceptedMeson","ClusMerged_NLM_Pt_AcceptedMeson",12, -0.5, 11.5, ptBins, arrPtBinning);
739  fESDList[iCut]->Add(fHistoClusNLMPt[iCut]);
740 
741 
742  if (fIsMC == 2){
743  fHistoClusGammaPt[iCut]->Sumw2();
744  fHistoClusGammaE[iCut]->Sumw2();
745  fHistoClusOverlapHeadersGammaPt[iCut]->Sumw2();
746  fHistoClusMergedPtvsM02[iCut]->Sumw2();
747  fHistoClusMergedPtvsM02Accepted[iCut]->Sumw2();
748  fHistoClusMergedEvsM02Accepted[iCut]->Sumw2();
749  fHistoClusNLMPt[iCut]->Sumw2();
750  }
751 
752  if (fDoClusterQA > 0){
753  fHistoClusNCellsPt[iCut] = new TH2F("Clus_NCells_Pt","Clus_NCells_Pt",100,-0.5,99.5,ptBins, arrPtBinning);
754  fESDList[iCut]->Add(fHistoClusNCellsPt[iCut]);
755  fHistoClusMergedNCellsPt[iCut] = new TH2F("ClusMerged_NCells_Pt","ClusMerged_NCells_Pt",100,-0.5,99.5,ptBins, arrPtBinning);
756  fESDList[iCut]->Add(fHistoClusMergedNCellsPt[iCut]);
757  fHistoClusMergedNCellsAroundPt[iCut] = new TH2F("ClusMerged_NCellsAroundClus_Pt","ClusMerged_NCellsAroundClus_Pt",100,-0.5,99.5,ptBins, arrPtBinning);
758  fESDList[iCut]->Add(fHistoClusMergedNCellsAroundPt[iCut]);
759  fHistoClusMergedNCellsAroundAndInPt[iCut] = new TH2F("ClusMerged_NCellsAroundAndInClus_Pt","ClusMerged_NCellsAroundAndInClus_Pt",100,-0.5,99.5,ptBins, arrPtBinning);
761  fHistoClusMergedEAroundE[iCut] = new TH2F("ClusMerged_EAroundClus_E","ClusMerged_EAroundClus_E",ptBinsDefClus, startPtDefClus, endPtDefClus, ptBins, arrPtBinning);
762  fESDList[iCut]->Add(fHistoClusMergedEAroundE[iCut]);
763 
764  if (fIsMC > 0){
765  fHistoClusMergedNParticlePt[iCut] = new TH2F("ClusMerged_NPart_Pt","ClusMerged_NPart_Pt",100,-0.5,99.5,ptBins, arrPtBinning);
766  fESDList[iCut]->Add(fHistoClusMergedNParticlePt[iCut]);
767  if (fIsMC == 2){
768  fHistoClusNCellsPt[iCut]->Sumw2();
769  fHistoClusMergedNCellsPt[iCut]->Sumw2();
770  fHistoClusMergedNCellsAroundPt[iCut]->Sumw2();
772  fHistoClusMergedEAroundE[iCut]->Sumw2();
773  fHistoClusMergedNParticlePt[iCut]->Sumw2();
774  fHistoClusMergedEAroundE[iCut]->Sumw2();
775  }
776  }
777  }
778 
779  fHistoMotherInvMassPt[iCut] = new TH2F("ESD_Mother_InvMass_Pt","ESD_Mother_InvMass_Pt",invMassBins, startMass, endMass,ptBins, arrPtBinning);
780  fESDList[iCut]->Add(fHistoMotherInvMassPt[iCut]);
781 
782  if (fIsMC == 2){
783  fHistoMotherInvMassPt[iCut]->Sumw2();
784  }
785 
786  if (fDoMesonQA > 0 ){
787  fHistoMotherPtY[iCut] = new TH2F("ESD_Mother_Pt_Y","ESD_Mother_Pt_Y", ptBinsLog, startPtLog, endPtLog, 150, -1.5, 1.5);
789  fESDList[iCut]->Add(fHistoMotherPtY[iCut]);
790  fHistoMotherPtAlpha[iCut] = new TH2F("ESD_Mother_Pt_Alpha","ESD_Mother_Pt_Alpha", ptBinsLog, startPtLog, endPtLog, 100, 0, 1);
792  fESDList[iCut]->Add(fHistoMotherPtAlpha[iCut]);
793  if (fIsMC == 2){
794  fHistoMotherPtY[iCut]->Sumw2();
795  fHistoMotherPtAlpha[iCut]->Sumw2();
796  }
797  }
798  }
799 
800  if (fIsMC > 0){
801  fMCList = new TList*[fnCuts];
802  fTrueList = new TList*[fnCuts];
803 
804  fHistoMCHeaders = new TH1I*[fnCuts];
805  fHistoMCPi0Pt = new TH1F*[fnCuts];
806  fHistoMCPi0ReducedPt = new TH1F*[fnCuts];
807  fHistoMCEtaPt = new TH1F*[fnCuts];
810  fHistoMCDecayGammaPt = new TH1F*[fnCuts];
811  fHistoMCAllGammaPt = new TH1F*[fnCuts];
812  if (GetSelectedMesonID() != 2){
813  fHistoMCPi0WOWeightPt = new TH1F*[fnCuts];
814  fHistoMCPi0InAccPt = new TH1F*[fnCuts];
815  fHistoMCPi0ReducedInAccPt = new TH1F*[fnCuts];
819  fHistoMCPi0DalitzPt = new TH1F*[fnCuts];
820  fHistoMCPi0DalitzWOWeightPt = new TH1F*[fnCuts];
821  fHistoMCPi0DalitzInAccPt = new TH1F*[fnCuts];
824 
825  }
826  if (GetSelectedMesonID() != 1){
827  fHistoMCEtaWOWeightPt = new TH1F*[fnCuts];
828  fHistoMCEtaInAccPt = new TH1F*[fnCuts];
830  fHistoMCEtaDalitzPt = new TH1F*[fnCuts];
831  fHistoMCEtaDalitzWOWeightPt = new TH1F*[fnCuts];
832  fHistoMCEtaDalitzInAccPt = new TH1F*[fnCuts];
834  }
835  if (fIsMC == 2){
836  if (GetSelectedMesonID() != 2){
837  fHistoMCPi0WOEvtWeightPt = new TH1F*[fnCuts];
839  }
840  if (GetSelectedMesonID() != 1){
841  fHistoMCEtaWOEvtWeightPt = new TH1F*[fnCuts];
843  }
844  if (fDoMesonQA > 0){
845  if (GetSelectedMesonID() != 2)
847  if (GetSelectedMesonID() != 1)
849  }
850  }
851 
858  if (GetSelectedMesonID() < 2){
863  if (fDoMesonQA > 1){
872  }
879  }
895 
899 // fHistoTrueClusElectronPtvsMotherID = new TH2F*[fnCuts];
900 // fHistoTrueClusElectronPtvsTopMotherID = new TH2F*[fnCuts];
901 // fHistoTrueClusElectronPtvsConvPhotonTopMotherID = new TH2F*[fnCuts];
902  fHistoTrueMergedMissedPDG = new TH1F*[fnCuts];
903 
909 
910  if (fDoMesonQA > 1){
917  if (GetSelectedMesonID() < 2){
919  }
920  }
921 
922  if (fDoMesonQA > 0){
927 
928  if (GetSelectedMesonID() != 2){
929  fHistoTruePi0PtY = new TH2F*[fnCuts];
937  }
938  if (GetSelectedMesonID() != 1){
939  fHistoTrueEtaPtY = new TH2F*[fnCuts];
942  }
943  }
944 
945  for(Int_t iCut = 0; iCut<fnCuts;iCut++){
946  TString cutstringEvent = ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber();
947  TString cutstringCalo = ((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetCutNumber();
948  TString cutstringCaloMerged = ((AliCaloPhotonCuts*)fClusterMergedCutArray->At(iCut))->GetCutNumber();
949  TString cutstringMeson = ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutNumber();
950 
951 
952  fMCList[iCut] = new TList();
953  fMCList[iCut]->SetName(Form("%s_%s_%s_%s MC histograms",cutstringEvent.Data(),cutstringCalo.Data(),cutstringCaloMerged.Data(), cutstringMeson.Data()));
954  fMCList[iCut]->SetOwner(kTRUE);
955  fCutFolder[iCut]->Add(fMCList[iCut]);
956  fHistoMCHeaders[iCut] = new TH1I("MC_Headers", "MC_Headers", 20, 0, 20);
957  fMCList[iCut]->Add(fHistoMCHeaders[iCut]);
958  fHistoMCPi0Pt[iCut] = new TH1F("MC_Pi0_Pt","MC_Pi0_Pt",ptBins, arrPtBinning);
959  fHistoMCPi0Pt[iCut]->Sumw2();
960  fMCList[iCut]->Add(fHistoMCPi0Pt[iCut]);
961  fHistoMCPi0ReducedPt[iCut] = new TH1F("MC_Pi0MultipleSubtraction_Pt","MC_Pi0MultipleSubtraction_Pt",ptBins, arrPtBinning);
962  fHistoMCPi0ReducedPt[iCut]->Sumw2();
963  fMCList[iCut]->Add(fHistoMCPi0ReducedPt[iCut]);
964  fHistoMCEtaPt[iCut] = new TH1F("MC_Eta_Pt","MC_Eta_Pt",ptBins, arrPtBinning);
965  fHistoMCEtaPt[iCut]->Sumw2();
966  fMCList[iCut]->Add(fHistoMCEtaPt[iCut]);
967 
968  fHistoMCPrimaryPtvsSource[iCut] = new TH2F("MC_Primary_Pt_Source","MC_Primary_Pt_Source",ptBins, arrPtBinning, 7, -0.5, 6.5);
969  fHistoMCPrimaryPtvsSource[iCut]->GetYaxis()->SetBinLabel(1,"Pi+");
970  fHistoMCPrimaryPtvsSource[iCut]->GetYaxis()->SetBinLabel(2,"Pi-");
971  fHistoMCPrimaryPtvsSource[iCut]->GetYaxis()->SetBinLabel(3,"K+");
972  fHistoMCPrimaryPtvsSource[iCut]->GetYaxis()->SetBinLabel(4,"K-");
973  fHistoMCPrimaryPtvsSource[iCut]->GetYaxis()->SetBinLabel(5,"K0s");
974  fHistoMCPrimaryPtvsSource[iCut]->GetYaxis()->SetBinLabel(6,"K0l");
975  fHistoMCPrimaryPtvsSource[iCut]->GetYaxis()->SetBinLabel(7,"Lambda");
976  fHistoMCPrimaryPtvsSource[iCut]->Sumw2();
977  fMCList[iCut]->Add(fHistoMCPrimaryPtvsSource[iCut]);
978 
979  fHistoMCPrimaryYvsSource[iCut] = new TH2F("MC_Primary_Y_Source","MC_Primary_Y_Source",400, -20, 20, 7, -0.5, 6.5);
980  fHistoMCPrimaryYvsSource[iCut]->GetYaxis()->SetBinLabel(1,"Pi+");
981  fHistoMCPrimaryYvsSource[iCut]->GetYaxis()->SetBinLabel(2,"Pi-");
982  fHistoMCPrimaryYvsSource[iCut]->GetYaxis()->SetBinLabel(3,"K+");
983  fHistoMCPrimaryYvsSource[iCut]->GetYaxis()->SetBinLabel(4,"K-");
984  fHistoMCPrimaryYvsSource[iCut]->GetYaxis()->SetBinLabel(5,"K0s");
985  fHistoMCPrimaryYvsSource[iCut]->GetYaxis()->SetBinLabel(6,"K0l");
986  fHistoMCPrimaryYvsSource[iCut]->GetYaxis()->SetBinLabel(7,"Lambda");
987  fHistoMCPrimaryYvsSource[iCut]->Sumw2();
988  fMCList[iCut]->Add(fHistoMCPrimaryYvsSource[iCut]);
989 
990  fHistoMCDecayGammaPt[iCut] = new TH1F("MC_DecayGamma_Pt","MC_DecayGamma_Pt",ptBins, arrPtBinning);
991  fHistoMCDecayGammaPt[iCut]->Sumw2();
992  fMCList[iCut]->Add(fHistoMCDecayGammaPt[iCut]);
993  fHistoMCAllGammaPt[iCut] = new TH1F("MC_AllGamma_Pt","MC_AllGamma_Pt",ptBins, arrPtBinning);
994  fHistoMCAllGammaPt[iCut]->Sumw2();
995  fMCList[iCut]->Add(fHistoMCAllGammaPt[iCut]);
996 
997  if (GetSelectedMesonID() != 2){
998  fHistoMCPi0WOWeightPt[iCut] = new TH1F("MC_Pi0_WOWeights_Pt","MC_Pi0_WOWeights_Pt",ptBins, arrPtBinning);
999  fMCList[iCut]->Add(fHistoMCPi0WOWeightPt[iCut]);
1000  fHistoMCPi0InAccPt[iCut] = new TH1F("MC_Pi0InAcc_Pt","MC_Pi0InAcc_Pt",ptBins, arrPtBinning);
1001  fHistoMCPi0InAccPt[iCut]->Sumw2();
1002  fMCList[iCut]->Add(fHistoMCPi0InAccPt[iCut]);
1003  fHistoMCPi0ReducedInAccPt[iCut] = new TH1F("MC_Pi0InAccMulipleSubtraction_Pt","MC_Pi0InAccMulipleSubtraction_Pt",ptBins, arrPtBinning);
1004  fHistoMCPi0ReducedInAccPt[iCut]->Sumw2();
1005  fMCList[iCut]->Add(fHistoMCPi0ReducedInAccPt[iCut]);
1006  fHistoMCPi0DalitzPt[iCut] = new TH1F("MC_Pi0Dalitz_Pt","MC_Pi0Dalitz_Pt",ptBins, arrPtBinning);
1007  fHistoMCPi0DalitzPt[iCut]->Sumw2();
1008  fMCList[iCut]->Add(fHistoMCPi0DalitzPt[iCut]);
1009  fHistoMCPi0DalitzWOWeightPt[iCut] = new TH1F("MC_Pi0Dalitz_WOWeights_Pt","MC_Pi0Dalitz_WOWeights_Pt",ptBins, arrPtBinning);
1010  fMCList[iCut]->Add(fHistoMCPi0DalitzWOWeightPt[iCut]);
1011  fHistoMCPi0DalitzInAccPt[iCut] = new TH1F("MC_Pi0DalitzInAcc_Pt","MC_Pi0DalitzInAcc_Pt",ptBins, arrPtBinning);
1012  fHistoMCPi0DalitzInAccPt[iCut]->Sumw2();
1013  fMCList[iCut]->Add(fHistoMCPi0DalitzInAccPt[iCut]);
1014 
1015  // initialization for secondary histograms
1016  fHistoMCSecPi0PtvsSource[iCut] = new TH2F("MC_SecPi0_Pt_Source","MC_SecPi0_Pt_Source", ptBins, arrPtBinning, 16, -0.5, 15.5);
1017  fHistoMCSecPi0PtvsSource[iCut]->Sumw2();
1018  fMCList[iCut]->Add(fHistoMCSecPi0PtvsSource[iCut]);
1019  fHistoMCSecPi0InAccPtvsSource[iCut] = new TH2F("MC_SecPi0InAcc_Pt_Source","MC_SecPi0InAcc_Pt_Source", ptBins, arrPtBinning, 16, -0.5, 15.5);
1020  fHistoMCSecPi0InAccPtvsSource[iCut]->Sumw2();
1021  fMCList[iCut]->Add(fHistoMCSecPi0InAccPtvsSource[iCut]);
1022 
1023  fHistoPi0EvsGammaOverlapE[iCut] = new TH2F("MC_Pi0_E_OverlapGamma_E","MC_Pi0_E_OverlapGamma_E",200,0,200,200,0,200);
1024  fMCList[iCut]->Add(fHistoPi0EvsGammaOverlapE[iCut]);
1025  }
1026 
1027  if (GetSelectedMesonID() != 1){
1028  fHistoMCEtaWOWeightPt[iCut] = new TH1F("MC_Eta_WOWeights_Pt","MC_Eta_WOWeights_Pt",ptBins, arrPtBinning);
1029  fMCList[iCut]->Add(fHistoMCEtaWOWeightPt[iCut]);
1030  fHistoMCEtaInAccPt[iCut] = new TH1F("MC_EtaInAcc_Pt","MC_EtaInAcc_Pt",ptBins, arrPtBinning);
1031  fHistoMCEtaInAccPt[iCut]->Sumw2();
1032  fMCList[iCut]->Add(fHistoMCEtaInAccPt[iCut]);
1033  fHistoMCEtaDalitzPt[iCut] = new TH1F("MC_EtaDalitz_Pt","MC_EtaDalitz_Pt",ptBins, arrPtBinning);
1034  fHistoMCEtaDalitzPt[iCut]->Sumw2();
1035  fMCList[iCut]->Add(fHistoMCEtaDalitzPt[iCut]);
1036  fHistoMCEtaDalitzWOWeightPt[iCut] = new TH1F("MC_EtaDalitz_WOWeights_Pt","MC_EtaDalitz_WOWeights_Pt",ptBins, arrPtBinning);
1037  fMCList[iCut]->Add(fHistoMCEtaDalitzWOWeightPt[iCut]);
1038  fHistoMCEtaDalitzInAccPt[iCut] = new TH1F("MC_EtaDalitzInAcc_Pt","MC_EtaDalitzInAcc_Pt",ptBins, arrPtBinning);
1039  fHistoMCEtaDalitzInAccPt[iCut]->Sumw2();
1040  fMCList[iCut]->Add(fHistoMCEtaDalitzInAccPt[iCut]);
1041  }
1042 
1043  if (fIsMC == 2){
1044  if (GetSelectedMesonID() != 2){
1045  fHistoMCPi0WOWeightPt[iCut]->Sumw2();
1046  fHistoMCPi0DalitzWOWeightPt[iCut]->Sumw2();
1047  fHistoMCPi0WOEvtWeightPt[iCut] = new TH1F("MC_Pi0_WOEventWeights_Pt","MC_Pi0_WOEventWeights_Pt",ptBins, arrPtBinning);
1048  fMCList[iCut]->Add(fHistoMCPi0WOEvtWeightPt[iCut]);
1049  fHistoMCPi0DalitzWOEvtWeightPt[iCut] = new TH1F("MC_Pi0Dalitz_WOEventWeights_Pt","MC_Pi0Dalitz_WOEventWeights_Pt",ptBins, arrPtBinning);
1050  fMCList[iCut]->Add(fHistoMCPi0DalitzWOEvtWeightPt[iCut]);
1051  fHistoMCPi0DalitzWOEvtWeightInAccPt[iCut] = new TH1F("MC_Pi0DalitzWOEvtWeightInAcc_Pt","MC_Pi0DalitzWOEvtWeightInAcc_Pt",ptBins, arrPtBinning);
1052  fMCList[iCut]->Add(fHistoMCPi0DalitzWOEvtWeightInAccPt[iCut]);
1053  fHistoMCPi0WOEvtWeightInAccPt[iCut] = new TH1F("MC_Pi0WOEvtWeightInAcc_Pt","MC_Pi0WOEvtWeightInAcc_Pt",ptBins, arrPtBinning);
1054  fMCList[iCut]->Add(fHistoMCPi0WOEvtWeightInAccPt[iCut]);
1055 
1056 
1057  }
1058  if (GetSelectedMesonID() != 1){
1059  fHistoMCEtaWOWeightPt[iCut]->Sumw2();
1060  fHistoMCEtaDalitzWOWeightPt[iCut]->Sumw2();
1061  fHistoMCEtaWOEvtWeightPt[iCut] = new TH1F("MC_Eta_WOEventWeights_Pt","MC_Eta_WOEventWeights_Pt",ptBins, arrPtBinning);
1062  fMCList[iCut]->Add(fHistoMCEtaWOEvtWeightPt[iCut]);
1063  fHistoMCEtaDalitzWOEvtWeightPt[iCut] = new TH1F("MC_EtaDalitz_WOEventWeights_Pt","MC_EtaDalitz_WOEventWeights_Pt",ptBins, arrPtBinning);
1064  fMCList[iCut]->Add(fHistoMCEtaDalitzWOEvtWeightPt[iCut]);
1065  fHistoMCEtaWOEvtWeightInAccPt[iCut] = new TH1F("MC_EtaWOEvtWeightInAcc_Pt","MC_EtaWOEvtWeightInAcc_Pt",ptBins, arrPtBinning);
1066  fMCList[iCut]->Add(fHistoMCEtaWOEvtWeightInAccPt[iCut]);
1067  fHistoMCEtaDalitzWOEvtWeightInAccPt[iCut] = new TH1F("MC_EtaDalitzWOEvtWeightInAcc_Pt","MC_EtaDalitzWOEvtWeightInAcc_Pt",ptBins, arrPtBinning);
1068  fMCList[iCut]->Add(fHistoMCEtaDalitzWOEvtWeightInAccPt[iCut]);
1069  }
1070  if (fDoMesonQA > 0){
1071  if (GetSelectedMesonID() != 2){
1072  fHistoMCPi0PtJetPt[iCut] = new TH2F("MC_Pi0_Pt_JetPt","MC_Pi0_Pt_JetPt", ptBinsLog, startPtLog, endPtLog, 200, -0.5, 199.5);
1073  fHistoMCPi0PtJetPt[iCut]->Sumw2();
1075  fMCList[iCut]->Add(fHistoMCPi0PtJetPt[iCut]);
1076  }
1077  if (GetSelectedMesonID() != 1){
1078  fHistoMCEtaPtJetPt[iCut] = new TH2F("MC_Eta_Pt_JetPt","MC_Eta_Pt_JetPt", ptBinsLog, startPtLog, endPtLog, 200, -0.5, 199.5);
1079  fHistoMCEtaPtJetPt[iCut]->Sumw2();
1081  fMCList[iCut]->Add(fHistoMCEtaPtJetPt[iCut]);
1082  }
1083  }
1084  }
1085 
1086  fTrueList[iCut] = new TList();
1087  fTrueList[iCut]->SetName(Form("%s_%s_%s_%s True histograms",cutstringEvent.Data(),cutstringCalo.Data(),cutstringCaloMerged.Data(), cutstringMeson.Data()));
1088  fTrueList[iCut]->SetOwner(kTRUE);
1089  fCutFolder[iCut]->Add(fTrueList[iCut]);
1090 
1091  fHistoTrueClusEFracFirstLabel[iCut] = new TH2F("ESD_TrueClusEFracFirstLabel_E_Frac","ESD_TrueClusEFracFirstLabel_E_Frac",ptBins, arrPtBinning,50, -0.01, 1.01);
1092  fTrueList[iCut]->Add(fHistoTrueClusEFracFirstLabel[iCut]);
1093  fHistoTrueClusEFracLeadingPi0[iCut] = new TH2F("ESD_TrueClusEFracLeadingPi0_E_Frac","ESD_TrueClusEFracLeadingPi0_E_Frac",ptBins, arrPtBinning,50, -0.01, 1.01);
1094  fTrueList[iCut]->Add(fHistoTrueClusEFracLeadingPi0[iCut]);
1095  fHistoTrueClusMergedPtvsM02[iCut] = new TH2F("ESD_TrueClusMerged_Pt_M02","ESD_TrueClusMerged_Pt_M02",ptBins, arrPtBinning,showerShapeBins, startShowerShape, endShowerShape);
1096  fTrueList[iCut]->Add(fHistoTrueClusMergedPtvsM02[iCut]);
1097  fHistoTrueClusPi0PtvsM02 [iCut] = new TH2F("ESD_TrueClusFromPi0_Pt_M02","ESD_TrueClusFromPi0_Pt_M02",ptBins, arrPtBinning,showerShapeBins, startShowerShape, endShowerShape);
1098  fTrueList[iCut]->Add(fHistoTrueClusPi0PtvsM02[iCut]);
1099  fHistoTrueClusMultiplePi0PtvsM02 [iCut] = new TH2F("ESD_TrueClusFromMultiplePi0_Pt_M02","ESD_TrueClusFromMultiplePi0_Pt_M02",ptBins, arrPtBinning,showerShapeBins, startShowerShape, endShowerShape);
1100  fTrueList[iCut]->Add(fHistoTrueClusMultiplePi0PtvsM02[iCut]);
1101  fHistoTrueClusPi0DalitzPtvsM02 [iCut] = new TH2F("ESD_TrueClusFromPi0Dalitz_Pt_M02","ESD_TrueClusFromPi0Dalitz_Pt_M02",ptBins, arrPtBinning,showerShapeBins, startShowerShape, endShowerShape);
1102  fTrueList[iCut]->Add(fHistoTrueClusPi0DalitzPtvsM02[iCut]);
1103  fHistoTrueClusEtaPtvsM02[iCut] = new TH2F("ESD_TrueClusFromEta_Pt_M02","ESD_TrueClusFromEta_Pt_M02",ptBins, arrPtBinning,showerShapeBins, startShowerShape, endShowerShape);
1104  fTrueList[iCut]->Add(fHistoTrueClusEtaPtvsM02[iCut]);
1105  fHistoTrueClusEtaDalitzPtvsM02[iCut] = new TH2F("ESD_TrueClusFromEtaDalitz_Pt_M02","ESD_TrueClusFromEtaDalitz_Pt_M02",ptBins, arrPtBinning,showerShapeBins, startShowerShape, endShowerShape);
1106  fTrueList[iCut]->Add(fHistoTrueClusEtaDalitzPtvsM02[iCut]);
1107  fHistoTrueClusMergedPureFromPi0PtvsM02[iCut] = new TH2F("ESD_TrueClusMergedPureFromPi0_Pt_M02","ESD_TrueClusMergedPureFromPi0_Pt_M02",ptBins, arrPtBinning,showerShapeBins, startShowerShape, endShowerShape);
1109  fHistoTrueClusMergedPureFromEtaPtvsM02[iCut] = new TH2F("ESD_TrueClusMergedPureFromEta_Pt_M02","ESD_TrueClusMergedPureFromEta_Pt_M02",ptBins, arrPtBinning,showerShapeBins, startShowerShape, endShowerShape);
1111  fHistoTrueClusMergedPartConvFromPi0PtvsM02[iCut] = new TH2F("ESD_TrueClusMergedPartConvFromPi0_Pt_M02","ESD_TrueClusMergedPartConvFromPi0_Pt_M02",ptBins, arrPtBinning,showerShapeBins, startShowerShape, endShowerShape);
1113  fHistoTrueClusMergedPartConvFromEtaPtvsM02[iCut] = new TH2F("ESD_TrueClusMergedPartConvFromEta_Pt_M02","ESD_TrueClusMergedPartConvFromEta_Pt_M02",ptBins, arrPtBinning,showerShapeBins, startShowerShape, endShowerShape);
1115  fHistoNTrueMultiplePi0vsPt [iCut] = new TH2F("ESD_TrueNumberOfMultiplePi0_Pt","ESD_TrueNumberOfMultiplePi0_Pt",ptBins, arrPtBinning,20, 0, 20);
1116  fTrueList[iCut]->Add(fHistoNTrueMultiplePi0vsPt[iCut]);
1117 
1118  fHistoTrueClusBGPtvsM02[iCut] = new TH2F("ESD_TrueClusBG_Pt_M02","ESD_TrueClusBG_Pt_M02",ptBins, arrPtBinning,showerShapeBins, startShowerShape, endShowerShape);
1119  fTrueList[iCut]->Add(fHistoTrueClusBGPtvsM02[iCut]);
1120  fHistoTrueClusGammaPtvsM02[iCut] = new TH2F("ESD_TrueClusGamma_Pt_M02","ESD_TrueClusGamma_Pt_M02",ptBins, arrPtBinning,showerShapeBins, startShowerShape, endShowerShape);
1121  fTrueList[iCut]->Add(fHistoTrueClusGammaPtvsM02[iCut]);
1122  fHistoTrueClusGammaFromPi0PtvsM02[iCut] = new TH2F("ESD_TrueClusGamma_FromPi0_Pt_M02","ESD_TrueClusGamma_FromPi0_Pt_M02",ptBins, arrPtBinning,showerShapeBins, startShowerShape, endShowerShape);
1123  fTrueList[iCut]->Add(fHistoTrueClusGammaFromPi0PtvsM02[iCut]);
1124  fHistoTrueClusGammaFromEtaPtvsM02[iCut] = new TH2F("ESD_TrueClusGamma_FromEta_Pt_M02","ESD_TrueClusGamma_FromEta_Pt_M02",ptBins, arrPtBinning,showerShapeBins, startShowerShape, endShowerShape);
1125  fTrueList[iCut]->Add(fHistoTrueClusGammaFromEtaPtvsM02[iCut]);
1126  fHistoTrueClusElectronPtvsM02[iCut] = new TH2F("ESD_TrueClusElectron_Pt_M02","ESD_TrueClusElectron_Pt_M02",ptBins, arrPtBinning,showerShapeBins, startShowerShape, endShowerShape);
1127  fTrueList[iCut]->Add(fHistoTrueClusElectronPtvsM02[iCut]);
1128  fHistoTrueClusElectronFromPi0PtvsM02[iCut] = new TH2F("ESD_TrueClusElectron_FromPi0_Pt_M02","ESD_TrueClusElectron_FromPi0_Pt_M02",ptBins, arrPtBinning,showerShapeBins, startShowerShape, endShowerShape);
1130  fHistoTrueClusElectronFromEtaPtvsM02[iCut] = new TH2F("ESD_TrueClusElectron_FromEta_Pt_M02","ESD_TrueClusElectron_FromEta_Pt_M02",ptBins, arrPtBinning,showerShapeBins, startShowerShape, endShowerShape);
1132  fHistoTrueClusElectronFromGammaPtvsM02[iCut] = new TH2F("ESD_TrueClusElectron_FromGamma_Pt_M02","ESD_TrueClusElectron_FromGamma_Pt_M02",ptBins, arrPtBinning,showerShapeBins, startShowerShape, endShowerShape);
1134 
1135  if (GetSelectedMesonID() < 2){
1136  fHistoTrueClusPrimPi0PtvsM02[iCut] = new TH2F("ESD_TrueClusFromPrimPi0_Pt_M02","ESD_TrueClusFromPrimPi0_Pt_M02",ptBins, arrPtBinning,showerShapeBins, startShowerShape, endShowerShape);
1137  fTrueList[iCut]->Add(fHistoTrueClusPrimPi0PtvsM02[iCut]);
1138  fHistoTrueClusPrimPi0PtMCPt[iCut] = new TH2F("ESD_TrueClusFromPrimPi0_Pt_MCPt","ESD_TrueClusFromPrimPi0_Pt_MCPt",ptBins, arrPtBinning,ptBins, arrPtBinning);
1139  fTrueList[iCut]->Add(fHistoTrueClusPrimPi0PtMCPt[iCut]);
1140  fHistoTruePureMergedClusPrimPi0PtvsM02[iCut] = new TH2F("ESD_TruePureMergedClusFromPrimPi0_Pt_M02","ESD_TruePureMergedClusFromPrimPi0_Pt_M02",ptBins, arrPtBinning,showerShapeBins, startShowerShape, endShowerShape);
1142  fHistoTruePartConvClusPrimPi0PtvsM02[iCut] = new TH2F("ESD_TruePartConvClusFromPrimPi0_Pt_M02","ESD_TruePartConvClusFromPrimPi0_Pt_M02",ptBins, arrPtBinning,showerShapeBins, startShowerShape, endShowerShape);
1144  if (fDoMesonQA > 1){
1145  fHistoTrueClusPrimPi0PureMergedPtMCPt[iCut] = new TH2F("ESD_TrueClusFromPrimPi0PureMerged_Pt_MCPt","ESD_TrueClusFromPrimPi0PureMerged_Pt_MCPt",ptBins, arrPtBinning,ptBins, arrPtBinning);
1147  fHistoTrueClusPrimPi0PartConvMergedPtMCPt[iCut] = new TH2F("ESD_TrueClusFromPrimPi0PartConvMerged_Pt_MCPt","ESD_TrueClusFromPrimPi0PartConvMerged_Pt_MCPt",ptBins, arrPtBinning,ptBins, arrPtBinning);
1149  fHistoTrueClusPrimPi01GammaMergedPtMCPt[iCut] = new TH2F("ESD_TrueClusFromPrimPi01GammaMerged_Pt_MCPt","ESD_TrueClusFromPrimPi01GammaMerged_Pt_MCPt",ptBins, arrPtBinning,ptBins, arrPtBinning);
1151  fHistoTrueClusPrimPi01ElectronMergedPtMCPt[iCut] = new TH2F("ESD_TrueClusFromPrimPi01ElectronMerged_Pt_MCPt","ESD_TrueClusFromPrimPi01ElectronMerged_Pt_MCPt",ptBins, arrPtBinning,ptBins, arrPtBinning);
1153 
1154  fHistoTrueClusNeutralContamination[iCut] = new TH2F("ESD_TrueClusE_RelContaminationNeutralPart","ESD_TrueClusE_RelContaminationNeutralPart",ptBins, arrPtBinning,100, -1.0, 1.0);
1156  fHistoTrueClusPhotonContamination[iCut] = new TH2F("ESD_TrueClusE_RelContaminationPhotons","ESD_TrueClusE_RelContaminationPhotons",ptBins, arrPtBinning,100, -1.0, 1.0);
1157  fTrueList[iCut]->Add(fHistoTrueClusPhotonContamination[iCut]);
1158  fHistoTrueClusElectronContamination[iCut] = new TH2F("ESD_TrueClusE_RelContaminationElectrons","ESD_TrueClusE_RelContaminationElectrons",ptBins, arrPtBinning,100, -1.0, 1.0);
1160  fHistoTrueClusOtherContamination[iCut] = new TH2F("ESD_TrueClusE_RelContaminationOthers","ESD_TrueClusE_RelContaminationOthers",ptBins, arrPtBinning,100, -1.0, 1.0);
1161  fTrueList[iCut]->Add(fHistoTrueClusOtherContamination[iCut]);
1162  }
1163  fHistoTrueClusMultiplePrimPi0PtvsM02[iCut] = new TH2F("ESD_TrueClusFromMultiplePrimPi0_Pt_M02","ESD_TrueClusFromMultiplePrimPi0_Pt_M02",ptBins, arrPtBinning,showerShapeBins, startShowerShape, endShowerShape);
1165  fHistoTrueClusSecPi0PtvsM02[iCut] = new TH2F("ESD_TrueClusFromSecPi0_Pt_M02","ESD_TrueClusFromSecPi0_Pt_M02",ptBins, arrPtBinning,showerShapeBins, startShowerShape, endShowerShape);
1166  fTrueList[iCut]->Add(fHistoTrueClusSecPi0PtvsM02[iCut]);
1167  fHistoTrueClusSecPi0FromK0sPtvsM02[iCut] = new TH2F("ESD_TrueClusFromSecPi0FromK0s_Pt_M02","ESD_TrueClusFromSecPi0FromK0s_Pt_M02",ptBins, arrPtBinning,showerShapeBins, startShowerShape, endShowerShape);
1169  fHistoTrueClusSecPi0FromK0lPtvsM02[iCut] = new TH2F("ESD_TrueClusFromSecPi0FromK0l_Pt_M02","ESD_TrueClusFromSecPi0FromK0l_Pt_M02",ptBins, arrPtBinning,showerShapeBins, startShowerShape, endShowerShape);
1171  fHistoTrueClusSecPi0FromLambdaPtvsM02[iCut] = new TH2F("ESD_TrueClusFromSecPi0FromLambda_Pt_M02","ESD_TrueClusFromSecPi0FromLambda_Pt_M02",ptBins, arrPtBinning,showerShapeBins, startShowerShape, endShowerShape);
1173  fHistoTrueSecPi0PtvsDiffReco[iCut] = new TH2F("ESD_TrueClusFromSecPi0_Pt_RecoMethod","ESD_TrueClusFromSecPi0_Pt_RecoMethod",ptBins, arrPtBinning, 4, -0.5, 3.5);
1174  fTrueList[iCut]->Add(fHistoTrueSecPi0PtvsDiffReco[iCut]);
1175  }
1176 
1177 
1178  fHistoTrueClusBGPtvsSource[iCut] = new TH2F("ESD_TrueClusBG_Pt_Source","ESD_TrueClusBG_Pt_Source",ptBins, arrPtBinning, 10, 0, 10);
1179  fTrueList[iCut]->Add(fHistoTrueClusBGPtvsSource[iCut]);
1180  fHistoTrueClusGammaPtvsSource[iCut] = new TH2F("ESD_TrueClusGamma_Pt_Source","ESD_TrueClusGamma_Pt_Source",ptBins, arrPtBinning, 8, 0, 8);
1181  fTrueList[iCut]->Add(fHistoTrueClusGammaPtvsSource[iCut]);
1182  fHistoTrueClusElectronPtvsSource[iCut] = new TH2F("ESD_TrueClusElectron_Pt_Source","ESD_TrueClusElectron_Pt_Source",ptBins, arrPtBinning, 9, 0, 9);
1183  fTrueList[iCut]->Add(fHistoTrueClusElectronPtvsSource[iCut]);
1184 // fHistoTrueClusElectronPtvsMotherID[iCut] = new TH2F("ESD_TrueClusElectron_Pt_MotherID","ESD_TrueClusElectron_Pt_MotherID",ptBins, arrPtBinning, 570, -1.5, 568.5);
1185 // fTrueList[iCut]->Add(fHistoTrueClusElectronPtvsMotherID[iCut]);
1186 // fHistoTrueClusElectronPtvsTopMotherID[iCut] = new TH2F("ESD_TrueClusElectron_Pt_TopMotherID","ESD_TrueClusElectron_Pt_TopMotherID",ptBins, arrPtBinning, 570, -1.5, 568.5);
1187 // fTrueList[iCut]->Add(fHistoTrueClusElectronPtvsTopMotherID[iCut]);
1188 // fHistoTrueClusElectronPtvsConvPhotonTopMotherID[iCut] = new TH2F("ESD_TrueClusElectron_Pt_ConvPhotonTopMotherID","ESD_TrueClusElectron_Pt_ConvPhotonTopMotherID",ptBins, arrPtBinning, 570, -1.5, 568.5);
1189 // fTrueList[iCut]->Add(fHistoTrueClusElectronPtvsConvPhotonTopMotherID[iCut]);
1190  fHistoTrueMergedMissedPDG[iCut] = new TH1F("ESD_TrueMergedMissed_PDG","ESD_TrueMergedMissed_PDG",10000, -1.5, 9998.5);
1191  fTrueList[iCut]->Add(fHistoTrueMergedMissedPDG[iCut]);
1192 
1193  fHistoDoubleCountTruePi0PtvsM02[iCut] = new TH2F("ESD_TrueDoubleCountPi0_Pt_M02","ESD_TrueDoubleCountPi0_Pt_M02",ptBins, arrPtBinning,showerShapeBins, startShowerShape, endShowerShape);
1194  fTrueList[iCut]->Add(fHistoDoubleCountTruePi0PtvsM02[iCut]);
1195  fHistoDoubleCountTrueSecPi0Pt[iCut] = new TH1F("ESD_TrueDoubleCountSecPi0_Pt","ESD_TrueDoubleCountSecPi0_Pt",ptBins, arrPtBinning);
1196  fTrueList[iCut]->Add(fHistoDoubleCountTrueSecPi0Pt[iCut]);
1197  fHistoDoubleCountTrueMultiplePi0PtvsM02[iCut] = new TH2F("ESD_TrueDoubleCountMultiplePi0_Pt_M02","ESD_TrueDoubleCountMultiplePi0_Pt_M02",ptBins, arrPtBinning,showerShapeBins, startShowerShape, endShowerShape);
1199  fHistoDoubleCountTrueMultipleSecPi0Pt[iCut] = new TH1F("ESD_TrueDoubleCountMultipleSecPi0_Pt","ESD_TrueDoubleCountMultipleSecPi0_Pt",ptBins, arrPtBinning);
1201  fHistoDoubleCountTrueEtaPtvsM02[iCut] = new TH2F("ESD_TrueDoubleCountEta_Pt_M02","ESD_TrueDoubleCountEta_Pt_M02",ptBins, arrPtBinning,showerShapeBins, startShowerShape, endShowerShape);
1202  fTrueList[iCut]->Add(fHistoDoubleCountTrueEtaPtvsM02[iCut]);
1203 
1204 
1205  if (fDoMesonQA > 1){
1206  fHistoTrueClusMergedInvMassvsPt[iCut] = new TH2F("ESD_TrueClusMerged_InvMass_Pt","ESD_TrueClusMerged_InvMass_Pt",invMassBins, startMass, endMass,ptBins, arrPtBinning);
1207  fTrueList[iCut]->Add(fHistoTrueClusMergedInvMassvsPt[iCut]);
1208  fHistoTrueClusPi0InvMassvsPt [iCut] = new TH2F("ESD_TrueClusFromPi0_InvMass_Pt","ESD_TrueClusFromPi0_InvMass_Pt",invMassBins, startMass, endMass,ptBins, arrPtBinning);
1209  fTrueList[iCut]->Add(fHistoTrueClusPi0InvMassvsPt[iCut]);
1210  fHistoTrueClusEtaInvMassvsPt[iCut] = new TH2F("ESD_TrueClusFromEta_InvMass_Pt","ESD_TrueClusFromEta_InvMass_Pt",invMassBins, startMass, endMass,ptBins, arrPtBinning);
1211  fTrueList[iCut]->Add(fHistoTrueClusEtaInvMassvsPt[iCut]);
1212  fHistoTrueClusBGInvMassvsPt[iCut] = new TH2F("ESD_TrueClusBG_InvMass_Pt","ESD_TrueClusBG_InvMass_Pt",invMassBins, startMass, endMass,ptBins, arrPtBinning);
1213  fTrueList[iCut]->Add(fHistoTrueClusBGInvMassvsPt[iCut]);
1214  fHistoTrueClusGammaInvMassvsPt[iCut] = new TH2F("ESD_TrueClusGamma_InvMass_Pt","ESD_TrueClusGamma_InvMass_Pt",invMassBins, startMass, endMass,ptBins, arrPtBinning);
1215  fTrueList[iCut]->Add(fHistoTrueClusGammaInvMassvsPt[iCut]);
1216  fHistoTrueClusElectronInvMassvsPt[iCut] = new TH2F("ESD_TrueClusElectron_InvMass_Pt","ESD_TrueClusElectron_InvMass_Pt",invMassBins, startMass, endMass,ptBins, arrPtBinning);
1217  fTrueList[iCut]->Add(fHistoTrueClusElectronInvMassvsPt[iCut]);
1218  if (GetSelectedMesonID() < 2){
1219  fHistoTrueClusPrimPi0InvMassvsPt[iCut] = new TH2F("ESD_TrueClusFromPrimPi0_InvMass_Pt","ESD_TrueClusFromPrimPi0_InvMass_Pt",invMassBins, startMass, endMass,ptBins, arrPtBinning);
1220  fTrueList[iCut]->Add(fHistoTrueClusPrimPi0InvMassvsPt[iCut]);
1221  }
1222  }
1223 
1224  if (fDoMesonQA > 0){
1225  fHistoTrueClusGammaEM02[iCut] = new TH2F("TrueClusGammaEM02","TrueClusGammaEM02",ptBins, arrPtBinning, showerShapeBins, startShowerShape, endShowerShape);
1226  fTrueList[iCut]->Add(fHistoTrueClusGammaEM02[iCut]);
1227  fHistoTrueClusElectronEM02[iCut] = new TH2F("TrueClusElectronEM02","TrueClusElectronEM02",ptBins, arrPtBinning, showerShapeBins, startShowerShape, endShowerShape);
1228  fTrueList[iCut]->Add(fHistoTrueClusElectronEM02[iCut]);
1229  fHistoTrueClusPi0EM02[iCut] = new TH2F("TrueClusPi0EM02","TrueClusPi0EM02",ptBins, arrPtBinning, showerShapeBins, startShowerShape, endShowerShape);
1230  fTrueList[iCut]->Add(fHistoTrueClusPi0EM02[iCut]);
1231  fHistoTrueClusEtaEM02[iCut] = new TH2F("TrueClusEtaEM02","TrueClusEtaEM02",ptBins, arrPtBinning, showerShapeBins, startShowerShape, endShowerShape);
1232  fTrueList[iCut]->Add(fHistoTrueClusEtaEM02[iCut]);
1233  if (GetSelectedMesonID() != 2){
1234  fHistoTruePi0PtY[iCut] = new TH2F("ESD_TruePi0_Pt_Y","ESD_TruePi0_Pt_Y",ptBinsLog, startPtLog, endPtLog,150,-1.5,1.5);
1236  fTrueList[iCut]->Add(fHistoTruePi0PtY[iCut]);
1237  fHistoTruePi0PtAlpha[iCut] = new TH2F("ESD_TruePi0_Pt_Alpha","ESD_TruePi0_Pt_Alpha",ptBinsLog, startPtLog, endPtLog,100,0,1);
1239  fTrueList[iCut]->Add(fHistoTruePi0PtAlpha[iCut]);
1240  fHistoTruePrimaryPi0MCPtResolPt[iCut] = new TH2F("ESD_TruePrimaryPi0_MCPt_ResolPt","ESD_TruePrimaryPi0_ResolPt_MCPt",ptBinsLog, startPtLog, endPtLog,1000,-1.,1.);
1242  fTrueList[iCut]->Add(fHistoTruePrimaryPi0MCPtResolPt[iCut]);
1243  fHistoTruePrimaryPi0PureMergedMCPtResolPt[iCut] = new TH2F("ESD_TruePrimaryPi0PureMerged_MCPt_ResolPt","ESD_TruePrimaryPi0PureMerged_ResolPt_MCPt",ptBinsLog, startPtLog, endPtLog,1000,-1.,1.);
1246  fHistoTruePrimaryPi0MergedPartConvMCPtResolPt[iCut] = new TH2F("ESD_TruePrimaryPi0MergedPartConv_MCPt_ResolPt","ESD_TruePrimaryPi0MergedPartConv_ResolPt_MCPt",ptBinsLog, startPtLog, endPtLog,1000,-1.,1.);
1249  fHistoTruePrimaryPi01GammaMCPtResolPt[iCut] = new TH2F("ESD_TruePrimaryPi01Gamma_MCPt_ResolPt","ESD_TruePrimaryPi01Gamma_ResolPt_MCPt",ptBinsLog, startPtLog, endPtLog,1000,-1.,1.);
1252  fHistoTruePrimaryPi01ElectronMCPtResolPt[iCut] = new TH2F("ESD_TruePrimaryPi01Electron_MCPt_ResolPt","ESD_TruePrimaryPi01Electron_ResolPt_MCPt",ptBinsLog, startPtLog, endPtLog,1000,-1.,1.);
1255  fHistoTrueSecondaryPi0MCPtResolPt[iCut] = new TH2F("ESD_TrueSecondaryPi0_MCPt_ResolPt","ESD_TrueSecondaryPi0_MCPt_ResolPt",ptBinsLog, startPtLog, endPtLog,2000,-10.,10.);
1257  fTrueList[iCut]->Add(fHistoTrueSecondaryPi0MCPtResolPt[iCut]);
1258  }
1259  if (GetSelectedMesonID() != 1){
1260  fHistoTrueEtaPtY[iCut] = new TH2F("ESD_TrueEta_Pt_Y","ESD_TrueEta_Pt_Y",ptBinsLog, startPtLog, endPtLog,150,-1.5,1.5);
1262  fTrueList[iCut]->Add(fHistoTrueEtaPtY[iCut]);
1263  fHistoTrueEtaPtAlpha[iCut] = new TH2F("ESD_TrueEta_Pt_Alpha","ESD_TrueEta_Pt_Alpha",ptBinsLog, startPtLog, endPtLog,100,0,0.5);
1265  fTrueList[iCut]->Add(fHistoTrueEtaPtAlpha[iCut]);
1266  fHistoTruePrimaryEtaMCPtResolPt[iCut] = new TH2F("ESD_TruePrimaryEta_MCPt_ResolPt","ESD_TruePrimaryEta_ResolPt_MCPt",ptBinsLog, startPtLog, endPtLog,1000,-1.,1.);
1268  fTrueList[iCut]->Add(fHistoTruePrimaryEtaMCPtResolPt[iCut]);
1269  }
1270  }
1271 
1272  if (fIsMC == 2){
1273  fHistoTrueClusEFracFirstLabel[iCut]->Sumw2();
1274  fHistoTrueClusEFracLeadingPi0[iCut]->Sumw2();
1275  fHistoTrueClusMergedPtvsM02[iCut]->Sumw2();
1276  fHistoTrueClusPi0PtvsM02[iCut]->Sumw2();
1277  fHistoTrueClusMultiplePi0PtvsM02[iCut]->Sumw2();
1278  fHistoNTrueMultiplePi0vsPt[iCut]->Sumw2();
1279  fHistoTrueClusPi0DalitzPtvsM02[iCut]->Sumw2();
1280  fHistoTrueClusEtaPtvsM02[iCut]->Sumw2();
1281  fHistoTrueClusEtaDalitzPtvsM02[iCut]->Sumw2();
1286  fHistoTrueMergedMissedPDG[iCut]->Sumw2();
1287  fHistoTrueClusBGPtvsM02[iCut]->Sumw2();
1288  fHistoTrueClusGammaPtvsM02[iCut]->Sumw2();
1289  fHistoTrueClusGammaFromPi0PtvsM02[iCut]->Sumw2();
1290  fHistoTrueClusGammaFromEtaPtvsM02[iCut]->Sumw2();
1291  fHistoTrueClusElectronPtvsM02[iCut]->Sumw2();
1292  fHistoTrueClusElectronFromPi0PtvsM02[iCut]->Sumw2();
1293  fHistoTrueClusElectronFromEtaPtvsM02[iCut]->Sumw2();
1295  fHistoTrueClusBGPtvsSource[iCut]->Sumw2();
1296  fHistoTrueClusGammaPtvsSource[iCut]->Sumw2();
1297  fHistoTrueClusElectronPtvsSource[iCut]->Sumw2();
1298 // fHistoTrueClusElectronPtvsMotherID[iCut]->Sumw2();
1299 // fHistoTrueClusElectronPtvsTopMotherID[iCut]->Sumw2();
1300 // fHistoTrueClusElectronPtvsConvPhotonTopMotherID[iCut]->Sumw2();
1301  fHistoDoubleCountTruePi0PtvsM02[iCut]->Sumw2();
1302  fHistoDoubleCountTrueSecPi0Pt[iCut]->Sumw2();
1305  fHistoDoubleCountTrueEtaPtvsM02[iCut]->Sumw2();
1306 
1307  if (GetSelectedMesonID() < 2){
1308  fHistoTrueClusPrimPi0PtvsM02[iCut]->Sumw2();
1309  fHistoTrueClusPrimPi0PtMCPt[iCut]->Sumw2();
1311  fHistoTruePartConvClusPrimPi0PtvsM02[iCut]->Sumw2();
1312  if (fDoMesonQA > 1){
1317 
1318  fHistoTrueClusNeutralContamination[iCut]->Sumw2();
1319  fHistoTrueClusPhotonContamination[iCut]->Sumw2();
1320  fHistoTrueClusElectronContamination[iCut]->Sumw2();
1321  fHistoTrueClusOtherContamination[iCut]->Sumw2();
1322  }
1323  fHistoTrueClusMultiplePrimPi0PtvsM02[iCut]->Sumw2();
1324  fHistoTrueClusSecPi0PtvsM02[iCut]->Sumw2();
1325  fHistoTrueClusSecPi0FromK0sPtvsM02[iCut]->Sumw2();
1326  fHistoTrueClusSecPi0FromK0lPtvsM02[iCut]->Sumw2();
1328  fHistoTrueSecPi0PtvsDiffReco[iCut]->Sumw2();
1329  }
1330 
1331  if (fDoMesonQA > 1){
1332  fHistoTrueClusMergedInvMassvsPt[iCut]->Sumw2();
1333  fHistoTrueClusPi0InvMassvsPt[iCut]->Sumw2();
1334  fHistoTrueClusEtaInvMassvsPt[iCut]->Sumw2();
1335  fHistoTrueClusBGInvMassvsPt[iCut]->Sumw2();
1336  fHistoTrueClusGammaInvMassvsPt[iCut]->Sumw2();
1337  fHistoTrueClusElectronInvMassvsPt[iCut]->Sumw2();
1338  if (GetSelectedMesonID() < 2){
1339  fHistoTrueClusPrimPi0InvMassvsPt[iCut]->Sumw2();
1340  }
1341  }
1342 
1343  if (fDoMesonQA > 0 ){
1344  if (GetSelectedMesonID() != 2){
1345  fHistoTruePi0PtY[iCut]->Sumw2();
1346  fHistoTruePi0PtAlpha[iCut]->Sumw2();
1347  fHistoTruePrimaryPi0MCPtResolPt[iCut]->Sumw2();
1352  fHistoTrueSecondaryPi0MCPtResolPt[iCut]->Sumw2();
1353  fHistoTrueClusPi0EM02[iCut]->Sumw2();
1354  fHistoTrueClusEtaEM02[iCut]->Sumw2();
1355  fHistoTrueClusGammaEM02[iCut]->Sumw2();
1356  fHistoTrueClusElectronEM02[iCut]->Sumw2();
1357  }
1358  if (GetSelectedMesonID() != 1){
1359  fHistoTrueEtaPtY[iCut]->Sumw2();
1360  fHistoTrueEtaPtAlpha[iCut]->Sumw2();
1361  fHistoTruePrimaryEtaMCPtResolPt[iCut]->Sumw2();
1362  }
1363  }
1364  }
1365  }
1366 
1367  }
1368 
1369  if(fV0Reader)
1370  if((AliConvEventCuts*)fV0Reader->GetEventCuts())
1371  if(((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetCutHistograms())
1372  fOutputContainer->Add(((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetCutHistograms());
1373 
1374  for(Int_t iMatcherTask = 0; iMatcherTask < 5; iMatcherTask++){
1375  AliCaloTrackMatcher* temp = 0x0;
1376  if(!fCorrTaskSetting.CompareTo("")){
1377  temp = (AliCaloTrackMatcher*) (AliAnalysisManager::GetAnalysisManager()->GetTask(Form("CaloTrackMatcher_%i_%i",iMatcherTask,fTrackMatcherRunningMode)));
1378  } else {
1379  temp = (AliCaloTrackMatcher*) (AliAnalysisManager::GetAnalysisManager()->GetTask(Form("CaloTrackMatcher_%i_%i_%s",iMatcherTask,fTrackMatcherRunningMode,fCorrTaskSetting.Data())));
1380  }
1381  if(temp) fOutputContainer->Add(temp->GetCaloTrackMatcherHistograms());
1382  }
1383 
1384 
1385  for(Int_t iCut = 0; iCut<fnCuts;iCut++){
1386  if(!((AliConvEventCuts*)fEventCutArray->At(iCut))) continue;
1387  if(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutHistograms()){
1388  fCutFolder[iCut]->Add(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutHistograms());
1389  }
1390  if(!((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))) continue;
1391  if(((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetCutHistograms()){
1392  fCutFolder[iCut]->Add(((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetCutHistograms());
1393  }
1394  if(!((AliCaloPhotonCuts*)fClusterMergedCutArray->At(iCut))) continue;
1395  if(((AliCaloPhotonCuts*)fClusterMergedCutArray->At(iCut))->GetCutHistograms()){
1396  fCutFolder[iCut]->Add(((AliCaloPhotonCuts*)fClusterMergedCutArray->At(iCut))->GetCutHistograms());
1397  }
1398 
1399  if(fSetPlotHistsExtQA){
1400  if(!((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))) continue;
1401  if(((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetExtQAHistograms()){
1402  fCutFolder[iCut]->Add(((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetExtQAHistograms());
1403  }
1404  }
1405  if(!((AliConversionMesonCuts*)fMesonCutArray->At(iCut))) continue;
1406  if(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutHistograms()){
1407  fCutFolder[iCut]->Add(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutHistograms());
1408  }
1409  }
1410 
1411  if (fIsMC > 0){
1412  tBrokenFiles = new TTree("BrokenFiles","BrokenFiles");
1413  tBrokenFiles->Branch("fileName",&fFileNameBroken);
1415  }
1416 
1417 
1418  PostData(1, fOutputContainer);
1419 }
1420 //_____________________________________________________________________________
1422 {
1423  for(Int_t iCut = 0; iCut<fnCuts;iCut++){
1424  if (((AliConvEventCuts*)fEventCutArray->At(iCut))->GetPeriodEnum() == AliConvEventCuts::kNoPeriod && ((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetPeriodEnum() != AliConvEventCuts::kNoPeriod){
1425  ((AliConvEventCuts*)fEventCutArray->At(iCut))->SetPeriodEnumExplicit(((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetPeriodEnum());
1426  } else if (((AliConvEventCuts*)fEventCutArray->At(iCut))->GetPeriodEnum() == AliConvEventCuts::kNoPeriod ){
1427  ((AliConvEventCuts*)fEventCutArray->At(iCut))->SetPeriodEnum(fV0Reader->GetPeriodName());
1428  }
1429 
1430  if(!((AliConvEventCuts*)fEventCutArray->At(iCut))->GetDoEtaShift()){
1431  fProfileEtaShift[iCut]->Fill(0.,(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift()));
1432  continue; // No Eta Shift requested, continue
1433  }
1434  if(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift() == 0.0){ // Eta Shift requested but not set, get shift automatically
1435  ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCorrectEtaShiftFromPeriod();
1436  fProfileEtaShift[iCut]->Fill(0.,(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift()));
1437  ((AliConvEventCuts*)fEventCutArray->At(iCut))->DoEtaShift(kFALSE); // Eta Shift Set, make sure that it is called only once
1438  continue;
1439  } else {
1440  printf(" Gamma Conversion Task %s :: Eta Shift Manually Set to %f \n\n",
1441  (((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber()).Data(),((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift());
1442  fProfileEtaShift[iCut]->Fill(0.,(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift()));
1443  ((AliConvEventCuts*)fEventCutArray->At(iCut))->DoEtaShift(kFALSE); // Eta Shift Set, make sure that it is called only once
1444  }
1445 
1446  // Check whether non linearity correction has been applied already
1447  Bool_t doNonLinCorr = kTRUE;
1448  if (((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetNonLinearity() == ((AliCaloPhotonCuts*)fClusterMergedCutArray->At(iCut))->GetNonLinearity()){
1449  doNonLinCorr = kFALSE;
1450  } else if (((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetNonLinearity() == 0 && ((AliCaloPhotonCuts*)fClusterMergedCutArray->At(iCut))->GetNonLinearity() > 0){
1451  doNonLinCorr = kTRUE;
1452  } else if (((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetNonLinearity() > 0 && ((AliCaloPhotonCuts*)fClusterMergedCutArray->At(iCut))->GetNonLinearity() == 0){
1453  doNonLinCorr = kTRUE;
1454  } else {
1455  doNonLinCorr = kFALSE;
1456  cout << "ERROR: something went wrong in the configuration, different non linearity corrections have been chosen in the standard and merged cluster, which are incompatible" << endl;
1457  cout << "INFO: switching off the non lin corr for merged cluster" << endl;
1458  }
1459  // check whether photon fullfill merged cluster cuts as well
1460  if (doNonLinCorr) ((AliCaloPhotonCuts*)fClusterMergedCutArray->At(fiCut))->SetUseNonLinearitySwitch(doNonLinCorr);
1461 
1462 
1463  }
1464  return kTRUE;
1465 }
1466 //_____________________________________________________________________________
1468 {
1469  //
1470  // Called for each event
1471  //
1472  fInputEvent = InputEvent();
1473 
1474  if(fIsMC> 0) fMCEvent = MCEvent();
1475 
1476  Int_t eventQuality = ((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetEventQuality();
1477  if(fInputEvent->IsIncompleteDAQ()==kTRUE) eventQuality = 2; // incomplete event
1478 
1479  // Event Not Accepted due to MC event missing or wrong trigger for V0ReaderV1 or because it is incomplete => abort processing of this file/event
1480  if(eventQuality == 2 || eventQuality == 3){
1481  // write out name of broken file for first event
1482  if (fIsMC > 0){
1483  if (fInputEvent->IsA()==AliESDEvent::Class()){
1484  if (((AliESDEvent*)fInputEvent)->GetEventNumberInFile() == 0){
1485  fFileNameBroken = new TObjString(Form("%s",((TString)fV0Reader->GetCurrentFileName()).Data()));
1486  if (tBrokenFiles) tBrokenFiles->Fill();
1487  delete fFileNameBroken;
1488  }
1489  }
1490  }
1491 
1492  for(Int_t iCut = 0; iCut<fnCuts; iCut++){
1493  fHistoNEvents[iCut]->Fill(eventQuality);
1494  if (fIsMC==2)
1495  fHistoNEventsWOWeight[iCut]->Fill(eventQuality);
1496  }
1497  return;
1498  }
1499 
1500  // ------------------- BeginEvent ----------------------------
1501 
1502  for(Int_t iCut = 0; iCut<fnCuts; iCut++){
1503  fiCut = iCut;
1504 
1505  Bool_t isRunningEMCALrelAna = kFALSE;
1506  if (((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->GetClusterType() == 1) isRunningEMCALrelAna = kTRUE;
1507 
1508  Int_t eventNotAccepted = ((AliConvEventCuts*)fEventCutArray->At(iCut))->IsEventAcceptedByCut(fV0Reader->GetEventCuts(),fInputEvent,fMCEvent,fIsHeavyIon, isRunningEMCALrelAna);
1509 
1510  fWeightJetJetMC = 1;
1511  // cout << fMCEvent << endl;
1512  Float_t maxjetpt = -1.;
1513  Float_t pthard = -1;
1514  if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetUseJetFinderForOutliers()) maxjetpt = fOutlierJetReader->GetMaxJetPt();
1515  Bool_t isMCJet = ((AliConvEventCuts*)fEventCutArray->At(iCut))->IsJetJetMCEventAccepted( fMCEvent, fWeightJetJetMC ,pthard, fInputEvent, maxjetpt);
1516  if (!isMCJet){
1517  fHistoNEvents[iCut]->Fill(10,fWeightJetJetMC);
1518  if (fIsMC==2) fHistoNEventsWOWeight[iCut]->Fill(10);
1519  continue;
1520  }
1521 
1522  if(fIsMC==2){
1523  Float_t xsection = -1.; Float_t ntrials = -1.;
1524  ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetXSectionAndNTrials(fMCEvent,xsection,ntrials,fInputEvent);
1525  if((xsection==-1.) || (ntrials==-1.)) AliFatal(Form("ERROR: GetXSectionAndNTrials returned invalid xsection/ntrials, periodName from V0Reader: '%s'",fV0Reader->GetPeriodName().Data()));
1526  fProfileJetJetXSection[iCut]->Fill(0.,xsection);
1527  fHistoJetJetNTrials[iCut]->Fill("#sum{NTrials}",ntrials);
1528  }
1529 
1530  Bool_t triggered = kTRUE;
1531  if(eventNotAccepted!= 0){
1532  fHistoNEvents[iCut]->Fill(eventNotAccepted, fWeightJetJetMC); // Check Centrality, PileUp, SDD and V0AND --> Not Accepted => eventQuality = 1
1533  if (fIsMC>1) fHistoNEventsWOWeight[iCut]->Fill(eventNotAccepted);
1534  // cout << "event rejected due to wrong trigger: " <<eventNotAccepted << endl;
1535  if (eventNotAccepted==3 && fIsMC > 0){
1536  triggered = kFALSE;
1537  }else {
1538  continue;
1539  }
1540  }
1541 
1542  if(eventQuality != 0 && triggered== kTRUE){// Event Not Accepted
1543  //cout << "event rejected due to: " <<eventQuality << endl;
1544  fHistoNEvents[iCut]->Fill(eventQuality, fWeightJetJetMC);
1545  if (fIsMC==2) fHistoNEventsWOWeight[iCut]->Fill(eventQuality);
1546 
1547  continue;
1548  }
1549 
1550  // reject events if there are more overlaps of pi0 in R<0.05 than allowed
1551  if(fIsMC> 0 && NumberOfMCEventNeutralPionOverlapInEMCal(fMCEvent)){
1552  fHistoNEvents[iCut]->Fill(3, fWeightJetJetMC);
1553  if (fIsMC==2) fHistoNEventsWOWeight[iCut]->Fill(3);
1554  continue;
1555  }
1556 
1557  if (triggered == kTRUE) {
1558  fHistoNEvents[iCut]->Fill(eventQuality, fWeightJetJetMC); // Should be 0 here
1559  if (fIsMC==2) fHistoNEventsWOWeight[iCut]->Fill(eventQuality); // Should be 0 here
1560 
1561  fHistoNGoodESDTracks[iCut]->Fill( fV0Reader->GetNumberOfPrimaryTracks(),
1562  fWeightJetJetMC);
1563  fHistoVertexZ[iCut]->Fill( fInputEvent->GetPrimaryVertex()->GetZ(),
1564  fWeightJetJetMC);
1565  fHistoSPDClusterTrackletBackground[iCut]->Fill( fInputEvent->GetMultiplicity()->GetNumberOfTracklets(),
1566  (fInputEvent->GetNumberOfITSClusters(0)+fInputEvent->GetNumberOfITSClusters(1)),
1567  fWeightJetJetMC);
1568  if(((AliConvEventCuts*)fEventCutArray->At(iCut))->IsHeavyIon() == 2)
1569  fHistoNV0Tracks[iCut]->Fill(fInputEvent->GetVZEROData()->GetMTotV0A(),
1570  fWeightJetJetMC);
1571  else
1572  fHistoNV0Tracks[iCut]->Fill(fInputEvent->GetVZEROData()->GetMTotV0A()+fInputEvent->GetVZEROData()->GetMTotV0C(),
1573  fWeightJetJetMC);
1574  }
1575  if(fIsMC> 0){
1576  // Process MC Particle
1577  if(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetSignalRejection() != 0){
1578  if(fInputEvent->IsA()==AliESDEvent::Class()){
1579  ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetNotRejectedParticles(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetSignalRejection(),
1580  ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetAcceptedHeader(),
1581  fMCEvent);
1582  }
1583  else if(fInputEvent->IsA()==AliAODEvent::Class()){
1584  ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetNotRejectedParticles(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetSignalRejection(),
1585  ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetAcceptedHeader(),
1586  fInputEvent);
1587  }
1588 
1589  if(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetAcceptedHeader()){
1590  for(Int_t i = 0;i<(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetAcceptedHeader())->GetEntries();i++){
1591  TString nameBin= fHistoMCHeaders[iCut]->GetXaxis()->GetBinLabel(i+1);
1592  if (nameBin.CompareTo("")== 0){
1593  TString nameHeader = ((TObjString*)((TList*)((AliConvEventCuts*)fEventCutArray->At(iCut))
1594  ->GetAcceptedHeader())->At(i))->GetString();
1595  fHistoMCHeaders[iCut]->GetXaxis()->SetBinLabel(i+1,nameHeader.Data());
1596  }
1597  }
1598  }
1599  }
1600  }
1601  if(fIsMC>0){
1602  // ProcessNeutralOverlapsMC(fMCEvent);
1603  // create new vector that only contains those pi0s that would be lost due to overlap in the clusters
1604  if(fVectorLabelsLeadingPi0.size() > 0){
1605  for (std::vector<Int_t>::const_iterator i = fVectorLabelsMultiplePi0.begin(); i != fVectorLabelsMultiplePi0.end(); ++i){
1606  // check that the labels from fVectorLabelsMultiplePi0 are not contained in fVectorLabelsLeadingPi0 and fill fVectorLabelsMultiplePi0Reduced
1608  }
1609  }
1610 
1611  if(fInputEvent->IsA()==AliESDEvent::Class())
1613  if(fInputEvent->IsA()==AliAODEvent::Class())
1615  }
1616 
1617  if (triggered==kFALSE) continue;
1618 
1619  // 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)
1620  ProcessClusters(); // process calo clusters
1621 
1622 
1623 
1625  fWeightJetJetMC);
1627  fWeightJetJetMC);
1628 
1629  fHistoNGoodESDTracksVsNClusterCandidates[iCut]->Fill( fV0Reader->GetNumberOfPrimaryTracks(),
1631  fWeightJetJetMC);
1632 
1633  fVectorLabelsLeadingPi0.clear();
1634  fVectorLabelsMultiplePi0.clear();
1639 
1640  }
1641 
1642  PostData(1, fOutputContainer);
1643 }
1644 
1645 //________________________________________________________________________
1647 
1648  Int_t nclus = 0;
1649  TClonesArray * arrClustersProcess = NULL;
1650  if(!fCorrTaskSetting.CompareTo("")){
1651  nclus = fInputEvent->GetNumberOfCaloClusters();
1652  } else {
1653  arrClustersProcess = dynamic_cast<TClonesArray*>(fInputEvent->FindListObject(Form("%sClustersBranch",fCorrTaskSetting.Data())));
1654  if(!arrClustersProcess)
1655  AliFatal(Form("%sClustersBranch was not found in AliAnalysisTaskGammaCaloMerged! Check the correction framework settings!",fCorrTaskSetting.Data()));
1656  nclus = arrClustersProcess->GetEntries();
1657  }
1658 
1659  if(nclus == 0) return;
1660 
1661  fNClusterCandidates = 0;
1663 
1664  // plotting histograms on cell/tower level, only if extendedMatchAndQA > 1
1665  ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->FillHistogramsExtendedQA(fInputEvent,fIsMC);
1666 
1667  // match tracks to clusters
1668  ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->MatchTracksToClusters(fInputEvent, fWeightJetJetMC, kTRUE, fMCEvent);
1669  // match tracks to clusters also for mergedCutArray
1670  ((AliCaloPhotonCuts*)fClusterMergedCutArray->At(fiCut))->MatchTracksToClusters(fInputEvent, fWeightJetJetMC, kTRUE, fMCEvent);
1671 
1672  // vertex
1673  Double_t vertex[3] = {0};
1674  InputEvent()->GetPrimaryVertex()->GetXYZ(vertex);
1675 
1676  // Loop over EMCal clusters
1677  for(Long_t i = 0; i < nclus; i++){
1678 
1679  Double_t tempClusterWeight = fWeightJetJetMC;
1680  Double_t tempPhotonWeight = fWeightJetJetMC;
1681  // select clusters with open cuts for normalizations histos
1682  AliVCluster* clus = NULL;
1683  if(fInputEvent->IsA()==AliESDEvent::Class()){
1684  if(arrClustersProcess)
1685  clus = new AliESDCaloCluster(*(AliESDCaloCluster*)arrClustersProcess->At(i));
1686  else
1687  clus = new AliESDCaloCluster(*(AliESDCaloCluster*)fInputEvent->GetCaloCluster(i));
1688  } else if(fInputEvent->IsA()==AliAODEvent::Class()){
1689  if(arrClustersProcess)
1690  clus = new AliAODCaloCluster(*(AliAODCaloCluster*)arrClustersProcess->At(i));
1691  else
1692  clus = new AliAODCaloCluster(*(AliAODCaloCluster*)fInputEvent->GetCaloCluster(i));
1693  }
1694 
1695  if (!clus) continue;
1696 
1697 
1698 
1699  // Set the jetjet weight to 1 in case the cluster orignated from the minimum bias header
1700  if (fIsMC>0 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() == 4){
1701  if( ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(clus->GetLabelAt(0), fMCEvent, fInputEvent) == 2)
1702  tempClusterWeight = 1;
1703  }
1704 
1705  // if open cluster cuts are not fullfilled I can abort
1706  if(!((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelected(clus,fInputEvent,fMCEvent,fIsMC,tempClusterWeight, i)){
1707  delete clus;
1708  continue;
1709  }
1710 
1711 
1712  // TLorentzvector with cluster
1713  TLorentzVector clusterVector;
1714  clus->GetMomentum(clusterVector,vertex);
1715 
1716  TLorentzVector* tmpvec = new TLorentzVector();
1717  tmpvec->SetPxPyPzE(clusterVector.Px(),clusterVector.Py(),clusterVector.Pz(),clusterVector.E());
1718 
1719  // convert to AODConversionPhoton
1720  AliAODConversionPhoton *PhotonCandidate=new AliAODConversionPhoton(tmpvec);
1721  if(!PhotonCandidate){
1722  delete clus;
1723  delete tmpvec;
1724  continue;
1725  }
1726 
1727  // Flag Photon as CaloPhoton
1728  PhotonCandidate->SetIsCaloPhoton(((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->GetClusterType());
1729  PhotonCandidate->SetCaloClusterRef(i);
1730 
1731  // get MC label
1732  if(fIsMC> 0){
1733  Int_t* mclabelsCluster = clus->GetLabels();
1734  // cout << "cluster: " << i << endl;
1735  Int_t nValidClusters = 0;
1736 
1737  if (clus->GetNLabels()>0){
1738  for (Int_t k =0; k< (Int_t)clus->GetNLabels(); k++){
1739  // TParticle *dummy = NULL;
1740  if (mclabelsCluster[k]>0){
1741  // dummy = fMCEvent->Particle(mclabelsCluster[k]);
1742  // if (dummy->R() < 407.0){
1743  if (nValidClusters< 50)PhotonCandidate->SetCaloPhotonMCLabel(nValidClusters,mclabelsCluster[k]);
1744  nValidClusters++;
1745  // }
1746  }
1747  }
1748  }
1749  PhotonCandidate->SetNCaloPhotonMCLabels(nValidClusters);
1750 
1751  }
1752 
1753  fIsFromMBHeader = kTRUE;
1755 
1756  // test whether largest contribution to cluster orginates in added signals
1757  if (fIsMC>0 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() > 0){
1758  // Set the jetjet weight to 1 in case the photon candidate orignated from the minimum bias header
1759  if ( ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(PhotonCandidate->GetCaloPhotonMCLabel(0), fMCEvent, fInputEvent) == 2 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() == 4) tempPhotonWeight = 1;
1760  if ( ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(PhotonCandidate->GetCaloPhotonMCLabel(0), fMCEvent, fInputEvent) == 0) fIsFromMBHeader = kFALSE;
1761  if (clus->GetNLabels()>1){
1762  Int_t* mclabelsCluster = clus->GetLabels();
1763  for (Int_t l = 1; l < (Int_t)clus->GetNLabels(); l++ ){
1764  if (((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(mclabelsCluster[l], fMCEvent, fInputEvent) == 0) fIsOverlappingWithOtherHeader = kTRUE;
1765  }
1766  }
1767  }
1768 
1769  // check whether photon is from correct header
1771  fHistoClusOverlapHeadersGammaPt[fiCut]->Fill(PhotonCandidate->Pt(), tempPhotonWeight);
1772  }
1773  // only cluster candidates from correct header will be processed fully
1775  fHistoClusGammaPt[fiCut]->Fill(PhotonCandidate->Pt(), tempPhotonWeight);
1776  fHistoClusGammaE[fiCut]->Fill(PhotonCandidate->E(), tempPhotonWeight);
1777  if (fDoClusterQA > 0){
1778  fHistoClusNCellsPt[fiCut]->Fill(clus->GetNCells(), PhotonCandidate->Pt(), tempPhotonWeight);
1779  }
1781  } else {
1782  delete clus;
1783  delete tmpvec;
1784  delete PhotonCandidate;
1785  continue;
1786  }
1787 
1788  if(!((AliCaloPhotonCuts*)fClusterMergedCutArray->At(fiCut))->ClusterIsSelected(clus,fInputEvent,fMCEvent,fIsMC,tempPhotonWeight,i)){
1789  delete clus;
1790  delete tmpvec;
1791  delete PhotonCandidate;
1792  continue;
1793  }else {
1795  }
1796 
1797  AliAODCaloCluster* clusSub1 = new AliAODCaloCluster();
1798  AliAODCaloCluster* clusSub2 = new AliAODCaloCluster();
1799 
1800 
1801  // split clusters according to their shares in the cluster (NLM == 1) needs to be treated differently
1802  if (((AliCaloPhotonCuts*)fClusterMergedCutArray->At(fiCut))->GetMinNLMCut() == 1 &&
1803  ((AliCaloPhotonCuts*)fClusterMergedCutArray->At(fiCut))->GetMaxNLMCut() == 1 ){
1804 
1805  Int_t absCellIdFirst = ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->FindLargestCellInCluster(clus, fInputEvent);
1806  Int_t absCellIdSecond = ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->FindSecondLargestCellInCluster(clus, fInputEvent);
1807 
1808  ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->SplitEnergy(absCellIdFirst, absCellIdSecond,
1809  clus, fInputEvent, fIsMC, clusSub1, clusSub2);
1810 
1811 
1812  } else if (((AliCaloPhotonCuts*)fClusterMergedCutArray->At(fiCut))->GetMinNLMCut() > 1 ){
1813  const Int_t nc = clus->GetNCells();
1814  Int_t absCellIdList[nc];
1815  //Float_t maxEList[nc];
1816  //Int_t nlm = ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->GetNumberOfLocalMaxima(clus, fInputEvent, absCellIdList, maxEList);
1817  ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->SplitEnergy(absCellIdList[0], absCellIdList[1],
1818  clus, fInputEvent, fIsMC, clusSub1, clusSub2);
1819  }
1820  fHistoClusMergedPtvsM02[fiCut]->Fill( PhotonCandidate->Pt(),
1821  clus->GetM02(),
1822  tempPhotonWeight);
1823 
1824  // TLorentzvector with sub cluster 1
1825  TLorentzVector clusterVector1;
1826  clusSub1->GetMomentum(clusterVector1,vertex);
1827  TLorentzVector* tmpvec1 = new TLorentzVector();
1828  tmpvec1->SetPxPyPzE(clusterVector1.Px(),clusterVector1.Py(),clusterVector1.Pz(),clusterVector1.E());
1829  // convert to AODConversionPhoton
1830  AliAODConversionPhoton *PhotonCandidate1=new AliAODConversionPhoton(tmpvec1);
1831  if(!PhotonCandidate1){
1832  delete clusSub1;
1833  delete tmpvec1;
1834  continue;
1835  }
1836  // Flag Photon as CaloPhoton
1837  PhotonCandidate1->SetIsCaloPhoton(((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->GetClusterType());
1838 
1839  // TLorentzvector with sub cluster 2
1840  TLorentzVector clusterVector2;
1841  clusSub2->GetMomentum(clusterVector2,vertex);
1842  TLorentzVector* tmpvec2 = new TLorentzVector();
1843  tmpvec2->SetPxPyPzE(clusterVector2.Px(),clusterVector2.Py(),clusterVector2.Pz(),clusterVector2.E());
1844  // convert to AODConversionPhoton
1845  AliAODConversionPhoton *PhotonCandidate2=new AliAODConversionPhoton(tmpvec2);
1846  if(!PhotonCandidate2){
1847  delete clusSub2;
1848  delete tmpvec2;
1849  continue;
1850  }
1851  // Flag Photon as CaloPhoton
1852  PhotonCandidate1->SetIsCaloPhoton(((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->GetClusterType());
1853  // create pi0 candidate
1854  AliAODConversionMother *pi0cand = new AliAODConversionMother(PhotonCandidate1,PhotonCandidate2);
1855 
1856  if((((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->MesonIsSelected(pi0cand,kTRUE,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift()))){
1857  fHistoMotherInvMassPt[fiCut]->Fill(pi0cand->M(),PhotonCandidate->Pt(), tempPhotonWeight);
1858  fHistoClusMergedPtvsM02Accepted[fiCut]->Fill( PhotonCandidate->Pt(), clus->GetM02(), tempPhotonWeight);
1859  fHistoClusMergedEvsM02Accepted[fiCut]->Fill( PhotonCandidate->E(), clus->GetM02(), tempPhotonWeight);
1860  Int_t nlm = ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->GetNumberOfLocalMaxima(clus, fInputEvent);
1861  if ( nlm < 11 ){
1862  fHistoClusNLMPt[fiCut]->Fill( nlm, PhotonCandidate->Pt());
1863  } else {
1864  fHistoClusNLMPt[fiCut]->Fill( 11., PhotonCandidate->Pt());
1865  }
1866 
1867  if (fDoClusterQA > 0){
1868  fHistoClusMergedNCellsPt[fiCut]->Fill(clus->GetNCells(), PhotonCandidate->Pt(), tempPhotonWeight);
1869  Double_t energyAround = 0;
1870  Double_t nCellsAround = 0;
1871  for (Int_t j = 0; j < nclus; j++){
1872  if (j == i) continue;
1873  AliVCluster* clusTemp = NULL;
1874  if(fInputEvent->IsA()==AliESDEvent::Class()){
1875  if(arrClustersProcess)
1876  clusTemp = new AliESDCaloCluster(*(AliESDCaloCluster*)arrClustersProcess->At(j));
1877  else
1878  clusTemp = new AliESDCaloCluster(*(AliESDCaloCluster*)fInputEvent->GetCaloCluster(j));
1879  } else if(fInputEvent->IsA()==AliAODEvent::Class()){
1880  if(arrClustersProcess)
1881  clusTemp = new AliAODCaloCluster(*(AliAODCaloCluster*)arrClustersProcess->At(j));
1882  else
1883  clusTemp = new AliAODCaloCluster(*(AliAODCaloCluster*)fInputEvent->GetCaloCluster(j));
1884  }
1885 
1886  if (!clusTemp) continue;
1887 
1888  Double_t R = ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->GetDistanceBetweenClusters(clus, clusTemp);
1889 
1890  if (R < 0.15){
1891  nCellsAround = nCellsAround+clusTemp->GetNCells();
1892  energyAround = energyAround+clusTemp->E();
1893  }
1894  delete clusTemp;
1895  }
1896  fHistoClusMergedNCellsAroundPt[fiCut]->Fill(nCellsAround, PhotonCandidate->Pt(), tempPhotonWeight);
1897  fHistoClusMergedNCellsAroundAndInPt[fiCut]->Fill(nCellsAround+clus->GetNCells(), PhotonCandidate->Pt(), tempPhotonWeight);
1898  fHistoClusMergedEAroundE[fiCut]->Fill(energyAround, clus->E(), tempPhotonWeight);
1899  if (fIsMC > 0){
1900  fHistoClusMergedNParticlePt[fiCut]->Fill(clus->GetNLabels(), PhotonCandidate->Pt(), tempPhotonWeight);
1901  }
1902  }
1903  if (fDoMesonQA > 0 ){
1904  fHistoMotherPtY[fiCut]->Fill(PhotonCandidate->Pt(),pi0cand->Rapidity()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift(), tempPhotonWeight);
1905  fHistoMotherPtAlpha[fiCut]->Fill(PhotonCandidate->Pt(),TMath::Abs(pi0cand->GetAlpha()), tempPhotonWeight);
1906  }
1907  if(fIsMC> 0 && PhotonCandidate && PhotonCandidate1 && PhotonCandidate2){
1908 
1909  // PrintFractionsOfMCLabels(clus,fInputEvent,fMCEvent);
1910 
1911  if(fInputEvent->IsA()==AliESDEvent::Class())
1912  ProcessTrueClusterCandidates(PhotonCandidate, clus, PhotonCandidate1, PhotonCandidate2);
1913  if(fInputEvent->IsA()==AliAODEvent::Class())
1914  ProcessTrueClusterCandidatesAOD(PhotonCandidate, clus, PhotonCandidate1, PhotonCandidate2);
1915  }
1916  } // meson is selected
1917 
1918 
1919 
1920  delete pi0cand;
1921  delete clusSub1;
1922  delete tmpvec1;
1923  delete PhotonCandidate1;
1924  delete clusSub2;
1925  delete tmpvec2;
1926  delete PhotonCandidate2;
1927 
1928  delete clus;
1929  delete tmpvec;
1930  delete PhotonCandidate;
1931  } // cluster loop
1932 }
1933 
1934 //________________________________________________________________________
1935 void AliAnalysisTaskGammaCaloMerged::ProcessTrueClusterCandidates(AliAODConversionPhoton *TrueClusterCandidate, AliVCluster* cluster,
1936  AliAODConversionPhoton *TrueSubClusterCandidate1,
1937  AliAODConversionPhoton *TrueSubClusterCandidate2)
1938 {
1939  Float_t m02 = cluster->GetM02();
1940  const AliVVertex* primVtxMC = fMCEvent->GetPrimaryVertex();
1941  Double_t mcProdVtxX = primVtxMC->GetX();
1942  Double_t mcProdVtxY = primVtxMC->GetY();
1943  Double_t mcProdVtxZ = primVtxMC->GetZ();
1944 
1945  Double_t tempClusterWeight = fWeightJetJetMC;
1946  TParticle *Photon = NULL;
1947  if (TrueClusterCandidate->GetIsCaloPhoton() == 0) AliFatal("CaloPhotonFlag has not been set task will abort");
1948  if (TrueClusterCandidate->GetCaloPhotonMCLabel(0) < 0) return;
1949 
1950  AliAODConversionMother *mesoncand = new AliAODConversionMother(TrueSubClusterCandidate1,TrueSubClusterCandidate2);
1951  Bool_t mesonIsSelected = (((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->MesonIsSelected(mesoncand,kTRUE,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift()));
1952  if (!mesonIsSelected){
1953  delete mesoncand;
1954  return;
1955  }
1956 
1957  // Setting all MC Flags (IsMerged, etc)
1958  TrueClusterCandidate->SetCaloPhotonMCFlags(fMCEvent, fEnableSortForClusMC, kTRUE,cluster);
1959 
1960  if (TrueClusterCandidate->GetNCaloPhotonMCLabels()>0 && fEnableDetailedPrintOut){
1961  cout << endl << endl << "Cluster energy: " << TrueClusterCandidate->E() << endl;;
1962  TrueClusterCandidate->PrintCaloMCLabelsAndInfo(fMCEvent);
1963  TrueClusterCandidate->PrintCaloMCFlags();
1964  }
1965 
1966 
1967  if (TrueClusterCandidate->GetNCaloPhotonMCLabels()>0){
1968  fHistoTrueClusEFracFirstLabel[fiCut]->Fill(cluster->E(), cluster->GetClusterMCEdepFraction(0), tempClusterWeight);
1969  if(TrueClusterCandidate->GetNNeutralPionMCLabels()>0)
1970  fHistoTrueClusEFracLeadingPi0[fiCut]->Fill(cluster->E(), TrueClusterCandidate->GetNeutralPionEnergyFraction(TrueClusterCandidate->GetLeadingNeutralPionIndex()), tempClusterWeight);
1971  // check if leading pi0 comes not from label 0 in cluster
1972  // for this do:
1973  // -> check if neutral pions were found in cluster
1974  // -> if the leading daughter index is not 0
1975  // -> the leading neutral pion has a larger cluster energy fraction than the cluster label 0
1976  if( TrueClusterCandidate->GetNNeutralPionMCLabels()>0 && TrueClusterCandidate->GetLeadingNeutralPionDaughterIndex()!=0 && TrueClusterCandidate->GetNeutralPionEnergyFraction(TrueClusterCandidate->GetLeadingNeutralPionIndex())>cluster->GetClusterMCEdepFraction(0)) {
1977  // load particle corresponding to largest daughter of leading pi0
1978  Photon = fMCEvent->Particle(TrueClusterCandidate->GetCaloPhotonMCLabel(TrueClusterCandidate->GetLeadingNeutralPionDaughterIndex()));
1979  // fill vector with leading pi0 MC label
1980  CheckVectorForDoubleCount(fVectorLabelsLeadingPi0,TrueClusterCandidate->GetNeutralPionMCLabel(TrueClusterCandidate->GetLeadingNeutralPionIndex()));
1981  // fill vector will ALL pi0 MC labels that are found in the cluster
1982  for(Int_t npion = 0; npion < TrueClusterCandidate->GetNNeutralPionMCLabels(); npion++){
1983  CheckVectorForDoubleCount(fVectorLabelsMultiplePi0,TrueClusterCandidate->GetNeutralPionMCLabel(npion));
1984  }
1985  } else {
1986  // load particle corresponding to MC label 0 in cluster
1987  Photon = fMCEvent->Particle(TrueClusterCandidate->GetCaloPhotonMCLabel(0));
1988  // important check that leading daughter corresponds to the cluster MC label 0
1989  if(TrueClusterCandidate->GetLeadingNeutralPionDaughterIndex()==0){
1990  // fill vector with leading pi0 MC label
1991  CheckVectorForDoubleCount(fVectorLabelsLeadingPi0,TrueClusterCandidate->GetNeutralPionMCLabel(TrueClusterCandidate->GetLeadingNeutralPionIndex()));
1992  // fill vector will ALL pi0 MC labels that are found in the cluster
1993  for(Int_t npion = 0; npion < TrueClusterCandidate->GetNNeutralPionMCLabels(); npion++){
1994  CheckVectorForDoubleCount(fVectorLabelsMultiplePi0,TrueClusterCandidate->GetNeutralPionMCLabel(npion));
1995  }
1996  }
1997  }
1998  } else {
1999  // return if there are no MC labels in the cluster
2000  return;
2001  }
2002 
2003  if(Photon == NULL){
2004  return;
2005  }
2006  Int_t pdgCodeParticle = Photon->GetPdgCode();
2007 
2009  Int_t clusterClass = 0;
2010  Bool_t isPrimary = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryESD( fMCEvent, TrueClusterCandidate->GetCaloPhotonMCLabel(0), mcProdVtxX, mcProdVtxY, mcProdVtxZ);
2011 
2012  // cluster classification:
2013  // 1 - nice merged cluster (2 gamma | contributions from 2 gamma) from pi0/eta
2014  // 2 - contribution from only 1 partner (1 gamma, 1 fully coverted gamma) from pi0/eta
2015  // 3 - contribution from part of 1 partner (1 electron) from pi0/eta
2016  Long_t motherLab = -1;
2017  if (TrueClusterCandidate->IsMerged() || TrueClusterCandidate->IsMergedPartConv()){
2018  clusterClass = 1;
2019  motherLab = TrueClusterCandidate->GetCaloPhotonMotherMCLabel(0);
2020  } else if (TrueClusterCandidate->GetNCaloPhotonMotherMCLabels()> 0){
2021  // cout << TrueClusterCandidate->GetCaloPhotonMotherMCLabel(0) << endl;
2022  if (TrueClusterCandidate->IsLargestComponentElectron() || TrueClusterCandidate->IsLargestComponentPhoton()){
2023  if (TrueClusterCandidate->GetCaloPhotonMotherMCLabel(0) > -1 && (fMCEvent->Particle(TrueClusterCandidate->GetCaloPhotonMotherMCLabel(0))->GetPdgCode() == 111 || fMCEvent->Particle(TrueClusterCandidate->GetCaloPhotonMotherMCLabel(0))->GetPdgCode() == 221) ){
2024  if ( TrueClusterCandidate->IsConversion() && !TrueClusterCandidate->IsConversionFullyContained() ){
2025  clusterClass = 3;
2026  motherLab = TrueClusterCandidate->GetCaloPhotonMotherMCLabel(0);
2027  } else {
2028  clusterClass = 2;
2029  motherLab = TrueClusterCandidate->GetCaloPhotonMotherMCLabel(0);
2030  }
2031  }
2032  } else if (TrueClusterCandidate->IsSubLeadingEM()){
2033  if (TrueClusterCandidate->GetNCaloPhotonMotherMCLabels()> 1){
2034  if (fEnableDetailedPrintOut) cout << "Is Subleading EM: "<< TrueClusterCandidate->GetCaloPhotonMotherMCLabel(1) << endl;
2035  if ( TrueClusterCandidate->GetCaloPhotonMotherMCLabel(1) > -1){
2036  if (fMCEvent->Particle(TrueClusterCandidate->GetCaloPhotonMotherMCLabel(1))->GetPdgCode() == 111 || fMCEvent->Particle(TrueClusterCandidate->GetCaloPhotonMotherMCLabel(1))->GetPdgCode() == 221 ){
2037  clusterClass = 2;
2038  motherLab = TrueClusterCandidate->GetCaloPhotonMotherMCLabel(1);
2039  }
2040  }
2041  }
2042  } else {
2043  motherLab = TrueClusterCandidate->GetCaloPhotonMotherMCLabel(0);
2044  }
2045  }
2046 
2047  // Get Mother particle
2048  TParticle *mother = NULL;
2049  Int_t motherPDG = -1;
2050  if (motherLab > -1){
2051  mother = fMCEvent->Particle(motherLab);
2052  }
2053  if (fEnableDetailedPrintOut) cout << "cluster class: " << clusterClass << "\t mother lab: "<< motherLab ;
2054  if (mother){
2055  motherPDG = TMath::Abs(mother->GetPdgCode());
2056  if (fEnableDetailedPrintOut) cout << "\t mother pdg: " << motherPDG << endl;
2057  } else {
2058  if (fEnableDetailedPrintOut) cout << endl;
2059  }
2060  // Set the jetjet weight to 1 in case the photon orignated from the minimum bias header
2061  if (fIsMC>0 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() == 4){
2062  if ( ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(motherLab, fMCEvent, fInputEvent) == 2) tempClusterWeight = 1;
2063  }
2064 
2065  //
2066  if (clusterClass == 1 || clusterClass == 2 || clusterClass == 3 ){
2067  fHistoTrueClusMergedPtvsM02[fiCut]->Fill(TrueClusterCandidate->Pt(), m02, tempClusterWeight);
2068  if (fDoMesonQA > 1)fHistoTrueClusMergedInvMassvsPt[fiCut]->Fill(mesoncand->M(),TrueClusterCandidate->Pt(), tempClusterWeight);
2069 
2070  // separate different components
2071  if (clusterClass == 1 && TrueClusterCandidate->IsMerged()){
2072  if (motherPDG == 111){
2073  fHistoTrueClusMergedPureFromPi0PtvsM02[fiCut]->Fill(TrueClusterCandidate->Pt(), m02, tempClusterWeight);
2074  if (GetSelectedMesonID() < 2 && !isPrimary && m02 >= 0 && m02 <= 4.8 ){
2075  fHistoTrueSecPi0PtvsDiffReco[fiCut]->Fill(TrueClusterCandidate->Pt(), 0., tempClusterWeight);
2076  }
2077  }
2078  if (motherPDG == 221)
2079  fHistoTrueClusMergedPureFromEtaPtvsM02[fiCut]->Fill(TrueClusterCandidate->Pt(), m02, tempClusterWeight);
2080  } else if (clusterClass == 1 && TrueClusterCandidate->IsMergedPartConv()){
2081  if (motherPDG == 111){
2082  fHistoTrueClusMergedPartConvFromPi0PtvsM02[fiCut]->Fill(TrueClusterCandidate->Pt(), m02, tempClusterWeight);
2083  if (GetSelectedMesonID() < 2 && !isPrimary && m02 >= 0 && m02 <= 4.8 ){
2084  fHistoTrueSecPi0PtvsDiffReco[fiCut]->Fill(TrueClusterCandidate->Pt(), 1., tempClusterWeight);
2085  }
2086  }
2087  if (motherPDG == 221)
2088  fHistoTrueClusMergedPartConvFromEtaPtvsM02[fiCut]->Fill(TrueClusterCandidate->Pt(), m02, tempClusterWeight);
2089  } else if (clusterClass == 2){
2090  if (motherPDG == 111){
2091  fHistoTrueClusGammaFromPi0PtvsM02[fiCut]->Fill(TrueClusterCandidate->Pt(), m02, tempClusterWeight);
2092  if (GetSelectedMesonID() < 2 && !isPrimary && m02 >= 0 && m02 <= 4.8 ){
2093  fHistoTrueSecPi0PtvsDiffReco[fiCut]->Fill(TrueClusterCandidate->Pt(), 2., tempClusterWeight);
2094  }
2095  }if (motherPDG == 221)
2096  fHistoTrueClusGammaFromEtaPtvsM02[fiCut]->Fill(TrueClusterCandidate->Pt(), m02, tempClusterWeight);
2097  } else if (clusterClass == 3){
2098  if (motherPDG == 111) {
2099  fHistoTrueClusElectronFromPi0PtvsM02[fiCut]->Fill(TrueClusterCandidate->Pt(), m02, tempClusterWeight);
2100  if (GetSelectedMesonID() < 2 && !isPrimary && m02 >= 0 && m02 <= 4.8 ){
2101  fHistoTrueSecPi0PtvsDiffReco[fiCut]->Fill(TrueClusterCandidate->Pt(), 3., tempClusterWeight);
2102  }
2103  }
2104  if (motherPDG == 221)
2105  fHistoTrueClusElectronFromEtaPtvsM02[fiCut]->Fill(TrueClusterCandidate->Pt(), m02, tempClusterWeight);
2106  }
2107 
2108  // deal with pi0 only
2109  if (motherPDG == 111){
2110  fHistoTrueClusPi0PtvsM02[fiCut]->Fill(TrueClusterCandidate->Pt(), m02, tempClusterWeight);
2112  fHistoDoubleCountTruePi0PtvsM02[fiCut]->Fill(TrueClusterCandidate->Pt(), m02, tempClusterWeight);
2113  if (!isPrimary)
2114  fHistoDoubleCountTrueSecPi0Pt[fiCut]->Fill(TrueClusterCandidate->Pt(), tempClusterWeight);
2115  }
2116 
2117  // Treatment of multiple pi0 in cluster (filling of true candidates, amount of pions and double counting)
2118  if(TrueClusterCandidate->GetNNeutralPionMCLabels()>1){
2119  for(Int_t npion = 0; npion < TrueClusterCandidate->GetNNeutralPionMCLabels(); npion++){
2120  // fill multiple true pions in same cluster
2121  if(npion>0) fHistoTrueClusMultiplePi0PtvsM02[fiCut]->Fill(TrueClusterCandidate->Pt(), m02, tempClusterWeight);
2122 
2123  // check MC labels for double counting (each particle should only be reconstructed once)
2124  if (CheckVectorForDoubleCount(fVectorDoubleCountTrueMultilePi0s,TrueClusterCandidate->GetNeutralPionMCLabel(npion))){
2125  fHistoDoubleCountTrueMultiplePi0PtvsM02[fiCut]->Fill(TrueClusterCandidate->Pt(), m02, tempClusterWeight);
2126 
2127  // check if particle is not a primary -> secondary particle
2128  if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryESD( fMCEvent, TrueClusterCandidate->GetNeutralPionMCLabel(npion), mcProdVtxX, mcProdVtxY, mcProdVtxZ)) // check if pion is primary
2129  fHistoDoubleCountTrueMultipleSecPi0Pt[fiCut]->Fill(TrueClusterCandidate->Pt(), tempClusterWeight);
2130  }
2131  }
2132  }
2133  fHistoNTrueMultiplePi0vsPt[fiCut]->Fill(TrueClusterCandidate->Pt(),TrueClusterCandidate->GetNNeutralPionMCLabels(), tempClusterWeight);
2134 
2135 
2136  if (TrueClusterCandidate->IsDalitz()){
2137  fHistoTrueClusPi0DalitzPtvsM02[fiCut]->Fill(TrueClusterCandidate->Pt(), m02, tempClusterWeight);
2138  }
2139  if (fDoMesonQA > 1)fHistoTrueClusPi0InvMassvsPt[fiCut]->Fill(mesoncand->M(),TrueClusterCandidate->Pt(), tempClusterWeight);
2140  if (fDoMesonQA > 0){
2141  fHistoTrueClusPi0EM02[fiCut]->Fill(TrueClusterCandidate->E(), m02, tempClusterWeight);
2142  }
2143  if (fDoMesonQA > 0 && GetSelectedMesonID() != 2){
2144  fHistoTruePi0PtY[fiCut]->Fill(TrueClusterCandidate->Pt(),mesoncand->Rapidity()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift(), tempClusterWeight);
2145  fHistoTruePi0PtAlpha[fiCut]->Fill(TrueClusterCandidate->Pt(),TMath::Abs(mesoncand->GetAlpha()), tempClusterWeight);
2146  }
2147 
2148  if (GetSelectedMesonID() < 2) {
2149  Float_t weighted= 1;
2150  if (mother->Pt()>0.005){
2151  weighted= ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetWeightForMeson(motherLab, fMCEvent, fInputEvent);
2152  }
2153  if (isPrimary) {
2154  fHistoTrueClusPrimPi0PtvsM02[fiCut]->Fill(TrueClusterCandidate->Pt(), m02, tempClusterWeight*weighted);
2155  if (clusterClass == 1 && TrueClusterCandidate->IsMerged()){
2156  fHistoTruePureMergedClusPrimPi0PtvsM02[fiCut]->Fill(TrueClusterCandidate->Pt(), m02, tempClusterWeight*weighted);
2157  }else if (clusterClass == 1 && TrueClusterCandidate->IsMergedPartConv()){
2158  fHistoTruePartConvClusPrimPi0PtvsM02[fiCut]->Fill(TrueClusterCandidate->Pt(), m02, tempClusterWeight*weighted);
2159  }
2160  if(TrueClusterCandidate->GetNNeutralPionMCLabels()>1){;
2161  for(Int_t npion = 1; npion < TrueClusterCandidate->GetNNeutralPionMCLabels(); npion++){
2162  if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryESD( fMCEvent, TrueClusterCandidate->GetNeutralPionMCLabel(npion), mcProdVtxX, mcProdVtxY, mcProdVtxZ)) // check if pion is primary
2163  fHistoTrueClusMultiplePrimPi0PtvsM02[fiCut]->Fill(TrueClusterCandidate->Pt(), m02, tempClusterWeight);
2164  }
2165  }
2166  if (fDoMesonQA > 1) fHistoTrueClusPrimPi0InvMassvsPt[fiCut]->Fill(mesoncand->M(),TrueClusterCandidate->Pt(), tempClusterWeight);
2167  if (fDoMesonQA > 0 && mother->Pt()>0){
2168  fHistoTruePrimaryPi0MCPtResolPt[fiCut]->Fill(mother->Pt(),(TrueClusterCandidate->Pt()-mother->Pt())/mother->Pt(),tempClusterWeight);
2169  if (fDoMesonQA > 1) fHistoTrueClusPrimPi0PtMCPt[fiCut]->Fill(TrueClusterCandidate->Pt(), mother->Pt(),tempClusterWeight);
2170  if (clusterClass == 1 && TrueClusterCandidate->IsMerged()){
2171  fHistoTruePrimaryPi0PureMergedMCPtResolPt[fiCut]->Fill(mother->Pt(),(TrueClusterCandidate->Pt()-mother->Pt())/mother->Pt(),tempClusterWeight);
2172  if (fDoMesonQA > 1) fHistoTrueClusPrimPi0PureMergedPtMCPt[fiCut]->Fill(TrueClusterCandidate->Pt(), mother->Pt(),tempClusterWeight);
2173  }else if (clusterClass == 1 && TrueClusterCandidate->IsMergedPartConv()){
2174  fHistoTruePrimaryPi0MergedPartConvMCPtResolPt[fiCut]->Fill(mother->Pt(),(TrueClusterCandidate->Pt()-mother->Pt())/mother->Pt(),tempClusterWeight);
2175  if (fDoMesonQA > 1) fHistoTrueClusPrimPi0PartConvMergedPtMCPt[fiCut]->Fill(TrueClusterCandidate->Pt(), mother->Pt(),tempClusterWeight);
2176  }else if (clusterClass == 2){
2177  fHistoTruePrimaryPi01GammaMCPtResolPt[fiCut]->Fill(mother->Pt(),(TrueClusterCandidate->Pt()-mother->Pt())/mother->Pt(),tempClusterWeight);
2178  if (fDoMesonQA > 1) fHistoTrueClusPrimPi01GammaMergedPtMCPt[fiCut]->Fill(TrueClusterCandidate->Pt(), mother->Pt(),tempClusterWeight);
2179  }else if (clusterClass == 3){
2180  fHistoTruePrimaryPi01ElectronMCPtResolPt[fiCut]->Fill(mother->Pt(),(TrueClusterCandidate->Pt()-mother->Pt())/mother->Pt(),tempClusterWeight);
2181  if (fDoMesonQA > 1) fHistoTrueClusPrimPi01ElectronMergedPtMCPt[fiCut]->Fill(TrueClusterCandidate->Pt(), mother->Pt(),tempClusterWeight);
2182  }
2183  }
2184  } else {
2185  fHistoTrueClusSecPi0PtvsM02[fiCut]->Fill(TrueClusterCandidate->Pt(), m02, tempClusterWeight);
2186  if (fDoMesonQA > 0 && mother->Pt()>0){
2187  fHistoTrueSecondaryPi0MCPtResolPt[fiCut]->Fill(mother->Pt(),(TrueClusterCandidate->Pt()-mother->Pt())/mother->Pt(),tempClusterWeight);
2188  }
2189  Int_t grandMaLab = mother->GetMother(0);
2190  if (grandMaLab > -1){
2191  if (TMath::Abs(fMCEvent->Particle(grandMaLab)->GetPdgCode()) == 310){
2192  fHistoTrueClusSecPi0FromK0sPtvsM02[fiCut]->Fill(TrueClusterCandidate->Pt(), m02, tempClusterWeight);
2193  } else if (TMath::Abs(fMCEvent->Particle(grandMaLab)->GetPdgCode()) == 130){
2194  fHistoTrueClusSecPi0FromK0lPtvsM02[fiCut]->Fill(TrueClusterCandidate->Pt(), m02, tempClusterWeight);
2195  } else if (TMath::Abs(fMCEvent->Particle(grandMaLab)->GetPdgCode()) == 3122){
2196  fHistoTrueClusSecPi0FromLambdaPtvsM02[fiCut]->Fill(TrueClusterCandidate->Pt(), m02, tempClusterWeight);
2197  }
2198  }
2199  }
2200  }
2201  // deal with eta only
2202  } else if (motherPDG == 221){
2203  fHistoTrueClusEtaPtvsM02[fiCut]->Fill(TrueClusterCandidate->Pt(), m02, tempClusterWeight);
2204  if (TrueClusterCandidate->IsDalitz()){
2205  fHistoTrueClusEtaDalitzPtvsM02[fiCut]->Fill(TrueClusterCandidate->Pt(), m02, tempClusterWeight);
2206  }
2207  if (CheckVectorForDoubleCount(fVectorDoubleCountTrueEtas,motherLab)) fHistoDoubleCountTrueEtaPtvsM02[fiCut]->Fill(TrueClusterCandidate->Pt(), m02, tempClusterWeight);
2208  if (fDoMesonQA > 1)fHistoTrueClusEtaInvMassvsPt[fiCut]->Fill(mesoncand->M(),TrueClusterCandidate->Pt(), tempClusterWeight);
2209  if (fDoMesonQA > 0){
2210  fHistoTrueClusEtaEM02[fiCut]->Fill(TrueClusterCandidate->E(), m02, tempClusterWeight);
2211  }
2212  if ( fDoMesonQA > 0 && GetSelectedMesonID() != 1 ){
2213  fHistoTrueEtaPtY[fiCut]->Fill(TrueClusterCandidate->Pt(),mesoncand->Rapidity()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift(), tempClusterWeight);
2214  fHistoTrueEtaPtAlpha[fiCut]->Fill(TrueClusterCandidate->Pt(),TMath::Abs(mesoncand->GetAlpha()), tempClusterWeight);
2215  if( mother->Pt()>0)
2216  fHistoTruePrimaryEtaMCPtResolPt[fiCut]->Fill(mother->Pt(),(TrueClusterCandidate->Pt()-mother->Pt())/mother->Pt(),tempClusterWeight);
2217  }
2218  } else {
2219  fHistoTrueMergedMissedPDG[fiCut]->Fill(motherPDG, tempClusterWeight);
2220  }
2221 
2222  // leading particle is a photon or the conversion is fully contained and its not from pi0 || eta
2223  } else if (TrueClusterCandidate->IsLargestComponentPhoton() || TrueClusterCandidate->IsConversionFullyContained()
2224  || TrueClusterCandidate->IsElectronFromFragPhoton()){
2225  if (fEnableDetailedPrintOut) cout << "photon" << endl;
2226  fHistoTrueClusGammaPtvsM02[fiCut]->Fill(TrueClusterCandidate->Pt(), m02, tempClusterWeight);
2227  if (fDoMesonQA > 0){
2228  fHistoTrueClusGammaEM02[fiCut]->Fill(TrueClusterCandidate->E(), m02, tempClusterWeight);
2229  }
2230 
2231  if (fDoMesonQA > 1) fHistoTrueClusGammaInvMassvsPt[fiCut]->Fill(mesoncand->M(),TrueClusterCandidate->Pt(), tempClusterWeight);
2232  if (motherLab == -1){
2233  fHistoTrueClusGammaPtvsSource[fiCut]->Fill(TrueClusterCandidate->Pt(), 0.5, tempClusterWeight); // direct photon
2234  } else {
2235  if (motherPDG == 111)
2236  fHistoTrueClusGammaPtvsSource[fiCut]->Fill(TrueClusterCandidate->Pt(), 1.5, tempClusterWeight); // pi0
2237  else if (motherPDG == 221)
2238  fHistoTrueClusGammaPtvsSource[fiCut]->Fill(TrueClusterCandidate->Pt(), 2.5, tempClusterWeight); // eta
2239  else if (motherPDG == 331)
2240  fHistoTrueClusGammaPtvsSource[fiCut]->Fill(TrueClusterCandidate->Pt(), 3.5, tempClusterWeight); // eta'
2241  else if (motherPDG == 223)
2242  fHistoTrueClusGammaPtvsSource[fiCut]->Fill(TrueClusterCandidate->Pt(), 4.5, tempClusterWeight); // omega
2243  else if (motherPDG == 333)
2244  fHistoTrueClusGammaPtvsSource[fiCut]->Fill(TrueClusterCandidate->Pt(), 5.5, tempClusterWeight); // phi
2245  else if (motherPDG == 3122)
2246  fHistoTrueClusGammaPtvsSource[fiCut]->Fill(TrueClusterCandidate->Pt(), 6.5, tempClusterWeight); // Lambda
2247  else
2248  fHistoTrueClusGammaPtvsSource[fiCut]->Fill(TrueClusterCandidate->Pt(), 7.5, tempClusterWeight); // rest
2249  }
2250 
2251  // leading particle is an electron and its not from pi0 || eta and no electron from fragmentation photon conversion
2252  } else if (TrueClusterCandidate->IsLargestComponentElectron() &&
2253  !TrueClusterCandidate->IsElectronFromFragPhoton()){
2254  if (fEnableDetailedPrintOut) cout << "electron" << endl;
2255  fHistoTrueClusElectronPtvsM02[fiCut]->Fill(TrueClusterCandidate->Pt(), m02, tempClusterWeight);
2256  if (fDoMesonQA > 0){
2257  fHistoTrueClusElectronEM02[fiCut]->Fill(TrueClusterCandidate->E(), m02, tempClusterWeight);
2258  }
2259 
2260  if (fDoMesonQA > 1) fHistoTrueClusElectronInvMassvsPt[fiCut]->Fill(mesoncand->M(),TrueClusterCandidate->Pt(), tempClusterWeight);
2261  Int_t motherLab = Photon->GetMother(0);
2262  mother = fMCEvent->Particle(motherLab);
2263  if (mother){
2264  TrueClusterCandidate->GetLabel(0);
2265  motherPDG = TMath::Abs(mother->GetPdgCode());
2266  }
2267 
2268  if (motherLab == -1){
2269  fHistoTrueClusElectronPtvsSource[fiCut]->Fill(TrueClusterCandidate->Pt(), 0.5, tempClusterWeight); // direct electron
2270  } else {
2271  if (motherPDG == 22){
2272  fHistoTrueClusElectronPtvsSource[fiCut]->Fill(TrueClusterCandidate->Pt(), 1.5, tempClusterWeight); // gamma
2273  fHistoTrueClusElectronFromGammaPtvsM02[fiCut]->Fill(TrueClusterCandidate->Pt(), m02, tempClusterWeight);
2274  } else if (motherPDG == 111){
2275  fHistoTrueClusElectronPtvsSource[fiCut]->Fill(TrueClusterCandidate->Pt(), 2.5, tempClusterWeight); // pi0
2276  } else if (motherPDG == 221){
2277  fHistoTrueClusElectronPtvsSource[fiCut]->Fill(TrueClusterCandidate->Pt(), 3.5, tempClusterWeight); // eta
2278  } else if ( int(motherPDG/100.)==5 || int(motherPDG/1000.)==5 ){
2279  fHistoTrueClusElectronPtvsSource[fiCut]->Fill(TrueClusterCandidate->Pt(), 5.5, tempClusterWeight); // b
2280  } else if ( int(motherPDG/100.)==4 || int(motherPDG/1000.)==4 ){
2281  fHistoTrueClusElectronPtvsSource[fiCut]->Fill(TrueClusterCandidate->Pt(), 4.5, tempClusterWeight); // c
2282  } else if (motherPDG == 23 || motherPDG == 24){
2283  fHistoTrueClusElectronPtvsSource[fiCut]->Fill(TrueClusterCandidate->Pt(), 6.5, tempClusterWeight); // W/Z
2284  } else if (motherPDG == 15) {
2285  fHistoTrueClusElectronPtvsSource[fiCut]->Fill(TrueClusterCandidate->Pt(), 7.5, tempClusterWeight); // tau
2286  } else {
2287  fHistoTrueClusElectronPtvsSource[fiCut]->Fill(TrueClusterCandidate->Pt(), 8.5, tempClusterWeight); // rest
2288  }
2289  }
2290 
2291  // leading particle is a hadron
2292  } else {
2293  if (fEnableDetailedPrintOut) cout << "BG" << endl;
2294  fHistoTrueClusBGPtvsM02[fiCut]->Fill(TrueClusterCandidate->Pt(), m02, tempClusterWeight);
2295  if (fDoMesonQA > 1) fHistoTrueClusBGInvMassvsPt[fiCut]->Fill(mesoncand->M(),TrueClusterCandidate->Pt(), tempClusterWeight);
2296 
2297  Double_t maxM02 = 4.8;
2298  if (m02 >= 0 && m02 < maxM02){
2299  if (TMath::Abs(pdgCodeParticle) == 211) fHistoTrueClusBGPtvsSource[fiCut]->Fill(TrueClusterCandidate->Pt(), 0.5, tempClusterWeight); // pi+/-
2300  else if (TMath::Abs(pdgCodeParticle) == 2212) fHistoTrueClusBGPtvsSource[fiCut]->Fill(TrueClusterCandidate->Pt(), 1.5, tempClusterWeight); // p
2301  else if (TMath::Abs(pdgCodeParticle) == 321) fHistoTrueClusBGPtvsSource[fiCut]->Fill(TrueClusterCandidate->Pt(), 2.5, tempClusterWeight); // K+-
2302  else if (TMath::Abs(pdgCodeParticle) == 2112) fHistoTrueClusBGPtvsSource[fiCut]->Fill(TrueClusterCandidate->Pt(), 3.5, tempClusterWeight); // n
2303  else if (TMath::Abs(pdgCodeParticle) == 310) fHistoTrueClusBGPtvsSource[fiCut]->Fill(TrueClusterCandidate->Pt(), 4.5, tempClusterWeight); // K0s
2304  else if (TMath::Abs(pdgCodeParticle) == 3122) fHistoTrueClusBGPtvsSource[fiCut]->Fill(TrueClusterCandidate->Pt(), 5.5, tempClusterWeight); // Lambda
2305  else if (TMath::Abs(pdgCodeParticle) == 13) fHistoTrueClusBGPtvsSource[fiCut]->Fill(TrueClusterCandidate->Pt(), 6.5, tempClusterWeight); // mu+/-
2306  else if (TMath::Abs(pdgCodeParticle) == 130) fHistoTrueClusBGPtvsSource[fiCut]->Fill(TrueClusterCandidate->Pt(), 7.5, tempClusterWeight); // K0l
2307  else fHistoTrueClusBGPtvsSource[fiCut]->Fill(TrueClusterCandidate->Pt(), 8.5, tempClusterWeight); // Rest
2308  }
2309  }
2310  }
2311  delete mesoncand;
2312  return;
2313 }
2314 
2315 //________________________________________________________________________
2316 void AliAnalysisTaskGammaCaloMerged::ProcessTrueClusterCandidatesAOD(AliAODConversionPhoton *TrueClusterCandidate, AliVCluster* cluster,
2317  AliAODConversionPhoton *TrueSubClusterCandidate1,
2318  AliAODConversionPhoton *TrueSubClusterCandidate2)
2319 {
2320  Float_t m02 = cluster->GetM02();
2321  const AliVVertex* primVtxMC = fMCEvent->GetPrimaryVertex();
2322  Double_t mcProdVtxX = primVtxMC->GetX();
2323  Double_t mcProdVtxY = primVtxMC->GetY();
2324  Double_t mcProdVtxZ = primVtxMC->GetZ();
2325 
2326  Double_t tempClusterWeight = fWeightJetJetMC;
2327  AliAODMCParticle *Photon = NULL;
2328  TClonesArray *AODMCTrackArray = dynamic_cast<TClonesArray*>(fInputEvent->FindListObject(AliAODMCParticle::StdBranchName()));
2329  if (AODMCTrackArray){
2330  if (TrueClusterCandidate->GetIsCaloPhoton() == 0) AliFatal("CaloPhotonFlag has not been set task will abort");
2331  if (TrueClusterCandidate->GetCaloPhotonMCLabel(0) < 0) return;
2332  } else {
2333  AliInfo("AODMCTrackArray could not be loaded");
2334  return;
2335  }
2336 
2337  AliAODConversionMother *mesoncand = new AliAODConversionMother(TrueSubClusterCandidate1,TrueSubClusterCandidate2);
2338  Bool_t mesonIsSelected = (((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->MesonIsSelected(mesoncand,kTRUE,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift()));
2339  if (!mesonIsSelected){
2340  delete mesoncand;
2341  return;
2342  }
2343 
2344  // Setting all MC Flags (IsMerged, etc)
2345  TrueClusterCandidate->SetCaloPhotonMCFlagsAOD(fInputEvent, fEnableSortForClusMC, kTRUE,cluster);
2346 
2347  if (TrueClusterCandidate->GetNCaloPhotonMCLabels()>0 && fEnableDetailedPrintOut && fDoMesonQA > 1){
2348  // cout << endl << "Cluster energy: " << TrueClusterCandidate->E() << endl;;
2349  // TrueClusterCandidate->PrintCaloMCLabelsAndInfo(fMCEvent);
2350  // TrueClusterCandidate->PrintCaloMCLabelsAndInfoAOD(fInputEvent);
2351  PrintCaloMCLabelsAndInfoAOD(fInputEvent,TrueClusterCandidate,cluster);
2352  // TrueClusterCandidate->PrintCaloMCFlags();
2353  }
2354 
2355  if (TrueClusterCandidate->GetNCaloPhotonMCLabels()>0){
2356  fHistoTrueClusEFracFirstLabel[fiCut]->Fill(cluster->E(), cluster->GetClusterMCEdepFraction(0), tempClusterWeight);
2357  if(TrueClusterCandidate->GetNNeutralPionMCLabels()>0)
2358  fHistoTrueClusEFracLeadingPi0[fiCut]->Fill(cluster->E(), TrueClusterCandidate->GetNeutralPionEnergyFraction(TrueClusterCandidate->GetLeadingNeutralPionIndex()), tempClusterWeight);
2359  // check if leading pi0 comes not from label 0 in cluster
2360  // for this do:
2361  // -> check if neutral pions were found in cluster
2362  // -> if the leading daughter index is not 0
2363  // -> the leading neutral pion has a larger cluster energy fraction than the cluster label 0
2364  if( TrueClusterCandidate->GetNNeutralPionMCLabels()>0 && TrueClusterCandidate->GetLeadingNeutralPionDaughterIndex()!=0 && TrueClusterCandidate->GetNeutralPionEnergyFraction(TrueClusterCandidate->GetLeadingNeutralPionIndex())>cluster->GetClusterMCEdepFraction(0)) {
2365  // load particle corresponding to largest daughter of leading pi0
2366  Photon = (AliAODMCParticle*) AODMCTrackArray->At(TrueClusterCandidate->GetCaloPhotonMCLabel(TrueClusterCandidate->GetLeadingNeutralPionDaughterIndex()));
2367  // fill vector with leading pi0 MC label
2368  CheckVectorForDoubleCount(fVectorLabelsLeadingPi0,TrueClusterCandidate->GetNeutralPionMCLabel(TrueClusterCandidate->GetLeadingNeutralPionIndex()));
2369  // fill vector will ALL pi0 MC labels that are found in the cluster
2370  for(Int_t npion = 0; npion < TrueClusterCandidate->GetNNeutralPionMCLabels(); npion++){
2371  CheckVectorForDoubleCount(fVectorLabelsMultiplePi0,TrueClusterCandidate->GetNeutralPionMCLabel(npion));
2372  }
2373  } else {
2374  // load particle corresponding to MC label 0 in cluster
2375  Photon = (AliAODMCParticle*) AODMCTrackArray->At(TrueClusterCandidate->GetCaloPhotonMCLabel(0));
2376  // important check that leading daughter corresponds to the cluster MC label 0
2377  if(TrueClusterCandidate->GetLeadingNeutralPionDaughterIndex()==0){
2378  // fill vector with leading pi0 MC label
2379  CheckVectorForDoubleCount(fVectorLabelsLeadingPi0,TrueClusterCandidate->GetNeutralPionMCLabel(TrueClusterCandidate->GetLeadingNeutralPionIndex()));
2380  // fill vector will ALL pi0 MC labels that are found in the cluster
2381  for(Int_t npion = 0; npion < TrueClusterCandidate->GetNNeutralPionMCLabels(); npion++){
2382  CheckVectorForDoubleCount(fVectorLabelsMultiplePi0,TrueClusterCandidate->GetNeutralPionMCLabel(npion));
2383  }
2384  }
2385  }
2386  } else {
2387  // return if there are no MC labels in the cluster
2388  return;
2389  }
2390 
2391  if(Photon == NULL){
2392  return;
2393  }
2394  Int_t pdgCodeParticle = Photon->GetPdgCode();
2395 
2397  Int_t clusterClass = 0;
2398  Bool_t isPrimary = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryAOD( fInputEvent, Photon, mcProdVtxX, mcProdVtxY, mcProdVtxZ);
2399 
2400  // cluster classification:
2401  // 1 - nice merged cluster (2 gamma | contributions from 2 gamma) from pi0/eta
2402  // 2 - contribution from only 1 partner (1 gamma, 1 fully coverted gamma) from pi0/eta
2403  // 3 - contribution from part of 1 partner (1 electron) from pi0/eta
2404  Long_t motherLab = -1;
2405  if (TrueClusterCandidate->IsMerged() || TrueClusterCandidate->IsMergedPartConv()){
2406  clusterClass = 1;
2407  motherLab = TrueClusterCandidate->GetCaloPhotonMotherMCLabel(0);
2408  } else if (TrueClusterCandidate->GetNCaloPhotonMotherMCLabels()> 0){
2409  if (TrueClusterCandidate->IsLargestComponentElectron() || TrueClusterCandidate->IsLargestComponentPhoton()){
2410  if (TrueClusterCandidate->GetCaloPhotonMotherMCLabel(0) > -1 && (((AliAODMCParticle*) AODMCTrackArray->At(TrueClusterCandidate->GetCaloPhotonMotherMCLabel(0)))->GetPdgCode() == 111 || ((AliAODMCParticle*) AODMCTrackArray->At(TrueClusterCandidate->GetCaloPhotonMotherMCLabel(0)))->GetPdgCode() == 221) ){
2411  if ( TrueClusterCandidate->IsConversion() && !TrueClusterCandidate->IsConversionFullyContained() ){
2412  clusterClass = 3;
2413  motherLab = TrueClusterCandidate->GetCaloPhotonMotherMCLabel(0);
2414  } else {
2415  clusterClass = 2;
2416  motherLab = TrueClusterCandidate->GetCaloPhotonMotherMCLabel(0);
2417  }
2418  }
2419  } else if (TrueClusterCandidate->IsSubLeadingEM()){
2420  if (TrueClusterCandidate->GetNCaloPhotonMotherMCLabels()> 1){
2421  if (fEnableDetailedPrintOut) cout << "Is Subleading EM: "<< TrueClusterCandidate->GetCaloPhotonMotherMCLabel(1) << endl;
2422  if ( TrueClusterCandidate->GetCaloPhotonMotherMCLabel(1) > -1){
2423  if (TMath::Abs(((AliAODMCParticle*) AODMCTrackArray->At(TrueClusterCandidate->GetCaloPhotonMotherMCLabel(1)))->GetPdgCode()) == 111 || TMath::Abs(((AliAODMCParticle*) AODMCTrackArray->At(TrueClusterCandidate->GetCaloPhotonMotherMCLabel(1)))->GetPdgCode()) == 221 ){
2424  clusterClass = 2;
2425  motherLab = TrueClusterCandidate->GetCaloPhotonMotherMCLabel(1);
2426  }
2427  }
2428  }
2429  } else {
2430  motherLab = TrueClusterCandidate->GetCaloPhotonMotherMCLabel(0);
2431  }
2432  }
2433 
2434  // Get Mother particle
2435  AliAODMCParticle *mother = NULL;
2436  Int_t motherPDG = -1;
2437  if (motherLab > -1){
2438  mother = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(motherLab));
2439  }
2440  if (fEnableDetailedPrintOut) cout << "cluster class: " << clusterClass << "\t mother lab: "<< motherLab ;
2441  if (mother){
2442  motherPDG = TMath::Abs(mother->GetPdgCode());
2443  if (fEnableDetailedPrintOut) cout << "\t mother pdg: " << motherPDG << endl;
2444  } else {
2445  if (fEnableDetailedPrintOut) cout << endl;
2446  }
2447 
2448  // Set the jetjet weight to 1 in case the cluster orignated from the minimum bias header
2449  if (fIsMC>0 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() == 4){
2450  if ( ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(motherLab, fMCEvent, fInputEvent) == 2) tempClusterWeight = 1;
2451  }
2452 
2453  //
2454  if (clusterClass == 1 || clusterClass == 2 || clusterClass == 3 ){
2455  fHistoTrueClusMergedPtvsM02[fiCut]->Fill(TrueClusterCandidate->Pt(), m02, tempClusterWeight);
2456  if (fDoMesonQA > 1)fHistoTrueClusMergedInvMassvsPt[fiCut]->Fill(mesoncand->M(),TrueClusterCandidate->Pt(), tempClusterWeight);
2457 
2458  // separate different components
2459  if (clusterClass == 1 && TrueClusterCandidate->IsMerged()){
2460  if (motherPDG == 111){
2461  fHistoTrueClusMergedPureFromPi0PtvsM02[fiCut]->Fill(TrueClusterCandidate->Pt(), m02, tempClusterWeight);
2462  if (GetSelectedMesonID() < 2 && !isPrimary && m02 >= 0 && m02 <= 4.8 ){
2463  fHistoTrueSecPi0PtvsDiffReco[fiCut]->Fill(TrueClusterCandidate->Pt(), 0., tempClusterWeight);
2464  }
2465  }
2466  if (motherPDG == 221)
2467  fHistoTrueClusMergedPureFromEtaPtvsM02[fiCut]->Fill(TrueClusterCandidate->Pt(), m02, tempClusterWeight);
2468  } else if (clusterClass == 1 && TrueClusterCandidate->IsMergedPartConv()){
2469  if (motherPDG == 111){
2470  fHistoTrueClusMergedPartConvFromPi0PtvsM02[fiCut]->Fill(TrueClusterCandidate->Pt(), m02, tempClusterWeight);
2471  if (GetSelectedMesonID() < 2 && !isPrimary && m02 >= 0 && m02 <= 4.8 ){
2472  fHistoTrueSecPi0PtvsDiffReco[fiCut]->Fill(TrueClusterCandidate->Pt(), 1., tempClusterWeight);
2473  }
2474  }
2475  if (motherPDG == 221)
2476  fHistoTrueClusMergedPartConvFromEtaPtvsM02[fiCut]->Fill(TrueClusterCandidate->Pt(), m02, tempClusterWeight);
2477  } else if (clusterClass == 2){
2478  if (motherPDG == 111){
2479  fHistoTrueClusGammaFromPi0PtvsM02[fiCut]->Fill(TrueClusterCandidate->Pt(), m02, tempClusterWeight);
2480  if (GetSelectedMesonID() < 2 && !isPrimary && m02 >= 0 && m02 <= 4.8 ){
2481  fHistoTrueSecPi0PtvsDiffReco[fiCut]->Fill(TrueClusterCandidate->Pt(), 2., tempClusterWeight);
2482  }
2483  }if (motherPDG == 221)
2484  fHistoTrueClusGammaFromEtaPtvsM02[fiCut]->Fill(TrueClusterCandidate->Pt(), m02, tempClusterWeight);
2485  } else if (clusterClass == 3){
2486  if (motherPDG == 111) {
2487  fHistoTrueClusElectronFromPi0PtvsM02[fiCut]->Fill(TrueClusterCandidate->Pt(), m02, tempClusterWeight);
2488  if (GetSelectedMesonID() < 2 && !isPrimary && m02 >= 0 && m02 <= 4.8 ){
2489  fHistoTrueSecPi0PtvsDiffReco[fiCut]->Fill(TrueClusterCandidate->Pt(), 3., tempClusterWeight);
2490  }
2491  }
2492  if (motherPDG == 221)
2493  fHistoTrueClusElectronFromEtaPtvsM02[fiCut]->Fill(TrueClusterCandidate->Pt(), m02, tempClusterWeight);
2494  }
2495 
2496  // deal with pi0 only
2497  if (motherPDG == 111){
2498  fHistoTrueClusPi0PtvsM02[fiCut]->Fill(TrueClusterCandidate->Pt(), m02, tempClusterWeight);
2500  fHistoDoubleCountTruePi0PtvsM02[fiCut]->Fill(TrueClusterCandidate->Pt(), m02, tempClusterWeight);
2501  if (!isPrimary)
2502  fHistoDoubleCountTrueSecPi0Pt[fiCut]->Fill(TrueClusterCandidate->Pt(), tempClusterWeight);
2503  }
2504  // Treatment of multiple pi0 in cluster (filling of true candidates, amount of pions and double counting)
2505  if(TrueClusterCandidate->GetNNeutralPionMCLabels()>1){
2506  for(Int_t npion = 0; npion < TrueClusterCandidate->GetNNeutralPionMCLabels(); npion++){
2507  // fill multiple true pions in same cluster
2508  if(npion>0) fHistoTrueClusMultiplePi0PtvsM02[fiCut]->Fill(TrueClusterCandidate->Pt(), m02, tempClusterWeight);
2509 
2510  // check MC labels for double counting (each particle should only be reconstructed once)
2511  if (CheckVectorForDoubleCount(fVectorDoubleCountTrueMultilePi0s,TrueClusterCandidate->GetNeutralPionMCLabel(npion))){
2512  fHistoDoubleCountTrueMultiplePi0PtvsM02[fiCut]->Fill(TrueClusterCandidate->Pt(), m02, tempClusterWeight);
2513 
2514  AliAODMCParticle *PhotonDummyPrimary = (AliAODMCParticle*) AODMCTrackArray->At(TrueClusterCandidate->GetNeutralPionMCLabel(npion));
2515  // check if particle is not a primary -> secondary particle
2516  if(!((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryAOD( fInputEvent, PhotonDummyPrimary, mcProdVtxX, mcProdVtxY, mcProdVtxZ))
2517  fHistoDoubleCountTrueMultipleSecPi0Pt[fiCut]->Fill(TrueClusterCandidate->Pt(), tempClusterWeight);
2518  }
2519  }
2520  }
2521  fHistoNTrueMultiplePi0vsPt[fiCut]->Fill(TrueClusterCandidate->Pt(),TrueClusterCandidate->GetNNeutralPionMCLabels(), tempClusterWeight);
2522 
2523  if (TrueClusterCandidate->IsDalitz()){
2524  fHistoTrueClusPi0DalitzPtvsM02[fiCut]->Fill(TrueClusterCandidate->Pt(), m02, tempClusterWeight);
2525  }
2526  if (fDoMesonQA > 1)fHistoTrueClusPi0InvMassvsPt[fiCut]->Fill(mesoncand->M(),TrueClusterCandidate->Pt(), tempClusterWeight);
2527  if (fDoMesonQA > 0){
2528  fHistoTrueClusPi0EM02[fiCut]->Fill(TrueClusterCandidate->E(), m02, tempClusterWeight);
2529  }
2530  if (fDoMesonQA > 0 && GetSelectedMesonID() != 2){
2531  fHistoTruePi0PtY[fiCut]->Fill(TrueClusterCandidate->Pt(),mesoncand->Rapidity()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift(), tempClusterWeight);
2532  fHistoTruePi0PtAlpha[fiCut]->Fill(TrueClusterCandidate->Pt(),TMath::Abs(mesoncand->GetAlpha()), tempClusterWeight);
2533  }
2534 
2535  if (GetSelectedMesonID() < 2) {
2536  Float_t weighted= 1;
2537  if (mother->Pt()>0.005){
2538  weighted= ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetWeightForMeson(motherLab, fMCEvent, fInputEvent);
2539  }
2540  if (isPrimary) {
2541  fHistoTrueClusPrimPi0PtvsM02[fiCut]->Fill(TrueClusterCandidate->Pt(), m02, tempClusterWeight*weighted);
2542  if (clusterClass == 1 && TrueClusterCandidate->IsMerged()){
2543  fHistoTruePureMergedClusPrimPi0PtvsM02[fiCut]->Fill(TrueClusterCandidate->Pt(), m02, tempClusterWeight*weighted);
2544  }else if (clusterClass == 1 && TrueClusterCandidate->IsMergedPartConv()){
2545  fHistoTruePartConvClusPrimPi0PtvsM02[fiCut]->Fill(TrueClusterCandidate->Pt(), m02, tempClusterWeight*weighted);
2546  }
2547  if(TrueClusterCandidate->GetNNeutralPionMCLabels()>1){
2548  for(Int_t npion = 1; npion < TrueClusterCandidate->GetNNeutralPionMCLabels(); npion++){
2549  AliAODMCParticle *PhotonDummyPrimary = (AliAODMCParticle*) AODMCTrackArray->At(TrueClusterCandidate->GetNeutralPionMCLabel(npion));
2550  if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryAOD( fInputEvent, PhotonDummyPrimary, mcProdVtxX, mcProdVtxY, mcProdVtxZ)) // check if pion is primary
2551  fHistoTrueClusMultiplePrimPi0PtvsM02[fiCut]->Fill(TrueClusterCandidate->Pt(), m02, tempClusterWeight);
2552  }
2553  }
2554  if (fDoMesonQA > 1) fHistoTrueClusPrimPi0InvMassvsPt[fiCut]->Fill(mesoncand->M(),TrueClusterCandidate->Pt(), tempClusterWeight);
2555  if (fDoMesonQA > 0 && mother->Pt()>0){
2556  fHistoTruePrimaryPi0MCPtResolPt[fiCut]->Fill(mother->Pt(),(TrueClusterCandidate->Pt()-mother->Pt())/mother->Pt(),tempClusterWeight);
2557  if (fDoMesonQA > 1) fHistoTrueClusPrimPi0PtMCPt[fiCut]->Fill(TrueClusterCandidate->Pt(), mother->Pt(),tempClusterWeight);
2558  if (clusterClass == 1 && TrueClusterCandidate->IsMerged()){
2559  fHistoTruePrimaryPi0PureMergedMCPtResolPt[fiCut]->Fill(mother->Pt(),(TrueClusterCandidate->Pt()-mother->Pt())/mother->Pt(),tempClusterWeight);
2560  if (fDoMesonQA > 1) fHistoTrueClusPrimPi0PureMergedPtMCPt[fiCut]->Fill(TrueClusterCandidate->Pt(), mother->Pt(),tempClusterWeight);
2561  }else if (clusterClass == 1 && TrueClusterCandidate->IsMergedPartConv()){
2562  fHistoTruePrimaryPi0MergedPartConvMCPtResolPt[fiCut]->Fill(mother->Pt(),(TrueClusterCandidate->Pt()-mother->Pt())/mother->Pt(),tempClusterWeight);
2563  if (fDoMesonQA > 1) fHistoTrueClusPrimPi0PartConvMergedPtMCPt[fiCut]->Fill(TrueClusterCandidate->Pt(), mother->Pt(),tempClusterWeight);
2564  }else if (clusterClass == 2){
2565  fHistoTruePrimaryPi01GammaMCPtResolPt[fiCut]->Fill(mother->Pt(),(TrueClusterCandidate->Pt()-mother->Pt())/mother->Pt(),tempClusterWeight);
2566  if (fDoMesonQA > 1) fHistoTrueClusPrimPi01GammaMergedPtMCPt[fiCut]->Fill(TrueClusterCandidate->Pt(), mother->Pt(),tempClusterWeight);
2567  }else if (clusterClass == 3){
2568  fHistoTruePrimaryPi01ElectronMCPtResolPt[fiCut]->Fill(mother->Pt(),(TrueClusterCandidate->Pt()-mother->Pt())/mother->Pt(),tempClusterWeight);
2569  if (fDoMesonQA > 1) fHistoTrueClusPrimPi01ElectronMergedPtMCPt[fiCut]->Fill(TrueClusterCandidate->Pt(), mother->Pt(),tempClusterWeight);
2570  }
2571  }
2572  } else {
2573  fHistoTrueClusSecPi0PtvsM02[fiCut]->Fill(TrueClusterCandidate->Pt(), m02, tempClusterWeight);
2574  if (fDoMesonQA > 0 && mother->Pt()>0){
2575  fHistoTrueSecondaryPi0MCPtResolPt[fiCut]->Fill(mother->Pt(),(TrueClusterCandidate->Pt()-mother->Pt())/mother->Pt(),tempClusterWeight);
2576  }
2577  Int_t grandMaLab = mother->GetMother();
2578  if (grandMaLab > -1){
2579  if (TMath::Abs(static_cast<AliAODMCParticle*>(AODMCTrackArray->At(grandMaLab))->GetPdgCode()) == 310){
2580  fHistoTrueClusSecPi0FromK0sPtvsM02[fiCut]->Fill(TrueClusterCandidate->Pt(), m02, tempClusterWeight);
2581  } else if (TMath::Abs(static_cast<AliAODMCParticle*>(AODMCTrackArray->At(grandMaLab))->GetPdgCode()) == 130){
2582  fHistoTrueClusSecPi0FromK0lPtvsM02[fiCut]->Fill(TrueClusterCandidate->Pt(), m02, tempClusterWeight);
2583  } else if (TMath::Abs(static_cast<AliAODMCParticle*>(AODMCTrackArray->At(grandMaLab))->GetPdgCode()) == 3122){
2584  fHistoTrueClusSecPi0FromLambdaPtvsM02[fiCut]->Fill(TrueClusterCandidate->Pt(), m02, tempClusterWeight);
2585  }
2586  }
2587  }
2588  }
2589  // deal with eta only
2590  } else if (motherPDG == 221){
2591  fHistoTrueClusEtaPtvsM02[fiCut]->Fill(TrueClusterCandidate->Pt(), m02, tempClusterWeight);
2592  if (TrueClusterCandidate->IsDalitz()){
2593  fHistoTrueClusEtaDalitzPtvsM02[fiCut]->Fill(TrueClusterCandidate->Pt(), m02, tempClusterWeight);
2594  }
2595  if (CheckVectorForDoubleCount(fVectorDoubleCountTrueEtas,motherLab)) fHistoDoubleCountTrueEtaPtvsM02[fiCut]->Fill(TrueClusterCandidate->Pt(), m02, tempClusterWeight);
2596  if (fDoMesonQA > 1)fHistoTrueClusEtaInvMassvsPt[fiCut]->Fill(mesoncand->M(),TrueClusterCandidate->Pt(), tempClusterWeight);
2597  if (fDoMesonQA > 0){
2598  fHistoTrueClusEtaEM02[fiCut]->Fill(TrueClusterCandidate->E(), m02, tempClusterWeight);
2599  }
2600  if ( fDoMesonQA > 0 && GetSelectedMesonID() != 1 ){
2601  fHistoTrueEtaPtY[fiCut]->Fill(TrueClusterCandidate->Pt(),mesoncand->Rapidity()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift(), tempClusterWeight);
2602  fHistoTrueEtaPtAlpha[fiCut]->Fill(TrueClusterCandidate->Pt(),TMath::Abs(mesoncand->GetAlpha()), tempClusterWeight);
2603  if(mother->Pt()>0)
2604  fHistoTruePrimaryEtaMCPtResolPt[fiCut]->Fill(mother->Pt(),(TrueClusterCandidate->Pt()-mother->Pt())/mother->Pt(),tempClusterWeight);
2605  }
2606  } else {
2607  fHistoTrueMergedMissedPDG[fiCut]->Fill(motherPDG, tempClusterWeight);
2608  }
2609 
2610  // leading particle is a photon or the conversion is fully contained and its not from pi0 || eta
2611  } else if (TrueClusterCandidate->IsLargestComponentPhoton() || TrueClusterCandidate->IsConversionFullyContained()){
2612  if (fEnableDetailedPrintOut) cout << "photon" << endl;
2613  fHistoTrueClusGammaPtvsM02[fiCut]->Fill(TrueClusterCandidate->Pt(), m02, tempClusterWeight);
2614  if (fDoMesonQA > 0){
2615  fHistoTrueClusGammaEM02[fiCut]->Fill(TrueClusterCandidate->E(), m02, tempClusterWeight);
2616  }
2617 
2618  if (fDoMesonQA > 1) fHistoTrueClusGammaInvMassvsPt[fiCut]->Fill(mesoncand->M(),TrueClusterCandidate->Pt(), tempClusterWeight);
2619  if (motherLab == -1){
2620  fHistoTrueClusGammaPtvsSource[fiCut]->Fill(TrueClusterCandidate->Pt(), 0.5, tempClusterWeight); // direct photon
2621  } else {
2622  if (motherPDG == 111)
2623  fHistoTrueClusGammaPtvsSource[fiCut]->Fill(TrueClusterCandidate->Pt(), 1.5, tempClusterWeight); // pi0
2624  else if (motherPDG == 221)
2625  fHistoTrueClusGammaPtvsSource[fiCut]->Fill(TrueClusterCandidate->Pt(), 2.5, tempClusterWeight); // eta
2626  else if (motherPDG == 331)
2627  fHistoTrueClusGammaPtvsSource[fiCut]->Fill(TrueClusterCandidate->Pt(), 3.5, tempClusterWeight); // eta'
2628  else if (motherPDG == 223)
2629  fHistoTrueClusGammaPtvsSource[fiCut]->Fill(TrueClusterCandidate->Pt(), 4.5, tempClusterWeight); // omega
2630  else if (motherPDG == 333)
2631  fHistoTrueClusGammaPtvsSource[fiCut]->Fill(TrueClusterCandidate->Pt(), 5.5, tempClusterWeight); // phi
2632  else if (motherPDG == 3122)
2633  fHistoTrueClusGammaPtvsSource[fiCut]->Fill(TrueClusterCandidate->Pt(), 6.5, tempClusterWeight); // Lambda
2634  else
2635  fHistoTrueClusGammaPtvsSource[fiCut]->Fill(TrueClusterCandidate->Pt(), 7.5, tempClusterWeight); // rest
2636  }
2637 
2638  // leading particle is an electron and its not from pi0 || eta
2639  } else if (TrueClusterCandidate->IsLargestComponentElectron()){
2640  if (fEnableDetailedPrintOut) cout << "electron" << endl;
2641  fHistoTrueClusElectronPtvsM02[fiCut]->Fill(TrueClusterCandidate->Pt(), m02, tempClusterWeight);
2642  if (fDoMesonQA > 0){
2643  fHistoTrueClusElectronEM02[fiCut]->Fill(TrueClusterCandidate->E(), m02, tempClusterWeight);
2644  }
2645 
2646  if (fDoMesonQA > 1) fHistoTrueClusElectronInvMassvsPt[fiCut]->Fill(mesoncand->M(),TrueClusterCandidate->Pt(), tempClusterWeight);
2647  Int_t motherLab = Photon->GetMother();
2648  if (motherLab == -1){
2649  fHistoTrueClusElectronPtvsSource[fiCut]->Fill(TrueClusterCandidate->Pt(), 0.5, tempClusterWeight); // direct electron
2650  } else {
2651  if (motherPDG == 22){
2652  fHistoTrueClusElectronPtvsSource[fiCut]->Fill(TrueClusterCandidate->Pt(), 1.5, tempClusterWeight); // gamma
2653  fHistoTrueClusElectronFromGammaPtvsM02[fiCut]->Fill(TrueClusterCandidate->Pt(), m02, tempClusterWeight);
2654  } else if (motherPDG == 111){
2655  fHistoTrueClusElectronPtvsSource[fiCut]->Fill(TrueClusterCandidate->Pt(), 2.5, tempClusterWeight); // pi0
2656  } else if (motherPDG == 221){
2657  fHistoTrueClusElectronPtvsSource[fiCut]->Fill(TrueClusterCandidate->Pt(), 3.5, tempClusterWeight); // eta
2658  } else if ( int(motherPDG/100.)==5 || int(motherPDG/1000.)==5 ){
2659  fHistoTrueClusElectronPtvsSource[fiCut]->Fill(TrueClusterCandidate->Pt(), 5.5, tempClusterWeight); // b
2660  } else if ( int(motherPDG/100.)==4 || int(motherPDG/1000.)==4 ){
2661  fHistoTrueClusElectronPtvsSource[fiCut]->Fill(TrueClusterCandidate->Pt(), 4.5, tempClusterWeight); // c
2662  } else if (motherPDG == 23 || motherPDG == 24){
2663  fHistoTrueClusElectronPtvsSource[fiCut]->Fill(TrueClusterCandidate->Pt(), 6.5, tempClusterWeight); // W/Z
2664  } else if (motherPDG == 15) {
2665  fHistoTrueClusElectronPtvsSource[fiCut]->Fill(TrueClusterCandidate->Pt(), 7.5, tempClusterWeight); // tau
2666  } else {
2667  fHistoTrueClusElectronPtvsSource[fiCut]->Fill(TrueClusterCandidate->Pt(), 8.5, tempClusterWeight); // rest
2668  }
2669  }
2670  // leading particle is a hadron
2671  } else {
2672  if (fEnableDetailedPrintOut) cout << "BG" << endl;
2673  fHistoTrueClusBGPtvsM02[fiCut]->Fill(TrueClusterCandidate->Pt(), m02, tempClusterWeight);
2674  if (fDoMesonQA > 1) fHistoTrueClusBGInvMassvsPt[fiCut]->Fill(mesoncand->M(),TrueClusterCandidate->Pt(), tempClusterWeight);
2675 
2676  Double_t maxM02 = 4.8;
2677  if (m02 >= 0 && m02 < maxM02){
2678  if (TMath::Abs(pdgCodeParticle) == 211) fHistoTrueClusBGPtvsSource[fiCut]->Fill(TrueClusterCandidate->Pt(), 0.5, tempClusterWeight); // pi+/-
2679  else if (TMath::Abs(pdgCodeParticle) == 2212) fHistoTrueClusBGPtvsSource[fiCut]->Fill(TrueClusterCandidate->Pt(), 1.5, tempClusterWeight); // p
2680  else if (TMath::Abs(pdgCodeParticle) == 321) fHistoTrueClusBGPtvsSource[fiCut]->Fill(TrueClusterCandidate->Pt(), 2.5, tempClusterWeight); // K+-
2681  else if (TMath::Abs(pdgCodeParticle) == 2112) fHistoTrueClusBGPtvsSource[fiCut]->Fill(TrueClusterCandidate->Pt(), 3.5, tempClusterWeight); // n
2682  else if (TMath::Abs(pdgCodeParticle) == 310) fHistoTrueClusBGPtvsSource[fiCut]->Fill(TrueClusterCandidate->Pt(), 4.5, tempClusterWeight); // K0s
2683  else if (TMath::Abs(pdgCodeParticle) == 3122) fHistoTrueClusBGPtvsSource[fiCut]->Fill(TrueClusterCandidate->Pt(), 5.5, tempClusterWeight); // Lambda
2684  else if (TMath::Abs(pdgCodeParticle) == 13) fHistoTrueClusBGPtvsSource[fiCut]->Fill(TrueClusterCandidate->Pt(), 6.5, tempClusterWeight); // mu+/-
2685  else if (TMath::Abs(pdgCodeParticle) == 130) fHistoTrueClusBGPtvsSource[fiCut]->Fill(TrueClusterCandidate->Pt(), 7.5, tempClusterWeight); // K0l
2686  else fHistoTrueClusBGPtvsSource[fiCut]->Fill(TrueClusterCandidate->Pt(), 8.5, tempClusterWeight); // Rest
2687  }
2688  }
2689  }
2690  delete mesoncand;
2691  return;
2692 }
2693 
2694 
2695 //________________________________________________________________________
2697 {
2698  const AliVVertex* primVtxMC = fMCEvent->GetPrimaryVertex();
2699  Double_t mcProdVtxX = primVtxMC->GetX();
2700  Double_t mcProdVtxY = primVtxMC->GetY();
2701  Double_t mcProdVtxZ = primVtxMC->GetZ();
2702 
2703  // Loop over all primary MC particle
2704  for(Long_t i = 0; i < fMCEvent->GetNumberOfTracks(); i++) {
2705  Double_t tempParticleWeight = fWeightJetJetMC;
2706  if (((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryESD( fMCEvent, i, mcProdVtxX, mcProdVtxY, mcProdVtxZ)){
2707 
2708  TParticle* particle = (TParticle *)fMCEvent->Particle(i);
2709  if (!particle) continue;
2710 
2711  Int_t isMCFromMBHeader = -1;
2712  if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 0){
2713  isMCFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCEvent, fInputEvent);
2714  if(isMCFromMBHeader == 0 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 3) continue;
2715  // Set the jetjet weight to 1 in case the particle orignated from the minimum bias header
2716  if(isMCFromMBHeader == 2 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() == 4) tempParticleWeight = 1;
2717  }
2718 
2719  Double_t mesonY = 1.e30;
2720  Double_t ratio = 0;
2721  if (particle->Energy() != TMath::Abs(particle->Pz())){
2722  ratio = (particle->Energy()+particle->Pz()) / (particle->Energy()-particle->Pz());
2723  }
2724  if( !(ratio <= 0) ){
2725  mesonY = particle->Y()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
2726  }
2727 
2728  // fill Primary Y hist
2729  if ( particle->GetPdgCode() == 211 ){ // positve pions
2730  fHistoMCPrimaryYvsSource[fiCut]->Fill(mesonY, 0., tempParticleWeight);
2731  } else if ( particle->GetPdgCode() == -211 ){ // negative pions
2732  fHistoMCPrimaryYvsSource[fiCut]->Fill(mesonY, 1., tempParticleWeight);
2733  } else if ( particle->GetPdgCode() == 321 ){ // positve kaons
2734  fHistoMCPrimaryYvsSource[fiCut]->Fill(mesonY, 2., tempParticleWeight);
2735  } else if ( particle->GetPdgCode() == -321 ){ // negative kaons
2736  fHistoMCPrimaryYvsSource[fiCut]->Fill(mesonY, 3., tempParticleWeight);
2737  } else if ( TMath::Abs(particle->GetPdgCode()) == 310 ){ // K0s
2738  fHistoMCPrimaryYvsSource[fiCut]->Fill(mesonY, 4., tempParticleWeight);
2739  } else if ( TMath::Abs(particle->GetPdgCode()) == 130 ){ // K0l
2740  fHistoMCPrimaryYvsSource[fiCut]->Fill(mesonY, 5., tempParticleWeight);
2741  } else if ( TMath::Abs(particle->GetPdgCode()) == 3122 ){ // Lambda/ AntiLambda
2742  fHistoMCPrimaryYvsSource[fiCut]->Fill(mesonY, 6., tempParticleWeight);
2743  }
2744 
2745  if (TMath::Abs(mesonY) < ((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->GetRapidityCutValue()){
2746  if ( particle->GetPdgCode() == 211 ){ // positve pions
2747  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 0., tempParticleWeight);
2748  } else if ( particle->GetPdgCode() == -211 ){ // negative pions
2749  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 1., tempParticleWeight);
2750  } else if ( particle->GetPdgCode() == 321 ){ // positve kaons
2751  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 2., tempParticleWeight);
2752  } else if ( particle->GetPdgCode() == -321 ){ // negative kaons
2753  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 3., tempParticleWeight);
2754  } else if ( TMath::Abs(particle->GetPdgCode()) == 310 ){ // K0s
2755  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 4., tempParticleWeight);
2756  } else if ( TMath::Abs(particle->GetPdgCode()) == 130 ){ // K0l
2757  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 5., tempParticleWeight);
2758  } else if ( TMath::Abs(particle->GetPdgCode()) == 3122 ){ // Lambda/ AntiLambda
2759  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 6., tempParticleWeight);
2760  } else if ( particle->GetPdgCode() == 22 ){ // photons
2761  fHistoMCAllGammaPt[fiCut]->Fill(particle->Pt(), tempParticleWeight); // direct photons
2762  if(particle->GetMother(0) > -1){
2763  TParticle* mother = (TParticle*)fMCEvent->Particle(particle->GetMother(0));
2764  if ( TMath::Abs(mother->GetPdgCode()) == 111 ||
2765  TMath::Abs(mother->GetPdgCode()) == 113 ||
2766  TMath::Abs(mother->GetPdgCode()) == 221 ||
2767  TMath::Abs(mother->GetPdgCode()) == 223 ||
2768  TMath::Abs(mother->GetPdgCode()) == 331 ||
2769  TMath::Abs(mother->GetPdgCode()) == 333 ||
2770  TMath::Abs(mother->GetPdgCode()) == 3212 ||
2771  TMath::Abs(mother->GetPdgCode()) == 213
2772  ){
2773  fHistoMCDecayGammaPt[fiCut]->Fill(particle->Pt(), tempParticleWeight); // decay photons
2774  }
2775  }
2776  }
2777  }
2778 
2779  // check if particle is pi0/eta from di-photon decay
2780  if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))
2781  ->MesonIsSelectedMC(particle,fMCEvent,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift())){
2782  TParticle* daughter0 = (TParticle*)fMCEvent->Particle(particle->GetFirstDaughter());
2783  TParticle* daughter1 = (TParticle*)fMCEvent->Particle(particle->GetLastDaughter());
2784 
2785  Float_t weighted= 1;
2786  if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCEvent, fInputEvent)){
2787  if (particle->Pt()>0.005){
2788  weighted= ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetWeightForMeson(i, fMCEvent, fInputEvent);
2789  }
2790  }
2791 
2792  if( TMath::Abs(particle->GetPdgCode()) == 111 ){ // neutral pions
2793  fHistoMCPi0Pt[fiCut]->Fill(particle->Pt(),weighted* tempParticleWeight); // All MC Pi0
2795  fHistoMCPi0ReducedPt[fiCut]->Fill(particle->Pt(),weighted* tempParticleWeight); // MC Pi0 with gamma in acc, ONLY overlapping pi0 in cluster
2796  }
2797  if (GetSelectedMesonID() != 2){
2798  fHistoMCPi0WOWeightPt[fiCut]->Fill(particle->Pt(), tempParticleWeight);
2799  if (fIsMC==2)fHistoMCPi0WOEvtWeightPt[fiCut]->Fill(particle->Pt());
2800  if (fDoMesonQA > 0 ){
2801  if (fIsMC == 2) fHistoMCPi0PtJetPt[fiCut]->Fill(particle->Pt(),((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetMaxPtJet(),tempParticleWeight);
2802  }
2803  }
2804  } else if( TMath::Abs(particle->GetPdgCode()) == 221 ){ // eta mesons
2805  fHistoMCEtaPt[fiCut]->Fill(particle->Pt(),weighted* tempParticleWeight); // All MC Eta
2806  if (GetSelectedMesonID() != 1){
2807  fHistoMCEtaWOWeightPt[fiCut]->Fill(particle->Pt(), tempParticleWeight);
2808  if (fIsMC==2)fHistoMCEtaWOEvtWeightPt[fiCut]->Fill(particle->Pt());
2809  if (fDoMesonQA > 0 ){
2810  if (fIsMC == 2) fHistoMCEtaPtJetPt[fiCut]->Fill(particle->Pt(),((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetMaxPtJet(),tempParticleWeight);
2811  }
2812  }
2813  }
2814  // Check the acceptance for both gammas & whether they are counted as primaries as well
2815  Bool_t kDaughter0IsPrim = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryESD( fMCEvent, particle->GetFirstDaughter(), mcProdVtxX, mcProdVtxY, mcProdVtxZ);
2816  Bool_t kDaughter1IsPrim = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryESD( fMCEvent, particle->GetLastDaughter(), mcProdVtxX, mcProdVtxY, mcProdVtxZ);
2817 
2818  if( kDaughter0IsPrim && kDaughter1IsPrim &&
2819  (((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedMC(daughter0,fMCEvent) ||
2820  ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedMC(daughter1,fMCEvent) ) ){
2821  if(particle->GetPdgCode() == 111 && GetSelectedMesonID() != 2){
2822  fHistoMCPi0InAccPt[fiCut]->Fill(particle->Pt(),weighted* tempParticleWeight); // MC Pi0 with gamma in acc
2824  fHistoMCPi0ReducedInAccPt[fiCut]->Fill(particle->Pt(),weighted* tempParticleWeight); // MC Pi0 with gamma in acc, ONLY overlapping pi0 in cluster
2825  }
2826  if (fIsMC == 2)fHistoMCPi0WOEvtWeightInAccPt[fiCut]->Fill(particle->Pt()); // MC Pi0 w/o event weights with gamma in acc
2827  } else if(particle->GetPdgCode() == 221 && GetSelectedMesonID() != 1){
2828  fHistoMCEtaInAccPt[fiCut]->Fill(particle->Pt(),weighted* tempParticleWeight); // MC Eta with gamma in acc
2829  if (fIsMC == 2)fHistoMCEtaWOEvtWeightInAccPt[fiCut]->Fill(particle->Pt()); // MC Eta w/o event weights with gamma in acc
2830  }
2831  }
2832  }
2833  Int_t gammaLabel = -1;
2834  Int_t electronLabel = -1;
2835  Int_t positronLabel = -1;
2836  // check if particle is pi0/eta from Dalitz decay
2837  if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))
2838  ->MesonIsSelectedMCDalitz(particle,fMCEvent, electronLabel, positronLabel, gammaLabel, ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift())){
2839  if( (gammaLabel > -1) && (electronLabel > -1) && (positronLabel > -1) ){
2840  TParticle* gamma = (TParticle*)fMCEvent->Particle(gammaLabel);
2841  TParticle* electron = (TParticle*)fMCEvent->Particle(electronLabel);
2842  TParticle* positron = (TParticle*)fMCEvent->Particle(positronLabel);
2843 
2844  Float_t weighted= 1;
2845  if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCEvent, fInputEvent)){
2846  if (particle->Pt()>0.005){
2847  weighted= ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetWeightForMeson(i, fMCEvent, fInputEvent);
2848  }
2849  }
2850 
2851  if(particle->GetPdgCode() == 111 && GetSelectedMesonID() != 2){
2852  fHistoMCPi0DalitzPt[fiCut]->Fill(particle->Pt(),weighted* tempParticleWeight); // All MC Pi0
2853  fHistoMCPi0DalitzWOWeightPt[fiCut]->Fill(particle->Pt(), tempParticleWeight);
2854  if (fIsMC==2)fHistoMCPi0DalitzWOEvtWeightPt[fiCut]->Fill(particle->Pt());
2855  if (fDoMesonQA > 0 ){
2856  if (fIsMC == 2) fHistoMCPi0PtJetPt[fiCut]->Fill(particle->Pt(),((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetMaxPtJet(),tempParticleWeight);
2857  }
2858  } else if(particle->GetPdgCode() == 221 && GetSelectedMesonID() != 1){
2859  fHistoMCEtaDalitzPt[fiCut]->Fill(particle->Pt(),weighted* tempParticleWeight); // All MC Eta
2860  fHistoMCEtaDalitzWOWeightPt[fiCut]->Fill(particle->Pt(), tempParticleWeight);
2861  if (fIsMC==2)fHistoMCEtaDalitzWOEvtWeightPt[fiCut]->Fill(particle->Pt());
2862  if (fDoMesonQA > 0 ){
2863  if (fIsMC == 2) fHistoMCEtaPtJetPt[fiCut]->Fill(particle->Pt(),((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetMaxPtJet(),tempParticleWeight);
2864  }
2865  }
2866 
2867  // Check the acceptance for both gammas & whether they are counted as primaries as well
2868  Bool_t kGammaIsPrim = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryESD( fMCEvent, gammaLabel, mcProdVtxX, mcProdVtxY, mcProdVtxZ);
2869  Bool_t kElectronIsPrim = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryESD( fMCEvent, electronLabel, mcProdVtxX, mcProdVtxY, mcProdVtxZ);
2870  Bool_t kPositronIsPrim = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryESD( fMCEvent, positronLabel, mcProdVtxX, mcProdVtxY, mcProdVtxZ);
2871  if( kGammaIsPrim && kElectronIsPrim && kPositronIsPrim &&
2872  (((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedMC(gamma,fMCEvent) ||
2873  ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedElecMC(electron,fMCEvent) ||
2874  ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedElecMC(positron,fMCEvent) )
2875  ){
2876  if(particle->GetPdgCode() == 111 && GetSelectedMesonID() != 2){
2877  fHistoMCPi0DalitzInAccPt[fiCut]->Fill(particle->Pt(),weighted* tempParticleWeight); // MC Pi0 with gamma in acc
2878  if (fIsMC == 2) fHistoMCPi0DalitzWOEvtWeightInAccPt[fiCut]->Fill(particle->Pt(),weighted* tempParticleWeight); // MC Pi0 with gamma in acc
2879  } else if(particle->GetPdgCode() == 221 && GetSelectedMesonID() != 1){
2880  fHistoMCEtaDalitzInAccPt[fiCut]->Fill(particle->Pt(),weighted* tempParticleWeight); // MC Eta with gamma in acc
2881  if (fIsMC == 2) fHistoMCEtaDalitzWOEvtWeightInAccPt[fiCut]->Fill(particle->Pt(),weighted* tempParticleWeight); // MC Pi0 with gamma in acc
2882  }
2883  }
2884  }
2885  }
2886  // End of primary threatment, now secondary treatment
2887  } else {
2888 
2889  TParticle* particle = (TParticle *)fMCEvent->Particle(i);
2890  if (!particle) continue;
2891 
2892  Int_t isMCFromMBHeader = -1;
2893  if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 0){
2894  isMCFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCEvent, fInputEvent);
2895  if(isMCFromMBHeader == 0 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 3) continue;
2896  // Set the jetjet weight to 1 in case the particle orignated from the minimum bias header
2897  if(isMCFromMBHeader == 2 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() == 4) tempParticleWeight = 1;
2898  }
2899 
2900  // check if particle is pi0 from di-photon decay
2901  if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))
2902  ->MesonIsSelectedMC(particle,fMCEvent,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift())){
2903  TParticle* daughter0 = (TParticle*)fMCEvent->Particle(particle->GetFirstDaughter());
2904  TParticle* daughter1 = (TParticle*)fMCEvent->Particle(particle->GetLastDaughter());
2905  TParticle* mother = NULL;
2906  Int_t motherPDG = -1000000;
2907  if (particle->GetMother(0) > -1){
2908  mother = (TParticle*)fMCEvent->Particle(particle->GetMother(0));
2909  if (mother)
2910  motherPDG = TMath::Abs(mother->GetPdgCode());
2911  }
2912 
2913  if( TMath::Abs(particle->GetPdgCode()) == 111 ){ // neutral pions
2914  Int_t source = GetSourceClassification(111,motherPDG);
2915  fHistoMCSecPi0PtvsSource[fiCut]->Fill(particle->Pt(),source, tempParticleWeight); // All secondary MC Pi0
2916  }
2917 
2918  // check whether pi0 landet in acceptance
2919  if( (((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedMC(daughter0,fMCEvent) ||
2920  ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedMC(daughter1,fMCEvent) ) ){
2921  if( TMath::Abs(particle->GetPdgCode()) == 111 ){ // neutral pions
2922  Int_t source = GetSourceClassification(111,motherPDG);
2923  fHistoMCSecPi0InAccPtvsSource[fiCut]->Fill(particle->Pt(),source, tempParticleWeight); // All secondary MC Pi0
2924  }
2925  }
2926  }
2927 
2928  Int_t gammaLabel = -1;
2929  Int_t electronLabel = -1;
2930  Int_t positronLabel = -1;
2931  // check if particle is pi0/eta from Dalitz decay
2932  if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))
2933  ->MesonIsSelectedMCDalitz(particle,fMCEvent, electronLabel, positronLabel, gammaLabel, ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift())){
2934  if( (gammaLabel > -1) && (electronLabel > -1) && (positronLabel > -1) ){
2935  TParticle* gamma = (TParticle*)fMCEvent->Particle(gammaLabel);
2936  TParticle* electron = (TParticle*)fMCEvent->Particle(electronLabel);
2937  TParticle* positron = (TParticle*)fMCEvent->Particle(positronLabel);
2938 
2939  TParticle* mother = NULL;
2940  Int_t motherPDG = -1000000;
2941  if (particle->GetMother(0) > -1){
2942  mother = (TParticle*)fMCEvent->Particle(particle->GetMother(0));
2943  if (mother)
2944  motherPDG = TMath::Abs(mother->GetPdgCode());
2945  }
2946 
2947  if( TMath::Abs(particle->GetPdgCode()) == 111 ){ // neutral pions
2948  Int_t source = GetSourceClassification(111,motherPDG);
2949  fHistoMCSecPi0PtvsSource[fiCut]->Fill(particle->Pt(),source, tempParticleWeight); // All secondary MC Pi0
2950  }
2951 
2952  // check whether pi0 landet in acceptance
2953  if( (((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedMC(gamma,fMCEvent) ||
2954  ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedElecMC(electron,fMCEvent) ||
2955  ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedElecMC(positron,fMCEvent) ) ){
2956  if( TMath::Abs(particle->GetPdgCode()) == 111 ){ // neutral pions
2957  Int_t source = GetSourceClassification(111,motherPDG);
2958  fHistoMCSecPi0InAccPtvsSource[fiCut]->Fill(particle->Pt(),source, tempParticleWeight); // All secondary MC Pi0
2959  }
2960  }
2961  }
2962  }
2963  }
2964  } // end of particle loop
2965 }
2966 
2967 //________________________________________________________________________
2969 {
2970  const AliVVertex* primVtxMC = fMCEvent->GetPrimaryVertex();
2971  Double_t mcProdVtxX = primVtxMC->GetX();
2972  Double_t mcProdVtxY = primVtxMC->GetY();
2973  Double_t mcProdVtxZ = primVtxMC->GetZ();
2974 
2975  TClonesArray *AODMCTrackArray = dynamic_cast<TClonesArray*>(fInputEvent->FindListObject(AliAODMCParticle::StdBranchName()));
2976  if (AODMCTrackArray == NULL) return;
2977 
2978  // Loop over all primary MC particle
2979  for(Long_t i = 0; i < AODMCTrackArray->GetEntriesFast(); i++) {
2980  Double_t tempParticleWeight = fWeightJetJetMC;
2981  AliAODMCParticle* particle = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(i));
2982  if (!particle) continue;
2983 
2984  Bool_t isPrimary = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryAOD(fInputEvent, particle, mcProdVtxX, mcProdVtxY, mcProdVtxZ);
2985  if (isPrimary) {
2986 
2987  Int_t isMCFromMBHeader = -1;
2988  if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 0){
2989  isMCFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCEvent, fInputEvent);
2990  if(isMCFromMBHeader == 0 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 3) continue;
2991  // Set the jetjet weight to 1 in case the particle orignated from the minimum bias header
2992  if(isMCFromMBHeader == 2 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() == 4) tempParticleWeight = 1;
2993  }
2994 
2995  Double_t mesonY = 1.e30;
2996  Double_t ratio = 0;
2997  if (particle->E() != TMath::Abs(particle->Pz())){
2998  ratio = (particle->E()+particle->Pz()) / (particle->E()-particle->Pz());
2999  }
3000  if( !(ratio <= 0) ){
3001  mesonY = particle->Y()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
3002  }
3003 
3004  // fill Primary Y hist
3005  if ( particle->GetPdgCode() == 211 ){ // positve pions
3006  fHistoMCPrimaryYvsSource[fiCut]->Fill(mesonY, 0., tempParticleWeight);
3007  } else if ( particle->GetPdgCode() == -211 ){ // negative pions
3008  fHistoMCPrimaryYvsSource[fiCut]->Fill(mesonY, 1., tempParticleWeight);
3009  } else if ( particle->GetPdgCode() == 321 ){ // positve kaons
3010  fHistoMCPrimaryYvsSource[fiCut]->Fill(mesonY, 2., tempParticleWeight);
3011  } else if ( particle->GetPdgCode() == -321 ){ // negative kaons
3012  fHistoMCPrimaryYvsSource[fiCut]->Fill(mesonY, 3., tempParticleWeight);
3013  } else if ( TMath::Abs(particle->GetPdgCode()) == 310 ){ // K0s
3014  fHistoMCPrimaryYvsSource[fiCut]->Fill(mesonY, 4., tempParticleWeight);
3015  } else if ( TMath::Abs(particle->GetPdgCode()) == 130 ){ // K0l
3016  fHistoMCPrimaryYvsSource[fiCut]->Fill(mesonY, 5., tempParticleWeight);
3017  } else if ( TMath::Abs(particle->GetPdgCode()) == 3122 ){ // Lambda/ AntiLambda
3018  fHistoMCPrimaryYvsSource[fiCut]->Fill(mesonY, 6., tempParticleWeight);
3019  }
3020 
3021  if (TMath::Abs(mesonY) < ((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->GetRapidityCutValue()){
3022  if ( particle->GetPdgCode() == 211 ){ // positve pions
3023  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 0., tempParticleWeight);
3024  } else if ( particle->GetPdgCode() == -211 ){ // negative pions
3025  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 1., tempParticleWeight);
3026  } else if ( particle->GetPdgCode() == 321 ){ // positve kaons
3027  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 2., tempParticleWeight);
3028  } else if ( particle->GetPdgCode() == -321 ){ // negative kaons
3029  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 3., tempParticleWeight);
3030  } else if ( TMath::Abs(particle->GetPdgCode()) == 310 ){ // K0s
3031  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 4., tempParticleWeight);
3032  } else if ( TMath::Abs(particle->GetPdgCode()) == 130 ){ // K0l
3033  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 5., tempParticleWeight);
3034  } else if ( TMath::Abs(particle->GetPdgCode()) == 3122 ){ // Lambda/ AntiLambda
3035  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 6., tempParticleWeight);
3036  } else if ( particle->GetPdgCode() == 22 ){ // photons
3037  fHistoMCAllGammaPt[fiCut]->Fill(particle->Pt(), tempParticleWeight); // direct photons
3038  if(particle->GetMother() > -1){
3039  AliAODMCParticle *mother = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(particle->GetMother()));
3040  if ( TMath::Abs(mother->GetPdgCode()) == 111 ||
3041  TMath::Abs(mother->GetPdgCode()) == 113 ||
3042  TMath::Abs(mother->GetPdgCode()) == 221 ||
3043  TMath::Abs(mother->GetPdgCode()) == 223 ||
3044  TMath::Abs(mother->GetPdgCode()) == 331 ||
3045  TMath::Abs(mother->GetPdgCode()) == 333 ||
3046  TMath::Abs(mother->GetPdgCode()) == 3212 ||
3047  TMath::Abs(mother->GetPdgCode()) == 213
3048  ){
3049  fHistoMCDecayGammaPt[fiCut]->Fill(particle->Pt(), tempParticleWeight); // decay photons
3050  }
3051  }
3052  }
3053  }
3054 
3055  // check if particle is pi0/eta from di-photon decay
3056  if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))
3057  ->MesonIsSelectedAODMC(particle,AODMCTrackArray,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift())){
3058  AliAODMCParticle* daughter0 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(particle->GetDaughterLabel(0)));
3059  AliAODMCParticle* daughter1 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(particle->GetDaughterLabel(1)));
3060 
3061  Float_t weighted= 1;
3062  if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCEvent, fInputEvent)){
3063  if (particle->Pt()>0.005){
3064  weighted= ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetWeightForMeson(i, 0x0, fInputEvent);
3065  }
3066  }
3067  if( TMath::Abs(particle->GetPdgCode()) == 111 ){ // neutral pions
3068  fHistoMCPi0Pt[fiCut]->Fill(particle->Pt(),weighted* tempParticleWeight); // All MC Pi0
3070  fHistoMCPi0ReducedPt[fiCut]->Fill(particle->Pt(),weighted* tempParticleWeight); // MC Pi0 with gamma in acc, ONLY overlapping pi0 in cluster
3071  }
3072  if (GetSelectedMesonID() != 2){
3073  fHistoMCPi0WOWeightPt[fiCut]->Fill(particle->Pt(), tempParticleWeight);
3074  if (fIsMC==2)fHistoMCPi0WOEvtWeightPt[fiCut]->Fill(particle->Pt());
3075  if (fDoMesonQA > 0 ){
3076  if (fIsMC == 2) fHistoMCPi0PtJetPt[fiCut]->Fill(particle->Pt(),((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetMaxPtJet(),tempParticleWeight);
3077  }
3078  }
3079  } else if( TMath::Abs(particle->GetPdgCode()) == 221 ){ // eta mesons
3080  fHistoMCEtaPt[fiCut]->Fill(particle->Pt(),weighted* tempParticleWeight); // All MC Eta
3081  if (GetSelectedMesonID() != 1){
3082  fHistoMCEtaWOWeightPt[fiCut]->Fill(particle->Pt(), tempParticleWeight);
3083  if (fIsMC==2)fHistoMCEtaWOEvtWeightPt[fiCut]->Fill(particle->Pt());
3084  if (fDoMesonQA > 0 ){
3085  if (fIsMC == 2) fHistoMCEtaPtJetPt[fiCut]->Fill(particle->Pt(),((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetMaxPtJet(),tempParticleWeight);
3086  }
3087  }
3088  }
3089  // Check the acceptance for both gammas & whether they are counted as primaries as well
3090  Bool_t kDaughter0IsPrim = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryAOD( fInputEvent, daughter0, mcProdVtxX, mcProdVtxY, mcProdVtxZ);
3091  Bool_t kDaughter1IsPrim = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryAOD( fInputEvent, daughter1, mcProdVtxX, mcProdVtxY, mcProdVtxZ);
3092 
3093  if( kDaughter0IsPrim && kDaughter1IsPrim &&
3094  (((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedAODMC(daughter0,AODMCTrackArray) ||
3095  ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedAODMC(daughter1,AODMCTrackArray) ) ){
3096  if(particle->GetPdgCode() == 111 && GetSelectedMesonID() != 2){
3097  fHistoMCPi0InAccPt[fiCut]->Fill(particle->Pt(),weighted* tempParticleWeight); // MC Pi0 with gamma in acc
3099  fHistoMCPi0ReducedInAccPt[fiCut]->Fill(particle->Pt(),weighted* tempParticleWeight); // MC Pi0 with gamma in acc, ONLY overlapping pi0 in cluster
3100  }
3101  if (fIsMC == 2)fHistoMCPi0WOEvtWeightInAccPt[fiCut]->Fill(particle->Pt()); // MC Pi0 w/o event weights with gamma in acc
3102  } else if(particle->GetPdgCode() == 221 && GetSelectedMesonID() != 1){
3103  fHistoMCEtaInAccPt[fiCut]->Fill(particle->Pt(),weighted* tempParticleWeight); // MC Eta with gamma in acc
3104  if (fIsMC == 2)fHistoMCEtaWOEvtWeightInAccPt[fiCut]->Fill(particle->Pt()); // MC Eta w/o event weights with gamma in acc
3105  }
3106  }
3107  }
3108  Int_t gammaLabel = -1;
3109  Int_t electronLabel = -1;
3110  Int_t positronLabel = -1;
3111  // check if particle is pi0/eta from Dalitz decay
3112  if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))
3113  ->MesonIsSelectedAODMCDalitz(particle,AODMCTrackArray, electronLabel, positronLabel, gammaLabel, ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift())){
3114  if( (gammaLabel > -1) && (electronLabel > -1) && (positronLabel > -1) ){
3115  AliAODMCParticle* gamma = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gammaLabel));
3116  AliAODMCParticle* electron = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(electronLabel));
3117  AliAODMCParticle* positron = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(positronLabel));
3118 
3119  Float_t weighted= 1;
3120  if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCEvent, fInputEvent)){
3121  if (particle->Pt()>0.005){
3122  weighted= ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetWeightForMeson(i, fMCEvent, fInputEvent);
3123  }
3124  }
3125 
3126  if(particle->GetPdgCode() == 111 && GetSelectedMesonID() != 2){
3127  fHistoMCPi0DalitzPt[fiCut]->Fill(particle->Pt(),weighted* tempParticleWeight); // All MC Pi0
3128  fHistoMCPi0DalitzWOWeightPt[fiCut]->Fill(particle->Pt(), tempParticleWeight);
3129  if (fIsMC==2)fHistoMCPi0DalitzWOEvtWeightPt[fiCut]->Fill(particle->Pt());
3130  if (fDoMesonQA > 0 ){
3131  if (fIsMC == 2) fHistoMCPi0PtJetPt[fiCut]->Fill(particle->Pt(),((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetMaxPtJet(),tempParticleWeight);
3132  }
3133  } else if(particle->GetPdgCode() == 221 && GetSelectedMesonID() != 1){
3134  fHistoMCEtaDalitzPt[fiCut]->Fill(particle->Pt(),weighted* tempParticleWeight); // All MC Eta
3135  fHistoMCEtaDalitzWOWeightPt[fiCut]->Fill(particle->Pt(), tempParticleWeight);
3136  if (fIsMC==2)fHistoMCEtaDalitzWOEvtWeightPt[fiCut]->Fill(particle->Pt());
3137  if (fDoMesonQA > 0 ){
3138  if (fIsMC == 2) fHistoMCEtaPtJetPt[fiCut]->Fill(particle->Pt(),((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetMaxPtJet(),tempParticleWeight);
3139  }
3140  }
3141 
3142  // Check the acceptance for both gammas & whether they are counted as primaries as well
3143  Bool_t kGammaIsPrim = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryAOD( fInputEvent, gamma, mcProdVtxX, mcProdVtxY, mcProdVtxZ);
3144  Bool_t kElectronIsPrim = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryAOD( fInputEvent, electron, mcProdVtxX, mcProdVtxY, mcProdVtxZ);
3145  Bool_t kPositronIsPrim = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryAOD( fInputEvent, positron, mcProdVtxX, mcProdVtxY, mcProdVtxZ);
3146  if( kGammaIsPrim && kElectronIsPrim && kPositronIsPrim &&
3147  (((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedAODMC(gamma,AODMCTrackArray) ||
3148  ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedElecAODMC(electron,AODMCTrackArray) ||
3149  ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedElecAODMC(positron,AODMCTrackArray) )
3150  ){
3151  if(particle->GetPdgCode() == 111 && GetSelectedMesonID() != 2){
3152  fHistoMCPi0DalitzInAccPt[fiCut]->Fill(particle->Pt(),weighted* tempParticleWeight); // MC Pi0 with gamma in acc
3153  if (fIsMC == 2) fHistoMCPi0DalitzWOEvtWeightInAccPt[fiCut]->Fill(particle->Pt(),weighted* tempParticleWeight); // MC Pi0 with gamma in acc
3154  } else if(particle->GetPdgCode() == 221 && GetSelectedMesonID() != 1){
3155  fHistoMCEtaDalitzInAccPt[fiCut]->Fill(particle->Pt(),weighted* tempParticleWeight); // MC Eta with gamma in acc
3156  if (fIsMC == 2) fHistoMCEtaDalitzWOEvtWeightInAccPt[fiCut]->Fill(particle->Pt(),weighted* tempParticleWeight); // MC Pi0 with gamma in acc
3157  }
3158  }
3159  }
3160  }
3161  // End of primary threatment, now secondary treatment
3162  } else {
3163 
3164  AliAODMCParticle* particle = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(i));
3165  if (!particle) continue;
3166 
3167  Int_t isMCFromMBHeader = -1;
3168  if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 0){
3169  isMCFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCEvent, fInputEvent);
3170  if(isMCFromMBHeader == 0 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 3) continue;
3171  if(isMCFromMBHeader == 2 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() == 4) tempParticleWeight = 1;
3172  }
3173 
3174  // check if particle is pi0 from di-photon decay
3175  if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))
3176  ->MesonIsSelectedAODMC(particle,AODMCTrackArray,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift())){
3177  AliAODMCParticle* daughter0 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(particle->GetDaughterLabel(0)));
3178  AliAODMCParticle* daughter1 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(particle->GetDaughterLabel(1)));
3179  AliAODMCParticle* mother = NULL;
3180  Int_t motherPDG = -1000000;
3181  if (particle->GetMother() > -1){
3182  mother = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(particle->GetMother()));
3183  if (mother)
3184  motherPDG = TMath::Abs(mother->GetPdgCode());
3185  }
3186 
3187  if( TMath::Abs(particle->GetPdgCode()) == 111 ){ // neutral pions
3188  Int_t source = GetSourceClassification(111,motherPDG);
3189  fHistoMCSecPi0PtvsSource[fiCut]->Fill(particle->Pt(),source, tempParticleWeight); // All secondary MC Pi0
3190  }
3191 
3192  // check whether pi0 landet in acceptance
3193  if( (((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedAODMC(daughter0,AODMCTrackArray) ||
3194  ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedAODMC(daughter1,AODMCTrackArray) ) ){
3195  if( TMath::Abs(particle->GetPdgCode()) == 111 ){ // neutral pions
3196  Int_t source = GetSourceClassification(111,motherPDG);
3197  fHistoMCSecPi0InAccPtvsSource[fiCut]->Fill(particle->Pt(),source, tempParticleWeight); // All secondary MC Pi0
3198  }
3199  }
3200  }
3201 
3202  Int_t gammaLabel = -1;
3203  Int_t electronLabel = -1;
3204  Int_t positronLabel = -1;
3205  // check if particle is pi0/eta from Dalitz decay
3206  if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))
3207  ->MesonIsSelectedAODMCDalitz(particle,AODMCTrackArray, electronLabel, positronLabel, gammaLabel, ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift())){
3208  if( (gammaLabel > -1) && (electronLabel > -1) && (positronLabel > -1) ){
3209  AliAODMCParticle* gamma = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gammaLabel));
3210  AliAODMCParticle* electron = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(electronLabel));
3211  AliAODMCParticle* positron = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(positronLabel));
3212 
3213  AliAODMCParticle* mother = NULL;
3214  Int_t motherPDG = -1000000;
3215  if (particle->GetMother() > -1){
3216  mother = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(particle->GetMother()));
3217  if (mother)
3218  motherPDG = TMath::Abs(mother->GetPdgCode());
3219  }
3220 
3221  if( TMath::Abs(particle->GetPdgCode()) == 111 ){ // neutral pions
3222  Int_t source = GetSourceClassification(111,motherPDG);
3223  fHistoMCSecPi0PtvsSource[fiCut]->Fill(particle->Pt(),source, tempParticleWeight); // All secondary MC Pi0
3224  }
3225 
3226  // check whether pi0 landet in acceptance
3227  if( (((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedAODMC(gamma,AODMCTrackArray) ||
3228  ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedElecAODMC(electron,AODMCTrackArray) ||
3229  ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedElecAODMC(positron,AODMCTrackArray) ) ){
3230  if( TMath::Abs(particle->GetPdgCode()) == 111 ){ // neutral pions
3231  Int_t source = GetSourceClassification(111,motherPDG);
3232  fHistoMCSecPi0InAccPtvsSource[fiCut]->Fill(particle->Pt(),source, tempParticleWeight); // All secondary MC Pi0
3233  }
3234  }
3235  }
3236  }
3237  }
3238  } // end of particle loop
3239  return;
3240 }
3241 
3242 //_________________________________________________________________________________
3244  TAxis *axisafter = histoRebin->GetXaxis();
3245  Int_t bins = axisafter->GetNbins();
3246  Double_t from = axisafter->GetXmin();
3247  Double_t to = axisafter->GetXmax();
3248  Double_t *newbins = new Double_t[bins+1];
3249  newbins[0] = from;
3250  Double_t factor = TMath::Power(to/from, 1./bins);
3251  for(Int_t i=1; i<=bins; ++i) newbins[i] = factor * newbins[i-1];
3252  axisafter->Set(bins, newbins);
3253  delete [] newbins;
3254 }
3255 
3256 //_________________________________________________________________________________
3258 {
3259  if(tobechecked > -1)
3260  {
3261  vector<Int_t>::iterator it;
3262  it = find (vec.begin(), vec.end(), tobechecked);
3263  if (it != vec.end()) return true;
3264  else{
3265  vec.push_back(tobechecked);
3266  return false;
3267  }
3268  }
3269  return false;
3270 }
3271 
3272 //_________________________________________________________________________________
3273 Bool_t AliAnalysisTaskGammaCaloMerged::CheckVector1ForEntryAndFillVector2(vector<Int_t> vecCheck, vector<Int_t> &vecFill, Int_t tobechecked)
3274 {
3275  if(tobechecked > -1)
3276  {
3277  vector<Int_t>::iterator itCheck;
3278  vector<Int_t>::iterator itFill;
3279  // search for entry in vecCheck
3280  itCheck = find (vecCheck.begin(), vecCheck.end(), tobechecked);
3281  if (itCheck != vecCheck.end()){
3282  // entry in vecCheck -> may not be filled in vecFill -> return false
3283  return false;
3284  } else {
3285  // entry NOT in vecCheck -> entry is allowed to be filled in vecFill
3286  // check vecFill if entry already exists
3287  itFill = find (vecFill.begin(), vecFill.end(), tobechecked);
3288  if (itFill != vecFill.end()){
3289  // entry already in vecFill -> return false
3290  } else {
3291  // entry does not yet exist in vecFill -> fill
3292  vecFill.push_back(tobechecked);
3293  return false;
3294  }
3295  }
3296  }
3297  return false;
3298 }
3299 
3300 //________________________________________________________________________
3302 {
3303 
3304  //fOutputContainer->Print(); // Will crash on GRID
3305 }
3306 
3307 
3308 //_________________________________________________________________________________
3309 void AliAnalysisTaskGammaCaloMerged::FillMultipleCountMap(map<Int_t,Int_t> &ma, Int_t tobechecked){
3310  if( ma.find(tobechecked) != ma.end() ) ma[tobechecked] += 1;
3311  else ma[tobechecked] = 2;
3312  return;
3313 }
3314 
3315 //_________________________________________________________________________________
3317  map<Int_t, Int_t>::iterator it;
3318  for (it = ma.begin(); it != ma.end(); it++){
3319  hist->Fill(it->second, fWeightJetJetMC);
3320  }
3321  ma.clear();
3322  return;
3323 }
3324 
3325 
3326 //________________________________________________________________________
3328 
3329  if (daughter == 111) {
3330  if (TMath::Abs(pdgCode) == 310) return 1; // k0s
3331  else if (TMath::Abs(pdgCode) == 3122) return 2; // Lambda
3332  else if (TMath::Abs(pdgCode) == 130) return 3; // K0L
3333  else if (TMath::Abs(pdgCode) == 2212) return 4; // proton
3334  else if (TMath::Abs(pdgCode) == 2112) return 5; // neutron
3335  else if (TMath::Abs(pdgCode) == 211) return 6; // pion
3336  else if (TMath::Abs(pdgCode) == 321) return 7; // kaon
3337  else if (TMath::Abs(pdgCode) == 113 || TMath::Abs(pdgCode) == 213 ) return 8; // rho 0,+,-
3338  else if (TMath::Abs(pdgCode) == 3222 || TMath::Abs(pdgCode) == 3212 || TMath::Abs(pdgCode) == 3112 ) return 9; // Sigma
3339  else if (TMath::Abs(pdgCode) == 2224 || TMath::Abs(pdgCode) == 2214 || TMath::Abs(pdgCode) == 2114 || TMath::Abs(pdgCode) == 1114 ) return 10; // Delta
3340  else if (TMath::Abs(pdgCode) == 313 || TMath::Abs(pdgCode) == 323 ) return 11; // K*
3341  else return 15;
3342  }
3343  return 15;
3344 
3345 }
3346 
3347 
3349  Int_t nOverlapsFound = 0;
3350  if (mcEvent && fMaxAllowedPi0OverlapsMC>-1){
3351  for(Long_t i = 0; i < mcEvent->GetNumberOfPrimaries(); i++) {
3352  AliMCParticle* particle1 = (AliMCParticle*) mcEvent->GetTrack(i);
3353  if (!particle1) continue;
3354  if (TMath::Abs(particle1->PdgCode()) == 111){
3355  if(TMath::Abs(particle1->Eta()) > 0.67) continue;
3356 
3357  if ( (((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->GetClusterType() == 1) && !(particle1->Phi() > 1.396 && particle1->Phi() < 3.28)) continue;
3358  if ( (((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->GetClusterType() == 3) && !(particle1->Phi() > 4.55 && particle1->Phi() < 5.70)) continue;
3359  if ( (((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->GetClusterType() == 4) && !( (particle1->Phi() > 1.396 && particle1->Phi() < 3.28) || (particle1->Phi() > 4.55 && particle1->Phi() < 5.70) )) continue;
3360 
3361  for(Long_t j = i+1; j < mcEvent->GetNumberOfPrimaries(); j++) {
3362  AliMCParticle* particle2 = (AliMCParticle*) mcEvent->GetTrack(j);
3363  if (!particle2) continue;
3364  if(i==j) continue;
3365  if(TMath::Abs(particle2->Eta()) > 0.7) continue;
3366  if(TMath::Abs(particle2->PdgCode()) == 111){
3367  Double_t DeltaEta = particle1->Eta()-particle2->Eta();
3368  Double_t DeltaPhi = abs(particle1->Phi()-particle2->Phi());
3369  Double_t RneutralParts = TMath::Sqrt(pow((DeltaEta),2)+pow((DeltaPhi),2));
3370  if(RneutralParts<0.05){
3371  nOverlapsFound++;
3372  if(nOverlapsFound>fMaxAllowedPi0OverlapsMC){
3373  return kTRUE;
3374  }
3375  }
3376  }
3377  }
3378  }
3379  }
3380  }
3381  return kFALSE;
3382 }
3383 
3385  // cout << "---------------------------------------------------------------------------------------------" << endl;
3386  if (mcEvent){
3387  for(Long_t i = 0; i < mcEvent->GetNumberOfPrimaries(); i++) {
3388  AliMCParticle* particle1 = (AliMCParticle*) mcEvent->GetTrack(i);
3389  if (!particle1) continue;
3390  if (TMath::Abs(particle1->PdgCode()) == 111){
3391  if(particle1->Pt() < 10) continue;
3392  AliMCParticle* particle1D1 = (AliMCParticle*) mcEvent->GetTrack(particle1->GetDaughterFirst());
3393  AliMCParticle* particle1D2 = (AliMCParticle*) mcEvent->GetTrack(particle1->GetDaughterLast());
3394  if(TMath::Abs(particle1->Eta()) > 0.67 || TMath::Abs(particle1D1->Eta()) > 0.67 || TMath::Abs(particle1D2->Eta()) > 0.67) continue;
3395 
3396  // if ( (((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->GetClusterType() == 1) && !(particle1->Phi() > 1.396 && particle1->Phi() < 3.28)) continue;
3397  // if ( (((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->GetClusterType() == 4) && !( (particle1->Phi() > 1.396 && particle1->Phi() < 3.28) || (particle1->Phi() > 4.55 && particle1->Phi() < 5.70) )) continue;
3398 
3399  if ( (((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->GetClusterType() == 1) && !(particle1D1->Phi() > 1.396 && particle1D1->Phi() < 3.28)) continue;
3400  if ( (((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->GetClusterType() == 4) && !( (particle1D1->Phi() > 1.396 && particle1D1->Phi() < 3.28) || (particle1D1->Phi() > 4.55 && particle1D1->Phi() < 5.70) )) continue;
3401  if ( (((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->GetClusterType() == 1) && !(particle1D2->Phi() > 1.396 && particle1D2->Phi() < 3.28)) continue;
3402  if ( (((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->GetClusterType() == 4) && !( (particle1D2->Phi() > 1.396 && particle1D2->Phi() < 3.28) || (particle1D2->Phi() > 4.55 && particle1D2->Phi() < 5.70) )) continue;
3403  // both photons must be in a R<0.05 cone
3404  if(TMath::Sqrt(pow((particle1D1->Eta()-particle1D2->Eta()),2)+pow((abs(particle1D1->Phi()-particle1D2->Phi())),2))>0.05) continue;
3405 
3406 
3407  Double_t gammaEnergyInCone = 0;
3408  Int_t nOverlapsFound = 0;
3409  // cout << "E_pi0: " << particle1->E() << "\tID:" << i << "\tFirstDaughter:" << particle1->GetDaughterFirst()<< "\tLastDaughter:" << particle1->GetDaughterLast()<< endl;
3410  // cout << " pT_g1: " << particle1D1->Pt() << "\tEta: " << particle1D1->Eta()<< "\tPhi: " << particle1D1->Phi() << "\tdR = " << TMath::Sqrt(pow((particle1->Eta()-particle1D1->Eta()),2)+pow((abs(particle1->Phi()-particle1D1->Phi())),2))<< endl;
3411  // cout << " pT_g2: " << particle1D2->Pt() << "\tEta: " << particle1D2->Eta()<< "\tPhi: " << particle1D2->Phi() << "\tdR = " << TMath::Sqrt(pow((particle1->Eta()-particle1D2->Eta()),2)+pow((abs(particle1->Phi()-particle1D2->Phi())),2))<< endl;
3412 
3413  Bool_t foundHigherEParticleInCone = kFALSE;
3414  for(Long_t j = i+1; j < mcEvent->GetNumberOfPrimaries(); j++) {
3415  AliMCParticle* particle2 = (AliMCParticle*) mcEvent->GetTrack(j);
3416  if (!particle2) continue;
3417  if(i==j) continue;
3418  if(TMath::Abs(particle2->Eta()) > 0.7) continue;
3419  if(TMath::Abs(particle2->PdgCode()) == 22 && (particle1->GetDaughterFirst() != j) && (particle1->GetDaughterLast() != j)){
3420  Double_t DeltaEta = particle1->Eta()-particle2->Eta();
3421  Double_t DeltaPhi = abs(particle1->Phi()-particle2->Phi());
3422  Double_t RneutralParts = TMath::Sqrt(pow((DeltaEta),2)+pow((DeltaPhi),2));
3423  if(RneutralParts<0.05){
3424  if(particle2->Pt()>(particle1D1->Pt()+particle1D2->Pt()) ) foundHigherEParticleInCone = kTRUE;
3425  nOverlapsFound++;
3426  gammaEnergyInCone+=particle2->Pt();
3427  // cout << "\tE_gamma_" << j << ": " << particle2->Pt() << "\tdEta: " << DeltaEta<< "\tdPhi: " << DeltaPhi<< "\tdR = " << RneutralParts << "\tMother: " << particle2->GetMother() << "\tMotherPDG: " << ((AliMCParticle*) mcEvent->GetTrack(particle2->GetMother()))->PdgCode()<< "\tMotherE: " << ((AliMCParticle*) mcEvent->GetTrack(particle2->GetMother()))->E() << endl;
3428  }
3429  }
3430  }
3431  if(nOverlapsFound>0 && !foundHigherEParticleInCone){
3432  // cout << "\t\tE_gamma surr: " << gammaEnergyInCone << " from " << nOverlapsFound << " gammas" << endl;
3433  fHistoPi0EvsGammaOverlapE[fiCut]->Fill(particle1->E(),gammaEnergyInCone);
3434  }
3435  }
3436  }
3437  }
3438 }
3439 
3440 
3441 void AliAnalysisTaskGammaCaloMerged::PrintCaloMCLabelsAndInfoAOD(AliVEvent* event, AliAODConversionPhoton *TrueClusterCandidate, AliVCluster* cluster){
3442  TClonesArray *AODMCTrackArray = dynamic_cast<TClonesArray*>(event->FindListObject(AliAODMCParticle::StdBranchName()));
3443  if (!AODMCTrackArray) return;
3444  // cout << endl << endl << "particles contributing: " << endl;
3445  Double_t energyFromPhotons = 0;
3446  Double_t energyFromElectrons = 0;
3447  Double_t energyFromOthers = 0;
3448  Double_t energyFromLeadingPionParticles = 0;
3449  for (Int_t i =0 ; i < TrueClusterCandidate->GetNCaloPhotonMCLabels(); i++ ){
3450  AliAODMCParticle *dummy = NULL;
3451  if (TrueClusterCandidate->GetCaloPhotonMCLabel(i)>0){
3452  dummy = (AliAODMCParticle*) AODMCTrackArray->At(TrueClusterCandidate->GetCaloPhotonMCLabel(i));
3453  // cout << i << "\t ID: "<< TrueClusterCandidate->GetCaloPhotonMCLabel(i) << "\t pdg: " <<dummy->GetPdgCode() << "\t R: "<< TMath::Sqrt( (dummy->Xv()*dummy->Xv()) + (dummy->Yv()*dummy->Yv()) ) << "\t E: " << dummy->E() << "\t Erec: " << cluster->E()* cluster->GetClusterMCEdepFraction(i) << " ( " << cluster->GetClusterMCEdepFraction(i)*100 << " %)\t ClsLbl: " << cluster->GetLabelAt(i) ;
3454  if(TMath::Abs(dummy->GetPdgCode())==22) energyFromPhotons+=cluster->E()* cluster->GetClusterMCEdepFraction(i);
3455  else if(TMath::Abs(dummy->GetPdgCode())==11) energyFromElectrons+=cluster->E()* cluster->GetClusterMCEdepFraction(i);
3456  else energyFromOthers+=cluster->E()* cluster->GetClusterMCEdepFraction(i);
3457  if (dummy->GetMother() > -1){
3458  AliAODMCParticle* dummyMother = (AliAODMCParticle*) AODMCTrackArray->At(dummy->GetMother());
3459  // cout << "\t MID: " << dummy->GetMother() << "\t Mpdg: " << dummyMother->GetPdgCode() << "\t E: " << dummyMother->E();
3460  if (dummyMother->GetMother() > -1){
3461  // AliAODMCParticle* dummyGrandMother = (AliAODMCParticle*) AODMCTrackArray->At(dummyMother->GetMother());
3462  // cout << "\t GMID: " << dummyMother->GetMother() << "\t GMcode: " << dummyGrandMother->GetPdgCode() << "\t E: " << dummyGrandMother->E() << endl;
3463  } else {
3464  // cout << endl;
3465  }
3466  } else {
3467  // cout << endl;
3468  }
3469  }
3470  }
3471  // cout << "leading pion: " << endl;
3472  if(TrueClusterCandidate->GetNNeutralPionMCLabels()>0){
3473  // cout << "ID: " << TrueClusterCandidate->GetNeutralPionMCLabel(TrueClusterCandidate->GetLeadingNeutralPionIndex()) << "\t fracE: " << TrueClusterCandidate->GetNeutralPionEnergyFraction(TrueClusterCandidate->GetLeadingNeutralPionIndex()) << endl;
3474  // cout << "\t leading daughter: ID: " << TrueClusterCandidate->GetCaloPhotonMCLabel(TrueClusterCandidate->GetLeadingNeutralPionDaughterIndex()) << "\t fracE: " << TrueClusterCandidate->GetNeutralPionEnergyFraction(TrueClusterCandidate->GetLeadingNeutralPionDaughterIndex()) << endl;
3475  energyFromLeadingPionParticles = TrueClusterCandidate->GetNeutralPionEnergyFraction(TrueClusterCandidate->GetLeadingNeutralPionIndex())*cluster->E();
3476  if(TrueClusterCandidate->GetNeutralPionEnergyFraction(TrueClusterCandidate->GetLeadingNeutralPionIndex())>cluster->GetClusterMCEdepFraction(0)){ // only fill histo if this cluster would be selected for a pi0
3477  // cout << "frac pi0: " << TrueClusterCandidate->GetNeutralPionEnergyFraction(TrueClusterCandidate->GetLeadingNeutralPionIndex()) << "\t filling " << ((energyFromPhotons+energyFromElectrons)-(energyFromLeadingPionParticles))/(energyFromLeadingPionParticles) << endl;
3478  if((energyFromPhotons+energyFromElectrons)>0)fHistoTrueClusNeutralContamination[fiCut]->Fill(cluster->E(), ((energyFromPhotons+energyFromElectrons)-(energyFromLeadingPionParticles))/(cluster->E()), fWeightJetJetMC);
3479  if(energyFromPhotons>0)fHistoTrueClusPhotonContamination[fiCut]->Fill(cluster->E(), ((energyFromPhotons)-(energyFromLeadingPionParticles))/(cluster->E()), fWeightJetJetMC);
3480  if(energyFromElectrons>0)fHistoTrueClusElectronContamination[fiCut]->Fill(cluster->E(), ((energyFromElectrons)-(energyFromLeadingPionParticles))/(cluster->E()), fWeightJetJetMC);
3481  if(energyFromOthers>0)fHistoTrueClusOtherContamination[fiCut]->Fill(cluster->E(), ((energyFromOthers)-(energyFromLeadingPionParticles))/(cluster->E()), fWeightJetJetMC);
3482  // if((energyFromPhotons+energyFromElectrons)>0)fHistoTrueClusNeutralContamination[fiCut]->Fill(cluster->E(), ((energyFromPhotons+energyFromElectrons)-(energyFromLeadingPionParticles))/(energyFromLeadingPionParticles), fWeightJetJetMC);
3483  // if(energyFromPhotons>0)fHistoTrueClusPhotonContamination[fiCut]->Fill(cluster->E(), ((energyFromPhotons)-(energyFromLeadingPionParticles))/(energyFromLeadingPionParticles), fWeightJetJetMC);
3484  // if(energyFromElectrons>0)fHistoTrueClusElectronContamination[fiCut]->Fill(cluster->E(), ((energyFromElectrons)-(energyFromLeadingPionParticles))/(energyFromLeadingPionParticles), fWeightJetJetMC);
3485  // if(energyFromOthers>0)fHistoTrueClusOtherContamination[fiCut]->Fill(cluster->E(), ((energyFromOthers)-(energyFromLeadingPionParticles))/(energyFromLeadingPionParticles), fWeightJetJetMC);
3486  }
3487  }
3488 
3489 }
TH2F ** fHistoClusMergedNCellsPt
array of histos with cluster NCells vs Pt
TH1F ** fHistoNGoodESDTracks
array of histos with event information without event weights
vector< Int_t > fVectorLabelsLeadingPi0
array of histos with double counted etas, pT, M02
TH1F ** fHistoMCPi0DalitzInAccPt
array of histos without evt weight eta in acceptance, pT
TH2F ** fHistoTruePrimaryEtaMCPtResolPt
array of histos with validated weighted primary pi0, MCpt, resol pt
TH2F ** fHistoClusMergedNCellsAroundPt
array of histos with merged cluster N MC paricles in cluster vs Pt
TH2F ** fHistoTruePi0PtAlpha
array of histos with validated eta, pt, Y
TH1F ** fHistoClusOverlapHeadersGammaPt
array of histos with cluster, E
double Double_t
Definition: External.C:58
void FillMultipleCountHistoAndClear(map< Int_t, Int_t > &ma, TH1F *hist)
Definition: External.C:236
vector< Int_t > fVectorDoubleCountTrueMultilePi0s
vector containing labels of validated pi0
TH2F ** fHistoMotherPtAlpha
array of histograms with signal +BG pt, Y
TH1F ** fHistoMCPi0InAccPt
array of histos without event weights eta Dalitz, pT
TH2F ** fHistoTruePrimaryPi0MergedPartConvMCPtResolPt
array of histos with validated weighted primary pi0, MCpt, resol pt
vector< Int_t > fVectorLabelsMultiplePi0
vector containing labels of validated pi0
TH1F ** fHistoMCPi0ReducedInAccPt
array of histos with weighted pi0 in acceptance, pT
TH1F ** fHistoMCEtaDalitzWOWeightPt
array of histos with weighted eta Dalitz, pT
TH2F ** fHistoTrueEtaPtAlpha
array of histos with validated pi0, pt, alpha
Bool_t NumberOfMCEventNeutralPionOverlapInEMCal(AliMCEvent *mcEvent)
TH1F ** fHistoMCPi0DalitzPt
array of histos without event weights eta, pT
TH1F ** fHistoMCAllGammaPt
array of histos with weighted decay gamma
TH1F ** fHistoClusGammaE
array of histos with cluster, pt
TH2F ** fHistoMCPrimaryPtvsSource
array of histos with weighted eta, pT, hardest jet pt
TH2F ** fHistoSPDClusterTrackletBackground
array of histos with number of good tracks vs gamma candidates
TH2F ** fHistoMCSecPi0InAccPtvsSource
array of histos with weighted pi0 from sec, pT for different sources
TH1F ** fHistoNEvents
vector containing labels of validated eta
TH2F ** fHistoTrueClusEtaEM02
array of histos with validated pi0, E, m02
TH2F ** fHistoTrueClusEFracFirstLabel
array of histos with weighted all gamma
TH1F ** fHistoNEventsWOWeight
array of histos with event information
TH2F ** fHistoClusMergedNCellsAroundAndInPt
array of histos with number of cells surrounding merged cluster vs merged cluster Pt ...
TH1F ** fHistoClusGammaPt
array of histograms with signal +BG pt, alpha
TH1F ** fHistoMCEtaWOEvtWeightPt
array of histos with unweighted eta, pT
TH1I ** fHistoMCHeaders
array of histos with E surrounding merged cluster vs merged cluster E
TH1F ** fHistoMCDecayGammaPt
array of histos with weighted primary particles, Y vs source
TH2F ** fHistoClusNCellsPt
array of histos with cluster merged accepted mesons, E vs M02
TH1F ** fHistoMCPi0DalitzWOWeightPt
array of histos with weighted pi0 Dalitz, pT
TH2F ** fHistoClusMergedEvsM02Accepted
array of histos with cluster merged accepted mesons, pt vs M02
void PrintCaloMCLabelsAndInfoAOD(AliVEvent *event, AliAODConversionPhoton *TrueClusterCandidate, AliVCluster *cluster)
int Int_t
Definition: External.C:63
TH2F ** fHistoClusMergedPtvsM02Accepted
array of histos with cluster merged, pt vs M02
TH1F ** fHistoMCEtaDalitzPt
array of histos without event weights pi0 Dalitz, pT
TH2F ** fHistoClusMergedEAroundE
array of histos with number of cells surrounding merged cluster + Ncells in clus vs merged cluster Pt...
Definition: External.C:204
TH1F ** fHistoNClusterMergedCandidates
array of histos with number of cluster candidates per event
TH2F ** fHistoMCPrimaryYvsSource
array of histos with weighted primary particles, pT vs source
TH1F ** fHistoMCEtaDalitzWOEvtWeightPt
array of histos with unweighted eta Dalitz, pT
float Float_t
Definition: External.C:68
TH1F ** fHistoMCPi0WOWeightPt
array of histos with weighted pi0, pT
Bool_t CheckVectorForDoubleCount(vector< Int_t > &vec, Int_t tobechecked)
TH1F ** fHistoMCPi0WOEvtWeightPt
array of histos with unweighted pi0, pT
TH1F ** fHistoNClusterCandidates
array of histos with vertex z distribution for selected events
Int_t fNClusterMergedCandidates
current number of cluster candidates
TH1F ** fHistoMCPi0WOEvtWeightInAccPt
array of histos with weighted eta in acceptance, pT
TH2F ** fHistoMotherPtY
array of histogram with signal + BG for same event photon pairs, inv Mass, pt
TH2F ** fHistoMCPi0PtJetPt
array of histos with weighted pi0 from sec in acceptance, pT for different sources ...
TH1F ** fHistoNV0Tracks
array of histos with SPD tracklets vs SPD clusters for background rejection
TH2F ** fHistoTrueSecondaryPi0MCPtResolPt
array of histos with validated weighted primary eta, MCpt, resol pt
void ProcessTrueClusterCandidatesAOD(AliAODConversionPhoton *TruePhotonCandidate, AliVCluster *cluster, AliAODConversionPhoton *TrueSubClusterCandidate1, AliAODConversionPhoton *TrueSubClusterCandidate2)
TH1F ** fHistoJetJetNTrials
array of profiles with xsection for jetjet
TH2F ** fHistoTruePrimaryPi01GammaMCPtResolPt
array of histos with validated weighted primary pi0, MCpt, resol pt
TH1F ** fHistoMCEtaDalitzInAccPt
array of histos with weighted pi0 dalitz in acceptance, pT
TH1F ** fHistoMCPi0Pt
array of histos for header names
TH1F ** fHistoMCEtaDalitzWOEvtWeightInAccPt
array of histos without evt weight pi0 in acceptance, pT
TH2F ** fHistoTrueClusPi0EM02
array of histos with validated electrons, E, m02
Bool_t Data(TH1F *h, Double_t *rangefit, Bool_t writefit, Double_t &sgn, Double_t &errsgn, Double_t &bkg, Double_t &errbkg, Double_t &sgnf, Double_t &errsgnf, Double_t &sigmafit, Int_t &status)
AliAnalysisTaskJetOutlierRemoval * fOutlierJetReader
TH2F ** fHistoClusMergedNParticlePt
array of histos with merged cluster NCells vs Pt
TH1F ** fHistoMCEtaWOEvtWeightInAccPt
array of histos without evt weight pi0 in acceptance, pT
Int_t GetSourceClassification(Int_t daughter, Int_t pdgCode)
TH2F ** fHistoTrueClusGammaEM02
array of histos with validated eta, pt, alpha
TH2F ** fHistoDoubleCountTrueEtaPtvsM02
array of histos with double counted secondary pi0s, pT, M02
TH2F ** fHistoClusMergedPtvsM02
array of histos with cluster NLM vs Pt
TH2F ** fHistoTruePrimaryPi0MCPtResolPt
array of histos with validated eta, E, m02
TProfile ** fProfileEtaShift
array of histos with V0 counts
Definition: External.C:220
TH1F ** fHistoMCPi0ReducedPt
array of histos with weighted pi0, pT
TH2F ** fHistoMCEtaPtJetPt
array of histos with weighted pi0, pT, hardest jet pt
TH1F ** fHistoDoubleCountTrueMultipleSecPi0Pt
array of histos with double counted pi0s, pT, M02
TH2F ** fHistoDoubleCountTruePi0PtvsM02
array of histos with validated weighted secondary pi0, MCpt, resol pt
Implementation of a sample jet analysis task.
void ProcessTrueClusterCandidates(AliAODConversionPhoton *TruePhotonCandidate, AliVCluster *cluster, AliAODConversionPhoton *TrueSubClusterCandidate1, AliAODConversionPhoton *TrueSubClusterCandidate2)
TH1F ** fHistoDoubleCountTrueSecPi0Pt
array of histos with double counted pi0s, pT, M02
TH1F ** fHistoMCEtaPt
array of histos without event weights pi0, pT
TH1F ** fHistoMCEtaWOWeightPt
array of histos with weighted eta, pT
TH1F ** fHistoMCPi0DalitzWOEvtWeightInAccPt
array of histos with weighted eta dalitz in acceptance, pT
TH2F ** fHistoNGoodESDTracksVsNClusterCandidates
array of histos with number of merged cluster candidates per event
TH2F ** fHistoMCSecPi0PtvsSource
array of histos without evt weight eta in acceptance, pT
TH1F ** fHistoMCPi0DalitzWOEvtWeightPt
array of histos with unweighted pi0 Dalitz, pT
const char Option_t
Definition: External.C:48
TList * fEventCutArray
current number of merged cluster candidates
TH1F ** fHistoMCEtaInAccPt
array of histos with weighted pi0 in acceptance, pT
bool Bool_t
Definition: External.C:53
TH2F ** fHistoTruePrimaryPi01ElectronMCPtResolPt
array of histos with validated weighted primary pi0, MCpt, resol pt
TProfile ** fProfileJetJetXSection
array of profiles with eta shift
vector< Int_t > fVectorDoubleCountTrueEtas
vector containing labels of validated pi0
TH1F ** fHistoVertexZ
array of histos with number of good tracks (2010 Standard track cuts)
vector< Int_t > fVectorDoubleCountTruePi0s
vector containing labels of validated pi0
TH2F ** fHistoDoubleCountTrueMultiplePi0PtvsM02
array of histos with double counted secondary pi0s, pT, M02
TH2F ** fHistoTruePrimaryPi0PureMergedMCPtResolPt
array of histos with validated weighted primary pi0, MCpt, resol pt
vector< Int_t > fVectorLabelsMultiplePi0Reduced
vector containing labels of validated pi0
TH2F ** fHistoClusNLMPt
array of histos with cluster, pt overlapping with other headers
TH2F ** fHistoTrueEtaPtY
array of histos with validated pi0, pt, Y
Bool_t CheckVector1ForEntryAndFillVector2(vector< Int_t > vecCheck, vector< Int_t > &vecFill, Int_t tobechecked)
void FillMultipleCountMap(map< Int_t, Int_t > &ma, Int_t tobechecked)
TH2F ** fHistoTrueClusElectronEM02
array of histos with validated gamma, E, m02