AliPhysics  d3874b5 (d3874b5)
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 
63 
64 //________________________________________________________________________
66  fV0Reader(NULL),
67  fV0ReaderName("V0ReaderV1"),
68  fCorrTaskSetting(""),
69  fDoLightOutput(kFALSE),
70  fInputEvent(NULL),
71  fMCEvent(NULL),
72  fCutFolder(NULL),
73  fESDList(NULL),
74  fTrueList(NULL),
75  fMCList(NULL),
76  fHeaderNameList(NULL),
77  fOutputContainer(NULL),
78  fNClusterCandidates(0),
79  fNClusterMergedCandidates(0),
80  fEventCutArray(NULL),
81  fEventCuts(NULL),
82  fClusterCutArray(NULL),
83  fClusterMergedCutArray(NULL),
84  fMesonCutArray(NULL),
85  fMesonCuts(NULL),
86  fHistoMotherInvMassPt(NULL),
87  fHistoMotherPtY(NULL),
88  fHistoMotherPtAlpha(NULL),
89  fHistoClusGammaPt(NULL),
90  fHistoClusGammaE(NULL),
91  fHistoClusOverlapHeadersGammaPt(NULL),
92  fHistoClusNLMPt(NULL),
93  fHistoClusMergedPtvsM02(NULL),
94  fHistoClusMergedPtvsM02Accepted(NULL),
95  fHistoClusMergedEvsM02Accepted(NULL),
96  fHistoClusNCellsPt(NULL),
97  fHistoClusMergedNCellsPt(NULL),
98  fHistoClusMergedNParticlePt(NULL),
99  fHistoClusMergedNCellsAroundPt(NULL),
100  fHistoClusMergedNCellsAroundAndInPt(NULL),
101  fHistoClusMergedEAroundE(NULL),
102  fHistoMCHeaders(NULL),
103  fHistoMCPi0Pt(NULL),
104  fHistoMCPi0WOWeightPt(NULL),
105  fHistoMCPi0WOEvtWeightPt(NULL),
106  fHistoMCEtaPt(NULL),
107  fHistoMCEtaWOWeightPt(NULL),
108  fHistoMCEtaWOEvtWeightPt(NULL),
109  fHistoMCPi0DalitzPt(NULL),
110  fHistoMCPi0DalitzWOWeightPt(NULL),
111  fHistoMCPi0DalitzWOEvtWeightPt(NULL),
112  fHistoMCEtaDalitzPt(NULL),
113  fHistoMCEtaDalitzWOWeightPt(NULL),
114  fHistoMCEtaDalitzWOEvtWeightPt(NULL),
115  fHistoMCPi0InAccPt(NULL),
116  fHistoMCEtaInAccPt(NULL),
117  fHistoMCPi0WOEvtWeightInAccPt(NULL),
118  fHistoMCEtaWOEvtWeightInAccPt(NULL),
119  fHistoMCPi0DalitzInAccPt(NULL),
120  fHistoMCEtaDalitzInAccPt(NULL),
121  fHistoMCPi0DalitzWOEvtWeightInAccPt(NULL),
122  fHistoMCEtaDalitzWOEvtWeightInAccPt(NULL),
123  fHistoMCSecPi0PtvsSource(NULL),
124  fHistoMCSecPi0InAccPtvsSource(NULL),
125  fHistoMCPi0PtJetPt(NULL),
126  fHistoMCEtaPtJetPt(NULL),
127  fHistoMCPrimaryPtvsSource(NULL),
128  fHistoMCPrimaryYvsSource(NULL),
129  fHistoMCDecayGammaPt(NULL),
130  fHistoMCAllGammaPt(NULL),
131  fHistoTrueClusMergedPtvsM02(NULL),
132  fHistoTrueClusPi0PtvsM02(NULL),
133  fHistoTrueClusPi0DalitzPtvsM02(NULL),
134  fHistoTrueClusPrimPi0PtvsM02(NULL),
135  fHistoTrueClusSecPi0PtvsM02(NULL),
136  fHistoTrueClusSecPi0FromK0sPtvsM02(NULL),
137  fHistoTrueClusSecPi0FromK0lPtvsM02(NULL),
138  fHistoTrueClusSecPi0FromLambdaPtvsM02(NULL),
139  fHistoTrueClusEtaPtvsM02(NULL),
140  fHistoTrueClusEtaDalitzPtvsM02(NULL),
141  fHistoTrueClusMergedPureFromPi0PtvsM02(NULL),
142  fHistoTrueClusMergedPureFromEtaPtvsM02(NULL),
143  fHistoTrueClusMergedPartConvFromPi0PtvsM02(NULL),
144  fHistoTrueClusMergedPartConvFromEtaPtvsM02(NULL),
145  fHistoTrueClusGammaFromPi0PtvsM02(NULL),
146  fHistoTrueClusGammaFromEtaPtvsM02(NULL),
147  fHistoTrueClusElectronFromPi0PtvsM02(NULL),
148  fHistoTrueClusElectronFromEtaPtvsM02(NULL),
149  fHistoTrueSecPi0PtvsDiffReco(NULL),
150  fHistoTrueClusBGPtvsM02(NULL),
151  fHistoTrueClusGammaPtvsM02(NULL),
152  fHistoTrueClusGammaPartConvPtvsM02(NULL),
153  fHistoTrueClusElectronPtvsM02(NULL),
154  fHistoTrueClusElectronFromGammaPtvsM02(NULL),
155  fHistoTrueClusMergedInvMassvsPt(NULL),
156  fHistoTrueClusPi0InvMassvsPt(NULL),
157  fHistoTrueClusPrimPi0InvMassvsPt(NULL),
158  fHistoTrueClusEtaInvMassvsPt(NULL),
159  fHistoTrueClusBGInvMassvsPt(NULL),
160  fHistoTrueClusGammaInvMassvsPt(NULL),
161  fHistoTrueClusElectronInvMassvsPt(NULL),
162  fHistoTrueClusBGPtvsSource(NULL),
163  fHistoTrueClusGammaPtvsSource(NULL),
164  fHistoTrueClusElectronPtvsSource(NULL),
165 // fHistoTrueClusElectronPtvsMotherID(NULL),
166 // fHistoTrueClusElectronPtvsTopMotherID(NULL),
167 // fHistoTrueClusElectronPtvsConvPhotonTopMotherID(NULL),
168  fHistoTrueMergedMissedPDG(NULL),
169  fHistoTruePi0PtY(NULL),
170  fHistoTrueEtaPtY(NULL),
171  fHistoTruePi0PtAlpha(NULL),
172  fHistoTrueEtaPtAlpha(NULL),
173  fHistoTrueClusGammaEM02(NULL),
174  fHistoTrueClusElectronEM02(NULL),
175  fHistoTrueClusPi0EM02(NULL),
176  fHistoTrueClusEtaEM02(NULL),
177  fHistoTruePrimaryPi0PureMergedMCPtResolPt(NULL),
178  fHistoTruePrimaryPi0MergedPartConvMCPtResolPt(NULL),
179  fHistoTruePrimaryPi01GammaMCPtResolPt(NULL),
180  fHistoTruePrimaryPi01ElectronMCPtResolPt(NULL),
181  fHistoTruePrimaryEtaMCPtResolPt(NULL),
182  fHistoTrueSecondaryPi0MCPtResolPt(NULL),
183  fHistoDoubleCountTruePi0PtvsM02(NULL),
184  fHistoDoubleCountTrueSecPi0Pt(NULL),
185  fHistoDoubleCountTrueEtaPtvsM02(NULL),
186  fVectorDoubleCountTruePi0s(0),
187  fVectorDoubleCountTrueEtas(0),
188  fHistoNEvents(NULL),
189  fHistoNEventsWOWeight(NULL),
190  fHistoNGoodESDTracks(NULL),
191  fHistoVertexZ(NULL),
192  fHistoNClusterCandidates(NULL),
193  fHistoNClusterMergedCandidates(NULL),
194  fHistoNGoodESDTracksVsNClusterCandidates(NULL),
195  fHistoSPDClusterTrackletBackground(NULL),
196  fHistoNV0Tracks(NULL),
197  fProfileEtaShift(NULL),
198  fProfileJetJetXSection(NULL),
199  fHistoJetJetNTrials(NULL),
200  fRandom(0),
201  fnCuts(0),
202  fiCut(0),
203  fIsHeavyIon(0),
204  fDoMesonQA(0),
205  fDoClusterQA(0),
206  fIsFromMBHeader(kTRUE),
207  fIsOverlappingWithOtherHeader(kFALSE),
208  fIsMC(0),
209  fSetPlotHistsExtQA(kFALSE),
210  fWeightJetJetMC(1),
211  fSelectedMesonID(0),
212  fEnableDetailedPrintOut(kFALSE),
213  fEnableSortForClusMC(kFALSE),
214  tBrokenFiles(NULL),
215  fFileNameBroken(NULL),
216  fDoDetailedM02(NULL),
217  fTrackMatcherRunningMode(0)
218 {
219 
220 }
221 
222 //________________________________________________________________________
224  AliAnalysisTaskSE(name),
225  fV0Reader(NULL),
226  fV0ReaderName("V0ReaderV1"),
227  fCorrTaskSetting(""),
228  fDoLightOutput(kFALSE),
229  fInputEvent(NULL),
230  fMCEvent(NULL),
231  fCutFolder(NULL),
232  fESDList(NULL),
233  fTrueList(NULL),
234  fMCList(NULL),
235  fHeaderNameList(NULL),
236  fOutputContainer(NULL),
237  fNClusterCandidates(0),
238  fNClusterMergedCandidates(0),
239  fEventCutArray(NULL),
240  fEventCuts(NULL),
241  fClusterCutArray(NULL),
242  fClusterMergedCutArray(NULL),
243  fMesonCutArray(NULL),
244  fMesonCuts(NULL),
245  fHistoMotherInvMassPt(NULL),
246  fHistoMotherPtY(NULL),
247  fHistoMotherPtAlpha(NULL),
248  fHistoClusGammaPt(NULL),
249  fHistoClusGammaE(NULL),
250  fHistoClusOverlapHeadersGammaPt(NULL),
251  fHistoClusNLMPt(NULL),
252  fHistoClusMergedPtvsM02(NULL),
253  fHistoClusMergedPtvsM02Accepted(NULL),
254  fHistoClusMergedEvsM02Accepted(NULL),
255  fHistoClusNCellsPt(NULL),
256  fHistoClusMergedNCellsPt(NULL),
257  fHistoClusMergedNParticlePt(NULL),
258  fHistoClusMergedNCellsAroundPt(NULL),
259  fHistoClusMergedNCellsAroundAndInPt(NULL),
260  fHistoClusMergedEAroundE(NULL),
261  fHistoMCHeaders(NULL),
262  fHistoMCPi0Pt(NULL),
263  fHistoMCPi0WOWeightPt(NULL),
264  fHistoMCPi0WOEvtWeightPt(NULL),
265  fHistoMCEtaPt(NULL),
266  fHistoMCEtaWOWeightPt(NULL),
267  fHistoMCEtaWOEvtWeightPt(NULL),
268  fHistoMCPi0DalitzPt(NULL),
269  fHistoMCPi0DalitzWOWeightPt(NULL),
270  fHistoMCPi0DalitzWOEvtWeightPt(NULL),
271  fHistoMCEtaDalitzPt(NULL),
272  fHistoMCEtaDalitzWOWeightPt(NULL),
273  fHistoMCEtaDalitzWOEvtWeightPt(NULL),
274  fHistoMCPi0InAccPt(NULL),
275  fHistoMCEtaInAccPt(NULL),
276  fHistoMCPi0WOEvtWeightInAccPt(NULL),
277  fHistoMCEtaWOEvtWeightInAccPt(NULL),
278  fHistoMCPi0DalitzInAccPt(NULL),
279  fHistoMCEtaDalitzInAccPt(NULL),
280  fHistoMCPi0DalitzWOEvtWeightInAccPt(NULL),
281  fHistoMCEtaDalitzWOEvtWeightInAccPt(NULL),
282  fHistoMCSecPi0PtvsSource(NULL),
283  fHistoMCSecPi0InAccPtvsSource(NULL),
284  fHistoMCPi0PtJetPt(NULL),
285  fHistoMCEtaPtJetPt(NULL),
286  fHistoMCPrimaryPtvsSource(NULL),
287  fHistoMCPrimaryYvsSource(NULL),
288  fHistoMCDecayGammaPt(NULL),
289  fHistoMCAllGammaPt(NULL),
290  fHistoTrueClusMergedPtvsM02(NULL),
291  fHistoTrueClusPi0PtvsM02(NULL),
292  fHistoTrueClusPi0DalitzPtvsM02(NULL),
293  fHistoTrueClusPrimPi0PtvsM02(NULL),
294  fHistoTrueClusSecPi0PtvsM02(NULL),
295  fHistoTrueClusSecPi0FromK0sPtvsM02(NULL),
296  fHistoTrueClusSecPi0FromK0lPtvsM02(NULL),
297  fHistoTrueClusSecPi0FromLambdaPtvsM02(NULL),
298  fHistoTrueClusEtaPtvsM02(NULL),
299  fHistoTrueClusEtaDalitzPtvsM02(NULL),
300  fHistoTrueClusMergedPureFromPi0PtvsM02(NULL),
301  fHistoTrueClusMergedPureFromEtaPtvsM02(NULL),
302  fHistoTrueClusMergedPartConvFromPi0PtvsM02(NULL),
303  fHistoTrueClusMergedPartConvFromEtaPtvsM02(NULL),
304  fHistoTrueClusGammaFromPi0PtvsM02(NULL),
305  fHistoTrueClusGammaFromEtaPtvsM02(NULL),
306  fHistoTrueClusElectronFromPi0PtvsM02(NULL),
307  fHistoTrueClusElectronFromEtaPtvsM02(NULL),
308  fHistoTrueSecPi0PtvsDiffReco(NULL),
309  fHistoTrueClusBGPtvsM02(NULL),
310  fHistoTrueClusGammaPtvsM02(NULL),
311  fHistoTrueClusGammaPartConvPtvsM02(NULL),
312  fHistoTrueClusElectronPtvsM02(NULL),
313  fHistoTrueClusElectronFromGammaPtvsM02(NULL),
314  fHistoTrueClusMergedInvMassvsPt(NULL),
315  fHistoTrueClusPi0InvMassvsPt(NULL),
316  fHistoTrueClusPrimPi0InvMassvsPt(NULL),
317  fHistoTrueClusEtaInvMassvsPt(NULL),
318  fHistoTrueClusBGInvMassvsPt(NULL),
319  fHistoTrueClusGammaInvMassvsPt(NULL),
320  fHistoTrueClusElectronInvMassvsPt(NULL),
321  fHistoTrueClusBGPtvsSource(NULL),
322  fHistoTrueClusGammaPtvsSource(NULL),
323  fHistoTrueClusElectronPtvsSource(NULL),
324 // fHistoTrueClusElectronPtvsMotherID(NULL),
325 // fHistoTrueClusElectronPtvsTopMotherID(NULL),
326 // fHistoTrueClusElectronPtvsConvPhotonTopMotherID(NULL),
327  fHistoTrueMergedMissedPDG(NULL),
328  fHistoTruePi0PtY(NULL),
329  fHistoTrueEtaPtY(NULL),
330  fHistoTruePi0PtAlpha(NULL),
331  fHistoTrueEtaPtAlpha(NULL),
332  fHistoTrueClusGammaEM02(NULL),
333  fHistoTrueClusElectronEM02(NULL),
334  fHistoTrueClusPi0EM02(NULL),
335  fHistoTrueClusEtaEM02(NULL),
336  fHistoTruePrimaryPi0PureMergedMCPtResolPt(NULL),
337  fHistoTruePrimaryPi0MergedPartConvMCPtResolPt(NULL),
338  fHistoTruePrimaryPi01GammaMCPtResolPt(NULL),
339  fHistoTruePrimaryPi01ElectronMCPtResolPt(NULL),
340  fHistoTruePrimaryEtaMCPtResolPt(NULL),
341  fHistoTrueSecondaryPi0MCPtResolPt(NULL),
342  fHistoDoubleCountTruePi0PtvsM02(NULL),
343  fHistoDoubleCountTrueSecPi0Pt(NULL),
344  fHistoDoubleCountTrueEtaPtvsM02(NULL),
345  fVectorDoubleCountTruePi0s(0),
346  fVectorDoubleCountTrueEtas(0),
347  fHistoNEvents(NULL),
348  fHistoNEventsWOWeight(NULL),
349  fHistoNGoodESDTracks(NULL),
350  fHistoVertexZ(NULL),
351  fHistoNClusterCandidates(NULL),
352  fHistoNClusterMergedCandidates(NULL),
353  fHistoNGoodESDTracksVsNClusterCandidates(NULL),
354  fHistoSPDClusterTrackletBackground(NULL),
355  fHistoNV0Tracks(NULL),
356  fProfileEtaShift(NULL),
357  fProfileJetJetXSection(NULL),
358  fHistoJetJetNTrials(NULL),
359  fRandom(0),
360  fnCuts(0),
361  fiCut(0),
362  fIsHeavyIon(0),
363  fDoMesonQA(0),
364  fDoClusterQA(0),
365  fIsFromMBHeader(kTRUE),
366  fIsOverlappingWithOtherHeader(kFALSE),
367  fIsMC(0),
368  fSetPlotHistsExtQA(kFALSE),
369  fWeightJetJetMC(1),
370  fSelectedMesonID(0),
371  fEnableDetailedPrintOut(kFALSE),
372  fEnableSortForClusMC(kFALSE),
373  tBrokenFiles(NULL),
374  fFileNameBroken(NULL),
375  fDoDetailedM02(NULL),
376  fTrackMatcherRunningMode(0)
377 {
378  // Define output slots here
379  DefineOutput(1, TList::Class());
380 }
381 
383 {
384 
385 }
386 
387 //________________________________________________________________________
389 
390  fV0Reader=(AliV0ReaderV1*)AliAnalysisManager::GetAnalysisManager()->GetTask(fV0ReaderName.Data());
391  if(!fV0Reader){printf("Error: No V0 Reader");return;} // GetV0Reader
392 
393 
394  Int_t invMassBins = 800;
395  Float_t startMass = 0;
396  Float_t endMass = 0.8;
397  Double_t *arrPtBinning = new Double_t[1000];
398 
399  if (GetSelectedMesonID() == 1) {
400  invMassBins = 400;
401  startMass = 0;
402  endMass = 0.4;
403  } else if (GetSelectedMesonID() == 2) {
404  invMassBins = 800;
405  startMass = 0.;
406  endMass = 0.8;
407  }
408 
409  Int_t ptBinsDefClus = 500;
410  Float_t startPtDefClus = 0;
411  Float_t endPtDefClus = 50;
412 
413  Int_t ptBins = 400;
414  Float_t startPt = 10;
415  Float_t endPt = 50;
416 
417  Int_t ptBinsLog = 200;
418  Float_t startPtLog = 10;
419  Float_t endPtLog = 50;
420  if (GetSelectedMesonID() == 2 ) {
421  ptBins = 500;
422  startPt = 20;
423  endPt = 70;
424  for(Int_t i=0; i<ptBins+1;i++){
425  arrPtBinning[i] = 10.+((endPt-startPt)/ptBins)*i;
426  }
427  ptBinsLog = 250;
428  startPtLog = 20;
429  endPtLog = 70;
430  } else if (((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetEnergyEnum() == AliConvEventCuts::k5TeV ||
431  ((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetEnergyEnum() == AliConvEventCuts::k7TeV ||
432  ((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetEnergyEnum() == AliConvEventCuts::k8TeV ||
436  ptBins = 610;
437  startPt = 10;
438  endPt = 200;
439  // pT dependet binning for very high pT analyses
440  for(Int_t i=0; i<ptBins+2;i++){
441  if(i<400)
442  arrPtBinning[i] = 10.+0.1*i;
443  else if(i<500)
444  arrPtBinning[i] = 50.+0.2*(i-400);
445  else if(i<540)
446  arrPtBinning[i] = 70.+0.5*(i-500);
447  else if(i<570)
448  arrPtBinning[i] = 90.+1.0*(i-540);
449  else
450  arrPtBinning[i] = 120+2.0*(i-570);
451  }
452  ptBinsLog = 475;
453  startPtLog = 10;
454  endPtLog = 200;
455  ptBinsDefClus = 1000;
456  startPtDefClus = 0;
457  endPtDefClus = 200;
458  } else if (((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetEnergyEnum() == AliConvEventCuts::k13TeVLowB ||
460  ptBins = 900;
461  startPt = 10;
462  endPt = 100;
463  for(Int_t i=0; i<ptBins+1;i++){
464  arrPtBinning[i] = 10.+((endPt-startPt)/ptBins)*i;
465  }
466  ptBinsLog = 450;
467  startPtLog = 10;
468  endPtLog = 100;
469  ptBinsDefClus = 1000;
470  startPtDefClus = 0;
471  endPtDefClus = 100;
472  } else {
473  for(Int_t i=0; i<ptBins+1;i++){
474  arrPtBinning[i] = 10.+((endPt-startPt)/ptBins)*i;
475  }
476  }
477 
478  Int_t showerShapeBins = 500;
479  Float_t startShowerShape = 0;
480  Float_t endShowerShape = 5;
481 
482  if (fDoDetailedM02) showerShapeBins = 5000;
483 
484  // Create histograms
485  if(fOutputContainer != NULL){
486  delete fOutputContainer;
487  fOutputContainer = NULL;
488  }
489  if(fOutputContainer == NULL){
490  fOutputContainer = new TList();
491  fOutputContainer->SetOwner(kTRUE);
492  }
493 
494  fCutFolder = new TList*[fnCuts];
495  fESDList = new TList*[fnCuts];
496 
497  fHistoNEvents = new TH1F*[fnCuts];
498  if(fIsMC == 2){
499  fHistoNEventsWOWeight = new TH1F*[fnCuts];
500  fProfileJetJetXSection = new TProfile*[fnCuts];
501  fHistoJetJetNTrials = new TH1F*[fnCuts];
502  }
503 
504  fHistoNGoodESDTracks = new TH1F*[fnCuts];
505  fHistoVertexZ = new TH1F*[fnCuts];
506  fHistoNClusterCandidates = new TH1F*[fnCuts];
510  fHistoNV0Tracks = new TH1F*[fnCuts];
511  fProfileEtaShift = new TProfile*[fnCuts];
512 
514  if (fDoMesonQA > 0 ){
515  fHistoMotherPtY = new TH2F*[fnCuts];
517  }
518 
519  fHistoClusGammaPt = new TH1F*[fnCuts];
520  fHistoClusGammaE = new TH1F*[fnCuts];
525  fHistoClusNLMPt = new TH2F*[fnCuts];
526  if (fDoClusterQA > 0){
532 
533  if (fIsMC > 0){
535  }
536 
537  }
538 
539  for(Int_t iCut = 0; iCut<fnCuts;iCut++){
540  TString cutstringEvent = ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber();
541  TString cutstringCalo = ((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetCutNumber();
542  TString cutstringCaloMerged = ((AliCaloPhotonCuts*)fClusterMergedCutArray->At(iCut))->GetCutNumber();
543  TString cutstringMeson = ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutNumber();
544 
545  //Int_t nLMCut = ((AliCaloPhotonCuts*)fClusterMergedCutArray->At(iCut))->GetMinNLMCut();
546 
547  fCutFolder[iCut] = new TList();
548  fCutFolder[iCut]->SetName(Form("Cut Number %s_%s_%s_%s",cutstringEvent.Data(), cutstringCalo.Data(), cutstringCaloMerged.Data(), cutstringMeson.Data()));
549  fCutFolder[iCut]->SetOwner(kTRUE);
550  fOutputContainer->Add(fCutFolder[iCut]);
551  fESDList[iCut] = new TList();
552  fESDList[iCut]->SetName(Form("%s_%s_%s_%s ESD histograms",cutstringEvent.Data(), cutstringCalo.Data(), cutstringCaloMerged.Data(), cutstringMeson.Data()));
553  fESDList[iCut]->SetOwner(kTRUE);
554  fCutFolder[iCut]->Add(fESDList[iCut]);
555 
556  fHistoNEvents[iCut] = new TH1F("NEvents","NEvents",14,-0.5,13.5);
557  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(1,"Accepted");
558  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(2,"Centrality");
559  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(3,"Miss. MC or inc. ev.");
560  if (((AliConvEventCuts*)fEventCutArray->At(iCut))->IsSpecialTrigger() > 1 ){
561  TString TriggerNames = "Not Trigger: ";
562  TriggerNames = TriggerNames+ ( (AliConvEventCuts*)fEventCutArray->At(iCut))->GetSpecialTriggerName();
563  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(4,TriggerNames.Data());
564  } else {
565  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(4,"Trigger");
566  }
567  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(5,"Vertex Z");
568  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(6,"Cont. Vertex");
569  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(7,"Pile-Up");
570  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(8,"no SDD");
571  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(9,"no V0AND");
572  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(10,"EMCAL problems");
573  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(11,"rejectedForJetJetMC");
574  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(12,"SPD hits vs tracklet");
575  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(13,"Out-of-Bunch pileup Past-Future");
576  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(14,"Pileup V0M-TPCout Tracks");
577  fESDList[iCut]->Add(fHistoNEvents[iCut]);
578 
579  if (fIsMC == 2){
580  fHistoNEventsWOWeight[iCut] = new TH1F("NEventsWOWeight","NEventsWOWeight",14,-0.5,13.5);
581  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(1,"Accepted");
582  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(2,"Centrality");
583  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(3,"Miss. MC or inc. ev.");
584  if (((AliConvEventCuts*)fEventCutArray->At(iCut))->IsSpecialTrigger() > 1 ){
585  TString TriggerNames = "Not Trigger: ";
586  TriggerNames = TriggerNames+ ( (AliConvEventCuts*)fEventCutArray->At(iCut))->GetSpecialTriggerName();
587  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(4,TriggerNames.Data());
588  } else {
589  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(4,"Trigger");
590  }
591  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(5,"Vertex Z");
592  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(6,"Cont. Vertex");
593  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(7,"Pile-Up");
594  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(8,"no SDD");
595  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(9,"no V0AND");
596  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(10,"EMCAL problem");
597  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(11,"rejectedForJetJetMC");
598  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(12,"SPD hits vs tracklet");
599  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(13,"Out-of-Bunch pileup Past-Future");
600  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(14,"Pileup V0M-TPCout Tracks");
601  fESDList[iCut]->Add(fHistoNEventsWOWeight[iCut]);
602 
603  fProfileJetJetXSection[iCut] = new TProfile("XSection","XSection",1,-0.5,0.5);
604  fESDList[iCut]->Add(fProfileJetJetXSection[iCut]);
605  fHistoJetJetNTrials[iCut] = new TH1F("NTrials","#sum{NTrials}",1,0,1);
606  fHistoJetJetNTrials[iCut]->GetXaxis()->SetBinLabel(1,"#sum{NTrials}");
607  fESDList[iCut]->Add(fHistoJetJetNTrials[iCut]);
608  }
609 
610  if(fIsHeavyIon == 1)
611  fHistoNGoodESDTracks[iCut] = new TH1F("GoodESDTracks","GoodESDTracks",4000,-0.5,3999.5);
612  else if(fIsHeavyIon == 2)
613  fHistoNGoodESDTracks[iCut] = new TH1F("GoodESDTracks","GoodESDTracks",400,-0.5,399.5);
614  else
615  fHistoNGoodESDTracks[iCut] = new TH1F("GoodESDTracks","GoodESDTracks",200,-0.5,199.5);
616  fESDList[iCut]->Add(fHistoNGoodESDTracks[iCut]);
617 
618  fHistoVertexZ[iCut] = new TH1F("VertexZ","VertexZ",1000,-50,50);
619  fESDList[iCut]->Add(fHistoVertexZ[iCut]);
620 
621  if(fIsHeavyIon == 1)
622  fHistoNClusterCandidates[iCut] = new TH1F("GammaCandidates","GammaCandidates",600,-0.5,599.5);
623  else if(fIsHeavyIon == 2)
624  fHistoNClusterCandidates[iCut] = new TH1F("GammaCandidates","GammaCandidates",400,-0.5,399.5);
625  else
626  fHistoNClusterCandidates[iCut] = new TH1F("GammaCandidates","GammaCandidates",100,-0.5,99.5);
627  fESDList[iCut]->Add(fHistoNClusterCandidates[iCut]);
628 
629  if(fIsHeavyIon == 1)
630  fHistoNClusterMergedCandidates[iCut] = new TH1F("MergedCandidates","MergedCandidates",300,-0.5,299.5);
631  else if(fIsHeavyIon == 2)
632  fHistoNClusterMergedCandidates[iCut] = new TH1F("MergedCandidates","MergedCandidates",200,-0.5,199.5);
633  else
634  fHistoNClusterMergedCandidates[iCut] = new TH1F("MergedCandidates","MergedCandidates",50,-0.5,49.5);
635  fESDList[iCut]->Add(fHistoNClusterMergedCandidates[iCut]);
636 
637 
638  if(fIsHeavyIon == 1)
639  fHistoNGoodESDTracksVsNClusterCandidates[iCut] = new TH2F("GoodESDTracksVsGammaCandidates","GoodESDTracksVsGammaCandidates",4000,-0.5,3999.5,600,-0.5,599.5);
640  else if(fIsHeavyIon == 2)
641  fHistoNGoodESDTracksVsNClusterCandidates[iCut] = new TH2F("GoodESDTracksVsGammaCandidates","GoodESDTracksVsGammaCandidates",400,-0.5,399.5,400,-0.5,399.5);
642  else
643  fHistoNGoodESDTracksVsNClusterCandidates[iCut] = new TH2F("GoodESDTracksVsGammaCandidates","GoodESDTracksVsGammaCandidates",200,-0.5,199.5,100,-0.5,99.5);
645 
646  fHistoSPDClusterTrackletBackground[iCut] = new TH2F("SPD tracklets vs SPD clusters","SPD tracklets vs SPD clusters",100,0,200,250,0,1000);
648 
649  if(fIsHeavyIon == 1)
650  fHistoNV0Tracks[iCut] = new TH1F("V0 Multiplicity","V0 Multiplicity",30000,-0.5,29999.5);
651  else if(fIsHeavyIon == 2)
652  fHistoNV0Tracks[iCut] = new TH1F("V0 Multiplicity","V0 Multiplicity",2500,-0.5,2499.5);
653  else
654  fHistoNV0Tracks[iCut] = new TH1F("V0 Multiplicity","V0 Multiplicity",1500,-0.5,1499.5);
655  fESDList[iCut]->Add(fHistoNV0Tracks[iCut]);
656  fProfileEtaShift[iCut] = new TProfile("Eta Shift","Eta Shift",1, -0.5,0.5);
657  fESDList[iCut]->Add(fProfileEtaShift[iCut]);
658 
659  if (fIsMC == 2){
660  fHistoNEvents[iCut]->Sumw2();
661  fHistoNGoodESDTracks[iCut]->Sumw2();
662  fHistoVertexZ[iCut]->Sumw2();
663  fHistoNClusterCandidates[iCut]->Sumw2();
665  fHistoSPDClusterTrackletBackground[iCut]->Sumw2();
666  fHistoNV0Tracks[iCut]->Sumw2();
667  fProfileEtaShift[iCut]->Sumw2();
668  }
669 
670  fHistoClusGammaPt[iCut] = new TH1F("ClusGamma_Pt","ClusGamma_Pt",ptBinsDefClus, startPtDefClus, endPtDefClus);
671  fESDList[iCut]->Add(fHistoClusGammaPt[iCut]);
672  fHistoClusGammaE[iCut] = new TH1F("ClusGamma_E","ClusGamma_E",ptBinsDefClus, startPtDefClus, endPtDefClus);
673  fESDList[iCut]->Add(fHistoClusGammaE[iCut]);
674  fHistoClusOverlapHeadersGammaPt[iCut] = new TH1F("ClusGammaOverlapHeaders_Pt","ClusGammaOverlapHeaders_Pt",ptBins, arrPtBinning);
675  fESDList[iCut]->Add(fHistoClusOverlapHeadersGammaPt[iCut]);
676  fHistoClusMergedPtvsM02[iCut] = new TH2F("ClusMerged_Pt_M02","ClusMerged_Pt_M02",ptBins, arrPtBinning,showerShapeBins, startShowerShape, endShowerShape);
677  fESDList[iCut]->Add(fHistoClusMergedPtvsM02[iCut]);
678  fHistoClusMergedPtvsM02Accepted[iCut] = new TH2F("ClusMerged_Pt_M02_AcceptedMeson","ClusMerged_Pt_M02_AcceptedMeson",ptBins, arrPtBinning,showerShapeBins, startShowerShape, endShowerShape);
679  fESDList[iCut]->Add(fHistoClusMergedPtvsM02Accepted[iCut]);
680  fHistoClusMergedEvsM02Accepted[iCut] = new TH2F("ClusMerged_E_M02_AcceptedMeson","ClusMerged_E_M02_AcceptedMeson",ptBins, arrPtBinning, showerShapeBins, startShowerShape, endShowerShape);
681  fESDList[iCut]->Add(fHistoClusMergedEvsM02Accepted[iCut]);
682  fHistoClusNLMPt[iCut] = new TH2F("ClusMerged_NLM_Pt_AcceptedMeson","ClusMerged_NLM_Pt_AcceptedMeson",12, -0.5, 11.5, ptBins, arrPtBinning);
683  fESDList[iCut]->Add(fHistoClusNLMPt[iCut]);
684 
685 
686  if (fIsMC == 2){
687  fHistoClusGammaPt[iCut]->Sumw2();
688  fHistoClusGammaE[iCut]->Sumw2();
689  fHistoClusOverlapHeadersGammaPt[iCut]->Sumw2();
690  fHistoClusMergedPtvsM02[iCut]->Sumw2();
691  fHistoClusMergedPtvsM02Accepted[iCut]->Sumw2();
692  fHistoClusMergedEvsM02Accepted[iCut]->Sumw2();
693  fHistoClusNLMPt[iCut]->Sumw2();
694  }
695 
696  if (fDoClusterQA > 0){
697  fHistoClusNCellsPt[iCut] = new TH2F("Clus_NCells_Pt","Clus_NCells_Pt",100,-0.5,99.5,ptBins, arrPtBinning);
698  fESDList[iCut]->Add(fHistoClusNCellsPt[iCut]);
699  fHistoClusMergedNCellsPt[iCut] = new TH2F("ClusMerged_NCells_Pt","ClusMerged_NCells_Pt",100,-0.5,99.5,ptBins, arrPtBinning);
700  fESDList[iCut]->Add(fHistoClusMergedNCellsPt[iCut]);
701  fHistoClusMergedNCellsAroundPt[iCut] = new TH2F("ClusMerged_NCellsAroundClus_Pt","ClusMerged_NCellsAroundClus_Pt",100,-0.5,99.5,ptBins, arrPtBinning);
702  fESDList[iCut]->Add(fHistoClusMergedNCellsAroundPt[iCut]);
703  fHistoClusMergedNCellsAroundAndInPt[iCut] = new TH2F("ClusMerged_NCellsAroundAndInClus_Pt","ClusMerged_NCellsAroundAndInClus_Pt",100,-0.5,99.5,ptBins, arrPtBinning);
705  fHistoClusMergedEAroundE[iCut] = new TH2F("ClusMerged_EAroundClus_E","ClusMerged_EAroundClus_E",ptBinsDefClus, startPtDefClus, endPtDefClus, ptBins, arrPtBinning);
706  fESDList[iCut]->Add(fHistoClusMergedEAroundE[iCut]);
707 
708  if (fIsMC > 0){
709  fHistoClusMergedNParticlePt[iCut] = new TH2F("ClusMerged_NPart_Pt","ClusMerged_NPart_Pt",100,-0.5,99.5,ptBins, arrPtBinning);
710  fESDList[iCut]->Add(fHistoClusMergedNParticlePt[iCut]);
711  if (fIsMC == 2){
712  fHistoClusNCellsPt[iCut]->Sumw2();
713  fHistoClusMergedNCellsPt[iCut]->Sumw2();
714  fHistoClusMergedNCellsAroundPt[iCut]->Sumw2();
716  fHistoClusMergedEAroundE[iCut]->Sumw2();
717  fHistoClusMergedNParticlePt[iCut]->Sumw2();
718  fHistoClusMergedEAroundE[iCut]->Sumw2();
719  }
720  }
721  }
722 
723  fHistoMotherInvMassPt[iCut] = new TH2F("ESD_Mother_InvMass_Pt","ESD_Mother_InvMass_Pt",invMassBins, startMass, endMass,ptBins, arrPtBinning);
724  fESDList[iCut]->Add(fHistoMotherInvMassPt[iCut]);
725 
726  if (fIsMC == 2){
727  fHistoMotherInvMassPt[iCut]->Sumw2();
728  }
729 
730  if (fDoMesonQA > 0 ){
731  fHistoMotherPtY[iCut] = new TH2F("ESD_Mother_Pt_Y","ESD_Mother_Pt_Y", ptBinsLog, startPtLog, endPtLog, 150, -1.5, 1.5);
733  fESDList[iCut]->Add(fHistoMotherPtY[iCut]);
734  fHistoMotherPtAlpha[iCut] = new TH2F("ESD_Mother_Pt_Alpha","ESD_Mother_Pt_Alpha", ptBinsLog, startPtLog, endPtLog, 100, 0, 1);
736  fESDList[iCut]->Add(fHistoMotherPtAlpha[iCut]);
737  if (fIsMC == 2){
738  fHistoMotherPtY[iCut]->Sumw2();
739  fHistoMotherPtAlpha[iCut]->Sumw2();
740  }
741  }
742  }
743 
744  if (fIsMC > 0){
745  fMCList = new TList*[fnCuts];
746  fTrueList = new TList*[fnCuts];
747 
748  fHistoMCHeaders = new TH1I*[fnCuts];
749  fHistoMCPi0Pt = new TH1F*[fnCuts];
750  fHistoMCEtaPt = new TH1F*[fnCuts];
753  fHistoMCDecayGammaPt = new TH1F*[fnCuts];
754  fHistoMCAllGammaPt = new TH1F*[fnCuts];
755  if (GetSelectedMesonID() != 2){
756  fHistoMCPi0WOWeightPt = new TH1F*[fnCuts];
757  fHistoMCPi0InAccPt = new TH1F*[fnCuts];
761  fHistoMCPi0DalitzPt = new TH1F*[fnCuts];
762  fHistoMCPi0DalitzWOWeightPt = new TH1F*[fnCuts];
763  fHistoMCPi0DalitzInAccPt = new TH1F*[fnCuts];
765  }
766  if (GetSelectedMesonID() != 1){
767  fHistoMCEtaWOWeightPt = new TH1F*[fnCuts];
768  fHistoMCEtaInAccPt = new TH1F*[fnCuts];
770  fHistoMCEtaDalitzPt = new TH1F*[fnCuts];
771  fHistoMCEtaDalitzWOWeightPt = new TH1F*[fnCuts];
772  fHistoMCEtaDalitzInAccPt = new TH1F*[fnCuts];
774  }
775  if (fIsMC == 2){
776  if (GetSelectedMesonID() != 2){
777  fHistoMCPi0WOEvtWeightPt = new TH1F*[fnCuts];
779  }
780  if (GetSelectedMesonID() != 1){
781  fHistoMCEtaWOEvtWeightPt = new TH1F*[fnCuts];
783  }
784  if (fDoMesonQA > 0){
785  if (GetSelectedMesonID() != 2)
787  if (GetSelectedMesonID() != 1)
789  }
790  }
791 
795  if (GetSelectedMesonID() < 2){
802  }
817 
821 // fHistoTrueClusElectronPtvsMotherID = new TH2F*[fnCuts];
822 // fHistoTrueClusElectronPtvsTopMotherID = new TH2F*[fnCuts];
823 // fHistoTrueClusElectronPtvsConvPhotonTopMotherID = new TH2F*[fnCuts];
824  fHistoTrueMergedMissedPDG = new TH1F*[fnCuts];
825 
829 
830  if (fDoMesonQA > 1){
837  if (GetSelectedMesonID() < 2){
839  }
840  }
841 
842  if (fDoMesonQA > 0){
847 
848  if (GetSelectedMesonID() != 2){
849  fHistoTruePi0PtY = new TH2F*[fnCuts];
856  }
857  if (GetSelectedMesonID() != 1){
858  fHistoTrueEtaPtY = new TH2F*[fnCuts];
861  }
862  }
863 
864  for(Int_t iCut = 0; iCut<fnCuts;iCut++){
865  TString cutstringEvent = ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber();
866  TString cutstringCalo = ((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetCutNumber();
867  TString cutstringCaloMerged = ((AliCaloPhotonCuts*)fClusterMergedCutArray->At(iCut))->GetCutNumber();
868  TString cutstringMeson = ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutNumber();
869 
870 
871  fMCList[iCut] = new TList();
872  fMCList[iCut]->SetName(Form("%s_%s_%s_%s MC histograms",cutstringEvent.Data(),cutstringCalo.Data(),cutstringCaloMerged.Data(), cutstringMeson.Data()));
873  fMCList[iCut]->SetOwner(kTRUE);
874  fCutFolder[iCut]->Add(fMCList[iCut]);
875  fHistoMCHeaders[iCut] = new TH1I("MC_Headers", "MC_Headers", 20, 0, 20);
876  fMCList[iCut]->Add(fHistoMCHeaders[iCut]);
877  fHistoMCPi0Pt[iCut] = new TH1F("MC_Pi0_Pt","MC_Pi0_Pt",ptBins, arrPtBinning);
878  fHistoMCPi0Pt[iCut]->Sumw2();
879  fMCList[iCut]->Add(fHistoMCPi0Pt[iCut]);
880  fHistoMCEtaPt[iCut] = new TH1F("MC_Eta_Pt","MC_Eta_Pt",ptBins, arrPtBinning);
881  fHistoMCEtaPt[iCut]->Sumw2();
882  fMCList[iCut]->Add(fHistoMCEtaPt[iCut]);
883 
884  fHistoMCPrimaryPtvsSource[iCut] = new TH2F("MC_Primary_Pt_Source","MC_Primary_Pt_Source",ptBins, arrPtBinning, 7, -0.5, 6.5);
885  fHistoMCPrimaryPtvsSource[iCut]->GetYaxis()->SetBinLabel(1,"Pi+");
886  fHistoMCPrimaryPtvsSource[iCut]->GetYaxis()->SetBinLabel(2,"Pi-");
887  fHistoMCPrimaryPtvsSource[iCut]->GetYaxis()->SetBinLabel(3,"K+");
888  fHistoMCPrimaryPtvsSource[iCut]->GetYaxis()->SetBinLabel(4,"K-");
889  fHistoMCPrimaryPtvsSource[iCut]->GetYaxis()->SetBinLabel(5,"K0s");
890  fHistoMCPrimaryPtvsSource[iCut]->GetYaxis()->SetBinLabel(6,"K0l");
891  fHistoMCPrimaryPtvsSource[iCut]->GetYaxis()->SetBinLabel(7,"Lambda");
892  fHistoMCPrimaryPtvsSource[iCut]->Sumw2();
893  fMCList[iCut]->Add(fHistoMCPrimaryPtvsSource[iCut]);
894 
895  fHistoMCPrimaryYvsSource[iCut] = new TH2F("MC_Primary_Y_Source","MC_Primary_Y_Source",400, -20, 20, 7, -0.5, 6.5);
896  fHistoMCPrimaryYvsSource[iCut]->GetYaxis()->SetBinLabel(1,"Pi+");
897  fHistoMCPrimaryYvsSource[iCut]->GetYaxis()->SetBinLabel(2,"Pi-");
898  fHistoMCPrimaryYvsSource[iCut]->GetYaxis()->SetBinLabel(3,"K+");
899  fHistoMCPrimaryYvsSource[iCut]->GetYaxis()->SetBinLabel(4,"K-");
900  fHistoMCPrimaryYvsSource[iCut]->GetYaxis()->SetBinLabel(5,"K0s");
901  fHistoMCPrimaryYvsSource[iCut]->GetYaxis()->SetBinLabel(6,"K0l");
902  fHistoMCPrimaryYvsSource[iCut]->GetYaxis()->SetBinLabel(7,"Lambda");
903  fHistoMCPrimaryYvsSource[iCut]->Sumw2();
904  fMCList[iCut]->Add(fHistoMCPrimaryYvsSource[iCut]);
905 
906  fHistoMCDecayGammaPt[iCut] = new TH1F("MC_DecayGamma_Pt","MC_DecayGamma_Pt",ptBins, arrPtBinning);
907  fHistoMCDecayGammaPt[iCut]->Sumw2();
908  fMCList[iCut]->Add(fHistoMCDecayGammaPt[iCut]);
909  fHistoMCAllGammaPt[iCut] = new TH1F("MC_AllGamma_Pt","MC_AllGamma_Pt",ptBins, arrPtBinning);
910  fHistoMCAllGammaPt[iCut]->Sumw2();
911  fMCList[iCut]->Add(fHistoMCAllGammaPt[iCut]);
912 
913  if (GetSelectedMesonID() != 2){
914  fHistoMCPi0WOWeightPt[iCut] = new TH1F("MC_Pi0_WOWeights_Pt","MC_Pi0_WOWeights_Pt",ptBins, arrPtBinning);
915  fMCList[iCut]->Add(fHistoMCPi0WOWeightPt[iCut]);
916  fHistoMCPi0InAccPt[iCut] = new TH1F("MC_Pi0InAcc_Pt","MC_Pi0InAcc_Pt",ptBins, arrPtBinning);
917  fHistoMCPi0InAccPt[iCut]->Sumw2();
918  fMCList[iCut]->Add(fHistoMCPi0InAccPt[iCut]);
919  fHistoMCPi0DalitzPt[iCut] = new TH1F("MC_Pi0Dalitz_Pt","MC_Pi0Dalitz_Pt",ptBins, arrPtBinning);
920  fHistoMCPi0DalitzPt[iCut]->Sumw2();
921  fMCList[iCut]->Add(fHistoMCPi0DalitzPt[iCut]);
922  fHistoMCPi0DalitzWOWeightPt[iCut] = new TH1F("MC_Pi0Dalitz_WOWeights_Pt","MC_Pi0Dalitz_WOWeights_Pt",ptBins, arrPtBinning);
923  fMCList[iCut]->Add(fHistoMCPi0DalitzWOWeightPt[iCut]);
924  fHistoMCPi0DalitzInAccPt[iCut] = new TH1F("MC_Pi0DalitzInAcc_Pt","MC_Pi0DalitzInAcc_Pt",ptBins, arrPtBinning);
925  fHistoMCPi0DalitzInAccPt[iCut]->Sumw2();
926  fMCList[iCut]->Add(fHistoMCPi0DalitzInAccPt[iCut]);
927 
928  // initialization for secondary histograms
929  fHistoMCSecPi0PtvsSource[iCut] = new TH2F("MC_SecPi0_Pt_Source","MC_SecPi0_Pt_Source", ptBins, arrPtBinning, 16, -0.5, 15.5);
930  fHistoMCSecPi0PtvsSource[iCut]->Sumw2();
931  fMCList[iCut]->Add(fHistoMCSecPi0PtvsSource[iCut]);
932  fHistoMCSecPi0InAccPtvsSource[iCut] = new TH2F("MC_SecPi0InAcc_Pt_Source","MC_SecPi0InAcc_Pt_Source", ptBins, arrPtBinning, 16, -0.5, 15.5);
933  fHistoMCSecPi0InAccPtvsSource[iCut]->Sumw2();
934  fMCList[iCut]->Add(fHistoMCSecPi0InAccPtvsSource[iCut]);
935  }
936 
937  if (GetSelectedMesonID() != 1){
938  fHistoMCEtaWOWeightPt[iCut] = new TH1F("MC_Eta_WOWeights_Pt","MC_Eta_WOWeights_Pt",ptBins, arrPtBinning);
939  fMCList[iCut]->Add(fHistoMCEtaWOWeightPt[iCut]);
940  fHistoMCEtaInAccPt[iCut] = new TH1F("MC_EtaInAcc_Pt","MC_EtaInAcc_Pt",ptBins, arrPtBinning);
941  fHistoMCEtaInAccPt[iCut]->Sumw2();
942  fMCList[iCut]->Add(fHistoMCEtaInAccPt[iCut]);
943  fHistoMCEtaDalitzPt[iCut] = new TH1F("MC_EtaDalitz_Pt","MC_EtaDalitz_Pt",ptBins, arrPtBinning);
944  fHistoMCEtaDalitzPt[iCut]->Sumw2();
945  fMCList[iCut]->Add(fHistoMCEtaDalitzPt[iCut]);
946  fHistoMCEtaDalitzWOWeightPt[iCut] = new TH1F("MC_EtaDalitz_WOWeights_Pt","MC_EtaDalitz_WOWeights_Pt",ptBins, arrPtBinning);
947  fMCList[iCut]->Add(fHistoMCEtaDalitzWOWeightPt[iCut]);
948  fHistoMCEtaDalitzInAccPt[iCut] = new TH1F("MC_EtaDalitzInAcc_Pt","MC_EtaDalitzInAcc_Pt",ptBins, arrPtBinning);
949  fHistoMCEtaDalitzInAccPt[iCut]->Sumw2();
950  fMCList[iCut]->Add(fHistoMCEtaDalitzInAccPt[iCut]);
951  }
952 
953  if (fIsMC == 2){
954  if (GetSelectedMesonID() != 2){
955  fHistoMCPi0WOWeightPt[iCut]->Sumw2();
956  fHistoMCPi0DalitzWOWeightPt[iCut]->Sumw2();
957  fHistoMCPi0WOEvtWeightPt[iCut] = new TH1F("MC_Pi0_WOEventWeights_Pt","MC_Pi0_WOEventWeights_Pt",ptBins, arrPtBinning);
958  fMCList[iCut]->Add(fHistoMCPi0WOEvtWeightPt[iCut]);
959  fHistoMCPi0DalitzWOEvtWeightPt[iCut] = new TH1F("MC_Pi0Dalitz_WOEventWeights_Pt","MC_Pi0Dalitz_WOEventWeights_Pt",ptBins, arrPtBinning);
960  fMCList[iCut]->Add(fHistoMCPi0DalitzWOEvtWeightPt[iCut]);
961  fHistoMCPi0DalitzWOEvtWeightInAccPt[iCut] = new TH1F("MC_Pi0DalitzWOEvtWeightInAcc_Pt","MC_Pi0DalitzWOEvtWeightInAcc_Pt",ptBins, arrPtBinning);
963  fHistoMCPi0WOEvtWeightInAccPt[iCut] = new TH1F("MC_Pi0WOEvtWeightInAcc_Pt","MC_Pi0WOEvtWeightInAcc_Pt",ptBins, arrPtBinning);
964  fMCList[iCut]->Add(fHistoMCPi0WOEvtWeightInAccPt[iCut]);
965 
966 
967  }
968  if (GetSelectedMesonID() != 1){
969  fHistoMCEtaWOWeightPt[iCut]->Sumw2();
970  fHistoMCEtaDalitzWOWeightPt[iCut]->Sumw2();
971  fHistoMCEtaWOEvtWeightPt[iCut] = new TH1F("MC_Eta_WOEventWeights_Pt","MC_Eta_WOEventWeights_Pt",ptBins, arrPtBinning);
972  fMCList[iCut]->Add(fHistoMCEtaWOEvtWeightPt[iCut]);
973  fHistoMCEtaDalitzWOEvtWeightPt[iCut] = new TH1F("MC_EtaDalitz_WOEventWeights_Pt","MC_EtaDalitz_WOEventWeights_Pt",ptBins, arrPtBinning);
974  fMCList[iCut]->Add(fHistoMCEtaDalitzWOEvtWeightPt[iCut]);
975  fHistoMCEtaWOEvtWeightInAccPt[iCut] = new TH1F("MC_EtaWOEvtWeightInAcc_Pt","MC_EtaWOEvtWeightInAcc_Pt",ptBins, arrPtBinning);
976  fMCList[iCut]->Add(fHistoMCEtaWOEvtWeightInAccPt[iCut]);
977  fHistoMCEtaDalitzWOEvtWeightInAccPt[iCut] = new TH1F("MC_EtaDalitzWOEvtWeightInAcc_Pt","MC_EtaDalitzWOEvtWeightInAcc_Pt",ptBins, arrPtBinning);
979  }
980  if (fDoMesonQA > 0){
981  if (GetSelectedMesonID() != 2){
982  fHistoMCPi0PtJetPt[iCut] = new TH2F("MC_Pi0_Pt_JetPt","MC_Pi0_Pt_JetPt", ptBinsLog, startPtLog, endPtLog, 200, -0.5, 199.5);
983  fHistoMCPi0PtJetPt[iCut]->Sumw2();
985  fMCList[iCut]->Add(fHistoMCPi0PtJetPt[iCut]);
986  }
987  if (GetSelectedMesonID() != 1){
988  fHistoMCEtaPtJetPt[iCut] = new TH2F("MC_Eta_Pt_JetPt","MC_Eta_Pt_JetPt", ptBinsLog, startPtLog, endPtLog, 200, -0.5, 199.5);
989  fHistoMCEtaPtJetPt[iCut]->Sumw2();
991  fMCList[iCut]->Add(fHistoMCEtaPtJetPt[iCut]);
992  }
993  }
994  }
995 
996  fTrueList[iCut] = new TList();
997  fTrueList[iCut]->SetName(Form("%s_%s_%s_%s True histograms",cutstringEvent.Data(),cutstringCalo.Data(),cutstringCaloMerged.Data(), cutstringMeson.Data()));
998  fTrueList[iCut]->SetOwner(kTRUE);
999  fCutFolder[iCut]->Add(fTrueList[iCut]);
1000 
1001  fHistoTrueClusMergedPtvsM02[iCut] = new TH2F("ESD_TrueClusMerged_Pt_M02","ESD_TrueClusMerged_Pt_M02",ptBins, arrPtBinning,showerShapeBins, startShowerShape, endShowerShape);
1002  fTrueList[iCut]->Add(fHistoTrueClusMergedPtvsM02[iCut]);
1003  fHistoTrueClusPi0PtvsM02 [iCut] = new TH2F("ESD_TrueClusFromPi0_Pt_M02","ESD_TrueClusFromPi0_Pt_M02",ptBins, arrPtBinning,showerShapeBins, startShowerShape, endShowerShape);
1004  fTrueList[iCut]->Add(fHistoTrueClusPi0PtvsM02[iCut]);
1005  fHistoTrueClusPi0DalitzPtvsM02 [iCut] = new TH2F("ESD_TrueClusFromPi0Dalitz_Pt_M02","ESD_TrueClusFromPi0Dalitz_Pt_M02",ptBins, arrPtBinning,showerShapeBins, startShowerShape, endShowerShape);
1006  fTrueList[iCut]->Add(fHistoTrueClusPi0DalitzPtvsM02[iCut]);
1007  fHistoTrueClusEtaPtvsM02[iCut] = new TH2F("ESD_TrueClusFromEta_Pt_M02","ESD_TrueClusFromEta_Pt_M02",ptBins, arrPtBinning,showerShapeBins, startShowerShape, endShowerShape);
1008  fTrueList[iCut]->Add(fHistoTrueClusEtaPtvsM02[iCut]);
1009  fHistoTrueClusEtaDalitzPtvsM02[iCut] = new TH2F("ESD_TrueClusFromEtaDalitz_Pt_M02","ESD_TrueClusFromEtaDalitz_Pt_M02",ptBins, arrPtBinning,showerShapeBins, startShowerShape, endShowerShape);
1010  fTrueList[iCut]->Add(fHistoTrueClusEtaDalitzPtvsM02[iCut]);
1011  fHistoTrueClusMergedPureFromPi0PtvsM02[iCut] = new TH2F("ESD_TrueClusMergedPureFromPi0_Pt_M02","ESD_TrueClusMergedPureFromPi0_Pt_M02",ptBins, arrPtBinning,showerShapeBins, startShowerShape, endShowerShape);
1013  fHistoTrueClusMergedPureFromEtaPtvsM02[iCut] = new TH2F("ESD_TrueClusMergedPureFromEta_Pt_M02","ESD_TrueClusMergedPureFromEta_Pt_M02",ptBins, arrPtBinning,showerShapeBins, startShowerShape, endShowerShape);
1015  fHistoTrueClusMergedPartConvFromPi0PtvsM02[iCut] = new TH2F("ESD_TrueClusMergedPartConvFromPi0_Pt_M02","ESD_TrueClusMergedPartConvFromPi0_Pt_M02",ptBins, arrPtBinning,showerShapeBins, startShowerShape, endShowerShape);
1017  fHistoTrueClusMergedPartConvFromEtaPtvsM02[iCut] = new TH2F("ESD_TrueClusMergedPartConvFromEta_Pt_M02","ESD_TrueClusMergedPartConvFromEta_Pt_M02",ptBins, arrPtBinning,showerShapeBins, startShowerShape, endShowerShape);
1019 
1020  fHistoTrueClusBGPtvsM02[iCut] = new TH2F("ESD_TrueClusBG_Pt_M02","ESD_TrueClusBG_Pt_M02",ptBins, arrPtBinning,showerShapeBins, startShowerShape, endShowerShape);
1021  fTrueList[iCut]->Add(fHistoTrueClusBGPtvsM02[iCut]);
1022  fHistoTrueClusGammaPtvsM02[iCut] = new TH2F("ESD_TrueClusGamma_Pt_M02","ESD_TrueClusGamma_Pt_M02",ptBins, arrPtBinning,showerShapeBins, startShowerShape, endShowerShape);
1023  fTrueList[iCut]->Add(fHistoTrueClusGammaPtvsM02[iCut]);
1024  fHistoTrueClusGammaFromPi0PtvsM02[iCut] = new TH2F("ESD_TrueClusGamma_FromPi0_Pt_M02","ESD_TrueClusGamma_FromPi0_Pt_M02",ptBins, arrPtBinning,showerShapeBins, startShowerShape, endShowerShape);
1025  fTrueList[iCut]->Add(fHistoTrueClusGammaFromPi0PtvsM02[iCut]);
1026  fHistoTrueClusGammaFromEtaPtvsM02[iCut] = new TH2F("ESD_TrueClusGamma_FromEta_Pt_M02","ESD_TrueClusGamma_FromEta_Pt_M02",ptBins, arrPtBinning,showerShapeBins, startShowerShape, endShowerShape);
1027  fTrueList[iCut]->Add(fHistoTrueClusGammaFromEtaPtvsM02[iCut]);
1028  fHistoTrueClusElectronPtvsM02[iCut] = new TH2F("ESD_TrueClusElectron_Pt_M02","ESD_TrueClusElectron_Pt_M02",ptBins, arrPtBinning,showerShapeBins, startShowerShape, endShowerShape);
1029  fTrueList[iCut]->Add(fHistoTrueClusElectronPtvsM02[iCut]);
1030  fHistoTrueClusElectronFromPi0PtvsM02[iCut] = new TH2F("ESD_TrueClusElectron_FromPi0_Pt_M02","ESD_TrueClusElectron_FromPi0_Pt_M02",ptBins, arrPtBinning,showerShapeBins, startShowerShape, endShowerShape);
1032  fHistoTrueClusElectronFromEtaPtvsM02[iCut] = new TH2F("ESD_TrueClusElectron_FromEta_Pt_M02","ESD_TrueClusElectron_FromEta_Pt_M02",ptBins, arrPtBinning,showerShapeBins, startShowerShape, endShowerShape);
1034  fHistoTrueClusElectronFromGammaPtvsM02[iCut] = new TH2F("ESD_TrueClusElectron_FromGamma_Pt_M02","ESD_TrueClusElectron_FromGamma_Pt_M02",ptBins, arrPtBinning,showerShapeBins, startShowerShape, endShowerShape);
1036 
1037  if (GetSelectedMesonID() < 2){
1038  fHistoTrueClusPrimPi0PtvsM02[iCut] = new TH2F("ESD_TrueClusFromPrimPi0_Pt_M02","ESD_TrueClusFromPrimPi0_Pt_M02",ptBins, arrPtBinning,showerShapeBins, startShowerShape, endShowerShape);
1039  fTrueList[iCut]->Add(fHistoTrueClusPrimPi0PtvsM02[iCut]);
1040  fHistoTrueClusSecPi0PtvsM02[iCut] = new TH2F("ESD_TrueClusFromSecPi0_Pt_M02","ESD_TrueClusFromSecPi0_Pt_M02",ptBins, arrPtBinning,showerShapeBins, startShowerShape, endShowerShape);
1041  fTrueList[iCut]->Add(fHistoTrueClusSecPi0PtvsM02[iCut]);
1042  fHistoTrueClusSecPi0FromK0sPtvsM02[iCut] = new TH2F("ESD_TrueClusFromSecPi0FromK0s_Pt_M02","ESD_TrueClusFromSecPi0FromK0s_Pt_M02",ptBins, arrPtBinning,showerShapeBins, startShowerShape, endShowerShape);
1044  fHistoTrueClusSecPi0FromK0lPtvsM02[iCut] = new TH2F("ESD_TrueClusFromSecPi0FromK0l_Pt_M02","ESD_TrueClusFromSecPi0FromK0l_Pt_M02",ptBins, arrPtBinning,showerShapeBins, startShowerShape, endShowerShape);
1046  fHistoTrueClusSecPi0FromLambdaPtvsM02[iCut] = new TH2F("ESD_TrueClusFromSecPi0FromLambda_Pt_M02","ESD_TrueClusFromSecPi0FromLambda_Pt_M02",ptBins, arrPtBinning,showerShapeBins, startShowerShape, endShowerShape);
1048  fHistoTrueSecPi0PtvsDiffReco[iCut] = new TH2F("ESD_TrueClusFromSecPi0_Pt_RecoMethod","ESD_TrueClusFromSecPi0_Pt_RecoMethod",ptBins, arrPtBinning, 4, -0.5, 3.5);
1049  fTrueList[iCut]->Add(fHistoTrueSecPi0PtvsDiffReco[iCut]);
1050  }
1051 
1052 
1053  fHistoTrueClusBGPtvsSource[iCut] = new TH2F("ESD_TrueClusBG_Pt_Source","ESD_TrueClusBG_Pt_Source",ptBins, arrPtBinning, 10, 0, 10);
1054  fTrueList[iCut]->Add(fHistoTrueClusBGPtvsSource[iCut]);
1055  fHistoTrueClusGammaPtvsSource[iCut] = new TH2F("ESD_TrueClusGamma_Pt_Source","ESD_TrueClusGamma_Pt_Source",ptBins, arrPtBinning, 8, 0, 8);
1056  fTrueList[iCut]->Add(fHistoTrueClusGammaPtvsSource[iCut]);
1057  fHistoTrueClusElectronPtvsSource[iCut] = new TH2F("ESD_TrueClusElectron_Pt_Source","ESD_TrueClusElectron_Pt_Source",ptBins, arrPtBinning, 9, 0, 9);
1058  fTrueList[iCut]->Add(fHistoTrueClusElectronPtvsSource[iCut]);
1059 // fHistoTrueClusElectronPtvsMotherID[iCut] = new TH2F("ESD_TrueClusElectron_Pt_MotherID","ESD_TrueClusElectron_Pt_MotherID",ptBins, arrPtBinning, 570, -1.5, 568.5);
1060 // fTrueList[iCut]->Add(fHistoTrueClusElectronPtvsMotherID[iCut]);
1061 // fHistoTrueClusElectronPtvsTopMotherID[iCut] = new TH2F("ESD_TrueClusElectron_Pt_TopMotherID","ESD_TrueClusElectron_Pt_TopMotherID",ptBins, arrPtBinning, 570, -1.5, 568.5);
1062 // fTrueList[iCut]->Add(fHistoTrueClusElectronPtvsTopMotherID[iCut]);
1063 // fHistoTrueClusElectronPtvsConvPhotonTopMotherID[iCut] = new TH2F("ESD_TrueClusElectron_Pt_ConvPhotonTopMotherID","ESD_TrueClusElectron_Pt_ConvPhotonTopMotherID",ptBins, arrPtBinning, 570, -1.5, 568.5);
1064 // fTrueList[iCut]->Add(fHistoTrueClusElectronPtvsConvPhotonTopMotherID[iCut]);
1065  fHistoTrueMergedMissedPDG[iCut] = new TH1F("ESD_TrueMergedMissed_PDG","ESD_TrueMergedMissed_PDG",10000, -1.5, 9998.5);
1066  fTrueList[iCut]->Add(fHistoTrueMergedMissedPDG[iCut]);
1067 
1068  fHistoDoubleCountTruePi0PtvsM02[iCut] = new TH2F("ESD_TrueDoubleCountPi0_Pt_M02","ESD_TrueDoubleCountPi0_Pt_M02",ptBins, arrPtBinning,showerShapeBins, startShowerShape, endShowerShape);
1069  fTrueList[iCut]->Add(fHistoDoubleCountTruePi0PtvsM02[iCut]);
1070  fHistoDoubleCountTrueSecPi0Pt[iCut] = new TH1F("ESD_TrueDoubleCountSecPi0_Pt","ESD_TrueDoubleCountSecPi0_Pt",ptBins, arrPtBinning);
1071  fTrueList[iCut]->Add(fHistoDoubleCountTrueSecPi0Pt[iCut]);
1072  fHistoDoubleCountTrueEtaPtvsM02[iCut] = new TH2F("ESD_TrueDoubleCountEta_Pt_M02","ESD_TrueDoubleCountEta_Pt_M02",ptBins, arrPtBinning,showerShapeBins, startShowerShape, endShowerShape);
1073  fTrueList[iCut]->Add(fHistoDoubleCountTrueEtaPtvsM02[iCut]);
1074 
1075 
1076  if (fDoMesonQA > 1){
1077  fHistoTrueClusMergedInvMassvsPt[iCut] = new TH2F("ESD_TrueClusMerged_InvMass_Pt","ESD_TrueClusMerged_InvMass_Pt",invMassBins, startMass, endMass,ptBins, arrPtBinning);
1078  fTrueList[iCut]->Add(fHistoTrueClusMergedInvMassvsPt[iCut]);
1079  fHistoTrueClusPi0InvMassvsPt [iCut] = new TH2F("ESD_TrueClusFromPi0_InvMass_Pt","ESD_TrueClusFromPi0_InvMass_Pt",invMassBins, startMass, endMass,ptBins, arrPtBinning);
1080  fTrueList[iCut]->Add(fHistoTrueClusPi0InvMassvsPt[iCut]);
1081  fHistoTrueClusEtaInvMassvsPt[iCut] = new TH2F("ESD_TrueClusFromEta_InvMass_Pt","ESD_TrueClusFromEta_InvMass_Pt",invMassBins, startMass, endMass,ptBins, arrPtBinning);
1082  fTrueList[iCut]->Add(fHistoTrueClusEtaInvMassvsPt[iCut]);
1083  fHistoTrueClusBGInvMassvsPt[iCut] = new TH2F("ESD_TrueClusBG_InvMass_Pt","ESD_TrueClusBG_InvMass_Pt",invMassBins, startMass, endMass,ptBins, arrPtBinning);
1084  fTrueList[iCut]->Add(fHistoTrueClusBGInvMassvsPt[iCut]);
1085  fHistoTrueClusGammaInvMassvsPt[iCut] = new TH2F("ESD_TrueClusGamma_InvMass_Pt","ESD_TrueClusGamma_InvMass_Pt",invMassBins, startMass, endMass,ptBins, arrPtBinning);
1086  fTrueList[iCut]->Add(fHistoTrueClusGammaInvMassvsPt[iCut]);
1087  fHistoTrueClusElectronInvMassvsPt[iCut] = new TH2F("ESD_TrueClusElectron_InvMass_Pt","ESD_TrueClusElectron_InvMass_Pt",invMassBins, startMass, endMass,ptBins, arrPtBinning);
1088  fTrueList[iCut]->Add(fHistoTrueClusElectronInvMassvsPt[iCut]);
1089  if (GetSelectedMesonID() < 2){
1090  fHistoTrueClusPrimPi0InvMassvsPt[iCut] = new TH2F("ESD_TrueClusFromPrimPi0_InvMass_Pt","ESD_TrueClusFromPrimPi0_InvMass_Pt",invMassBins, startMass, endMass,ptBins, arrPtBinning);
1091  fTrueList[iCut]->Add(fHistoTrueClusPrimPi0InvMassvsPt[iCut]);
1092  }
1093  }
1094 
1095  if (fDoMesonQA > 0){
1096  fHistoTrueClusGammaEM02[iCut] = new TH2F("TrueClusGammaEM02","TrueClusGammaEM02",ptBins, arrPtBinning, showerShapeBins, startShowerShape, endShowerShape);
1097  fTrueList[iCut]->Add(fHistoTrueClusGammaEM02[iCut]);
1098  fHistoTrueClusElectronEM02[iCut] = new TH2F("TrueClusElectronEM02","TrueClusElectronEM02",ptBins, arrPtBinning, showerShapeBins, startShowerShape, endShowerShape);
1099  fTrueList[iCut]->Add(fHistoTrueClusElectronEM02[iCut]);
1100  fHistoTrueClusPi0EM02[iCut] = new TH2F("TrueClusPi0EM02","TrueClusPi0EM02",ptBins, arrPtBinning, showerShapeBins, startShowerShape, endShowerShape);
1101  fTrueList[iCut]->Add(fHistoTrueClusPi0EM02[iCut]);
1102  fHistoTrueClusEtaEM02[iCut] = new TH2F("TrueClusEtaEM02","TrueClusEtaEM02",ptBins, arrPtBinning, showerShapeBins, startShowerShape, endShowerShape);
1103  fTrueList[iCut]->Add(fHistoTrueClusEtaEM02[iCut]);
1104  if (GetSelectedMesonID() != 2){
1105  fHistoTruePi0PtY[iCut] = new TH2F("ESD_TruePi0_Pt_Y","ESD_TruePi0_Pt_Y",ptBinsLog, startPtLog, endPtLog,150,-1.5,1.5);
1107  fTrueList[iCut]->Add(fHistoTruePi0PtY[iCut]);
1108  fHistoTruePi0PtAlpha[iCut] = new TH2F("ESD_TruePi0_Pt_Alpha","ESD_TruePi0_Pt_Alpha",ptBinsLog, startPtLog, endPtLog,100,0,1);
1110  fTrueList[iCut]->Add(fHistoTruePi0PtAlpha[iCut]);
1111  fHistoTruePrimaryPi0PureMergedMCPtResolPt[iCut] = new TH2F("ESD_TruePrimaryPi0PureMerged_MCPt_ResolPt","ESD_TruePrimaryPi0PureMerged_ResolPt_MCPt",ptBinsLog, startPtLog, endPtLog,1000,-1.,1.);
1114  fHistoTruePrimaryPi0MergedPartConvMCPtResolPt[iCut] = new TH2F("ESD_TruePrimaryPi0MergedPartConv_MCPt_ResolPt","ESD_TruePrimaryPi0MergedPartConv_ResolPt_MCPt",ptBinsLog, startPtLog, endPtLog,1000,-1.,1.);
1117  fHistoTruePrimaryPi01GammaMCPtResolPt[iCut] = new TH2F("ESD_TruePrimaryPi01Gamma_MCPt_ResolPt","ESD_TruePrimaryPi01Gamma_ResolPt_MCPt",ptBinsLog, startPtLog, endPtLog,1000,-1.,1.);
1120  fHistoTruePrimaryPi01ElectronMCPtResolPt[iCut] = new TH2F("ESD_TruePrimaryPi01Electron_MCPt_ResolPt","ESD_TruePrimaryPi01Electron_ResolPt_MCPt",ptBinsLog, startPtLog, endPtLog,1000,-1.,1.);
1123  fHistoTrueSecondaryPi0MCPtResolPt[iCut] = new TH2F("ESD_TrueSecondaryPi0_MCPt_ResolPt","ESD_TrueSecondaryPi0_MCPt_ResolPt",ptBinsLog, startPtLog, endPtLog,2000,-10.,10.);
1125  fTrueList[iCut]->Add(fHistoTrueSecondaryPi0MCPtResolPt[iCut]);
1126  }
1127  if (GetSelectedMesonID() != 1){
1128  fHistoTrueEtaPtY[iCut] = new TH2F("ESD_TrueEta_Pt_Y","ESD_TrueEta_Pt_Y",ptBinsLog, startPtLog, endPtLog,150,-1.5,1.5);
1130  fTrueList[iCut]->Add(fHistoTrueEtaPtY[iCut]);
1131  fHistoTrueEtaPtAlpha[iCut] = new TH2F("ESD_TrueEta_Pt_Alpha","ESD_TrueEta_Pt_Alpha",ptBinsLog, startPtLog, endPtLog,100,0,0.5);
1133  fTrueList[iCut]->Add(fHistoTrueEtaPtAlpha[iCut]);
1134  fHistoTruePrimaryEtaMCPtResolPt[iCut] = new TH2F("ESD_TruePrimaryEta_MCPt_ResolPt","ESD_TruePrimaryEta_ResolPt_MCPt",ptBinsLog, startPtLog, endPtLog,1000,-1.,1.);
1136  fTrueList[iCut]->Add(fHistoTruePrimaryEtaMCPtResolPt[iCut]);
1137  }
1138  }
1139 
1140  if (fIsMC == 2){
1141  fHistoTrueClusMergedPtvsM02[iCut]->Sumw2();
1142  fHistoTrueClusPi0PtvsM02[iCut]->Sumw2();
1143  fHistoTrueClusPi0DalitzPtvsM02[iCut]->Sumw2();
1144  fHistoTrueClusEtaPtvsM02[iCut]->Sumw2();
1145  fHistoTrueClusEtaDalitzPtvsM02[iCut]->Sumw2();
1150  fHistoTrueMergedMissedPDG[iCut]->Sumw2();
1151  fHistoTrueClusBGPtvsM02[iCut]->Sumw2();
1152  fHistoTrueClusGammaPtvsM02[iCut]->Sumw2();
1153  fHistoTrueClusGammaFromPi0PtvsM02[iCut]->Sumw2();
1154  fHistoTrueClusGammaFromEtaPtvsM02[iCut]->Sumw2();
1155  fHistoTrueClusElectronPtvsM02[iCut]->Sumw2();
1156  fHistoTrueClusElectronFromPi0PtvsM02[iCut]->Sumw2();
1157  fHistoTrueClusElectronFromEtaPtvsM02[iCut]->Sumw2();
1159  fHistoTrueClusBGPtvsSource[iCut]->Sumw2();
1160  fHistoTrueClusGammaPtvsSource[iCut]->Sumw2();
1161  fHistoTrueClusElectronPtvsSource[iCut]->Sumw2();
1162 // fHistoTrueClusElectronPtvsMotherID[iCut]->Sumw2();
1163 // fHistoTrueClusElectronPtvsTopMotherID[iCut]->Sumw2();
1164 // fHistoTrueClusElectronPtvsConvPhotonTopMotherID[iCut]->Sumw2();
1165  fHistoDoubleCountTruePi0PtvsM02[iCut]->Sumw2();
1166  fHistoDoubleCountTrueSecPi0Pt[iCut]->Sumw2();
1167  fHistoDoubleCountTrueEtaPtvsM02[iCut]->Sumw2();
1168 
1169  if (GetSelectedMesonID() < 2){
1170  fHistoTrueClusPrimPi0PtvsM02[iCut]->Sumw2();
1171  fHistoTrueClusSecPi0PtvsM02[iCut]->Sumw2();
1172  fHistoTrueClusSecPi0FromK0sPtvsM02[iCut]->Sumw2();
1173  fHistoTrueClusSecPi0FromK0lPtvsM02[iCut]->Sumw2();
1175  fHistoTrueSecPi0PtvsDiffReco[iCut]->Sumw2();
1176  }
1177 
1178  if (fDoMesonQA > 1){
1179  fHistoTrueClusMergedInvMassvsPt[iCut]->Sumw2();
1180  fHistoTrueClusPi0InvMassvsPt[iCut]->Sumw2();
1181  fHistoTrueClusEtaInvMassvsPt[iCut]->Sumw2();
1182  fHistoTrueClusBGInvMassvsPt[iCut]->Sumw2();
1183  fHistoTrueClusGammaInvMassvsPt[iCut]->Sumw2();
1184  fHistoTrueClusElectronInvMassvsPt[iCut]->Sumw2();
1185  if (GetSelectedMesonID() < 2){
1186  fHistoTrueClusPrimPi0InvMassvsPt[iCut]->Sumw2();
1187  }
1188  }
1189 
1190  if (fDoMesonQA > 0 ){
1191  if (GetSelectedMesonID() != 2){
1192  fHistoTruePi0PtY[iCut]->Sumw2();
1193  fHistoTruePi0PtAlpha[iCut]->Sumw2();
1198  fHistoTrueSecondaryPi0MCPtResolPt[iCut]->Sumw2();
1199  fHistoTrueClusPi0EM02[iCut]->Sumw2();
1200  fHistoTrueClusEtaEM02[iCut]->Sumw2();
1201  fHistoTrueClusGammaEM02[iCut]->Sumw2();
1202  fHistoTrueClusElectronEM02[iCut]->Sumw2();
1203  }
1204  if (GetSelectedMesonID() != 1){
1205  fHistoTrueEtaPtY[iCut]->Sumw2();
1206  fHistoTrueEtaPtAlpha[iCut]->Sumw2();
1207  fHistoTruePrimaryEtaMCPtResolPt[iCut]->Sumw2();
1208  }
1209  }
1210  }
1211  }
1212 
1213  }
1214 
1215  if(fV0Reader)
1217  if(((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetCutHistograms())
1218  fOutputContainer->Add(((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetCutHistograms());
1219 
1220  for(Int_t iMatcherTask = 0; iMatcherTask < 5; iMatcherTask++){
1221  AliCaloTrackMatcher* temp = (AliCaloTrackMatcher*) (AliAnalysisManager::GetAnalysisManager()->GetTask(Form("CaloTrackMatcher_%i_%i",iMatcherTask,fTrackMatcherRunningMode)));
1222  if(temp) fOutputContainer->Add(temp->GetCaloTrackMatcherHistograms());
1223  }
1224 
1225 
1226  for(Int_t iCut = 0; iCut<fnCuts;iCut++){
1227  if(!((AliConvEventCuts*)fEventCutArray->At(iCut))) continue;
1228  if(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutHistograms()){
1229  fCutFolder[iCut]->Add(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutHistograms());
1230  }
1231  if(!((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))) continue;
1232  if(((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetCutHistograms()){
1233  fCutFolder[iCut]->Add(((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetCutHistograms());
1234  }
1235  if(!((AliCaloPhotonCuts*)fClusterMergedCutArray->At(iCut))) continue;
1236  if(((AliCaloPhotonCuts*)fClusterMergedCutArray->At(iCut))->GetCutHistograms()){
1237  fCutFolder[iCut]->Add(((AliCaloPhotonCuts*)fClusterMergedCutArray->At(iCut))->GetCutHistograms());
1238  }
1239 
1240  if(fSetPlotHistsExtQA){
1241  if(!((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))) continue;
1242  if(((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetExtQAHistograms()){
1243  fCutFolder[iCut]->Add(((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetExtQAHistograms());
1244  }
1245  }
1246  if(!((AliConversionMesonCuts*)fMesonCutArray->At(iCut))) continue;
1247  if(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutHistograms()){
1248  fCutFolder[iCut]->Add(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutHistograms());
1249  }
1250  }
1251 
1252  if (fIsMC > 0){
1253  tBrokenFiles = new TTree("BrokenFiles","BrokenFiles");
1254  tBrokenFiles->Branch("fileName",&fFileNameBroken);
1256  }
1257 
1258 
1259  PostData(1, fOutputContainer);
1260 }
1261 //_____________________________________________________________________________
1263 {
1264  for(Int_t iCut = 0; iCut<fnCuts;iCut++){
1265  if (((AliConvEventCuts*)fEventCutArray->At(iCut))->GetPeriodEnum() == AliConvEventCuts::kNoPeriod && ((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetPeriodEnum() != AliConvEventCuts::kNoPeriod){
1266  ((AliConvEventCuts*)fEventCutArray->At(iCut))->SetPeriodEnumExplicit(((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetPeriodEnum());
1267  } else if (((AliConvEventCuts*)fEventCutArray->At(iCut))->GetPeriodEnum() == AliConvEventCuts::kNoPeriod ){
1268  ((AliConvEventCuts*)fEventCutArray->At(iCut))->SetPeriodEnum(fV0Reader->GetPeriodName());
1269  }
1270 
1271  if(!((AliConvEventCuts*)fEventCutArray->At(iCut))->GetDoEtaShift()){
1272  fProfileEtaShift[iCut]->Fill(0.,(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift()));
1273  continue; // No Eta Shift requested, continue
1274  }
1275  if(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift() == 0.0){ // Eta Shift requested but not set, get shift automatically
1276  ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCorrectEtaShiftFromPeriod();
1277  fProfileEtaShift[iCut]->Fill(0.,(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift()));
1278  ((AliConvEventCuts*)fEventCutArray->At(iCut))->DoEtaShift(kFALSE); // Eta Shift Set, make sure that it is called only once
1279  continue;
1280  } else {
1281  printf(" Gamma Conversion Task %s :: Eta Shift Manually Set to %f \n\n",
1282  (((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber()).Data(),((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift());
1283  fProfileEtaShift[iCut]->Fill(0.,(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift()));
1284  ((AliConvEventCuts*)fEventCutArray->At(iCut))->DoEtaShift(kFALSE); // Eta Shift Set, make sure that it is called only once
1285  }
1286 
1287  // Check whether non linearity correction has been applied already
1288  Bool_t doNonLinCorr = kTRUE;
1289  if (((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetNonLinearity() == ((AliCaloPhotonCuts*)fClusterMergedCutArray->At(iCut))->GetNonLinearity()){
1290  doNonLinCorr = kFALSE;
1291  } else if (((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetNonLinearity() == 0 && ((AliCaloPhotonCuts*)fClusterMergedCutArray->At(iCut))->GetNonLinearity() > 0){
1292  doNonLinCorr = kTRUE;
1293  } else if (((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetNonLinearity() > 0 && ((AliCaloPhotonCuts*)fClusterMergedCutArray->At(iCut))->GetNonLinearity() == 0){
1294  doNonLinCorr = kTRUE;
1295  } else {
1296  doNonLinCorr = kFALSE;
1297  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;
1298  cout << "INFO: switching off the non lin corr for merged cluster" << endl;
1299  }
1300  // check whether photon fullfill merged cluster cuts as well
1301  if (doNonLinCorr) ((AliCaloPhotonCuts*)fClusterMergedCutArray->At(fiCut))->SetUseNonLinearitySwitch(doNonLinCorr);
1302 
1303 
1304  }
1305  return kTRUE;
1306 }
1307 //_____________________________________________________________________________
1309 {
1310  //
1311  // Called for each event
1312  //
1313  fInputEvent = InputEvent();
1314 
1315  if(fIsMC> 0) fMCEvent = MCEvent();
1316 
1317  Int_t eventQuality = ((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetEventQuality();
1318  if(fInputEvent->IsIncompleteDAQ()==kTRUE) eventQuality = 2; // incomplete event
1319 
1320  // Event Not Accepted due to MC event missing or wrong trigger for V0ReaderV1 or because it is incomplete => abort processing of this file/event
1321  if(eventQuality == 2 || eventQuality == 3){
1322  // write out name of broken file for first event
1323  if (fIsMC > 0){
1324  if (fInputEvent->IsA()==AliESDEvent::Class()){
1325  if (((AliESDEvent*)fInputEvent)->GetEventNumberInFile() == 0){
1326  fFileNameBroken = new TObjString(Form("%s",((TString)fV0Reader->GetCurrentFileName()).Data()));
1327  if (tBrokenFiles) tBrokenFiles->Fill();
1328  delete fFileNameBroken;
1329  }
1330  }
1331  }
1332 
1333  for(Int_t iCut = 0; iCut<fnCuts; iCut++){
1334  fHistoNEvents[iCut]->Fill(eventQuality);
1335  if (fIsMC==2)
1336  fHistoNEventsWOWeight[iCut]->Fill(eventQuality);
1337  }
1338  return;
1339  }
1340 
1341  // ------------------- BeginEvent ----------------------------
1342 
1343  for(Int_t iCut = 0; iCut<fnCuts; iCut++){
1344  fiCut = iCut;
1345 
1346  Bool_t isRunningEMCALrelAna = kFALSE;
1347  if (((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->GetClusterType() == 1) isRunningEMCALrelAna = kTRUE;
1348 
1349  Int_t eventNotAccepted = ((AliConvEventCuts*)fEventCutArray->At(iCut))->IsEventAcceptedByCut(fV0Reader->GetEventCuts(),fInputEvent,fMCEvent,fIsHeavyIon, isRunningEMCALrelAna);
1350 
1351  if(fIsMC==2){
1352  Float_t xsection = -1.; Float_t ntrials = -1.;
1353  ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetXSectionAndNTrials(fMCEvent,xsection,ntrials,fInputEvent);
1354  if((xsection==-1.) || (ntrials==-1.)) AliFatal(Form("ERROR: GetXSectionAndNTrials returned invalid xsection/ntrials, periodName from V0Reader: '%s'",fV0Reader->GetPeriodName().Data()));
1355  fProfileJetJetXSection[iCut]->Fill(0.,xsection);
1356  fHistoJetJetNTrials[iCut]->Fill("#sum{NTrials}",ntrials);
1357  }
1358 
1359  fWeightJetJetMC = 1;
1360  // cout << fMCEvent << endl;
1361  Bool_t isMCJet = ((AliConvEventCuts*)fEventCutArray->At(iCut))->IsJetJetMCEventAccepted( fMCEvent, fWeightJetJetMC, fInputEvent );
1362  if (!isMCJet){
1363  fHistoNEvents[iCut]->Fill(10,fWeightJetJetMC);
1364  if (fIsMC==2) fHistoNEventsWOWeight[iCut]->Fill(10);
1365  continue;
1366  }
1367 
1368  Bool_t triggered = kTRUE;
1369  if(eventNotAccepted!= 0){
1370  fHistoNEvents[iCut]->Fill(eventNotAccepted, fWeightJetJetMC); // Check Centrality, PileUp, SDD and V0AND --> Not Accepted => eventQuality = 1
1371  if (fIsMC>1) fHistoNEventsWOWeight[iCut]->Fill(eventNotAccepted);
1372  // cout << "event rejected due to wrong trigger: " <<eventNotAccepted << endl;
1373  if (eventNotAccepted==3 && fIsMC > 0){
1374  triggered = kFALSE;
1375  }else {
1376  continue;
1377  }
1378  }
1379 
1380  if(eventQuality != 0 && triggered== kTRUE){// Event Not Accepted
1381  //cout << "event rejected due to: " <<eventQuality << endl;
1382  fHistoNEvents[iCut]->Fill(eventQuality, fWeightJetJetMC);
1383  if (fIsMC==2) fHistoNEventsWOWeight[iCut]->Fill(eventQuality);
1384 
1385  continue;
1386  }
1387  if (triggered == kTRUE) {
1388  fHistoNEvents[iCut]->Fill(eventQuality, fWeightJetJetMC); // Should be 0 here
1389  if (fIsMC==2) fHistoNEventsWOWeight[iCut]->Fill(eventQuality); // Should be 0 here
1390 
1392  fWeightJetJetMC);
1393  fHistoVertexZ[iCut]->Fill( fInputEvent->GetPrimaryVertex()->GetZ(),
1394  fWeightJetJetMC);
1395  fHistoSPDClusterTrackletBackground[iCut]->Fill( fInputEvent->GetMultiplicity()->GetNumberOfTracklets(),
1396  (fInputEvent->GetNumberOfITSClusters(0)+fInputEvent->GetNumberOfITSClusters(1)),
1397  fWeightJetJetMC);
1398  if(((AliConvEventCuts*)fEventCutArray->At(iCut))->IsHeavyIon() == 2)
1399  fHistoNV0Tracks[iCut]->Fill(fInputEvent->GetVZEROData()->GetMTotV0A(),
1400  fWeightJetJetMC);
1401  else
1402  fHistoNV0Tracks[iCut]->Fill(fInputEvent->GetVZEROData()->GetMTotV0A()+fInputEvent->GetVZEROData()->GetMTotV0C(),
1403  fWeightJetJetMC);
1404  }
1405  if(fIsMC> 0){
1406  // Process MC Particle
1407  if(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetSignalRejection() != 0){
1408  if(fInputEvent->IsA()==AliESDEvent::Class()){
1409  ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetNotRejectedParticles(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetSignalRejection(),
1410  ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetAcceptedHeader(),
1411  fMCEvent);
1412  }
1413  else if(fInputEvent->IsA()==AliAODEvent::Class()){
1414  ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetNotRejectedParticles(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetSignalRejection(),
1415  ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetAcceptedHeader(),
1416  fInputEvent);
1417  }
1418 
1419  if(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetAcceptedHeader()){
1420  for(Int_t i = 0;i<(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetAcceptedHeader())->GetEntries();i++){
1421  TString nameBin= fHistoMCHeaders[iCut]->GetXaxis()->GetBinLabel(i+1);
1422  if (nameBin.CompareTo("")== 0){
1423  TString nameHeader = ((TObjString*)((TList*)((AliConvEventCuts*)fEventCutArray->At(iCut))
1424  ->GetAcceptedHeader())->At(i))->GetString();
1425  fHistoMCHeaders[iCut]->GetXaxis()->SetBinLabel(i+1,nameHeader.Data());
1426  }
1427  }
1428  }
1429  }
1430  }
1431  if(fIsMC>0){
1432  if(fInputEvent->IsA()==AliESDEvent::Class())
1434  if(fInputEvent->IsA()==AliAODEvent::Class())
1436  }
1437 
1438  if (triggered==kFALSE) continue;
1439 
1440  // 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)
1441  ProcessClusters(); // process calo clusters
1442 
1444  fWeightJetJetMC);
1446  fWeightJetJetMC);
1447 
1450  fWeightJetJetMC);
1451 
1454 
1455  }
1456 
1457  PostData(1, fOutputContainer);
1458 }
1459 
1460 //________________________________________________________________________
1462 
1463  Int_t nclus = 0;
1464  TClonesArray * arrClustersProcess = NULL;
1465  if(!fCorrTaskSetting.CompareTo("")){
1466  nclus = fInputEvent->GetNumberOfCaloClusters();
1467  } else {
1468  arrClustersProcess = dynamic_cast<TClonesArray*>(fInputEvent->FindListObject(Form("%sClustersBranch",fCorrTaskSetting.Data())));
1469  if(!arrClustersProcess)
1470  AliFatal(Form("%sClustersBranch was not found in AliAnalysisTaskGammaCaloMerged! Check the correction framework settings!",fCorrTaskSetting.Data()));
1471  nclus = arrClustersProcess->GetEntries();
1472  }
1473 
1474 // cout << nclus << endl;
1475 
1476  if(nclus == 0) return;
1477 
1478 // cout << "new event with accepted clusters: \t trigger \t" << (((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSpecialTriggerName()).Data() <<endl;
1479 
1480  fNClusterCandidates = 0;
1482 
1483  // plotting histograms on cell/tower level, only if extendedMatchAndQA > 1
1484  ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->FillHistogramsExtendedQA(fInputEvent,fIsMC);
1485 
1486  // match tracks to clusters
1487  ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->MatchTracksToClusters(fInputEvent, fWeightJetJetMC, kTRUE, fMCEvent);
1488  // match tracks to clusters also for mergedCutArray
1489  ((AliCaloPhotonCuts*)fClusterMergedCutArray->At(fiCut))->MatchTracksToClusters(fInputEvent, fWeightJetJetMC, kTRUE, fMCEvent);
1490 
1491  // vertex
1492  Double_t vertex[3] = {0};
1493  InputEvent()->GetPrimaryVertex()->GetXYZ(vertex);
1494 
1495  // Loop over EMCal clusters
1496  for(Long_t i = 0; i < nclus; i++){
1497 
1498  Double_t tempClusterWeight = fWeightJetJetMC;
1499  Double_t tempPhotonWeight = fWeightJetJetMC;
1500  // select clusters with open cuts for normalizations histos
1501  AliVCluster* clus = NULL;
1502  if(fInputEvent->IsA()==AliESDEvent::Class()){
1503  if(arrClustersProcess)
1504  clus = new AliESDCaloCluster(*(AliESDCaloCluster*)arrClustersProcess->At(i));
1505  else
1506  clus = new AliESDCaloCluster(*(AliESDCaloCluster*)fInputEvent->GetCaloCluster(i));
1507  } else if(fInputEvent->IsA()==AliAODEvent::Class()){
1508  if(arrClustersProcess)
1509  clus = new AliAODCaloCluster(*(AliAODCaloCluster*)arrClustersProcess->At(i));
1510  else
1511  clus = new AliAODCaloCluster(*(AliAODCaloCluster*)fInputEvent->GetCaloCluster(i));
1512  }
1513 
1514  if (!clus) continue;
1515 
1516  // Set the jetjet weight to 1 in case the cluster orignated from the minimum bias header
1517  if (fIsMC>0 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() == 4){
1518  if( ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(clus->GetLabelAt(0), fMCEvent, fInputEvent) == 2)
1519  tempClusterWeight = 1;
1520  }
1521 
1522  // if open cluster cuts are not fullfilled I can abort
1523  if(!((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelected(clus,fInputEvent,fMCEvent,fIsMC,tempClusterWeight, i)){
1524  delete clus;
1525  continue;
1526  }
1527 
1528  // TLorentzvector with cluster
1529  TLorentzVector clusterVector;
1530  clus->GetMomentum(clusterVector,vertex);
1531 
1532  TLorentzVector* tmpvec = new TLorentzVector();
1533  tmpvec->SetPxPyPzE(clusterVector.Px(),clusterVector.Py(),clusterVector.Pz(),clusterVector.E());
1534 
1535  // convert to AODConversionPhoton
1536  AliAODConversionPhoton *PhotonCandidate=new AliAODConversionPhoton(tmpvec);
1537  if(!PhotonCandidate){
1538  delete clus;
1539  delete tmpvec;
1540  continue;
1541  }
1542 
1543  // Flag Photon as CaloPhoton
1544  PhotonCandidate->SetIsCaloPhoton();
1545  PhotonCandidate->SetCaloClusterRef(i);
1546 
1547  // get MC label
1548  if(fIsMC> 0){
1549  Int_t* mclabelsCluster = clus->GetLabels();
1550 // cout << "cluster: " << i << endl;
1551  Int_t nValidClusters = 0;
1552 
1553  if (clus->GetNLabels()>0){
1554  for (Int_t k =0; k< (Int_t)clus->GetNLabels(); k++){
1555 // TParticle *dummy = NULL;
1556  if (mclabelsCluster[k]>0){
1557 // dummy = fMCEvent->Particle(mclabelsCluster[k]);
1558 // if (dummy->R() < 407.0){
1559  if (nValidClusters< 50)PhotonCandidate->SetCaloPhotonMCLabel(nValidClusters,mclabelsCluster[k]);
1560  nValidClusters++;
1561 // }
1562  }
1563  }
1564  }
1565  PhotonCandidate->SetNCaloPhotonMCLabels(nValidClusters);
1566 
1567  }
1568 
1569  fIsFromMBHeader = kTRUE;
1571 
1572  // test whether largest contribution to cluster orginates in added signals
1573  if (fIsMC>0 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() > 0){
1574  // Set the jetjet weight to 1 in case the photon candidate orignated from the minimum bias header
1575  if ( ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(PhotonCandidate->GetCaloPhotonMCLabel(0), fMCEvent, fInputEvent) == 2 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() == 4) tempPhotonWeight = 1;
1576  if ( ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(PhotonCandidate->GetCaloPhotonMCLabel(0), fMCEvent, fInputEvent) == 0) fIsFromMBHeader = kFALSE;
1577  if (clus->GetNLabels()>1){
1578  Int_t* mclabelsCluster = clus->GetLabels();
1579  for (Int_t l = 1; l < (Int_t)clus->GetNLabels(); l++ ){
1580  if (((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(mclabelsCluster[l], fMCEvent, fInputEvent) == 0) fIsOverlappingWithOtherHeader = kTRUE;
1581  }
1582  }
1583  }
1584 
1585  // check whether photon is from correct header
1587  fHistoClusOverlapHeadersGammaPt[fiCut]->Fill(PhotonCandidate->Pt(), tempPhotonWeight);
1588  }
1589  // only cluster candidates from correct header will be processed fully
1591  fHistoClusGammaPt[fiCut]->Fill(PhotonCandidate->Pt(), tempPhotonWeight);
1592  fHistoClusGammaE[fiCut]->Fill(PhotonCandidate->E(), tempPhotonWeight);
1593  if (fDoClusterQA > 0){
1594  fHistoClusNCellsPt[fiCut]->Fill(clus->GetNCells(), PhotonCandidate->Pt(), tempPhotonWeight);
1595  }
1597  } else {
1598  delete clus;
1599  delete tmpvec;
1600  delete PhotonCandidate;
1601  continue;
1602  }
1603 
1604  if(!((AliCaloPhotonCuts*)fClusterMergedCutArray->At(fiCut))->ClusterIsSelected(clus,fInputEvent,fMCEvent,fIsMC,tempPhotonWeight,i)){
1605  delete clus;
1606  delete tmpvec;
1607  delete PhotonCandidate;
1608  continue;
1609  }else {
1611  }
1612 
1613  AliAODCaloCluster* clusSub1 = new AliAODCaloCluster();
1614  AliAODCaloCluster* clusSub2 = new AliAODCaloCluster();
1615 
1616 
1617  // split clusters according to their shares in the cluster (NLM == 1) needs to be treated differently
1618  if (((AliCaloPhotonCuts*)fClusterMergedCutArray->At(fiCut))->GetMinNLMCut() == 1 &&
1619  ((AliCaloPhotonCuts*)fClusterMergedCutArray->At(fiCut))->GetMaxNLMCut() == 1 ){
1620 
1621  Int_t absCellIdFirst = ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->FindLargestCellInCluster(clus, fInputEvent);
1622  Int_t absCellIdSecond = ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->FindSecondLargestCellInCluster(clus, fInputEvent);
1623 
1624  ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->SplitEnergy(absCellIdFirst, absCellIdSecond,
1625  clus, fInputEvent, fIsMC, clusSub1, clusSub2);
1626 
1627 
1628  } else if (((AliCaloPhotonCuts*)fClusterMergedCutArray->At(fiCut))->GetMinNLMCut() > 1 ){
1629  const Int_t nc = clus->GetNCells();
1630  Int_t absCellIdList[nc];
1631  //Float_t maxEList[nc];
1632  //Int_t nlm = ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->GetNumberOfLocalMaxima(clus, fInputEvent, absCellIdList, maxEList);
1633  ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->SplitEnergy(absCellIdList[0], absCellIdList[1],
1634  clus, fInputEvent, fIsMC, clusSub1, clusSub2);
1635  }
1636  fHistoClusMergedPtvsM02[fiCut]->Fill( PhotonCandidate->Pt(),
1637  clus->GetM02(),
1638  tempPhotonWeight);
1639 
1640  // TLorentzvector with sub cluster 1
1641  TLorentzVector clusterVector1;
1642  clusSub1->GetMomentum(clusterVector1,vertex);
1643  TLorentzVector* tmpvec1 = new TLorentzVector();
1644  tmpvec1->SetPxPyPzE(clusterVector1.Px(),clusterVector1.Py(),clusterVector1.Pz(),clusterVector1.E());
1645  // convert to AODConversionPhoton
1646  AliAODConversionPhoton *PhotonCandidate1=new AliAODConversionPhoton(tmpvec1);
1647  if(!PhotonCandidate1){
1648  delete clusSub1;
1649  delete tmpvec1;
1650  continue;
1651  }
1652  // Flag Photon as CaloPhoton
1653  PhotonCandidate1->SetIsCaloPhoton();
1654 
1655  // TLorentzvector with sub cluster 2
1656  TLorentzVector clusterVector2;
1657  clusSub2->GetMomentum(clusterVector2,vertex);
1658  TLorentzVector* tmpvec2 = new TLorentzVector();
1659  tmpvec2->SetPxPyPzE(clusterVector2.Px(),clusterVector2.Py(),clusterVector2.Pz(),clusterVector2.E());
1660  // convert to AODConversionPhoton
1661  AliAODConversionPhoton *PhotonCandidate2=new AliAODConversionPhoton(tmpvec2);
1662  if(!PhotonCandidate2){
1663  delete clusSub2;
1664  delete tmpvec2;
1665  continue;
1666  }
1667  // Flag Photon as CaloPhoton
1668  PhotonCandidate2->SetIsCaloPhoton();
1669 
1670  // create pi0 candidate
1671  AliAODConversionMother *pi0cand = new AliAODConversionMother(PhotonCandidate1,PhotonCandidate2);
1672 
1673  if((((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->MesonIsSelected(pi0cand,kTRUE,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift()))){
1674  fHistoMotherInvMassPt[fiCut]->Fill(pi0cand->M(),PhotonCandidate->Pt(), tempPhotonWeight);
1675  fHistoClusMergedPtvsM02Accepted[fiCut]->Fill( PhotonCandidate->Pt(), clus->GetM02(), tempPhotonWeight);
1676  fHistoClusMergedEvsM02Accepted[fiCut]->Fill( PhotonCandidate->E(), clus->GetM02(), tempPhotonWeight);
1677  Int_t nlm = ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->GetNumberOfLocalMaxima(clus, fInputEvent);
1678  if ( nlm < 11 ){
1679  fHistoClusNLMPt[fiCut]->Fill( nlm, PhotonCandidate->Pt());
1680  } else {
1681  fHistoClusNLMPt[fiCut]->Fill( 11., PhotonCandidate->Pt());
1682  }
1683 
1684  if (fDoClusterQA > 0){
1685  fHistoClusMergedNCellsPt[fiCut]->Fill(clus->GetNCells(), PhotonCandidate->Pt(), tempPhotonWeight);
1686  Double_t energyAround = 0;
1687  Double_t nCellsAround = 0;
1688  for (Int_t j = 0; j < nclus; j++){
1689  if (j == i) continue;
1690  AliVCluster* clusTemp = NULL;
1691  if(fInputEvent->IsA()==AliESDEvent::Class()){
1692  if(arrClustersProcess)
1693  clusTemp = new AliESDCaloCluster(*(AliESDCaloCluster*)arrClustersProcess->At(j));
1694  else
1695  clusTemp = new AliESDCaloCluster(*(AliESDCaloCluster*)fInputEvent->GetCaloCluster(j));
1696  } else if(fInputEvent->IsA()==AliAODEvent::Class()){
1697  if(arrClustersProcess)
1698  clusTemp = new AliAODCaloCluster(*(AliAODCaloCluster*)arrClustersProcess->At(j));
1699  else
1700  clusTemp = new AliAODCaloCluster(*(AliAODCaloCluster*)fInputEvent->GetCaloCluster(j));
1701  }
1702 
1703  if (!clusTemp) continue;
1704 
1705  Double_t R = ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->GetDistanceBetweenClusters(clus, clusTemp);
1706 
1707  if (R < 0.15){
1708  nCellsAround = nCellsAround+clusTemp->GetNCells();
1709  energyAround = energyAround+clusTemp->E();
1710  }
1711  delete clusTemp;
1712  }
1713  fHistoClusMergedNCellsAroundPt[fiCut]->Fill(nCellsAround, PhotonCandidate->Pt(), tempPhotonWeight);
1714  fHistoClusMergedNCellsAroundAndInPt[fiCut]->Fill(nCellsAround+clus->GetNCells(), PhotonCandidate->Pt(), tempPhotonWeight);
1715  fHistoClusMergedEAroundE[fiCut]->Fill(energyAround, clus->E(), tempPhotonWeight);
1716  if (fIsMC > 0){
1717  fHistoClusMergedNParticlePt[fiCut]->Fill(clus->GetNLabels(), PhotonCandidate->Pt(), tempPhotonWeight);
1718  }
1719  }
1720  if (fDoMesonQA > 0 ){
1721  fHistoMotherPtY[fiCut]->Fill(PhotonCandidate->Pt(),pi0cand->Rapidity()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift(), tempPhotonWeight);
1722  fHistoMotherPtAlpha[fiCut]->Fill(PhotonCandidate->Pt(),TMath::Abs(pi0cand->GetAlpha()), tempPhotonWeight);
1723  }
1724  if(fIsMC> 0 && PhotonCandidate && PhotonCandidate1 && PhotonCandidate2){
1725  if(fInputEvent->IsA()==AliESDEvent::Class())
1726  ProcessTrueClusterCandidates(PhotonCandidate, clus->GetM02(), PhotonCandidate1, PhotonCandidate2);
1727  if(fInputEvent->IsA()==AliAODEvent::Class())
1728  ProcessTrueClusterCandidatesAOD(PhotonCandidate, clus->GetM02(), PhotonCandidate1, PhotonCandidate2);
1729  }
1730  }
1731 
1732 
1733 
1734  delete pi0cand;
1735  delete clusSub1;
1736  delete tmpvec1;
1737  delete PhotonCandidate1;
1738  delete clusSub2;
1739  delete tmpvec2;
1740  delete PhotonCandidate2;
1741 
1742  delete clus;
1743  delete tmpvec;
1744  delete PhotonCandidate;
1745  }
1746 
1747 }
1748 
1749 //________________________________________________________________________
1751  AliAODConversionPhoton *TrueSubClusterCandidate1,
1752  AliAODConversionPhoton *TrueSubClusterCandidate2)
1753 {
1754 
1755  const AliVVertex* primVtxMC = fMCEvent->GetPrimaryVertex();
1756  Double_t mcProdVtxX = primVtxMC->GetX();
1757  Double_t mcProdVtxY = primVtxMC->GetY();
1758  Double_t mcProdVtxZ = primVtxMC->GetZ();
1759 
1760  Double_t tempClusterWeight = fWeightJetJetMC;
1761  TParticle *Photon = NULL;
1762  if (!TrueClusterCandidate->GetIsCaloPhoton()) AliFatal("CaloPhotonFlag has not been set task will abort");
1763  if (TrueClusterCandidate->GetCaloPhotonMCLabel(0) < 0) return;
1764 
1765  if (TrueClusterCandidate->GetNCaloPhotonMCLabels()>0) Photon = fMCEvent->Particle(TrueClusterCandidate->GetCaloPhotonMCLabel(0));
1766  else return;
1767 
1768  if(Photon == NULL){
1769  // cout << "no photon" << endl;
1770  return;
1771  }
1772 
1773  AliAODConversionMother *mesoncand = new AliAODConversionMother(TrueSubClusterCandidate1,TrueSubClusterCandidate2);
1774  Bool_t mesonIsSelected = (((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->MesonIsSelected(mesoncand,kTRUE,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift()));
1775  if (!mesonIsSelected){
1776  delete mesoncand;
1777  return;
1778  }
1779  Int_t pdgCodeParticle = Photon->GetPdgCode();
1780  TrueClusterCandidate->SetCaloPhotonMCFlags(fMCEvent, fEnableSortForClusMC);
1781  if (TrueClusterCandidate->GetNCaloPhotonMCLabels()>0 && fEnableDetailedPrintOut){
1782  cout << endl << endl << "Cluster energy: " << TrueClusterCandidate->E() << endl;;
1783  TrueClusterCandidate->PrintCaloMCLabelsAndInfo(fMCEvent);
1784  TrueClusterCandidate->PrintCaloMCFlags();
1785  }
1786 
1788  Int_t clusterClass = 0;
1789  Bool_t isPrimary = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryESD( fMCEvent, TrueClusterCandidate->GetCaloPhotonMCLabel(0), mcProdVtxX, mcProdVtxY, mcProdVtxZ);
1790 
1791  // cluster classification:
1792  // 1 - nice merged cluster (2 gamma | contributions from 2 gamma) from pi0/eta
1793  // 2 - contribution from only 1 partner (1 gamma, 1 fully coverted gamma) from pi0/eta
1794  // 3 - contribution from part of 1 partner (1 electron) from pi0/eta
1795  Long_t motherLab = -1;
1796  if (TrueClusterCandidate->IsMerged() || TrueClusterCandidate->IsMergedPartConv()){
1797  clusterClass = 1;
1798  motherLab = TrueClusterCandidate->GetCaloPhotonMotherMCLabel(0);
1799  } else if (TrueClusterCandidate->GetNCaloPhotonMotherMCLabels()> 0){
1800 // cout << TrueClusterCandidate->GetCaloPhotonMotherMCLabel(0) << endl;
1801  if (TrueClusterCandidate->IsLargestComponentElectron() || TrueClusterCandidate->IsLargestComponentPhoton()){
1802  if (TrueClusterCandidate->GetCaloPhotonMotherMCLabel(0) > -1 && (fMCEvent->Particle(TrueClusterCandidate->GetCaloPhotonMotherMCLabel(0))->GetPdgCode() == 111 || fMCEvent->Particle(TrueClusterCandidate->GetCaloPhotonMotherMCLabel(0))->GetPdgCode() == 221) ){
1803  if ( TrueClusterCandidate->IsConversion() && !TrueClusterCandidate->IsConversionFullyContained() ){
1804  clusterClass = 3;
1805  motherLab = TrueClusterCandidate->GetCaloPhotonMotherMCLabel(0);
1806  } else {
1807  clusterClass = 2;
1808  motherLab = TrueClusterCandidate->GetCaloPhotonMotherMCLabel(0);
1809  }
1810  }
1811  } else if (TrueClusterCandidate->IsSubLeadingEM()){
1812  if (TrueClusterCandidate->GetNCaloPhotonMotherMCLabels()> 1){
1813  if (fEnableDetailedPrintOut) cout << "Is Subleading EM: "<< TrueClusterCandidate->GetCaloPhotonMotherMCLabel(1) << endl;
1814  if ( TrueClusterCandidate->GetCaloPhotonMotherMCLabel(1) > -1){
1815  if (fMCEvent->Particle(TrueClusterCandidate->GetCaloPhotonMotherMCLabel(1))->GetPdgCode() == 111 || fMCEvent->Particle(TrueClusterCandidate->GetCaloPhotonMotherMCLabel(1))->GetPdgCode() == 221 ){
1816  clusterClass = 2;
1817  motherLab = TrueClusterCandidate->GetCaloPhotonMotherMCLabel(1);
1818  }
1819  }
1820  }
1821  } else {
1822  motherLab = TrueClusterCandidate->GetCaloPhotonMotherMCLabel(0);
1823  }
1824  }
1825 
1826  // Get Mother particle
1827  TParticle *mother = NULL;
1828  Int_t motherPDG = -1;
1829  if (motherLab > -1){
1830  mother = fMCEvent->Particle(motherLab);
1831  }
1832  if (fEnableDetailedPrintOut) cout << "cluster class: " << clusterClass << "\t mother lab: "<< motherLab ;
1833  if (mother){
1834  motherPDG = TMath::Abs(mother->GetPdgCode());
1835  if (fEnableDetailedPrintOut) cout << "\t mother pdg: " << motherPDG << endl;
1836  } else {
1837  if (fEnableDetailedPrintOut) cout << endl;
1838  }
1839  // Set the jetjet weight to 1 in case the photon orignated from the minimum bias header
1840  if (fIsMC>0 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() == 4){
1841  if ( ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(motherLab, fMCEvent, fInputEvent) == 2) tempClusterWeight = 1;
1842  }
1843 
1844  //
1845  if (clusterClass == 1 || clusterClass == 2 || clusterClass == 3 ){
1846  fHistoTrueClusMergedPtvsM02[fiCut]->Fill(TrueClusterCandidate->Pt(), m02, tempClusterWeight);
1847  if (fDoMesonQA > 1)fHistoTrueClusMergedInvMassvsPt[fiCut]->Fill(mesoncand->M(),TrueClusterCandidate->Pt(), tempClusterWeight);
1848 
1849  // separate different components
1850  if (clusterClass == 1 && TrueClusterCandidate->IsMerged()){
1851  if (motherPDG == 111){
1852  fHistoTrueClusMergedPureFromPi0PtvsM02[fiCut]->Fill(TrueClusterCandidate->Pt(), m02, tempClusterWeight);
1853  if (GetSelectedMesonID() < 2 && !isPrimary && m02 >= 0 && m02 <= 4.8 ){
1854  fHistoTrueSecPi0PtvsDiffReco[fiCut]->Fill(TrueClusterCandidate->Pt(), 0., tempClusterWeight);
1855  }
1856  }
1857  if (motherPDG == 221)
1858  fHistoTrueClusMergedPureFromEtaPtvsM02[fiCut]->Fill(TrueClusterCandidate->Pt(), m02, tempClusterWeight);
1859  } else if (clusterClass == 1 && TrueClusterCandidate->IsMergedPartConv()){
1860  if (motherPDG == 111){
1861  fHistoTrueClusMergedPartConvFromPi0PtvsM02[fiCut]->Fill(TrueClusterCandidate->Pt(), m02, tempClusterWeight);
1862  if (GetSelectedMesonID() < 2 && !isPrimary && m02 >= 0 && m02 <= 4.8 ){
1863  fHistoTrueSecPi0PtvsDiffReco[fiCut]->Fill(TrueClusterCandidate->Pt(), 1., tempClusterWeight);
1864  }
1865  }
1866  if (motherPDG == 221)
1867  fHistoTrueClusMergedPartConvFromEtaPtvsM02[fiCut]->Fill(TrueClusterCandidate->Pt(), m02, tempClusterWeight);
1868  } else if (clusterClass == 2){
1869  if (motherPDG == 111){
1870  fHistoTrueClusGammaFromPi0PtvsM02[fiCut]->Fill(TrueClusterCandidate->Pt(), m02, tempClusterWeight);
1871  if (GetSelectedMesonID() < 2 && !isPrimary && m02 >= 0 && m02 <= 4.8 ){
1872  fHistoTrueSecPi0PtvsDiffReco[fiCut]->Fill(TrueClusterCandidate->Pt(), 2., tempClusterWeight);
1873  }
1874  }if (motherPDG == 221)
1875  fHistoTrueClusGammaFromEtaPtvsM02[fiCut]->Fill(TrueClusterCandidate->Pt(), m02, tempClusterWeight);
1876  } else if (clusterClass == 3){
1877  if (motherPDG == 111) {
1878  fHistoTrueClusElectronFromPi0PtvsM02[fiCut]->Fill(TrueClusterCandidate->Pt(), m02, tempClusterWeight);
1879  if (GetSelectedMesonID() < 2 && !isPrimary && m02 >= 0 && m02 <= 4.8 ){
1880  fHistoTrueSecPi0PtvsDiffReco[fiCut]->Fill(TrueClusterCandidate->Pt(), 3., tempClusterWeight);
1881  }
1882  }
1883  if (motherPDG == 221)
1884  fHistoTrueClusElectronFromEtaPtvsM02[fiCut]->Fill(TrueClusterCandidate->Pt(), m02, tempClusterWeight);
1885  }
1886 
1887  // deal with pi0 only
1888  if (motherPDG == 111){
1889  fHistoTrueClusPi0PtvsM02[fiCut]->Fill(TrueClusterCandidate->Pt(), m02, tempClusterWeight);
1891  fHistoDoubleCountTruePi0PtvsM02[fiCut]->Fill(TrueClusterCandidate->Pt(), m02, tempClusterWeight);
1892  if (!isPrimary)
1893  fHistoDoubleCountTrueSecPi0Pt[fiCut]->Fill(TrueClusterCandidate->Pt(), tempClusterWeight);
1894  }
1895 
1896 
1897  if (TrueClusterCandidate->IsDalitz()){
1898  fHistoTrueClusPi0DalitzPtvsM02[fiCut]->Fill(TrueClusterCandidate->Pt(), m02, tempClusterWeight);
1899  }
1900  if (fDoMesonQA > 1)fHistoTrueClusPi0InvMassvsPt[fiCut]->Fill(mesoncand->M(),TrueClusterCandidate->Pt(), tempClusterWeight);
1901  if (fDoMesonQA > 0){
1902  fHistoTrueClusPi0EM02[fiCut]->Fill(TrueClusterCandidate->E(), m02, tempClusterWeight);
1903  }
1904  if (fDoMesonQA > 0 && GetSelectedMesonID() != 2){
1905  fHistoTruePi0PtY[fiCut]->Fill(TrueClusterCandidate->Pt(),mesoncand->Rapidity()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift(), tempClusterWeight);
1906  fHistoTruePi0PtAlpha[fiCut]->Fill(TrueClusterCandidate->Pt(),TMath::Abs(mesoncand->GetAlpha()), tempClusterWeight);
1907  }
1908 
1909  if (GetSelectedMesonID() < 2) {
1910  if (isPrimary) {
1911  fHistoTrueClusPrimPi0PtvsM02[fiCut]->Fill(TrueClusterCandidate->Pt(), m02, tempClusterWeight);
1912  if (fDoMesonQA > 1) fHistoTrueClusPrimPi0InvMassvsPt[fiCut]->Fill(mesoncand->M(),TrueClusterCandidate->Pt(), tempClusterWeight);
1913  if (fDoMesonQA > 0){
1914  if (clusterClass == 1 && TrueClusterCandidate->IsMerged())
1915  fHistoTruePrimaryPi0PureMergedMCPtResolPt[fiCut]->Fill(mother->Pt(),(TrueClusterCandidate->Pt()-mother->Pt())/mother->Pt(),tempClusterWeight);
1916  else if (clusterClass == 1 && TrueClusterCandidate->IsMergedPartConv())
1917  fHistoTruePrimaryPi0MergedPartConvMCPtResolPt[fiCut]->Fill(mother->Pt(),(TrueClusterCandidate->Pt()-mother->Pt())/mother->Pt(),tempClusterWeight);
1918  else if (clusterClass == 2)
1919  fHistoTruePrimaryPi01GammaMCPtResolPt[fiCut]->Fill(mother->Pt(),(TrueClusterCandidate->Pt()-mother->Pt())/mother->Pt(),tempClusterWeight);
1920  else if (clusterClass == 3)
1921  fHistoTruePrimaryPi01ElectronMCPtResolPt[fiCut]->Fill(mother->Pt(),(TrueClusterCandidate->Pt()-mother->Pt())/mother->Pt(),tempClusterWeight);
1922  }
1923  } else {
1924  fHistoTrueClusSecPi0PtvsM02[fiCut]->Fill(TrueClusterCandidate->Pt(), m02, tempClusterWeight);
1925  if (fDoMesonQA > 0){
1926  fHistoTrueSecondaryPi0MCPtResolPt[fiCut]->Fill(mother->Pt(),(TrueClusterCandidate->Pt()-mother->Pt())/mother->Pt(),tempClusterWeight);
1927  }
1928  Int_t grandMaLab = mother->GetMother(0);
1929  if (grandMaLab > -1){
1930  if (TMath::Abs(fMCEvent->Particle(grandMaLab)->GetPdgCode()) == 310){
1931  fHistoTrueClusSecPi0FromK0sPtvsM02[fiCut]->Fill(TrueClusterCandidate->Pt(), m02, tempClusterWeight);
1932  } else if (TMath::Abs(fMCEvent->Particle(grandMaLab)->GetPdgCode()) == 130){
1933  fHistoTrueClusSecPi0FromK0lPtvsM02[fiCut]->Fill(TrueClusterCandidate->Pt(), m02, tempClusterWeight);
1934  } else if (TMath::Abs(fMCEvent->Particle(grandMaLab)->GetPdgCode()) == 3122){
1935  fHistoTrueClusSecPi0FromLambdaPtvsM02[fiCut]->Fill(TrueClusterCandidate->Pt(), m02, tempClusterWeight);
1936  }
1937  }
1938  }
1939  }
1940  // deal with eta only
1941  } else if (motherPDG == 221){
1942  fHistoTrueClusEtaPtvsM02[fiCut]->Fill(TrueClusterCandidate->Pt(), m02, tempClusterWeight);
1943  if (TrueClusterCandidate->IsDalitz()){
1944  fHistoTrueClusEtaDalitzPtvsM02[fiCut]->Fill(TrueClusterCandidate->Pt(), m02, tempClusterWeight);
1945  }
1946  if (CheckVectorForDoubleCount(fVectorDoubleCountTrueEtas,motherLab)) fHistoDoubleCountTrueEtaPtvsM02[fiCut]->Fill(TrueClusterCandidate->Pt(), m02, tempClusterWeight);
1947  if (fDoMesonQA > 1)fHistoTrueClusEtaInvMassvsPt[fiCut]->Fill(mesoncand->M(),TrueClusterCandidate->Pt(), tempClusterWeight);
1948  if (fDoMesonQA > 0){
1949  fHistoTrueClusEtaEM02[fiCut]->Fill(TrueClusterCandidate->E(), m02, tempClusterWeight);
1950  }
1951  if ( fDoMesonQA > 0 && GetSelectedMesonID() != 1 ){
1952  fHistoTrueEtaPtY[fiCut]->Fill(TrueClusterCandidate->Pt(),mesoncand->Rapidity()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift(), tempClusterWeight);
1953  fHistoTrueEtaPtAlpha[fiCut]->Fill(TrueClusterCandidate->Pt(),TMath::Abs(mesoncand->GetAlpha()), tempClusterWeight);
1954  fHistoTruePrimaryEtaMCPtResolPt[fiCut]->Fill(mother->Pt(),(TrueClusterCandidate->Pt()-mother->Pt())/mother->Pt(),tempClusterWeight);
1955  }
1956  } else {
1957  fHistoTrueMergedMissedPDG[fiCut]->Fill(motherPDG, tempClusterWeight);
1958  }
1959 
1960  // leading particle is a photon or the conversion is fully contained and its not from pi0 || eta
1961  } else if (TrueClusterCandidate->IsLargestComponentPhoton() || TrueClusterCandidate->IsConversionFullyContained()
1962  || TrueClusterCandidate->IsElectronFromFragPhoton()){
1963  if (fEnableDetailedPrintOut) cout << "photon" << endl;
1964  fHistoTrueClusGammaPtvsM02[fiCut]->Fill(TrueClusterCandidate->Pt(), m02, tempClusterWeight);
1965  if (fDoMesonQA > 0){
1966  fHistoTrueClusGammaEM02[fiCut]->Fill(TrueClusterCandidate->E(), m02, tempClusterWeight);
1967  }
1968 
1969  if (fDoMesonQA > 1) fHistoTrueClusGammaInvMassvsPt[fiCut]->Fill(mesoncand->M(),TrueClusterCandidate->Pt(), tempClusterWeight);
1970  if (motherLab == -1){
1971  fHistoTrueClusGammaPtvsSource[fiCut]->Fill(TrueClusterCandidate->Pt(), 0.5, tempClusterWeight); // direct photon
1972  } else {
1973  if (motherPDG == 111)
1974  fHistoTrueClusGammaPtvsSource[fiCut]->Fill(TrueClusterCandidate->Pt(), 1.5, tempClusterWeight); // pi0
1975  else if (motherPDG == 221)
1976  fHistoTrueClusGammaPtvsSource[fiCut]->Fill(TrueClusterCandidate->Pt(), 2.5, tempClusterWeight); // eta
1977  else if (motherPDG == 331)
1978  fHistoTrueClusGammaPtvsSource[fiCut]->Fill(TrueClusterCandidate->Pt(), 3.5, tempClusterWeight); // eta'
1979  else if (motherPDG == 223)
1980  fHistoTrueClusGammaPtvsSource[fiCut]->Fill(TrueClusterCandidate->Pt(), 4.5, tempClusterWeight); // omega
1981  else if (motherPDG == 333)
1982  fHistoTrueClusGammaPtvsSource[fiCut]->Fill(TrueClusterCandidate->Pt(), 5.5, tempClusterWeight); // phi
1983  else if (motherPDG == 3122)
1984  fHistoTrueClusGammaPtvsSource[fiCut]->Fill(TrueClusterCandidate->Pt(), 6.5, tempClusterWeight); // Lambda
1985  else
1986  fHistoTrueClusGammaPtvsSource[fiCut]->Fill(TrueClusterCandidate->Pt(), 7.5, tempClusterWeight); // rest
1987  }
1988 
1989  // leading particle is an electron and its not from pi0 || eta and no electron from fragmentation photon conversion
1990  } else if (TrueClusterCandidate->IsLargestComponentElectron() &&
1991  !TrueClusterCandidate->IsElectronFromFragPhoton()){
1992  if (fEnableDetailedPrintOut) cout << "electron" << endl;
1993  fHistoTrueClusElectronPtvsM02[fiCut]->Fill(TrueClusterCandidate->Pt(), m02, tempClusterWeight);
1994  if (fDoMesonQA > 0){
1995  fHistoTrueClusElectronEM02[fiCut]->Fill(TrueClusterCandidate->E(), m02, tempClusterWeight);
1996  }
1997 
1998  if (fDoMesonQA > 1) fHistoTrueClusElectronInvMassvsPt[fiCut]->Fill(mesoncand->M(),TrueClusterCandidate->Pt(), tempClusterWeight);
1999  Int_t motherLab = Photon->GetMother(0);
2000  mother = fMCEvent->Particle(motherLab);
2001  if (mother){
2002  TrueClusterCandidate->GetLabel(0);
2003  motherPDG = TMath::Abs(mother->GetPdgCode());
2004  }
2005 
2006  if (motherLab == -1){
2007  fHistoTrueClusElectronPtvsSource[fiCut]->Fill(TrueClusterCandidate->Pt(), 0.5, tempClusterWeight); // direct electron
2008  } else {
2009  if (motherPDG == 22){
2010  fHistoTrueClusElectronPtvsSource[fiCut]->Fill(TrueClusterCandidate->Pt(), 1.5, tempClusterWeight); // gamma
2011  fHistoTrueClusElectronFromGammaPtvsM02[fiCut]->Fill(TrueClusterCandidate->Pt(), m02, tempClusterWeight);
2012  } else if (motherPDG == 111){
2013  fHistoTrueClusElectronPtvsSource[fiCut]->Fill(TrueClusterCandidate->Pt(), 2.5, tempClusterWeight); // pi0
2014  } else if (motherPDG == 221){
2015  fHistoTrueClusElectronPtvsSource[fiCut]->Fill(TrueClusterCandidate->Pt(), 3.5, tempClusterWeight); // eta
2016  } else if ( int(motherPDG/100.)==5 || int(motherPDG/1000.)==5 ){
2017  fHistoTrueClusElectronPtvsSource[fiCut]->Fill(TrueClusterCandidate->Pt(), 5.5, tempClusterWeight); // b
2018  } else if ( int(motherPDG/100.)==4 || int(motherPDG/1000.)==4 ){
2019  fHistoTrueClusElectronPtvsSource[fiCut]->Fill(TrueClusterCandidate->Pt(), 4.5, tempClusterWeight); // c
2020  } else if (motherPDG == 23 || motherPDG == 24){
2021  fHistoTrueClusElectronPtvsSource[fiCut]->Fill(TrueClusterCandidate->Pt(), 6.5, tempClusterWeight); // W/Z
2022  } else if (motherPDG == 15) {
2023  fHistoTrueClusElectronPtvsSource[fiCut]->Fill(TrueClusterCandidate->Pt(), 7.5, tempClusterWeight); // tau
2024  } else {
2025  fHistoTrueClusElectronPtvsSource[fiCut]->Fill(TrueClusterCandidate->Pt(), 8.5, tempClusterWeight); // rest
2026  }
2027  }
2028 
2029  // leading particle is a hadron
2030  } else {
2031  if (fEnableDetailedPrintOut) cout << "BG" << endl;
2032  fHistoTrueClusBGPtvsM02[fiCut]->Fill(TrueClusterCandidate->Pt(), m02, tempClusterWeight);
2033  if (fDoMesonQA > 1) fHistoTrueClusBGInvMassvsPt[fiCut]->Fill(mesoncand->M(),TrueClusterCandidate->Pt(), tempClusterWeight);
2034 
2035  Double_t maxM02 = 4.8;
2036  if (m02 >= 0 && m02 < maxM02){
2037  if (TMath::Abs(pdgCodeParticle) == 211) fHistoTrueClusBGPtvsSource[fiCut]->Fill(TrueClusterCandidate->Pt(), 0.5, tempClusterWeight); // pi+/-
2038  else if (TMath::Abs(pdgCodeParticle) == 2212) fHistoTrueClusBGPtvsSource[fiCut]->Fill(TrueClusterCandidate->Pt(), 1.5, tempClusterWeight); // p
2039  else if (TMath::Abs(pdgCodeParticle) == 321) fHistoTrueClusBGPtvsSource[fiCut]->Fill(TrueClusterCandidate->Pt(), 2.5, tempClusterWeight); // K+-
2040  else if (TMath::Abs(pdgCodeParticle) == 2112) fHistoTrueClusBGPtvsSource[fiCut]->Fill(TrueClusterCandidate->Pt(), 3.5, tempClusterWeight); // n
2041  else if (TMath::Abs(pdgCodeParticle) == 310) fHistoTrueClusBGPtvsSource[fiCut]->Fill(TrueClusterCandidate->Pt(), 4.5, tempClusterWeight); // K0s
2042  else if (TMath::Abs(pdgCodeParticle) == 3122) fHistoTrueClusBGPtvsSource[fiCut]->Fill(TrueClusterCandidate->Pt(), 5.5, tempClusterWeight); // Lambda
2043  else if (TMath::Abs(pdgCodeParticle) == 13) fHistoTrueClusBGPtvsSource[fiCut]->Fill(TrueClusterCandidate->Pt(), 6.5, tempClusterWeight); // mu+/-
2044  else if (TMath::Abs(pdgCodeParticle) == 130) fHistoTrueClusBGPtvsSource[fiCut]->Fill(TrueClusterCandidate->Pt(), 7.5, tempClusterWeight); // K0l
2045  else fHistoTrueClusBGPtvsSource[fiCut]->Fill(TrueClusterCandidate->Pt(), 8.5, tempClusterWeight); // Rest
2046  }
2047  }
2048  }
2049  delete mesoncand;
2050  return;
2051 }
2052 
2053 //________________________________________________________________________
2055  AliAODConversionPhoton *TrueSubClusterCandidate1,
2056  AliAODConversionPhoton *TrueSubClusterCandidate2)
2057 {
2058 
2059  const AliVVertex* primVtxMC = fMCEvent->GetPrimaryVertex();
2060  Double_t mcProdVtxX = primVtxMC->GetX();
2061  Double_t mcProdVtxY = primVtxMC->GetY();
2062  Double_t mcProdVtxZ = primVtxMC->GetZ();
2063 
2064  Double_t tempClusterWeight = fWeightJetJetMC;
2065  AliAODMCParticle *Photon = NULL;
2066  TClonesArray *AODMCTrackArray = dynamic_cast<TClonesArray*>(fInputEvent->FindListObject(AliAODMCParticle::StdBranchName()));
2067  if (AODMCTrackArray){
2068  if (!TrueClusterCandidate->GetIsCaloPhoton()) AliFatal("CaloPhotonFlag has not been set task will abort");
2069  if (TrueClusterCandidate->GetCaloPhotonMCLabel(0) < 0) return;
2070 
2071  if (TrueClusterCandidate->GetNCaloPhotonMCLabels()>0) Photon = (AliAODMCParticle*) AODMCTrackArray->At(TrueClusterCandidate->GetCaloPhotonMCLabel(0));
2072  else return;
2073  } else {
2074  AliInfo("AODMCTrackArray could not be loaded");
2075  return;
2076  }
2077 
2078  if(Photon == NULL){
2079  // cout << "no photon" << endl;
2080  return;
2081  }
2082 
2083  AliAODConversionMother *mesoncand = new AliAODConversionMother(TrueSubClusterCandidate1,TrueSubClusterCandidate2);
2084  Bool_t mesonIsSelected = (((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->MesonIsSelected(mesoncand,kTRUE,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift()));
2085  if (!mesonIsSelected){
2086  delete mesoncand;
2087  return;
2088  }
2089  Int_t pdgCodeParticle = Photon->GetPdgCode();
2091  if (TrueClusterCandidate->GetNCaloPhotonMCLabels()>0 && fEnableDetailedPrintOut){
2092  cout << endl << endl << "Cluster energy: " << TrueClusterCandidate->E() << endl;;
2093  //TrueClusterCandidate->PrintCaloMCLabelsAndInfo(fMCEvent);
2094  TrueClusterCandidate->PrintCaloMCFlags();
2095  }
2096 
2098  Int_t clusterClass = 0;
2099  Bool_t isPrimary = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryAOD( fInputEvent, Photon, mcProdVtxX, mcProdVtxY, mcProdVtxZ);
2100 
2101  // cluster classification:
2102  // 1 - nice merged cluster (2 gamma | contributions from 2 gamma) from pi0/eta
2103  // 2 - contribution from only 1 partner (1 gamma, 1 fully coverted gamma) from pi0/eta
2104  // 3 - contribution from part of 1 partner (1 electron) from pi0/eta
2105  Long_t motherLab = -1;
2106  if (TrueClusterCandidate->IsMerged() || TrueClusterCandidate->IsMergedPartConv()){
2107  clusterClass = 1;
2108  motherLab = TrueClusterCandidate->GetCaloPhotonMotherMCLabel(0);
2109  } else if (TrueClusterCandidate->GetNCaloPhotonMotherMCLabels()> 0){
2110 // cout << TrueClusterCandidate->GetCaloPhotonMotherMCLabel(0) << endl;
2111  if (TrueClusterCandidate->IsLargestComponentElectron() || TrueClusterCandidate->IsLargestComponentPhoton()){
2112  if (TrueClusterCandidate->GetCaloPhotonMotherMCLabel(0) > -1 && (((AliAODMCParticle*) AODMCTrackArray->At(TrueClusterCandidate->GetCaloPhotonMotherMCLabel(0)))->GetPdgCode() == 111 || ((AliAODMCParticle*) AODMCTrackArray->At(TrueClusterCandidate->GetCaloPhotonMotherMCLabel(0)))->GetPdgCode() == 221) ){
2113  if ( TrueClusterCandidate->IsConversion() && !TrueClusterCandidate->IsConversionFullyContained() ){
2114  clusterClass = 3;
2115  motherLab = TrueClusterCandidate->GetCaloPhotonMotherMCLabel(0);
2116  } else {
2117  clusterClass = 2;
2118  motherLab = TrueClusterCandidate->GetCaloPhotonMotherMCLabel(0);
2119  }
2120  }
2121  } else if (TrueClusterCandidate->IsSubLeadingEM()){
2122  if (TrueClusterCandidate->GetNCaloPhotonMotherMCLabels()> 1){
2123  if (fEnableDetailedPrintOut) cout << "Is Subleading EM: "<< TrueClusterCandidate->GetCaloPhotonMotherMCLabel(1) << endl;
2124  if ( TrueClusterCandidate->GetCaloPhotonMotherMCLabel(1) > -1){
2125  if (TMath::Abs(((AliAODMCParticle*) AODMCTrackArray->At(TrueClusterCandidate->GetCaloPhotonMotherMCLabel(1)))->GetPdgCode()) == 111 || TMath::Abs(((AliAODMCParticle*) AODMCTrackArray->At(TrueClusterCandidate->GetCaloPhotonMotherMCLabel(1)))->GetPdgCode()) == 221 ){
2126  clusterClass = 2;
2127  motherLab = TrueClusterCandidate->GetCaloPhotonMotherMCLabel(1);
2128  }
2129  }
2130  }
2131  } else {
2132  motherLab = TrueClusterCandidate->GetCaloPhotonMotherMCLabel(0);
2133  }
2134  }
2135 
2136  // Get Mother particle
2137  AliAODMCParticle *mother = NULL;
2138  Int_t motherPDG = -1;
2139  if (motherLab > -1){
2140  mother = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(motherLab));
2141  }
2142  if (fEnableDetailedPrintOut) cout << "cluster class: " << clusterClass << "\t mother lab: "<< motherLab ;
2143  if (mother){
2144  motherPDG = TMath::Abs(mother->GetPdgCode());
2145  if (fEnableDetailedPrintOut) cout << "\t mother pdg: " << motherPDG << endl;
2146  } else {
2147  if (fEnableDetailedPrintOut) cout << endl;
2148  }
2149 
2150  // Set the jetjet weight to 1 in case the cluster orignated from the minimum bias header
2151  if (fIsMC>0 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() == 4){
2152  if ( ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(motherLab, fMCEvent, fInputEvent) == 2) tempClusterWeight = 1;
2153  }
2154 
2155  //
2156  if (clusterClass == 1 || clusterClass == 2 || clusterClass == 3 ){
2157  fHistoTrueClusMergedPtvsM02[fiCut]->Fill(TrueClusterCandidate->Pt(), m02, tempClusterWeight);
2158  if (fDoMesonQA > 1)fHistoTrueClusMergedInvMassvsPt[fiCut]->Fill(mesoncand->M(),TrueClusterCandidate->Pt(), tempClusterWeight);
2159 
2160  // separate different components
2161  if (clusterClass == 1 && TrueClusterCandidate->IsMerged()){
2162  if (motherPDG == 111){
2163  fHistoTrueClusMergedPureFromPi0PtvsM02[fiCut]->Fill(TrueClusterCandidate->Pt(), m02, tempClusterWeight);
2164  if (GetSelectedMesonID() < 2 && !isPrimary && m02 >= 0 && m02 <= 4.8 ){
2165  fHistoTrueSecPi0PtvsDiffReco[fiCut]->Fill(TrueClusterCandidate->Pt(), 0., tempClusterWeight);
2166  }
2167  }
2168  if (motherPDG == 221)
2169  fHistoTrueClusMergedPureFromEtaPtvsM02[fiCut]->Fill(TrueClusterCandidate->Pt(), m02, tempClusterWeight);
2170  } else if (clusterClass == 1 && TrueClusterCandidate->IsMergedPartConv()){
2171  if (motherPDG == 111){
2172  fHistoTrueClusMergedPartConvFromPi0PtvsM02[fiCut]->Fill(TrueClusterCandidate->Pt(), m02, tempClusterWeight);
2173  if (GetSelectedMesonID() < 2 && !isPrimary && m02 >= 0 && m02 <= 4.8 ){
2174  fHistoTrueSecPi0PtvsDiffReco[fiCut]->Fill(TrueClusterCandidate->Pt(), 1., tempClusterWeight);
2175  }
2176  }
2177  if (motherPDG == 221)
2178  fHistoTrueClusMergedPartConvFromEtaPtvsM02[fiCut]->Fill(TrueClusterCandidate->Pt(), m02, tempClusterWeight);
2179  } else if (clusterClass == 2){
2180  if (motherPDG == 111){
2181  fHistoTrueClusGammaFromPi0PtvsM02[fiCut]->Fill(TrueClusterCandidate->Pt(), m02, tempClusterWeight);
2182  if (GetSelectedMesonID() < 2 && !isPrimary && m02 >= 0 && m02 <= 4.8 ){
2183  fHistoTrueSecPi0PtvsDiffReco[fiCut]->Fill(TrueClusterCandidate->Pt(), 2., tempClusterWeight);
2184  }
2185  }if (motherPDG == 221)
2186  fHistoTrueClusGammaFromEtaPtvsM02[fiCut]->Fill(TrueClusterCandidate->Pt(), m02, tempClusterWeight);
2187  } else if (clusterClass == 3){
2188  if (motherPDG == 111) {
2189  fHistoTrueClusElectronFromPi0PtvsM02[fiCut]->Fill(TrueClusterCandidate->Pt(), m02, tempClusterWeight);
2190  if (GetSelectedMesonID() < 2 && !isPrimary && m02 >= 0 && m02 <= 4.8 ){
2191  fHistoTrueSecPi0PtvsDiffReco[fiCut]->Fill(TrueClusterCandidate->Pt(), 3., tempClusterWeight);
2192  }
2193  }
2194  if (motherPDG == 221)
2195  fHistoTrueClusElectronFromEtaPtvsM02[fiCut]->Fill(TrueClusterCandidate->Pt(), m02, tempClusterWeight);
2196  }
2197 
2198  // deal with pi0 only
2199  if (motherPDG == 111){
2200  fHistoTrueClusPi0PtvsM02[fiCut]->Fill(TrueClusterCandidate->Pt(), m02, tempClusterWeight);
2202  fHistoDoubleCountTruePi0PtvsM02[fiCut]->Fill(TrueClusterCandidate->Pt(), m02, tempClusterWeight);
2203  if (!isPrimary)
2204  fHistoDoubleCountTrueSecPi0Pt[fiCut]->Fill(TrueClusterCandidate->Pt(), tempClusterWeight);
2205  }
2206 
2207 
2208  if (TrueClusterCandidate->IsDalitz()){
2209  fHistoTrueClusPi0DalitzPtvsM02[fiCut]->Fill(TrueClusterCandidate->Pt(), m02, tempClusterWeight);
2210  }
2211  if (fDoMesonQA > 1)fHistoTrueClusPi0InvMassvsPt[fiCut]->Fill(mesoncand->M(),TrueClusterCandidate->Pt(), tempClusterWeight);
2212  if (fDoMesonQA > 0){
2213  fHistoTrueClusPi0EM02[fiCut]->Fill(TrueClusterCandidate->E(), m02, tempClusterWeight);
2214  }
2215  if (fDoMesonQA > 0 && GetSelectedMesonID() != 2){
2216  fHistoTruePi0PtY[fiCut]->Fill(TrueClusterCandidate->Pt(),mesoncand->Rapidity()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift(), tempClusterWeight);
2217  fHistoTruePi0PtAlpha[fiCut]->Fill(TrueClusterCandidate->Pt(),TMath::Abs(mesoncand->GetAlpha()), tempClusterWeight);
2218  }
2219 
2220  if (GetSelectedMesonID() < 2) {
2221  if (isPrimary) {
2222  fHistoTrueClusPrimPi0PtvsM02[fiCut]->Fill(TrueClusterCandidate->Pt(), m02, tempClusterWeight);
2223  if (fDoMesonQA > 1) fHistoTrueClusPrimPi0InvMassvsPt[fiCut]->Fill(mesoncand->M(),TrueClusterCandidate->Pt(), tempClusterWeight);
2224  if (fDoMesonQA > 0){
2225  if (clusterClass == 1 && TrueClusterCandidate->IsMerged())
2226  fHistoTruePrimaryPi0PureMergedMCPtResolPt[fiCut]->Fill(mother->Pt(),(TrueClusterCandidate->Pt()-mother->Pt())/mother->Pt(),tempClusterWeight);
2227  else if (clusterClass == 1 && TrueClusterCandidate->IsMergedPartConv())
2228  fHistoTruePrimaryPi0MergedPartConvMCPtResolPt[fiCut]->Fill(mother->Pt(),(TrueClusterCandidate->Pt()-mother->Pt())/mother->Pt(),tempClusterWeight);
2229  else if (clusterClass == 2)
2230  fHistoTruePrimaryPi01GammaMCPtResolPt[fiCut]->Fill(mother->Pt(),(TrueClusterCandidate->Pt()-mother->Pt())/mother->Pt(),tempClusterWeight);
2231  else if (clusterClass == 3)
2232  fHistoTruePrimaryPi01ElectronMCPtResolPt[fiCut]->Fill(mother->Pt(),(TrueClusterCandidate->Pt()-mother->Pt())/mother->Pt(),tempClusterWeight);
2233  }
2234  } else {
2235  fHistoTrueClusSecPi0PtvsM02[fiCut]->Fill(TrueClusterCandidate->Pt(), m02, tempClusterWeight);
2236  if (fDoMesonQA > 0){
2237  fHistoTrueSecondaryPi0MCPtResolPt[fiCut]->Fill(mother->Pt(),(TrueClusterCandidate->Pt()-mother->Pt())/mother->Pt(),tempClusterWeight);
2238  }
2239  Int_t grandMaLab = mother->GetMother();
2240  if (grandMaLab > -1){
2241  if (TMath::Abs(static_cast<AliAODMCParticle*>(AODMCTrackArray->At(grandMaLab))->GetPdgCode()) == 310){
2242  fHistoTrueClusSecPi0FromK0sPtvsM02[fiCut]->Fill(TrueClusterCandidate->Pt(), m02, tempClusterWeight);
2243  } else if (TMath::Abs(static_cast<AliAODMCParticle*>(AODMCTrackArray->At(grandMaLab))->GetPdgCode()) == 130){
2244  fHistoTrueClusSecPi0FromK0lPtvsM02[fiCut]->Fill(TrueClusterCandidate->Pt(), m02, tempClusterWeight);
2245  } else if (TMath::Abs(static_cast<AliAODMCParticle*>(AODMCTrackArray->At(grandMaLab))->GetPdgCode()) == 3122){
2246  fHistoTrueClusSecPi0FromLambdaPtvsM02[fiCut]->Fill(TrueClusterCandidate->Pt(), m02, tempClusterWeight);
2247  }
2248  }
2249  }
2250  }
2251  // deal with eta only
2252  } else if (motherPDG == 221){
2253  fHistoTrueClusEtaPtvsM02[fiCut]->Fill(TrueClusterCandidate->Pt(), m02, tempClusterWeight);
2254  if (TrueClusterCandidate->IsDalitz()){
2255  fHistoTrueClusEtaDalitzPtvsM02[fiCut]->Fill(TrueClusterCandidate->Pt(), m02, tempClusterWeight);
2256  }
2257  if (CheckVectorForDoubleCount(fVectorDoubleCountTrueEtas,motherLab)) fHistoDoubleCountTrueEtaPtvsM02[fiCut]->Fill(TrueClusterCandidate->Pt(), m02, tempClusterWeight);
2258  if (fDoMesonQA > 1)fHistoTrueClusEtaInvMassvsPt[fiCut]->Fill(mesoncand->M(),TrueClusterCandidate->Pt(), tempClusterWeight);
2259  if (fDoMesonQA > 0){
2260  fHistoTrueClusEtaEM02[fiCut]->Fill(TrueClusterCandidate->E(), m02, tempClusterWeight);
2261  }
2262  if ( fDoMesonQA > 0 && GetSelectedMesonID() != 1 ){
2263  fHistoTrueEtaPtY[fiCut]->Fill(TrueClusterCandidate->Pt(),mesoncand->Rapidity()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift(), tempClusterWeight);
2264  fHistoTrueEtaPtAlpha[fiCut]->Fill(TrueClusterCandidate->Pt(),TMath::Abs(mesoncand->GetAlpha()), tempClusterWeight);
2265  fHistoTruePrimaryEtaMCPtResolPt[fiCut]->Fill(mother->Pt(),(TrueClusterCandidate->Pt()-mother->Pt())/mother->Pt(),tempClusterWeight);
2266  }
2267  } else {
2268  fHistoTrueMergedMissedPDG[fiCut]->Fill(motherPDG, tempClusterWeight);
2269  }
2270 
2271  // leading particle is a photon or the conversion is fully contained and its not from pi0 || eta
2272  } else if (TrueClusterCandidate->IsLargestComponentPhoton() || TrueClusterCandidate->IsConversionFullyContained()){
2273  if (fEnableDetailedPrintOut) cout << "photon" << endl;
2274  fHistoTrueClusGammaPtvsM02[fiCut]->Fill(TrueClusterCandidate->Pt(), m02, tempClusterWeight);
2275  if (fDoMesonQA > 0){
2276  fHistoTrueClusGammaEM02[fiCut]->Fill(TrueClusterCandidate->E(), m02, tempClusterWeight);
2277  }
2278 
2279  if (fDoMesonQA > 1) fHistoTrueClusGammaInvMassvsPt[fiCut]->Fill(mesoncand->M(),TrueClusterCandidate->Pt(), tempClusterWeight);
2280  if (motherLab == -1){
2281  fHistoTrueClusGammaPtvsSource[fiCut]->Fill(TrueClusterCandidate->Pt(), 0.5, tempClusterWeight); // direct photon
2282  } else {
2283  if (motherPDG == 111)
2284  fHistoTrueClusGammaPtvsSource[fiCut]->Fill(TrueClusterCandidate->Pt(), 1.5, tempClusterWeight); // pi0
2285  else if (motherPDG == 221)
2286  fHistoTrueClusGammaPtvsSource[fiCut]->Fill(TrueClusterCandidate->Pt(), 2.5, tempClusterWeight); // eta
2287  else if (motherPDG == 331)
2288  fHistoTrueClusGammaPtvsSource[fiCut]->Fill(TrueClusterCandidate->Pt(), 3.5, tempClusterWeight); // eta'
2289  else if (motherPDG == 223)
2290  fHistoTrueClusGammaPtvsSource[fiCut]->Fill(TrueClusterCandidate->Pt(), 4.5, tempClusterWeight); // omega
2291  else if (motherPDG == 333)
2292  fHistoTrueClusGammaPtvsSource[fiCut]->Fill(TrueClusterCandidate->Pt(), 5.5, tempClusterWeight); // phi
2293  else if (motherPDG == 3122)
2294  fHistoTrueClusGammaPtvsSource[fiCut]->Fill(TrueClusterCandidate->Pt(), 6.5, tempClusterWeight); // Lambda
2295  else
2296  fHistoTrueClusGammaPtvsSource[fiCut]->Fill(TrueClusterCandidate->Pt(), 7.5, tempClusterWeight); // rest
2297  }
2298 
2299  // leading particle is an electron and its not from pi0 || eta
2300  } else if (TrueClusterCandidate->IsLargestComponentElectron()){
2301  if (fEnableDetailedPrintOut) cout << "electron" << endl;
2302  fHistoTrueClusElectronPtvsM02[fiCut]->Fill(TrueClusterCandidate->Pt(), m02, tempClusterWeight);
2303  if (fDoMesonQA > 0){
2304  fHistoTrueClusElectronEM02[fiCut]->Fill(TrueClusterCandidate->E(), m02, tempClusterWeight);
2305  }
2306 
2307  if (fDoMesonQA > 1) fHistoTrueClusElectronInvMassvsPt[fiCut]->Fill(mesoncand->M(),TrueClusterCandidate->Pt(), tempClusterWeight);
2308  Int_t motherLab = Photon->GetMother();
2309  if (motherLab == -1){
2310  fHistoTrueClusElectronPtvsSource[fiCut]->Fill(TrueClusterCandidate->Pt(), 0.5, tempClusterWeight); // direct electron
2311  } else {
2312  if (motherPDG == 22){
2313  fHistoTrueClusElectronPtvsSource[fiCut]->Fill(TrueClusterCandidate->Pt(), 1.5, tempClusterWeight); // gamma
2314  fHistoTrueClusElectronFromGammaPtvsM02[fiCut]->Fill(TrueClusterCandidate->Pt(), m02, tempClusterWeight);
2315  } else if (motherPDG == 111){
2316  fHistoTrueClusElectronPtvsSource[fiCut]->Fill(TrueClusterCandidate->Pt(), 2.5, tempClusterWeight); // pi0
2317  } else if (motherPDG == 221){
2318  fHistoTrueClusElectronPtvsSource[fiCut]->Fill(TrueClusterCandidate->Pt(), 3.5, tempClusterWeight); // eta
2319  } else if ( int(motherPDG/100.)==5 || int(motherPDG/1000.)==5 ){
2320  fHistoTrueClusElectronPtvsSource[fiCut]->Fill(TrueClusterCandidate->Pt(), 5.5, tempClusterWeight); // b
2321  } else if ( int(motherPDG/100.)==4 || int(motherPDG/1000.)==4 ){
2322  fHistoTrueClusElectronPtvsSource[fiCut]->Fill(TrueClusterCandidate->Pt(), 4.5, tempClusterWeight); // c
2323  } else if (motherPDG == 23 || motherPDG == 24){
2324  fHistoTrueClusElectronPtvsSource[fiCut]->Fill(TrueClusterCandidate->Pt(), 6.5, tempClusterWeight); // W/Z
2325  } else if (motherPDG == 15) {
2326  fHistoTrueClusElectronPtvsSource[fiCut]->Fill(TrueClusterCandidate->Pt(), 7.5, tempClusterWeight); // tau
2327  } else {
2328  fHistoTrueClusElectronPtvsSource[fiCut]->Fill(TrueClusterCandidate->Pt(), 8.5, tempClusterWeight); // rest
2329  }
2330  }
2331  // leading particle is a hadron
2332  } else {
2333  if (fEnableDetailedPrintOut) cout << "BG" << endl;
2334  fHistoTrueClusBGPtvsM02[fiCut]->Fill(TrueClusterCandidate->Pt(), m02, tempClusterWeight);
2335  if (fDoMesonQA > 1) fHistoTrueClusBGInvMassvsPt[fiCut]->Fill(mesoncand->M(),TrueClusterCandidate->Pt(), tempClusterWeight);
2336 
2337  Double_t maxM02 = 4.8;
2338  if (m02 >= 0 && m02 < maxM02){
2339  if (TMath::Abs(pdgCodeParticle) == 211) fHistoTrueClusBGPtvsSource[fiCut]->Fill(TrueClusterCandidate->Pt(), 0.5, tempClusterWeight); // pi+/-
2340  else if (TMath::Abs(pdgCodeParticle) == 2212) fHistoTrueClusBGPtvsSource[fiCut]->Fill(TrueClusterCandidate->Pt(), 1.5, tempClusterWeight); // p
2341  else if (TMath::Abs(pdgCodeParticle) == 321) fHistoTrueClusBGPtvsSource[fiCut]->Fill(TrueClusterCandidate->Pt(), 2.5, tempClusterWeight); // K+-
2342  else if (TMath::Abs(pdgCodeParticle) == 2112) fHistoTrueClusBGPtvsSource[fiCut]->Fill(TrueClusterCandidate->Pt(), 3.5, tempClusterWeight); // n
2343  else if (TMath::Abs(pdgCodeParticle) == 310) fHistoTrueClusBGPtvsSource[fiCut]->Fill(TrueClusterCandidate->Pt(), 4.5, tempClusterWeight); // K0s
2344  else if (TMath::Abs(pdgCodeParticle) == 3122) fHistoTrueClusBGPtvsSource[fiCut]->Fill(TrueClusterCandidate->Pt(), 5.5, tempClusterWeight); // Lambda
2345  else if (TMath::Abs(pdgCodeParticle) == 13) fHistoTrueClusBGPtvsSource[fiCut]->Fill(TrueClusterCandidate->Pt(), 6.5, tempClusterWeight); // mu+/-
2346  else if (TMath::Abs(pdgCodeParticle) == 130) fHistoTrueClusBGPtvsSource[fiCut]->Fill(TrueClusterCandidate->Pt(), 7.5, tempClusterWeight); // K0l
2347  else fHistoTrueClusBGPtvsSource[fiCut]->Fill(TrueClusterCandidate->Pt(), 8.5, tempClusterWeight); // Rest
2348  }
2349  }
2350  }
2351  delete mesoncand;
2352  return;
2353 }
2354 
2355 
2356 //________________________________________________________________________
2358 {
2359  const AliVVertex* primVtxMC = fMCEvent->GetPrimaryVertex();
2360  Double_t mcProdVtxX = primVtxMC->GetX();
2361  Double_t mcProdVtxY = primVtxMC->GetY();
2362  Double_t mcProdVtxZ = primVtxMC->GetZ();
2363 
2364  // Loop over all primary MC particle
2365  for(Long_t i = 0; i < fMCEvent->GetNumberOfTracks(); i++) {
2366  Double_t tempParticleWeight = fWeightJetJetMC;
2367  if (((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryESD( fMCEvent, i, mcProdVtxX, mcProdVtxY, mcProdVtxZ)){
2368 
2369  TParticle* particle = (TParticle *)fMCEvent->Particle(i);
2370  if (!particle) continue;
2371 
2372  Int_t isMCFromMBHeader = -1;
2373  if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 0){
2374  isMCFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCEvent, fInputEvent);
2375  if(isMCFromMBHeader == 0 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 3) continue;
2376  // Set the jetjet weight to 1 in case the particle orignated from the minimum bias header
2377  if(isMCFromMBHeader == 2 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() == 4) tempParticleWeight = 1;
2378  }
2379 
2380  Double_t mesonY = 1.e30;
2381  Double_t ratio = 0;
2382  if (particle->Energy() != TMath::Abs(particle->Pz())){
2383  ratio = (particle->Energy()+particle->Pz()) / (particle->Energy()-particle->Pz());
2384  }
2385  if( !(ratio <= 0) ){
2386  mesonY = particle->Y()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
2387  }
2388 
2389  // fill Primary Y hist
2390  if ( particle->GetPdgCode() == 211 ){ // positve pions
2391  fHistoMCPrimaryYvsSource[fiCut]->Fill(mesonY, 0., tempParticleWeight);
2392  } else if ( particle->GetPdgCode() == -211 ){ // negative pions
2393  fHistoMCPrimaryYvsSource[fiCut]->Fill(mesonY, 1., tempParticleWeight);
2394  } else if ( particle->GetPdgCode() == 321 ){ // positve kaons
2395  fHistoMCPrimaryYvsSource[fiCut]->Fill(mesonY, 2., tempParticleWeight);
2396  } else if ( particle->GetPdgCode() == -321 ){ // negative kaons
2397  fHistoMCPrimaryYvsSource[fiCut]->Fill(mesonY, 3., tempParticleWeight);
2398  } else if ( TMath::Abs(particle->GetPdgCode()) == 310 ){ // K0s
2399  fHistoMCPrimaryYvsSource[fiCut]->Fill(mesonY, 4., tempParticleWeight);
2400  } else if ( TMath::Abs(particle->GetPdgCode()) == 130 ){ // K0l
2401  fHistoMCPrimaryYvsSource[fiCut]->Fill(mesonY, 5., tempParticleWeight);
2402  } else if ( TMath::Abs(particle->GetPdgCode()) == 3122 ){ // Lambda/ AntiLambda
2403  fHistoMCPrimaryYvsSource[fiCut]->Fill(mesonY, 6., tempParticleWeight);
2404  }
2405 
2406  if (TMath::Abs(mesonY) < ((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->GetRapidityCutValue()){
2407  if ( particle->GetPdgCode() == 211 ){ // positve pions
2408  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 0., tempParticleWeight);
2409  } else if ( particle->GetPdgCode() == -211 ){ // negative pions
2410  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 1., tempParticleWeight);
2411  } else if ( particle->GetPdgCode() == 321 ){ // positve kaons
2412  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 2., tempParticleWeight);
2413  } else if ( particle->GetPdgCode() == -321 ){ // negative kaons
2414  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 3., tempParticleWeight);
2415  } else if ( TMath::Abs(particle->GetPdgCode()) == 310 ){ // K0s
2416  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 4., tempParticleWeight);
2417  } else if ( TMath::Abs(particle->GetPdgCode()) == 130 ){ // K0l
2418  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 5., tempParticleWeight);
2419  } else if ( TMath::Abs(particle->GetPdgCode()) == 3122 ){ // Lambda/ AntiLambda
2420  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 6., tempParticleWeight);
2421  } else if ( particle->GetPdgCode() == 22 ){ // photons
2422  fHistoMCAllGammaPt[fiCut]->Fill(particle->Pt(), tempParticleWeight); // direct photons
2423  if(particle->GetMother(0) > -1){
2424  TParticle* mother = (TParticle*)fMCEvent->Particle(particle->GetMother(0));
2425  if ( TMath::Abs(mother->GetPdgCode()) == 111 ||
2426  TMath::Abs(mother->GetPdgCode()) == 113 ||
2427  TMath::Abs(mother->GetPdgCode()) == 221 ||
2428  TMath::Abs(mother->GetPdgCode()) == 223 ||
2429  TMath::Abs(mother->GetPdgCode()) == 331 ||
2430  TMath::Abs(mother->GetPdgCode()) == 333 ||
2431  TMath::Abs(mother->GetPdgCode()) == 3212 ||
2432  TMath::Abs(mother->GetPdgCode()) == 213
2433  ){
2434  fHistoMCDecayGammaPt[fiCut]->Fill(particle->Pt(), tempParticleWeight); // decay photons
2435  }
2436  }
2437  }
2438  }
2439 
2440  // check if particle is pi0/eta from di-photon decay
2442  ->MesonIsSelectedMC(particle,fMCEvent,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift())){
2443  TParticle* daughter0 = (TParticle*)fMCEvent->Particle(particle->GetFirstDaughter());
2444  TParticle* daughter1 = (TParticle*)fMCEvent->Particle(particle->GetLastDaughter());
2445 
2446  Float_t weighted= 1;
2447  if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCEvent, fInputEvent)){
2448  if (particle->Pt()>0.005){
2449  weighted= ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetWeightForMeson(i, fMCEvent, fInputEvent);
2450  }
2451  }
2452 
2453  if( TMath::Abs(particle->GetPdgCode()) == 111 ){ // neutral pions
2454  fHistoMCPi0Pt[fiCut]->Fill(particle->Pt(),weighted* tempParticleWeight); // All MC Pi0
2455  if (GetSelectedMesonID() != 2){
2456  fHistoMCPi0WOWeightPt[fiCut]->Fill(particle->Pt(), tempParticleWeight);
2457  if (fIsMC==2)fHistoMCPi0WOEvtWeightPt[fiCut]->Fill(particle->Pt());
2458  if (fDoMesonQA > 0 ){
2459  if (fIsMC == 2) fHistoMCPi0PtJetPt[fiCut]->Fill(particle->Pt(),((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetMaxPtJet(),tempParticleWeight);
2460  }
2461  }
2462  } else if( TMath::Abs(particle->GetPdgCode()) == 221 ){ // eta mesons
2463  fHistoMCEtaPt[fiCut]->Fill(particle->Pt(),weighted* tempParticleWeight); // All MC Eta
2464  if (GetSelectedMesonID() != 1){
2465  fHistoMCEtaWOWeightPt[fiCut]->Fill(particle->Pt(), tempParticleWeight);
2466  if (fIsMC==2)fHistoMCEtaWOEvtWeightPt[fiCut]->Fill(particle->Pt());
2467  if (fDoMesonQA > 0 ){
2468  if (fIsMC == 2) fHistoMCEtaPtJetPt[fiCut]->Fill(particle->Pt(),((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetMaxPtJet(),tempParticleWeight);
2469  }
2470  }
2471  }
2472  // Check the acceptance for both gammas & whether they are counted as primaries as well
2473  Bool_t kDaughter0IsPrim = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryESD( fMCEvent, particle->GetFirstDaughter(), mcProdVtxX, mcProdVtxY, mcProdVtxZ);
2474  Bool_t kDaughter1IsPrim = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryESD( fMCEvent, particle->GetLastDaughter(), mcProdVtxX, mcProdVtxY, mcProdVtxZ);
2475 
2476  if( kDaughter0IsPrim && kDaughter1IsPrim &&
2477  (((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedMC(daughter0,fMCEvent) ||
2478  ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedMC(daughter1,fMCEvent) ) ){
2479  if(particle->GetPdgCode() == 111 && GetSelectedMesonID() != 2){
2480  fHistoMCPi0InAccPt[fiCut]->Fill(particle->Pt(),weighted* tempParticleWeight); // MC Pi0 with gamma in acc
2481  if (fIsMC == 2)fHistoMCPi0WOEvtWeightInAccPt[fiCut]->Fill(particle->Pt()); // MC Pi0 w/o event weights with gamma in acc
2482  } else if(particle->GetPdgCode() == 221 && GetSelectedMesonID() != 1){
2483  fHistoMCEtaInAccPt[fiCut]->Fill(particle->Pt(),weighted* tempParticleWeight); // MC Eta with gamma in acc
2484  if (fIsMC == 2)fHistoMCEtaWOEvtWeightInAccPt[fiCut]->Fill(particle->Pt()); // MC Eta w/o event weights with gamma in acc
2485  }
2486  }
2487  }
2488  Int_t gammaLabel = -1;
2489  Int_t electronLabel = -1;
2490  Int_t positronLabel = -1;
2491  // check if particle is pi0/eta from Dalitz decay
2493  ->MesonIsSelectedMCDalitz(particle,fMCEvent, electronLabel, positronLabel, gammaLabel, ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift())){
2494  if( (gammaLabel > -1) && (electronLabel > -1) && (positronLabel > -1) ){
2495  TParticle* gamma = (TParticle*)fMCEvent->Particle(gammaLabel);
2496  TParticle* electron = (TParticle*)fMCEvent->Particle(electronLabel);
2497  TParticle* positron = (TParticle*)fMCEvent->Particle(positronLabel);
2498 
2499  Float_t weighted= 1;
2500  if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCEvent, fInputEvent)){
2501  if (particle->Pt()>0.005){
2502  weighted= ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetWeightForMeson(i, fMCEvent, fInputEvent);
2503  }
2504  }
2505 
2506  if(particle->GetPdgCode() == 111 && GetSelectedMesonID() != 2){
2507  fHistoMCPi0DalitzPt[fiCut]->Fill(particle->Pt(),weighted* tempParticleWeight); // All MC Pi0
2508  fHistoMCPi0DalitzWOWeightPt[fiCut]->Fill(particle->Pt(), tempParticleWeight);
2509  if (fIsMC==2)fHistoMCPi0DalitzWOEvtWeightPt[fiCut]->Fill(particle->Pt());
2510  if (fDoMesonQA > 0 ){
2511  if (fIsMC == 2) fHistoMCPi0PtJetPt[fiCut]->Fill(particle->Pt(),((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetMaxPtJet(),tempParticleWeight);
2512  }
2513  } else if(particle->GetPdgCode() == 221 && GetSelectedMesonID() != 1){
2514  fHistoMCEtaDalitzPt[fiCut]->Fill(particle->Pt(),weighted* tempParticleWeight); // All MC Eta
2515  fHistoMCEtaDalitzWOWeightPt[fiCut]->Fill(particle->Pt(), tempParticleWeight);
2516  if (fIsMC==2)fHistoMCEtaDalitzWOEvtWeightPt[fiCut]->Fill(particle->Pt());
2517  if (fDoMesonQA > 0 ){
2518  if (fIsMC == 2) fHistoMCEtaPtJetPt[fiCut]->Fill(particle->Pt(),((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetMaxPtJet(),tempParticleWeight);
2519  }
2520  }
2521 
2522  // Check the acceptance for both gammas & whether they are counted as primaries as well
2523  Bool_t kGammaIsPrim = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryESD( fMCEvent, gammaLabel, mcProdVtxX, mcProdVtxY, mcProdVtxZ);
2524  Bool_t kElectronIsPrim = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryESD( fMCEvent, electronLabel, mcProdVtxX, mcProdVtxY, mcProdVtxZ);
2525  Bool_t kPositronIsPrim = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryESD( fMCEvent, positronLabel, mcProdVtxX, mcProdVtxY, mcProdVtxZ);
2526  if( kGammaIsPrim && kElectronIsPrim && kPositronIsPrim &&
2527  (((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedMC(gamma,fMCEvent) ||
2528  ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedElecMC(electron,fMCEvent) ||
2529  ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedElecMC(positron,fMCEvent) )
2530  ){
2531  if(particle->GetPdgCode() == 111 && GetSelectedMesonID() != 2){
2532  fHistoMCPi0DalitzInAccPt[fiCut]->Fill(particle->Pt(),weighted* tempParticleWeight); // MC Pi0 with gamma in acc
2533  if (fIsMC == 2) fHistoMCPi0DalitzWOEvtWeightInAccPt[fiCut]->Fill(particle->Pt(),weighted* tempParticleWeight); // MC Pi0 with gamma in acc
2534  } else if(particle->GetPdgCode() == 221 && GetSelectedMesonID() != 1){
2535  fHistoMCEtaDalitzInAccPt[fiCut]->Fill(particle->Pt(),weighted* tempParticleWeight); // MC Eta with gamma in acc
2536  if (fIsMC == 2) fHistoMCEtaDalitzWOEvtWeightInAccPt[fiCut]->Fill(particle->Pt(),weighted* tempParticleWeight); // MC Pi0 with gamma in acc
2537  }
2538  }
2539  }
2540  }
2541  // End of primary threatment, now secondary treatment
2542  } else {
2543 
2544  TParticle* particle = (TParticle *)fMCEvent->Particle(i);
2545  if (!particle) continue;
2546 
2547  Int_t isMCFromMBHeader = -1;
2548  if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 0){
2549  isMCFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCEvent, fInputEvent);
2550  if(isMCFromMBHeader == 0 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 3) continue;
2551  // Set the jetjet weight to 1 in case the particle orignated from the minimum bias header
2552  if(isMCFromMBHeader == 2 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() == 4) tempParticleWeight = 1;
2553  }
2554 
2555  // check if particle is pi0 from di-photon decay
2557  ->MesonIsSelectedMC(particle,fMCEvent,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift())){
2558  TParticle* daughter0 = (TParticle*)fMCEvent->Particle(particle->GetFirstDaughter());
2559  TParticle* daughter1 = (TParticle*)fMCEvent->Particle(particle->GetLastDaughter());
2560  TParticle* mother = NULL;
2561  Int_t motherPDG = -1000000;
2562  if (particle->GetMother(0) > -1){
2563  mother = (TParticle*)fMCEvent->Particle(particle->GetMother(0));
2564  if (mother)
2565  motherPDG = TMath::Abs(mother->GetPdgCode());
2566  }
2567 
2568  if( TMath::Abs(particle->GetPdgCode()) == 111 ){ // neutral pions
2569  Int_t source = GetSourceClassification(111,motherPDG);
2570  fHistoMCSecPi0PtvsSource[fiCut]->Fill(particle->Pt(),source, tempParticleWeight); // All secondary MC Pi0
2571  }
2572 
2573  // check whether pi0 landet in acceptance
2574  if( (((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedMC(daughter0,fMCEvent) ||
2575  ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedMC(daughter1,fMCEvent) ) ){
2576  if( TMath::Abs(particle->GetPdgCode()) == 111 ){ // neutral pions
2577  Int_t source = GetSourceClassification(111,motherPDG);
2578  fHistoMCSecPi0InAccPtvsSource[fiCut]->Fill(particle->Pt(),source, tempParticleWeight); // All secondary MC Pi0
2579  }
2580  }
2581  }
2582 
2583  Int_t gammaLabel = -1;
2584  Int_t electronLabel = -1;
2585  Int_t positronLabel = -1;
2586  // check if particle is pi0/eta from Dalitz decay
2588  ->MesonIsSelectedMCDalitz(particle,fMCEvent, electronLabel, positronLabel, gammaLabel, ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift())){
2589  if( (gammaLabel > -1) && (electronLabel > -1) && (positronLabel > -1) ){
2590  TParticle* gamma = (TParticle*)fMCEvent->Particle(gammaLabel);
2591  TParticle* electron = (TParticle*)fMCEvent->Particle(electronLabel);
2592  TParticle* positron = (TParticle*)fMCEvent->Particle(positronLabel);
2593 
2594  TParticle* mother = NULL;
2595  Int_t motherPDG = -1000000;
2596  if (particle->GetMother(0) > -1){
2597  mother = (TParticle*)fMCEvent->Particle(particle->GetMother(0));
2598  if (mother)
2599  motherPDG = TMath::Abs(mother->GetPdgCode());
2600  }
2601 
2602  if( TMath::Abs(particle->GetPdgCode()) == 111 ){ // neutral pions
2603  Int_t source = GetSourceClassification(111,motherPDG);
2604  fHistoMCSecPi0PtvsSource[fiCut]->Fill(particle->Pt(),source, tempParticleWeight); // All secondary MC Pi0
2605  }
2606 
2607  // check whether pi0 landet in acceptance
2608  if( (((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedMC(gamma,fMCEvent) ||
2609  ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedElecMC(electron,fMCEvent) ||
2610  ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedElecMC(positron,fMCEvent) ) ){
2611  if( TMath::Abs(particle->GetPdgCode()) == 111 ){ // neutral pions
2612  Int_t source = GetSourceClassification(111,motherPDG);
2613  fHistoMCSecPi0InAccPtvsSource[fiCut]->Fill(particle->Pt(),source, tempParticleWeight); // All secondary MC Pi0
2614  }
2615  }
2616  }
2617  }
2618  }
2619  } // end of particle loop
2620 }
2621 
2622 //________________________________________________________________________
2624 {
2625  const AliVVertex* primVtxMC = fMCEvent->GetPrimaryVertex();
2626  Double_t mcProdVtxX = primVtxMC->GetX();
2627  Double_t mcProdVtxY = primVtxMC->GetY();
2628  Double_t mcProdVtxZ = primVtxMC->GetZ();
2629 
2630  TClonesArray *AODMCTrackArray = dynamic_cast<TClonesArray*>(fInputEvent->FindListObject(AliAODMCParticle::StdBranchName()));
2631  if (AODMCTrackArray == NULL) return;
2632 
2633  // Loop over all primary MC particle
2634  for(Long_t i = 0; i < AODMCTrackArray->GetEntriesFast(); i++) {
2635  Double_t tempParticleWeight = fWeightJetJetMC;
2636  AliAODMCParticle* particle = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(i));
2637  if (!particle) continue;
2638 
2639  Bool_t isPrimary = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryAOD(fInputEvent, particle, mcProdVtxX, mcProdVtxY, mcProdVtxZ);
2640  if (isPrimary) {
2641 
2642  Int_t isMCFromMBHeader = -1;
2643  if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 0){
2644  isMCFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCEvent, fInputEvent);
2645  if(isMCFromMBHeader == 0 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 3) continue;
2646  // Set the jetjet weight to 1 in case the particle orignated from the minimum bias header
2647  if(isMCFromMBHeader == 2 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() == 4) tempParticleWeight = 1;
2648  }
2649 
2650  Double_t mesonY = 1.e30;
2651  Double_t ratio = 0;
2652  if (particle->E() != TMath::Abs(particle->Pz())){
2653  ratio = (particle->E()+particle->Pz()) / (particle->E()-particle->Pz());
2654  }
2655  if( !(ratio <= 0) ){
2656  mesonY = particle->Y()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
2657  }
2658 
2659  // fill Primary Y hist
2660  if ( particle->GetPdgCode() == 211 ){ // positve pions
2661  fHistoMCPrimaryYvsSource[fiCut]->Fill(mesonY, 0., tempParticleWeight);
2662  } else if ( particle->GetPdgCode() == -211 ){ // negative pions
2663  fHistoMCPrimaryYvsSource[fiCut]->Fill(mesonY, 1., tempParticleWeight);
2664  } else if ( particle->GetPdgCode() == 321 ){ // positve kaons
2665  fHistoMCPrimaryYvsSource[fiCut]->Fill(mesonY, 2., tempParticleWeight);
2666  } else if ( particle->GetPdgCode() == -321 ){ // negative kaons
2667  fHistoMCPrimaryYvsSource[fiCut]->Fill(mesonY, 3., tempParticleWeight);
2668  } else if ( TMath::Abs(particle->GetPdgCode()) == 310 ){ // K0s
2669  fHistoMCPrimaryYvsSource[fiCut]->Fill(mesonY, 4., tempParticleWeight);
2670  } else if ( TMath::Abs(particle->GetPdgCode()) == 130 ){ // K0l
2671  fHistoMCPrimaryYvsSource[fiCut]->Fill(mesonY, 5., tempParticleWeight);
2672  } else if ( TMath::Abs(particle->GetPdgCode()) == 3122 ){ // Lambda/ AntiLambda
2673  fHistoMCPrimaryYvsSource[fiCut]->Fill(mesonY, 6., tempParticleWeight);
2674  }
2675 
2676  if (TMath::Abs(mesonY) < ((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->GetRapidityCutValue()){
2677  if ( particle->GetPdgCode() == 211 ){ // positve pions
2678  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 0., tempParticleWeight);
2679  } else if ( particle->GetPdgCode() == -211 ){ // negative pions
2680  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 1., tempParticleWeight);
2681  } else if ( particle->GetPdgCode() == 321 ){ // positve kaons
2682  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 2., tempParticleWeight);
2683  } else if ( particle->GetPdgCode() == -321 ){ // negative kaons
2684  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 3., tempParticleWeight);
2685  } else if ( TMath::Abs(particle->GetPdgCode()) == 310 ){ // K0s
2686  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 4., tempParticleWeight);
2687  } else if ( TMath::Abs(particle->GetPdgCode()) == 130 ){ // K0l
2688  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 5., tempParticleWeight);
2689  } else if ( TMath::Abs(particle->GetPdgCode()) == 3122 ){ // Lambda/ AntiLambda
2690  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 6., tempParticleWeight);
2691  } else if ( particle->GetPdgCode() == 22 ){ // photons
2692  fHistoMCAllGammaPt[fiCut]->Fill(particle->Pt(), tempParticleWeight); // direct photons
2693  if(particle->GetMother() > -1){
2694  AliAODMCParticle *mother = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(particle->GetMother()));
2695  if ( TMath::Abs(mother->GetPdgCode()) == 111 ||
2696  TMath::Abs(mother->GetPdgCode()) == 113 ||
2697  TMath::Abs(mother->GetPdgCode()) == 221 ||
2698  TMath::Abs(mother->GetPdgCode()) == 223 ||
2699  TMath::Abs(mother->GetPdgCode()) == 331 ||
2700  TMath::Abs(mother->GetPdgCode()) == 333 ||
2701  TMath::Abs(mother->GetPdgCode()) == 3212 ||
2702  TMath::Abs(mother->GetPdgCode()) == 213
2703  ){
2704  fHistoMCDecayGammaPt[fiCut]->Fill(particle->Pt(), tempParticleWeight); // decay photons
2705  }
2706  }
2707  }
2708  }
2709 
2710  // check if particle is pi0/eta from di-photon decay
2712  ->MesonIsSelectedAODMC(particle,AODMCTrackArray,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift())){
2713  AliAODMCParticle* daughter0 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(particle->GetDaughter(0)));
2714  AliAODMCParticle* daughter1 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(particle->GetDaughter(1)));
2715 
2716  Float_t weighted= 1;
2717  if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCEvent, fInputEvent)){
2718  if (particle->Pt()>0.005){
2719  weighted= ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetWeightForMeson(i, 0x0, fInputEvent);
2720  }
2721  }
2722 
2723  if( TMath::Abs(particle->GetPdgCode()) == 111 ){ // neutral pions
2724  fHistoMCPi0Pt[fiCut]->Fill(particle->Pt(),weighted* tempParticleWeight); // All MC Pi0
2725  if (GetSelectedMesonID() != 2){
2726  fHistoMCPi0WOWeightPt[fiCut]->Fill(particle->Pt(), tempParticleWeight);
2727  if (fIsMC==2)fHistoMCPi0WOEvtWeightPt[fiCut]->Fill(particle->Pt());
2728  if (fDoMesonQA > 0 ){
2729  if (fIsMC == 2) fHistoMCPi0PtJetPt[fiCut]->Fill(particle->Pt(),((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetMaxPtJet(),tempParticleWeight);
2730  }
2731  }
2732  } else if( TMath::Abs(particle->GetPdgCode()) == 221 ){ // eta mesons
2733  fHistoMCEtaPt[fiCut]->Fill(particle->Pt(),weighted* tempParticleWeight); // All MC Eta
2734  if (GetSelectedMesonID() != 1){
2735  fHistoMCEtaWOWeightPt[fiCut]->Fill(particle->Pt(), tempParticleWeight);
2736  if (fIsMC==2)fHistoMCEtaWOEvtWeightPt[fiCut]->Fill(particle->Pt());
2737  if (fDoMesonQA > 0 ){
2738  if (fIsMC == 2) fHistoMCEtaPtJetPt[fiCut]->Fill(particle->Pt(),((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetMaxPtJet(),tempParticleWeight);
2739  }
2740  }
2741  }
2742  // Check the acceptance for both gammas & whether they are counted as primaries as well
2743  Bool_t kDaughter0IsPrim = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryAOD( fInputEvent, daughter0, mcProdVtxX, mcProdVtxY, mcProdVtxZ);
2744  Bool_t kDaughter1IsPrim = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryAOD( fInputEvent, daughter1, mcProdVtxX, mcProdVtxY, mcProdVtxZ);
2745 
2746  if( kDaughter0IsPrim && kDaughter1IsPrim &&
2747  (((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedAODMC(daughter0,AODMCTrackArray) ||
2748  ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedAODMC(daughter1,AODMCTrackArray) ) ){
2749  if(particle->GetPdgCode() == 111 && GetSelectedMesonID() != 2){
2750  fHistoMCPi0InAccPt[fiCut]->Fill(particle->Pt(),weighted* tempParticleWeight); // MC Pi0 with gamma in acc
2751  if (fIsMC == 2)fHistoMCPi0WOEvtWeightInAccPt[fiCut]->Fill(particle->Pt()); // MC Pi0 w/o event weights with gamma in acc
2752  } else if(particle->GetPdgCode() == 221 && GetSelectedMesonID() != 1){
2753  fHistoMCEtaInAccPt[fiCut]->Fill(particle->Pt(),weighted* tempParticleWeight); // MC Eta with gamma in acc
2754  if (fIsMC == 2)fHistoMCEtaWOEvtWeightInAccPt[fiCut]->Fill(particle->Pt()); // MC Eta w/o event weights with gamma in acc
2755  }
2756  }
2757  }
2758  Int_t gammaLabel = -1;
2759  Int_t electronLabel = -1;
2760  Int_t positronLabel = -1;
2761  // check if particle is pi0/eta from Dalitz decay
2763  ->MesonIsSelectedAODMCDalitz(particle,AODMCTrackArray, electronLabel, positronLabel, gammaLabel, ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift())){
2764  if( (gammaLabel > -1) && (electronLabel > -1) && (positronLabel > -1) ){
2765  AliAODMCParticle* gamma = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gammaLabel));
2766  AliAODMCParticle* electron = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(electronLabel));
2767  AliAODMCParticle* positron = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(positronLabel));
2768 
2769  Float_t weighted= 1;
2770  if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCEvent, fInputEvent)){
2771  if (particle->Pt()>0.005){
2772  weighted= ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetWeightForMeson(i, fMCEvent, fInputEvent);
2773  }
2774  }
2775 
2776  if(particle->GetPdgCode() == 111 && GetSelectedMesonID() != 2){
2777  fHistoMCPi0DalitzPt[fiCut]->Fill(particle->Pt(),weighted* tempParticleWeight); // All MC Pi0
2778  fHistoMCPi0DalitzWOWeightPt[fiCut]->Fill(particle->Pt(), tempParticleWeight);
2779  if (fIsMC==2)fHistoMCPi0DalitzWOEvtWeightPt[fiCut]->Fill(particle->Pt());
2780  if (fDoMesonQA > 0 ){
2781  if (fIsMC == 2) fHistoMCPi0PtJetPt[fiCut]->Fill(particle->Pt(),((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetMaxPtJet(),tempParticleWeight);
2782  }
2783  } else if(particle->GetPdgCode() == 221 && GetSelectedMesonID() != 1){
2784  fHistoMCEtaDalitzPt[fiCut]->Fill(particle->Pt(),weighted* tempParticleWeight); // All MC Eta
2785  fHistoMCEtaDalitzWOWeightPt[fiCut]->Fill(particle->Pt(), tempParticleWeight);
2786  if (fIsMC==2)fHistoMCEtaDalitzWOEvtWeightPt[fiCut]->Fill(particle->Pt());
2787  if (fDoMesonQA > 0 ){
2788  if (fIsMC == 2) fHistoMCEtaPtJetPt[fiCut]->Fill(particle->Pt(),((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetMaxPtJet(),tempParticleWeight);
2789  }
2790  }
2791 
2792  // Check the acceptance for both gammas & whether they are counted as primaries as well
2793  Bool_t kGammaIsPrim = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryAOD( fInputEvent, gamma, mcProdVtxX, mcProdVtxY, mcProdVtxZ);
2794  Bool_t kElectronIsPrim = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryAOD( fInputEvent, electron, mcProdVtxX, mcProdVtxY, mcProdVtxZ);
2795  Bool_t kPositronIsPrim = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryAOD( fInputEvent, positron, mcProdVtxX, mcProdVtxY, mcProdVtxZ);
2796  if( kGammaIsPrim && kElectronIsPrim && kPositronIsPrim &&
2797  (((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedAODMC(gamma,AODMCTrackArray) ||
2798  ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedElecAODMC(electron,AODMCTrackArray) ||
2799  ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedElecAODMC(positron,AODMCTrackArray) )
2800  ){
2801  if(particle->GetPdgCode() == 111 && GetSelectedMesonID() != 2){
2802  fHistoMCPi0DalitzInAccPt[fiCut]->Fill(particle->Pt(),weighted* tempParticleWeight); // MC Pi0 with gamma in acc
2803  if (fIsMC == 2) fHistoMCPi0DalitzWOEvtWeightInAccPt[fiCut]->Fill(particle->Pt(),weighted* tempParticleWeight); // MC Pi0 with gamma in acc
2804  } else if(particle->GetPdgCode() == 221 && GetSelectedMesonID() != 1){
2805  fHistoMCEtaDalitzInAccPt[fiCut]->Fill(particle->Pt(),weighted* tempParticleWeight); // MC Eta with gamma in acc
2806  if (fIsMC == 2) fHistoMCEtaDalitzWOEvtWeightInAccPt[fiCut]->Fill(particle->Pt(),weighted* tempParticleWeight); // MC Pi0 with gamma in acc
2807  }
2808  }
2809  }
2810  }
2811  // End of primary threatment, now secondary treatment
2812  } else {
2813 
2814  AliAODMCParticle* particle = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(i));
2815  if (!particle) continue;
2816 
2817  Int_t isMCFromMBHeader = -1;
2818  if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 0){
2819  isMCFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCEvent, fInputEvent);
2820  if(isMCFromMBHeader == 0 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 3) continue;
2821  if(isMCFromMBHeader == 2 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() == 4) tempParticleWeight = 1;
2822  }
2823 
2824  // check if particle is pi0 from di-photon decay
2826  ->MesonIsSelectedAODMC(particle,AODMCTrackArray,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift())){
2827  AliAODMCParticle* daughter0 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(particle->GetDaughter(0)));
2828  AliAODMCParticle* daughter1 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(particle->GetDaughter(1)));
2829  AliAODMCParticle* mother = NULL;
2830  Int_t motherPDG = -1000000;
2831  if (particle->GetMother() > -1){
2832  mother = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(particle->GetMother()));
2833  if (mother)
2834  motherPDG = TMath::Abs(mother->GetPdgCode());
2835  }
2836 
2837  if( TMath::Abs(particle->GetPdgCode()) == 111 ){ // neutral pions
2838  Int_t source = GetSourceClassification(111,motherPDG);
2839  fHistoMCSecPi0PtvsSource[fiCut]->Fill(particle->Pt(),source, tempParticleWeight); // All secondary MC Pi0
2840  }
2841 
2842  // check whether pi0 landet in acceptance
2843  if( (((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedAODMC(daughter0,AODMCTrackArray) ||
2844  ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedAODMC(daughter1,AODMCTrackArray) ) ){
2845  if( TMath::Abs(particle->GetPdgCode()) == 111 ){ // neutral pions
2846  Int_t source = GetSourceClassification(111,motherPDG);
2847  fHistoMCSecPi0InAccPtvsSource[fiCut]->Fill(particle->Pt(),source, tempParticleWeight); // All secondary MC Pi0
2848  }
2849  }
2850  }
2851 
2852  Int_t gammaLabel = -1;
2853  Int_t electronLabel = -1;
2854  Int_t positronLabel = -1;
2855  // check if particle is pi0/eta from Dalitz decay
2857  ->MesonIsSelectedAODMCDalitz(particle,AODMCTrackArray, electronLabel, positronLabel, gammaLabel, ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift())){
2858  if( (gammaLabel > -1) && (electronLabel > -1) && (positronLabel > -1) ){
2859  AliAODMCParticle* gamma = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gammaLabel));
2860  AliAODMCParticle* electron = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(electronLabel));
2861  AliAODMCParticle* positron = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(positronLabel));
2862 
2863  AliAODMCParticle* mother = NULL;
2864  Int_t motherPDG = -1000000;
2865  if (particle->GetMother() > -1){
2866  mother = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(particle->GetMother()));
2867  if (mother)
2868  motherPDG = TMath::Abs(mother->GetPdgCode());
2869  }
2870 
2871  if( TMath::Abs(particle->GetPdgCode()) == 111 ){ // neutral pions
2872  Int_t source = GetSourceClassification(111,motherPDG);
2873  fHistoMCSecPi0PtvsSource[fiCut]->Fill(particle->Pt(),source, tempParticleWeight); // All secondary MC Pi0
2874  }
2875 
2876  // check whether pi0 landet in acceptance
2877  if( (((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedAODMC(gamma,AODMCTrackArray) ||
2878  ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedElecAODMC(electron,AODMCTrackArray) ||
2879  ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedElecAODMC(positron,AODMCTrackArray) ) ){
2880  if( TMath::Abs(particle->GetPdgCode()) == 111 ){ // neutral pions
2881  Int_t source = GetSourceClassification(111,motherPDG);
2882  fHistoMCSecPi0InAccPtvsSource[fiCut]->Fill(particle->Pt(),source, tempParticleWeight); // All secondary MC Pi0
2883  }
2884  }
2885  }
2886  }
2887  }
2888  } // end of particle loop
2889  return;
2890 }
2891 
2892 //_________________________________________________________________________________
2894  TAxis *axisafter = histoRebin->GetXaxis();
2895  Int_t bins = axisafter->GetNbins();
2896  Double_t from = axisafter->GetXmin();
2897  Double_t to = axisafter->GetXmax();
2898  Double_t *newbins = new Double_t[bins+1];
2899  newbins[0] = from;
2900  Double_t factor = TMath::Power(to/from, 1./bins);
2901  for(Int_t i=1; i<=bins; ++i) newbins[i] = factor * newbins[i-1];
2902  axisafter->Set(bins, newbins);
2903  delete [] newbins;
2904 }
2905 
2906 //_________________________________________________________________________________
2908 {
2909  if(tobechecked > -1)
2910  {
2911  vector<Int_t>::iterator it;
2912  it = find (vec.begin(), vec.end(), tobechecked);
2913  if (it != vec.end()) return true;
2914  else{
2915  vec.push_back(tobechecked);
2916  return false;
2917  }
2918  }
2919  return false;
2920 }
2921 
2922 //________________________________________________________________________
2924 {
2925 
2926  //fOutputContainer->Print(); // Will crash on GRID
2927 }
2928 
2929 
2930 //_________________________________________________________________________________
2931 void AliAnalysisTaskGammaCaloMerged::FillMultipleCountMap(map<Int_t,Int_t> &ma, Int_t tobechecked){
2932  if( ma.find(tobechecked) != ma.end() ) ma[tobechecked] += 1;
2933  else ma[tobechecked] = 2;
2934  return;
2935 }
2936 
2937 //_________________________________________________________________________________
2939  map<Int_t, Int_t>::iterator it;
2940  for (it = ma.begin(); it != ma.end(); it++){
2941  hist->Fill(it->second, fWeightJetJetMC);
2942  }
2943  ma.clear();
2944  return;
2945 }
2946 
2947 
2948 //________________________________________________________________________
2950 
2951  if (daughter == 111) {
2952  if (TMath::Abs(pdgCode) == 310) return 1; // k0s
2953  else if (TMath::Abs(pdgCode) == 3122) return 2; // Lambda
2954  else if (TMath::Abs(pdgCode) == 130) return 3; // K0L
2955  else if (TMath::Abs(pdgCode) == 2212) return 4; // proton
2956  else if (TMath::Abs(pdgCode) == 2112) return 5; // neutron
2957  else if (TMath::Abs(pdgCode) == 211) return 6; // pion
2958  else if (TMath::Abs(pdgCode) == 321) return 7; // kaon
2959  else if (TMath::Abs(pdgCode) == 113 || TMath::Abs(pdgCode) == 213 ) return 8; // rho 0,+,-
2960  else if (TMath::Abs(pdgCode) == 3222 || TMath::Abs(pdgCode) == 3212 || TMath::Abs(pdgCode) == 3112 ) return 9; // Sigma
2961  else if (TMath::Abs(pdgCode) == 2224 || TMath::Abs(pdgCode) == 2214 || TMath::Abs(pdgCode) == 2114 || TMath::Abs(pdgCode) == 1114 ) return 10; // Delta
2962  else if (TMath::Abs(pdgCode) == 313 || TMath::Abs(pdgCode) == 323 ) return 11; // K*
2963  else return 15;
2964  }
2965  return 15;
2966 
2967 }
TH2F ** fHistoClusMergedNCellsPt
array of histos with cluster NCells vs Pt
TH1F ** fHistoNGoodESDTracks
array of histos with event information without event weights
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
void SetCaloClusterRef(Long_t ref)
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
TH2F ** fHistoMotherPtAlpha
array of histograms with signal +BG pt, Y
void SetCaloPhotonMCFlags(AliMCEvent *mcEvent, Bool_t enableSort)
TH1F ** fHistoMCPi0InAccPt
array of histos without event weights eta Dalitz, pT
TH2F ** fHistoTruePrimaryPi0MergedPartConvMCPtResolPt
array of histos with validated weighted primary pi0, MCpt, resol pt
TH1F ** fHistoMCEtaDalitzWOWeightPt
array of histos with weighted eta Dalitz, pT
TH2F ** fHistoTrueEtaPtAlpha
array of histos with validated pi0, pt, alpha
TH1F ** fHistoMCPi0DalitzPt
array of histos without event weights eta, pT
TH1F ** fHistoMCAllGammaPt
array of histos with weighted decay gamma
Int_t GetNumberOfPrimaryTracks()
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
TString GetCurrentFileName()
Definition: AliV0ReaderV1.h:95
TString GetPeriodName()
TH1F ** fHistoNEvents
vector containing labels of validated eta
virtual Int_t GetLabel(Int_t i) const
TH2F ** fHistoTrueClusEtaEM02
array of histos with validated pi0, E, m02
TH1F ** fHistoNEventsWOWeight
array of histos with event information
void SetCaloPhotonMCLabel(Int_t i, Int_t labelCaloPhoton)
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
Int_t GetCaloPhotonMotherMCLabel(Int_t i)
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
void PrintCaloMCLabelsAndInfo(AliMCEvent *mcEvent)
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
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
Class handling all kinds of selection cuts for Gamma Calo analysis.
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
void ProcessTrueClusterCandidatesAOD(AliAODConversionPhoton *TruePhotonCandidate, Float_t m02, AliAODConversionPhoton *TrueSubClusterCandidate1, AliAODConversionPhoton *TrueSubClusterCandidate2)
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
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)
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
TList * GetCaloTrackMatcherHistograms()
TH2F ** fHistoDoubleCountTrueEtaPtvsM02
array of histos with double counted secondary pi0s, pT, M02
TH2F ** fHistoClusMergedPtvsM02
array of histos with cluster NLM vs Pt
TProfile ** fProfileEtaShift
array of histos with V0 counts
Definition: External.C:220
Class handling all kinds of selection cuts for Gamma Conversion analysis.
TH2F ** fHistoMCEtaPtJetPt
array of histos with weighted pi0, pT, hardest jet pt
TH2F ** fHistoDoubleCountTruePi0PtvsM02
array of histos with validated weighted secondary pi0, MCpt, resol pt
TH2F ** fHistoTrueClusMergedPtvsM02
array of histos with weighted all gamma
void SetNCaloPhotonMCLabels(Int_t nLabels)
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
void ProcessTrueClusterCandidates(AliAODConversionPhoton *TruePhotonCandidate, Float_t m02, AliAODConversionPhoton *TrueSubClusterCandidate1, AliAODConversionPhoton *TrueSubClusterCandidate2)
Class handling all kinds of selection cuts for Gamma Conversion analysis.
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
AliConvEventCuts * GetEventCuts()
Definition: AliV0ReaderV1.h:90
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
array of histos with double counted etas, pT, M02
void SetCaloPhotonMCFlagsAOD(AliVEvent *event, Bool_t enableSort)
TH2F ** fHistoTruePrimaryPi0PureMergedMCPtResolPt
array of histos with validated eta, E, m02
TH2F ** fHistoClusNLMPt
array of histos with cluster, pt overlapping with other headers
TH2F ** fHistoTrueEtaPtY
array of histos with validated pi0, pt, Y
void FillMultipleCountMap(map< Int_t, Int_t > &ma, Int_t tobechecked)
TH2F ** fHistoTrueClusElectronEM02
array of histos with validated gamma, E, m02