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