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