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