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