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