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