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