6178f971731dbd30f0c063579a80432a56f0f4aa
[u/mrichter/AliRoot.git] / PWGGA / GammaConv / macros / Plot_Mapping_Histos_Events.C
1 // provided by Gamma Conversion Group, PWG4, Kathrin Koch, kkoch@physi.uni-heidelberg.de and Friederike Bock, fbock@physi.uni-heidelberg.de
2
3 #include <Riostream.h>
4 #include <fstream>
5 #include "PlottingGammaHistos.h"
6 using namespace std;
7
8 extern TRandom *gRandom;
9 extern TBenchmark *gBenchmark;
10 extern TSystem *gSystem;
11
12 void  Plot_Mapping_Histos_Events(const char *input1 = "myOutput", const char *secondinput = "", const char *cutsel = "", const char *path = "", const char *output = "Mapping", const char *Plots = "kFALSE", const char *suffix = "gif"){      
13         
14         gROOT->Reset();
15         gROOT->SetStyle("Plain");
16         StyleSettings();        
17
18                 // Which file you want to analyse
19         Char_t filename_input1[200] = (Form("%s%s",path,input1));
20         
21         Bool_t SinglePlots = kFALSE;
22         if(Plots == "kTRUE") SinglePlots = kTRUE;
23         
24         // the outputfile
25         TPostScript *ps_mapping = 0x0;
26         if(!SinglePlots)ps_mapping = new TPostScript(Form("%s%s.ps",path,output),111);
27         
28         //rebinning
29         const int rebin = 4;
30
31         //Which Minimum do you want to set for XY-2Dplot
32         Int_t minimumXY = 10;
33
34         //How big should the right margin in 2D plots be? Others are set by default setting.
35         Float_t RightMargin = 0.17;
36
37         //How many slices do you have?
38 //      const int NbinsPhi = 8;  
39 //      const int NbinsR = 12;
40         const int NbinsZ = 6;
41         const int NbinsR = 13;  
42         const int NbinsZ = 12;
43
44         // how many raws and colums you want to have in your output?
45         Int_t column = 2;
46         Int_t raw = 7;
47         
48         //Array for ZinR-Ranges
49         Float_t *RangeZinR[NbinsR] = {30,30,40,50,60,70,80,100,120,140,160,180,240}; 
50         //Float_t *RangeZinR[NbinsR] = {30,40,50,60,70,80,100,120,140,160,180,240};
51         
52         //Array of Rbins
53         Float_t ArrayRbins[12] = {3.5,5.75,9.5,13.,21.,27.5,35.,42.,55.,81.5,90,72.};
54         //Array of Zbins
55         Float_t ArrayZbins[11] = {0,15,30,50,100,200,-15,-30,-50,-100,-200};
56
57         //Array defintion for printing Logo in right upper corner
58         Float_t right_up[4]={0.7,0.63,0.15, 0.02};
59         Float_t right_down[4]={0.7,0.23,0.15, 0.02};
60         Float_t right_up2D[4]={0.68,0.775,0.11, 0.02};
61         //Array defintion for printing Logo in left upper corner
62         Float_t left_up[4]={0.17,0.73, 0.15, 0.02};
63         Float_t left_down[4] = {0.15,0.17, 0.15, 0.02};
64         //Array defintion for printing text in right upper corner
65         Float_t right_up_text[4]={0.6,0.8,0.15, 0.04};
66
67         // get the histos
68         TFile f1(filename_input1);  
69
70
71         // choice of dateset
72         if(cutsel != ""){
73                 char *GammaDirectory = Form("PWG4_GammaConversion_%s",  cutsel);
74                 cout << GammaDirectory << endl;
75                 char *GammaList = Form("histogramsAliGammaConversion_%s", cutsel);
76                 cout << GammaList << endl;
77         }else{
78                 char *GammaDirectory = "PWG4_GammaConversion";
79                 cout << GammaDirectory << endl;
80                 char *GammaList = "histogramsAliGammaConversion";
81                 cout << GammaList << endl;
82         }       
83
84         // labeling
85         char *StandardYAxis = "#gamma/ event scaled by multiplicity";
86         char *Date = "3rd June 2010";
87         TLatex *EtaRange = new TLatex(0.15,0.845,"|#eta| < 0.9 "); // Bo: this was modified
88                     EtaRange->SetNDC();
89                     EtaRange->SetTextFont(62);
90                     EtaRange->SetTextSize(0.04);
91                     EtaRange->SetLineWidth(6);  
92
93 //------------------------------- Reading FILES ----------------------------------------------------------------------
94          TDirectory *fPWG4GammaConversion_input1 = new TDirectory(); // definition of first folder / list       
95          TList *fHistosGammaConversion_input1 = new TList(); // definition of first folder / list
96          TList *fESDContainer_input1 = new TList();  // definition of following folder / list
97          TList *fMappingContainer_input1 = new TList();
98
99         fPWG4GammaConversion_input1 = (TDirectory*)f1.Get(GammaDirectory); 
100         fHistosGammaConversion_input1 = (TList*)fPWG4GammaConversion_input1->Get(GammaList); 
101         fMappingContainer_input1 = (TList*)fHistosGammaConversion_input1->FindObject("Mapping histograms"); 
102         fESDContainer_input1 = (TList*)fHistosGammaConversion_input1->FindObject("ESD histograms"); 
103         
104         TH1F *ESD_Conversion_R_input1=fESDContainer_input1->FindObject("ESD_Conversion_R");        
105         TH2F *ESD_Conversion_ZR_input1=fESDContainer_input1->FindObject("ESD_Conversion_ZR");
106         TH2F *ESD_Conversion_XY_input1=fESDContainer_input1->FindObject("ESD_Conversion_XY");
107         TH1F *ESD_Conversion_OpeningAngle_input1=fESDContainer_input1->FindObject("ESD_Conversion_OpeningAngle");
108         TH1D *ESD_Conversion_Z_input1=ESD_Conversion_ZR_input1->ProjectionX("ESD_Conversion_Z_input1");
109         TH1F *ESD_NumberOfContributorsVtx_input1=fESDContainer_input1->FindObject("ESD_NumberOfContributorsVtx");
110         TH1D *ESD_Conversion_Z_input1=ESD_Conversion_ZR_input1->ProjectionX("ESD_Cocdnversion_Z_input1");
111         TH1F *ScalingDiagramm_input1= fMappingContainer_input1->FindObject("ESD_Conversion_Mapping_Phi_in_R_11");
112         TH1F *ESD_NumberOfGoodESDTracks_input1=fESDContainer_input1->FindObject("ESD_NumberOfGoodESDTracksVtx");
113
114         ESD_NumberOfContributorsVtx_input1->SetAxisRange(1.,100.);      
115 //      ESD_NumberOfGoodESDTracks_input1->SetAxisRange(1.,100.);
116
117         Float_t Scaling_input1 = ScalingDiagramm_input1->Integral();
118         Float_t nGoodEvents_input1 = ESD_NumberOfContributorsVtx_input1->Integral();
119         Float_t nGoodTrig_input1 = ESD_NumberOfContributorsVtx_input1->GetEntries();
120         Float_t nRecGamma_input1 = ESD_Conversion_R_input1->GetEntries();
121         cout<< input1 << "    Number of events::   " << nGoodEvents_input1 << "    Number of triggers::   " << nGoodTrig_input1 << "    Number reconstructed gammas::    "<< nRecGamma_input1 <<endl;
122
123         Double_t mean_input1 = ESD_NumberOfGoodESDTracks_input1->GetMean();
124
125         Float_t normFacRec_input1=1./nGoodEvents_input1;
126 //      Float_t normFacRec_input1=1./Scaling_input1;
127         //Scaling reconstr.
128
129         GammaScalingHistogramm(ESD_Conversion_R_input1,normFacRec_input1);
130 //      GammaScalingHistogramm(ESD_Conversion_ZR_input1,normFacRec_input1);
131 //      GammaScalingHistogramm(ESD_Conversion_XY_input1,normFacRec_input1);
132         GammaScalingHistogramm(ESD_Conversion_OpeningAngle_input1,normFacRec_input1);
133         GammaScalingHistogramm(ESD_Conversion_Z_input1,normFacRec_input1);
134
135         TH1F *ESD_Conversion_R_summed_input1 = (TH1F*) ESD_Conversion_R_input1->Clone("ESD_Conversion_R_summed_input1");
136         ESD_Conversion_R_summed_input1->Reset();
137         Int_t ConvBinsR = ESD_Conversion_R_input1->GetNbinsX();
138         for(Int_t ConvR = 1; ConvR < ConvBinsR +1; ConvR++){
139                 if (ConvR == 1){
140                         ESD_Conversion_R_summed_input1->AddBinContent(ConvR, ESD_Conversion_R_input1-> GetBinContent(ConvR));
141                 } else {
142                         ESD_Conversion_R_summed_input1->AddBinContent(ConvR,(ESD_Conversion_R_summed_input1->GetBinContent(ConvR -1) + ESD_Conversion_R_input1->GetBinContent(ConvR)));         
143                 }
144         }
145
146         TH1F *ESD_Conversion_Mapping_Phi_in_R_input1[NbinsR];
147         Char_t histoname_Phi_in_R_input1[100];
148         for(Int_t iR = 0; iR < NbinsR; iR++){
149                 sprintf(histoname_Phi_in_R_input1,"ESD_Conversion_Mapping_Phi_in_R_%02d",iR);
150                 ESD_Conversion_Mapping_Phi_in_R_input1[iR] = dynamic_cast<TH1F*>(fMappingContainer_input1->FindObject(histoname_Phi_in_R_input1));
151                 GammaScalingHistogramm(ESD_Conversion_Mapping_Phi_in_R_input1[iR],normFacRec_input1);
152                 ESD_Conversion_Mapping_Phi_in_R_input1[iR]->Rebin(rebin);       
153         }
154         
155         TH1F *ESD_Conversion_Mapping_Z_in_R_input1[NbinsR];
156         Char_t histoname_Z_in_R_input1[100];
157         for(Int_t iR = 0; iR < NbinsR; iR++){
158                 sprintf(histoname_Z_in_R_input1,"ESD_Conversion_Mapping_Z_in_R_%02d",iR);
159                 ESD_Conversion_Mapping_Z_in_R_input1[iR] = dynamic_cast<TH1F*>(fMappingContainer_input1->FindObject(histoname_Z_in_R_input1));
160                 GammaScalingHistogramm(ESD_Conversion_Mapping_Z_in_R_input1[iR],normFacRec_input1);
161                 ESD_Conversion_Mapping_Z_in_R_input1[iR]->Rebin(rebin);
162         }
163         
164         TH1F *ESD_Conversion_Mapping_Phi_in_Z_input1[NbinsZ];
165         Char_t histoname_Phi_in_Z_input1[100];
166         for(Int_t iZ = 0; iZ < NbinsZ; iZ++){
167                 sprintf(histoname_Phi_in_Z_input1,"ESD_Conversion_Mapping_Phi_in_Z_%02d",iZ);
168                 ESD_Conversion_Mapping_Phi_in_Z_input1[iZ] = dynamic_cast<TH1F*>(fMappingContainer_input1->FindObject(histoname_Phi_in_Z_input1));
169                 GammaScalingHistogramm(ESD_Conversion_Mapping_Phi_in_Z_input1[iZ],normFacRec_input1);
170                 ESD_Conversion_Mapping_Phi_in_Z_input1[iZ]->Rebin(rebin);
171         }
172
173         TH1F *ESD_Conversion_Mapping_R_in_Z_input1[NbinsZ];
174         Char_t histoname_R_in_Z_input1[100];
175         for(Int_t iZ = 0; iZ < NbinsZ; iZ++){
176                 sprintf(histoname_R_in_Z_input1,"ESD_Conversion_Mapping_R_in_Z_%02d",iZ);
177                 ESD_Conversion_Mapping_R_in_Z_input1[iZ] = dynamic_cast<TH1F*>(fMappingContainer_input1->FindObject(histoname_R_in_Z_input1));
178                 GammaScalingHistogramm(ESD_Conversion_Mapping_R_in_Z_input1[iZ],normFacRec_input1);
179                 ESD_Conversion_Mapping_R_in_Z_input1[iZ]->Rebin(rebin);
180         }
181         
182         // Middle Pt    
183         TH1F *ESD_Conversion_Mapping_MidPt_Phi_in_R_input1[NbinsR];
184         Char_t histoname_MidPt_Phi_in_R_input1[100];
185         for(Int_t iR = 0; iR < NbinsR; iR++){
186                 sprintf(histoname_MidPt_Phi_in_R_input1,"ESD_Conversion_Mapping_MidPt_Phi_in_R_%02d",iR);
187                 ESD_Conversion_Mapping_MidPt_Phi_in_R_input1[iR] = dynamic_cast<TH1F*>(fMappingContainer_input1->FindObject(histoname_MidPt_Phi_in_R_input1));
188                 GammaScalingHistogramm(ESD_Conversion_Mapping_MidPt_Phi_in_R_input1[iR],normFacRec_input1);
189                 ESD_Conversion_Mapping_MidPt_Phi_in_R_input1[iR] ->Rebin(rebin);
190         }
191         
192         TH1F *ESD_Conversion_Mapping_MidPt_Z_in_R_input1[NbinsR];
193         Char_t histoname_MidPt_Z_in_R_input1[100];
194         for(Int_t iR = 0; iR < NbinsR; iR++){
195                 sprintf(histoname_MidPt_Z_in_R_input1,"ESD_Conversion_Mapping_MidPt_Z_in_R_%02d",iR);
196                 ESD_Conversion_Mapping_MidPt_Z_in_R_input1[iR] = dynamic_cast<TH1F*>(fMappingContainer_input1->FindObject(histoname_MidPt_Z_in_R_input1));
197                 GammaScalingHistogramm(ESD_Conversion_Mapping_MidPt_Z_in_R_input1[iR],normFacRec_input1);
198                 ESD_Conversion_Mapping_MidPt_Z_in_R_input1[iR] ->Rebin(rebin);
199         }
200         
201         TH1F *ESD_Conversion_Mapping_MidPt_Phi_in_Z_input1[NbinsZ];
202         Char_t histoname_MidPt_Phi_in_Z_input1[100];
203         for(Int_t iZ = 0; iZ < NbinsZ; iZ++){
204                 sprintf(histoname_MidPt_Phi_in_Z_input1,"ESD_Conversion_Mapping_MidPt_Phi_in_Z_%02d",iZ);
205                 ESD_Conversion_Mapping_MidPt_Phi_in_Z_input1[iZ] = dynamic_cast<TH1F*>(fMappingContainer_input1->FindObject(histoname_MidPt_Phi_in_Z_input1));
206                 GammaScalingHistogramm(ESD_Conversion_Mapping_MidPt_Phi_in_Z_input1[iZ],normFacRec_input1);
207                 ESD_Conversion_Mapping_MidPt_Phi_in_Z_input1[iZ] ->Rebin(rebin);
208         }
209         
210         TH1F *ESD_Conversion_Mapping_MidPt_R_in_Z_input1[NbinsZ];
211         Char_t histoname_MidPt_R_in_Z_input1[100];
212         for(Int_t iZ = 0; iZ < NbinsZ; iZ++){
213                 sprintf(histoname_MidPt_R_in_Z_input1,"ESD_Conversion_Mapping_MidPt_R_in_Z_%02d",iZ);
214                 ESD_Conversion_Mapping_MidPt_R_in_Z_input1[iZ] = dynamic_cast<TH1F*>(fMappingContainer_input1->FindObject(histoname_MidPt_R_in_Z_input1));
215                 GammaScalingHistogramm(ESD_Conversion_Mapping_MidPt_R_in_Z_input1[iZ],normFacRec_input1);
216                 ESD_Conversion_Mapping_MidPt_R_in_Z_input1[iZ] ->Rebin(rebin);
217         }
218
219         // ------------------------------------- second file-----------------------------------------------------------
220         TFile *input2 = 0x0 ;
221         
222         TH1F *ESD_Conversion_Mapping_Phi_in_R_input2[NbinsR];
223         TH1F *ESD_Conversion_Mapping_Z_in_R_input2[NbinsR];
224         TH1F *ESD_Conversion_Mapping_Phi_in_Z_input2[NbinsZ];
225         TH1F *ESD_Conversion_Mapping_R_in_Z_input2[NbinsZ];
226         TH1F *ESD_Conversion_Mapping_MidPt_Phi_in_R_input2[NbinsR];
227         TH1F *ESD_Conversion_Mapping_MidPt_Z_in_R_input2[NbinsR];
228         TH1F *ESD_Conversion_Mapping_MidPt_Phi_in_Z_input2[NbinsZ];
229         TH1F *ESD_Conversion_Mapping_MidPt_R_in_Z_input2[NbinsZ];
230         
231         if(secondinput != ""){
232                 
233                 input2 = new TFile(Form("%s%s",path, secondinput));     
234
235                  TDirectory *fPWG4GammaConversion_input2 = new TDirectory(); // definition of first folder / list       
236                  TList *fHistosGammaConversion_input2 = new TList(); // definition of first folder / list
237                  TList *fMappingContainer_input2 = new TList();  // definition of following folder / list
238                  TList *fESDContainer_input2 = new TList();  // definition of following folder / list
239                  
240                 fPWG4GammaConversion_input2 = (TDirectory*)input2->Get(GammaDirectory); 
241                 fHistosGammaConversion_input2 = (TList*)fPWG4GammaConversion_input2->Get(GammaList); 
242                 fMappingContainer_input2 = (TList*)fHistosGammaConversion_input2->FindObject("Mapping histograms");
243                 fESDContainer_input2 = (TList*)fHistosGammaConversion_input2->FindObject("ESD histograms"); 
244
245                 TH1F * ESD_NumberOfGoodESDTracks_input2=fESDContainer_input2->FindObject("ESD_NumberOfGoodESDTracksVtx");                       
246                 TH1F *ESD_Conversion_R_input2=fESDContainer_input2->FindObject("ESD_Conversion_R");        
247                 TH2F *ESD_Conversion_ZR_input2=fESDContainer_input2->FindObject("ESD_Conversion_ZR");
248                 TH2F *ESD_Conversion_XY_input2=fESDContainer_input2->FindObject("ESD_Conversion_XY");
249                 TH1F *ESD_Conversion_OpeningAngle_input2=fESDContainer_input2->FindObject("ESD_Conversion_OpeningAngle");
250                 TH1D *ESD_Conversion_Z_input2=ESD_Conversion_ZR_input2->ProjectionX("ESD_Conversion_Z_input2");
251                 TH1F * ESD_NumberOfContributorsVtx_input2=fESDContainer_input2->FindObject("ESD_NumberOfContributorsVtx");
252                 TH1F *ScalingDiagramm_input2= fMappingContainer_input2->FindObject("ESD_Conversion_Mapping_Phi_in_R_11");
253
254                 ESD_NumberOfContributorsVtx_input2->SetAxisRange(1.,100.);
255         //      ESD_NumberOfGoodESDTracks_input2->SetAxisRange(1.,100.);
256         
257                 Float_t Scaling_input2 = ScalingDiagramm_input2->Integral();
258                 Float_t nGoodEvents_input2 = ESD_NumberOfContributorsVtx_input2->Integral();
259                 Float_t nGoodTrig_input2 = ESD_NumberOfContributorsVtx_input2->GetEntries();
260                 Float_t nRecGamma_input2 = ESD_Conversion_R_input2->GetEntries();
261                 cout<< secondinput << "    Number of events::   " << nGoodEvents_input2 << "    Number of triggers::   " << nGoodTrig_input2 << "    Number reconstructed gammas::    "<< nRecGamma_input2 <<endl;
262
263                 Double_t mean_input2 = ESD_NumberOfGoodESDTracks_input2->GetMean();
264
265         //      Float_t normFacRec_input2=1./nGoodEvents_input2;
266                 Float_t normFacRec_input2=1./nGoodEvents_input2 * mean_input1/mean_input2;
267                 
268                 //Scaling reconstr.
269                 GammaScalingHistogramm(ESD_Conversion_R_input2,normFacRec_input2);
270 //              GammaScalingHistogramm(ESD_Conversion_ZR_input2,normFacRec_input2);
271 //              GammaScalingHistogramm(ESD_Conversion_XY_input2,normFacRec_input2);
272                 GammaScalingHistogramm(ESD_Conversion_OpeningAngle_input2,normFacRec_input2);
273                 GammaScalingHistogramm(ESD_Conversion_Z_input2,normFacRec_input2);
274
275                 TH1F *ESD_Conversion_R_summed_input2 = (TH1F*) ESD_Conversion_R_input2->Clone("ESD_Conversion_R_summed_input2");
276                 ESD_Conversion_R_summed_input2->Reset();
277                 Int_t ConvBinsR = ESD_Conversion_R_input2->GetNbinsX();
278                 for(Int_t ConvR = 1; ConvR < ConvBinsR +1; ConvR++){
279                         if (ConvR == 1){
280                                 ESD_Conversion_R_summed_input2->AddBinContent(ConvR, ESD_Conversion_R_input2-> GetBinContent(ConvR));
281                         } else {
282                                 ESD_Conversion_R_summed_input2->AddBinContent(ConvR,(ESD_Conversion_R_summed_input2->GetBinContent(ConvR -1) + ESD_Conversion_R_input2->GetBinContent(ConvR)));         
283                         }
284                 }
285
286                 Char_t histoname_Phi_in_R_input2[100];
287                 Char_t histoname_Ratio_Phi_in_R_input2[100];
288                 TH1F *Ratio_Mapping_Phi_in_R[NbinsR];
289                 for(Int_t iR = 0; iR < NbinsR; iR++){
290                         sprintf(histoname_Phi_in_R_input2,"ESD_Conversion_Mapping_Phi_in_R_%02d",iR);
291                         ESD_Conversion_Mapping_Phi_in_R_input2[iR] = dynamic_cast<TH1F*>(fMappingContainer_input2->FindObject(histoname_Phi_in_R_input2));
292                         GammaScalingHistogramm(ESD_Conversion_Mapping_Phi_in_R_input2[iR],normFacRec_input2);
293                         ESD_Conversion_Mapping_Phi_in_R_input2[iR]->Rebin(rebin);
294         
295                         sprintf(histoname_Ratio_Phi_in_R_input2,"Ratio_Mapping_Phi_in_R_%02d",iR);
296                         Ratio_Mapping_Phi_in_R[iR]= (TH1F*)ESD_Conversion_Mapping_Phi_in_R_input1[iR]->Clone();
297                         Ratio_Mapping_Phi_in_R[iR]->SetName(histoname_Ratio_Phi_in_R_input2); 
298                         Ratio_Mapping_Phi_in_R[iR]->Divide(Ratio_Mapping_Phi_in_R[iR],ESD_Conversion_Mapping_Phi_in_R_input2[iR]);
299                 }
300                 
301                 Char_t histoname_Z_in_R_input2[100];
302                 Char_t histoname_Ratio_Z_in_R_input2[100];
303                 TH1F *Ratio_Mapping_Z_in_R[NbinsR];
304                 for(Int_t iR = 0; iR < NbinsR; iR++){
305                         sprintf(histoname_Z_in_R_input2,"ESD_Conversion_Mapping_Z_in_R_%02d",iR);
306                         ESD_Conversion_Mapping_Z_in_R_input2[iR] = dynamic_cast<TH1F*>(fMappingContainer_input2->FindObject(histoname_Z_in_R_input2));
307                         GammaScalingHistogramm(ESD_Conversion_Mapping_Z_in_R_input2[iR],normFacRec_input2);
308                         ESD_Conversion_Mapping_Z_in_R_input2[iR]->Rebin(rebin);
309                         sprintf(histoname_Ratio_Z_in_R_input2,"Ratio_Mapping_Z_in_R_%02d",iR);
310                         Ratio_Mapping_Z_in_R[iR]= (TH1F*)ESD_Conversion_Mapping_Z_in_R_input1[iR]->Clone();
311                         Ratio_Mapping_Z_in_R[iR]->SetName(histoname_Ratio_Z_in_R_input2); 
312                         Ratio_Mapping_Z_in_R[iR]->Divide(Ratio_Mapping_Z_in_R[iR],ESD_Conversion_Mapping_Z_in_R_input2[iR]);
313                 }
314                 
315                 Char_t histoname_Phi_in_Z_input2[100];
316                 Char_t histoname_Ratio_Phi_in_Z_input2[100];
317                 TH1F *Ratio_Mapping_Phi_in_Z[NbinsZ];
318                 for(Int_t iZ = 0; iZ < NbinsZ; iZ++){
319                         sprintf(histoname_Phi_in_Z_input2,"ESD_Conversion_Mapping_Phi_in_Z_%02d",iZ);
320                         ESD_Conversion_Mapping_Phi_in_Z_input2[iZ] = dynamic_cast<TH1F*>(fMappingContainer_input2->FindObject(histoname_Phi_in_Z_input2));
321                         GammaScalingHistogramm(ESD_Conversion_Mapping_Phi_in_Z_input2[iZ],normFacRec_input2);
322                         ESD_Conversion_Mapping_Phi_in_Z_input2[iZ] ->Rebin(rebin);                      
323                         sprintf(histoname_Ratio_Phi_in_Z_input2,"Ratio_Mapping_Phi_in_Z_%02d",iZ);
324                         Ratio_Mapping_Phi_in_Z[iZ]= (TH1F*)ESD_Conversion_Mapping_Phi_in_Z_input1[iZ]->Clone();
325                         Ratio_Mapping_Phi_in_Z[iZ]->SetName(histoname_Ratio_Phi_in_Z_input2); 
326                         Ratio_Mapping_Phi_in_Z[iZ]->Divide(Ratio_Mapping_Phi_in_Z[iZ],ESD_Conversion_Mapping_Phi_in_Z_input2[iZ]);
327                 }
328                 
329                 Char_t histoname_R_in_Z_input2[100];
330                 Char_t histoname_Ratio_R_in_Z_input2[100];
331                 TH1F *Ratio_Mapping_R_in_Z[NbinsZ];
332                 for(Int_t iZ = 0; iZ < NbinsZ; iZ++){
333                         sprintf(histoname_R_in_Z_input2,"ESD_Conversion_Mapping_R_in_Z_%02d",iZ);
334                         ESD_Conversion_Mapping_R_in_Z_input2[iZ] = dynamic_cast<TH1F*>(fMappingContainer_input2->FindObject(histoname_R_in_Z_input2));
335                         GammaScalingHistogramm(ESD_Conversion_Mapping_R_in_Z_input2[iZ],normFacRec_input2);
336                         ESD_Conversion_Mapping_R_in_Z_input2[iZ] ->Rebin(rebin);
337                         sprintf(histoname_Ratio_Phi_in_Z_input2,"Ratio_Mapping_R_in_Z_%02d",iZ);
338                         Ratio_Mapping_R_in_Z[iZ]= (TH1F*)ESD_Conversion_Mapping_R_in_Z_input1[iZ]->Clone();
339                         Ratio_Mapping_R_in_Z[iZ]->SetName(histoname_Ratio_R_in_Z_input2); 
340                         Ratio_Mapping_R_in_Z[iZ]->Divide(Ratio_Mapping_R_in_Z[iZ],ESD_Conversion_Mapping_R_in_Z_input2[iZ]);
341                 }
342                 
343                 // Middle Pt    
344                 Char_t histoname_MidPt_Phi_in_R_input2[100];
345                 for(Int_t iR = 0; iR < NbinsR; iR++){
346                         sprintf(histoname_MidPt_Phi_in_R_input2,"ESD_Conversion_Mapping_MidPt_Phi_in_R_%02d",iR);
347                         ESD_Conversion_Mapping_MidPt_Phi_in_R_input2[iR] = dynamic_cast<TH1F*>(fMappingContainer_input2->FindObject(histoname_MidPt_Phi_in_R_input2));
348                         GammaScalingHistogramm(ESD_Conversion_Mapping_MidPt_Phi_in_R_input2[iR],normFacRec_input2);
349                         ESD_Conversion_Mapping_MidPt_Phi_in_R_input2[iR] ->Rebin(rebin);
350                 }
351                 
352                 Char_t histoname_MidPt_Z_in_R_input2[100];
353                 for(Int_t iR = 0; iR < NbinsR; iR++){
354                         sprintf(histoname_MidPt_Z_in_R_input2,"ESD_Conversion_Mapping_MidPt_Z_in_R_%02d",iR);
355                         ESD_Conversion_Mapping_MidPt_Z_in_R_input2[iR] = dynamic_cast<TH1F*>(fMappingContainer_input2->FindObject(histoname_MidPt_Z_in_R_input2));
356                         GammaScalingHistogramm(ESD_Conversion_Mapping_MidPt_Z_in_R_input2[iR],normFacRec_input2);
357                         ESD_Conversion_Mapping_MidPt_Z_in_R_input2[iR] ->Rebin(rebin);
358                 }
359                 
360                 Char_t histoname_MidPt_Phi_in_Z_input2[100];
361                 for(Int_t iZ = 0; iZ < NbinsZ; iZ++){
362                         sprintf(histoname_MidPt_Phi_in_Z_input2,"ESD_Conversion_Mapping_MidPt_Phi_in_Z_%02d",iZ);
363                         ESD_Conversion_Mapping_MidPt_Phi_in_Z_input2[iZ] = dynamic_cast<TH1F*>(fMappingContainer_input2->FindObject(histoname_MidPt_Phi_in_Z_input2));
364                         GammaScalingHistogramm(ESD_Conversion_Mapping_MidPt_Phi_in_Z_input2[iZ],normFacRec_input2);
365                         ESD_Conversion_Mapping_MidPt_Phi_in_Z_input2[iZ] ->Rebin(rebin);
366                 }
367                 
368                 Char_t histoname_MidPt_R_in_Z_input2[100];
369                 for(Int_t iZ = 0; iZ < NbinsZ; iZ++){
370                         sprintf(histoname_MidPt_R_in_Z_input2,"ESD_Conversion_Mapping_MidPt_R_in_Z_%02d",iZ);
371                         ESD_Conversion_Mapping_MidPt_R_in_Z_input2[iZ] = dynamic_cast<TH1F*>(fMappingContainer_input2->FindObject(histoname_MidPt_R_in_Z_input2));
372                         GammaScalingHistogramm(ESD_Conversion_Mapping_MidPt_R_in_Z_input2[iZ],normFacRec_input2);
373                         ESD_Conversion_Mapping_MidPt_R_in_Z_input2[iZ] ->Rebin(rebin);
374                 }       
375         }
376         // end second file
377         
378         
379         // -----------------page 1---------------------------------------------------------------------------
380         
381         // plot the ESD histos
382                 
383         TLine * linePhi = new TLine (-3.2,1,3.2,1);
384         TLine * lineZ = new TLine (-300,1,300,1);
385         TLine * lineR = new TLine (0,1,200,1);
386         linePhi->SetLineColor(2);
387         lineZ->SetLineColor(2);
388         lineR->SetLineColor(2);
389
390         leg1 = new TLegend(0.6,0.82,0.9,0.9);
391         leg1->AddEntry(ESD_Conversion_R_input1,("Data"),"l");
392         if(secondinput != ""){
393         leg1->AddEntry(ESD_Conversion_R_input2,("MC"),"l");}
394         leg1->SetFillColor(0);
395         leg1->SetTextSize(0.04);
396
397
398 if (!SinglePlots) {     
399         ps_mapping->NewPage();
400 //      c_0 = new TCanvas("c_0","",200,10,700,1000);  // gives the page size
401         
402         title0 = new TPaveLabel(0.05,0.92,0.95,0.96,(Form("Input1: %s",input1)));       
403         title0->SetFillColor(16);
404         title0->SetTextSize(0.25);
405 //      title0->Draw();
406         
407         if(secondinput != ""){
408                 title1 = new TPaveLabel(0.05,0.87,0.95,0.91,(Form("Input2: %s",secondinput)));  
409                 title1->SetFillColor(16);
410                 title1->SetTextSize(0.25);
411 //              title1->Draw();
412         }
413 //      c_0->Update();
414         
415         // --------------------------------page 2 - R-distributions -----------------------------------         
416         
417         ps_mapping->NewPage();
418         
419         c_R = new TCanvas("c_R","",200,10,700,1000);  // gives the page size
420         
421         pad_R = new TPad("pad_R","",0.05,0.05,0.95,0.85,0);   // gives the size of the histo areas      
422         pad_R->SetFillColor(0);
423         pad_R->GetFrame()->SetFillColor(0);
424         pad_R->SetBorderMode(0);
425         pad_R->Divide(2,2);
426         pad_R->Draw();
427         
428         title0->Draw(); if(secondinput != ""){title1->Draw();}
429         
430         pad_R->cd(1);
431         pad_R->cd(1)->SetLogy(1);
432                 if(secondinput == ""){
433                                 DrawAutoGammaHisto( ESD_Conversion_R_input1, 
434                                                                  "Conversions R distribution","R [cm]",StandardYAxis,
435                                                                  kTRUE, 1.5,0.00001,
436                                                                  kFALSE,0. ,0,
437                                                                  kTRUE, 0.,180.);
438                 }else{
439                                 DrawAutoGammaHistos( ESD_Conversion_R_input1, 
440                                                                  ESD_Conversion_R_input2, 
441                                                                  "Conversions R distribution","R [cm]",StandardYAxis,
442                                                                  kTRUE, 1.5,0.00001,
443                                                                  kFALSE,0. ,0.,
444                                                                  kTRUE, 0.,180.);
445                 }
446                 for(Int_t i=0; i < 12 ; i++){
447                         DrawGammaLines(ArrayRbins[i], ArrayRbins[i], 0.00001,ESD_Conversion_R_input1->GetMaximum());
448                 }               
449                 DrawAliceLogo(right_up [0],right_up[1],right_up[2],right_up[3]);        
450                 
451         pad_R->cd(2);   
452                 if(secondinput == ""){
453                                 DrawAutoGammaHisto( ESD_Conversion_R_input1, 
454                                                                  "Conversions R distribution","R [cm]",StandardYAxis,
455                                                                  kFALSE, 1.5,0,
456                                                                  kFALSE,0. ,0.,
457                                                                  kTRUE, 0.,180.);
458                 }else{
459                                 DrawAutoGammaHistos( ESD_Conversion_R_input1, 
460                                                                  ESD_Conversion_R_input2, 
461                                                                  "Conversions R distribution","R [cm] ",StandardYAxis,
462                                                                  kFALSE, 1.5,0,
463                                                                  kFALSE,0. ,0.,
464                                                                  kTRUE, 0.,180.);
465                 }
466                 for(Int_t i=0; i < 12 ; i++){
467                         DrawGammaLines(ArrayRbins[i], ArrayRbins[i], 0.,ESD_Conversion_R_input1->GetMaximum());
468                 }
469
470                 DrawAliceLogo(right_up [0],right_up[1],right_up[2],right_up[3]);        
471
472         
473         //----------------------------- Integrated Radius -----------------------
474         pad_R->cd(3);
475         pad_R->cd(3)->SetLogy(1);
476                 if(secondinput == ""){
477                                 DrawAutoGammaHisto( ESD_Conversion_R_summed_input1, 
478                                                                  "Conversions R distribution","R [cm]","Integrated (0-to-R) #gamma candidates/event scaled by multiplicity",
479                                                                  kTRUE, 1.5,0.000001,
480                                                                  kFALSE,0. ,0.,
481                                                                  kTRUE, 0.,180.);
482                 }else{
483                                 DrawAutoGammaHistos( ESD_Conversion_R_summed_input1, 
484                                                                  ESD_Conversion_R_summed_input2, 
485                                                                  "Integrated Radius of Conversion","R [cm] ","Integrated (0-to-R) #gamma candidates/event scaled by multiplicity",
486                                                                  kTRUE, 1.5,0.000001,
487                                                                  kFALSE,0. ,0.,
488                                                                  kTRUE, 0.,180.);
489                 }
490                 DrawAliceLogo(right_down [0],right_down[1],right_down[2],right_down[3]);        
491                 
492         pad_R->cd(4);
493         pad_R->cd(4)->SetLogy(0);
494                 if(secondinput == ""){
495                                 DrawAutoGammaHisto( ESD_Conversion_R_summed_input1, 
496                                                                  "Conversions R distribution","R [cm]","Integrated (0-to-R) #gamma candidates/event scaled by multiplicity",
497                                                                  kTRUE, 1.5,0,
498                                                                  kFALSE,0. ,0.,
499                                                                  kTRUE, 0.,180.);
500                 }else{
501                                 DrawAutoGammaHistos( ESD_Conversion_R_summed_input1, 
502                                                                  ESD_Conversion_R_summed_input2, 
503                                                                  "Integrated Radius of Conversion","R [cm] ","Integrated (0-to-R) #gamma candidates/event scaled by multiplicity",
504                                                                  kTRUE, 1.5,0,
505                                                                  kFALSE,0. ,0.,
506                                                                  kTRUE, 0.,180.);
507                 }
508                 DrawAliceLogo(left_up [0],left_up[1],left_up[2],left_up[3]);    
509
510         pad_R->Update();
511
512         //--------------------------- Page 3  - Z-Distributions -----------------------------------------------
513         ps_mapping->NewPage();
514         
515         c_Z = new TCanvas("c_Z","",200,10,700,1000);  // gives the page size
516         
517         pad_Z = new TPad("pad_Z","",0.05,0.05,0.95,0.85,0);   // gives the size of the histo areas 
518         pad_Z->SetFillColor(0);
519         pad_Z->GetFrame()->SetFillColor(0);
520         pad_Z->SetBorderMode(0);
521         pad_Z->Divide(2,2);
522         pad_Z->Draw();
523         
524         title0->Draw(); if(secondinput != ""){title1->Draw();}
525         
526         pad_Z->cd(1);
527         pad_Z->cd(1)->SetLogy(1);
528                 if(secondinput == ""){
529                                 DrawAutoGammaHisto( ESD_Conversion_Z_input1
530                                                                  "Conversions Z distribution","Z [cm]",StandardYAxis,
531                                                                  kTRUE, 1.5,0.00001,
532                                                                  kFALSE,0. ,0,
533                                                                  kTRUE, -201.,201.);
534                 }else{
535                                 DrawAutoGammaHistos( ESD_Conversion_Z_input1, 
536                                                                  ESD_Conversion_Z_input2, 
537                                                                  "Conversions Z distribution","Z [cm] ",StandardYAxis,
538                                                                  kTRUE, 1.5,0.00001,
539                                                                  kFALSE,0. ,0.,
540                                                                  kTRUE, -201.,201.);
541                 }
542                 for(Int_t i=0; i < 12 ; i++){
543                         DrawGammaLines(ArrayZbins[i], ArrayZbins[i], 0.00001,ESD_Conversion_Z_input1->GetMaximum());
544                 }
545                 DrawAliceLogo(right_up [0],right_up[1],right_up[2],right_up[3]);        
546         pad_Z->cd(2);
547         pad_Z->cd(2)->SetLogy(0);
548                 if(secondinput == ""){
549                                 DrawAutoGammaHisto( ESD_Conversion_Z_input1
550                                                                  "Conversions Z distribution","Z [cm]",StandardYAxis,
551                                                                  kTRUE, 1.5,0.00001,
552                                                                  kFALSE,0. ,0,
553                                                                  kTRUE, -201.,201.);
554                 }else{
555                                 DrawAutoGammaHistos( ESD_Conversion_Z_input1, 
556                                                                  ESD_Conversion_Z_input2, 
557                                                                  "Conversions Z distribution","Z [cm] ",StandardYAxis,
558                                                                  kTRUE, 1.5,0.00001,
559                                                                  kFALSE,0. ,0.,
560                                                                  kTRUE, -201.,201.);
561                 }
562                 for(Int_t i=0; i < 12 ; i++){
563                         DrawGammaLines(ArrayZbins[i], ArrayZbins[i], 0.00001,ESD_Conversion_Z_input1->GetMaximum());
564                 }               
565                 DrawAliceLogo(right_up [0],right_up[1],right_up[2],right_up[3]);        
566
567         pad_Z->Update();
568
569         
570         // --------------------------------page 4 - 2 Dimensional Plots-----------------------------------              
571         
572         //hier
573         
574         ps_mapping->NewPage();
575         
576         c_2dims = new TCanvas("c_2dims","",200,10,700,1000);  // gives the page size
577
578         pad_2dims = new TPad("pad_2dims","",0.05,0.05,0.95,0.85,0);   // gives the size of the histo areas 
579         pad_2dims->SetFillColor(0);
580         pad_2dims->GetFrame()->SetFillColor(0);
581         pad_2dims->SetBorderMode(0);
582         pad_2dims->Divide(2,2);
583         pad_2dims->Draw();
584         
585         title0->Draw(); if(secondinput != ""){title1->Draw();}
586
587         pad_2dims->cd(1)->SetRightMargin(RightMargin);                          
588         pad_2dims->cd(1);
589         pad_2dims->cd(1)->SetLogz(1);           
590                         DrawAutoGammaHisto2D(   ESD_Conversion_ZR_input1,
591                                                                 "Conversion in ZR- input 1", "Z [cm]", "R [cm]", "Data",
592                                                                 kTRUE, 0., 200.,
593                                                                 kFALSE, 0., 20.);
594                         DrawAliceLogo(right_up2D [0],right_up2D[1],right_up2D[2],right_up2D[3]);
595         pad_2dims->cd(2)->SetRightMargin(RightMargin);                                     
596         pad_2dims->cd(2);
597         pad_2dims->cd(2)->SetLogz(1);   
598                         DrawAutoGammaHisto2D(   ESD_Conversion_XY_input1,
599                                                                 "Conversion in XY- input 1", "X [cm]", "Y [cm]", "Data",
600                                                                 kTRUE, -180., 180.,
601                                                                 kTRUE, -180., 180.);
602                         DrawAliceLogo(right_up2D [0],right_up2D[1],right_up2D[2],right_up2D[3]);
603         
604         if(secondinput != ""){
605                 pad_2dims->cd(3)->SetRightMargin(RightMargin);                          
606                 pad_2dims->cd(3);
607                 pad_2dims->cd(3)->SetLogz(1);   
608                         DrawAutoGammaHisto2D(   ESD_Conversion_ZR_input2,
609                                                                 "Conversion in ZR- input 2", "Z [cm]", "R [cm]", "MC",
610                                                                 kTRUE, 0., 200.,
611                                                                 kFALSE, 0., 20.);
612                         DrawAliceLogo(right_up2D [0],right_up2D[1],right_up2D[2],right_up2D[3]);
613                 pad_2dims->cd(4)->SetRightMargin(RightMargin);                          
614                 pad_2dims->cd(4);
615                 pad_2dims->cd(4)->SetLogz(1);   
616                         DrawAutoGammaHisto2D(   ESD_Conversion_XY_input2,
617                                                                 "Conversion in XY- input 2", "X [cm]", "Y [cm]", "MC",
618                                                                 kTRUE, -180., 180.,
619                                                                 kTRUE, -180., 180.);
620                         DrawAliceLogo(right_up2D [0],right_up2D[1],right_up2D[2],right_up2D[3]);
621         }       
622         
623         pad_2dims->Update();
624
625
626         // ----------------------------------- Page 5 - Phi in R -------------------------------------
627         ps_mapping->NewPage();
628
629         c_Phi_in_R = new TCanvas("c_Phi_in_R","",200,10,700,1000);  // gives the page size
630         
631         pad_Phi_in_R = new TPad("pad_Phi_in_R","",0.05,0.05,0.95,0.85,0);   // gives the size of the histo areas 
632         pad_Phi_in_R->SetFillColor(0);
633         pad_Phi_in_R->GetFrame()->SetFillColor(0);
634         pad_Phi_in_R->SetBorderMode(0);
635         pad_Phi_in_R->Divide(column,raw);
636         pad_Phi_in_R->Draw();
637         
638         title0->Draw();
639         if(secondinput != ""){
640                 title1->Draw();
641         }
642         
643         Double_t Integ_R_input1[NbinsR];        
644         Double_t Integ_R_input2[NbinsR];                        
645
646         for(Int_t iR = 0; iR < NbinsR; iR++){
647                 Int_t place = iR + 1;
648                 
649                 pad_Phi_in_R->cd(place);
650                 pad_Phi_in_R->cd(place)->SetLogy(1);
651                 sprintf(histoname_Phi_in_R_input1,"ESD_Conversion_Mapping_Phi_in_R_iR%02d",iR);
652                 if(secondinput == ""){          
653                         DrawAutoGammaHisto( ESD_Conversion_Mapping_Phi_in_R_input1[iR], 
654                                                                  histoname_Phi_in_R_input1,"#Phi",StandardYAxis,
655                                                                  kTRUE,3 ,0.000001,
656                                                                  kFALSE,0. ,0.,
657                                                                  kFALSE, 0.,180.);
658                 }else{
659                         DrawAutoGammaHistos( ESD_Conversion_Mapping_Phi_in_R_input1[iR], 
660                                                                  ESD_Conversion_Mapping_Phi_in_R_input2[iR], 
661                                                                  histoname_Phi_in_R_input1,"#Phi",StandardYAxis,
662                                                                  kTRUE,3 ,0.000001,
663                                                                  kFALSE,0. ,0.,
664                                                                  kFALSE, 0.,180.);
665                         Integ_R_input1[iR]=ESD_Conversion_Mapping_Phi_in_R_input1[iR]->Integral() ;                     
666                         Integ_R_input2[iR]=ESD_Conversion_Mapping_Phi_in_R_input2[iR]->Integral() ;     
667                 }       
668         }
669         pad_Phi_in_R->Update();
670         
671         //------------------------------ Page 6 - Ratio Phi in R --------------------------------------
672         if(secondinput != ""){  ps_mapping->NewPage();
673
674         c_Ratio_Phi_in_R = new TCanvas("c_Ratio_Phi_in_R","",200,10,700,1000);  // gives the page size
675         
676         pad_Ratio_Phi_in_R = new TPad("pad_Ratio_Phi_in_R","",0.05,0.05,0.95,0.85,0);   // gives the size of the histo areas 
677         pad_Ratio_Phi_in_R->SetFillColor(0);
678         pad_Ratio_Phi_in_R->GetFrame()->SetFillColor(0);
679         pad_Ratio_Phi_in_R->SetBorderMode(0);
680         pad_Ratio_Phi_in_R->Divide(column,raw);
681         pad_Ratio_Phi_in_R->Draw();
682         
683         title0->Draw();
684         if(secondinput != ""){
685                 title1->Draw();
686         }
687
688         for(Int_t iR = 0; iR < NbinsR; iR++){
689                 Int_t place = iR + 1;
690                 
691                 pad_Ratio_Phi_in_R->cd(place);
692                 pad_Ratio_Phi_in_R->cd(place)->SetLogy(1);
693                 sprintf(histoname_Ratio_Phi_in_R_input2,"Ratio_Phi_in_R_iR%02d",iR);
694                 if(secondinput != ""){          
695                         DrawRatioGammaHisto(    Ratio_Mapping_Phi_in_R[iR], 
696                                                                  histoname_Ratio_Phi_in_R_input2,"#Phi","norm Data/norm MC",
697                                                                  kFALSE,3 ,0.000001,
698                                                                  kTRUE,0.1 ,5.,
699                                                                  kFALSE, 0.,180.);
700                         linePhi->Draw("same");
701                 }       
702         }
703         pad_Ratio_Phi_in_R->Update();
704 }
705
706
707         //--------------- page 7 - Z in R ---------------------------------------------------
708         
709         ps_mapping->NewPage();
710         
711         c_Z_in_R = new TCanvas("c_Z_in_R","",200,10,700,1000);  // gives the page size
712         
713         pad_Z_in_R = new TPad("pad_Z_in_R","",0.05,0.05,0.95,0.85,0);   // gives the size of the histo areas 
714         pad_Z_in_R->SetFillColor(0);
715         pad_Z_in_R->GetFrame()->SetFillColor(0);
716         pad_Z_in_R->SetBorderMode(0);
717         pad_Z_in_R->Divide(column,raw);
718         pad_Z_in_R->Draw();
719         
720         title0->Draw(); 
721         if(secondinput != ""){title1->Draw();}
722         
723         Double_t Integ_ZinR_input1[NbinsR];     
724         Double_t Integ_ZinR_input2[NbinsR];                     
725         
726         
727         for(Int_t iR = 0; iR < NbinsR; iR++){
728                 Int_t place = iR + 1;
729                 pad_Z_in_R->cd(place);
730                 pad_Z_in_R->cd(place)->SetLogy(1);
731                 sprintf(histoname_Z_in_R_input1,"ESD_Conversion_Mapping_Z_in_R_iR%02d",iR);
732                 if(secondinput == ""){          
733                         DrawAutoGammaHisto( ESD_Conversion_Mapping_Z_in_R_input1[iR], 
734                                                                  histoname_Z_in_R_input1,"Z [cm]",StandardYAxis,
735                                                                  kTRUE,3 ,0.00001,
736                                                                  kFALSE,0. ,0.,
737                                                                  kFALSE, 0.,180.);
738                 }else{
739                         DrawAutoGammaHistos( ESD_Conversion_Mapping_Z_in_R_input1[iR], 
740                                                                  ESD_Conversion_Mapping_Z_in_R_input2[iR], 
741                                                                  histoname_Z_in_R_input1,"Z [cm]",StandardYAxis,
742                                                                  kTRUE,3 ,0.00001,
743                                                                  kFALSE,0. ,0.,
744                                                                  kFALSE, 0.,180.);
745                         Integ_ZinR_input1[iR]=ESD_Conversion_Mapping_Z_in_R_input1[iR]->Integral() ;                    
746                         Integ_ZinR_input2[iR]=ESD_Conversion_Mapping_Z_in_R_input2[iR]->Integral() ;    
747                 }       
748         }
749         
750         pad_Z_in_R->Update();
751         
752         //------------------------------ Page 8 - Ratio Z in R --------------------------------------
753         if(secondinput != ""){  ps_mapping->NewPage();
754
755         c_Ratio_Z_in_R = new TCanvas("c_Ratio_Z_in_R","",200,10,700,1000);  // gives the page size
756         
757         pad_Ratio_Z_in_R = new TPad("pad_Ratio_Z_in_R","",0.05,0.05,0.95,0.85,0);   // gives the size of the histo areas 
758         pad_Ratio_Z_in_R->SetFillColor(0);
759         pad_Ratio_Z_in_R->GetFrame()->SetFillColor(0);
760         pad_Ratio_Z_in_R->SetBorderMode(0);
761         pad_Ratio_Z_in_R->Divide(column,raw);
762         pad_Ratio_Z_in_R->Draw();
763         
764         title0->Draw();
765         if(secondinput != ""){
766                 title1->Draw();
767         }
768
769         for(Int_t iR = 0; iR < NbinsR; iR++){
770                 Int_t place = iR + 1;
771                 
772                 pad_Ratio_Z_in_R->cd(place);
773                 pad_Ratio_Z_in_R->cd(place)->SetLogy(1);
774                 sprintf(histoname_Ratio_Z_in_R_input2,"Ratio_Z_in_R_iR%02d",iR);
775                 if(secondinput != ""){          
776                         Float_t ZRange = RangeZinR[iR];
777                         DrawRatioGammaHisto( Ratio_Mapping_Z_in_R[iR], 
778                                                                  histoname_Ratio_Z_in_R_input2,"Z","norm Data/norm MC",
779                                                                  kFALSE,3 ,0.000001,
780                                                                  kTRUE,0.1 ,5.,
781                                                                  kTRUE, -ZRange,ZRange);
782                         DrawGammaLines(-ZRange,ZRange,1,1);
783                 }       
784         }
785
786         pad_Ratio_Z_in_R->Update();
787 }
788
789
790
791         //---------page 9 - Phi in Z --------------------------------   
792         
793         ps_mapping->NewPage();
794         
795         
796         c_Phi_in_Z = new TCanvas("c_Phi_in_Z","",200,10,700,1000);  // gives the page size
797         
798         pad_Phi_in_Z = new TPad("pad_Phi_in_Z","",0.05,0.05,0.95,0.85,0);   // gives the size of the histo areas 
799         pad_Phi_in_Z->SetFillColor(0);
800         pad_Phi_in_Z->GetFrame()->SetFillColor(0);
801         pad_Phi_in_Z->SetBorderMode(0);
802         pad_Phi_in_Z->Divide(column,raw);
803         pad_Phi_in_Z->Draw();
804         
805         title0->Draw(); if(secondinput != ""){title1->Draw();}
806         
807         Double_t Integ_Z_input1[NbinsZ];        
808         Double_t Integ_Z_input2[NbinsZ];                        
809         
810         for(Int_t iZ = 0; iZ < NbinsZ; iZ++){
811                 Int_t place = iZ + 1;
812                 pad_Phi_in_Z->cd(place);
813                 pad_Phi_in_Z->cd(place)->SetLogy(1);
814                 sprintf(histoname_Phi_in_Z_input1,"ESD_Conversion_Mapping_Phi_in_Z_iZ%02d",iZ);
815                 if(secondinput == ""){          
816                         DrawAutoGammaHisto( ESD_Conversion_Mapping_Phi_in_Z_input1[iZ], 
817                                                                  histoname_Phi_in_Z_input1,"#Phi",StandardYAxis,
818                                                                  kTRUE,3 ,0.000001,
819                                                                  kFALSE,0. ,0.,
820                                                                  kFALSE, 0.,180.);
821                 }else{
822                         DrawAutoGammaHistos( ESD_Conversion_Mapping_Phi_in_Z_input1[iZ], 
823                                                                  ESD_Conversion_Mapping_Phi_in_Z_input2[iZ], 
824                                                                  histoname_Phi_in_Z_input1,"#Phi",StandardYAxis,
825                                                                  kTRUE,3 ,0.000001,
826                                                                  kFALSE,0. ,0.,
827                                                                  kFALSE, 0.,180.);
828                         Integ_Z_input1[iZ]=ESD_Conversion_Mapping_Phi_in_Z_input1[iZ]->Integral() ;                     
829                         Integ_Z_input2[iZ]=ESD_Conversion_Mapping_Phi_in_Z_input2[iZ]->Integral() ;     
830                 }       
831         }
832         
833         pad_Phi_in_Z->Update();
834
835         //------------------------------------- Page 10 - Ratio Phi in Z -----------------------------------    
836
837         if(secondinput != ""){  ps_mapping->NewPage();
838
839         c_Ratio_Phi_in_Z = new TCanvas("c_Ratio_Phi_in_Z","",200,10,700,1000);  // gives the page size
840         
841         pad_Ratio_Phi_in_Z = new TPad("pad_Ratio_Phi_in_Z","",0.05,0.05,0.95,0.85,0);   // gives the size of the histo areas 
842         pad_Ratio_Phi_in_Z->SetFillColor(0);
843         pad_Ratio_Phi_in_Z->GetFrame()->SetFillColor(0);
844         pad_Ratio_Phi_in_Z->SetBorderMode(0);
845         pad_Ratio_Phi_in_Z->Divide(column,raw);
846         pad_Ratio_Phi_in_Z->Draw();
847         
848         title0->Draw();
849         if(secondinput != ""){
850                 title1->Draw();
851         }
852
853         for(Int_t iZ = 0; iZ < NbinsZ; iZ++){
854                 Int_t place = iZ + 1;
855                 
856                 pad_Ratio_Phi_in_Z->cd(place);
857                 pad_Ratio_Phi_in_Z->cd(place)->SetLogy(1);
858                 sprintf(histoname_Ratio_Phi_in_Z_input2,"Ratio_Phi_in_Z_iZ%02d",iZ);
859                 if(secondinput != ""){          
860                         DrawRatioGammaHisto( Ratio_Mapping_Phi_in_Z[iZ], 
861                                                                  histoname_Ratio_Phi_in_Z_input2,"#Phi","norm Data/norm MC",
862                                                                  kFALSE,3 ,0.000001,
863                                                                  kTRUE,0.1 ,5.,
864                                                                  kFALSE, 0,0);
865                         linePhi->Draw("same");
866                 }       
867         }
868
869         pad_Ratio_Phi_in_Z->Update();
870 }
871
872         //---------------page 11 - R in Z ---------------------------------------------------
873         
874         ps_mapping->NewPage();
875         
876         c_R_in_Z = new TCanvas("c_R_in_Z","",200,10,700,1000);  // gives the page size
877         
878         pad_R_in_Z = new TPad("pad_R_in_Z","",0.05,0.05,0.95,0.85,0);   // gives the size of the histo areas 
879         pad_R_in_Z->SetFillColor(0);
880         pad_R_in_Z->GetFrame()->SetFillColor(0);
881         pad_R_in_Z->SetBorderMode(0);
882         pad_R_in_Z->Divide(column,raw);
883         pad_R_in_Z->Draw();
884         
885         title0->Draw(); if(secondinput != ""){title1->Draw();}
886         
887         Double_t Integ_RinZ_input1[NbinsZ];     
888         Double_t Integ_RinZ_input2[NbinsZ];                     
889
890         for(Int_t iZ = 0; iZ < NbinsZ; iZ++){
891                 Int_t place = iZ + 1;
892                 pad_R_in_Z->cd(place);
893                 pad_R_in_Z->cd(place)->SetLogy(1);
894                 sprintf(histoname_R_in_Z_input1,"ESD_Conversion_Mapping_R_in_Z_iZ%02d",iZ);
895                 if(secondinput == ""){          
896                         DrawAutoGammaHisto( ESD_Conversion_Mapping_R_in_Z_input1[iZ], 
897                                                                  histoname_R_in_Z_input1,"R [cm]",StandardYAxis,
898                                                                  kTRUE,3 ,0.000001,
899                                                                  kFALSE,0. ,0.,
900                                                                  kFALSE, 0.,180.);
901                 }else{
902                         DrawAutoGammaHistos( ESD_Conversion_Mapping_R_in_Z_input1[iZ], 
903                                                                  ESD_Conversion_Mapping_R_in_Z_input2[iZ], 
904                                                                  histoname_R_in_Z_input1,"R [cm]",StandardYAxis,
905                                                                  kTRUE,3 ,0.000001,
906                                                                  kFALSE,0. ,0.,
907                                                                  kFALSE, 0.,180.);
908                         Integ_RinZ_input1[iZ]=ESD_Conversion_Mapping_R_in_Z_input1[iZ]->Integral() ;                    
909                         Integ_RinZ_input2[iZ]=ESD_Conversion_Mapping_R_in_Z_input2[iZ]->Integral() ;    
910                 }       
911         }
912         pad_R_in_Z->Update();
913         
914         //------------------------------ Page 12 - Ratio R in Z --------------------------------------
915         if(secondinput != ""){  ps_mapping->NewPage();
916
917         c_Ratio_R_in_Z = new TCanvas("c_Ratio_R_in_Z","",200,10,700,1000);  // gives the page size
918         
919         pad_Ratio_R_in_Z = new TPad("pad_Ratio_R_in_Z","",0.05,0.05,0.95,0.85,0);   // gives the size of the histo areas 
920         pad_Ratio_R_in_Z->SetFillColor(0);
921         pad_Ratio_R_in_Z->GetFrame()->SetFillColor(0);
922         pad_Ratio_R_in_Z->SetBorderMode(0);
923         pad_Ratio_R_in_Z->Divide(column,raw);
924         pad_Ratio_R_in_Z->Draw();
925         
926         title0->Draw();
927         if(secondinput != ""){
928                 title1->Draw();
929         }
930
931         for(Int_t iZ = 0; iZ < NbinsZ; iZ++){
932                 Int_t place = iZ + 1;
933                 
934                 pad_Ratio_R_in_Z->cd(place);
935                 pad_Ratio_R_in_Z->cd(place)->SetLogy(1);
936                 sprintf(histoname_Ratio_R_in_Z_input2,"Ratio_R_in_Z_iZ%02d",iZ);
937                 if(secondinput != ""){          
938                         DrawRatioGammaHisto( Ratio_Mapping_R_in_Z[iZ], 
939                                                                  histoname_Ratio_R_in_Z_input2,"R [cm]","norm Data/norm MC",
940                                                                  kFALSE,3 ,0.000001,
941                                                                  kTRUE,0.1 ,5.,
942                                                                  kFALSE, 0,0);
943                         lineR->Draw("same");
944                 }       
945         }
946         
947         pad_Ratio_R_in_Z->Update();
948 }       
949
950         // --------------------page 13 - MidPt Phi in R-------------------------------------------------------------
951         
952         
953         ps_mapping->NewPage();
954         
955         
956         c_MidPt_Phi_in_R = new TCanvas("c_MidPt_Phi_in_R","",200,10,700,1000);  // gives the page size
957
958         pad_MidPt_Phi_in_R = new TPad("pad_MidPt_Phi_in_R","",0.05,0.05,0.95,0.85,0);   // gives the size of the histo areas 
959         pad_MidPt_Phi_in_R->SetFillColor(0);
960         pad_MidPt_Phi_in_R->GetFrame()->SetFillColor(0);
961         pad_MidPt_Phi_in_R->SetBorderMode(0);
962         pad_MidPt_Phi_in_R->Divide(column,raw);
963         pad_MidPt_Phi_in_R->Draw();
964         
965         title0->Draw(); if(secondinput != ""){title1->Draw();}
966
967         Double_t Integ_midpt_R_input1[NbinsR];  
968         Double_t Integ_midpt_R_input2[NbinsR];                  
969         
970         for(Int_t iR = 0; iR < NbinsR; iR++){
971                 Int_t place = iR + 1;
972                 pad_MidPt_Phi_in_R->cd(place);
973                 pad_MidPt_Phi_in_R->cd(place)->SetLogy(1);
974                 sprintf(histoname_MidPt_Phi_in_R_input1,"ESD_Conversion_Mapping_MidPt_Phi_in_R_iR%02d",iR);
975                 if(secondinput == ""){          
976                         DrawAutoGammaHisto( ESD_Conversion_Mapping_MidPt_Phi_in_R_input1[iR], 
977                                                                  histoname_MidPt_Phi_in_R_input1,"#Phi",StandardYAxis,
978                                                                  kTRUE,3 ,0.000001,
979                                                                  kFALSE,0. ,0.,
980                                                                  kFALSE, 0.,180.);
981                 }else{
982                         DrawAutoGammaHistos(ESD_Conversion_Mapping_MidPt_Phi_in_R_input1[iR], 
983                                                         ESD_Conversion_Mapping_MidPt_Phi_in_R_input2[iR], 
984                                                                  histoname_MidPt_Phi_in_Z_input1,"#Phi",StandardYAxis,
985                                                                  kTRUE,3 ,0.000001,
986                                                                  kFALSE,0. ,0.,
987                                                                  kFALSE, 0.,180.);
988                         Integ_midpt_R_input1[iR]=ESD_Conversion_Mapping_MidPt_Phi_in_R_input1[iR]->Integral() ;                 
989                         Integ_midpt_R_input2[iR]=ESD_Conversion_Mapping_MidPt_Phi_in_R_input2[iR]->Integral() ; 
990                 }       
991         }
992         
993         pad_MidPt_Phi_in_R->Update();
994         
995         //---------------------------page 14 - MidPt Z in R ---------------------------------------
996         
997         ps_mapping->NewPage();
998         
999         c_midpt_Z_in_R = new TCanvas("c_midpt_Z_in_R","",200,10,700,1000);  // gives the page size
1000         
1001         pad_midpt_Z_in_R = new TPad("pad_midpt_Z_in_R","",0.05,0.05,0.95,0.85,0);   // gives the size of the histo areas 
1002         pad_midpt_Z_in_R->SetFillColor(0);
1003         pad_midpt_Z_in_R->GetFrame()->SetFillColor(0);
1004         pad_midpt_Z_in_R->SetBorderMode(0);
1005         pad_midpt_Z_in_R->Divide(column,raw);
1006         pad_midpt_Z_in_R->Draw();
1007         
1008         title0->Draw(); if(secondinput != ""){title1->Draw();}
1009         
1010         Double_t Integ_midpt_ZinR_input1[NbinsR];       
1011         Double_t Integ_midpt_ZinR_input2[NbinsR];                       
1012         
1013         
1014
1015         for(Int_t iR = 0; iR < NbinsR; iR++){
1016                 Int_t place = iR + 1;
1017                 pad_midpt_Z_in_R->cd(place);
1018                 pad_midpt_Z_in_R->cd(place)->SetLogy(1);
1019                 sprintf(histoname_MidPt_Z_in_R_input1,"ESD_Conversion_Mapping_MidPt_Z_in_R_iR%02d",iR);
1020                 if(secondinput == ""){          
1021                         DrawAutoGammaHisto( ESD_Conversion_Mapping_MidPt_Z_in_R_input1[iR], 
1022                                                                  histoname_MidPt_Z_in_R_input1,"Z [cm]",StandardYAxis,
1023                                                                  kTRUE,3 ,0.000001,
1024                                                                  kFALSE,0. ,0.,
1025                                                                  kFALSE, 0.,180.);
1026                 }else{
1027                         DrawAutoGammaHistos(ESD_Conversion_Mapping_MidPt_Z_in_R_input1[iR], 
1028                                                         ESD_Conversion_Mapping_MidPt_Z_in_R_input2[iR], 
1029                                                                  histoname_MidPt_Z_in_R_input1,"Z [cm]",StandardYAxis,
1030                                                                  kTRUE,3 ,0.000001,
1031                                                                  kFALSE,0. ,0.,
1032                                                                  kFALSE, 0.,180.);
1033                         Integ_midpt_ZinR_input1[iR]=ESD_Conversion_Mapping_MidPt_Z_in_R_input1[iR]->Integral() ;                        
1034                         Integ_midpt_ZinR_input2[iR]=ESD_Conversion_Mapping_MidPt_Z_in_R_input2[iR]->Integral() ;        
1035                 }       
1036         }
1037
1038         pad_midpt_Z_in_R->Update();
1039
1040         
1041         //---------------------page 15 - MidPt Phi in Z--------------------     
1042         
1043         if(!SinglePlots)ps_mapping->NewPage();
1044         
1045         
1046         c_MidPt_Phi_in_Z = new TCanvas("c_MidPt_Phi_in_Z","",200,10,700,1000);  // gives the page size
1047         
1048         pad_MidPt_Phi_in_Z = new TPad("pad_MidPt_Phi_in_Z","",0.05,0.05,0.95,0.85,0);   // gives the size of the histo areas 
1049         pad_MidPt_Phi_in_Z->SetFillColor(0);
1050         pad_MidPt_Phi_in_Z->GetFrame()->SetFillColor(0);
1051         pad_MidPt_Phi_in_Z->SetBorderMode(0);
1052         pad_MidPt_Phi_in_Z->Divide(column,raw);
1053         pad_MidPt_Phi_in_Z->Draw();
1054         
1055         title0->Draw(); if(secondinput != ""){title1->Draw();}
1056         
1057         Double_t Integ_midpt_Z_input1[NbinsZ];  
1058         Double_t Integ_midpt_Z_input2[NbinsZ];                  
1059         
1060         for(Int_t iZ = 0; iZ < NbinsZ; iZ++){
1061                 Int_t place = iZ + 1;
1062                 pad_MidPt_Phi_in_Z->cd(place);
1063                 pad_MidPt_Phi_in_Z->cd(place)->SetLogy(1);
1064                 sprintf(histoname_MidPt_Phi_in_Z_input1,"ESD_Conversion_Mapping_MidPt_Phi_in_Z_iR%02d",iR);
1065                 if(secondinput == ""){          
1066                         DrawAutoGammaHisto( ESD_Conversion_Mapping_MidPt_Phi_in_Z_input1[iZ], 
1067                                                                  histoname_MidPt_Phi_in_Z_input1,"#Phi",StandardYAxis,
1068                                                                  kTRUE,3 ,0.000001,
1069                                                                  kFALSE,0. ,0.,
1070                                                                  kFALSE, 0.,180.);
1071                 }else{
1072                         DrawAutoGammaHistos(ESD_Conversion_Mapping_MidPt_Phi_in_Z_input1[iZ], 
1073                                                         ESD_Conversion_Mapping_MidPt_Phi_in_Z_input2[iZ], 
1074                                                                  histoname_MidPt_Phi_in_Z_input1,"#Phi",StandardYAxis,
1075                                                                  kTRUE,3 ,0.000001,
1076                                                                  kFALSE,0. ,0.,
1077                                                                  kFALSE, 0.,180.);
1078                         Integ_midpt_Z_input1[iZ]=ESD_Conversion_Mapping_MidPt_Phi_in_Z_input1[iZ]->Integral() ;                 
1079                         Integ_midpt_Z_input2[iZ]=ESD_Conversion_Mapping_MidPt_Phi_in_Z_input2[iZ]->Integral() ; 
1080                 }       
1081         }
1082         pad_MidPt_Phi_in_Z->Update();
1083         
1084         //---------------------------page 16 - MidPt R in Z ---------------------------------------
1085         
1086         if(!SinglePlots)ps_mapping->NewPage();
1087         
1088         c_MidPt_R_in_Z = new TCanvas("c_MidPt_R_in_Z","",200,10,700,1000);  // gives the page size
1089         
1090         pad_MidPt_R_in_Z = new TPad("pad_MidPt_R_in_Z","",0.05,0.05,0.95,0.85,0);   // gives the size of the histo areas 
1091         pad_MidPt_R_in_Z->SetFillColor(0);
1092         pad_MidPt_R_in_Z->GetFrame()->SetFillColor(0);
1093         pad_MidPt_R_in_Z->SetBorderMode(0);
1094         pad_MidPt_R_in_Z->Divide(column,raw);
1095         pad_MidPt_R_in_Z->Draw();
1096         
1097         title0->Draw(); if(secondinput != ""){title1->Draw();}
1098         
1099         Double_t Integ_midpt_RinZ_input1[NbinsZ];       
1100         Double_t Integ_midpt_RinZ_input2[NbinsZ];                       
1101
1102         for(Int_t iZ = 0; iZ < NbinsZ; iZ++){
1103                 Int_t place = iZ + 1;
1104                 pad_MidPt_R_in_Z->cd(place);
1105                 pad_MidPt_R_in_Z->cd(place)->SetLogy(1);
1106                 sprintf(histoname_MidPt_R_in_Z_input1,"ESD_Conversion_Mapping_MidPt_R_in_Z_iR%02d",iR);
1107                 if(secondinput == ""){          
1108                         DrawAutoGammaHisto( ESD_Conversion_Mapping_MidPt_R_in_Z_input1[iZ], 
1109                                                                  histoname_MidPt_R_in_Z_input1,"R [cm]",StandardYAxis,
1110                                                                  kTRUE,3 ,0.000001,
1111                                                                  kFALSE,0. ,0.,
1112                                                                  kFALSE, 0.,180.);
1113                 }else{
1114                         DrawAutoGammaHistos(ESD_Conversion_Mapping_MidPt_R_in_Z_input1[iZ], 
1115                                                         ESD_Conversion_Mapping_MidPt_R_in_Z_input2[iZ], 
1116                                                                  histoname_MidPt_R_in_Z_input1,"R [cm]",StandardYAxis,
1117                                                                  kTRUE,3 ,0.000001,
1118                                                                  kFALSE,0. ,0.,
1119                                                                  kFALSE, 0.,180.);
1120                         Integ_midpt_RinZ_input1[iZ]=ESD_Conversion_Mapping_MidPt_R_in_Z_input1[iZ]->Integral() ;                        
1121                         Integ_midpt_RinZ_input2[iZ]=ESD_Conversion_Mapping_MidPt_R_in_Z_input2[iZ]->Integral() ;        
1122                 }       
1123         }
1124         pad_MidPt_R_in_Z->Update();
1125         
1126            if(secondinput != ""){
1127                 Double_t Sum_phi_in_R_input1 = 0., Sum_phi_in_Z_input1 =0., Sum_midpt_phi_in_R_input1 = 0., Sum_midpt_phi_in_Z_input1= 0.;
1128                 Double_t Sum_phi_in_R_input2 = 0., Sum_phi_in_Z_input2 =0., Sum_midpt_phi_in_R_input2 = 0., Sum_midpt_phi_in_Z_input2= 0.;
1129                 Double_t Sum_Z_in_R_input1 = 0., Sum_R_in_Z_input1 =0., Sum_midpt_Z_in_R_input1 = 0., Sum_midpt_R_in_Z_input1= 0.;
1130                 Double_t Sum_Z_in_R_input2 = 0., Sum_R_in_Z_input2 =0., Sum_midpt_Z_in_R_input2 = 0., Sum_midpt_R_in_Z_input2= 0.;
1131                 
1132                 for(Int_t iR = 0; iR < NbinsR; iR++){
1133                         Sum_phi_in_R_input1 = Sum_phi_in_R_input1 + Integ_R_input1[iR];
1134                         Sum_phi_in_R_input2 = Sum_phi_in_R_input2 + Integ_R_input2[iR];
1135                         Sum_midpt_phi_in_R_input1 = Sum_midpt_phi_in_R_input1 + Integ_midpt_R_input1[iR];
1136                         Sum_midpt_phi_in_R_input2 = Sum_midpt_phi_in_R_input2 + Integ_midpt_R_input2[iR];
1137                         Sum_Z_in_R_input1 = Sum_Z_in_R_input1 + Integ_ZinR_input1[iR];
1138                         Sum_Z_in_R_input2 = Sum_Z_in_R_input2 + Integ_ZinR_input2[iR];
1139                         Sum_midpt_Z_in_R_input1 = Sum_midpt_Z_in_R_input1 + Integ_midpt_ZinR_input1[iR];
1140                         Sum_midpt_Z_in_R_input2 = Sum_midpt_Z_in_R_input2 + Integ_midpt_ZinR_input2[iR];
1141                                 
1142                 }
1143                 for(Int_t iZ = 0; iZ < NbinsZ; iZ++){
1144                         Sum_phi_in_Z_input1 = Sum_phi_in_Z_input1 + Integ_Z_input1[iZ];
1145                         Sum_phi_in_Z_input2 = Sum_phi_in_Z_input2 + Integ_Z_input2[iZ];
1146                         Sum_midpt_phi_in_Z_input1 = Sum_midpt_phi_in_Z_input1 + Integ_midpt_Z_input1[iZ];
1147                         Sum_midpt_phi_in_Z_input2 = Sum_midpt_phi_in_Z_input2 + Integ_midpt_Z_input2[iZ];
1148                         Sum_R_in_Z_input1 = Sum_R_in_Z_input1 + Integ_RinZ_input1[iZ];
1149                         Sum_R_in_Z_input2 = Sum_R_in_Z_input2 + Integ_RinZ_input2[iZ];
1150                         Sum_midpt_R_in_Z_input1 = Sum_midpt_R_in_Z_input1 + Integ_midpt_RinZ_input1[iZ];
1151                         Sum_midpt_R_in_Z_input2 = Sum_midpt_R_in_Z_input2 + Integ_midpt_RinZ_input2[iZ];
1152                 }
1153                                         
1154                 const char *outlname = "Export_Mapping.dat";
1155                 fstream outl;
1156                 outl.open(outlname, ios::out);
1157                 outl << "#Calculating Integrals" << endl;       
1158                 outl << "------------------------------------------------------------------------------------------" << endl;
1159                 outl << "# This file is created to display the Integrals of the different bins of the different diagrams. The forth column displays the Integral over the input1 in that bin divided by the sum over all bins of input1, the same does the sixth column for input2. The eigth column displays the difference of input1 - input2 divided by input2 of that bin. Therefore you should put the data in the first input and the Montecarlo in the second." << endl;
1160                 outl << "------------------------------------------------------------------------------------------" << endl;
1161
1162                 outl << "input1 :\t" << input1  << endl;
1163                 outl << "input2 :\t" << secondinput << endl;
1164                 outl << "------------------------------------------------------------------------------------------" << endl;
1165                 outl << endl;
1166                 outl << "\t input1 \t input2 " << endl;
1167                 outl << "Number of events" << "\t" << nGoodEvents_input1 << "\t" << nGoodEvents_input2 << endl;
1168                 outl << "Number of triggers" << "\t" << nGoodTrig_input1 << "\t" << nGoodTrig_input2 << endl;
1169                 outl << "Number reconstructed gammas"<< "\t" << nRecGamma_input1 << "\t" << nRecGamma_input2 <<endl;
1170                 outl << "Mean Multiplicity" << "\t" <<  mean_input1 << "\t" << mean_input2 << endl;
1171                 outl << endl;
1172                 outl << endl;
1173
1174                 outl << "------------------------------------------------------------------------------------------" << endl;           
1175                 outl << "graph \t bin \t Input1 \t % \t Input2 \t % \t Input1-Input2 \t %" <<endl;
1176
1177
1178                 outl << "Phi in R" <<endl;
1179                 outl <<"\t0\t" << Integ_R_input1[0] << "\t" << Integ_R_input1[0]/Sum_phi_in_R_input1 * 100 <<"\t" << Integ_R_input2[0] << "\t" << Integ_R_input2[0]/Sum_phi_in_R_input2 * 100 << "\t" << Integ_R_input1[0]- Integ_R_input2[0] << "\t" << (Integ_R_input1[0]- Integ_R_input2[0])/Integ_R_input2[0] *100 << endl;         
1180                 for(Int_t iR = 1; iR < NbinsR; iR++){
1181                         outl << "\t" << iR << "\t" << Integ_R_input1[iR] << "\t" << Integ_R_input1[iR]/Sum_phi_in_R_input1 * 100 <<"\t" << Integ_R_input2[iR] << "\t" << Integ_R_input2[iR]/Sum_phi_in_R_input2 * 100 << "\t" << Integ_R_input1[iR]- Integ_R_input2[iR] << "\t" << (Integ_R_input1[iR]- Integ_R_input2[iR])/Integ_R_input2[iR]* 100 << endl;
1182                 }
1183                 outl << "\t" << "sum" << "\t" << ESD_Conversion_R_input1->Integral() << "\t" << "100" << "\t" << ESD_Conversion_R_input2->Integral() << "\t" << "100" <<"\t" << ESD_Conversion_R_input1->Integral() - ESD_Conversion_R_input2->Integral() << "\t" << (ESD_Conversion_R_input1->Integral()-ESD_Conversion_R_input2->Integral())/ESD_Conversion_R_input2->Integral() *100 << endl;
1184                 outl << endl;
1185
1186                 outl << "Phi in Z" <<endl;
1187 //              outl <<"\t0\t" << Integ_Z_input1[0] << "\t"<< Integ_Z_input1[0]/Sum_phi_in_Z_input1 * 100 <<"\t" << Integ_Z_input2[0] << "\t" << Integ_Z_input2[0]/Sum_phi_in_Z_input2 * 100 << "\t" << Integ_Z_input1[0]- Integ_Z_input2[0] << "\t" << (Integ_Z_input1[0]- Integ_Z_input2[0])/Integ_Z_input2[0] * 100 << endl;
1188                 for(Int_t iZ = 1; iZ < NbinsZ; iZ++){
1189                         outl << "\t" << iZ<< "\t" << Integ_Z_input1[iZ] << "\t" << Integ_Z_input1[iZ]/Sum_phi_in_Z_input1 * 100 <<"\t" << Integ_Z_input2[iZ] << "\t" << Integ_Z_input2[iZ]/Sum_phi_in_Z_input2 * 100 << "\t" << Integ_Z_input1[iZ]- Integ_Z_input2[iZ] << "\t" << (Integ_Z_input1[iZ]- Integ_Z_input2[iZ])/Integ_Z_input2[iZ]*100 << endl;
1190                 }
1191                 outl << "\t" << "sum" << "\t" << ESD_Conversion_Z_input1->Integral() << "\t" << "100" << "\t" << ESD_Conversion_Z_input2->Integral() << "\t" << "100" <<"\t" << ESD_Conversion_Z_input1->Integral() - ESD_Conversion_Z_input2->Integral() << "\t" << (ESD_Conversion_Z_input1->Integral()-ESD_Conversion_Z_input2->Integral())/ESD_Conversion_Z_input2->Integral() *100 << endl;
1192                 outl << endl;
1193         
1194                 outl << "MidPt Phi in R" <<endl;
1195                 outl <<" \t0\t" << Integ_midpt_R_input1[0] << "\t" << Integ_midpt_R_input1[0]/Sum_midpt_phi_in_R_input1 * 100 <<"\t" << Integ_midpt_R_input2[0] << "\t" << Integ_midpt_R_input2[0]/Sum_midpt_phi_in_R_input2 * 100 << "\t" << Integ_midpt_R_input1[0]- Integ_midpt_R_input2[0] << "\t" << (Integ_midpt_R_input1[0]- Integ_midpt_R_input2[0])/Integ_midpt_R_input2[0]*100 << endl;       
1196                 for(Int_t iR = 1; iR < NbinsR; iR++){
1197                         outl << "\t" << iR << "\t" << Integ_midpt_R_input1[iR] << "\t" << Integ_midpt_R_input1[iR]/Sum_midpt_phi_in_R_input1 * 100 <<"\t" << Integ_midpt_R_input2[iR] << "\t" << Integ_midpt_R_input2[iR]/Sum_midpt_phi_in_R_input2 * 100 << "\t" << Integ_midpt_R_input1[iR]- Integ_midpt_R_input2[iR] << "\t" << (Integ_midpt_R_input1[iR]- Integ_midpt_R_input2[iR])/Integ_midpt_R_input2[iR] *100 << endl;
1198                 }
1199                 outl << "\t" << "sum" << "\t" << Sum_midpt_phi_in_R_input1 << "\t" << "100" << "\t" << Sum_midpt_phi_in_R_input2 << "\t" << "100" <<"\t" << Sum_midpt_phi_in_R_input1 - Sum_midpt_phi_in_R_input2 << "\t" << (Sum_midpt_phi_in_R_input1-Sum_midpt_phi_in_R_input2)/Sum_midpt_phi_in_R_input2 *100 << endl;
1200         
1201                 outl << endl;
1202
1203                 outl << "MidPt Phi in Z" <<endl;
1204 //              outl <<" \t0\t" << Integ_midpt_Z_input1[0] << "\t"<< Integ_midpt_Z_input1[0]/Sum_midpt_phi_in_Z_input1 * 100 <<"\t" << Integ_midpt_Z_input2[0] << "\t" << Integ_midpt_Z_input2[0]/Sum_midpt_phi_in_Z_input2 * 100 << "\t" << Integ_midpt_Z_input1[0]- Integ_midpt_Z_input2[0] << "\t" << (Integ_midpt_Z_input1[0]- Integ_midpt_Z_input2[0])/Integ_midpt_Z_input2[0] *100<< endl;
1205                 for(Int_t iZ = 1; iZ < NbinsZ; iZ++){
1206                         outl << "\t" << iZ << "\t" << Integ_midpt_Z_input1[iZ] << "\t" << Integ_midpt_Z_input1[iZ]/Sum_midpt_phi_in_Z_input1 * 100 <<"\t" << Integ_midpt_Z_input2[iZ] << "\t" << Integ_midpt_Z_input2[iZ]/Sum_midpt_phi_in_Z_input2 * 100 << "\t" << Integ_midpt_Z_input1[iZ]- Integ_midpt_Z_input2[iZ] << "\t" << (Integ_midpt_Z_input1[iZ]- Integ_midpt_Z_input2[iZ])/Integ_midpt_Z_input2[iZ] *100 << endl;
1207                 }
1208                 outl << "\t" << "sum" << "\t" << Sum_midpt_phi_in_Z_input1 << "\t" << "100" << "\t" << Sum_midpt_phi_in_Z_input2 << "\t" << "100" <<"\t" << Sum_midpt_phi_in_Z_input1 - Sum_midpt_phi_in_Z_input2 << "\t" << (Sum_midpt_phi_in_Z_input1-Sum_midpt_phi_in_Z_input2)/Sum_midpt_phi_in_Z_input2 *100 << endl;
1209                 outl << endl;
1210
1211                 outl << "Z in R" <<endl;
1212                 outl <<" \t0\t" << Integ_ZinR_input1[0] << "\t" << Integ_R_input1[0]/Sum_Z_in_R_input1 * 100 <<"\t" << Integ_ZinR_input2[0] << "\t" << Integ_ZinR_input2[0]/Sum_Z_in_R_input2 * 100 << "\t" << Integ_ZinR_input1[0]- Integ_ZinR_input2[0] << "\t" << (Integ_ZinR_input1[0]- Integ_ZinR_input2[0])/Integ_ZinR_input2[0] *100 << endl;    
1213                 for(Int_t iR = 1; iR < NbinsR; iR++){
1214                         outl << "\t" << iR << "\t" << Integ_ZinR_input1[iR] << "\t" << Integ_ZinR_input1[iR]/Sum_Z_in_R_input1 * 100 <<"\t" << Integ_ZinR_input2[iR] << "\t" << Integ_ZinR_input2[iR]/Sum_Z_in_R_input2 * 100 << "\t" << Integ_ZinR_input1[iR]- Integ_ZinR_input2[iR] << "\t" << (Integ_ZinR_input1[iR]- Integ_ZinR_input2[iR])/Integ_ZinR_input2[iR]*100 << endl;
1215                 }
1216                 outl << "\t" << "sum" << "\t" << ESD_Conversion_R_input1->Integral() << "\t" << "100" << "\t" << ESD_Conversion_R_input2->Integral() << "\t" << "100" <<"\t" << ESD_Conversion_R_input1->Integral() - ESD_Conversion_R_input2->Integral() << "\t" << (ESD_Conversion_R_input1->Integral()-ESD_Conversion_R_input2->Integral())/ESD_Conversion_R_input2->Integral() *100 << endl;
1217                 outl << endl;
1218
1219                 outl << "R in Z" <<endl;
1220 //              outl <<" \t0\t" << Integ_RinZ_input1[0] << "\t"<< Integ_RinZ_input1[0]/Sum_R_in_Z_input1 * 100 <<"\t" << Integ_RinZ_input2[0] << "\t" << Integ_RinZ_input2[0]/Sum_R_in_Z_input2 * 100 << "\t" << Integ_RinZ_input1[0]- Integ_RinZ_input2[0] << "\t" << (Integ_RinZ_input1[0]- Integ_RinZ_input2[0])/Integ_RinZ_input2[0] * 100 << endl;
1221                 for(Int_t iZ = 1; iZ < NbinsZ; iZ++){
1222                         outl << "\t" << iZ<< "\t" << Integ_RinZ_input1[iZ] << "\t" << Integ_RinZ_input1[iZ]/Sum_R_in_Z_input1 * 100 <<"\t" << Integ_RinZ_input2[iZ] << "\t" << Integ_RinZ_input2[iZ]/Sum_R_in_Z_input2 * 100 << "\t" << Integ_RinZ_input1[iZ]- Integ_RinZ_input2[iZ] << "\t" << (Integ_RinZ_input1[iZ]- Integ_RinZ_input2[iZ])/Integ_RinZ_input2[iZ]*100 << endl;
1223                 }
1224                 outl << "\t" << "sum" << "\t" << ESD_Conversion_Z_input1->Integral() << "\t" << "100" << "\t" << ESD_Conversion_Z_input2->Integral() << "\t" << "100" <<"\t" << ESD_Conversion_Z_input1->Integral() - ESD_Conversion_Z_input2->Integral() << "\t" << (ESD_Conversion_Z_input1->Integral()-ESD_Conversion_Z_input2->Integral())/ESD_Conversion_Z_input2->Integral() *100 << endl;
1225                 outl << endl;
1226
1227                 outl << "MidPt Z in R" <<endl;
1228                 outl <<" \t0\t" << Integ_midpt_ZinR_input1[0] << "\t" << Integ_midpt_ZinR_input1[0]/Sum_midpt_Z_in_R_input1 * 100 <<"\t" << Integ_midpt_ZinR_input2[0] << "\t" << Integ_midpt_ZinR_input2[0]/Sum_midpt_Z_in_R_input2 * 100 << "\t" << Integ_midpt_ZinR_input1[0]- Integ_midpt_ZinR_input2[0] << "\t" << (Integ_midpt_ZinR_input1[0]- Integ_midpt_ZinR_input2[0])/Integ_midpt_ZinR_input2[0]*100 << endl;        
1229                 for(Int_t iR = 1; iR < NbinsR; iR++){
1230                         outl << "\t" << iR << "\t" << Integ_midpt_ZinR_input1[iR] << "\t" << Integ_midpt_ZinR_input1[iR]/Sum_midpt_Z_in_R_input1 * 100 <<"\t" << Integ_midpt_ZinR_input2[iR] << "\t" << Integ_midpt_ZinR_input2[iR]/Sum_midpt_Z_in_R_input2 * 100 << "\t" << Integ_midpt_ZinR_input1[iR]- Integ_midpt_ZinR_input2[iR] << "\t" << (Integ_midpt_ZinR_input1[iR]- Integ_midpt_ZinR_input2[iR])/Integ_midpt_ZinR_input2[iR] *100 << endl;
1231                 }
1232                 outl << "\t" << "sum" << "\t" << Sum_midpt_Z_in_R_input1 << "\t" << "100" << "\t" << Sum_midpt_Z_in_R_input2 << "\t" << "100" <<"\t" << Sum_midpt_Z_in_R_input1 - Sum_midpt_Z_in_R_input2 << "\t" << (Sum_midpt_Z_in_R_input1-Sum_midpt_Z_in_R_input2)/Sum_midpt_Z_in_R_input2 *100 << endl;
1233                 outl << endl;
1234                 
1235                 outl << "MidPt R in Z" <<endl;
1236 //              outl <<" \t0\t" << Integ_midpt_RinZ_input1[0] << "\t"<< Integ_midpt_RinZ_input1[0]/Sum_midpt_R_in_Z_input1 * 100 <<"\t" << Integ_midpt_RinZ_input2[0] << "\t" << Integ_midpt_RinZ_input2[0]/Sum_midpt_R_in_Z_input2 * 100 << "\t" << Integ_midpt_RinZ_input1[0]- Integ_midpt_RinZ_input2[0] << "\t" << (Integ_midpt_RinZ_input1[0]- Integ_midpt_RinZ_input2[0])/Integ_midpt_RinZ_input2[0] *100<< endl;
1237                 for(Int_t iZ = 1; iZ < NbinsZ; iZ++){
1238                         outl << "\t" << iZ << "\t" << Integ_midpt_RinZ_input1[iZ] << "\t" << Integ_midpt_RinZ_input1[iZ]/Sum_midpt_R_in_Z_input1 * 100 <<"\t" << Integ_midpt_RinZ_input2[iZ] << "\t" << Integ_midpt_RinZ_input2[iZ]/Sum_midpt_R_in_Z_input2 * 100 << "\t" << Integ_midpt_RinZ_input1[iZ]- Integ_midpt_RinZ_input2[iZ] << "\t" << (Integ_midpt_RinZ_input1[iZ]- Integ_midpt_RinZ_input2[iZ])/Integ_midpt_RinZ_input2[iZ] *100 << endl;
1239                 }
1240                 outl << "\t" << "sum" << "\t" << Sum_midpt_R_in_Z_input1 << "\t" << "100" << "\t" << Sum_midpt_R_in_Z_input2 << "\t" << "100" <<"\t" << Sum_midpt_R_in_Z_input1 - Sum_midpt_R_in_Z_input2 << "\t" << (Sum_midpt_R_in_Z_input1-Sum_midpt_R_in_Z_input2)/Sum_midpt_R_in_Z_input2 *100 << endl;
1241
1242                 outl << "------------------------------------------------------------------------------------------" << endl;           
1243            }
1244         ps_mapping->Close();
1245         // hier ende
1246         }       
1247         
1248         // --------------------------- single plots  ----------------------------
1249         if(SinglePlots){
1250         
1251
1252                 // ---------------------------- R- Distribution -----------------------
1253                 TCanvas * c_SinglePlot_2 = new TCanvas("c_SinglePlot_2","",1000,1000);  // gives the page size  
1254                 c_SinglePlot_2->SetLogy(0);             
1255                 c_SinglePlot_2->cd();
1256
1257                 if(secondinput == ""){
1258                                 DrawAutoGammaHisto( ESD_Conversion_R_input1, 
1259                                                                  "","R [cm]",StandardYAxis,
1260                                                                  kTRUE, 1.1,0.00001,
1261                                                                  kFALSE,0. ,0,
1262                                                                  kTRUE, 0.,180.);
1263                 }else{
1264                                 DrawAutoGammaHistos( ESD_Conversion_R_input1, 
1265                                                                  ESD_Conversion_R_input2, 
1266                                                                  "","R [cm]",StandardYAxis,
1267                                                                  kTRUE, 1.1,0.00001,
1268                                                                  kFALSE,0. ,0.,
1269                                                                  kTRUE, 0.,180.);
1270                 }
1271                 for(Int_t i=0; i < 12 ; i++){
1272                         DrawGammaLines(ArrayRbins[i], ArrayRbins[i], 0.00001,ESD_Conversion_R_input1->GetMaximum());
1273                 }               
1274                 DrawAliceLogoPerformance(right_up [0],right_up[1],right_up[2],right_up[3],0.03, Date);  
1275                 c_SinglePlot_2->Update();
1276                 c_SinglePlot_2->SaveAs(Form("%sR_distribution_lin.%s",path,suffix));
1277                 delete c_SinglePlot_2;          
1278
1279
1280                 TCanvas * c_SinglePlot_1 = new TCanvas("c_SinglePlot_1","",1000,1000);  // gives the page size
1281                 c_SinglePlot_1->cd();
1282                 c_SinglePlot_1->SetLogy(1);
1283
1284                 if(secondinput == ""){
1285                                 DrawAutoGammaHisto( ESD_Conversion_R_input1, 
1286                                                                  "","R [cm]",StandardYAxis,
1287                                                                  kTRUE, 1.5,0.00001,
1288                                                                  kFALSE,0. ,0,
1289                                                                  kTRUE, 0.,180.);
1290                 }else{
1291                                 DrawAutoGammaHistos( ESD_Conversion_R_input1, 
1292                                                                  ESD_Conversion_R_input2, 
1293                                                                  "","R [cm]",StandardYAxis,
1294                                                                  kTRUE, 1.5,0.00001,
1295                                                                  kFALSE,0. ,0.,
1296                                                                  kTRUE, 0.,180.);
1297                 }
1298                 for(Int_t i=0; i < 12 ; i++){
1299                         DrawGammaLines(ArrayRbins[i], ArrayRbins[i], 0.00001,ESD_Conversion_R_input1->GetMaximum());
1300                 }               
1301                 DrawAliceLogoPerformance(right_up [0],right_up[1],right_up[2],right_up[3],0.03, Date);  
1302
1303                 c_SinglePlot_1->Update();
1304                 c_SinglePlot_1->SaveAs(Form("%sR_distribution_log.%s",path,suffix));
1305                 delete c_SinglePlot_1;
1306
1307
1308                 //----------------------------- Integrated Radius -----------------------
1309                 TCanvas * c_SinglePlot_18 = new TCanvas("c_SinglePlot_18","",1000,1000);  // gives the page size                
1310                 c_SinglePlot_18->SetLogy(0);
1311                 c_SinglePlot_18->cd();
1312                 if(secondinput == ""){
1313                                 DrawAutoGammaHisto( ESD_Conversion_R_summed_input1, 
1314                                                                  "Conversions R distribution","R [cm]","Integrated (0-to-R) #gamma candidates/event scaled by multiplicity",
1315                                                                  kTRUE, 1.2,0,
1316                                                                  kTRUE,0. ,0.,
1317                                                                  kTRUE, 0.,180.);
1318                 }else{
1319                                 DrawAutoGammaHistos( ESD_Conversion_R_summed_input1, 
1320                                                                  ESD_Conversion_R_summed_input2, 
1321                                                                  "Integrated Radius of Conversion","R [cm] ","Integrated (0-to-R) #gamma candidates/event scaled by multiplicity",
1322                                                                  kTRUE, 1.2,0,
1323                                                                  kFALSE,0. ,0.,
1324                                                                  kTRUE, 0.,180.);
1325                 }
1326                 DrawAliceLogo(left_up [0],left_up[1],left_up[2],left_up[3]);    
1327
1328                 c_SinglePlot_18->Update();
1329                 c_SinglePlot_18->SaveAs(Form("%sInteg_Radius.%s",path,suffix));
1330                 delete c_SinglePlot_18;         
1331
1332
1333                 TCanvas * c_SinglePlot_17 = new TCanvas("c_SinglePlot_17","",1000,1000);  // gives the page size
1334                 c_SinglePlot_17->SetLogy(1);
1335                 c_SinglePlot_17->cd();
1336                 if(secondinput == ""){
1337                                 DrawAutoGammaHisto( ESD_Conversion_R_summed_input1, 
1338                                                                  "Conversions R distribution","R [cm]","Integrated (0-to-R) #gamma candidates/event scaled by multiplicity",
1339                                                                  kTRUE,2.5,0,
1340                                                                  kFALSE,0. ,0.,
1341                                                                  kTRUE, 0.,180.);
1342                 }else{
1343                                 DrawAutoGammaHistos( ESD_Conversion_R_summed_input1, 
1344                                                                  ESD_Conversion_R_summed_input2, 
1345                                                                  "Integrated Radius of Conversion","R [cm] ","Integrated (0-to-R) #gamma candidates/event scaled by multiplicity",
1346                                                                  kTRUE, 2.5,0,
1347                                                                  kFALSE,0. ,0.,
1348                                                                  kTRUE, 0.,180.);
1349                 }
1350                 DrawAliceLogo(right_down [0],right_down[1],right_down[2],right_down[3]);        
1351
1352                         
1353                 c_SinglePlot_17->Update();
1354                 c_SinglePlot_17->SaveAs(Form("%sInteg_Radius_log.%s",path,suffix));
1355                 delete c_SinglePlot_17;
1356
1357
1358
1359                 // -----------------------  2 dim Plots -----------------------------------
1360                 TCanvas * c_SinglePlot_3 = new TCanvas("c_SinglePlot_3","",1000,1000);  // gives the page size
1361                 c_SinglePlot_3->SetLogz(1);     
1362                 c_SinglePlot_3->SetRightMargin(RightMargin);                                            
1363                 c_SinglePlot_3->cd();
1364                         DrawAutoGammaHisto2D(   ESD_Conversion_ZR_input1,
1365                                                                 "", "Z [cm]", "R [cm]", "",
1366                                                                 kTRUE, 0., 200.,
1367                                                                 kFALSE, 0., 20.);
1368                         DrawAliceLogoPerformance(right_up2D [0],right_up2D[1],right_up2D[2],right_up2D[3],0.03,Date);
1369 //                      DrawAliceText(left_down[0], left_down[1 ], left_down[3]);
1370                         EtaRange->Draw();
1371                 c_SinglePlot_3->Update();
1372                 c_SinglePlot_3->SaveAs(Form("%sZR_distribution.%s",path,suffix));
1373                 delete c_SinglePlot_3;
1374
1375                 TCanvas * c_SinglePlot_4 = new TCanvas("c_SinglePlot_4","",1000,1000);  // gives the page size
1376                 c_SinglePlot_4->SetLogz(1);
1377                 c_SinglePlot_4->SetRightMargin(RightMargin);                                            
1378                 c_SinglePlot_4->cd();
1379                         DrawAutoGammaHisto2D(   ESD_Conversion_XY_input1,
1380                                                                 "", "X [cm]", "Y [cm]", "",
1381                                                                 kTRUE, -180., 180.,
1382                                                                 kTRUE, -180., 180.);
1383                         DrawStructure();
1384                         EtaRange->Draw();
1385                         DrawAliceLogoPerformance(right_up2D [0],right_up2D[1],right_up2D[2],right_up2D[3],0.03,Date);
1386 //                      DrawAliceText(left_down[0], left_down[1 ], left_down[3]);
1387                 c_SinglePlot_4->Update();
1388                 c_SinglePlot_4->SaveAs(Form("%sXY_distribution.%s",path,suffix));
1389                 delete c_SinglePlot_4;
1390
1391                 TCanvas * c_SinglePlot_4 = new TCanvas("c_SinglePlot_4","",1000,1000);  // gives the page size
1392                 c_SinglePlot_4->SetLogz(1);
1393                 c_SinglePlot_4->SetRightMargin(RightMargin);                                            
1394                 c_SinglePlot_4->cd();
1395                         ESD_Conversion_XY_input1->SetMinimum(minimumXY);
1396                         DrawAutoGammaHisto2D(   ESD_Conversion_XY_input1,
1397                                                                 "", "X [cm]", "Y [cm]", "",
1398                                                                 kTRUE, -180., 180.,
1399                                                                 kTRUE, -180., 180.);
1400                         DrawStructure();
1401                         EtaRange->Draw();
1402                         DrawAliceLogoPerformance(right_up2D [0],right_up2D[1],right_up2D[2],right_up2D[3],0.03,Date);
1403 //                      DrawAliceText(left_down[0], left_down[1 ], left_down[3]);
1404                 c_SinglePlot_4->Update();
1405                 c_SinglePlot_4->SaveAs(Form("%sXY_distribution_minimum.%s",path,suffix));
1406                 delete c_SinglePlot_4;
1407
1408
1409                 
1410                 if(secondinput != ""){
1411                         TCanvas * c_SinglePlot_5 = new TCanvas("c_SinglePlot_5","",1000,1000);  // gives the page size
1412                         c_SinglePlot_5->SetLogz(1);
1413                         c_SinglePlot_5->SetRightMargin(RightMargin);                                            
1414                         c_SinglePlot_5->cd();
1415                         Diff_XY_distribution = (TH1D*)ESD_Conversion_XY_input1->Clone();
1416                         Diff_XY_distribution->Divide(ESD_Conversion_XY_input1,ESD_Conversion_XY_input2,1.,1.,"B");
1417                         Diff_XY_distribution->Draw("col2");     
1418                         DrawAliceLogo(right_up2D [0],right_up2D[1],right_up2D[2],right_up2D[3]);
1419                         c_SinglePlot_5->Update();
1420                         c_SinglePlot_5->SaveAs(Form("%sDiff_XY_distributions.%s",path,suffix));
1421                         delete c_SinglePlot_5;
1422                 }
1423                 
1424
1425                 //-------------------- Z - Distribution ------------------------------
1426
1427                 TCanvas * c_SinglePlot_19 = new TCanvas("c_SinglePlot_19","",1000,1000);  // gives the page size
1428                 c_SinglePlot_19->SetLogy(0);
1429                 c_SinglePlot_19->cd();
1430                 if(secondinput == ""){
1431                                 DrawAutoGammaHisto( ESD_Conversion_Z_input1
1432                                                                  "Conversions Z distribution","Z [cm]",StandardYAxis,
1433                                                                  kTRUE, 1.1,0.00001,
1434                                                                  kFALSE,0. ,0,
1435                                                                  kTRUE, -201.,201.);
1436                 }else{
1437                                 DrawAutoGammaHistos( ESD_Conversion_Z_input1, 
1438                                                                  ESD_Conversion_Z_input2, 
1439                                                                  "Conversions Z distribution","Z [cm] ",StandardYAxis,
1440                                                                  kTRUE, 1.1,0.00001,
1441                                                                  kFALSE,0. ,0.,
1442                                                                  kFALSE, -201.,201.);
1443                 }
1444                 for(Int_t i=0; i < 12 ; i++){
1445                         DrawGammaLines(ArrayZbins[i], ArrayZbins[i], 0.00001,ESD_Conversion_Z_input1->GetMaximum());
1446                 }               
1447                 
1448                 leg1 = new TLegend( 0.6,0.82,0.9,0.9);
1449                 leg1->SetTextSize(0.04);                        
1450                 leg1->SetFillColor(0);
1451                 leg1->AddEntry(ESD_Conversion_Z_input1,("Data"));
1452                 if(secondinput != ""){leg1->AddEntry(ESD_Conversion_Z_input2,("MC"));}
1453                 leg1->Draw();
1454
1455                 DrawAliceLogo(right_up [0],right_up[1],right_up[2],right_up[3]);        
1456
1457                 c_SinglePlot_19->Update();
1458                 c_SinglePlot_19->SaveAs(Form("%sZ_distribution_lin.%s",path,suffix));
1459                 delete c_SinglePlot_19;
1460
1461                 TCanvas * c_SinglePlot_6 = new TCanvas("c_SinglePlot_6","",1000,1000);  // gives the page size
1462                 c_SinglePlot_6->SetLogy(1);
1463                 c_SinglePlot_6->cd();
1464                 if(secondinput == ""){
1465                                 DrawAutoGammaHisto( ESD_Conversion_Z_input1
1466                                                                  "Conversions Z distribution","Z [cm]",StandardYAxis,
1467                                                                  kTRUE, 1.5,0.00001,
1468                                                                  kFALSE,0. ,0,
1469                                                                  kTRUE, -250.,250.);
1470                 }else{
1471                                 DrawAutoGammaHistos( ESD_Conversion_Z_input1, 
1472                                                                  ESD_Conversion_Z_input2, 
1473                                                                  "Conversions Z distribution","Z [cm] ",StandardYAxis,
1474                                                                  kTRUE, 1.5,0.0000001,
1475                                                                  kFALSE,0. ,0.,
1476                                                                  kFALSE, -201.,201.);
1477                 }
1478                 for(Int_t i=0; i < 12 ; i++){
1479                         DrawGammaLines(ArrayZbins[i], ArrayZbins[i], 0.0000001,ESD_Conversion_Z_input1->GetMaximum());
1480                 }               
1481                 leg1->Draw();
1482                 DrawAliceLogo(right_up [0],right_up[1],right_up[2],right_up[3]);        
1483
1484                 c_SinglePlot_6->Update();
1485                 c_SinglePlot_6->SaveAs(Form("%sZ_distribution_log.%s",path,suffix));
1486                 delete c_SinglePlot_6;
1487
1488                 
1489                 //------------------- Giving the Pad Phi in R in better resolution
1490
1491                 c_Single_Phi_in_R = new TCanvas("c_Single_Phi_in_R","",400,20,1400,2000);  // gives the page size
1492                 pad_Single_Phi_in_R = new TPad("pad_Single_Phi_in_R","",0.01,0.01,0.99,0.99,0);   // gives the size of the histo areas 
1493                 pad_Single_Phi_in_R->SetFillColor(0);
1494                 pad_Single_Phi_in_R->GetFrame()->SetFillColor(0);
1495                 pad_Single_Phi_in_R->SetBorderMode(0);
1496                 pad_Single_Phi_in_R->Divide(column,raw);
1497                 pad_Single_Phi_in_R->Draw();
1498
1499                 for(Int_t iR = 0; iR < NbinsR; iR++){
1500                         Int_t place = iR + 1;
1501                         
1502                         pad_Single_Phi_in_R->cd(place);
1503                         pad_Single_Phi_in_R->cd(place)->SetLogy(1);
1504                         sprintf(histoname_Phi_in_R_input1,"ESD_Conversion_Mapping_Phi_in_R_iR%02d",iR);
1505                         if(secondinput == ""){          
1506                                 DrawAutoGammaHisto( ESD_Conversion_Mapping_Phi_in_R_input1[iR], 
1507                                                                          histoname_Phi_in_R_input1,"#Phi",StandardYAxis,
1508                                                                          kTRUE,2 ,0.0000002,
1509                                                                          kFALSE,0. ,0.,
1510                                                                          kFALSE, 0.,180.);
1511                         }else{
1512                                 DrawAutoGammaHistos( ESD_Conversion_Mapping_Phi_in_R_input1[iR], 
1513                                                                          ESD_Conversion_Mapping_Phi_in_R_input2[iR], 
1514                                                                          histoname_Phi_in_R_input1,"#Phi",StandardYAxis,
1515                                                                          kTRUE,2 ,0.0000002,
1516                                                                          kFALSE,0. ,0.,
1517                                                                          kFALSE, 0.,180.);
1518                         }       
1519                 DrawAliceText(right_up_text[0],right_up_text[1], right_up_text[3]);             
1520                 }
1521                         pad_Single_Phi_in_R->Update();
1522                         c_Single_Phi_in_R->Print(Form("%spad_Phi_in_R.%s",path,suffix));        
1523                         delete  pad_Single_Phi_in_R;
1524                         delete c_Single_Phi_in_R;               
1525
1526
1527                 // --------------- Giving Phi in R for several bins -------------------------------------------------------------
1528                 TCanvas * c_SinglePlot_7 = new TCanvas("c_SinglePlot_7","",1000,700);  // gives the page size
1529                 c_SinglePlot_7->SetLogy(1);
1530                 c_SinglePlot_7->cd();
1531                         if(secondinput == ""){          
1532                                 DrawAutoGammaHisto( ESD_Conversion_Mapping_Phi_in_R_input1[4],
1533                                                                         "ESD_Conversion_Mapping_Phi_in_R_R04","#Phi",StandardYAxis,
1534                                                                          kFALSE,3 ,0.000001,
1535                                                                          kFALSE,0. ,0.,
1536                                                                          kFALSE, 0.,180.);
1537                         }else{
1538                                 DrawAutoGammaHistos( ESD_Conversion_Mapping_Phi_in_R_input1[4], 
1539                                                                          ESD_Conversion_Mapping_Phi_in_R_input2[4], 
1540                                                                          "ESD_Conversion_Mapping_Phi_in_R_R04","#Phi",StandardYAxis,
1541                                                                          kFALSE,3 ,0.000001,
1542                                                                          kFALSE,0. ,0.,
1543                                                                          kFALSE, 0.,180.);
1544                         }       
1545                 DrawAliceText(right_up_text[0],right_up_text[1], right_up_text[3]);             
1546
1547                 c_SinglePlot_7->Update();
1548                 c_SinglePlot_7->SaveAs(Form("%sPhi_in_R_04.%s",path,suffix));
1549                 delete c_SinglePlot_7;
1550                 
1551                 TCanvas * c_SinglePlot_8 = new TCanvas("c_SinglePlot_8","",1000,700);  // gives the page size           
1552                 c_SinglePlot_8->SetLogy(1);             
1553                 c_SinglePlot_8->cd();
1554                         if(secondinput == ""){          
1555                                 DrawAutoGammaHisto( ESD_Conversion_Mapping_Phi_in_R_input1[5],
1556                                                                         "ESD_Conversion_Mapping_Phi_in_R_R05","#Phi",StandardYAxis,
1557                                                                          kFALSE,3 ,0.000001,
1558                                                                          kFALSE,0. ,0.,
1559                                                                          kFALSE, 0.,180.);
1560                         }else{
1561                                 DrawAutoGammaHistos( ESD_Conversion_Mapping_Phi_in_R_input1[5], 
1562                                                                          ESD_Conversion_Mapping_Phi_in_R_input2[5], 
1563                                                                          "ESD_Conversion_Mapping_Phi_in_R_R05","#Phi",StandardYAxis,
1564                                                                          kFALSE,3 ,0.000001,
1565                                                                          kFALSE,0. ,0.,
1566                                                                          kFALSE, 0.,180.);
1567                         }       
1568                 DrawAliceText(right_up_text[0],right_up_text[1], right_up_text[3]);             
1569                 c_SinglePlot_8->Update();
1570                 c_SinglePlot_8->SaveAs(Form("%sPhi_in_R_05.%s",path,suffix));
1571                 delete c_SinglePlot_8;
1572
1573                 TCanvas * c_SinglePlot_12 = new TCanvas("c_SinglePlot_12","",1000,700);  // gives the page size         
1574                 c_SinglePlot_12->SetLogy(1);
1575                 c_SinglePlot_12->cd();
1576                         if(secondinput == ""){          
1577                                 DrawAutoGammaHisto( ESD_Conversion_Mapping_Phi_in_R_input1[2],
1578                                                                         "ESD_Conversion_Mapping_Phi_in_R_R02","#Phi",StandardYAxis,
1579                                                                          kFALSE,3 ,0.000001,
1580                                                                          kFALSE,0. ,0.,
1581                                                                          kFALSE, 0.,180.);
1582                         }else{
1583                                 DrawAutoGammaHistos( ESD_Conversion_Mapping_Phi_in_R_input1[2], 
1584                                                                          ESD_Conversion_Mapping_Phi_in_R_input2[2], 
1585                                                                          "ESD_Conversion_Mapping_Phi_in_R_R02","#Phi",StandardYAxis,
1586                                                                          kFALSE,3 ,0.000001,
1587                                                                          kFALSE,0. ,0.,
1588                                                                          kFALSE, 0.,180.);
1589                         }       
1590                 DrawAliceText(right_up_text[0],right_up_text[1], right_up_text[3]);             
1591
1592                 c_SinglePlot_12->Update();
1593                 c_SinglePlot_12->SaveAs(Form("%sPhi_in_R_02.%s",path,suffix));
1594                 delete c_SinglePlot_12;                         
1595
1596                 TCanvas * c_SinglePlot_13 = new TCanvas("c_SinglePlot_13","",1000,700);  // gives the page size
1597                 c_SinglePlot_13->SetLogy(1);
1598                 c_SinglePlot_13->cd();
1599                         if(secondinput == ""){          
1600                                 DrawAutoGammaHisto( ESD_Conversion_Mapping_Phi_in_R_input1[6],
1601                                                                         "ESD_Conversion_Mapping_Phi_in_R_R06","#Phi",StandardYAxis,
1602                                                                          kFALSE,3 ,0.000001,
1603                                                                          kFALSE,0. ,0.,
1604                                                                          kFALSE, 0.,180.);
1605                         }else{
1606                                 DrawAutoGammaHistos( ESD_Conversion_Mapping_Phi_in_R_input1[6], 
1607                                                                          ESD_Conversion_Mapping_Phi_in_R_input2[6], 
1608                                                                          "ESD_Conversion_Mapping_Phi_in_R_R06","#Phi",StandardYAxis,
1609                                                                          kFALSE,3 ,0.000001,
1610                                                                          kFALSE,0. ,0.,
1611                                                                          kFALSE, 0.,180.);
1612                         }       
1613                 DrawAliceText(right_up_text[0],right_up_text[1], right_up_text[3]);             
1614                 c_SinglePlot_13->Update();
1615                 c_SinglePlot_13->SaveAs(Form("%sPhi_in_R_06.%s",path,suffix));
1616                 delete c_SinglePlot_13;         
1617
1618                 TCanvas * c_SinglePlot_14 = new TCanvas("c_SinglePlot_14","",1000,700);  // gives the page size
1619                 c_SinglePlot_14->SetLogy(1);
1620                 c_SinglePlot_14->cd();          
1621                 if(secondinput == ""){          
1622                                 DrawAutoGammaHisto( ESD_Conversion_Mapping_Phi_in_R_input1[7],
1623                                                                         "ESD_Conversion_Mapping_Phi_in_R_R07","#Phi",StandardYAxis,
1624                                                                          kFALSE,3 ,0.000001,
1625                                                                          kFALSE,0. ,0.,
1626                                                                          kFALSE, 0.,180.);
1627                         }else{
1628                                 DrawAutoGammaHistos( ESD_Conversion_Mapping_Phi_in_R_input1[7], 
1629                                                                          ESD_Conversion_Mapping_Phi_in_R_input2[7], 
1630                                                                          "ESD_Conversion_Mapping_Phi_in_R_R07","#Phi",StandardYAxis,
1631                                                                          kFALSE,3 ,0.000001,
1632                                                                          kFALSE,0. ,0.,
1633                                                                          kFALSE, 0.,180.);
1634                         }       
1635                 DrawAliceText(right_up_text[0],right_up_text[1], right_up_text[3]);             
1636
1637                 c_SinglePlot_14->Update();
1638                 c_SinglePlot_14->SaveAs(Form("%sPhi_in_R_07.%s",path,suffix));
1639                 delete c_SinglePlot_14;                         
1640
1641                 TCanvas * c_SinglePlot_15 = new TCanvas("c_SinglePlot_15","",1000,700);  // gives the page size
1642                 c_SinglePlot_15->SetLogy(1);
1643                 c_SinglePlot_15->cd();
1644                         if(secondinput == ""){          
1645                                 DrawAutoGammaHisto( ESD_Conversion_Mapping_Phi_in_R_input1[9 ],
1646                                                                         "ESD_Conversion_Mapping_Phi_in_R_R09","#Phi",StandardYAxis,
1647                                                                          kFALSE,3 ,0.000001,
1648                                                                          kFALSE,0. ,0.,
1649                                                                          kFALSE, 0.,180.);
1650                         }else{
1651                                 DrawAutoGammaHistos( ESD_Conversion_Mapping_Phi_in_R_input1[9], 
1652                                                                          ESD_Conversion_Mapping_Phi_in_R_input2[9], 
1653                                                                          "ESD_Conversion_Mapping_Phi_in_R_R09","#Phi",StandardYAxis,
1654                                                                          kFALSE,3 ,0.000001,
1655                                                                          kFALSE,0. ,0.,
1656                                                                          kFALSE, 0.,180.);
1657                         }       
1658                 DrawAliceText(right_up_text[0],right_up_text[1], right_up_text[3]);             
1659                 c_SinglePlot_15->Update();
1660                 c_SinglePlot_15->SaveAs(Form("%sPhi_in_R_09.%s",path,suffix));
1661                 delete c_SinglePlot_15;
1662
1663                 TCanvas * c_SinglePlot_16 = new TCanvas("c_SinglePlot_16","",1000,700);  // gives the page size         
1664                 c_SinglePlot_16->SetLogy(1);
1665                 c_SinglePlot_16->cd();
1666                         if(secondinput == ""){          
1667                                 DrawAutoGammaHisto( ESD_Conversion_Mapping_Phi_in_R_input1[10],
1668                                                                         "ESD_Conversion_Mapping_Phi_in_R_R10","#Phi",StandardYAxis,
1669                                                                          kFALSE,3 ,0.000001,
1670                                                                          kFALSE,0. ,0.,
1671                                                                          kFALSE, 0.,180.);
1672                         }else{
1673                                 DrawAutoGammaHistos( ESD_Conversion_Mapping_Phi_in_R_input1[10], 
1674                                                                          ESD_Conversion_Mapping_Phi_in_R_input2[10], 
1675                                                                          "ESD_Conversion_Mapping_Phi_in_R_R10","#Phi",StandardYAxis,
1676                                                                          kFALSE,3 ,0.000001,
1677                                                                          kFALSE,0. ,0.,
1678                                                                          kFALSE, 0.,180.);
1679                         }       
1680                 DrawAliceText(right_up_text[0],right_up_text[1], right_up_text[3]);             
1681                 c_SinglePlot_16->Update();
1682                 c_SinglePlot_16->SaveAs(Form("%sPhi_in_R_10.%s",path,suffix));
1683                 delete c_SinglePlot_16;
1684                 
1685         //----------- Giving Z in R as single Pad ----------------
1686                 c_Single_Z_in_R = new TCanvas("c_Single_Z_in_R","",400,20,1400,2000);  // gives the page size
1687         
1688                 pad_Single_Z_in_R = new TPad("pad_Single_Z_in_R","",0.01,0.01,0.99,0.99,0);   // gives the size of the histo areas 
1689                 pad_Single_Z_in_R->SetFillColor(0);
1690                 pad_Single_Z_in_R->GetFrame()->SetFillColor(0);
1691                 pad_Single_Z_in_R->SetBorderMode(0);
1692                 pad_Single_Z_in_R->Divide(column,raw);
1693                 pad_Single_Z_in_R->Draw();
1694         
1695 /*              title0->Draw(); 
1696                 if(secondinput != ""){title1->Draw();}  
1697 */              
1698         for(Int_t iR = 0; iR < NbinsR; iR++){
1699                 Int_t place = iR + 1;
1700                 pad_Single_Z_in_R->cd(place);
1701                 pad_Single_Z_in_R->cd(place)->SetLogy(1);
1702                 sprintf(histoname_Z_in_R_input1,"ESD_Conversion_Mapping_Z_in_R_iR%02d",iR);
1703                 if(secondinput == ""){          
1704                         DrawAutoGammaHisto( ESD_Conversion_Mapping_Z_in_R_input1[iR], 
1705                                                                  histoname_Z_in_R_input1,"Z [cm]",StandardYAxis,
1706                                                                  kTRUE,2 ,0.00001,
1707                                                                  kFALSE,0. ,0.,
1708                                                                  kFALSE, 0.,180.);
1709                 }else{
1710                         DrawAutoGammaHistos( ESD_Conversion_Mapping_Z_in_R_input1[iR], 
1711                                                                  ESD_Conversion_Mapping_Z_in_R_input2[iR], 
1712                                                                  histoname_Z_in_R_input1,"Z [cm]",StandardYAxis,
1713                                                                  kTRUE,2 ,0.00001,
1714                                                                  kFALSE,0. ,0.,
1715                                                                  kFALSE, 0.,180.);
1716                 }       
1717                 DrawAliceText(right_up_text[0],right_up_text[1], right_up_text[3]);             
1718         }
1719         
1720                 pad_Single_Z_in_R->Update();
1721                 c_Single_Z_in_R->SaveAs(Form("%spad_Z_in_R.%s",path,suffix));
1722                 delete pad_Single_Z_in_R;
1723                 delete c_Single_Z_in_R;
1724
1725                 // -------------- Giving Z in R for 4th and 5th bin
1726                 TCanvas * c_SinglePlot_9 = new TCanvas("c_SinglePlot_9","",1000,1000);  // gives the page size
1727                 c_SinglePlot_9->SetLogy(1);             
1728                 c_SinglePlot_9->cd();
1729                 if(secondinput == ""){          
1730                         DrawAutoGammaHisto( ESD_Conversion_Mapping_Z_in_R_input1[9], 
1731                                                                  "ESD_Conversion_Mapping_Z_in_R_iR09","Z [cm]",StandardYAxis,
1732                                                                  kFALSE,3 ,0.0001,
1733                                                                  kFALSE,0. ,0.,
1734                                                                  kFALSE, 0.,180.);
1735                 }else{
1736                         DrawAutoGammaHistos( ESD_Conversion_Mapping_Z_in_R_input1[9], 
1737                                                                  ESD_Conversion_Mapping_Z_in_R_input2[9], 
1738                                                                  "ESD_Conversion_Mapping_Z_in_R_iR09","Z [cm]",StandardYAxis,
1739                                                                  kFALSE,3 ,0.0001,
1740                                                                  kFALSE,0. ,0.,
1741                                                                  kFALSE, 0.,180.);
1742                 }       
1743                 DrawAliceText(right_up_text[0],right_up_text[1], right_up_text[3]);             
1744                 c_SinglePlot_9->Update();
1745                 c_SinglePlot_9->SaveAs(Form("%sZ_in_R_09.%s",path,suffix));
1746                 delete c_SinglePlot_9;
1747                                 
1748                 TCanvas * c_SinglePlot_10 = new TCanvas("c_SinglePlot_10","",1000,1000);  // gives the page size
1749                 c_SinglePlot_10->SetLogy(1);            
1750                 c_SinglePlot_10->cd();
1751                 if(secondinput == ""){          
1752                         DrawAutoGammaHisto( ESD_Conversion_Mapping_Z_in_R_input1[10], 
1753                                                                  "ESD_Conversion_Mapping_Z_in_R_iR10","Z [cm]",StandardYAxis,
1754                                                                  kFALSE,3 ,0.0001,
1755                                                                  kFALSE,0. ,0.,
1756                                                                  kFALSE, 0.,180.);
1757                 }else{
1758                         DrawAutoGammaHistos( ESD_Conversion_Mapping_Z_in_R_input1[10], 
1759                                                                  ESD_Conversion_Mapping_Z_in_R_input2[10], 
1760                                                                  "ESD_Conversion_Mapping_Z_in_R_iR10","Z [cm]",StandardYAxis,
1761                                                                  kFALSE,3 ,0.0001,
1762                                                                  kFALSE,0. ,0.,
1763                                                                  kFALSE, 0.,180.);
1764                 }       
1765                 DrawAliceText(right_up_text[0],right_up_text[1], right_up_text[3]);             
1766                 c_SinglePlot_10->Update();
1767                 c_SinglePlot_10->SaveAs(Form("%sZ_in_R_10.%s",path,suffix));
1768                 delete c_SinglePlot_10;
1769
1770                 // ------------- Giving Z in phi in singleplot
1771                 c_Single_Phi_in_Z = new TCanvas("c_Single_Phi_in_Z","",200,10,1400,2000);  // gives the page size
1772         
1773                 pad_Single_Phi_in_Z = new TPad("pad_Single_Phi_in_Z","",0.01,0.01,0.99,0.99,0);   // gives the size of the histo areas 
1774                 pad_Single_Phi_in_Z->SetFillColor(0);
1775                 pad_Single_Phi_in_Z->GetFrame()->SetFillColor(0);
1776                 pad_Single_Phi_in_Z->SetBorderMode(0);
1777                 pad_Single_Phi_in_Z->Divide(column,raw);
1778                 pad_Single_Phi_in_Z->Draw();
1779         
1780
1781         for(Int_t iZ = 0; iZ < NbinsZ; iZ++){
1782                 Int_t place = iZ + 1;
1783                 pad_Single_Phi_in_Z->cd(place);
1784                 pad_Single_Phi_in_Z->cd(place)->SetLogy(1);
1785                 sprintf(histoname_Phi_in_Z_input1,"ESD_Conversion_Mapping_Phi_in_Z_iZ%02d",iZ);
1786                 if(secondinput == ""){          
1787                         DrawAutoGammaHisto( ESD_Conversion_Mapping_Phi_in_Z_input1[iZ], 
1788                                                                  histoname_Phi_in_Z_input1,"#Phi",StandardYAxis,
1789                                                                  kTRUE,2 ,0.0000002,
1790                                                                  kFALSE,0. ,0.,
1791                                                                  kFALSE, 0.,180.);
1792                 }else{
1793                         DrawAutoGammaHistos( ESD_Conversion_Mapping_Phi_in_Z_input1[iZ], 
1794                                                                  ESD_Conversion_Mapping_Phi_in_Z_input2[iZ], 
1795                                                                  histoname_Phi_in_Z_input1,"#Phi",StandardYAxis,
1796                                                                  kTRUE,2 ,0.0000002,
1797                                                                  kFALSE,0. ,0.,
1798                                                                  kFALSE, 0.,180.);
1799                 }       
1800                 DrawAliceText(right_up_text[0],right_up_text[1], right_up_text[3]);             
1801         }
1802
1803                 pad_Single_Phi_in_Z->Update();
1804                 c_Single_Phi_in_Z->SaveAs(Form("%spad_Phi_in_Z.%s",path,suffix));
1805                 delete pad_Single_Phi_in_Z ;
1806                 delete c_Single_Phi_in_Z;
1807
1808                 // ----- Giving R in Z in SinglePlot    
1809                 c_Single_R_in_Z = new TCanvas("c_Single_R_in_Z","",400,20,1400,2000);  // gives the page size
1810         
1811                 pad_Single_R_in_Z = new TPad("pad_Single_R_in_Z","",0.01,0.01,0.99,0.99,0);   // gives the size of the histo areas 
1812                 pad_Single_R_in_Z->SetFillColor(0);
1813                 pad_Single_R_in_Z->GetFrame()->SetFillColor(0);
1814                 pad_Single_R_in_Z->SetBorderMode(0);
1815                 pad_Single_R_in_Z->Divide(column,raw);
1816                 pad_Single_R_in_Z->Draw();
1817         
1818
1819         for(Int_t iZ = 0; iZ < NbinsZ; iZ++){
1820                 Int_t place = iZ + 1;
1821                 pad_Single_R_in_Z->cd(place);
1822                 pad_Single_R_in_Z->cd(place)->SetLogy(1);
1823                 sprintf(histoname_R_in_Z_input1,"ESD_Conversion_Mapping_R_in_Z_iZ%02d",iZ);
1824                 if(secondinput == ""){          
1825                         DrawAutoGammaHisto( ESD_Conversion_Mapping_R_in_Z_input1[iZ], 
1826                                                                  histoname_R_in_Z_input1,"R [cm]",StandardYAxis,
1827                                                                  kTRUE,2 ,0.0000002,
1828                                                                  kFALSE,0. ,0.,
1829                                                                  kFALSE, 0.,180.);
1830                 }else{
1831                         DrawAutoGammaHistos( ESD_Conversion_Mapping_R_in_Z_input1[iZ], 
1832                                                                  ESD_Conversion_Mapping_R_in_Z_input2[iZ], 
1833                                                                  histoname_R_in_Z_input1,"R [cm]",StandardYAxis,
1834                                                                  kTRUE,2 ,0.0000002,
1835                                                                  kFALSE,0. ,0.,
1836                                                                  kFALSE, 0.,180.);
1837                 }       
1838                 DrawAliceText(right_up_text[0],right_up_text[1], right_up_text[3]);             
1839         }
1840
1841                 pad_Single_R_in_Z->Update();
1842                 c_Single_R_in_Z->SaveAs(Form("%spad_R_in_Z.%s",path,suffix));
1843                 delete pad_Single_R_in_Z ;
1844                 delete c_Single_R_in_Z;
1845                 //---------------------------- Ratio Pads ----------------------------------
1846
1847 if(secondinput != ""){
1848
1849         c_Ratio_Phi_in_R = new TCanvas("c_Ratio_Phi_in_R","",400,20,1400,2000);  // gives the page size
1850         
1851         pad_Ratio_Phi_in_R = new TPad("pad_Ratio_Phi_in_R","",0.01,0.01,0.99,0.99,0);   // gives the size of the histo areas 
1852         pad_Ratio_Phi_in_R->SetFillColor(0);
1853         pad_Ratio_Phi_in_R->GetFrame()->SetFillColor(0);
1854         pad_Ratio_Phi_in_R->SetBorderMode(0);
1855         pad_Ratio_Phi_in_R->Divide(column,raw);
1856         pad_Ratio_Phi_in_R->Draw();
1857         
1858         for(Int_t iR = 0; iR < NbinsR; iR++){
1859                 Int_t place = iR + 1;
1860                 
1861                 pad_Ratio_Phi_in_R->cd(place);
1862                 pad_Ratio_Phi_in_R->cd(place)->SetLogy(1);
1863                 sprintf(histoname_Ratio_Phi_in_R_input2,"Ratio_Phi_in_R_iR%02d",iR);
1864                         DrawRatioGammaHisto(    Ratio_Mapping_Phi_in_R[iR], 
1865                                                                  histoname_Ratio_Phi_in_R_input2,"#Phi","norm Data/norm MC",
1866                                                                  kFALSE,3 ,0.000001,
1867                                                                  kTRUE,0.1 ,5.,
1868                                                                  kFALSE, 0.,180.);
1869                         linePhi->Draw("same");
1870                 DrawAliceText(right_up_text[0],right_up_text[1], right_up_text[3]);             
1871         }
1872         
1873         pad_Ratio_Phi_in_R->Update();
1874         c_Ratio_Phi_in_R->SaveAs(Form("%sRatio_Phi_in_R.%s",path,suffix));
1875         delete pad_Ratio_Phi_in_R ;
1876         delete  c_Ratio_Phi_in_R;
1877 }
1878
1879 if(secondinput != ""){
1880
1881         c_Ratio_Z_in_R = new TCanvas("c_Ratio_Z_in_R","",400,20,1400,2000);  // gives the page size
1882         
1883         pad_Ratio_Z_in_R = new TPad("pad_Ratio_Z_in_R","",0.01,0.01,0.99,0.99,0);   // gives the size of the histo areas 
1884         pad_Ratio_Z_in_R->SetFillColor(0);
1885         pad_Ratio_Z_in_R->GetFrame()->SetFillColor(0);
1886         pad_Ratio_Z_in_R->SetBorderMode(0);
1887         pad_Ratio_Z_in_R->Divide(column,raw);
1888         pad_Ratio_Z_in_R->Draw();
1889
1890         for(Int_t iR = 0; iR < NbinsR; iR++){
1891                 Int_t place = iR + 1;
1892                 
1893                 pad_Ratio_Z_in_R->cd(place);
1894                 pad_Ratio_Z_in_R->cd(place)->SetLogy(1);
1895                 sprintf(histoname_Ratio_Z_in_R_input2,"Ratio_Z_in_R_iR%02d",iR);        
1896                         Float_t ZRange = RangeZinR[iR];
1897                         DrawRatioGammaHisto( Ratio_Mapping_Z_in_R[iR], 
1898                                                                  histoname_Ratio_Z_in_R_input2,"Z","norm Data/norm MC",
1899                                                                  kFALSE,3 ,0.000001,
1900                                                                  kTRUE,0.1 ,5.,
1901                                                                  kTRUE, -ZRange,ZRange);
1902                         DrawGammaLines(-ZRange,ZRange,1,1);
1903                 DrawAliceText(right_up_text[0],right_up_text[1], right_up_text[3]);             
1904         }
1905         pad_Ratio_Z_in_R->Update();
1906         c_Ratio_Z_in_R->SaveAs(Form("%sRatio_Z_in_R.%s",path,suffix));
1907         delete pad_Ratio_Z_in_R ;
1908         delete c_Ratio_Z_in_R;
1909 }
1910
1911 if(secondinput != ""){
1912
1913         c_Ratio_Phi_in_Z = new TCanvas("c_Ratio_Phi_in_Z","",400,20,1400,2000);  // gives the page size
1914         
1915         pad_Ratio_Phi_in_Z = new TPad("pad_Ratio_Phi_in_Z","",0.01,0.01,0.99,0.99,0);   // gives the size of the histo areas 
1916         pad_Ratio_Phi_in_Z->SetFillColor(0);
1917         pad_Ratio_Phi_in_Z->GetFrame()->SetFillColor(0);
1918         pad_Ratio_Phi_in_Z->SetBorderMode(0);
1919         pad_Ratio_Phi_in_Z->Divide(column,raw);
1920         pad_Ratio_Phi_in_Z->Draw();
1921
1922         for(Int_t iZ = 0; iZ < NbinsZ; iZ++){
1923                 Int_t place = iZ + 1;
1924                 
1925                 pad_Ratio_Phi_in_Z->cd(place);
1926                 pad_Ratio_Phi_in_Z->cd(place)->SetLogy(1);
1927                 sprintf(histoname_Ratio_Phi_in_Z_input2,"Ratio_Phi_in_Z_iZ%02d",iZ);
1928                         DrawRatioGammaHisto( Ratio_Mapping_Phi_in_Z[iZ], 
1929                                                                  histoname_Ratio_Phi_in_Z_input2,"#Phi","norm Data/norm MC",
1930                                                                  kFALSE,3 ,0.000001,
1931                                                                  kTRUE,0.1 ,5.,
1932                                                                  kFALSE, 0,0);
1933                         linePhi->Draw("same");
1934                 DrawAliceText(right_up_text[0],right_up_text[1], right_up_text[3]);             
1935         }
1936         
1937         pad_Ratio_Phi_in_Z->Update();
1938         c_Ratio_Phi_in_Z->SaveAs(Form("%sRatio_Phi_in_Z.%s",path,suffix));
1939         delete pad_Ratio_Phi_in_Z ;
1940         delete c_Ratio_Phi_in_Z;
1941 }
1942
1943 if(secondinput != ""){
1944
1945         c_Ratio_R_in_Z = new TCanvas("c_Ratio_R_in_Z","",400,20,1400,2000);  // gives the page size
1946         
1947         pad_Ratio_R_in_Z = new TPad("pad_Ratio_R_in_Z","",0.01,0.01,0.99,0.99,0);   // gives the size of the histo areas 
1948         pad_Ratio_R_in_Z->SetFillColor(0);
1949         pad_Ratio_R_in_Z->GetFrame()->SetFillColor(0);
1950         pad_Ratio_R_in_Z->SetBorderMode(0);
1951         pad_Ratio_R_in_Z->Divide(column,raw);
1952         pad_Ratio_R_in_Z->Draw();
1953         
1954         for(Int_t iZ = 0; iZ < NbinsZ; iZ++){
1955                 Int_t place = iZ + 1;
1956                 
1957                 pad_Ratio_R_in_Z->cd(place);
1958                 pad_Ratio_R_in_Z->cd(place)->SetLogy(1);
1959                 sprintf(histoname_Ratio_R_in_Z_input2,"Ratio_R_in_Z_iZ%02d",iZ);
1960                         DrawRatioGammaHisto( Ratio_Mapping_R_in_Z[iZ], 
1961                                                                  histoname_Ratio_R_in_Z_input2,"R [cm]","norm Data/norm MC",
1962                                                                  kFALSE,3 ,0.000001,
1963                                                                  kTRUE,0.1 ,5.,
1964                                                                  kFALSE, 0,0);
1965                         lineR->Draw("same");
1966                 DrawAliceText(right_up_text[0],right_up_text[1], right_up_text[3]);             
1967         }
1968         
1969         pad_Ratio_R_in_Z->Update();
1970         c_Ratio_R_in_Z->SaveAs(Form("%sRatio_R_in_Z.%s",path,suffix));
1971         delete pad_Ratio_R_in_Z ;
1972         delete c_Ratio_R_in_Z;
1973 }       
1974         
1975         }       
1976
1977 //Dealocating all reserved resources
1978
1979 }