AliPhysics  d497547 (d497547)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliAnalysisTaskMaterialHistos.cxx
Go to the documentation of this file.
1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Authors: Friederike Bock *
5 * Version 1.0 *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15 
17 //---------------------------------------------
18 // QA Task for V0 Reader V1
19 //---------------------------------------------
21 
23 #include "TChain.h"
24 #include "AliAnalysisManager.h"
25 #include "TParticle.h"
26 #include "TVectorF.h"
27 #include "AliPIDResponse.h"
28 #include "AliESDtrackCuts.h"
29 #include "TFile.h"
30 
31 class iostream;
32 
33 using namespace std;
34 
36 
38  fV0Reader(NULL),
39  fV0ReaderName("V0ReaderV1"),
40  fConversionGammas(NULL),
41  fGammaCandidates(NULL),
42  fConversionCutArray(NULL),
43  fEventCutArray(NULL),
44  fCutFolder(NULL),
45  fESDList(NULL),
46  fTrueList(NULL),
47  fMCList(NULL),
48  fOutputList(NULL),
49  fAllMCGammaList(NULL),
50  fAllMCConvGammaList(NULL),
51  fPrimVtxZ(0.),
52  fNContrVtx(0),
53  fNESDtracksEta09(0),
54  fNESDtracksEta0914(0),
55  fNESDtracksEta14(0),
56  fGammaMCPt(0.),
57  fGammaMCTheta(0.),
58  fGammaMCConvPt(0.),
59  fGammaMCConvTheta(0.),
60  fGammaPt(0.),
61  fGammaTheta(0.),
62  fGammaChi2NDF(0.),
63  fKind(0),
64  fIsHeavyIon(0),
65  fIsMC(0),
66  fInputEvent(NULL),
67  fMCEvent(NULL),
68  fnCuts(0),
69  fiCut(0),
70  hNEvents(NULL),
71  hNGoodESDTracks09(NULL),
72  hNGoodESDTracks14(NULL),
73  hNGoodESDTracks09_14(NULL),
74  hESDConversionMappingRPhi(NULL),
75  hESDConversionMappingRZ(NULL),
76  hESDConversionR(NULL),
77  hESDConversionPtvsR(NULL),
78  hESDConversionAsymP(NULL),
79  hESDConversionMidPtR(NULL),
80  hESDConversionHighPtR(NULL),
81  hESDConversionEtaPR(NULL),
82  hESDConversionEtaNR(NULL),
83  hESDConversionRInBins(NULL),
84  hESDConversionPhiInBins(NULL),
85  hESDConversionEta(NULL),
86  hESDConversionMidPtEta(NULL),
87  hESDConversionHighPtEta(NULL),
88  hESDConversionPt(NULL),
89  hESDConversionPt5cm(NULL),
90  hESDConversionDCA(NULL),
91  hESDConversionMidPtDCA(NULL),
92  hESDConversionHighPtDCA(NULL),
93  hESDConversionPsiPair(NULL),
94  hESDConversionChi2(NULL),
95  hESDConversionMass(NULL),
96  hMCConversionMappingRPhi(NULL),
97  hMCConversionR(NULL),
98  hMCConversionPtvsR(NULL),
99  hMCConversionMidPtR(NULL),
100  hMCConversionHighPtR(NULL),
101  hMCConversionEtaPR(NULL),
102  hMCConversionEtaNR(NULL),
103  hMCConversionEta(NULL),
104  hMCConversionMidPtEta(NULL),
105  hMCConversionHighPtEta(NULL),
106  hMCConversionPt(NULL),
107  hMCAllGammaPt(NULL),
108  hMCTrueConversionMappingRPhi(NULL),
109  hMCTrueConversionMappingRZ(NULL),
110  hMCTrueConversionR(NULL),
111  hMCTrueConversionPtvsR(NULL),
112  hMCTrueConversionMidPtR(NULL),
113  hMCTrueConversionHighPtR(NULL),
114  hMCTrueConversionEtaPR(NULL),
115  hMCTrueConversionEtaNR(NULL),
116  hMCTrueConversionEta(NULL),
117  hMCTrueConversionMidPtEta(NULL),
118  hMCTrueConversionHighPtEta(NULL),
119  hMCTrueConversionPt(NULL),
120  hMCTrueConversionPt5cm(NULL),
121  hMCTrueConversionAsymP(NULL),
122  hMCTrueConversionDCA(NULL),
123  hMCTrueConversionMidPtDCA(NULL),
124  hMCTrueConversionHighPtDCA(NULL),
125  hMCTrueConversionPsiPair(NULL),
126  hMCTrueConversionChi2(NULL),
127  hMCTrueConversionMass(NULL),
128  hMCTruePi0DalConversionR(NULL),
129  hMCTruePi0DalConversionMidPtR(NULL),
130  hMCTruePi0DalConversionHighPtR(NULL),
131  hMCTruePi0DalConversionEta(NULL),
132  hMCTruePi0DalConversionMidPtEta(NULL),
133  hMCTruePi0DalConversionHighPtEta(NULL),
134  hMCTruePi0DalConversionPt(NULL),
135  hMCTrueEtaDalConversionR(NULL),
136  hMCTrueEtaDalConversionMidPtR(NULL),
137  hMCTrueEtaDalConversionHighPtR(NULL),
138  hMCTrueEtaDalConversionEta(NULL),
139  hMCTrueEtaDalConversionMidPtEta(NULL),
140  hMCTrueEtaDalConversionHighPtEta(NULL),
141  hMCTrueEtaDalConversionPt(NULL),
142  hMCTrueCombConversionR(NULL),
143  hMCTrueCombConversionMidPtR(NULL),
144  hMCTrueCombConversionHighPtR(NULL),
145  hMCTrueCombConversionEta(NULL),
146  hMCTrueCombConversionMidPtEta(NULL),
147  hMCTrueCombConversionHighPtEta(NULL),
148  hMCTrueCombConversionPt(NULL)
149 {
150 
151 }
152 
153 
154 //________________________________________________________________________
156 fV0Reader(NULL),
157 fV0ReaderName("V0ReaderV1"),
158 fConversionGammas(NULL),
159 fGammaCandidates(NULL),
160 fConversionCutArray(NULL),
161  fEventCutArray(NULL),
162  fCutFolder(NULL),
163  fESDList(NULL),
164  fTrueList(NULL),
165  fMCList(NULL),
166  fOutputList(NULL),
167  fAllMCGammaList(NULL),
168  fAllMCConvGammaList(NULL),
169  fPrimVtxZ(0.),
170  fNContrVtx(0),
171  fNESDtracksEta09(0),
172  fNESDtracksEta0914(0),
173  fNESDtracksEta14(0),
174  fGammaMCPt(0.),
175  fGammaMCTheta(0.),
176  fGammaMCConvPt(0.),
177  fGammaMCConvTheta(0.),
178  fGammaPt(0.),
179  fGammaTheta(0.),
180  fGammaChi2NDF(0.),
181  fKind(0),
182  fIsHeavyIon(0),
183  fIsMC(0),
184  fInputEvent(NULL),
185  fMCEvent(NULL),
186  fnCuts(0),
187  fiCut(0),
188  hNEvents(NULL),
189  hNGoodESDTracks09(NULL),
190  hNGoodESDTracks14(NULL),
191  hNGoodESDTracks09_14(NULL),
192  hESDConversionMappingRPhi(NULL),
193  hESDConversionMappingRZ(NULL),
194  hESDConversionR(NULL),
195  hESDConversionPtvsR(NULL),
196  hESDConversionAsymP(NULL),
197  hESDConversionMidPtR(NULL),
198  hESDConversionHighPtR(NULL),
199  hESDConversionEtaPR(NULL),
200  hESDConversionEtaNR(NULL),
201  hESDConversionRInBins(NULL),
202  hESDConversionPhiInBins(NULL),
203  hESDConversionEta(NULL),
204  hESDConversionMidPtEta(NULL),
205  hESDConversionHighPtEta(NULL),
206  hESDConversionPt(NULL),
207  hESDConversionPt5cm(NULL),
208  hESDConversionDCA(NULL),
209  hESDConversionMidPtDCA(NULL),
210  hESDConversionHighPtDCA(NULL),
211  hESDConversionPsiPair(NULL),
212  hESDConversionChi2(NULL),
213  hESDConversionMass(NULL),
214  hMCConversionMappingRPhi(NULL),
215  hMCConversionR(NULL),
216  hMCConversionPtvsR(NULL),
217  hMCConversionMidPtR(NULL),
218  hMCConversionHighPtR(NULL),
219  hMCConversionEtaPR(NULL),
220  hMCConversionEtaNR(NULL),
221  hMCConversionEta(NULL),
222  hMCConversionMidPtEta(NULL),
223  hMCConversionHighPtEta(NULL),
224  hMCConversionPt(NULL),
225  hMCAllGammaPt(NULL),
226  hMCTrueConversionMappingRPhi(NULL),
227  hMCTrueConversionMappingRZ(NULL),
228  hMCTrueConversionR(NULL),
229  hMCTrueConversionPtvsR(NULL),
230  hMCTrueConversionMidPtR(NULL),
231  hMCTrueConversionHighPtR(NULL),
232  hMCTrueConversionEtaPR(NULL),
233  hMCTrueConversionEtaNR(NULL),
234  hMCTrueConversionEta(NULL),
235  hMCTrueConversionMidPtEta(NULL),
236  hMCTrueConversionHighPtEta(NULL),
237  hMCTrueConversionPt(NULL),
238  hMCTrueConversionPt5cm(NULL),
239  hMCTrueConversionAsymP(NULL),
240  hMCTrueConversionDCA(NULL),
241  hMCTrueConversionMidPtDCA(NULL),
242  hMCTrueConversionHighPtDCA(NULL),
243  hMCTrueConversionPsiPair(NULL),
244  hMCTrueConversionChi2(NULL),
245  hMCTrueConversionMass(NULL),
246  hMCTruePi0DalConversionR(NULL),
247  hMCTruePi0DalConversionMidPtR(NULL),
248  hMCTruePi0DalConversionHighPtR(NULL),
249  hMCTruePi0DalConversionEta(NULL),
250  hMCTruePi0DalConversionMidPtEta(NULL),
251  hMCTruePi0DalConversionHighPtEta(NULL),
252  hMCTruePi0DalConversionPt(NULL),
253  hMCTrueEtaDalConversionR(NULL),
254  hMCTrueEtaDalConversionMidPtR(NULL),
255  hMCTrueEtaDalConversionHighPtR(NULL),
256  hMCTrueEtaDalConversionEta(NULL),
257  hMCTrueEtaDalConversionMidPtEta(NULL),
258  hMCTrueEtaDalConversionHighPtEta(NULL),
259  hMCTrueEtaDalConversionPt(NULL),
260  hMCTrueCombConversionR(NULL),
261  hMCTrueCombConversionMidPtR(NULL),
262  hMCTrueCombConversionHighPtR(NULL),
263  hMCTrueCombConversionEta(NULL),
264  hMCTrueCombConversionMidPtEta(NULL),
265  hMCTrueCombConversionHighPtEta(NULL),
266  hMCTrueCombConversionPt(NULL)
267 {
268  // Default constructor
269 
270  DefineInput(0, TChain::Class());
271  DefineOutput(1, TList::Class());
272 }
273 
274 //________________________________________________________________________
276 {
277  // default deconstructor
278  if(fGammaCandidates){
279  delete fGammaCandidates;
280  fGammaCandidates = 0x0;
281  }
282 }
283 //________________________________________________________________________
285 {
286  // Create User Output Objects
287 
288  if(fOutputList != NULL){
289  delete fOutputList;
290  fOutputList = NULL;
291  }
292  if(fOutputList == NULL){
293  fOutputList = new TList();
294  fOutputList->SetOwner(kTRUE);
295  }
296 
297  // Array of current cut's gammas
298 
299  fGammaCandidates = new TList();
300  fCutFolder = new TList*[fnCuts];
301  fESDList = new TList*[fnCuts];
302  fMCList = new TList*[fnCuts];
303  fTrueList = new TList*[fnCuts];
304 
305 
306  hNEvents = new TH1F*[fnCuts];
307  hNGoodESDTracks09 = new TH1F*[fnCuts];
308  hNGoodESDTracks14 = new TH1F*[fnCuts];
309  hNGoodESDTracks09_14 = new TH1F*[fnCuts];
312  hESDConversionR = new TH1F*[fnCuts];
317  hESDConversionMidPtR = new TH1F*[fnCuts];
318  hESDConversionHighPtR = new TH1F*[fnCuts];
319  hESDConversionEtaPR = new TH1F*[fnCuts];
320  hESDConversionEtaNR = new TH1F*[fnCuts];
321  hESDConversionEta = new TH1F*[fnCuts];
322  hESDConversionMidPtEta = new TH1F*[fnCuts];
323  hESDConversionHighPtEta = new TH1F*[fnCuts];
324  hESDConversionPt = new TH1F*[fnCuts];
325  hESDConversionPt5cm = new TH1F*[fnCuts];
326  hESDConversionDCA = new TH1F*[fnCuts];
327  hESDConversionMidPtDCA = new TH1F*[fnCuts];
328  hESDConversionHighPtDCA = new TH1F*[fnCuts];
329  hESDConversionPsiPair = new TH1F*[fnCuts];
330  hESDConversionChi2 = new TH1F*[fnCuts];
331  hESDConversionMass = new TH1F*[fnCuts];
332 
334  hMCConversionR = new TH1F*[fnCuts];
336  hMCConversionMidPtR = new TH1F*[fnCuts];
337  hMCConversionHighPtR = new TH1F*[fnCuts];
338  hMCConversionEtaPR = new TH1F*[fnCuts];
339  hMCConversionEtaNR = new TH1F*[fnCuts];
340  hMCConversionEta = new TH1F*[fnCuts];
341  hMCConversionMidPtEta = new TH1F*[fnCuts];
342  hMCConversionHighPtEta = new TH1F*[fnCuts];
343  hMCConversionPt = new TH1F*[fnCuts];
344  hMCAllGammaPt = new TH1F*[fnCuts];
345 
348  hMCTrueConversionR = new TH1F*[fnCuts];
350  hMCTrueConversionMidPtR = new TH1F*[fnCuts];
351  hMCTrueConversionHighPtR = new TH1F*[fnCuts];
352  hMCTrueConversionEtaPR = new TH1F*[fnCuts];
353  hMCTrueConversionEtaNR = new TH1F*[fnCuts];
354  hMCTrueConversionEta = new TH1F*[fnCuts];
355  hMCTrueConversionMidPtEta = new TH1F*[fnCuts];
356  hMCTrueConversionHighPtEta = new TH1F*[fnCuts];
357  hMCTrueConversionPt = new TH1F*[fnCuts];
358  hMCTrueConversionPt5cm = new TH1F*[fnCuts];
359 
361  hMCTrueConversionDCA = new TH1F*[fnCuts];
362  hMCTrueConversionMidPtDCA = new TH1F*[fnCuts];
363  hMCTrueConversionHighPtDCA = new TH1F*[fnCuts];
364  hMCTrueConversionPsiPair = new TH1F*[fnCuts];
365  hMCTrueConversionChi2 = new TH1F*[fnCuts];
366  hMCTrueConversionMass = new TH1F*[fnCuts];
367 
368 
369  hMCTruePi0DalConversionR = new TH1F*[fnCuts];
372  hMCTruePi0DalConversionEta = new TH1F*[fnCuts];
375  hMCTruePi0DalConversionPt = new TH1F*[fnCuts];
376 
377 
378  hMCTrueEtaDalConversionEta = new TH1F*[fnCuts];
381  hMCTrueEtaDalConversionPt = new TH1F*[fnCuts];
382  hMCTrueEtaDalConversionR = new TH1F*[fnCuts];
385 
386  hMCTrueCombConversionR = new TH1F*[fnCuts];
387  hMCTrueCombConversionMidPtR = new TH1F*[fnCuts];
389  hMCTrueCombConversionEta = new TH1F*[fnCuts];
392  hMCTrueCombConversionPt = new TH1F*[fnCuts];
393 
394 
395 
396  for(Int_t iCut = 0; iCut<fnCuts;iCut++){
397 
398 
399  TString cutstringEvent = ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber();
400  TString cutstringPhoton = ((AliConversionPhotonCuts*)fConversionCutArray->At(iCut))->GetCutNumber();
401  fCutFolder[iCut] = new TList();
402  fCutFolder[iCut]->SetName(Form("Cut Number %s_%s",cutstringEvent.Data() ,cutstringPhoton.Data()));
403  fCutFolder[iCut]->SetOwner(kTRUE);
404  fOutputList->Add(fCutFolder[iCut]);
405 
406  fESDList[iCut] = new TList();
407  fESDList[iCut]->SetName(Form("%s_%s ESD histograms",cutstringEvent.Data() ,cutstringPhoton.Data()));
408  fESDList[iCut]->SetOwner(kTRUE);
409  fCutFolder[iCut]->Add(fESDList[iCut]);
410 
411  Int_t nBinsR=400;
412  Int_t nBinsX=2000;
413  Int_t nBinsY=2000;
414  Int_t nBinsZ=500;
415  Int_t nBinsPhi=750;
416  Int_t nBinsEta=2000;
417  Int_t nBinsPt=400;
418 
419 
420 
421  hNEvents[iCut] = new TH1F("NEvents","NEvents",14,-0.5,13.5);
422  hNEvents[iCut]->GetXaxis()->SetBinLabel(1,"Accepted");
423  hNEvents[iCut]->GetXaxis()->SetBinLabel(2,"Centrality");
424  hNEvents[iCut]->GetXaxis()->SetBinLabel(3,"Miss. MC or inc. ev.");
425  if (((AliConvEventCuts*)fEventCutArray->At(iCut))->IsSpecialTrigger() > 1 ){
426  TString TriggerNames = "Not Trigger: ";
427  TriggerNames = TriggerNames+ ( (AliConvEventCuts*)fEventCutArray->At(iCut))->GetSpecialTriggerName();
428  hNEvents[iCut]->GetXaxis()->SetBinLabel(4,TriggerNames.Data());
429  } else {
430  hNEvents[iCut]->GetXaxis()->SetBinLabel(4,"Trigger");
431  }
432  hNEvents[iCut]->GetXaxis()->SetBinLabel(5,"Vertex Z");
433  hNEvents[iCut]->GetXaxis()->SetBinLabel(6,"Cont. Vertex");
434  hNEvents[iCut]->GetXaxis()->SetBinLabel(7,"Pile-Up");
435  hNEvents[iCut]->GetXaxis()->SetBinLabel(8,"no SDD");
436  hNEvents[iCut]->GetXaxis()->SetBinLabel(9,"no V0AND");
437  hNEvents[iCut]->GetXaxis()->SetBinLabel(10,"EMCAL problem");
438  hNEvents[iCut]->GetXaxis()->SetBinLabel(11,"rejectedForJetJetMC");
439  hNEvents[iCut]->GetXaxis()->SetBinLabel(12,"SPD hits vs tracklet");
440  hNEvents[iCut]->GetXaxis()->SetBinLabel(13,"Out-of-Bunch pileup Past-Future");
441  hNEvents[iCut]->GetXaxis()->SetBinLabel(14,"Pileup V0M-TPCout Tracks");
442  fESDList[iCut]->Add(hNEvents[iCut]);
443 
444 
445  hNGoodESDTracks09[iCut] = new TH1F("GoodESDTracks09","GoodESDTracks09",4000,0,4000);
446  fESDList[iCut]->Add(hNGoodESDTracks09[iCut]);
447 
448  hNGoodESDTracks14[iCut] = new TH1F("GoodESDTracks14","GoodESDTracks14",4000,0,4000);
449  fESDList[iCut]->Add(hNGoodESDTracks14[iCut]);
450 
451  hNGoodESDTracks09_14[iCut] = new TH1F("GoodESDTracks09_14","GoodESDTracks09_14",4000,0,4000);
452  fESDList[iCut]->Add(hNGoodESDTracks09_14[iCut]);
453 
454  hESDConversionMappingRPhi[iCut] = new TH2F("ESD_ConversionMapping_RPhi","ESD_ConversionMapping_RPhi",nBinsPhi,0.,2*TMath::Pi(),nBinsR,0.,200.);
455 
456  fESDList[iCut]->Add(hESDConversionMappingRPhi[iCut]);
457  hESDConversionMappingRZ[iCut] = new TH2F("ESD_ConversionMapping_RZ","ESD_ConversionMapping_RZ",nBinsPhi,-180.,180.,nBinsR,0.,200.);
458  fESDList[iCut]->Add(hESDConversionMappingRZ[iCut]);
459  hESDConversionR[iCut] = new TH1F("ESD_ConversionMapping_R","ESD_ConversionMapping_R",nBinsR,0.,200.);
460  fESDList[iCut]->Add(hESDConversionR[iCut]);
461 
462  hESDConversionPtvsR[iCut] = new TH2F("ESD_ConversionMapping_Pt_R","ESD_ConversionMapping_Pt_R",nBinsPt,0.,20.,nBinsR,0.,200.);
463  fESDList[iCut]->Add(hESDConversionPtvsR[iCut]);
464 
465  hESDConversionRInBins[iCut] = new TH3F("ESD_ConversionMapping_RInBins","ESD_ConversionMapping_RInBins",100,0.,20.,8,0.,4000,nBinsR,0.,200.);
466  fESDList[iCut]->Add(hESDConversionRInBins[iCut]);
467  hESDConversionPhiInBins[iCut] = new TH3F("ESD_ConversionMapping_PhiInBins","ESD_ConversionMapping_PhiInBins",100,0.,200.,8,0.,4000,nBinsPhi,0.,2*TMath::Pi());
468  fESDList[iCut]->Add(hESDConversionPhiInBins[iCut]);
469 
470  hESDConversionAsymP[iCut] = new TH2F("ESD_ConversionMapping_AsymP","ESD_ConversionMapping_AsymP",nBinsPt,0.01,20.,500,0.,1.);
471  fESDList[iCut]->Add(hESDConversionAsymP[iCut]);
472 
473  hESDConversionMidPtR[iCut] = new TH1F("ESD_ConversionMappingMidPt_R","ESD_ConversionMappingMidPt_R",nBinsR,0.,200.);
474  fESDList[iCut]->Add(hESDConversionMidPtR[iCut]);
475 
476  hESDConversionHighPtR[iCut] = new TH1F("ESD_ConversionMappingHighPt_R","ESD_ConversionMappingHighPt_R",nBinsR,0.,200.);
477  fESDList[iCut]->Add(hESDConversionHighPtR[iCut]);
478 
479  hESDConversionEtaPR[iCut] = new TH1F("ESD_ConversionMappingEtaP_R","ESD_ConversionMappingEtaP_R",nBinsR,0.,200.);
480  fESDList[iCut]->Add(hESDConversionEtaPR[iCut]);
481 
482  hESDConversionEtaNR[iCut] = new TH1F("ESD_ConversionMappingEtaN_R","ESD_ConversionMappingEtaN_R",nBinsR,0.,200.);
483  fESDList[iCut]->Add(hESDConversionEtaNR[iCut]);
484 
485  hESDConversionEta[iCut] = new TH1F("ESD_ConversionMapping_Eta","ESD_ConversionMapping_Eta",nBinsEta,-2.,2.);
486  fESDList[iCut]->Add(hESDConversionEta[iCut]);
487 
488  hESDConversionMidPtEta[iCut] = new TH1F("ESD_ConversionMappingMidPt_Eta","ESD_ConversionMappingMidPt_Eta",nBinsEta,-2.,2.);
489  fESDList[iCut]->Add(hESDConversionMidPtEta[iCut]);
490 
491  hESDConversionHighPtEta[iCut] = new TH1F("ESD_ConversionMappingHighPt_Eta","ESD_ConversionMappingHighPt_Eta",nBinsEta,-2.,2.);
492  fESDList[iCut]->Add(hESDConversionHighPtEta[iCut]);
493 
494  hESDConversionPt[iCut] = new TH1F("ESD_ConversionMapping_Pt","ESD_ConversionMapping_Pt",nBinsPt,0.,20.);
495  fESDList[iCut]->Add(hESDConversionPt[iCut]);
496 
497  hESDConversionPt5cm[iCut] = new TH1F("ESD_ConversionMapping_Pt5cm","ESD_ConversionMapping_Pt5cm",nBinsPt,0.,20.);
498  fESDList[iCut]->Add(hESDConversionPt5cm[iCut]);
499 
500  hESDConversionDCA[iCut] = new TH1F("ESD_ConversionMapping_DCA","ESD_ConversionMapping_DCA",nBinsPt,0.,5.);
501  fESDList[iCut]->Add(hESDConversionDCA[iCut]);
502 
503  hESDConversionMidPtDCA[iCut] = new TH1F("ESD_ConversionMappingMidPt_DCA","ESD_ConversionMappingMidPt_DCA",nBinsPt,0.,5.);
504  fESDList[iCut]->Add(hESDConversionMidPtDCA[iCut]);
505 
506  hESDConversionHighPtDCA[iCut] = new TH1F("ESD_ConversionMappingHighPt_DCA","ESD_ConversionMappingHighPt_DCA",nBinsPt,0.,5.);
507  fESDList[iCut]->Add(hESDConversionHighPtDCA[iCut]);
508 
509 
510  hESDConversionPsiPair[iCut] = new TH1F("ESD_ConversionMapping_PsiPair","ESD_ConversionMapping_PsiPair",nBinsPt,0.,5.);
511  fESDList[iCut]->Add(hESDConversionPsiPair[iCut]);
512 
513  hESDConversionChi2[iCut] = new TH1F("ESD_ConversionMapping_Chi2","ESD_ConversionMapping_Chi2",nBinsPt,0.,50.);
514  fESDList[iCut]->Add(hESDConversionChi2[iCut]);
515 
516  hESDConversionMass[iCut] = new TH1F("ESD_ConversionMapping_Mass","ESD_ConversionMapping_Mass",nBinsPt,0.,1.);
517  fESDList[iCut]->Add(hESDConversionMass[iCut]);
518 
519 
520 
521 
522  TAxis *AxisAfter = hESDConversionAsymP[iCut]->GetXaxis();
523  Int_t bins = AxisAfter->GetNbins();
524  Double_t from = AxisAfter->GetXmin();
525  Double_t to = AxisAfter->GetXmax();
526  Double_t *newBins = new Double_t[bins+1];
527  newBins[0] = from;
528  Double_t factor = TMath::Power(to/from, 1./bins);
529  for(Int_t i=1; i<=bins; ++i) newBins[i] = factor * newBins[i-1];
530  AxisAfter->Set(bins, newBins);
531 
532 
533 
534  if (fIsMC>0) {
535  fMCList[iCut] = new TList();
536  fMCList[iCut]->SetName(Form("%s_%s MC histograms",cutstringEvent.Data() ,cutstringPhoton.Data()));
537  fMCList[iCut]->SetOwner(kTRUE);
538  fCutFolder[iCut]->Add(fMCList[iCut]);
539 
540  fTrueList[iCut] = new TList();
541  fTrueList[iCut]->SetName(Form("%s_%s True histograms",cutstringEvent.Data() ,cutstringPhoton.Data()));
542  fTrueList[iCut]->SetOwner(kTRUE);
543  fCutFolder[iCut]->Add(fTrueList[iCut]);
544 
545 
546 
547 
548  hMCConversionMappingRPhi[iCut] = new TH2F("MC_ConversionMapping_RPhi","MC_ConversionMapping_RPhi",nBinsPhi,0.,2*TMath::Pi(),nBinsR,0.,200.);
549  fMCList[iCut]->Add(hMCConversionMappingRPhi[iCut]);
550  hMCConversionR[iCut] = new TH1F("MC_ConversionMapping_R","MC_ConversionMapping_R",nBinsR,0.,200.);
551  fMCList[iCut]->Add(hMCConversionR[iCut]);
552  hMCConversionPtvsR[iCut] = new TH2F("MC_ConversionMapping_Pt_R","MC_ConversionMapping_Pt_R",nBinsPt,0.,20.,nBinsR,0.,200.);
553  fMCList[iCut]->Add(hMCConversionPtvsR[iCut]);
554  hMCConversionMidPtR[iCut] = new TH1F("MC_ConversionMappingMidPt_R","MC_ConversionMappingMidPt_R",nBinsR,0.,200.);
555  fMCList[iCut]->Add(hMCConversionMidPtR[iCut]);
556  hMCConversionHighPtR[iCut] = new TH1F("MC_ConversionMappingHighPt_R","MC_ConversionMappingHighPt_R",nBinsR,0.,200.);
557  fMCList[iCut]->Add(hMCConversionHighPtR[iCut]);
558  hMCConversionEtaPR[iCut] = new TH1F("MC_ConversionMappingEtaP_R","MC_ConversionMappingEtaP_R",nBinsR,0.,200.);
559  fMCList[iCut]->Add(hMCConversionEtaPR[iCut]);
560  hMCConversionEtaNR[iCut] = new TH1F("MC_ConversionMappingEtaN_R","MC_ConversionMappingEtaN_R",nBinsR,0.,200.);
561  fMCList[iCut]->Add(hMCConversionEtaNR[iCut]);
562  hMCConversionEta[iCut] = new TH1F("MC_ConversionMapping_Eta","MC_ConversionMapping_Eta",nBinsEta,-2.,2.);
563  fMCList[iCut]->Add(hMCConversionEta[iCut]);
564  hMCConversionMidPtEta[iCut] = new TH1F("MC_ConversionMappingMidPt_Eta","MC_ConversionMappingMidPt_Eta",nBinsEta,-2.,2.);
565  fMCList[iCut]->Add(hMCConversionMidPtEta[iCut]);
566  hMCConversionHighPtEta[iCut] = new TH1F("MC_ConversionMappingHighPt_Eta","MC_ConversionMappingHighPt_Eta",nBinsEta,-2.,2.);
567  fMCList[iCut]->Add(hMCConversionHighPtEta[iCut]);
568  hMCConversionPt[iCut] = new TH1F("MC_ConversionMapping_Pt","MC_ConversionMapping_Pt",nBinsPt,0.,20.);
569  fMCList[iCut]->Add(hMCConversionPt[iCut]);
570  hMCAllGammaPt[iCut] = new TH1F("MC_AllGamma_Pt","MC_AllGamma_Pt",nBinsPt,0.,20.);
571  fMCList[iCut]->Add(hMCAllGammaPt[iCut]);
572 
573 
574 
575  hMCTrueConversionMappingRPhi[iCut] = new TH2F("ESD_TrueConversionMapping_RPhi","ESD_TrueConversionMapping_RPhi",nBinsPhi,0.,2*TMath::Pi(),nBinsR,0.,200.);
576  fTrueList[iCut]->Add(hMCTrueConversionMappingRPhi[iCut]);
577 
578  hMCTrueConversionMappingRZ[iCut] = new TH2F("ESD_TrueConversionMapping_RZ","ESD_TrueConversionMapping_RZ",nBinsPhi,-180.,180.,nBinsR,0.,200.);
579  fTrueList[iCut]->Add(hMCTrueConversionMappingRZ[iCut]);
580 
581 
582  hMCTrueConversionR[iCut] = new TH1F("ESD_TrueConversionMapping_R","ESD_TrueConversionMapping_R",nBinsR,0.,200.);
583  fTrueList[iCut]->Add(hMCTrueConversionR[iCut]);
584 
585  hMCTrueConversionPtvsR[iCut] = new TH2F("ESD_TrueConversionMapping_Pt_R","ESD_TrueConversionMapping_Pt_R",nBinsPt,0.,20.,nBinsR,0.,200.);
586  fTrueList[iCut]->Add(hMCTrueConversionPtvsR[iCut]);
587 
588 
589  hMCTrueConversionMidPtR[iCut] = new TH1F("ESD_TrueConversionMappingMidPt_R","ESD_TrueConversionMappingMidPt_R",nBinsR,0.,200.);
590  fTrueList[iCut]->Add(hMCTrueConversionMidPtR[iCut]);
591 
592  hMCTrueConversionHighPtR[iCut] = new TH1F("ESD_TrueConversionMappingHighPt_R","ESD_TrueConversionMappingHighPt_R",nBinsR,0.,200.);
593  fTrueList[iCut]->Add(hMCTrueConversionHighPtR[iCut]);
594 
595  hMCTrueConversionEtaPR[iCut] = new TH1F("ESD_TrueConversionMappingEtaP_R","ESD_TrueConversionMappingEtaP_R",nBinsR,0.,200.);
596  fTrueList[iCut]->Add(hMCTrueConversionEtaPR[iCut]);
597 
598  hMCTrueConversionEtaNR[iCut] = new TH1F("ESD_TrueConversionMappingEtaN_R","ESD_TrueConversionMappingEtaN_R",nBinsR,0.,200.);
599  fTrueList[iCut]->Add(hMCTrueConversionEtaNR[iCut]);
600 
601  hMCTrueConversionEta[iCut] = new TH1F("ESD_TrueConversionMapping_Eta","ESD_TrueConversionMapping_Eta",nBinsEta,-2.,2.);
602  fTrueList[iCut]->Add(hMCTrueConversionEta[iCut]);
603  hMCTrueConversionMidPtEta[iCut] = new TH1F("ESD_TrueConversionMappingMidPt_Eta","ESD_TrueConversionMappingMidPt_Eta",nBinsEta,-2.,2.);
604  fTrueList[iCut]->Add(hMCTrueConversionMidPtEta[iCut]);
605  hMCTrueConversionHighPtEta[iCut] = new TH1F("ESD_TrueConversionMappingHighPt_Eta","ESD_TrueConversionMappingHighPt_Eta",nBinsEta,-2.,2.);
606  fTrueList[iCut]->Add(hMCTrueConversionHighPtEta[iCut]);
607 
608  hMCTrueConversionPt[iCut] = new TH1F("ESD_TrueConversionMapping_Pt","ESD_TrueConversionMapping_Pt",nBinsPt,0.,20.);
609  fTrueList[iCut]->Add(hMCTrueConversionPt[iCut]);
610 
611  hMCTrueConversionPt5cm[iCut] = new TH1F("ESD_TrueConversionMapping_Pt5cm","ESD_TrueConversionMapping_Pt5cm",nBinsPt,0.,20.);
612  fTrueList[iCut]->Add(hMCTrueConversionPt5cm[iCut]);
613 
614  hMCTrueConversionAsymP[iCut] = new TH2F("ESD_TrueConversionMapping_AsymP","ESD_TrueConversionMapping_AsymP",nBinsPt,0.01,20.,500,0.,1.);
615  fTrueList[iCut]->Add(hMCTrueConversionAsymP[iCut]);
616 
617  AxisAfter = hMCTrueConversionAsymP[iCut]->GetXaxis();
618  AxisAfter->Set(bins, newBins);
619 
620  hMCTrueConversionDCA[iCut] = new TH1F("ESD_TrueConversionMapping_DCA","ESD_TrueConversionMapping_DCA",nBinsPt,0.,5.);
621  fTrueList[iCut]->Add(hMCTrueConversionDCA[iCut]);
622 
623  hMCTrueConversionMidPtDCA[iCut] = new TH1F("ESD_TrueConversionMappingMidPt_DCA","ESD_TrueConversionMappingMidPt_DCA",nBinsPt,0.,5.);
624  fTrueList[iCut]->Add(hMCTrueConversionMidPtDCA[iCut]);
625 
626  hMCTrueConversionHighPtDCA[iCut] = new TH1F("ESD_TrueConversionMappingHighPt_DCA","ESD_TrueConversionMappingHighPt_DCA",nBinsPt,0.,5.);
627  fTrueList[iCut]->Add(hMCTrueConversionHighPtDCA[iCut]);
628 
629 
630  hMCTrueConversionPsiPair[iCut] = new TH1F("ESD_TrueConversionMapping_PsiPair","ESD_TrueConversionMapping_PsiPair",nBinsPt,0.,5.);
631  fTrueList[iCut]->Add(hMCTrueConversionPsiPair[iCut]);
632 
633  hMCTrueConversionChi2[iCut] = new TH1F("ESD_TrueConversionMapping_Chi2","ESD_TrueConversionMapping_Chi2",nBinsPt,0.,50.);
634  fTrueList[iCut]->Add(hMCTrueConversionChi2[iCut]);
635 
636  hMCTrueConversionMass[iCut] = new TH1F("ESD_TrueConversionMapping_Mass","ESD_TrueConversionMapping_Mass",nBinsPt,0.,1.);
637  fTrueList[iCut]->Add(hMCTrueConversionMass[iCut]);
638 
639 
640  hMCTruePi0DalConversionR[iCut] = new TH1F("ESD_TruePi0DalConversionMapping_R","ESD_TruePi0DalConversionMapping_R",nBinsR,0.,200.);
641  fTrueList[iCut]->Add(hMCTruePi0DalConversionR[iCut]);
642 
643  hMCTruePi0DalConversionMidPtR[iCut] = new TH1F("ESD_TruePi0DalConversionMappingMidPt_R","ESD_TruePi0DalConversionMappingMidPt_R",nBinsR,0.,200.);
644  fTrueList[iCut]->Add(hMCTruePi0DalConversionMidPtR[iCut]);
645 
646 
647  hMCTruePi0DalConversionHighPtR[iCut] = new TH1F("ESD_TruePi0DalConversionMappingHighPt_R","ESD_TruePi0DalConversionMappingHighPt_R",nBinsR,0.,200.);
648  fTrueList[iCut]->Add(hMCTruePi0DalConversionHighPtR[iCut]);
649 
650  hMCTruePi0DalConversionEta[iCut] = new TH1F("ESD_TruePi0DalConversionMapping_Eta","ESD_TruePi0DalConversionMapping_Eta",nBinsEta,-2.,2.);
651  fTrueList[iCut]->Add(hMCTruePi0DalConversionEta[iCut]);
652 
653  hMCTruePi0DalConversionMidPtEta[iCut] = new TH1F("ESD_TruePi0DalConversionMappingMidPt_Eta","ESD_TruePi0DalConversionMappingMidPt_Eta",nBinsEta,-2.,2.);
654  fTrueList[iCut]->Add(hMCTruePi0DalConversionMidPtEta[iCut]);
655 
656  hMCTruePi0DalConversionHighPtEta[iCut] = new TH1F("ESD_TruePi0DalConversionMappingHighPt_Eta","ESD_TruePi0DalConversionMappingHighPt_Eta",nBinsEta,-2.,2.);
658 
659  hMCTruePi0DalConversionPt[iCut] = new TH1F("ESD_TruePi0DalConversionMapping_Pt","ESD_TruePi0DalConversionMapping_Pt",nBinsPt,0.,20.);
660  fTrueList[iCut]->Add(hMCTruePi0DalConversionPt[iCut]);
661 
662 
663  hMCTrueEtaDalConversionR[iCut] = new TH1F("ESD_TrueEtaDalConversionMapping_R","ESD_TrueEtaDalConversionMapping_R",nBinsR,0.,200.);
664  fTrueList[iCut]->Add(hMCTrueEtaDalConversionR[iCut]);
665 
666  hMCTrueEtaDalConversionMidPtR[iCut] = new TH1F("ESD_TrueEtaDalConversionMappingMidPt_R","ESD_TrueEtaDalConversionMappingMidPt_R",nBinsR,0.,200.);
667  fTrueList[iCut]->Add(hMCTrueEtaDalConversionMidPtR[iCut]);
668 
669  hMCTrueEtaDalConversionHighPtR[iCut] = new TH1F("ESD_TrueEtaDalConversionMappingHighPt_R","ESD_TrueEtaDalConversionMappingHighPt_R",nBinsR,0.,200.);
670  fTrueList[iCut]->Add(hMCTrueEtaDalConversionHighPtR[iCut]);
671 
672  hMCTrueEtaDalConversionEta[iCut] = new TH1F("ESD_TrueEtaDalConversionMapping_Eta","ESD_TrueEtaDalConversionMapping_Eta",nBinsEta,-2.,2.);
673  fTrueList[iCut]->Add(hMCTrueEtaDalConversionEta[iCut]);
674 
675  hMCTrueEtaDalConversionMidPtEta[iCut] = new TH1F("ESD_TrueEtaDalConversionMappingMidPt_Eta","ESD_TrueEtaDalConversionMappingMidPt_Eta",nBinsEta,-2.,2.);
676  fTrueList[iCut]->Add(hMCTrueEtaDalConversionMidPtEta[iCut]);
677 
678 
679  hMCTrueEtaDalConversionHighPtEta[iCut] = new TH1F("ESD_TrueEtaDalConversionMappingHighPt_Eta","ESD_TrueEtaDalConversionMappingHighPt_Eta",nBinsEta,-2.,2.);
681 
682  hMCTrueEtaDalConversionPt[iCut] = new TH1F("ESD_TrueEtaDalConversionMapping_Pt","ESD_TrueEtaDalConversionMapping_Pt",nBinsPt,0.,20.);
683  fTrueList[iCut]->Add(hMCTrueEtaDalConversionPt[iCut]);
684 
685 
686 
687  hMCTrueCombConversionR[iCut] = new TH1F("ESD_TrueCombConversionMapping_R","ESD_TrueCombConversionMapping_R",nBinsR,0.,200.);
688  fTrueList[iCut]->Add(hMCTrueCombConversionR[iCut]);
689 
690  hMCTrueCombConversionMidPtR[iCut] = new TH1F("ESD_TrueCombConversionMappingMidPt_R","ESD_TrueCombConversionMappingMidPt_R",nBinsR,0.,200.);
691  fTrueList[iCut]->Add(hMCTrueCombConversionMidPtR[iCut]);
692 
693  hMCTrueCombConversionHighPtR[iCut] = new TH1F("ESD_TrueCombConversionMappingHighPt_R","ESD_TrueCombConversionMappingHighPt_R",nBinsR,0.,200.);
694  fTrueList[iCut]->Add(hMCTrueCombConversionHighPtR[iCut]);
695 
696  hMCTrueCombConversionEta[iCut] = new TH1F("ESD_TrueCombConversionMapping_Eta","ESD_TrueCombConversionMapping_Eta",nBinsEta,-2.,2.);
697  fTrueList[iCut]->Add(hMCTrueCombConversionEta[iCut]);
698 
699  hMCTrueCombConversionMidPtEta[iCut] = new TH1F("ESD_TrueCombConversionMappingMidPt_Eta","ESD_TrueCombConversionMappingMidPt_Eta",nBinsEta,-2.,2.);
700  fTrueList[iCut]->Add(hMCTrueCombConversionMidPtEta[iCut]);
701 
702  hMCTrueCombConversionHighPtEta[iCut] = new TH1F("ESD_TrueCombConversionMappingHighPt_Eta","ESD_TrueCombConversionMappingMidPt_Eta",nBinsEta,-2.,2.);
703  fTrueList[iCut]->Add(hMCTrueCombConversionHighPtEta[iCut]);
704 
705  hMCTrueCombConversionPt[iCut] = new TH1F("ESD_TrueCombConversionMapping_Pt","ESD_TrueCombConversionMapping_Pt",nBinsPt,0.,20.);
706  fTrueList[iCut]->Add(hMCTrueCombConversionPt[iCut]);
707 
708 
709  }
710  }
711 
712 
713  fV0Reader=(AliV0ReaderV1*)AliAnalysisManager::GetAnalysisManager()->GetTask(fV0ReaderName.Data());
717 
718  if(fV0Reader)
720  if(((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetCutHistograms())
721  fOutputList->Add(((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetCutHistograms());
722 
723  if(fV0Reader)
725  if(((AliConversionPhotonCuts*)fV0Reader->GetConversionCuts())->GetCutHistograms())
726  fOutputList->Add(((AliConversionPhotonCuts*)fV0Reader->GetConversionCuts())->GetCutHistograms());
727 
728  // if(fV0Reader && fV0Reader->GetProduceV0FindingEfficiency())
729  // if (fV0Reader->GetV0FindingEfficiencyHistograms())
730  // fOutputList->Add(fV0Reader->GetV0FindingEfficiencyHistograms());
731 
732  for(Int_t iCut = 0; iCut<fnCuts;iCut++){
733  if(!((AliConvEventCuts*)fEventCutArray->At(iCut))) continue;
734  if(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutHistograms()){
735  fCutFolder[iCut]->Add(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutHistograms());
736  }
737  if(!((AliConversionPhotonCuts*)fConversionCutArray->At(iCut))) continue;
738  if(((AliConversionPhotonCuts*)fConversionCutArray->At(iCut))->GetCutHistograms()){
739  fCutFolder[iCut]->Add(((AliConversionPhotonCuts*)fConversionCutArray->At(iCut))->GetCutHistograms());
740  }
741  }
742 
743  PostData(1, fOutputList);
744 
745 }
746 
747 //________________________________________________________________________
749 
750  fInputEvent = InputEvent();
751  if (fInputEvent==NULL) return;
752 
753  if(fIsMC>0) fMCEvent = MCEvent();
754 
755  Int_t eventQuality = ((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetEventQuality();
756  if(fInputEvent->IsIncompleteDAQ()==kTRUE) eventQuality = 2; // incomplete event
757  // Event Not Accepted due to MC event missing or because it is incomplere or wrong trigger for V0ReaderV1 => skip broken event/file
758  if(eventQuality == 2 || eventQuality == 3){
759  for(Int_t iCut = 0; iCut<fnCuts; iCut++){
760  hNEvents[iCut]->Fill(eventQuality);
761  }
762  return;
763  }
764 
765  fConversionGammas=fV0Reader->GetReconstructedGammas();// Gammas from default Cut
766 
767  // ------------------- BeginEvent ----------------------------
768 
769  for(Int_t iCut = 0; iCut<fnCuts; iCut++){
770  fiCut = iCut;
771  Int_t eventNotAccepted = ((AliConvEventCuts*)fEventCutArray->At(iCut))->IsEventAcceptedByCut(fV0Reader->GetEventCuts(),fInputEvent,fMCEvent,fIsHeavyIon,kFALSE);
772  if(eventNotAccepted){
773  // cout << "event rejected due to wrong trigger: " <<eventNotAccepted << endl;
774 
775  hNEvents[iCut]->Fill(eventNotAccepted); // Check Centrality, PileUp, SDD and V0AND --> Not Accepted => eventQuality = 1
776 
777  continue;
778  }
779 
780  if(eventQuality != 0){// Event Not Accepted
781  // cout << "event rejected due to: " <<eventQuality << endl;
782 
783  hNEvents[iCut]->Fill(eventQuality);
784 
785  continue;
786  }
787 
788  hNEvents[iCut]->Fill(eventQuality); // Should be 0 here
789 
790 
791  if(fIsMC > 0){
792  // Process MC Particle
793  if(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetSignalRejection() != 0){
794  if(fInputEvent->IsA()==AliESDEvent::Class()){
795  ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetNotRejectedParticles(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetSignalRejection(),
796  ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetAcceptedHeader(),
797  fMCEvent);
798  }
799  }
800  }
801 
802  if(fIsMC>0){
804  }
805 
806 
807  fNESDtracksEta09 = CountTracks09(); // Estimate Event Multiplicity
808  fNESDtracksEta0914 = CountTracks0914(); // Estimate Event Multiplicity
810 
811 
812  hNGoodESDTracks09[iCut]->Fill(fNESDtracksEta09);
813  hNGoodESDTracks14[iCut]->Fill(fNESDtracksEta14);
814  hNGoodESDTracks09_14[iCut]->Fill(fNESDtracksEta0914);
815 
816 
817  if(fInputEvent){
818  if(fInputEvent->GetPrimaryVertexTracks()->GetNContributors()>0) {
819  fNContrVtx = fInputEvent->GetPrimaryVertexTracks()->GetNContributors();
820  } else {
821  fNContrVtx = 0;
822  }
823 
824  }
825  // fPrimVtxZ = fInputEvent->GetPrimaryVertex()->GetZ();
826 
827  ProcessPhotons();
828  fGammaCandidates->Clear(); // delete this cuts good gammas
829  }
830 
831  //cout<<" done with the event"<<endl;
832 
833  PostData(1, fOutputList);
834 }
835 
836 // ///________________________________________________________________________
838  TParticle* candidate = (TParticle *)fMCEvent->Particle(eventPos);
839 
840  if(((AliConversionPhotonCuts*)fConversionCutArray->At(fiCut))->PhotonIsSelectedMC(candidate,fMCEvent,kFALSE)){
841  fGammaMCPt = candidate->Pt();
842  fGammaMCTheta = candidate->Theta();
843 
844  hMCAllGammaPt[fiCut]->Fill(candidate->Pt());
845 
846  }
847  Double_t minPt=0.4;
848  Double_t maxPt=1.5;
849 
850  Double_t minPtHigh=2.0;
851  Double_t maxPtHigh=4.0;
852 
853  if(((AliConversionPhotonCuts*)fConversionCutArray->At(fiCut))->PhotonIsSelectedMC(candidate,fMCEvent,kTRUE)){
854  fGammaMCConvPt = candidate->Pt();
855  fGammaMCConvTheta = candidate->Theta();
856  TParticle* daughter1 = (TParticle *)fMCEvent->Particle(candidate->GetFirstDaughter());
857  // TParticle* daughter2 = (TParticle *)fMCEvent->Particle(candidate->GetLastDaughter());
858 
859  // hMCConversionMappingRZ[fiCut]->Fill(daughter1->Vz(),daughter1->R());
860  hMCConversionMappingRPhi[fiCut]->Fill(candidate->Phi(),daughter1->R());
861  hMCConversionEta[fiCut]->Fill(candidate->Eta());
862  hMCConversionPt[fiCut]->Fill(candidate->Pt());
863  hMCConversionR[fiCut]->Fill(daughter1->R());
864  hMCConversionPtvsR[fiCut]->Fill(candidate->Pt(),daughter1->R());
865  if (fGammaMCConvPt>minPt && fGammaMCConvPt<maxPt){
866  hMCConversionMidPtR[fiCut]->Fill(daughter1->R());
867  }else if(fGammaMCConvPt>minPtHigh && fGammaMCConvPt<maxPtHigh){
868  hMCConversionHighPtR[fiCut]->Fill(daughter1->R());
869  }
870  if (candidate->Eta()>0) {
871  hMCConversionEtaPR[fiCut]->Fill(daughter1->R());
872  }else {
873  hMCConversionEtaNR[fiCut]->Fill(daughter1->R());
874  }
875 
876 
877  } // Converted MC Gamma
878 }
879 //
880 // ///________________________________________________________________________
882  // Loop over all primary MC particle
883  for(Int_t i = 0; i < fMCEvent->GetNumberOfPrimaries(); i++) {
884  TParticle* particle = (TParticle *)fMCEvent->Particle(i);
885  if (!particle) continue;
886 
887 
888  if(fMCEvent && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 0){
889  Int_t isPosFromMBHeader
890  = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCEvent, fInputEvent);
891  Int_t isNegFromMBHeader
892  = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCEvent, fInputEvent);
893  if( (isNegFromMBHeader < 1) || (isPosFromMBHeader < 1)) continue;
894  }
895 
896 
897  if (particle->GetPdgCode() == 111 && particle->GetFirstDaughter() >= fMCEvent->GetNumberOfPrimaries()){
898  // cout << "Undecayed pi0 found with mother: " << particle->GetMother(0) << endl;
899  for (Int_t j = 0; j < 2 ; j++){
900  FillMCTree(particle->GetDaughter(j));
901  }
902  } else {
903  FillMCTree(i);
904  }
905 
906  }
907 }
908 
911 
912  // Fill Histograms for QA and MC
913  TList *GammaCandidatesStepTwo = new TList();
914 
915  //not needed here already calculated
916  //fNESDtracksEta09 = CountTracks09();
917  for(Int_t firstGammaIndex=0;firstGammaIndex<fConversionGammas->GetEntriesFast();firstGammaIndex++){
918  AliAODConversionPhoton *gamma= (AliAODConversionPhoton*)fConversionGammas->At(firstGammaIndex);
919 
920  if (gamma == NULL) continue;
921 
922  if(!((AliConversionPhotonCuts*)fConversionCutArray->At(fiCut))->PhotonIsSelected(gamma,fInputEvent))continue;
923 
924  if( ! ((AliConversionPhotonCuts*)fConversionCutArray->At(fiCut))->UseToCloseV0sCut()){
925  fGammaCandidates->Add(gamma); // if no second loop is required add to events good gammas
926  }else if(((AliConversionPhotonCuts*)fConversionCutArray->At(fiCut))->UseToCloseV0sCut()) { // shared electron is disabled, step one not needed -> step two
927  GammaCandidatesStepTwo->Add(gamma);
928  }
929  }
930 
931  if(((AliConversionPhotonCuts*)fConversionCutArray->At(fiCut))->UseToCloseV0sCut()){
932  for(Int_t i = 0;i<GammaCandidatesStepTwo->GetEntries();i++){
933  AliAODConversionPhoton* PhotonCandidate = (AliAODConversionPhoton*) GammaCandidatesStepTwo->At(i);
934  if(!PhotonCandidate) continue;
935  if(!((AliConversionPhotonCuts*)fConversionCutArray->At(fiCut))->RejectToCloseV0s(PhotonCandidate,GammaCandidatesStepTwo,i)) continue;
936  fGammaCandidates->Add(PhotonCandidate); // Add gamma to current cut TList
937  }
938  }
939 
940 
941 
942 
943  for(Int_t firstGammaIndex=0;firstGammaIndex<fGammaCandidates->GetEntries();firstGammaIndex++){
944  AliAODConversionPhoton *gamma=dynamic_cast<AliAODConversionPhoton*>(fGammaCandidates->At(firstGammaIndex));
945  if (gamma==NULL) continue;
946 
947  fGammaPt = gamma->GetPhotonPt();
948  fGammaTheta = gamma->GetPhotonTheta();
949  fGammaChi2NDF = gamma->GetChi2perNDF();
950 
951 
952  AliVTrack * negTrack = ((AliConversionPhotonCuts*)fConversionCutArray->At(fiCut))->GetTrack(fInputEvent, gamma->GetTrackLabelNegative());
953  AliVTrack * posTrack = ((AliConversionPhotonCuts*)fConversionCutArray->At(fiCut))->GetTrack(fInputEvent, gamma->GetTrackLabelPositive());
954 
955 
956  Double_t asym=0.;
957  if(gamma->GetPhotonP()!=0){
958  asym=negTrack->P()/gamma->GetPhotonP();
959  }
960  Double_t mcPhotonPt = 0.;
961  Double_t mcPhotonR = 0.;
962 
963  fKind = 9;
964 
965  if(fIsMC>0){
966 
967  const AliVVertex* primVtxMC = fMCEvent->GetPrimaryVertex();
968  Double_t mcProdVtxX = primVtxMC->GetX();
969  Double_t mcProdVtxY = primVtxMC->GetY();
970  Double_t mcProdVtxZ = primVtxMC->GetZ();
971 
972  TParticle *posDaughter = gamma->GetPositiveMCDaughter(fMCEvent);
973  TParticle *negDaughter = gamma->GetNegativeMCDaughter(fMCEvent);
974  // cout << "generate Daughters: "<<posDaughter << "\t" << negDaughter << endl;
975 
976  if(fMCEvent && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 0){
977  Int_t isPosFromMBHeader
978  = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(gamma->GetMCLabelPositive(), fMCEvent, fInputEvent);
979  Int_t isNegFromMBHeader
980  = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(gamma->GetMCLabelNegative(), fMCEvent, fInputEvent);
981  if( (isNegFromMBHeader < 1) || (isPosFromMBHeader < 1)) continue;
982  }
983 
984  if(posDaughter == NULL || negDaughter == NULL){
985  fKind = 9; // garbage
986  // cout << "one of the daughters not available" << endl;
987  } else if(posDaughter->GetMother(0) != negDaughter->GetMother(0) || (posDaughter->GetMother(0) == negDaughter->GetMother(0) && posDaughter->GetMother(0) ==-1)){
988  // Not Same Mother == Combinatorial Bck
989  fKind = 1;
990  // cout << "not the same mother" << endl;
991  Int_t pdgCodePos;
992  if (posDaughter->GetPdgCode()) pdgCodePos = posDaughter->GetPdgCode(); else continue;
993  Int_t pdgCodeNeg;
994  if (negDaughter->GetPdgCode()) pdgCodeNeg = negDaughter->GetPdgCode(); else continue;
995  // cout << "PDG codes daughters: " << pdgCodePos << "\t" << pdgCodeNeg << endl;
996  if(TMath::Abs(pdgCodePos)==11 && TMath::Abs(pdgCodeNeg)==11)
997  fKind = 10; //Electron Combinatorial
998  if(TMath::Abs(pdgCodePos)==11 && TMath::Abs(pdgCodeNeg)==11 && (posDaughter->GetMother(0) == negDaughter->GetMother(0) && posDaughter->GetMother(0) ==-1))
999  fKind = 15; //direct Electron Combinatorial
1000 
1001  if(TMath::Abs(pdgCodePos)==211 && TMath::Abs(pdgCodeNeg)==211)
1002  fKind = 11; //Pion Combinatorial
1003  if((TMath::Abs(pdgCodePos)==211 && TMath::Abs(pdgCodeNeg)==2212) ||
1004  (TMath::Abs(pdgCodePos)==2212 && TMath::Abs(pdgCodeNeg)==211))
1005  fKind = 12; //Pion, Proton Combinatorics
1006  if((TMath::Abs(pdgCodePos)==211 && TMath::Abs(pdgCodeNeg)==11) ||
1007  (TMath::Abs(pdgCodePos)==11 && TMath::Abs(pdgCodeNeg)==211))
1008  fKind = 13; //Pion, Electron Combinatorics
1009  if (TMath::Abs(pdgCodePos)==321 || TMath::Abs(pdgCodeNeg)==321)
1010  fKind = 14; //Kaon combinatorics
1011 
1012  } else {
1013  // cout << "same mother" << endl;
1014  Int_t pdgCodePos;
1015  if (posDaughter->GetPdgCode()) pdgCodePos = posDaughter->GetPdgCode(); else continue;
1016  Int_t pdgCodeNeg;
1017  if (negDaughter->GetPdgCode()) pdgCodeNeg = negDaughter->GetPdgCode(); else continue;
1018  // cout << "PDG codes daughters: " << pdgCodePos << "\t" << pdgCodeNeg << endl;
1019  Int_t pdgCode;
1020  if (gamma->GetMCParticle(fMCEvent)->GetPdgCode()) pdgCode = gamma->GetMCParticle(fMCEvent)->GetPdgCode(); else continue;
1021  // cout << "PDG code: " << pdgCode << endl;
1022  if(TMath::Abs(pdgCodePos)!=11 || TMath::Abs(pdgCodeNeg)!=11)
1023  fKind = 2; // combinatorics from hadronic decays
1024  else if ( !(pdgCodeNeg==pdgCodePos)){
1025  TParticle *truePhotonCanditate = gamma->GetMCParticle(fMCEvent);
1026  Int_t motherLabelPhoton = truePhotonCanditate->GetMother(0);
1027  Bool_t gammaIsPrimary = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryESD( fMCEvent, posDaughter->GetMother(0), mcProdVtxX, mcProdVtxY, mcProdVtxZ);
1028  if(pdgCode == 111)
1029  fKind = 3; // pi0 Dalitz
1030  else if (pdgCode == 221)
1031  fKind = 4; // eta Dalitz
1032  else if (!(negDaughter->GetUniqueID() != 5 || posDaughter->GetUniqueID() !=5)){
1033  if(pdgCode == 22 && gammaIsPrimary){
1034  fKind = 0; // primary photons
1035  mcPhotonR= negDaughter->R();
1036  mcPhotonPt=gamma->GetMCParticle(fMCEvent)->Pt();
1037  } else if (pdgCode == 22){
1038  fKind = 5; //secondary photons
1039  }
1040  } else fKind = 9; //garbage
1041  } else fKind = 9; //garbage
1042  }
1043  }
1044 
1045 
1046 
1047 
1048  Double_t minPt=0.4;
1049  Double_t maxPt=1.5;
1050  Double_t minPtHigh=2.0;
1051  Double_t maxPtHigh=4.0;
1052 
1053 
1056  hESDConversionEta[fiCut]->Fill(gamma->GetPhotonEta());
1057  hESDConversionPt[fiCut]->Fill(gamma->GetPhotonPt());
1058  if(gamma->GetConversionRadius()>5){
1059  hESDConversionPt5cm[fiCut]->Fill(gamma->GetPhotonPt());
1060  }
1061  hESDConversionR[fiCut]->Fill(gamma->GetConversionRadius());
1062  hESDConversionPtvsR[fiCut]->Fill(gamma->GetPhotonPt(),gamma->GetConversionRadius());
1063  hESDConversionAsymP[fiCut]->Fill(gamma->GetPhotonP(),asym);
1064 
1065  if(fInputEvent->IsA()==AliESDEvent::Class()){
1066  AliESDEvent *esdEvent = dynamic_cast<AliESDEvent*>(fInputEvent);
1067  if(esdEvent){
1068  AliESDv0 *v0 = esdEvent->GetV0(gamma->GetV0Index());
1069  hESDConversionDCA[fiCut]->Fill(v0->GetDcaV0Daughters());
1070  if(gamma->GetPhotonPt()>minPt && gamma->GetPhotonPt()<maxPt){
1071  hESDConversionMidPtDCA[fiCut]->Fill(v0->GetDcaV0Daughters());
1072  }else if(gamma->GetPhotonPt()>minPtHigh && gamma->GetPhotonPt()<maxPtHigh){
1073  hESDConversionHighPtDCA[fiCut]->Fill(v0->GetDcaV0Daughters());
1074  }
1075  }
1076  }
1077 
1078 
1079  hESDConversionPsiPair[fiCut]->Fill(gamma->GetPsiPair());
1080  hESDConversionChi2[fiCut]->Fill(gamma->GetChi2perNDF());
1081  hESDConversionMass[fiCut]->Fill(gamma->GetInvMassPair());
1082 
1083 
1084  if(gamma->GetPhotonPt()>minPt && gamma->GetPhotonPt()<maxPt){
1085  hESDConversionMidPtEta[fiCut]->Fill(gamma->GetPhotonEta());
1087  }else if(gamma->GetPhotonPt()>minPtHigh && gamma->GetPhotonPt()<maxPtHigh){
1088  hESDConversionHighPtEta[fiCut]->Fill(gamma->GetPhotonEta());
1090  }
1091 
1092  if(gamma->GetPhotonEta() >0){
1094  }else{
1096  }
1097 
1098 
1099  Double_t convR = gamma->GetConversionRadius();
1102 
1103  if(fIsMC>0){
1104  if(fKind==0 || fKind==5){
1107  hMCTrueConversionEta[fiCut]->Fill(gamma->GetPhotonEta());
1108  hMCTrueConversionPt[fiCut]->Fill(gamma->GetPhotonPt());
1109  if(gamma->GetConversionRadius()>5){
1110  hMCTrueConversionPt5cm[fiCut]->Fill(gamma->GetPhotonPt());
1111  }
1112  hMCTrueConversionR[fiCut]->Fill(gamma->GetConversionRadius());
1113  hMCTrueConversionPtvsR[fiCut]->Fill(mcPhotonPt,mcPhotonR);
1114  hMCTrueConversionAsymP[fiCut]->Fill(gamma->GetPhotonP(),asym);
1115  hMCTrueConversionPsiPair[fiCut]->Fill(gamma->GetPsiPair());
1116  hMCTrueConversionChi2[fiCut]->Fill(gamma->GetChi2perNDF());
1117  hMCTrueConversionMass[fiCut]->Fill(gamma->GetInvMassPair());
1118  if(fInputEvent->IsA()==AliESDEvent::Class()){
1119  AliESDEvent *esdEvent = dynamic_cast<AliESDEvent*>(fInputEvent);
1120  if(esdEvent){
1121  AliESDv0 *v0 = esdEvent->GetV0(gamma->GetV0Index());
1122  hMCTrueConversionDCA[fiCut]->Fill(v0->GetDcaV0Daughters());
1123  if(gamma->GetPhotonPt()>minPt && gamma->GetPhotonPt()<maxPt){
1124  hMCTrueConversionMidPtDCA[fiCut]->Fill(v0->GetDcaV0Daughters());
1125  }else if(gamma->GetPhotonPt()>minPtHigh && gamma->GetPhotonPt()<maxPtHigh){
1126  hMCTrueConversionHighPtDCA[fiCut]->Fill(v0->GetDcaV0Daughters());
1127  }
1128 
1129  }
1130  }
1131 
1132 
1133  if(gamma->GetPhotonPt()>minPt && gamma->GetPhotonPt()<maxPt){
1135  hMCTrueConversionMidPtEta[fiCut]->Fill(gamma->GetPhotonEta());
1136  }else if(gamma->GetPhotonPt()>minPtHigh && gamma->GetPhotonPt()<maxPtHigh){
1138  hMCTrueConversionHighPtEta[fiCut]->Fill(gamma->GetPhotonEta());
1139  }
1140 
1141  if(gamma->GetPhotonEta() >0){
1143  }else{
1145  }
1146  }
1147 
1148  if(fKind==3){
1149  hMCTruePi0DalConversionEta[fiCut]->Fill(gamma->GetPhotonEta());
1150  hMCTruePi0DalConversionPt[fiCut]->Fill(gamma->GetPhotonPt());
1152  if(gamma->GetPhotonPt()>minPt && gamma->GetPhotonPt()<maxPt){
1155  }else if(gamma->GetPhotonPt()>minPtHigh && gamma->GetPhotonPt()<maxPtHigh){
1158  }
1159  }
1160  if(fKind==4){
1161  hMCTrueEtaDalConversionEta[fiCut]->Fill(gamma->GetPhotonEta());
1162  hMCTrueEtaDalConversionPt[fiCut]->Fill(gamma->GetPhotonPt());
1164  if(gamma->GetPhotonPt()>minPt && gamma->GetPhotonPt()<maxPt){
1167  }else if (gamma->GetPhotonPt()>minPtHigh && gamma->GetPhotonPt()<maxPtHigh){
1170  }
1171  }
1172  if(fKind==1 || fKind==10 || fKind==11 || fKind==12 || fKind==13 || fKind==14 || fKind==15){
1173  hMCTrueCombConversionEta[fiCut]->Fill(gamma->GetPhotonEta());
1174  hMCTrueCombConversionPt[fiCut]->Fill(gamma->GetPhotonPt());
1176  if(gamma->GetPhotonPt()>minPt && gamma->GetPhotonPt()<maxPt){
1179  }else if(gamma->GetPhotonPt()>minPtHigh && gamma->GetPhotonPt()<maxPtHigh){
1182  }
1183  }
1184  }
1185  }
1186 
1187  delete GammaCandidatesStepTwo;
1188  GammaCandidatesStepTwo = 0x0;
1189 
1190 
1191 }
1192 
1193 //________________________________________________________________________
1195  Int_t fNumberOfESDTracks = 0;
1196  if(fInputEvent->IsA()==AliESDEvent::Class()){
1197  // Using standard function for setting Cuts
1198 
1199  Bool_t selectPrimaries=kTRUE;
1200  AliESDtrackCuts *EsdTrackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2010(selectPrimaries);
1201  EsdTrackCuts->SetMaxDCAToVertexZ(2);
1202  EsdTrackCuts->SetEtaRange(-0.9, 0.9);
1203  EsdTrackCuts->SetPtRange(0.15);
1204 
1205  for(Int_t iTracks = 0; iTracks < fInputEvent->GetNumberOfTracks(); iTracks++){
1206  AliESDtrack* curTrack = (AliESDtrack*) fInputEvent->GetTrack(iTracks);
1207  if(!curTrack) continue;
1208  if(EsdTrackCuts->AcceptTrack(curTrack) ){
1209  if (fMCEvent){
1210  if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 0){
1211  Int_t isFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(TMath::Abs(curTrack->GetLabel()), fMCEvent, fInputEvent);
1212  if( (isFromMBHeader < 1) ) continue;
1213  }
1214  }
1215  fNumberOfESDTracks++;
1216  }
1217  }
1218  delete EsdTrackCuts;
1219  EsdTrackCuts=0x0;
1220  }
1221  return fNumberOfESDTracks;
1222 }
1223 
1224 //________________________________________________________________________
1226  Int_t fNumberOfESDTracks = 0;
1227  if(fInputEvent->IsA()==AliESDEvent::Class()){
1228  // Using standard function for setting Cuts
1229 
1230  AliESDtrackCuts *EsdTrackCuts = AliESDtrackCuts::GetStandardTPCOnlyTrackCuts();
1231  EsdTrackCuts->SetMaxDCAToVertexZ(5);
1232  EsdTrackCuts->SetEtaRange(0.9, 1.4);
1233  EsdTrackCuts->SetPtRange(0.15);
1234 
1235  for(Int_t iTracks = 0; iTracks < fInputEvent->GetNumberOfTracks(); iTracks++){
1236  AliESDtrack* curTrack = (AliESDtrack*) fInputEvent->GetTrack(iTracks);
1237  if(!curTrack) continue;
1238  if(EsdTrackCuts->AcceptTrack(curTrack) ){
1239  if (fMCEvent){
1240  if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 0){
1241  Int_t isFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(TMath::Abs(curTrack->GetLabel()), fMCEvent, fInputEvent);
1242  if( (isFromMBHeader < 1) ) continue;
1243  }
1244  }
1245  fNumberOfESDTracks++;
1246  }
1247  }
1248  EsdTrackCuts->SetEtaRange(-1.4, -0.9);
1249  for(Int_t iTracks = 0; iTracks < fInputEvent->GetNumberOfTracks(); iTracks++){
1250  AliESDtrack* curTrack =(AliESDtrack*) fInputEvent->GetTrack(iTracks);
1251  if(!curTrack) continue;
1252  if(EsdTrackCuts->AcceptTrack(curTrack) ){
1253  if (fMCEvent){
1254  if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 0){
1255  Int_t isFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(TMath::Abs(curTrack->GetLabel()), fMCEvent, fInputEvent);
1256  if( (isFromMBHeader < 1) ) continue;
1257  }
1258  }
1259  fNumberOfESDTracks++;
1260  }
1261  }
1262  delete EsdTrackCuts;
1263  EsdTrackCuts=0x0;
1264  }
1265 
1266  return fNumberOfESDTracks;
1267 }
1268 
1269 //________________________________________________________________________
1271 {
1272 // if (fStreamMaterial){
1273 // fStreamMaterial->GetFile()->Write();
1274 // }
1275 }
TParticle * GetMCParticle(AliMCEvent *mcEvent)
virtual Double_t GetPhotonPhi() const
double Double_t
Definition: External.C:58
Definition: External.C:260
Definition: External.C:236
virtual Double_t GetPhotonTheta() const
TParticle * GetPositiveMCDaughter(AliMCEvent *mcEvent)
virtual void UserExec(Option_t *option)
Bool_t GetProduceV0FindingEfficiency()
TParticle * GetNegativeMCDaughter(AliMCEvent *mcEvent)
virtual Double_t GetPhotonP() const
int Int_t
Definition: External.C:63
AliConversionPhotonCuts * GetConversionCuts()
Definition: AliV0ReaderV1.h:79
Class handling all kinds of selection cuts for Gamma Conversion analysis.
virtual Double_t GetPhotonEta() const
TClonesArray * GetReconstructedGammas() const
Definition: AliV0ReaderV1.h:75
virtual Double_t GetPhotonPt() const
Class handling all kinds of selection cuts for Gamma Conversion analysis.
AliConvEventCuts * GetEventCuts()
Definition: AliV0ReaderV1.h:80
const char Option_t
Definition: External.C:48
bool Bool_t
Definition: External.C:53
Double_t GetConversionRadius() const
TList * GetV0FindingEfficiencyHistograms()