- changes by Daniel to make CaloConv, Calo run on AODs , modifications in addtask
[u/mrichter/AliRoot.git] / PWGGA / GammaConv / AliAnalysisTaskGammaConvCalo.cxx
CommitLineData
8bdca7f1 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 "AliAnalysisTaskGammaConvCalo.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 "AliConversionAODBGHandlerRP.h"
50#include "AliAODMCParticle.h"
51#include "AliAODMCHeader.h"
52#include "AliEventplane.h"
53#include "AliAnalysisTaskEMCALClusterizeFast.h"
54#include "AliAODEvent.h"
55#include "AliAODInputHandler.h"
56#include "AliESDEvent.h"
57#include "AliESDInputHandler.h"
58#include "AliInputEventHandler.h"
59
60ClassImp(AliAnalysisTaskGammaConvCalo)
61
62//________________________________________________________________________
63AliAnalysisTaskGammaConvCalo::AliAnalysisTaskGammaConvCalo(): AliAnalysisTaskSE(),
64 fV0Reader(NULL),
65 fBGHandler(NULL),
66 fBGHandlerRP(NULL),
67 fBGClusHandler(NULL),
68 fBGClusHandlerRP(NULL),
69 fInputEvent(NULL),
70 fMCEvent(NULL),
71 fMCStack(NULL),
72 fCutFolder(NULL),
73 fESDList(NULL),
74 fBackList(NULL),
75 fMotherList(NULL),
76 fPhotonDCAList(NULL),
77 fMesonDCAList(NULL),
78 fTrueList(NULL),
79 fMCList(NULL),
80 fHeaderNameList(NULL),
81 fTagOutputList(NULL),
82 fOutputContainer(NULL),
83 fReaderGammas(NULL),
84 fGammaCandidates(NULL),
85 fClusterCandidates(NULL),
344100c4 86 fEventCutArray(NULL),
87 fEventCuts(NULL),
8bdca7f1 88 fCutArray(NULL),
89 fConversionCuts(NULL),
90 fClusterCutArray(NULL),
91 fCaloPhotonCuts(NULL),
92 fMesonCutArray(NULL),
93 fMesonCuts(NULL),
94 fHistoConvGammaPt(NULL),
95 fHistoConvGammaR(NULL),
96 fHistoConvGammaEta(NULL),
97 fTreeConvGammaPtDcazCat(NULL),
98 fPtGamma(0),
99 fDCAzPhoton(0),
100 fRConvPhoton(0),
101 fEtaPhoton(0),
102 fCharCatPhoton(0),
103 fCharPhotonMCInfo(0),
104 fHistoMotherInvMassPt(NULL),
d53bf4ac 105 fHistoMotherMatchedInvMassPt(NULL),
8bdca7f1 106 fSparseMotherInvMassPtZM(NULL),
107 fHistoMotherBackInvMassPt(NULL),
108 fSparseMotherBackInvMassPtZM(NULL),
109 fHistoMotherInvMassEalpha(NULL),
110 fHistoMotherPi0PtY(NULL),
111 fHistoMotherEtaPtY(NULL),
112 fHistoMotherPi0PtAlpha(NULL),
113 fHistoMotherEtaPtAlpha(NULL),
114 fHistoMotherPi0PtOpenAngle(NULL),
115 fHistoMotherEtaPtOpenAngle(NULL),
20af4b69 116 fHistoMotherInvMassECalib(NULL),
117 fHistoMotherInvMassECalibalpha(NULL),
8bdca7f1 118 fTreeMesonsInvMassPtDcazMinDcazMaxFlag(NULL),
119 fInvMass(0),
120 fPt(0),
121 fDCAzGammaMin(0),
122 fDCAzGammaMax(0),
123 fCharFlag(0),
124 fCharMesonMCInfo(0),
125 fHistoConvGammaUntagged(NULL),
126 fHistoConvGammaTagged(NULL),
127 fHistoConvGammaPi0Tagged(NULL),
128 fHistoConvGammaEtaTagged(NULL),
129 fHistoPhotonPairAll(NULL),
130 fHistoPhotonPairAllGam(NULL),
131 fHistoClusGammaPt(NULL),
132 fHistoMCHeaders(NULL),
133 fHistoMCAllGammaPt(NULL),
20af4b69 134 fHistoMCAllGammaEMCALAccPt(NULL),
8bdca7f1 135 fHistoMCDecayGammaPi0Pt(NULL),
136 fHistoMCDecayGammaRhoPt(NULL),
137 fHistoMCDecayGammaEtaPt(NULL),
138 fHistoMCDecayGammaOmegaPt(NULL),
139 fHistoMCDecayGammaEtapPt(NULL),
140 fHistoMCDecayGammaPhiPt(NULL),
141 fHistoMCDecayGammaSigmaPt(NULL),
142 fHistoMCConvGammaPt(NULL),
143 fHistoMCConvGammaR(NULL),
144 fHistoMCConvGammaEta(NULL),
145 fHistoMCPi0Pt(NULL),
146 fHistoMCPi0WOWeightPt(NULL),
147 fHistoMCEtaPt(NULL),
148 fHistoMCEtaWOWeightPt(NULL),
149 fHistoMCPi0InAccPt(NULL),
150 fHistoMCEtaInAccPt(NULL),
151 fHistoMCPi0PtY(NULL),
152 fHistoMCEtaPtY(NULL),
153 fHistoMCK0sPt(NULL),
154 fHistoMCK0sWOWeightPt(NULL),
155 fHistoMCK0sPtY(NULL),
156 fHistoMCSecPi0PtvsSource(NULL),
157 fHistoMCSecPi0Source(NULL),
158 fHistoMCSecEtaPt(NULL),
159 fHistoMCSecEtaSource(NULL),
ed8bc1ca 160 fHistoTruePi0InvMassPt(NULL),
161 fHistoTrueEtaInvMassPt(NULL),
162 fHistoTruePi0CaloPhotonInvMassPt(NULL),
163 fHistoTrueEtaCaloPhotonInvMassPt(NULL),
20af4b69 164 fHistoTruePi0CaloConvertedPhotonInvMassPt(NULL),
165 fHistoTruePi0CaloConvertedPhotonMatchedInvMassPt(NULL),
166 fHistoTrueEtaCaloConvertedPhotonInvMassPt(NULL),
167 fHistoTrueEtaCaloConvertedPhotonMatchedInvMassPt(NULL),
ed8bc1ca 168 fHistoTruePi0CaloElectronInvMassPt(NULL),
169 fHistoTrueEtaCaloElectronInvMassPt(NULL),
170 fHistoTruePi0CaloMergedClusterInvMassPt(NULL),
171 fHistoTrueEtaCaloMergedClusterInvMassPt(NULL),
fd94f234 172 fHistoTrueMotherCaloEMNonLeadingInvMassPt(NULL),
ed8bc1ca 173 fHistoTruePi0CaloMergedClusterPartConvInvMassPt(NULL),
174 fHistoTrueEtaCaloMergedClusterPartConvInvMassPt(NULL),
175 fHistoTruePrimaryPi0InvMassPt(NULL),
176 fHistoTruePrimaryEtaInvMassPt(NULL),
177 fHistoTruePrimaryPi0W0WeightingInvMassPt(NULL),
178 fHistoTruePrimaryEtaW0WeightingInvMassPt(NULL),
179 fProfileTruePrimaryPi0WeightsInvMassPt(NULL),
180 fProfileTruePrimaryEtaWeightsInvMassPt(NULL),
8bdca7f1 181 fHistoTruePrimaryPi0MCPtResolPt(NULL),
182 fHistoTruePrimaryEtaMCPtResolPt(NULL),
ed8bc1ca 183 fHistoTrueSecondaryPi0InvMassPt(NULL),
184 fHistoTrueSecondaryEtaInvMassPt(NULL),
185 fHistoTrueSecondaryPi0FromK0sInvMassPt(NULL),
8bdca7f1 186 fHistoTrueK0sWithPi0DaughterMCPt(NULL),
ed8bc1ca 187 fHistoTrueSecondaryPi0FromEtaInvMassPt(NULL),
8bdca7f1 188 fHistoTrueEtaWithPi0DaughterMCPt(NULL),
ed8bc1ca 189 fHistoTrueSecondaryPi0FromLambdaInvMassPt(NULL),
8bdca7f1 190 fHistoTrueLambdaWithPi0DaughterMCPt(NULL),
191 fHistoTrueBckGGInvMassPt(NULL),
192 fHistoTrueBckContInvMassPt(NULL),
193 fHistoTruePi0PtY(NULL),
194 fHistoTrueEtaPtY(NULL),
195 fHistoTruePi0PtAlpha(NULL),
196 fHistoTrueEtaPtAlpha(NULL),
197 fHistoTruePi0PtOpenAngle(NULL),
198 fHistoTrueEtaPtOpenAngle(NULL),
8bdca7f1 199 fHistoTrueConvGammaPt(NULL),
200 fHistoTrueConvPi0GammaPt(NULL),
201 fHistoTrueConvGammaEta(NULL),
202 fHistoCombinatorialPt(NULL),
203 fHistoTruePrimaryConvGammaPt(NULL),
204 fHistoTruePrimaryConvGammaESDPtMCPt(NULL),
205 fHistoTrueSecondaryConvGammaPt(NULL),
206 fHistoTrueSecondaryConvGammaFromXFromK0sPt(NULL),
207 fHistoTrueSecondaryConvGammaFromXFromLambdaPt(NULL),
8bdca7f1 208 fHistoTrueClusGammaPt(NULL),
fd94f234 209 fHistoTrueClusUnConvGammaPt(NULL),
20af4b69 210 fHistoTrueClusUnConvGammaMCPt(NULL),
fd94f234 211 fHistoTrueClusElectronPt(NULL),
212 fHistoTrueClusConvGammaPt(NULL),
20af4b69 213 fHistoTrueClusConvGammaMCPt(NULL),
fd94f234 214 fHistoTrueClusConvGammaFullyPt(NULL),
215 fHistoTrueClusMergedGammaPt(NULL),
216 fHistoTrueClusMergedPartConvGammaPt(NULL),
217 fHistoTrueClusDalitzPt(NULL),
218 fHistoTrueClusDalitzMergedPt(NULL),
219 fHistoTrueClusPhotonFromElecMotherPt(NULL),
220 fHistoTrueClusShowerPt(NULL),
cc579963 221 fHistoTrueClusSubLeadingPt(NULL),
222 fHistoTrueClusNParticles(NULL),
fd94f234 223 fHistoTrueClusEMNonLeadingPt(NULL),
224 fHistoTrueNLabelsInClus(NULL),
8bdca7f1 225 fHistoTruePrimaryClusGammaPt(NULL),
226 fHistoTruePrimaryClusGammaESDPtMCPt(NULL),
227 fHistoNEvents(NULL),
228 fHistoNGoodESDTracks(NULL),
229 fHistoNGammaCandidates(NULL),
230 fHistoNGoodESDTracksVsNGammaCanditates(NULL),
231 fHistoNV0Tracks(NULL),
232 fProfileEtaShift(NULL),
233 fEventPlaneAngle(-100),
234 fRandom(0),
235 fNGammaCandidates(0),
236 fUnsmearedPx(NULL),
237 fUnsmearedPy(NULL),
238 fUnsmearedPz(NULL),
239 fUnsmearedE(NULL),
240 fMCStackPos(NULL),
241 fMCStackNeg(NULL),
242 fESDArrayPos(NULL),
243 fESDArrayNeg(NULL),
244 fnCuts(0),
245 fiCut(0),
246 fMoveParticleAccordingToVertex(kTRUE),
247 fIsHeavyIon(0),
248 fDoMesonAnalysis(kTRUE),
249 fDoMesonQA(0),
250 fDoPhotonQA(0),
fd94f234 251 fDoClusterQA(0),
8bdca7f1 252 fIsFromMBHeader(kTRUE),
d53bf4ac 253 fIsMC(kFALSE)
8bdca7f1 254{
255
256}
257
258//________________________________________________________________________
259AliAnalysisTaskGammaConvCalo::AliAnalysisTaskGammaConvCalo(const char *name):
260 AliAnalysisTaskSE(name),
261 fV0Reader(NULL),
262 fBGHandler(NULL),
263 fBGHandlerRP(NULL),
264 fBGClusHandler(NULL),
265 fBGClusHandlerRP(NULL),
266 fInputEvent(NULL),
267 fMCEvent(NULL),
268 fMCStack(NULL),
269 fCutFolder(NULL),
270 fESDList(NULL),
271 fBackList(NULL),
272 fMotherList(NULL),
273 fPhotonDCAList(NULL),
274 fMesonDCAList(NULL),
275 fTrueList(NULL),
276 fMCList(NULL),
277 fHeaderNameList(NULL),
278 fTagOutputList(NULL),
279 fOutputContainer(0),
280 fReaderGammas(NULL),
281 fGammaCandidates(NULL),
282 fClusterCandidates(NULL),
344100c4 283 fEventCutArray(NULL),
284 fEventCuts(NULL),
8bdca7f1 285 fCutArray(NULL),
286 fConversionCuts(NULL),
287 fClusterCutArray(NULL),
288 fCaloPhotonCuts(NULL),
289 fMesonCutArray(NULL),
290 fMesonCuts(NULL),
291 fHistoConvGammaPt(NULL),
292 fHistoConvGammaR(NULL),
293 fHistoConvGammaEta(NULL),
294 fTreeConvGammaPtDcazCat(NULL),
295 fPtGamma(0),
296 fDCAzPhoton(0),
297 fRConvPhoton(0),
298 fEtaPhoton(0),
299 fCharCatPhoton(0),
300 fCharPhotonMCInfo(0),
301 fHistoMotherInvMassPt(NULL),
d53bf4ac 302 fHistoMotherMatchedInvMassPt(NULL),
8bdca7f1 303 fSparseMotherInvMassPtZM(NULL),
304 fHistoMotherBackInvMassPt(NULL),
305 fSparseMotherBackInvMassPtZM(NULL),
306 fHistoMotherInvMassEalpha(NULL),
307 fHistoMotherPi0PtY(NULL),
308 fHistoMotherEtaPtY(NULL),
309 fHistoMotherPi0PtAlpha(NULL),
310 fHistoMotherEtaPtAlpha(NULL),
311 fHistoMotherPi0PtOpenAngle(NULL),
312 fHistoMotherEtaPtOpenAngle(NULL),
20af4b69 313 fHistoMotherInvMassECalib(NULL),
314 fHistoMotherInvMassECalibalpha(NULL),
8bdca7f1 315 fTreeMesonsInvMassPtDcazMinDcazMaxFlag(NULL),
316 fInvMass(0),
317 fPt(0),
318 fDCAzGammaMin(0),
319 fDCAzGammaMax(0),
320 fCharFlag(0),
321 fCharMesonMCInfo(0),
322 fHistoConvGammaUntagged(NULL),
323 fHistoConvGammaTagged(NULL),
324 fHistoConvGammaPi0Tagged(NULL),
325 fHistoConvGammaEtaTagged(NULL),
326 fHistoPhotonPairAll(NULL),
327 fHistoPhotonPairAllGam(NULL),
328 fHistoClusGammaPt(NULL),
329 fHistoMCHeaders(NULL),
330 fHistoMCAllGammaPt(NULL),
20af4b69 331 fHistoMCAllGammaEMCALAccPt(NULL),
8bdca7f1 332 fHistoMCDecayGammaPi0Pt(NULL),
333 fHistoMCDecayGammaRhoPt(NULL),
334 fHistoMCDecayGammaEtaPt(NULL),
335 fHistoMCDecayGammaOmegaPt(NULL),
336 fHistoMCDecayGammaEtapPt(NULL),
337 fHistoMCDecayGammaPhiPt(NULL),
338 fHistoMCDecayGammaSigmaPt(NULL),
339 fHistoMCConvGammaPt(NULL),
340 fHistoMCConvGammaR(NULL),
341 fHistoMCConvGammaEta(NULL),
342 fHistoMCPi0Pt(NULL),
343 fHistoMCPi0WOWeightPt(NULL),
344 fHistoMCEtaPt(NULL),
345 fHistoMCEtaWOWeightPt(NULL),
346 fHistoMCPi0InAccPt(NULL),
347 fHistoMCEtaInAccPt(NULL),
348 fHistoMCPi0PtY(NULL),
349 fHistoMCEtaPtY(NULL),
350 fHistoMCK0sPt(NULL),
351 fHistoMCK0sWOWeightPt(NULL),
352 fHistoMCK0sPtY(NULL),
353 fHistoMCSecPi0PtvsSource(NULL),
354 fHistoMCSecPi0Source(NULL),
355 fHistoMCSecEtaPt(NULL),
356 fHistoMCSecEtaSource(NULL),
ed8bc1ca 357 fHistoTruePi0InvMassPt(NULL),
358 fHistoTrueEtaInvMassPt(NULL),
359 fHistoTruePi0CaloPhotonInvMassPt(NULL),
360 fHistoTrueEtaCaloPhotonInvMassPt(NULL),
20af4b69 361 fHistoTruePi0CaloConvertedPhotonInvMassPt(NULL),
362 fHistoTruePi0CaloConvertedPhotonMatchedInvMassPt(NULL),
363 fHistoTrueEtaCaloConvertedPhotonInvMassPt(NULL),
364 fHistoTrueEtaCaloConvertedPhotonMatchedInvMassPt(NULL),
ed8bc1ca 365 fHistoTruePi0CaloElectronInvMassPt(NULL),
366 fHistoTrueEtaCaloElectronInvMassPt(NULL),
367 fHistoTruePi0CaloMergedClusterInvMassPt(NULL),
368 fHistoTrueEtaCaloMergedClusterInvMassPt(NULL),
fd94f234 369 fHistoTrueMotherCaloEMNonLeadingInvMassPt(NULL),
ed8bc1ca 370 fHistoTruePi0CaloMergedClusterPartConvInvMassPt(NULL),
371 fHistoTrueEtaCaloMergedClusterPartConvInvMassPt(NULL),
372 fHistoTruePrimaryPi0InvMassPt(NULL),
373 fHistoTruePrimaryEtaInvMassPt(NULL),
374 fHistoTruePrimaryPi0W0WeightingInvMassPt(NULL),
375 fHistoTruePrimaryEtaW0WeightingInvMassPt(NULL),
376 fProfileTruePrimaryPi0WeightsInvMassPt(NULL),
377 fProfileTruePrimaryEtaWeightsInvMassPt(NULL),
8bdca7f1 378 fHistoTruePrimaryPi0MCPtResolPt(NULL),
379 fHistoTruePrimaryEtaMCPtResolPt(NULL),
ed8bc1ca 380 fHistoTrueSecondaryPi0InvMassPt(NULL),
381 fHistoTrueSecondaryEtaInvMassPt(NULL),
382 fHistoTrueSecondaryPi0FromK0sInvMassPt(NULL),
8bdca7f1 383 fHistoTrueK0sWithPi0DaughterMCPt(NULL),
ed8bc1ca 384 fHistoTrueSecondaryPi0FromEtaInvMassPt(NULL),
8bdca7f1 385 fHistoTrueEtaWithPi0DaughterMCPt(NULL),
ed8bc1ca 386 fHistoTrueSecondaryPi0FromLambdaInvMassPt(NULL),
8bdca7f1 387 fHistoTrueLambdaWithPi0DaughterMCPt(NULL),
388 fHistoTrueBckGGInvMassPt(NULL),
389 fHistoTrueBckContInvMassPt(NULL),
390 fHistoTruePi0PtY(NULL),
391 fHistoTrueEtaPtY(NULL),
392 fHistoTruePi0PtAlpha(NULL),
393 fHistoTrueEtaPtAlpha(NULL),
394 fHistoTruePi0PtOpenAngle(NULL),
395 fHistoTrueEtaPtOpenAngle(NULL),
8bdca7f1 396 fHistoTrueConvGammaPt(NULL),
397 fHistoTrueConvPi0GammaPt(NULL),
398 fHistoTrueConvGammaEta(NULL),
399 fHistoCombinatorialPt(NULL),
400 fHistoTruePrimaryConvGammaPt(NULL),
401 fHistoTruePrimaryConvGammaESDPtMCPt(NULL),
402 fHistoTrueSecondaryConvGammaPt(NULL),
403 fHistoTrueSecondaryConvGammaFromXFromK0sPt(NULL),
404 fHistoTrueSecondaryConvGammaFromXFromLambdaPt(NULL),
8bdca7f1 405 fHistoTrueClusGammaPt(NULL),
fd94f234 406 fHistoTrueClusUnConvGammaPt(NULL),
20af4b69 407 fHistoTrueClusUnConvGammaMCPt(NULL),
fd94f234 408 fHistoTrueClusElectronPt(NULL),
409 fHistoTrueClusConvGammaPt(NULL),
20af4b69 410 fHistoTrueClusConvGammaMCPt(NULL),
fd94f234 411 fHistoTrueClusConvGammaFullyPt(NULL),
412 fHistoTrueClusMergedGammaPt(NULL),
413 fHistoTrueClusMergedPartConvGammaPt(NULL),
414 fHistoTrueClusDalitzPt(NULL),
415 fHistoTrueClusDalitzMergedPt(NULL),
416 fHistoTrueClusPhotonFromElecMotherPt(NULL),
417 fHistoTrueClusShowerPt(NULL),
cc579963 418 fHistoTrueClusSubLeadingPt(NULL),
419 fHistoTrueClusNParticles(NULL),
fd94f234 420 fHistoTrueClusEMNonLeadingPt(NULL),
421 fHistoTrueNLabelsInClus(NULL),
8bdca7f1 422 fHistoTruePrimaryClusGammaPt(NULL),
423 fHistoTruePrimaryClusGammaESDPtMCPt(NULL),
424 fHistoNEvents(NULL),
425 fHistoNGoodESDTracks(NULL),
426 fHistoNGammaCandidates(NULL),
427 fHistoNGoodESDTracksVsNGammaCanditates(NULL),
428 fHistoNV0Tracks(NULL),
429 fProfileEtaShift(NULL),
430 fEventPlaneAngle(-100),
431 fRandom(0),
432 fNGammaCandidates(0),
433 fUnsmearedPx(NULL),
434 fUnsmearedPy(NULL),
435 fUnsmearedPz(NULL),
436 fUnsmearedE(NULL),
437 fMCStackPos(NULL),
438 fMCStackNeg(NULL),
439 fESDArrayPos(NULL),
440 fESDArrayNeg(NULL),
441 fnCuts(0),
442 fiCut(0),
443 fMoveParticleAccordingToVertex(kTRUE),
444 fIsHeavyIon(0),
445 fDoMesonAnalysis(kTRUE),
446 fDoMesonQA(0),
447 fDoPhotonQA(0),
fd94f234 448 fDoClusterQA(0),
8bdca7f1 449 fIsFromMBHeader(kTRUE),
d53bf4ac 450 fIsMC(kFALSE)
8bdca7f1 451{
452 // Define output slots here
453 DefineOutput(1, TList::Class());
454}
455
456AliAnalysisTaskGammaConvCalo::~AliAnalysisTaskGammaConvCalo()
457{
458 if(fGammaCandidates){
459 delete fGammaCandidates;
460 fGammaCandidates = 0x0;
461 }
462 if(fClusterCandidates){
463 delete fClusterCandidates;
464 fClusterCandidates = 0x0;
465 }
466 if(fBGHandler){
467 delete[] fBGHandler;
468 fBGHandler = 0x0;
469 }
470 if(fBGHandlerRP){
471 delete[] fBGHandlerRP;
472 fBGHandlerRP = 0x0;
473 }
474 if(fBGClusHandler){
475 delete[] fBGClusHandler;
476 fBGClusHandler = 0x0;
477 }
478 if(fBGClusHandlerRP){
479 delete[] fBGClusHandlerRP;
480 fBGClusHandlerRP = 0x0;
481 }
482}
483//___________________________________________________________
484void AliAnalysisTaskGammaConvCalo::InitBack(){
485
486 const Int_t nDim = 4;
487 Int_t nBins[nDim] = {800,250,7,4};
488 Double_t xMin[nDim] = {0,0, 0,0};
489 Double_t xMax[nDim] = {0.8,25,7,4};
490
491 fSparseMotherInvMassPtZM = new THnSparseF*[fnCuts];
492 fSparseMotherBackInvMassPtZM = new THnSparseF*[fnCuts];
493
494 fBGHandler = new AliGammaConversionAODBGHandler*[fnCuts];
495 fBGHandlerRP = new AliConversionAODBGHandlerRP*[fnCuts];
496
497 fBGClusHandler = new AliGammaConversionAODBGHandler*[fnCuts];
498 fBGClusHandlerRP = new AliConversionAODBGHandlerRP*[fnCuts];
499
500 for(Int_t iCut = 0; iCut<fnCuts;iCut++){
501 if (((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->DoBGCalculation()){
344100c4 502 TString cutstringEvent = ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber();
503 TString cutstringPhoton = ((AliConversionPhotonCuts*)fCutArray->At(iCut))->GetCutNumber();
504 TString cutstringCalo = ((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetCutNumber();
505 TString cutstringMeson = ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutNumber();
8bdca7f1 506
344100c4 507 Int_t collisionSystem = atoi((TString)(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber())(0,1));
508 Int_t centMin = atoi((TString)(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber())(1,1));
509 Int_t centMax = atoi((TString)(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber())(2,1));
8bdca7f1 510
511 if(collisionSystem == 1 || collisionSystem == 2 ||
512 collisionSystem == 5 || collisionSystem == 8 ||
513 collisionSystem == 9){
514 centMin = centMin*10;
515 centMax = centMax*10;
516 if(centMax ==0 && centMax!=centMin) centMax=100;
517 } else if(collisionSystem == 3 || collisionSystem == 6){
518 centMin = centMin*5;
519 centMax = centMax*5;
520 } else if(collisionSystem == 4 || collisionSystem == 7){
521 centMin = ((centMin*5)+45);
522 centMax = ((centMax*5)+45);
523 }
524
525 fBackList[iCut] = new TList();
344100c4 526 fBackList[iCut]->SetName(Form("%s_%s_%s_%s Back histograms",cutstringEvent.Data(),cutstringPhoton.Data(),cutstringCalo.Data(), cutstringMeson.Data()));
8bdca7f1 527 fBackList[iCut]->SetOwner(kTRUE);
528 fCutFolder[iCut]->Add(fBackList[iCut]);
529
530 fSparseMotherBackInvMassPtZM[iCut] = new THnSparseF("Back_Back_InvMass_Pt_z_m","Back_Back_InvMass_Pt_z_m",nDim,nBins,xMin,xMax);
531 fBackList[iCut]->Add(fSparseMotherBackInvMassPtZM[iCut]);
532
533 fMotherList[iCut] = new TList();
344100c4 534 fMotherList[iCut]->SetName(Form("%s_%s_%s_%s Mother histograms",cutstringEvent.Data(),cutstringPhoton.Data(),cutstringCalo.Data(),cutstringMeson.Data()));
8bdca7f1 535 fMotherList[iCut]->SetOwner(kTRUE);
536 fCutFolder[iCut]->Add(fMotherList[iCut]);
537
538 fSparseMotherInvMassPtZM[iCut] = new THnSparseF("Back_Mother_InvMass_Pt_z_m","Back_Mother_InvMass_Pt_z_m",nDim,nBins,xMin,xMax);
539 fMotherList[iCut]->Add(fSparseMotherInvMassPtZM[iCut]);
540
541 if(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->BackgroundHandlerType() == 0){
542 fBGHandler[iCut] = new AliGammaConversionAODBGHandler(
543 collisionSystem,centMin,centMax,
544 ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetNumberOfBGEvents(),
545 ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->UseTrackMultiplicity());
546 fBGClusHandler[iCut] = new AliGammaConversionAODBGHandler(
547 collisionSystem,centMin,centMax,
548 ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetNumberOfBGEvents(),
549 ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->UseTrackMultiplicity());
550 fBGHandlerRP[iCut] = NULL;
551 } else{
552 fBGHandlerRP[iCut] = new AliConversionAODBGHandlerRP(
344100c4 553 ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsHeavyIon(),
8bdca7f1 554 ((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->UseTrackMultiplicity(),
555 ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetNumberOfBGEvents());
556 fBGClusHandlerRP[iCut] = new AliConversionAODBGHandlerRP(
344100c4 557 ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsHeavyIon(),
8bdca7f1 558 ((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->UseTrackMultiplicity(),
559 ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetNumberOfBGEvents());
560 fBGHandler[iCut] = NULL;
561 }
562 }
563 }
564}
565//________________________________________________________________________
566void AliAnalysisTaskGammaConvCalo::UserCreateOutputObjects(){
567
568 // Create histograms
569 if(fOutputContainer != NULL){
570 delete fOutputContainer;
571 fOutputContainer = NULL;
572 }
573 if(fOutputContainer == NULL){
574 fOutputContainer = new TList();
575 fOutputContainer->SetOwner(kTRUE);
576 }
577
578 // Array of current cut's gammas
579 fGammaCandidates = new TList();
580 fClusterCandidates = new TList();
581
582 fCutFolder = new TList*[fnCuts];
583 fESDList = new TList*[fnCuts];
584 fBackList = new TList*[fnCuts];
585 fMotherList = new TList*[fnCuts];
586 fHistoNEvents = new TH1I*[fnCuts];
587 fHistoNGoodESDTracks = new TH1I*[fnCuts];
588 fHistoNGammaCandidates = new TH1I*[fnCuts];
589 fHistoNGoodESDTracksVsNGammaCanditates = new TH2F*[fnCuts];
590 fHistoNV0Tracks = new TH1I*[fnCuts];
591 fProfileEtaShift = new TProfile*[fnCuts];
592 fHistoConvGammaPt = new TH1F*[fnCuts];
593
594 if (fDoPhotonQA == 2){
595 fPhotonDCAList = new TList*[fnCuts];
596 fTreeConvGammaPtDcazCat = new TTree*[fnCuts];
597 }
598 if (fDoPhotonQA > 0){
599 fHistoConvGammaR = new TH1F*[fnCuts];
600 fHistoConvGammaEta = new TH1F*[fnCuts];
601 }
602
603 if(fDoMesonAnalysis){
604 fHistoMotherInvMassPt = new TH2F*[fnCuts];
d53bf4ac 605 fHistoMotherMatchedInvMassPt = new TH2F*[fnCuts];
8bdca7f1 606 fHistoMotherBackInvMassPt = new TH2F*[fnCuts];
607 fHistoMotherInvMassEalpha = new TH2F*[fnCuts];
608 if (fDoMesonQA == 2){
609 fMesonDCAList = new TList*[fnCuts];
610 fTreeMesonsInvMassPtDcazMinDcazMaxFlag = new TTree*[fnCuts];
611 }
612 if (fDoMesonQA > 0){
613 fHistoMotherPi0PtY = new TH2F*[fnCuts];
614 fHistoMotherEtaPtY = new TH2F*[fnCuts];
615 fHistoMotherPi0PtAlpha = new TH2F*[fnCuts];
616 fHistoMotherEtaPtAlpha = new TH2F*[fnCuts];
617 fHistoMotherPi0PtOpenAngle = new TH2F*[fnCuts];
618 fHistoMotherEtaPtOpenAngle = new TH2F*[fnCuts];
619 }
20af4b69 620 if(fDoMesonQA == 1){
621 fHistoMotherInvMassECalib = new TH2F*[fnCuts];
622 fHistoMotherInvMassECalibalpha = new TH2F*[fnCuts];
623 }
8bdca7f1 624 }
625 fTagOutputList = new TList*[fnCuts];
626
627 fHistoConvGammaUntagged = new TH1F*[fnCuts];
628 fHistoConvGammaTagged = new TH1F*[fnCuts];
629 fHistoConvGammaPi0Tagged = new TH1F*[fnCuts];
630 fHistoConvGammaEtaTagged = new TH1F*[fnCuts];
631 fHistoPhotonPairAll = new TH2F*[fnCuts];
632 fHistoPhotonPairAllGam = new TH2F*[fnCuts];
633
634 fHistoClusGammaPt = new TH1F*[fnCuts];
635
636 for(Int_t iCut = 0; iCut<fnCuts;iCut++){
344100c4 637 TString cutstringEvent = ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber();
638 TString cutstringPhoton = ((AliConversionPhotonCuts*)fCutArray->At(iCut))->GetCutNumber();
639 TString cutstringCalo = ((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetCutNumber();
640 TString cutstringMeson = "NoMesonCut";
8bdca7f1 641 if(fDoMesonAnalysis)cutstringMeson = ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutNumber();
642
643 fCutFolder[iCut] = new TList();
344100c4 644 fCutFolder[iCut]->SetName(Form("Cut Number %s_%s_%s_%s",cutstringEvent.Data(),cutstringPhoton.Data(),cutstringCalo.Data(),cutstringMeson.Data()));
8bdca7f1 645 fCutFolder[iCut]->SetOwner(kTRUE);
646 fOutputContainer->Add(fCutFolder[iCut]);
647 fESDList[iCut] = new TList();
344100c4 648 fESDList[iCut]->SetName(Form("%s_%s_%s_%s ESD histograms",cutstringEvent.Data(),cutstringPhoton.Data(),cutstringCalo.Data(),cutstringMeson.Data()));
8bdca7f1 649 fESDList[iCut]->SetOwner(kTRUE);
650 fCutFolder[iCut]->Add(fESDList[iCut]);
651
652 fHistoNEvents[iCut] = new TH1I("NEvents","NEvents",9,-0.5,8.5);
653 fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(1,"Accepted");
654 fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(2,"Centrality");
655 fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(3,"Missing MC");
344100c4 656 if (((AliConvEventCuts*)fEventCutArray->At(iCut))->IsSpecialTrigger() == 4 ){
8bdca7f1 657 TString TriggerNames = "Not Trigger: ";
344100c4 658 TriggerNames = TriggerNames+ ( (AliConvEventCuts*)fEventCutArray->At(iCut))->GetSpecialTriggerName();
8bdca7f1 659 fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(4,TriggerNames.Data());
660 } else {
661 fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(4,"Trigger");
662 }
663 fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(5,"Vertex Z");
664 fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(6,"Cont. Vertex");
665 fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(7,"Pile-Up");
666 fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(8,"no SDD");
667 fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(9,"no V0AND");
668 fESDList[iCut]->Add(fHistoNEvents[iCut]);
669
670 if(fIsHeavyIon == 1) fHistoNGoodESDTracks[iCut] = new TH1I("GoodESDTracks","GoodESDTracks",4000,0,4000);
671 else if(fIsHeavyIon == 2) fHistoNGoodESDTracks[iCut] = new TH1I("GoodESDTracks","GoodESDTracks",400,0,400);
672 else fHistoNGoodESDTracks[iCut] = new TH1I("GoodESDTracks","GoodESDTracks",200,0,200);
673 fESDList[iCut]->Add(fHistoNGoodESDTracks[iCut]);
674 if(fIsHeavyIon == 1) fHistoNGammaCandidates[iCut] = new TH1I("GammaCandidates","GammaCandidates",100,0,100);
675 else if(fIsHeavyIon == 2) fHistoNGammaCandidates[iCut] = new TH1I("GammaCandidates","GammaCandidates",50,0,50);
676 else fHistoNGammaCandidates[iCut] = new TH1I("GammaCandidates","GammaCandidates",50,0,50);
677 fESDList[iCut]->Add(fHistoNGammaCandidates[iCut]);
678 if(fIsHeavyIon == 1) fHistoNGoodESDTracksVsNGammaCanditates[iCut] = new TH2F("GoodESDTracksVsGammaCandidates","GoodESDTracksVsGammaCandidates",4000,0,4000,100,0,100);
679 else if(fIsHeavyIon == 2) fHistoNGoodESDTracksVsNGammaCanditates[iCut] = new TH2F("GoodESDTracksVsGammaCandidates","GoodESDTracksVsGammaCandidates",400,0,400,50,0,50);
680 else fHistoNGoodESDTracksVsNGammaCanditates[iCut] = new TH2F("GoodESDTracksVsGammaCandidates","GoodESDTracksVsGammaCandidates",200,0,200,50,0,50);
681 fESDList[iCut]->Add(fHistoNGoodESDTracksVsNGammaCanditates[iCut]);
682
683
684 if(fIsHeavyIon == 1) fHistoNV0Tracks[iCut] = new TH1I("V0 Multiplicity","V0 Multiplicity",30000,0,30000);
685 else if(fIsHeavyIon == 2) fHistoNV0Tracks[iCut] = new TH1I("V0 Multiplicity","V0 Multiplicity",2500,0,2500);
686 else fHistoNV0Tracks[iCut] = new TH1I("V0 Multiplicity","V0 Multiplicity",1500,0,1500);
687 fESDList[iCut]->Add(fHistoNV0Tracks[iCut]);
688 fProfileEtaShift[iCut] = new TProfile("Eta Shift","Eta Shift",1, -0.5,0.5);
689 fESDList[iCut]->Add(fProfileEtaShift[iCut]);
690 fHistoConvGammaPt[iCut] = new TH1F("ESD_ConvGamma_Pt","ESD_ConvGamma_Pt",250,0,25);
691 fESDList[iCut]->Add(fHistoConvGammaPt[iCut]);
692
693 if (fDoPhotonQA == 2){
694 fPhotonDCAList[iCut] = new TList();
344100c4 695 fPhotonDCAList[iCut]->SetName(Form("%s_%s_%s_%s Photon DCA tree",cutstringEvent.Data(),cutstringPhoton.Data(),cutstringCalo.Data(),cutstringMeson.Data()));
8bdca7f1 696 fPhotonDCAList[iCut]->SetOwner(kTRUE);
697 fCutFolder[iCut]->Add(fPhotonDCAList[iCut]);
698
699 fTreeConvGammaPtDcazCat[iCut] = new TTree("ESD_ConvGamma_Pt_Dcaz_R_Eta","ESD_ConvGamma_Pt_Dcaz_R_Eta_Cat");
700 fTreeConvGammaPtDcazCat[iCut]->Branch("Pt",&fPtGamma,"fPtGamma/F");
701 fTreeConvGammaPtDcazCat[iCut]->Branch("DcaZPhoton",&fDCAzPhoton,"fDCAzPhoton/F");
702 // fTreeConvGammaPtDcazCat[iCut]->Branch("R",&fRConvPhoton,"fRConvPhoton/F");
703 // fTreeConvGammaPtDcazCat[iCut]->Branch("Eta",&fEtaPhoton,"fEtaPhoton/F");
704
705 fTreeConvGammaPtDcazCat[iCut]->Branch("cat",&fCharCatPhoton,"fCharCatPhoton/b");
706 if(fIsMC){
707 fTreeConvGammaPtDcazCat[iCut]->Branch("photonMCInfo",&fCharPhotonMCInfo,"fCharPhotonMCInfo/b");
708 }
709 fPhotonDCAList[iCut]->Add(fTreeConvGammaPtDcazCat[iCut]);
710 }
711
712 if (fDoPhotonQA > 0){
713 fHistoConvGammaR[iCut] = new TH1F("ESD_ConvGamma_R","ESD_ConvGamma_R",800,0,200);
714 fESDList[iCut]->Add(fHistoConvGammaR[iCut]);
715 fHistoConvGammaEta[iCut] = new TH1F("ESD_ConvGamma_Eta","ESD_ConvGamma_Eta",2000,-2,2);
716 fESDList[iCut]->Add(fHistoConvGammaEta[iCut]);
717 }
718
719 fTagOutputList[iCut] = new TList();
344100c4 720 fTagOutputList[iCut]->SetName(Form("%s_%s_%s_%s Tagging Output",cutstringEvent.Data(),cutstringPhoton.Data(),cutstringCalo.Data(),cutstringMeson.Data()));
8bdca7f1 721 fTagOutputList[iCut]->SetOwner(1);
722 fCutFolder[iCut]->Add(fTagOutputList[iCut]);
723
724 const Int_t nptbins = 200;
725 const Double_t ptmin = 0.;
726 const Double_t ptmax = 20.;
727
728 const Int_t nmbins = 180;
729 const Double_t mmin = 0.;
730 const Double_t mmax = 0.9;
731
732 // photon candidates
733 // this is maybe not necessary ...
734
735 fHistoConvGammaUntagged[iCut] = new TH1F("ConvGammaUntagged","",nptbins,ptmin,ptmax);
736 fHistoConvGammaUntagged[iCut]->SetXTitle("p_{T} (GeV/c)");
737 fTagOutputList[iCut]->Add(fHistoConvGammaUntagged[iCut]);
738
739 fHistoConvGammaTagged[iCut] = new TH1F("ConvGammaTagged","",nptbins,ptmin,ptmax);
740 fHistoConvGammaTagged[iCut]->SetXTitle("p_{T} (GeV/c)");
741 fTagOutputList[iCut]->Add(fHistoConvGammaTagged[iCut]);
742
743 fHistoConvGammaPi0Tagged[iCut] = new TH1F("ConvGammaPi0Tagged","",nptbins,ptmin,ptmax);
744 fHistoConvGammaPi0Tagged[iCut]->SetXTitle("p_{T} (GeV/c)");
745 fTagOutputList[iCut]->Add(fHistoConvGammaPi0Tagged[iCut]);
746
747 fHistoConvGammaEtaTagged[iCut] = new TH1F("ConvGammaEtaTagged","",nptbins,ptmin,ptmax);
748 fHistoConvGammaEtaTagged[iCut]->SetXTitle("p_{T} (GeV/c)");
749 fTagOutputList[iCut]->Add(fHistoConvGammaEtaTagged[iCut]);
750
751 // pairs
752 fHistoPhotonPairAll[iCut] = new TH2F("PhotonPairAll","",nmbins,mmin,mmax,nptbins,ptmin,ptmax);
753 fHistoPhotonPairAll[iCut]->SetXTitle("M_{inv} (GeV/cc)");
754 fHistoPhotonPairAll[iCut]->SetYTitle("p_{T} (GeV/c)");
755 fTagOutputList[iCut]->Add(fHistoPhotonPairAll[iCut]);
756
757 fHistoPhotonPairAllGam[iCut] = new TH2F("PhotonPairAllGammaConvPt","",nmbins,mmin,mmax,nptbins,ptmin,ptmax);
758 fHistoPhotonPairAllGam[iCut]->SetXTitle("M_{inv} (GeV/cc)");
759 fHistoPhotonPairAllGam[iCut]->SetYTitle("#gamma^{conv} p_{T} (GeV/c)");
760 fTagOutputList[iCut]->Add(fHistoPhotonPairAllGam[iCut]);
761
762 fHistoClusGammaPt[iCut] = new TH1F("ClusGamma_Pt","ClusGamma_Pt",250,0,25);
763 fTagOutputList[iCut]->Add(fHistoClusGammaPt[iCut]);
764
765
766 if(fDoMesonAnalysis){
767 fHistoMotherInvMassPt[iCut] = new TH2F("ESD_Mother_InvMass_Pt","ESD_Mother_InvMass_Pt",800,0,0.8,250,0,25);
768 fESDList[iCut]->Add(fHistoMotherInvMassPt[iCut]);
d53bf4ac 769 fHistoMotherMatchedInvMassPt[iCut] = new TH2F("ESD_MotherMatched_InvMass_Pt","ESD_MotherMatched_InvMass_Pt",800,0,0.8,250,0,25);
770 fESDList[iCut]->Add(fHistoMotherMatchedInvMassPt[iCut]);
8bdca7f1 771 fHistoMotherBackInvMassPt[iCut] = new TH2F("ESD_Background_InvMass_Pt","ESD_Background_InvMass_Pt",800,0,0.8,250,0,25);
772 fESDList[iCut]->Add(fHistoMotherBackInvMassPt[iCut]);
773 fHistoMotherInvMassEalpha[iCut] = new TH2F("ESD_Mother_InvMass_vs_E_alpha","ESD_Mother_InvMass_vs_E_alpha",800,0,0.8,250,0,25);
774 fESDList[iCut]->Add(fHistoMotherInvMassEalpha[iCut]);
775 if (fDoMesonQA == 2){
776 fMesonDCAList[iCut] = new TList();
344100c4 777 fMesonDCAList[iCut]->SetName(Form("%s_%s_%s_%s Meson DCA tree",cutstringEvent.Data(),cutstringPhoton.Data(),cutstringCalo.Data(),cutstringMeson.Data()));
8bdca7f1 778 fMesonDCAList[iCut]->SetOwner(kTRUE);
779 fCutFolder[iCut]->Add(fMesonDCAList[iCut]);
780
781 fTreeMesonsInvMassPtDcazMinDcazMaxFlag[iCut] = new TTree("ESD_Mesons_InvMass_Pt_DcazMin_DcazMax_Flag","ESD_Mesons_InvMass_Pt_DcazMin_DcazMax_Flag");
782 fTreeMesonsInvMassPtDcazMinDcazMaxFlag[iCut]->Branch("InvMass",&fInvMass,"fInvMass/F");
783 fTreeMesonsInvMassPtDcazMinDcazMaxFlag[iCut]->Branch("Pt",&fPt,"fPt/F");
784 fTreeMesonsInvMassPtDcazMinDcazMaxFlag[iCut]->Branch("DcaZMin",&fDCAzGammaMin,"fDCAzGammaMin/F");
785 fTreeMesonsInvMassPtDcazMinDcazMaxFlag[iCut]->Branch("DcaZMax",&fDCAzGammaMax,"fDCAzGammaMax/F");
786 fTreeMesonsInvMassPtDcazMinDcazMaxFlag[iCut]->Branch("kind",&fCharFlag,"fCharFlag/b");
787 if(fIsMC){
788 fTreeMesonsInvMassPtDcazMinDcazMaxFlag[iCut]->Branch("mesonMCInfo",&fCharMesonMCInfo,"fCharMesonMCInfo/b");
789 }
790 fMesonDCAList[iCut]->Add(fTreeMesonsInvMassPtDcazMinDcazMaxFlag[iCut]);
791
792 }
20af4b69 793 if(fDoMesonQA == 1){
794 fHistoMotherInvMassECalib[iCut] = new TH2F("ESD_Mother_InvMass_Pt_Calib","ESD_Mother_InvMass_Pt_Calib",800,0,0.8,250,0,25);
795 fESDList[iCut]->Add(fHistoMotherInvMassECalib[iCut]);
796 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);
797 fESDList[iCut]->Add(fHistoMotherInvMassECalibalpha[iCut]);
798 }
799
8bdca7f1 800 if (fDoMesonQA > 0 ){
801 fHistoMotherPi0PtY[iCut] = new TH2F("ESD_MotherPi0_Pt_Y","ESD_MotherPi0_Pt_Y",150,0.03,15.,150,-1.5,1.5);
802 SetLogBinningXTH2(fHistoMotherPi0PtY[iCut]);
803 fESDList[iCut]->Add(fHistoMotherPi0PtY[iCut]);
804 fHistoMotherEtaPtY[iCut] = new TH2F("ESD_MotherEta_Pt_Y","ESD_MotherEta_Pt_Y",150,0.03,15.,150,-1.5,1.5);
805 SetLogBinningXTH2(fHistoMotherEtaPtY[iCut]);
806 fESDList[iCut]->Add(fHistoMotherEtaPtY[iCut]);
807 fHistoMotherPi0PtAlpha[iCut] = new TH2F("ESD_MotherPi0_Pt_Alpha","ESD_MotherPi0_Pt_Alpha",150,0.03,15.,100,0,1);
808 SetLogBinningXTH2(fHistoMotherPi0PtAlpha[iCut]);
809 fESDList[iCut]->Add(fHistoMotherPi0PtAlpha[iCut]);
810 fHistoMotherEtaPtAlpha[iCut] = new TH2F("ESD_MotherEta_Pt_Alpha","ESD_MotherEta_Pt_Alpha",150,0.03,15.,100,0,1);
811 SetLogBinningXTH2(fHistoMotherEtaPtAlpha[iCut]);
812 fESDList[iCut]->Add(fHistoMotherEtaPtAlpha[iCut]);
813 fHistoMotherPi0PtOpenAngle[iCut] = new TH2F("ESD_MotherPi0_Pt_OpenAngle","ESD_MotherPi0_Pt_OpenAngle",150,0.03,15.,200,0,2*TMath::Pi());
814 SetLogBinningXTH2(fHistoMotherPi0PtOpenAngle[iCut]);
815 fESDList[iCut]->Add(fHistoMotherPi0PtOpenAngle[iCut]);
816 fHistoMotherEtaPtOpenAngle[iCut] = new TH2F("ESD_MotherEta_Pt_OpenAngle","ESD_MotherEta_Pt_OpenAngle",150,0.03,15.,200,0,2*TMath::Pi());
817 SetLogBinningXTH2(fHistoMotherEtaPtOpenAngle[iCut]);
818 fESDList[iCut]->Add(fHistoMotherEtaPtOpenAngle[iCut]);
819 }
820 }
821 }
822 if(fDoMesonAnalysis){
823 InitBack(); // Init Background Handler
824 }
825
826 if(fIsMC){
827 // MC Histogramms
fd94f234 828 fMCList = new TList*[fnCuts];
8bdca7f1 829 // True Histogramms
fd94f234 830 fTrueList = new TList*[fnCuts];
8bdca7f1 831 // Selected Header List
fd94f234 832 fHeaderNameList = new TList*[fnCuts];
833 fHistoMCHeaders = new TH1I*[fnCuts];
834 fHistoMCAllGammaPt = new TH1F*[fnCuts];
20af4b69 835 fHistoMCAllGammaEMCALAccPt = new TH1F*[fnCuts];
fd94f234 836 fHistoMCDecayGammaPi0Pt = new TH1F*[fnCuts];
837 fHistoMCDecayGammaRhoPt = new TH1F*[fnCuts];
838 fHistoMCDecayGammaEtaPt = new TH1F*[fnCuts];
839 fHistoMCDecayGammaOmegaPt = new TH1F*[fnCuts];
840 fHistoMCDecayGammaEtapPt = new TH1F*[fnCuts];
841 fHistoMCDecayGammaPhiPt = new TH1F*[fnCuts];
842 fHistoMCDecayGammaSigmaPt = new TH1F*[fnCuts];
843 fHistoMCConvGammaPt = new TH1F*[fnCuts];
844 fHistoTrueConvGammaPt = new TH1F*[fnCuts];
845 fHistoTrueConvPi0GammaPt = new TH1F*[fnCuts];
8bdca7f1 846
fd94f234 847 fHistoCombinatorialPt = new TH2F*[fnCuts];
848 fHistoTruePrimaryConvGammaPt = new TH1F*[fnCuts];
849 fHistoTruePrimaryConvGammaESDPtMCPt = new TH2F*[fnCuts];
850 fHistoTrueSecondaryConvGammaPt = new TH1F*[fnCuts];
851 fHistoTrueSecondaryConvGammaFromXFromK0sPt = new TH1F*[fnCuts];
852 fHistoTrueSecondaryConvGammaFromXFromLambdaPt = new TH1F*[fnCuts];
8bdca7f1 853
fd94f234 854 fHistoTrueClusGammaPt = new TH1F*[fnCuts];
855 fHistoTruePrimaryClusGammaPt = new TH1F*[fnCuts];
8bdca7f1 856 fHistoTruePrimaryClusGammaESDPtMCPt = new TH2F*[fnCuts];
857
858 if (fDoPhotonQA > 0){
fd94f234 859 fHistoMCConvGammaR = new TH1F*[fnCuts];
860 fHistoMCConvGammaEta = new TH1F*[fnCuts];
861 fHistoTrueConvGammaEta = new TH1F*[fnCuts];
862 }
863 if (fDoClusterQA > 0){
864 fHistoTrueClusUnConvGammaPt = new TH1F*[fnCuts];
20af4b69 865 fHistoTrueClusUnConvGammaMCPt = new TH1F*[fnCuts];
fd94f234 866 fHistoTrueClusElectronPt = new TH1F*[fnCuts];
867 fHistoTrueClusConvGammaPt = new TH1F*[fnCuts];
20af4b69 868 fHistoTrueClusConvGammaMCPt = new TH1F*[fnCuts];
fd94f234 869 fHistoTrueClusConvGammaFullyPt = new TH1F*[fnCuts];
870 fHistoTrueClusMergedGammaPt = new TH1F*[fnCuts];
871 fHistoTrueClusMergedPartConvGammaPt = new TH1F*[fnCuts];
872 fHistoTrueClusDalitzPt = new TH1F*[fnCuts];
873 fHistoTrueClusDalitzMergedPt = new TH1F*[fnCuts];
874 fHistoTrueClusPhotonFromElecMotherPt= new TH1F*[fnCuts];
875 fHistoTrueClusShowerPt = new TH1F*[fnCuts];
cc579963 876 fHistoTrueClusSubLeadingPt = new TH1F*[fnCuts];
877 fHistoTrueClusNParticles = new TH1I*[fnCuts];
fd94f234 878 fHistoTrueClusEMNonLeadingPt = new TH1F*[fnCuts];
879 fHistoTrueNLabelsInClus = new TH1F*[fnCuts];
8bdca7f1 880 }
881
882 if(fDoMesonAnalysis){
fd94f234 883 fHistoMCPi0Pt = new TH1F*[fnCuts];
884 fHistoMCPi0WOWeightPt = new TH1F*[fnCuts];
885 fHistoMCEtaPt = new TH1F*[fnCuts];
886 fHistoMCEtaWOWeightPt = new TH1F*[fnCuts];
887 fHistoMCPi0InAccPt = new TH1F*[fnCuts];
888 fHistoMCEtaInAccPt = new TH1F*[fnCuts];
8bdca7f1 889
ed8bc1ca 890 fHistoTruePi0InvMassPt = new TH2F*[fnCuts];
891 fHistoTrueEtaInvMassPt = new TH2F*[fnCuts];
892 fHistoTruePrimaryPi0InvMassPt = new TH2F*[fnCuts];
893 fHistoTruePrimaryEtaInvMassPt = new TH2F*[fnCuts];
894 fHistoTruePrimaryPi0W0WeightingInvMassPt = new TH2F*[fnCuts];
895 fHistoTruePrimaryEtaW0WeightingInvMassPt = new TH2F*[fnCuts];
896 fProfileTruePrimaryPi0WeightsInvMassPt = new TProfile2D*[fnCuts];
897 fProfileTruePrimaryEtaWeightsInvMassPt = new TProfile2D*[fnCuts];
898 fHistoTrueSecondaryPi0InvMassPt = new TH2F*[fnCuts];
899 fHistoTrueSecondaryEtaInvMassPt = new TH2F*[fnCuts];
900 fHistoTrueSecondaryPi0FromK0sInvMassPt = new TH2F*[fnCuts];
901 fHistoTrueSecondaryPi0FromEtaInvMassPt = new TH2F*[fnCuts];
902 fHistoTrueSecondaryPi0FromLambdaInvMassPt = new TH2F*[fnCuts];
8bdca7f1 903 if (fDoMesonQA > 0){
fd94f234 904 fHistoMCPi0PtY = new TH2F*[fnCuts];
905 fHistoMCEtaPtY = new TH2F*[fnCuts];
906 fHistoMCK0sPt = new TH1F*[fnCuts];
907 fHistoMCK0sWOWeightPt = new TH1F*[fnCuts];
908 fHistoMCK0sPtY = new TH2F*[fnCuts];
909 fHistoMCSecPi0PtvsSource = new TH2F*[fnCuts];
910 fHistoMCSecPi0Source = new TH1F*[fnCuts];
911 fHistoMCSecEtaPt = new TH1F*[fnCuts];
912 fHistoMCSecEtaSource = new TH1F*[fnCuts];
ed8bc1ca 913 fHistoTruePi0CaloPhotonInvMassPt = new TH2F*[fnCuts];
914 fHistoTrueEtaCaloPhotonInvMassPt = new TH2F*[fnCuts];
20af4b69 915 fHistoTruePi0CaloConvertedPhotonInvMassPt = new TH2F*[fnCuts];
916 fHistoTruePi0CaloConvertedPhotonMatchedInvMassPt = new TH2F*[fnCuts];
917 fHistoTrueEtaCaloConvertedPhotonInvMassPt = new TH2F*[fnCuts];
918 fHistoTrueEtaCaloConvertedPhotonMatchedInvMassPt = new TH2F*[fnCuts];
ed8bc1ca 919 fHistoTruePi0CaloElectronInvMassPt = new TH2F*[fnCuts];
920 fHistoTrueEtaCaloElectronInvMassPt = new TH2F*[fnCuts];
921 fHistoTruePi0CaloMergedClusterInvMassPt = new TH2F*[fnCuts];
922 fHistoTrueEtaCaloMergedClusterInvMassPt = new TH2F*[fnCuts];
923 fHistoTruePi0CaloMergedClusterPartConvInvMassPt = new TH2F*[fnCuts];
924 fHistoTrueEtaCaloMergedClusterPartConvInvMassPt = new TH2F*[fnCuts];
fd94f234 925 fHistoTrueMotherCaloEMNonLeadingInvMassPt = new TH2F*[fnCuts];
926 fHistoTruePrimaryPi0MCPtResolPt = new TH2F*[fnCuts];
927 fHistoTruePrimaryEtaMCPtResolPt = new TH2F*[fnCuts];
928 fHistoTrueK0sWithPi0DaughterMCPt = new TH1F*[fnCuts];
929 fHistoTrueEtaWithPi0DaughterMCPt = new TH1F*[fnCuts];
930 fHistoTrueLambdaWithPi0DaughterMCPt = new TH1F*[fnCuts];
931 fHistoTrueBckGGInvMassPt = new TH2F*[fnCuts];
932 fHistoTrueBckContInvMassPt = new TH2F*[fnCuts];
933 fHistoTruePi0PtY = new TH2F*[fnCuts];
934 fHistoTrueEtaPtY = new TH2F*[fnCuts];
935 fHistoTruePi0PtAlpha = new TH2F*[fnCuts];
936 fHistoTrueEtaPtAlpha = new TH2F*[fnCuts];
937 fHistoTruePi0PtOpenAngle = new TH2F*[fnCuts];
938 fHistoTrueEtaPtOpenAngle = new TH2F*[fnCuts];
8bdca7f1 939 }
940 }
941
942
943
944 for(Int_t iCut = 0; iCut<fnCuts;iCut++){
344100c4 945 TString cutstringEvent = ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber();
946 TString cutstringPhoton = ((AliConversionPhotonCuts*)fCutArray->At(iCut))->GetCutNumber();
947 TString cutstringCalo = ((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetCutNumber();
948 TString cutstringMeson = "NoMesonCut";
8bdca7f1 949 if(fDoMesonAnalysis)cutstringMeson = ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutNumber();
950
951 fMCList[iCut] = new TList();
344100c4 952 fMCList[iCut]->SetName(Form("%s_%s_%s_%s MC histograms",cutstringEvent.Data(),cutstringPhoton.Data(),cutstringCalo.Data(),cutstringMeson.Data()));
8bdca7f1 953 fMCList[iCut]->SetOwner(kTRUE);
954 fCutFolder[iCut]->Add(fMCList[iCut]);
955 fHistoMCHeaders[iCut] = new TH1I("MC_Headers","MC_Headers",20,0,20);
956 fMCList[iCut]->Add(fHistoMCHeaders[iCut]);
957 fHistoMCAllGammaPt[iCut] = new TH1F("MC_AllGamma_Pt","MC_AllGamma_Pt",250,0,25);
958 fMCList[iCut]->Add(fHistoMCAllGammaPt[iCut]);
d404157c 959 fHistoMCAllGammaEMCALAccPt[iCut] = new TH1F("MC_AllGammaEMCALAcc_Pt","MC_AllGammaEMCALAcc_Pt",250,0,25);
20af4b69 960 fMCList[iCut]->Add(fHistoMCAllGammaEMCALAccPt[iCut]);
8bdca7f1 961 fHistoMCDecayGammaPi0Pt[iCut] = new TH1F("MC_DecayGammaPi0_Pt","MC_DecayGammaPi0_Pt",250,0,25);
962 fMCList[iCut]->Add(fHistoMCDecayGammaPi0Pt[iCut]);
963 fHistoMCDecayGammaRhoPt[iCut] = new TH1F("MC_DecayGammaRho_Pt","MC_DecayGammaRho_Pt",250,0,25);
964 fMCList[iCut]->Add(fHistoMCDecayGammaRhoPt[iCut]);
965 fHistoMCDecayGammaEtaPt[iCut] = new TH1F("MC_DecayGammaEta_Pt","MC_DecayGammaEta_Pt",250,0,25);
966 fMCList[iCut]->Add(fHistoMCDecayGammaEtaPt[iCut]);
967 fHistoMCDecayGammaOmegaPt[iCut] = new TH1F("MC_DecayGammaOmega_Pt","MC_DecayGammaOmmega_Pt",250,0,25);
968 fMCList[iCut]->Add(fHistoMCDecayGammaOmegaPt[iCut]);
969 fHistoMCDecayGammaEtapPt[iCut] = new TH1F("MC_DecayGammaEtap_Pt","MC_DecayGammaEtap_Pt",250,0,25);
970 fMCList[iCut]->Add(fHistoMCDecayGammaEtapPt[iCut]);
971 fHistoMCDecayGammaPhiPt[iCut] = new TH1F("MC_DecayGammaPhi_Pt","MC_DecayGammaPhi_Pt",250,0,25);
972 fMCList[iCut]->Add(fHistoMCDecayGammaPhiPt[iCut]);
973 fHistoMCDecayGammaSigmaPt[iCut] = new TH1F("MC_DecayGammaSigma_Pt","MC_DecayGammaSigma_Pt",250,0,25);
974 fMCList[iCut]->Add(fHistoMCDecayGammaSigmaPt[iCut]);
975 fHistoMCConvGammaPt[iCut] = new TH1F("MC_ConvGamma_Pt","MC_ConvGamma_Pt",250,0,25);
976 fMCList[iCut]->Add(fHistoMCConvGammaPt[iCut]);
977
978 if (fDoPhotonQA > 0){
979 fHistoMCConvGammaR[iCut] = new TH1F("MC_ConvGamma_R","MC_ConvGamma_R",800,0,200);
980 fMCList[iCut]->Add(fHistoMCConvGammaR[iCut]);
981 fHistoMCConvGammaEta[iCut] = new TH1F("MC_ConvGamma_Eta","MC_ConvGamma_Eta",2000,-2,2);
982 fMCList[iCut]->Add(fHistoMCConvGammaEta[iCut]);
983 }
984
985 if(fDoMesonAnalysis){
986 fHistoMCPi0Pt[iCut] = new TH1F("MC_Pi0_Pt","MC_Pi0_Pt",250,0,25);
987 fHistoMCPi0Pt[iCut]->Sumw2();
988 fMCList[iCut]->Add(fHistoMCPi0Pt[iCut]);
989 fHistoMCPi0WOWeightPt[iCut] = new TH1F("MC_Pi0_WOWeights_Pt","MC_Pi0_WOWeights_Pt",250,0,25);
990 fHistoMCPi0WOWeightPt[iCut]->Sumw2();
991 fMCList[iCut]->Add(fHistoMCPi0WOWeightPt[iCut]);
992
993 fHistoMCEtaPt[iCut] = new TH1F("MC_Eta_Pt","MC_Eta_Pt",250,0,25);
994 fHistoMCEtaPt[iCut]->Sumw2();
995 fMCList[iCut]->Add(fHistoMCEtaPt[iCut]);
996 fHistoMCEtaWOWeightPt[iCut] = new TH1F("MC_Eta_WOWeights_Pt","MC_Eta_WOWeights_Pt",250,0,25);
997 fHistoMCEtaWOWeightPt[iCut]->Sumw2();
998 fMCList[iCut]->Add(fHistoMCEtaWOWeightPt[iCut]);
999 fHistoMCPi0InAccPt[iCut] = new TH1F("MC_Pi0InAcc_Pt","MC_Pi0InAcc_Pt",250,0,25);
1000 fHistoMCPi0InAccPt[iCut]->Sumw2();
1001 fMCList[iCut]->Add(fHistoMCPi0InAccPt[iCut]);
1002 fHistoMCEtaInAccPt[iCut] = new TH1F("MC_EtaInAcc_Pt","MC_EtaInAcc_Pt",250,0,25);
1003 fHistoMCEtaInAccPt[iCut]->Sumw2();
1004 fMCList[iCut]->Add(fHistoMCEtaInAccPt[iCut]);
1005 if (fDoMesonQA > 0){
1006 fHistoMCPi0PtY[iCut] = new TH2F("MC_Pi0_Pt_Y","MC_Pi0_Pt_Y",150,0.03,15.,150,-1.5,1.5);
1007 fHistoMCPi0PtY[iCut]->Sumw2();
1008 SetLogBinningXTH2(fHistoMCPi0PtY[iCut]);
1009 fMCList[iCut]->Add(fHistoMCPi0PtY[iCut]);
1010 fHistoMCEtaPtY[iCut] = new TH2F("MC_Eta_Pt_Y","MC_Eta_Pt_Y",150,0.03,15.,150,-1.5,1.5);
1011 fHistoMCEtaPtY[iCut]->Sumw2();
1012 SetLogBinningXTH2(fHistoMCEtaPtY[iCut]);
1013 fMCList[iCut]->Add(fHistoMCEtaPtY[iCut]);
1014 fHistoMCK0sPt[iCut] = new TH1F("MC_K0s_Pt","MC_K0s_Pt",150,0,15);
1015 fHistoMCK0sPt[iCut]->Sumw2();
1016 fMCList[iCut]->Add(fHistoMCK0sPt[iCut]);
1017 fHistoMCK0sWOWeightPt[iCut] = new TH1F("MC_K0s_WOWeights_Pt","MC_K0s_WOWeights_Pt",150,0,15);
1018 fHistoMCK0sWOWeightPt[iCut]->Sumw2();
1019 fMCList[iCut]->Add(fHistoMCK0sWOWeightPt[iCut]);
1020 fHistoMCK0sPtY[iCut] = new TH2F("MC_K0s_Pt_Y","MC_K0s_Pt_Y",150,0.03,15.,150,-1.5,1.5);
1021 fHistoMCK0sPtY[iCut]->Sumw2();
1022 SetLogBinningXTH2(fHistoMCK0sPtY[iCut]);
1023 fMCList[iCut]->Add(fHistoMCK0sPtY[iCut]);
1024
1025 fHistoMCSecPi0Source[iCut] = new TH1F("MC_SecPi0_Source","MC_SecPi0_Source",5000,0.,5000);
1026 fMCList[iCut]->Add(fHistoMCSecPi0Source[iCut]);
1027 fHistoMCSecEtaSource[iCut] = new TH1F("MC_SecEta_Source","MC_SecEta_Source",5000,0,5000);
1028 fMCList[iCut]->Add(fHistoMCSecEtaSource[iCut]);
1029 fHistoMCSecPi0PtvsSource[iCut] = new TH2F("MC_SecPi0_Pt_Source","MC_SecPi0_Pt_Source",250,0.0,25.,16,-0.5,15.5);
1030 fHistoMCSecPi0PtvsSource[iCut]->Sumw2();
1031 fMCList[iCut]->Add(fHistoMCSecPi0PtvsSource[iCut]);
1032 fHistoMCSecEtaPt[iCut] = new TH1F("MC_SecEta_Pt","MC_SecEta_Pt",250,0,25);
1033 fHistoMCSecEtaPt[iCut]->Sumw2();
1034 fMCList[iCut]->Add(fHistoMCSecEtaPt[iCut]);
1035 }
1036
1037 }
1038 fTrueList[iCut] = new TList();
344100c4 1039 fTrueList[iCut]->SetName(Form("%s_%s_%s_%s True histograms",cutstringEvent.Data(),cutstringPhoton.Data(),cutstringCalo.Data(),cutstringMeson.Data()));
8bdca7f1 1040 fTrueList[iCut]->SetOwner(kTRUE);
1041 fCutFolder[iCut]->Add(fTrueList[iCut]);
1042
1043 fHistoTrueConvGammaPt[iCut] = new TH1F("ESD_TrueConvGamma_Pt","ESD_TrueConvGamma_Pt",250,0,25);
1044 fTrueList[iCut]->Add(fHistoTrueConvGammaPt[iCut]);
1045
1046 fHistoTrueConvPi0GammaPt[iCut] = new TH1F("ESD_TrueConvGamma_Pt","ESD_TrueConvGamma_Pt",250,0,25);
1047 fTrueList[iCut]->Add(fHistoTrueConvPi0GammaPt[iCut]);
1048
1049 fHistoCombinatorialPt[iCut] = new TH2F("ESD_TrueCombinatorial_Pt","ESD_TrueCombinatorial_Pt",250,0,25,16,-0.5,15.5);
1050 fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel( 1,"Elec+Elec");
1051 fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel( 2,"Elec+Pion");
1052 fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel( 3,"Elec+Kaon");
1053 fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel( 4,"Elec+Proton");
1054 fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel( 5,"Elec+Muon");
1055 fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel( 6,"Pion+Pion");
1056 fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel( 7,"Pion+Kaon");
1057 fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel( 8,"Pion+Proton");
1058 fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel( 9,"Pion+Muon");
1059 fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel(10,"Kaon+Kaon");
1060 fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel(11,"Kaon+Proton");
1061 fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel(12,"Kaon+Muon");
1062 fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel(13,"Proton+Proton");
1063 fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel(14,"Proton+Muon");
1064 fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel(15,"Muon+Muon");
1065 fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel(16,"Rest");
1066 fTrueList[iCut]->Add(fHistoCombinatorialPt[iCut]);
1067 fHistoTruePrimaryConvGammaPt[iCut] = new TH1F("ESD_TruePrimaryConvGamma_Pt","ESD_TruePrimaryConvGamma_Pt",250,0,25);
1068 fTrueList[iCut]->Add(fHistoTruePrimaryConvGammaPt[iCut]);
1069 fHistoTrueSecondaryConvGammaPt[iCut] = new TH1F("ESD_TrueSecondaryConvGamma_Pt","ESD_TrueSecondaryConvGamma_Pt",250,0,25);
1070 fTrueList[iCut]->Add(fHistoTrueSecondaryConvGammaPt[iCut]);
1071
1072 fHistoTrueSecondaryConvGammaFromXFromK0sPt[iCut] = new TH1F("ESD_TrueSecondaryConvGammaFromXFromK0s_Pt", "ESD_TrueSecondaryConvGammaFromXFromK0s_Pt",250,0,25);
1073 fTrueList[iCut]->Add(fHistoTrueSecondaryConvGammaFromXFromK0sPt[iCut]);
1074 fHistoTrueSecondaryConvGammaFromXFromLambdaPt[iCut] = new TH1F("ESD_TrueSecondaryConvGammaFromXFromLambda_Pt", "ESD_TrueSecondaryConvGammaFromXFromLambda_Pt",250,0,25);
1075 fTrueList[iCut]->Add(fHistoTrueSecondaryConvGammaFromXFromLambdaPt[iCut]);
fd94f234 1076
8bdca7f1 1077 fHistoTruePrimaryConvGammaESDPtMCPt[iCut] = new TH2F("ESD_TruePrimaryConvGammaESD_PtMCPt", "ESD_TruePrimaryConvGammaESD_PtMCPt",250,0,25,250,0,25);
1078 fTrueList[iCut]->Add(fHistoTruePrimaryConvGammaESDPtMCPt[iCut]);
1079
fd94f234 1080 fHistoTrueClusGammaPt[iCut] = new TH1F("TrueClusGamma_Pt","ESD_TrueClusGamma_Pt",250,0,25);
8bdca7f1 1081 fTagOutputList[iCut]->Add(fHistoTrueClusGammaPt[iCut]);
1082 fHistoTruePrimaryClusGammaPt[iCut] = new TH1F("TruePrimaryClusGamma_Pt","ESD_TruePrimaryClusGamma_Pt",250,0,25);
1083 fTagOutputList[iCut]->Add(fHistoTruePrimaryClusGammaPt[iCut]);
1084 fHistoTruePrimaryClusGammaESDPtMCPt[iCut] = new TH2F("TruePrimaryClusGamma_Pt_MCPt","ESD_TruePrimaryClusGamma_MCPt",250,0,25,250,0,25);
1085 fTagOutputList[iCut]->Add(fHistoTruePrimaryClusGammaESDPtMCPt[iCut]);
1086
fd94f234 1087 if (fDoPhotonQA > 0){
1088 fHistoTrueConvGammaEta[iCut] = new TH1F("ESD_TrueConvGamma_Eta","ESD_TrueConvGamma_Eta",2000,-2,2);
1089 fTrueList[iCut]->Add(fHistoTrueConvGammaEta[iCut]);
1090 }
1091 if (fDoClusterQA > 0){
1092 fHistoTrueClusUnConvGammaPt[iCut] = new TH1F("TrueClusUnConvGamma_Pt","TrueClusUnConvGamma_Pt",250,0,25);
1093 fTagOutputList[iCut]->Add(fHistoTrueClusUnConvGammaPt[iCut]);
20af4b69 1094 fHistoTrueClusUnConvGammaMCPt[iCut] = new TH1F("TrueClusUnConvGamma_MCPt","TrueClusUnConvGamma_MCPt",250,0,25);
1095 fTagOutputList[iCut]->Add(fHistoTrueClusUnConvGammaMCPt[iCut]);
fd94f234 1096 fHistoTrueClusElectronPt[iCut] = new TH1F("TrueClusElectron_Pt","TrueElectronGamma_Pt",250,0,25);
1097 fTagOutputList[iCut]->Add(fHistoTrueClusElectronPt[iCut]);
fd94f234 1098 fHistoTrueClusConvGammaPt[iCut] = new TH1F("TrueClusConvGamma_Pt","TrueClusConvGamma_Pt",250,0,25);
1099 fTagOutputList[iCut]->Add(fHistoTrueClusConvGammaPt[iCut]);
20af4b69 1100 fHistoTrueClusConvGammaMCPt[iCut] = new TH1F("TrueClusConvGamma_MCPt","TrueClusConvGamma_MCPt",250,0,25);
1101 fTagOutputList[iCut]->Add(fHistoTrueClusConvGammaMCPt[iCut]);
fd94f234 1102 fHistoTrueClusConvGammaFullyPt[iCut] = new TH1F("TrueClusConvGammaFullyContained_Pt","TrueClusConvGammaFullyContained_Pt",250,0,25);
1103 fTagOutputList[iCut]->Add(fHistoTrueClusConvGammaFullyPt[iCut]);
1104 fHistoTrueClusMergedGammaPt[iCut] = new TH1F("TrueClusMergedGamma_Pt","TrueClusMergedGamma_Pt",250,0,25);
1105 fTagOutputList[iCut]->Add(fHistoTrueClusMergedGammaPt[iCut]);
1106 fHistoTrueClusMergedPartConvGammaPt[iCut] = new TH1F("TrueClusMergedPartConvGamma_Pt","TrueClusMergedPartConvGamma_Pt",250,0,25);
1107 fTagOutputList[iCut]->Add(fHistoTrueClusMergedPartConvGammaPt[iCut]);
1108 fHistoTrueClusDalitzPt[iCut] = new TH1F("TrueClusDalitz_Pt","TrueClusDalitz_Pt",250,0,25);
1109 fTagOutputList[iCut]->Add(fHistoTrueClusDalitzPt[iCut]);
1110 fHistoTrueClusDalitzMergedPt[iCut] = new TH1F("TrueClusDalitzMerged_Pt","TrueClusDalitzMerged_Pt",250,0,25);
1111 fTagOutputList[iCut]->Add(fHistoTrueClusDalitzMergedPt[iCut]);
1112 fHistoTrueClusPhotonFromElecMotherPt[iCut] = new TH1F("TrueClusPhotonFromElecMother_Pt","TrueClusPhotonFromElecMother_Pt",250,0,25);
1113 fTagOutputList[iCut]->Add(fHistoTrueClusPhotonFromElecMotherPt[iCut]);
1114 fHistoTrueClusShowerPt[iCut] = new TH1F("TrueClusShower_Pt","TrueClusShower_Pt",250,0,25);
1115 fTagOutputList[iCut]->Add(fHistoTrueClusShowerPt[iCut]);
cc579963 1116 fHistoTrueClusSubLeadingPt[iCut] = new TH1F("TrueClusSubleading_Pt","TrueClusSubleading_Pt",250,0,25);
1117 fTagOutputList[iCut]->Add(fHistoTrueClusSubLeadingPt[iCut]);
1118 fHistoTrueClusNParticles[iCut] = new TH1I("TrueClusNParticles","TrueClusNParticles",20,0,20);
1119 fTagOutputList[iCut]->Add(fHistoTrueClusNParticles[iCut]);
fd94f234 1120 fHistoTrueClusEMNonLeadingPt[iCut] = new TH1F("TrueClusEMNonLeading_Pt","TrueClusEMNonLeading_Pt",250,0,25);
1121 fTagOutputList[iCut]->Add(fHistoTrueClusEMNonLeadingPt[iCut]);
1122 fHistoTrueNLabelsInClus[iCut] = new TH1F("TrueNLabelsInClus","TrueNLabelsInClus",100,-0.5,99.5);
1123 fTagOutputList[iCut]->Add(fHistoTrueNLabelsInClus[iCut]);
1124 }
1125
8bdca7f1 1126 if(fDoMesonAnalysis){
ed8bc1ca 1127 fHistoTruePi0InvMassPt[iCut] = new TH2F("ESD_TruePi0_InvMass_Pt","ESD_TruePi0_InvMass_Pt",800,0,0.8,250,0,25);
1128 fTrueList[iCut]->Add(fHistoTruePi0InvMassPt[iCut]);
1129 fHistoTrueEtaInvMassPt[iCut] = new TH2F("ESD_TrueEta_InvMass_Pt","ESD_TrueEta_InvMass_Pt",800,0,0.8,250,0,25);
1130 fTrueList[iCut]->Add(fHistoTrueEtaInvMassPt[iCut]);
1131
1132 fHistoTruePrimaryPi0InvMassPt[iCut] = new TH2F("ESD_TruePrimaryPi0_InvMass_Pt", "ESD_TruePrimaryPi0_InvMass_Pt", 800,0,0.8,250,0,25);
1133 fHistoTruePrimaryPi0InvMassPt[iCut]->Sumw2();
1134 fTrueList[iCut]->Add(fHistoTruePrimaryPi0InvMassPt[iCut]);
1135 fHistoTruePrimaryEtaInvMassPt[iCut] = new TH2F("ESD_TruePrimaryEta_InvMass_Pt", "ESD_TruePrimaryEta_InvMass_Pt", 800,0,0.8,250,0,25);
1136 fHistoTruePrimaryEtaInvMassPt[iCut]->Sumw2();
1137 fTrueList[iCut]->Add(fHistoTruePrimaryEtaInvMassPt[iCut]);
1138
1139 fHistoTruePrimaryPi0W0WeightingInvMassPt[iCut] = new TH2F("ESD_TruePrimaryPi0W0Weights_InvMass_Pt", "ESD_TruePrimaryPi0W0Weights_InvMass_Pt", 800,0,0.8,250,0,25);
1140 fHistoTruePrimaryPi0W0WeightingInvMassPt[iCut]->Sumw2();
1141 fTrueList[iCut]->Add(fHistoTruePrimaryPi0W0WeightingInvMassPt[iCut]);
1142 fHistoTruePrimaryEtaW0WeightingInvMassPt[iCut] = new TH2F("ESD_TruePrimaryEtaW0Weights_InvMass_Pt", "ESD_TruePrimaryEtaW0Weights_InvMass_Pt", 800,0,0.8,250,0,25);
1143 fHistoTruePrimaryEtaW0WeightingInvMassPt[iCut]->Sumw2();
1144 fTrueList[iCut]->Add(fHistoTruePrimaryEtaW0WeightingInvMassPt[iCut]);
1145
1146 fProfileTruePrimaryPi0WeightsInvMassPt[iCut] = new TProfile2D("ESD_TruePrimaryPi0Weights_InvMass_Pt", "ESD_TruePrimaryPi0Weights_InvMass_Pt", 800,0,0.8,250,0,25);
1147 fProfileTruePrimaryPi0WeightsInvMassPt[iCut]->Sumw2();
1148 fTrueList[iCut]->Add(fProfileTruePrimaryPi0WeightsInvMassPt[iCut]);
1149 fProfileTruePrimaryEtaWeightsInvMassPt[iCut] = new TProfile2D("ESD_TruePrimaryEtaWeights_InvMass_Pt", "ESD_TruePrimaryEtaWeights_InvMass_Pt", 800,0,0.8,250,0,25);
1150 fProfileTruePrimaryEtaWeightsInvMassPt[iCut]->Sumw2();
1151 fTrueList[iCut]->Add(fProfileTruePrimaryEtaWeightsInvMassPt[iCut]);
20af4b69 1152
ed8bc1ca 1153 fHistoTrueSecondaryPi0InvMassPt[iCut] = new TH2F("ESD_TrueSecondaryPi0_InvMass_Pt", "ESD_TrueSecondaryPi0_InvMass_Pt", 800,0,0.8,250,0,25);
1154 fHistoTrueSecondaryPi0InvMassPt[iCut]->Sumw2();
1155 fTrueList[iCut]->Add(fHistoTrueSecondaryPi0InvMassPt[iCut]);
1156 fHistoTrueSecondaryEtaInvMassPt[iCut] = new TH2F("ESD_TrueSecondaryEta_InvMass_Pt", "ESD_TrueSecondaryEta_InvMass_Pt", 800,0,0.8,250,0,25);
1157 fHistoTrueSecondaryEtaInvMassPt[iCut]->Sumw2();
1158 fTrueList[iCut]->Add(fHistoTrueSecondaryEtaInvMassPt[iCut]);
1159
1160 fHistoTrueSecondaryPi0FromK0sInvMassPt[iCut] = new TH2F("ESD_TrueSecondaryPi0FromK0s_InvMass_Pt","ESD_TrueSecondaryPi0FromK0s_InvMass_Pt",800,0,0.8,250,0,25);
1161 fHistoTrueSecondaryPi0FromK0sInvMassPt[iCut]->Sumw2();
1162 fTrueList[iCut]->Add(fHistoTrueSecondaryPi0FromK0sInvMassPt[iCut]);
1163 fHistoTrueSecondaryPi0FromEtaInvMassPt[iCut] = new TH2F("ESD_TrueSecondaryPi0FromEta_InvMass_Pt","ESD_TrueSecondaryPi0FromEta_InvMass_Pt",800,0,0.8,250,0,25);
1164 fTrueList[iCut]->Add(fHistoTrueSecondaryPi0FromEtaInvMassPt[iCut]);
1165 fHistoTrueSecondaryPi0FromLambdaInvMassPt[iCut] = new TH2F("ESD_TrueSecondaryPi0FromLambda_InvMass_Pt","ESD_TrueSecondaryPi0FromLambda_InvMass_Pt",800,0,0.8,250,0,25);
1166 fTrueList[iCut]->Add(fHistoTrueSecondaryPi0FromLambdaInvMassPt[iCut]);
1167 if (fDoMesonQA > 0){
1168 fHistoTruePi0CaloPhotonInvMassPt[iCut] = new TH2F("ESD_TruePi0CaloPhoton_InvMass_Pt","ESD_TruePi0CaloPhoton_InvMass_Pt",800,0,0.8,250,0,25);
1169 fTrueList[iCut]->Add(fHistoTruePi0CaloPhotonInvMassPt[iCut]);
1170 fHistoTrueEtaCaloPhotonInvMassPt[iCut] = new TH2F("ESD_TrueEtaCaloPhoton_InvMass_Pt","ESD_TrueEtaCaloPhoton_InvMass_Pt",800,0,0.8,250,0,25);
1171 fTrueList[iCut]->Add(fHistoTrueEtaCaloPhotonInvMassPt[iCut]);
20af4b69 1172 fHistoTruePi0CaloConvertedPhotonInvMassPt[iCut] = new TH2F("ESD_TruePi0CaloConvertedPhoton_InvMass_Pt","ESD_TruePi0CaloConvertedPhoton_InvMass_Pt",800,0,0.8,250,0,25);
1173 fTrueList[iCut]->Add(fHistoTruePi0CaloConvertedPhotonInvMassPt[iCut]);
1174 fHistoTruePi0CaloConvertedPhotonMatchedInvMassPt[iCut] = new TH2F("ESD_TruePi0CaloConvertedPhotonMatched_InvMass_Pt","ESD_TruePi0CaloConvertedPhotonMatched_InvMass_Pt",800,0,0.8,250,0,25);
1175 fTrueList[iCut]->Add(fHistoTruePi0CaloConvertedPhotonMatchedInvMassPt[iCut]);
20af4b69 1176 fHistoTrueEtaCaloConvertedPhotonInvMassPt[iCut] = new TH2F("ESD_TrueEtaCaloConvertedPhoton_InvMass_Pt","ESD_TrueEtaCaloConvertedPhoton_InvMass_Pt",800,0,0.8,250,0,25);
1177 fTrueList[iCut]->Add(fHistoTrueEtaCaloConvertedPhotonInvMassPt[iCut]);
1178 fHistoTrueEtaCaloConvertedPhotonMatchedInvMassPt[iCut] = new TH2F("ESD_TrueEtaCaloConvertedPhotonMatched_InvMass_Pt","ESD_TrueEtaCaloConvertedPhotonMatched_InvMass_Pt",800,0,0.8,250,0,25);
1179 fTrueList[iCut]->Add(fHistoTrueEtaCaloConvertedPhotonMatchedInvMassPt[iCut]);
1180
d404157c 1181 fHistoTruePi0CaloElectronInvMassPt[iCut] = new TH2F("ESD_TruePi0CaloElectron_InvMass_Pt","ESD_TruePi0CaloElectron_InvMass_Pt",800,0,0.8,250,0,25);
ed8bc1ca 1182 fTrueList[iCut]->Add(fHistoTruePi0CaloElectronInvMassPt[iCut]);
1183 fHistoTrueEtaCaloElectronInvMassPt[iCut] = new TH2F("ESD_TrueEtaCaloElectron_InvMass_Pt","ESD_TrueEtaCaloElectron_InvMass_Pt",800,0,0.8,250,0,25);
1184 fTrueList[iCut]->Add(fHistoTrueEtaCaloElectronInvMassPt[iCut]);
1185
1186 fHistoTruePi0CaloMergedClusterInvMassPt[iCut] = new TH2F("ESD_TruePi0CaloMergedCluster_InvMass_Pt","ESD_TruePi0CaloMergedCluster_InvMass_Pt",800,0,0.8,250,0,25);
1187 fTrueList[iCut]->Add(fHistoTruePi0CaloMergedClusterInvMassPt[iCut]);
1188 fHistoTrueEtaCaloMergedClusterInvMassPt[iCut] = new TH2F("ESD_TrueEtaCaloMergedCluster_InvMass_Pt","ESD_TrueEtaCaloMergedCluster_InvMass_Pt",800,0,0.8,250,0,25);
1189 fTrueList[iCut]->Add(fHistoTrueEtaCaloMergedClusterInvMassPt[iCut]);
1190
fd94f234 1191 fHistoTrueMotherCaloEMNonLeadingInvMassPt[iCut] = new TH2F("ESD_TrueMotherCaloEMNonLeading_InvMass_Pt","ESD_TrueMotherCaloEMNonLeading_InvMass_Pt",800,0,0.8,250,0,25);
1192 fTrueList[iCut]->Add(fHistoTrueMotherCaloEMNonLeadingInvMassPt[iCut]);
ed8bc1ca 1193 fHistoTruePi0CaloMergedClusterPartConvInvMassPt[iCut] = new TH2F("ESD_TruePi0CaloMergedClusterPartConv_InvMass_Pt","ESD_TruePi0CaloMergedClusterPartConv_InvMass_Pt",800,0,0.8,250,0,25);
1194 fTrueList[iCut]->Add(fHistoTruePi0CaloMergedClusterPartConvInvMassPt[iCut]);
1195 fHistoTrueEtaCaloMergedClusterPartConvInvMassPt[iCut] = new TH2F("ESD_TrueEtaCaloMergedClusterPartConv_InvMass_Pt","ESD_TrueEtaCaloMergedClusterPartConv_InvMass_Pt",800,0,0.8,250,0,25);
1196 fTrueList[iCut]->Add(fHistoTrueEtaCaloMergedClusterPartConvInvMassPt[iCut]);
fd94f234 1197
8bdca7f1 1198 fHistoTruePrimaryPi0MCPtResolPt[iCut] = new TH2F("ESD_TruePrimaryPi0_MCPt_ResolPt","ESD_TruePrimaryPi0_ResolPt_MCPt",500,0.03,25,1000,-1.,1.);
1199 fHistoTruePrimaryPi0MCPtResolPt[iCut]->Sumw2();
1200 SetLogBinningXTH2(fHistoTruePrimaryPi0MCPtResolPt[iCut]);
1201 fTrueList[iCut]->Add(fHistoTruePrimaryPi0MCPtResolPt[iCut]);
1202 fHistoTruePrimaryEtaMCPtResolPt[iCut] = new TH2F("ESD_TruePrimaryEta_MCPt_ResolPt","ESD_TruePrimaryEta_ResolPt_MCPt",500,0.03,25,1000,-1.,1.);
1203 fHistoTruePrimaryEtaMCPtResolPt[iCut]->Sumw2();
1204 SetLogBinningXTH2(fHistoTruePrimaryEtaMCPtResolPt[iCut]);
1205 fTrueList[iCut]->Add(fHistoTruePrimaryEtaMCPtResolPt[iCut]);
1206 fHistoTrueBckGGInvMassPt[iCut] = new TH2F("ESD_TrueBckGG_InvMass_Pt","ESD_TrueBckGG_InvMass_Pt",800,0,0.8,250,0,25);
1207 fTrueList[iCut]->Add(fHistoTrueBckGGInvMassPt[iCut]);
1208 fHistoTrueBckContInvMassPt[iCut] = new TH2F("ESD_TrueBckCont_InvMass_Pt","ESD_TrueBckCont_InvMass_Pt",800,0,0.8,250,0,25);
1209 fTrueList[iCut]->Add(fHistoTrueBckContInvMassPt[iCut]);
1210 fHistoTrueK0sWithPi0DaughterMCPt[iCut] = new TH1F("ESD_TrueK0sWithPi0Daughter_MCPt","ESD_TrueK0sWithPi0Daughter_MCPt",250,0,25);
1211 fTrueList[iCut]->Add(fHistoTrueK0sWithPi0DaughterMCPt[iCut]);
1212 fHistoTrueEtaWithPi0DaughterMCPt[iCut] = new TH1F("ESD_TrueEtaWithPi0Daughter_MCPt","ESD_TrueEtaWithPi0Daughter_MCPt",250,0,25);
1213 fTrueList[iCut]->Add(fHistoTrueEtaWithPi0DaughterMCPt[iCut]);
1214 fHistoTrueLambdaWithPi0DaughterMCPt[iCut] = new TH1F("ESD_TrueLambdaWithPi0Daughter_MCPt","ESD_TrueLambdaWithPi0Daughter_MCPt",250,0,25);
1215 fTrueList[iCut]->Add(fHistoTrueLambdaWithPi0DaughterMCPt[iCut]);
1216
1217 fHistoTruePi0PtY[iCut] = new TH2F("ESD_TruePi0_Pt_Y","ESD_TruePi0_Pt_Y",150,0.03,15.,150,-1.5,1.5);
1218 SetLogBinningXTH2(fHistoTruePi0PtY[iCut]);
1219 fTrueList[iCut]->Add(fHistoTruePi0PtY[iCut]);
1220 fHistoTrueEtaPtY[iCut] = new TH2F("ESD_TrueEta_Pt_Y","ESD_TrueEta_Pt_Y",150,0.03,15.,150,-1.5,1.5);
1221 SetLogBinningXTH2(fHistoTrueEtaPtY[iCut]);
1222 fTrueList[iCut]->Add(fHistoTrueEtaPtY[iCut]);
1223 fHistoTruePi0PtAlpha[iCut] = new TH2F("ESD_TruePi0_Pt_Alpha","ESD_TruePi0_Pt_Alpha",150,0.03,15.,100,0,1);
1224 SetLogBinningXTH2(fHistoTruePi0PtAlpha[iCut]);
1225 fTrueList[iCut]->Add(fHistoTruePi0PtAlpha[iCut]);
1226 fHistoTrueEtaPtAlpha[iCut] = new TH2F("ESD_TrueEta_Pt_Alpha","ESD_TrueEta_Pt_Alpha",150,0.03,15.,100,0,1);
1227 SetLogBinningXTH2(fHistoTrueEtaPtAlpha[iCut]);
1228 fTrueList[iCut]->Add(fHistoTrueEtaPtAlpha[iCut]);
1229
1230 fHistoTruePi0PtOpenAngle[iCut] = new TH2F("ESD_TruePi0_Pt_OpenAngle","ESD_TruePi0_Pt_OpenAngle",150,0.03,15.,200,0,2*TMath::Pi());
1231 SetLogBinningXTH2(fHistoTruePi0PtOpenAngle[iCut]);
1232 fTrueList[iCut]->Add(fHistoTruePi0PtOpenAngle[iCut]);
1233 fHistoTrueEtaPtOpenAngle[iCut] = new TH2F("ESD_TrueEta_Pt_OpenAngle","ESD_TrueEta_Pt_OpenAngle",150,0.03,15.,200,0,2*TMath::Pi());
1234 SetLogBinningXTH2(fHistoTrueEtaPtOpenAngle[iCut]);
1235 fTrueList[iCut]->Add(fHistoTrueEtaPtOpenAngle[iCut]);
8bdca7f1 1236 }
1237 }
1238 }
1239 }
1240
1241 fV0Reader=(AliV0ReaderV1*)AliAnalysisManager::GetAnalysisManager()->GetTask("V0ReaderV1");
1242 if(!fV0Reader){printf("Error: No V0 Reader");return;} // GetV0Reader
1243
1244 if(fV0Reader)
344100c4 1245 if((AliConversionPhotonCuts*)fV0Reader->GetConversionCuts())
1246 if(((AliConversionPhotonCuts*)fV0Reader->GetConversionCuts())->GetCutHistograms())
1247 fOutputContainer->Add(((AliConversionPhotonCuts*)fV0Reader->GetConversionCuts())->GetCutHistograms());
1248 if(fV0Reader)
1249 if((AliConvEventCuts*)fV0Reader->GetEventCuts())
1250 if(((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetCutHistograms())
1251 fOutputContainer->Add(((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetCutHistograms());
1252
1253
8bdca7f1 1254 for(Int_t iCut = 0; iCut<fnCuts;iCut++){
344100c4 1255 if(!((AliConvEventCuts*)fEventCutArray->At(iCut))) continue;
1256 if(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutHistograms()){
1257 fCutFolder[iCut]->Add(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutHistograms());
1258 }
1259 if(!((AliConversionPhotonCuts*)fCutArray->At(iCut))) continue;
1260 if(((AliConversionPhotonCuts*)fCutArray->At(iCut))->GetCutHistograms()){
1261 fCutFolder[iCut]->Add(((AliConversionPhotonCuts*)fCutArray->At(iCut))->GetCutHistograms());
8bdca7f1 1262 }
1263 if(!((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))) continue;
1264 if(((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetCutHistograms()){
1265 fCutFolder[iCut]->Add(((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetCutHistograms());
1266 }
1267 if(fDoMesonAnalysis){
1268 if(!((AliConversionMesonCuts*)fMesonCutArray->At(iCut))) continue;
1269 if(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutHistograms()){
1270 fCutFolder[iCut]->Add(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutHistograms());
1271 }
1272 }
1273 }
1274 PostData(1, fOutputContainer);
1275}
1276//_____________________________________________________________________________
1277Bool_t AliAnalysisTaskGammaConvCalo::Notify()
1278{
1279 for(Int_t iCut = 0; iCut<fnCuts;iCut++){
344100c4 1280 if(!((AliConvEventCuts*)fEventCutArray->At(iCut))->GetDoEtaShift()){
1281 fProfileEtaShift[iCut]->Fill(0.,(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift()));
8bdca7f1 1282 continue; // No Eta Shift requested, continue
1283 }
344100c4 1284 if(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift() == 0.0){ // Eta Shift requested but not set, get shift automatically
1285 ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCorrectEtaShiftFromPeriod(fV0Reader->GetPeriodName());
1286 fProfileEtaShift[iCut]->Fill(0.,(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift()));
1287 ((AliConvEventCuts*)fEventCutArray->At(iCut))->DoEtaShift(kFALSE); // Eta Shift Set, make sure that it is called only once
8bdca7f1 1288 continue;
1289 }
1290 else{
1291 printf(" Gamma Conversion Task %s :: Eta Shift Manually Set to %f \n\n",
344100c4 1292 (((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber()).Data(),((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift());
1293 fProfileEtaShift[iCut]->Fill(0.,(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift()));
1294 ((AliConvEventCuts*)fEventCutArray->At(iCut))->DoEtaShift(kFALSE); // Eta Shift Set, make sure that it is called only once
8bdca7f1 1295 }
1296 }
1297
1298 return kTRUE;
1299}
1300//_____________________________________________________________________________
1301void AliAnalysisTaskGammaConvCalo::UserExec(Option_t *)
1302{
1303 //
1304 // Called for each event
1305 //
344100c4 1306 Int_t eventQuality = ((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetEventQuality();
8bdca7f1 1307 if(eventQuality == 2 || eventQuality == 3){// Event Not Accepted due to MC event missing or wrong trigger for V0ReaderV1
1308 for(Int_t iCut = 0; iCut<fnCuts; iCut++){
1309 fHistoNEvents[iCut]->Fill(eventQuality);
1310 }
1311 return;
1312 }
1313
1314 if(fIsMC) fMCEvent = MCEvent();
1315 if(fMCEvent == NULL) fIsMC = kFALSE;
1316
1317 fInputEvent = InputEvent();
1318
1319 if(fIsMC && fInputEvent->IsA()==AliESDEvent::Class()){
1320 fMCStack = fMCEvent->Stack();
1321 if(fMCStack == NULL) fIsMC = kFALSE;
1322 }
1323
d404157c 1324 if(fInputEvent->IsA()==AliAODEvent::Class()){
1325 fInputEvent->InitMagneticField();
1326 }
1327
8bdca7f1 1328 fReaderGammas = fV0Reader->GetReconstructedGammas(); // Gammas from default Cut
1329
1330 // ------------------- BeginEvent ----------------------------
1331
1332 AliEventplane *EventPlane = fInputEvent->GetEventplane();
1333 if(fIsHeavyIon ==1)fEventPlaneAngle = EventPlane->GetEventplane("V0",fInputEvent,2);
1334 else fEventPlaneAngle=0.0;
1335
1336 if(fIsMC && fInputEvent->IsA()==AliAODEvent::Class() && !(fV0Reader->AreAODsRelabeled())){
1337 RelabelAODPhotonCandidates(kTRUE); // In case of AODMC relabeling MC
1338 fV0Reader->RelabelAODs(kTRUE);
1339 }
1340
1341
1342 for(Int_t iCut = 0; iCut<fnCuts; iCut++){
1343
1344 fiCut = iCut;
344100c4 1345 Int_t eventNotAccepted = ((AliConvEventCuts*)fEventCutArray->At(iCut))->IsEventAcceptedByCut(fV0Reader->GetEventCuts(),fInputEvent,fMCEvent,fIsHeavyIon);
8bdca7f1 1346
1347 if(eventNotAccepted){
1348 // cout << "event rejected due to wrong trigger: " <<eventNotAccepted << endl;
1349 fHistoNEvents[iCut]->Fill(eventNotAccepted); // Check Centrality, PileUp, SDD and V0AND --> Not Accepted => eventQuality = 1
1350 continue;
1351 }
1352
1353 if(eventQuality != 0){// Event Not Accepted
1354 //cout << "event rejected due to: " <<eventQuality << endl;
1355 fHistoNEvents[iCut]->Fill(eventQuality);
1356 continue;
1357 }
1358
1359 fHistoNEvents[iCut]->Fill(eventQuality); // Should be 0 here
1360 fHistoNGoodESDTracks[iCut]->Fill(fV0Reader->GetNumberOfPrimaryTracks());
344100c4 1361 if(((AliConvEventCuts*)fEventCutArray->At(iCut))->IsHeavyIon() == 2) fHistoNV0Tracks[iCut]->Fill(fInputEvent->GetVZEROData()->GetMTotV0A());
8bdca7f1 1362 else fHistoNV0Tracks[iCut]->Fill(fInputEvent->GetVZEROData()->GetMTotV0A()+fInputEvent->GetVZEROData()->GetMTotV0C());
1363
1364 if(fIsMC){
1365 // Process MC Particle
344100c4 1366 if(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetSignalRejection() != 0){
8bdca7f1 1367 if(fInputEvent->IsA()==AliESDEvent::Class()){
344100c4 1368 ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetNotRejectedParticles(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetSignalRejection(),
1369 ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetAcceptedHeader(),
8bdca7f1 1370 fMCEvent);
1371 }
1372 else if(fInputEvent->IsA()==AliAODEvent::Class()){
344100c4 1373 ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetNotRejectedParticles(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetSignalRejection(),
1374 ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetAcceptedHeader(),
8bdca7f1 1375 fInputEvent);
1376 }
1377
344100c4 1378 if(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetAcceptedHeader()){
1379 for(Int_t i = 0;i<(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetAcceptedHeader())->GetEntries();i++){
8bdca7f1 1380 TString nameBin= fHistoMCHeaders[iCut]->GetXaxis()->GetBinLabel(i+1);
1381 if (nameBin.CompareTo("")== 0){
344100c4 1382 TString nameHeader = ((TObjString*)((TList*)((AliConvEventCuts*)fEventCutArray->At(iCut))
1383 ->GetAcceptedHeader())->At(i))->GetString();
1384 fHistoMCHeaders[iCut]->GetXaxis()->SetBinLabel(i+1,nameHeader.Data());
8bdca7f1 1385 }
1386 }
1387 }
1388 }
1389 }
1390 if(fIsMC){
1391 if(fInputEvent->IsA()==AliESDEvent::Class())
1392 ProcessMCParticles();
1393 if(fInputEvent->IsA()==AliAODEvent::Class())
1394 ProcessAODMCParticles();
1395 }
1396
1397 // 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)
1398 ProcessClusters(); // process calo clusters
1399 ProcessPhotonCandidates(); // Process this cuts gammas
1400
1401 fHistoNGammaCandidates[iCut]->Fill(fGammaCandidates->GetEntries());
1402 fHistoNGoodESDTracksVsNGammaCanditates[iCut]->Fill(fV0Reader->GetNumberOfPrimaryTracks(),fGammaCandidates->GetEntries());
1403 if(fDoMesonAnalysis){ // Meson Analysis
1404 if(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->UseMCPSmearing() && fIsMC){
1405 fUnsmearedPx = new Double_t[fGammaCandidates->GetEntries()]; // Store unsmeared Momenta
1406 fUnsmearedPy = new Double_t[fGammaCandidates->GetEntries()];
1407 fUnsmearedPz = new Double_t[fGammaCandidates->GetEntries()];
1408 fUnsmearedE = new Double_t[fGammaCandidates->GetEntries()];
1409
1410 for(Int_t gamma=0;gamma<fGammaCandidates->GetEntries();gamma++){ // Smear the AODPhotons in MC
1411 fUnsmearedPx[gamma] = ((AliAODConversionPhoton*)fGammaCandidates->At(gamma))->Px();
1412 fUnsmearedPy[gamma] = ((AliAODConversionPhoton*)fGammaCandidates->At(gamma))->Py();
1413 fUnsmearedPz[gamma] = ((AliAODConversionPhoton*)fGammaCandidates->At(gamma))->Pz();
1414 fUnsmearedE[gamma] = ((AliAODConversionPhoton*)fGammaCandidates->At(gamma))->E();
1415 ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->SmearParticle(dynamic_cast<AliAODConversionPhoton*>(fGammaCandidates->At(gamma)));
1416 }
1417 }
1418
1419 PhotonTagging(); // tag PCM photons with calorimeter
1420
1421 CalculatePi0Candidates(); // Combine Gammas from conversion and from calo
1422
1423 if(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->DoBGCalculation()){
1424 if(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->BackgroundHandlerType() == 0){
1425 CalculateBackground(); // Combinatorial Background
1426 UpdateEventByEventData(); // Store Event for mixed Events
1427 }
1428 else{
1429 CalculateBackgroundRP(); // Combinatorial Background
1430 fBGHandlerRP[iCut]->AddEvent(fGammaCandidates,fInputEvent); // Store Event for mixed Events
1431 fBGClusHandlerRP[iCut]->AddEvent(fClusterCandidates,fInputEvent); // Store Event for mixed Events
1432 }
1433 }
1434 if(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->UseMCPSmearing() && fIsMC){
1435 for(Int_t gamma=0;gamma<fGammaCandidates->GetEntries();gamma++){ // Smear the AODPhotons in MC
1436 ((AliAODConversionPhoton*)fGammaCandidates->At(gamma))->SetPx(fUnsmearedPx[gamma]); // Reset Unsmeared Momenta
1437 ((AliAODConversionPhoton*)fGammaCandidates->At(gamma))->SetPy(fUnsmearedPy[gamma]);
1438 ((AliAODConversionPhoton*)fGammaCandidates->At(gamma))->SetPz(fUnsmearedPz[gamma]);
1439 ((AliAODConversionPhoton*)fGammaCandidates->At(gamma))->SetE(fUnsmearedE[gamma]);
1440 }
1441 delete[] fUnsmearedPx; fUnsmearedPx = 0x0;
1442 delete[] fUnsmearedPy; fUnsmearedPy = 0x0;
1443 delete[] fUnsmearedPz; fUnsmearedPz = 0x0;
1444 delete[] fUnsmearedE; fUnsmearedE = 0x0;
1445 }
1446 }
1447
1448 fGammaCandidates->Clear(); // delete this cuts good gammas
1449 fClusterCandidates->Clear(); // delete cluster candidates
1450 }
1451
1452 if(fIsMC && fInputEvent->IsA()==AliAODEvent::Class() && !(fV0Reader->AreAODsRelabeled())){
1453 RelabelAODPhotonCandidates(kFALSE); // Back to ESDMC Label
1454 fV0Reader->RelabelAODs(kFALSE);
1455 }
1456
1457 PostData(1, fOutputContainer);
1458}
1459
1460//________________________________________________________________________
1461void AliAnalysisTaskGammaConvCalo::ProcessClusters()
1462{
1463
1464 Int_t nclus = 0;
1465 nclus = fInputEvent->GetNumberOfCaloClusters();
1466
9df9736d 1467// cout << nclus << endl;
8bdca7f1 1468
1469 if(nclus == 0) return;
1470
1471 // vertex
1472 Double_t vertex[3] = {0};
1473 InputEvent()->GetPrimaryVertex()->GetXYZ(vertex);
1474
1475 // Loop over EMCal clusters
d53bf4ac 1476 for(Long_t i = 0; i < nclus; i++){
8bdca7f1 1477
20af4b69 1478 AliVCluster* clus = NULL;
1479 clus = fInputEvent->GetCaloCluster(i);
8bdca7f1 1480 if (!clus) continue;
1481 if(!((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelected(clus,fInputEvent,fIsMC)) continue;
1482 // TLorentzvector with cluster
1483 TLorentzVector clusterVector;
1484 clus->GetMomentum(clusterVector,vertex);
1485
1486 TLorentzVector* tmpvec = new TLorentzVector();
1487 tmpvec->SetPxPyPzE(clusterVector.Px(),clusterVector.Py(),clusterVector.Pz(),clusterVector.E());
1488
1489 // convert to AODConversionPhoton
1490 AliAODConversionPhoton *PhotonCandidate=new AliAODConversionPhoton(tmpvec);
1491 if(!PhotonCandidate) continue;
fd94f234 1492
1493 // Flag Photon as CaloPhoton
1494 PhotonCandidate->SetIsCaloPhoton();
d53bf4ac 1495 PhotonCandidate->SetCaloClusterRef(i);
8bdca7f1 1496 // get MC label
8bdca7f1 1497 if(fIsMC){
fd94f234 1498 Int_t* mclabelsCluster = clus->GetLabels();
1499 PhotonCandidate->SetNCaloPhotonMCLabels(clus->GetNLabels());
1500// cout << clus->GetNLabels() << endl;
1501 if (clus->GetNLabels()>0){
1502 for (Int_t k =0; k< (Int_t)clus->GetNLabels(); k++){
cc579963 1503 if (k< 20)PhotonCandidate->SetCaloPhotonMCLabel(k,mclabelsCluster[k]);
fd94f234 1504// Int_t pdgCode = fMCStack->Particle(mclabelsCluster[k])->GetPdgCode();
1505// cout << "label " << k << "\t" << mclabelsCluster[k] << " pdg code: " << pdgCode << endl;
1506 }
1507 }
8bdca7f1 1508 }
1509
fd94f234 1510 fIsFromMBHeader = kTRUE;
1511 // test whether largest contribution to cluster orginates in added signals
1512 if (fIsMC && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(PhotonCandidate->GetCaloPhotonMCLabel(0), fMCStack, fInputEvent) == 0) fIsFromMBHeader = kFALSE;
8bdca7f1 1513
1514 fHistoClusGammaPt[fiCut]->Fill(PhotonCandidate->Pt());
1515 fClusterCandidates->Add(PhotonCandidate); // if no second loop is required add to events good gammas
1516
8bdca7f1 1517 if(fIsMC){
fd94f234 1518 if(fInputEvent->IsA()==AliESDEvent::Class()){
1519 ProcessTrueClusterCandidates(PhotonCandidate);
1520 } else {
1521 ProcessTrueClusterCandidatesAOD(PhotonCandidate);
1522 }
8bdca7f1 1523 }
1524
344100c4 1525 delete tmpvec;
8bdca7f1 1526 }
1527
1528}
1529
1530//________________________________________________________________________
1531void AliAnalysisTaskGammaConvCalo::ProcessTrueClusterCandidates(AliAODConversionPhoton *TruePhotonCandidate)
1532{
fd94f234 1533
1534 TParticle *Photon = NULL;
1535 if (!TruePhotonCandidate->GetIsCaloPhoton()) AliFatal("CaloPhotonFlag has not been set task will abort");
1536 fHistoTrueNLabelsInClus[fiCut]->Fill(TruePhotonCandidate->GetNCaloPhotonMCLabels());
8bdca7f1 1537
fd94f234 1538 if (TruePhotonCandidate->GetNCaloPhotonMCLabels()>0)Photon = fMCStack->Particle(TruePhotonCandidate->GetCaloPhotonMCLabel(0));
1539 else return;
1540
8bdca7f1 1541 if(Photon == NULL){
1542 // cout << "no photon" << endl;
1543 return;
1544 }
fd94f234 1545
1546 TruePhotonCandidate->SetCaloPhotonMCFlags(fMCStack);
8bdca7f1 1547
1548 // True Photon
1549 if(fIsFromMBHeader){
fd94f234 1550 if (TruePhotonCandidate->IsLargestComponentPhoton() || TruePhotonCandidate->IsLargestComponentElectron() )fHistoTrueClusGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1551 else fHistoTrueClusEMNonLeadingPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1552 if (fDoClusterQA > 0){
20af4b69 1553 if (TruePhotonCandidate->IsLargestComponentPhoton()){
fd94f234 1554 fHistoTrueClusUnConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
20af4b69 1555 fHistoTrueClusUnConvGammaMCPt[fiCut]->Fill(Photon->Pt());
1556 }
fd94f234 1557 if (TruePhotonCandidate->IsLargestComponentElectron())
1558 fHistoTrueClusElectronPt[fiCut]->Fill(TruePhotonCandidate->Pt());
20af4b69 1559 if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion()){
fd94f234 1560 fHistoTrueClusConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
20af4b69 1561 fHistoTrueClusConvGammaMCPt[fiCut]->Fill(((TParticle*)fMCStack->Particle(Photon->GetMother(0)))->Pt());
1562 }
fd94f234 1563 if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion() && TruePhotonCandidate->IsConversionFullyContained())
1564 fHistoTrueClusConvGammaFullyPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1565 if (TruePhotonCandidate->IsMerged() || TruePhotonCandidate->IsMergedPartConv() || TruePhotonCandidate->IsDalitzMerged())
1566 fHistoTrueClusMergedGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1567 if (TruePhotonCandidate->IsMergedPartConv())
1568 fHistoTrueClusMergedPartConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1569 if (TruePhotonCandidate->IsDalitz())
1570 fHistoTrueClusDalitzPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1571 if (TruePhotonCandidate->IsDalitzMerged())
1572 fHistoTrueClusDalitzMergedPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1573 if (TruePhotonCandidate->IsPhotonWithElecMother())
1574 fHistoTrueClusPhotonFromElecMotherPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1575 if (TruePhotonCandidate->IsShower())
1576 fHistoTrueClusShowerPt[fiCut]->Fill(TruePhotonCandidate->Pt());
cc579963 1577 if (TruePhotonCandidate->IsSubLeadingEM())
1578 fHistoTrueClusSubLeadingPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1579 fHistoTrueClusNParticles[fiCut]->Fill(TruePhotonCandidate->GetNCaloPhotonMotherMCLabels());
fd94f234 1580 }
8bdca7f1 1581 }
1582
1583 if(Photon->GetMother(0) <= fMCStack->GetNprimary()){
1584 // Count just primary MC Gammas as true --> For Ratio esdtruegamma / mcconvgamma
1585 if(fIsFromMBHeader){
344100c4 1586 fHistoTruePrimaryClusGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1587 fHistoTruePrimaryClusGammaESDPtMCPt[fiCut]->Fill(TruePhotonCandidate->Pt(),Photon->Pt()); // Allways Filled
8bdca7f1 1588 }
fd94f234 1589 }
1590 return;
1591}
1592
1593
1594//________________________________________________________________________
1595void AliAnalysisTaskGammaConvCalo::ProcessTrueClusterCandidatesAOD(AliAODConversionPhoton *TruePhotonCandidate)
1596{
1597 AliAODMCParticle *Photon = NULL;
1598 TClonesArray *AODMCTrackArray = dynamic_cast<TClonesArray*>(fInputEvent->FindListObject(AliAODMCParticle::StdBranchName()));
1599 if (AODMCTrackArray){
1600 if (!TruePhotonCandidate->GetIsCaloPhoton()) AliFatal("CaloPhotonFlag has not been set task will abort");
1601 if (TruePhotonCandidate->GetNCaloPhotonMCLabels()>0) Photon = (AliAODMCParticle*) AODMCTrackArray->At(TruePhotonCandidate->GetCaloPhotonMCLabel(0));
1602 else return;
1603 } else {
1604 AliInfo("AODMCTrackArray could not be loaded");
1605 return;
8bdca7f1 1606 }
1607
fd94f234 1608 if(Photon == NULL){
cc579963 1609 // cout << "no photon" << endl;
fd94f234 1610 return;
1611 }
1612 TruePhotonCandidate->SetCaloPhotonMCFlagsAOD(fInputEvent);
d404157c 1613 fHistoTrueNLabelsInClus[fiCut]->Fill(TruePhotonCandidate->GetNCaloPhotonMCLabels());
fd94f234 1614 // True Photon
1615 if(fIsFromMBHeader){
1616 if (TruePhotonCandidate->IsLargestComponentPhoton() || TruePhotonCandidate->IsLargestComponentElectron() )fHistoTrueClusGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1617 else fHistoTrueClusEMNonLeadingPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1618 if (fDoClusterQA > 0){
20af4b69 1619 if (TruePhotonCandidate->IsLargestComponentPhoton()) {
fd94f234 1620 fHistoTrueClusUnConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
20af4b69 1621 fHistoTrueClusUnConvGammaMCPt[fiCut]->Fill(Photon->Pt());
1622 }
fd94f234 1623 if (TruePhotonCandidate->IsLargestComponentElectron())
1624 fHistoTrueClusElectronPt[fiCut]->Fill(TruePhotonCandidate->Pt());
20af4b69 1625 if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion()) {
fd94f234 1626 fHistoTrueClusConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
20af4b69 1627 AliAODMCParticle *Mother = (AliAODMCParticle*) AODMCTrackArray->At(Photon->GetMother());
1628 fHistoTrueClusConvGammaMCPt[fiCut]->Fill(Mother->Pt());
1629 }
fd94f234 1630 if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion() && TruePhotonCandidate->IsConversionFullyContained())
1631 fHistoTrueClusConvGammaFullyPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1632 if (TruePhotonCandidate->IsMerged() || TruePhotonCandidate->IsMergedPartConv() || TruePhotonCandidate->IsDalitzMerged())
1633 fHistoTrueClusMergedGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1634 if (TruePhotonCandidate->IsMergedPartConv())
1635 fHistoTrueClusMergedPartConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1636 if (TruePhotonCandidate->IsDalitz())
1637 fHistoTrueClusDalitzPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1638 if (TruePhotonCandidate->IsDalitzMerged())
1639 fHistoTrueClusDalitzMergedPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1640 if (TruePhotonCandidate->IsPhotonWithElecMother())
1641 fHistoTrueClusPhotonFromElecMotherPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1642 if (TruePhotonCandidate->IsShower())
1643 fHistoTrueClusShowerPt[fiCut]->Fill(TruePhotonCandidate->Pt());
cc579963 1644 if (TruePhotonCandidate->IsSubLeadingEM())
1645 fHistoTrueClusSubLeadingPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1646 fHistoTrueClusNParticles[fiCut]->Fill(TruePhotonCandidate->GetNCaloPhotonMotherMCLabels());
fd94f234 1647 }
1648 }
8bdca7f1 1649
fd94f234 1650 // True Photon
1651 if(fIsFromMBHeader){
1652 fHistoTrueClusGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1653// if (fDoPhotonQA > 0) fHistoTrueConvGammaEta[fiCut]->Fill(TruePhotonCandidate->Eta());
1654 }
1655
1656 if(Photon->IsPrimary()){
1657 // Count just primary MC Gammas as true --> For Ratio esdtruegamma / mcconvgamma
1658 if(fIsFromMBHeader){
1659 fHistoTruePrimaryClusGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1660 fHistoTruePrimaryClusGammaESDPtMCPt[fiCut]->Fill(TruePhotonCandidate->Pt(),Photon->Pt()); // Allways Filled
1661 }
1662 }
1663}
8bdca7f1 1664
1665//________________________________________________________________________
1666void AliAnalysisTaskGammaConvCalo::ProcessPhotonCandidates()
1667{
1668 Int_t nV0 = 0;
1669 TList *GammaCandidatesStepOne = new TList();
1670 TList *GammaCandidatesStepTwo = new TList();
1671 // Loop over Photon Candidates allocated by ReaderV1
1672 for(Int_t i = 0; i < fReaderGammas->GetEntriesFast(); i++){
1673 AliAODConversionPhoton* PhotonCandidate = (AliAODConversionPhoton*) fReaderGammas->At(i);
1674 if(!PhotonCandidate) continue;
1675 fIsFromMBHeader = kTRUE;
344100c4 1676 if(fIsMC && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 0){
1677 Int_t isPosFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(PhotonCandidate->GetMCLabelPositive(), fMCStack, fInputEvent);
1678 if(isPosFromMBHeader == 0 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 3) continue;
1679 Int_t isNegFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(PhotonCandidate->GetMCLabelNegative(), fMCStack, fInputEvent);
1680 if(isNegFromMBHeader == 0 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 3) continue;
8bdca7f1 1681 if( (isNegFromMBHeader+isPosFromMBHeader) != 4) fIsFromMBHeader = kFALSE;
1682 }
1683
344100c4 1684 if(!((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelected(PhotonCandidate,fInputEvent)) continue;
1685 if(!((AliConversionPhotonCuts*)fCutArray->At(fiCut))->InPlaneOutOfPlaneCut(PhotonCandidate->GetPhotonPhi(),fEventPlaneAngle)) continue;
1686 if(!((AliConversionPhotonCuts*)fCutArray->At(fiCut))->UseElecSharingCut() &&
1687 !((AliConversionPhotonCuts*)fCutArray->At(fiCut))->UseToCloseV0sCut()){
8bdca7f1 1688 fGammaCandidates->Add(PhotonCandidate); // if no second loop is required add to events good gammas
1689
1690 if(fIsFromMBHeader){
1691 fHistoConvGammaPt[fiCut]->Fill(PhotonCandidate->Pt());
1692 if (fDoPhotonQA > 0){
1693 fHistoConvGammaR[fiCut]->Fill(PhotonCandidate->GetConversionRadius());
1694 fHistoConvGammaEta[fiCut]->Fill(PhotonCandidate->Eta());
1695 }
1696 }
1697 if(fIsMC){
1698 if(fInputEvent->IsA()==AliESDEvent::Class())
1699 ProcessTruePhotonCandidates(PhotonCandidate);
1700 if(fInputEvent->IsA()==AliAODEvent::Class())
1701 ProcessTruePhotonCandidatesAOD(PhotonCandidate);
1702 }
1703 if (fIsFromMBHeader && fDoPhotonQA == 2){
1704 if (fIsHeavyIon == 1 && PhotonCandidate->Pt() > 0.399 && PhotonCandidate->Pt() < 12.){
344100c4 1705 fPtGamma = PhotonCandidate->Pt();
1706 fDCAzPhoton = PhotonCandidate->GetDCAzToPrimVtx();
1707 fRConvPhoton = PhotonCandidate->GetConversionRadius();
1708 fEtaPhoton = PhotonCandidate->GetPhotonEta();
1709 fCharCatPhoton = PhotonCandidate->GetPhotonQuality();
1710 fTreeConvGammaPtDcazCat[fiCut]->Fill();
8bdca7f1 1711 } else if ( PhotonCandidate->Pt() > 0.299 && PhotonCandidate->Pt() < 16.){
344100c4 1712 fPtGamma = PhotonCandidate->Pt();
1713 fDCAzPhoton = PhotonCandidate->GetDCAzToPrimVtx();
1714 fRConvPhoton = PhotonCandidate->GetConversionRadius();
1715 fEtaPhoton = PhotonCandidate->GetPhotonEta();
1716 fCharCatPhoton = PhotonCandidate->GetPhotonQuality();
1717 fTreeConvGammaPtDcazCat[fiCut]->Fill();
8bdca7f1 1718 }
1719 }
344100c4 1720 } else if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->UseElecSharingCut()){ // if Shared Electron cut is enabled, Fill array, add to step one
1721 ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->FillElectonLabelArray(PhotonCandidate,nV0);
8bdca7f1 1722 nV0++;
1723 GammaCandidatesStepOne->Add(PhotonCandidate);
344100c4 1724 } else if(!((AliConversionPhotonCuts*)fCutArray->At(fiCut))->UseElecSharingCut() &&
1725 ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->UseToCloseV0sCut()){ // shared electron is disabled, step one not needed -> step two
8bdca7f1 1726 GammaCandidatesStepTwo->Add(PhotonCandidate);
1727 }
1728 }
344100c4 1729 if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->UseElecSharingCut()){
8bdca7f1 1730 for(Int_t i = 0;i<GammaCandidatesStepOne->GetEntries();i++){
1731 AliAODConversionPhoton *PhotonCandidate= (AliAODConversionPhoton*) GammaCandidatesStepOne->At(i);
1732 if(!PhotonCandidate) continue;
1733 fIsFromMBHeader = kTRUE;
344100c4 1734 if(fMCStack && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 0){
1735 Int_t isPosFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(PhotonCandidate->GetMCLabelPositive(), fMCStack, fInputEvent);
1736 Int_t isNegFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(PhotonCandidate->GetMCLabelNegative(), fMCStack, fInputEvent);
8bdca7f1 1737 if( (isNegFromMBHeader+isPosFromMBHeader) != 4) fIsFromMBHeader = kFALSE;
1738 }
344100c4 1739 if(!((AliConversionPhotonCuts*)fCutArray->At(fiCut))->RejectSharedElectronV0s(PhotonCandidate,i,GammaCandidatesStepOne->GetEntries())) continue;
1740 if(!((AliConversionPhotonCuts*)fCutArray->At(fiCut))->UseToCloseV0sCut()){ // To Colse v0s cut diabled, step two not needed
8bdca7f1 1741 fGammaCandidates->Add(PhotonCandidate);
1742 if(fIsFromMBHeader){
1743 fHistoConvGammaPt[fiCut]->Fill(PhotonCandidate->Pt());
1744 if (fDoPhotonQA > 0){
1745 fHistoConvGammaR[fiCut]->Fill(PhotonCandidate->GetConversionRadius());
1746 fHistoConvGammaEta[fiCut]->Fill(PhotonCandidate->Eta());
1747 }
1748 }
1749 }
1750 if(fIsMC){
1751 if(fInputEvent->IsA()==AliESDEvent::Class())
1752 ProcessTruePhotonCandidates(PhotonCandidate);
1753 if(fInputEvent->IsA()==AliAODEvent::Class())
1754 ProcessTruePhotonCandidatesAOD(PhotonCandidate);
1755 } else GammaCandidatesStepTwo->Add(PhotonCandidate); // Close v0s cut enabled -> add to list two
1756
1757 if (fIsFromMBHeader && fDoPhotonQA == 2){
1758 if (fIsHeavyIon ==1 && PhotonCandidate->Pt() > 0.399 && PhotonCandidate->Pt() < 12.){
1759 fPtGamma = PhotonCandidate->Pt();
1760 fDCAzPhoton = PhotonCandidate->GetDCAzToPrimVtx();
1761 fRConvPhoton = PhotonCandidate->GetConversionRadius();
1762 fEtaPhoton = PhotonCandidate->GetPhotonEta();
1763 fCharCatPhoton = PhotonCandidate->GetPhotonQuality();
1764 fTreeConvGammaPtDcazCat[fiCut]->Fill();
1765 } else if ( PhotonCandidate->Pt() > 0.299 && PhotonCandidate->Pt() < 16.){
1766 fPtGamma = PhotonCandidate->Pt();
1767 fDCAzPhoton = PhotonCandidate->GetDCAzToPrimVtx();
1768 fRConvPhoton = PhotonCandidate->GetConversionRadius();
1769 fEtaPhoton = PhotonCandidate->GetPhotonEta();
1770 fCharCatPhoton = PhotonCandidate->GetPhotonQuality();
1771 fTreeConvGammaPtDcazCat[fiCut]->Fill();
1772 }
1773 }
1774 }
1775 }
344100c4 1776 if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->UseToCloseV0sCut()){
8bdca7f1 1777 for(Int_t i = 0;i<GammaCandidatesStepTwo->GetEntries();i++){
1778 AliAODConversionPhoton* PhotonCandidate = (AliAODConversionPhoton*) GammaCandidatesStepTwo->At(i);
1779 if(!PhotonCandidate) continue;
1780 fIsFromMBHeader = kTRUE;
344100c4 1781 if(fMCStack && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 0){
1782 Int_t isPosFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(PhotonCandidate->GetMCLabelPositive(), fMCStack, fInputEvent);
1783 Int_t isNegFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(PhotonCandidate->GetMCLabelNegative(), fMCStack, fInputEvent);
8bdca7f1 1784 if( (isNegFromMBHeader+isPosFromMBHeader) != 4) fIsFromMBHeader = kFALSE;
1785 }
344100c4 1786 if(!((AliConversionPhotonCuts*)fCutArray->At(fiCut))->RejectToCloseV0s(PhotonCandidate,GammaCandidatesStepTwo,i)) continue;
8bdca7f1 1787 fGammaCandidates->Add(PhotonCandidate); // Add gamma to current cut TList
1788 if(fIsFromMBHeader){
1789 fHistoConvGammaPt[fiCut]->Fill(PhotonCandidate->Pt());
1790 if (fDoPhotonQA > 0){
1791 fHistoConvGammaR[fiCut]->Fill(PhotonCandidate->GetConversionRadius());
1792 fHistoConvGammaEta[fiCut]->Fill(PhotonCandidate->Eta());
1793 }
1794 }
1795 if(fIsMC){
1796 if(fInputEvent->IsA()==AliESDEvent::Class())
1797 ProcessTruePhotonCandidates(PhotonCandidate);
1798 if(fInputEvent->IsA()==AliAODEvent::Class())
1799 ProcessTruePhotonCandidatesAOD(PhotonCandidate);
1800 }
1801 if (fIsFromMBHeader){
1802 if (fIsHeavyIon == 1 && PhotonCandidate->Pt() > 0.399 && PhotonCandidate->Pt() < 12.){
1803 fPtGamma = PhotonCandidate->Pt();
1804 fDCAzPhoton = PhotonCandidate->GetDCAzToPrimVtx();
1805 fRConvPhoton = PhotonCandidate->GetConversionRadius();
1806 fEtaPhoton = PhotonCandidate->GetPhotonEta();
1807 fCharCatPhoton = PhotonCandidate->GetPhotonQuality();
1808 fTreeConvGammaPtDcazCat[fiCut]->Fill();
1809 } else if ( PhotonCandidate->Pt() > 0.299 && PhotonCandidate->Pt() < 16.){
1810 fPtGamma = PhotonCandidate->Pt();
1811 fDCAzPhoton = PhotonCandidate->GetDCAzToPrimVtx();
1812 fRConvPhoton = PhotonCandidate->GetConversionRadius();
1813 fEtaPhoton = PhotonCandidate->GetPhotonEta();
1814 fCharCatPhoton = PhotonCandidate->GetPhotonQuality();
1815 fTreeConvGammaPtDcazCat[fiCut]->Fill();
1816 }
1817 }
1818 }
1819 }
1820
1821 delete GammaCandidatesStepOne;
1822 GammaCandidatesStepOne = 0x0;
1823 delete GammaCandidatesStepTwo;
1824 GammaCandidatesStepTwo = 0x0;
1825
1826}
1827//________________________________________________________________________
1828void AliAnalysisTaskGammaConvCalo::ProcessTruePhotonCandidatesAOD(AliAODConversionPhoton *TruePhotonCandidate)
1829{
1830
1831 Double_t magField = fInputEvent->GetMagneticField();
1832 if( magField < 0.0 ){
1833 magField = 1.0;
1834 }
1835 else {
1836 magField = -1.0;
1837 }
1838
1839 TClonesArray *AODMCTrackArray = dynamic_cast<TClonesArray*>(fInputEvent->FindListObject(AliAODMCParticle::StdBranchName()));
1840 AliAODMCParticle *posDaughter = (AliAODMCParticle*) AODMCTrackArray->At(TruePhotonCandidate->GetMCLabelPositive());
1841 AliAODMCParticle *negDaughter = (AliAODMCParticle*) AODMCTrackArray->At(TruePhotonCandidate->GetMCLabelNegative());
1842 fCharPhotonMCInfo = 0;
1843
1844 if(posDaughter == NULL || negDaughter == NULL) return; // One particle does not exist
1845 Int_t pdgCode[2] = {abs(posDaughter->GetPdgCode()),abs(negDaughter->GetPdgCode())};
1846
1847 if(posDaughter->GetMother() != negDaughter->GetMother()){
1848 FillPhotonCombinatorialBackgroundHist(TruePhotonCandidate, pdgCode);
1849 fCharPhotonMCInfo = 1;
1850 return;
1851 }
1852 else if(posDaughter->GetMother() == -1){
1853 FillPhotonCombinatorialBackgroundHist(TruePhotonCandidate, pdgCode);
1854 fCharPhotonMCInfo = 1;
1855 return;
1856 }
1857
1858 if(pdgCode[0]!=11 || pdgCode[1]!=11){
1859 fCharPhotonMCInfo = 1;
1860 return; //One Particle is not a electron
1861 }
fd94f234 1862
8bdca7f1 1863 if(posDaughter->GetPdgCode()==negDaughter->GetPdgCode()){
1864 fCharPhotonMCInfo = 1;
1865 return; // Same Charge
1866 }
1867
fd94f234 1868 AliAODMCParticle *Photon = (AliAODMCParticle*) AODMCTrackArray->At(posDaughter->GetMother());
8bdca7f1 1869 if(Photon->GetPdgCode() != 22){
8bdca7f1 1870 fCharPhotonMCInfo = 1;
1871 return; // Mother is no Photon
1872 }
1873
1874 if(((posDaughter->GetMCProcessCode())) != 5 || ((negDaughter->GetMCProcessCode())) != 5){
1875 fCharPhotonMCInfo = 1;
1876 return;// check if the daughters come from a conversion
1877 }
1878 // STILL A BUG IN ALIROOT >>8 HAS TPO BE REMOVED AFTER FIX
1879
1880
1881
1882 // True Photon
1883 if(fIsFromMBHeader){
1884 fHistoTrueConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1885 if (fDoPhotonQA > 0) fHistoTrueConvGammaEta[fiCut]->Fill(TruePhotonCandidate->Eta());
1886 }
8bdca7f1 1887 if(Photon->IsPrimary()){
1888 // Count just primary MC Gammas as true --> For Ratio esdtruegamma / mcconvgamma
1889 if(fIsFromMBHeader){
1890 fCharPhotonMCInfo = 6;
1891 fHistoTruePrimaryConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1892 fHistoTruePrimaryConvGammaESDPtMCPt[fiCut]->Fill(TruePhotonCandidate->Pt(),Photon->Pt()); // Allways Filled
1893 }
1894 // (Not Filled for i6, Extra Signal Gamma (parambox) are secondary)
1895 } else {
1896 if(fIsFromMBHeader){
1897 fHistoTrueSecondaryConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1898 fCharPhotonMCInfo = 2;
1899 if(((AliAODMCParticle*)AODMCTrackArray->At(Photon->GetMother()))->GetMother() > -1 &&
1900 ((AliAODMCParticle*)AODMCTrackArray->At(((AliAODMCParticle*)AODMCTrackArray->At(Photon->GetMother()))->GetMother()))->GetPdgCode() == 3122){
1901 fCharPhotonMCInfo = 5;
1902 fHistoTrueSecondaryConvGammaFromXFromLambdaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1903 }
1904 if(((AliAODMCParticle*)AODMCTrackArray->At(Photon->GetMother()))->GetMother() > -1 &&
1905 ((AliAODMCParticle*)AODMCTrackArray->At(((AliAODMCParticle*)AODMCTrackArray->At(Photon->GetMother()))->GetMother()))->GetPdgCode() == 310){
1906 fCharPhotonMCInfo = 4;
1907 fHistoTrueSecondaryConvGammaFromXFromK0sPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1908 }
1909 if(((AliAODMCParticle*)AODMCTrackArray->At(Photon->GetMother()))->GetMother() > -1 &&
1910 ((AliAODMCParticle*)AODMCTrackArray->At(((AliAODMCParticle*)AODMCTrackArray->At(Photon->GetMother()))->GetMother()))->GetPdgCode() == 221){
1911 fCharPhotonMCInfo = 3;
1912 }
1913 }
1914 }
1915
1916}
1917//________________________________________________________________________
1918void AliAnalysisTaskGammaConvCalo::ProcessTruePhotonCandidates(AliAODConversionPhoton *TruePhotonCandidate)
1919{
cc579963 1920
8bdca7f1 1921 Double_t magField = fInputEvent->GetMagneticField();
1922 if( magField < 0.0 ){
1923 magField = 1.0;
1924 }
1925 else {
1926 magField = -1.0;
1927 }
cc579963 1928
8bdca7f1 1929 // Process True Photons
1930 TParticle *posDaughter = TruePhotonCandidate->GetPositiveMCDaughter(fMCStack);
1931 TParticle *negDaughter = TruePhotonCandidate->GetNegativeMCDaughter(fMCStack);
1932 fCharPhotonMCInfo = 0;
1933
1934 if(posDaughter == NULL || negDaughter == NULL) return; // One particle does not exist
1935 Int_t pdgCode[2] = {abs(posDaughter->GetPdgCode()),abs(negDaughter->GetPdgCode())};
1936 fCharPhotonMCInfo = 1;
1937 if(posDaughter->GetMother(0) != negDaughter->GetMother(0)){
1938 FillPhotonCombinatorialBackgroundHist(TruePhotonCandidate, pdgCode);
1939 return;
1940 }
1941 else if(posDaughter->GetMother(0) == -1){
1942 FillPhotonCombinatorialBackgroundHist(TruePhotonCandidate, pdgCode);
1943 return;
1944 }
1945
1946 if(pdgCode[0]!=11 || pdgCode[1]!=11) return; //One Particle is not a electron
1947
1948 if(posDaughter->GetPdgCode()==negDaughter->GetPdgCode()) return; // Same Charge
cc579963 1949
8bdca7f1 1950 TParticle *Photon = TruePhotonCandidate->GetMCParticle(fMCStack);
8bdca7f1 1951
1952 if(Photon->GetPdgCode() != 22){
8bdca7f1 1953 return; // Mother is no Photon
1954 }
1955
1956 if(posDaughter->GetUniqueID() != 5 || negDaughter->GetUniqueID() !=5) return;// check if the daughters come from a conversion
1957
8bdca7f1 1958 // True Photon
1959 if(fIsFromMBHeader){
1960 fHistoTrueConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1961 if (fDoPhotonQA > 0) fHistoTrueConvGammaEta[fiCut]->Fill(TruePhotonCandidate->Eta());
1962 }
8bdca7f1 1963 if(posDaughter->GetMother(0) <= fMCStack->GetNprimary()){
1964 // Count just primary MC Gammas as true --> For Ratio esdtruegamma / mcconvgamma
1965 if(fIsFromMBHeader){
1966 fCharPhotonMCInfo = 6;
1967 fHistoTruePrimaryConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1968 fHistoTruePrimaryConvGammaESDPtMCPt[fiCut]->Fill(TruePhotonCandidate->Pt(),Photon->Pt()); // Allways Filled
1969
1970 }
1971 // (Not Filled for i6, Extra Signal Gamma (parambox) are secondary)
1972 }
1973 else{
1974 if(fIsFromMBHeader){
1975 fCharPhotonMCInfo = 2;
1976 fHistoTrueSecondaryConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1977 if(fMCStack->Particle(Photon->GetMother(0))->GetMother(0) > -1 &&
1978 fMCStack->Particle(fMCStack->Particle(Photon->GetMother(0))->GetMother(0))->GetPdgCode() == 3122){
1979 fHistoTrueSecondaryConvGammaFromXFromLambdaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1980 fCharPhotonMCInfo = 5;
1981 }
1982 if(fMCStack->Particle(Photon->GetMother(0))->GetMother(0) > -1 &&
1983 fMCStack->Particle(fMCStack->Particle(Photon->GetMother(0))->GetMother(0))->GetPdgCode() == 310){
1984 fHistoTrueSecondaryConvGammaFromXFromK0sPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1985 fCharPhotonMCInfo = 4;
1986 }
1987 if(fMCStack->Particle(Photon->GetMother(0))->GetMother(0) > -1 &&
1988 fMCStack->Particle(fMCStack->Particle(Photon->GetMother(0))->GetMother(0))->GetPdgCode() == 221){
1989 fCharPhotonMCInfo = 3;
1990 }
1991 }
1992 }
cc579963 1993
8bdca7f1 1994 // pi0 photon
1995 //Bool_t bpi0 = 0;
1996 Int_t imother = Photon->GetMother(0);
cc579963 1997 if(imother > -1){
1998 AliMCParticle* McMother = static_cast<AliMCParticle*>(fMCEvent->GetTrack(imother));
1999 //cout << fMCEvent->GetRunNumber() << " " << imother << " " << fMCEvent->GetNumberOfTracks() << endl;
2000 if(McMother->PdgCode() == 111) fHistoTrueConvPi0GammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
8bdca7f1 2001 }
cc579963 2002 return;
8bdca7f1 2003}
2004//________________________________________________________________________
2005void AliAnalysisTaskGammaConvCalo::ProcessAODMCParticles()
2006{
2007
2008 TClonesArray *AODMCTrackArray = dynamic_cast<TClonesArray*>(fInputEvent->FindListObject(AliAODMCParticle::StdBranchName()));
2009
2010 // Loop over all primary MC particle
2011 for(Int_t i = 0; i < AODMCTrackArray->GetEntriesFast(); i++) {
2012
2013 AliAODMCParticle* particle = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(i));
2014 if (!particle) continue;
2015 if (!particle->IsPrimary()) continue;
2016
2017 Int_t isMCFromMBHeader = -1;
344100c4 2018 if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 0){
2019 isMCFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCStack, fInputEvent);
2020 if(isMCFromMBHeader == 0 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 3) continue;
8bdca7f1 2021 }
2022
344100c4 2023 if(!((AliConversionPhotonCuts*)fCutArray->At(fiCut))->InPlaneOutOfPlaneCut(particle->Phi(),fEventPlaneAngle,kFALSE)) continue;
2024 if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedAODMC(particle,AODMCTrackArray,kFALSE)){
8bdca7f1 2025 fHistoMCAllGammaPt[fiCut]->Fill(particle->Pt()); // All MC Gamma
d404157c 2026 if (abs(particle->Eta()) < 0.66 ){
2027 if (particle->Phi() > 1.39626 && particle->Phi() < 3.125) fHistoMCAllGammaEMCALAccPt[fiCut]->Fill(particle->Pt());
8bdca7f1 2028 }
d404157c 2029 if(particle->GetMother() >-1){ // Meson Decay Gamma
2030 switch((static_cast<AliAODMCParticle*>(AODMCTrackArray->At(particle->GetMother())))->GetPdgCode()){
2031 case 111: // Pi0
2032 fHistoMCDecayGammaPi0Pt[fiCut]->Fill(particle->Pt());
2033 break;
2034 case 113: // Rho0
2035 fHistoMCDecayGammaRhoPt[fiCut]->Fill(particle->Pt());
2036 break;
2037 case 221: // Eta
2038 fHistoMCDecayGammaEtaPt[fiCut]->Fill(particle->Pt());
2039 break;
2040 case 223: // Omega
2041 fHistoMCDecayGammaOmegaPt[fiCut]->Fill(particle->Pt());
2042 break;
2043 case 331: // Eta'
2044 fHistoMCDecayGammaEtapPt[fiCut]->Fill(particle->Pt());
2045 break;
2046 case 333: // Phi
2047 fHistoMCDecayGammaPhiPt[fiCut]->Fill(particle->Pt());
2048 break;
2049 case 3212: // Sigma
2050 fHistoMCDecayGammaSigmaPt[fiCut]->Fill(particle->Pt());
2051 break;
8bdca7f1 2052 }
d404157c 2053 }
2054 }
2055 if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedAODMC(particle,AODMCTrackArray,kTRUE)){
2056 Double_t rConv = 0;
2057 for(Int_t daughterIndex=particle->GetDaughter(0);daughterIndex<=particle->GetDaughter(1);daughterIndex++){
2058 AliAODMCParticle *tmpDaughter = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(daughterIndex));
2059 if(!tmpDaughter) continue;
2060 if(abs(tmpDaughter->GetPdgCode()) == 11){
2061 rConv = sqrt( (tmpDaughter->Xv()*tmpDaughter->Xv()) + (tmpDaughter->Yv()*tmpDaughter->Yv()) );
8bdca7f1 2062 }
2063 }
d404157c 2064 fHistoMCConvGammaPt[fiCut]->Fill(particle->Pt());
2065 if (fDoPhotonQA > 0){
2066 fHistoMCConvGammaR[fiCut]->Fill(rConv);
2067 fHistoMCConvGammaEta[fiCut]->Fill(particle->Eta());
2068 }
2069 }
2070 // Converted MC Gamma
2071 if(fDoMesonAnalysis){
8bdca7f1 2072 if(particle->GetPdgCode() == 310 && fDoMesonQA > 0){
2073 Double_t mesonY = 10.;
2074 if(particle->E() - particle->Pz() == 0 || particle->E() + particle->Pz() == 0){
344100c4 2075 mesonY=10.-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
8bdca7f1 2076 } else {
344100c4 2077 mesonY = 0.5*(TMath::Log((particle->E()+particle->Pz()) / (particle->E()-particle->Pz())))-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
8bdca7f1 2078 }
2079 Float_t weightedK0s= 1;
344100c4 2080 if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCStack, fInputEvent)){
8bdca7f1 2081 if (particle->Pt()>0.005){
344100c4 2082 weightedK0s= ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetWeightForMeson(fV0Reader->GetPeriodName(),i, 0x0, fInputEvent);
8bdca7f1 2083 //cout << "MC input \t"<<i << "\t" << particle->Pt()<<"\t"<<weighted << endl;
2084 }
2085 }
2086 fHistoMCK0sPt[fiCut]->Fill(particle->Pt(),weightedK0s);
2087 fHistoMCK0sWOWeightPt[fiCut]->Fill(particle->Pt());
2088 fHistoMCK0sPtY[fiCut]->Fill(particle->Pt(),mesonY,weightedK0s);
2089 }
2090 if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))
344100c4 2091 ->MesonIsSelectedAODMC(particle,AODMCTrackArray,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift())){
8bdca7f1 2092 AliAODMCParticle* daughter0 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(particle->GetDaughter(0)));
2093 AliAODMCParticle* daughter1 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(particle->GetDaughter(1)));
2094 Float_t weighted= 1;
344100c4 2095 if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCStack, fInputEvent)){
8bdca7f1 2096 if (particle->Pt()>0.005){
344100c4 2097 weighted= ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetWeightForMeson(fV0Reader->GetPeriodName(),i, 0x0, fInputEvent);
8bdca7f1 2098 // if(particle->GetPdgCode() == 221){
2099 // cout << "MC input \t"<<i << "\t" << particle->Pt()<<"\t"<<weighted << endl;
2100 // }
2101 }
2102 }
2103 Double_t mesonY = 10.;
2104 if(particle->E() - particle->Pz() == 0 || particle->E() + particle->Pz() == 0){
344100c4 2105 mesonY=10.-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
8bdca7f1 2106 } else{
344100c4 2107 mesonY = 0.5*(TMath::Log((particle->E()+particle->Pz()) / (particle->E()-particle->Pz())))-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
8bdca7f1 2108 }
2109
2110 if(particle->GetPdgCode() == 111){
2111 fHistoMCPi0Pt[fiCut]->Fill(particle->Pt(),weighted); // All MC Pi0
2112 fHistoMCPi0WOWeightPt[fiCut]->Fill(particle->Pt());
2113 if (fDoMesonQA > 0) fHistoMCPi0PtY[fiCut]->Fill(particle->Pt(),mesonY,weighted); // All MC Pi0
2114 } else if(particle->GetPdgCode() == 221){
2115 fHistoMCEtaPt[fiCut]->Fill(particle->Pt(),weighted); // All MC Eta
2116 fHistoMCEtaWOWeightPt[fiCut]->Fill(particle->Pt());
2117 if (fDoMesonQA > 0) fHistoMCEtaPtY[fiCut]->Fill(particle->Pt(),mesonY,weighted); // All MC Pi0
2118 }
2119
2120 // Check the acceptance for both gammas
344100c4 2121 if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedAODMC(daughter0,AODMCTrackArray,kFALSE) &&
2122 ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedAODMC(daughter1,AODMCTrackArray,kFALSE) &&
2123 ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->InPlaneOutOfPlaneCut(daughter0->Phi(),fEventPlaneAngle,kFALSE) &&
2124 ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->InPlaneOutOfPlaneCut(daughter1->Phi(),fEventPlaneAngle,kFALSE)){
8bdca7f1 2125
2126 if(particle->GetPdgCode() == 111){
2127 fHistoMCPi0InAccPt[fiCut]->Fill(particle->Pt(),weighted); // MC Pi0 with gamma in acc
2128 } else if(particle->GetPdgCode() == 221){
2129 fHistoMCEtaInAccPt[fiCut]->Fill(particle->Pt(),weighted); // MC Eta with gamma in acc
2130 }
2131 }
2132 }
2133 }
2134 }
2135
2136}
2137//________________________________________________________________________
2138void AliAnalysisTaskGammaConvCalo::ProcessMCParticles()
2139{
2140 // Loop over all primary MC particle
2141 for(Int_t i = 0; i < fMCStack->GetNprimary(); i++) {
2142 TParticle* particle = (TParticle *)fMCStack->Particle(i);
2143 if (!particle) continue;
2144
2145 Int_t isMCFromMBHeader = -1;
344100c4 2146 if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 0){
2147 isMCFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCStack, fInputEvent);
2148 if(isMCFromMBHeader == 0 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 3) continue;
8bdca7f1 2149 }
2150
344100c4 2151 if(!((AliConversionPhotonCuts*)fCutArray->At(fiCut))->InPlaneOutOfPlaneCut(particle->Phi(),fEventPlaneAngle,kFALSE)) continue;
2152 if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedMC(particle,fMCStack,kFALSE)){
8bdca7f1 2153 fHistoMCAllGammaPt[fiCut]->Fill(particle->Pt()); // All MC Gamma
20af4b69 2154 if (abs(particle->Eta()) < 0.66 ){
2155 if (particle->Phi() > 1.39626 && particle->Phi() < 3.125) fHistoMCAllGammaEMCALAccPt[fiCut]->Fill(particle->Pt());
2156 }
2157
8bdca7f1 2158 if(particle->GetMother(0) >-1){ // Meson Decay Gamma
2159 switch(fMCStack->Particle(particle->GetMother(0))->GetPdgCode()){
2160 case 111: // Pi0
2161 fHistoMCDecayGammaPi0Pt[fiCut]->Fill(particle->Pt());
2162 break;
2163 case 113: // Rho0
2164 fHistoMCDecayGammaRhoPt[fiCut]->Fill(particle->Pt());
2165 break;
2166 case 221: // Eta
2167 fHistoMCDecayGammaEtaPt[fiCut]->Fill(particle->Pt());
2168 break;
2169 case 223: // Omega
2170 fHistoMCDecayGammaOmegaPt[fiCut]->Fill(particle->Pt());
2171 break;
2172 case 331: // Eta'
2173 fHistoMCDecayGammaEtapPt[fiCut]->Fill(particle->Pt());
2174 break;
2175 case 333: // Phi
2176 fHistoMCDecayGammaPhiPt[fiCut]->Fill(particle->Pt());
2177 break;
2178 case 3212: // Sigma
2179 fHistoMCDecayGammaSigmaPt[fiCut]->Fill(particle->Pt());
2180 break;
2181 }
2182 }
2183 }
344100c4 2184 if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedMC(particle,fMCStack,kTRUE)){
8bdca7f1 2185 fHistoMCConvGammaPt[fiCut]->Fill(particle->Pt());
2186 if (fDoPhotonQA > 0){
2187 fHistoMCConvGammaR[fiCut]->Fill(((TParticle*)fMCStack->Particle(particle->GetFirstDaughter()))->R());
2188 fHistoMCConvGammaEta[fiCut]->Fill(particle->Eta());
2189 }
2190 } // Converted MC Gamma
2191 if(fDoMesonAnalysis){
2192 if(particle->GetPdgCode() == 310 && fDoMesonQA > 0){
2193 Double_t mesonY = 10.;
2194 if(particle->Energy() - particle->Pz() == 0 || particle->Energy() + particle->Pz() == 0){
344100c4 2195 mesonY=10.-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
8bdca7f1 2196 } else{
344100c4 2197 mesonY = 0.5*(TMath::Log((particle->Energy()+particle->Pz()) / (particle->Energy()-particle->Pz())))-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
8bdca7f1 2198 }
2199 Float_t weightedK0s= 1;
344100c4 2200 if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCStack, fInputEvent)){
8bdca7f1 2201 if (particle->Pt()>0.005){
344100c4 2202 weightedK0s= ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetWeightForMeson(fV0Reader->GetPeriodName(),i, fMCStack, fInputEvent);
8bdca7f1 2203 //cout << "MC input \t"<<i << "\t" << particle->Pt()<<"\t"<<weighted << endl;
2204 }
2205 }
2206 if (fMCStack->IsPhysicalPrimary(i)){
2207 fHistoMCK0sPt[fiCut]->Fill(particle->Pt(),weightedK0s);
2208 fHistoMCK0sWOWeightPt[fiCut]->Fill(particle->Pt());
2209 fHistoMCK0sPtY[fiCut]->Fill(particle->Pt(),mesonY,weightedK0s);
2210 }
2211 }
2212 if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))
344100c4 2213 ->MesonIsSelectedMC(particle,fMCStack,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift())){
8bdca7f1 2214 TParticle* daughter0 = (TParticle*)fMCStack->Particle(particle->GetFirstDaughter());
2215 TParticle* daughter1 = (TParticle*)fMCStack->Particle(particle->GetLastDaughter());
2216
2217 Float_t weighted= 1;
344100c4 2218 if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCStack, fInputEvent)){
8bdca7f1 2219 if (particle->Pt()>0.005){
344100c4 2220 weighted= ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetWeightForMeson(fV0Reader->GetPeriodName(),i, fMCStack, fInputEvent);
8bdca7f1 2221 // if(particle->GetPdgCode() == 221){
2222 // cout << "MC input \t"<<i << "\t" << particle->Pt()<<"\t"<<weighted << endl;
2223 // }
2224 }
2225 }
2226 Double_t mesonY = 10.;
2227 if(particle->Energy() - particle->Pz() == 0 || particle->Energy() + particle->Pz() == 0){
344100c4 2228 mesonY=10.-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
8bdca7f1 2229 } else{
344100c4 2230 mesonY = 0.5*(TMath::Log((particle->Energy()+particle->Pz()) / (particle->Energy()-particle->Pz())))-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
8bdca7f1 2231 }
2232
2233 if(particle->GetPdgCode() == 111){
2234 fHistoMCPi0Pt[fiCut]->Fill(particle->Pt(),weighted); // All MC Pi0
2235 fHistoMCPi0WOWeightPt[fiCut]->Fill(particle->Pt());
2236 if (fDoMesonQA > 0) fHistoMCPi0PtY[fiCut]->Fill(particle->Pt(),mesonY,weighted); // All MC Pi0
2237 } else if(particle->GetPdgCode() == 221){
2238 fHistoMCEtaPt[fiCut]->Fill(particle->Pt(),weighted); // All MC Eta
2239 fHistoMCEtaWOWeightPt[fiCut]->Fill(particle->Pt());
2240 if (fDoMesonQA > 0) fHistoMCEtaPtY[fiCut]->Fill(particle->Pt(),mesonY,weighted); // All MC Pi0
2241 }
2242
2243 // Check the acceptance for both gammas
344100c4 2244 if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedMC(daughter0,fMCStack,kFALSE) &&
2245 ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedMC(daughter1,fMCStack,kFALSE) &&
2246 ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->InPlaneOutOfPlaneCut(daughter0->Phi(),fEventPlaneAngle,kFALSE) &&
2247 ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->InPlaneOutOfPlaneCut(daughter1->Phi(),fEventPlaneAngle,kFALSE)){
8bdca7f1 2248
2249 if(particle->GetPdgCode() == 111){
2250 fHistoMCPi0InAccPt[fiCut]->Fill(particle->Pt(),weighted); // MC Pi0 with gamma in acc
2251 } else if(particle->GetPdgCode() == 221){
2252 fHistoMCEtaInAccPt[fiCut]->Fill(particle->Pt(),weighted); // MC Eta with gamma in acc
2253 }
2254 }
2255 }
2256 }
2257 }
2258
2259 if (fDoMesonQA){
2260 for(Int_t i = fMCStack->GetNprimary(); i < fMCStack->GetNtrack(); i++) {
2261 TParticle* particle = (TParticle *)fMCStack->Particle(i);
2262 if (!particle) continue;
2263
2264 Int_t isMCFromMBHeader = -1;
344100c4 2265 if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 0){
2266 isMCFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCStack, fInputEvent);
2267 if(isMCFromMBHeader == 0 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 3) continue;
8bdca7f1 2268 }
2269
2270 if(fDoMesonAnalysis){
344100c4 2271 if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->MesonIsSelectedMC(particle,fMCStack,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift())){
8bdca7f1 2272 Float_t weighted= 1;
344100c4 2273 if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCStack, fInputEvent)){
8bdca7f1 2274 if (particle->Pt()>0.005){
344100c4 2275 weighted= ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetWeightForMeson(fV0Reader->GetPeriodName(),i, fMCStack, fInputEvent);
8bdca7f1 2276 // if(particle->GetPdgCode() == 221){
2277 // cout << "MC input \t"<<i << "\t" << particle->Pt()<<"\t"<<weighted << endl;
2278 // }
2279 }
2280 }
2281
2282 if(particle->GetPdgCode() == 111){
2283 Int_t pdgCode = ((TParticle*)fMCStack->Particle( particle->GetFirstMother() ))->GetPdgCode();
2284 Int_t source = GetSourceClassification(111,pdgCode);
2285 fHistoMCSecPi0PtvsSource[fiCut]->Fill(particle->Pt(),source,weighted); // All MC Pi0
2286 fHistoMCSecPi0Source[fiCut]->Fill(pdgCode);
2287 } else if(particle->GetPdgCode() == 221){
2288 Int_t pdgCode = ((TParticle*)fMCStack->Particle( particle->GetFirstMother() ))->GetPdgCode();
2289 fHistoMCSecEtaPt[fiCut]->Fill(particle->Pt(),weighted); // All MC Pi0
2290 fHistoMCSecEtaSource[fiCut]->Fill(pdgCode);
2291 }
2292 }
2293 }
2294 }
2295 }
2296}
2297
2298//________________________________________________________________________
2299void AliAnalysisTaskGammaConvCalo::PhotonTagging(){
2300
2301 // Conversion Gammas
2302 if(fGammaCandidates->GetEntries()>0){
2303
2304 for(Int_t firstGammaIndex=0;firstGammaIndex<fGammaCandidates->GetEntries()-1;firstGammaIndex++){
2305
2306 // get conversion photon
2307 AliAODConversionPhoton *gamma0=dynamic_cast<AliAODConversionPhoton*>(fGammaCandidates->At(firstGammaIndex));
2308 if (gamma0==NULL) continue;
2309
2310 TLorentzVector photonVector;
2311 photonVector.SetPxPyPzE(gamma0->GetPx(),gamma0->GetPy(),gamma0->GetPz(),gamma0->GetPhotonP());
2312
2313 Bool_t btagpi0 = 0;
2314 Bool_t btageta = 0;
2315
2316 // loop over clusters
2317 for(Int_t secondGammaIndex = 0; secondGammaIndex<fClusterCandidates->GetEntries(); ++secondGammaIndex) {
2318
2319 AliAODConversionPhoton *gamma1=dynamic_cast<AliAODConversionPhoton*>(fClusterCandidates->At(secondGammaIndex));
2320 if (gamma1==NULL) continue;
2321
2322 TLorentzVector clusterVector;
2323 clusterVector.SetPxPyPzE(gamma1->GetPx(),gamma1->GetPy(),gamma1->GetPz(),gamma1->GetPhotonP());
2324
2325 // do the tagging
2326 TLorentzVector pairVector = photonVector+clusterVector;
2327
2328 // see if pi0?
2329 if((pairVector.M() > 0.11 && pairVector.M() < 0.15)){
344100c4 2330 btagpi0 = 1;
8bdca7f1 2331 }
2332 // or eta
2333 if((pairVector.M() > 0.50 && pairVector.M() < 0.6)){
344100c4 2334 btageta = 1;
8bdca7f1 2335 }
2336 }// end loop over clusters
2337
2338 if(btagpi0 && btageta)
2339 fHistoConvGammaTagged[fiCut]->Fill(photonVector.Pt());
2340 else if(btagpi0 && !btageta)
2341 fHistoConvGammaPi0Tagged[fiCut]->Fill(photonVector.Pt());
2342 else if(btageta && !btagpi0)
2343 fHistoConvGammaEtaTagged[fiCut]->Fill(photonVector.Pt());
2344 else
2345 fHistoConvGammaUntagged[fiCut]->Fill(photonVector.Pt());
2346
2347 }// end loop over gammas
2348 }// end if
2349 return;
2350}
2351
2352//________________________________________________________________________
2353void AliAnalysisTaskGammaConvCalo::CalculatePi0Candidates(){
2354
2355 // Conversion Gammas
2356 if(fGammaCandidates->GetEntries()>0){
2357
2358 // vertex
2359 Double_t vertex[3] = {0};
2360 InputEvent()->GetPrimaryVertex()->GetXYZ(vertex);
2361
2362 for(Int_t firstGammaIndex=0;firstGammaIndex<fGammaCandidates->GetEntries();firstGammaIndex++){
2363 AliAODConversionPhoton *gamma0=dynamic_cast<AliAODConversionPhoton*>(fGammaCandidates->At(firstGammaIndex));
2364 if (gamma0==NULL) continue;
2365
2366 for(Int_t secondGammaIndex=0;secondGammaIndex<fClusterCandidates->GetEntries();secondGammaIndex++){
d53bf4ac 2367 Bool_t matched = kFALSE;
8bdca7f1 2368 AliAODConversionPhoton *gamma1=dynamic_cast<AliAODConversionPhoton*>(fClusterCandidates->At(secondGammaIndex));
2369 if (gamma1==NULL) continue;
2370
d53bf4ac 2371 if (gamma1->GetIsCaloPhoton()){
2372 AliVCluster* cluster = fInputEvent->GetCaloCluster(gamma1->GetCaloClusterRef());
2373 matched = ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->MatchConvPhotonToCluster(gamma0,cluster, fInputEvent );
2374 }
2375
8bdca7f1 2376 AliAODConversionMother *pi0cand = new AliAODConversionMother(gamma0,gamma1);
2377 pi0cand->SetLabels(firstGammaIndex,secondGammaIndex);
2378
d53bf4ac 2379
2380
344100c4 2381 if((((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->MesonIsSelected(pi0cand,kTRUE,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift()))){
d53bf4ac 2382 if (matched){
2383 fHistoMotherMatchedInvMassPt[fiCut]->Fill(pi0cand->M(),pi0cand->Pt());
2384 } else {
2385 fHistoMotherInvMassPt[fiCut]->Fill(pi0cand->M(),pi0cand->Pt());
2386 }
8bdca7f1 2387 // fill new histograms
d53bf4ac 2388 if (!matched){
2389 fHistoPhotonPairAll[fiCut]->Fill(pi0cand->M(),pi0cand->Pt());
2390 fHistoPhotonPairAllGam[fiCut]->Fill(pi0cand->M(),gamma0->Pt());
8bdca7f1 2391
d53bf4ac 2392 if(pi0cand->GetAlpha()<0.1)
2393 fHistoMotherInvMassEalpha[fiCut]->Fill(pi0cand->M(),pi0cand->E());
2394
2395 if (fDoMesonQA > 0){
2396 if ( pi0cand->M() > 0.05 && pi0cand->M() < 0.17){
2397 fHistoMotherPi0PtY[fiCut]->Fill(pi0cand->Pt(),pi0cand->Rapidity()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift());
2398 fHistoMotherPi0PtAlpha[fiCut]->Fill(pi0cand->Pt(),pi0cand->GetAlpha());
2399 fHistoMotherPi0PtOpenAngle[fiCut]->Fill(pi0cand->Pt(),pi0cand->GetOpeningAngle());
8bdca7f1 2400 }
d53bf4ac 2401 if ( pi0cand->M() > 0.45 && pi0cand->M() < 0.65){
2402 fHistoMotherEtaPtY[fiCut]->Fill(pi0cand->Pt(),pi0cand->Rapidity()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift());
2403 fHistoMotherEtaPtAlpha[fiCut]->Fill(pi0cand->Pt(),pi0cand->GetAlpha());
2404 fHistoMotherEtaPtOpenAngle[fiCut]->Fill(pi0cand->Pt(),pi0cand->GetOpeningAngle());
2405 }
2406 }
2407 if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->DoBGCalculation()){
2408 Int_t zbin = 0;
2409 Int_t mbin = 0;
2410
2411 if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->BackgroundHandlerType() == 0){
2412 zbin = fBGHandler[fiCut]->GetZBinIndex(fInputEvent->GetPrimaryVertex()->GetZ());
2413 if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->UseTrackMultiplicity()){
2414 mbin = fBGHandler[fiCut]->GetMultiplicityBinIndex(fV0Reader->GetNumberOfPrimaryTracks());
2415 } else {
2416 mbin = fBGHandler[fiCut]->GetMultiplicityBinIndex(fGammaCandidates->GetEntries());
2417 }
2418 } else{
2419 zbin = fBGHandlerRP[fiCut]->GetZBinIndex(fInputEvent->GetPrimaryVertex()->GetZ());
2420 if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->UseTrackMultiplicity()){
2421 mbin = fBGHandlerRP[fiCut]->GetMultiplicityBinIndex(fV0Reader->GetNumberOfPrimaryTracks());
2422 } else {
2423 mbin = fBGHandlerRP[fiCut]->GetMultiplicityBinIndex(fGammaCandidates->GetEntries());
2424 }
8bdca7f1 2425 }
d53bf4ac 2426 Double_t sparesFill[4] = {pi0cand->M(),pi0cand->Pt(),(Double_t)zbin,(Double_t)mbin};
2427 fSparseMotherInvMassPtZM[fiCut]->Fill(sparesFill,1);
8bdca7f1 2428 }
8bdca7f1 2429 }
2430
8bdca7f1 2431 if(fIsMC){
2432 if(fInputEvent->IsA()==AliESDEvent::Class())
d53bf4ac 2433 ProcessTrueMesonCandidates(pi0cand,gamma0,gamma1, matched);
8bdca7f1 2434 if(fInputEvent->IsA()==AliAODEvent::Class())
d53bf4ac 2435 ProcessTrueMesonCandidatesAOD(pi0cand,gamma0,gamma1, matched);
8bdca7f1 2436 }
d53bf4ac 2437 if (!matched){
2438 if (fDoMesonQA == 2){
2439 fInvMass = pi0cand->M();
2440 fPt = pi0cand->Pt();
2441 if (abs(gamma0->GetDCAzToPrimVtx()) < abs(gamma1->GetDCAzToPrimVtx())){
2442 fDCAzGammaMin = gamma0->GetDCAzToPrimVtx();
2443 fDCAzGammaMax = gamma1->GetDCAzToPrimVtx();
2444 } else {
2445 fDCAzGammaMin = gamma1->GetDCAzToPrimVtx();
2446 fDCAzGammaMax = gamma0->GetDCAzToPrimVtx();
2447 }
2448 fCharFlag = pi0cand->GetMesonQuality();
2449 // cout << "gamma 0: " << gamma0->GetV0Index()<< "\t" << gamma0->GetPx() << "\t" << gamma0->GetPy() << "\t" << gamma0->GetPz() << "\t" << endl;
2450 // cout << "gamma 1: " << gamma1->GetV0Index()<< "\t"<< gamma1->GetPx() << "\t" << gamma1->GetPy() << "\t" << gamma1->GetPz() << "\t" << endl;
2451 // cout << "pi0: "<<fInvMass << "\t" << fPt <<"\t" << fDCAzGammaMin << "\t" << fDCAzGammaMax << "\t" << (Int_t)fCharFlag << "\t" << (Int_t)fCharMesonMCInfo <<endl;
2452 if (fIsHeavyIon == 1 && fPt > 0.399 && fPt < 20. ) {
2453 if (fInvMass > 0.08 && fInvMass < 0.2) fTreeMesonsInvMassPtDcazMinDcazMaxFlag[fiCut]->Fill();
2454 if ((fInvMass > 0.45 && fInvMass < 0.6) && (fPt > 0.999 && fPt < 20.) )fTreeMesonsInvMassPtDcazMinDcazMaxFlag[fiCut]->Fill();
2455 } else if (fPt > 0.299 && fPt < 20. ) {
2456 if ( (fInvMass > 0.08 && fInvMass < 0.2) || (fInvMass > 0.45 && fInvMass < 0.6)) fTreeMesonsInvMassPtDcazMinDcazMaxFlag[fiCut]->Fill();
2457 }
8bdca7f1 2458 }
d53bf4ac 2459 if (fDoMesonQA == 1){
2460 fHistoMotherInvMassECalib[fiCut]->Fill(pi0cand->M(),gamma1->E());
2461 if(pi0cand->GetAlpha()<0.1)
2462 fHistoMotherInvMassECalibalpha[fiCut]->Fill(pi0cand->M(),gamma1->E());
8bdca7f1 2463 }
2464 }
2465 }
2466 delete pi0cand;
2467 pi0cand=0x0;
2468 }
2469 }
2470 }
2471}
2472//______________________________________________________________________
d53bf4ac 2473void AliAnalysisTaskGammaConvCalo::ProcessTrueMesonCandidates(AliAODConversionMother *Pi0Candidate, AliAODConversionPhoton *TrueGammaCandidate0, AliAODConversionPhoton *TrueGammaCandidate1, Bool_t matched)
8bdca7f1 2474{
2475 // Process True Mesons
2476 AliStack *MCStack = fMCEvent->Stack();
2477 fCharMesonMCInfo = 0;
2478 if(TrueGammaCandidate0->GetV0Index()<fInputEvent->GetNumberOfV0s()){
2479 Bool_t isTruePi0 = kFALSE;
2480 Bool_t isTrueEta = kFALSE;
8bdca7f1 2481 Int_t gamma0MCLabel = TrueGammaCandidate0->GetMCParticleLabel(MCStack);
2482 Int_t gamma0MotherLabel = -1;
2483 if(gamma0MCLabel != -1){ // Gamma is Combinatorial; MC Particles don't belong to the same Mother
fd94f234 2484 // Daughters Gamma 0
2485 TParticle * negativeMC = (TParticle*)TrueGammaCandidate0->GetNegativeMCDaughter(MCStack);
2486 TParticle * positiveMC = (TParticle*)TrueGammaCandidate0->GetPositiveMCDaughter(MCStack);
2487 TParticle * gammaMC0 = (TParticle*)MCStack->Particle(gamma0MCLabel);
2488 if(abs(negativeMC->GetPdgCode())==11 && abs(positiveMC->GetPdgCode())==11){ // Electrons ...
2489 if(negativeMC->GetUniqueID() == 5 && positiveMC->GetUniqueID() ==5){ // ... From Conversion ...
2490 if(gammaMC0->GetPdgCode() == 22){ // ... with Gamma Mother
2491 gamma0MotherLabel=gammaMC0->GetFirstMother();
2492 }
8bdca7f1 2493 }
2494 }
fd94f234 2495 }
2496 if (!TrueGammaCandidate1->GetIsCaloPhoton()) AliFatal("CaloPhotonFlag has not been set. Aborting");
2497
2498 Int_t gamma1MCLabel = TrueGammaCandidate1->GetCaloPhotonMCLabel(0); // get most probable MC label
2499 Int_t gamma1MotherLabel = -1;
2500 // check if
2501
2502 if(gamma1MCLabel != -1){ // Gamma is Combinatorial; MC Particles don't belong to the same Mother
2503 // Daughters Gamma 1
2504 TParticle * gammaMC1 = (TParticle*)MCStack->Particle(gamma1MCLabel);
2505 if (TrueGammaCandidate1->IsLargestComponentPhoton() || TrueGammaCandidate1->IsLargestComponentElectron()){ // largest component is electro magnetic
2506 // get mother of interest (pi0 or eta)
2507 if (TrueGammaCandidate1->IsLargestComponentPhoton()){ // for photons its the direct mother
2508 gamma1MotherLabel=gammaMC1->GetMother(0);
2509 } else if (TrueGammaCandidate1->IsLargestComponentElectron()){ // for electrons its either the direct mother or for conversions the grandmother
2510 if (TrueGammaCandidate1->IsConversion()) gamma1MotherLabel=MCStack->Particle(gammaMC1->GetMother(0))->GetMother(0);
2511 else gamma1MotherLabel=gammaMC1->GetMother(0);
2512 }
2513 } else {
2514 if (fDoMesonQA > 0) fHistoTrueMotherCaloEMNonLeadingInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2515 }
2516 }
2517
2518 if(gamma0MotherLabel>=0 && gamma0MotherLabel==gamma1MotherLabel){
2519 if(((TParticle*)MCStack->Particle(gamma1MotherLabel))->GetPdgCode() == 111){
2520 isTruePi0=kTRUE;
8bdca7f1 2521 }
fd94f234 2522 if(((TParticle*)MCStack->Particle(gamma1MotherLabel))->GetPdgCode() == 221){
2523 isTrueEta=kTRUE;
8bdca7f1 2524 }
2525 }
fd94f234 2526
2527 if(isTruePi0 || isTrueEta){// True Pion or Eta
ed8bc1ca 2528 if (!matched){
2529 if (isTruePi0)fHistoTruePi0InvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2530 if (isTrueEta)fHistoTrueEtaInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2531 }
fd94f234 2532 if (fDoMesonQA > 0){
ed8bc1ca 2533 if (TrueGammaCandidate1->IsLargestComponentPhoton() && !matched){
2534 if(isTruePi0) fHistoTruePi0CaloPhotonInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2535 if(isTrueEta) fHistoTrueEtaCaloPhotonInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2536 }
2537 if (TrueGammaCandidate1->IsLargestComponentElectron() && !matched){
2538 if(isTruePi0) fHistoTruePi0CaloElectronInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2539 if(isTrueEta) fHistoTrueEtaCaloElectronInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2540 }
d53bf4ac 2541 if (TrueGammaCandidate1->IsLargestComponentElectron() && TrueGammaCandidate1->IsConversion() ){
d53bf4ac 2542 if (isTruePi0 && !matched)fHistoTruePi0CaloConvertedPhotonInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2543 if (isTrueEta && !matched)fHistoTrueEtaCaloConvertedPhotonInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2544 if ((TrueGammaCandidate0->GetMCLabelPositive() == gamma1MCLabel || TrueGammaCandidate0->GetMCLabelNegative() == gamma1MCLabel) && isTruePi0){
20af4b69 2545 fHistoTruePi0CaloConvertedPhotonMatchedInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
d53bf4ac 2546 }
2547 if ((TrueGammaCandidate0->GetMCLabelPositive() == gamma1MCLabel || TrueGammaCandidate0->GetMCLabelNegative() == gamma1MCLabel) && isTrueEta){
20af4b69 2548 fHistoTrueEtaCaloConvertedPhotonMatchedInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
d53bf4ac 2549 }
20af4b69 2550 }
ed8bc1ca 2551 if ((TrueGammaCandidate1->IsMerged() || TrueGammaCandidate1->IsMergedPartConv() || TrueGammaCandidate1->IsDalitzMerged()) && !matched ){
2552 if (isTruePi0 )fHistoTruePi0CaloMergedClusterInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2553 if (isTrueEta )fHistoTrueEtaCaloMergedClusterInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2554 }
2555 if (TrueGammaCandidate1->IsMergedPartConv() && !matched){
2556 if (isTruePi0) fHistoTruePi0CaloMergedClusterPartConvInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2557 if (isTrueEta) fHistoTrueEtaCaloMergedClusterPartConvInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2558 }
fd94f234 2559 }
d53bf4ac 2560 if (!matched){
2561 if (fDoMesonQA > 0){
2562 if (isTruePi0){
2563 if ( Pi0Candidate->M() > 0.05 && Pi0Candidate->M() < 0.17){
2564 fHistoTruePi0PtY[fiCut]->Fill(Pi0Candidate->Pt(),Pi0Candidate->Rapidity()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift());
2565 fHistoTruePi0PtAlpha[fiCut]->Fill(Pi0Candidate->Pt(),Pi0Candidate->GetAlpha());
2566 fHistoTruePi0PtOpenAngle[fiCut]->Fill(Pi0Candidate->Pt(),Pi0Candidate->GetOpeningAngle());
2567 }
2568 } else if (isTrueEta){
2569 if ( Pi0Candidate->M() > 0.45 && Pi0Candidate->M() < 0.65){
2570 fHistoTrueEtaPtY[fiCut]->Fill(Pi0Candidate->Pt(),Pi0Candidate->Rapidity()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift());
2571 fHistoTrueEtaPtAlpha[fiCut]->Fill(Pi0Candidate->Pt(),Pi0Candidate->GetAlpha());
2572 fHistoTrueEtaPtOpenAngle[fiCut]->Fill(Pi0Candidate->Pt(),Pi0Candidate->GetOpeningAngle());
2573 }
8bdca7f1 2574 }
2575 }
d53bf4ac 2576
2577 if(gamma0MotherLabel >= MCStack->GetNprimary()){ // Secondary Meson
2578 Int_t secMotherLabel = ((TParticle*)MCStack->Particle(gamma0MotherLabel))->GetMother(0);
2579 Float_t weightedSec= 1;
2580 if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(secMotherLabel, fMCStack, fInputEvent) && MCStack->Particle(secMotherLabel)->GetPdgCode()==310){
2581 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
2582 //cout << "MC input \t"<<i << "\t" << particle->Pt()<<"\t"<<weighted << endl;
8bdca7f1 2583 }
ed8bc1ca 2584 if (isTruePi0) fHistoTrueSecondaryPi0InvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weightedSec);
2585 if (isTrueEta) fHistoTrueSecondaryEtaInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weightedSec);
d53bf4ac 2586 fCharMesonMCInfo = 2;
2587 if (secMotherLabel >-1){
ed8bc1ca 2588 if(MCStack->Particle(secMotherLabel)->GetPdgCode()==310 && isTruePi0 ){
d53bf4ac 2589 fCharMesonMCInfo = 4;
ed8bc1ca 2590 fHistoTrueSecondaryPi0FromK0sInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weightedSec);
d53bf4ac 2591 if (fDoMesonQA > 0)fHistoTrueK0sWithPi0DaughterMCPt[fiCut]->Fill(MCStack->Particle(secMotherLabel)->Pt());
2592 }
ed8bc1ca 2593 if(MCStack->Particle(secMotherLabel)->GetPdgCode()==221 && isTruePi0){
d53bf4ac 2594 fCharMesonMCInfo = 3;
ed8bc1ca 2595 fHistoTrueSecondaryPi0FromEtaInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weightedSec);
d53bf4ac 2596 if (fDoMesonQA > 0)fHistoTrueEtaWithPi0DaughterMCPt[fiCut]->Fill(MCStack->Particle(secMotherLabel)->Pt());
2597 }
ed8bc1ca 2598 if(MCStack->Particle(secMotherLabel)->GetPdgCode()==3122 && isTruePi0){
d53bf4ac 2599 fCharMesonMCInfo = 7;
ed8bc1ca 2600 fHistoTrueSecondaryPi0FromLambdaInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weightedSec);
d53bf4ac 2601 if (fDoMesonQA > 0)fHistoTrueLambdaWithPi0DaughterMCPt[fiCut]->Fill(MCStack->Particle(secMotherLabel)->Pt());
2602 }
8bdca7f1 2603 }
d53bf4ac 2604 } else { // Only primary pi0 for efficiency calculation
2605 fCharMesonMCInfo = 6;
2606 Float_t weighted= 1;
2607 if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(gamma1MotherLabel, fMCStack, fInputEvent)){
2608 if (((TParticle*)MCStack->Particle(gamma1MotherLabel))->Pt()>0.005){
2609 weighted= ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetWeightForMeson(fV0Reader->GetPeriodName(),gamma1MotherLabel, fMCStack, fInputEvent);
2610 // cout << "rec \t " <<gamma1MotherLabel << "\t" << weighted << endl;
2611 }
fd94f234 2612 }
ed8bc1ca 2613 if (isTruePi0){
2614 fHistoTruePrimaryPi0InvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weighted);
2615 fHistoTruePrimaryPi0W0WeightingInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2616 fProfileTruePrimaryPi0WeightsInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weighted);
2617 } else if (isTrueEta) {
2618 fHistoTruePrimaryEtaInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weighted);
2619 fHistoTruePrimaryEtaW0WeightingInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2620 fProfileTruePrimaryEtaWeightsInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weighted);
2621 }
d53bf4ac 2622
2623 if (fDoMesonQA > 0){
2624 if(isTruePi0){ // Only primary pi0 for resolution
2625 fHistoTruePrimaryPi0MCPtResolPt[fiCut]->Fill(((TParticle*)MCStack->Particle(gamma1MotherLabel))->Pt(),(Pi0Candidate->Pt()-((TParticle*)MCStack->Particle(gamma1MotherLabel))->Pt())/((TParticle*)MCStack->Particle(gamma1MotherLabel))->Pt(),weighted);
2626 }
2627 if (isTrueEta){ // Only primary eta for resolution
2628 fHistoTruePrimaryEtaMCPtResolPt[fiCut]->Fill(((TParticle*)MCStack->Particle(gamma1MotherLabel))->Pt(),(Pi0Candidate->Pt()-((TParticle*)MCStack->Particle(gamma1MotherLabel))->Pt())/((TParticle*)MCStack->Particle(gamma1MotherLabel))->Pt(),weighted);
2629 }
8bdca7f1 2630 }
2631 }
d53bf4ac 2632 }
fd94f234 2633 } else if(!isTruePi0 && !isTrueEta){ // Background
2634 if (fDoMesonQA > 0){
2635 if(gamma0MotherLabel>-1 && gamma1MotherLabel>-1){ // Both Tracks are Photons and have a mother but not Pi0 or Eta
2636 fHistoTrueBckGGInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2637 fCharMesonMCInfo = 1;
2638 } else { // No photon or without mother
2639 fHistoTrueBckContInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
8bdca7f1 2640 }
2641 }
2642 }
2643 }
2644}
2645//______________________________________________________________________
d53bf4ac 2646void AliAnalysisTaskGammaConvCalo::ProcessTrueMesonCandidatesAOD(AliAODConversionMother *Pi0Candidate, AliAODConversionPhoton *TrueGammaCandidate0, AliAODConversionPhoton *TrueGammaCandidate1, Bool_t matched)
8bdca7f1 2647{
2648
2649 // Process True Mesons
2650 TClonesArray *AODMCTrackArray = dynamic_cast<TClonesArray*>(fInputEvent->FindListObject(AliAODMCParticle::StdBranchName()));
2651 Bool_t isTruePi0 = kFALSE;
2652 Bool_t isTrueEta = kFALSE;
8bdca7f1 2653
2654 AliAODMCParticle *positiveMC = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(TrueGammaCandidate0->GetMCLabelPositive()));
2655 AliAODMCParticle *negativeMC = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(TrueGammaCandidate0->GetMCLabelNegative()));
2656
2657 fCharMesonMCInfo = 0;
2658 Int_t gamma0MCLabel = -1;
2659 Int_t gamma0MotherLabel = -1;
2660 if(!positiveMC||!negativeMC)
2661 return;
2662
2663 if(positiveMC->GetMother()>-1&&(negativeMC->GetMother() == positiveMC->GetMother())){
2664 gamma0MCLabel = positiveMC->GetMother();
2665 }
2666
2667 if(gamma0MCLabel != -1){ // Gamma is Combinatorial; MC Particles don't belong to the same Mother
2668 // Daughters Gamma 0
2669 AliAODMCParticle * gammaMC0 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma0MCLabel));
2670 if(abs(negativeMC->GetPdgCode())==11 && abs(positiveMC->GetPdgCode())==11){ // Electrons ...
2671 if(((positiveMC->GetMCProcessCode())) == 5 && ((negativeMC->GetMCProcessCode())) == 5){ // ... From Conversion ...
2672 if(gammaMC0->GetPdgCode() == 22){ // ... with Gamma Mother
2673 gamma0MotherLabel=gammaMC0->GetMother();
2674 }
2675 }
8bdca7f1 2676 }
fd94f234 2677 }
2678
2679 Int_t gamma1MCLabel = TrueGammaCandidate1->GetCaloPhotonMCLabel(0); // get most probable MC label
8bdca7f1 2680 Int_t gamma1MotherLabel = -1;
fd94f234 2681 // check if
2682
8bdca7f1 2683 if(gamma1MCLabel != -1){ // Gamma is Combinatorial; MC Particles don't belong to the same Mother
2684 // Daughters Gamma 1
2685 AliAODMCParticle * gammaMC1 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma1MCLabel));
fd94f234 2686 if (TrueGammaCandidate1->IsLargestComponentPhoton() || TrueGammaCandidate1->IsLargestComponentElectron()){ // largest component is electro magnetic
2687 // get mother of interest (pi0 or eta)
2688 if (TrueGammaCandidate1->IsLargestComponentPhoton()){ // for photons its the direct mother
8bdca7f1 2689 gamma1MotherLabel=gammaMC1->GetMother();
fd94f234 2690 } else if (TrueGammaCandidate1->IsLargestComponentElectron()){ // for electrons its either the direct mother or for conversions the grandmother
2691 if (TrueGammaCandidate1->IsConversion()){
2692 AliAODMCParticle * gammaGrandMotherMC1 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gammaMC1->GetMother()));
2693 gamma1MotherLabel=gammaGrandMotherMC1->GetMother();
2694 } else gamma1MotherLabel=gammaMC1->GetMother();
8bdca7f1 2695 }
fd94f234 2696 } else {
2697 if (fDoMesonQA > 0) fHistoTrueMotherCaloEMNonLeadingInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2698 }
8bdca7f1 2699 }
fd94f234 2700
8bdca7f1 2701 if(gamma0MotherLabel>=0 && gamma0MotherLabel==gamma1MotherLabel){
fd94f234 2702 if(((AliAODMCParticle*)AODMCTrackArray->At(gamma1MotherLabel))->GetPdgCode() == 111){
8bdca7f1 2703 isTruePi0=kTRUE;
2704 }
fd94f234 2705 if(((AliAODMCParticle*)AODMCTrackArray->At(gamma1MotherLabel))->GetPdgCode() == 221){
8bdca7f1 2706 isTrueEta=kTRUE;
2707 }
2708 }
2709
8bdca7f1 2710 if(isTruePi0 || isTrueEta){// True Pion or Eta
ed8bc1ca 2711 if (!matched){
2712 if (isTruePi0)fHistoTruePi0InvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2713 if (isTrueEta)fHistoTrueEtaInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2714 }
8bdca7f1 2715 if (fDoMesonQA > 0){
ed8bc1ca 2716 if (TrueGammaCandidate1->IsLargestComponentPhoton() && !matched){
2717 if (isTruePi0) fHistoTruePi0CaloPhotonInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2718 if (isTrueEta) fHistoTrueEtaCaloPhotonInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2719 }
2720 if (TrueGammaCandidate1->IsLargestComponentElectron() && !matched) {
2721 if (isTruePi0) fHistoTruePi0CaloElectronInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2722 if (isTrueEta) fHistoTrueEtaCaloElectronInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2723 }
20af4b69 2724 if (TrueGammaCandidate1->IsLargestComponentElectron() && TrueGammaCandidate1->IsConversion()){
d53bf4ac 2725 if (isTruePi0 && !matched)fHistoTruePi0CaloConvertedPhotonInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2726 if (isTrueEta && !matched)fHistoTrueEtaCaloConvertedPhotonInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
20af4b69 2727 if ((TrueGammaCandidate0->GetMCLabelPositive() == gamma1MCLabel || TrueGammaCandidate0->GetMCLabelNegative() == gamma1MCLabel) && isTruePi0)
2728 fHistoTruePi0CaloConvertedPhotonMatchedInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2729 if ((TrueGammaCandidate0->GetMCLabelPositive() == gamma1MCLabel || TrueGammaCandidate0->GetMCLabelNegative() == gamma1MCLabel) && isTrueEta)
2730 fHistoTrueEtaCaloConvertedPhotonMatchedInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2731 }
ed8bc1ca 2732 if ((TrueGammaCandidate1->IsMerged() || TrueGammaCandidate1->IsMergedPartConv() || TrueGammaCandidate1->IsDalitzMerged()) && !matched ){
2733 if (isTruePi0) fHistoTruePi0CaloMergedClusterInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2734 if (isTrueEta) fHistoTrueEtaCaloMergedClusterInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2735 }
2736 if (TrueGammaCandidate1->IsMergedPartConv() && !matched) {
2737 if (isTruePi0) fHistoTruePi0CaloMergedClusterPartConvInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2738 if (isTrueEta) fHistoTrueEtaCaloMergedClusterPartConvInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2739 }
fd94f234 2740 }
2741
d53bf4ac 2742 if ( !matched){
2743 if (fDoMesonQA > 0){
2744 if (isTruePi0){
2745 if ( Pi0Candidate->M() > 0.05 && Pi0Candidate->M() < 0.17){
2746 fHistoTruePi0PtY[fiCut]->Fill(Pi0Candidate->Pt(),Pi0Candidate->Rapidity()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift());
2747 fHistoTruePi0PtAlpha[fiCut]->Fill(Pi0Candidate->Pt(),Pi0Candidate->GetAlpha());
2748 fHistoTruePi0PtOpenAngle[fiCut]->Fill(Pi0Candidate->Pt(),Pi0Candidate->GetOpeningAngle());
2749 }
2750 } else if (isTrueEta){
2751 if ( Pi0Candidate->M() > 0.45 && Pi0Candidate->M() < 0.65){
2752 fHistoTrueEtaPtY[fiCut]->Fill(Pi0Candidate->Pt(),Pi0Candidate->Rapidity()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift());
2753 fHistoTrueEtaPtAlpha[fiCut]->Fill(Pi0Candidate->Pt(),Pi0Candidate->GetAlpha());
2754 fHistoTrueEtaPtOpenAngle[fiCut]->Fill(Pi0Candidate->Pt(),Pi0Candidate->GetOpeningAngle());
2755 }
8bdca7f1 2756 }
2757 }
d53bf4ac 2758 if(!(static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma0MotherLabel))->IsPrimary())){ // Secondary Meson
2759 Int_t secMotherLabel = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma1MotherLabel))->GetMother();
2760 Float_t weightedSec= 1;
2761 if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(secMotherLabel, 0x0, fInputEvent) && static_cast<AliAODMCParticle*>(AODMCTrackArray->At(secMotherLabel))->GetPdgCode()==310){
2762 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
2763 //cout << "MC input \t"<<i << "\t" << particle->Pt()<<"\t"<<weighted << endl;
8bdca7f1 2764 }
ed8bc1ca 2765 if (isTruePi0) fHistoTrueSecondaryPi0InvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weightedSec);
2766 if (isTrueEta) fHistoTrueSecondaryEtaInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weightedSec);
2767
d53bf4ac 2768 fCharMesonMCInfo = 2;
2769 if (secMotherLabel >-1){
ed8bc1ca 2770 if(static_cast<AliAODMCParticle*>(AODMCTrackArray->At(secMotherLabel))->GetPdgCode()==310 && isTruePi0){
d53bf4ac 2771 fCharMesonMCInfo = 4;
ed8bc1ca 2772 fHistoTrueSecondaryPi0FromK0sInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weightedSec);
d53bf4ac 2773 if (fDoMesonQA > 0)fHistoTrueK0sWithPi0DaughterMCPt[fiCut]->Fill(static_cast<AliAODMCParticle*>(AODMCTrackArray->At(secMotherLabel))->Pt());
2774 }
ed8bc1ca 2775 if(static_cast<AliAODMCParticle*>(AODMCTrackArray->At(secMotherLabel))->GetPdgCode()==221 && isTruePi0){
d53bf4ac 2776 fCharMesonMCInfo = 3;
ed8bc1ca 2777 fHistoTrueSecondaryPi0FromEtaInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weightedSec);
d53bf4ac 2778 if (fDoMesonQA > 0)fHistoTrueEtaWithPi0DaughterMCPt[fiCut]->Fill(static_cast<AliAODMCParticle*>(AODMCTrackArray->At(secMotherLabel))->Pt());
2779 }
ed8bc1ca 2780 if(static_cast<AliAODMCParticle*>(AODMCTrackArray->At(secMotherLabel))->GetPdgCode()==3122 && isTruePi0){
d53bf4ac 2781 fCharMesonMCInfo = 7;
ed8bc1ca 2782 fHistoTrueSecondaryPi0FromLambdaInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weightedSec);
d53bf4ac 2783 if (fDoMesonQA > 0)fHistoTrueLambdaWithPi0DaughterMCPt[fiCut]->Fill(static_cast<AliAODMCParticle*>(AODMCTrackArray->At(secMotherLabel))->Pt());
2784 }
8bdca7f1 2785 }
d53bf4ac 2786 } else{ // Only primary pi0 for efficiency calculation
2787 Float_t weighted= 1;
2788 fCharMesonMCInfo = 6;
2789 if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(gamma1MotherLabel, 0x0, fInputEvent)){
2790 if (static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma1MotherLabel))->Pt()>0.005){
2791 weighted= ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetWeightForMeson(fV0Reader->GetPeriodName(),gamma1MotherLabel, 0x0, fInputEvent);
2792 // cout << "rec \t " <<gamma1MotherLabel << "\t" << weighted << endl;
2793 }
8bdca7f1 2794 }
ed8bc1ca 2795 if (isTruePi0){
2796 fHistoTruePrimaryPi0InvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weighted);
2797 fHistoTruePrimaryPi0W0WeightingInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2798 fProfileTruePrimaryPi0WeightsInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weighted);
2799 } else if (isTrueEta){
2800 fHistoTruePrimaryEtaInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weighted);
2801 fHistoTruePrimaryEtaW0WeightingInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2802 fProfileTruePrimaryEtaWeightsInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weighted);
2803 }
d53bf4ac 2804 if (fDoMesonQA > 0){
2805 if(isTruePi0){ // Only primary pi0 for resolution
2806 fHistoTruePrimaryPi0MCPtResolPt[fiCut]->Fill(static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma1MotherLabel))->Pt(),
2807 (Pi0Candidate->Pt()-static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma1MotherLabel))->Pt())/static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma1MotherLabel))->Pt(),weighted);
2808
2809 }
2810 if (isTrueEta){ // Only primary eta for resolution
2811 fHistoTruePrimaryEtaMCPtResolPt[fiCut]->Fill(static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma1MotherLabel))->Pt(),
2812 (Pi0Candidate->Pt()-static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma1MotherLabel))->Pt())/static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma1MotherLabel))->Pt(),weighted);
2813 }
8bdca7f1 2814 }
2815 }
d53bf4ac 2816 }
8bdca7f1 2817 } else if(!isTruePi0 && !isTrueEta) { // Background
2818 if (fDoMesonQA > 0){
2819 if(gamma0MotherLabel>-1 && gamma1MotherLabel>-1){ // Both Tracks are Photons and have a mother but not Pi0 or Eta
2820 fHistoTrueBckGGInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2821 fCharMesonMCInfo = 1;
2822 } else { // No photon or without mother
2823 fHistoTrueBckContInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2824 }
2825 }
8bdca7f1 2826 }
2827}
344100c4 2828
8bdca7f1 2829//________________________________________________________________________
2830void AliAnalysisTaskGammaConvCalo::CalculateBackground(){
2831
2832 Int_t zbin= fBGClusHandler[fiCut]->GetZBinIndex(fInputEvent->GetPrimaryVertex()->GetZ());
2833 Int_t mbin = 0;
2834
2835 if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->UseTrackMultiplicity()){
2836 mbin = fBGClusHandler[fiCut]->GetMultiplicityBinIndex(fV0Reader->GetNumberOfPrimaryTracks());
2837 } else {
2838 mbin = fBGClusHandler[fiCut]->GetMultiplicityBinIndex(fGammaCandidates->GetEntries());
2839 }
2840
2841 AliGammaConversionAODBGHandler::GammaConversionVertex *bgEventVertex = NULL;
2842 if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->UseTrackMultiplicity()){
2843 for(Int_t nEventsInBG=0;nEventsInBG<fBGClusHandler[fiCut]->GetNBGEvents();nEventsInBG++){
2844 AliGammaConversionAODVector *previousEventV0s = fBGClusHandler[fiCut]->GetBGGoodV0s(zbin,mbin,nEventsInBG);
2845 if(fMoveParticleAccordingToVertex == kTRUE){
2846 bgEventVertex = fBGClusHandler[fiCut]->GetBGEventVertex(zbin,mbin,nEventsInBG);
2847 }
2848
2849 for(Int_t iCurrent=0;iCurrent<fGammaCandidates->GetEntries();iCurrent++){
2850 AliAODConversionPhoton currentEventGoodV0 = *(AliAODConversionPhoton*)(fGammaCandidates->At(iCurrent));
2851 for(UInt_t iPrevious=0;iPrevious<previousEventV0s->size();iPrevious++){
2852 AliAODConversionPhoton previousGoodV0 = (AliAODConversionPhoton)(*(previousEventV0s->at(iPrevious)));
2853 if(fMoveParticleAccordingToVertex == kTRUE){
2854 MoveParticleAccordingToVertex(&previousGoodV0,bgEventVertex);
2855 }
344100c4 2856 if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->GetInPlaneOutOfPlaneCut() != 0){
8bdca7f1 2857 RotateParticleAccordingToEP(&previousGoodV0,bgEventVertex->fEP,fEventPlaneAngle);
2858 }
2859
2860 AliAODConversionMother *backgroundCandidate = new AliAODConversionMother(&currentEventGoodV0,&previousGoodV0);
2861 backgroundCandidate->CalculateDistanceOfClossetApproachToPrimVtx(fInputEvent->GetPrimaryVertex());
2862 if((((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))
344100c4 2863 ->MesonIsSelected(backgroundCandidate,kFALSE,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift()))){
8bdca7f1 2864 fHistoMotherBackInvMassPt[fiCut]->Fill(backgroundCandidate->M(),backgroundCandidate->Pt());
2865 Double_t sparesFill[4] = {backgroundCandidate->M(),backgroundCandidate->Pt(),(Double_t)zbin,(Double_t)mbin};
2866 fSparseMotherBackInvMassPtZM[fiCut]->Fill(sparesFill,1);
2867 }
2868 delete backgroundCandidate;
2869 backgroundCandidate = 0x0;
2870 }
2871 }
2872 }
2873 } else {
2874 for(Int_t nEventsInBG=0;nEventsInBG <fBGClusHandler[fiCut]->GetNBGEvents();nEventsInBG++){
2875 AliGammaConversionAODVector *previousEventV0s = fBGClusHandler[fiCut]->GetBGGoodV0s(zbin,mbin,nEventsInBG);
2876 if(previousEventV0s){
2877 if(fMoveParticleAccordingToVertex == kTRUE){
2878 bgEventVertex = fBGClusHandler[fiCut]->GetBGEventVertex(zbin,mbin,nEventsInBG);
2879 }
2880 for(Int_t iCurrent=0;iCurrent<fGammaCandidates->GetEntries();iCurrent++){
2881 AliAODConversionPhoton currentEventGoodV0 = *(AliAODConversionPhoton*)(fGammaCandidates->At(iCurrent));
2882 for(UInt_t iPrevious=0;iPrevious<previousEventV0s->size();iPrevious++){
2883
2884 AliAODConversionPhoton previousGoodV0 = (AliAODConversionPhoton)(*(previousEventV0s->at(iPrevious)));
2885
2886 if(fMoveParticleAccordingToVertex == kTRUE){
2887 MoveParticleAccordingToVertex(&previousGoodV0,bgEventVertex);
2888 }
344100c4 2889 if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->GetInPlaneOutOfPlaneCut() != 0){
8bdca7f1 2890 RotateParticleAccordingToEP(&previousGoodV0,bgEventVertex->fEP,fEventPlaneAngle);
2891 }
2892
8bdca7f1 2893 AliAODConversionMother *backgroundCandidate = new AliAODConversionMother(&currentEventGoodV0,&previousGoodV0);
2894 backgroundCandidate->CalculateDistanceOfClossetApproachToPrimVtx(fInputEvent->GetPrimaryVertex());
344100c4 2895 if((((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->MesonIsSelected(backgroundCandidate,kFALSE,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift()))){
8bdca7f1 2896 fHistoMotherBackInvMassPt[fiCut]->Fill(backgroundCandidate->M(),backgroundCandidate->Pt());
2897 Double_t sparesFill[4] = {backgroundCandidate->M(),backgroundCandidate->Pt(),(Double_t)zbin,(Double_t)mbin};
2898 fSparseMotherBackInvMassPtZM[fiCut]->Fill(sparesFill,1);
2899 }
2900 delete backgroundCandidate;
2901 backgroundCandidate = 0x0;
2902 }
2903 }
2904 }
2905 }
2906 }
2907}
2908
2909//________________________________________________________________________
2910void AliAnalysisTaskGammaConvCalo::CalculateBackgroundRP(){
2911
2912 Int_t zbin= fBGHandlerRP[fiCut]->GetZBinIndex(fInputEvent->GetPrimaryVertex()->GetZ());
2913 Int_t mbin = 0;
2914 if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->UseTrackMultiplicity()){
2915 mbin = fBGHandlerRP[fiCut]->GetMultiplicityBinIndex(fV0Reader->GetNumberOfPrimaryTracks());
2916 } else {
2917 mbin = fBGHandlerRP[fiCut]->GetMultiplicityBinIndex(fGammaCandidates->GetEntries());
2918 }
2919
2920
2921 //Rotation Method
2922 if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->UseRotationMethod()){
2923 // Correct for the number of rotations
2924 // BG is for rotation the same, except for factor NRotations
2925 Double_t weight=1./Double_t(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->GetNumberOfBGEvents());
2926
2927 for(Int_t firstGammaIndex=0;firstGammaIndex<fGammaCandidates->GetEntries();firstGammaIndex++){
2928
2929 AliAODConversionPhoton *gamma0=dynamic_cast<AliAODConversionPhoton*>(fGammaCandidates->At(firstGammaIndex));
2930 if (gamma0==NULL) continue;
2931 for(Int_t secondGammaIndex=firstGammaIndex+1;secondGammaIndex<fGammaCandidates->GetEntries();secondGammaIndex++){
2932 AliAODConversionPhoton *gamma1=dynamic_cast<AliAODConversionPhoton*>(fGammaCandidates->At(secondGammaIndex));
2933 if (gamma1 == NULL) continue;
344100c4 2934 if(!((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelected(gamma1,fInputEvent))continue;
8bdca7f1 2935 for(Int_t nRandom=0;nRandom<((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->GetNumberOfBGEvents();nRandom++){
2936
2937 RotateParticle(gamma1);
2938 AliAODConversionMother backgroundCandidate(gamma0,gamma1);
2939 backgroundCandidate.CalculateDistanceOfClossetApproachToPrimVtx(fInputEvent->GetPrimaryVertex());
2940 if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))
344100c4 2941 ->MesonIsSelected(&backgroundCandidate,kFALSE,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift())){
8bdca7f1 2942 fHistoMotherBackInvMassPt[fiCut]->Fill(backgroundCandidate.M(),backgroundCandidate.Pt());
2943 Double_t sparesFill[4] = {backgroundCandidate.M(),backgroundCandidate.Pt(),(Double_t)zbin,(Double_t)mbin};
2944 fSparseMotherBackInvMassPtZM[fiCut]->Fill(sparesFill,weight);
2945 }
2946 }