]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGGA/GammaConv/AliAnalysisTaskGammaCalo.cxx
Added LHC11h_pass2 calibration
[u/mrichter/AliRoot.git] / PWGGA / GammaConv / AliAnalysisTaskGammaCalo.cxx
CommitLineData
d53bf4ac 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: Baldo Sahlmueller, 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
17//////////////////////////////////////////////////////////////////
18//----------------------------------------------------------------
19// Class used to do analysis on conversion photons + calo photons
20//----------------------------------------------------------------
21//////////////////////////////////////////////////////////////////
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"
42#include "AliAnalysisTaskGammaCalo.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"
52#include "AliAnalysisTaskEMCALClusterizeFast.h"
53#include "AliAODEvent.h"
54#include "AliAODInputHandler.h"
55#include "AliESDEvent.h"
56#include "AliESDInputHandler.h"
57#include "AliInputEventHandler.h"
58
59ClassImp(AliAnalysisTaskGammaCalo)
60
61//________________________________________________________________________
62AliAnalysisTaskGammaCalo::AliAnalysisTaskGammaCalo(): AliAnalysisTaskSE(),
63 fV0Reader(NULL),
64 fBGHandler(NULL),
65 fInputEvent(NULL),
66 fMCEvent(NULL),
67 fMCStack(NULL),
68 fCutFolder(NULL),
69 fESDList(NULL),
70 fBackList(NULL),
71 fMotherList(NULL),
72 fTrueList(NULL),
73 fMCList(NULL),
74 fHeaderNameList(NULL),
75 fOutputContainer(NULL),
76 fClusterCandidates(NULL),
77 fEventCutArray(NULL),
78 fEventCuts(NULL),
79 fClusterCutArray(NULL),
80 fCaloPhotonCuts(NULL),
81 fMesonCutArray(NULL),
82 fMesonCuts(NULL),
83 fHistoMotherInvMassPt(NULL),
8c96b4f9 84 fHistoMotherInvMass3ClusterPt(NULL),
d53bf4ac 85 fSparseMotherInvMassPtZM(NULL),
86 fHistoMotherBackInvMassPt(NULL),
87 fSparseMotherBackInvMassPtZM(NULL),
88 fHistoMotherInvMassEalpha(NULL),
89 fHistoMotherPi0PtY(NULL),
90 fHistoMotherEtaPtY(NULL),
91 fHistoMotherPi0PtAlpha(NULL),
92 fHistoMotherEtaPtAlpha(NULL),
93 fHistoMotherPi0PtOpenAngle(NULL),
94 fHistoMotherEtaPtOpenAngle(NULL),
95 fHistoMotherInvMassECalib(NULL),
96 fHistoMotherInvMassECalibalpha(NULL),
97 fHistoClusGammaPt(NULL),
98 fHistoMCHeaders(NULL),
99 fHistoMCAllGammaPt(NULL),
100 fHistoMCDecayGammaPi0Pt(NULL),
101 fHistoMCDecayGammaRhoPt(NULL),
102 fHistoMCDecayGammaEtaPt(NULL),
103 fHistoMCDecayGammaOmegaPt(NULL),
104 fHistoMCDecayGammaEtapPt(NULL),
105 fHistoMCDecayGammaPhiPt(NULL),
106 fHistoMCDecayGammaSigmaPt(NULL),
107 fHistoMCPi0Pt(NULL),
108 fHistoMCPi0WOWeightPt(NULL),
109 fHistoMCEtaPt(NULL),
110 fHistoMCEtaWOWeightPt(NULL),
111 fHistoMCPi0InAccPt(NULL),
112 fHistoMCEtaInAccPt(NULL),
113 fHistoMCPi0PtY(NULL),
114 fHistoMCEtaPtY(NULL),
de752898 115 fHistoMCPi0PtAlpha(NULL),
116 fHistoMCEtaPtAlpha(NULL),
d53bf4ac 117 fHistoMCK0sPt(NULL),
118 fHistoMCK0sWOWeightPt(NULL),
119 fHistoMCK0sPtY(NULL),
120 fHistoMCSecPi0PtvsSource(NULL),
121 fHistoMCSecPi0Source(NULL),
122 fHistoMCSecEtaPt(NULL),
123 fHistoMCSecEtaSource(NULL),
ed8bc1ca 124 fHistoTruePi0InvMassPt(NULL),
125 fHistoTrueEtaInvMassPt(NULL),
126 fHistoTruePi0CaloPhotonInvMassPt(NULL),
127 fHistoTrueEtaCaloPhotonInvMassPt(NULL),
d53bf4ac 128 fHistoTruePi0CaloConvertedPhotonInvMassPt(NULL),
129 fHistoTrueEtaCaloConvertedPhotonInvMassPt(NULL),
ed8bc1ca 130 fHistoTruePi0CaloMixedPhotonConvPhotonInvMassPt(NULL),
131 fHistoTrueEtaCaloMixedPhotonConvPhotonInvMassPt(NULL),
132 fHistoTruePi0CaloElectronInvMassPt(NULL),
133 fHistoTrueEtaCaloElectronInvMassPt(NULL),
134 fHistoTruePi0CaloMergedClusterInvMassPt(NULL),
135 fHistoTrueEtaCaloMergedClusterInvMassPt(NULL),
136 fHistoTruePi0CaloMergedClusterPartConvInvMassPt(NULL),
137 fHistoTrueEtaCaloMergedClusterPartConvInvMassPt(NULL),
def90c8b 138 fHistoTruePi0NonMergedElectronPhotonInvMassPt(NULL),
139 fHistoTruePi0NonMergedElectronMergedPhotonInvMassPt(NULL),
ed8bc1ca 140 fHistoTruePrimaryPi0InvMassPt(NULL),
141 fHistoTruePrimaryEtaInvMassPt(NULL),
142 fHistoTruePrimaryPi0W0WeightingInvMassPt(NULL),
143 fHistoTruePrimaryEtaW0WeightingInvMassPt(NULL),
144 fProfileTruePrimaryPi0WeightsInvMassPt(NULL),
145 fProfileTruePrimaryEtaWeightsInvMassPt(NULL),
d53bf4ac 146 fHistoTruePrimaryPi0MCPtResolPt(NULL),
147 fHistoTruePrimaryEtaMCPtResolPt(NULL),
ed8bc1ca 148 fHistoTrueSecondaryPi0InvMassPt(NULL),
149 fHistoTrueSecondaryEtaInvMassPt(NULL),
150 fHistoTrueSecondaryPi0FromK0sInvMassPt(NULL),
d53bf4ac 151 fHistoTrueK0sWithPi0DaughterMCPt(NULL),
ed8bc1ca 152 fHistoTrueSecondaryPi0FromEtaInvMassPt(NULL),
d53bf4ac 153 fHistoTrueEtaWithPi0DaughterMCPt(NULL),
ed8bc1ca 154 fHistoTrueSecondaryPi0FromLambdaInvMassPt(NULL),
d53bf4ac 155 fHistoTrueLambdaWithPi0DaughterMCPt(NULL),
156 fHistoTrueBckGGInvMassPt(NULL),
157 fHistoTrueBckContInvMassPt(NULL),
158 fHistoTruePi0PtY(NULL),
159 fHistoTrueEtaPtY(NULL),
160 fHistoTruePi0PtAlpha(NULL),
161 fHistoTrueEtaPtAlpha(NULL),
162 fHistoTruePi0PtOpenAngle(NULL),
163 fHistoTrueEtaPtOpenAngle(NULL),
164 fHistoClusPhotonBGPt(NULL),
165 fHistoClusPhotonPlusConvBGPt(NULL),
166 fHistoTrueClusGammaPt(NULL),
167 fHistoTrueClusUnConvGammaPt(NULL),
168 fHistoTrueClusUnConvGammaMCPt(NULL),
169 fHistoTrueClusElectronPt(NULL),
170 fHistoTrueClusConvGammaPt(NULL),
171 fHistoTrueClusConvGammaMCPt(NULL),
172 fHistoTrueClusConvGammaFullyPt(NULL),
173 fHistoTrueClusMergedGammaPt(NULL),
174 fHistoTrueClusMergedPartConvGammaPt(NULL),
175 fHistoTrueClusDalitzPt(NULL),
176 fHistoTrueClusDalitzMergedPt(NULL),
177 fHistoTrueClusPhotonFromElecMotherPt(NULL),
178 fHistoTrueClusShowerPt(NULL),
179 fHistoTrueClusSubLeadingPt(NULL),
180 fHistoTrueClusNParticles(NULL),
181 fHistoTrueClusEMNonLeadingPt(NULL),
182 fHistoTrueNLabelsInClus(NULL),
183 fHistoTruePrimaryClusGammaPt(NULL),
184 fHistoTruePrimaryClusGammaESDPtMCPt(NULL),
185 fHistoTruePrimaryClusConvGammaPt(NULL),
186 fHistoTruePrimaryClusConvGammaESDPtMCPt(NULL),
187 fHistoTrueSecondaryClusGammaPt(NULL),
188 fHistoTrueSecondaryClusConvGammaPt(NULL),
189 fHistoTrueSecondaryClusGammaFromXFromK0sPt(NULL),
190 fHistoTrueSecondaryClusConvGammaFromXFromK0sPt(NULL),
191 fHistoTrueSecondaryClusGammaFromXFromLambdaPt(NULL),
192 fHistoTrueSecondaryClusConvGammaFromXFromLambdaPt(NULL),
193 fHistoTrueSecondaryClusGammaFromXFromEtasPt(NULL),
194 fHistoTrueSecondaryClusConvGammaFromXFromEtasPt(NULL),
195 fHistoNEvents(NULL),
196 fHistoNGoodESDTracks(NULL),
197 fHistoNGammaCandidates(NULL),
198 fHistoNGoodESDTracksVsNGammaCanditates(NULL),
199 fHistoNV0Tracks(NULL),
200 fProfileEtaShift(NULL),
201 fEventPlaneAngle(-100),
202 fRandom(0),
203 fnCuts(0),
204 fiCut(0),
205 fIsHeavyIon(0),
206 fDoMesonAnalysis(kTRUE),
207 fDoMesonQA(0),
208 fDoClusterQA(0),
209 fIsFromMBHeader(kTRUE),
210 fIsMC(kFALSE)
211{
212
213}
214
215//________________________________________________________________________
216AliAnalysisTaskGammaCalo::AliAnalysisTaskGammaCalo(const char *name):
217 AliAnalysisTaskSE(name),
218 fV0Reader(NULL),
219 fBGHandler(NULL),
220 fInputEvent(NULL),
221 fMCEvent(NULL),
222 fMCStack(NULL),
223 fCutFolder(NULL),
224 fESDList(NULL),
225 fBackList(NULL),
226 fMotherList(NULL),
227 fTrueList(NULL),
228 fMCList(NULL),
229 fHeaderNameList(NULL),
230 fOutputContainer(0),
231 fClusterCandidates(NULL),
232 fEventCutArray(NULL),
233 fEventCuts(NULL),
234 fClusterCutArray(NULL),
235 fCaloPhotonCuts(NULL),
236 fMesonCutArray(NULL),
237 fMesonCuts(NULL),
238 fHistoMotherInvMassPt(NULL),
8c96b4f9 239 fHistoMotherInvMass3ClusterPt(NULL),
d53bf4ac 240 fSparseMotherInvMassPtZM(NULL),
241 fHistoMotherBackInvMassPt(NULL),
242 fSparseMotherBackInvMassPtZM(NULL),
243 fHistoMotherInvMassEalpha(NULL),
244 fHistoMotherPi0PtY(NULL),
245 fHistoMotherEtaPtY(NULL),
246 fHistoMotherPi0PtAlpha(NULL),
247 fHistoMotherEtaPtAlpha(NULL),
248 fHistoMotherPi0PtOpenAngle(NULL),
249 fHistoMotherEtaPtOpenAngle(NULL),
250 fHistoMotherInvMassECalib(NULL),
251 fHistoMotherInvMassECalibalpha(NULL),
252 fHistoClusGammaPt(NULL),
253 fHistoMCHeaders(NULL),
254 fHistoMCAllGammaPt(NULL),
255 fHistoMCDecayGammaPi0Pt(NULL),
256 fHistoMCDecayGammaRhoPt(NULL),
257 fHistoMCDecayGammaEtaPt(NULL),
258 fHistoMCDecayGammaOmegaPt(NULL),
259 fHistoMCDecayGammaEtapPt(NULL),
260 fHistoMCDecayGammaPhiPt(NULL),
261 fHistoMCDecayGammaSigmaPt(NULL),
262 fHistoMCPi0Pt(NULL),
263 fHistoMCPi0WOWeightPt(NULL),
264 fHistoMCEtaPt(NULL),
265 fHistoMCEtaWOWeightPt(NULL),
266 fHistoMCPi0InAccPt(NULL),
267 fHistoMCEtaInAccPt(NULL),
268 fHistoMCPi0PtY(NULL),
269 fHistoMCEtaPtY(NULL),
de752898 270 fHistoMCPi0PtAlpha(NULL),
271 fHistoMCEtaPtAlpha(NULL),
d53bf4ac 272 fHistoMCK0sPt(NULL),
273 fHistoMCK0sWOWeightPt(NULL),
274 fHistoMCK0sPtY(NULL),
275 fHistoMCSecPi0PtvsSource(NULL),
276 fHistoMCSecPi0Source(NULL),
277 fHistoMCSecEtaPt(NULL),
278 fHistoMCSecEtaSource(NULL),
ed8bc1ca 279 fHistoTruePi0InvMassPt(NULL),
280 fHistoTrueEtaInvMassPt(NULL),
281 fHistoTruePi0CaloPhotonInvMassPt(NULL),
282 fHistoTrueEtaCaloPhotonInvMassPt(NULL),
d53bf4ac 283 fHistoTruePi0CaloConvertedPhotonInvMassPt(NULL),
284 fHistoTrueEtaCaloConvertedPhotonInvMassPt(NULL),
ed8bc1ca 285 fHistoTruePi0CaloMixedPhotonConvPhotonInvMassPt(NULL),
286 fHistoTrueEtaCaloMixedPhotonConvPhotonInvMassPt(NULL),
287 fHistoTruePi0CaloElectronInvMassPt(NULL),
288 fHistoTrueEtaCaloElectronInvMassPt(NULL),
289 fHistoTruePi0CaloMergedClusterInvMassPt(NULL),
290 fHistoTrueEtaCaloMergedClusterInvMassPt(NULL),
291 fHistoTruePi0CaloMergedClusterPartConvInvMassPt(NULL),
292 fHistoTrueEtaCaloMergedClusterPartConvInvMassPt(NULL),
def90c8b 293 fHistoTruePi0NonMergedElectronPhotonInvMassPt(NULL),
294 fHistoTruePi0NonMergedElectronMergedPhotonInvMassPt(NULL),
ed8bc1ca 295 fHistoTruePrimaryPi0InvMassPt(NULL),
296 fHistoTruePrimaryEtaInvMassPt(NULL),
297 fHistoTruePrimaryPi0W0WeightingInvMassPt(NULL),
298 fHistoTruePrimaryEtaW0WeightingInvMassPt(NULL),
299 fProfileTruePrimaryPi0WeightsInvMassPt(NULL),
300 fProfileTruePrimaryEtaWeightsInvMassPt(NULL),
d53bf4ac 301 fHistoTruePrimaryPi0MCPtResolPt(NULL),
302 fHistoTruePrimaryEtaMCPtResolPt(NULL),
ed8bc1ca 303 fHistoTrueSecondaryPi0InvMassPt(NULL),
304 fHistoTrueSecondaryEtaInvMassPt(NULL),
305 fHistoTrueSecondaryPi0FromK0sInvMassPt(NULL),
d53bf4ac 306 fHistoTrueK0sWithPi0DaughterMCPt(NULL),
ed8bc1ca 307 fHistoTrueSecondaryPi0FromEtaInvMassPt(NULL),
d53bf4ac 308 fHistoTrueEtaWithPi0DaughterMCPt(NULL),
ed8bc1ca 309 fHistoTrueSecondaryPi0FromLambdaInvMassPt(NULL),
d53bf4ac 310 fHistoTrueLambdaWithPi0DaughterMCPt(NULL),
311 fHistoTrueBckGGInvMassPt(NULL),
312 fHistoTrueBckContInvMassPt(NULL),
313 fHistoTruePi0PtY(NULL),
314 fHistoTrueEtaPtY(NULL),
315 fHistoTruePi0PtAlpha(NULL),
316 fHistoTrueEtaPtAlpha(NULL),
317 fHistoTruePi0PtOpenAngle(NULL),
318 fHistoTrueEtaPtOpenAngle(NULL),
319 fHistoClusPhotonBGPt(NULL),
320 fHistoClusPhotonPlusConvBGPt(NULL),
321 fHistoTrueClusGammaPt(NULL),
322 fHistoTrueClusUnConvGammaPt(NULL),
323 fHistoTrueClusUnConvGammaMCPt(NULL),
324 fHistoTrueClusElectronPt(NULL),
325 fHistoTrueClusConvGammaPt(NULL),
326 fHistoTrueClusConvGammaMCPt(NULL),
327 fHistoTrueClusConvGammaFullyPt(NULL),
328 fHistoTrueClusMergedGammaPt(NULL),
329 fHistoTrueClusMergedPartConvGammaPt(NULL),
330 fHistoTrueClusDalitzPt(NULL),
331 fHistoTrueClusDalitzMergedPt(NULL),
332 fHistoTrueClusPhotonFromElecMotherPt(NULL),
333 fHistoTrueClusShowerPt(NULL),
334 fHistoTrueClusSubLeadingPt(NULL),
335 fHistoTrueClusNParticles(NULL),
336 fHistoTrueClusEMNonLeadingPt(NULL),
337 fHistoTrueNLabelsInClus(NULL),
338 fHistoTruePrimaryClusGammaPt(NULL),
339 fHistoTruePrimaryClusGammaESDPtMCPt(NULL),
340 fHistoTruePrimaryClusConvGammaPt(NULL),
341 fHistoTruePrimaryClusConvGammaESDPtMCPt(NULL),
342 fHistoTrueSecondaryClusGammaPt(NULL),
343 fHistoTrueSecondaryClusConvGammaPt(NULL),
344 fHistoTrueSecondaryClusGammaFromXFromK0sPt(NULL),
345 fHistoTrueSecondaryClusConvGammaFromXFromK0sPt(NULL),
346 fHistoTrueSecondaryClusGammaFromXFromLambdaPt(NULL),
347 fHistoTrueSecondaryClusConvGammaFromXFromLambdaPt(NULL),
348 fHistoTrueSecondaryClusGammaFromXFromEtasPt(NULL),
349 fHistoTrueSecondaryClusConvGammaFromXFromEtasPt(NULL),
350 fHistoNEvents(NULL),
351 fHistoNGoodESDTracks(NULL),
352 fHistoNGammaCandidates(NULL),
353 fHistoNGoodESDTracksVsNGammaCanditates(NULL),
354 fHistoNV0Tracks(NULL),
355 fProfileEtaShift(NULL),
356 fEventPlaneAngle(-100),
357 fRandom(0),
358 fnCuts(0),
359 fiCut(0),
360 fIsHeavyIon(0),
361 fDoMesonAnalysis(kTRUE),
362 fDoMesonQA(0),
363 fDoClusterQA(0),
364 fIsFromMBHeader(kTRUE),
365 fIsMC(kFALSE)
366{
367 // Define output slots here
368 DefineOutput(1, TList::Class());
369}
370
371AliAnalysisTaskGammaCalo::~AliAnalysisTaskGammaCalo()
372{
373 if(fClusterCandidates){
374 delete fClusterCandidates;
375 fClusterCandidates = 0x0;
376 }
377 if(fBGHandler){
378 delete[] fBGHandler;
379 fBGHandler = 0x0;
380 }
381}
382//___________________________________________________________
383void AliAnalysisTaskGammaCalo::InitBack(){
384
385 const Int_t nDim = 4;
386 Int_t nBins[nDim] = {800,250,7,4};
387 Double_t xMin[nDim] = {0,0, 0,0};
388 Double_t xMax[nDim] = {0.8,25,7,4};
389
390 fSparseMotherInvMassPtZM = new THnSparseF*[fnCuts];
391 fSparseMotherBackInvMassPtZM = new THnSparseF*[fnCuts];
392
393 fBGHandler = new AliGammaConversionAODBGHandler*[fnCuts];
394
395
396 for(Int_t iCut = 0; iCut<fnCuts;iCut++){
397 if (((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->DoBGCalculation()){
398 TString cutstringEvent = ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber();
399 TString cutstringCalo = ((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetCutNumber();
400 TString cutstringMeson = ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutNumber();
401
402 Int_t collisionSystem = atoi((TString)(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber())(0,1));
403 Int_t centMin = atoi((TString)(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber())(1,1));
404 Int_t centMax = atoi((TString)(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber())(2,1));
405
406 if(collisionSystem == 1 || collisionSystem == 2 ||
407 collisionSystem == 5 || collisionSystem == 8 ||
408 collisionSystem == 9){
409 centMin = centMin*10;
410 centMax = centMax*10;
411 if(centMax ==0 && centMax!=centMin) centMax=100;
412 } else if(collisionSystem == 3 || collisionSystem == 6){
413 centMin = centMin*5;
414 centMax = centMax*5;
415 } else if(collisionSystem == 4 || collisionSystem == 7){
416 centMin = ((centMin*5)+45);
417 centMax = ((centMax*5)+45);
418 }
419
420 fBackList[iCut] = new TList();
421 fBackList[iCut]->SetName(Form("%s_%s_%s Back histograms",cutstringEvent.Data(),cutstringCalo.Data(), cutstringMeson.Data()));
422 fBackList[iCut]->SetOwner(kTRUE);
423 fCutFolder[iCut]->Add(fBackList[iCut]);
424
425 fSparseMotherBackInvMassPtZM[iCut] = new THnSparseF("Back_Back_InvMass_Pt_z_m","Back_Back_InvMass_Pt_z_m",nDim,nBins,xMin,xMax);
426 fBackList[iCut]->Add(fSparseMotherBackInvMassPtZM[iCut]);
427
428 fMotherList[iCut] = new TList();
429 fMotherList[iCut]->SetName(Form("%s_%s_%s Mother histograms",cutstringEvent.Data(),cutstringCalo.Data(),cutstringMeson.Data()));
430 fMotherList[iCut]->SetOwner(kTRUE);
431 fCutFolder[iCut]->Add(fMotherList[iCut]);
432
433 fSparseMotherInvMassPtZM[iCut] = new THnSparseF("Back_Mother_InvMass_Pt_z_m","Back_Mother_InvMass_Pt_z_m",nDim,nBins,xMin,xMax);
434 fMotherList[iCut]->Add(fSparseMotherInvMassPtZM[iCut]);
435
436 if(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->BackgroundHandlerType() == 0){
437 fBGHandler[iCut] = new AliGammaConversionAODBGHandler(
438 collisionSystem,centMin,centMax,
439 ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetNumberOfBGEvents(),
440 ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->UseTrackMultiplicity());
441 }
442 }
443 }
444}
445//________________________________________________________________________
446void AliAnalysisTaskGammaCalo::UserCreateOutputObjects(){
447
448 // Create histograms
449 if(fOutputContainer != NULL){
450 delete fOutputContainer;
451 fOutputContainer = NULL;
452 }
453 if(fOutputContainer == NULL){
454 fOutputContainer = new TList();
455 fOutputContainer->SetOwner(kTRUE);
456 }
457
458 // Array of current cut's gammas
459 fClusterCandidates = new TList();
460
461 fCutFolder = new TList*[fnCuts];
462 fESDList = new TList*[fnCuts];
463 fBackList = new TList*[fnCuts];
464 fMotherList = new TList*[fnCuts];
465 fHistoNEvents = new TH1I*[fnCuts];
466 fHistoNGoodESDTracks = new TH1I*[fnCuts];
467 fHistoNGammaCandidates = new TH1I*[fnCuts];
468 fHistoNGoodESDTracksVsNGammaCanditates = new TH2F*[fnCuts];
469 fHistoNV0Tracks = new TH1I*[fnCuts];
470 fProfileEtaShift = new TProfile*[fnCuts];
471
472 if(fDoMesonAnalysis){
473 fHistoMotherInvMassPt = new TH2F*[fnCuts];
8c96b4f9 474 fHistoMotherInvMass3ClusterPt = new TH2F*[fnCuts];
d53bf4ac 475 fHistoMotherBackInvMassPt = new TH2F*[fnCuts];
476 fHistoMotherInvMassEalpha = new TH2F*[fnCuts];
477 if (fDoMesonQA > 0){
478 fHistoMotherPi0PtY = new TH2F*[fnCuts];
479 fHistoMotherEtaPtY = new TH2F*[fnCuts];
480 fHistoMotherPi0PtAlpha = new TH2F*[fnCuts];
481 fHistoMotherEtaPtAlpha = new TH2F*[fnCuts];
482 fHistoMotherPi0PtOpenAngle = new TH2F*[fnCuts];
483 fHistoMotherEtaPtOpenAngle = new TH2F*[fnCuts];
484 }
485 if(fDoMesonQA == 1){
486 fHistoMotherInvMassECalib = new TH2F*[fnCuts];
487 fHistoMotherInvMassECalibalpha = new TH2F*[fnCuts];
488 }
489 }
490
491 fHistoClusGammaPt = new TH1F*[fnCuts];
492
493 for(Int_t iCut = 0; iCut<fnCuts;iCut++){
494 TString cutstringEvent = ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber();
495 TString cutstringCalo = ((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetCutNumber();
496 TString cutstringMeson = "NoMesonCut";
497 if(fDoMesonAnalysis)cutstringMeson = ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutNumber();
498
499 fCutFolder[iCut] = new TList();
500 fCutFolder[iCut]->SetName(Form("Cut Number %s_%s_%s",cutstringEvent.Data(),cutstringCalo.Data(),cutstringMeson.Data()));
501 fCutFolder[iCut]->SetOwner(kTRUE);
502 fOutputContainer->Add(fCutFolder[iCut]);
503 fESDList[iCut] = new TList();
504 fESDList[iCut]->SetName(Form("%s_%s_%s ESD histograms",cutstringEvent.Data(),cutstringCalo.Data(),cutstringMeson.Data()));
505 fESDList[iCut]->SetOwner(kTRUE);
506 fCutFolder[iCut]->Add(fESDList[iCut]);
507
508 fHistoNEvents[iCut] = new TH1I("NEvents","NEvents",9,-0.5,8.5);
509 fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(1,"Accepted");
510 fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(2,"Centrality");
511 fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(3,"Missing MC");
512 if (((AliConvEventCuts*)fEventCutArray->At(iCut))->IsSpecialTrigger() == 4 ){
513 TString TriggerNames = "Not Trigger: ";
514 TriggerNames = TriggerNames+ ( (AliConvEventCuts*)fEventCutArray->At(iCut))->GetSpecialTriggerName();
515 fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(4,TriggerNames.Data());
516 } else {
517 fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(4,"Trigger");
518 }
519 fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(5,"Vertex Z");
520 fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(6,"Cont. Vertex");
521 fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(7,"Pile-Up");
522 fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(8,"no SDD");
523 fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(9,"no V0AND");
524 fESDList[iCut]->Add(fHistoNEvents[iCut]);
525
526 if(fIsHeavyIon == 1) fHistoNGoodESDTracks[iCut] = new TH1I("GoodESDTracks","GoodESDTracks",4000,0,4000);
527 else if(fIsHeavyIon == 2) fHistoNGoodESDTracks[iCut] = new TH1I("GoodESDTracks","GoodESDTracks",400,0,400);
528 else fHistoNGoodESDTracks[iCut] = new TH1I("GoodESDTracks","GoodESDTracks",200,0,200);
529 fESDList[iCut]->Add(fHistoNGoodESDTracks[iCut]);
530 if(fIsHeavyIon == 1) fHistoNGammaCandidates[iCut] = new TH1I("GammaCandidates","GammaCandidates",600,0,600);
531 else if(fIsHeavyIon == 2) fHistoNGammaCandidates[iCut] = new TH1I("GammaCandidates","GammaCandidates",400,0,400);
532 else fHistoNGammaCandidates[iCut] = new TH1I("GammaCandidates","GammaCandidates",100,0,100);
533 fESDList[iCut]->Add(fHistoNGammaCandidates[iCut]);
534 if(fIsHeavyIon == 1) fHistoNGoodESDTracksVsNGammaCanditates[iCut] = new TH2F("GoodESDTracksVsGammaCandidates","GoodESDTracksVsGammaCandidates",4000,0,4000,600,0,600);
535 else if(fIsHeavyIon == 2) fHistoNGoodESDTracksVsNGammaCanditates[iCut] = new TH2F("GoodESDTracksVsGammaCandidates","GoodESDTracksVsGammaCandidates",400,0,400,400,0,400);
536 else fHistoNGoodESDTracksVsNGammaCanditates[iCut] = new TH2F("GoodESDTracksVsGammaCandidates","GoodESDTracksVsGammaCandidates",200,0,200,100,0,100);
537 fESDList[iCut]->Add(fHistoNGoodESDTracksVsNGammaCanditates[iCut]);
538
539
540 if(fIsHeavyIon == 1) fHistoNV0Tracks[iCut] = new TH1I("V0 Multiplicity","V0 Multiplicity",30000,0,30000);
541 else if(fIsHeavyIon == 2) fHistoNV0Tracks[iCut] = new TH1I("V0 Multiplicity","V0 Multiplicity",2500,0,2500);
542 else fHistoNV0Tracks[iCut] = new TH1I("V0 Multiplicity","V0 Multiplicity",1500,0,1500);
543 fESDList[iCut]->Add(fHistoNV0Tracks[iCut]);
544 fProfileEtaShift[iCut] = new TProfile("Eta Shift","Eta Shift",1, -0.5,0.5);
545 fESDList[iCut]->Add(fProfileEtaShift[iCut]);
546
547 fHistoClusGammaPt[iCut] = new TH1F("ClusGamma_Pt","ClusGamma_Pt",250,0,25);
548 fESDList[iCut]->Add(fHistoClusGammaPt[iCut]);
549
550
551 if(fDoMesonAnalysis){
552 fHistoMotherInvMassPt[iCut] = new TH2F("ESD_Mother_InvMass_Pt","ESD_Mother_InvMass_Pt",800,0,0.8,250,0,25);
553 fESDList[iCut]->Add(fHistoMotherInvMassPt[iCut]);
8c96b4f9 554 fHistoMotherInvMass3ClusterPt[iCut] = new TH2F("ESD_Mother_InvMass3Cluster_Pt","ESD_Mother_InvMass3Cluster_Pt",800,0,0.8,250,0,25);
555 fESDList[iCut]->Add(fHistoMotherInvMass3ClusterPt[iCut]);
d53bf4ac 556 fHistoMotherBackInvMassPt[iCut] = new TH2F("ESD_Background_InvMass_Pt","ESD_Background_InvMass_Pt",800,0,0.8,250,0,25);
557 fESDList[iCut]->Add(fHistoMotherBackInvMassPt[iCut]);
558 fHistoMotherInvMassEalpha[iCut] = new TH2F("ESD_Mother_InvMass_vs_E_alpha","ESD_Mother_InvMass_vs_E_alpha",800,0,0.8,250,0,25);
559 fESDList[iCut]->Add(fHistoMotherInvMassEalpha[iCut]);
560 if(fDoMesonQA == 1){
561 fHistoMotherInvMassECalib[iCut] = new TH2F("ESD_Mother_InvMass_Pt_Calib","ESD_Mother_InvMass_Pt_Calib",800,0,0.8,250,0,25);
562 fESDList[iCut]->Add(fHistoMotherInvMassECalib[iCut]);
563 fHistoMotherInvMassECalibalpha[iCut] = new TH2F("ESD_Mother_InvMass_vs_E_Calib_alpha","ESD_Mother_InvMass_vs_E_Calib_alpha",800,0,0.8,250,0,25);
564 fESDList[iCut]->Add(fHistoMotherInvMassECalibalpha[iCut]);
565 }
566
567 if (fDoMesonQA > 0 ){
568 fHistoMotherPi0PtY[iCut] = new TH2F("ESD_MotherPi0_Pt_Y","ESD_MotherPi0_Pt_Y",150,0.03,15.,150,-1.5,1.5);
569 SetLogBinningXTH2(fHistoMotherPi0PtY[iCut]);
570 fESDList[iCut]->Add(fHistoMotherPi0PtY[iCut]);
571 fHistoMotherEtaPtY[iCut] = new TH2F("ESD_MotherEta_Pt_Y","ESD_MotherEta_Pt_Y",150,0.03,15.,150,-1.5,1.5);
572 SetLogBinningXTH2(fHistoMotherEtaPtY[iCut]);
573 fESDList[iCut]->Add(fHistoMotherEtaPtY[iCut]);
574 fHistoMotherPi0PtAlpha[iCut] = new TH2F("ESD_MotherPi0_Pt_Alpha","ESD_MotherPi0_Pt_Alpha",150,0.03,15.,100,0,1);
575 SetLogBinningXTH2(fHistoMotherPi0PtAlpha[iCut]);
576 fESDList[iCut]->Add(fHistoMotherPi0PtAlpha[iCut]);
577 fHistoMotherEtaPtAlpha[iCut] = new TH2F("ESD_MotherEta_Pt_Alpha","ESD_MotherEta_Pt_Alpha",150,0.03,15.,100,0,1);
578 SetLogBinningXTH2(fHistoMotherEtaPtAlpha[iCut]);
579 fESDList[iCut]->Add(fHistoMotherEtaPtAlpha[iCut]);
580 fHistoMotherPi0PtOpenAngle[iCut] = new TH2F("ESD_MotherPi0_Pt_OpenAngle","ESD_MotherPi0_Pt_OpenAngle",150,0.03,15.,200,0,2*TMath::Pi());
581 SetLogBinningXTH2(fHistoMotherPi0PtOpenAngle[iCut]);
582 fESDList[iCut]->Add(fHistoMotherPi0PtOpenAngle[iCut]);
583 fHistoMotherEtaPtOpenAngle[iCut] = new TH2F("ESD_MotherEta_Pt_OpenAngle","ESD_MotherEta_Pt_OpenAngle",150,0.03,15.,200,0,2*TMath::Pi());
584 SetLogBinningXTH2(fHistoMotherEtaPtOpenAngle[iCut]);
585 fESDList[iCut]->Add(fHistoMotherEtaPtOpenAngle[iCut]);
586 }
587 }
588 }
589 if(fDoMesonAnalysis){
590 InitBack(); // Init Background Handler
591 }
592
593 if(fIsMC){
594 // MC Histogramms
595 fMCList = new TList*[fnCuts];
596 // True Histogramms
597 fTrueList = new TList*[fnCuts];
598 // Selected Header List
599 fHeaderNameList = new TList*[fnCuts];
600 fHistoMCHeaders = new TH1I*[fnCuts];
601 fHistoMCAllGammaPt = new TH1F*[fnCuts];
602 fHistoMCDecayGammaPi0Pt = new TH1F*[fnCuts];
603 fHistoMCDecayGammaRhoPt = new TH1F*[fnCuts];
604 fHistoMCDecayGammaEtaPt = new TH1F*[fnCuts];
605 fHistoMCDecayGammaOmegaPt = new TH1F*[fnCuts];
606 fHistoMCDecayGammaEtapPt = new TH1F*[fnCuts];
607 fHistoMCDecayGammaPhiPt = new TH1F*[fnCuts];
608 fHistoMCDecayGammaSigmaPt = new TH1F*[fnCuts];
609
610 fHistoClusPhotonBGPt = new TH2F*[fnCuts];
611 fHistoClusPhotonPlusConvBGPt = new TH2F*[fnCuts];
612
613 fHistoTrueClusGammaPt = new TH1F*[fnCuts];
614 fHistoTruePrimaryClusGammaPt = new TH1F*[fnCuts];
615 fHistoTruePrimaryClusGammaESDPtMCPt = new TH2F*[fnCuts];
616 fHistoTruePrimaryClusConvGammaPt = new TH1F*[fnCuts];
617 fHistoTruePrimaryClusConvGammaESDPtMCPt = new TH2F*[fnCuts];
618 fHistoTrueSecondaryClusGammaPt = new TH1F*[fnCuts];
619 fHistoTrueSecondaryClusConvGammaPt = new TH1F*[fnCuts];
620 fHistoTrueSecondaryClusGammaFromXFromK0sPt = new TH1F*[fnCuts];
621 fHistoTrueSecondaryClusConvGammaFromXFromK0sPt = new TH1F*[fnCuts];
622 fHistoTrueSecondaryClusGammaFromXFromLambdaPt = new TH1F*[fnCuts];
623 fHistoTrueSecondaryClusConvGammaFromXFromLambdaPt = new TH1F*[fnCuts];
624 fHistoTrueSecondaryClusGammaFromXFromEtasPt = new TH1F*[fnCuts];
625 fHistoTrueSecondaryClusConvGammaFromXFromEtasPt = new TH1F*[fnCuts];
626
d53bf4ac 627 if (fDoClusterQA > 0){
628 fHistoTrueClusUnConvGammaPt = new TH1F*[fnCuts];
629 fHistoTrueClusUnConvGammaMCPt = new TH1F*[fnCuts];
630 fHistoTrueClusElectronPt = new TH1F*[fnCuts];
631 fHistoTrueClusConvGammaPt = new TH1F*[fnCuts];
632 fHistoTrueClusConvGammaMCPt = new TH1F*[fnCuts];
633 fHistoTrueClusConvGammaFullyPt = new TH1F*[fnCuts];
634 fHistoTrueClusMergedGammaPt = new TH1F*[fnCuts];
635 fHistoTrueClusMergedPartConvGammaPt = new TH1F*[fnCuts];
636 fHistoTrueClusDalitzPt = new TH1F*[fnCuts];
637 fHistoTrueClusDalitzMergedPt = new TH1F*[fnCuts];
638 fHistoTrueClusPhotonFromElecMotherPt= new TH1F*[fnCuts];
639 fHistoTrueClusShowerPt = new TH1F*[fnCuts];
640 fHistoTrueClusSubLeadingPt = new TH1F*[fnCuts];
641 fHistoTrueClusNParticles = new TH1I*[fnCuts];
642 fHistoTrueClusEMNonLeadingPt = new TH1F*[fnCuts];
643 fHistoTrueNLabelsInClus = new TH1F*[fnCuts];
644 }
645
646 if(fDoMesonAnalysis){
647 fHistoMCPi0Pt = new TH1F*[fnCuts];
648 fHistoMCPi0WOWeightPt = new TH1F*[fnCuts];
649 fHistoMCEtaPt = new TH1F*[fnCuts];
650 fHistoMCEtaWOWeightPt = new TH1F*[fnCuts];
651 fHistoMCPi0InAccPt = new TH1F*[fnCuts];
652 fHistoMCEtaInAccPt = new TH1F*[fnCuts];
653
ed8bc1ca 654 fHistoTruePi0InvMassPt = new TH2F*[fnCuts];
655 fHistoTrueEtaInvMassPt = new TH2F*[fnCuts];
656 fHistoTruePrimaryPi0InvMassPt = new TH2F*[fnCuts];
657 fHistoTruePrimaryEtaInvMassPt = new TH2F*[fnCuts];
658 fHistoTruePrimaryPi0W0WeightingInvMassPt = new TH2F*[fnCuts];
659 fHistoTruePrimaryEtaW0WeightingInvMassPt = new TH2F*[fnCuts];
660 fProfileTruePrimaryPi0WeightsInvMassPt = new TProfile2D*[fnCuts];
661 fProfileTruePrimaryEtaWeightsInvMassPt = new TProfile2D*[fnCuts];
662 fHistoTrueSecondaryPi0InvMassPt = new TH2F*[fnCuts];
663 fHistoTrueSecondaryEtaInvMassPt = new TH2F*[fnCuts];
664 fHistoTrueSecondaryPi0FromK0sInvMassPt = new TH2F*[fnCuts];
665 fHistoTrueSecondaryPi0FromEtaInvMassPt = new TH2F*[fnCuts];
666 fHistoTrueSecondaryPi0FromLambdaInvMassPt = new TH2F*[fnCuts];
d53bf4ac 667 if (fDoMesonQA > 0){
668 fHistoMCPi0PtY = new TH2F*[fnCuts];
669 fHistoMCEtaPtY = new TH2F*[fnCuts];
de752898 670 fHistoMCPi0PtAlpha = new TH2F*[fnCuts];
671 fHistoMCEtaPtAlpha = new TH2F*[fnCuts];
d53bf4ac 672 fHistoMCK0sPt = new TH1F*[fnCuts];
673 fHistoMCK0sWOWeightPt = new TH1F*[fnCuts];
674 fHistoMCK0sPtY = new TH2F*[fnCuts];
675 fHistoMCSecPi0PtvsSource = new TH2F*[fnCuts];
676 fHistoMCSecPi0Source = new TH1F*[fnCuts];
677 fHistoMCSecEtaPt = new TH1F*[fnCuts];
678 fHistoMCSecEtaSource = new TH1F*[fnCuts];
ed8bc1ca 679 fHistoTruePi0CaloPhotonInvMassPt = new TH2F*[fnCuts];
680 fHistoTrueEtaCaloPhotonInvMassPt = new TH2F*[fnCuts];
681 fHistoTruePi0CaloMixedPhotonConvPhotonInvMassPt= new TH2F*[fnCuts];
682 fHistoTrueEtaCaloMixedPhotonConvPhotonInvMassPt= new TH2F*[fnCuts];
d53bf4ac 683 fHistoTruePi0CaloConvertedPhotonInvMassPt = new TH2F*[fnCuts];
684 fHistoTrueEtaCaloConvertedPhotonInvMassPt = new TH2F*[fnCuts];
ed8bc1ca 685 fHistoTruePi0CaloElectronInvMassPt = new TH2F*[fnCuts];
686 fHistoTrueEtaCaloElectronInvMassPt = new TH2F*[fnCuts];
687 fHistoTruePi0CaloMergedClusterInvMassPt = new TH2F*[fnCuts];
688 fHistoTrueEtaCaloMergedClusterInvMassPt = new TH2F*[fnCuts];
689 fHistoTruePi0CaloMergedClusterPartConvInvMassPt = new TH2F*[fnCuts];
690 fHistoTrueEtaCaloMergedClusterPartConvInvMassPt = new TH2F*[fnCuts];
def90c8b 691 fHistoTruePi0NonMergedElectronPhotonInvMassPt = new TH2F*[fnCuts];
692 fHistoTruePi0NonMergedElectronMergedPhotonInvMassPt = new TH2F*[fnCuts];
d53bf4ac 693 fHistoTruePrimaryPi0MCPtResolPt = new TH2F*[fnCuts];
694 fHistoTruePrimaryEtaMCPtResolPt = new TH2F*[fnCuts];
695 fHistoTrueK0sWithPi0DaughterMCPt = new TH1F*[fnCuts];
696 fHistoTrueEtaWithPi0DaughterMCPt = new TH1F*[fnCuts];
697 fHistoTrueLambdaWithPi0DaughterMCPt = new TH1F*[fnCuts];
698 fHistoTrueBckGGInvMassPt = new TH2F*[fnCuts];
699 fHistoTrueBckContInvMassPt = new TH2F*[fnCuts];
700 fHistoTruePi0PtY = new TH2F*[fnCuts];
701 fHistoTrueEtaPtY = new TH2F*[fnCuts];
702 fHistoTruePi0PtAlpha = new TH2F*[fnCuts];
703 fHistoTrueEtaPtAlpha = new TH2F*[fnCuts];
704 fHistoTruePi0PtOpenAngle = new TH2F*[fnCuts];
705 fHistoTrueEtaPtOpenAngle = new TH2F*[fnCuts];
706 }
707 }
708
709
710
711 for(Int_t iCut = 0; iCut<fnCuts;iCut++){
712 TString cutstringEvent = ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber();
713 TString cutstringCalo = ((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetCutNumber();
714 TString cutstringMeson = "NoMesonCut";
715 if(fDoMesonAnalysis)cutstringMeson = ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutNumber();
716
717 fMCList[iCut] = new TList();
718 fMCList[iCut]->SetName(Form("%s_%s_%s MC histograms",cutstringEvent.Data(),cutstringCalo.Data(),cutstringMeson.Data()));
719 fMCList[iCut]->SetOwner(kTRUE);
720 fCutFolder[iCut]->Add(fMCList[iCut]);
721 fHistoMCHeaders[iCut] = new TH1I("MC_Headers","MC_Headers",20,0,20);
722 fMCList[iCut]->Add(fHistoMCHeaders[iCut]);
723 fHistoMCAllGammaPt[iCut] = new TH1F("MC_AllGamma_Pt","MC_AllGamma_Pt",250,0,25);
724 fMCList[iCut]->Add(fHistoMCAllGammaPt[iCut]);
725 fHistoMCDecayGammaPi0Pt[iCut] = new TH1F("MC_DecayGammaPi0_Pt","MC_DecayGammaPi0_Pt",250,0,25);
726 fMCList[iCut]->Add(fHistoMCDecayGammaPi0Pt[iCut]);
727 fHistoMCDecayGammaRhoPt[iCut] = new TH1F("MC_DecayGammaRho_Pt","MC_DecayGammaRho_Pt",250,0,25);
728 fMCList[iCut]->Add(fHistoMCDecayGammaRhoPt[iCut]);
729 fHistoMCDecayGammaEtaPt[iCut] = new TH1F("MC_DecayGammaEta_Pt","MC_DecayGammaEta_Pt",250,0,25);
730 fMCList[iCut]->Add(fHistoMCDecayGammaEtaPt[iCut]);
731 fHistoMCDecayGammaOmegaPt[iCut] = new TH1F("MC_DecayGammaOmega_Pt","MC_DecayGammaOmmega_Pt",250,0,25);
732 fMCList[iCut]->Add(fHistoMCDecayGammaOmegaPt[iCut]);
733 fHistoMCDecayGammaEtapPt[iCut] = new TH1F("MC_DecayGammaEtap_Pt","MC_DecayGammaEtap_Pt",250,0,25);
734 fMCList[iCut]->Add(fHistoMCDecayGammaEtapPt[iCut]);
735 fHistoMCDecayGammaPhiPt[iCut] = new TH1F("MC_DecayGammaPhi_Pt","MC_DecayGammaPhi_Pt",250,0,25);
736 fMCList[iCut]->Add(fHistoMCDecayGammaPhiPt[iCut]);
737 fHistoMCDecayGammaSigmaPt[iCut] = new TH1F("MC_DecayGammaSigma_Pt","MC_DecayGammaSigma_Pt",250,0,25);
738 fMCList[iCut]->Add(fHistoMCDecayGammaSigmaPt[iCut]);
739
740 if(fDoMesonAnalysis){
741 fHistoMCPi0Pt[iCut] = new TH1F("MC_Pi0_Pt","MC_Pi0_Pt",250,0,25);
742 fHistoMCPi0Pt[iCut]->Sumw2();
743 fMCList[iCut]->Add(fHistoMCPi0Pt[iCut]);
744 fHistoMCPi0WOWeightPt[iCut] = new TH1F("MC_Pi0_WOWeights_Pt","MC_Pi0_WOWeights_Pt",250,0,25);
745 fHistoMCPi0WOWeightPt[iCut]->Sumw2();
746 fMCList[iCut]->Add(fHistoMCPi0WOWeightPt[iCut]);
747
748 fHistoMCEtaPt[iCut] = new TH1F("MC_Eta_Pt","MC_Eta_Pt",250,0,25);
749 fHistoMCEtaPt[iCut]->Sumw2();
750 fMCList[iCut]->Add(fHistoMCEtaPt[iCut]);
751 fHistoMCEtaWOWeightPt[iCut] = new TH1F("MC_Eta_WOWeights_Pt","MC_Eta_WOWeights_Pt",250,0,25);
752 fHistoMCEtaWOWeightPt[iCut]->Sumw2();
753 fMCList[iCut]->Add(fHistoMCEtaWOWeightPt[iCut]);
754 fHistoMCPi0InAccPt[iCut] = new TH1F("MC_Pi0InAcc_Pt","MC_Pi0InAcc_Pt",250,0,25);
755 fHistoMCPi0InAccPt[iCut]->Sumw2();
756 fMCList[iCut]->Add(fHistoMCPi0InAccPt[iCut]);
757 fHistoMCEtaInAccPt[iCut] = new TH1F("MC_EtaInAcc_Pt","MC_EtaInAcc_Pt",250,0,25);
758 fHistoMCEtaInAccPt[iCut]->Sumw2();
759 fMCList[iCut]->Add(fHistoMCEtaInAccPt[iCut]);
760 if (fDoMesonQA > 0){
761 fHistoMCPi0PtY[iCut] = new TH2F("MC_Pi0_Pt_Y","MC_Pi0_Pt_Y",150,0.03,15.,150,-1.5,1.5);
762 fHistoMCPi0PtY[iCut]->Sumw2();
763 SetLogBinningXTH2(fHistoMCPi0PtY[iCut]);
764 fMCList[iCut]->Add(fHistoMCPi0PtY[iCut]);
765 fHistoMCEtaPtY[iCut] = new TH2F("MC_Eta_Pt_Y","MC_Eta_Pt_Y",150,0.03,15.,150,-1.5,1.5);
766 fHistoMCEtaPtY[iCut]->Sumw2();
767 SetLogBinningXTH2(fHistoMCEtaPtY[iCut]);
768 fMCList[iCut]->Add(fHistoMCEtaPtY[iCut]);
de752898 769 fHistoMCPi0PtAlpha[iCut] = new TH2F("MC_Pi0_Pt_Alpha","MC_Pi0_Pt_Alpha",150,0.03,15.,100,0,1);
770 SetLogBinningXTH2(fHistoMCPi0PtAlpha[iCut]);
771 fMCList[iCut]->Add(fHistoMCPi0PtAlpha[iCut]);
772 fHistoMCEtaPtAlpha[iCut] = new TH2F("MC_Eta_Pt_Alpha","MC_Eta_Pt_Alpha",150,0.03,15.,100,0,1);
773 SetLogBinningXTH2(fHistoMCEtaPtAlpha[iCut]);
774 fMCList[iCut]->Add(fHistoMCEtaPtAlpha[iCut]);
775
d53bf4ac 776 fHistoMCK0sPt[iCut] = new TH1F("MC_K0s_Pt","MC_K0s_Pt",150,0,15);
777 fHistoMCK0sPt[iCut]->Sumw2();
778 fMCList[iCut]->Add(fHistoMCK0sPt[iCut]);
779 fHistoMCK0sWOWeightPt[iCut] = new TH1F("MC_K0s_WOWeights_Pt","MC_K0s_WOWeights_Pt",150,0,15);
780 fHistoMCK0sWOWeightPt[iCut]->Sumw2();
781 fMCList[iCut]->Add(fHistoMCK0sWOWeightPt[iCut]);
782 fHistoMCK0sPtY[iCut] = new TH2F("MC_K0s_Pt_Y","MC_K0s_Pt_Y",150,0.03,15.,150,-1.5,1.5);
783 fHistoMCK0sPtY[iCut]->Sumw2();
784 SetLogBinningXTH2(fHistoMCK0sPtY[iCut]);
785 fMCList[iCut]->Add(fHistoMCK0sPtY[iCut]);
786
787 fHistoMCSecPi0Source[iCut] = new TH1F("MC_SecPi0_Source","MC_SecPi0_Source",5000,0.,5000);
788 fMCList[iCut]->Add(fHistoMCSecPi0Source[iCut]);
789 fHistoMCSecEtaSource[iCut] = new TH1F("MC_SecEta_Source","MC_SecEta_Source",5000,0,5000);
790 fMCList[iCut]->Add(fHistoMCSecEtaSource[iCut]);
791 fHistoMCSecPi0PtvsSource[iCut] = new TH2F("MC_SecPi0_Pt_Source","MC_SecPi0_Pt_Source",250,0.0,25.,16,-0.5,15.5);
792 fHistoMCSecPi0PtvsSource[iCut]->Sumw2();
793 fMCList[iCut]->Add(fHistoMCSecPi0PtvsSource[iCut]);
794 fHistoMCSecEtaPt[iCut] = new TH1F("MC_SecEta_Pt","MC_SecEta_Pt",250,0,25);
795 fHistoMCSecEtaPt[iCut]->Sumw2();
796 fMCList[iCut]->Add(fHistoMCSecEtaPt[iCut]);
797 }
798
799 }
800 fTrueList[iCut] = new TList();
801 fTrueList[iCut]->SetName(Form("%s_%s_%s True histograms",cutstringEvent.Data(),cutstringCalo.Data(),cutstringMeson.Data()));
802 fTrueList[iCut]->SetOwner(kTRUE);
803 fCutFolder[iCut]->Add(fTrueList[iCut]);
804
805 fHistoClusPhotonBGPt[iCut] = new TH2F("ESD_TrueClusPhotonBG_Pt","ESD_TrueClusPhotonBG_Pt",250,0,25,9,-0.5,8.5);
806 fHistoClusPhotonBGPt[iCut]->GetYaxis()->SetBinLabel( 1,"Elec");
807 fHistoClusPhotonBGPt[iCut]->GetYaxis()->SetBinLabel( 2,"Pion");
808 fHistoClusPhotonBGPt[iCut]->GetYaxis()->SetBinLabel( 3,"Proton");
809 fHistoClusPhotonBGPt[iCut]->GetYaxis()->SetBinLabel( 4,"Kaon");
810 fHistoClusPhotonBGPt[iCut]->GetYaxis()->SetBinLabel( 5,"Neutron");
811 fHistoClusPhotonBGPt[iCut]->GetYaxis()->SetBinLabel( 6,"K0s");
812 fHistoClusPhotonBGPt[iCut]->GetYaxis()->SetBinLabel( 7,"Lambda");
813 fHistoClusPhotonBGPt[iCut]->GetYaxis()->SetBinLabel( 8,"Muon");
814 fHistoClusPhotonBGPt[iCut]->GetYaxis()->SetBinLabel(9,"Rest");
815 fTrueList[iCut]->Add(fHistoClusPhotonBGPt[iCut]);
816 fHistoClusPhotonPlusConvBGPt[iCut] = new TH2F("ESD_TrueClusPhotonPlusConvBG_Pt","ESD_TrueClusPhotonPlusConvBG_Pt",250,0,25,9,-0.5,8.5);
817 fHistoClusPhotonPlusConvBGPt[iCut]->GetYaxis()->SetBinLabel( 1,"Elec");
818 fHistoClusPhotonPlusConvBGPt[iCut]->GetYaxis()->SetBinLabel( 2,"Pion");
819 fHistoClusPhotonPlusConvBGPt[iCut]->GetYaxis()->SetBinLabel( 3,"Proton");
820 fHistoClusPhotonPlusConvBGPt[iCut]->GetYaxis()->SetBinLabel( 4,"Kaon");
821 fHistoClusPhotonPlusConvBGPt[iCut]->GetYaxis()->SetBinLabel( 5,"Neutron");
822 fHistoClusPhotonPlusConvBGPt[iCut]->GetYaxis()->SetBinLabel( 6,"K0s");
823 fHistoClusPhotonPlusConvBGPt[iCut]->GetYaxis()->SetBinLabel( 7,"Lambda");
824 fHistoClusPhotonPlusConvBGPt[iCut]->GetYaxis()->SetBinLabel( 8,"Muon");
825 fHistoClusPhotonPlusConvBGPt[iCut]->GetYaxis()->SetBinLabel(9,"Rest");
826 fTrueList[iCut]->Add(fHistoClusPhotonPlusConvBGPt[iCut]);
827
828 fHistoTrueClusGammaPt[iCut] = new TH1F("TrueClusGamma_Pt","ESD_TrueClusGamma_Pt",250,0,25);
829 fTrueList[iCut]->Add(fHistoTrueClusGammaPt[iCut]);
830 fHistoTruePrimaryClusGammaPt[iCut] = new TH1F("TruePrimaryClusGamma_Pt","ESD_TruePrimaryClusGamma_Pt",250,0,25);
831 fTrueList[iCut]->Add(fHistoTruePrimaryClusGammaPt[iCut]);
832 fHistoTruePrimaryClusGammaESDPtMCPt[iCut] = new TH2F("TruePrimaryClusGamma_Pt_MCPt","ESD_TruePrimaryClusGamma_MCPt",250,0,25,250,0,25);
833 fTrueList[iCut]->Add(fHistoTruePrimaryClusGammaESDPtMCPt[iCut]);
834 fHistoTruePrimaryClusConvGammaPt[iCut] = new TH1F("TruePrimaryClusConvGamma_Pt","ESD_TruePrimaryClusConvGamma_Pt",250,0,25);
835 fTrueList[iCut]->Add(fHistoTruePrimaryClusConvGammaPt[iCut]);
836 fHistoTruePrimaryClusConvGammaESDPtMCPt[iCut] = new TH2F("TruePrimaryClusConvGamma_Pt_MCPt","ESD_TruePrimaryClusConvGamma_MCPt",250,0,25,250,0,25);
837 fTrueList[iCut]->Add(fHistoTruePrimaryClusConvGammaESDPtMCPt[iCut]);
838 fHistoTrueSecondaryClusGammaPt[iCut] = new TH1F("ESD_TrueSecondaryClusGamma_Pt","ESD_TrueSecondaryClusGamma_Pt",250,0,25);
839 fTrueList[iCut]->Add(fHistoTrueSecondaryClusGammaPt[iCut]);
840 fHistoTrueSecondaryClusConvGammaPt[iCut] = new TH1F("ESD_TrueSecondaryClusConvGamma_Pt","ESD_TrueSecondaryClusConvGamma_Pt",250,0,25);
841 fTrueList[iCut]->Add(fHistoTrueSecondaryClusConvGammaPt[iCut]);
842
843 fHistoTrueSecondaryClusGammaFromXFromK0sPt[iCut] = new TH1F("ESD_TrueSecondaryClusGammaFromXFromK0s_Pt", "ESD_TrueSecondaryClusGammaFromXFromK0s_Pt",250,0,25);
844 fTrueList[iCut]->Add(fHistoTrueSecondaryClusGammaFromXFromK0sPt[iCut]);
845 fHistoTrueSecondaryClusConvGammaFromXFromK0sPt[iCut] = new TH1F("ESD_TrueSecondaryClusConvGammaFromXFromK0s_Pt", "ESD_TrueSecondaryClusConvGammaFromXFromK0s_Pt",250,0,25);
846 fTrueList[iCut]->Add(fHistoTrueSecondaryClusConvGammaFromXFromK0sPt[iCut]);
847 fHistoTrueSecondaryClusGammaFromXFromLambdaPt[iCut] = new TH1F("ESD_TrueSecondaryClusGammaFromXFromLambda_Pt", "ESD_TrueSecondaryClusGammaFromXFromLambda_Pt",250,0,25);
848 fTrueList[iCut]->Add(fHistoTrueSecondaryClusGammaFromXFromLambdaPt[iCut]);
849 fHistoTrueSecondaryClusConvGammaFromXFromLambdaPt[iCut] = new TH1F("ESD_TrueSecondaryClusConvGammaFromXFromLambda_Pt", "ESD_TrueSecondaryClusConvGammaFromXFromLambda_Pt",250,0,25);
850 fTrueList[iCut]->Add(fHistoTrueSecondaryClusConvGammaFromXFromLambdaPt[iCut]);
851 fHistoTrueSecondaryClusGammaFromXFromEtasPt[iCut] = new TH1F("ESD_TrueSecondaryClusGammaFromXFromEtas_Pt", "ESD_TrueSecondaryClusGammaFromXFromEtas_Pt",250,0,25);
852 fTrueList[iCut]->Add(fHistoTrueSecondaryClusGammaFromXFromEtasPt[iCut]);
853 fHistoTrueSecondaryClusConvGammaFromXFromEtasPt[iCut] = new TH1F("ESD_TrueSecondaryClusConvGammaFromXFromEtas_Pt", "ESD_TrueSecondaryClusConvGammaFromXFromEtas_Pt",250,0,25);
854 fTrueList[iCut]->Add(fHistoTrueSecondaryClusConvGammaFromXFromEtasPt[iCut]);
855
856
857 if (fDoClusterQA > 0){
858 fHistoTrueClusUnConvGammaPt[iCut] = new TH1F("TrueClusUnConvGamma_Pt","TrueClusUnConvGamma_Pt",250,0,25);
859 fTrueList[iCut]->Add(fHistoTrueClusUnConvGammaPt[iCut]);
860 fHistoTrueClusUnConvGammaMCPt[iCut] = new TH1F("TrueClusUnConvGamma_MCPt","TrueClusUnConvGamma_MCPt",250,0,25);
861 fTrueList[iCut]->Add(fHistoTrueClusUnConvGammaMCPt[iCut]);
862 fHistoTrueClusElectronPt[iCut] = new TH1F("TrueClusElectron_Pt","TrueElectronGamma_Pt",250,0,25);
863 fTrueList[iCut]->Add(fHistoTrueClusElectronPt[iCut]);
864 fHistoTrueClusConvGammaPt[iCut] = new TH1F("TrueClusConvGamma_Pt","TrueClusConvGamma_Pt",250,0,25);
865 fTrueList[iCut]->Add(fHistoTrueClusConvGammaPt[iCut]);
866 fHistoTrueClusConvGammaMCPt[iCut] = new TH1F("TrueClusConvGamma_MCPt","TrueClusConvGamma_MCPt",250,0,25);
867 fTrueList[iCut]->Add(fHistoTrueClusConvGammaMCPt[iCut]);
868 fHistoTrueClusConvGammaFullyPt[iCut] = new TH1F("TrueClusConvGammaFullyContained_Pt","TrueClusConvGammaFullyContained_Pt",250,0,25);
869 fTrueList[iCut]->Add(fHistoTrueClusConvGammaFullyPt[iCut]);
870 fHistoTrueClusMergedGammaPt[iCut] = new TH1F("TrueClusMergedGamma_Pt","TrueClusMergedGamma_Pt",250,0,25);
871 fTrueList[iCut]->Add(fHistoTrueClusMergedGammaPt[iCut]);
872 fHistoTrueClusMergedPartConvGammaPt[iCut] = new TH1F("TrueClusMergedPartConvGamma_Pt","TrueClusMergedPartConvGamma_Pt",250,0,25);
873 fTrueList[iCut]->Add(fHistoTrueClusMergedPartConvGammaPt[iCut]);
874 fHistoTrueClusDalitzPt[iCut] = new TH1F("TrueClusDalitz_Pt","TrueClusDalitz_Pt",250,0,25);
875 fTrueList[iCut]->Add(fHistoTrueClusDalitzPt[iCut]);
876 fHistoTrueClusDalitzMergedPt[iCut] = new TH1F("TrueClusDalitzMerged_Pt","TrueClusDalitzMerged_Pt",250,0,25);
877 fTrueList[iCut]->Add(fHistoTrueClusDalitzMergedPt[iCut]);
878 fHistoTrueClusPhotonFromElecMotherPt[iCut] = new TH1F("TrueClusPhotonFromElecMother_Pt","TrueClusPhotonFromElecMother_Pt",250,0,25);
879 fTrueList[iCut]->Add(fHistoTrueClusPhotonFromElecMotherPt[iCut]);
880 fHistoTrueClusShowerPt[iCut] = new TH1F("TrueClusShower_Pt","TrueClusShower_Pt",250,0,25);
881 fTrueList[iCut]->Add(fHistoTrueClusShowerPt[iCut]);
882 fHistoTrueClusSubLeadingPt[iCut] = new TH1F("TrueClusSubleading_Pt","TrueClusSubleading_Pt",250,0,25);
883 fTrueList[iCut]->Add(fHistoTrueClusSubLeadingPt[iCut]);
884 fHistoTrueClusNParticles[iCut] = new TH1I("TrueClusNParticles","TrueClusNParticles",20,0,20);
885 fTrueList[iCut]->Add(fHistoTrueClusNParticles[iCut]);
886 fHistoTrueClusEMNonLeadingPt[iCut] = new TH1F("TrueClusEMNonLeading_Pt","TrueClusEMNonLeading_Pt",250,0,25);
887 fTrueList[iCut]->Add(fHistoTrueClusEMNonLeadingPt[iCut]);
888 fHistoTrueNLabelsInClus[iCut] = new TH1F("TrueNLabelsInClus","TrueNLabelsInClus",100,-0.5,99.5);
889 fTrueList[iCut]->Add(fHistoTrueNLabelsInClus[iCut]);
890 }
891
892 if(fDoMesonAnalysis){
ed8bc1ca 893 fHistoTruePi0InvMassPt[iCut] = new TH2F("ESD_TruePi0_InvMass_Pt","ESD_TruePi0_InvMass_Pt",800,0,0.8,250,0,25);
894 fTrueList[iCut]->Add(fHistoTruePi0InvMassPt[iCut]);
895 fHistoTrueEtaInvMassPt[iCut] = new TH2F("ESD_TrueEta_InvMass_Pt","ESD_TrueEta_InvMass_Pt",800,0,0.8,250,0,25);
896 fTrueList[iCut]->Add(fHistoTrueEtaInvMassPt[iCut]);
897
898 fHistoTruePrimaryPi0InvMassPt[iCut] = new TH2F("ESD_TruePrimaryPi0_InvMass_Pt", "ESD_TruePrimaryPi0_InvMass_Pt", 800,0,0.8,250,0,25);
899 fHistoTruePrimaryPi0InvMassPt[iCut]->Sumw2();
900 fTrueList[iCut]->Add(fHistoTruePrimaryPi0InvMassPt[iCut]);
901 fHistoTruePrimaryEtaInvMassPt[iCut] = new TH2F("ESD_TruePrimaryEta_InvMass_Pt", "ESD_TruePrimaryEta_InvMass_Pt", 800,0,0.8,250,0,25);
902 fHistoTruePrimaryEtaInvMassPt[iCut]->Sumw2();
903 fTrueList[iCut]->Add(fHistoTruePrimaryEtaInvMassPt[iCut]);
904
905 fHistoTruePrimaryPi0W0WeightingInvMassPt[iCut] = new TH2F("ESD_TruePrimaryPi0W0Weights_InvMass_Pt", "ESD_TruePrimaryPi0W0Weights_InvMass_Pt", 800,0,0.8,250,0,25);
906 fHistoTruePrimaryPi0W0WeightingInvMassPt[iCut]->Sumw2();
907 fTrueList[iCut]->Add(fHistoTruePrimaryPi0W0WeightingInvMassPt[iCut]);
908 fHistoTruePrimaryEtaW0WeightingInvMassPt[iCut] = new TH2F("ESD_TruePrimaryEtaW0Weights_InvMass_Pt", "ESD_TruePrimaryEtaW0Weights_InvMass_Pt", 800,0,0.8,250,0,25);
909 fHistoTruePrimaryEtaW0WeightingInvMassPt[iCut]->Sumw2();
910 fTrueList[iCut]->Add(fHistoTruePrimaryEtaW0WeightingInvMassPt[iCut]);
911
912 fProfileTruePrimaryPi0WeightsInvMassPt[iCut] = new TProfile2D("ESD_TruePrimaryPi0Weights_InvMass_Pt", "ESD_TruePrimaryPi0Weights_InvMass_Pt", 800,0,0.8,250,0,25);
913 fProfileTruePrimaryPi0WeightsInvMassPt[iCut]->Sumw2();
914 fTrueList[iCut]->Add(fProfileTruePrimaryPi0WeightsInvMassPt[iCut]);
915 fProfileTruePrimaryEtaWeightsInvMassPt[iCut] = new TProfile2D("ESD_TruePrimaryEtaWeights_InvMass_Pt", "ESD_TruePrimaryEtaWeights_InvMass_Pt", 800,0,0.8,250,0,25);
916 fProfileTruePrimaryEtaWeightsInvMassPt[iCut]->Sumw2();
917 fTrueList[iCut]->Add(fProfileTruePrimaryEtaWeightsInvMassPt[iCut]);
918
919 fHistoTrueSecondaryPi0InvMassPt[iCut] = new TH2F("ESD_TrueSecondaryPi0_InvMass_Pt", "ESD_TrueSecondaryPi0_InvMass_Pt", 800,0,0.8,250,0,25);
920 fHistoTrueSecondaryPi0InvMassPt[iCut]->Sumw2();
921 fTrueList[iCut]->Add(fHistoTrueSecondaryPi0InvMassPt[iCut]);
922 fHistoTrueSecondaryEtaInvMassPt[iCut] = new TH2F("ESD_TrueSecondaryEta_InvMass_Pt", "ESD_TrueSecondaryEta_InvMass_Pt", 800,0,0.8,250,0,25);
923 fHistoTrueSecondaryEtaInvMassPt[iCut]->Sumw2();
924 fTrueList[iCut]->Add(fHistoTrueSecondaryEtaInvMassPt[iCut]);
925
926 fHistoTrueSecondaryPi0FromK0sInvMassPt[iCut] = new TH2F("ESD_TrueSecondaryPi0FromK0s_InvMass_Pt","ESD_TrueSecondaryPi0FromK0s_InvMass_Pt",800,0,0.8,250,0,25);
927 fHistoTrueSecondaryPi0FromK0sInvMassPt[iCut]->Sumw2();
928 fTrueList[iCut]->Add(fHistoTrueSecondaryPi0FromK0sInvMassPt[iCut]);
929 fHistoTrueSecondaryPi0FromEtaInvMassPt[iCut] = new TH2F("ESD_TrueSecondaryPi0FromEta_InvMass_Pt","ESD_TrueSecondaryPi0FromEta_InvMass_Pt",800,0,0.8,250,0,25);
930 fTrueList[iCut]->Add(fHistoTrueSecondaryPi0FromEtaInvMassPt[iCut]);
931 fHistoTrueSecondaryPi0FromLambdaInvMassPt[iCut] = new TH2F("ESD_TrueSecondaryPi0FromLambda_InvMass_Pt","ESD_TrueSecondaryPi0FromLambda_InvMass_Pt",800,0,0.8,250,0,25);
932 fTrueList[iCut]->Add(fHistoTrueSecondaryPi0FromLambdaInvMassPt[iCut]);
d53bf4ac 933 if (fDoMesonQA > 0){
ed8bc1ca 934 fHistoTruePi0CaloPhotonInvMassPt[iCut] = new TH2F("ESD_TruePi0CaloPhoton_InvMass_Pt","ESD_TruePi0CaloPhoton_InvMass_Pt",800,0,0.8,250,0,25);
935 fTrueList[iCut]->Add(fHistoTruePi0CaloPhotonInvMassPt[iCut]);
936 fHistoTrueEtaCaloPhotonInvMassPt[iCut] = new TH2F("ESD_TrueEtaCaloPhoton_InvMass_Pt","ESD_TrueEtaCaloPhoton_InvMass_Pt",800,0,0.8,250,0,25);
937 fTrueList[iCut]->Add(fHistoTrueEtaCaloPhotonInvMassPt[iCut]);
938
939 fHistoTruePi0CaloMixedPhotonConvPhotonInvMassPt[iCut] = new TH2F("ESD_TruePi0CaloMixedPhotonConvertedPhoton_InvMass_Pt","ESD_TruePi0CaloMixedPhotonConvertedPhoton_InvMass_Pt",800,0,0.8,250,0,25);
940 fTrueList[iCut]->Add(fHistoTruePi0CaloMixedPhotonConvPhotonInvMassPt[iCut]);
941 fHistoTrueEtaCaloMixedPhotonConvPhotonInvMassPt[iCut] = new TH2F("ESD_TrueEtaCaloMixedPhotonConvertedPhoton_InvMass_Pt","ESD_TrueEtaCaloMixedPhotonConvertedPhoton_InvMass_Pt",800,0,0.8,250,0,25);
942 fTrueList[iCut]->Add(fHistoTrueEtaCaloMixedPhotonConvPhotonInvMassPt[iCut]);
d53bf4ac 943
944 fHistoTruePi0CaloConvertedPhotonInvMassPt[iCut] = new TH2F("ESD_TruePi0CaloConvertedPhoton_InvMass_Pt","ESD_TruePi0CaloConvertedPhoton_InvMass_Pt",800,0,0.8,250,0,25);
945 fTrueList[iCut]->Add(fHistoTruePi0CaloConvertedPhotonInvMassPt[iCut]);
d53bf4ac 946 fHistoTrueEtaCaloConvertedPhotonInvMassPt[iCut] = new TH2F("ESD_TrueEtaCaloConvertedPhoton_InvMass_Pt","ESD_TrueEtaCaloConvertedPhoton_InvMass_Pt",800,0,0.8,250,0,25);
947 fTrueList[iCut]->Add(fHistoTrueEtaCaloConvertedPhotonInvMassPt[iCut]);
948
ed8bc1ca 949 fHistoTruePi0CaloElectronInvMassPt[iCut] = new TH2F("ESD_TruePi0CaloElectron_InvMass_Pt","ESD_TruePi0CaloElectron_InvMass_Pt",800,0,0.8,250,0,25);
950 fTrueList[iCut]->Add(fHistoTruePi0CaloElectronInvMassPt[iCut]);
951 fHistoTrueEtaCaloElectronInvMassPt[iCut] = new TH2F("ESD_TrueEtaCaloElectron_InvMass_Pt","ESD_TrueEtaCaloElectron_InvMass_Pt",800,0,0.8,250,0,25);
952 fTrueList[iCut]->Add(fHistoTrueEtaCaloElectronInvMassPt[iCut]);
953
954 fHistoTruePi0CaloMergedClusterInvMassPt[iCut] = new TH2F("ESD_TruePi0CaloMergedCluster_InvMass_Pt","ESD_TruePi0CaloMergedCluster_InvMass_Pt",800,0,0.8,250,0,25);
955 fTrueList[iCut]->Add(fHistoTruePi0CaloMergedClusterInvMassPt[iCut]);
956 fHistoTrueEtaCaloMergedClusterInvMassPt[iCut] = new TH2F("ESD_TrueEtaCaloMergedCluster_InvMass_Pt","ESD_TrueEtaCaloMergedCluster_InvMass_Pt",800,0,0.8,250,0,25);
957 fTrueList[iCut]->Add(fHistoTrueEtaCaloMergedClusterInvMassPt[iCut]);
958
959 fHistoTruePi0CaloMergedClusterPartConvInvMassPt[iCut] = new TH2F("ESD_TruePi0CaloMergedClusterPartConv_InvMass_Pt","ESD_TruePi0CaloMergedClusterPartConv_InvMass_Pt",800,0,0.8,250,0,25);
960 fTrueList[iCut]->Add(fHistoTruePi0CaloMergedClusterPartConvInvMassPt[iCut]);
961 fHistoTrueEtaCaloMergedClusterPartConvInvMassPt[iCut] = new TH2F("ESD_TrueEtaCaloMergedClusterPartConv_InvMass_Pt","ESD_TrueEtaCaloMergedClusterPartConv_InvMass_Pt",800,0,0.8,250,0,25);
962 fTrueList[iCut]->Add(fHistoTrueEtaCaloMergedClusterPartConvInvMassPt[iCut]);
963
def90c8b 964 fHistoTruePi0NonMergedElectronPhotonInvMassPt[iCut] = new TH2F("ESD_TruePi0NonMergedElectronPhoton_InvMass_Pt","ESD_TruePi0NonMergedElectronPhoton_InvMass_Pt",800,0,0.8,250,0,25);
965 fTrueList[iCut]->Add(fHistoTruePi0NonMergedElectronPhotonInvMassPt[iCut]);
966 fHistoTruePi0NonMergedElectronMergedPhotonInvMassPt[iCut] = new TH2F("ESD_TruePi0NonMergedElectronMergedPhoton_InvMass_Pt","ESD_TruePi0NonMergedElectronMergedPhoton_InvMass_Pt",800,0,0.8,250,0,25);
967 fTrueList[iCut]->Add(fHistoTruePi0NonMergedElectronMergedPhotonInvMassPt[iCut]);
d53bf4ac 968
969 fHistoTruePrimaryPi0MCPtResolPt[iCut] = new TH2F("ESD_TruePrimaryPi0_MCPt_ResolPt","ESD_TruePrimaryPi0_ResolPt_MCPt",500,0.03,25,1000,-1.,1.);
970 fHistoTruePrimaryPi0MCPtResolPt[iCut]->Sumw2();
971 SetLogBinningXTH2(fHistoTruePrimaryPi0MCPtResolPt[iCut]);
972 fTrueList[iCut]->Add(fHistoTruePrimaryPi0MCPtResolPt[iCut]);
973 fHistoTruePrimaryEtaMCPtResolPt[iCut] = new TH2F("ESD_TruePrimaryEta_MCPt_ResolPt","ESD_TruePrimaryEta_ResolPt_MCPt",500,0.03,25,1000,-1.,1.);
974 fHistoTruePrimaryEtaMCPtResolPt[iCut]->Sumw2();
975 SetLogBinningXTH2(fHistoTruePrimaryEtaMCPtResolPt[iCut]);
976 fTrueList[iCut]->Add(fHistoTruePrimaryEtaMCPtResolPt[iCut]);
977 fHistoTrueBckGGInvMassPt[iCut] = new TH2F("ESD_TrueBckGG_InvMass_Pt","ESD_TrueBckGG_InvMass_Pt",800,0,0.8,250,0,25);
978 fTrueList[iCut]->Add(fHistoTrueBckGGInvMassPt[iCut]);
979 fHistoTrueBckContInvMassPt[iCut] = new TH2F("ESD_TrueBckCont_InvMass_Pt","ESD_TrueBckCont_InvMass_Pt",800,0,0.8,250,0,25);
980 fTrueList[iCut]->Add(fHistoTrueBckContInvMassPt[iCut]);
981 fHistoTrueK0sWithPi0DaughterMCPt[iCut] = new TH1F("ESD_TrueK0sWithPi0Daughter_MCPt","ESD_TrueK0sWithPi0Daughter_MCPt",250,0,25);
982 fTrueList[iCut]->Add(fHistoTrueK0sWithPi0DaughterMCPt[iCut]);
983 fHistoTrueEtaWithPi0DaughterMCPt[iCut] = new TH1F("ESD_TrueEtaWithPi0Daughter_MCPt","ESD_TrueEtaWithPi0Daughter_MCPt",250,0,25);
984 fTrueList[iCut]->Add(fHistoTrueEtaWithPi0DaughterMCPt[iCut]);
985 fHistoTrueLambdaWithPi0DaughterMCPt[iCut] = new TH1F("ESD_TrueLambdaWithPi0Daughter_MCPt","ESD_TrueLambdaWithPi0Daughter_MCPt",250,0,25);
986 fTrueList[iCut]->Add(fHistoTrueLambdaWithPi0DaughterMCPt[iCut]);
987
988 fHistoTruePi0PtY[iCut] = new TH2F("ESD_TruePi0_Pt_Y","ESD_TruePi0_Pt_Y",150,0.03,15.,150,-1.5,1.5);
989 SetLogBinningXTH2(fHistoTruePi0PtY[iCut]);
990 fTrueList[iCut]->Add(fHistoTruePi0PtY[iCut]);
991 fHistoTrueEtaPtY[iCut] = new TH2F("ESD_TrueEta_Pt_Y","ESD_TrueEta_Pt_Y",150,0.03,15.,150,-1.5,1.5);
992 SetLogBinningXTH2(fHistoTrueEtaPtY[iCut]);
993 fTrueList[iCut]->Add(fHistoTrueEtaPtY[iCut]);
994 fHistoTruePi0PtAlpha[iCut] = new TH2F("ESD_TruePi0_Pt_Alpha","ESD_TruePi0_Pt_Alpha",150,0.03,15.,100,0,1);
995 SetLogBinningXTH2(fHistoTruePi0PtAlpha[iCut]);
996 fTrueList[iCut]->Add(fHistoTruePi0PtAlpha[iCut]);
997 fHistoTrueEtaPtAlpha[iCut] = new TH2F("ESD_TrueEta_Pt_Alpha","ESD_TrueEta_Pt_Alpha",150,0.03,15.,100,0,1);
998 SetLogBinningXTH2(fHistoTrueEtaPtAlpha[iCut]);
999 fTrueList[iCut]->Add(fHistoTrueEtaPtAlpha[iCut]);
1000
1001 fHistoTruePi0PtOpenAngle[iCut] = new TH2F("ESD_TruePi0_Pt_OpenAngle","ESD_TruePi0_Pt_OpenAngle",150,0.03,15.,200,0,2*TMath::Pi());
1002 SetLogBinningXTH2(fHistoTruePi0PtOpenAngle[iCut]);
1003 fTrueList[iCut]->Add(fHistoTruePi0PtOpenAngle[iCut]);
1004 fHistoTrueEtaPtOpenAngle[iCut] = new TH2F("ESD_TrueEta_Pt_OpenAngle","ESD_TrueEta_Pt_OpenAngle",150,0.03,15.,200,0,2*TMath::Pi());
1005 SetLogBinningXTH2(fHistoTrueEtaPtOpenAngle[iCut]);
1006 fTrueList[iCut]->Add(fHistoTrueEtaPtOpenAngle[iCut]);
1007 }
1008 }
1009 }
1010 }
1011
1012 fV0Reader=(AliV0ReaderV1*)AliAnalysisManager::GetAnalysisManager()->GetTask("V0ReaderV1");
1013 if(!fV0Reader){printf("Error: No V0 Reader");return;} // GetV0Reader
1014
1015 if(fV0Reader)
1016 if((AliConversionPhotonCuts*)fV0Reader->GetConversionCuts())
1017 if(((AliConversionPhotonCuts*)fV0Reader->GetConversionCuts())->GetCutHistograms())
1018 fOutputContainer->Add(((AliConversionPhotonCuts*)fV0Reader->GetConversionCuts())->GetCutHistograms());
1019 if(fV0Reader)
1020 if((AliConvEventCuts*)fV0Reader->GetEventCuts())
1021 if(((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetCutHistograms())
1022 fOutputContainer->Add(((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetCutHistograms());
1023
1024
1025 for(Int_t iCut = 0; iCut<fnCuts;iCut++){
1026 if(!((AliConvEventCuts*)fEventCutArray->At(iCut))) continue;
1027 if(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutHistograms()){
1028 fCutFolder[iCut]->Add(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutHistograms());
1029 }
1030 if(!((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))) continue;
1031 if(((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetCutHistograms()){
1032 fCutFolder[iCut]->Add(((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetCutHistograms());
1033 }
1034 if(fDoMesonAnalysis){
1035 if(!((AliConversionMesonCuts*)fMesonCutArray->At(iCut))) continue;
1036 if(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutHistograms()){
1037 fCutFolder[iCut]->Add(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutHistograms());
1038 }
1039 }
1040 }
1041 PostData(1, fOutputContainer);
1042}
1043//_____________________________________________________________________________
1044Bool_t AliAnalysisTaskGammaCalo::Notify()
1045{
1046 for(Int_t iCut = 0; iCut<fnCuts;iCut++){
1047 if(!((AliConvEventCuts*)fEventCutArray->At(iCut))->GetDoEtaShift()){
1048 fProfileEtaShift[iCut]->Fill(0.,(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift()));
1049 continue; // No Eta Shift requested, continue
1050 }
1051 if(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift() == 0.0){ // Eta Shift requested but not set, get shift automatically
1052 ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCorrectEtaShiftFromPeriod(fV0Reader->GetPeriodName());
1053 fProfileEtaShift[iCut]->Fill(0.,(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift()));
1054 ((AliConvEventCuts*)fEventCutArray->At(iCut))->DoEtaShift(kFALSE); // Eta Shift Set, make sure that it is called only once
1055 continue;
1056 }
1057 else{
1058 printf(" Gamma Conversion Task %s :: Eta Shift Manually Set to %f \n\n",
1059 (((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber()).Data(),((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift());
1060 fProfileEtaShift[iCut]->Fill(0.,(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift()));
1061 ((AliConvEventCuts*)fEventCutArray->At(iCut))->DoEtaShift(kFALSE); // Eta Shift Set, make sure that it is called only once
1062 }
1063 }
1064
1065 return kTRUE;
1066}
1067//_____________________________________________________________________________
1068void AliAnalysisTaskGammaCalo::UserExec(Option_t *)
1069{
1070 //
1071 // Called for each event
1072 //
1073 Int_t eventQuality = ((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetEventQuality();
1074 if(eventQuality == 2 || eventQuality == 3){// Event Not Accepted due to MC event missing or wrong trigger for V0ReaderV1
1075 for(Int_t iCut = 0; iCut<fnCuts; iCut++){
1076 fHistoNEvents[iCut]->Fill(eventQuality);
1077 }
1078 return;
1079 }
1080
1081 if(fIsMC) fMCEvent = MCEvent();
1082 if(fMCEvent == NULL) fIsMC = kFALSE;
1083
1084 fInputEvent = InputEvent();
1085
1086 if(fIsMC && fInputEvent->IsA()==AliESDEvent::Class()){
1087 fMCStack = fMCEvent->Stack();
1088 if(fMCStack == NULL) fIsMC = kFALSE;
1089 }
1090
1091 // ------------------- BeginEvent ----------------------------
1092
1093 AliEventplane *EventPlane = fInputEvent->GetEventplane();
1094 if(fIsHeavyIon ==1)fEventPlaneAngle = EventPlane->GetEventplane("V0",fInputEvent,2);
1095 else fEventPlaneAngle=0.0;
1096
1097 for(Int_t iCut = 0; iCut<fnCuts; iCut++){
1098
1099 fiCut = iCut;
1100 Int_t eventNotAccepted = ((AliConvEventCuts*)fEventCutArray->At(iCut))->IsEventAcceptedByCut(fV0Reader->GetEventCuts(),fInputEvent,fMCEvent,fIsHeavyIon);
1101
1102 if(eventNotAccepted){
1103 // cout << "event rejected due to wrong trigger: " <<eventNotAccepted << endl;
1104 fHistoNEvents[iCut]->Fill(eventNotAccepted); // Check Centrality, PileUp, SDD and V0AND --> Not Accepted => eventQuality = 1
1105 continue;
1106 }
1107
1108 if(eventQuality != 0){// Event Not Accepted
1109 //cout << "event rejected due to: " <<eventQuality << endl;
1110 fHistoNEvents[iCut]->Fill(eventQuality);
1111 continue;
1112 }
1113
1114 fHistoNEvents[iCut]->Fill(eventQuality); // Should be 0 here
1115 fHistoNGoodESDTracks[iCut]->Fill(fV0Reader->GetNumberOfPrimaryTracks());
1116 if(((AliConvEventCuts*)fEventCutArray->At(iCut))->IsHeavyIon() == 2) fHistoNV0Tracks[iCut]->Fill(fInputEvent->GetVZEROData()->GetMTotV0A());
1117 else fHistoNV0Tracks[iCut]->Fill(fInputEvent->GetVZEROData()->GetMTotV0A()+fInputEvent->GetVZEROData()->GetMTotV0C());
1118
1119 if(fIsMC){
1120 // Process MC Particle
1121 if(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetSignalRejection() != 0){
1122 if(fInputEvent->IsA()==AliESDEvent::Class()){
1123 ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetNotRejectedParticles(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetSignalRejection(),
1124 ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetAcceptedHeader(),
1125 fMCEvent);
1126 }
1127 else if(fInputEvent->IsA()==AliAODEvent::Class()){
1128 ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetNotRejectedParticles(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetSignalRejection(),
1129 ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetAcceptedHeader(),
1130 fInputEvent);
1131 }
1132
1133 if(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetAcceptedHeader()){
1134 for(Int_t i = 0;i<(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetAcceptedHeader())->GetEntries();i++){
1135 TString nameBin= fHistoMCHeaders[iCut]->GetXaxis()->GetBinLabel(i+1);
1136 if (nameBin.CompareTo("")== 0){
1137 TString nameHeader = ((TObjString*)((TList*)((AliConvEventCuts*)fEventCutArray->At(iCut))
1138 ->GetAcceptedHeader())->At(i))->GetString();
1139 fHistoMCHeaders[iCut]->GetXaxis()->SetBinLabel(i+1,nameHeader.Data());
1140 }
1141 }
1142 }
1143 }
1144 }
1145 if(fIsMC){
1146 if(fInputEvent->IsA()==AliESDEvent::Class())
1147 ProcessMCParticles();
1148 if(fInputEvent->IsA()==AliAODEvent::Class())
1149 ProcessAODMCParticles();
1150 }
1151
1152 // 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)
1153 ProcessClusters(); // process calo clusters
1154
1155 fHistoNGammaCandidates[iCut]->Fill(fClusterCandidates->GetEntries());
1156 fHistoNGoodESDTracksVsNGammaCanditates[iCut]->Fill(fV0Reader->GetNumberOfPrimaryTracks(),fClusterCandidates->GetEntries());
1157 if(fDoMesonAnalysis){ // Meson Analysis
1158
1159 CalculatePi0Candidates(); // Combine Gammas from conversion and from calo
1160
1161 if(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->DoBGCalculation()){
1162 if(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->BackgroundHandlerType() == 0){
1163 CalculateBackground(); // Combinatorial Background
1164 UpdateEventByEventData(); // Store Event for mixed Events
1165 }
1166
1167 }
1168 }
1169
1170 fClusterCandidates->Clear(); // delete cluster candidates
1171 }
1172
1173 PostData(1, fOutputContainer);
1174}
1175
1176//________________________________________________________________________
1177void AliAnalysisTaskGammaCalo::ProcessClusters()
1178{
1179
1180 Int_t nclus = 0;
1181 nclus = fInputEvent->GetNumberOfCaloClusters();
1182
1183// cout << nclus << endl;
1184
1185 if(nclus == 0) return;
1186
1187 // vertex
1188 Double_t vertex[3] = {0};
1189 InputEvent()->GetPrimaryVertex()->GetXYZ(vertex);
1190
1191 // Loop over EMCal clusters
1192 for(Long_t i = 0; i < nclus; i++){
1193
1194 AliVCluster* clus = NULL;
1195 clus = fInputEvent->GetCaloCluster(i);
1196 if (!clus) continue;
1197 if(!((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelected(clus,fInputEvent,fIsMC)) continue;
1198 // TLorentzvector with cluster
1199 TLorentzVector clusterVector;
1200 clus->GetMomentum(clusterVector,vertex);
1201
1202 TLorentzVector* tmpvec = new TLorentzVector();
1203 tmpvec->SetPxPyPzE(clusterVector.Px(),clusterVector.Py(),clusterVector.Pz(),clusterVector.E());
1204
1205 // convert to AODConversionPhoton
1206 AliAODConversionPhoton *PhotonCandidate=new AliAODConversionPhoton(tmpvec);
1207 if(!PhotonCandidate) continue;
1208
1209 // Flag Photon as CaloPhoton
1210 PhotonCandidate->SetIsCaloPhoton();
1211 PhotonCandidate->SetCaloClusterRef(i);
1212 // get MC label
1213 if(fIsMC){
1214 Int_t* mclabelsCluster = clus->GetLabels();
1215 PhotonCandidate->SetNCaloPhotonMCLabels(clus->GetNLabels());
1216// cout << clus->GetNLabels() << endl;
1217 if (clus->GetNLabels()>0){
1218 for (Int_t k =0; k< (Int_t)clus->GetNLabels(); k++){
1219 if (k< 20)PhotonCandidate->SetCaloPhotonMCLabel(k,mclabelsCluster[k]);
1220// Int_t pdgCode = fMCStack->Particle(mclabelsCluster[k])->GetPdgCode();
1221// cout << "label " << k << "\t" << mclabelsCluster[k] << " pdg code: " << pdgCode << endl;
1222 }
1223 }
1224 }
1225
1226 fIsFromMBHeader = kTRUE;
1227 // test whether largest contribution to cluster orginates in added signals
1228 if (fIsMC && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(PhotonCandidate->GetCaloPhotonMCLabel(0), fMCStack, fInputEvent) == 0) fIsFromMBHeader = kFALSE;
1229
1230 if (fIsFromMBHeader)fHistoClusGammaPt[fiCut]->Fill(PhotonCandidate->Pt());
1231 fClusterCandidates->Add(PhotonCandidate); // if no second loop is required add to events good gammas
1232
1233 if(fIsMC){
1234 if(fInputEvent->IsA()==AliESDEvent::Class()){
1235 ProcessTrueClusterCandidates(PhotonCandidate);
1236 } else {
1237 ProcessTrueClusterCandidatesAOD(PhotonCandidate);
1238 }
1239 }
1240
1241 delete tmpvec;
1242 }
1243
1244}
1245
1246//________________________________________________________________________
1247void AliAnalysisTaskGammaCalo::ProcessTrueClusterCandidates(AliAODConversionPhoton *TruePhotonCandidate)
1248{
1249
1250 TParticle *Photon = NULL;
1251 if (!TruePhotonCandidate->GetIsCaloPhoton()) AliFatal("CaloPhotonFlag has not been set task will abort");
d404157c 1252 if (fDoClusterQA > 0) fHistoTrueNLabelsInClus[fiCut]->Fill(TruePhotonCandidate->GetNCaloPhotonMCLabels());
d53bf4ac 1253
1254 if (TruePhotonCandidate->GetNCaloPhotonMCLabels()>0)Photon = fMCStack->Particle(TruePhotonCandidate->GetCaloPhotonMCLabel(0));
1255 else return;
1256
1257 if(Photon == NULL){
1258 // cout << "no photon" << endl;
1259 return;
1260 }
1261
1262 Int_t pdgCodeParticle = Photon->GetPdgCode();
1263 TruePhotonCandidate->SetCaloPhotonMCFlags(fMCStack);
1264
1265 // True Photon
1266 if(fIsFromMBHeader){
1267 if (TruePhotonCandidate->IsLargestComponentPhoton() || TruePhotonCandidate->IsLargestComponentElectron() )fHistoTrueClusGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1268 else fHistoTrueClusEMNonLeadingPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1269 if (fDoClusterQA > 0){
1270 if (TruePhotonCandidate->IsLargestComponentPhoton()){
1271 fHistoTrueClusUnConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1272 fHistoTrueClusUnConvGammaMCPt[fiCut]->Fill(Photon->Pt());
1273 }
1274 if (TruePhotonCandidate->IsLargestComponentElectron())
1275 fHistoTrueClusElectronPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1276 if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion()){
1277 fHistoTrueClusConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1278 fHistoTrueClusConvGammaMCPt[fiCut]->Fill(((TParticle*)fMCStack->Particle(Photon->GetMother(0)))->Pt());
1279 }
1280 if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion() && TruePhotonCandidate->IsConversionFullyContained())
1281 fHistoTrueClusConvGammaFullyPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1282 if (TruePhotonCandidate->IsMerged() || TruePhotonCandidate->IsMergedPartConv() || TruePhotonCandidate->IsDalitzMerged())
1283 fHistoTrueClusMergedGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1284 if (TruePhotonCandidate->IsMergedPartConv())
1285 fHistoTrueClusMergedPartConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1286 if (TruePhotonCandidate->IsDalitz())
1287 fHistoTrueClusDalitzPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1288 if (TruePhotonCandidate->IsDalitzMerged())
1289 fHistoTrueClusDalitzMergedPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1290 if (TruePhotonCandidate->IsPhotonWithElecMother())
1291 fHistoTrueClusPhotonFromElecMotherPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1292 if (TruePhotonCandidate->IsShower())
1293 fHistoTrueClusShowerPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1294 if (TruePhotonCandidate->IsSubLeadingEM())
1295 fHistoTrueClusSubLeadingPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1296 fHistoTrueClusNParticles[fiCut]->Fill(TruePhotonCandidate->GetNCaloPhotonMotherMCLabels());
1297 if (!TruePhotonCandidate->IsLargestComponentPhoton())
1298 FillPhotonBackgroundHist(TruePhotonCandidate,pdgCodeParticle);
1299 if (!(TruePhotonCandidate->IsLargestComponentPhoton() || (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion())) )
1300 FillPhotonPlusConversionBackgroundHist(TruePhotonCandidate,pdgCodeParticle);
1301 }
1302
1303 if(Photon->GetMother(0) <= fMCStack->GetNprimary()){
1304 if (TruePhotonCandidate->IsLargestComponentPhoton()){
1305 fHistoTruePrimaryClusGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1306 fHistoTruePrimaryClusGammaESDPtMCPt[fiCut]->Fill(TruePhotonCandidate->Pt(),Photon->Pt()); // Allways Filled
1307 }
1308 if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion()){
1309 fHistoTruePrimaryClusConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1310 fHistoTruePrimaryClusConvGammaESDPtMCPt[fiCut]->Fill(TruePhotonCandidate->Pt(),Photon->Pt()); // Allways Filled
1311 }
1312
1313 } else {
1314 if (TruePhotonCandidate->IsLargestComponentPhoton())
1315 fHistoTrueSecondaryClusGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1316 if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion())
1317 fHistoTrueSecondaryClusConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1318 if(fMCStack->Particle(Photon->GetMother(0))->GetMother(0) > -1){
1319 if(fMCStack->Particle(fMCStack->Particle(Photon->GetMother(0))->GetMother(0))->GetPdgCode() == 3122){
1320 if (TruePhotonCandidate->IsLargestComponentPhoton())
1321 fHistoTrueSecondaryClusGammaFromXFromLambdaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1322 if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion())
1323 fHistoTrueSecondaryClusConvGammaFromXFromLambdaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1324 }
1325 if(fMCStack->Particle(fMCStack->Particle(Photon->GetMother(0))->GetMother(0))->GetPdgCode() == 310){
1326 if (TruePhotonCandidate->IsLargestComponentPhoton())
1327 fHistoTrueSecondaryClusGammaFromXFromK0sPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1328 if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion())
1329 fHistoTrueSecondaryClusConvGammaFromXFromK0sPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1330 }
1331 if(fMCStack->Particle(fMCStack->Particle(Photon->GetMother(0))->GetMother(0))->GetPdgCode() == 221){
1332 if (TruePhotonCandidate->IsLargestComponentPhoton())
1333 fHistoTrueSecondaryClusGammaFromXFromEtasPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1334 if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion())
1335 fHistoTrueSecondaryClusConvGammaFromXFromEtasPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1336
1337 }
1338 }
1339 }
1340 }
1341 return;
1342}
1343
1344
1345//________________________________________________________________________
1346void AliAnalysisTaskGammaCalo::ProcessTrueClusterCandidatesAOD(AliAODConversionPhoton *TruePhotonCandidate)
1347{
1348 AliAODMCParticle *Photon = NULL;
1349 TClonesArray *AODMCTrackArray = dynamic_cast<TClonesArray*>(fInputEvent->FindListObject(AliAODMCParticle::StdBranchName()));
d404157c 1350 if (fDoClusterQA > 0) fHistoTrueNLabelsInClus[fiCut]->Fill(TruePhotonCandidate->GetNCaloPhotonMCLabels());
d53bf4ac 1351 if (AODMCTrackArray){
1352 if (!TruePhotonCandidate->GetIsCaloPhoton()) AliFatal("CaloPhotonFlag has not been set task will abort");
1353 if (TruePhotonCandidate->GetNCaloPhotonMCLabels()>0) Photon = (AliAODMCParticle*) AODMCTrackArray->At(TruePhotonCandidate->GetCaloPhotonMCLabel(0));
1354 else return;
1355 } else {
1356 AliInfo("AODMCTrackArray could not be loaded");
1357 return;
1358 }
1359
1360 if(Photon == NULL){
1361 // cout << "no photon" << endl;
1362 return;
1363 }
1364 Int_t pdgCodeParticle = Photon->GetPdgCode();
1365 TruePhotonCandidate->SetCaloPhotonMCFlagsAOD(fInputEvent);
1366
1367 // True Photon
1368 if(fIsFromMBHeader){
1369 if (TruePhotonCandidate->IsLargestComponentPhoton() || TruePhotonCandidate->IsLargestComponentElectron() )fHistoTrueClusGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1370 else fHistoTrueClusEMNonLeadingPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1371 if (fDoClusterQA > 0){
1372 if (TruePhotonCandidate->IsLargestComponentPhoton()) {
1373 fHistoTrueClusUnConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1374 fHistoTrueClusUnConvGammaMCPt[fiCut]->Fill(Photon->Pt());
1375 }
1376 if (TruePhotonCandidate->IsLargestComponentElectron())
1377 fHistoTrueClusElectronPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1378 if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion()) {
1379 fHistoTrueClusConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1380 AliAODMCParticle *Mother = (AliAODMCParticle*) AODMCTrackArray->At(Photon->GetMother());
1381 fHistoTrueClusConvGammaMCPt[fiCut]->Fill(Mother->Pt());
1382 }
1383 if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion() && TruePhotonCandidate->IsConversionFullyContained())
1384 fHistoTrueClusConvGammaFullyPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1385 if (TruePhotonCandidate->IsMerged() || TruePhotonCandidate->IsMergedPartConv() || TruePhotonCandidate->IsDalitzMerged())
1386 fHistoTrueClusMergedGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1387 if (TruePhotonCandidate->IsMergedPartConv())
1388 fHistoTrueClusMergedPartConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1389 if (TruePhotonCandidate->IsDalitz())
1390 fHistoTrueClusDalitzPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1391 if (TruePhotonCandidate->IsDalitzMerged())
1392 fHistoTrueClusDalitzMergedPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1393 if (TruePhotonCandidate->IsPhotonWithElecMother())
1394 fHistoTrueClusPhotonFromElecMotherPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1395 if (TruePhotonCandidate->IsShower())
1396 fHistoTrueClusShowerPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1397 if (TruePhotonCandidate->IsSubLeadingEM())
1398 fHistoTrueClusSubLeadingPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1399 fHistoTrueClusNParticles[fiCut]->Fill(TruePhotonCandidate->GetNCaloPhotonMotherMCLabels());
1400
1401 if (!TruePhotonCandidate->IsLargestComponentPhoton())
1402 FillPhotonBackgroundHist(TruePhotonCandidate,pdgCodeParticle);
1403 if (!(TruePhotonCandidate->IsLargestComponentPhoton() || (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion())) )
1404 FillPhotonPlusConversionBackgroundHist(TruePhotonCandidate,pdgCodeParticle);
1405 }
1406
1407 if(Photon->IsPrimary()){
1408 if (TruePhotonCandidate->IsLargestComponentPhoton()){
1409 fHistoTruePrimaryClusGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1410 fHistoTruePrimaryClusGammaESDPtMCPt[fiCut]->Fill(TruePhotonCandidate->Pt(),Photon->Pt()); // Allways Filled
1411 }
1412 if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion()){
1413 fHistoTruePrimaryClusConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1414 fHistoTruePrimaryClusConvGammaESDPtMCPt[fiCut]->Fill(TruePhotonCandidate->Pt(),Photon->Pt()); // Allways Filled
1415 }
1416
1417 } else {
1418 if (TruePhotonCandidate->IsLargestComponentPhoton())
1419 fHistoTrueSecondaryClusGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1420 if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion())
1421 fHistoTrueSecondaryClusConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1422 if(((AliAODMCParticle*)AODMCTrackArray->At(Photon->GetMother()))->GetMother() > -1){
1423 if(((AliAODMCParticle*)AODMCTrackArray->At(((AliAODMCParticle*)AODMCTrackArray->At(Photon->GetMother()))->GetMother()))->GetPdgCode() == 3122){
1424 if (TruePhotonCandidate->IsLargestComponentPhoton())
1425 fHistoTrueSecondaryClusGammaFromXFromLambdaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1426 if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion())
1427 fHistoTrueSecondaryClusConvGammaFromXFromLambdaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1428 }
1429 if(((AliAODMCParticle*)AODMCTrackArray->At(((AliAODMCParticle*)AODMCTrackArray->At(Photon->GetMother()))->GetMother()))->GetPdgCode() == 310){
1430 if (TruePhotonCandidate->IsLargestComponentPhoton())
1431 fHistoTrueSecondaryClusGammaFromXFromK0sPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1432 if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion())
1433 fHistoTrueSecondaryClusConvGammaFromXFromK0sPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1434 }
1435 if(((AliAODMCParticle*)AODMCTrackArray->At(((AliAODMCParticle*)AODMCTrackArray->At(Photon->GetMother()))->GetMother()))->GetPdgCode() == 221){
1436 if (TruePhotonCandidate->IsLargestComponentPhoton())
1437 fHistoTrueSecondaryClusGammaFromXFromEtasPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1438 if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion())
1439 fHistoTrueSecondaryClusConvGammaFromXFromEtasPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1440
1441 }
1442 }
1443 }
1444 }
1445}
1446
1447//________________________________________________________________________
1448void AliAnalysisTaskGammaCalo::ProcessAODMCParticles()
1449{
1450
1451 TClonesArray *AODMCTrackArray = dynamic_cast<TClonesArray*>(fInputEvent->FindListObject(AliAODMCParticle::StdBranchName()));
1452
1453 // Loop over all primary MC particle
1454 for(Int_t i = 0; i < AODMCTrackArray->GetEntriesFast(); i++) {
1455
1456 AliAODMCParticle* particle = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(i));
1457 if (!particle) continue;
1458 if (!particle->IsPrimary()) continue;
1459
1460 Int_t isMCFromMBHeader = -1;
1461 if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 0){
1462 isMCFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCStack, fInputEvent);
1463 if(isMCFromMBHeader == 0 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 3) continue;
1464 }
1465
1466 if(((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedAODMC(particle,AODMCTrackArray)){
1467 fHistoMCAllGammaPt[fiCut]->Fill(particle->Pt()); // All MC Gamma
1468 if(particle->GetMother() >-1){ // Meson Decay Gamma
1469 switch((static_cast<AliAODMCParticle*>(AODMCTrackArray->At(particle->GetMother())))->GetPdgCode()){
1470 case 111: // Pi0
1471 fHistoMCDecayGammaPi0Pt[fiCut]->Fill(particle->Pt());
1472 break;
1473 case 113: // Rho0
1474 fHistoMCDecayGammaRhoPt[fiCut]->Fill(particle->Pt());
1475 break;
1476 case 221: // Eta
1477 fHistoMCDecayGammaEtaPt[fiCut]->Fill(particle->Pt());
1478 break;
1479 case 223: // Omega
1480 fHistoMCDecayGammaOmegaPt[fiCut]->Fill(particle->Pt());
1481 break;
1482 case 331: // Eta'
1483 fHistoMCDecayGammaEtapPt[fiCut]->Fill(particle->Pt());
1484 break;
1485 case 333: // Phi
1486 fHistoMCDecayGammaPhiPt[fiCut]->Fill(particle->Pt());
1487 break;
1488 case 3212: // Sigma
1489 fHistoMCDecayGammaSigmaPt[fiCut]->Fill(particle->Pt());
1490 break;
1491 }
1492 }
1493 }
de752898 1494 // Converted MC Gamma
d53bf4ac 1495 if(fDoMesonAnalysis){
1496 if(particle->GetPdgCode() == 310 && fDoMesonQA > 0){
1497 Double_t mesonY = 10.;
1498 if(particle->E() - particle->Pz() == 0 || particle->E() + particle->Pz() == 0){
1499 mesonY=10.-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
1500 } else {
1501 mesonY = 0.5*(TMath::Log((particle->E()+particle->Pz()) / (particle->E()-particle->Pz())))-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
1502 }
1503 Float_t weightedK0s= 1;
1504 if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCStack, fInputEvent)){
1505 if (particle->Pt()>0.005){
1506 weightedK0s= ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetWeightForMeson(fV0Reader->GetPeriodName(),i, 0x0, fInputEvent);
1507 //cout << "MC input \t"<<i << "\t" << particle->Pt()<<"\t"<<weighted << endl;
1508 }
1509 }
1510 fHistoMCK0sPt[fiCut]->Fill(particle->Pt(),weightedK0s);
1511 fHistoMCK0sWOWeightPt[fiCut]->Fill(particle->Pt());
1512 fHistoMCK0sPtY[fiCut]->Fill(particle->Pt(),mesonY,weightedK0s);
1513 }
1514 if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))
1515 ->MesonIsSelectedAODMC(particle,AODMCTrackArray,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift())){
1516 AliAODMCParticle* daughter0 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(particle->GetDaughter(0)));
1517 AliAODMCParticle* daughter1 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(particle->GetDaughter(1)));
1518 Float_t weighted= 1;
1519 if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCStack, fInputEvent)){
1520 if (particle->Pt()>0.005){
1521 weighted= ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetWeightForMeson(fV0Reader->GetPeriodName(),i, 0x0, fInputEvent);
d53bf4ac 1522 }
1523 }
de752898 1524
d53bf4ac 1525 Double_t mesonY = 10.;
1526 if(particle->E() - particle->Pz() == 0 || particle->E() + particle->Pz() == 0){
1527 mesonY=10.-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
1528 } else{
1529 mesonY = 0.5*(TMath::Log((particle->E()+particle->Pz()) / (particle->E()-particle->Pz())))-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
1530 }
de752898 1531 Double_t alpha = -1;
1532 if (particle->GetPdgCode() == 111 || particle->GetPdgCode() == 221){
1533 alpha = TMath::Abs((daughter0->E() - daughter1->E()))/(daughter0->E() + daughter1->E());
1534 }
d53bf4ac 1535
1536 if(particle->GetPdgCode() == 111){
1537 fHistoMCPi0Pt[fiCut]->Fill(particle->Pt(),weighted); // All MC Pi0
1538 fHistoMCPi0WOWeightPt[fiCut]->Fill(particle->Pt());
de752898 1539 if (fDoMesonQA > 0){
1540 fHistoMCPi0PtY[fiCut]->Fill(particle->Pt(),mesonY,weighted); // All MC Pi0
1541 fHistoMCPi0PtAlpha[fiCut]->Fill(particle->Pt(),alpha);
1542 }
d53bf4ac 1543 } else if(particle->GetPdgCode() == 221){
1544 fHistoMCEtaPt[fiCut]->Fill(particle->Pt(),weighted); // All MC Eta
1545 fHistoMCEtaWOWeightPt[fiCut]->Fill(particle->Pt());
de752898 1546 if (fDoMesonQA > 0){
1547 fHistoMCEtaPtY[fiCut]->Fill(particle->Pt(),mesonY,weighted); // All MC Pi0
1548 fHistoMCEtaPtAlpha[fiCut]->Fill(particle->Pt(),alpha);
1549 }
d53bf4ac 1550 }
1551
1552 // Check the acceptance for both gammas
1553 if(((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedAODMC(daughter0,AODMCTrackArray) &&
1554 ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedAODMC(daughter1,AODMCTrackArray) ){
1555
1556 if(particle->GetPdgCode() == 111){
1557 fHistoMCPi0InAccPt[fiCut]->Fill(particle->Pt(),weighted); // MC Pi0 with gamma in acc
1558 } else if(particle->GetPdgCode() == 221){
1559 fHistoMCEtaInAccPt[fiCut]->Fill(particle->Pt(),weighted); // MC Eta with gamma in acc
1560 }
1561 }
1562 }
1563 }
1564 }
1565
1566}
1567//________________________________________________________________________
1568void AliAnalysisTaskGammaCalo::ProcessMCParticles()
1569{
1570 // Loop over all primary MC particle
1571 for(Int_t i = 0; i < fMCStack->GetNprimary(); i++) {
1572 TParticle* particle = (TParticle *)fMCStack->Particle(i);
1573 if (!particle) continue;
1574
1575 Int_t isMCFromMBHeader = -1;
1576 if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 0){
1577 isMCFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCStack, fInputEvent);
1578 if(isMCFromMBHeader == 0 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 3) continue;
1579 }
1580
1581 if(((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedMC(particle,fMCStack)){
1582 fHistoMCAllGammaPt[fiCut]->Fill(particle->Pt()); // All MC Gamma
1583 if(particle->GetMother(0) >-1){ // Meson Decay Gamma
1584 switch(fMCStack->Particle(particle->GetMother(0))->GetPdgCode()){
1585 case 111: // Pi0
1586 fHistoMCDecayGammaPi0Pt[fiCut]->Fill(particle->Pt());
1587 break;
1588 case 113: // Rho0
1589 fHistoMCDecayGammaRhoPt[fiCut]->Fill(particle->Pt());
1590 break;
1591 case 221: // Eta
1592 fHistoMCDecayGammaEtaPt[fiCut]->Fill(particle->Pt());
1593 break;
1594 case 223: // Omega
1595 fHistoMCDecayGammaOmegaPt[fiCut]->Fill(particle->Pt());
1596 break;
1597 case 331: // Eta'
1598 fHistoMCDecayGammaEtapPt[fiCut]->Fill(particle->Pt());
1599 break;
1600 case 333: // Phi
1601 fHistoMCDecayGammaPhiPt[fiCut]->Fill(particle->Pt());
1602 break;
1603 case 3212: // Sigma
1604 fHistoMCDecayGammaSigmaPt[fiCut]->Fill(particle->Pt());
1605 break;
1606 }
1607 }
1608 }
1609 if(fDoMesonAnalysis){
1610 if(particle->GetPdgCode() == 310 && fDoMesonQA > 0){
1611 Double_t mesonY = 10.;
1612 if(particle->Energy() - particle->Pz() == 0 || particle->Energy() + particle->Pz() == 0){
1613 mesonY=10.-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
1614 } else{
1615 mesonY = 0.5*(TMath::Log((particle->Energy()+particle->Pz()) / (particle->Energy()-particle->Pz())))-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
1616 }
1617 Float_t weightedK0s= 1;
1618 if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCStack, fInputEvent)){
1619 if (particle->Pt()>0.005){
1620 weightedK0s= ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetWeightForMeson(fV0Reader->GetPeriodName(),i, fMCStack, fInputEvent);
1621 //cout << "MC input \t"<<i << "\t" << particle->Pt()<<"\t"<<weighted << endl;
1622 }
1623 }
1624 if (fMCStack->IsPhysicalPrimary(i)){
1625 fHistoMCK0sPt[fiCut]->Fill(particle->Pt(),weightedK0s);
1626 fHistoMCK0sWOWeightPt[fiCut]->Fill(particle->Pt());
1627 fHistoMCK0sPtY[fiCut]->Fill(particle->Pt(),mesonY,weightedK0s);
1628 }
1629 }
1630 if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))
1631 ->MesonIsSelectedMC(particle,fMCStack,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift())){
1632 TParticle* daughter0 = (TParticle*)fMCStack->Particle(particle->GetFirstDaughter());
1633 TParticle* daughter1 = (TParticle*)fMCStack->Particle(particle->GetLastDaughter());
1634
1635 Float_t weighted= 1;
1636 if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCStack, fInputEvent)){
1637 if (particle->Pt()>0.005){
1638 weighted= ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetWeightForMeson(fV0Reader->GetPeriodName(),i, fMCStack, fInputEvent);
1639 // if(particle->GetPdgCode() == 221){
1640 // cout << "MC input \t"<<i << "\t" << particle->Pt()<<"\t"<<weighted << endl;
1641 // }
1642 }
1643 }
1644 Double_t mesonY = 10.;
1645 if(particle->Energy() - particle->Pz() == 0 || particle->Energy() + particle->Pz() == 0){
1646 mesonY=10.-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
1647 } else{
1648 mesonY = 0.5*(TMath::Log((particle->Energy()+particle->Pz()) / (particle->Energy()-particle->Pz())))-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
1649 }
de752898 1650
1651 Double_t alpha = -1;
1652 if (particle->GetPdgCode() == 111 || particle->GetPdgCode() == 221){
1653 alpha = TMath::Abs((daughter0->Energy() - daughter1->Energy()))/(daughter0->Energy() + daughter1->Energy());
1654 }
1655
d53bf4ac 1656 if(particle->GetPdgCode() == 111){
1657 fHistoMCPi0Pt[fiCut]->Fill(particle->Pt(),weighted); // All MC Pi0
1658 fHistoMCPi0WOWeightPt[fiCut]->Fill(particle->Pt());
de752898 1659 if (fDoMesonQA > 0){
1660 fHistoMCPi0PtY[fiCut]->Fill(particle->Pt(),mesonY,weighted); // All MC Pi0
1661 fHistoMCPi0PtAlpha[fiCut]->Fill(particle->Pt(),alpha); // All MC Pi0
1662 }
d53bf4ac 1663 } else if(particle->GetPdgCode() == 221){
1664 fHistoMCEtaPt[fiCut]->Fill(particle->Pt(),weighted); // All MC Eta
1665 fHistoMCEtaWOWeightPt[fiCut]->Fill(particle->Pt());
de752898 1666 if (fDoMesonQA > 0){
1667 fHistoMCEtaPtY[fiCut]->Fill(particle->Pt(),mesonY,weighted); // All MC Pi0
1668 fHistoMCEtaPtAlpha[fiCut]->Fill(particle->Pt(),alpha); // All MC Pi0
1669 }
d53bf4ac 1670 }
1671
1672 // Check the acceptance for both gammas
1673 if(((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedMC(daughter0,fMCStack) &&
1674 ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedMC(daughter1,fMCStack) ){
1675 if(particle->GetPdgCode() == 111){
1676 fHistoMCPi0InAccPt[fiCut]->Fill(particle->Pt(),weighted); // MC Pi0 with gamma in acc
1677 } else if(particle->GetPdgCode() == 221){
1678 fHistoMCEtaInAccPt[fiCut]->Fill(particle->Pt(),weighted); // MC Eta with gamma in acc
1679 }
1680 }
1681 }
1682 }
1683 }
1684
1685 if (fDoMesonQA){
1686 for(Int_t i = fMCStack->GetNprimary(); i < fMCStack->GetNtrack(); i++) {
1687 TParticle* particle = (TParticle *)fMCStack->Particle(i);
1688 if (!particle) continue;
1689
1690 Int_t isMCFromMBHeader = -1;
1691 if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 0){
1692 isMCFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCStack, fInputEvent);
1693 if(isMCFromMBHeader == 0 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 3) continue;
1694 }
1695
1696 if(fDoMesonAnalysis){
1697 if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->MesonIsSelectedMC(particle,fMCStack,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift())){
1698 Float_t weighted= 1;
1699 if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCStack, fInputEvent)){
1700 if (particle->Pt()>0.005){
1701 weighted= ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetWeightForMeson(fV0Reader->GetPeriodName(),i, fMCStack, fInputEvent);
1702 // if(particle->GetPdgCode() == 221){
1703 // cout << "MC input \t"<<i << "\t" << particle->Pt()<<"\t"<<weighted << endl;
1704 // }
1705 }
1706 }
1707
1708 if(particle->GetPdgCode() == 111){
1709 Int_t pdgCode = ((TParticle*)fMCStack->Particle( particle->GetFirstMother() ))->GetPdgCode();
1710 Int_t source = GetSourceClassification(111,pdgCode);
1711 fHistoMCSecPi0PtvsSource[fiCut]->Fill(particle->Pt(),source,weighted); // All MC Pi0
1712 fHistoMCSecPi0Source[fiCut]->Fill(pdgCode);
1713 } else if(particle->GetPdgCode() == 221){
1714 Int_t pdgCode = ((TParticle*)fMCStack->Particle( particle->GetFirstMother() ))->GetPdgCode();
1715 fHistoMCSecEtaPt[fiCut]->Fill(particle->Pt(),weighted); // All MC Pi0
1716 fHistoMCSecEtaSource[fiCut]->Fill(pdgCode);
1717 }
1718 }
1719 }
1720 }
1721 }
1722}
1723
1724//________________________________________________________________________
1725void AliAnalysisTaskGammaCalo::CalculatePi0Candidates(){
1726
1727 // Conversion Gammas
1728 if(fClusterCandidates->GetEntries()>0){
1729
1730 // vertex
1731 Double_t vertex[3] = {0};
1732 InputEvent()->GetPrimaryVertex()->GetXYZ(vertex);
1733
1734 for(Int_t firstGammaIndex=0;firstGammaIndex<fClusterCandidates->GetEntries();firstGammaIndex++){
1735 AliAODConversionPhoton *gamma0=dynamic_cast<AliAODConversionPhoton*>(fClusterCandidates->At(firstGammaIndex));
1736 if (gamma0==NULL) continue;
1737
1738 for(Int_t secondGammaIndex=0;secondGammaIndex<fClusterCandidates->GetEntries();secondGammaIndex++){
8c96b4f9 1739 if (firstGammaIndex == secondGammaIndex) continue;
d53bf4ac 1740 AliAODConversionPhoton *gamma1=dynamic_cast<AliAODConversionPhoton*>(fClusterCandidates->At(secondGammaIndex));
1741 if (gamma1==NULL) continue;
8c96b4f9 1742
d53bf4ac 1743 AliAODConversionMother *pi0cand = new AliAODConversionMother(gamma0,gamma1);
1744 pi0cand->SetLabels(firstGammaIndex,secondGammaIndex);
1745
1746
1747
1748 if((((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->MesonIsSelected(pi0cand,kTRUE,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift()))){
1749 fHistoMotherInvMassPt[fiCut]->Fill(pi0cand->M(),pi0cand->Pt());
1750 // fill new histograms
1751 if(pi0cand->GetAlpha()<0.1)
1752 fHistoMotherInvMassEalpha[fiCut]->Fill(pi0cand->M(),pi0cand->E());
1753
1754 if (fDoMesonQA > 0){
1755 if ( pi0cand->M() > 0.05 && pi0cand->M() < 0.17){
1756 fHistoMotherPi0PtY[fiCut]->Fill(pi0cand->Pt(),pi0cand->Rapidity()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift());
1757 fHistoMotherPi0PtAlpha[fiCut]->Fill(pi0cand->Pt(),pi0cand->GetAlpha());
1758 fHistoMotherPi0PtOpenAngle[fiCut]->Fill(pi0cand->Pt(),pi0cand->GetOpeningAngle());
1759 }
1760 if ( pi0cand->M() > 0.45 && pi0cand->M() < 0.65){
1761 fHistoMotherEtaPtY[fiCut]->Fill(pi0cand->Pt(),pi0cand->Rapidity()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift());
1762 fHistoMotherEtaPtAlpha[fiCut]->Fill(pi0cand->Pt(),pi0cand->GetAlpha());
1763 fHistoMotherEtaPtOpenAngle[fiCut]->Fill(pi0cand->Pt(),pi0cand->GetOpeningAngle());
1764 }
1765 }
1766 if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->DoBGCalculation()){
1767 Int_t zbin = 0;
1768 Int_t mbin = 0;
1769
1770 if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->BackgroundHandlerType() == 0){
1771 zbin = fBGHandler[fiCut]->GetZBinIndex(fInputEvent->GetPrimaryVertex()->GetZ());
1772 if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->UseTrackMultiplicity()){
1773 mbin = fBGHandler[fiCut]->GetMultiplicityBinIndex(fV0Reader->GetNumberOfPrimaryTracks());
1774 } else {
1775 mbin = fBGHandler[fiCut]->GetMultiplicityBinIndex(fClusterCandidates->GetEntries());
1776 }
1777 }
1778 Double_t sparesFill[4] = {pi0cand->M(),pi0cand->Pt(),(Double_t)zbin,(Double_t)mbin};
1779 fSparseMotherInvMassPtZM[fiCut]->Fill(sparesFill,1);
1780 }
1781
1782 if(fIsMC){
1783 if(fInputEvent->IsA()==AliESDEvent::Class())
1784 ProcessTrueMesonCandidates(pi0cand,gamma0,gamma1);
1785 if(fInputEvent->IsA()==AliAODEvent::Class())
1786 ProcessTrueMesonCandidatesAOD(pi0cand,gamma0,gamma1);
1787 }
1788
1789 if (fDoMesonQA == 1){
1790 fHistoMotherInvMassECalib[fiCut]->Fill(pi0cand->M(),gamma1->E());
1791 if(pi0cand->GetAlpha()<0.1)
1792 fHistoMotherInvMassECalibalpha[fiCut]->Fill(pi0cand->M(),gamma1->E());
1793 }
1794
1795 }
8c96b4f9 1796 for (Int_t thirdGammaIndex=0;thirdGammaIndex<fClusterCandidates->GetEntries();thirdGammaIndex++){
1797 if (firstGammaIndex == thirdGammaIndex || secondGammaIndex == thirdGammaIndex ) continue;
1798 AliAODConversionPhoton *gamma2=dynamic_cast<AliAODConversionPhoton*>(fClusterCandidates->At(thirdGammaIndex));
1799 if (gamma2==NULL) continue;
1800
1801 AliAODConversionMother *pi0cand2 = new AliAODConversionMother(pi0cand,gamma2);
1802 if((((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->MesonIsSelected(pi0cand2,kTRUE,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift()))){
1803 fHistoMotherInvMass3ClusterPt[fiCut]->Fill(pi0cand2->M(),pi0cand2->Pt());
1804 }
1805 delete pi0cand2;
1806 pi0cand2=0x0;
1807
1808 }
1809
d53bf4ac 1810 delete pi0cand;
1811 pi0cand=0x0;
1812 }
1813 }
1814 }
1815}
1816//______________________________________________________________________
1817void AliAnalysisTaskGammaCalo::ProcessTrueMesonCandidates(AliAODConversionMother *Pi0Candidate, AliAODConversionPhoton *TrueGammaCandidate0, AliAODConversionPhoton *TrueGammaCandidate1)
1818{
1819 // Process True Mesons
1820 AliStack *MCStack = fMCEvent->Stack();
1821
1822 Bool_t isTruePi0 = kFALSE;
1823 Bool_t isTrueEta = kFALSE;
1824 Int_t gamma0MCLabel = TrueGammaCandidate0->GetCaloPhotonMCLabel(0); // get most probable MC label
1825 Int_t gamma0MotherLabel = -1;
1826
1827 if(gamma0MCLabel != -1){ // Gamma is Combinatorial; MC Particles don't belong to the same Mother
1828 TParticle * gammaMC0 = (TParticle*)MCStack->Particle(gamma0MCLabel);
1829 if (TrueGammaCandidate0->IsLargestComponentPhoton() || TrueGammaCandidate0->IsLargestComponentElectron()){ // largest component is electro magnetic
1830 // get mother of interest (pi0 or eta)
1831 if (TrueGammaCandidate0->IsLargestComponentPhoton()){ // for photons its the direct mother
1832 gamma0MotherLabel=gammaMC0->GetMother(0);
1833 } else if (TrueGammaCandidate0->IsLargestComponentElectron()){ // for electrons its either the direct mother or for conversions the grandmother
1834 if (TrueGammaCandidate0->IsConversion()) gamma0MotherLabel=MCStack->Particle(gammaMC0->GetMother(0))->GetMother(0);
1835 else gamma0MotherLabel=gammaMC0->GetMother(0);
1836 }
1837 }
1838 }
1839 if (!TrueGammaCandidate1->GetIsCaloPhoton()) AliFatal("CaloPhotonFlag has not been set. Aborting");
1840
1841 Int_t gamma1MCLabel = TrueGammaCandidate1->GetCaloPhotonMCLabel(0); // get most probable MC label
1842 Int_t gamma1MotherLabel = -1;
1843 // check if
1844
1845 if(gamma1MCLabel != -1){ // Gamma is Combinatorial; MC Particles don't belong to the same Mother
1846 // Daughters Gamma 1
1847 TParticle * gammaMC1 = (TParticle*)MCStack->Particle(gamma1MCLabel);
1848 if (TrueGammaCandidate1->IsLargestComponentPhoton() || TrueGammaCandidate1->IsLargestComponentElectron()){ // largest component is electro magnetic
1849 // get mother of interest (pi0 or eta)
1850 if (TrueGammaCandidate1->IsLargestComponentPhoton()){ // for photons its the direct mother
1851 gamma1MotherLabel=gammaMC1->GetMother(0);
1852 } else if (TrueGammaCandidate1->IsLargestComponentElectron()){ // for electrons its either the direct mother or for conversions the grandmother
1853 if (TrueGammaCandidate1->IsConversion()) gamma1MotherLabel=MCStack->Particle(gammaMC1->GetMother(0))->GetMother(0);
1854 else gamma1MotherLabel=gammaMC1->GetMother(0);
1855 }
1856 }
1857 }
1858
1859 if(gamma0MotherLabel>=0 && gamma0MotherLabel==gamma1MotherLabel){
1860 if(((TParticle*)MCStack->Particle(gamma1MotherLabel))->GetPdgCode() == 111){
1861 isTruePi0=kTRUE;
1862 }
1863 if(((TParticle*)MCStack->Particle(gamma1MotherLabel))->GetPdgCode() == 221){
1864 isTrueEta=kTRUE;
1865 }
1866 }
1867
1868 if(isTruePi0 || isTrueEta){// True Pion or Eta
ed8bc1ca 1869 if (isTruePi0) fHistoTruePi0InvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
1870 if (isTrueEta) fHistoTrueEtaInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
d53bf4ac 1871 if (fDoMesonQA > 0){
1872 // both gammas are real gammas
ed8bc1ca 1873 if (TrueGammaCandidate0->IsLargestComponentPhoton() && TrueGammaCandidate1->IsLargestComponentPhoton()) {
1874 if (isTruePi0) fHistoTruePi0CaloPhotonInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
1875 if (isTrueEta) fHistoTrueEtaCaloPhotonInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
1876 }
d53bf4ac 1877 // both particles are electrons
ed8bc1ca 1878 if (TrueGammaCandidate0->IsLargestComponentElectron() && TrueGammaCandidate1->IsLargestComponentElectron() ) {
1879 if (isTruePi0) fHistoTruePi0CaloElectronInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
1880 if (isTrueEta) fHistoTrueEtaCaloElectronInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
1881 }
d53bf4ac 1882 // both particles are converted electrons
1883 if ((TrueGammaCandidate0->IsLargestComponentElectron() && TrueGammaCandidate0->IsConversion()) && (TrueGammaCandidate1->IsLargestComponentElectron() && TrueGammaCandidate1->IsConversion()) ){
d53bf4ac 1884 if (isTruePi0 )fHistoTruePi0CaloConvertedPhotonInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
1885 if (isTrueEta )fHistoTrueEtaCaloConvertedPhotonInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
1886 }
1887 // 1 gamma is converted the other one is normals
1888 if ( (TrueGammaCandidate0->IsLargestComponentPhoton() && TrueGammaCandidate1->IsLargestComponentElectron() && TrueGammaCandidate1->IsConversion()) ||
1889 (TrueGammaCandidate1->IsLargestComponentPhoton() && TrueGammaCandidate0->IsLargestComponentElectron() && TrueGammaCandidate0->IsConversion())
ed8bc1ca 1890 ) {
1891 if (isTruePi0) fHistoTruePi0CaloMixedPhotonConvPhotonInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
1892 if (isTrueEta) fHistoTrueEtaCaloMixedPhotonConvPhotonInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
1893 }
def90c8b 1894
1895 if ( (TrueGammaCandidate0->IsLargestComponentElectron() && TrueGammaCandidate0->IsConversion() && TrueGammaCandidate1->IsLargestComponentPhoton() && !TrueGammaCandidate1->IsMerged()) ||
1896 (TrueGammaCandidate1->IsLargestComponentElectron() && TrueGammaCandidate1->IsConversion() && TrueGammaCandidate0->IsLargestComponentPhoton() && !TrueGammaCandidate0->IsMerged())
1897 ) {
1898 if (isTruePi0) fHistoTruePi0NonMergedElectronPhotonInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
1899 }
1900
1901 if ( (TrueGammaCandidate0->IsLargestComponentElectron() && TrueGammaCandidate0->IsConversion() && TrueGammaCandidate1->IsLargestComponentPhoton() && TrueGammaCandidate1->IsMerged()) ||
1902 (TrueGammaCandidate1->IsLargestComponentElectron() && TrueGammaCandidate1->IsConversion() && TrueGammaCandidate0->IsLargestComponentPhoton() && TrueGammaCandidate0->IsMerged())
1903 ) {
1904 if (isTruePi0) fHistoTruePi0NonMergedElectronMergedPhotonInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
1905 }
1906
d53bf4ac 1907 // at least one of the photon is merged
ed8bc1ca 1908 if (TrueGammaCandidate0->IsMerged() || TrueGammaCandidate0->IsMergedPartConv() || TrueGammaCandidate0->IsDalitzMerged() || TrueGammaCandidate1->IsMerged() || TrueGammaCandidate1->IsMergedPartConv() || TrueGammaCandidate1->IsDalitzMerged() ){
1909 if (isTruePi0) fHistoTruePi0CaloMergedClusterInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
1910 if (isTrueEta) fHistoTruePi0CaloMergedClusterInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
1911 }
d53bf4ac 1912 // at least one of the photon is merged and part conv
ed8bc1ca 1913 if (TrueGammaCandidate1->IsMergedPartConv() || TrueGammaCandidate0->IsMergedPartConv()) {
1914 if (isTruePi0) fHistoTruePi0CaloMergedClusterPartConvInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
1915 if (isTrueEta) fHistoTrueEtaCaloMergedClusterPartConvInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
1916 }
d53bf4ac 1917 }
1918
1919 if (fDoMesonQA > 0){
1920 if (isTruePi0){
1921 if ( Pi0Candidate->M() > 0.05 && Pi0Candidate->M() < 0.17){
1922 fHistoTruePi0PtY[fiCut]->Fill(Pi0Candidate->Pt(),Pi0Candidate->Rapidity()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift());
1923 fHistoTruePi0PtAlpha[fiCut]->Fill(Pi0Candidate->Pt(),Pi0Candidate->GetAlpha());
1924 fHistoTruePi0PtOpenAngle[fiCut]->Fill(Pi0Candidate->Pt(),Pi0Candidate->GetOpeningAngle());
1925 }
1926 } else if (isTrueEta){
1927 if ( Pi0Candidate->M() > 0.45 && Pi0Candidate->M() < 0.65){
1928 fHistoTrueEtaPtY[fiCut]->Fill(Pi0Candidate->Pt(),Pi0Candidate->Rapidity()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift());
1929 fHistoTrueEtaPtAlpha[fiCut]->Fill(Pi0Candidate->Pt(),Pi0Candidate->GetAlpha());
1930 fHistoTrueEtaPtOpenAngle[fiCut]->Fill(Pi0Candidate->Pt(),Pi0Candidate->GetOpeningAngle());
1931 }
1932 }
1933 }
1934
1935 if(gamma0MotherLabel >= MCStack->GetNprimary()){ // Secondary Meson
1936 Int_t secMotherLabel = ((TParticle*)MCStack->Particle(gamma0MotherLabel))->GetMother(0);
1937 Float_t weightedSec= 1;
1938 if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(secMotherLabel, fMCStack, fInputEvent) && MCStack->Particle(secMotherLabel)->GetPdgCode()==310){
1939 weightedSec= ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetWeightForMeson(fV0Reader->GetPeriodName(),secMotherLabel, fMCStack, fInputEvent)/2.; //invariant mass is additive thus the weight for the daughters has to be devide by two for the K0s at a certain pt
1940 //cout << "MC input \t"<<i << "\t" << particle->Pt()<<"\t"<<weighted << endl;
1941 }
ed8bc1ca 1942 if (isTruePi0) fHistoTrueSecondaryPi0InvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weightedSec);
1943 if (isTrueEta) fHistoTrueSecondaryEtaInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weightedSec);
d53bf4ac 1944 if (secMotherLabel >-1){
ed8bc1ca 1945 if(MCStack->Particle(secMotherLabel)->GetPdgCode()==310 && isTruePi0){
1946 fHistoTrueSecondaryPi0FromK0sInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weightedSec);
d53bf4ac 1947 if (fDoMesonQA > 0)fHistoTrueK0sWithPi0DaughterMCPt[fiCut]->Fill(MCStack->Particle(secMotherLabel)->Pt());
1948 }
ed8bc1ca 1949 if(MCStack->Particle(secMotherLabel)->GetPdgCode()==221 && isTruePi0){
1950 fHistoTrueSecondaryPi0FromEtaInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weightedSec);
d53bf4ac 1951 if (fDoMesonQA > 0)fHistoTrueEtaWithPi0DaughterMCPt[fiCut]->Fill(MCStack->Particle(secMotherLabel)->Pt());
1952 }
ed8bc1ca 1953 if(MCStack->Particle(secMotherLabel)->GetPdgCode()==3122 && isTruePi0){
1954 fHistoTrueSecondaryPi0FromLambdaInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weightedSec);
d53bf4ac 1955 if (fDoMesonQA > 0)fHistoTrueLambdaWithPi0DaughterMCPt[fiCut]->Fill(MCStack->Particle(secMotherLabel)->Pt());
1956 }
1957 }
1958 } else { // Only primary pi0 for efficiency calculation
1959 Float_t weighted= 1;
1960 if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(gamma1MotherLabel, fMCStack, fInputEvent)){
1961 if (((TParticle*)MCStack->Particle(gamma1MotherLabel))->Pt()>0.005){
1962 weighted= ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetWeightForMeson(fV0Reader->GetPeriodName(),gamma1MotherLabel, fMCStack, fInputEvent);
1963 // cout << "rec \t " <<gamma1MotherLabel << "\t" << weighted << endl;
1964 }
1965 }
ed8bc1ca 1966 if (isTruePi0){
1967 fHistoTruePrimaryPi0InvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weighted);
1968 fHistoTruePrimaryPi0W0WeightingInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
1969 fProfileTruePrimaryPi0WeightsInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weighted);
1970 } else if (isTrueEta){
1971 fHistoTruePrimaryEtaInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weighted);
1972 fHistoTruePrimaryEtaW0WeightingInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
1973 fProfileTruePrimaryEtaWeightsInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weighted);
1974 }
d53bf4ac 1975
1976 if (fDoMesonQA > 0){
1977 if(isTruePi0){ // Only primary pi0 for resolution
1978 fHistoTruePrimaryPi0MCPtResolPt[fiCut]->Fill(((TParticle*)MCStack->Particle(gamma1MotherLabel))->Pt(),(Pi0Candidate->Pt()-((TParticle*)MCStack->Particle(gamma1MotherLabel))->Pt())/((TParticle*)MCStack->Particle(gamma1MotherLabel))->Pt(),weighted);
1979 }
1980 if (isTrueEta){ // Only primary eta for resolution
1981 fHistoTruePrimaryEtaMCPtResolPt[fiCut]->Fill(((TParticle*)MCStack->Particle(gamma1MotherLabel))->Pt(),(Pi0Candidate->Pt()-((TParticle*)MCStack->Particle(gamma1MotherLabel))->Pt())/((TParticle*)MCStack->Particle(gamma1MotherLabel))->Pt(),weighted);
1982 }
1983 }
1984 }
1985 } else if(!isTruePi0 && !isTrueEta){ // Background
1986 if (fDoMesonQA > 0){
1987 if(gamma0MotherLabel>-1 && gamma1MotherLabel>-1){ // Both Tracks are Photons and have a mother but not Pi0 or Eta
1988 fHistoTrueBckGGInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
1989 } else { // No photon or without mother
1990 fHistoTrueBckContInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
1991 }
1992 }
1993 }
1994
1995}
1996//______________________________________________________________________
1997void AliAnalysisTaskGammaCalo::ProcessTrueMesonCandidatesAOD(AliAODConversionMother *Pi0Candidate, AliAODConversionPhoton *TrueGammaCandidate0, AliAODConversionPhoton *TrueGammaCandidate1)
1998{
1999
2000 // Process True Mesons
2001 TClonesArray *AODMCTrackArray = dynamic_cast<TClonesArray*>(fInputEvent->FindListObject(AliAODMCParticle::StdBranchName()));
2002 Bool_t isTruePi0 = kFALSE;
2003 Bool_t isTrueEta = kFALSE;
2004
d404157c 2005 Int_t gamma0MCLabel = TrueGammaCandidate0->GetCaloPhotonMCLabel(0); // get most probable MC label
d53bf4ac 2006 Int_t gamma0MotherLabel = -1;
2007 // check if
2008
2009 if(gamma0MCLabel != -1){ // Gamma is Combinatorial; MC Particles don't belong to the same Mother
2010 // Daughters Gamma 0
2011 AliAODMCParticle * gammaMC0 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma0MCLabel));
2012 if (TrueGammaCandidate0->IsLargestComponentPhoton() || TrueGammaCandidate0->IsLargestComponentElectron()){ // largest component is electro magnetic
2013 // get mother of interest (pi0 or eta)
2014 if (TrueGammaCandidate0->IsLargestComponentPhoton()){ // for photons its the direct mother
2015 gamma0MotherLabel=gammaMC0->GetMother();
2016 } else if (TrueGammaCandidate0->IsLargestComponentElectron()){ // for electrons its either the direct mother or for conversions the grandmother
2017 if (TrueGammaCandidate0->IsConversion()){
2018 AliAODMCParticle * gammaGrandMotherMC0 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gammaMC0->GetMother()));
2019 gamma0MotherLabel=gammaGrandMotherMC0->GetMother();
2020 } else gamma0MotherLabel=gammaMC0->GetMother();
2021 }
2022 }
2023 }
2024
2025 Int_t gamma1MCLabel = TrueGammaCandidate1->GetCaloPhotonMCLabel(0); // get most probable MC label
2026 Int_t gamma1MotherLabel = -1;
2027 // check if
2028
2029 if(gamma1MCLabel != -1){ // Gamma is Combinatorial; MC Particles don't belong to the same Mother
2030 // Daughters Gamma 1
2031 AliAODMCParticle * gammaMC1 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma1MCLabel));
2032 if (TrueGammaCandidate1->IsLargestComponentPhoton() || TrueGammaCandidate1->IsLargestComponentElectron()){ // largest component is electro magnetic
2033 // get mother of interest (pi0 or eta)
2034 if (TrueGammaCandidate1->IsLargestComponentPhoton()){ // for photons its the direct mother
2035 gamma1MotherLabel=gammaMC1->GetMother();
2036 } else if (TrueGammaCandidate1->IsLargestComponentElectron()){ // for electrons its either the direct mother or for conversions the grandmother
2037 if (TrueGammaCandidate1->IsConversion()){
2038 AliAODMCParticle * gammaGrandMotherMC1 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gammaMC1->GetMother()));
2039 gamma1MotherLabel=gammaGrandMotherMC1->GetMother();
2040 } else gamma1MotherLabel=gammaMC1->GetMother();
2041 }
2042 }
2043 }
2044
2045 if(gamma0MotherLabel>=0 && gamma0MotherLabel==gamma1MotherLabel){
2046 if(((AliAODMCParticle*)AODMCTrackArray->At(gamma1MotherLabel))->GetPdgCode() == 111){
2047 isTruePi0=kTRUE;
2048 }
2049 if(((AliAODMCParticle*)AODMCTrackArray->At(gamma1MotherLabel))->GetPdgCode() == 221){
2050 isTrueEta=kTRUE;
2051 }
2052 }
2053
2054 if(isTruePi0 || isTrueEta){// True Pion or Eta
ed8bc1ca 2055 if (isTruePi0)fHistoTruePi0InvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2056 if (isTrueEta)fHistoTrueEtaInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
d53bf4ac 2057 if (fDoMesonQA > 0){
2058 // both gammas are real gammas
ed8bc1ca 2059 if (TrueGammaCandidate0->IsLargestComponentPhoton() && TrueGammaCandidate1->IsLargestComponentPhoton()) {
2060 if (isTruePi0)fHistoTruePi0CaloPhotonInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2061 if (isTrueEta)fHistoTrueEtaCaloPhotonInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2062 }
d53bf4ac 2063 // both particles are electrons
ed8bc1ca 2064 if (TrueGammaCandidate0->IsLargestComponentElectron() && TrueGammaCandidate1->IsLargestComponentElectron() ) {
2065 if (isTruePi0) fHistoTruePi0CaloElectronInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2066 if (isTrueEta) fHistoTrueEtaCaloElectronInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2067 }
d53bf4ac 2068 // both particles are converted electrons
2069 if ((TrueGammaCandidate0->IsLargestComponentElectron() && TrueGammaCandidate0->IsConversion()) && (TrueGammaCandidate1->IsLargestComponentElectron() && TrueGammaCandidate1->IsConversion()) ){
d53bf4ac 2070 if (isTruePi0 )fHistoTruePi0CaloConvertedPhotonInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2071 if (isTrueEta )fHistoTrueEtaCaloConvertedPhotonInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2072 }
2073 // 1 gamma is converted the other one is normals
2074 if ( (TrueGammaCandidate0->IsLargestComponentPhoton() && TrueGammaCandidate1->IsLargestComponentElectron() && TrueGammaCandidate1->IsConversion()) ||
2075 (TrueGammaCandidate1->IsLargestComponentPhoton() && TrueGammaCandidate0->IsLargestComponentElectron() && TrueGammaCandidate0->IsConversion())
ed8bc1ca 2076 ) {
2077 if (isTruePi0) fHistoTruePi0CaloMixedPhotonConvPhotonInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2078 if (isTrueEta) fHistoTrueEtaCaloMixedPhotonConvPhotonInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2079 }
def90c8b 2080
2081 if ( (TrueGammaCandidate0->IsLargestComponentElectron() && TrueGammaCandidate0->IsConversion() && TrueGammaCandidate1->IsLargestComponentPhoton() && !TrueGammaCandidate1->IsMerged()) ||
2082 (TrueGammaCandidate1->IsLargestComponentElectron() && TrueGammaCandidate1->IsConversion() && TrueGammaCandidate0->IsLargestComponentPhoton() && !TrueGammaCandidate0->IsMerged())
2083 ) {
2084 if (isTruePi0) fHistoTruePi0NonMergedElectronPhotonInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2085 }
2086
2087 if ( (TrueGammaCandidate0->IsLargestComponentElectron() && TrueGammaCandidate0->IsConversion() && TrueGammaCandidate1->IsLargestComponentPhoton() && TrueGammaCandidate1->IsMerged()) ||
2088 (TrueGammaCandidate1->IsLargestComponentElectron() && TrueGammaCandidate1->IsConversion() && TrueGammaCandidate0->IsLargestComponentPhoton() && TrueGammaCandidate0->IsMerged())
2089 ) {
2090 if (isTruePi0) fHistoTruePi0NonMergedElectronMergedPhotonInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2091 }
2092
d53bf4ac 2093 // at least one of the photon is merged
ed8bc1ca 2094 if (TrueGammaCandidate0->IsMerged() || TrueGammaCandidate0->IsMergedPartConv() || TrueGammaCandidate0->IsDalitzMerged() || TrueGammaCandidate1->IsMerged() || TrueGammaCandidate1->IsMergedPartConv() || TrueGammaCandidate1->IsDalitzMerged() ){
2095 if (isTruePi0) fHistoTruePi0CaloMergedClusterInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2096 if (isTrueEta) fHistoTrueEtaCaloMergedClusterInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2097 }
d53bf4ac 2098 // at least one of the photon is merged and part conv
ed8bc1ca 2099 if (TrueGammaCandidate1->IsMergedPartConv() || TrueGammaCandidate0->IsMergedPartConv()) {
2100 if (isTruePi0)fHistoTruePi0CaloMergedClusterPartConvInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2101 if (isTrueEta)fHistoTrueEtaCaloMergedClusterPartConvInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2102 }
d53bf4ac 2103 }
2104
2105 if (fDoMesonQA > 0){
2106 if (isTruePi0){
2107 if ( Pi0Candidate->M() > 0.05 && Pi0Candidate->M() < 0.17){
2108 fHistoTruePi0PtY[fiCut]->Fill(Pi0Candidate->Pt(),Pi0Candidate->Rapidity()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift());
2109 fHistoTruePi0PtAlpha[fiCut]->Fill(Pi0Candidate->Pt(),Pi0Candidate->GetAlpha());
2110 fHistoTruePi0PtOpenAngle[fiCut]->Fill(Pi0Candidate->Pt(),Pi0Candidate->GetOpeningAngle());
2111 }
2112 } else if (isTrueEta){
2113 if ( Pi0Candidate->M() > 0.45 && Pi0Candidate->M() < 0.65){
2114 fHistoTrueEtaPtY[fiCut]->Fill(Pi0Candidate->Pt(),Pi0Candidate->Rapidity()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift());
2115 fHistoTrueEtaPtAlpha[fiCut]->Fill(Pi0Candidate->Pt(),Pi0Candidate->GetAlpha());
2116 fHistoTrueEtaPtOpenAngle[fiCut]->Fill(Pi0Candidate->Pt(),Pi0Candidate->GetOpeningAngle());
2117 }
2118 }
2119 }
2120 if(!(static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma0MotherLabel))->IsPrimary())){ // Secondary Meson
2121 Int_t secMotherLabel = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma1MotherLabel))->GetMother();
2122 Float_t weightedSec= 1;
2123 if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(secMotherLabel, 0x0, fInputEvent) && static_cast<AliAODMCParticle*>(AODMCTrackArray->At(secMotherLabel))->GetPdgCode()==310){
2124 weightedSec= ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetWeightForMeson(fV0Reader->GetPeriodName(),secMotherLabel, 0x0, fInputEvent)/2.; //invariant mass is additive thus the weight for the daughters has to be devide by two for the K0s at a certain pt
2125 //cout << "MC input \t"<<i << "\t" << particle->Pt()<<"\t"<<weighted << endl;
2126 }
ed8bc1ca 2127 if (isTruePi0) fHistoTrueSecondaryPi0InvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weightedSec);
2128 if (isTrueEta) fHistoTrueSecondaryEtaInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weightedSec);
d53bf4ac 2129 if (secMotherLabel >-1){
ed8bc1ca 2130 if(static_cast<AliAODMCParticle*>(AODMCTrackArray->At(secMotherLabel))->GetPdgCode()==310 && isTruePi0 ){
2131 fHistoTrueSecondaryPi0FromK0sInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weightedSec);
d53bf4ac 2132 if (fDoMesonQA > 0)fHistoTrueK0sWithPi0DaughterMCPt[fiCut]->Fill(static_cast<AliAODMCParticle*>(AODMCTrackArray->At(secMotherLabel))->Pt());
2133 }
ed8bc1ca 2134 if(static_cast<AliAODMCParticle*>(AODMCTrackArray->At(secMotherLabel))->GetPdgCode()==221 && isTruePi0){
2135 fHistoTrueSecondaryPi0FromEtaInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weightedSec);
d53bf4ac 2136 if (fDoMesonQA > 0)fHistoTrueEtaWithPi0DaughterMCPt[fiCut]->Fill(static_cast<AliAODMCParticle*>(AODMCTrackArray->At(secMotherLabel))->Pt());
2137 }
ed8bc1ca 2138 if(static_cast<AliAODMCParticle*>(AODMCTrackArray->At(secMotherLabel))->GetPdgCode()==3122 && isTruePi0){
2139 fHistoTrueSecondaryPi0FromLambdaInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weightedSec);
d53bf4ac 2140 if (fDoMesonQA > 0)fHistoTrueLambdaWithPi0DaughterMCPt[fiCut]->Fill(static_cast<AliAODMCParticle*>(AODMCTrackArray->At(secMotherLabel))->Pt());
2141 }
2142 }
2143 } else{ // Only primary pi0 for efficiency calculation
2144 Float_t weighted= 1;
2145 if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(gamma1MotherLabel, 0x0, fInputEvent)){
2146 if (static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma1MotherLabel))->Pt()>0.005){
2147 weighted= ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetWeightForMeson(fV0Reader->GetPeriodName(),gamma1MotherLabel, 0x0, fInputEvent);
2148 // cout << "rec \t " <<gamma1MotherLabel << "\t" << weighted << endl;
2149 }
2150 }
ed8bc1ca 2151 if (isTruePi0){
2152 fHistoTruePrimaryPi0InvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weighted);
2153 fHistoTruePrimaryPi0W0WeightingInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2154 fProfileTruePrimaryPi0WeightsInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weighted);
2155 } else if (isTrueEta){
2156 fHistoTruePrimaryEtaInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weighted);
2157 fHistoTruePrimaryEtaW0WeightingInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2158 fProfileTruePrimaryEtaWeightsInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weighted);
2159 }
d53bf4ac 2160 if (fDoMesonQA > 0){
2161 if(isTruePi0){ // Only primary pi0 for resolution
2162 fHistoTruePrimaryPi0MCPtResolPt[fiCut]->Fill(static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma1MotherLabel))->Pt(),
2163 (Pi0Candidate->Pt()-static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma1MotherLabel))->Pt())/static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma1MotherLabel))->Pt(),weighted);
2164
2165 }
2166 if (isTrueEta){ // Only primary eta for resolution
2167 fHistoTruePrimaryEtaMCPtResolPt[fiCut]->Fill(static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma1MotherLabel))->Pt(),
2168 (Pi0Candidate->Pt()-static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma1MotherLabel))->Pt())/static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma1MotherLabel))->Pt(),weighted);
2169 }
2170 }
2171 }
2172 } else if(!isTruePi0 && !isTrueEta) { // Background
2173 if (fDoMesonQA > 0){
2174 if(gamma0MotherLabel>-1 && gamma1MotherLabel>-1){ // Both Tracks are Photons and have a mother but not Pi0 or Eta
2175 fHistoTrueBckGGInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2176 } else { // No photon or without mother
2177 fHistoTrueBckContInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2178 }
2179 }
2180 }
2181}
2182
2183//________________________________________________________________________
2184void AliAnalysisTaskGammaCalo::CalculateBackground(){
2185
2186 Int_t zbin= fBGHandler[fiCut]->GetZBinIndex(fInputEvent->GetPrimaryVertex()->GetZ());
2187 Int_t mbin = 0;
2188
2189 if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->UseTrackMultiplicity()){
2190 mbin = fBGHandler[fiCut]->GetMultiplicityBinIndex(fV0Reader->GetNumberOfPrimaryTracks());
2191 } else {
2192 mbin = fBGHandler[fiCut]->GetMultiplicityBinIndex(fClusterCandidates->GetEntries());
2193 }
2194
2195 if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->UseTrackMultiplicity()){
2196 for(Int_t nEventsInBG=0;nEventsInBG<fBGHandler[fiCut]->GetNBGEvents();nEventsInBG++){
2197 AliGammaConversionAODVector *previousEventV0s = fBGHandler[fiCut]->GetBGGoodV0s(zbin,mbin,nEventsInBG);
2198
2199 for(Int_t iCurrent=0;iCurrent<fClusterCandidates->GetEntries();iCurrent++){
2200 AliAODConversionPhoton currentEventGoodV0 = *(AliAODConversionPhoton*)(fClusterCandidates->At(iCurrent));
2201 for(UInt_t iPrevious=0;iPrevious<previousEventV0s->size();iPrevious++){
2202 AliAODConversionPhoton previousGoodV0 = (AliAODConversionPhoton)(*(previousEventV0s->at(iPrevious)));
2203 AliAODConversionMother *backgroundCandidate = new AliAODConversionMother(&currentEventGoodV0,&previousGoodV0);
2204 backgroundCandidate->CalculateDistanceOfClossetApproachToPrimVtx(fInputEvent->GetPrimaryVertex());
2205 if((((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))
2206 ->MesonIsSelected(backgroundCandidate,kFALSE,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift()))){
2207 fHistoMotherBackInvMassPt[fiCut]->Fill(backgroundCandidate->M(),backgroundCandidate->Pt());
2208 Double_t sparesFill[4] = {backgroundCandidate->M(),backgroundCandidate->Pt(),(Double_t)zbin,(Double_t)mbin};
2209 fSparseMotherBackInvMassPtZM[fiCut]->Fill(sparesFill,1);
2210 }
2211 delete backgroundCandidate;
2212 backgroundCandidate = 0x0;
2213 }
2214 }
2215 }
2216 } else {
2217 for(Int_t nEventsInBG=0;nEventsInBG <fBGHandler[fiCut]->GetNBGEvents();nEventsInBG++){
2218 AliGammaConversionAODVector *previousEventV0s = fBGHandler[fiCut]->GetBGGoodV0s(zbin,mbin,nEventsInBG);
2219 if(previousEventV0s){
2220 for(Int_t iCurrent=0;iCurrent<fClusterCandidates->GetEntries();iCurrent++){
2221 AliAODConversionPhoton currentEventGoodV0 = *(AliAODConversionPhoton*)(fClusterCandidates->At(iCurrent));
2222 for(UInt_t iPrevious=0;iPrevious<previousEventV0s->size();iPrevious++){
2223
2224 AliAODConversionPhoton previousGoodV0 = (AliAODConversionPhoton)(*(previousEventV0s->at(iPrevious)));
2225 AliAODConversionMother *backgroundCandidate = new AliAODConversionMother(&currentEventGoodV0,&previousGoodV0);
2226 backgroundCandidate->CalculateDistanceOfClossetApproachToPrimVtx(fInputEvent->GetPrimaryVertex());
2227 if((((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->MesonIsSelected(backgroundCandidate,kFALSE,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift()))){
2228 fHistoMotherBackInvMassPt[fiCut]->Fill(backgroundCandidate->M(),backgroundCandidate->Pt());
2229 Double_t sparesFill[4] = {backgroundCandidate->M(),backgroundCandidate->Pt(),(Double_t)zbin,(Double_t)mbin};
2230 fSparseMotherBackInvMassPtZM[fiCut]->Fill(sparesFill,1);
2231 }
2232 delete backgroundCandidate;
2233 backgroundCandidate = 0x0;
2234 }
2235 }
2236 }
2237 }
2238 }
2239}
2240
2241//________________________________________________________________________
2242void AliAnalysisTaskGammaCalo::RotateParticle(AliAODConversionPhoton *gamma){
2243 Int_t fNDegreesPMBackground= ((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->NDegreesRotation();
2244 Double_t nRadiansPM = fNDegreesPMBackground*TMath::Pi()/180;
2245 Double_t rotationValue = fRandom.Rndm()*2*nRadiansPM + TMath::Pi()-nRadiansPM;
2246 gamma->RotateZ(rotationValue);
2247}
2248
2249//________________________________________________________________________
2250void AliAnalysisTaskGammaCalo::UpdateEventByEventData(){
2251 //see header file for documentation
2252 if(fClusterCandidates->GetEntries() >0 ){
2253 if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->UseTrackMultiplicity()){
2254 fBGHandler[fiCut]->AddEvent(fClusterCandidates,fInputEvent->GetPrimaryVertex()->GetX(),fInputEvent->GetPrimaryVertex()->GetY(),fInputEvent->GetPrimaryVertex()->GetZ(),fV0Reader->GetNumberOfPrimaryTracks(),fEventPlaneAngle);
2255 } else { // means we use #V0s for multiplicity
2256 fBGHandler[fiCut]->AddEvent(fClusterCandidates,fInputEvent->GetPrimaryVertex()->GetX(),fInputEvent->GetPrimaryVertex()->GetY(),fInputEvent->GetPrimaryVertex()->GetZ(),fClusterCandidates->GetEntries(),fEventPlaneAngle);
2257 }
2258 }
2259}
2260
2261
2262//________________________________________________________________________
2263void AliAnalysisTaskGammaCalo::FillPhotonBackgroundHist(AliAODConversionPhoton *TruePhotonCandidate, Int_t pdgCode)
2264{
2265 // Bck = 0 e+-, 1 pi+-, 2 p+-, 3 K+-, 4 n, 5 K0s, 6 Lambda, 7 mu+-, 8 rest
2266 if(fIsFromMBHeader){
2267 if(abs(pdgCode) == 11) fHistoClusPhotonBGPt[fiCut]->Fill(TruePhotonCandidate->Pt(),0);
2268 else if( abs(pdgCode)==211) fHistoClusPhotonBGPt[fiCut]->Fill(TruePhotonCandidate->Pt(),1);
2269 else if( abs(pdgCode)==2212) fHistoClusPhotonBGPt[fiCut]->Fill(TruePhotonCandidate->Pt(),2);
2270 else if( abs(pdgCode)==321) fHistoClusPhotonBGPt[fiCut]->Fill(TruePhotonCandidate->Pt(),3);
2271 else if( abs(pdgCode)==2112) fHistoClusPhotonBGPt[fiCut]->Fill(TruePhotonCandidate->Pt(),4);
2272 else if( abs(pdgCode)==310) fHistoClusPhotonBGPt[fiCut]->Fill(TruePhotonCandidate->Pt(),5);
2273 else if( abs(pdgCode)==3122) fHistoClusPhotonBGPt[fiCut]->Fill(TruePhotonCandidate->Pt(),6);
2274 else if( abs(pdgCode)==13) fHistoClusPhotonBGPt[fiCut]->Fill(TruePhotonCandidate->Pt(),7);
2275 else fHistoClusPhotonBGPt[fiCut]->Fill(TruePhotonCandidate->Pt(),8);
2276 }
2277}
2278
2279//________________________________________________________________________
2280void AliAnalysisTaskGammaCalo::FillPhotonPlusConversionBackgroundHist(AliAODConversionPhoton *TruePhotonCandidate, Int_t pdgCode)
2281{
2282 // Bck = 0 e+-, 1 pi+-, 2 p+-, 3 K+-, 4 n, 5 K0s, 6 Lambda, 7 mu+-, 8 rest
2283 if(fIsFromMBHeader){
2284 if(abs(pdgCode) == 11) fHistoClusPhotonPlusConvBGPt[fiCut]->Fill(TruePhotonCandidate->Pt(),0);
2285 else if( abs(pdgCode)==211) fHistoClusPhotonPlusConvBGPt[fiCut]->Fill(TruePhotonCandidate->Pt(),1);
2286 else if( abs(pdgCode)==2212) fHistoClusPhotonPlusConvBGPt[fiCut]->Fill(TruePhotonCandidate->Pt(),2);
2287 else if( abs(pdgCode)==321) fHistoClusPhotonPlusConvBGPt[fiCut]->Fill(TruePhotonCandidate->Pt(),3);
2288 else if( abs(pdgCode)==2112) fHistoClusPhotonPlusConvBGPt[fiCut]->Fill(TruePhotonCandidate->Pt(),4);
2289 else if( abs(pdgCode)==310) fHistoClusPhotonPlusConvBGPt[fiCut]->Fill(TruePhotonCandidate->Pt(),5);
2290 else if( abs(pdgCode)==3122) fHistoClusPhotonPlusConvBGPt[fiCut]->Fill(TruePhotonCandidate->Pt(),6);
2291 else if( abs(pdgCode)==13) fHistoClusPhotonPlusConvBGPt[fiCut]->Fill(TruePhotonCandidate->Pt(),7);
2292 else fHistoClusPhotonPlusConvBGPt[fiCut]->Fill(TruePhotonCandidate->Pt(),8);
2293 }
2294}
2295
2296
2297void AliAnalysisTaskGammaCalo::SetLogBinningXTH2(TH2* histoRebin){
2298 TAxis *axisafter = histoRebin->GetXaxis();
2299 Int_t bins = axisafter->GetNbins();
2300 Double_t from = axisafter->GetXmin();
2301 Double_t to = axisafter->GetXmax();
2302 Double_t *newbins = new Double_t[bins+1];
2303 newbins[0] = from;
2304 Double_t factor = TMath::Power(to/from, 1./bins);
2305 for(Int_t i=1; i<=bins; ++i) newbins[i] = factor * newbins[i-1];
2306 axisafter->Set(bins, newbins);
2307 delete [] newbins;
2308}
2309
2310//________________________________________________________________________
2311void AliAnalysisTaskGammaCalo::Terminate(const Option_t *)
2312{
2313
2314 //fOutputContainer->Print(); // Will crash on GRID
2315}
2316
2317//________________________________________________________________________
2318Int_t AliAnalysisTaskGammaCalo::GetSourceClassification(Int_t daughter, Int_t pdgCode){
2319
2320 if (daughter == 111) {
2321 if (abs(pdgCode) == 310) return 1; // k0s
2322 else if (abs(pdgCode) == 3122) return 2; // Lambda
2323 else if (abs(pdgCode) == 130) return 3; // K0L
2324 else if (abs(pdgCode) == 2212) return 4; // proton
2325 else if (abs(pdgCode) == 2112) return 5; // neutron
2326 else if (abs(pdgCode) == 211) return 6; // pion
2327 else if (abs(pdgCode) == 321) return 7; // kaon
2328 else if (abs(pdgCode) == 113 || abs(pdgCode) == 213 ) return 8; // rho 0,+,-
2329 else if (abs(pdgCode) == 3222 || abs(pdgCode) == 3212 || abs(pdgCode) == 3112 ) return 9; // Sigma
2330 else if (abs(pdgCode) == 2224 || abs(pdgCode) == 2214 || abs(pdgCode) == 2114 || abs(pdgCode) == 1114 ) return 10; // Delta
2331 else if (abs(pdgCode) == 313 || abs(pdgCode) == 323 ) return 11; // K*
2332 else return 15;
2333 }
2334 return 15;
2335
2336}