1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: Baldo Sahlmueller, Friederike Bock *
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 **************************************************************************/
17 //////////////////////////////////////////////////////////////////
18 //----------------------------------------------------------------
19 // Class used to do analysis on conversion photons + calo photons
20 //----------------------------------------------------------------
21 //////////////////////////////////////////////////////////////////
29 #include "THnSparse.h"
32 #include "AliAnalysisTask.h"
33 #include "AliAnalysisManager.h"
34 #include "AliESDEvent.h"
35 #include "AliESDInputHandler.h"
36 #include "AliMCEventHandler.h"
37 #include "AliMCEvent.h"
38 #include "AliMCParticle.h"
39 #include "AliCentrality.h"
40 #include "AliESDVZERO.h"
41 #include "AliESDpid.h"
42 #include "AliAnalysisTaskGammaCalo.h"
43 #include "AliVParticle.h"
44 #include "AliESDtrack.h"
45 #include "AliESDtrackCuts.h"
46 #include "AliKFVertex.h"
47 #include "AliV0ReaderV1.h"
48 #include "AliGenCocktailEventHeader.h"
49 #include "AliAODMCParticle.h"
50 #include "AliAODMCHeader.h"
51 #include "AliEventplane.h"
52 #include "AliAnalysisTaskEMCALClusterizeFast.h"
53 #include "AliAODEvent.h"
54 #include "AliAODInputHandler.h"
55 #include "AliESDEvent.h"
56 #include "AliESDInputHandler.h"
57 #include "AliInputEventHandler.h"
59 ClassImp(AliAnalysisTaskGammaCalo)
61 //________________________________________________________________________
62 AliAnalysisTaskGammaCalo::AliAnalysisTaskGammaCalo(): AliAnalysisTaskSE(),
74 fHeaderNameList(NULL),
75 fOutputContainer(NULL),
76 fClusterCandidates(NULL),
79 fClusterCutArray(NULL),
80 fCaloPhotonCuts(NULL),
83 fHistoMotherInvMassPt(NULL),
84 fHistoMotherInvMass3ClusterPt(NULL),
85 fSparseMotherInvMassPtZM(NULL),
86 fHistoMotherBackInvMassPt(NULL),
87 fSparseMotherBackInvMassPtZM(NULL),
88 fHistoMotherInvMassEalpha(NULL),
89 fHistoMotherPi0PtY(NULL),
90 fHistoMotherEtaPtY(NULL),
91 fHistoMotherPi0PtAlpha(NULL),
92 fHistoMotherEtaPtAlpha(NULL),
93 fHistoMotherPi0PtOpenAngle(NULL),
94 fHistoMotherEtaPtOpenAngle(NULL),
95 fHistoMotherInvMassECalib(NULL),
96 fHistoMotherInvMassECalibalpha(NULL),
97 fHistoClusGammaPt(NULL),
98 fHistoMCHeaders(NULL),
99 fHistoMCAllGammaPt(NULL),
100 fHistoMCDecayGammaPi0Pt(NULL),
101 fHistoMCDecayGammaRhoPt(NULL),
102 fHistoMCDecayGammaEtaPt(NULL),
103 fHistoMCDecayGammaOmegaPt(NULL),
104 fHistoMCDecayGammaEtapPt(NULL),
105 fHistoMCDecayGammaPhiPt(NULL),
106 fHistoMCDecayGammaSigmaPt(NULL),
108 fHistoMCPi0WOWeightPt(NULL),
110 fHistoMCEtaWOWeightPt(NULL),
111 fHistoMCPi0InAccPt(NULL),
112 fHistoMCEtaInAccPt(NULL),
113 fHistoMCPi0PtY(NULL),
114 fHistoMCEtaPtY(NULL),
116 fHistoMCK0sWOWeightPt(NULL),
117 fHistoMCK0sPtY(NULL),
118 fHistoMCSecPi0PtvsSource(NULL),
119 fHistoMCSecPi0Source(NULL),
120 fHistoMCSecEtaPt(NULL),
121 fHistoMCSecEtaSource(NULL),
122 fHistoTrueMotherInvMassPt(NULL),
123 fHistoTrueMotherCaloPhotonInvMassPt(NULL),
124 fHistoTrueMotherCaloConvertedPhotonInvMassPt(NULL),
125 fHistoTrueMotherCaloMixedPhotonConvPhotonInvMassPt(NULL),
126 fHistoTruePi0CaloConvertedPhotonInvMassPt(NULL),
127 fHistoTrueEtaCaloConvertedPhotonInvMassPt(NULL),
128 fHistoTrueMotherCaloElectronInvMassPt(NULL),
129 fHistoTrueMotherCaloMergedClusterInvMassPt(NULL),
130 fHistoTrueMotherCaloMergedClusterPartConvInvMassPt(NULL),
131 fHistoTruePrimaryMotherInvMassPt(NULL),
132 fHistoTruePrimaryMotherW0WeightingInvMassPt(NULL),
133 fProfileTruePrimaryMotherWeightsInvMassPt(NULL),
134 fHistoTruePrimaryPi0MCPtResolPt(NULL),
135 fHistoTruePrimaryEtaMCPtResolPt(NULL),
136 fHistoTrueSecondaryMotherInvMassPt(NULL),
137 fHistoTrueSecondaryMotherFromK0sInvMassPt(NULL),
138 fHistoTrueK0sWithPi0DaughterMCPt(NULL),
139 fHistoTrueSecondaryMotherFromEtaInvMassPt(NULL),
140 fHistoTrueEtaWithPi0DaughterMCPt(NULL),
141 fHistoTrueSecondaryMotherFromLambdaInvMassPt(NULL),
142 fHistoTrueLambdaWithPi0DaughterMCPt(NULL),
143 fHistoTrueBckGGInvMassPt(NULL),
144 fHistoTrueBckContInvMassPt(NULL),
145 fHistoTruePi0PtY(NULL),
146 fHistoTrueEtaPtY(NULL),
147 fHistoTruePi0PtAlpha(NULL),
148 fHistoTrueEtaPtAlpha(NULL),
149 fHistoTruePi0PtOpenAngle(NULL),
150 fHistoTrueEtaPtOpenAngle(NULL),
151 fHistoClusPhotonBGPt(NULL),
152 fHistoClusPhotonPlusConvBGPt(NULL),
153 fHistoTrueClusGammaPt(NULL),
154 fHistoTrueClusUnConvGammaPt(NULL),
155 fHistoTrueClusUnConvGammaMCPt(NULL),
156 fHistoTrueClusElectronPt(NULL),
157 fHistoTrueClusConvGammaPt(NULL),
158 fHistoTrueClusConvGammaMCPt(NULL),
159 fHistoTrueClusConvGammaFullyPt(NULL),
160 fHistoTrueClusMergedGammaPt(NULL),
161 fHistoTrueClusMergedPartConvGammaPt(NULL),
162 fHistoTrueClusDalitzPt(NULL),
163 fHistoTrueClusDalitzMergedPt(NULL),
164 fHistoTrueClusPhotonFromElecMotherPt(NULL),
165 fHistoTrueClusShowerPt(NULL),
166 fHistoTrueClusSubLeadingPt(NULL),
167 fHistoTrueClusNParticles(NULL),
168 fHistoTrueClusEMNonLeadingPt(NULL),
169 fHistoTrueNLabelsInClus(NULL),
170 fHistoTruePrimaryClusGammaPt(NULL),
171 fHistoTruePrimaryClusGammaESDPtMCPt(NULL),
172 fHistoTruePrimaryClusConvGammaPt(NULL),
173 fHistoTruePrimaryClusConvGammaESDPtMCPt(NULL),
174 fHistoTrueSecondaryClusGammaPt(NULL),
175 fHistoTrueSecondaryClusConvGammaPt(NULL),
176 fHistoTrueSecondaryClusGammaFromXFromK0sPt(NULL),
177 fHistoTrueSecondaryClusConvGammaFromXFromK0sPt(NULL),
178 fHistoTrueSecondaryClusGammaFromXFromLambdaPt(NULL),
179 fHistoTrueSecondaryClusConvGammaFromXFromLambdaPt(NULL),
180 fHistoTrueSecondaryClusGammaFromXFromEtasPt(NULL),
181 fHistoTrueSecondaryClusConvGammaFromXFromEtasPt(NULL),
183 fHistoNGoodESDTracks(NULL),
184 fHistoNGammaCandidates(NULL),
185 fHistoNGoodESDTracksVsNGammaCanditates(NULL),
186 fHistoNV0Tracks(NULL),
187 fProfileEtaShift(NULL),
188 fEventPlaneAngle(-100),
193 fDoMesonAnalysis(kTRUE),
196 fIsFromMBHeader(kTRUE),
202 //________________________________________________________________________
203 AliAnalysisTaskGammaCalo::AliAnalysisTaskGammaCalo(const char *name):
204 AliAnalysisTaskSE(name),
216 fHeaderNameList(NULL),
218 fClusterCandidates(NULL),
219 fEventCutArray(NULL),
221 fClusterCutArray(NULL),
222 fCaloPhotonCuts(NULL),
223 fMesonCutArray(NULL),
225 fHistoMotherInvMassPt(NULL),
226 fHistoMotherInvMass3ClusterPt(NULL),
227 fSparseMotherInvMassPtZM(NULL),
228 fHistoMotherBackInvMassPt(NULL),
229 fSparseMotherBackInvMassPtZM(NULL),
230 fHistoMotherInvMassEalpha(NULL),
231 fHistoMotherPi0PtY(NULL),
232 fHistoMotherEtaPtY(NULL),
233 fHistoMotherPi0PtAlpha(NULL),
234 fHistoMotherEtaPtAlpha(NULL),
235 fHistoMotherPi0PtOpenAngle(NULL),
236 fHistoMotherEtaPtOpenAngle(NULL),
237 fHistoMotherInvMassECalib(NULL),
238 fHistoMotherInvMassECalibalpha(NULL),
239 fHistoClusGammaPt(NULL),
240 fHistoMCHeaders(NULL),
241 fHistoMCAllGammaPt(NULL),
242 fHistoMCDecayGammaPi0Pt(NULL),
243 fHistoMCDecayGammaRhoPt(NULL),
244 fHistoMCDecayGammaEtaPt(NULL),
245 fHistoMCDecayGammaOmegaPt(NULL),
246 fHistoMCDecayGammaEtapPt(NULL),
247 fHistoMCDecayGammaPhiPt(NULL),
248 fHistoMCDecayGammaSigmaPt(NULL),
250 fHistoMCPi0WOWeightPt(NULL),
252 fHistoMCEtaWOWeightPt(NULL),
253 fHistoMCPi0InAccPt(NULL),
254 fHistoMCEtaInAccPt(NULL),
255 fHistoMCPi0PtY(NULL),
256 fHistoMCEtaPtY(NULL),
258 fHistoMCK0sWOWeightPt(NULL),
259 fHistoMCK0sPtY(NULL),
260 fHistoMCSecPi0PtvsSource(NULL),
261 fHistoMCSecPi0Source(NULL),
262 fHistoMCSecEtaPt(NULL),
263 fHistoMCSecEtaSource(NULL),
264 fHistoTrueMotherInvMassPt(NULL),
265 fHistoTrueMotherCaloPhotonInvMassPt(NULL),
266 fHistoTrueMotherCaloConvertedPhotonInvMassPt(NULL),
267 fHistoTrueMotherCaloMixedPhotonConvPhotonInvMassPt(NULL),
268 fHistoTruePi0CaloConvertedPhotonInvMassPt(NULL),
269 fHistoTrueEtaCaloConvertedPhotonInvMassPt(NULL),
270 fHistoTrueMotherCaloElectronInvMassPt(NULL),
271 fHistoTrueMotherCaloMergedClusterInvMassPt(NULL),
272 fHistoTrueMotherCaloMergedClusterPartConvInvMassPt(NULL),
273 fHistoTruePrimaryMotherInvMassPt(NULL),
274 fHistoTruePrimaryMotherW0WeightingInvMassPt(NULL),
275 fProfileTruePrimaryMotherWeightsInvMassPt(NULL),
276 fHistoTruePrimaryPi0MCPtResolPt(NULL),
277 fHistoTruePrimaryEtaMCPtResolPt(NULL),
278 fHistoTrueSecondaryMotherInvMassPt(NULL),
279 fHistoTrueSecondaryMotherFromK0sInvMassPt(NULL),
280 fHistoTrueK0sWithPi0DaughterMCPt(NULL),
281 fHistoTrueSecondaryMotherFromEtaInvMassPt(NULL),
282 fHistoTrueEtaWithPi0DaughterMCPt(NULL),
283 fHistoTrueSecondaryMotherFromLambdaInvMassPt(NULL),
284 fHistoTrueLambdaWithPi0DaughterMCPt(NULL),
285 fHistoTrueBckGGInvMassPt(NULL),
286 fHistoTrueBckContInvMassPt(NULL),
287 fHistoTruePi0PtY(NULL),
288 fHistoTrueEtaPtY(NULL),
289 fHistoTruePi0PtAlpha(NULL),
290 fHistoTrueEtaPtAlpha(NULL),
291 fHistoTruePi0PtOpenAngle(NULL),
292 fHistoTrueEtaPtOpenAngle(NULL),
293 fHistoClusPhotonBGPt(NULL),
294 fHistoClusPhotonPlusConvBGPt(NULL),
295 fHistoTrueClusGammaPt(NULL),
296 fHistoTrueClusUnConvGammaPt(NULL),
297 fHistoTrueClusUnConvGammaMCPt(NULL),
298 fHistoTrueClusElectronPt(NULL),
299 fHistoTrueClusConvGammaPt(NULL),
300 fHistoTrueClusConvGammaMCPt(NULL),
301 fHistoTrueClusConvGammaFullyPt(NULL),
302 fHistoTrueClusMergedGammaPt(NULL),
303 fHistoTrueClusMergedPartConvGammaPt(NULL),
304 fHistoTrueClusDalitzPt(NULL),
305 fHistoTrueClusDalitzMergedPt(NULL),
306 fHistoTrueClusPhotonFromElecMotherPt(NULL),
307 fHistoTrueClusShowerPt(NULL),
308 fHistoTrueClusSubLeadingPt(NULL),
309 fHistoTrueClusNParticles(NULL),
310 fHistoTrueClusEMNonLeadingPt(NULL),
311 fHistoTrueNLabelsInClus(NULL),
312 fHistoTruePrimaryClusGammaPt(NULL),
313 fHistoTruePrimaryClusGammaESDPtMCPt(NULL),
314 fHistoTruePrimaryClusConvGammaPt(NULL),
315 fHistoTruePrimaryClusConvGammaESDPtMCPt(NULL),
316 fHistoTrueSecondaryClusGammaPt(NULL),
317 fHistoTrueSecondaryClusConvGammaPt(NULL),
318 fHistoTrueSecondaryClusGammaFromXFromK0sPt(NULL),
319 fHistoTrueSecondaryClusConvGammaFromXFromK0sPt(NULL),
320 fHistoTrueSecondaryClusGammaFromXFromLambdaPt(NULL),
321 fHistoTrueSecondaryClusConvGammaFromXFromLambdaPt(NULL),
322 fHistoTrueSecondaryClusGammaFromXFromEtasPt(NULL),
323 fHistoTrueSecondaryClusConvGammaFromXFromEtasPt(NULL),
325 fHistoNGoodESDTracks(NULL),
326 fHistoNGammaCandidates(NULL),
327 fHistoNGoodESDTracksVsNGammaCanditates(NULL),
328 fHistoNV0Tracks(NULL),
329 fProfileEtaShift(NULL),
330 fEventPlaneAngle(-100),
335 fDoMesonAnalysis(kTRUE),
338 fIsFromMBHeader(kTRUE),
341 // Define output slots here
342 DefineOutput(1, TList::Class());
345 AliAnalysisTaskGammaCalo::~AliAnalysisTaskGammaCalo()
347 if(fClusterCandidates){
348 delete fClusterCandidates;
349 fClusterCandidates = 0x0;
356 //___________________________________________________________
357 void AliAnalysisTaskGammaCalo::InitBack(){
359 const Int_t nDim = 4;
360 Int_t nBins[nDim] = {800,250,7,4};
361 Double_t xMin[nDim] = {0,0, 0,0};
362 Double_t xMax[nDim] = {0.8,25,7,4};
364 fSparseMotherInvMassPtZM = new THnSparseF*[fnCuts];
365 fSparseMotherBackInvMassPtZM = new THnSparseF*[fnCuts];
367 fBGHandler = new AliGammaConversionAODBGHandler*[fnCuts];
370 for(Int_t iCut = 0; iCut<fnCuts;iCut++){
371 if (((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->DoBGCalculation()){
372 TString cutstringEvent = ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber();
373 TString cutstringCalo = ((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetCutNumber();
374 TString cutstringMeson = ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutNumber();
376 Int_t collisionSystem = atoi((TString)(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber())(0,1));
377 Int_t centMin = atoi((TString)(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber())(1,1));
378 Int_t centMax = atoi((TString)(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber())(2,1));
380 if(collisionSystem == 1 || collisionSystem == 2 ||
381 collisionSystem == 5 || collisionSystem == 8 ||
382 collisionSystem == 9){
383 centMin = centMin*10;
384 centMax = centMax*10;
385 if(centMax ==0 && centMax!=centMin) centMax=100;
386 } else if(collisionSystem == 3 || collisionSystem == 6){
389 } else if(collisionSystem == 4 || collisionSystem == 7){
390 centMin = ((centMin*5)+45);
391 centMax = ((centMax*5)+45);
394 fBackList[iCut] = new TList();
395 fBackList[iCut]->SetName(Form("%s_%s_%s Back histograms",cutstringEvent.Data(),cutstringCalo.Data(), cutstringMeson.Data()));
396 fBackList[iCut]->SetOwner(kTRUE);
397 fCutFolder[iCut]->Add(fBackList[iCut]);
399 fSparseMotherBackInvMassPtZM[iCut] = new THnSparseF("Back_Back_InvMass_Pt_z_m","Back_Back_InvMass_Pt_z_m",nDim,nBins,xMin,xMax);
400 fBackList[iCut]->Add(fSparseMotherBackInvMassPtZM[iCut]);
402 fMotherList[iCut] = new TList();
403 fMotherList[iCut]->SetName(Form("%s_%s_%s Mother histograms",cutstringEvent.Data(),cutstringCalo.Data(),cutstringMeson.Data()));
404 fMotherList[iCut]->SetOwner(kTRUE);
405 fCutFolder[iCut]->Add(fMotherList[iCut]);
407 fSparseMotherInvMassPtZM[iCut] = new THnSparseF("Back_Mother_InvMass_Pt_z_m","Back_Mother_InvMass_Pt_z_m",nDim,nBins,xMin,xMax);
408 fMotherList[iCut]->Add(fSparseMotherInvMassPtZM[iCut]);
410 if(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->BackgroundHandlerType() == 0){
411 fBGHandler[iCut] = new AliGammaConversionAODBGHandler(
412 collisionSystem,centMin,centMax,
413 ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetNumberOfBGEvents(),
414 ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->UseTrackMultiplicity());
419 //________________________________________________________________________
420 void AliAnalysisTaskGammaCalo::UserCreateOutputObjects(){
423 if(fOutputContainer != NULL){
424 delete fOutputContainer;
425 fOutputContainer = NULL;
427 if(fOutputContainer == NULL){
428 fOutputContainer = new TList();
429 fOutputContainer->SetOwner(kTRUE);
432 // Array of current cut's gammas
433 fClusterCandidates = new TList();
435 fCutFolder = new TList*[fnCuts];
436 fESDList = new TList*[fnCuts];
437 fBackList = new TList*[fnCuts];
438 fMotherList = new TList*[fnCuts];
439 fHistoNEvents = new TH1I*[fnCuts];
440 fHistoNGoodESDTracks = new TH1I*[fnCuts];
441 fHistoNGammaCandidates = new TH1I*[fnCuts];
442 fHistoNGoodESDTracksVsNGammaCanditates = new TH2F*[fnCuts];
443 fHistoNV0Tracks = new TH1I*[fnCuts];
444 fProfileEtaShift = new TProfile*[fnCuts];
446 if(fDoMesonAnalysis){
447 fHistoMotherInvMassPt = new TH2F*[fnCuts];
448 fHistoMotherInvMass3ClusterPt = new TH2F*[fnCuts];
449 fHistoMotherBackInvMassPt = new TH2F*[fnCuts];
450 fHistoMotherInvMassEalpha = new TH2F*[fnCuts];
452 fHistoMotherPi0PtY = new TH2F*[fnCuts];
453 fHistoMotherEtaPtY = new TH2F*[fnCuts];
454 fHistoMotherPi0PtAlpha = new TH2F*[fnCuts];
455 fHistoMotherEtaPtAlpha = new TH2F*[fnCuts];
456 fHistoMotherPi0PtOpenAngle = new TH2F*[fnCuts];
457 fHistoMotherEtaPtOpenAngle = new TH2F*[fnCuts];
460 fHistoMotherInvMassECalib = new TH2F*[fnCuts];
461 fHistoMotherInvMassECalibalpha = new TH2F*[fnCuts];
465 fHistoClusGammaPt = new TH1F*[fnCuts];
467 for(Int_t iCut = 0; iCut<fnCuts;iCut++){
468 TString cutstringEvent = ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber();
469 TString cutstringCalo = ((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetCutNumber();
470 TString cutstringMeson = "NoMesonCut";
471 if(fDoMesonAnalysis)cutstringMeson = ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutNumber();
473 fCutFolder[iCut] = new TList();
474 fCutFolder[iCut]->SetName(Form("Cut Number %s_%s_%s",cutstringEvent.Data(),cutstringCalo.Data(),cutstringMeson.Data()));
475 fCutFolder[iCut]->SetOwner(kTRUE);
476 fOutputContainer->Add(fCutFolder[iCut]);
477 fESDList[iCut] = new TList();
478 fESDList[iCut]->SetName(Form("%s_%s_%s ESD histograms",cutstringEvent.Data(),cutstringCalo.Data(),cutstringMeson.Data()));
479 fESDList[iCut]->SetOwner(kTRUE);
480 fCutFolder[iCut]->Add(fESDList[iCut]);
482 fHistoNEvents[iCut] = new TH1I("NEvents","NEvents",9,-0.5,8.5);
483 fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(1,"Accepted");
484 fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(2,"Centrality");
485 fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(3,"Missing MC");
486 if (((AliConvEventCuts*)fEventCutArray->At(iCut))->IsSpecialTrigger() == 4 ){
487 TString TriggerNames = "Not Trigger: ";
488 TriggerNames = TriggerNames+ ( (AliConvEventCuts*)fEventCutArray->At(iCut))->GetSpecialTriggerName();
489 fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(4,TriggerNames.Data());
491 fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(4,"Trigger");
493 fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(5,"Vertex Z");
494 fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(6,"Cont. Vertex");
495 fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(7,"Pile-Up");
496 fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(8,"no SDD");
497 fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(9,"no V0AND");
498 fESDList[iCut]->Add(fHistoNEvents[iCut]);
500 if(fIsHeavyIon == 1) fHistoNGoodESDTracks[iCut] = new TH1I("GoodESDTracks","GoodESDTracks",4000,0,4000);
501 else if(fIsHeavyIon == 2) fHistoNGoodESDTracks[iCut] = new TH1I("GoodESDTracks","GoodESDTracks",400,0,400);
502 else fHistoNGoodESDTracks[iCut] = new TH1I("GoodESDTracks","GoodESDTracks",200,0,200);
503 fESDList[iCut]->Add(fHistoNGoodESDTracks[iCut]);
504 if(fIsHeavyIon == 1) fHistoNGammaCandidates[iCut] = new TH1I("GammaCandidates","GammaCandidates",600,0,600);
505 else if(fIsHeavyIon == 2) fHistoNGammaCandidates[iCut] = new TH1I("GammaCandidates","GammaCandidates",400,0,400);
506 else fHistoNGammaCandidates[iCut] = new TH1I("GammaCandidates","GammaCandidates",100,0,100);
507 fESDList[iCut]->Add(fHistoNGammaCandidates[iCut]);
508 if(fIsHeavyIon == 1) fHistoNGoodESDTracksVsNGammaCanditates[iCut] = new TH2F("GoodESDTracksVsGammaCandidates","GoodESDTracksVsGammaCandidates",4000,0,4000,600,0,600);
509 else if(fIsHeavyIon == 2) fHistoNGoodESDTracksVsNGammaCanditates[iCut] = new TH2F("GoodESDTracksVsGammaCandidates","GoodESDTracksVsGammaCandidates",400,0,400,400,0,400);
510 else fHistoNGoodESDTracksVsNGammaCanditates[iCut] = new TH2F("GoodESDTracksVsGammaCandidates","GoodESDTracksVsGammaCandidates",200,0,200,100,0,100);
511 fESDList[iCut]->Add(fHistoNGoodESDTracksVsNGammaCanditates[iCut]);
514 if(fIsHeavyIon == 1) fHistoNV0Tracks[iCut] = new TH1I("V0 Multiplicity","V0 Multiplicity",30000,0,30000);
515 else if(fIsHeavyIon == 2) fHistoNV0Tracks[iCut] = new TH1I("V0 Multiplicity","V0 Multiplicity",2500,0,2500);
516 else fHistoNV0Tracks[iCut] = new TH1I("V0 Multiplicity","V0 Multiplicity",1500,0,1500);
517 fESDList[iCut]->Add(fHistoNV0Tracks[iCut]);
518 fProfileEtaShift[iCut] = new TProfile("Eta Shift","Eta Shift",1, -0.5,0.5);
519 fESDList[iCut]->Add(fProfileEtaShift[iCut]);
521 fHistoClusGammaPt[iCut] = new TH1F("ClusGamma_Pt","ClusGamma_Pt",250,0,25);
522 fESDList[iCut]->Add(fHistoClusGammaPt[iCut]);
525 if(fDoMesonAnalysis){
526 fHistoMotherInvMassPt[iCut] = new TH2F("ESD_Mother_InvMass_Pt","ESD_Mother_InvMass_Pt",800,0,0.8,250,0,25);
527 fESDList[iCut]->Add(fHistoMotherInvMassPt[iCut]);
528 fHistoMotherInvMass3ClusterPt[iCut] = new TH2F("ESD_Mother_InvMass3Cluster_Pt","ESD_Mother_InvMass3Cluster_Pt",800,0,0.8,250,0,25);
529 fESDList[iCut]->Add(fHistoMotherInvMass3ClusterPt[iCut]);
530 fHistoMotherBackInvMassPt[iCut] = new TH2F("ESD_Background_InvMass_Pt","ESD_Background_InvMass_Pt",800,0,0.8,250,0,25);
531 fESDList[iCut]->Add(fHistoMotherBackInvMassPt[iCut]);
532 fHistoMotherInvMassEalpha[iCut] = new TH2F("ESD_Mother_InvMass_vs_E_alpha","ESD_Mother_InvMass_vs_E_alpha",800,0,0.8,250,0,25);
533 fESDList[iCut]->Add(fHistoMotherInvMassEalpha[iCut]);
535 fHistoMotherInvMassECalib[iCut] = new TH2F("ESD_Mother_InvMass_Pt_Calib","ESD_Mother_InvMass_Pt_Calib",800,0,0.8,250,0,25);
536 fESDList[iCut]->Add(fHistoMotherInvMassECalib[iCut]);
537 fHistoMotherInvMassECalibalpha[iCut] = new TH2F("ESD_Mother_InvMass_vs_E_Calib_alpha","ESD_Mother_InvMass_vs_E_Calib_alpha",800,0,0.8,250,0,25);
538 fESDList[iCut]->Add(fHistoMotherInvMassECalibalpha[iCut]);
541 if (fDoMesonQA > 0 ){
542 fHistoMotherPi0PtY[iCut] = new TH2F("ESD_MotherPi0_Pt_Y","ESD_MotherPi0_Pt_Y",150,0.03,15.,150,-1.5,1.5);
543 SetLogBinningXTH2(fHistoMotherPi0PtY[iCut]);
544 fESDList[iCut]->Add(fHistoMotherPi0PtY[iCut]);
545 fHistoMotherEtaPtY[iCut] = new TH2F("ESD_MotherEta_Pt_Y","ESD_MotherEta_Pt_Y",150,0.03,15.,150,-1.5,1.5);
546 SetLogBinningXTH2(fHistoMotherEtaPtY[iCut]);
547 fESDList[iCut]->Add(fHistoMotherEtaPtY[iCut]);
548 fHistoMotherPi0PtAlpha[iCut] = new TH2F("ESD_MotherPi0_Pt_Alpha","ESD_MotherPi0_Pt_Alpha",150,0.03,15.,100,0,1);
549 SetLogBinningXTH2(fHistoMotherPi0PtAlpha[iCut]);
550 fESDList[iCut]->Add(fHistoMotherPi0PtAlpha[iCut]);
551 fHistoMotherEtaPtAlpha[iCut] = new TH2F("ESD_MotherEta_Pt_Alpha","ESD_MotherEta_Pt_Alpha",150,0.03,15.,100,0,1);
552 SetLogBinningXTH2(fHistoMotherEtaPtAlpha[iCut]);
553 fESDList[iCut]->Add(fHistoMotherEtaPtAlpha[iCut]);
554 fHistoMotherPi0PtOpenAngle[iCut] = new TH2F("ESD_MotherPi0_Pt_OpenAngle","ESD_MotherPi0_Pt_OpenAngle",150,0.03,15.,200,0,2*TMath::Pi());
555 SetLogBinningXTH2(fHistoMotherPi0PtOpenAngle[iCut]);
556 fESDList[iCut]->Add(fHistoMotherPi0PtOpenAngle[iCut]);
557 fHistoMotherEtaPtOpenAngle[iCut] = new TH2F("ESD_MotherEta_Pt_OpenAngle","ESD_MotherEta_Pt_OpenAngle",150,0.03,15.,200,0,2*TMath::Pi());
558 SetLogBinningXTH2(fHistoMotherEtaPtOpenAngle[iCut]);
559 fESDList[iCut]->Add(fHistoMotherEtaPtOpenAngle[iCut]);
563 if(fDoMesonAnalysis){
564 InitBack(); // Init Background Handler
569 fMCList = new TList*[fnCuts];
571 fTrueList = new TList*[fnCuts];
572 // Selected Header List
573 fHeaderNameList = new TList*[fnCuts];
574 fHistoMCHeaders = new TH1I*[fnCuts];
575 fHistoMCAllGammaPt = new TH1F*[fnCuts];
576 fHistoMCDecayGammaPi0Pt = new TH1F*[fnCuts];
577 fHistoMCDecayGammaRhoPt = new TH1F*[fnCuts];
578 fHistoMCDecayGammaEtaPt = new TH1F*[fnCuts];
579 fHistoMCDecayGammaOmegaPt = new TH1F*[fnCuts];
580 fHistoMCDecayGammaEtapPt = new TH1F*[fnCuts];
581 fHistoMCDecayGammaPhiPt = new TH1F*[fnCuts];
582 fHistoMCDecayGammaSigmaPt = new TH1F*[fnCuts];
584 fHistoClusPhotonBGPt = new TH2F*[fnCuts];
585 fHistoClusPhotonPlusConvBGPt = new TH2F*[fnCuts];
587 fHistoTrueClusGammaPt = new TH1F*[fnCuts];
588 fHistoTruePrimaryClusGammaPt = new TH1F*[fnCuts];
589 fHistoTruePrimaryClusGammaESDPtMCPt = new TH2F*[fnCuts];
590 fHistoTruePrimaryClusConvGammaPt = new TH1F*[fnCuts];
591 fHistoTruePrimaryClusConvGammaESDPtMCPt = new TH2F*[fnCuts];
592 fHistoTrueSecondaryClusGammaPt = new TH1F*[fnCuts];
593 fHistoTrueSecondaryClusConvGammaPt = new TH1F*[fnCuts];
594 fHistoTrueSecondaryClusGammaFromXFromK0sPt = new TH1F*[fnCuts];
595 fHistoTrueSecondaryClusConvGammaFromXFromK0sPt = new TH1F*[fnCuts];
596 fHistoTrueSecondaryClusGammaFromXFromLambdaPt = new TH1F*[fnCuts];
597 fHistoTrueSecondaryClusConvGammaFromXFromLambdaPt = new TH1F*[fnCuts];
598 fHistoTrueSecondaryClusGammaFromXFromEtasPt = new TH1F*[fnCuts];
599 fHistoTrueSecondaryClusConvGammaFromXFromEtasPt = new TH1F*[fnCuts];
602 if (fDoClusterQA > 0){
603 fHistoTrueClusUnConvGammaPt = new TH1F*[fnCuts];
604 fHistoTrueClusUnConvGammaMCPt = new TH1F*[fnCuts];
605 fHistoTrueClusElectronPt = new TH1F*[fnCuts];
606 fHistoTrueClusConvGammaPt = new TH1F*[fnCuts];
607 fHistoTrueClusConvGammaMCPt = new TH1F*[fnCuts];
608 fHistoTrueClusConvGammaFullyPt = new TH1F*[fnCuts];
609 fHistoTrueClusMergedGammaPt = new TH1F*[fnCuts];
610 fHistoTrueClusMergedPartConvGammaPt = new TH1F*[fnCuts];
611 fHistoTrueClusDalitzPt = new TH1F*[fnCuts];
612 fHistoTrueClusDalitzMergedPt = new TH1F*[fnCuts];
613 fHistoTrueClusPhotonFromElecMotherPt= new TH1F*[fnCuts];
614 fHistoTrueClusShowerPt = new TH1F*[fnCuts];
615 fHistoTrueClusSubLeadingPt = new TH1F*[fnCuts];
616 fHistoTrueClusNParticles = new TH1I*[fnCuts];
617 fHistoTrueClusEMNonLeadingPt = new TH1F*[fnCuts];
618 fHistoTrueNLabelsInClus = new TH1F*[fnCuts];
621 if(fDoMesonAnalysis){
622 fHistoMCPi0Pt = new TH1F*[fnCuts];
623 fHistoMCPi0WOWeightPt = new TH1F*[fnCuts];
624 fHistoMCEtaPt = new TH1F*[fnCuts];
625 fHistoMCEtaWOWeightPt = new TH1F*[fnCuts];
626 fHistoMCPi0InAccPt = new TH1F*[fnCuts];
627 fHistoMCEtaInAccPt = new TH1F*[fnCuts];
629 fHistoTrueMotherInvMassPt = new TH2F*[fnCuts];
630 fHistoTruePrimaryMotherInvMassPt = new TH2F*[fnCuts];
631 fHistoTruePrimaryMotherW0WeightingInvMassPt = new TH2F*[fnCuts];
632 fProfileTruePrimaryMotherWeightsInvMassPt = new TProfile2D*[fnCuts];
633 fHistoTrueSecondaryMotherInvMassPt = new TH2F*[fnCuts];
634 fHistoTrueSecondaryMotherFromK0sInvMassPt = new TH2F*[fnCuts];
635 fHistoTrueSecondaryMotherFromEtaInvMassPt = new TH2F*[fnCuts];
636 fHistoTrueSecondaryMotherFromLambdaInvMassPt = new TH2F*[fnCuts];
638 fHistoMCPi0PtY = new TH2F*[fnCuts];
639 fHistoMCEtaPtY = new TH2F*[fnCuts];
640 fHistoMCK0sPt = new TH1F*[fnCuts];
641 fHistoMCK0sWOWeightPt = new TH1F*[fnCuts];
642 fHistoMCK0sPtY = new TH2F*[fnCuts];
643 fHistoMCSecPi0PtvsSource = new TH2F*[fnCuts];
644 fHistoMCSecPi0Source = new TH1F*[fnCuts];
645 fHistoMCSecEtaPt = new TH1F*[fnCuts];
646 fHistoMCSecEtaSource = new TH1F*[fnCuts];
647 fHistoTrueMotherCaloPhotonInvMassPt = new TH2F*[fnCuts];
648 fHistoTrueMotherCaloConvertedPhotonInvMassPt= new TH2F*[fnCuts];
649 fHistoTrueMotherCaloMixedPhotonConvPhotonInvMassPt= new TH2F*[fnCuts];
650 fHistoTruePi0CaloConvertedPhotonInvMassPt = new TH2F*[fnCuts];
651 fHistoTrueEtaCaloConvertedPhotonInvMassPt = new TH2F*[fnCuts];
652 fHistoTrueMotherCaloElectronInvMassPt = new TH2F*[fnCuts];
653 fHistoTrueMotherCaloMergedClusterInvMassPt = new TH2F*[fnCuts];
654 fHistoTrueMotherCaloMergedClusterPartConvInvMassPt = new TH2F*[fnCuts];
655 fHistoTruePrimaryPi0MCPtResolPt = new TH2F*[fnCuts];
656 fHistoTruePrimaryEtaMCPtResolPt = new TH2F*[fnCuts];
657 fHistoTrueK0sWithPi0DaughterMCPt = new TH1F*[fnCuts];
658 fHistoTrueEtaWithPi0DaughterMCPt = new TH1F*[fnCuts];
659 fHistoTrueLambdaWithPi0DaughterMCPt = new TH1F*[fnCuts];
660 fHistoTrueBckGGInvMassPt = new TH2F*[fnCuts];
661 fHistoTrueBckContInvMassPt = new TH2F*[fnCuts];
662 fHistoTruePi0PtY = new TH2F*[fnCuts];
663 fHistoTrueEtaPtY = new TH2F*[fnCuts];
664 fHistoTruePi0PtAlpha = new TH2F*[fnCuts];
665 fHistoTrueEtaPtAlpha = new TH2F*[fnCuts];
666 fHistoTruePi0PtOpenAngle = new TH2F*[fnCuts];
667 fHistoTrueEtaPtOpenAngle = new TH2F*[fnCuts];
673 for(Int_t iCut = 0; iCut<fnCuts;iCut++){
674 TString cutstringEvent = ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber();
675 TString cutstringCalo = ((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetCutNumber();
676 TString cutstringMeson = "NoMesonCut";
677 if(fDoMesonAnalysis)cutstringMeson = ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutNumber();
679 fMCList[iCut] = new TList();
680 fMCList[iCut]->SetName(Form("%s_%s_%s MC histograms",cutstringEvent.Data(),cutstringCalo.Data(),cutstringMeson.Data()));
681 fMCList[iCut]->SetOwner(kTRUE);
682 fCutFolder[iCut]->Add(fMCList[iCut]);
683 fHistoMCHeaders[iCut] = new TH1I("MC_Headers","MC_Headers",20,0,20);
684 fMCList[iCut]->Add(fHistoMCHeaders[iCut]);
685 fHistoMCAllGammaPt[iCut] = new TH1F("MC_AllGamma_Pt","MC_AllGamma_Pt",250,0,25);
686 fMCList[iCut]->Add(fHistoMCAllGammaPt[iCut]);
687 fHistoMCDecayGammaPi0Pt[iCut] = new TH1F("MC_DecayGammaPi0_Pt","MC_DecayGammaPi0_Pt",250,0,25);
688 fMCList[iCut]->Add(fHistoMCDecayGammaPi0Pt[iCut]);
689 fHistoMCDecayGammaRhoPt[iCut] = new TH1F("MC_DecayGammaRho_Pt","MC_DecayGammaRho_Pt",250,0,25);
690 fMCList[iCut]->Add(fHistoMCDecayGammaRhoPt[iCut]);
691 fHistoMCDecayGammaEtaPt[iCut] = new TH1F("MC_DecayGammaEta_Pt","MC_DecayGammaEta_Pt",250,0,25);
692 fMCList[iCut]->Add(fHistoMCDecayGammaEtaPt[iCut]);
693 fHistoMCDecayGammaOmegaPt[iCut] = new TH1F("MC_DecayGammaOmega_Pt","MC_DecayGammaOmmega_Pt",250,0,25);
694 fMCList[iCut]->Add(fHistoMCDecayGammaOmegaPt[iCut]);
695 fHistoMCDecayGammaEtapPt[iCut] = new TH1F("MC_DecayGammaEtap_Pt","MC_DecayGammaEtap_Pt",250,0,25);
696 fMCList[iCut]->Add(fHistoMCDecayGammaEtapPt[iCut]);
697 fHistoMCDecayGammaPhiPt[iCut] = new TH1F("MC_DecayGammaPhi_Pt","MC_DecayGammaPhi_Pt",250,0,25);
698 fMCList[iCut]->Add(fHistoMCDecayGammaPhiPt[iCut]);
699 fHistoMCDecayGammaSigmaPt[iCut] = new TH1F("MC_DecayGammaSigma_Pt","MC_DecayGammaSigma_Pt",250,0,25);
700 fMCList[iCut]->Add(fHistoMCDecayGammaSigmaPt[iCut]);
702 if(fDoMesonAnalysis){
703 fHistoMCPi0Pt[iCut] = new TH1F("MC_Pi0_Pt","MC_Pi0_Pt",250,0,25);
704 fHistoMCPi0Pt[iCut]->Sumw2();
705 fMCList[iCut]->Add(fHistoMCPi0Pt[iCut]);
706 fHistoMCPi0WOWeightPt[iCut] = new TH1F("MC_Pi0_WOWeights_Pt","MC_Pi0_WOWeights_Pt",250,0,25);
707 fHistoMCPi0WOWeightPt[iCut]->Sumw2();
708 fMCList[iCut]->Add(fHistoMCPi0WOWeightPt[iCut]);
710 fHistoMCEtaPt[iCut] = new TH1F("MC_Eta_Pt","MC_Eta_Pt",250,0,25);
711 fHistoMCEtaPt[iCut]->Sumw2();
712 fMCList[iCut]->Add(fHistoMCEtaPt[iCut]);
713 fHistoMCEtaWOWeightPt[iCut] = new TH1F("MC_Eta_WOWeights_Pt","MC_Eta_WOWeights_Pt",250,0,25);
714 fHistoMCEtaWOWeightPt[iCut]->Sumw2();
715 fMCList[iCut]->Add(fHistoMCEtaWOWeightPt[iCut]);
716 fHistoMCPi0InAccPt[iCut] = new TH1F("MC_Pi0InAcc_Pt","MC_Pi0InAcc_Pt",250,0,25);
717 fHistoMCPi0InAccPt[iCut]->Sumw2();
718 fMCList[iCut]->Add(fHistoMCPi0InAccPt[iCut]);
719 fHistoMCEtaInAccPt[iCut] = new TH1F("MC_EtaInAcc_Pt","MC_EtaInAcc_Pt",250,0,25);
720 fHistoMCEtaInAccPt[iCut]->Sumw2();
721 fMCList[iCut]->Add(fHistoMCEtaInAccPt[iCut]);
723 fHistoMCPi0PtY[iCut] = new TH2F("MC_Pi0_Pt_Y","MC_Pi0_Pt_Y",150,0.03,15.,150,-1.5,1.5);
724 fHistoMCPi0PtY[iCut]->Sumw2();
725 SetLogBinningXTH2(fHistoMCPi0PtY[iCut]);
726 fMCList[iCut]->Add(fHistoMCPi0PtY[iCut]);
727 fHistoMCEtaPtY[iCut] = new TH2F("MC_Eta_Pt_Y","MC_Eta_Pt_Y",150,0.03,15.,150,-1.5,1.5);
728 fHistoMCEtaPtY[iCut]->Sumw2();
729 SetLogBinningXTH2(fHistoMCEtaPtY[iCut]);
730 fMCList[iCut]->Add(fHistoMCEtaPtY[iCut]);
731 fHistoMCK0sPt[iCut] = new TH1F("MC_K0s_Pt","MC_K0s_Pt",150,0,15);
732 fHistoMCK0sPt[iCut]->Sumw2();
733 fMCList[iCut]->Add(fHistoMCK0sPt[iCut]);
734 fHistoMCK0sWOWeightPt[iCut] = new TH1F("MC_K0s_WOWeights_Pt","MC_K0s_WOWeights_Pt",150,0,15);
735 fHistoMCK0sWOWeightPt[iCut]->Sumw2();
736 fMCList[iCut]->Add(fHistoMCK0sWOWeightPt[iCut]);
737 fHistoMCK0sPtY[iCut] = new TH2F("MC_K0s_Pt_Y","MC_K0s_Pt_Y",150,0.03,15.,150,-1.5,1.5);
738 fHistoMCK0sPtY[iCut]->Sumw2();
739 SetLogBinningXTH2(fHistoMCK0sPtY[iCut]);
740 fMCList[iCut]->Add(fHistoMCK0sPtY[iCut]);
742 fHistoMCSecPi0Source[iCut] = new TH1F("MC_SecPi0_Source","MC_SecPi0_Source",5000,0.,5000);
743 fMCList[iCut]->Add(fHistoMCSecPi0Source[iCut]);
744 fHistoMCSecEtaSource[iCut] = new TH1F("MC_SecEta_Source","MC_SecEta_Source",5000,0,5000);
745 fMCList[iCut]->Add(fHistoMCSecEtaSource[iCut]);
746 fHistoMCSecPi0PtvsSource[iCut] = new TH2F("MC_SecPi0_Pt_Source","MC_SecPi0_Pt_Source",250,0.0,25.,16,-0.5,15.5);
747 fHistoMCSecPi0PtvsSource[iCut]->Sumw2();
748 fMCList[iCut]->Add(fHistoMCSecPi0PtvsSource[iCut]);
749 fHistoMCSecEtaPt[iCut] = new TH1F("MC_SecEta_Pt","MC_SecEta_Pt",250,0,25);
750 fHistoMCSecEtaPt[iCut]->Sumw2();
751 fMCList[iCut]->Add(fHistoMCSecEtaPt[iCut]);
755 fTrueList[iCut] = new TList();
756 fTrueList[iCut]->SetName(Form("%s_%s_%s True histograms",cutstringEvent.Data(),cutstringCalo.Data(),cutstringMeson.Data()));
757 fTrueList[iCut]->SetOwner(kTRUE);
758 fCutFolder[iCut]->Add(fTrueList[iCut]);
760 fHistoClusPhotonBGPt[iCut] = new TH2F("ESD_TrueClusPhotonBG_Pt","ESD_TrueClusPhotonBG_Pt",250,0,25,9,-0.5,8.5);
761 fHistoClusPhotonBGPt[iCut]->GetYaxis()->SetBinLabel( 1,"Elec");
762 fHistoClusPhotonBGPt[iCut]->GetYaxis()->SetBinLabel( 2,"Pion");
763 fHistoClusPhotonBGPt[iCut]->GetYaxis()->SetBinLabel( 3,"Proton");
764 fHistoClusPhotonBGPt[iCut]->GetYaxis()->SetBinLabel( 4,"Kaon");
765 fHistoClusPhotonBGPt[iCut]->GetYaxis()->SetBinLabel( 5,"Neutron");
766 fHistoClusPhotonBGPt[iCut]->GetYaxis()->SetBinLabel( 6,"K0s");
767 fHistoClusPhotonBGPt[iCut]->GetYaxis()->SetBinLabel( 7,"Lambda");
768 fHistoClusPhotonBGPt[iCut]->GetYaxis()->SetBinLabel( 8,"Muon");
769 fHistoClusPhotonBGPt[iCut]->GetYaxis()->SetBinLabel(9,"Rest");
770 fTrueList[iCut]->Add(fHistoClusPhotonBGPt[iCut]);
771 fHistoClusPhotonPlusConvBGPt[iCut] = new TH2F("ESD_TrueClusPhotonPlusConvBG_Pt","ESD_TrueClusPhotonPlusConvBG_Pt",250,0,25,9,-0.5,8.5);
772 fHistoClusPhotonPlusConvBGPt[iCut]->GetYaxis()->SetBinLabel( 1,"Elec");
773 fHistoClusPhotonPlusConvBGPt[iCut]->GetYaxis()->SetBinLabel( 2,"Pion");
774 fHistoClusPhotonPlusConvBGPt[iCut]->GetYaxis()->SetBinLabel( 3,"Proton");
775 fHistoClusPhotonPlusConvBGPt[iCut]->GetYaxis()->SetBinLabel( 4,"Kaon");
776 fHistoClusPhotonPlusConvBGPt[iCut]->GetYaxis()->SetBinLabel( 5,"Neutron");
777 fHistoClusPhotonPlusConvBGPt[iCut]->GetYaxis()->SetBinLabel( 6,"K0s");
778 fHistoClusPhotonPlusConvBGPt[iCut]->GetYaxis()->SetBinLabel( 7,"Lambda");
779 fHistoClusPhotonPlusConvBGPt[iCut]->GetYaxis()->SetBinLabel( 8,"Muon");
780 fHistoClusPhotonPlusConvBGPt[iCut]->GetYaxis()->SetBinLabel(9,"Rest");
781 fTrueList[iCut]->Add(fHistoClusPhotonPlusConvBGPt[iCut]);
783 fHistoTrueClusGammaPt[iCut] = new TH1F("TrueClusGamma_Pt","ESD_TrueClusGamma_Pt",250,0,25);
784 fTrueList[iCut]->Add(fHistoTrueClusGammaPt[iCut]);
785 fHistoTruePrimaryClusGammaPt[iCut] = new TH1F("TruePrimaryClusGamma_Pt","ESD_TruePrimaryClusGamma_Pt",250,0,25);
786 fTrueList[iCut]->Add(fHistoTruePrimaryClusGammaPt[iCut]);
787 fHistoTruePrimaryClusGammaESDPtMCPt[iCut] = new TH2F("TruePrimaryClusGamma_Pt_MCPt","ESD_TruePrimaryClusGamma_MCPt",250,0,25,250,0,25);
788 fTrueList[iCut]->Add(fHistoTruePrimaryClusGammaESDPtMCPt[iCut]);
789 fHistoTruePrimaryClusConvGammaPt[iCut] = new TH1F("TruePrimaryClusConvGamma_Pt","ESD_TruePrimaryClusConvGamma_Pt",250,0,25);
790 fTrueList[iCut]->Add(fHistoTruePrimaryClusConvGammaPt[iCut]);
791 fHistoTruePrimaryClusConvGammaESDPtMCPt[iCut] = new TH2F("TruePrimaryClusConvGamma_Pt_MCPt","ESD_TruePrimaryClusConvGamma_MCPt",250,0,25,250,0,25);
792 fTrueList[iCut]->Add(fHistoTruePrimaryClusConvGammaESDPtMCPt[iCut]);
793 fHistoTrueSecondaryClusGammaPt[iCut] = new TH1F("ESD_TrueSecondaryClusGamma_Pt","ESD_TrueSecondaryClusGamma_Pt",250,0,25);
794 fTrueList[iCut]->Add(fHistoTrueSecondaryClusGammaPt[iCut]);
795 fHistoTrueSecondaryClusConvGammaPt[iCut] = new TH1F("ESD_TrueSecondaryClusConvGamma_Pt","ESD_TrueSecondaryClusConvGamma_Pt",250,0,25);
796 fTrueList[iCut]->Add(fHistoTrueSecondaryClusConvGammaPt[iCut]);
798 fHistoTrueSecondaryClusGammaFromXFromK0sPt[iCut] = new TH1F("ESD_TrueSecondaryClusGammaFromXFromK0s_Pt", "ESD_TrueSecondaryClusGammaFromXFromK0s_Pt",250,0,25);
799 fTrueList[iCut]->Add(fHistoTrueSecondaryClusGammaFromXFromK0sPt[iCut]);
800 fHistoTrueSecondaryClusConvGammaFromXFromK0sPt[iCut] = new TH1F("ESD_TrueSecondaryClusConvGammaFromXFromK0s_Pt", "ESD_TrueSecondaryClusConvGammaFromXFromK0s_Pt",250,0,25);
801 fTrueList[iCut]->Add(fHistoTrueSecondaryClusConvGammaFromXFromK0sPt[iCut]);
802 fHistoTrueSecondaryClusGammaFromXFromLambdaPt[iCut] = new TH1F("ESD_TrueSecondaryClusGammaFromXFromLambda_Pt", "ESD_TrueSecondaryClusGammaFromXFromLambda_Pt",250,0,25);
803 fTrueList[iCut]->Add(fHistoTrueSecondaryClusGammaFromXFromLambdaPt[iCut]);
804 fHistoTrueSecondaryClusConvGammaFromXFromLambdaPt[iCut] = new TH1F("ESD_TrueSecondaryClusConvGammaFromXFromLambda_Pt", "ESD_TrueSecondaryClusConvGammaFromXFromLambda_Pt",250,0,25);
805 fTrueList[iCut]->Add(fHistoTrueSecondaryClusConvGammaFromXFromLambdaPt[iCut]);
806 fHistoTrueSecondaryClusGammaFromXFromEtasPt[iCut] = new TH1F("ESD_TrueSecondaryClusGammaFromXFromEtas_Pt", "ESD_TrueSecondaryClusGammaFromXFromEtas_Pt",250,0,25);
807 fTrueList[iCut]->Add(fHistoTrueSecondaryClusGammaFromXFromEtasPt[iCut]);
808 fHistoTrueSecondaryClusConvGammaFromXFromEtasPt[iCut] = new TH1F("ESD_TrueSecondaryClusConvGammaFromXFromEtas_Pt", "ESD_TrueSecondaryClusConvGammaFromXFromEtas_Pt",250,0,25);
809 fTrueList[iCut]->Add(fHistoTrueSecondaryClusConvGammaFromXFromEtasPt[iCut]);
812 if (fDoClusterQA > 0){
813 fHistoTrueClusUnConvGammaPt[iCut] = new TH1F("TrueClusUnConvGamma_Pt","TrueClusUnConvGamma_Pt",250,0,25);
814 fTrueList[iCut]->Add(fHistoTrueClusUnConvGammaPt[iCut]);
815 fHistoTrueClusUnConvGammaMCPt[iCut] = new TH1F("TrueClusUnConvGamma_MCPt","TrueClusUnConvGamma_MCPt",250,0,25);
816 fTrueList[iCut]->Add(fHistoTrueClusUnConvGammaMCPt[iCut]);
817 fHistoTrueClusElectronPt[iCut] = new TH1F("TrueClusElectron_Pt","TrueElectronGamma_Pt",250,0,25);
818 fTrueList[iCut]->Add(fHistoTrueClusElectronPt[iCut]);
819 fHistoTrueClusConvGammaPt[iCut] = new TH1F("TrueClusConvGamma_Pt","TrueClusConvGamma_Pt",250,0,25);
820 fTrueList[iCut]->Add(fHistoTrueClusConvGammaPt[iCut]);
821 fHistoTrueClusConvGammaMCPt[iCut] = new TH1F("TrueClusConvGamma_MCPt","TrueClusConvGamma_MCPt",250,0,25);
822 fTrueList[iCut]->Add(fHistoTrueClusConvGammaMCPt[iCut]);
823 fHistoTrueClusConvGammaFullyPt[iCut] = new TH1F("TrueClusConvGammaFullyContained_Pt","TrueClusConvGammaFullyContained_Pt",250,0,25);
824 fTrueList[iCut]->Add(fHistoTrueClusConvGammaFullyPt[iCut]);
825 fHistoTrueClusMergedGammaPt[iCut] = new TH1F("TrueClusMergedGamma_Pt","TrueClusMergedGamma_Pt",250,0,25);
826 fTrueList[iCut]->Add(fHistoTrueClusMergedGammaPt[iCut]);
827 fHistoTrueClusMergedPartConvGammaPt[iCut] = new TH1F("TrueClusMergedPartConvGamma_Pt","TrueClusMergedPartConvGamma_Pt",250,0,25);
828 fTrueList[iCut]->Add(fHistoTrueClusMergedPartConvGammaPt[iCut]);
829 fHistoTrueClusDalitzPt[iCut] = new TH1F("TrueClusDalitz_Pt","TrueClusDalitz_Pt",250,0,25);
830 fTrueList[iCut]->Add(fHistoTrueClusDalitzPt[iCut]);
831 fHistoTrueClusDalitzMergedPt[iCut] = new TH1F("TrueClusDalitzMerged_Pt","TrueClusDalitzMerged_Pt",250,0,25);
832 fTrueList[iCut]->Add(fHistoTrueClusDalitzMergedPt[iCut]);
833 fHistoTrueClusPhotonFromElecMotherPt[iCut] = new TH1F("TrueClusPhotonFromElecMother_Pt","TrueClusPhotonFromElecMother_Pt",250,0,25);
834 fTrueList[iCut]->Add(fHistoTrueClusPhotonFromElecMotherPt[iCut]);
835 fHistoTrueClusShowerPt[iCut] = new TH1F("TrueClusShower_Pt","TrueClusShower_Pt",250,0,25);
836 fTrueList[iCut]->Add(fHistoTrueClusShowerPt[iCut]);
837 fHistoTrueClusSubLeadingPt[iCut] = new TH1F("TrueClusSubleading_Pt","TrueClusSubleading_Pt",250,0,25);
838 fTrueList[iCut]->Add(fHistoTrueClusSubLeadingPt[iCut]);
839 fHistoTrueClusNParticles[iCut] = new TH1I("TrueClusNParticles","TrueClusNParticles",20,0,20);
840 fTrueList[iCut]->Add(fHistoTrueClusNParticles[iCut]);
841 fHistoTrueClusEMNonLeadingPt[iCut] = new TH1F("TrueClusEMNonLeading_Pt","TrueClusEMNonLeading_Pt",250,0,25);
842 fTrueList[iCut]->Add(fHistoTrueClusEMNonLeadingPt[iCut]);
843 fHistoTrueNLabelsInClus[iCut] = new TH1F("TrueNLabelsInClus","TrueNLabelsInClus",100,-0.5,99.5);
844 fTrueList[iCut]->Add(fHistoTrueNLabelsInClus[iCut]);
847 if(fDoMesonAnalysis){
848 fHistoTrueMotherInvMassPt[iCut] = new TH2F("ESD_TrueMother_InvMass_Pt","ESD_TrueMother_InvMass_Pt",800,0,0.8,250,0,25);
849 fTrueList[iCut]->Add(fHistoTrueMotherInvMassPt[iCut]);
850 fHistoTruePrimaryMotherInvMassPt[iCut] = new TH2F("ESD_TruePrimaryMother_InvMass_Pt", "ESD_TruePrimaryMother_InvMass_Pt", 800,0,0.8,250,0,25);
851 fHistoTruePrimaryMotherInvMassPt[iCut]->Sumw2();
852 fTrueList[iCut]->Add(fHistoTruePrimaryMotherInvMassPt[iCut]);
853 fHistoTruePrimaryMotherW0WeightingInvMassPt[iCut] = new TH2F("ESD_TruePrimaryMotherW0Weights_InvMass_Pt", "ESD_TruePrimaryMotherW0Weights_InvMass_Pt", 800,0,0.8,250,0,25);
854 fHistoTruePrimaryMotherW0WeightingInvMassPt[iCut]->Sumw2();
855 fTrueList[iCut]->Add(fHistoTruePrimaryMotherW0WeightingInvMassPt[iCut]);
856 fProfileTruePrimaryMotherWeightsInvMassPt[iCut] = new TProfile2D("ESD_TruePrimaryMotherWeights_InvMass_Pt", "ESD_TruePrimaryMotherWeights_InvMass_Pt", 800,0,0.8,250,0,25);
857 fProfileTruePrimaryMotherWeightsInvMassPt[iCut]->Sumw2();
858 fTrueList[iCut]->Add(fProfileTruePrimaryMotherWeightsInvMassPt[iCut]);
859 fHistoTrueSecondaryMotherInvMassPt[iCut] = new TH2F("ESD_TrueSecondaryMother_InvMass_Pt", "ESD_TrueSecondaryMother_InvMass_Pt", 800,0,0.8,250,0,25);
860 fHistoTrueSecondaryMotherInvMassPt[iCut]->Sumw2();
861 fTrueList[iCut]->Add(fHistoTrueSecondaryMotherInvMassPt[iCut]);
862 fHistoTrueSecondaryMotherFromK0sInvMassPt[iCut] = new TH2F("ESD_TrueSecondaryMotherFromK0s_InvMass_Pt","ESD_TrueSecondaryMotherFromK0s_InvMass_Pt",800,0,0.8,250,0,25);
863 fHistoTrueSecondaryMotherFromK0sInvMassPt[iCut]->Sumw2();
864 fTrueList[iCut]->Add(fHistoTrueSecondaryMotherFromK0sInvMassPt[iCut]);
865 fHistoTrueSecondaryMotherFromEtaInvMassPt[iCut] = new TH2F("ESD_TrueSecondaryMotherFromEta_InvMass_Pt","ESD_TrueSecondaryMotherFromEta_InvMass_Pt",800,0,0.8,250,0,25);
866 fTrueList[iCut]->Add(fHistoTrueSecondaryMotherFromEtaInvMassPt[iCut]);
867 fHistoTrueSecondaryMotherFromLambdaInvMassPt[iCut] = new TH2F("ESD_TrueSecondaryMotherFromLambda_InvMass_Pt","ESD_TrueSecondaryMotherFromLambda_InvMass_Pt",800,0,0.8,250,0,25);
868 fTrueList[iCut]->Add(fHistoTrueSecondaryMotherFromLambdaInvMassPt[iCut]);
870 fHistoTrueMotherCaloPhotonInvMassPt[iCut] = new TH2F("ESD_TrueMotherCaloPhoton_InvMass_Pt","ESD_TrueMotherCaloPhoton_InvMass_Pt",800,0,0.8,250,0,25);
871 fTrueList[iCut]->Add(fHistoTrueMotherCaloPhotonInvMassPt[iCut]);
872 fHistoTrueMotherCaloConvertedPhotonInvMassPt[iCut] = new TH2F("ESD_TrueMotherCaloConvertedPhoton_InvMass_Pt","ESD_TrueMotherCaloConvertedPhoton_InvMass_Pt",800,0,0.8,250,0,25);
873 fTrueList[iCut]->Add(fHistoTrueMotherCaloConvertedPhotonInvMassPt[iCut]);
874 fHistoTrueMotherCaloMixedPhotonConvPhotonInvMassPt[iCut] = new TH2F("ESD_TrueMotherCaloMixedPhotonConvertedPhoton_InvMass_Pt","ESD_TrueMotherCaloMixedPhotonConvertedPhoton_InvMass_Pt",800,0,0.8,250,0,25);
875 fTrueList[iCut]->Add(fHistoTrueMotherCaloMixedPhotonConvPhotonInvMassPt[iCut]);
877 fHistoTruePi0CaloConvertedPhotonInvMassPt[iCut] = new TH2F("ESD_TruePi0CaloConvertedPhoton_InvMass_Pt","ESD_TruePi0CaloConvertedPhoton_InvMass_Pt",800,0,0.8,250,0,25);
878 fTrueList[iCut]->Add(fHistoTruePi0CaloConvertedPhotonInvMassPt[iCut]);
880 fHistoTrueEtaCaloConvertedPhotonInvMassPt[iCut] = new TH2F("ESD_TrueEtaCaloConvertedPhoton_InvMass_Pt","ESD_TrueEtaCaloConvertedPhoton_InvMass_Pt",800,0,0.8,250,0,25);
881 fTrueList[iCut]->Add(fHistoTrueEtaCaloConvertedPhotonInvMassPt[iCut]);
883 fHistoTrueMotherCaloElectronInvMassPt[iCut] = new TH2F("ESD_TrueMotherCaloElectron_InvMass_Pt","ESD_TrueMotherCaloElectron_InvMass_Pt",800,0,0.8,250,0,25);
884 fTrueList[iCut]->Add(fHistoTrueMotherCaloElectronInvMassPt[iCut]);
885 fHistoTrueMotherCaloMergedClusterInvMassPt[iCut] = new TH2F("ESD_TrueMotherCaloMergedCluster_InvMass_Pt","ESD_TrueMotherCaloMergedCluster_InvMass_Pt",800,0,0.8,250,0,25);
886 fTrueList[iCut]->Add(fHistoTrueMotherCaloMergedClusterInvMassPt[iCut]);
887 fHistoTrueMotherCaloMergedClusterPartConvInvMassPt[iCut] = new TH2F("ESD_TrueMotherCaloMergedClusterPartConv_InvMass_Pt","ESD_TrueMotherCaloMergedClusterPartConv_InvMass_Pt",800,0,0.8,250,0,25);
888 fTrueList[iCut]->Add(fHistoTrueMotherCaloMergedClusterPartConvInvMassPt[iCut]);
890 fHistoTruePrimaryPi0MCPtResolPt[iCut] = new TH2F("ESD_TruePrimaryPi0_MCPt_ResolPt","ESD_TruePrimaryPi0_ResolPt_MCPt",500,0.03,25,1000,-1.,1.);
891 fHistoTruePrimaryPi0MCPtResolPt[iCut]->Sumw2();
892 SetLogBinningXTH2(fHistoTruePrimaryPi0MCPtResolPt[iCut]);
893 fTrueList[iCut]->Add(fHistoTruePrimaryPi0MCPtResolPt[iCut]);
894 fHistoTruePrimaryEtaMCPtResolPt[iCut] = new TH2F("ESD_TruePrimaryEta_MCPt_ResolPt","ESD_TruePrimaryEta_ResolPt_MCPt",500,0.03,25,1000,-1.,1.);
895 fHistoTruePrimaryEtaMCPtResolPt[iCut]->Sumw2();
896 SetLogBinningXTH2(fHistoTruePrimaryEtaMCPtResolPt[iCut]);
897 fTrueList[iCut]->Add(fHistoTruePrimaryEtaMCPtResolPt[iCut]);
898 fHistoTrueBckGGInvMassPt[iCut] = new TH2F("ESD_TrueBckGG_InvMass_Pt","ESD_TrueBckGG_InvMass_Pt",800,0,0.8,250,0,25);
899 fTrueList[iCut]->Add(fHistoTrueBckGGInvMassPt[iCut]);
900 fHistoTrueBckContInvMassPt[iCut] = new TH2F("ESD_TrueBckCont_InvMass_Pt","ESD_TrueBckCont_InvMass_Pt",800,0,0.8,250,0,25);
901 fTrueList[iCut]->Add(fHistoTrueBckContInvMassPt[iCut]);
902 fHistoTrueK0sWithPi0DaughterMCPt[iCut] = new TH1F("ESD_TrueK0sWithPi0Daughter_MCPt","ESD_TrueK0sWithPi0Daughter_MCPt",250,0,25);
903 fTrueList[iCut]->Add(fHistoTrueK0sWithPi0DaughterMCPt[iCut]);
904 fHistoTrueEtaWithPi0DaughterMCPt[iCut] = new TH1F("ESD_TrueEtaWithPi0Daughter_MCPt","ESD_TrueEtaWithPi0Daughter_MCPt",250,0,25);
905 fTrueList[iCut]->Add(fHistoTrueEtaWithPi0DaughterMCPt[iCut]);
906 fHistoTrueLambdaWithPi0DaughterMCPt[iCut] = new TH1F("ESD_TrueLambdaWithPi0Daughter_MCPt","ESD_TrueLambdaWithPi0Daughter_MCPt",250,0,25);
907 fTrueList[iCut]->Add(fHistoTrueLambdaWithPi0DaughterMCPt[iCut]);
909 fHistoTruePi0PtY[iCut] = new TH2F("ESD_TruePi0_Pt_Y","ESD_TruePi0_Pt_Y",150,0.03,15.,150,-1.5,1.5);
910 SetLogBinningXTH2(fHistoTruePi0PtY[iCut]);
911 fTrueList[iCut]->Add(fHistoTruePi0PtY[iCut]);
912 fHistoTrueEtaPtY[iCut] = new TH2F("ESD_TrueEta_Pt_Y","ESD_TrueEta_Pt_Y",150,0.03,15.,150,-1.5,1.5);
913 SetLogBinningXTH2(fHistoTrueEtaPtY[iCut]);
914 fTrueList[iCut]->Add(fHistoTrueEtaPtY[iCut]);
915 fHistoTruePi0PtAlpha[iCut] = new TH2F("ESD_TruePi0_Pt_Alpha","ESD_TruePi0_Pt_Alpha",150,0.03,15.,100,0,1);
916 SetLogBinningXTH2(fHistoTruePi0PtAlpha[iCut]);
917 fTrueList[iCut]->Add(fHistoTruePi0PtAlpha[iCut]);
918 fHistoTrueEtaPtAlpha[iCut] = new TH2F("ESD_TrueEta_Pt_Alpha","ESD_TrueEta_Pt_Alpha",150,0.03,15.,100,0,1);
919 SetLogBinningXTH2(fHistoTrueEtaPtAlpha[iCut]);
920 fTrueList[iCut]->Add(fHistoTrueEtaPtAlpha[iCut]);
922 fHistoTruePi0PtOpenAngle[iCut] = new TH2F("ESD_TruePi0_Pt_OpenAngle","ESD_TruePi0_Pt_OpenAngle",150,0.03,15.,200,0,2*TMath::Pi());
923 SetLogBinningXTH2(fHistoTruePi0PtOpenAngle[iCut]);
924 fTrueList[iCut]->Add(fHistoTruePi0PtOpenAngle[iCut]);
925 fHistoTrueEtaPtOpenAngle[iCut] = new TH2F("ESD_TrueEta_Pt_OpenAngle","ESD_TrueEta_Pt_OpenAngle",150,0.03,15.,200,0,2*TMath::Pi());
926 SetLogBinningXTH2(fHistoTrueEtaPtOpenAngle[iCut]);
927 fTrueList[iCut]->Add(fHistoTrueEtaPtOpenAngle[iCut]);
933 fV0Reader=(AliV0ReaderV1*)AliAnalysisManager::GetAnalysisManager()->GetTask("V0ReaderV1");
934 if(!fV0Reader){printf("Error: No V0 Reader");return;} // GetV0Reader
937 if((AliConversionPhotonCuts*)fV0Reader->GetConversionCuts())
938 if(((AliConversionPhotonCuts*)fV0Reader->GetConversionCuts())->GetCutHistograms())
939 fOutputContainer->Add(((AliConversionPhotonCuts*)fV0Reader->GetConversionCuts())->GetCutHistograms());
941 if((AliConvEventCuts*)fV0Reader->GetEventCuts())
942 if(((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetCutHistograms())
943 fOutputContainer->Add(((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetCutHistograms());
946 for(Int_t iCut = 0; iCut<fnCuts;iCut++){
947 if(!((AliConvEventCuts*)fEventCutArray->At(iCut))) continue;
948 if(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutHistograms()){
949 fCutFolder[iCut]->Add(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutHistograms());
951 if(!((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))) continue;
952 if(((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetCutHistograms()){
953 fCutFolder[iCut]->Add(((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetCutHistograms());
955 if(fDoMesonAnalysis){
956 if(!((AliConversionMesonCuts*)fMesonCutArray->At(iCut))) continue;
957 if(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutHistograms()){
958 fCutFolder[iCut]->Add(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutHistograms());
962 PostData(1, fOutputContainer);
964 //_____________________________________________________________________________
965 Bool_t AliAnalysisTaskGammaCalo::Notify()
967 for(Int_t iCut = 0; iCut<fnCuts;iCut++){
968 if(!((AliConvEventCuts*)fEventCutArray->At(iCut))->GetDoEtaShift()){
969 fProfileEtaShift[iCut]->Fill(0.,(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift()));
970 continue; // No Eta Shift requested, continue
972 if(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift() == 0.0){ // Eta Shift requested but not set, get shift automatically
973 ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCorrectEtaShiftFromPeriod(fV0Reader->GetPeriodName());
974 fProfileEtaShift[iCut]->Fill(0.,(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift()));
975 ((AliConvEventCuts*)fEventCutArray->At(iCut))->DoEtaShift(kFALSE); // Eta Shift Set, make sure that it is called only once
979 printf(" Gamma Conversion Task %s :: Eta Shift Manually Set to %f \n\n",
980 (((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber()).Data(),((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift());
981 fProfileEtaShift[iCut]->Fill(0.,(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift()));
982 ((AliConvEventCuts*)fEventCutArray->At(iCut))->DoEtaShift(kFALSE); // Eta Shift Set, make sure that it is called only once
988 //_____________________________________________________________________________
989 void AliAnalysisTaskGammaCalo::UserExec(Option_t *)
992 // Called for each event
994 Int_t eventQuality = ((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetEventQuality();
995 if(eventQuality == 2 || eventQuality == 3){// Event Not Accepted due to MC event missing or wrong trigger for V0ReaderV1
996 for(Int_t iCut = 0; iCut<fnCuts; iCut++){
997 fHistoNEvents[iCut]->Fill(eventQuality);
1002 if(fIsMC) fMCEvent = MCEvent();
1003 if(fMCEvent == NULL) fIsMC = kFALSE;
1005 fInputEvent = InputEvent();
1007 if(fIsMC && fInputEvent->IsA()==AliESDEvent::Class()){
1008 fMCStack = fMCEvent->Stack();
1009 if(fMCStack == NULL) fIsMC = kFALSE;
1012 // ------------------- BeginEvent ----------------------------
1014 AliEventplane *EventPlane = fInputEvent->GetEventplane();
1015 if(fIsHeavyIon ==1)fEventPlaneAngle = EventPlane->GetEventplane("V0",fInputEvent,2);
1016 else fEventPlaneAngle=0.0;
1018 for(Int_t iCut = 0; iCut<fnCuts; iCut++){
1021 Int_t eventNotAccepted = ((AliConvEventCuts*)fEventCutArray->At(iCut))->IsEventAcceptedByCut(fV0Reader->GetEventCuts(),fInputEvent,fMCEvent,fIsHeavyIon);
1023 if(eventNotAccepted){
1024 // cout << "event rejected due to wrong trigger: " <<eventNotAccepted << endl;
1025 fHistoNEvents[iCut]->Fill(eventNotAccepted); // Check Centrality, PileUp, SDD and V0AND --> Not Accepted => eventQuality = 1
1029 if(eventQuality != 0){// Event Not Accepted
1030 //cout << "event rejected due to: " <<eventQuality << endl;
1031 fHistoNEvents[iCut]->Fill(eventQuality);
1035 fHistoNEvents[iCut]->Fill(eventQuality); // Should be 0 here
1036 fHistoNGoodESDTracks[iCut]->Fill(fV0Reader->GetNumberOfPrimaryTracks());
1037 if(((AliConvEventCuts*)fEventCutArray->At(iCut))->IsHeavyIon() == 2) fHistoNV0Tracks[iCut]->Fill(fInputEvent->GetVZEROData()->GetMTotV0A());
1038 else fHistoNV0Tracks[iCut]->Fill(fInputEvent->GetVZEROData()->GetMTotV0A()+fInputEvent->GetVZEROData()->GetMTotV0C());
1041 // Process MC Particle
1042 if(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetSignalRejection() != 0){
1043 if(fInputEvent->IsA()==AliESDEvent::Class()){
1044 ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetNotRejectedParticles(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetSignalRejection(),
1045 ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetAcceptedHeader(),
1048 else if(fInputEvent->IsA()==AliAODEvent::Class()){
1049 ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetNotRejectedParticles(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetSignalRejection(),
1050 ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetAcceptedHeader(),
1054 if(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetAcceptedHeader()){
1055 for(Int_t i = 0;i<(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetAcceptedHeader())->GetEntries();i++){
1056 TString nameBin= fHistoMCHeaders[iCut]->GetXaxis()->GetBinLabel(i+1);
1057 if (nameBin.CompareTo("")== 0){
1058 TString nameHeader = ((TObjString*)((TList*)((AliConvEventCuts*)fEventCutArray->At(iCut))
1059 ->GetAcceptedHeader())->At(i))->GetString();
1060 fHistoMCHeaders[iCut]->GetXaxis()->SetBinLabel(i+1,nameHeader.Data());
1067 if(fInputEvent->IsA()==AliESDEvent::Class())
1068 ProcessMCParticles();
1069 if(fInputEvent->IsA()==AliAODEvent::Class())
1070 ProcessAODMCParticles();
1073 // 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)
1074 ProcessClusters(); // process calo clusters
1076 fHistoNGammaCandidates[iCut]->Fill(fClusterCandidates->GetEntries());
1077 fHistoNGoodESDTracksVsNGammaCanditates[iCut]->Fill(fV0Reader->GetNumberOfPrimaryTracks(),fClusterCandidates->GetEntries());
1078 if(fDoMesonAnalysis){ // Meson Analysis
1080 CalculatePi0Candidates(); // Combine Gammas from conversion and from calo
1082 if(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->DoBGCalculation()){
1083 if(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->BackgroundHandlerType() == 0){
1084 CalculateBackground(); // Combinatorial Background
1085 UpdateEventByEventData(); // Store Event for mixed Events
1091 fClusterCandidates->Clear(); // delete cluster candidates
1094 PostData(1, fOutputContainer);
1097 //________________________________________________________________________
1098 void AliAnalysisTaskGammaCalo::ProcessClusters()
1102 nclus = fInputEvent->GetNumberOfCaloClusters();
1104 // cout << nclus << endl;
1106 if(nclus == 0) return;
1109 Double_t vertex[3] = {0};
1110 InputEvent()->GetPrimaryVertex()->GetXYZ(vertex);
1112 // Loop over EMCal clusters
1113 for(Long_t i = 0; i < nclus; i++){
1115 AliVCluster* clus = NULL;
1116 clus = fInputEvent->GetCaloCluster(i);
1117 if (!clus) continue;
1118 if(!((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelected(clus,fInputEvent,fIsMC)) continue;
1119 // TLorentzvector with cluster
1120 TLorentzVector clusterVector;
1121 clus->GetMomentum(clusterVector,vertex);
1123 TLorentzVector* tmpvec = new TLorentzVector();
1124 tmpvec->SetPxPyPzE(clusterVector.Px(),clusterVector.Py(),clusterVector.Pz(),clusterVector.E());
1126 // convert to AODConversionPhoton
1127 AliAODConversionPhoton *PhotonCandidate=new AliAODConversionPhoton(tmpvec);
1128 if(!PhotonCandidate) continue;
1130 // Flag Photon as CaloPhoton
1131 PhotonCandidate->SetIsCaloPhoton();
1132 PhotonCandidate->SetCaloClusterRef(i);
1135 Int_t* mclabelsCluster = clus->GetLabels();
1136 PhotonCandidate->SetNCaloPhotonMCLabels(clus->GetNLabels());
1137 // cout << clus->GetNLabels() << endl;
1138 if (clus->GetNLabels()>0){
1139 for (Int_t k =0; k< (Int_t)clus->GetNLabels(); k++){
1140 if (k< 20)PhotonCandidate->SetCaloPhotonMCLabel(k,mclabelsCluster[k]);
1141 // Int_t pdgCode = fMCStack->Particle(mclabelsCluster[k])->GetPdgCode();
1142 // cout << "label " << k << "\t" << mclabelsCluster[k] << " pdg code: " << pdgCode << endl;
1147 fIsFromMBHeader = kTRUE;
1148 // test whether largest contribution to cluster orginates in added signals
1149 if (fIsMC && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(PhotonCandidate->GetCaloPhotonMCLabel(0), fMCStack, fInputEvent) == 0) fIsFromMBHeader = kFALSE;
1151 if (fIsFromMBHeader)fHistoClusGammaPt[fiCut]->Fill(PhotonCandidate->Pt());
1152 fClusterCandidates->Add(PhotonCandidate); // if no second loop is required add to events good gammas
1155 if(fInputEvent->IsA()==AliESDEvent::Class()){
1156 ProcessTrueClusterCandidates(PhotonCandidate);
1158 ProcessTrueClusterCandidatesAOD(PhotonCandidate);
1167 //________________________________________________________________________
1168 void AliAnalysisTaskGammaCalo::ProcessTrueClusterCandidates(AliAODConversionPhoton *TruePhotonCandidate)
1171 TParticle *Photon = NULL;
1172 if (!TruePhotonCandidate->GetIsCaloPhoton()) AliFatal("CaloPhotonFlag has not been set task will abort");
1173 fHistoTrueNLabelsInClus[fiCut]->Fill(TruePhotonCandidate->GetNCaloPhotonMCLabels());
1175 if (TruePhotonCandidate->GetNCaloPhotonMCLabels()>0)Photon = fMCStack->Particle(TruePhotonCandidate->GetCaloPhotonMCLabel(0));
1179 // cout << "no photon" << endl;
1183 Int_t pdgCodeParticle = Photon->GetPdgCode();
1184 TruePhotonCandidate->SetCaloPhotonMCFlags(fMCStack);
1187 if(fIsFromMBHeader){
1188 if (TruePhotonCandidate->IsLargestComponentPhoton() || TruePhotonCandidate->IsLargestComponentElectron() )fHistoTrueClusGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1189 else fHistoTrueClusEMNonLeadingPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1190 if (fDoClusterQA > 0){
1191 if (TruePhotonCandidate->IsLargestComponentPhoton()){
1192 fHistoTrueClusUnConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1193 fHistoTrueClusUnConvGammaMCPt[fiCut]->Fill(Photon->Pt());
1195 if (TruePhotonCandidate->IsLargestComponentElectron())
1196 fHistoTrueClusElectronPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1197 if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion()){
1198 fHistoTrueClusConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1199 fHistoTrueClusConvGammaMCPt[fiCut]->Fill(((TParticle*)fMCStack->Particle(Photon->GetMother(0)))->Pt());
1201 if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion() && TruePhotonCandidate->IsConversionFullyContained())
1202 fHistoTrueClusConvGammaFullyPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1203 if (TruePhotonCandidate->IsMerged() || TruePhotonCandidate->IsMergedPartConv() || TruePhotonCandidate->IsDalitzMerged())
1204 fHistoTrueClusMergedGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1205 if (TruePhotonCandidate->IsMergedPartConv())
1206 fHistoTrueClusMergedPartConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1207 if (TruePhotonCandidate->IsDalitz())
1208 fHistoTrueClusDalitzPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1209 if (TruePhotonCandidate->IsDalitzMerged())
1210 fHistoTrueClusDalitzMergedPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1211 if (TruePhotonCandidate->IsPhotonWithElecMother())
1212 fHistoTrueClusPhotonFromElecMotherPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1213 if (TruePhotonCandidate->IsShower())
1214 fHistoTrueClusShowerPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1215 if (TruePhotonCandidate->IsSubLeadingEM())
1216 fHistoTrueClusSubLeadingPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1217 fHistoTrueClusNParticles[fiCut]->Fill(TruePhotonCandidate->GetNCaloPhotonMotherMCLabels());
1218 if (!TruePhotonCandidate->IsLargestComponentPhoton())
1219 FillPhotonBackgroundHist(TruePhotonCandidate,pdgCodeParticle);
1220 if (!(TruePhotonCandidate->IsLargestComponentPhoton() || (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion())) )
1221 FillPhotonPlusConversionBackgroundHist(TruePhotonCandidate,pdgCodeParticle);
1224 if(Photon->GetMother(0) <= fMCStack->GetNprimary()){
1225 if (TruePhotonCandidate->IsLargestComponentPhoton()){
1226 fHistoTruePrimaryClusGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1227 fHistoTruePrimaryClusGammaESDPtMCPt[fiCut]->Fill(TruePhotonCandidate->Pt(),Photon->Pt()); // Allways Filled
1229 if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion()){
1230 fHistoTruePrimaryClusConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1231 fHistoTruePrimaryClusConvGammaESDPtMCPt[fiCut]->Fill(TruePhotonCandidate->Pt(),Photon->Pt()); // Allways Filled
1235 if (TruePhotonCandidate->IsLargestComponentPhoton())
1236 fHistoTrueSecondaryClusGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1237 if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion())
1238 fHistoTrueSecondaryClusConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1239 if(fMCStack->Particle(Photon->GetMother(0))->GetMother(0) > -1){
1240 if(fMCStack->Particle(fMCStack->Particle(Photon->GetMother(0))->GetMother(0))->GetPdgCode() == 3122){
1241 if (TruePhotonCandidate->IsLargestComponentPhoton())
1242 fHistoTrueSecondaryClusGammaFromXFromLambdaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1243 if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion())
1244 fHistoTrueSecondaryClusConvGammaFromXFromLambdaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1246 if(fMCStack->Particle(fMCStack->Particle(Photon->GetMother(0))->GetMother(0))->GetPdgCode() == 310){
1247 if (TruePhotonCandidate->IsLargestComponentPhoton())
1248 fHistoTrueSecondaryClusGammaFromXFromK0sPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1249 if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion())
1250 fHistoTrueSecondaryClusConvGammaFromXFromK0sPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1252 if(fMCStack->Particle(fMCStack->Particle(Photon->GetMother(0))->GetMother(0))->GetPdgCode() == 221){
1253 if (TruePhotonCandidate->IsLargestComponentPhoton())
1254 fHistoTrueSecondaryClusGammaFromXFromEtasPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1255 if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion())
1256 fHistoTrueSecondaryClusConvGammaFromXFromEtasPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1266 //________________________________________________________________________
1267 void AliAnalysisTaskGammaCalo::ProcessTrueClusterCandidatesAOD(AliAODConversionPhoton *TruePhotonCandidate)
1269 AliAODMCParticle *Photon = NULL;
1270 TClonesArray *AODMCTrackArray = dynamic_cast<TClonesArray*>(fInputEvent->FindListObject(AliAODMCParticle::StdBranchName()));
1271 if (AODMCTrackArray){
1272 if (!TruePhotonCandidate->GetIsCaloPhoton()) AliFatal("CaloPhotonFlag has not been set task will abort");
1273 if (TruePhotonCandidate->GetNCaloPhotonMCLabels()>0) Photon = (AliAODMCParticle*) AODMCTrackArray->At(TruePhotonCandidate->GetCaloPhotonMCLabel(0));
1276 AliInfo("AODMCTrackArray could not be loaded");
1281 // cout << "no photon" << endl;
1284 Int_t pdgCodeParticle = Photon->GetPdgCode();
1285 TruePhotonCandidate->SetCaloPhotonMCFlagsAOD(fInputEvent);
1288 if(fIsFromMBHeader){
1289 if (TruePhotonCandidate->IsLargestComponentPhoton() || TruePhotonCandidate->IsLargestComponentElectron() )fHistoTrueClusGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1290 else fHistoTrueClusEMNonLeadingPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1291 if (fDoClusterQA > 0){
1292 if (TruePhotonCandidate->IsLargestComponentPhoton()) {
1293 fHistoTrueClusUnConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1294 fHistoTrueClusUnConvGammaMCPt[fiCut]->Fill(Photon->Pt());
1296 if (TruePhotonCandidate->IsLargestComponentElectron())
1297 fHistoTrueClusElectronPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1298 if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion()) {
1299 fHistoTrueClusConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1300 AliAODMCParticle *Mother = (AliAODMCParticle*) AODMCTrackArray->At(Photon->GetMother());
1301 fHistoTrueClusConvGammaMCPt[fiCut]->Fill(Mother->Pt());
1303 if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion() && TruePhotonCandidate->IsConversionFullyContained())
1304 fHistoTrueClusConvGammaFullyPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1305 if (TruePhotonCandidate->IsMerged() || TruePhotonCandidate->IsMergedPartConv() || TruePhotonCandidate->IsDalitzMerged())
1306 fHistoTrueClusMergedGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1307 if (TruePhotonCandidate->IsMergedPartConv())
1308 fHistoTrueClusMergedPartConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1309 if (TruePhotonCandidate->IsDalitz())
1310 fHistoTrueClusDalitzPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1311 if (TruePhotonCandidate->IsDalitzMerged())
1312 fHistoTrueClusDalitzMergedPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1313 if (TruePhotonCandidate->IsPhotonWithElecMother())
1314 fHistoTrueClusPhotonFromElecMotherPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1315 if (TruePhotonCandidate->IsShower())
1316 fHistoTrueClusShowerPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1317 if (TruePhotonCandidate->IsSubLeadingEM())
1318 fHistoTrueClusSubLeadingPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1319 fHistoTrueClusNParticles[fiCut]->Fill(TruePhotonCandidate->GetNCaloPhotonMotherMCLabels());
1321 if (!TruePhotonCandidate->IsLargestComponentPhoton())
1322 FillPhotonBackgroundHist(TruePhotonCandidate,pdgCodeParticle);
1323 if (!(TruePhotonCandidate->IsLargestComponentPhoton() || (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion())) )
1324 FillPhotonPlusConversionBackgroundHist(TruePhotonCandidate,pdgCodeParticle);
1327 if(Photon->IsPrimary()){
1328 if (TruePhotonCandidate->IsLargestComponentPhoton()){
1329 fHistoTruePrimaryClusGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1330 fHistoTruePrimaryClusGammaESDPtMCPt[fiCut]->Fill(TruePhotonCandidate->Pt(),Photon->Pt()); // Allways Filled
1332 if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion()){
1333 fHistoTruePrimaryClusConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1334 fHistoTruePrimaryClusConvGammaESDPtMCPt[fiCut]->Fill(TruePhotonCandidate->Pt(),Photon->Pt()); // Allways Filled
1338 if (TruePhotonCandidate->IsLargestComponentPhoton())
1339 fHistoTrueSecondaryClusGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1340 if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion())
1341 fHistoTrueSecondaryClusConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1342 if(((AliAODMCParticle*)AODMCTrackArray->At(Photon->GetMother()))->GetMother() > -1){
1343 if(((AliAODMCParticle*)AODMCTrackArray->At(((AliAODMCParticle*)AODMCTrackArray->At(Photon->GetMother()))->GetMother()))->GetPdgCode() == 3122){
1344 if (TruePhotonCandidate->IsLargestComponentPhoton())
1345 fHistoTrueSecondaryClusGammaFromXFromLambdaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1346 if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion())
1347 fHistoTrueSecondaryClusConvGammaFromXFromLambdaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1349 if(((AliAODMCParticle*)AODMCTrackArray->At(((AliAODMCParticle*)AODMCTrackArray->At(Photon->GetMother()))->GetMother()))->GetPdgCode() == 310){
1350 if (TruePhotonCandidate->IsLargestComponentPhoton())
1351 fHistoTrueSecondaryClusGammaFromXFromK0sPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1352 if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion())
1353 fHistoTrueSecondaryClusConvGammaFromXFromK0sPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1355 if(((AliAODMCParticle*)AODMCTrackArray->At(((AliAODMCParticle*)AODMCTrackArray->At(Photon->GetMother()))->GetMother()))->GetPdgCode() == 221){
1356 if (TruePhotonCandidate->IsLargestComponentPhoton())
1357 fHistoTrueSecondaryClusGammaFromXFromEtasPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1358 if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion())
1359 fHistoTrueSecondaryClusConvGammaFromXFromEtasPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1367 //________________________________________________________________________
1368 void AliAnalysisTaskGammaCalo::ProcessAODMCParticles()
1371 TClonesArray *AODMCTrackArray = dynamic_cast<TClonesArray*>(fInputEvent->FindListObject(AliAODMCParticle::StdBranchName()));
1373 // Loop over all primary MC particle
1374 for(Int_t i = 0; i < AODMCTrackArray->GetEntriesFast(); i++) {
1376 AliAODMCParticle* particle = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(i));
1377 if (!particle) continue;
1378 if (!particle->IsPrimary()) continue;
1380 Int_t isMCFromMBHeader = -1;
1381 if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 0){
1382 isMCFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCStack, fInputEvent);
1383 if(isMCFromMBHeader == 0 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 3) continue;
1386 if(((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedAODMC(particle,AODMCTrackArray)){
1387 fHistoMCAllGammaPt[fiCut]->Fill(particle->Pt()); // All MC Gamma
1388 if(particle->GetMother() >-1){ // Meson Decay Gamma
1389 switch((static_cast<AliAODMCParticle*>(AODMCTrackArray->At(particle->GetMother())))->GetPdgCode()){
1391 fHistoMCDecayGammaPi0Pt[fiCut]->Fill(particle->Pt());
1394 fHistoMCDecayGammaRhoPt[fiCut]->Fill(particle->Pt());
1397 fHistoMCDecayGammaEtaPt[fiCut]->Fill(particle->Pt());
1400 fHistoMCDecayGammaOmegaPt[fiCut]->Fill(particle->Pt());
1403 fHistoMCDecayGammaEtapPt[fiCut]->Fill(particle->Pt());
1406 fHistoMCDecayGammaPhiPt[fiCut]->Fill(particle->Pt());
1409 fHistoMCDecayGammaSigmaPt[fiCut]->Fill(particle->Pt());
1414 // Converted MC Gamma
1415 if(fDoMesonAnalysis){
1416 if(particle->GetPdgCode() == 310 && fDoMesonQA > 0){
1417 Double_t mesonY = 10.;
1418 if(particle->E() - particle->Pz() == 0 || particle->E() + particle->Pz() == 0){
1419 mesonY=10.-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
1421 mesonY = 0.5*(TMath::Log((particle->E()+particle->Pz()) / (particle->E()-particle->Pz())))-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
1423 Float_t weightedK0s= 1;
1424 if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCStack, fInputEvent)){
1425 if (particle->Pt()>0.005){
1426 weightedK0s= ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetWeightForMeson(fV0Reader->GetPeriodName(),i, 0x0, fInputEvent);
1427 //cout << "MC input \t"<<i << "\t" << particle->Pt()<<"\t"<<weighted << endl;
1430 fHistoMCK0sPt[fiCut]->Fill(particle->Pt(),weightedK0s);
1431 fHistoMCK0sWOWeightPt[fiCut]->Fill(particle->Pt());
1432 fHistoMCK0sPtY[fiCut]->Fill(particle->Pt(),mesonY,weightedK0s);
1434 if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))
1435 ->MesonIsSelectedAODMC(particle,AODMCTrackArray,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift())){
1436 AliAODMCParticle* daughter0 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(particle->GetDaughter(0)));
1437 AliAODMCParticle* daughter1 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(particle->GetDaughter(1)));
1438 Float_t weighted= 1;
1439 if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCStack, fInputEvent)){
1440 if (particle->Pt()>0.005){
1441 weighted= ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetWeightForMeson(fV0Reader->GetPeriodName(),i, 0x0, fInputEvent);
1442 // if(particle->GetPdgCode() == 221){
1443 // cout << "MC input \t"<<i << "\t" << particle->Pt()<<"\t"<<weighted << endl;
1447 Double_t mesonY = 10.;
1448 if(particle->E() - particle->Pz() == 0 || particle->E() + particle->Pz() == 0){
1449 mesonY=10.-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
1451 mesonY = 0.5*(TMath::Log((particle->E()+particle->Pz()) / (particle->E()-particle->Pz())))-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
1454 if(particle->GetPdgCode() == 111){
1455 fHistoMCPi0Pt[fiCut]->Fill(particle->Pt(),weighted); // All MC Pi0
1456 fHistoMCPi0WOWeightPt[fiCut]->Fill(particle->Pt());
1457 if (fDoMesonQA > 0) fHistoMCPi0PtY[fiCut]->Fill(particle->Pt(),mesonY,weighted); // All MC Pi0
1458 } else if(particle->GetPdgCode() == 221){
1459 fHistoMCEtaPt[fiCut]->Fill(particle->Pt(),weighted); // All MC Eta
1460 fHistoMCEtaWOWeightPt[fiCut]->Fill(particle->Pt());
1461 if (fDoMesonQA > 0) fHistoMCEtaPtY[fiCut]->Fill(particle->Pt(),mesonY,weighted); // All MC Pi0
1464 // Check the acceptance for both gammas
1465 if(((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedAODMC(daughter0,AODMCTrackArray) &&
1466 ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedAODMC(daughter1,AODMCTrackArray) ){
1468 if(particle->GetPdgCode() == 111){
1469 fHistoMCPi0InAccPt[fiCut]->Fill(particle->Pt(),weighted); // MC Pi0 with gamma in acc
1470 } else if(particle->GetPdgCode() == 221){
1471 fHistoMCEtaInAccPt[fiCut]->Fill(particle->Pt(),weighted); // MC Eta with gamma in acc
1479 //________________________________________________________________________
1480 void AliAnalysisTaskGammaCalo::ProcessMCParticles()
1482 // Loop over all primary MC particle
1483 for(Int_t i = 0; i < fMCStack->GetNprimary(); i++) {
1484 TParticle* particle = (TParticle *)fMCStack->Particle(i);
1485 if (!particle) continue;
1487 Int_t isMCFromMBHeader = -1;
1488 if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 0){
1489 isMCFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCStack, fInputEvent);
1490 if(isMCFromMBHeader == 0 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 3) continue;
1493 if(((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedMC(particle,fMCStack)){
1494 fHistoMCAllGammaPt[fiCut]->Fill(particle->Pt()); // All MC Gamma
1495 if(particle->GetMother(0) >-1){ // Meson Decay Gamma
1496 switch(fMCStack->Particle(particle->GetMother(0))->GetPdgCode()){
1498 fHistoMCDecayGammaPi0Pt[fiCut]->Fill(particle->Pt());
1501 fHistoMCDecayGammaRhoPt[fiCut]->Fill(particle->Pt());
1504 fHistoMCDecayGammaEtaPt[fiCut]->Fill(particle->Pt());
1507 fHistoMCDecayGammaOmegaPt[fiCut]->Fill(particle->Pt());
1510 fHistoMCDecayGammaEtapPt[fiCut]->Fill(particle->Pt());
1513 fHistoMCDecayGammaPhiPt[fiCut]->Fill(particle->Pt());
1516 fHistoMCDecayGammaSigmaPt[fiCut]->Fill(particle->Pt());
1521 if(fDoMesonAnalysis){
1522 if(particle->GetPdgCode() == 310 && fDoMesonQA > 0){
1523 Double_t mesonY = 10.;
1524 if(particle->Energy() - particle->Pz() == 0 || particle->Energy() + particle->Pz() == 0){
1525 mesonY=10.-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
1527 mesonY = 0.5*(TMath::Log((particle->Energy()+particle->Pz()) / (particle->Energy()-particle->Pz())))-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
1529 Float_t weightedK0s= 1;
1530 if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCStack, fInputEvent)){
1531 if (particle->Pt()>0.005){
1532 weightedK0s= ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetWeightForMeson(fV0Reader->GetPeriodName(),i, fMCStack, fInputEvent);
1533 //cout << "MC input \t"<<i << "\t" << particle->Pt()<<"\t"<<weighted << endl;
1536 if (fMCStack->IsPhysicalPrimary(i)){
1537 fHistoMCK0sPt[fiCut]->Fill(particle->Pt(),weightedK0s);
1538 fHistoMCK0sWOWeightPt[fiCut]->Fill(particle->Pt());
1539 fHistoMCK0sPtY[fiCut]->Fill(particle->Pt(),mesonY,weightedK0s);
1542 if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))
1543 ->MesonIsSelectedMC(particle,fMCStack,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift())){
1544 TParticle* daughter0 = (TParticle*)fMCStack->Particle(particle->GetFirstDaughter());
1545 TParticle* daughter1 = (TParticle*)fMCStack->Particle(particle->GetLastDaughter());
1547 Float_t weighted= 1;
1548 if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCStack, fInputEvent)){
1549 if (particle->Pt()>0.005){
1550 weighted= ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetWeightForMeson(fV0Reader->GetPeriodName(),i, fMCStack, fInputEvent);
1551 // if(particle->GetPdgCode() == 221){
1552 // cout << "MC input \t"<<i << "\t" << particle->Pt()<<"\t"<<weighted << endl;
1556 Double_t mesonY = 10.;
1557 if(particle->Energy() - particle->Pz() == 0 || particle->Energy() + particle->Pz() == 0){
1558 mesonY=10.-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
1560 mesonY = 0.5*(TMath::Log((particle->Energy()+particle->Pz()) / (particle->Energy()-particle->Pz())))-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
1563 if(particle->GetPdgCode() == 111){
1564 fHistoMCPi0Pt[fiCut]->Fill(particle->Pt(),weighted); // All MC Pi0
1565 fHistoMCPi0WOWeightPt[fiCut]->Fill(particle->Pt());
1566 if (fDoMesonQA > 0) fHistoMCPi0PtY[fiCut]->Fill(particle->Pt(),mesonY,weighted); // All MC Pi0
1567 } else if(particle->GetPdgCode() == 221){
1568 fHistoMCEtaPt[fiCut]->Fill(particle->Pt(),weighted); // All MC Eta
1569 fHistoMCEtaWOWeightPt[fiCut]->Fill(particle->Pt());
1570 if (fDoMesonQA > 0) fHistoMCEtaPtY[fiCut]->Fill(particle->Pt(),mesonY,weighted); // All MC Pi0
1573 // Check the acceptance for both gammas
1574 if(((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedMC(daughter0,fMCStack) &&
1575 ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedMC(daughter1,fMCStack) ){
1576 if(particle->GetPdgCode() == 111){
1577 fHistoMCPi0InAccPt[fiCut]->Fill(particle->Pt(),weighted); // MC Pi0 with gamma in acc
1578 } else if(particle->GetPdgCode() == 221){
1579 fHistoMCEtaInAccPt[fiCut]->Fill(particle->Pt(),weighted); // MC Eta with gamma in acc
1587 for(Int_t i = fMCStack->GetNprimary(); i < fMCStack->GetNtrack(); i++) {
1588 TParticle* particle = (TParticle *)fMCStack->Particle(i);
1589 if (!particle) continue;
1591 Int_t isMCFromMBHeader = -1;
1592 if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 0){
1593 isMCFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCStack, fInputEvent);
1594 if(isMCFromMBHeader == 0 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 3) continue;
1597 if(fDoMesonAnalysis){
1598 if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->MesonIsSelectedMC(particle,fMCStack,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift())){
1599 Float_t weighted= 1;
1600 if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCStack, fInputEvent)){
1601 if (particle->Pt()>0.005){
1602 weighted= ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetWeightForMeson(fV0Reader->GetPeriodName(),i, fMCStack, fInputEvent);
1603 // if(particle->GetPdgCode() == 221){
1604 // cout << "MC input \t"<<i << "\t" << particle->Pt()<<"\t"<<weighted << endl;
1609 if(particle->GetPdgCode() == 111){
1610 Int_t pdgCode = ((TParticle*)fMCStack->Particle( particle->GetFirstMother() ))->GetPdgCode();
1611 Int_t source = GetSourceClassification(111,pdgCode);
1612 fHistoMCSecPi0PtvsSource[fiCut]->Fill(particle->Pt(),source,weighted); // All MC Pi0
1613 fHistoMCSecPi0Source[fiCut]->Fill(pdgCode);
1614 } else if(particle->GetPdgCode() == 221){
1615 Int_t pdgCode = ((TParticle*)fMCStack->Particle( particle->GetFirstMother() ))->GetPdgCode();
1616 fHistoMCSecEtaPt[fiCut]->Fill(particle->Pt(),weighted); // All MC Pi0
1617 fHistoMCSecEtaSource[fiCut]->Fill(pdgCode);
1625 //________________________________________________________________________
1626 void AliAnalysisTaskGammaCalo::CalculatePi0Candidates(){
1628 // Conversion Gammas
1629 if(fClusterCandidates->GetEntries()>0){
1632 Double_t vertex[3] = {0};
1633 InputEvent()->GetPrimaryVertex()->GetXYZ(vertex);
1635 for(Int_t firstGammaIndex=0;firstGammaIndex<fClusterCandidates->GetEntries();firstGammaIndex++){
1636 AliAODConversionPhoton *gamma0=dynamic_cast<AliAODConversionPhoton*>(fClusterCandidates->At(firstGammaIndex));
1637 if (gamma0==NULL) continue;
1639 for(Int_t secondGammaIndex=0;secondGammaIndex<fClusterCandidates->GetEntries();secondGammaIndex++){
1640 if (firstGammaIndex == secondGammaIndex) continue;
1641 AliAODConversionPhoton *gamma1=dynamic_cast<AliAODConversionPhoton*>(fClusterCandidates->At(secondGammaIndex));
1642 if (gamma1==NULL) continue;
1644 AliAODConversionMother *pi0cand = new AliAODConversionMother(gamma0,gamma1);
1645 pi0cand->SetLabels(firstGammaIndex,secondGammaIndex);
1649 if((((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->MesonIsSelected(pi0cand,kTRUE,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift()))){
1650 fHistoMotherInvMassPt[fiCut]->Fill(pi0cand->M(),pi0cand->Pt());
1651 // fill new histograms
1652 if(pi0cand->GetAlpha()<0.1)
1653 fHistoMotherInvMassEalpha[fiCut]->Fill(pi0cand->M(),pi0cand->E());
1655 if (fDoMesonQA > 0){
1656 if ( pi0cand->M() > 0.05 && pi0cand->M() < 0.17){
1657 fHistoMotherPi0PtY[fiCut]->Fill(pi0cand->Pt(),pi0cand->Rapidity()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift());
1658 fHistoMotherPi0PtAlpha[fiCut]->Fill(pi0cand->Pt(),pi0cand->GetAlpha());
1659 fHistoMotherPi0PtOpenAngle[fiCut]->Fill(pi0cand->Pt(),pi0cand->GetOpeningAngle());
1661 if ( pi0cand->M() > 0.45 && pi0cand->M() < 0.65){
1662 fHistoMotherEtaPtY[fiCut]->Fill(pi0cand->Pt(),pi0cand->Rapidity()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift());
1663 fHistoMotherEtaPtAlpha[fiCut]->Fill(pi0cand->Pt(),pi0cand->GetAlpha());
1664 fHistoMotherEtaPtOpenAngle[fiCut]->Fill(pi0cand->Pt(),pi0cand->GetOpeningAngle());
1667 if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->DoBGCalculation()){
1671 if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->BackgroundHandlerType() == 0){
1672 zbin = fBGHandler[fiCut]->GetZBinIndex(fInputEvent->GetPrimaryVertex()->GetZ());
1673 if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->UseTrackMultiplicity()){
1674 mbin = fBGHandler[fiCut]->GetMultiplicityBinIndex(fV0Reader->GetNumberOfPrimaryTracks());
1676 mbin = fBGHandler[fiCut]->GetMultiplicityBinIndex(fClusterCandidates->GetEntries());
1679 Double_t sparesFill[4] = {pi0cand->M(),pi0cand->Pt(),(Double_t)zbin,(Double_t)mbin};
1680 fSparseMotherInvMassPtZM[fiCut]->Fill(sparesFill,1);
1684 if(fInputEvent->IsA()==AliESDEvent::Class())
1685 ProcessTrueMesonCandidates(pi0cand,gamma0,gamma1);
1686 if(fInputEvent->IsA()==AliAODEvent::Class())
1687 ProcessTrueMesonCandidatesAOD(pi0cand,gamma0,gamma1);
1690 if (fDoMesonQA == 1){
1691 fHistoMotherInvMassECalib[fiCut]->Fill(pi0cand->M(),gamma1->E());
1692 if(pi0cand->GetAlpha()<0.1)
1693 fHistoMotherInvMassECalibalpha[fiCut]->Fill(pi0cand->M(),gamma1->E());
1697 for (Int_t thirdGammaIndex=0;thirdGammaIndex<fClusterCandidates->GetEntries();thirdGammaIndex++){
1698 if (firstGammaIndex == thirdGammaIndex || secondGammaIndex == thirdGammaIndex ) continue;
1699 AliAODConversionPhoton *gamma2=dynamic_cast<AliAODConversionPhoton*>(fClusterCandidates->At(thirdGammaIndex));
1700 if (gamma2==NULL) continue;
1702 AliAODConversionMother *pi0cand2 = new AliAODConversionMother(pi0cand,gamma2);
1703 if((((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->MesonIsSelected(pi0cand2,kTRUE,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift()))){
1704 fHistoMotherInvMass3ClusterPt[fiCut]->Fill(pi0cand2->M(),pi0cand2->Pt());
1717 //______________________________________________________________________
1718 void AliAnalysisTaskGammaCalo::ProcessTrueMesonCandidates(AliAODConversionMother *Pi0Candidate, AliAODConversionPhoton *TrueGammaCandidate0, AliAODConversionPhoton *TrueGammaCandidate1)
1720 // Process True Mesons
1721 AliStack *MCStack = fMCEvent->Stack();
1723 Bool_t isTruePi0 = kFALSE;
1724 Bool_t isTrueEta = kFALSE;
1725 Int_t gamma0MCLabel = TrueGammaCandidate0->GetCaloPhotonMCLabel(0); // get most probable MC label
1726 Int_t gamma0MotherLabel = -1;
1728 if(gamma0MCLabel != -1){ // Gamma is Combinatorial; MC Particles don't belong to the same Mother
1729 TParticle * gammaMC0 = (TParticle*)MCStack->Particle(gamma0MCLabel);
1730 if (TrueGammaCandidate0->IsLargestComponentPhoton() || TrueGammaCandidate0->IsLargestComponentElectron()){ // largest component is electro magnetic
1731 // get mother of interest (pi0 or eta)
1732 if (TrueGammaCandidate0->IsLargestComponentPhoton()){ // for photons its the direct mother
1733 gamma0MotherLabel=gammaMC0->GetMother(0);
1734 } else if (TrueGammaCandidate0->IsLargestComponentElectron()){ // for electrons its either the direct mother or for conversions the grandmother
1735 if (TrueGammaCandidate0->IsConversion()) gamma0MotherLabel=MCStack->Particle(gammaMC0->GetMother(0))->GetMother(0);
1736 else gamma0MotherLabel=gammaMC0->GetMother(0);
1740 if (!TrueGammaCandidate1->GetIsCaloPhoton()) AliFatal("CaloPhotonFlag has not been set. Aborting");
1742 Int_t gamma1MCLabel = TrueGammaCandidate1->GetCaloPhotonMCLabel(0); // get most probable MC label
1743 Int_t gamma1MotherLabel = -1;
1746 if(gamma1MCLabel != -1){ // Gamma is Combinatorial; MC Particles don't belong to the same Mother
1747 // Daughters Gamma 1
1748 TParticle * gammaMC1 = (TParticle*)MCStack->Particle(gamma1MCLabel);
1749 if (TrueGammaCandidate1->IsLargestComponentPhoton() || TrueGammaCandidate1->IsLargestComponentElectron()){ // largest component is electro magnetic
1750 // get mother of interest (pi0 or eta)
1751 if (TrueGammaCandidate1->IsLargestComponentPhoton()){ // for photons its the direct mother
1752 gamma1MotherLabel=gammaMC1->GetMother(0);
1753 } else if (TrueGammaCandidate1->IsLargestComponentElectron()){ // for electrons its either the direct mother or for conversions the grandmother
1754 if (TrueGammaCandidate1->IsConversion()) gamma1MotherLabel=MCStack->Particle(gammaMC1->GetMother(0))->GetMother(0);
1755 else gamma1MotherLabel=gammaMC1->GetMother(0);
1760 if(gamma0MotherLabel>=0 && gamma0MotherLabel==gamma1MotherLabel){
1761 if(((TParticle*)MCStack->Particle(gamma1MotherLabel))->GetPdgCode() == 111){
1764 if(((TParticle*)MCStack->Particle(gamma1MotherLabel))->GetPdgCode() == 221){
1769 if(isTruePi0 || isTrueEta){// True Pion or Eta
1770 fHistoTrueMotherInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
1771 if (fDoMesonQA > 0){
1772 // both gammas are real gammas
1773 if (TrueGammaCandidate0->IsLargestComponentPhoton() && TrueGammaCandidate1->IsLargestComponentPhoton())
1774 fHistoTrueMotherCaloPhotonInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
1775 // both particles are electrons
1776 if (TrueGammaCandidate0->IsLargestComponentElectron() && TrueGammaCandidate1->IsLargestComponentElectron() )
1777 fHistoTrueMotherCaloElectronInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
1778 // both particles are converted electrons
1779 if ((TrueGammaCandidate0->IsLargestComponentElectron() && TrueGammaCandidate0->IsConversion()) && (TrueGammaCandidate1->IsLargestComponentElectron() && TrueGammaCandidate1->IsConversion()) ){
1780 fHistoTrueMotherCaloConvertedPhotonInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
1781 if (isTruePi0 )fHistoTruePi0CaloConvertedPhotonInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
1782 if (isTrueEta )fHistoTrueEtaCaloConvertedPhotonInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
1784 // 1 gamma is converted the other one is normals
1785 if ( (TrueGammaCandidate0->IsLargestComponentPhoton() && TrueGammaCandidate1->IsLargestComponentElectron() && TrueGammaCandidate1->IsConversion()) ||
1786 (TrueGammaCandidate1->IsLargestComponentPhoton() && TrueGammaCandidate0->IsLargestComponentElectron() && TrueGammaCandidate0->IsConversion())
1788 fHistoTrueMotherCaloMixedPhotonConvPhotonInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
1790 // at least one of the photon is merged
1791 if (TrueGammaCandidate0->IsMerged() || TrueGammaCandidate0->IsMergedPartConv() || TrueGammaCandidate0->IsDalitzMerged() || TrueGammaCandidate1->IsMerged() || TrueGammaCandidate1->IsMergedPartConv() || TrueGammaCandidate1->IsDalitzMerged() )
1792 fHistoTrueMotherCaloMergedClusterInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
1793 // at least one of the photon is merged and part conv
1794 if (TrueGammaCandidate1->IsMergedPartConv() || TrueGammaCandidate0->IsMergedPartConv())
1795 fHistoTrueMotherCaloMergedClusterPartConvInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
1798 if (fDoMesonQA > 0){
1800 if ( Pi0Candidate->M() > 0.05 && Pi0Candidate->M() < 0.17){
1801 fHistoTruePi0PtY[fiCut]->Fill(Pi0Candidate->Pt(),Pi0Candidate->Rapidity()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift());
1802 fHistoTruePi0PtAlpha[fiCut]->Fill(Pi0Candidate->Pt(),Pi0Candidate->GetAlpha());
1803 fHistoTruePi0PtOpenAngle[fiCut]->Fill(Pi0Candidate->Pt(),Pi0Candidate->GetOpeningAngle());
1805 } else if (isTrueEta){
1806 if ( Pi0Candidate->M() > 0.45 && Pi0Candidate->M() < 0.65){
1807 fHistoTrueEtaPtY[fiCut]->Fill(Pi0Candidate->Pt(),Pi0Candidate->Rapidity()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift());
1808 fHistoTrueEtaPtAlpha[fiCut]->Fill(Pi0Candidate->Pt(),Pi0Candidate->GetAlpha());
1809 fHistoTrueEtaPtOpenAngle[fiCut]->Fill(Pi0Candidate->Pt(),Pi0Candidate->GetOpeningAngle());
1814 if(gamma0MotherLabel >= MCStack->GetNprimary()){ // Secondary Meson
1815 Int_t secMotherLabel = ((TParticle*)MCStack->Particle(gamma0MotherLabel))->GetMother(0);
1816 Float_t weightedSec= 1;
1817 if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(secMotherLabel, fMCStack, fInputEvent) && MCStack->Particle(secMotherLabel)->GetPdgCode()==310){
1818 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
1819 //cout << "MC input \t"<<i << "\t" << particle->Pt()<<"\t"<<weighted << endl;
1821 fHistoTrueSecondaryMotherInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weightedSec);
1822 if (secMotherLabel >-1){
1823 if(MCStack->Particle(secMotherLabel)->GetPdgCode()==310){
1824 fHistoTrueSecondaryMotherFromK0sInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weightedSec);
1825 if (fDoMesonQA > 0)fHistoTrueK0sWithPi0DaughterMCPt[fiCut]->Fill(MCStack->Particle(secMotherLabel)->Pt());
1827 if(MCStack->Particle(secMotherLabel)->GetPdgCode()==221){
1828 fHistoTrueSecondaryMotherFromEtaInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weightedSec);
1829 if (fDoMesonQA > 0)fHistoTrueEtaWithPi0DaughterMCPt[fiCut]->Fill(MCStack->Particle(secMotherLabel)->Pt());
1831 if(MCStack->Particle(secMotherLabel)->GetPdgCode()==3122){
1832 fHistoTrueSecondaryMotherFromLambdaInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weightedSec);
1833 if (fDoMesonQA > 0)fHistoTrueLambdaWithPi0DaughterMCPt[fiCut]->Fill(MCStack->Particle(secMotherLabel)->Pt());
1836 } else { // Only primary pi0 for efficiency calculation
1837 Float_t weighted= 1;
1838 if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(gamma1MotherLabel, fMCStack, fInputEvent)){
1839 if (((TParticle*)MCStack->Particle(gamma1MotherLabel))->Pt()>0.005){
1840 weighted= ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetWeightForMeson(fV0Reader->GetPeriodName(),gamma1MotherLabel, fMCStack, fInputEvent);
1841 // cout << "rec \t " <<gamma1MotherLabel << "\t" << weighted << endl;
1844 fHistoTruePrimaryMotherInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weighted);
1845 fHistoTruePrimaryMotherW0WeightingInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
1846 fProfileTruePrimaryMotherWeightsInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weighted);
1848 if (fDoMesonQA > 0){
1849 if(isTruePi0){ // Only primary pi0 for resolution
1850 fHistoTruePrimaryPi0MCPtResolPt[fiCut]->Fill(((TParticle*)MCStack->Particle(gamma1MotherLabel))->Pt(),(Pi0Candidate->Pt()-((TParticle*)MCStack->Particle(gamma1MotherLabel))->Pt())/((TParticle*)MCStack->Particle(gamma1MotherLabel))->Pt(),weighted);
1852 if (isTrueEta){ // Only primary eta for resolution
1853 fHistoTruePrimaryEtaMCPtResolPt[fiCut]->Fill(((TParticle*)MCStack->Particle(gamma1MotherLabel))->Pt(),(Pi0Candidate->Pt()-((TParticle*)MCStack->Particle(gamma1MotherLabel))->Pt())/((TParticle*)MCStack->Particle(gamma1MotherLabel))->Pt(),weighted);
1857 } else if(!isTruePi0 && !isTrueEta){ // Background
1858 if (fDoMesonQA > 0){
1859 if(gamma0MotherLabel>-1 && gamma1MotherLabel>-1){ // Both Tracks are Photons and have a mother but not Pi0 or Eta
1860 fHistoTrueBckGGInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
1861 } else { // No photon or without mother
1862 fHistoTrueBckContInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
1868 //______________________________________________________________________
1869 void AliAnalysisTaskGammaCalo::ProcessTrueMesonCandidatesAOD(AliAODConversionMother *Pi0Candidate, AliAODConversionPhoton *TrueGammaCandidate0, AliAODConversionPhoton *TrueGammaCandidate1)
1872 // Process True Mesons
1873 TClonesArray *AODMCTrackArray = dynamic_cast<TClonesArray*>(fInputEvent->FindListObject(AliAODMCParticle::StdBranchName()));
1874 Bool_t isTruePi0 = kFALSE;
1875 Bool_t isTrueEta = kFALSE;
1877 Int_t gamma0MCLabel = TrueGammaCandidate1->GetCaloPhotonMCLabel(0); // get most probable MC label
1878 Int_t gamma0MotherLabel = -1;
1881 if(gamma0MCLabel != -1){ // Gamma is Combinatorial; MC Particles don't belong to the same Mother
1882 // Daughters Gamma 0
1883 AliAODMCParticle * gammaMC0 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma0MCLabel));
1884 if (TrueGammaCandidate0->IsLargestComponentPhoton() || TrueGammaCandidate0->IsLargestComponentElectron()){ // largest component is electro magnetic
1885 // get mother of interest (pi0 or eta)
1886 if (TrueGammaCandidate0->IsLargestComponentPhoton()){ // for photons its the direct mother
1887 gamma0MotherLabel=gammaMC0->GetMother();
1888 } else if (TrueGammaCandidate0->IsLargestComponentElectron()){ // for electrons its either the direct mother or for conversions the grandmother
1889 if (TrueGammaCandidate0->IsConversion()){
1890 AliAODMCParticle * gammaGrandMotherMC0 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gammaMC0->GetMother()));
1891 gamma0MotherLabel=gammaGrandMotherMC0->GetMother();
1892 } else gamma0MotherLabel=gammaMC0->GetMother();
1897 Int_t gamma1MCLabel = TrueGammaCandidate1->GetCaloPhotonMCLabel(0); // get most probable MC label
1898 Int_t gamma1MotherLabel = -1;
1901 if(gamma1MCLabel != -1){ // Gamma is Combinatorial; MC Particles don't belong to the same Mother
1902 // Daughters Gamma 1
1903 AliAODMCParticle * gammaMC1 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma1MCLabel));
1904 if (TrueGammaCandidate1->IsLargestComponentPhoton() || TrueGammaCandidate1->IsLargestComponentElectron()){ // largest component is electro magnetic
1905 // get mother of interest (pi0 or eta)
1906 if (TrueGammaCandidate1->IsLargestComponentPhoton()){ // for photons its the direct mother
1907 gamma1MotherLabel=gammaMC1->GetMother();
1908 } else if (TrueGammaCandidate1->IsLargestComponentElectron()){ // for electrons its either the direct mother or for conversions the grandmother
1909 if (TrueGammaCandidate1->IsConversion()){
1910 AliAODMCParticle * gammaGrandMotherMC1 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gammaMC1->GetMother()));
1911 gamma1MotherLabel=gammaGrandMotherMC1->GetMother();
1912 } else gamma1MotherLabel=gammaMC1->GetMother();
1917 if(gamma0MotherLabel>=0 && gamma0MotherLabel==gamma1MotherLabel){
1918 if(((AliAODMCParticle*)AODMCTrackArray->At(gamma1MotherLabel))->GetPdgCode() == 111){
1921 if(((AliAODMCParticle*)AODMCTrackArray->At(gamma1MotherLabel))->GetPdgCode() == 221){
1926 if(isTruePi0 || isTrueEta){// True Pion or Eta
1927 fHistoTrueMotherInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
1928 if (fDoMesonQA > 0){
1929 // both gammas are real gammas
1930 if (TrueGammaCandidate0->IsLargestComponentPhoton() && TrueGammaCandidate1->IsLargestComponentPhoton())
1931 fHistoTrueMotherCaloPhotonInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
1932 // both particles are electrons
1933 if (TrueGammaCandidate0->IsLargestComponentElectron() && TrueGammaCandidate1->IsLargestComponentElectron() )
1934 fHistoTrueMotherCaloElectronInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
1935 // both particles are converted electrons
1936 if ((TrueGammaCandidate0->IsLargestComponentElectron() && TrueGammaCandidate0->IsConversion()) && (TrueGammaCandidate1->IsLargestComponentElectron() && TrueGammaCandidate1->IsConversion()) ){
1937 fHistoTrueMotherCaloConvertedPhotonInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
1938 if (isTruePi0 )fHistoTruePi0CaloConvertedPhotonInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
1939 if (isTrueEta )fHistoTrueEtaCaloConvertedPhotonInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
1941 // 1 gamma is converted the other one is normals
1942 if ( (TrueGammaCandidate0->IsLargestComponentPhoton() && TrueGammaCandidate1->IsLargestComponentElectron() && TrueGammaCandidate1->IsConversion()) ||
1943 (TrueGammaCandidate1->IsLargestComponentPhoton() && TrueGammaCandidate0->IsLargestComponentElectron() && TrueGammaCandidate0->IsConversion())
1945 fHistoTrueMotherCaloMixedPhotonConvPhotonInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
1947 // at least one of the photon is merged
1948 if (TrueGammaCandidate0->IsMerged() || TrueGammaCandidate0->IsMergedPartConv() || TrueGammaCandidate0->IsDalitzMerged() || TrueGammaCandidate1->IsMerged() || TrueGammaCandidate1->IsMergedPartConv() || TrueGammaCandidate1->IsDalitzMerged() )
1949 fHistoTrueMotherCaloMergedClusterInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
1950 // at least one of the photon is merged and part conv
1951 if (TrueGammaCandidate1->IsMergedPartConv() || TrueGammaCandidate0->IsMergedPartConv())
1952 fHistoTrueMotherCaloMergedClusterPartConvInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
1955 if (fDoMesonQA > 0){
1957 if ( Pi0Candidate->M() > 0.05 && Pi0Candidate->M() < 0.17){
1958 fHistoTruePi0PtY[fiCut]->Fill(Pi0Candidate->Pt(),Pi0Candidate->Rapidity()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift());
1959 fHistoTruePi0PtAlpha[fiCut]->Fill(Pi0Candidate->Pt(),Pi0Candidate->GetAlpha());
1960 fHistoTruePi0PtOpenAngle[fiCut]->Fill(Pi0Candidate->Pt(),Pi0Candidate->GetOpeningAngle());
1962 } else if (isTrueEta){
1963 if ( Pi0Candidate->M() > 0.45 && Pi0Candidate->M() < 0.65){
1964 fHistoTrueEtaPtY[fiCut]->Fill(Pi0Candidate->Pt(),Pi0Candidate->Rapidity()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift());
1965 fHistoTrueEtaPtAlpha[fiCut]->Fill(Pi0Candidate->Pt(),Pi0Candidate->GetAlpha());
1966 fHistoTrueEtaPtOpenAngle[fiCut]->Fill(Pi0Candidate->Pt(),Pi0Candidate->GetOpeningAngle());
1970 if(!(static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma0MotherLabel))->IsPrimary())){ // Secondary Meson
1971 Int_t secMotherLabel = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma1MotherLabel))->GetMother();
1972 Float_t weightedSec= 1;
1973 if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(secMotherLabel, 0x0, fInputEvent) && static_cast<AliAODMCParticle*>(AODMCTrackArray->At(secMotherLabel))->GetPdgCode()==310){
1974 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
1975 //cout << "MC input \t"<<i << "\t" << particle->Pt()<<"\t"<<weighted << endl;
1977 fHistoTrueSecondaryMotherInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weightedSec);
1978 if (secMotherLabel >-1){
1979 if(static_cast<AliAODMCParticle*>(AODMCTrackArray->At(secMotherLabel))->GetPdgCode()==310){
1980 fHistoTrueSecondaryMotherFromK0sInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weightedSec);
1981 if (fDoMesonQA > 0)fHistoTrueK0sWithPi0DaughterMCPt[fiCut]->Fill(static_cast<AliAODMCParticle*>(AODMCTrackArray->At(secMotherLabel))->Pt());
1983 if(static_cast<AliAODMCParticle*>(AODMCTrackArray->At(secMotherLabel))->GetPdgCode()==221){
1984 fHistoTrueSecondaryMotherFromEtaInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weightedSec);
1985 if (fDoMesonQA > 0)fHistoTrueEtaWithPi0DaughterMCPt[fiCut]->Fill(static_cast<AliAODMCParticle*>(AODMCTrackArray->At(secMotherLabel))->Pt());
1987 if(static_cast<AliAODMCParticle*>(AODMCTrackArray->At(secMotherLabel))->GetPdgCode()==3122){
1988 fHistoTrueSecondaryMotherFromLambdaInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weightedSec);
1989 if (fDoMesonQA > 0)fHistoTrueLambdaWithPi0DaughterMCPt[fiCut]->Fill(static_cast<AliAODMCParticle*>(AODMCTrackArray->At(secMotherLabel))->Pt());
1992 } else{ // Only primary pi0 for efficiency calculation
1993 Float_t weighted= 1;
1994 if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(gamma1MotherLabel, 0x0, fInputEvent)){
1995 if (static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma1MotherLabel))->Pt()>0.005){
1996 weighted= ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetWeightForMeson(fV0Reader->GetPeriodName(),gamma1MotherLabel, 0x0, fInputEvent);
1997 // cout << "rec \t " <<gamma1MotherLabel << "\t" << weighted << endl;
2000 fHistoTruePrimaryMotherInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weighted);
2001 fHistoTruePrimaryMotherW0WeightingInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2002 fProfileTruePrimaryMotherWeightsInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weighted);
2004 if (fDoMesonQA > 0){
2005 if(isTruePi0){ // Only primary pi0 for resolution
2006 fHistoTruePrimaryPi0MCPtResolPt[fiCut]->Fill(static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma1MotherLabel))->Pt(),
2007 (Pi0Candidate->Pt()-static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma1MotherLabel))->Pt())/static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma1MotherLabel))->Pt(),weighted);
2010 if (isTrueEta){ // Only primary eta for resolution
2011 fHistoTruePrimaryEtaMCPtResolPt[fiCut]->Fill(static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma1MotherLabel))->Pt(),
2012 (Pi0Candidate->Pt()-static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma1MotherLabel))->Pt())/static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma1MotherLabel))->Pt(),weighted);
2016 } else if(!isTruePi0 && !isTrueEta) { // Background
2017 if (fDoMesonQA > 0){
2018 if(gamma0MotherLabel>-1 && gamma1MotherLabel>-1){ // Both Tracks are Photons and have a mother but not Pi0 or Eta
2019 fHistoTrueBckGGInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2020 } else { // No photon or without mother
2021 fHistoTrueBckContInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2027 //________________________________________________________________________
2028 void AliAnalysisTaskGammaCalo::CalculateBackground(){
2030 Int_t zbin= fBGHandler[fiCut]->GetZBinIndex(fInputEvent->GetPrimaryVertex()->GetZ());
2033 if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->UseTrackMultiplicity()){
2034 mbin = fBGHandler[fiCut]->GetMultiplicityBinIndex(fV0Reader->GetNumberOfPrimaryTracks());
2036 mbin = fBGHandler[fiCut]->GetMultiplicityBinIndex(fClusterCandidates->GetEntries());
2039 if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->UseTrackMultiplicity()){
2040 for(Int_t nEventsInBG=0;nEventsInBG<fBGHandler[fiCut]->GetNBGEvents();nEventsInBG++){
2041 AliGammaConversionAODVector *previousEventV0s = fBGHandler[fiCut]->GetBGGoodV0s(zbin,mbin,nEventsInBG);
2043 for(Int_t iCurrent=0;iCurrent<fClusterCandidates->GetEntries();iCurrent++){
2044 AliAODConversionPhoton currentEventGoodV0 = *(AliAODConversionPhoton*)(fClusterCandidates->At(iCurrent));
2045 for(UInt_t iPrevious=0;iPrevious<previousEventV0s->size();iPrevious++){
2046 AliAODConversionPhoton previousGoodV0 = (AliAODConversionPhoton)(*(previousEventV0s->at(iPrevious)));
2047 AliAODConversionMother *backgroundCandidate = new AliAODConversionMother(¤tEventGoodV0,&previousGoodV0);
2048 backgroundCandidate->CalculateDistanceOfClossetApproachToPrimVtx(fInputEvent->GetPrimaryVertex());
2049 if((((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))
2050 ->MesonIsSelected(backgroundCandidate,kFALSE,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift()))){
2051 fHistoMotherBackInvMassPt[fiCut]->Fill(backgroundCandidate->M(),backgroundCandidate->Pt());
2052 Double_t sparesFill[4] = {backgroundCandidate->M(),backgroundCandidate->Pt(),(Double_t)zbin,(Double_t)mbin};
2053 fSparseMotherBackInvMassPtZM[fiCut]->Fill(sparesFill,1);
2055 delete backgroundCandidate;
2056 backgroundCandidate = 0x0;
2061 for(Int_t nEventsInBG=0;nEventsInBG <fBGHandler[fiCut]->GetNBGEvents();nEventsInBG++){
2062 AliGammaConversionAODVector *previousEventV0s = fBGHandler[fiCut]->GetBGGoodV0s(zbin,mbin,nEventsInBG);
2063 if(previousEventV0s){
2064 for(Int_t iCurrent=0;iCurrent<fClusterCandidates->GetEntries();iCurrent++){
2065 AliAODConversionPhoton currentEventGoodV0 = *(AliAODConversionPhoton*)(fClusterCandidates->At(iCurrent));
2066 for(UInt_t iPrevious=0;iPrevious<previousEventV0s->size();iPrevious++){
2068 AliAODConversionPhoton previousGoodV0 = (AliAODConversionPhoton)(*(previousEventV0s->at(iPrevious)));
2069 AliAODConversionMother *backgroundCandidate = new AliAODConversionMother(¤tEventGoodV0,&previousGoodV0);
2070 backgroundCandidate->CalculateDistanceOfClossetApproachToPrimVtx(fInputEvent->GetPrimaryVertex());
2071 if((((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->MesonIsSelected(backgroundCandidate,kFALSE,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift()))){
2072 fHistoMotherBackInvMassPt[fiCut]->Fill(backgroundCandidate->M(),backgroundCandidate->Pt());
2073 Double_t sparesFill[4] = {backgroundCandidate->M(),backgroundCandidate->Pt(),(Double_t)zbin,(Double_t)mbin};
2074 fSparseMotherBackInvMassPtZM[fiCut]->Fill(sparesFill,1);
2076 delete backgroundCandidate;
2077 backgroundCandidate = 0x0;
2085 //________________________________________________________________________
2086 void AliAnalysisTaskGammaCalo::RotateParticle(AliAODConversionPhoton *gamma){
2087 Int_t fNDegreesPMBackground= ((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->NDegreesRotation();
2088 Double_t nRadiansPM = fNDegreesPMBackground*TMath::Pi()/180;
2089 Double_t rotationValue = fRandom.Rndm()*2*nRadiansPM + TMath::Pi()-nRadiansPM;
2090 gamma->RotateZ(rotationValue);
2093 //________________________________________________________________________
2094 void AliAnalysisTaskGammaCalo::UpdateEventByEventData(){
2095 //see header file for documentation
2096 if(fClusterCandidates->GetEntries() >0 ){
2097 if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->UseTrackMultiplicity()){
2098 fBGHandler[fiCut]->AddEvent(fClusterCandidates,fInputEvent->GetPrimaryVertex()->GetX(),fInputEvent->GetPrimaryVertex()->GetY(),fInputEvent->GetPrimaryVertex()->GetZ(),fV0Reader->GetNumberOfPrimaryTracks(),fEventPlaneAngle);
2099 } else { // means we use #V0s for multiplicity
2100 fBGHandler[fiCut]->AddEvent(fClusterCandidates,fInputEvent->GetPrimaryVertex()->GetX(),fInputEvent->GetPrimaryVertex()->GetY(),fInputEvent->GetPrimaryVertex()->GetZ(),fClusterCandidates->GetEntries(),fEventPlaneAngle);
2106 //________________________________________________________________________
2107 void AliAnalysisTaskGammaCalo::FillPhotonBackgroundHist(AliAODConversionPhoton *TruePhotonCandidate, Int_t pdgCode)
2109 // Bck = 0 e+-, 1 pi+-, 2 p+-, 3 K+-, 4 n, 5 K0s, 6 Lambda, 7 mu+-, 8 rest
2110 if(fIsFromMBHeader){
2111 if(abs(pdgCode) == 11) fHistoClusPhotonBGPt[fiCut]->Fill(TruePhotonCandidate->Pt(),0);
2112 else if( abs(pdgCode)==211) fHistoClusPhotonBGPt[fiCut]->Fill(TruePhotonCandidate->Pt(),1);
2113 else if( abs(pdgCode)==2212) fHistoClusPhotonBGPt[fiCut]->Fill(TruePhotonCandidate->Pt(),2);
2114 else if( abs(pdgCode)==321) fHistoClusPhotonBGPt[fiCut]->Fill(TruePhotonCandidate->Pt(),3);
2115 else if( abs(pdgCode)==2112) fHistoClusPhotonBGPt[fiCut]->Fill(TruePhotonCandidate->Pt(),4);
2116 else if( abs(pdgCode)==310) fHistoClusPhotonBGPt[fiCut]->Fill(TruePhotonCandidate->Pt(),5);
2117 else if( abs(pdgCode)==3122) fHistoClusPhotonBGPt[fiCut]->Fill(TruePhotonCandidate->Pt(),6);
2118 else if( abs(pdgCode)==13) fHistoClusPhotonBGPt[fiCut]->Fill(TruePhotonCandidate->Pt(),7);
2119 else fHistoClusPhotonBGPt[fiCut]->Fill(TruePhotonCandidate->Pt(),8);
2123 //________________________________________________________________________
2124 void AliAnalysisTaskGammaCalo::FillPhotonPlusConversionBackgroundHist(AliAODConversionPhoton *TruePhotonCandidate, Int_t pdgCode)
2126 // Bck = 0 e+-, 1 pi+-, 2 p+-, 3 K+-, 4 n, 5 K0s, 6 Lambda, 7 mu+-, 8 rest
2127 if(fIsFromMBHeader){
2128 if(abs(pdgCode) == 11) fHistoClusPhotonPlusConvBGPt[fiCut]->Fill(TruePhotonCandidate->Pt(),0);
2129 else if( abs(pdgCode)==211) fHistoClusPhotonPlusConvBGPt[fiCut]->Fill(TruePhotonCandidate->Pt(),1);
2130 else if( abs(pdgCode)==2212) fHistoClusPhotonPlusConvBGPt[fiCut]->Fill(TruePhotonCandidate->Pt(),2);
2131 else if( abs(pdgCode)==321) fHistoClusPhotonPlusConvBGPt[fiCut]->Fill(TruePhotonCandidate->Pt(),3);
2132 else if( abs(pdgCode)==2112) fHistoClusPhotonPlusConvBGPt[fiCut]->Fill(TruePhotonCandidate->Pt(),4);
2133 else if( abs(pdgCode)==310) fHistoClusPhotonPlusConvBGPt[fiCut]->Fill(TruePhotonCandidate->Pt(),5);
2134 else if( abs(pdgCode)==3122) fHistoClusPhotonPlusConvBGPt[fiCut]->Fill(TruePhotonCandidate->Pt(),6);
2135 else if( abs(pdgCode)==13) fHistoClusPhotonPlusConvBGPt[fiCut]->Fill(TruePhotonCandidate->Pt(),7);
2136 else fHistoClusPhotonPlusConvBGPt[fiCut]->Fill(TruePhotonCandidate->Pt(),8);
2141 void AliAnalysisTaskGammaCalo::SetLogBinningXTH2(TH2* histoRebin){
2142 TAxis *axisafter = histoRebin->GetXaxis();
2143 Int_t bins = axisafter->GetNbins();
2144 Double_t from = axisafter->GetXmin();
2145 Double_t to = axisafter->GetXmax();
2146 Double_t *newbins = new Double_t[bins+1];
2148 Double_t factor = TMath::Power(to/from, 1./bins);
2149 for(Int_t i=1; i<=bins; ++i) newbins[i] = factor * newbins[i-1];
2150 axisafter->Set(bins, newbins);
2154 //________________________________________________________________________
2155 void AliAnalysisTaskGammaCalo::Terminate(const Option_t *)
2158 //fOutputContainer->Print(); // Will crash on GRID
2161 //________________________________________________________________________
2162 Int_t AliAnalysisTaskGammaCalo::GetSourceClassification(Int_t daughter, Int_t pdgCode){
2164 if (daughter == 111) {
2165 if (abs(pdgCode) == 310) return 1; // k0s
2166 else if (abs(pdgCode) == 3122) return 2; // Lambda
2167 else if (abs(pdgCode) == 130) return 3; // K0L
2168 else if (abs(pdgCode) == 2212) return 4; // proton
2169 else if (abs(pdgCode) == 2112) return 5; // neutron
2170 else if (abs(pdgCode) == 211) return 6; // pion
2171 else if (abs(pdgCode) == 321) return 7; // kaon
2172 else if (abs(pdgCode) == 113 || abs(pdgCode) == 213 ) return 8; // rho 0,+,-
2173 else if (abs(pdgCode) == 3222 || abs(pdgCode) == 3212 || abs(pdgCode) == 3112 ) return 9; // Sigma
2174 else if (abs(pdgCode) == 2224 || abs(pdgCode) == 2214 || abs(pdgCode) == 2114 || abs(pdgCode) == 1114 ) return 10; // Delta
2175 else if (abs(pdgCode) == 313 || abs(pdgCode) == 323 ) return 11; // K*