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