AliPhysics  df4bbdf (df4bbdf)
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  fDoDeDxMaps(0),
41  fConversionGammas(NULL),
42  fGammaCandidates(NULL),
43  fConversionCutArray(NULL),
44  fEventCutArray(NULL),
45  fCutFolder(NULL),
46  fESDList(NULL),
47  fTrueList(NULL),
48  fMCList(NULL),
49  fDeDxMapList(NULL),
50  fOutputList(NULL),
51  fAllMCGammaList(NULL),
52  fAllMCConvGammaList(NULL),
53  fPrimVtxZ(0.),
54  fNContrVtx(0),
55  fNESDtracksEta09(0),
56  fNESDtracksEta0914(0),
57  fNESDtracksEta14(0),
58  fGammaMCPt(0.),
59  fGammaMCTheta(0.),
60  fGammaMCConvPt(0.),
61  fGammaMCConvTheta(0.),
62  fGammaPt(0.),
63  fGammaTheta(0.),
64  fGammaChi2NDF(0.),
65  fKind(0),
66  fIsHeavyIon(0),
67  fIsMC(0),
68  fInputEvent(NULL),
69  fMCEvent(NULL),
70  fnCuts(0),
71  fiCut(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  hElectrondEdxMapsR0(NULL),
116  hPositrondEdxMapsR0(NULL),
117  hElectrondEdxMapsR1(NULL),
118  hPositrondEdxMapsR1(NULL),
119  hElectrondEdxMapsR2(NULL),
120  hPositrondEdxMapsR2(NULL),
121  hElectrondEdxMapsR3(NULL),
122  hPositrondEdxMapsR3(NULL)
123 {
124 
125 }
126 
127 
128 //________________________________________________________________________
130  fV0Reader(NULL),
131  fV0ReaderName("V0ReaderV1"),
132  fDoDeDxMaps(0),
133  fConversionGammas(NULL),
134  fGammaCandidates(NULL),
135  fConversionCutArray(NULL),
136  fEventCutArray(NULL),
137  fCutFolder(NULL),
138  fESDList(NULL),
139  fTrueList(NULL),
140  fMCList(NULL),
141  fDeDxMapList(NULL),
142  fOutputList(NULL),
143  fAllMCGammaList(NULL),
144  fAllMCConvGammaList(NULL),
145  fPrimVtxZ(0.),
146  fNContrVtx(0),
147  fNESDtracksEta09(0),
148  fNESDtracksEta0914(0),
149  fNESDtracksEta14(0),
150  fGammaMCPt(0.),
151  fGammaMCTheta(0.),
152  fGammaMCConvPt(0.),
153  fGammaMCConvTheta(0.),
154  fGammaPt(0.),
155  fGammaTheta(0.),
156  fGammaChi2NDF(0.),
157  fKind(0),
158  fIsHeavyIon(0),
159  fIsMC(0),
160  fInputEvent(NULL),
161  fMCEvent(NULL),
162  fnCuts(0),
163  fiCut(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  hElectrondEdxMapsR0(NULL),
208  hPositrondEdxMapsR0(NULL),
209  hElectrondEdxMapsR1(NULL),
210  hPositrondEdxMapsR1(NULL),
211  hElectrondEdxMapsR2(NULL),
212  hPositrondEdxMapsR2(NULL),
213  hElectrondEdxMapsR3(NULL),
214  hPositrondEdxMapsR3(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* pidResonse = ((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  hESDConversionRPhi[fiCut]->Fill(gamma->GetPhotonPhi(),gamma->GetConversionRadius());
770  hESDConversionRZ[fiCut]->Fill(gamma->GetConversionZ(),gamma->GetConversionRadius());
771  hESDConversionREta[fiCut]->Fill(gamma->GetPhotonEta(),gamma->GetConversionRadius());
772  hESDConversionRPt[fiCut]->Fill(gamma->GetPhotonPt(),gamma->GetConversionRadius());
773 
774  if(negTrack->GetTPCsignal()){
775  hElectronRdEdx[fiCut]->Fill(negTrack->GetTPCsignal(),gamma->GetConversionRadius());
776  hElectronRNSigmadEdx[fiCut]->Fill(pidResonse->NumberOfSigmasTPC(negTrack, AliPID::kElectron),gamma->GetConversionRadius());
777  }
778  if(posTrack->GetTPCsignal()){
779  hPositronRdEdx[fiCut]->Fill(posTrack->GetTPCsignal(),gamma->GetConversionRadius());
780  hPositronRNSigmadEdx[fiCut]->Fill(pidResonse->NumberOfSigmasTPC(posTrack, AliPID::kElectron),gamma->GetConversionRadius());
781  }
782 
783  if(gamma->GetConversionRadius() < 75. || gamma->GetConversionRadius() > 85.) hESDConversionRRejSmall[fiCut]->Fill(gamma->GetConversionRadius());
784  if(gamma->GetConversionRadius() < 70. || gamma->GetConversionRadius() > 90.) hESDConversionRRejLarge[fiCut]->Fill(gamma->GetConversionRadius());
785 
786  if(fInputEvent->IsA()==AliESDEvent::Class()){
787  AliESDEvent *esdEvent = dynamic_cast<AliESDEvent*>(fInputEvent);
788  if(esdEvent){
789  AliESDv0 *v0 = esdEvent->GetV0(gamma->GetV0Index());
790  hESDConversionDCA[fiCut]->Fill(v0->GetDcaV0Daughters());
791  }
792  }
793  hESDConversionPsiPair[fiCut]->Fill(gamma->GetPsiPair());
794  hESDConversionChi2[fiCut]->Fill(gamma->GetChi2perNDF());
795  hESDConversionMass[fiCut]->Fill(gamma->GetInvMassPair());
796 
797  if(gamma->GetPhotonP()!=0 && negTrack->P()!=0) {
798  if(gamma->GetConversionRadius() > 5. ){
799  hESDConversionAsymP[fiCut]->Fill(gamma->GetPhotonP(),negTrack->P()/gamma->GetPhotonP());
800  }
801  }
802  if(fDoDeDxMaps > 0 ) {
803  if(gamma->GetConversionRadius() < 33.5){
804  hElectrondEdxMapsR0[fiCut]->Fill(pidResonse->NumberOfSigmasTPC(negTrack, AliPID::kElectron),gamma->GetPhotonEta(), negTrack->P());
805  hPositrondEdxMapsR0[fiCut]->Fill(pidResonse->NumberOfSigmasTPC(posTrack, AliPID::kElectron),gamma->GetPhotonEta(), posTrack->P());
806  }else if (gamma->GetConversionRadius() > 33.5 && gamma->GetConversionRadius() < 72.){
807  hElectrondEdxMapsR1[fiCut]->Fill(pidResonse->NumberOfSigmasTPC(negTrack, AliPID::kElectron),gamma->GetPhotonEta(), negTrack->P());
808  hPositrondEdxMapsR1[fiCut]->Fill(pidResonse->NumberOfSigmasTPC(posTrack, AliPID::kElectron),gamma->GetPhotonEta(), posTrack->P());
809  }else if (gamma->GetConversionRadius() > 72. && gamma->GetConversionRadius() < 145.){
810  hElectrondEdxMapsR2[fiCut]->Fill(pidResonse->NumberOfSigmasTPC(negTrack, AliPID::kElectron),gamma->GetPhotonEta(), negTrack->P());
811  hPositrondEdxMapsR2[fiCut]->Fill(pidResonse->NumberOfSigmasTPC(posTrack, AliPID::kElectron),gamma->GetPhotonEta(), posTrack->P());
812  }else if (gamma->GetConversionRadius() > 145. && gamma->GetConversionRadius() < 180.){
813  hElectrondEdxMapsR3[fiCut]->Fill(pidResonse->NumberOfSigmasTPC(negTrack, AliPID::kElectron),gamma->GetPhotonEta(), negTrack->P());
814  hPositrondEdxMapsR3[fiCut]->Fill(pidResonse->NumberOfSigmasTPC(posTrack, AliPID::kElectron),gamma->GetPhotonEta(), posTrack->P());
815  }
816  }
817 
818 
819  fKind = 9;
820  Int_t pdgCodePos = 0.;
821  Int_t pdgCodeNeg = 0.;
822 
823  if(fIsMC>0){
824 
825  const AliVVertex* primVtxMC = fMCEvent->GetPrimaryVertex();
826  Double_t mcProdVtxX = primVtxMC->GetX();
827  Double_t mcProdVtxY = primVtxMC->GetY();
828  Double_t mcProdVtxZ = primVtxMC->GetZ();
829 
830  TParticle *posDaughter = gamma->GetPositiveMCDaughter(fMCEvent);
831  TParticle *negDaughter = gamma->GetNegativeMCDaughter(fMCEvent);
832  TParticle *Photon = gamma->GetMCParticle(fMCEvent);
833  //cout << "generate Daughters: "<<posDaughter << "\t" << negDaughter << endl;
834 
835  if(fMCEvent && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 0){
836  Int_t isPosFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(gamma->GetMCLabelPositive(), fMCEvent, fInputEvent);
837  Int_t isNegFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(gamma->GetMCLabelNegative(), fMCEvent, fInputEvent);
838  if( (isNegFromMBHeader < 1) || (isPosFromMBHeader < 1)) continue;
839  }
840 
841  if(posDaughter == NULL || negDaughter == NULL){
842 
843  fKind = 9; // garbage
844 
845  } else if(posDaughter->GetMother(0) != negDaughter->GetMother(0) || (posDaughter->GetMother(0) == negDaughter->GetMother(0) && posDaughter->GetMother(0) ==-1)){
846 
847  fKind = 1; //Not Same Mother == Combinatorial Bck
848  pdgCodePos = posDaughter->GetPdgCode();
849  pdgCodeNeg = negDaughter->GetPdgCode();
850 
851  if(TMath::Abs(pdgCodePos)==11 && TMath::Abs(pdgCodeNeg)==11)
852  fKind = 10; //Electron Combinatorial
853  if(TMath::Abs(pdgCodePos)==11 && TMath::Abs(pdgCodeNeg)==11 && (posDaughter->GetMother(0) == negDaughter->GetMother(0) && posDaughter->GetMother(0) ==-1))
854  fKind = 15; //direct Electron Combinatorial
855  if(TMath::Abs(pdgCodePos)==211 && TMath::Abs(pdgCodeNeg)==211)
856  fKind = 11; //Pion Combinatorial
857  if((TMath::Abs(pdgCodePos)==211 && TMath::Abs(pdgCodeNeg)==2212) ||
858  (TMath::Abs(pdgCodePos)==2212 && TMath::Abs(pdgCodeNeg)==211))
859  fKind = 12; //Pion, Proton Combinatorics
860  if((TMath::Abs(pdgCodePos)==211 && TMath::Abs(pdgCodeNeg)==11) ||
861  (TMath::Abs(pdgCodePos)==11 && TMath::Abs(pdgCodeNeg)==211))
862  fKind = 13; //Pion, Electron Combinatorics
863  if (TMath::Abs(pdgCodePos)==321 || TMath::Abs(pdgCodeNeg)==321)
864  fKind = 14; //Kaon combinatorics
865 
866  } else {
867  //cout << "same mother" << endl;
868  pdgCodePos = posDaughter->GetPdgCode();
869  pdgCodeNeg = negDaughter->GetPdgCode();
870  Int_t pdgCode;
871  pdgCode = gamma->GetMCParticle(fMCEvent)->GetPdgCode();
872  if(TMath::Abs(pdgCodePos)!=11 || TMath::Abs(pdgCodeNeg)!=11)
873  fKind = 2; // combinatorics from hadronic decays
874  else if ( !(pdgCodeNeg==pdgCodePos)){
875  Bool_t gammaIsPrimary = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryESD( fMCEvent, posDaughter->GetMother(0), mcProdVtxX, mcProdVtxY, mcProdVtxZ);
876  if(pdgCode == 111) fKind = 3; // pi0 Dalitz
877  else if (pdgCode == 221)fKind = 4; // eta Dalitz
878  else if (!(negDaughter->GetUniqueID() != 5 || posDaughter->GetUniqueID() !=5)){
879  if(pdgCode == 22 && gammaIsPrimary){
880  fKind = 0; // primary photons
881  } else if (pdgCode == 22){
882  fKind = 5; //secondary photons
883  }
884  } else fKind = 9; //garbage
885  } else fKind = 9; //garbage
886  }
887 
888  if(fKind==0 || fKind==5){
892  hMCTrueConversionRPt[fiCut]->Fill(gamma->GetPhotonPt(),gamma->GetConversionRadius());
893  hMCTrueConversionRPtMCRPt[fiCut]->Fill(Photon->Pt(),negDaughter->R());
894 
895  if(gamma->GetConversionRadius() < 75. || gamma->GetConversionRadius() > 85.) hMCTrueConversionRRejSmall[fiCut]->Fill(gamma->GetConversionRadius());
896  if(gamma->GetConversionRadius() < 70. || gamma->GetConversionRadius() > 90.) hMCTrueConversionRRejLarge[fiCut]->Fill(gamma->GetConversionRadius());
897 
898  hMCTrueConversionPsiPair[fiCut]->Fill(gamma->GetPsiPair());
899  hMCTrueConversionChi2[fiCut]->Fill(gamma->GetChi2perNDF());
900  hMCTrueConversionMass[fiCut]->Fill(gamma->GetInvMassPair());
901  if(gamma->GetPhotonP()!=0 && negTrack->P()!=0) {
902  if(gamma->GetConversionRadius() > 5.){
903  hMCTrueConversionAsymP[fiCut]->Fill(gamma->GetPhotonP(),negTrack->P()/gamma->GetPhotonP());
904  }
905  }
906 
907 
908  if(fInputEvent->IsA()==AliESDEvent::Class()){
909  AliESDEvent *esdEvent = dynamic_cast<AliESDEvent*>(fInputEvent);
910  if(esdEvent){
911  AliESDv0 *v0 = esdEvent->GetV0(gamma->GetV0Index());
912  hMCTrueConversionDCA[fiCut]->Fill(v0->GetDcaV0Daughters());
913  }
914  }
915 
916  } else if(fKind==3){
919  } else if(fKind==4){
922  } else {
925  }
926  }
927  }
928 
929  delete GammaCandidatesStepTwo;
930  GammaCandidatesStepTwo = 0x0;
931 
932 
933 }
934 
935 //________________________________________________________________________
937 
938  Int_t fNumberOfESDTracks = 0;
939  if(fInputEvent->IsA()==AliESDEvent::Class()){
940  // Using standard function for setting Cuts
941 
942 // Bool_t selectPrimaries = kTRUE;
943  static AliESDtrackCuts *EsdTrackCuts = 0x0;
944  static int prevRun = -1;
945  // Using standard function for setting Cuts
946  Int_t runNumber = fInputEvent->GetRunNumber();
947  if (prevRun!=runNumber) {
948  delete EsdTrackCuts;
949  EsdTrackCuts = 0;
950  prevRun = runNumber;
951  }
952 // AliESDtrackCuts *EsdTrackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2010(selectPrimaries);
953  if (!EsdTrackCuts) {
954  // if LHC11a or earlier or if LHC13g or if LHC12a-i -> use 2010 cuts
955  if( (runNumber<=146860) || (runNumber>=197470 && runNumber<=197692) || (runNumber>=172440 && runNumber<=193766) ){
956  EsdTrackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2010();
957 
958  } else if (runNumber>=209122){ // else if run2 data use 2015 PbPb cuts
959  //EsdTrackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2015PbPb();
960  // hard coded track cuts for the moment, because AliESDtrackCuts::GetStandardITSTPCTrackCuts2015PbPb() gives spams warnings
961  EsdTrackCuts = new AliESDtrackCuts();
962  // TPC; clusterCut = 1, cutAcceptanceEdges = kTRUE, removeDistortedRegions = kFALSE
963  EsdTrackCuts->AliESDtrackCuts::SetMinNCrossedRowsTPC(70);
964  EsdTrackCuts->AliESDtrackCuts::SetMinRatioCrossedRowsOverFindableClustersTPC(0.8);
965  EsdTrackCuts->SetCutGeoNcrNcl(2., 130., 1.5, 0.0, 0.0); // only dead zone and not clusters per length
966  //EsdTrackCuts->AliESDtrackCuts::SetCutOutDistortedRegionsTPC(kTRUE);
967  EsdTrackCuts->AliESDtrackCuts::SetMaxChi2PerClusterTPC(4);
968  EsdTrackCuts->AliESDtrackCuts::SetAcceptKinkDaughters(kFALSE);
969  EsdTrackCuts->AliESDtrackCuts::SetRequireTPCRefit(kTRUE);
970  // ITS; selPrimaries = 1
971  EsdTrackCuts->AliESDtrackCuts::SetRequireITSRefit(kTRUE);
972  EsdTrackCuts->AliESDtrackCuts::SetClusterRequirementITS(AliESDtrackCuts::kSPD,
973  AliESDtrackCuts::kAny);
974  EsdTrackCuts->AliESDtrackCuts::SetMaxDCAToVertexXYPtDep("0.0105+0.0350/pt^1.1");
975  EsdTrackCuts->AliESDtrackCuts::SetMaxChi2TPCConstrainedGlobal(36);
976  EsdTrackCuts->AliESDtrackCuts::SetMaxDCAToVertexZ(2);
977  EsdTrackCuts->AliESDtrackCuts::SetDCAToVertex2D(kFALSE);
978  EsdTrackCuts->AliESDtrackCuts::SetRequireSigmaToVertex(kFALSE);
979  EsdTrackCuts->AliESDtrackCuts::SetMaxChi2PerClusterITS(36);
980 
981  } else { // else use 2011 version of track cuts
982  EsdTrackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2011();
983  }
984  EsdTrackCuts->SetMaxDCAToVertexZ(2);
985  EsdTrackCuts->SetEtaRange(-0.9, 0.9);
986  EsdTrackCuts->SetPtRange(0.15);
987  }
988 
989  for(Int_t iTracks = 0; iTracks < fInputEvent->GetNumberOfTracks(); iTracks++){
990  AliESDtrack* curTrack = (AliESDtrack*) fInputEvent->GetTrack(iTracks);
991  if(!curTrack) continue;
992  if(EsdTrackCuts->AcceptTrack(curTrack) ){
993  if (fMCEvent){
994  if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 0){
995  Int_t isFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(TMath::Abs(curTrack->GetLabel()), fMCEvent, fInputEvent);
996  if( (isFromMBHeader < 1) ) continue;
997  }
998  }
999  fNumberOfESDTracks++;
1000  }
1001  }
1002  delete EsdTrackCuts;
1003  EsdTrackCuts=0x0;
1004 
1005  }
1006 
1007  return fNumberOfESDTracks;
1008 
1009 }
1010 
1011 //________________________________________________________________________
1013 
1014  Int_t fNumberOfESDTracks = 0;
1015  if(fInputEvent->IsA()==AliESDEvent::Class()){
1016  // Using standard function for setting Cuts
1017 
1018 // Bool_t selectPrimaries = kTRUE;
1019  static AliESDtrackCuts *EsdTrackCuts = 0x0;
1020  static int prevRun = -1;
1021  // Using standard function for setting Cuts
1022  Int_t runNumber = fInputEvent->GetRunNumber();
1023  if (prevRun!=runNumber) {
1024  delete EsdTrackCuts;
1025  EsdTrackCuts = 0;
1026  prevRun = runNumber;
1027  }
1028 // AliESDtrackCuts *EsdTrackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2010(selectPrimaries);
1029  if (!EsdTrackCuts) {
1030  // if LHC11a or earlier or if LHC13g or if LHC12a-i -> use 2010 cuts
1031  if( (runNumber<=146860) || (runNumber>=197470 && runNumber<=197692) || (runNumber>=172440 && runNumber<=193766) ){
1032  EsdTrackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2010();
1033 
1034  } else if (runNumber>=209122){ // else if run2 data use 2015 PbPb cuts
1035  //EsdTrackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2015PbPb();
1036  // hard coded track cuts for the moment, because AliESDtrackCuts::GetStandardITSTPCTrackCuts2015PbPb() gives spams warnings
1037  EsdTrackCuts = new AliESDtrackCuts();
1038  // TPC; clusterCut = 1, cutAcceptanceEdges = kTRUE, removeDistortedRegions = kFALSE
1039  EsdTrackCuts->AliESDtrackCuts::SetMinNCrossedRowsTPC(70);
1040  EsdTrackCuts->AliESDtrackCuts::SetMinRatioCrossedRowsOverFindableClustersTPC(0.8);
1041  EsdTrackCuts->SetCutGeoNcrNcl(2., 130., 1.5, 0.0, 0.0); // only dead zone and not clusters per length
1042  //EsdTrackCuts->AliESDtrackCuts::SetCutOutDistortedRegionsTPC(kTRUE);
1043  EsdTrackCuts->AliESDtrackCuts::SetMaxChi2PerClusterTPC(4);
1044  EsdTrackCuts->AliESDtrackCuts::SetAcceptKinkDaughters(kFALSE);
1045  EsdTrackCuts->AliESDtrackCuts::SetRequireTPCRefit(kTRUE);
1046  // ITS; selPrimaries = 1
1047  EsdTrackCuts->AliESDtrackCuts::SetRequireITSRefit(kTRUE);
1048  EsdTrackCuts->AliESDtrackCuts::SetClusterRequirementITS(AliESDtrackCuts::kSPD,
1049  AliESDtrackCuts::kAny);
1050  EsdTrackCuts->AliESDtrackCuts::SetMaxDCAToVertexXYPtDep("0.0105+0.0350/pt^1.1");
1051  EsdTrackCuts->AliESDtrackCuts::SetMaxChi2TPCConstrainedGlobal(36);
1052  EsdTrackCuts->AliESDtrackCuts::SetMaxDCAToVertexZ(2);
1053  EsdTrackCuts->AliESDtrackCuts::SetDCAToVertex2D(kFALSE);
1054  EsdTrackCuts->AliESDtrackCuts::SetRequireSigmaToVertex(kFALSE);
1055  EsdTrackCuts->AliESDtrackCuts::SetMaxChi2PerClusterITS(36);
1056 
1057  } else { // else use 2011 version of track cuts
1058  EsdTrackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2011();
1059  }
1060  EsdTrackCuts->SetMaxDCAToVertexZ(2);
1061  EsdTrackCuts->SetPtRange(0.15);
1062  }
1063 
1064  EsdTrackCuts->SetEtaRange(0.9, 1.4);
1065  for(Int_t iTracks = 0; iTracks < fInputEvent->GetNumberOfTracks(); iTracks++){
1066  AliESDtrack* curTrack = (AliESDtrack*) fInputEvent->GetTrack(iTracks);
1067  if(!curTrack) continue;
1068  if(EsdTrackCuts->AcceptTrack(curTrack) ){
1069  if (fMCEvent){
1070  if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 0){
1071  Int_t isFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(TMath::Abs(curTrack->GetLabel()), fMCEvent, fInputEvent);
1072  if( (isFromMBHeader < 1) ) continue;
1073  }
1074  }
1075  fNumberOfESDTracks++;
1076  }
1077  }
1078 
1079  EsdTrackCuts->SetEtaRange(-1.4, -0.9);
1080  for(Int_t iTracks = 0; iTracks < fInputEvent->GetNumberOfTracks(); iTracks++){
1081  AliESDtrack* curTrack =(AliESDtrack*) fInputEvent->GetTrack(iTracks);
1082  if(!curTrack) continue;
1083  if(EsdTrackCuts->AcceptTrack(curTrack) ){
1084  if (fMCEvent){
1085  if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 0){
1086  Int_t isFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(TMath::Abs(curTrack->GetLabel()), fMCEvent, fInputEvent);
1087  if( (isFromMBHeader < 1) ) continue;
1088  }
1089  }
1090  fNumberOfESDTracks++;
1091  }
1092  }
1093  delete EsdTrackCuts;
1094  EsdTrackCuts=0x0;
1095 
1096  }
1097 
1098  return fNumberOfESDTracks;
1099 }
1100 
1101 
1102 //________________________________________________________________________
1104  TAxis *axisafter = histoRebin->GetXaxis();
1105  Int_t bins = axisafter->GetNbins();
1106  Double_t from = axisafter->GetXmin();
1107  Double_t to = axisafter->GetXmax();
1108  Double_t *newbins = new Double_t[bins+1];
1109  newbins[0] = from;
1110  Double_t factor = TMath::Power(to/from, 1./bins);
1111  for(Int_t i=1; i<=bins; ++i) newbins[i] = factor * newbins[i-1];
1112  axisafter->Set(bins, newbins);
1113  delete [] newbins;
1114 }
1115 
1116 //________________________________________________________________________
1118 {
1119 // if (fStreamMaterial){
1120 // fStreamMaterial->GetFile()->Write();
1121 // }
1122 }
TParticle * GetMCParticle(AliMCEvent *mcEvent)
virtual Double_t GetPhotonPhi() const
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
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()