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