New analysis classes for gamma conversion analysis (Kenneth Aamodt)
[u/mrichter/AliRoot.git] / PWG4 / macros / ConfigGammaConversion.C
1
2 /** ------------------------------ Monte Carlo flag -----------------------------------------*/
3 Bool_t doMCTruth = kTRUE;
4 /** ---------------------------- end Monte Carlo flag ---------------------------------------*/
5
6 /** ------------------------- Choose KFParticle OR ESDTrack  --------------------------------*/
7 Bool_t useKFParticle = kTRUE;
8 Bool_t useESDTrack   = kFALSE;
9 /** ----------------------- end Choose KFParticle OR ESDTrack  -----------------------------*/
10
11
12 Bool_t calculateBackground = kTRUE;
13
14 /** ---------------------------------- define cuts here ------------------------------------*/
15
16 Int_t pidOfNegativeTrack=11;
17 Int_t pidOfPositiveTrack=-11;
18
19 Double_t maxRCut   = 200.;
20 Double_t etaCut    = 1.2;
21 Double_t ptCut     = 0.1;
22 Double_t chi2Cut   = 20.;
23
24 Double_t xVertexCut = 0.;
25 Double_t yVertexCut = 0.;
26 Double_t zVertexCut = 0.;
27
28 Double_t sigmaCutGammaMass=0.0001;
29
30 Bool_t useImprovedVertex = kTRUE;
31
32 // define masses of different particles, this will be used by the KF particle
33 // together with the width to set mass constraints. Units in GeV.
34 Double_t electronMass = 0.00051099892;
35 Double_t gammaMass    = 0.;
36 Double_t pi0Mass      = 0.1349766;
37 Double_t etaMass      = 0.54751;
38
39 // define the width constraint used by KF particle.
40 Double_t gammaWidth = 0.01;
41 Double_t pi0Width   = 0.01;
42 Double_t etaWidth   = 0.01;
43
44 // define the probability of track being an electron
45 Double_t probElectron = 0.5;
46
47 /** ----------------------------------end define cuts here----------------------------------*/
48
49 /** -------------------------------- Phi/R Mapping ---------------------------------------*/
50 Int_t nPhiIndex = 18;
51 Int_t nRIndex   = 40;
52
53 Double_t minRadius   = 0.;
54 Double_t maxRadius   = 200.;
55 Double_t minPhi      = -TMath::Pi();
56 Double_t maxPhi      = TMath::Pi();
57 /** ------------------------------- end Phi/R Mapping ------------------------------------*/
58
59 /** ------------------- define which histograms to plot here --------------------------------*/
60 /**   NB: to change the bin numbers, see below the histogram flags                           */
61 Bool_t plotMC_EP_R                             = kTRUE;
62 Bool_t plotMC_EP_Z_R                           = kTRUE;
63 Bool_t plotMC_EP_X_Y                           = kTRUE;
64 Bool_t plotMC_EP_OpeningAngle                  = kTRUE;
65
66 Bool_t plotMC_E_Energy                         = kTRUE;
67 Bool_t plotMC_E_Pt                             = kTRUE;
68 Bool_t plotMC_E_Eta                            = kTRUE;
69 Bool_t plotMC_E_Phi                            = kTRUE;
70
71 Bool_t plotMC_P_Energy                         = kTRUE;
72 Bool_t plotMC_P_Pt                             = kTRUE;
73 Bool_t plotMC_P_Eta                            = kTRUE;
74 Bool_t plotMC_P_Phi                            = kTRUE;
75
76 Bool_t plotMC_Gamma_Energy                     = kTRUE;
77 Bool_t plotMC_Gamma_Pt                         = kTRUE;
78 Bool_t plotMC_Gamma_Eta                        = kTRUE;
79 Bool_t plotMC_Gamma_Phi                        = kTRUE;
80
81 Bool_t plotMC_DirectGamma_Energy               = kTRUE;
82 Bool_t plotMC_DirectGamma_Pt                   = kTRUE;
83 Bool_t plotMC_DirectGamma_Eta                  = kTRUE;
84 Bool_t plotMC_DirectGamma_Phi                  = kTRUE;
85
86 Bool_t plotMC_Match_Gamma_Eta                  = kTRUE;
87 Bool_t plotMC_Match_Gamma_Phi                  = kTRUE;
88 Bool_t plotMC_Match_Gamma_Pt                   = kTRUE;
89 Bool_t plotMC_Match_Gamma_Energy               = kTRUE;
90 Bool_t plotMC_Match_Gamma_Mass                 = kTRUE;
91 Bool_t plotMC_Match_Gamma_OpeningAngle         = kTRUE;
92 Bool_t plotMC_Match_Gamma_R                    = kTRUE;
93 Bool_t plotMC_Match_Gamma_Z_R                  = kTRUE;
94 Bool_t plotMC_Match_Gamma_X_Y                  = kTRUE;
95
96 Bool_t plotMC_Pi0_Eta                          = kTRUE;
97 Bool_t plotMC_Pi0_Phi                          = kTRUE;
98 Bool_t plotMC_Pi0_Pt                           = kTRUE;
99 Bool_t plotMC_Pi0_Energy                       = kTRUE;
100 Bool_t plotMC_Pi0_Mass                         = kTRUE;
101 Bool_t plotMC_Pi0_OpeningAngle                 = kTRUE;
102 Bool_t plotMC_Pi0_R                            = kTRUE;
103 Bool_t plotMC_Pi0_Z_R                          = kTRUE;
104 Bool_t plotMC_Pi0_X_Y                          = kTRUE;
105
106 Bool_t plotMC_Eta_Eta                          = kTRUE;
107 Bool_t plotMC_Eta_Phi                          = kTRUE;
108 Bool_t plotMC_Eta_Pt                           = kTRUE;
109 Bool_t plotMC_Eta_Energy                       = kTRUE;
110 Bool_t plotMC_Eta_Mass                         = kTRUE;
111 Bool_t plotMC_Eta_OpeningAngleGamma            = kTRUE;
112 Bool_t plotMC_Eta_R                            = kTRUE;
113 Bool_t plotMC_Eta_Z_R                          = kTRUE;
114 Bool_t plotMC_Eta_X_Y                          = kTRUE;
115     
116 // Histograms from esd tracks
117 Bool_t plotESD_EP_R                            = kTRUE;
118 Bool_t plotESD_EP_Z_R                          = kTRUE;
119 Bool_t plotESD_EP_X_Y                          = kTRUE;
120 Bool_t plotESD_EP_OpeningAngle                 = kTRUE;
121
122 Bool_t plotESD_E_Energy                        = kTRUE;
123 Bool_t plotESD_E_Pt                            = kTRUE;
124 Bool_t plotESD_E_Eta                           = kTRUE;
125 Bool_t plotESD_E_Phi                           = kTRUE;
126
127 Bool_t plotESD_P_Energy                        = kTRUE;
128 Bool_t plotESD_P_Pt                            = kTRUE;
129 Bool_t plotESD_P_Eta                           = kTRUE;
130 Bool_t plotESD_P_Phi                           = kTRUE;
131
132
133 Bool_t plotESD_Gamma_Energy                    = kTRUE;
134 Bool_t plotESD_Gamma_Pt                        = kTRUE;
135 Bool_t plotESD_Gamma_Eta                       = kTRUE;
136 Bool_t plotESD_Gamma_Phi                       = kTRUE;
137
138 Bool_t plotESD_Match_Gamma_OpeningAngle        = kTRUE;
139 Bool_t plotESD_Match_Gamma_Energy              = kTRUE;
140 Bool_t plotESD_Match_Gamma_Pt                  = kTRUE;
141 Bool_t plotESD_Match_Gamma_Eta                 = kTRUE;
142 Bool_t plotESD_Match_Gamma_Phi                 = kTRUE;
143 Bool_t plotESD_Match_Gamma_Mass                = kTRUE;
144 Bool_t plotESD_Match_Gamma_Width               = kTRUE;
145 Bool_t plotESD_Match_Gamma_Chi2                = kTRUE;
146 Bool_t plotESD_Match_Gamma_NDF                 = kTRUE;
147 Bool_t plotESD_Match_Gamma_R                   = kTRUE;
148 Bool_t plotESD_Match_Gamma_Z_R                 = kTRUE;
149 Bool_t plotESD_Match_Gamma_X_Y                 = kTRUE;
150
151 Bool_t plotESD_Pi0_OpeningAngleGamma           = kTRUE;
152 Bool_t plotESD_Pi0_Energy                      = kTRUE;
153 Bool_t plotESD_Pi0_Pt                          = kTRUE;
154 Bool_t plotESD_Pi0_Eta                         = kTRUE;
155 Bool_t plotESD_Pi0_Phi                         = kTRUE;
156 Bool_t plotESD_Pi0_Mass                        = kTRUE;
157 Bool_t plotESD_Pi0_R                           = kTRUE;
158 Bool_t plotESD_Pi0_Z_R                         = kTRUE;
159 Bool_t plotESD_Pi0_X_Y                         = kTRUE;
160
161 Bool_t plotESD_Eta_OpeningAngleGamma           = kTRUE;
162 Bool_t plotESD_Eta_Energy                      = kTRUE;
163 Bool_t plotESD_Eta_Pt                          = kTRUE;
164 Bool_t plotESD_Eta_Eta                         = kTRUE;
165 Bool_t plotESD_Eta_Phi                         = kTRUE;
166 Bool_t plotESD_Eta_Mass                        = kTRUE;
167 Bool_t plotESD_Eta_R                           = kTRUE;
168 Bool_t plotESD_Eta_Z_R                         = kTRUE;
169 Bool_t plotESD_Eta_X_Y                         = kTRUE;
170
171 Bool_t plotESD_Background_OpeningAngleGamma    = kTRUE;
172 Bool_t plotESD_Background_Energy               = kTRUE;
173 Bool_t plotESD_Background_Pt                   = kTRUE;
174 Bool_t plotESD_Background_Eta                  = kTRUE;
175 Bool_t plotESD_Background_Phi                  = kTRUE;
176 Bool_t plotESD_Background_Mass                 = kTRUE;
177 Bool_t plotESD_Background_R                    = kTRUE;
178 Bool_t plotESD_Background_Z_R                  = kTRUE;
179 Bool_t plotESD_Background_X_Y                  = kTRUE;
180
181 Bool_t plotMapping                             = kTRUE;       
182
183 Bool_t plotResolution_dPt                      = kTRUE;
184 Bool_t plotResolution_dR                       = kTRUE;
185 Bool_t plotResolution_dZ                       = kTRUE;
186   
187 Bool_t plotResolution_dR_dPt                   = kTRUE;
188
189 Bool_t plotResolution_MC_Pt                    = kTRUE;
190 Bool_t plotResolution_MC_R                     = kTRUE;
191 Bool_t plotResolution_MC_Z                     = kTRUE;
192
193 Bool_t plotResolution_ESD_Pt                   = kTRUE;
194 Bool_t plotResolution_ESD_R                    = kTRUE;
195 Bool_t plotResolution_ESD_Z                    = kTRUE;
196
197 Bool_t plotNumberOfV0s                         = kTRUE;
198 Bool_t plotNumberOfSurvivingV0s                = kTRUE;
199
200   //  debug histograms
201 Bool_t plotV0MassDebugCut1                     = kTRUE;
202 Bool_t plotV0MassDebugCut2                     = kTRUE;
203 Bool_t plotV0MassDebugCut3                     = kTRUE;
204 Bool_t plotV0MassDebugCut4                     = kTRUE;
205 Bool_t plotV0MassDebugCut5                     = kTRUE;
206 Bool_t plotV0MassDebugCut6                     = kTRUE;
207 Bool_t plotV0MassDebugCut7                     = kTRUE;
208 Bool_t plotV0MassDebugCut8                     = kTRUE;
209
210
211 /** ----------------- end define which histograms to plot here -------------------------------*/
212
213
214
215 /** ----------- Define the binning for the different plot types here -------------------------*/
216 //R-plots
217 Int_t nXBinsR = 1000;
218 Double_t firstXBinR = 0.;
219 Double_t lastXBinR = 250.;
220
221 //Z_R-plots
222 Int_t nXBinsZ_R = 2000;
223 Double_t firstXBinZ_R = -10.;
224 Double_t lastXBinZ_R = 10.;
225 Int_t nYBinsZ_R = 1000;
226 Double_t firstYBinZ_R = 0.;
227 Double_t lastYBinZ_R = 250.;
228
229 //X_Y-plots
230 Int_t nXBinsX_Y = 2000;
231 Double_t firstXBinX_Y = -250.;
232 Double_t lastXBinX_Y = 250.;
233 Int_t nYBinsX_Y = 2000;
234 Double_t firstYBinX_Y = -250.;
235 Double_t lastYBinX_Y = 250.;
236
237 //OpenAngle-plots
238 Int_t nXBinsOpeningAngle = 200;
239 Double_t firstXBinOpeningAngle = 0.;
240 Double_t lastXBinOpeningAngle = TMath::Pi()/2;
241
242 //Energy-plots
243 Int_t nXBinsEnergy = 500;
244 Double_t firstXBinEnergy = 0.;
245 Double_t lastXBinEnergy = 5.;
246
247 //Pt-plots
248 Int_t nXBinsPt = 500;
249 Double_t firstXBinPt = 0.;
250 Double_t lastXBinPt = 5.;
251
252 //Eta-plots
253 Int_t nXBinsEta = 400;
254 Double_t firstXBinEta = -2.;
255 Double_t lastXBinEta = 2.;
256
257 //Phi-plots
258 Int_t nXBinsPhi = 720;
259 Double_t firstXBinPhi = -TMath::Pi();
260 Double_t lastXBinPhi = TMath::Pi();
261
262 //Mapping-plots
263 Int_t nXBinsMapping = 40;
264 Double_t firstXBinMapping = -20.;
265 Double_t lastXBinMapping = 20.;
266 Int_t nYBinsMapping = 30;
267 Double_t firstYBinMapping = -1.5;
268 Double_t lastYBinMapping = 1.5;
269
270 //ResolutionPlots
271 //RES_dPt
272 Int_t nXBinsResdPt=500;
273 Int_t firstXBinResdPt= 0;
274 Int_t lastXBinResdPt=5;
275 Int_t nYBinsResdPt=1000;
276 Int_t firstYBinResdPt= -5;
277 Int_t lastYBinResdPt=5;
278
279 //RES_dR
280 Int_t nXBinsResdR=1000;
281 Int_t firstXBinResdR= 0;
282 Int_t lastXBinResdR=250;
283 Int_t nYBinsResdR=1000;
284 Int_t firstYBinResdR= -25;
285 Int_t lastYBinResdR=25;
286
287 //RES_dZ
288 Int_t nXBinsResdZ=2000;
289 Int_t firstXBinResdZ= -20;
290 Int_t lastXBinResdZ=20;
291 Int_t nYBinsResdZ=1000;
292 Int_t firstYBinResdZ= -20;
293 Int_t lastYBinResdZ=20;
294
295 //RES_dR_dPt
296 Int_t nXBinsResdR_dPt=1000;
297 Int_t firstXBinResdR_dPt= -22;
298 Int_t lastXBinResdR_dPt=22;
299 Int_t nYBinsResdR_dPt=1000;
300 Int_t firstYBinResdR_dPt= -5;
301 Int_t lastYBinResdR_dPt=5;
302
303
304 //RES_MC_Pt
305 Int_t nXBinsResPt=500;
306 Int_t firstXBinResPt= 0;
307 Int_t lastXBinResPt=5;
308
309 //RES_MC_R
310 Int_t nXBinsResR=1000;
311 Int_t firstXBinResR= 0;
312 Int_t lastXBinResR=250;
313
314 //RES_MC_Z
315 Int_t nXBinsResZ=1000;
316 Int_t firstXBinResZ= 0;
317 Int_t lastXBinResZ=250;
318
319 //GammaMass-plots
320 Int_t nXBinsGamma_Mass = 100;
321 Double_t firstXBinGamma_Mass = 0.;
322 Double_t lastXBinGamma_Mass = 1.;
323
324 //Pi0Mass-plots
325 Int_t nXBinsPi0_Mass = 100;
326 Double_t firstXBinPi0_Mass = 0.;
327 Double_t lastXBinPi0_Mass = 1.;
328
329 //EtaMass-plots
330 Int_t nXBinsEta_Mass = 100;
331 Double_t firstXBinEta_Mass = 0.;
332 Double_t lastXBinEta_Mass = 1.;
333
334 //Gamma_Width-plots
335 Int_t nXBinsGamma_Width = 100;
336 Double_t firstXBinGamma_Width = 0.;
337 Double_t lastXBinGamma_Width = 1.;
338
339 //Gamma_Chi2-plots
340 Int_t nXBinsGamma_Chi2 = 100;
341 Double_t firstXBinGamma_Chi2 = 0;
342 Double_t lastXBinGamma_Chi2 = 100.;
343
344 //Gamma_NDF-plots
345 Int_t nXBinsGamma_NDF = 10;
346 Double_t firstXBinGamma_NDF = 0.;
347 Double_t lastXBinGamma_NDF = 10.;
348 /** ---------- end Define the binning for the different plot types here ----------------------*/
349
350
351
352 /************************************************************************************************
353  *                                                                                              *
354  *                                                                                              *
355  *                     EVERYTHING BELOW IS FOR DEVELOPERS ONLY                                  *
356  *                                                                                              *
357  *                                                                                              *
358  ************************************************************************************************/
359
360 void ConfigGammaConversion(const char *chainName, const char *sample, int limit = 0){
361   
362   build();//build (if necessary) and load the libraries needed
363
364   gROOT->LoadMacro("$ALICE_ROOT/PWG0/CreateESDChain.C"); // load the CreateChain macro
365
366   AliLog::SetGlobalLogLevel(AliLog::kError);
367
368   //-------------------------------- Creating the histograms -------------------------------
369   AliGammaConversionHistograms * histograms = new AliGammaConversionHistograms();
370
371   //Change here
372   // All the plots need to be given good names for the x-axis and y-axis so that people don't have to ask, or get confused.
373   // I put in cm and cm in the first one as an example where to put in the axis titles.
374   
375   if(plotMC_EP_R != NULL){ histograms->Initialize_MC_EP_R(nXBinsR, firstXBinR, lastXBinR,"cm","cm");}
376   if(plotMC_EP_Z_R != NULL){ histograms->Initialize_MC_EP_Z_R(nXBinsZ_R, firstXBinZ_R, lastXBinZ_R, nYBinsZ_R, firstYBinZ_R, lastYBinZ_R, "", "");}
377   if(plotMC_EP_X_Y != NULL){ histograms->Initialize_MC_EP_X_Y(nXBinsX_Y, firstXBinX_Y, lastXBinX_Y, nYBinsX_Y, firstYBinX_Y, lastYBinX_Y, "", "");}
378   if(plotMC_EP_OpeningAngle != NULL){ histograms->Initialize_MC_EP_OpeningAngle(nXBinsOpeningAngle, firstXBinOpeningAngle, lastXBinOpeningAngle, "", "");}
379
380   if(plotMC_E_Energy != NULL){ histograms->Initialize_MC_E_Energy(nXBinsEnergy, firstXBinEnergy, lastXBinEnergy, "", "");}
381   if(plotMC_E_Pt != NULL){ histograms->Initialize_MC_E_Pt(nXBinsPt, firstXBinPt, lastXBinPt, "", "");}
382   if(plotMC_E_Eta != NULL){ histograms->Initialize_MC_E_Eta(nXBinsEta, firstXBinEta, lastXBinEta, "", "");}
383   if(plotMC_E_Phi != NULL){ histograms->Initialize_MC_E_Phi(nXBinsPhi, firstXBinPhi, lastXBinPhi, "", "");}
384
385   if(plotMC_P_Energy != NULL){ histograms->Initialize_MC_P_Energy(nXBinsEnergy, firstXBinEnergy, lastXBinEnergy, "", "");}
386   if(plotMC_P_Pt != NULL){ histograms->Initialize_MC_P_Pt(nXBinsPt, firstXBinPt, lastXBinPt, "", "");}
387   if(plotMC_P_Eta != NULL){ histograms->Initialize_MC_P_Eta(nXBinsEta, firstXBinEta, lastXBinEta, "", "");}
388   if(plotMC_P_Phi != NULL){ histograms->Initialize_MC_P_Phi(nXBinsPhi, firstXBinPhi, lastXBinPhi, "", "");}
389
390   if(plotMC_Gamma_Energy != NULL){ histograms->Initialize_MC_Gamma_Energy(nXBinsEnergy, firstXBinEnergy, lastXBinEnergy, "", "");}
391   if(plotMC_Gamma_Pt != NULL){ histograms->Initialize_MC_Gamma_Pt(nXBinsPt, firstXBinPt, lastXBinPt, "", "");}
392   if(plotMC_Gamma_Eta != NULL){ histograms->Initialize_MC_Gamma_Eta(nXBinsEta, firstXBinEta, lastXBinEta, "", "");}
393   if(plotMC_Gamma_Phi != NULL){ histograms->Initialize_MC_Gamma_Phi(nXBinsPhi, firstXBinPhi, lastXBinPhi, "", "");}
394
395   if(plotMC_DirectGamma_Energy != NULL){ histograms->Initialize_MC_DirectGamma_Energy(nXBinsEnergy, firstXBinEnergy, lastXBinEnergy, "", "");}
396   if(plotMC_DirectGamma_Pt != NULL){ histograms->Initialize_MC_DirectGamma_Pt(nXBinsPt, firstXBinPt, lastXBinPt, "", "");}
397   if(plotMC_DirectGamma_Eta != NULL){ histograms->Initialize_MC_DirectGamma_Eta(nXBinsEta, firstXBinEta, lastXBinEta, "", "");}
398   if(plotMC_DirectGamma_Phi != NULL){ histograms->Initialize_MC_DirectGamma_Phi(nXBinsPhi, firstXBinPhi, lastXBinPhi, "", "");}
399
400   if(plotMC_Match_Gamma_Eta != NULL){ histograms->Initialize_MC_Match_Gamma_Eta(nXBinsEta, firstXBinEta, lastXBinEta, "", "");}
401   if(plotMC_Match_Gamma_Phi != NULL){ histograms->Initialize_MC_Match_Gamma_Phi(nXBinsPhi, firstXBinPhi, lastXBinPhi, "", "");}
402   if(plotMC_Match_Gamma_Pt != NULL){ histograms->Initialize_MC_Match_Gamma_Pt(nXBinsPt, firstXBinPt, lastXBinPt, "", "");}
403   if(plotMC_Match_Gamma_Energy != NULL){ histograms->Initialize_MC_Match_Gamma_Energy(nXBinsEnergy, firstXBinEnergy, lastXBinEnergy, "", "");}
404   if(plotMC_Match_Gamma_Mass != NULL){ histograms->Initialize_MC_Match_Gamma_Mass(nXBinsGamma_Mass, firstXBinGamma_Mass, lastXBinGamma_Mass, "", "");}
405   if(plotMC_Match_Gamma_OpeningAngle != NULL){ histograms->Initialize_MC_Match_Gamma_OpeningAngle(nXBinsOpeningAngle, firstXBinOpeningAngle, lastXBinOpeningAngle, "", "");}
406   if(plotMC_Match_Gamma_R != NULL){ histograms->Initialize_MC_Match_Gamma_R(nXBinsR, firstXBinR, lastXBinR, "", "");}
407   if(plotMC_Match_Gamma_Z_R != NULL){ histograms->Initialize_MC_Match_Gamma_Z_R(nXBinsZ_R, firstXBinZ_R, lastXBinZ_R, nYBinsZ_R, firstYBinZ_R, lastYBinZ_R, "", "");}
408   if(plotMC_Match_Gamma_X_Y != NULL){ histograms->Initialize_MC_Match_Gamma_X_Y(nXBinsX_Y, firstXBinX_Y, lastXBinX_Y, nYBinsX_Y, firstYBinX_Y, lastYBinX_Y, "", "");}
409
410   if(plotMC_Pi0_Eta != NULL){ histograms->Initialize_MC_Pi0_Eta(nXBinsEta, firstXBinEta, lastXBinEta, "", "");}
411   if(plotMC_Pi0_Phi != NULL){ histograms->Initialize_MC_Pi0_Phi(nXBinsPhi, firstXBinPhi, lastXBinPhi, "", "");}
412   if(plotMC_Pi0_Pt != NULL){ histograms->Initialize_MC_Pi0_Pt(nXBinsPt, firstXBinPt, lastXBinPt, "", "");}
413   if(plotMC_Pi0_Energy != NULL){ histograms->Initialize_MC_Pi0_Energy(nXBinsEnergy, firstXBinEnergy, lastXBinEnergy, "", "");}
414   if(plotMC_Pi0_Mass != NULL){ histograms->Initialize_MC_Pi0_Mass(nXBinsPi0_Mass, firstXBinPi0_Mass, lastXBinPi0_Mass, "", "");}
415   if(plotMC_Pi0_OpeningAngle != NULL){ histograms->Initialize_MC_Pi0_OpeningAngleGamma(nXBinsOpeningAngle, firstXBinOpeningAngle, lastXBinOpeningAngle, "", "");}
416   if(plotMC_Pi0_R != NULL){ histograms->Initialize_MC_Pi0_R(nXBinsR, firstXBinR, lastXBinR, "", "");}
417   if(plotMC_Pi0_Z_R != NULL){ histograms->Initialize_MC_Pi0_Z_R(nXBinsZ_R, firstXBinZ_R, lastXBinZ_R, nYBinsZ_R, firstYBinZ_R, lastYBinZ_R, "", "");}
418   if(plotMC_Pi0_X_Y != NULL){ histograms->Initialize_MC_Pi0_X_Y(nXBinsX_Y, firstXBinX_Y, lastXBinX_Y, nYBinsX_Y, firstYBinX_Y, lastYBinX_Y, "", "");}
419
420   if(plotMC_Eta_Eta != NULL){ histograms->Initialize_MC_Eta_Eta(nXBinsEta, firstXBinEta, lastXBinEta, "", "");}
421   if(plotMC_Eta_Phi != NULL){ histograms->Initialize_MC_Eta_Phi(nXBinsPhi, firstXBinPhi, lastXBinPhi, "", "");}
422   if(plotMC_Eta_Pt != NULL){ histograms->Initialize_MC_Eta_Pt(nXBinsPt, firstXBinPt, lastXBinPt, "", "");}
423   if(plotMC_Eta_Energy != NULL){ histograms->Initialize_MC_Eta_Energy(nXBinsEnergy, firstXBinEnergy, lastXBinEnergy, "", "");}
424   if(plotMC_Eta_Mass != NULL){ histograms->Initialize_MC_Eta_Mass(nXBinsEta_Mass, firstXBinEta_Mass, lastXBinEta_Mass, "", "");}
425   if(plotMC_Eta_OpeningAngleGamma != NULL){ histograms->Initialize_MC_Eta_OpeningAngleGamma(nXBinsOpeningAngle, firstXBinOpeningAngle, lastXBinOpeningAngle, "", "");}
426   if(plotMC_Eta_R != NULL){ histograms->Initialize_MC_Eta_R(nXBinsR, firstXBinR, lastXBinR, "", "");}
427   if(plotMC_Eta_Z_R != NULL){ histograms->Initialize_MC_Eta_Z_R(nXBinsZ_R, firstXBinZ_R, lastXBinZ_R, nYBinsZ_R, firstYBinZ_R, lastYBinZ_R, "", "");}
428   if(plotMC_Eta_X_Y != NULL){ histograms->Initialize_MC_Eta_X_Y(nXBinsX_Y, firstXBinX_Y, lastXBinX_Y, nYBinsX_Y, firstYBinX_Y, lastYBinX_Y, "", "");}
429     
430   // Histograms from esd tracks
431   if(plotESD_EP_R != NULL){ histograms->Initialize_ESD_EP_R(nXBinsR, firstXBinR, lastXBinR, "", "");}
432   if(plotESD_EP_Z_R != NULL){ histograms->Initialize_ESD_EP_Z_R(nXBinsZ_R, firstXBinZ_R, lastXBinZ_R, nYBinsZ_R, firstYBinZ_R, lastYBinZ_R, "", "");}
433   if(plotESD_EP_X_Y != NULL){ histograms->Initialize_ESD_EP_X_Y(nXBinsX_Y, firstXBinX_Y, lastXBinX_Y, nYBinsX_Y, firstYBinX_Y, lastYBinX_Y, "", "");}
434   if(plotESD_EP_OpeningAngle != NULL){ histograms->Initialize_ESD_EP_OpeningAngle(nXBinsOpeningAngle, firstXBinOpeningAngle, lastXBinOpeningAngle, "", "");}
435
436   if(plotESD_E_Energy != NULL){ histograms->Initialize_ESD_E_Energy(nXBinsEnergy, firstXBinEnergy, lastXBinEnergy, "", "");}
437   if(plotESD_E_Pt != NULL){ histograms->Initialize_ESD_E_Pt(nXBinsPt, firstXBinPt, lastXBinPt, "", "");}
438   if(plotESD_E_Eta != NULL){ histograms->Initialize_ESD_E_Eta(nXBinsEta, firstXBinEta, lastXBinEta, "", "");}
439   if(plotESD_E_Phi != NULL){ histograms->Initialize_ESD_E_Phi(nXBinsPhi, firstXBinPhi, lastXBinPhi, "", "");}
440
441   if(plotESD_P_Energy != NULL){ histograms->Initialize_ESD_P_Energy(nXBinsEnergy, firstXBinEnergy, lastXBinEnergy, "", "");}
442   if(plotESD_P_Pt != NULL){ histograms->Initialize_ESD_P_Pt(nXBinsPt, firstXBinPt, lastXBinPt, "", "");}
443   if(plotESD_P_Eta != NULL){ histograms->Initialize_ESD_P_Eta(nXBinsEta, firstXBinEta, lastXBinEta, "", "");}
444   if(plotESD_P_Phi != NULL){ histograms->Initialize_ESD_P_Phi(nXBinsPhi, firstXBinPhi, lastXBinPhi, "", "");}
445
446   if(plotESD_Gamma_Energy != NULL){ histograms->Initialize_ESD_Gamma_Energy(nXBinsEnergy, firstXBinEnergy, lastXBinEnergy, "", "");}
447   if(plotESD_Gamma_Pt != NULL){ histograms->Initialize_ESD_Gamma_Pt(nXBinsPt, firstXBinPt, lastXBinPt, "", "");}
448   if(plotESD_Gamma_Eta != NULL){ histograms->Initialize_ESD_Gamma_Eta(nXBinsEta, firstXBinEta, lastXBinEta, "", "");}
449   if(plotESD_Gamma_Phi != NULL){ histograms->Initialize_ESD_Gamma_Phi(nXBinsPhi, firstXBinPhi, lastXBinPhi, "", "");}
450
451   if(plotESD_Match_Gamma_OpeningAngle != NULL){ histograms->Initialize_ESD_Match_Gamma_OpeningAngle(nXBinsOpeningAngle, firstXBinOpeningAngle, lastXBinOpeningAngle, "", "");}
452   if(plotESD_Match_Gamma_Energy != NULL){ histograms->Initialize_ESD_Match_Gamma_Energy(nXBinsEnergy, firstXBinEnergy, lastXBinEnergy, "", "");}
453   if(plotESD_Match_Gamma_Pt != NULL){ histograms->Initialize_ESD_Match_Gamma_Pt(nXBinsPt, firstXBinPt, lastXBinPt, "", "");}
454   if(plotESD_Match_Gamma_Eta != NULL){ histograms->Initialize_ESD_Match_Gamma_Eta(nXBinsEta, firstXBinEta, lastXBinEta, "", "");}
455   if(plotESD_Match_Gamma_Phi != NULL){ histograms->Initialize_ESD_Match_Gamma_Phi(nXBinsPhi, firstXBinPhi, lastXBinPhi, "", "");}
456   if(plotESD_Match_Gamma_Mass != NULL){ histograms->Initialize_ESD_Match_Gamma_Mass(nXBinsGamma_Mass, firstXBinGamma_Mass, lastXBinGamma_Mass, "", "");}
457   if(plotESD_Match_Gamma_Width != NULL){ histograms->Initialize_ESD_Match_Gamma_Width(nXBinsGamma_Width, firstXBinGamma_Width, lastXBinGamma_Width, "", "");}
458   if(plotESD_Match_Gamma_Chi2 != NULL){ histograms->Initialize_ESD_Match_Gamma_Chi2(nXBinsGamma_Chi2, firstXBinGamma_Chi2, lastXBinGamma_Chi2, "", "");}
459   if(plotESD_Match_Gamma_NDF != NULL){ histograms->Initialize_ESD_Match_Gamma_NDF(nXBinsGamma_NDF, firstXBinGamma_NDF, lastXBinGamma_NDF, "", "");}
460   if(plotESD_Match_Gamma_R != NULL){ histograms->Initialize_ESD_Match_Gamma_R(nXBinsR, firstXBinR, lastXBinR, "", "");}
461   if(plotESD_Match_Gamma_Z_R != NULL){ histograms->Initialize_ESD_Match_Gamma_Z_R(nXBinsZ_R, firstXBinZ_R, lastXBinZ_R, nYBinsZ_R, firstYBinZ_R, lastYBinZ_R, "", "");}
462   if(plotESD_Match_Gamma_X_Y != NULL){ histograms->Initialize_ESD_Match_Gamma_X_Y(nXBinsX_Y, firstXBinX_Y, lastXBinX_Y, nYBinsX_Y, firstYBinX_Y, lastYBinX_Y, "", "");}
463
464   if(plotESD_Pi0_OpeningAngleGamma != NULL){ histograms->Initialize_ESD_Pi0_OpeningAngleGamma(nXBinsOpeningAngle, firstXBinOpeningAngle, lastXBinOpeningAngle, "", "");}
465   if(plotESD_Pi0_Energy != NULL){ histograms->Initialize_ESD_Pi0_Energy(nXBinsEnergy, firstXBinEnergy, lastXBinEnergy, "", "");}
466   if(plotESD_Pi0_Pt != NULL){ histograms->Initialize_ESD_Pi0_Pt(nXBinsPt, firstXBinPt, lastXBinPt, "", "");}
467   if(plotESD_Pi0_Eta != NULL){ histograms->Initialize_ESD_Pi0_Eta(nXBinsEta, firstXBinEta, lastXBinEta, "", "");}
468   if(plotESD_Pi0_Phi != NULL){ histograms->Initialize_ESD_Pi0_Phi(nXBinsPhi, firstXBinPhi, lastXBinPhi, "", "");}
469   if(plotESD_Pi0_Mass != NULL){ histograms->Initialize_ESD_Pi0_Mass(nXBinsPi0_Mass, firstXBinPi0_Mass, lastXBinPi0_Mass, "", "");}
470   if(plotESD_Pi0_R != NULL){ histograms->Initialize_ESD_Pi0_R(nXBinsR, firstXBinR, lastXBinR, "", "");}
471   if(plotESD_Pi0_Z_R != NULL){ histograms->Initialize_ESD_Pi0_Z_R(nXBinsZ_R, firstXBinZ_R, lastXBinZ_R, nYBinsZ_R, firstYBinZ_R, lastYBinZ_R, "", "");}
472   if(plotESD_Pi0_X_Y != NULL){ histograms->Initialize_ESD_Pi0_X_Y(nXBinsX_Y, firstXBinX_Y, lastXBinX_Y, nYBinsX_Y, firstYBinX_Y, lastYBinX_Y, "", "");}
473
474   if(plotESD_Eta_OpeningAngleGamma != NULL){ histograms->Initialize_ESD_Eta_OpeningAngleGamma(nXBinsOpeningAngle, firstXBinOpeningAngle, lastXBinOpeningAngle, "", "");}
475   if(plotESD_Eta_Energy != NULL){ histograms->Initialize_ESD_Eta_Energy(nXBinsEnergy, firstXBinEnergy, lastXBinEnergy, "", "");}
476   if(plotESD_Eta_Pt != NULL){ histograms->Initialize_ESD_Eta_Pt(nXBinsPt, firstXBinPt, lastXBinPt, "", "");}
477   if(plotESD_Eta_Eta != NULL){ histograms->Initialize_ESD_Eta_Eta(nXBinsEta, firstXBinEta, lastXBinEta, "", "");}
478   if(plotESD_Eta_Phi != NULL){ histograms->Initialize_ESD_Eta_Phi(nXBinsPhi, firstXBinPhi, lastXBinPhi, "", "");}
479   if(plotESD_Eta_Mass != NULL){ histograms->Initialize_ESD_Eta_Mass(nXBinsEta_Mass, firstXBinEta_Mass, lastXBinEta_Mass, "", "");}
480   if(plotESD_Eta_R != NULL){ histograms->Initialize_ESD_Eta_R(nXBinsR, firstXBinR, lastXBinR, "", "");}
481   if(plotESD_Eta_Z_R != NULL){ histograms->Initialize_ESD_Eta_Z_R(nXBinsZ_R, firstXBinZ_R, lastXBinZ_R, nYBinsZ_R, firstYBinZ_R, lastYBinZ_R, "", "");}
482   if(plotESD_Eta_X_Y != NULL){ histograms->Initialize_ESD_Eta_X_Y(nXBinsX_Y, firstXBinX_Y, lastXBinX_Y, nYBinsX_Y, firstYBinX_Y, lastYBinX_Y, "", "");}
483
484   if(plotESD_Background_OpeningAngleGamma != NULL){ histograms->Initialize_ESD_Background_OpeningAngleGamma(nXBinsOpeningAngle, firstXBinOpeningAngle, lastXBinOpeningAngle, "", "");}
485   if(plotESD_Background_Energy != NULL){ histograms->Initialize_ESD_Background_Energy(nXBinsEnergy, firstXBinEnergy, lastXBinEnergy, "", "");}
486   if(plotESD_Background_Pt != NULL){ histograms->Initialize_ESD_Background_Pt(nXBinsPt, firstXBinPt, lastXBinPt, "", "");}
487   if(plotESD_Background_Eta != NULL){ histograms->Initialize_ESD_Background_Eta(nXBinsEta, firstXBinEta, lastXBinEta, "", "");}
488   if(plotESD_Background_Phi != NULL){ histograms->Initialize_ESD_Background_Phi(nXBinsPhi, firstXBinPhi, lastXBinPhi, "", "");}
489   if(plotESD_Background_Mass != NULL){ histograms->Initialize_ESD_Background_Mass(nXBinsEta_Mass, firstXBinEta_Mass, lastXBinEta_Mass, "", "");}
490   if(plotESD_Background_R != NULL){ histograms->Initialize_ESD_Background_R(nXBinsR, firstXBinR, lastXBinR, "", "");}
491   if(plotESD_Background_Z_R != NULL){ histograms->Initialize_ESD_Background_Z_R(nXBinsZ_R, firstXBinZ_R, lastXBinZ_R, nYBinsZ_R, firstYBinZ_R, lastYBinZ_R, "", "");}
492   if(plotESD_Background_X_Y != NULL){ histograms->Initialize_ESD_Background_X_Y(nXBinsX_Y, firstXBinX_Y, lastXBinX_Y, nYBinsX_Y, firstYBinX_Y, lastYBinX_Y, "", "");}
493
494   if(plotMapping != NULL){histograms->Initialize_MappingValues(nPhiIndex,nRIndex,nXBinsMapping,minRadius,maxRadius,nYBinsMapping,minPhi,maxPhi);}
495   //create the mapping histograms
496   if(plotMapping != NULL){histograms->Initialize_MappingHistograms(nPhiIndex,nRIndex,nXBinsMapping,firstXBinMapping,lastXBinMapping,nYBinsMapping,firstYBinMapping,lastYBinMapping,"", "");}
497
498
499
500
501   
502   if(plotResolution_dPt !=NULL){histograms->Initialize_Resolution_dPt(nXBinsResdPt, firstXBinResdPt, lastXBinResdPt, nYBinsResdPt, firstYBinResdPt, lastYBinResdPt, "", "");}
503   if(plotResolution_dR !=NULL){histograms->Initialize_Resolution_dR(nXBinsResdR, firstXBinResdR, lastXBinResdR, nYBinsResdR, firstYBinResdR, lastYBinResdR, "", "");}
504   if(plotResolution_dZ !=NULL){histograms->Initialize_Resolution_dZ(nXBinsResdZ, firstXBinResdZ, lastXBinResdZ, nYBinsResdZ, firstYBinResdZ, lastYBinResdZ, "", "");}
505   
506   if(plotResolution_dR_dPt !=NULL){histograms->Initialize_Resolution_dR_dPt(nXBinsResdR_dPt, firstXBinResdR_dPt, lastXBinResdR_dPt, nYBinsResdR_dPt, firstYBinResdR_dPt, lastYBinResdR_dPt, "", "");}
507   
508   if(plotResolution_MC_Pt !=NULL){histograms->Initialize_Resolution_MC_Pt(nXBinsResPt, firstXBinResPt, lastXBinResPt,"","");}
509   if(plotResolution_MC_R !=NULL){histograms->Initialize_Resolution_MC_R(nXBinsResR, firstXBinResR, lastXBinResR,"","");}
510   if(plotResolution_MC_Z !=NULL){histograms->Initialize_Resolution_MC_Z(nXBinsResZ, firstXBinResZ, lastXBinResZ,"","");}
511   
512   if(plotResolution_ESD_Pt !=NULL){histograms->Initialize_Resolution_ESD_Pt(nXBinsResPt, firstXBinResPt, lastXBinResPt,"","");}
513   if(plotResolution_ESD_R !=NULL){histograms->Initialize_Resolution_ESD_R(nXBinsResR, firstXBinResR, lastXBinResR,"","");}
514   if(plotResolution_ESD_Z !=NULL){histograms->Initialize_Resolution_ESD_Z(nXBinsResZ, firstXBinResZ, lastXBinResZ,"","");}
515   
516   if(plotNumberOfV0s != NULL){histograms->Initialize_NumberOfV0s(100, 0, 100,"","");}
517   if(plotNumberOfSurvivingV0s != NULL){histograms->Initialize_NumberOfSurvivingV0s(100, 0, 100,"","");}
518
519   //  debug histograms
520   if(plotV0MassDebugCut1 != NULL){histograms->Initialize_V0MassDebugCut1(nXBinsGamma_Mass, firstXBinGamma_Mass, lastXBinGamma_Mass,"","");}
521   if(plotV0MassDebugCut2 != NULL){histograms->Initialize_V0MassDebugCut2(nXBinsGamma_Mass, firstXBinGamma_Mass, lastXBinGamma_Mass,"","");}
522   if(plotV0MassDebugCut3 != NULL){histograms->Initialize_V0MassDebugCut3(nXBinsGamma_Mass, firstXBinGamma_Mass, lastXBinGamma_Mass,"","");}
523   if(plotV0MassDebugCut4 != NULL){histograms->Initialize_V0MassDebugCut4(nXBinsGamma_Mass, firstXBinGamma_Mass, lastXBinGamma_Mass,"","");}
524   if(plotV0MassDebugCut5 != NULL){histograms->Initialize_V0MassDebugCut5(nXBinsGamma_Mass, firstXBinGamma_Mass, lastXBinGamma_Mass,"","");}
525   if(plotV0MassDebugCut6 != NULL){histograms->Initialize_V0MassDebugCut6(nXBinsGamma_Mass, firstXBinGamma_Mass, lastXBinGamma_Mass,"","");}
526   if(plotV0MassDebugCut7 != NULL){histograms->Initialize_V0MassDebugCut7(nXBinsGamma_Mass, firstXBinGamma_Mass, lastXBinGamma_Mass,"","");}
527   if(plotV0MassDebugCut8 != NULL){histograms->Initialize_V0MassDebugCut8(nXBinsGamma_Mass, firstXBinGamma_Mass, lastXBinGamma_Mass,"","");}
528
529
530
531   //------------------------------ end Creating the histograms -----------------------------
532
533   // Create the Analysis manager
534   AliAnalysisManager *mgr  = new AliAnalysisManager("My Manager", "My Analysis");
535
536   // Define Input Event Handler 
537   AliESDInputHandler* inpHandler = new AliESDInputHandler();
538
539   // Define Output Event Handler
540   AliAODHandler* aodHandler = new AliAODHandler();
541   aodHandler->SetOutputFileName("aodAliGammaConversion.root");
542   
543   // Define MC Truth Event Handler
544   AliMCEventHandler* mcHandler = new AliMCEventHandler();
545   
546   // Add Handlers to the Task Manager
547   mgr->SetInputEventHandler  (inpHandler);
548   mgr->SetOutputEventHandler (aodHandler);
549   mgr->SetMCtruthEventHandler(mcHandler);
550
551   // Be sure you are told what you are doing
552   mgr->SetDebugLevel(10);
553
554   // Declare Common Input Tchain
555   AliAnalysisDataContainer *cinput1 = mgr->CreateContainer("Chain",TChain::Class(),AliAnalysisManager::kInputContainer);
556
557   // Common Output Tree in common â€˜default’ output file
558   AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("tree", TTree::Class(),AliAnalysisManager::kOutputContainer, "default");
559
560   // Private output objects
561   AliAnalysisDataContainer *coutput2 = mgr->CreateContainer("histogramsAliGammaConversion", TList::Class(),AliAnalysisManager::kOutputContainer, "histogramsAliGammaConversion.root");
562
563
564   //------------------------ END: Define input/output handlers ---------------------------------------------------
565
566
567   //check for errors in the specified data
568   if(useKFParticle == kTRUE && useESDTrack == kTRUE){
569     //Print warning, cannot use both
570   }
571   if(useKFParticle == kFALSE && useESDTrack == kFALSE){
572     //Print warning, one have to be specified
573   }
574
575
576   //Create the V0Reader
577   AliV0Reader * v0Reader = new AliV0Reader();
578   if(useKFParticle){
579     v0Reader->UseKFParticle();
580   }
581   else if(useESDTrack){
582     v0Reader->UseESDTrack();
583   }
584   v0Reader->SetNegativeTrackPID(pidOfNegativeTrack);
585   v0Reader->SetPositiveTrackPID(pidOfPositiveTrack);
586   v0Reader->SetMaxRCut(maxRCut);
587   v0Reader->SetEtaCut(etaCut);
588   v0Reader->SetPtCut(ptCut);
589   v0Reader->SetChi2Cut(chi2Cut);
590   v0Reader->SetPIDProbability(probElectron);
591   v0Reader->SetXVertexCut(xVertexCut);
592   v0Reader->SetYVertexCut(yVertexCut);
593   v0Reader->SetZVertexCut(zVertexCut);
594   v0Reader->SetSigmaMass(sigmaCutGammaMass);
595   v0Reader->SetUseImprovedVertex(useImprovedVertex);
596
597   // Create the GammaConversionTask
598   AliAnalysisTaskGammaConversion *gammaconversion = new AliAnalysisTaskGammaConversion("GammaConversionTask");
599   gammaconversion->SetDebugLevel(10);
600   
601   gammaconversion->SetV0Reader(v0Reader);
602   gammaconversion->SetCalculateBackground(calculateBackground);
603   gammaconversion->Init();
604   
605   gammaconversion->SetElectronMass(electronMass);
606   gammaconversion->SetGammaMass(gammaMass);
607   gammaconversion->SetPi0Mass(pi0Mass);
608   gammaconversion->SetEtaMass(etaMass);
609
610   gammaconversion->SetGammaWidth(gammaWidth);
611   gammaconversion->SetPi0Width(pi0Width);
612   gammaconversion->SetEtaWidth(etaWidth);
613
614   // define the width constraint used by KF particle.
615   Double_t gammaWidth = 0.01;
616   Double_t pi0Width   = 0.01;
617   Double_t etaWidth   = 0.01;
618
619   gammaconversion->SetHistograms(histograms);
620   v0Reader->SetHistograms(histograms);// also give the pointer to the v0reader, for debugging cuts
621   
622   gammaconversion->SetDoMCTruth(doMCTruth);
623
624
625   // Add task to the manager 
626   mgr->AddTask(gammaconversion);
627
628   // Connect I/O to the task
629   mgr->ConnectInput (gammaconversion, 0, cinput1);
630   mgr->ConnectOutput(gammaconversion, 0, coutput1);
631   mgr->ConnectOutput(gammaconversion, 1, coutput2);
632
633   TChain* chain= CreateESDChain(sample);
634   
635   mgr->InitAnalysis();
636   
637   mgr->PrintStatus();
638   
639   mgr->StartAnalysis("local",chain);
640
641 }
642
643
644
645
646 void build() {
647   TStopwatch timer;
648   timer.Start();
649   gSystem->Load("libTree.so");
650   gSystem->Load("libGeom");
651   //  gSystem->Load("libANALYSISalice");
652
653   //____________________________________________________//
654   //____________________________________________________//
655   //_____________Setting up STEERBase.par_______________//
656   //____________________________________________________//
657   setupPar("STEERBase");
658   gSystem->Load("libSTEERBase.so");
659
660   //____________________________________________________//
661   //_____________Setting up ESD.par_____________________//
662   //____________________________________________________//
663   setupPar("ESD");
664   gSystem->Load("libVMC.so");
665   gSystem->Load("libESD.so");
666
667   //____________________________________________________//
668   //_____________Setting up AOD.par_____________________//
669   //____________________________________________________//
670   setupPar("AOD");
671   gSystem->Load("libAOD.so");
672                                                                 
673   //_____________________________________________________________//
674   //_____________Setting up ANALYSIS.par_________________________//
675   //_____________________________________________________________//
676   setupPar("ANALYSIS");
677   gSystem->Load("libANALYSIS.so");
678
679   //_____________________________________________________________//
680   //_____________Setting up ANALYSISalice.par_________________________//
681   //_____________________________________________________________//
682   setupPar("ANALYSISalice");
683   gSystem->Load("libANALYSISalice.so");
684                                                                                                                                   
685   //_____________________________________________________________//
686   //_____________Setting up PWG4Gamma.par_____________________//
687   //_____________________________________________________________//
688   //  setupPar("PWG4Gamma");
689   //  gSystem->Load("libPWG4Gamma.so");
690   setupPar("PWG4PartCorr");
691   gSystem->Load("libPWG4PartCorr.so");
692   //if head:: use PWG4PartCorr
693              
694   //gROOT->LoadMacro("AliAnalysisTaskPi0.cxx+");
695   // gROOT->LoadMacro("AliAnalysisTaskPtMC.cxx+");
696   //  gROOT->LoadMacro("AliAnalysisTaskPi0MC.cxx+");
697   //  gROOT->LoadMacro("AliAnaScale.cxx+");
698
699
700   //gROOT->LoadMacro("$ALICE_ROOT/PWG0/CreateESDChain.C");
701   //TChain* chain = CreateESDChain("files1.txt");
702
703
704
705   //____________________________________________//
706
707
708 }
709
710 Int_t setupPar(const char* pararchivename) {
711   ///////////////////
712   // Setup PAR File//
713   ///////////////////
714   if (pararchivename) {
715     char processline[1024];
716     sprintf(processline,".! tar xvzf %s.par",pararchivename);
717     gROOT->ProcessLine(processline);
718     const char* ocwd = gSystem->WorkingDirectory();
719     gSystem->ChangeDirectory(pararchivename);
720                                                                                                                                                
721     // check for BUILD.sh and execute
722     if (!gSystem->AccessPathName("PROOF-INF/BUILD.sh")) {
723       printf("*******************************\n");
724       printf("*** Building PAR archive    ***\n");
725       printf("*******************************\n");
726                                                                                                                                                
727       if (gSystem->Exec("PROOF-INF/BUILD.sh")) {
728         Error("runAnalysis","Cannot Build the PAR Archive! - Abort!");
729         return -1;
730       }
731     }
732     // check for SETUP.C and execute
733     if (!gSystem->AccessPathName("PROOF-INF/SETUP.C")) {
734       printf("*******************************\n");
735       printf("*** Setup PAR archive       ***\n");
736       printf("*******************************\n");
737       gROOT->Macro("PROOF-INF/SETUP.C");
738     }
739                                                                                                                                                
740     gSystem->ChangeDirectory("../");
741   }                                                                                                                                               
742   return 1;
743 }