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