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