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