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