]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG4/macros/ConfigGammaConversion.C
Cleaning up files, added documentation. Added ntuple for v0s.
[u/mrichter/AliRoot.git] / PWG4 / macros / ConfigGammaConversion.C
1
2 /** VERSION NUMBER 0 */
3
4 Bool_t usePWG4PartCorr = kTRUE;
5
6
7 /** ------------------------------ Monte Carlo flag -----------------------------------------*/
8 Bool_t doMCTruth = kTRUE;
9 /** ---------------------------- end Monte Carlo flag ---------------------------------------*/
10
11 /** ------------------------- Choose KFParticle OR ESDTrack  --------------------------------*/
12 Bool_t useKFParticle = kTRUE;
13 Bool_t useESDTrack   = kFALSE;
14 /** ----------------------- end Choose KFParticle OR ESDTrack  -----------------------------*/
15
16
17 Bool_t calculateBackground = kTRUE;
18
19 Int_t numberOfFilesToAnalyze=2000;
20
21 /** ---------------------------------- define cuts here ------------------------------------*/
22
23 Int_t pidOfNegativeTrack=11;
24 Int_t pidOfPositiveTrack=-11;
25
26 Double_t maxRCut   = 200.;
27 Double_t etaCut    = 1.2;
28 Double_t ptCut     = 0.1;
29 Double_t chi2CutConversion   = 20.;
30 Double_t chi2CutMeson   = 20.;
31
32 Double_t xVertexCut = 0.;
33 Double_t yVertexCut = 0.;
34 Double_t zVertexCut = 0.;
35
36 Double_t sigmaCutGammaMass=0.0001;
37
38 Bool_t useImprovedVertex = kTRUE;
39
40 // define masses of different particles, this will be used by the KF particle
41 // together with the width to set mass constraints. Units in GeV.
42 Double_t electronMass = 0.00051099892;
43 Double_t gammaMass    = 0.;
44 Double_t pi0Mass      = 0.1349766;
45 Double_t etaMass      = 0.54751;
46
47 // define the width constraint used by KF particle.
48 Double_t gammaWidth = 0.01;
49 Double_t pi0Width   = 0.01;
50 Double_t etaWidth   = 0.01;
51
52 // define the probability of track being an electron
53 Double_t probElectron = 0.5;
54
55 /** ----------------------------------end define cuts here----------------------------------*/
56
57 /** -------------------------------- Phi/R Mapping ---------------------------------------*/
58 Int_t nPhiIndex = 18;
59 Int_t nRIndex   = 40;
60
61 Double_t minRadius   = 0.;
62 Double_t maxRadius   = 200.;
63 Double_t minPhi      = -TMath::Pi();
64 Double_t maxPhi      = TMath::Pi();
65 /** ------------------------------- end Phi/R Mapping ------------------------------------*/
66
67 /** ------------------- define which histograms to plot here --------------------------------*/
68 /**   NB: to change the bin numbers, see below the histogram flags                           */
69 Bool_t plotMCEPR                                           = kTRUE;
70 Bool_t plotMCEPZR                                          = kTRUE;
71 Bool_t plotMCEPXY                                          = kTRUE;
72 Bool_t plotMCEPOpeningAngle                                = kTRUE;
73
74 Bool_t plotMCEEnergy                                       = kTRUE;
75 Bool_t plotMCEPt                                           = kTRUE;
76 Bool_t plotMCEEta                                          = kTRUE;
77 Bool_t plotMCEPhi                                          = kTRUE;
78
79 Bool_t plotMCPEnergy                                       = kTRUE;
80 Bool_t plotMCPPt                                           = kTRUE;
81 Bool_t plotMCPEta                                          = kTRUE;
82 Bool_t plotMCPPhi                                          = kTRUE;
83
84 Bool_t plotMCGammaEnergy                                   = kTRUE;
85 Bool_t plotMCGammaPt                                       = kTRUE;
86 Bool_t plotMCGammaEta                                      = kTRUE;
87 Bool_t plotMCGammaPhi                                      = kTRUE;
88
89 Bool_t plotMCDirectGammaEnergy                             = kTRUE;
90 Bool_t plotMCDirectGammaPt                                 = kTRUE;
91 Bool_t plotMCDirectGammaEta                                = kTRUE;
92 Bool_t plotMCDirectGammaPhi                                = kTRUE;
93
94 Bool_t plotMCMatchGammaEta                                 = kTRUE;
95 Bool_t plotMCMatchGammaPhi                                 = kTRUE;
96 Bool_t plotMCMatchGammaPt                                  = kTRUE;
97 Bool_t plotMCMatchGammaEnergy                              = kTRUE;
98 Bool_t plotMCMatchGammaMass                                = kTRUE;
99 Bool_t plotMCMatchGammaOpeningAngle                        = kTRUE;
100 Bool_t plotMCMatchGammaR                                   = kTRUE;
101 Bool_t plotMCMatchGammaZR                                  = kTRUE;
102 Bool_t plotMCMatchGammaXY                                  = kTRUE;
103
104 Bool_t plotMCPi0Eta                                        = kTRUE;
105 Bool_t plotMCPi0Phi                                        = kTRUE;
106 Bool_t plotMCPi0Pt                                         = kTRUE;
107 Bool_t plotMCPi0Energy                                     = kTRUE;
108 Bool_t plotMCPi0Mass                                       = kTRUE;
109 Bool_t plotMCPi0OpeningAngle                               = kTRUE;
110 Bool_t plotMCPi0R                                          = kTRUE;
111 Bool_t plotMCPi0ZR                                         = kTRUE;
112 Bool_t plotMCPi0XY                                         = kTRUE;
113
114 Bool_t plotMCEtaEta                                        = kTRUE;
115 Bool_t plotMCEtaPhi                                        = kTRUE;
116 Bool_t plotMCEtaPt                                         = kTRUE;
117 Bool_t plotMCEtaEnergy                                     = kTRUE;
118 Bool_t plotMCEtaMass                                       = kTRUE;
119 Bool_t plotMCEtaOpeningAngleGamma                          = kTRUE;
120 Bool_t plotMCEtaR                                          = kTRUE;
121 Bool_t plotMCEtaZR                                         = kTRUE;
122 Bool_t plotMCEtaXY                                         = kTRUE;
123     
124 // Histograms from esd tracks
125 Bool_t plotESDEPR                                          = kTRUE;
126 Bool_t plotESDEPZR                                         = kTRUE;
127 Bool_t plotESDEPXY                                         = kTRUE;
128 Bool_t plotESDEPOpeningAngle                               = kTRUE;
129
130 Bool_t plotESDEEnergy                                      = kTRUE;
131 Bool_t plotESDEPt                                          = kTRUE;
132 Bool_t plotESDEEta                                         = kTRUE;
133 Bool_t plotESDEPhi                                         = kTRUE;
134
135 Bool_t plotESDPEnergy                                      = kTRUE;
136 Bool_t plotESDPPt                                          = kTRUE;
137 Bool_t plotESDPEta                                         = kTRUE;
138 Bool_t plotESDPPhi                                         = kTRUE;
139
140
141 Bool_t plotESDGammaEnergy                                  = kTRUE;
142 Bool_t plotESDGammaPt                                      = kTRUE;
143 Bool_t plotESDGammaEta                                     = kTRUE;
144 Bool_t plotESDGammaPhi                                     = kTRUE;
145
146 Bool_t plotESDMatchGammaOpeningAngle                       = kTRUE;
147 Bool_t plotESDMatchGammaEnergy                             = kTRUE;
148 Bool_t plotESDMatchGammaPt                                 = kTRUE;
149 Bool_t plotESDMatchGammaEta                                = kTRUE;
150 Bool_t plotESDMatchGammaPhi                                = kTRUE;
151 Bool_t plotESDMatchGammaMass                               = kTRUE;
152 Bool_t plotESDMatchGammaWidth                              = kTRUE;
153 Bool_t plotESDMatchGammaChi2                               = kTRUE;
154 Bool_t plotESDMatchGammaNDF                                = kTRUE;
155 Bool_t plotESDMatchGammaR                                  = kTRUE;
156 Bool_t plotESDMatchGammaZR                                 = kTRUE;
157 Bool_t plotESDMatchGammaXY                                 = kTRUE;
158
159 Bool_t plotESDTwoGammaCombinationOpeningAngleGamma         = kTRUE;
160 Bool_t plotESDTwoGammaCombinationEnergy                    = kTRUE;
161 Bool_t plotESDTwoGammaCombinationPt                        = kTRUE;
162 Bool_t plotESDTwoGammaCombinationEta                       = kTRUE;
163 Bool_t plotESDTwoGammaCombinationPhi                       = kTRUE;
164 Bool_t plotESDTwoGammaCombinationMass                      = kTRUE;
165 Bool_t plotESDTwoGammaCombinationR                         = kTRUE;
166 Bool_t plotESDTwoGammaCombinationZR                        = kTRUE;
167 Bool_t plotESDTwoGammaCombinationXY                        = kTRUE;
168
169 Bool_t plotESDBackgroundOpeningAngleGamma                  = kTRUE;
170 Bool_t plotESDBackgroundEnergy                             = kTRUE;
171 Bool_t plotESDBackgroundPt                                 = kTRUE;
172 Bool_t plotESDBackgroundEta                                = kTRUE;
173 Bool_t plotESDBackgroundPhi                                = kTRUE;
174 Bool_t plotESDBackgroundMass                               = kTRUE;
175 Bool_t plotESDBackgroundR                                  = kTRUE;
176 Bool_t plotESDBackgroundZR                                 = kTRUE;
177 Bool_t plotESDBackgroundXY                                 = kTRUE;
178
179 Bool_t plotMapping                                         = kTRUE;       
180
181 Bool_t plotResolutiondPt                                   = kTRUE;
182 Bool_t plotResolutiondR                                    = kTRUE;
183 Bool_t plotResolutiondZ                                    = kTRUE;
184   
185 Bool_t plotResolutiondRdPt                                 = kTRUE;
186
187 Bool_t plotResolutionMCPt                                  = kTRUE;
188 Bool_t plotResolutionMCR                                   = kTRUE;
189 Bool_t plotResolutionMCZ                                   = kTRUE;
190
191 Bool_t plotResolutionESDPt                                 = kTRUE;
192 Bool_t plotResolutionESDR                                  = kTRUE;
193 Bool_t plotResolutionESDZ                                  = kTRUE;
194
195 Bool_t plotNumberOfV0s                                     = kTRUE;
196 Bool_t plotNumberOfSurvivingV0s                            = kTRUE;
197
198   //  debug histograms
199 Bool_t plotV0MassDebugCut1                                 = kTRUE;
200 Bool_t plotV0MassDebugCut2                                 = kTRUE;
201 Bool_t plotV0MassDebugCut3                                 = kTRUE;
202 Bool_t plotV0MassDebugCut4                                 = kTRUE;
203 Bool_t plotV0MassDebugCut5                                 = kTRUE;
204 Bool_t plotV0MassDebugCut6                                 = kTRUE;
205 Bool_t plotV0MassDebugCut7                                 = kTRUE;
206 Bool_t plotV0MassDebugCut8                                 = kTRUE;
207
208 Bool_t plotPi0Spectra                                      = kTRUE;
209 Bool_t plotEtaSpectra                                      = kTRUE;
210
211
212 /** ----------------- end define which histograms to plot here -------------------------------*/
213
214
215
216 /** ----------- Define the binning for the different plot types here -------------------------*/
217 //R-plots
218 Int_t nXBinsR = 1000;
219 Double_t firstXBinR = 0.;
220 Double_t lastXBinR = 250.;
221
222 //ZR-plots
223 Int_t nXBinsZR = 2000;
224 Double_t firstXBinZR = -10.;
225 Double_t lastXBinZR = 10.;
226 Int_t nYBinsZR = 1000;
227 Double_t firstYBinZR = 0.;
228 Double_t lastYBinZR = 250.;
229
230 //XY-plots
231 Int_t nXBinsXY = 2000;
232 Double_t firstXBinXY = -250.;
233 Double_t lastXBinXY = 250.;
234 Int_t nYBinsXY = 2000;
235 Double_t firstYBinXY = -250.;
236 Double_t lastYBinXY = 250.;
237
238 //OpenAngle-plots
239 Int_t nXBinsOpeningAngle = 200;
240 Double_t firstXBinOpeningAngle = 0.;
241 Double_t lastXBinOpeningAngle = TMath::Pi()/2;
242
243 //Energy-plots
244 Int_t nXBinsEnergy = 500;
245 Double_t firstXBinEnergy = 0.;
246 Double_t lastXBinEnergy = 5.;
247
248 //Pt-plots
249 Int_t nXBinsPt = 500;
250 Double_t firstXBinPt = 0.;
251 Double_t lastXBinPt = 5.;
252
253 //Eta-plots
254 Int_t nXBinsEta = 400;
255 Double_t firstXBinEta = -2.;
256 Double_t lastXBinEta = 2.;
257
258 //Phi-plots
259 Int_t nXBinsPhi = 720;
260 Double_t firstXBinPhi = -TMath::Pi();
261 Double_t lastXBinPhi = TMath::Pi();
262
263 //Mapping-plots
264 Int_t nXBinsMapping = 40;
265 Double_t firstXBinMapping = -20.;
266 Double_t lastXBinMapping = 20.;
267 Int_t nYBinsMapping = 30;
268 Double_t firstYBinMapping = -1.5;
269 Double_t lastYBinMapping = 1.5;
270
271 //ResolutionPlots
272 //RESdPt
273 Int_t nXBinsResdPt=500;
274 Int_t firstXBinResdPt= 0;
275 Int_t lastXBinResdPt=5;
276 Int_t nYBinsResdPt=1000;
277 Int_t firstYBinResdPt= -5;
278 Int_t lastYBinResdPt=5;
279
280 //RESdR
281 Int_t nXBinsResdR=1000;
282 Int_t firstXBinResdR= 0;
283 Int_t lastXBinResdR=250;
284 Int_t nYBinsResdR=1000;
285 Int_t firstYBinResdR= -25;
286 Int_t lastYBinResdR=25;
287
288 //RESdZ
289 Int_t nXBinsResdZ=2000;
290 Int_t firstXBinResdZ= -20;
291 Int_t lastXBinResdZ=20;
292 Int_t nYBinsResdZ=1000;
293 Int_t firstYBinResdZ= -20;
294 Int_t lastYBinResdZ=20;
295
296 //RESdRdPt
297 Int_t nXBinsResdRdPt=1000;
298 Int_t firstXBinResdRdPt= -22;
299 Int_t lastXBinResdRdPt=22;
300 Int_t nYBinsResdRdPt=1000;
301 Int_t firstYBinResdRdPt= -5;
302 Int_t lastYBinResdRdPt=5;
303
304
305 //RESMCPt
306 Int_t nXBinsResPt=500;
307 Int_t firstXBinResPt= 0;
308 Int_t lastXBinResPt=5;
309
310 //RESMCR
311 Int_t nXBinsResR=1000;
312 Int_t firstXBinResR= 0;
313 Int_t lastXBinResR=250;
314
315 //RESMCZ
316 Int_t nXBinsResZ=1000;
317 Int_t firstXBinResZ= 0;
318 Int_t lastXBinResZ=250;
319
320 //GammaMass-plots
321 Int_t nXBinsGammaMass = 100;
322 Double_t firstXBinGammaMass = 0.;
323 Double_t lastXBinGammaMass = 1.;
324
325 //Pi0Mass-plots
326 Int_t nXBinsPi0Mass = 100;
327 Double_t firstXBinPi0Mass = 0.;
328 Double_t lastXBinPi0Mass = 1.;
329
330 //EtaMass-plots
331 Int_t nXBinsEtaMass = 100;
332 Double_t firstXBinEtaMass = 0.;
333 Double_t lastXBinEtaMass = 1.;
334
335 //GammaWidth-plots
336 Int_t nXBinsGammaWidth = 100;
337 Double_t firstXBinGammaWidth = 0.;
338 Double_t lastXBinGammaWidth = 1.;
339
340 //GammaChi2-plots
341 Int_t nXBinsGammaChi2 = 100;
342 Double_t firstXBinGammaChi2 = 0;
343 Double_t lastXBinGammaChi2 = 100.;
344
345 //GammaNDF-plots
346 Int_t nXBinsGammaNDF = 10;
347 Double_t firstXBinGammaNDF = 0.;
348 Double_t lastXBinGammaNDF = 10.;
349
350 //Spectra-plots
351 Int_t nXBinsSpectra = 100;
352 Double_t firstXBinSpectra = 0.;
353 Double_t lastXBinSpectra = 1.;
354 Int_t nYBinsSpectra = 500;
355 Double_t firstYBinSpectra = 0.;
356 Double_t lastYBinSpectra = 100.;
357
358 /** ---------- end Define the binning for the different plot types here ----------------------*/
359
360
361
362 /************************************************************************************************
363  *                                                                                              *
364  *                                                                                              *
365  *                     EVERYTHING BELOW IS FOR DEVELOPERS ONLY                                  *
366  *                                                                                              *
367  *                                                                                              *
368  ************************************************************************************************/
369
370 void ConfigGammaConversion(const char *chainName, const char *sample, Bool_t writeNtuple = kFALSE){
371   
372   build();//build (if necessary) and load the libraries needed
373
374   gROOT->LoadMacro("$ALICE_ROOT/PWG0/CreateESDChain.C"); // load the CreateChain macro
375
376   AliLog::SetGlobalLogLevel(AliLog::kError);
377
378   //-------------------------------- Creating the histograms -------------------------------
379   AliGammaConversionHistograms * histograms = new AliGammaConversionHistograms();
380
381   if(plotMCEPR == kTRUE){ histograms->AddHistogram("MC_EP_R","Radius of gamma conversion points",nXBinsR, firstXBinR, lastXBinR,"counts","cm");}
382   if(plotMCEPZR == kTRUE){ histograms->AddHistogram("MC_EP_ZR","Radius of gamma conversion points vs Z",nXBinsZR, firstXBinZR, lastXBinZR, nYBinsZR, firstYBinZR, lastYBinZR, "cm", "cm");}
383   if(plotMCEPXY == kTRUE){ histograms->AddHistogram("MC_EP_XY","Gamma XY converison point.",nXBinsXY, firstXBinXY, lastXBinXY, nYBinsXY, firstYBinXY, lastYBinXY, "cm", "cm");}
384   if(plotMCEPOpeningAngle == kTRUE){ histograms->AddHistogram("MC_EP_OpeningAngle","Opening angle of e+e- pairs from gamma conversion",nXBinsOpeningAngle, firstXBinOpeningAngle, lastXBinOpeningAngle, "counts", "cm");}
385
386   if(plotMCEEnergy == kTRUE){ histograms->AddHistogram("MC_E_Energy" ,"" , nXBinsEnergy, firstXBinEnergy, lastXBinEnergy, "", "");}
387   if(plotMCEPt == kTRUE){ histograms->AddHistogram("MC_E_Pt" ,"" , nXBinsPt, firstXBinPt, lastXBinPt, "", "");}
388   if(plotMCEEta == kTRUE){ histograms->AddHistogram("MC_E_Eta" ,"" , nXBinsEta, firstXBinEta, lastXBinEta, "", "");}
389   if(plotMCEPhi == kTRUE){ histograms->AddHistogram("MC_E_Phi" ,"" , nXBinsPhi, firstXBinPhi, lastXBinPhi, "", "");}
390
391   if(plotMCPEnergy == kTRUE){ histograms->AddHistogram("MC_P_Energy" ,"" , nXBinsEnergy, firstXBinEnergy, lastXBinEnergy, "", "");}
392   if(plotMCPPt == kTRUE){ histograms->AddHistogram("MC_P_Pt" ,"" , nXBinsPt, firstXBinPt, lastXBinPt, "", "");}
393   if(plotMCPEta == kTRUE){ histograms->AddHistogram("MC_P_Eta" ,"" , nXBinsEta, firstXBinEta, lastXBinEta, "", "");}
394   if(plotMCPPhi == kTRUE){ histograms->AddHistogram("MC_P_Phi" ,"" , nXBinsPhi, firstXBinPhi, lastXBinPhi, "", "");}
395
396   if(plotMCGammaEnergy == kTRUE){ histograms->AddHistogram("MC_Gamma_Energy" ,"" , nXBinsEnergy, firstXBinEnergy, lastXBinEnergy, "", "");}
397   if(plotMCGammaPt == kTRUE){ histograms->AddHistogram("MC_Gamma_Pt" ,"" , nXBinsPt, firstXBinPt, lastXBinPt, "", "");}
398   if(plotMCGammaEta == kTRUE){ histograms->AddHistogram("MC_Gamma_Eta" ,"" , nXBinsEta, firstXBinEta, lastXBinEta, "", "");}
399   if(plotMCGammaPhi == kTRUE){ histograms->AddHistogram("MC_Gamma_Phi" ,"" , nXBinsPhi, firstXBinPhi, lastXBinPhi, "", "");}
400
401   if(plotMCDirectGammaEnergy == kTRUE){ histograms->AddHistogram("MC_DirectGamma_Energy" ,"" , nXBinsEnergy, firstXBinEnergy, lastXBinEnergy, "", "");}
402   if(plotMCDirectGammaPt == kTRUE){ histograms->AddHistogram("MC_DirectGamma_Pt" ,"" , nXBinsPt, firstXBinPt, lastXBinPt, "", "");}
403   if(plotMCDirectGammaEta == kTRUE){ histograms->AddHistogram("MC_DirectGamma_Eta" ,"" , nXBinsEta, firstXBinEta, lastXBinEta, "", "");}
404   if(plotMCDirectGammaPhi == kTRUE){ histograms->AddHistogram("MC_DirectGamma_Phi" ,"" , nXBinsPhi, firstXBinPhi, lastXBinPhi, "", "");}
405
406   if(plotMCMatchGammaEta == kTRUE){ histograms->AddHistogram("MC_Match_Gamma_Eta" ,"" , nXBinsEta, firstXBinEta, lastXBinEta, "", "");}
407   if(plotMCMatchGammaPhi == kTRUE){ histograms->AddHistogram("MC_Match_Gamma_Phi" ,"" , nXBinsPhi, firstXBinPhi, lastXBinPhi, "", "");}
408   if(plotMCMatchGammaPt == kTRUE){ histograms->AddHistogram("MC_Match_Gamma_Pt" ,"" , nXBinsPt, firstXBinPt, lastXBinPt, "", "");}
409   if(plotMCMatchGammaEnergy == kTRUE){ histograms->AddHistogram("MC_Match_Gamma_Energy" ,"" , nXBinsEnergy, firstXBinEnergy, lastXBinEnergy, "", "");}
410   if(plotMCMatchGammaMass == kTRUE){ histograms->AddHistogram("MC_Match_Gamma_Mass" ,"" , nXBinsGammaMass, firstXBinGammaMass, lastXBinGammaMass, "", "");}
411   if(plotMCMatchGammaOpeningAngle == kTRUE){ histograms->AddHistogram("MC_Match_Gamma_OpeningAngle" ,"" , nXBinsOpeningAngle, firstXBinOpeningAngle, lastXBinOpeningAngle, "", "");}
412   if(plotMCMatchGammaR == kTRUE){ histograms->AddHistogram("MC_Match_Gamma_R" ,"" , nXBinsR, firstXBinR, lastXBinR, "", "");}
413   if(plotMCMatchGammaZR == kTRUE){ histograms->AddHistogram("MC_Match_Gamma_ZR" ,"" , nXBinsZR, firstXBinZR, lastXBinZR, nYBinsZR, firstYBinZR, lastYBinZR, "", "");}
414   if(plotMCMatchGammaXY == kTRUE){ histograms->AddHistogram("MC_Match_Gamma_XY" ,"" , nXBinsXY, firstXBinXY, lastXBinXY, nYBinsXY, firstYBinXY, lastYBinXY, "", "");}
415
416   if(plotMCPi0Eta == kTRUE){ histograms->AddHistogram("MC_Pi0_Eta" ,"" , nXBinsEta, firstXBinEta, lastXBinEta, "", "");}
417   if(plotMCPi0Phi == kTRUE){ histograms->AddHistogram("MC_Pi0_Phi" ,"" , nXBinsPhi, firstXBinPhi, lastXBinPhi, "", "");}
418   if(plotMCPi0Pt == kTRUE){ histograms->AddHistogram("MC_Pi0_Pt" ,"" , nXBinsPt, firstXBinPt, lastXBinPt, "", "");}
419   if(plotMCPi0Energy == kTRUE){ histograms->AddHistogram("MC_Pi0_Energy" ,"" , nXBinsEnergy, firstXBinEnergy, lastXBinEnergy, "", "");}
420   if(plotMCPi0Mass == kTRUE){ histograms->AddHistogram("MC_Pi0_Mass" ,"" , nXBinsPi0Mass, firstXBinPi0Mass, lastXBinPi0Mass, "", "");}
421   if(plotMCPi0OpeningAngle == kTRUE){ histograms->AddHistogram("MC_Pi0_GammaDaughter_OpeningAngle" ,"" , nXBinsOpeningAngle, firstXBinOpeningAngle, lastXBinOpeningAngle, "", "");}
422   if(plotMCPi0R == kTRUE){ histograms->AddHistogram("MC_Pi0_R" ,"" , nXBinsR, firstXBinR, lastXBinR, "", "");}
423   if(plotMCPi0ZR == kTRUE){ histograms->AddHistogram("MC_Pi0_ZR" ,"" , nXBinsZR, firstXBinZR, lastXBinZR, nYBinsZR, firstYBinZR, lastYBinZR, "", "");}
424   if(plotMCPi0XY == kTRUE){ histograms->AddHistogram("MC_Pi0_XY" ,"" , nXBinsXY, firstXBinXY, lastXBinXY, nYBinsXY, firstYBinXY, lastYBinXY, "", "");}
425
426   if(plotMCPi0Eta == kTRUE){ histograms->AddHistogram("MC_Pi0_Secondaries_Eta" ,"" , nXBinsEta, firstXBinEta, lastXBinEta, "", "");}
427   if(plotMCPi0Phi == kTRUE){ histograms->AddHistogram("MC_Pi0_Secondaries_Phi" ,"" , nXBinsPhi, firstXBinPhi, lastXBinPhi, "", "");}
428   if(plotMCPi0Pt == kTRUE){ histograms->AddHistogram("MC_Pi0_Secondaries_Pt" ,"" , nXBinsPt, firstXBinPt, lastXBinPt, "", "");}
429   if(plotMCPi0Energy == kTRUE){ histograms->AddHistogram("MC_Pi0_Secondaries_Energy" ,"" , nXBinsEnergy, firstXBinEnergy, lastXBinEnergy, "", "");}
430   if(plotMCPi0Mass == kTRUE){ histograms->AddHistogram("MC_Pi0_Secondaries_Mass" ,"" , nXBinsPi0Mass, firstXBinPi0Mass, lastXBinPi0Mass, "", "");}
431   if(plotMCPi0OpeningAngle == kTRUE){ histograms->AddHistogram("MC_Pi0_Secondaries_GammaDaughter_OpeningAngle" ,"" , nXBinsOpeningAngle, firstXBinOpeningAngle, lastXBinOpeningAngle, "", "");}
432   if(plotMCPi0R == kTRUE){ histograms->AddHistogram("MC_Pi0_Secondaries_R" ,"" , nXBinsR, firstXBinR, lastXBinR, "", "");}
433   if(plotMCPi0ZR == kTRUE){ histograms->AddHistogram("MC_Pi0_Secondaries_ZR" ,"" , nXBinsZR, firstXBinZR, lastXBinZR, nYBinsZR, firstYBinZR, lastYBinZR, "", "");}
434   if(plotMCPi0XY == kTRUE){ histograms->AddHistogram("MC_Pi0_Secondaries_XY" ,"" , nXBinsXY, firstXBinXY, lastXBinXY, nYBinsXY, firstYBinXY, lastYBinXY, "", "");}
435
436   if(plotMCEtaEta == kTRUE){ histograms->AddHistogram("MC_Eta_Eta" ,"" , nXBinsEta, firstXBinEta, lastXBinEta, "", "");}
437   if(plotMCEtaPhi == kTRUE){ histograms->AddHistogram("MC_Eta_Phi" ,"" , nXBinsPhi, firstXBinPhi, lastXBinPhi, "", "");}
438   if(plotMCEtaPt == kTRUE){ histograms->AddHistogram("MC_Eta_Pt" ,"" , nXBinsPt, firstXBinPt, lastXBinPt, "", "");}
439   if(plotMCEtaEnergy == kTRUE){ histograms->AddHistogram("MC_Eta_Energy" ,"" , nXBinsEnergy, firstXBinEnergy, lastXBinEnergy, "", "");}
440   if(plotMCEtaMass == kTRUE){ histograms->AddHistogram("MC_Eta_Mass" ,"" , nXBinsEtaMass, firstXBinEtaMass, lastXBinEtaMass, "", "");}
441   if(plotMCEtaOpeningAngleGamma == kTRUE){ histograms->AddHistogram("MC_Eta_GammaDaughter_OpeningAngle" ,"" , nXBinsOpeningAngle, firstXBinOpeningAngle, lastXBinOpeningAngle, "", "");}
442   if(plotMCEtaR == kTRUE){ histograms->AddHistogram("MC_Eta_R" ,"" , nXBinsR, firstXBinR, lastXBinR, "", "");}
443   if(plotMCEtaZR == kTRUE){ histograms->AddHistogram("MC_Eta_ZR" ,"" , nXBinsZR, firstXBinZR, lastXBinZR, nYBinsZR, firstYBinZR, lastYBinZR, "", "");}
444   if(plotMCEtaXY == kTRUE){ histograms->AddHistogram("MC_Eta_XY" ,"" , nXBinsXY, firstXBinXY, lastXBinXY, nYBinsXY, firstYBinXY, lastYBinXY, "", "");}
445     
446   // Histograms from esd tracks
447   if(plotESDEPR == kTRUE){ histograms->AddHistogram("ESD_EP_R" ,"" , nXBinsR, firstXBinR, lastXBinR, "", "");}
448   if(plotESDEPZR == kTRUE){ histograms->AddHistogram("ESD_EP_ZR" ,"" , nXBinsZR, firstXBinZR, lastXBinZR, nYBinsZR, firstYBinZR, lastYBinZR, "", "");}
449   if(plotESDEPXY == kTRUE){ histograms->AddHistogram("ESD_EP_XY" ,"" , nXBinsXY, firstXBinXY, lastXBinXY, nYBinsXY, firstYBinXY, lastYBinXY, "", "");}
450   if(plotESDEPOpeningAngle == kTRUE){ histograms->AddHistogram("ESD_EP_OpeningAngle" ,"" , nXBinsOpeningAngle, firstXBinOpeningAngle, lastXBinOpeningAngle, "", "");}
451
452   if(plotESDEEnergy == kTRUE){ histograms->AddHistogram("ESD_E_Energy" ,"" , nXBinsEnergy, firstXBinEnergy, lastXBinEnergy, "", "");}
453   if(plotESDEPt == kTRUE){ histograms->AddHistogram("ESD_E_Pt" ,"" , nXBinsPt, firstXBinPt, lastXBinPt, "", "");}
454   if(plotESDEEta == kTRUE){ histograms->AddHistogram("ESD_E_Eta" ,"" , nXBinsEta, firstXBinEta, lastXBinEta, "", "");}
455   if(plotESDEPhi == kTRUE){ histograms->AddHistogram("ESD_E_Phi" ,"" , nXBinsPhi, firstXBinPhi, lastXBinPhi, "", "");}
456
457   if(plotESDPEnergy == kTRUE){ histograms->AddHistogram("ESD_P_Energy" ,"" , nXBinsEnergy, firstXBinEnergy, lastXBinEnergy, "", "");}
458   if(plotESDPPt == kTRUE){ histograms->AddHistogram("ESD_P_Pt" ,"" , nXBinsPt, firstXBinPt, lastXBinPt, "", "");}
459   if(plotESDPEta == kTRUE){ histograms->AddHistogram("ESD_P_Eta" ,"" , nXBinsEta, firstXBinEta, lastXBinEta, "", "");}
460   if(plotESDPPhi == kTRUE){ histograms->AddHistogram("ESD_P_Phi" ,"" , nXBinsPhi, firstXBinPhi, lastXBinPhi, "", "");}
461
462   if(plotESDGammaEnergy == kTRUE){ histograms->AddHistogram("ESD_Gamma_Energy" ,"" , nXBinsEnergy, firstXBinEnergy, lastXBinEnergy, "", "");}
463   if(plotESDGammaPt == kTRUE){ histograms->AddHistogram("ESD_Gamma_Pt" ,"" , nXBinsPt, firstXBinPt, lastXBinPt, "", "");}
464   if(plotESDGammaEta == kTRUE){ histograms->AddHistogram("ESD_Gamma_Eta" ,"" , nXBinsEta, firstXBinEta, lastXBinEta, "", "");}
465   if(plotESDGammaPhi == kTRUE){ histograms->AddHistogram("ESD_Gamma_Phi" ,"" , nXBinsPhi, firstXBinPhi, lastXBinPhi, "", "");}
466
467   if(plotESDMatchGammaOpeningAngle == kTRUE){ histograms->AddHistogram("ESD_Match_Gamma_OpeningAngle" ,"" , nXBinsOpeningAngle, firstXBinOpeningAngle, lastXBinOpeningAngle, "", "");}
468   if(plotESDMatchGammaEnergy == kTRUE){ histograms->AddHistogram("ESD_Match_Gamma_Energy" ,"" , nXBinsEnergy, firstXBinEnergy, lastXBinEnergy, "", "");}
469   if(plotESDMatchGammaPt == kTRUE){ histograms->AddHistogram("ESD_Match_Gamma_Pt" ,"" , nXBinsPt, firstXBinPt, lastXBinPt, "", "");}
470   if(plotESDMatchGammaEta == kTRUE){ histograms->AddHistogram("ESD_Match_Gamma_Eta" ,"" , nXBinsEta, firstXBinEta, lastXBinEta, "", "");}
471   if(plotESDMatchGammaPhi == kTRUE){ histograms->AddHistogram("ESD_Match_Gamma_Phi" ,"" , nXBinsPhi, firstXBinPhi, lastXBinPhi, "", "");}
472   if(plotESDMatchGammaMass == kTRUE){ histograms->AddHistogram("ESD_Match_Gamma_Mass" ,"" , nXBinsGammaMass, firstXBinGammaMass, lastXBinGammaMass, "", "");}
473   if(plotESDMatchGammaWidth == kTRUE){ histograms->AddHistogram("ESD_Match_Gamma_Width" ,"" , nXBinsGammaWidth, firstXBinGammaWidth, lastXBinGammaWidth, "", "");}
474   if(plotESDMatchGammaChi2 == kTRUE){ histograms->AddHistogram("ESD_Match_Gamma_Chi2" ,"" , nXBinsGammaChi2, firstXBinGammaChi2, lastXBinGammaChi2, "", "");}
475   if(plotESDMatchGammaNDF == kTRUE){ histograms->AddHistogram("ESD_Match_Gamma_NDF" ,"" , nXBinsGammaNDF, firstXBinGammaNDF, lastXBinGammaNDF, "", "");}
476   if(plotESDMatchGammaR == kTRUE){ histograms->AddHistogram("ESD_Match_Gamma_R" ,"" , nXBinsR, firstXBinR, lastXBinR, "", "");}
477   if(plotESDMatchGammaZR == kTRUE){ histograms->AddHistogram("ESD_Match_Gamma_ZR" ,"" , nXBinsZR, firstXBinZR, lastXBinZR, nYBinsZR, firstYBinZR, lastYBinZR, "", "");}
478   if(plotESDMatchGammaXY == kTRUE){ histograms->AddHistogram("ESD_Match_Gamma_XY" ,"" , nXBinsXY, firstXBinXY, lastXBinXY, nYBinsXY, firstYBinXY, lastYBinXY, "", "");}
479
480   if(plotESDTwoGammaCombinationOpeningAngleGamma == kTRUE){ histograms->AddHistogram("ESD_TwoGammaCombination_GammaDaughter_OpeningAngle" ,"" , nXBinsOpeningAngle, firstXBinOpeningAngle, lastXBinOpeningAngle, "", "");}
481   if(plotESDTwoGammaCombinationEnergy == kTRUE){ histograms->AddHistogram("ESD_TwoGammaCombination_Energy" ,"" , nXBinsEnergy, firstXBinEnergy, lastXBinEnergy, "", "");}
482   if(plotESDTwoGammaCombinationPt == kTRUE){ histograms->AddHistogram("ESD_TwoGammaCombination_Pt" ,"" , nXBinsPt, firstXBinPt, lastXBinPt, "", "");}
483   if(plotESDTwoGammaCombinationEta == kTRUE){ histograms->AddHistogram("ESD_TwoGammaCombination_Eta" ,"" , nXBinsEta, firstXBinEta, lastXBinEta, "", "");}
484   if(plotESDTwoGammaCombinationPhi == kTRUE){ histograms->AddHistogram("ESD_TwoGammaCombination_Phi" ,"" , nXBinsPhi, firstXBinPhi, lastXBinPhi, "", "");}
485   if(plotESDTwoGammaCombinationMass == kTRUE){ histograms->AddHistogram("ESD_TwoGammaCombination_Mass" ,"" , nXBinsPi0Mass, firstXBinPi0Mass, lastXBinPi0Mass, "", "");}
486   if(plotESDTwoGammaCombinationR == kTRUE){ histograms->AddHistogram("ESD_TwoGammaCombination_R" ,"" , nXBinsR, firstXBinR, lastXBinR, "", "");}
487   if(plotESDTwoGammaCombinationZR == kTRUE){ histograms->AddHistogram("ESD_TwoGammaCombination_ZR" ,"" , nXBinsZR, firstXBinZR, lastXBinZR, nYBinsZR, firstYBinZR, lastYBinZR, "", "");}
488   if(plotESDTwoGammaCombinationXY == kTRUE){ histograms->AddHistogram("ESD_TwoGammaCombination_XY" ,"" , nXBinsXY, firstXBinXY, lastXBinXY, nYBinsXY, firstYBinXY, lastYBinXY, "", "");}
489
490   if(plotESDBackgroundOpeningAngleGamma == kTRUE){ histograms->AddHistogram("ESD_Background_GammaDaughter_OpeningAngle" ,"" , nXBinsOpeningAngle, firstXBinOpeningAngle, lastXBinOpeningAngle, "", "");}
491   if(plotESDBackgroundEnergy == kTRUE){ histograms->AddHistogram("ESD_Background_Energy" ,"" , nXBinsEnergy, firstXBinEnergy, lastXBinEnergy, "", "");}
492   if(plotESDBackgroundPt == kTRUE){ histograms->AddHistogram("ESD_Background_Pt" ,"" , nXBinsPt, firstXBinPt, lastXBinPt, "", "");}
493   if(plotESDBackgroundEta == kTRUE){ histograms->AddHistogram("ESD_Background_Eta" ,"" , nXBinsEta, firstXBinEta, lastXBinEta, "", "");}
494   if(plotESDBackgroundPhi == kTRUE){ histograms->AddHistogram("ESD_Background_Phi" ,"" , nXBinsPhi, firstXBinPhi, lastXBinPhi, "", "");}
495   if(plotESDBackgroundMass == kTRUE){ histograms->AddHistogram("ESD_Background_Mass" ,"" , nXBinsEtaMass, firstXBinEtaMass, lastXBinEtaMass, "", "");}
496   if(plotESDBackgroundR == kTRUE){ histograms->AddHistogram("ESD_Background_R" ,"" , nXBinsR, firstXBinR, lastXBinR, "", "");}
497   if(plotESDBackgroundZR == kTRUE){ histograms->AddHistogram("ESD_Background_ZR" ,"" , nXBinsZR, firstXBinZR, lastXBinZR, nYBinsZR, firstYBinZR, lastYBinZR, "", "");}
498   if(plotESDBackgroundXY == kTRUE){ histograms->AddHistogram("ESD_Background_XY" ,"" , nXBinsXY, firstXBinXY, lastXBinXY, nYBinsXY, firstYBinXY, lastYBinXY, "", "");}
499
500   if(plotMapping == kTRUE){
501     histograms->InitializeMappingValues(nPhiIndex,nRIndex,nXBinsMapping,minRadius,maxRadius,nYBinsMapping,minPhi,maxPhi);
502     histograms->AddMappingHistograms(nPhiIndex,nRIndex,nXBinsMapping,minRadius,maxRadius,nYBinsMapping,minPhi,maxPhi);
503   }
504
505   if(plotResolutiondPt == kTRUE){histograms->AddHistogram("Resolution_dPt" ,"" , nXBinsResdPt, firstXBinResdPt, lastXBinResdPt, nYBinsResdPt, firstYBinResdPt, lastYBinResdPt, "", "");}
506   if(plotResolutiondR == kTRUE){histograms->AddHistogram("Resolution_dR" ,"" , nXBinsResdR, firstXBinResdR, lastXBinResdR, nYBinsResdR, firstYBinResdR, lastYBinResdR, "", "");}
507   if(plotResolutiondZ == kTRUE){histograms->AddHistogram("Resolution_dZ" ,"" , nXBinsResdZ, firstXBinResdZ, lastXBinResdZ, nYBinsResdZ, firstYBinResdZ, lastYBinResdZ, "", "");}
508   
509   if(plotResolutiondRdPt == kTRUE){histograms->AddHistogram("Resolution_dR_dPt" ,"" , nXBinsResdRdPt, firstXBinResdRdPt, lastXBinResdRdPt, nYBinsResdRdPt, firstYBinResdRdPt, lastYBinResdRdPt, "", "");}
510   
511   if(plotResolutionMCPt == kTRUE){histograms->AddHistogram("Resolution_MC_Pt" ,"" , nXBinsResPt, firstXBinResPt, lastXBinResPt,"","");}
512   if(plotResolutionMCR == kTRUE){histograms->AddHistogram("Resolution_MC_R" ,"" , nXBinsResR, firstXBinResR, lastXBinResR,"","");}
513   if(plotResolutionMCZ == kTRUE){histograms->AddHistogram("Resolution_MC_Z" ,"" , nXBinsResZ, firstXBinResZ, lastXBinResZ,"","");}
514   
515   if(plotResolutionESDPt == kTRUE){histograms->AddHistogram("Resolution_ESD_Pt" ,"" , nXBinsResPt, firstXBinResPt, lastXBinResPt,"","");}
516   if(plotResolutionESDR == kTRUE){histograms->AddHistogram("Resolution_ESD_R" ,"" , nXBinsResR, firstXBinResR, lastXBinResR,"","");}
517   if(plotResolutionESDZ == kTRUE){histograms->AddHistogram("Resolution_ESD_Z" ,"" , nXBinsResZ, firstXBinResZ, lastXBinResZ,"","");}
518   
519   if(plotNumberOfV0s == kTRUE){histograms->AddHistogram("NumberOfV0s","Number of v0s",100, 0, 100,"","");}
520   if(plotNumberOfSurvivingV0s == kTRUE){histograms->AddHistogram("NumberOfSurvivingV0s","Number of surviving v0s",100, 0, 100,"","");}
521
522   //  debug histograms
523   if(plotV0MassDebugCut1 == kTRUE){histograms->AddHistogram("V0MassDebugCut1" ,"debug1" , nXBinsGammaMass, firstXBinGammaMass, lastXBinGammaMass,"","");}
524   if(plotV0MassDebugCut2 == kTRUE){histograms->AddHistogram("V0MassDebugCut2" ,"debug2" , nXBinsGammaMass, firstXBinGammaMass, lastXBinGammaMass,"","");}
525   if(plotV0MassDebugCut3 == kTRUE){histograms->AddHistogram("V0MassDebugCut3" ,"debug3" , nXBinsGammaMass, firstXBinGammaMass, lastXBinGammaMass,"","");}
526   if(plotV0MassDebugCut4 == kTRUE){histograms->AddHistogram("V0MassDebugCut4" ,"debug4" , nXBinsGammaMass, firstXBinGammaMass, lastXBinGammaMass,"","");}
527   if(plotV0MassDebugCut5 == kTRUE){histograms->AddHistogram("V0MassDebugCut5" ,"debug5" , nXBinsGammaMass, firstXBinGammaMass, lastXBinGammaMass,"","");}
528   if(plotV0MassDebugCut6 == kTRUE){histograms->AddHistogram("V0MassDebugCut6" ,"debug6" , nXBinsGammaMass, firstXBinGammaMass, lastXBinGammaMass,"","");}
529   if(plotV0MassDebugCut7 == kTRUE){histograms->AddHistogram("V0MassDebugCut7" ,"debug7" , nXBinsGammaMass, firstXBinGammaMass, lastXBinGammaMass,"","");}
530   if(plotV0MassDebugCut8 == kTRUE){histograms->AddHistogram("V0MassDebugCut8" ,"debug8" , nXBinsGammaMass, firstXBinGammaMass, lastXBinGammaMass,"","");}
531
532
533   if(plotPi0Spectra == kTRUE){histograms->AddHistogram("InvMass_vs_Pt_Spectra" ,"Invariant Mass vs Pt" , nXBinsSpectra, firstXBinSpectra, lastXBinSpectra,nYBinsSpectra, firstYBinSpectra, lastYBinSpectra,"InvMass [GeV]","Pt [GeV]");}
534
535   if(plotPi0Spectra == kTRUE && calculateBackground == kTRUE){histograms->AddHistogram("Background_InvMass_vs_Pt_Spectra" ,"Background Invariant Mass vs Pt" , nXBinsSpectra, firstXBinSpectra, lastXBinSpectra,nYBinsSpectra, firstYBinSpectra, lastYBinSpectra,"InvMass [GeV]","Pt [GeV]");}
536
537   
538
539   //------------------------------ end Creating the histograms -----------------------------
540
541   // Create the Analysis manager
542   AliAnalysisManager *mgr  = new AliAnalysisManager("My Manager", "My Analysis");
543
544   // Define Input Event Handler 
545   AliESDInputHandler* inpHandler = new AliESDInputHandler();
546
547   // Define Output Event Handler
548   AliAODHandler* aodHandler = new AliAODHandler();
549   aodHandler->SetOutputFileName("aodAliGammaConversion.root");
550   
551   // Define MC Truth Event Handler
552   AliMCEventHandler* mcHandler = new AliMCEventHandler();
553   
554   // Add Handlers to the Task Manager
555   mgr->SetInputEventHandler  (inpHandler);
556   mgr->SetOutputEventHandler (aodHandler);
557   mgr->SetMCtruthEventHandler(mcHandler);
558
559   // Be sure you are told what you are doing
560   mgr->SetDebugLevel(10);
561
562   // Declare Common Input Tchain
563   AliAnalysisDataContainer *cinput1 = mgr->CreateContainer("Chain",TChain::Class(),AliAnalysisManager::kInputContainer);
564
565   // Common Output Tree in common Ã¢\80\98defaultâ\80\99 output file
566   AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("tree", TTree::Class(),AliAnalysisManager::kOutputContainer, "default");
567
568   // Private output objects
569   AliAnalysisDataContainer *coutput2 = mgr->CreateContainer("histogramsAliGammaConversion", TList::Class(),AliAnalysisManager::kOutputContainer, "histogramsAliGammaConversion.root");
570
571
572   //------------------------ END: Define input/output handlers ---------------------------------------------------
573
574
575   //check for errors in the specified data
576   if(useKFParticle == kTRUE && useESDTrack == kTRUE){
577     //Print warning, cannot use both
578   }
579   if(useKFParticle == kFALSE && useESDTrack == kFALSE){
580     //Print warning, one have to be specified
581   }
582
583
584   //Create the V0Reader
585   AliV0Reader * v0Reader = new AliV0Reader();
586   if(useKFParticle){
587     v0Reader->UseKFParticle();
588   }
589   else if(useESDTrack){
590     v0Reader->UseESDTrack();
591   }
592   v0Reader->SetNegativeTrackPID(pidOfNegativeTrack);
593   v0Reader->SetPositiveTrackPID(pidOfPositiveTrack);
594   v0Reader->SetMaxRCut(maxRCut);
595   v0Reader->SetEtaCut(etaCut);
596   v0Reader->SetPtCut(ptCut);
597   v0Reader->SetChi2CutConversion(chi2CutConversion);
598   v0Reader->SetChi2CutMeson(chi2CutMeson);
599   v0Reader->SetPIDProbability(probElectron);
600   v0Reader->SetXVertexCut(xVertexCut);
601   v0Reader->SetYVertexCut(yVertexCut);
602   v0Reader->SetZVertexCut(zVertexCut);
603   v0Reader->SetSigmaMass(sigmaCutGammaMass);
604   v0Reader->SetUseImprovedVertex(useImprovedVertex);
605   v0Reader->SetDoMCTruth(doMCTruth);
606
607   // Create the GammaConversionTask
608   AliAnalysisTaskGammaConversion *gammaconversion = new AliAnalysisTaskGammaConversion("GammaConversionTask");
609   gammaconversion->SetDebugLevel(10);
610
611   gammaconversion->SetWriteNtuple(writeNtuple);
612
613   gammaconversion->SetV0Reader(v0Reader);
614   gammaconversion->SetCalculateBackground(calculateBackground);
615   gammaconversion->Init();
616   
617   gammaconversion->SetElectronMass(electronMass);
618   gammaconversion->SetGammaMass(gammaMass);
619   gammaconversion->SetPi0Mass(pi0Mass);
620   gammaconversion->SetEtaMass(etaMass);
621
622   gammaconversion->SetGammaWidth(gammaWidth);
623   gammaconversion->SetPi0Width(pi0Width);
624   gammaconversion->SetEtaWidth(etaWidth);
625
626   // define the width constraint used by KF particle.
627   Double_t gammaWidth = 0.01;
628   Double_t pi0Width   = 0.01;
629   Double_t etaWidth   = 0.01;
630
631   gammaconversion->SetHistograms(histograms);
632   v0Reader->SetHistograms(histograms);// also give the pointer to the v0reader, for debugging cuts
633   
634   gammaconversion->SetDoMCTruth(doMCTruth);
635
636
637   // Add task to the manager 
638   mgr->AddTask(gammaconversion);
639
640   // Connect I/O to the task
641   mgr->ConnectInput (gammaconversion, 0, cinput1);
642   mgr->ConnectOutput(gammaconversion, 0, coutput1);
643   mgr->ConnectOutput(gammaconversion, 1, coutput2);
644
645   TChain* chain= CreateESDChain(sample,numberOfFilesToAnalyze);
646   
647   mgr->InitAnalysis();
648   
649   mgr->PrintStatus();
650   
651   mgr->StartAnalysis("local",chain);
652 }
653
654
655
656
657 void build() {
658   TStopwatch timer;
659   timer.Start();
660   gSystem->Load("libTree.so");
661   gSystem->Load("libGeom");
662   //  gSystem->Load("libANALYSISalice");
663
664   ////
665   //Setting up ESD.par//
666   ////
667   cout<<"compiling ESD"<<endl;
668   setupPar("ESD");
669   gSystem->Load("libVMC.so");
670   gSystem->Load("libESD.so");
671
672   ////
673   ////
674   //Setting up STEERBase.par//
675   ////
676   cout<<"compiling STEERBase"<<endl;
677   setupPar("STEERBase");
678   gSystem->Load("libSTEERBase.so");
679
680   ////
681   //Setting up AOD.par//
682   ////
683   cout<<"compiling AOD"<<endl;
684   setupPar("AOD");
685   gSystem->Load("libAOD.so");
686                                                                 
687   ////
688   //Setting up ANALYSIS.par//
689   ////
690   cout<<"compiling ANALYSIS"<<endl;
691   setupPar("ANALYSIS");
692   gSystem->Load("libANALYSIS.so");
693
694   ////
695   //Setting up ANALYSISalice.par//
696   ////
697   cout<<"compiling ANALUSISalice"<<endl;
698   setupPar("ANALYSISalice");
699   gSystem->Load("libANALYSISalice.so");
700                                                                                                                                   
701   ////
702   //Setting up PWG4Gamma.par//
703   ////
704   //  cout<<"compiling GammaConv"<<endl;
705
706   if(usePWG4PartCorr == kTRUE){
707     cout<<"Using PWG4PartCorr library"<<endl;
708     setupPar("PWG4PartCorr");
709     gSystem->Load("libPWG4PartCorr.so");  
710   }
711   else{
712     setupPar("PWG4GammaConv");
713     gSystem->Load("libPWG4GammaConv.so");
714   }
715   //if head:: use PWG4PartCorr
716 }
717
718 Int_t setupPar(const char* pararchivename) {
719   ///////////////////
720   // Setup PAR File//
721   ///////////////////
722   if (pararchivename) {
723     char processline[1024];
724     sprintf(processline,".! tar xvzf %s.par",pararchivename);
725     gROOT->ProcessLine(processline);
726     const char* ocwd = gSystem->WorkingDirectory();
727     gSystem->ChangeDirectory(pararchivename);
728                                                                                                                                                
729     // check for BUILD.sh and execute
730     if (!gSystem->AccessPathName("PROOF-INF/BUILD.sh")) {
731       printf("*******************************\n");
732       printf("*** Building PAR archive    ***\n");
733       printf("*******************************\n");
734                                                                                                                                                
735       if (gSystem->Exec("PROOF-INF/BUILD.sh")) {
736         Error("runAnalysis","Cannot Build the PAR Archive! - Abort!");
737         return -1;
738       }
739     }
740     // check for SETUP.C and execute
741     if (!gSystem->AccessPathName("PROOF-INF/SETUP.C")) {
742       printf("*******************************\n");
743       printf("*** Setup PAR archive       ***\n");
744       printf("*******************************\n");
745       gROOT->Macro("PROOF-INF/SETUP.C");
746     }
747                                                                                                                                                
748     gSystem->ChangeDirectory("../");
749   }                                                                                                                                               
750   return 1;
751 }