AliPhysics  9b6b435 (9b6b435)
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  fDeDxMapList(NULL),
49  fOutputList(NULL),
50  fAllMCGammaList(NULL),
51  fAllMCConvGammaList(NULL),
52  fPrimVtxZ(0.),
53  fNContrVtx(0),
54  fNESDtracksEta08(0),
55  fNESDtracksEta0814(0),
56  fNESDtracksEta14(0),
57  fGammaMCPt(0.),
58  fGammaMCTheta(0.),
59  fGammaMCConvPt(0.),
60  fGammaMCConvTheta(0.),
61  fGammaPt(0.),
62  fGammaTheta(0.),
63  fGammaChi2NDF(0.),
64  fKind(0),
65  fIsHeavyIon(0),
66  fIsMC(0),
67  fInputEvent(NULL),
68  fMCEvent(NULL),
69  fnCuts(0),
70  fiCut(0),
71  fDoDeDxMaps(0),
72  fDoMultWeights(0),
73  fWeightMultMC(1),
74  hNEvents(NULL),
75  hNGoodESDTracksEta08(NULL),
76  hNGoodESDTracksWeightedEta08(NULL),
77  hNGoodESDTracksEta14(NULL),
78  hNGoodESDTracksEta08_14(NULL),
79  hESDConversionRPhi(NULL),
80  hESDConversionRZ(NULL),
81  hESDConversionRPt(NULL),
82  hESDConversionWOWeightRPt(NULL),
83  hESDConversionREta(NULL),
84  hESDConversionDCA(NULL),
85  hESDConversionPsiPair(NULL),
86  hESDConversionChi2(NULL),
87  hESDConversionMass(NULL),
88  hESDConversionRRejSmall(NULL),
89  hESDConversionRRejLarge(NULL),
90  hESDConversionAsymP(NULL),
91  hElectronRdEdx(NULL),
92  hElectronRNSigmadEdx(NULL),
93  hPositronRdEdx(NULL),
94  hPositronRNSigmadEdx(NULL),
95  hMCConversionRPhi(NULL),
96  hMCConversionRPt(NULL),
97  hMCConversionWOWeightRPt(NULL),
98  hMCConversionREta(NULL),
99  hMCConversionRRejSmall(NULL),
100  hMCConversionRRejLarge(NULL),
101  hMCAllGammaPt(NULL),
102  hMCAllGammaWOWeightPt(NULL),
103  hMCAllSecondaryGammaPt(NULL),
104  hMCSecondaryConvGammaPtR(NULL),
105  hMCTrueConversionRPhi(NULL),
106  hMCTrueConversionRZ(NULL),
107  hMCTrueConversionRPt(NULL),
108  hMCTrueConversionWOWeightRPt(NULL),
109  hMCTrueConversionRPtMCRPt(NULL),
110  hMCTrueConversionWOWeightRPtMCRPt(NULL),
111  hMCTrueConversionREta(NULL),
112  hMCTrueConversionDCA(NULL),
113  hMCTrueConversionPsiPair(NULL),
114  hMCTrueConversionChi2(NULL),
115  hMCTrueConversionMass(NULL),
116  hMCTrueConversionAsymP(NULL),
117  hMCTrueConversionRRejSmall(NULL),
118  hMCTrueConversionRRejLarge(NULL),
119  hMCTruePrimConversionRPt(NULL),
120  hMCTruePrimConversionWOWeightRPt(NULL),
121  hMCTrueSecConversionRPt(NULL),
122  hMCTrueSecondaryConvGammaRPt(NULL),
123  hMCTrueSecondaryConvGammaMCRPt(NULL),
124  hMCTruePi0DalConversionRPt(NULL),
125  hMCTruePi0DalConversionEta(NULL),
126  hMCTrueEtaDalConversionRPt(NULL),
127  hMCTrueEtaDalConversionEta(NULL),
128  hMCTrueCombinatorialConversionRPt(NULL),
129  hMCTrueCombinatorialConversionEta(NULL),
130  hPositrondEdxMapsR0(NULL),
131  hElectrondEdxMapsR0(NULL),
132  hPositrondEdxMapsR1(NULL),
133  hElectrondEdxMapsR1(NULL),
134  hPositrondEdxMapsR2(NULL),
135  hElectrondEdxMapsR2(NULL),
136  hPositrondEdxMapsR3(NULL),
137  hElectrondEdxMapsR3(NULL)
138 {
139 
140 }
141 
142 
143 //________________________________________________________________________
145  fV0Reader(NULL),
146  fV0ReaderName("V0ReaderV1"),
147  fConversionGammas(NULL),
148  fGammaCandidates(NULL),
149  fConversionCutArray(NULL),
150  fEventCutArray(NULL),
151  fCutFolder(NULL),
152  fESDList(NULL),
153  fTrueList(NULL),
154  fMCList(NULL),
155  fDeDxMapList(NULL),
156  fOutputList(NULL),
157  fAllMCGammaList(NULL),
158  fAllMCConvGammaList(NULL),
159  fPrimVtxZ(0.),
160  fNContrVtx(0),
161  fNESDtracksEta08(0),
162  fNESDtracksEta0814(0),
163  fNESDtracksEta14(0),
164  fGammaMCPt(0.),
165  fGammaMCTheta(0.),
166  fGammaMCConvPt(0.),
167  fGammaMCConvTheta(0.),
168  fGammaPt(0.),
169  fGammaTheta(0.),
170  fGammaChi2NDF(0.),
171  fKind(0),
172  fIsHeavyIon(0),
173  fIsMC(0),
174  fInputEvent(NULL),
175  fMCEvent(NULL),
176  fnCuts(0),
177  fiCut(0),
178  fDoDeDxMaps(0),
179  fDoMultWeights(0),
180  fWeightMultMC(1),
181  hNEvents(NULL),
182  hNGoodESDTracksEta08(NULL),
183  hNGoodESDTracksWeightedEta08(NULL),
184  hNGoodESDTracksEta14(NULL),
185  hNGoodESDTracksEta08_14(NULL),
186  hESDConversionRPhi(NULL),
187  hESDConversionRZ(NULL),
188  hESDConversionRPt(NULL),
189  hESDConversionWOWeightRPt(NULL),
190  hESDConversionREta(NULL),
191  hESDConversionDCA(NULL),
192  hESDConversionPsiPair(NULL),
193  hESDConversionChi2(NULL),
194  hESDConversionMass(NULL),
195  hESDConversionRRejSmall(NULL),
196  hESDConversionRRejLarge(NULL),
197  hESDConversionAsymP(NULL),
198  hElectronRdEdx(NULL),
199  hElectronRNSigmadEdx(NULL),
200  hPositronRdEdx(NULL),
201  hPositronRNSigmadEdx(NULL),
202  hMCConversionRPhi(NULL),
203  hMCConversionRPt(NULL),
204  hMCConversionWOWeightRPt(NULL),
205  hMCConversionREta(NULL),
206  hMCConversionRRejSmall(NULL),
207  hMCConversionRRejLarge(NULL),
208  hMCAllGammaPt(NULL),
209  hMCAllSecondaryGammaPt(NULL),
210  hMCSecondaryConvGammaPtR(NULL),
211  hMCTrueConversionRPhi(NULL),
212  hMCTrueConversionRZ(NULL),
213  hMCTrueConversionRPt(NULL),
214  hMCTrueConversionWOWeightRPt(NULL),
215  hMCTrueConversionRPtMCRPt(NULL),
216  hMCTrueConversionWOWeightRPtMCRPt(NULL),
217  hMCTrueConversionREta(NULL),
218  hMCTrueConversionDCA(NULL),
219  hMCTrueConversionPsiPair(NULL),
220  hMCTrueConversionChi2(NULL),
221  hMCTrueConversionMass(NULL),
222  hMCTrueConversionAsymP(NULL),
223  hMCTrueConversionRRejSmall(NULL),
224  hMCTrueConversionRRejLarge(NULL),
225  hMCTruePrimConversionRPt(NULL),
226  hMCTruePrimConversionWOWeightRPt(NULL),
227  hMCTrueSecConversionRPt(NULL),
228  hMCTrueSecondaryConvGammaRPt(NULL),
229  hMCTrueSecondaryConvGammaMCRPt(NULL),
230  hMCTruePi0DalConversionRPt(NULL),
231  hMCTruePi0DalConversionEta(NULL),
232  hMCTrueEtaDalConversionRPt(NULL),
233  hMCTrueEtaDalConversionEta(NULL),
234  hMCTrueCombinatorialConversionRPt(NULL),
235  hMCTrueCombinatorialConversionEta(NULL),
236  hPositrondEdxMapsR0(NULL),
237  hElectrondEdxMapsR0(NULL),
238  hPositrondEdxMapsR1(NULL),
239  hElectrondEdxMapsR1(NULL),
240  hPositrondEdxMapsR2(NULL),
241  hElectrondEdxMapsR2(NULL),
242  hPositrondEdxMapsR3(NULL),
243  hElectrondEdxMapsR3(NULL)
244 {
245  // Default constructor
246 
247  DefineInput(0, TChain::Class());
248  DefineOutput(1, TList::Class());
249 }
250 
251 //________________________________________________________________________
253 {
254  // default deconstructor
255  if(fGammaCandidates){
256  delete fGammaCandidates;
257  fGammaCandidates = 0x0;
258  }
259 }
260 //________________________________________________________________________
262 {
263  // Create User Output Objects
264 
265  if(fOutputList != NULL){
266  delete fOutputList;
267  fOutputList = NULL;
268  }
269  if(fOutputList == NULL){
270  fOutputList = new TList();
271  fOutputList->SetOwner(kTRUE);
272  }
273 
274  // Array of current cut's gammas
275 
276  fGammaCandidates = new TList();
277  fCutFolder = new TList*[fnCuts];
278  fESDList = new TList*[fnCuts];
279  fMCList = new TList*[fnCuts];
280  fTrueList = new TList*[fnCuts];
281  if (fDoDeDxMaps>0) {
282  fDeDxMapList = new TList*[fnCuts];
283  }
284  hNEvents = new TH1F*[fnCuts];
285  hNGoodESDTracksEta08 = new TH1F*[fnCuts];
286 
287  if (fDoMultWeights>0 && fIsMC>0 ) {
289  }
290  hNGoodESDTracksEta14 = new TH1F*[fnCuts];
291  hNGoodESDTracksEta08_14 = new TH1F*[fnCuts];
293  hESDConversionRZ = new TH2F*[fnCuts];
294  hESDConversionRPt = new TH2F*[fnCuts];
297  hESDConversionDCA = new TH1F*[fnCuts];
298  hESDConversionPsiPair = new TH1F*[fnCuts];
299  hESDConversionChi2 = new TH1F*[fnCuts];
300  hESDConversionMass = new TH1F*[fnCuts];
301  hESDConversionRRejLarge = new TH1F*[fnCuts];
302  hESDConversionRRejSmall = new TH1F*[fnCuts];
304 
305  hElectronRdEdx = new TH2F*[fnCuts];
307  hPositronRdEdx = new TH2F*[fnCuts];
309 
310  if (fDoDeDxMaps>0) {
313 
316 
319 
322  }
323 
324  hMCConversionRPhi = new TH2F*[fnCuts];
325  hMCConversionRPt = new TH2F*[fnCuts];
327  hMCConversionREta = new TH2F*[fnCuts];
328  hMCConversionRRejLarge = new TH1F*[fnCuts];
329  hMCConversionRRejSmall = new TH1F*[fnCuts];
330  hMCAllGammaPt = new TH1F*[fnCuts];
331  hMCAllGammaWOWeightPt = new TH1F*[fnCuts];
334 
342  hMCTrueConversionDCA = new TH1F*[fnCuts];
343  hMCTrueConversionPsiPair = new TH1F*[fnCuts];
344  hMCTrueConversionChi2 = new TH1F*[fnCuts];
345  hMCTrueConversionMass = new TH1F*[fnCuts];
347  hMCTrueConversionRRejLarge = new TH1F*[fnCuts];
348  hMCTrueConversionRRejSmall = new TH1F*[fnCuts];
349 
353 
356 
357 
359  hMCTruePi0DalConversionEta = new TH1F*[fnCuts];
361  hMCTrueEtaDalConversionEta = new TH1F*[fnCuts];
364 
365 
366  for(Int_t iCut = 0; iCut<fnCuts;iCut++){
367 
368 
369  TString cutstringEvent = ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber();
370  TString cutstringPhoton = ((AliConversionPhotonCuts*)fConversionCutArray->At(iCut))->GetCutNumber();
371  fCutFolder[iCut] = new TList();
372  fCutFolder[iCut]->SetName(Form("Cut Number %s_%s",cutstringEvent.Data() ,cutstringPhoton.Data()));
373  fCutFolder[iCut]->SetOwner(kTRUE);
374  fOutputList->Add(fCutFolder[iCut]);
375 
376  fESDList[iCut] = new TList();
377  fESDList[iCut]->SetName(Form("%s_%s ESD histograms",cutstringEvent.Data() ,cutstringPhoton.Data()));
378  fESDList[iCut]->SetOwner(kTRUE);
379  fCutFolder[iCut]->Add(fESDList[iCut]);
380 
381  Int_t nBinsR=400;
382 // Int_t nBinsX=2000;
383 // Int_t nBinsY=2000;
384  Int_t nBinsZ=750;
385  Int_t nBinsPhi=750;
386  Int_t nBinsEta=2000;
387  Int_t nBinsPt=400;
388 
389  hNEvents[iCut] = new TH1F("NEvents","NEvents",14,-0.5,13.5);
390  hNEvents[iCut]->GetXaxis()->SetBinLabel(1,"Accepted");
391  hNEvents[iCut]->GetXaxis()->SetBinLabel(2,"Centrality");
392  hNEvents[iCut]->GetXaxis()->SetBinLabel(3,"Miss. MC or inc. ev.");
393  if (((AliConvEventCuts*)fEventCutArray->At(iCut))->IsSpecialTrigger() > 1 ){
394  TString TriggerNames = "Not Trigger: ";
395  TriggerNames = TriggerNames+ ( (AliConvEventCuts*)fEventCutArray->At(iCut))->GetSpecialTriggerName();
396  hNEvents[iCut]->GetXaxis()->SetBinLabel(4,TriggerNames.Data());
397  } else {
398  hNEvents[iCut]->GetXaxis()->SetBinLabel(4,"Trigger");
399  }
400  hNEvents[iCut]->GetXaxis()->SetBinLabel(5,"Vertex Z");
401  hNEvents[iCut]->GetXaxis()->SetBinLabel(6,"Cont. Vertex");
402  hNEvents[iCut]->GetXaxis()->SetBinLabel(7,"Pile-Up");
403  hNEvents[iCut]->GetXaxis()->SetBinLabel(8,"no SDD");
404  hNEvents[iCut]->GetXaxis()->SetBinLabel(9,"no V0AND");
405  hNEvents[iCut]->GetXaxis()->SetBinLabel(10,"EMCAL problem");
406  hNEvents[iCut]->GetXaxis()->SetBinLabel(11,"rejectedForJetJetMC");
407  hNEvents[iCut]->GetXaxis()->SetBinLabel(12,"SPD hits vs tracklet");
408  hNEvents[iCut]->GetXaxis()->SetBinLabel(13,"Out-of-Bunch pileup Past-Future");
409  hNEvents[iCut]->GetXaxis()->SetBinLabel(14,"Pileup V0M-TPCout Tracks");
410  fESDList[iCut]->Add(hNEvents[iCut]);
411 
412 
413  hNGoodESDTracksEta08[iCut] = new TH1F("GoodESDTracksEta08","GoodESDTracksEta08",4000,-0.5,4000-0.5);
414  fESDList[iCut]->Add(hNGoodESDTracksEta08[iCut]);
415  if(fDoMultWeights && fIsMC>0) {
416  hNGoodESDTracksWeightedEta08[iCut] = new TH1F("GoodESDTracksWeightedEta08","GoodESDTracksWeigthedEta08",4000,-0.5,4000-0.5);
417  hNGoodESDTracksWeightedEta08[iCut]->Sumw2();
418  fESDList[iCut]->Add(hNGoodESDTracksWeightedEta08[iCut]);
419  }
420 
421  hNGoodESDTracksEta14[iCut] = new TH1F("GoodESDTracksEta14","GoodESDTracksEta14",4000,-0.5,4000-0.5);
422  fESDList[iCut]->Add(hNGoodESDTracksEta14[iCut]);
423  hNGoodESDTracksEta08_14[iCut] = new TH1F("GoodESDTracksEta08_14","GoodESDTracksEta08_14",4000,-0.50,4000-0.5);
424  fESDList[iCut]->Add(hNGoodESDTracksEta08_14[iCut]);
425 
426  hESDConversionRPhi[iCut] = new TH2F("ESD_Conversion_RPhi","ESD_Conversion_RPhi",nBinsPhi,0.,2*TMath::Pi(),nBinsR,0.,200.);
427  fESDList[iCut]->Add(hESDConversionRPhi[iCut]);
428  hESDConversionREta[iCut] = new TH2F("ESD_Conversion_REta","ESD_Conversion_REta",nBinsEta,-2.,2.,nBinsR,0.,200.);
429  fESDList[iCut]->Add(hESDConversionREta[iCut]);
430 
431  hESDConversionRPt[iCut] = new TH2F("ESD_Conversion_RPt","ESD_Conversion_RPt",nBinsPt,0.,20.,nBinsR,0.,200.);
432  fESDList[iCut]->Add(hESDConversionRPt[iCut]);
433  hESDConversionRPt[iCut]->Sumw2();
434 
435  hESDConversionWOWeightRPt[iCut] = new TH2F("ESD_ConversionWOWeight_RPt","ESD_ConversionWOWeight_RPt",nBinsPt,0.,20.,nBinsR,0.,200.);
436  fESDList[iCut]->Add(hESDConversionWOWeightRPt[iCut]);
437 
438  hESDConversionRZ[iCut] = new TH2F("ESD_Conversion_RZ","ESD_Conversion_RZ",nBinsZ,-180.,180.,nBinsR,0.,200.);
439  fESDList[iCut]->Add(hESDConversionRZ[iCut]);
440 
441  hElectronRdEdx[iCut] = new TH2F("Electron_RdEdx","Electron_RdEdx",200,0.,200.,nBinsR,0.,200.);
442  fESDList[iCut]->Add(hElectronRdEdx[iCut]);
443  hElectronRNSigmadEdx[iCut] = new TH2F("Electron_RNSigmadEdx","Electron_RNSigmadEdx",200,-10.,10.,nBinsR,0.,200.);
444  fESDList[iCut]->Add(hElectronRNSigmadEdx[iCut]);
445  hPositronRdEdx[iCut] = new TH2F("Positron_RdEdx","Positron_RdEdx",200,0.,200.,nBinsR,0.,200.);
446  fESDList[iCut]->Add(hPositronRdEdx[iCut]);
447  hPositronRNSigmadEdx[iCut] = new TH2F("Positron_RNSigmadEdx","Positron_RNSigmadEdx",200,-10.,10.,nBinsR,0.,200.);
448  fESDList[iCut]->Add(hPositronRNSigmadEdx[iCut]);
449 
450  hESDConversionDCA[iCut] = new TH1F("ESD_Conversion_DCA","ESD_Conversion_DCA",400,0.,5.);
451  fESDList[iCut]->Add(hESDConversionDCA[iCut]);
452  hESDConversionPsiPair[iCut] = new TH1F("ESD_Conversion_PsiPair","ESD_Conversion_PsiPair",400,0.,5.);
453  fESDList[iCut]->Add(hESDConversionPsiPair[iCut]);
454  hESDConversionChi2[iCut] = new TH1F("ESD_Conversion_Chi2","ESD_Conversion_Chi2",400,0.,50.);
455  fESDList[iCut]->Add(hESDConversionChi2[iCut]);
456  hESDConversionMass[iCut] = new TH1F("ESD_Conversion_Mass","ESD_Conversion_Mass",400,0.,1.);
457  fESDList[iCut]->Add(hESDConversionMass[iCut]);
458 
459  hESDConversionRRejLarge[iCut] = new TH1F("ESD_Conversion_RLarge","ESD_Conversion_RLarge",nBinsR,0.,200.);
460  fESDList[iCut]->Add(hESDConversionRRejLarge[iCut]);
461  hESDConversionRRejSmall[iCut] = new TH1F("ESD_Conversion_RSmall","ESD_Conversion_RSmall",nBinsR,0.,200.);
462  fESDList[iCut]->Add(hESDConversionRRejSmall[iCut]);
463 
464  hESDConversionAsymP[iCut] = new TH2F("ESD_ConversionMapping_AsymP","ESD_ConversionMapping_AsymP",nBinsPt,0.01,20.,500,0.,1.);
465  fESDList[iCut]->Add(hESDConversionAsymP[iCut]);
466  TAxis *AxisAfter = hESDConversionAsymP[iCut]->GetXaxis();
467  Int_t bins = AxisAfter->GetNbins();
468  Double_t from = AxisAfter->GetXmin();
469  Double_t to = AxisAfter->GetXmax();
470  Double_t *newBins = new Double_t[bins+1];
471  newBins[0] = from;
472  Double_t factor = TMath::Power(to/from, 1./bins);
473  for(Int_t i=1; i<=bins; ++i) newBins[i] = factor * newBins[i-1];
474  AxisAfter->Set(bins, newBins);
475 
476 
477  if (fDoMultWeights>0 && fIsMC>0 ) {
478  hESDConversionRPt[iCut] ->Sumw2();
479  hESDConversionDCA[iCut] ->Sumw2();
480  hESDConversionChi2[iCut] ->Sumw2();
481  hESDConversionAsymP[iCut] ->Sumw2();
482  }
483 
484  if (fIsMC>0) {
485 
486  fMCList[iCut] = new TList();
487  fMCList[iCut]->SetName(Form("%s_%s MC histograms",cutstringEvent.Data() ,cutstringPhoton.Data()));
488  fMCList[iCut]->SetOwner(kTRUE);
489  fCutFolder[iCut]->Add(fMCList[iCut]);
490 
491  fTrueList[iCut] = new TList();
492  fTrueList[iCut]->SetName(Form("%s_%s True histograms",cutstringEvent.Data() ,cutstringPhoton.Data()));
493  fTrueList[iCut]->SetOwner(kTRUE);
494  fCutFolder[iCut]->Add(fTrueList[iCut]);
495 
496  hMCAllGammaPt[iCut] = new TH1F("MC_AllGamma_Pt","MC_AllGamma_Pt",nBinsPt,0.,20.);
497  fMCList[iCut]->Add(hMCAllGammaPt[iCut]);
498  hMCAllGammaWOWeightPt[iCut] = new TH1F("MC_AllGammaWOWeight_Pt","MC_AllGammaWOWeight_Pt",nBinsPt,0.,20.);
499  fMCList[iCut]->Add(hMCAllGammaWOWeightPt[iCut]);
500 
501  hMCAllSecondaryGammaPt[iCut] = new TH2F("MC_AllSecondaryGamma_Pt", "MC_AllSecondaryGamma_Pt", nBinsPt, 0., 20., 4, -0.5, 3.5);
502  hMCAllSecondaryGammaPt[iCut]->GetYaxis()->SetBinLabel(1,"K0s");
503  hMCAllSecondaryGammaPt[iCut]->GetYaxis()->SetBinLabel(2,"K0l");
504  hMCAllSecondaryGammaPt[iCut]->GetYaxis()->SetBinLabel(3,"Lambda");
505  hMCAllSecondaryGammaPt[iCut]->GetYaxis()->SetBinLabel(4,"rest");
506  fMCList[iCut]->Add(hMCAllSecondaryGammaPt[iCut]);
507 
508  hMCSecondaryConvGammaPtR[iCut] = new TH3F("MC_SecondaryConvGamma_PtR", "MC_SecondaryConvGamma_PtR", nBinsPt, 0., 20., nBinsR,0.,200.,4, -0.5, 3.5);
509  hMCSecondaryConvGammaPtR[iCut]->GetZaxis()->SetBinLabel(1,"K0s");
510  hMCSecondaryConvGammaPtR[iCut]->GetZaxis()->SetBinLabel(2,"K0l");
511  hMCSecondaryConvGammaPtR[iCut]->GetZaxis()->SetBinLabel(3,"Lambda");
512  hMCSecondaryConvGammaPtR[iCut]->GetZaxis()->SetBinLabel(4,"rest");
513  fMCList[iCut]->Add(hMCSecondaryConvGammaPtR[iCut]);
514 
515 
516  hMCConversionRPhi[iCut] = new TH2F("MC_Conversion_RPhi","MC_Conversion_RPhi",nBinsPhi,0.,2*TMath::Pi(),nBinsR,0.,200.);
517  fMCList[iCut]->Add(hMCConversionRPhi[iCut]);
518  hMCConversionREta[iCut] = new TH2F("MC_Conversion_REta","MC_Conversion_REta",nBinsEta,-2.,2.,nBinsR,0.,200.);
519  fMCList[iCut]->Add(hMCConversionREta[iCut]);
520  hMCConversionRPt[iCut] = new TH2F("MC_Conversion_RPt","MC_Conversion_RPt",nBinsPt,0.,20.,nBinsR,0.,200.);
521  fMCList[iCut]->Add(hMCConversionRPt[iCut]);
522  hMCConversionWOWeightRPt[iCut] = new TH2F("MC_ConversionWOWeight_RPt","MC_ConversionWOWeight_RPt",nBinsPt,0.,20.,nBinsR,0.,200.);
523  fMCList[iCut]->Add(hMCConversionWOWeightRPt[iCut]);
524 
525  hMCConversionRRejLarge[iCut] = new TH1F("MC_Conversion_RLarge","MC_Conversion_RLarge",nBinsR,0.,200.);
526  fESDList[iCut]->Add(hMCConversionRRejLarge[iCut]);
527  hMCConversionRRejSmall[iCut] = new TH1F("MC_Conversion_RSmall","MC_Conversion_RSmall",nBinsR,0.,200.);
528  fESDList[iCut]->Add(hMCConversionRRejSmall[iCut]);
529 
530  if (fDoMultWeights>0 && fIsMC>0 ) {
531  hMCConversionRPt[iCut] ->Sumw2();
532  }
533 
534  hMCTrueConversionRPhi[iCut] = new TH2F("ESD_TrueConversion_RPhi","ESD_TrueConversion_RPhi",nBinsPhi,0.,2*TMath::Pi(),nBinsR,0.,200.);
535  fTrueList[iCut]->Add(hMCTrueConversionRPhi[iCut]);
536  hMCTrueConversionREta[iCut] = new TH2F("ESD_TrueConversion_REta","ESD_TrueConversion_REta",nBinsEta,-2.,2.,nBinsR,0.,200.);
537  fTrueList[iCut]->Add(hMCTrueConversionREta[iCut]);
538  hMCTrueConversionRPt[iCut] = new TH2F("ESD_TrueConversion_RPt","ESD_TrueConversion_RPt",nBinsPt,0.,20.,nBinsR,0.,200.);
539  fTrueList[iCut]->Add(hMCTrueConversionRPt[iCut]);
540  hMCTrueConversionWOWeightRPt[iCut] = new TH2F("ESD_TrueConversionWOWeight_RPt","ESD_TrueConversionWOWeight_RPt",nBinsPt,0.,20.,nBinsR,0.,200.);
541  fTrueList[iCut]->Add(hMCTrueConversionWOWeightRPt[iCut]);
542  hMCTrueConversionRPtMCRPt[iCut] = new TH2F("ESD_TrueConversion_RPtMCRPt","ESD_TrueConversion_RPtMCRPt",nBinsPt,0.,20.,nBinsR,0.,200.);
543  fTrueList[iCut]->Add(hMCTrueConversionRPtMCRPt[iCut]);
544  hMCTrueConversionWOWeightRPtMCRPt[iCut] = new TH2F("ESD_TrueConversionWOWeight_RPtMCRPt","ESD_TrueConversionWOWeight_RPtMCRPt",nBinsPt,0.,20.,nBinsR,0.,200.);
546  hMCTrueConversionRZ[iCut] = new TH2F("ESD_TrueConversion_RZ","ESD_TrueConversion_RZ",nBinsZ,-180.,180.,nBinsR,0.,200.);
547  fTrueList[iCut]->Add(hMCTrueConversionRZ[iCut]);
548 
549  hMCTrueConversionDCA[iCut] = new TH1F("ESD_TrueConversion_DCA","ESD_TrueConversion_DCA",400,0.,5.);
550  fTrueList[iCut]->Add(hMCTrueConversionDCA[iCut]);
551  hMCTrueConversionPsiPair[iCut] = new TH1F("ESD_TrueConversion_PsiPair","ESD_TrueConversion_PsiPair",400,0.,5.);
552  fTrueList[iCut]->Add(hMCTrueConversionPsiPair[iCut]);
553  hMCTrueConversionChi2[iCut] = new TH1F("ESD_TrueConversion_Chi2","ESD_TrueConversion_Chi2",400,0.,50.);
554  fTrueList[iCut]->Add(hMCTrueConversionChi2[iCut]);
555  hMCTrueConversionMass[iCut] = new TH1F("ESD_TrueConversion_Mass","ESD_TrueConversion_Mass",400,0.,1.);
556  fTrueList[iCut]->Add(hMCTrueConversionMass[iCut]);
557 
558  hMCTrueConversionRRejLarge[iCut] = new TH1F("ESD_TrueConversion_RLarge","ESD_TrueConversion_RLarge",nBinsR,0.,200.);
559  fESDList[iCut]->Add(hMCTrueConversionRRejLarge[iCut]);
560  hMCTrueConversionRRejSmall[iCut] = new TH1F("ESD_TrueConversion_RSmall","ESD_TrueConversion_RSmall",nBinsR,0.,200.);
561  fESDList[iCut]->Add(hMCTrueConversionRRejSmall[iCut]);
562 
563  hMCTruePrimConversionRPt[iCut] = new TH2F("ESD_TruePrimConversion_RPt","ESD_TruePrimConversion_RPt",nBinsPt,0.,20.,nBinsR,0.,200.);
564  fTrueList[iCut]->Add(hMCTruePrimConversionRPt[iCut]);
565  hMCTruePrimConversionWOWeightRPt[iCut] = new TH2F("ESD_TruePrimConversionWOWeight_RPt","ESD_TruePrimConversionWOWeight_RPt",nBinsPt,0.,20.,nBinsR,0.,200.);
567 
568 
569  hMCTrueSecConversionRPt[iCut] = new TH2F("ESD_TrueSecConversion_RPt","ESD_TrueSecConversion_RPt",nBinsPt,0.,20.,nBinsR,0.,200.);
570  fTrueList[iCut]->Add(hMCTrueSecConversionRPt[iCut]);
571 
572  hMCTrueSecondaryConvGammaRPt[iCut] = new TH3F("ESD_TrueSecondaryConvGamma_Pt", "ESD_TrueSecondaryConvGamma_Pt", nBinsPt,0.,20.,nBinsR,0.,200. , 4, -0.5, 3.5);
573  hMCTrueSecondaryConvGammaRPt[iCut]->GetZaxis()->SetBinLabel(1,"K0s");
574  hMCTrueSecondaryConvGammaRPt[iCut]->GetZaxis()->SetBinLabel(2,"K0l");
575  hMCTrueSecondaryConvGammaRPt[iCut]->GetZaxis()->SetBinLabel(3,"Lambda");
576  hMCTrueSecondaryConvGammaRPt[iCut]->GetZaxis()->SetBinLabel(4,"rest");
577  fTrueList[iCut]->Add(hMCTrueSecondaryConvGammaRPt[iCut]);
578  hMCTrueSecondaryConvGammaMCRPt[iCut] = new TH3F("ESD_TrueSecondaryConvGamma_MCPt", "ESD_TrueSecondaryConvGamma_MCPt", nBinsPt, 0.,20.,nBinsR,0.,200., 4, -0.5, 3.5);
579  hMCTrueSecondaryConvGammaMCRPt[iCut]->GetZaxis()->SetBinLabel(1,"K0s");
580  hMCTrueSecondaryConvGammaMCRPt[iCut]->GetZaxis()->SetBinLabel(2,"K0l");
581  hMCTrueSecondaryConvGammaMCRPt[iCut]->GetZaxis()->SetBinLabel(3,"Lambda");
582  hMCTrueSecondaryConvGammaMCRPt[iCut]->GetZaxis()->SetBinLabel(4,"rest");
583  fTrueList[iCut]->Add(hMCTrueSecondaryConvGammaMCRPt[iCut]);
584 
585 
586 
587 
588  hMCTruePi0DalConversionRPt[iCut] = new TH2F("ESD_TruePi0DalConversion_RPt","ESD_TruePi0DalConversion_RPt",nBinsPt,0.,20.,nBinsR,0.,200.);
589  fTrueList[iCut]->Add(hMCTruePi0DalConversionRPt[iCut]);
590  hMCTruePi0DalConversionEta[iCut] = new TH1F("ESD_TruePi0DalConversion_Eta","ESD_TruePi0DalConversion_Eta",nBinsEta,-2.,2.);
591  fTrueList[iCut]->Add(hMCTruePi0DalConversionEta[iCut]);
592 
593  hMCTrueEtaDalConversionRPt[iCut] = new TH2F("ESD_TrueEtaDalConversion_RPt","ESD_TrueEtaDalConversion_RPt",nBinsPt,0.,20.,nBinsR,0.,200.);
594  fTrueList[iCut]->Add(hMCTrueEtaDalConversionRPt[iCut]);
595  hMCTrueEtaDalConversionEta[iCut] = new TH1F("ESD_TrueEtaDalConversion_Eta","ESD_TrueEtaDalConversion_Eta",nBinsEta,-2.,2.);
596  fTrueList[iCut]->Add(hMCTrueEtaDalConversionEta[iCut]);
597 
598  hMCTrueCombinatorialConversionRPt[iCut] = new TH2F("ESD_TrueCombinatorialConversion_RPt","ESD_TrueCombinatorialConversion_RPt",nBinsPt,0.,20.,nBinsR,0.,200.);
600  hMCTrueCombinatorialConversionEta[iCut] = new TH1F("ESD_TrueCombinatorialConversion_Eta","ESD_TrueCombinatorialConversion_Eta",nBinsEta,-2.,2.);
602 
603  hMCTrueConversionAsymP[iCut] = new TH2F("ESD_TrueConversionMapping_AsymP","ESD_TrueConversionMapping_AsymP",nBinsPt,0.01,20.,500,0.,1.);
604  fTrueList[iCut]->Add(hMCTrueConversionAsymP[iCut]);
605 
606  AxisAfter = hMCTrueConversionAsymP[iCut]->GetXaxis();
607  AxisAfter->Set(bins, newBins);
608 
609  if (fDoMultWeights>0 && fIsMC>0 ) {
610  hMCTrueConversionRPt[iCut] ->Sumw2();
611  hMCTrueConversionRPtMCRPt[iCut] -> Sumw2();
612  hMCTrueConversionDCA[iCut] ->Sumw2();
613  hMCTrueConversionChi2[iCut] ->Sumw2();
614  hMCTrueConversionAsymP[iCut] ->Sumw2();
615  hMCTruePrimConversionRPt[iCut] ->Sumw2();
616  hMCTrueSecConversionRPt[iCut] ->Sumw2();
617  hMCTrueSecondaryConvGammaRPt[iCut]->Sumw2();
618  hMCTrueSecondaryConvGammaMCRPt[iCut]->Sumw2();
619  }
620 
621  }
622 
623  Int_t nPBins =12;
624  Int_t nEtaBins =20;
625  Int_t nSigmaDeDxBins=100;
626  Double_t *arrPBinning = new Double_t[13];
627  for( Int_t i=0;i<nPBins+1;i++){
628  if(i==0){
629  arrPBinning[i]= 0.05;
630  }else if(i>0 && i<11){
631  arrPBinning[i]= 0.1*i;
632  }else if(i==11){
633  arrPBinning[i]= 2.0;
634  }else if(i==12){
635  arrPBinning[i]= 10.0;
636  }
637  //cout<< "pbins::"<< i << " " << arrPBinning[i]<< endl;
638  }
639  Double_t *arrEtaBinning = new Double_t[21];
640  for( Int_t i=0;i<nEtaBins+1;i++){
641  arrEtaBinning[i]= -1.+0.1*i;
642  //cout<< "Etabins::"<< i << " " << arrEtaBinning[i]<< endl;
643  }
644  Double_t *arrSigmaDeDxBinning = new Double_t[101];
645  for( Int_t i=0;i<nSigmaDeDxBins+1;i++){
646  arrSigmaDeDxBinning[i]= -5.+0.1*i;
647  //cout<< "dedx::"<< i << " " << arrSigmaDeDxBinning[i]<< endl;
648  }
649 
650  if (fDoDeDxMaps>0) {
651  fDeDxMapList[iCut] = new TList();
652  fDeDxMapList[iCut] ->SetName(Form("%s_%s dEdx Maps",cutstringEvent.Data() ,cutstringPhoton.Data()));
653  fDeDxMapList[iCut]->SetOwner(kTRUE);
654  fCutFolder[iCut]->Add(fDeDxMapList[iCut]);
655 
656  hElectrondEdxMapsR0[iCut]= new TH3F("R0 electron sigma dEdx P Eta","R0 electron sigma dEdx P Eta", nSigmaDeDxBins, arrSigmaDeDxBinning, nEtaBins,arrEtaBinning, nPBins, arrPBinning);
657  hPositrondEdxMapsR0[iCut]= new TH3F("R0 positron sigma dEdx P Eta","R0 positron sigma dEdx P Eta", nSigmaDeDxBins, arrSigmaDeDxBinning, nEtaBins,arrEtaBinning, nPBins, arrPBinning);
658  fDeDxMapList[iCut]->Add( hPositrondEdxMapsR0[iCut]);
659  fDeDxMapList[iCut]->Add( hElectrondEdxMapsR0[iCut]);
660 
661  hElectrondEdxMapsR1[iCut]= new TH3F("R1 electron sigma dEdx P Eta","R1 electron sigma dEdx P Eta", nSigmaDeDxBins, arrSigmaDeDxBinning, nEtaBins,arrEtaBinning, nPBins, arrPBinning);
662  hPositrondEdxMapsR1[iCut]= new TH3F("R1 positron sigma dEdx P Eta","R1 positron sigma dEdx P Eta", nSigmaDeDxBins, arrSigmaDeDxBinning, nEtaBins,arrEtaBinning, nPBins, arrPBinning);
663  fDeDxMapList[iCut]->Add( hPositrondEdxMapsR1[iCut]);
664  fDeDxMapList[iCut]->Add( hElectrondEdxMapsR1[iCut]);
665 
666  hElectrondEdxMapsR2[iCut]= new TH3F("R2 electron sigma dEdx P Eta","R2 electron sigma dEdx P Eta", nSigmaDeDxBins, arrSigmaDeDxBinning, nEtaBins,arrEtaBinning, nPBins, arrPBinning);
667  hPositrondEdxMapsR2[iCut]= new TH3F("R2 positron sigma dEdx P Eta","R2 positron sigma dEdx P Eta", nSigmaDeDxBins, arrSigmaDeDxBinning, nEtaBins,arrEtaBinning, nPBins, arrPBinning);
668  fDeDxMapList[iCut]->Add( hPositrondEdxMapsR2[iCut]);
669  fDeDxMapList[iCut]->Add( hElectrondEdxMapsR2[iCut]);
670 
671  hElectrondEdxMapsR3[iCut]= new TH3F("R3 electron sigma dEdx P Eta", "R3 electron sigma dEdx P Eta", nSigmaDeDxBins, arrSigmaDeDxBinning, nEtaBins,arrEtaBinning, nPBins, arrPBinning);
672  hPositrondEdxMapsR3[iCut]= new TH3F("R3 positron sigma dEdx P Eta","R3 positron sigma dEdx P Eta", nSigmaDeDxBins, arrSigmaDeDxBinning, nEtaBins,arrEtaBinning, nPBins, arrPBinning);
673  fDeDxMapList[iCut]->Add( hPositrondEdxMapsR3[iCut]);
674  fDeDxMapList[iCut]->Add( hElectrondEdxMapsR3[iCut]);
675 
676 
677  }
678  }
679 
680 
681  fV0Reader=(AliV0ReaderV1*)AliAnalysisManager::GetAnalysisManager()->GetTask(fV0ReaderName.Data());
685 
686  if(fV0Reader){
688  if(((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetCutHistograms())
689  fOutputList->Add(((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetCutHistograms());
690 
692  if(((AliConversionPhotonCuts*)fV0Reader->GetConversionCuts())->GetCutHistograms())
693  fOutputList->Add(((AliConversionPhotonCuts*)fV0Reader->GetConversionCuts())->GetCutHistograms());
694 
695  }
696 
697  for(Int_t iCut = 0; iCut<fnCuts;iCut++){
698  if(!((AliConvEventCuts*)fEventCutArray->At(iCut))) continue;
699  if(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutHistograms()){
700  fCutFolder[iCut]->Add(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutHistograms());
701  }
702  if(!((AliConversionPhotonCuts*)fConversionCutArray->At(iCut))) continue;
703  if(((AliConversionPhotonCuts*)fConversionCutArray->At(iCut))->GetCutHistograms()){
704  fCutFolder[iCut]->Add(((AliConversionPhotonCuts*)fConversionCutArray->At(iCut))->GetCutHistograms());
705  }
706  }
707 
708  PostData(1, fOutputList);
709 
710 }
711 
712 //_____________________________________________________________________________
714 {
715  for(Int_t iCut = 0; iCut<fnCuts;iCut++){
716  if (((AliConvEventCuts*)fEventCutArray->At(iCut))->GetPeriodEnum() == AliConvEventCuts::kNoPeriod && ((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetPeriodEnum() != AliConvEventCuts::kNoPeriod){
717  ((AliConvEventCuts*)fEventCutArray->At(iCut))->SetPeriodEnumExplicit(((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetPeriodEnum());
718  } else if (((AliConvEventCuts*)fEventCutArray->At(iCut))->GetPeriodEnum() == AliConvEventCuts::kNoPeriod ){
719  ((AliConvEventCuts*)fEventCutArray->At(iCut))->SetPeriodEnum(fV0Reader->GetPeriodName());
720  }
721  }
722  return kTRUE;
723 }
724 
725 //________________________________________________________________________
727 
728  fInputEvent = InputEvent();
729  if (fInputEvent==NULL) return;
730 
731  if(fIsMC>0) fMCEvent = MCEvent();
732 
733  Int_t eventQuality = ((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetEventQuality();
734  if(fInputEvent->IsIncompleteDAQ()==kTRUE) eventQuality = 2; // incomplete event
735  // Event Not Accepted due to MC event missing or because it is incomplere or wrong trigger for V0ReaderV1 => skip broken event/file
736  if(eventQuality == 2 || eventQuality == 3){
737  for(Int_t iCut = 0; iCut<fnCuts; iCut++){
738  hNEvents[iCut]->Fill(eventQuality);
739  }
740  return;
741  }
742 
743  fConversionGammas=fV0Reader->GetReconstructedGammas();// Gammas from default Cut
744 
745  // ------------------- BeginEvent ----------------------------
746 
747  for(Int_t iCut = 0; iCut<fnCuts; iCut++){
748  fiCut = iCut;
749  Int_t eventNotAccepted = ((AliConvEventCuts*)fEventCutArray->At(iCut))->IsEventAcceptedByCut(fV0Reader->GetEventCuts(),fInputEvent,fMCEvent,fIsHeavyIon,kFALSE);
750  if(eventNotAccepted){
751  // cout << "event rejected due to wrong trigger: " <<eventNotAccepted << endl;
752  hNEvents[iCut]->Fill(eventNotAccepted); // Check Centrality, PileUp, SDD and V0AND --> Not Accepted => eventQuality = 1
753  continue;
754  }
755 
756  if(eventQuality != 0){// Event Not Accepted
757  // cout << "event rejected due to: " <<eventQuality << endl;
758  hNEvents[iCut]->Fill(eventQuality);
759  continue;
760  }
761 
762  hNEvents[iCut]->Fill(eventQuality); // Should be 0 here
763 
764 
765  fNESDtracksEta08 = CountTracks08(); // Estimate Event Multiplicity
766  fNESDtracksEta0814 = CountTracks0814(); // Estimate Event Multiplicity
768 
769 
770 
773  hNGoodESDTracksEta08_14[iCut]->Fill(fNESDtracksEta0814);
774 
775  if(fDoMultWeights && fIsMC > 0) {
776  fWeightMultMC = 1.;
777  fWeightMultMC = ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetWeightForMultiplicity(fNESDtracksEta08);
779  }
780 
781  // Calculation of Multiplicity weight moved before ProcessMCPhotons
782  // fWeightMultMC shuld also be inserted to input pT distributions .
783 
784  if(fIsMC > 0){
785  // Process MC Particle
786  if(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetSignalRejection() != 0){
787  if(fInputEvent->IsA()==AliESDEvent::Class()){
788  ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetNotRejectedParticles(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetSignalRejection(),
789  ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetAcceptedHeader(),
790  fMCEvent);
791  }
792  }
794  }
795 
796 
797 
798  if(fInputEvent){
799  if(fInputEvent->GetPrimaryVertexTracks()->GetNContributors()>0) {
800  fNContrVtx = fInputEvent->GetPrimaryVertexTracks()->GetNContributors();
801  } else {
802  fNContrVtx = 0;
803  }
804  }
805  ProcessPhotons();
806  fGammaCandidates->Clear(); // delete this cuts good gammas
807  }
808 
809  //cout<<" done with the event"<<endl;
810 
811  PostData(1, fOutputList);
812 }
813 
814 
815 
818 
819  const AliVVertex* primVtxMC = fMCEvent->GetPrimaryVertex();
820  Double_t mcProdVtxX = primVtxMC->GetX();
821  Double_t mcProdVtxY = primVtxMC->GetY();
822  Double_t mcProdVtxZ = primVtxMC->GetZ();
823 
824 
825  // Loop over all primary MC particle
826 
827  // Loop over all primary MC particle
828  for(Long_t i = 0; i < fMCEvent->GetNumberOfTracks(); i++) {
829 
830  // for(Int_t i = 0; i < fMCEvent->GetNumberOfPrimaries(); i++) {
831  if (((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryESD( fMCEvent, i, mcProdVtxX, mcProdVtxY, mcProdVtxZ)){
832  // fill primary histogram
833  TParticle* particle = (TParticle *)fMCEvent->Particle(i);
834  if (!particle) continue;
835 
836 
837  if(fMCEvent && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 0){
838  Int_t isPosFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCEvent, fInputEvent);
839  Int_t isNegFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCEvent, fInputEvent);
840  if( (isNegFromMBHeader < 1) || (isPosFromMBHeader < 1)) continue;
841  }
842 
843  Float_t weighted= 1;
844  if (particle->Pt()>0.005){
845  weighted= ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetWeightForGamma(i, fMCEvent, fInputEvent);
846  // cout << "MC input \t"<<i << "\t" << particle->Pt()<<"\t"<<weighted << endl;
847  }
848 
849 
850  if(((AliConversionPhotonCuts*)fConversionCutArray->At(fiCut))->PhotonIsSelectedMC(particle,fMCEvent,kFALSE)){
851  hMCAllGammaPt[fiCut]->Fill(particle->Pt(),weighted*fWeightMultMC); // All MC Gamma
852  hMCAllGammaWOWeightPt[fiCut]->Fill(particle->Pt()); // All MC Gamma
853  }
854  if(((AliConversionPhotonCuts*)fConversionCutArray->At(fiCut))->PhotonIsSelectedMC(particle,fMCEvent,kTRUE)){
855  TParticle* daughter1 = (TParticle *)fMCEvent->Particle(particle->GetFirstDaughter());
856 
857 
858  hMCConversionRPhi[fiCut]->Fill(particle->Phi(),daughter1->R());
859  hMCConversionREta[fiCut]->Fill(particle->Eta(),daughter1->R());
860  hMCConversionWOWeightRPt[fiCut]->Fill(particle->Pt(),daughter1->R());
861  hMCConversionRPt[fiCut]->Fill(particle->Pt(),daughter1->R(),weighted*fWeightMultMC);
862 
863  if(daughter1->R() < 75. || daughter1->R() > 85.) hMCConversionRRejSmall[fiCut]->Fill(daughter1->R());
864  if(daughter1->R() < 70. || daughter1->R() > 90.) hMCConversionRRejLarge[fiCut]->Fill(daughter1->R());
865  } // Converted MC Gamma
866  } else {
867  // fill secondary histograms
868  TParticle* particle = (TParticle *)fMCEvent->Particle(i);
869  if (!particle) continue;
870 
871  Int_t isMCFromMBHeader = -1;
872 
873  if(fMCEvent && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 0){
874  Int_t isPosFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCEvent, fInputEvent);
875  Int_t isNegFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCEvent, fInputEvent);
876  if( (isNegFromMBHeader < 1) || (isPosFromMBHeader < 1)) continue;
877  }
878  if(((AliConversionPhotonCuts*)fConversionCutArray->At(fiCut))->PhotonIsSelectedMC(particle,fMCEvent,kFALSE)){
879  if (particle->GetMother(0) > -1 && fMCEvent->Particle(particle->GetMother(0))->GetMother(0) > -1) {
880  if (fMCEvent->Particle(fMCEvent->Particle(particle->GetMother(0))->GetMother(0))->GetPdgCode() == 310){
881  hMCAllSecondaryGammaPt[fiCut]->Fill(particle->Pt(),0.,fWeightMultMC);
882  } else if (fMCEvent->Particle(fMCEvent->Particle(particle->GetMother(0))->GetMother(0))->GetPdgCode() == 130) {
883  hMCAllSecondaryGammaPt[fiCut]->Fill(particle->Pt(),1.,fWeightMultMC);
884  } else if (fMCEvent->Particle(fMCEvent->Particle(particle->GetMother(0))->GetMother(0))->GetPdgCode() == 3122) {
885  hMCAllSecondaryGammaPt[fiCut]->Fill(particle->Pt(),2.,fWeightMultMC);
886  } else {
887  // if ( !(TMath::Abs(fMCEvent->Particle(particle->GetMother(0))->GetPdgCode()) == 11 &&
888  // fMCEvent->Particle(fMCEvent->Particle(particle->GetMother(0))->GetMother(0))->GetPdgCode() == 22) )
889  hMCAllSecondaryGammaPt[fiCut]->Fill(particle->Pt(),3.,fWeightMultMC);
890  }
891  } else {
892  hMCAllSecondaryGammaPt[fiCut]->Fill(particle->Pt(),3.,fWeightMultMC);
893  }
894  if(((AliConversionPhotonCuts*)fConversionCutArray->At(fiCut))->PhotonIsSelectedMC(particle,fMCEvent,kTRUE)){
895  TParticle* tmpDaughter1 = (TParticle *)fMCEvent->Particle(particle->GetFirstDaughter());
896  if (particle->GetMother(0) > -1 && fMCEvent->Particle(particle->GetMother(0))->GetMother(0) > -1) {
897  if (fMCEvent->Particle(fMCEvent->Particle(particle->GetMother(0))->GetMother(0))->GetPdgCode() == 310){
898  hMCSecondaryConvGammaPtR[fiCut]->Fill(particle->Pt(),tmpDaughter1->R(),0.,fWeightMultMC);
899  } else if (fMCEvent->Particle(fMCEvent->Particle(particle->GetMother(0))->GetMother(0))->GetPdgCode() == 130) {
900  hMCSecondaryConvGammaPtR[fiCut]->Fill(particle->Pt(),tmpDaughter1->R(),1.,fWeightMultMC);
901  } else if (fMCEvent->Particle(fMCEvent->Particle(particle->GetMother(0))->GetMother(0))->GetPdgCode() == 3122) {
902  hMCSecondaryConvGammaPtR[fiCut]->Fill(particle->Pt(),tmpDaughter1->R(),2.,fWeightMultMC);
903  } else {
904  // if ( !(TMath::Abs(fMCEvent->Particle(particle->GetMother(0))->GetPdgCode()) == 11 &&
905  // fMCEvent->Particle(fMCEvent->Particle(particle->GetMother(0))->GetMother(0))->GetPdgCode() == 22) )
906  hMCSecondaryConvGammaPtR[fiCut]->Fill(particle->Pt(),tmpDaughter1->R(),3.,fWeightMultMC);
907  }
908  } else {
909  hMCSecondaryConvGammaPtR[fiCut]->Fill(particle->Pt(),tmpDaughter1->R(),3.,fWeightMultMC);
910  }
911  }
912  }
913  }
914  }
915 
916 }
917 
920 
921  // Fill Histograms for QA and MC
922  TList *GammaCandidatesStepTwo = new TList();
923 
924  for(Int_t firstGammaIndex=0;firstGammaIndex<fConversionGammas->GetEntriesFast();firstGammaIndex++){
925  AliAODConversionPhoton *gamma= (AliAODConversionPhoton*)fConversionGammas->At(firstGammaIndex);
926 
927  if (gamma == NULL) continue;
928 
929  if(!((AliConversionPhotonCuts*)fConversionCutArray->At(fiCut))->PhotonIsSelected(gamma,fInputEvent))continue;
930 
931  if( ! ((AliConversionPhotonCuts*)fConversionCutArray->At(fiCut))->UseToCloseV0sCut()){
932  fGammaCandidates->Add(gamma); // if no second loop is required add to events good gammas
933  }else if(((AliConversionPhotonCuts*)fConversionCutArray->At(fiCut))->UseToCloseV0sCut()) { // shared electron is disabled, step one not needed -> step two
934  GammaCandidatesStepTwo->Add(gamma);
935  }
936  }
937 
938  if(((AliConversionPhotonCuts*)fConversionCutArray->At(fiCut))->UseToCloseV0sCut()){
939  for(Int_t i = 0;i<GammaCandidatesStepTwo->GetEntries();i++){
940  AliAODConversionPhoton* PhotonCandidate = (AliAODConversionPhoton*) GammaCandidatesStepTwo->At(i);
941  if(!PhotonCandidate) continue;
942  if(!((AliConversionPhotonCuts*)fConversionCutArray->At(fiCut))->RejectToCloseV0s(PhotonCandidate,GammaCandidatesStepTwo,i)) continue;
943  fGammaCandidates->Add(PhotonCandidate); // Add gamma to current cut TList
944  }
945  }
946 
947  for(Int_t firstGammaIndex=0;firstGammaIndex<fGammaCandidates->GetEntries();firstGammaIndex++){
948  AliAODConversionPhoton *gamma=dynamic_cast<AliAODConversionPhoton*>(fGammaCandidates->At(firstGammaIndex));
949  if (gamma==NULL) continue;
950 
951  fGammaPt = gamma->GetPhotonPt();
952  fGammaTheta = gamma->GetPhotonTheta();
953  fGammaChi2NDF = gamma->GetChi2perNDF();
954 
955  AliPIDResponse* pidResponse = ((AliConversionPhotonCuts*)fV0Reader->GetConversionCuts())->GetPIDResponse();
956 
957  AliVTrack * negTrack = ((AliConversionPhotonCuts*)fConversionCutArray->At(fiCut))->GetTrack(fInputEvent, gamma->GetTrackLabelNegative());
958  AliVTrack * posTrack = ((AliConversionPhotonCuts*)fConversionCutArray->At(fiCut))->GetTrack(fInputEvent, gamma->GetTrackLabelPositive());
959 
960  Short_t Charge = 1;
961  Double_t electronNSigmaTPC = pidResponse->NumberOfSigmasTPC(negTrack,AliPID::kElectron);
962  Double_t electronNSigmaTPCCor=0.;
963  Double_t positronNSigmaTPC = pidResponse->NumberOfSigmasTPC(posTrack,AliPID::kElectron);
964  Double_t positronNSigmaTPCCor=0.;
965  Double_t R = gamma->GetConversionRadius();
966  Double_t P=0.;
967  Double_t Eta=0.;
968 
969  if( ((AliConversionPhotonCuts*)fConversionCutArray->At(fiCut))->GetElecDeDxPostCalibrationInitialized() ){
970  Charge = negTrack->Charge();
971  P = negTrack->P();
972  Eta = negTrack->Eta();
973  electronNSigmaTPCCor = ((AliConversionPhotonCuts*)fConversionCutArray->At(fiCut))->GetCorrectedElectronTPCResponse(Charge,electronNSigmaTPC,P,Eta,R);
974 
975  Charge = posTrack->Charge();
976  P = posTrack->P();
977  Eta = posTrack->Eta();
978  positronNSigmaTPCCor = ((AliConversionPhotonCuts*)fConversionCutArray->At(fiCut))->GetCorrectedElectronTPCResponse(Charge,positronNSigmaTPC,P,Eta,R);
979  }
980 
983  //In case of MC, this histogram is filled with pT weights for primary photons. Weights not applied for secondaries and also not for contaminations
984 
985 
986  hESDConversionRPhi[fiCut]->Fill(gamma->GetPhotonPhi(),gamma->GetConversionRadius());
987  hESDConversionRZ[fiCut]->Fill(gamma->GetConversionZ(),gamma->GetConversionRadius());
988  hESDConversionREta[fiCut]->Fill(gamma->GetPhotonEta(),gamma->GetConversionRadius());
989 
990 
991  if( ((AliConversionPhotonCuts*)fConversionCutArray->At(fiCut))->GetElecDeDxPostCalibrationInitialized() ){
992  if(negTrack->GetTPCsignal()){
993  hElectronRdEdx[fiCut]->Fill(negTrack->GetTPCsignal(),gamma->GetConversionRadius());
994  hElectronRNSigmadEdx[fiCut]->Fill( electronNSigmaTPCCor, gamma->GetConversionRadius());
995  }
996  if(posTrack->GetTPCsignal()){
997  hPositronRdEdx[fiCut]->Fill(posTrack->GetTPCsignal(),gamma->GetConversionRadius());
998  hPositronRNSigmadEdx[fiCut]->Fill( positronNSigmaTPCCor, gamma->GetConversionRadius());
999  }
1000  }else{
1001  if(negTrack->GetTPCsignal()){
1002  hElectronRdEdx[fiCut]->Fill(negTrack->GetTPCsignal(),gamma->GetConversionRadius());
1003  hElectronRNSigmadEdx[fiCut]->Fill( electronNSigmaTPC, gamma->GetConversionRadius());
1004  }
1005  if(posTrack->GetTPCsignal()){
1006  hPositronRdEdx[fiCut]->Fill(posTrack->GetTPCsignal(),gamma->GetConversionRadius());
1007  hPositronRNSigmadEdx[fiCut]->Fill( positronNSigmaTPC, gamma->GetConversionRadius());
1008  }
1009 
1010  }
1011 
1012  if(gamma->GetConversionRadius() < 75. || gamma->GetConversionRadius() > 85.) hESDConversionRRejSmall[fiCut]->Fill(gamma->GetConversionRadius());
1013  if(gamma->GetConversionRadius() < 70. || gamma->GetConversionRadius() > 90.) hESDConversionRRejLarge[fiCut]->Fill(gamma->GetConversionRadius());
1014 
1015  if(fInputEvent->IsA()==AliESDEvent::Class()){
1016  AliESDEvent *esdEvent = dynamic_cast<AliESDEvent*>(fInputEvent);
1017  if(esdEvent){
1018  AliESDv0 *v0 = esdEvent->GetV0(gamma->GetV0Index());
1019  hESDConversionDCA[fiCut]->Fill(v0->GetDcaV0Daughters(),fWeightMultMC);
1020  }
1021  }
1022  hESDConversionPsiPair[fiCut]->Fill(gamma->GetPsiPair());
1024  hESDConversionMass[fiCut]->Fill(gamma->GetInvMassPair());
1025 
1026  if(gamma->GetPhotonP()!=0 && negTrack->P()!=0) {
1027  if(gamma->GetConversionRadius() > 5. ){
1028  hESDConversionAsymP[fiCut]->Fill(gamma->GetPhotonP(),negTrack->P()/gamma->GetPhotonP(),fWeightMultMC);
1029  }
1030  }
1031 
1032  if(fDoDeDxMaps > 0 ) {
1033  if( ((AliConversionPhotonCuts*)fConversionCutArray->At(fiCut))->GetElecDeDxPostCalibrationInitialized()){
1034  if(gamma->GetConversionRadius() < 33.5){
1035  hElectrondEdxMapsR0[fiCut]->Fill(electronNSigmaTPCCor, gamma->GetPhotonEta(), negTrack->P());
1036  hPositrondEdxMapsR0[fiCut]->Fill(positronNSigmaTPCCor, gamma->GetPhotonEta(), posTrack->P());
1037  }else if (gamma->GetConversionRadius() > 33.5 && gamma->GetConversionRadius() < 72.){
1038  hElectrondEdxMapsR1[fiCut]->Fill(electronNSigmaTPCCor, gamma->GetPhotonEta(), negTrack->P());
1039  hPositrondEdxMapsR1[fiCut]->Fill(positronNSigmaTPCCor, gamma->GetPhotonEta(), posTrack->P());
1040  }else if (gamma->GetConversionRadius() > 72. && gamma->GetConversionRadius() < 145.){
1041  hElectrondEdxMapsR2[fiCut]->Fill(electronNSigmaTPCCor, gamma->GetPhotonEta(), negTrack->P());
1042  hPositrondEdxMapsR2[fiCut]->Fill(positronNSigmaTPCCor, gamma->GetPhotonEta(), posTrack->P());
1043  }else if (gamma->GetConversionRadius() > 145. && gamma->GetConversionRadius() < 180.){
1044  hElectrondEdxMapsR3[fiCut]->Fill(electronNSigmaTPCCor, gamma->GetPhotonEta(), negTrack->P());
1045  hPositrondEdxMapsR3[fiCut]->Fill(positronNSigmaTPCCor, gamma->GetPhotonEta(), posTrack->P());
1046  }
1047  }else{
1048  if(gamma->GetConversionRadius() < 33.5){
1049  hElectrondEdxMapsR0[fiCut]->Fill(electronNSigmaTPC, gamma->GetPhotonEta(), negTrack->P());
1050  hPositrondEdxMapsR0[fiCut]->Fill(positronNSigmaTPC, gamma->GetPhotonEta(), posTrack->P());
1051  }else if (gamma->GetConversionRadius() > 33.5 && gamma->GetConversionRadius() < 72.){
1052  hElectrondEdxMapsR1[fiCut]->Fill(electronNSigmaTPC, gamma->GetPhotonEta(), negTrack->P());
1053  hPositrondEdxMapsR1[fiCut]->Fill(positronNSigmaTPC, gamma->GetPhotonEta(), posTrack->P());
1054  }else if (gamma->GetConversionRadius() > 72. && gamma->GetConversionRadius() < 145.){
1055  hElectrondEdxMapsR2[fiCut]->Fill(electronNSigmaTPC, gamma->GetPhotonEta(), negTrack->P());
1056  hPositrondEdxMapsR2[fiCut]->Fill(positronNSigmaTPC, gamma->GetPhotonEta(), posTrack->P());
1057  }else if (gamma->GetConversionRadius() > 145. && gamma->GetConversionRadius() < 180.){
1058  hElectrondEdxMapsR3[fiCut]->Fill(electronNSigmaTPC, gamma->GetPhotonEta(), negTrack->P());
1059  hPositrondEdxMapsR3[fiCut]->Fill(positronNSigmaTPC, gamma->GetPhotonEta(), posTrack->P());
1060  }
1061  }
1062  }
1063 
1064 
1065  fKind = 9;
1066  Int_t pdgCodePos = 0.;
1067  Int_t pdgCodeNeg = 0.;
1068 
1069  if(fIsMC>0){
1070 
1071  const AliVVertex* primVtxMC = fMCEvent->GetPrimaryVertex();
1072  Double_t mcProdVtxX = primVtxMC->GetX();
1073  Double_t mcProdVtxY = primVtxMC->GetY();
1074  Double_t mcProdVtxZ = primVtxMC->GetZ();
1075 
1076  TParticle *posDaughter = gamma->GetPositiveMCDaughter(fMCEvent);
1077  TParticle *negDaughter = gamma->GetNegativeMCDaughter(fMCEvent);
1078  TParticle *Photon = gamma->GetMCParticle(fMCEvent);
1079  //cout << "generate Daughters: "<<posDaughter << "\t" << negDaughter << endl;
1080 
1081  if(fMCEvent && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 0){
1082  Int_t isPosFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(gamma->GetMCLabelPositive(), fMCEvent, fInputEvent);
1083  Int_t isNegFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(gamma->GetMCLabelNegative(), fMCEvent, fInputEvent);
1084  if( (isNegFromMBHeader < 1) || (isPosFromMBHeader < 1)) continue;
1085  }
1086 
1087  if(posDaughter == NULL || negDaughter == NULL){
1088 
1089  fKind = 9; // garbage
1090 
1091  } else if(posDaughter->GetMother(0) != negDaughter->GetMother(0) || (posDaughter->GetMother(0) == negDaughter->GetMother(0) && posDaughter->GetMother(0) ==-1)){
1092 
1093  fKind = 1; //Not Same Mother == Combinatorial Bck
1094  pdgCodePos = posDaughter->GetPdgCode();
1095  pdgCodeNeg = negDaughter->GetPdgCode();
1096 
1097  if(TMath::Abs(pdgCodePos)==11 && TMath::Abs(pdgCodeNeg)==11)
1098  fKind = 10; //Electron Combinatorial
1099  if(TMath::Abs(pdgCodePos)==11 && TMath::Abs(pdgCodeNeg)==11 && (posDaughter->GetMother(0) == negDaughter->GetMother(0) && posDaughter->GetMother(0) ==-1))
1100  fKind = 15; //direct Electron Combinatorial
1101  if(TMath::Abs(pdgCodePos)==211 && TMath::Abs(pdgCodeNeg)==211)
1102  fKind = 11; //Pion Combinatorial
1103  if((TMath::Abs(pdgCodePos)==211 && TMath::Abs(pdgCodeNeg)==2212) ||
1104  (TMath::Abs(pdgCodePos)==2212 && TMath::Abs(pdgCodeNeg)==211))
1105  fKind = 12; //Pion, Proton Combinatorics
1106  if((TMath::Abs(pdgCodePos)==211 && TMath::Abs(pdgCodeNeg)==11) ||
1107  (TMath::Abs(pdgCodePos)==11 && TMath::Abs(pdgCodeNeg)==211))
1108  fKind = 13; //Pion, Electron Combinatorics
1109  if (TMath::Abs(pdgCodePos)==321 || TMath::Abs(pdgCodeNeg)==321)
1110  fKind = 14; //Kaon combinatorics
1112  } else {
1113  //cout << "same mother" << endl;
1114  pdgCodePos = posDaughter->GetPdgCode();
1115  pdgCodeNeg = negDaughter->GetPdgCode();
1116  Int_t pdgCode;
1117  pdgCode = gamma->GetMCParticle(fMCEvent)->GetPdgCode();
1118  if(TMath::Abs(pdgCodePos)!=11 || TMath::Abs(pdgCodeNeg)!=11){
1119  fKind = 2; // combinatorics from hadronic decays
1121  }else if ( !(pdgCodeNeg==pdgCodePos)){
1122  Bool_t gammaIsPrimary = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryESD( fMCEvent, posDaughter->GetMother(0), mcProdVtxX, mcProdVtxY, mcProdVtxZ);
1123  if(pdgCode == 111) {
1124  fKind = 3; // pi0 Dalitz
1126  }else if (pdgCode == 221){
1127  fKind = 4; // eta Dalitz
1129  }else if (!(negDaughter->GetUniqueID() != 5 || posDaughter->GetUniqueID() !=5)){
1130  if(pdgCode == 22 && gammaIsPrimary){
1131  fKind = 0; // primary photons
1132  } else if (pdgCode == 22){
1133  fKind = 5; //secondary photons
1134 
1135  //----------Splitting of secondaries. Part taken from AliAnalysisTaskGammaConvV1-----------------
1136  if( Photon->GetMother(0) > -1 && fMCEvent->Particle(Photon->GetMother(0))->GetMother(0) > -1){
1137  if (fMCEvent->Particle(fMCEvent->Particle(Photon->GetMother(0))->GetMother(0))->GetPdgCode() == 310){
1138  hMCTrueSecondaryConvGammaRPt[fiCut]->Fill(gamma->Pt(),gamma->GetConversionRadius(),0.,fWeightMultMC);
1139  hMCTrueSecondaryConvGammaMCRPt[fiCut]->Fill(Photon->Pt(),negDaughter->R(),0.,fWeightMultMC);
1140  // hMCTrueSecondaryConvGammaFromXFromK0sMCPtESDPtR[fiCut]->Fill(Photon->Pt(),gamma->Pt());
1141  } else if (fMCEvent->Particle(fMCEvent->Particle(Photon->GetMother(0))->GetMother(0))->GetPdgCode() == 130) {
1142  hMCTrueSecondaryConvGammaRPt[fiCut]->Fill(gamma->Pt(),gamma->GetConversionRadius(),1.,fWeightMultMC);
1143  hMCTrueSecondaryConvGammaMCRPt[fiCut]->Fill(Photon->Pt(),negDaughter->R(),1.,fWeightMultMC);
1144  // hMCTrueSecondaryConvGammaFromXFromK0lMCPtESDPt[fiCut]->Fill(Photon->Pt(),gamma->Pt());
1145  } else if (fMCEvent->Particle(fMCEvent->Particle(Photon->GetMother(0))->GetMother(0))->GetPdgCode() == 3122) {
1146  hMCTrueSecondaryConvGammaRPt[fiCut]->Fill(gamma->Pt(),gamma->GetConversionRadius(),2.,fWeightMultMC);
1147  hMCTrueSecondaryConvGammaMCRPt[fiCut]->Fill(Photon->Pt(),negDaughter->R(),2.,fWeightMultMC);
1148  // hMCTrueSecondaryConvGammaFromXFromLambdaMCPtESDPt[fiCut]->Fill(Photon->Pt(),gamma->Pt());
1149  } else if (fMCEvent->Particle(fMCEvent->Particle(Photon->GetMother(0))->GetMother(0))->GetPdgCode() == 221) {
1150  hMCTrueSecondaryConvGammaRPt[fiCut]->Fill(Photon->Pt(),gamma->GetConversionRadius(),3.,fWeightMultMC);
1151  hMCTrueSecondaryConvGammaMCRPt[fiCut]->Fill(gamma->Pt(),negDaughter->R(),3.,fWeightMultMC);
1152  } else {
1153  // if ( !(TMath::Abs(fMCEvent->Particle(Photon->GetMother(0))->GetPdgCode()) == 11 && fMCEvent->Particle(fMCEvent->Particle(Photon->GetMother(0))->GetMother(0))->GetPdgCode() == 22) ) {
1154  hMCTrueSecondaryConvGammaRPt[fiCut]->Fill(gamma->Pt(),gamma->GetConversionRadius(),3.,fWeightMultMC);
1155  hMCTrueSecondaryConvGammaMCRPt[fiCut]->Fill(Photon->Pt(),negDaughter->R(),3.,fWeightMultMC);
1156  // }
1157  }
1158  } else {
1159  hMCTrueSecondaryConvGammaRPt[fiCut]->Fill(gamma->Pt(),gamma->GetConversionRadius(),3.,fWeightMultMC);
1160  hMCTrueSecondaryConvGammaMCRPt[fiCut]->Fill(Photon->Pt(),negDaughter->R(),3.,fWeightMultMC);
1161  }
1162  // End spliting of secondaries
1163  }
1164  } else fKind = 9; //garbage
1165  } else fKind = 9; //garbage
1166  }
1167  Float_t weighted = 1.;
1168  weighted= ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetWeightForGamma(posDaughter->GetMother(0), fMCEvent, fInputEvent);
1169 
1170  if(fKind==0 || fKind==5){
1171  hMCTrueConversionRPhi[fiCut]->Fill(gamma->GetPhotonPhi(),gamma->GetConversionRadius());
1172  hMCTrueConversionRZ[fiCut]->Fill(gamma->GetConversionZ(),gamma->GetConversionRadius());
1173  hMCTrueConversionREta[fiCut]->Fill(gamma->GetPhotonEta(),gamma->GetConversionRadius());
1174 
1175  if(fKind==0) hMCTrueConversionRPt[fiCut]->Fill(gamma->GetPhotonPt(),gamma->GetConversionRadius(),weighted*fWeightMultMC);
1177 
1179 
1180  if(fKind==0) hESDConversionRPt[fiCut]->Fill(gamma->GetPhotonPt(),gamma->GetConversionRadius(),weighted*fWeightMultMC);
1181  if(fKind==5) hESDConversionRPt[fiCut]->Fill(gamma->GetPhotonPt(),gamma->GetConversionRadius(),fWeightMultMC);
1182 
1183  if(fKind==0) hMCTruePrimConversionRPt[fiCut]->Fill(gamma->GetPhotonPt(),gamma->GetConversionRadius(),weighted*fWeightMultMC);
1186 
1187  hMCTrueConversionRPtMCRPt[fiCut]->Fill(Photon->Pt(),negDaughter->R(),weighted*fWeightMultMC);
1188  hMCTrueConversionWOWeightRPtMCRPt[fiCut]->Fill(Photon->Pt(),negDaughter->R());
1189 
1190  if(gamma->GetConversionRadius() < 75. || gamma->GetConversionRadius() > 85.) hMCTrueConversionRRejSmall[fiCut]->Fill(gamma->GetConversionRadius());
1191  if(gamma->GetConversionRadius() < 70. || gamma->GetConversionRadius() > 90.) hMCTrueConversionRRejLarge[fiCut]->Fill(gamma->GetConversionRadius());
1192 
1193  hMCTrueConversionPsiPair[fiCut]->Fill(gamma->GetPsiPair());
1194  hMCTrueConversionChi2[fiCut]->Fill(gamma->GetChi2perNDF(),weighted*fWeightMultMC);
1195  hMCTrueConversionMass[fiCut]->Fill(gamma->GetInvMassPair());
1196  if(gamma->GetPhotonP()!=0 && negTrack->P()!=0) {
1197  if(gamma->GetConversionRadius() > 5.){
1198  hMCTrueConversionAsymP[fiCut]->Fill(gamma->GetPhotonP(),negTrack->P()/gamma->GetPhotonP(),fWeightMultMC);
1199  }
1200  }
1201 
1202 
1203 
1204  if(fInputEvent->IsA()==AliESDEvent::Class()){
1205  AliESDEvent *esdEvent = dynamic_cast<AliESDEvent*>(fInputEvent);
1206  if(esdEvent){
1207  AliESDv0 *v0 = esdEvent->GetV0(gamma->GetV0Index());
1208  hMCTrueConversionDCA[fiCut]->Fill(v0->GetDcaV0Daughters());
1209  }
1210  }
1211 
1212  } else if(fKind==3){
1215  } else if(fKind==4){
1218  } else {
1221  }
1222  }
1223  }
1224 
1225  delete GammaCandidatesStepTwo;
1226  GammaCandidatesStepTwo = 0x0;
1227 
1228 
1229 }
1230 
1231 //________________________________________________________________________
1233 
1234  Int_t fNumberOfESDTracks = 0;
1235  if(fInputEvent->IsA()==AliESDEvent::Class()){
1236  // Using standard function for setting Cuts
1237 
1238 // Bool_t selectPrimaries = kTRUE;
1239  static AliESDtrackCuts *EsdTrackCuts = 0x0;
1240  static int prevRun = -1;
1241  // Using standard function for setting Cuts
1242  Int_t runNumber = fInputEvent->GetRunNumber();
1243  if (prevRun!=runNumber) {
1244  delete EsdTrackCuts;
1245  EsdTrackCuts = 0;
1246  prevRun = runNumber;
1247  }
1248 // AliESDtrackCuts *EsdTrackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2010(selectPrimaries);
1249  if (!EsdTrackCuts) {
1250  // if LHC11a or earlier or if LHC13g or if LHC12a-i -> use 2010 cuts
1251  if( (runNumber<=146860) || (runNumber>=197470 && runNumber<=197692) || (runNumber>=172440 && runNumber<=193766) ){
1252  EsdTrackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2010();
1253 
1254  } else if (runNumber>=209122){ // else if run2 data use 2015 PbPb cuts
1255  //EsdTrackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2015PbPb();
1256  // hard coded track cuts for the moment, because AliESDtrackCuts::GetStandardITSTPCTrackCuts2015PbPb() gives spams warnings
1257  EsdTrackCuts = new AliESDtrackCuts();
1258  // TPC; clusterCut = 1, cutAcceptanceEdges = kTRUE, removeDistortedRegions = kFALSE
1259  EsdTrackCuts->AliESDtrackCuts::SetMinNCrossedRowsTPC(70);
1260  EsdTrackCuts->AliESDtrackCuts::SetMinRatioCrossedRowsOverFindableClustersTPC(0.8);
1261  EsdTrackCuts->SetCutGeoNcrNcl(2., 130., 1.5, 0.0, 0.0); // only dead zone and not clusters per length
1262  //EsdTrackCuts->AliESDtrackCuts::SetCutOutDistortedRegionsTPC(kTRUE);
1263  EsdTrackCuts->AliESDtrackCuts::SetMaxChi2PerClusterTPC(4);
1264  EsdTrackCuts->AliESDtrackCuts::SetAcceptKinkDaughters(kFALSE);
1265  EsdTrackCuts->AliESDtrackCuts::SetRequireTPCRefit(kTRUE);
1266  // ITS; selPrimaries = 1
1267  EsdTrackCuts->AliESDtrackCuts::SetRequireITSRefit(kTRUE);
1268  EsdTrackCuts->AliESDtrackCuts::SetClusterRequirementITS(AliESDtrackCuts::kSPD,
1269  AliESDtrackCuts::kAny);
1270  EsdTrackCuts->AliESDtrackCuts::SetMaxDCAToVertexXYPtDep("0.0105+0.0350/pt^1.1");
1271  EsdTrackCuts->AliESDtrackCuts::SetMaxChi2TPCConstrainedGlobal(36);
1272  EsdTrackCuts->AliESDtrackCuts::SetMaxDCAToVertexZ(2);
1273  EsdTrackCuts->AliESDtrackCuts::SetDCAToVertex2D(kFALSE);
1274  EsdTrackCuts->AliESDtrackCuts::SetRequireSigmaToVertex(kFALSE);
1275  EsdTrackCuts->AliESDtrackCuts::SetMaxChi2PerClusterITS(36);
1276 
1277  } else { // else use 2011 version of track cuts
1278  EsdTrackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2011();
1279  }
1280  EsdTrackCuts->SetMaxDCAToVertexZ(2);
1281  EsdTrackCuts->SetEtaRange(-0.8, 0.8);
1282  EsdTrackCuts->SetPtRange(0.15);
1283  }
1284 
1285  for(Int_t iTracks = 0; iTracks < fInputEvent->GetNumberOfTracks(); iTracks++){
1286  AliESDtrack* curTrack = (AliESDtrack*) fInputEvent->GetTrack(iTracks);
1287  if(!curTrack) continue;
1288  if(EsdTrackCuts->AcceptTrack(curTrack) ){
1289  if (fMCEvent){
1290  if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 0){
1291  Int_t isFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(TMath::Abs(curTrack->GetLabel()), fMCEvent, fInputEvent);
1292  if( (isFromMBHeader < 1) ) continue;
1293  }
1294  }
1295  fNumberOfESDTracks++;
1296  }
1297  }
1298  delete EsdTrackCuts;
1299  EsdTrackCuts=0x0;
1300 
1301  }
1302 
1303  return fNumberOfESDTracks;
1304 
1305 }
1306 
1307 //________________________________________________________________________
1309 
1310  Int_t fNumberOfESDTracks = 0;
1311  if(fInputEvent->IsA()==AliESDEvent::Class()){
1312  // Using standard function for setting Cuts
1313 
1314 // Bool_t selectPrimaries = kTRUE;
1315  static AliESDtrackCuts *EsdTrackCuts = 0x0;
1316  static int prevRun = -1;
1317  // Using standard function for setting Cuts
1318  Int_t runNumber = fInputEvent->GetRunNumber();
1319  if (prevRun!=runNumber) {
1320  delete EsdTrackCuts;
1321  EsdTrackCuts = 0;
1322  prevRun = runNumber;
1323  }
1324 // AliESDtrackCuts *EsdTrackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2010(selectPrimaries);
1325  if (!EsdTrackCuts) {
1326  // if LHC11a or earlier or if LHC13g or if LHC12a-i -> use 2010 cuts
1327  if( (runNumber<=146860) || (runNumber>=197470 && runNumber<=197692) || (runNumber>=172440 && runNumber<=193766) ){
1328  EsdTrackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2010();
1329 
1330  } else if (runNumber>=209122){ // else if run2 data use 2015 PbPb cuts
1331  //EsdTrackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2015PbPb();
1332  // hard coded track cuts for the moment, because AliESDtrackCuts::GetStandardITSTPCTrackCuts2015PbPb() gives spams warnings
1333  EsdTrackCuts = new AliESDtrackCuts();
1334  // TPC; clusterCut = 1, cutAcceptanceEdges = kTRUE, removeDistortedRegions = kFALSE
1335  EsdTrackCuts->AliESDtrackCuts::SetMinNCrossedRowsTPC(70);
1336  EsdTrackCuts->AliESDtrackCuts::SetMinRatioCrossedRowsOverFindableClustersTPC(0.8);
1337  EsdTrackCuts->SetCutGeoNcrNcl(2., 130., 1.5, 0.0, 0.0); // only dead zone and not clusters per length
1338  //EsdTrackCuts->AliESDtrackCuts::SetCutOutDistortedRegionsTPC(kTRUE);
1339  EsdTrackCuts->AliESDtrackCuts::SetMaxChi2PerClusterTPC(4);
1340  EsdTrackCuts->AliESDtrackCuts::SetAcceptKinkDaughters(kFALSE);
1341  EsdTrackCuts->AliESDtrackCuts::SetRequireTPCRefit(kTRUE);
1342  // ITS; selPrimaries = 1
1343  EsdTrackCuts->AliESDtrackCuts::SetRequireITSRefit(kTRUE);
1344  EsdTrackCuts->AliESDtrackCuts::SetClusterRequirementITS(AliESDtrackCuts::kSPD,
1345  AliESDtrackCuts::kAny);
1346  EsdTrackCuts->AliESDtrackCuts::SetMaxDCAToVertexXYPtDep("0.0105+0.0350/pt^1.1");
1347  EsdTrackCuts->AliESDtrackCuts::SetMaxChi2TPCConstrainedGlobal(36);
1348  EsdTrackCuts->AliESDtrackCuts::SetMaxDCAToVertexZ(2);
1349  EsdTrackCuts->AliESDtrackCuts::SetDCAToVertex2D(kFALSE);
1350  EsdTrackCuts->AliESDtrackCuts::SetRequireSigmaToVertex(kFALSE);
1351  EsdTrackCuts->AliESDtrackCuts::SetMaxChi2PerClusterITS(36);
1352 
1353  } else { // else use 2011 version of track cuts
1354  EsdTrackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2011();
1355  }
1356  EsdTrackCuts->SetMaxDCAToVertexZ(2);
1357  EsdTrackCuts->SetPtRange(0.15);
1358  }
1359 
1360  EsdTrackCuts->SetEtaRange(0.8, 1.4);
1361  for(Int_t iTracks = 0; iTracks < fInputEvent->GetNumberOfTracks(); iTracks++){
1362  AliESDtrack* curTrack = (AliESDtrack*) fInputEvent->GetTrack(iTracks);
1363  if(!curTrack) continue;
1364  if(EsdTrackCuts->AcceptTrack(curTrack) ){
1365  if (fMCEvent){
1366  if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 0){
1367  Int_t isFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(TMath::Abs(curTrack->GetLabel()), fMCEvent, fInputEvent);
1368  if( (isFromMBHeader < 1) ) continue;
1369  }
1370  }
1371  fNumberOfESDTracks++;
1372  }
1373  }
1374 
1375  EsdTrackCuts->SetEtaRange(-1.4, -0.8);
1376  for(Int_t iTracks = 0; iTracks < fInputEvent->GetNumberOfTracks(); iTracks++){
1377  AliESDtrack* curTrack =(AliESDtrack*) fInputEvent->GetTrack(iTracks);
1378  if(!curTrack) continue;
1379  if(EsdTrackCuts->AcceptTrack(curTrack) ){
1380  if (fMCEvent){
1381  if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 0){
1382  Int_t isFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(TMath::Abs(curTrack->GetLabel()), fMCEvent, fInputEvent);
1383  if( (isFromMBHeader < 1) ) continue;
1384  }
1385  }
1386  fNumberOfESDTracks++;
1387  }
1388  }
1389  delete EsdTrackCuts;
1390  EsdTrackCuts=0x0;
1391 
1392  }
1393 
1394  return fNumberOfESDTracks;
1395 }
1396 
1397 
1398 //________________________________________________________________________
1400  TAxis *axisafter = histoRebin->GetXaxis();
1401  Int_t bins = axisafter->GetNbins();
1402  Double_t from = axisafter->GetXmin();
1403  Double_t to = axisafter->GetXmax();
1404  Double_t *newbins = new Double_t[bins+1];
1405  newbins[0] = from;
1406  Double_t factor = TMath::Power(to/from, 1./bins);
1407  for(Int_t i=1; i<=bins; ++i) newbins[i] = factor * newbins[i-1];
1408  axisafter->Set(bins, newbins);
1409  delete [] newbins;
1410 }
1411 
1412 //________________________________________________________________________
1414 {
1415 // if (fStreamMaterial){
1416 // fStreamMaterial->GetFile()->Write();
1417 // }
1418 }
TParticle * GetMCParticle(AliMCEvent *mcEvent)
virtual Double_t GetPhotonPhi() const
#define P(T, U, S)
double Double_t
Definition: External.C:58
Definition: External.C:260
Definition: External.C:236
virtual Double_t GetPhotonTheta() const
TString GetPeriodName()
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
float Float_t
Definition: External.C:68
AliConversionPhotonCuts * GetConversionCuts()
Definition: AliV0ReaderV1.h:89
Class handling all kinds of selection cuts for Gamma Conversion analysis.
virtual Double_t GetPhotonEta() const
short Short_t
Definition: External.C:23
Definition: External.C:220
TClonesArray * GetReconstructedGammas() const
Definition: AliV0ReaderV1.h:85
virtual Double_t GetPhotonPt() const
Class handling all kinds of selection cuts for Gamma Conversion analysis.
AliConvEventCuts * GetEventCuts()
Definition: AliV0ReaderV1.h:90
const char Option_t
Definition: External.C:48
virtual void SetLogBinningXTH2(TH2 *histoRebin)
bool Bool_t
Definition: External.C:53
Double_t GetConversionRadius() const
TList * GetV0FindingEfficiencyHistograms()