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