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