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