]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Added macros to produce pi0 results.
authorkaamodt <kaamodt@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 21 Jun 2010 15:07:40 +0000 (15:07 +0000)
committerkaamodt <kaamodt@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 21 Jun 2010 15:07:40 +0000 (15:07 +0000)
PWG4/GammaConv/macros/Extract_IntegratedPi0Yield.C [new file with mode: 0644]
PWG4/GammaConv/macros/Extract_Pi0_Characteristics.C [new file with mode: 0644]
PWG4/GammaConv/macros/MakeCutLog.C [new file with mode: 0644]
PWG4/GammaConv/macros/Plot_IntegratedPi0Yield.C [new file with mode: 0644]
PWG4/GammaConv/macros/Plot_Mapping_Histos_Events.C [new file with mode: 0644]
PWG4/GammaConv/macros/Plot_Pi0_Characteristics.C [new file with mode: 0644]
PWG4/GammaConv/macros/printCuts.C [new file with mode: 0644]
PWG4/GammaConv/macros/start_GammaConversionAnalysis.sh [new file with mode: 0755]

diff --git a/PWG4/GammaConv/macros/Extract_IntegratedPi0Yield.C b/PWG4/GammaConv/macros/Extract_IntegratedPi0Yield.C
new file mode 100644 (file)
index 0000000..a83ed41
--- /dev/null
@@ -0,0 +1,208 @@
+// provided by Gamma Conversion Group, PWG4, Kathrin Koch, kkoch@physi.uni-heidelberg.de
+
+#include <fstream>
+#include <Riostream.h>
+//#include <PlottingGammaHistograms.h>
+
+extern TRandom *gRandom;
+extern TBenchmark *gBenchmark;
+extern TSystem *gSystem;
+
+void Extract_IntegratedPi0Yield(const char* cutSelection="", const char *inputRootFile = "AnalysisResults",const char *path = "./",const char* outputDir="./Output/",const char* outputDatFileBase= "RB-data",const char* suffix=""){  
+
+  Bool_t writePlotFiles=kFALSE; // if one wants to write f.ex .gif files from the plots
+  if(suffix!=""){
+    writePlotFiles=kTRUE;
+  }
+
+  gROOT->Reset();      
+  gROOT->SetStyle("Plain");
+       
+  // rebinning
+  Int_t RebinMass = 2;
+       
+  Double_t BGFit_range[2] = {0.17,0.3};        
+       
+  Double_t Pi0Mass = 0.135;
+  Double_t Pi0Mass_range[2] = {0.12,0.15};
+  Double_t Pi0Width = 0.003;
+  Double_t Pi0Width_range[2] = {0.001,0.007};
+  Double_t Pi0Slope = 0.007;
+  Double_t Pi0Slope_range[2] = {0.001,0.016};
+       
+  Double_t Pi0FitRange[2] = {0.1,0.16};
+       
+  Bool_t MC = kFALSE;
+
+       
+  // --------------------------------- end of self definitions --------------------------------
+
+  TString filename = Form("%s%s.root",path,inputRootFile);     
+  TFile f(filename.Data());  
+
+  TCanvas* c_mass = new TCanvas("c_mass","",200,10,600,600);  // gives the page size
+  c_mass->SetFillColor(0);
+
+      
+  TDirectory *pwg4dir =(TDirectory*)f.Get(Form("PWG4_GammaConversion_%s",cutSelection));
+  TList *fHistosGammaConversion = (TList*)pwg4dir->Get(Form("histogramsAliGammaConversion_%s",cutSelection));
+  TList *fESDContainer = (TList*)fHistosGammaConversion->FindObject("ESD histograms");
+  TList *fMCContainer = (TList*)fHistosGammaConversion->FindObject("MC histograms");
+  TList *fBackgroundContainer = (TList*)fHistosGammaConversion->FindObject("Background histograms");
+  TH1F *ESD_Mother_Mass= (TH1F*)fESDContainer->FindObject("ESD_Mother_InvMass");
+           
+  TH1F *ESD_Background_Mass=(TH1F*)fBackgroundContainer->FindObject("ESD_Background_InvMass");
+           
+  TH1F * ESD_NumberOfContributorsVtx=(TH1F*)fESDContainer->FindObject("ESD_NumberOfContributorsVtx");
+  ESD_NumberOfContributorsVtx->SetAxisRange(1.,100.);
+           
+  Float_t nGoodEvents = ESD_NumberOfContributorsVtx->Integral();
+
+  ESD_Mother_Mass->Sumw2();
+  ESD_Background_Mass->Sumw2();
+
+  // for Pi0 reco efficiency
+  Double_t nPi0_MC = 0;
+  Double_t nPi0_MC_error = 0;
+  if(MC){
+    TH1D *MC_Pi0_Pt=fMCContainer->FindObject("MC_Pi0_Pt");
+    nPi0_MC = MC_Pi0_Pt->GetEntries();
+    nPi0_MC_error = sqrt(nPi0_MC);
+  }
+
+  // get counts for reco and background within pi0 range
+  TAxis *xaxis_reco = ESD_Mother_Mass->GetXaxis();                                                     
+  Int_t r_1 = xaxis_reco->FindBin(BGFit_range[0]);
+  Int_t r_2 = xaxis_reco->FindBin(BGFit_range[1]);  
+  Double_t r =  ESD_Mother_Mass->Integral(r_1,r_2); // Integral(75,125)
+  TAxis *xaxis_back =ESD_Background_Mass->GetXaxis();                                                  
+  Int_t b_1 = xaxis_back->FindBin(BGFit_range[0]);
+  Int_t b_2 = xaxis_back->FindBin(BGFit_range[1]);   
+  Double_t b =  ESD_Background_Mass->Integral(b_1,b_2);
+  Double_t norm = 1;
+  if(b != 0) norm = r/b;
+  ESD_Background_Mass->Sumw2();                
+  ESD_Background_Mass->Scale(norm);
+           
+  ESD_Mother_Mass->Rebin(RebinMass);
+  ESD_Background_Mass->Rebin(RebinMass);
+
+  ESD_Mother_Mass->SetTitle(Form("%s - cut: %s",inputRootFile,cutSelection));
+  ESD_Mother_Mass->SetXTitle("M_{#gamma#gamma} [GeV/c^{2}]");
+  ESD_Mother_Mass->GetXaxis()->SetRangeUser(0.0,0.3);  
+  ESD_Mother_Mass->SetLineColor(2);
+  ESD_Mother_Mass->Draw("");
+           
+  ESD_Background_Mass->GetXaxis()->SetRangeUser(0.0,0.3);      
+  ESD_Background_Mass->SetLineColor(4);
+  ESD_Background_Mass->Draw("same");
+           
+  if(writePlotFiles){
+    c_mass->Print(Form("%sSpectra-%s-%s.%s",outputDir,inputRootFile,cutSelection,suffix));
+  }
+  c_mass->Clear();
+
+  TAxis *xaxis_Reco = ESD_Mother_Mass->GetXaxis();     
+  Double_t ilowmassPi0_bin = xaxis_Reco->FindBin(0.1);  
+  Double_t ihighmassPi0_bin = xaxis_Reco->FindBin(0.16);       
+  Double_t Reco_error;
+  Double_t Reco = ESD_Mother_Mass->IntegralAndError(ilowmassPi0_bin,ihighmassPi0_bin,Reco_error);
+  //       cout << "Reco:   " << Reco << "      error:  " << Reco_error << endl;
+           
+  TAxis *xaxis_Back = ESD_Background_Mass->GetXaxis(); 
+  Double_t ilowmassPi0_bin = xaxis_Back->FindBin(0.1);  
+  Double_t ihighmassPi0_bin = xaxis_Back->FindBin(0.16);       
+  Double_t Back_error;
+  Double_t Back = ESD_Background_Mass->IntegralAndError(ilowmassPi0_bin,ihighmassPi0_bin,Back_error);
+  //       cout << "Back:   " << Back << "      error:  " << Back_error << endl;
+           
+               
+  TH1D* Signal = (TH1D*)ESD_Mother_Mass->Clone();
+  Signal->Sumw2();     
+  Signal->Add(ESD_Background_Mass,-1.);
+  Signal->Draw();
+           
+  Double_t Pi0Amplitude = Signal->GetMaximum();
+  Double_t Pi0Amplitude_Min = Pi0Amplitude*80/100;
+  Double_t Pi0Amplitude_Max = Pi0Amplitude*100/100;
+
+  TF1 *fReco = new TF1("Exp+Gauss","(x<[1])*([0]*(exp(-0.5*((x-[1])/[2])^2)+exp((x-[1])/[3])*(1-exp(-0.5*((x-[1])/[2])^2))))+(x>=[1])*([0]*exp(-0.5*((x-[1])/[2])^2))",Pi0FitRange[0],Pi0FitRange[1]); 
+           
+  // fit the peak around pi0 mass and draw             
+  fReco->SetParameter(0,Pi0Amplitude);
+  fReco->SetParameter(1,Pi0Mass);
+  fReco->SetParameter(2,Pi0Width);
+  fReco->SetParameter(3,Pi0Slope);
+           
+  fReco->SetParLimits(0,Pi0Amplitude_Min,Pi0Amplitude_Max);
+  fReco->SetParLimits(1,Pi0Mass_range[0],Pi0Mass_range[1]);
+  fReco->SetParLimits(2,Pi0Width_range[0],Pi0Width_range[1]);
+  fReco->SetParLimits(3,Pi0Slope_range[0],Pi0Slope_range[1]);
+           
+  Signal->Fit(fReco,"RME");
+  fReco->SetLineColor(3);
+  fReco->SetLineWidth(0.7);
+  fReco->SetLineStyle(4);              
+  fReco->Draw("same");
+           
+  Double_t parameter[4];
+  fReco->GetParameters(parameter);
+           
+  Double_t Mass = parameter[1];
+  Double_t Mass_error = fReco->GetParError(1);
+           
+  // calculation of FWHM + error
+  Int_t Pi0Amplitude_fit = fReco->GetMaximum(Pi0FitRange[0],Pi0FitRange[1]);
+  Int_t Pi0Amplitude_bin = fReco->GetXaxis()->FindBin(Pi0Amplitude_fit);
+  Double_t MassFWHM1 = fReco->GetX(Pi0Amplitude_fit*0.5,0.1,0.135);
+  Double_t MassFWHM2 = fReco->GetX(Pi0Amplitude_fit*0.5,0.135,0.16);           
+  Double_t FWHM = MassFWHM2 - MassFWHM1;
+
+  // + error
+  TF1 *fReco_EPlus = new TF1("Exp+Gauss","(x<[1])*([0]*(exp(-0.5*((x-[1])/[2])^2)+exp((x-[1])/[3])*(1-exp(-0.5*((x-[1])/[2])^2))))+(x>=[1])*([0]*exp(-0.5*((x-[1])/[2])^2))",Pi0FitRange[0],Pi0FitRange[1]); 
+  fReco_EPlus->SetParameter(0,parameter[0] + fReco->GetParError(0));
+  fReco_EPlus->SetParameter(1,parameter[1] + fReco->GetParError(1));
+  fReco_EPlus->SetParameter(2,parameter[2] + fReco->GetParError(2));
+  fReco_EPlus->SetParameter(3,parameter[3] + fReco->GetParError(3));
+
+  Int_t Pi0Amplitude_EPlus_fit = fReco_EPlus->GetMaximum(Pi0FitRange[0],Pi0FitRange[1]);
+  Int_t Pi0Amplitude_EPlus_bin = fReco_EPlus->GetXaxis()->FindBin(Pi0Amplitude_EPlus_fit);
+  Double_t MassFWHM1_EPlus = fReco_EPlus->GetX(Pi0Amplitude_EPlus_fit*0.5,0.1,0.135);
+  Double_t MassFWHM2_EPlus = fReco_EPlus->GetX(Pi0Amplitude_EPlus_fit*0.5,0.135,0.16);         
+  Double_t FWHM_EPlus = MassFWHM2_EPlus - MassFWHM1_EPlus;
+    
+  // - error
+  TF1 *fReco_EMinus = new TF1("Exp+Gauss","(x<[1])*([0]*(exp(-0.5*((x-[1])/[2])^2)+exp((x-[1])/[3])*(1-exp(-0.5*((x-[1])/[2])^2))))+(x>=[1])*([0]*exp(-0.5*((x-[1])/[2])^2))",Pi0FitRange[0],Pi0FitRange[1]); 
+  fReco_EMinus->SetParameter(0,parameter[0] - fReco->GetParError(0));
+  fReco_EMinus->SetParameter(1,parameter[1] - fReco->GetParError(1));
+  fReco_EMinus->SetParameter(2,parameter[2] - fReco->GetParError(2));
+  fReco_EMinus->SetParameter(3,parameter[3] - fReco->GetParError(3));
+           
+  Int_t Pi0Amplitude_EMinus_fit = fReco_EMinus->GetMaximum(Pi0FitRange[0],Pi0FitRange[1]);
+  Int_t Pi0Amplitude_EMinus_bin = fReco_EMinus->GetXaxis()->FindBin(Pi0Amplitude_EMinus_fit);
+  Double_t MassFWHM1_EMinus = fReco_EMinus->GetX(Pi0Amplitude_EMinus_fit*0.5,0.1,0.135);
+  Double_t MassFWHM2_EMinus = fReco_EMinus->GetX(Pi0Amplitude_EMinus_fit*0.5,0.135,0.16);              
+  Double_t FWHM_EMinus = MassFWHM2_EMinus - MassFWHM1_EMinus;           
+           
+  Double_t Error1 = TMath::Abs(FWHM-FWHM_EPlus);
+  Double_t Error2 = TMath::Abs(FWHM-FWHM_EMinus);
+           
+  Double_t FWHM_error;
+  if(Error1>=Error2) FWHM_error = Error1;
+  if(Error1 < Error2) FWHM_error = Error2;
+           
+  fstream file;
+  file.open(Form("%s%s-%s.dat",outputDir,outputDatFileBase,inputRootFile), ios::out|ios::app);
+  file << inputRootFile << "   " << cutSelection << "    " << nGoodEvents<< "  " << Reco << "  " << Reco_error  << "   " << Back << "  " << Back_error << "    " << Mass << "  " << Mass_error << "    " << FWHM << "  " << FWHM_error << "    " << nPi0_MC<< "    " << nPi0_MC_error << endl;
+  file.close();
+
+  if(writePlotFiles){
+    c_mass->Print(Form("%sInvMass-%s-%s.%s",outputDir,inputRootFile,cutSelection,suffix));
+  }
+  c_mass->Update();
+
+  delete fReco;
+  delete fReco_EPlus;
+  delete fReco_EMinus;
+  delete c_mass;
+}
diff --git a/PWG4/GammaConv/macros/Extract_Pi0_Characteristics.C b/PWG4/GammaConv/macros/Extract_Pi0_Characteristics.C
new file mode 100644 (file)
index 0000000..c7b3790
--- /dev/null
@@ -0,0 +1,364 @@
+
+#include <fstream>
+#include <Riostream.h>
+/*
+ *
+ *
+ *
+ */
+
+extern TRandom *gRandom;
+extern TBenchmark *gBenchmark;
+extern TSystem *gSystem;
+
+void Extract_Pi0_Characteristics(const char *cutSelection="", const char *inputRootFile = "AnalysisResults",const char *path = "./",const char*outputDir = "./Output/",Bool_t makeMappingPlots=kTRUE){ 
+       
+  gROOT->Reset();      
+  gROOT->SetStyle("Plain");
+  gStyle->SetOptFit(0);
+  // rebinning
+  Int_t RebinMass = 2;
+       
+  Double_t BGFit_range[2] = {0.17,0.3};        
+       
+  Double_t Pi0Mass = 0.135;
+  Double_t Pi0Mass_range[2] = {0.12,0.15};
+  Double_t Pi0Width = 0.003;
+  Double_t Pi0Width_range[2] = {0.001,0.007};
+  Double_t Pi0Slope = 0.007;
+  Double_t Pi0Slope_range[2] = {0.001,0.016};
+       
+  Double_t Pi0FitRange[2] = {0.1,0.16};
+       
+  // pt bins
+  Int_t NBinsPt = 31;
+  Double_t BinsPt[] = {0.0, 0.4, 0.8, 1.2, 1.6, 2.0, 2.4, 2.8, 3.2, 3.6, 4., 5., 6.,8.,10.,13.,15.,16.,17.,18.,19.,20.,21.,22.,23.,24.,25.,26.,27.,28.,29.,30.};  
+       
+  // input file
+  TString filename = Form("%s%s.root",path,inputRootFile);
+
+  TFile f(filename.Data());
+  
+  TFile *outputFile;
+  if(makeMappingPlots==kTRUE){
+    outputFile = new TFile(Form("%sPi0Characteristics.root",outputDir),"UPDATE");
+  }
+  TDirectory *pwg4dir =(TDirectory*)f.Get(Form("PWG4_GammaConversion_%s",cutSelection));
+  TList *fHistosGammaConversion = (TList*)pwg4dir->Get(Form("histogramsAliGammaConversion_%s",cutSelection));
+  TList *fESDContainer = (TList*)fHistosGammaConversion->FindObject("ESD histograms");
+  TList *fMCContainer = (TList*)fHistosGammaConversion->FindObject("MC histograms");
+  TList *fBackgroundContainer = (TList*)fHistosGammaConversion->FindObject("Background histograms");
+
+  TH2F *ESD_Mother_InvMass_vs_Pt = fESDContainer->FindObject("ESD_Mother_InvMass_vs_Pt");
+  ESD_Mother_InvMass_vs_Pt->Sumw2();   
+  TH2F *ESD_Background_InvMass_vs_Pt = fBackgroundContainer->FindObject("ESD_Background_InvMass_vs_Pt");
+  ESD_Background_InvMass_vs_Pt->Sumw2();
+               
+  //histos for comparison
+  TH1F *histoNormYield_Pi0 = new TH1F(Form("Norm_Yield_Pi0_%s",cutSelection),"",NBinsPt,BinsPt);
+  TH1F *histoRawYield_Pi0 = new TH1F(Form("Raw_Yield_Pi0_%s",cutSelection),"",NBinsPt,BinsPt);
+  TH1F *histoMass_Pi0 = new TH1F(Form("Mass_Pi0_%s",cutSelection),"",NBinsPt,BinsPt);
+  TH1F *histoFWHM_Pi0 = new TH1F(Form("FWHM_Pi0_%s",cutSelection),"",NBinsPt,BinsPt);
+  TH1F *histoSignificance_Pi0 = new TH1F(Form("Significance_Pi0_%s",cutSelection),"",NBinsPt,BinsPt);
+  TH1F *histoSB_Pi0 = new TH1F(Form("SB_Pi0_%s",cutSelection),"",NBinsPt,BinsPt);          
+  TH1F *histoSBRatio_Pi0 = new TH1F(Form("SBRatio_Pi0_%s",cutSelection),"",NBinsPt,BinsPt);        
+
+  // for yield correction in pt bins
+  TH1F *deltaPt = new TH1F("deltaPt","",NBinsPt,BinsPt);
+           
+  TH1F * ESD_NumberOfContributorsVtx = fESDContainer->FindObject("ESD_NumberOfContributorsVtx");
+  ESD_NumberOfContributorsVtx->SetAxisRange(1.,100.);
+  Float_t nGoodEvents = ESD_NumberOfContributorsVtx->Integral();
+  cout <<"# good events: "<< nGoodEvents << endl;
+               
+               
+  // binning / max pt from analysis
+  Double_t maxPt = ESD_Mother_InvMass_vs_Pt->GetYaxis()->GetBinCenter(ESD_Mother_InvMass_vs_Pt->GetNbinsY()) + ESD_Mother_InvMass_vs_Pt->GetYaxis()->GetBinWidth(ESD_Mother_InvMass_vs_Pt->GetNbinsY())/2.;
+  Double_t binningPt = ESD_Mother_InvMass_vs_Pt->GetNbinsY();
+               
+               
+  // ---------------------------------------------------------------------------------------------
+           
+  // extract yield, mass, significance and FWHM in pt bins
+
+  TH1D* Mapping_Reco_InvMass_PtBin[32];    // aray of histos for pt slices
+  TH1D* Mapping_Back_InvMass_PtBin[32];
+  TH1D* Mapping_Signal_InvMass_PtBin[32];   
+  TH1D* Mapping_SBRatio_InvMass_PtBin[32];   
+
+  TCanvas *canvas = new TCanvas("canvas","",200,10,600,600);  // gives the page size
+  canvas->SetFillColor(0);
+               
+  for(Int_t iPt = 2; iPt < NBinsPt+1; iPt++){
+    TString histonameReco = Form("Mapping_Reco_InvMass_in_Pt_Bin%s%02d",cutSelection ,iPt);
+    TString histonameBack = Form("Mapping_Back_InvMass_in_Pt_Bin%s%02d",cutSelection, iPt);
+
+    Mapping_Reco_InvMass_PtBin[iPt]=new TH1D(histonameReco.Data(),histonameReco.Data(),ESD_Mother_InvMass_vs_Pt->GetNbinsX(),0.,1.);
+    Mapping_Back_InvMass_PtBin[iPt]=new TH1D(histonameBack.Data(),histonameBack.Data(),ESD_Background_InvMass_vs_Pt->GetNbinsX(),0.,1.);
+                       
+    Int_t startBin = ESD_Mother_InvMass_vs_Pt->GetYaxis()->FindBin(BinsPt[iPt-1])-1;
+    Int_t endBin = ESD_Mother_InvMass_vs_Pt->GetYaxis()->FindBin(BinsPt[iPt])-1;
+                       
+    Double_t startpt = startBin*maxPt/binningPt;       
+    Double_t endpt = endBin*maxPt/binningPt;   
+                       
+    ESD_Mother_InvMass_vs_Pt->ProjectionX(histonameReco.Data(),startBin,endBin);
+    ESD_Background_InvMass_vs_Pt->ProjectionX(histonameBack.Data(),startBin,endBin);
+                       
+    Mapping_Reco_InvMass_PtBin[iPt]=(TH1D*)gDirectory->Get(histonameReco.Data());
+    Mapping_Reco_InvMass_PtBin[iPt]->Rebin(RebinMass);
+    Mapping_Back_InvMass_PtBin[iPt]=(TH1D*)gDirectory->Get(histonameBack.Data());
+    Mapping_Back_InvMass_PtBin[iPt]->Rebin(RebinMass);
+                       
+                       
+    // normalisation of background
+    TAxis *xaxis_reco = Mapping_Reco_InvMass_PtBin[iPt]->GetXaxis();                                                   
+    Int_t r_1 = xaxis_reco->FindBin(BGFit_range[0]);
+    Int_t r_2 = xaxis_reco->FindBin(BGFit_range[1]);  
+    Double_t r =  Mapping_Reco_InvMass_PtBin[iPt]->Integral(r_1,r_2); // Integral(75,125)
+    TAxis *xaxis_back = Mapping_Back_InvMass_PtBin[iPt]->GetXaxis();                                                   
+    Int_t b_1 = xaxis_back->FindBin(BGFit_range[0]);
+    Int_t b_2 = xaxis_back->FindBin(BGFit_range[1]);   
+    Double_t b =  Mapping_Back_InvMass_PtBin[iPt]->Integral(b_1,b_2);
+    Double_t norm = 1;
+    if(b != 0) norm = r/b;
+    Mapping_Back_InvMass_PtBin[iPt]->Sumw2();          
+    Mapping_Back_InvMass_PtBin[iPt]->Scale(norm);
+             
+    TString histonameSignal = Form("Mapping_Signal_InvMass_in_Pt_Bin%s%02d",cutSelection, iPt);
+    Mapping_Signal_InvMass_PtBin[iPt] = (TH1D*)Mapping_Reco_InvMass_PtBin[iPt]->Clone();
+    Mapping_Signal_InvMass_PtBin[iPt]->SetName(histonameSignal.Data());
+    Mapping_Signal_InvMass_PtBin[iPt]->SetTitle(histonameSignal.Data());
+    Mapping_Signal_InvMass_PtBin[iPt]->Sumw2();        
+    Mapping_Signal_InvMass_PtBin[iPt]->Add(Mapping_Back_InvMass_PtBin[iPt],-1.);
+
+    /*    TString histonameSBRatio= Form("Mapping_SBRatio_InvMass_in_Pt_Bin%02d", iPt);
+    Mapping_SBRatio_InvMass_PtBin[iPt]=->ProjectionX(histonameSBRatio.Data(),startBin,endBin);;
+    Mapping_SBRatio_InvMass_PtBin[iPt]->Add(Mapping_Reco_InvMass_PtBin[iPt],1);
+    Mapping_SBRatio_InvMass_PtBin[iPt]->Divide(Mapping_Back_InvMass_PtBin[iPt]);
+    Mapping_SBRatio_InvMass_PtBin[iPt]->Write();
+    */
+    Int_t bins =  Mapping_Signal_InvMass_PtBin[iPt]->GetNbinsX();
+    for(Int_t ib = 1; ib < bins; ib++){
+      Double_t error = Mapping_Signal_InvMass_PtBin[iPt]->GetBinError(ib);
+      if(abs(error) < 0.1) error = Mapping_Signal_InvMass_PtBin[iPt]->GetBinError(ib) +1;
+      Mapping_Signal_InvMass_PtBin[iPt]->SetBinError(ib,error);
+    }
+                       
+    Double_t Pi0Amplitude = Mapping_Signal_InvMass_PtBin[iPt]->GetMaximum();
+    Double_t Pi0Amplitude_Min = Pi0Amplitude*80/100;
+    Double_t Pi0Amplitude_Max = Pi0Amplitude*100/100;
+             
+    TAxis *xaxis = Mapping_Signal_InvMass_PtBin[iPt]->GetXaxis();      
+    Int_t ilowmassPi0_bin = xaxis->FindBin(Pi0FitRange[0]);  
+    Int_t ihighmassPi0_bin =xaxis->FindBin(Pi0FitRange[1]);    
+    if(makeMappingPlots){
+      Mapping_Signal_InvMass_PtBin[iPt]->Write();
+    }
+    TF1 *fReco = new TF1(Form("Exp+Gauss PtBin[%02d]",iPt),"(x<[1])*([0]*(exp(-0.5*((x-[1])/[2])^2)+exp((x-[1])/[3])*(1-exp(-0.5*((x-[1])/[2])^2))))+(x>=[1])*([0]*exp(-0.5*((x-[1])/[2])^2))",Pi0FitRange[0],Pi0FitRange[1]); 
+             
+    // fit the peak around pi0 mass and draw           
+    fReco->SetParameter(0,Pi0Amplitude);
+    fReco->SetParameter(1,Pi0Mass);
+    fReco->SetParameter(2,Pi0Width);
+    fReco->SetParameter(3,Pi0Slope);
+             
+    fReco->SetParLimits(0,Pi0Amplitude_Min,Pi0Amplitude_Max);
+    fReco->SetParLimits(1,Pi0Mass_range[0],Pi0Mass_range[1]);
+    fReco->SetParLimits(2,Pi0Width_range[0],Pi0Width_range[1]);
+    fReco->SetParLimits(3,Pi0Slope_range[0],Pi0Slope_range[1]);
+             
+    Mapping_Signal_InvMass_PtBin[iPt]->Fit(fReco,"RME");
+    //    Mapping_Signal_InvMass_PtBin[iPt]->Draw();
+    fReco->SetLineColor(3);
+    fReco->SetLineWidth(0.7);
+    fReco->SetLineStyle(4);            
+    fReco->Draw("same");
+    if(makeMappingPlots){
+      fReco->Write();
+    }
+    cout<<"Kenneth: Setting Bin content for bin: "<<iPt<<"  to "<<fReco->GetParameter(1)<<endl;
+    histoMass_Pi0->SetBinContent(iPt, fReco->GetParameter(1));
+    cout<<"Kenneth: Setting Bin content for bin: "<<iPt<<"  to "<<fReco->GetParError(1)<<endl;
+    histoMass_Pi0->SetBinError(iPt, fReco->GetParError(1));
+
+    TAxis *xaxis = Mapping_Signal_InvMass_PtBin[iPt]->GetXaxis();      
+    Int_t ilowmassPi0_bin = xaxis->FindBin(Pi0FitRange[0]);  
+    Int_t ihighmassPi0_bin =xaxis->FindBin(Pi0FitRange[1]);
+
+    Double_t Reco_error;
+    Double_t Background_error;
+    
+    Double_t IntReco = Mapping_Reco_InvMass_PtBin[iPt]->IntegralAndError(ilowmassPi0_bin,ihighmassPi0_bin,Reco_error);
+    Double_t IntBackground = Mapping_Back_InvMass_PtBin[iPt]->IntegralAndError(ilowmassPi0_bin,ihighmassPi0_bin,Background_error);
+    if(IntBackground>0){
+      Double_t SB= IntReco/IntBackground;
+      Double_t SB_error = sqrt( pow(Reco_error/IntBackground,2) + pow(IntReco/IntBackground/IntBackground*Background_error,2));                
+      
+      histoSB_Pi0->SetBinContent(iPt,SB);
+      histoSB_Pi0->SetBinError(iPt, SB_error);
+    }
+    //    canvas->Update();
+    //    canvas->Clear();
+    
+    Double_t parameter[4];
+    fReco->GetParameters(parameter);
+                       
+    // calculation of FWHM + error
+    Int_t Pi0Amplitude_fit = fReco->GetMaximum(Pi0FitRange[0],Pi0FitRange[1]);
+    Int_t Pi0Amplitude_bin = fReco->GetXaxis()->FindBin(Pi0Amplitude_fit);
+    Double_t MassFWHM1 = fReco->GetX(Pi0Amplitude_fit*0.5,0.1,0.135);
+    Double_t MassFWHM2 = fReco->GetX(Pi0Amplitude_fit*0.5,0.135,0.16);         
+    Double_t FWHM = MassFWHM2 - MassFWHM1;
+             
+    // + error
+    TF1 *fReco_EPlus = new TF1("Exp+Gauss","(x<[1])*([0]*(exp(-0.5*((x-[1])/[2])^2)+exp((x-[1])/[3])*(1-exp(-0.5*((x-[1])/[2])^2))))+(x>=[1])*([0]*exp(-0.5*((x-[1])/[2])^2))",Pi0FitRange[0],Pi0FitRange[1]); 
+    fReco_EPlus->SetParameter(0,parameter[0] + fReco->GetParError(0));
+    fReco_EPlus->SetParameter(1,parameter[1] + fReco->GetParError(1));
+    fReco_EPlus->SetParameter(2,parameter[2] + fReco->GetParError(2));
+    fReco_EPlus->SetParameter(3,parameter[3] + fReco->GetParError(3));
+                       
+    Int_t Pi0Amplitude_EPlus_fit = fReco_EPlus->GetMaximum(Pi0FitRange[0],Pi0FitRange[1]);
+    Int_t Pi0Amplitude_EPlus_bin = fReco_EPlus->GetXaxis()->FindBin(Pi0Amplitude_EPlus_fit);
+                       
+    Double_t MassFWHM1_EPlus = fReco_EPlus->GetX(Pi0Amplitude_EPlus_fit*0.5,0.1,0.135);
+    Double_t MassFWHM2_EPlus = fReco_EPlus->GetX(Pi0Amplitude_EPlus_fit*0.5,0.135,0.16);               
+    Double_t FWHM_EPlus = MassFWHM2_EPlus - MassFWHM1_EPlus;
+                       
+    // - error
+    TF1 *fReco_EMinus = new TF1("Exp+Gauss","(x<[1])*([0]*(exp(-0.5*((x-[1])/[2])^2)+exp((x-[1])/[3])*(1-exp(-0.5*((x-[1])/[2])^2))))+(x>=[1])*([0]*exp(-0.5*((x-[1])/[2])^2))",Pi0FitRange[0],Pi0FitRange[1]); 
+    fReco_EMinus->SetParameter(0,parameter[0] - fReco->GetParError(0));
+    fReco_EMinus->SetParameter(1,parameter[1] - fReco->GetParError(1));
+    fReco_EMinus->SetParameter(2,parameter[2] - fReco->GetParError(2));
+    fReco_EMinus->SetParameter(3,parameter[3] - fReco->GetParError(3));
+             
+    Int_t Pi0Amplitude_EMinus_fit = fReco_EMinus->GetMaximum(Pi0FitRange[0],Pi0FitRange[1]);
+    Int_t Pi0Amplitude_EMinus_bin = fReco_EMinus->GetXaxis()->FindBin(Pi0Amplitude_EMinus_fit);
+    Double_t MassFWHM1_EMinus = fReco_EMinus->GetX(Pi0Amplitude_EMinus_fit*0.5,0.1,0.135);
+    Double_t MassFWHM2_EMinus = fReco_EMinus->GetX(Pi0Amplitude_EMinus_fit*0.5,0.135,0.16);            
+    Double_t FWHM_EMinus = MassFWHM2_EMinus - MassFWHM1_EMinus;                 
+             
+    Double_t Error1 = TMath::Abs(FWHM-FWHM_EPlus);
+    Double_t Error2 = TMath::Abs(FWHM-FWHM_EMinus);
+             
+    Double_t FWHM_error;
+    if(Error1>=Error2) FWHM_error = Error1;
+    if(Error1 < Error2) FWHM_error = Error2;
+             
+    histoFWHM_Pi0->SetBinContent(iPt, FWHM);
+    histoFWHM_Pi0->SetBinError(iPt,FWHM_error);
+                       
+    Double_t Reco_error;
+    Double_t Background_error;
+             
+    Double_t Reco = Mapping_Reco_InvMass_PtBin[iPt]->IntegralAndError(ilowmassPi0_bin,ihighmassPi0_bin,Reco_error);
+    Double_t Background = Mapping_Back_InvMass_PtBin[iPt]->IntegralAndError(ilowmassPi0_bin,ihighmassPi0_bin,Background_error);
+             
+    if(Background>0){
+      Double_t Significance = Reco/sqrt(Background);
+      Double_t Significance_error = sqrt( pow(Reco_error/sqrt(Background),2) + pow( -0.5 * Reco/pow(Background,1.5) * Background_error,2) );
+      
+      histoSignificance_Pi0->SetBinContent(iPt,Significance);
+      histoSignificance_Pi0->SetBinError(iPt, Significance_error);
+    }
+    histoNormYield_Pi0->SetBinContent(iPt,(Reco-Background)/nGoodEvents);
+    histoNormYield_Pi0->SetBinError(iPt,sqrt(Reco_error*Reco_error + Background_error*Background_error)/nGoodEvents);
+
+    histoRawYield_Pi0->SetBinContent(iPt,Reco-Background);
+    histoRawYield_Pi0->SetBinError(iPt,sqrt(Reco_error*Reco_error + Background_error*Background_error));
+             
+             
+    deltaPt->SetBinContent(iPt, endpt-startpt);
+    deltaPt->SetBinError(iPt,0);
+    if(iPt == 2){
+      deltaPt->SetBinContent(1,startpt-0);
+      deltaPt->SetBinError(1,0);
+    } 
+  }
+               
+  delete [] Mapping_Reco_InvMass_PtBin;
+  delete [] Mapping_Back_InvMass_PtBin;
+  delete [] Mapping_Signal_InvMass_PtBin;   
+  delete [] Mapping_SBRatio_InvMass_PtBin;
+  // end of extract yield, mass .....
+               
+  // write the created histos into the output root file          
+
+  if(makeMappingPlots == kFALSE){// open the root file here so the mapping histograms is not included
+    outputFile = new TFile(Form("%sPi0Characteristics.root",outputDir),"UPDATE");
+  }
+
+  
+  //    ESD_Mother_InvMass_vs_Pt->ProjectionX(histonameReco.Data(),startBin,endBin);
+  //    ESD_Background_InvMass_vs_Pt->ProjectionX(histonameBack.Data(),startBin,endBin);
+  /*
+  histoSBRatio_Pi0->Add(ESD_Mother_InvMass_vs_Pt,1);
+  histoSBRatio_Pi0->Divide(ESD_Background_InvMass_vs_Pt);
+  histoSBRatio_Pi0->Write();
+  */
+  histoNormYield_Pi0->SetXTitle("p_{t} (GeV/c)");
+  histoNormYield_Pi0->Divide(deltaPt);
+  histoNormYield_Pi0->SetYTitle("#pi^{0} raw yield/per event");  
+  histoNormYield_Pi0->DrawCopy("e1");          
+  histoNormYield_Pi0->Write();
+  //  outputFile->Write();
+  canvas->Update();
+  canvas->Clear();
+
+  histoRawYield_Pi0->SetXTitle("p_{t} (GeV/c)");
+  histoRawYield_Pi0->Divide(deltaPt);
+  histoRawYield_Pi0->SetYTitle("#pi^{0} raw yield");
+  histoRawYield_Pi0->DrawCopy("e1");   
+  histoRawYield_Pi0->Write();
+  //  outputFile->Write();
+  canvas->Update();
+  canvas->Clear();
+           
+  histoMass_Pi0->SetXTitle("p_{t} (GeV/c)");
+  //  histoMass_Pi0->Divide(deltaPt);
+  histoMass_Pi0->SetYTitle("#pi^{0} mass");  
+  histoMass_Pi0->DrawCopy("e1");       
+  histoMass_Pi0->Write();
+  canvas->Update();
+  canvas->Clear();
+          
+  
+  histoSB_Pi0->SetXTitle("p_{t} (GeV/c)");
+  //  histoMass_Pi0->Divide(deltaPt);
+  histoSB_Pi0->SetYTitle("S/B");  
+  histoSB_Pi0->DrawCopy("e1");         
+  histoSB_Pi0->Write();
+  canvas->Update();
+  canvas->Clear(); 
+  
+  histoFWHM_Pi0->SetXTitle("p_{t} (GeV/c)");
+  //  histoFWHM_Pi0->Divide(deltaPt);
+  histoFWHM_Pi0->SetYTitle("#pi^{0} FWHM/2.36");  
+  histoFWHM_Pi0->DrawCopy("e1");       
+  histoFWHM_Pi0->Write();
+  canvas->Update();
+  canvas->Clear();
+           
+  histoSignificance_Pi0->SetXTitle("p_{t} (GeV/c)");
+  //  histoSignificance_Pi0->Divide(deltaPt);
+  histoSignificance_Pi0->SetYTitle("Significance");  
+  histoSignificance_Pi0->DrawCopy("e1");       
+  histoSignificance_Pi0->Write();
+  canvas->Update();
+  canvas->Clear();
+           
+  histoSBRatio_Pi0->Delete();
+  histoNormYield_Pi0->Delete();
+  histoRawYield_Pi0->Delete();
+  histoMass_Pi0->Delete();
+  histoFWHM_Pi0->Delete();
+  histoSignificance_Pi0->Delete();
+  histoSB_Pi0->Delete();
+  deltaPt->Delete();
+           
+  canvas->Delete();
+  
+  outputFile->Write();  
+  outputFile->Close();  
+}
diff --git a/PWG4/GammaConv/macros/MakeCutLog.C b/PWG4/GammaConv/macros/MakeCutLog.C
new file mode 100644 (file)
index 0000000..2849292
--- /dev/null
@@ -0,0 +1,60 @@
+// provided by Gamma Conversion Group, PWG4, Kathrin Koch, kkoch@physi.uni-heidelberg.de
+
+#include <Riostream>
+#include <fstream>
+using namespace std;
+
+void MakeCutLog(const char *inputRootFile = "AnalysisResults",const char *path = "./", const char* outputDir="./Output/"){
+
+  fstream outputFile(Form("%sCutSelection.log",outputDir),ios::out);
+  if(!outputFile.is_open()){
+    cout<<"Problem opening file"<<endl;
+    return;
+  }
+
+  //  Char_t filename_input1[200] = (Form("%s%s",path,input1));        
+  TString filename = Form("%s%s.root",path,inputRootFile);     
+  TFile f(filename.Data());  
+
+  TList *directories = f.GetListOfKeys(); // get the list of directories in the file
+  
+  for(Int_t entFile=0;entFile<directories->GetEntries();entFile++){
+
+    TObject * o = f.Get(directories->At(entFile)->GetName()); // get the object in the base directory
+
+    if(TString(o->IsA()->GetName())=="TDirectoryFile"){ // means that this is a directory (PWG4......)
+      
+      TDirectory *pwg4dir =(TDirectory*)o;
+      TString baseDirName = pwg4dir->GetName();
+      
+      TString reconstructionFlagString = ""; // this is for new scheme where also the flags are coded in numbers in the PWG4.... name
+
+      if(baseDirName.Length()>31){
+       reconstructionFlagString = baseDirName(baseDirName.Index("GammaConversion_")+16,8);
+      }
+      
+      TList *pwg4list = pwg4dir->GetListOfKeys(); // list of the yeys inside the base directory
+
+      for(Int_t entHist=0;entHist<pwg4list->GetEntries();entHist++){
+       TString name = pwg4list->At(entHist)->GetName();
+
+       if(name.Contains("container")==0){ // does not try to read the container (get errors if tried)
+         TObject * oHist = pwg4dir->Get(pwg4list->At(entHist)->GetName()); // get the object 
+         
+         if(TString(oHist->IsA()->GetName())=="TList"){ // check if the object is a TList
+           
+           TString listname = oHist->GetName();
+           cout<<"Reading: "<<listname.Data()<<endl;
+           
+           TString cutString = listname(listname.Index("_")+1,listname.Length()) + "\n";// get the Cut string from the name
+
+
+           outputFile << cutString.Data();
+         }
+       }
+      }
+    }
+  }
+  outputFile.close();
+}
diff --git a/PWG4/GammaConv/macros/Plot_IntegratedPi0Yield.C b/PWG4/GammaConv/macros/Plot_IntegratedPi0Yield.C
new file mode 100644 (file)
index 0000000..8304cb3
--- /dev/null
@@ -0,0 +1 @@
+#include <iostream>                             // Standardstream-Funktionaliät einbinden\r#include <fstream>                              // ofstream und ifstream einbinden\r#include <vector>\rusing namespace std;\r\rextern TRandom *gRandom;\rextern TBenchmark *gBenchmark;\rextern TSystem *gSystem;\r\r\rvoid  Plot_IntegratedPi0Yield(const char *input = "RB-data-AnalysisResults", const char *path = "./", const char *suffix = "gif"){    \r       \r  gROOT->Reset();\r  gROOT->SetStyle("Plain");\r  gStyle->SetOptStat(0); \r       \r  // Which file you want to analyse\r  //Char_t filename_input1[100] = (Form("%s%s",path,input1));\r\r  cout<<"Path is :"<<path<<endl;\r\r  TString fileName = Form("%s%s.dat",path,input);\r\r  vector<TString>  inputVector;\r  vector<TString>  cutVector;\r  vector<Double_t> nGoodEvents;\r  vector<Double_t> Reco;\r  vector<Double_t> Reco_error;\r  vector<Double_t> Background;\r  vector<Double_t> Background_error;\r  vector<Double_t> Mass;\r  vector<Double_t> Mass_error;\r  vector<Double_t> FWHM;\r  vector<Double_t> FWHM_error;\r  vector<Double_t> nPi0_MC;\r  vector<Double_t> nPi0_MC_error;\r       \r  ifstream in;\r  in.open(fileName.Data(),ios_base::in);\r  cout<<"Open the file: "<<fileName.Data()<<endl;\r     \r  while(!in.eof()){\r    string tmpStr;\r    Double_t tmpDouble;\r\r    in >> tmpStr;\r    inputVector.push_back(tmpStr);\r    in >> tmpStr;\r    cutVector.push_back(tmpStr);\r    in >> tmpDouble;\r    nGoodEvents.push_back(tmpDouble);\r    in >> tmpDouble;\r    Reco.push_back(tmpDouble);\r    in >> tmpDouble;\r    Reco_error.push_back(tmpDouble);\r    in >> tmpDouble;\r    Background.push_back(tmpDouble);\r    in >> tmpDouble;\r    Background_error.push_back(tmpDouble);\r    in >> tmpDouble;\r    Mass.push_back(tmpDouble);\r    in >> tmpDouble;\r    Mass_error.push_back(tmpDouble);\r    in >> tmpDouble;\r    FWHM.push_back(tmpDouble);\r    in >> tmpDouble;\r    FWHM_error.push_back(tmpDouble);\r    in >> tmpDouble;\r    nPi0_MC.push_back(tmpDouble);\r    in >> tmpDouble;\r    nPi0_MC_error.push_back(tmpDouble);\r  }\r  in.close();\r  \r  cout<<"The values are read"<<endl;\r\r  TH1F *histYield = new TH1F("Yield","",10,0.,10.);\r  TH1F *histSignificance = new TH1F("Significance","",10,0.,10.);\r  TH1F *histMass = new TH1F("Mass","",10,0.,10.);\r  TH1F *histFWHM = new TH1F("FWHM","",10,0.,10.);\r\r  if(nPi0_MC != 0){\r    TH1F *histEff = new TH1F("histEff","",10,0.,10.);\r  }\r        \r       \r  for(Int_t i = 1; i < inputVector.size(); i++){\r              \r    if(nGoodEvents[i-1] == 0){\r      cout<<"Warning:  nGoodEvents["<<i-1<<"]=0"<<endl;\r    }\r    else{\r      Double_t Yield = (Reco[i-1]-Background[i-1])/nGoodEvents[i-1];\r      Double_t Yield_error = sqrt(Reco_error[i-1]*Reco_error[i-1] + Background_error[i-1]*Background_error[i-1])/nGoodEvents[i-1];\r      histYield->SetBinContent(i,Yield);\r      histYield->SetBinError(i,Yield_error);\r      histYield->GetXaxis()->SetBinLabel(i,cutVector[i-1].Data());\r      \r      histMass->SetBinContent(i,Mass[i-1]);\r      histMass->SetBinError(i,Mass_error[i-1]);\r      histMass->GetXaxis()->SetBinLabel(i,cutVector[i-1].Data());\r      \r      histFWHM->SetBinContent(i,FWHM[i-1]/2.36);\r      histFWHM->SetBinError(i,FWHM_error[i-1]/2.36);\r      histFWHM->GetXaxis()->SetBinLabel(i,cutVector[i-1].Data());\r    }\r\r    if(Background[i-1]==0){\r      cout<<"Warning: Background["<<i-1<<"]=0"<<endl;\r    }\r    else{   \r      cout<<"BG good"<<endl;\r      Double_t Sign = Reco[i-1]/sqrt(Background[i-1]);\r      Double_t Sign_error = sqrt( pow(Reco_error[i-1]/sqrt(Background[i-1]),2) + pow( -0.5 * Reco[i-1]/pow(Background[i-1],1.5) * Background_error[i-1],2) );\r      histSignificance->SetBinContent(i,Sign);\r      histSignificance->SetBinError(i,Sign_error);\r      histSignificance->GetXaxis()->SetBinLabel(i,cutVector[i-1].Data());\r    }\r    if(nPi0_MC[i-1] == 0){\r      cout<<"Warning: nPi0_MC["<<i-1<<"]=0"<<endl;\r    }\r    else{\r      Double_t Eff = Reco[i-1]/nPi0_MC[i-1];\r      Double_t Eff_error = sqrt( pow(Reco_error[i-1]/nPi0_MC[i-1],2) + pow(Reco[i-1]/nPi0_MC[i-1]/nPi0_MC[i-1]*nPi0_MC_error[i-1],2)  );                \r      histEff->SetBinContent(i,Eff);\r      histEff->SetBinError(i,Eff_error);\r      histEff->GetXaxis()->SetBinLabel(i,cutVector[i-1].Data());         \r    }\r  }\r     \r  cout<<"Loop finished"<<endl;\r\r  //Create summary histograms and write them to file\r\r  // Yield\r  c_Yield = new TCanvas("c_Yield","",1000,600);  // gives the page size\r  c_Yield->SetTickx();\r  c_Yield->SetTicky();\r  c_Yield->SetGridx();\r  c_Yield->SetGridy();   \r  c_Yield->SetFillColor(0);\r  c_Yield->SetBottomMargin(0.2);\r  histYield->SetTitle(Form("%s",input));\r  histYield->SetYTitle("Int. Yield");  \r  histYield->GetYaxis()->SetRangeUser(1e-7,1e-3);        \r  histYield->SetMarkerStyle(20);  \r  histYield->SetMarkerColor(4);  \r  histYield->GetYaxis()->SetTitleOffset(1.3);\r  histYield->GetXaxis()->LabelsOption("v");\r  histYield->GetXaxis()->SetLabelSize(0.05);\r  histYield->DrawCopy("E,p");\r  c_Yield->Print(Form("%sPi0Yield_%s.%s",path,input,suffix));\r  c_Yield->Update();\r          \r  // Sign\r  c_Sign = new TCanvas("c_Sign","",1000,600);  // gives the page size\r  c_Sign->SetTickx();\r  c_Sign->SetTicky();\r  c_Sign->SetGridx();\r  c_Sign->SetGridy();        \r  c_Sign->SetFillColor(0);\r  c_Sign->SetBottomMargin(0.2);\r  histSignificance->SetTitle(Form("%s",input));     \r  histSignificance->SetYTitle("Significance");  \r  //histSignificance->GetYaxis()->SetDecimals();      \r  histSignificance->SetMarkerStyle(20);  \r  histSignificance->SetMarkerColor(4);  \r  histSignificance->GetYaxis()->SetTitleOffset(1.3);\r  histSignificance->GetXaxis()->LabelsOption("v");\r  histSignificance->GetXaxis()->SetLabelSize(0.05);\r  histSignificance->DrawCopy("E,p");\r  c_Sign->Print(Form("%sPi0Significance_%s.%s",path,input,suffix));\r  c_Sign->Update();\r   \r       \r  // Mass\r  c_Mass = new TCanvas("c_Mass","",1000,600);  // gives the page size\r  c_Mass->SetTickx();\r  c_Mass->SetTicky();\r  c_Mass->SetGridx();\r  c_Mass->SetGridy();        \r  c_Mass->SetFillColor(0);\r  c_Mass->SetBottomMargin(0.2);     \r  histMass->SetTitle(Form("%s",input));\r  histMass->SetYTitle("Mass");  \r  histMass->GetYaxis()->SetRangeUser(0.133,0.136);    \r  histMass->SetMarkerStyle(20);  \r  histMass->SetMarkerColor(4);  \r  histMass->GetYaxis()->SetTitleOffset(1.3);\r  histMass->GetXaxis()->LabelsOption("v");\r  histMass->GetXaxis()->SetLabelSize(0.05);\r  histMass->DrawCopy("E,p");\r  c_Mass->Print(Form("%sPi0Mass_%s.%s",path,input,suffix));\r  c_Mass->Update();\r   \r       \r  // FWHM\r  c_FWHM = new TCanvas("c_FWHM","",1000,600);  // gives the page size\r  c_FWHM->SetTickx();\r  c_FWHM->SetTicky();\r  c_FWHM->SetGridx();\r  c_FWHM->SetGridy();        \r  c_FWHM->SetFillColor(0);\r  c_FWHM->SetBottomMargin(0.2);\r  histFWHM->SetTitle(Form("%s",input));     \r  histFWHM->SetYTitle("FWHM");  \r  histFWHM->GetYaxis()->SetRangeUser(0.,0.01);        \r  histFWHM->SetMarkerStyle(20);  \r  histFWHM->SetMarkerColor(4);  \r  histFWHM->GetYaxis()->SetTitleOffset(1.3);\r  histFWHM->GetXaxis()->LabelsOption("v");\r  histFWHM->GetXaxis()->SetLabelSize(0.05);\r  histFWHM->DrawCopy("E,p");\r  c_FWHM->Print(Form("%sPi0FWHM_%s.%s",path,input,suffix));\r  c_FWHM->Update();\r   \r       \r  // Eff\r  if(nPi0_MC != 0){\r    c_Eff = new TCanvas("c_Eff","",1000,600);  // gives the page size\r    c_Eff->SetTickx();\r    c_Eff->SetTicky();\r    c_Eff->SetGridx();\r    c_Eff->SetGridy(); \r    c_Eff->SetFillColor(0);\r    c_Eff->SetBottomMargin(0.2);   \r    histEff->SetTitle(Form("%s",input));\r    histEff->SetYTitle("Reconstr. Eff.");  \r    //histEff->GetYaxis()->SetDecimals(); \r    histEff->SetMarkerStyle(20);  \r    histEff->SetMarkerColor(4);  \r    histEff->GetYaxis()->SetTitleOffset(1.3);\r    histEff->GetXaxis()->LabelsOption("v");\r    histEff->GetXaxis()->SetLabelSize(0.05);\r    histEff->DrawCopy("E,p");\r    c_Eff->Print(Form("%sPi0Eff_%s.%s",path,input,suffix));\r    c_Eff->Update();\r  }\r}\r
\ No newline at end of file
diff --git a/PWG4/GammaConv/macros/Plot_Mapping_Histos_Events.C b/PWG4/GammaConv/macros/Plot_Mapping_Histos_Events.C
new file mode 100644 (file)
index 0000000..6178f97
--- /dev/null
@@ -0,0 +1,1979 @@
+// provided by Gamma Conversion Group, PWG4, Kathrin Koch, kkoch@physi.uni-heidelberg.de and Friederike Bock, fbock@physi.uni-heidelberg.de
+
+#include <Riostream.h>
+#include <fstream>
+#include "PlottingGammaHistos.h"
+using namespace std;
+
+extern TRandom *gRandom;
+extern TBenchmark *gBenchmark;
+extern TSystem *gSystem;
+
+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"){     
+       
+       gROOT->Reset();
+       gROOT->SetStyle("Plain");
+       StyleSettings();        
+
+               // Which file you want to analyse
+       Char_t filename_input1[200] = (Form("%s%s",path,input1));
+       
+       Bool_t SinglePlots = kFALSE;
+       if(Plots == "kTRUE") SinglePlots = kTRUE;
+       
+       // the outputfile
+       TPostScript *ps_mapping = 0x0;
+       if(!SinglePlots)ps_mapping = new TPostScript(Form("%s%s.ps",path,output),111);
+       
+       //rebinning
+       const int rebin = 4;
+
+       //Which Minimum do you want to set for XY-2Dplot
+       Int_t minimumXY = 10;
+
+       //How big should the right margin in 2D plots be? Others are set by default setting.
+       Float_t RightMargin = 0.17;
+
+       //How many slices do you have?
+//     const int NbinsPhi = 8;  
+//     const int NbinsR = 12;
+       const int NbinsZ = 6;
+       const int NbinsR = 13;  
+       const int NbinsZ = 12;
+
+       // how many raws and colums you want to have in your output?
+       Int_t column = 2;
+       Int_t raw = 7;
+       
+       //Array for ZinR-Ranges
+       Float_t *RangeZinR[NbinsR] = {30,30,40,50,60,70,80,100,120,140,160,180,240}; 
+       //Float_t *RangeZinR[NbinsR] = {30,40,50,60,70,80,100,120,140,160,180,240};
+       
+       //Array of Rbins
+       Float_t ArrayRbins[12] = {3.5,5.75,9.5,13.,21.,27.5,35.,42.,55.,81.5,90,72.};
+       //Array of Zbins
+       Float_t ArrayZbins[11] = {0,15,30,50,100,200,-15,-30,-50,-100,-200};
+
+       //Array defintion for printing Logo in right upper corner
+       Float_t right_up[4]={0.7,0.63,0.15, 0.02};
+       Float_t right_down[4]={0.7,0.23,0.15, 0.02};
+       Float_t right_up2D[4]={0.68,0.775,0.11, 0.02};
+       //Array defintion for printing Logo in left upper corner
+       Float_t left_up[4]={0.17,0.73, 0.15, 0.02};
+       Float_t left_down[4] = {0.15,0.17, 0.15, 0.02};
+       //Array defintion for printing text in right upper corner
+       Float_t right_up_text[4]={0.6,0.8,0.15, 0.04};
+
+       // get the histos
+       TFile f1(filename_input1);  
+
+
+       // choice of dateset
+       if(cutsel != ""){
+               char *GammaDirectory = Form("PWG4_GammaConversion_%s",  cutsel);
+               cout << GammaDirectory << endl;
+               char *GammaList = Form("histogramsAliGammaConversion_%s", cutsel);
+               cout << GammaList << endl;
+       }else{
+               char *GammaDirectory = "PWG4_GammaConversion";
+               cout << GammaDirectory << endl;
+               char *GammaList = "histogramsAliGammaConversion";
+               cout << GammaList << endl;
+       }       
+
+       // labeling
+       char *StandardYAxis = "#gamma/ event scaled by multiplicity";
+       char *Date = "3rd June 2010";
+       TLatex *EtaRange = new TLatex(0.15,0.845,"|#eta| < 0.9 "); // Bo: this was modified
+                   EtaRange->SetNDC();
+                   EtaRange->SetTextFont(62);
+                   EtaRange->SetTextSize(0.04);
+                   EtaRange->SetLineWidth(6);  
+
+//------------------------------- Reading FILES        ----------------------------------------------------------------------
+        TDirectory *fPWG4GammaConversion_input1 = new TDirectory(); // definition of first folder / list       
+        TList *fHistosGammaConversion_input1 = new TList(); // definition of first folder / list
+        TList *fESDContainer_input1 = new TList();  // definition of following folder / list
+        TList *fMappingContainer_input1 = new TList();
+
+       fPWG4GammaConversion_input1 = (TDirectory*)f1.Get(GammaDirectory); 
+       fHistosGammaConversion_input1 = (TList*)fPWG4GammaConversion_input1->Get(GammaList); 
+       fMappingContainer_input1 = (TList*)fHistosGammaConversion_input1->FindObject("Mapping histograms"); 
+       fESDContainer_input1 = (TList*)fHistosGammaConversion_input1->FindObject("ESD histograms"); 
+       
+       TH1F *ESD_Conversion_R_input1=fESDContainer_input1->FindObject("ESD_Conversion_R");        
+       TH2F *ESD_Conversion_ZR_input1=fESDContainer_input1->FindObject("ESD_Conversion_ZR");
+       TH2F *ESD_Conversion_XY_input1=fESDContainer_input1->FindObject("ESD_Conversion_XY");
+       TH1F *ESD_Conversion_OpeningAngle_input1=fESDContainer_input1->FindObject("ESD_Conversion_OpeningAngle");
+       TH1D *ESD_Conversion_Z_input1=ESD_Conversion_ZR_input1->ProjectionX("ESD_Conversion_Z_input1");
+       TH1F *ESD_NumberOfContributorsVtx_input1=fESDContainer_input1->FindObject("ESD_NumberOfContributorsVtx");
+       TH1D *ESD_Conversion_Z_input1=ESD_Conversion_ZR_input1->ProjectionX("ESD_Cocdnversion_Z_input1");
+       TH1F *ScalingDiagramm_input1= fMappingContainer_input1->FindObject("ESD_Conversion_Mapping_Phi_in_R_11");
+       TH1F *ESD_NumberOfGoodESDTracks_input1=fESDContainer_input1->FindObject("ESD_NumberOfGoodESDTracksVtx");
+
+       ESD_NumberOfContributorsVtx_input1->SetAxisRange(1.,100.);      
+//     ESD_NumberOfGoodESDTracks_input1->SetAxisRange(1.,100.);
+
+       Float_t Scaling_input1 = ScalingDiagramm_input1->Integral();
+       Float_t nGoodEvents_input1 = ESD_NumberOfContributorsVtx_input1->Integral();
+       Float_t nGoodTrig_input1 = ESD_NumberOfContributorsVtx_input1->GetEntries();
+       Float_t nRecGamma_input1 = ESD_Conversion_R_input1->GetEntries();
+       cout<< input1 << "    Number of events::   " << nGoodEvents_input1 << "    Number of triggers::   " << nGoodTrig_input1 << "    Number reconstructed gammas::    "<< nRecGamma_input1 <<endl;
+
+       Double_t mean_input1 = ESD_NumberOfGoodESDTracks_input1->GetMean();
+
+       Float_t normFacRec_input1=1./nGoodEvents_input1;
+//     Float_t normFacRec_input1=1./Scaling_input1;
+       //Scaling reconstr.
+
+       GammaScalingHistogramm(ESD_Conversion_R_input1,normFacRec_input1);
+//     GammaScalingHistogramm(ESD_Conversion_ZR_input1,normFacRec_input1);
+//     GammaScalingHistogramm(ESD_Conversion_XY_input1,normFacRec_input1);
+       GammaScalingHistogramm(ESD_Conversion_OpeningAngle_input1,normFacRec_input1);
+       GammaScalingHistogramm(ESD_Conversion_Z_input1,normFacRec_input1);
+
+       TH1F *ESD_Conversion_R_summed_input1 = (TH1F*) ESD_Conversion_R_input1->Clone("ESD_Conversion_R_summed_input1");
+       ESD_Conversion_R_summed_input1->Reset();
+       Int_t ConvBinsR = ESD_Conversion_R_input1->GetNbinsX();
+       for(Int_t ConvR = 1; ConvR < ConvBinsR +1; ConvR++){
+               if (ConvR == 1){
+                       ESD_Conversion_R_summed_input1->AddBinContent(ConvR, ESD_Conversion_R_input1-> GetBinContent(ConvR));
+               } else {
+                       ESD_Conversion_R_summed_input1->AddBinContent(ConvR,(ESD_Conversion_R_summed_input1->GetBinContent(ConvR -1) + ESD_Conversion_R_input1->GetBinContent(ConvR)));         
+               }
+       }
+
+       TH1F *ESD_Conversion_Mapping_Phi_in_R_input1[NbinsR];
+       Char_t histoname_Phi_in_R_input1[100];
+       for(Int_t iR = 0; iR < NbinsR; iR++){
+               sprintf(histoname_Phi_in_R_input1,"ESD_Conversion_Mapping_Phi_in_R_%02d",iR);
+               ESD_Conversion_Mapping_Phi_in_R_input1[iR] = dynamic_cast<TH1F*>(fMappingContainer_input1->FindObject(histoname_Phi_in_R_input1));
+               GammaScalingHistogramm(ESD_Conversion_Mapping_Phi_in_R_input1[iR],normFacRec_input1);
+               ESD_Conversion_Mapping_Phi_in_R_input1[iR]->Rebin(rebin);       
+       }
+       
+       TH1F *ESD_Conversion_Mapping_Z_in_R_input1[NbinsR];
+       Char_t histoname_Z_in_R_input1[100];
+       for(Int_t iR = 0; iR < NbinsR; iR++){
+               sprintf(histoname_Z_in_R_input1,"ESD_Conversion_Mapping_Z_in_R_%02d",iR);
+               ESD_Conversion_Mapping_Z_in_R_input1[iR] = dynamic_cast<TH1F*>(fMappingContainer_input1->FindObject(histoname_Z_in_R_input1));
+               GammaScalingHistogramm(ESD_Conversion_Mapping_Z_in_R_input1[iR],normFacRec_input1);
+               ESD_Conversion_Mapping_Z_in_R_input1[iR]->Rebin(rebin);
+       }
+       
+       TH1F *ESD_Conversion_Mapping_Phi_in_Z_input1[NbinsZ];
+       Char_t histoname_Phi_in_Z_input1[100];
+       for(Int_t iZ = 0; iZ < NbinsZ; iZ++){
+               sprintf(histoname_Phi_in_Z_input1,"ESD_Conversion_Mapping_Phi_in_Z_%02d",iZ);
+               ESD_Conversion_Mapping_Phi_in_Z_input1[iZ] = dynamic_cast<TH1F*>(fMappingContainer_input1->FindObject(histoname_Phi_in_Z_input1));
+               GammaScalingHistogramm(ESD_Conversion_Mapping_Phi_in_Z_input1[iZ],normFacRec_input1);
+               ESD_Conversion_Mapping_Phi_in_Z_input1[iZ]->Rebin(rebin);
+       }
+
+       TH1F *ESD_Conversion_Mapping_R_in_Z_input1[NbinsZ];
+       Char_t histoname_R_in_Z_input1[100];
+       for(Int_t iZ = 0; iZ < NbinsZ; iZ++){
+               sprintf(histoname_R_in_Z_input1,"ESD_Conversion_Mapping_R_in_Z_%02d",iZ);
+               ESD_Conversion_Mapping_R_in_Z_input1[iZ] = dynamic_cast<TH1F*>(fMappingContainer_input1->FindObject(histoname_R_in_Z_input1));
+               GammaScalingHistogramm(ESD_Conversion_Mapping_R_in_Z_input1[iZ],normFacRec_input1);
+               ESD_Conversion_Mapping_R_in_Z_input1[iZ]->Rebin(rebin);
+       }
+       
+       // Middle Pt    
+       TH1F *ESD_Conversion_Mapping_MidPt_Phi_in_R_input1[NbinsR];
+       Char_t histoname_MidPt_Phi_in_R_input1[100];
+       for(Int_t iR = 0; iR < NbinsR; iR++){
+               sprintf(histoname_MidPt_Phi_in_R_input1,"ESD_Conversion_Mapping_MidPt_Phi_in_R_%02d",iR);
+               ESD_Conversion_Mapping_MidPt_Phi_in_R_input1[iR] = dynamic_cast<TH1F*>(fMappingContainer_input1->FindObject(histoname_MidPt_Phi_in_R_input1));
+               GammaScalingHistogramm(ESD_Conversion_Mapping_MidPt_Phi_in_R_input1[iR],normFacRec_input1);
+               ESD_Conversion_Mapping_MidPt_Phi_in_R_input1[iR] ->Rebin(rebin);
+       }
+       
+       TH1F *ESD_Conversion_Mapping_MidPt_Z_in_R_input1[NbinsR];
+       Char_t histoname_MidPt_Z_in_R_input1[100];
+       for(Int_t iR = 0; iR < NbinsR; iR++){
+               sprintf(histoname_MidPt_Z_in_R_input1,"ESD_Conversion_Mapping_MidPt_Z_in_R_%02d",iR);
+               ESD_Conversion_Mapping_MidPt_Z_in_R_input1[iR] = dynamic_cast<TH1F*>(fMappingContainer_input1->FindObject(histoname_MidPt_Z_in_R_input1));
+               GammaScalingHistogramm(ESD_Conversion_Mapping_MidPt_Z_in_R_input1[iR],normFacRec_input1);
+               ESD_Conversion_Mapping_MidPt_Z_in_R_input1[iR] ->Rebin(rebin);
+       }
+       
+       TH1F *ESD_Conversion_Mapping_MidPt_Phi_in_Z_input1[NbinsZ];
+       Char_t histoname_MidPt_Phi_in_Z_input1[100];
+       for(Int_t iZ = 0; iZ < NbinsZ; iZ++){
+               sprintf(histoname_MidPt_Phi_in_Z_input1,"ESD_Conversion_Mapping_MidPt_Phi_in_Z_%02d",iZ);
+               ESD_Conversion_Mapping_MidPt_Phi_in_Z_input1[iZ] = dynamic_cast<TH1F*>(fMappingContainer_input1->FindObject(histoname_MidPt_Phi_in_Z_input1));
+               GammaScalingHistogramm(ESD_Conversion_Mapping_MidPt_Phi_in_Z_input1[iZ],normFacRec_input1);
+               ESD_Conversion_Mapping_MidPt_Phi_in_Z_input1[iZ] ->Rebin(rebin);
+       }
+       
+       TH1F *ESD_Conversion_Mapping_MidPt_R_in_Z_input1[NbinsZ];
+       Char_t histoname_MidPt_R_in_Z_input1[100];
+       for(Int_t iZ = 0; iZ < NbinsZ; iZ++){
+               sprintf(histoname_MidPt_R_in_Z_input1,"ESD_Conversion_Mapping_MidPt_R_in_Z_%02d",iZ);
+               ESD_Conversion_Mapping_MidPt_R_in_Z_input1[iZ] = dynamic_cast<TH1F*>(fMappingContainer_input1->FindObject(histoname_MidPt_R_in_Z_input1));
+               GammaScalingHistogramm(ESD_Conversion_Mapping_MidPt_R_in_Z_input1[iZ],normFacRec_input1);
+               ESD_Conversion_Mapping_MidPt_R_in_Z_input1[iZ] ->Rebin(rebin);
+       }
+
+       // ------------------------------------- second file-----------------------------------------------------------
+       TFile *input2 = 0x0 ;
+       
+       TH1F *ESD_Conversion_Mapping_Phi_in_R_input2[NbinsR];
+       TH1F *ESD_Conversion_Mapping_Z_in_R_input2[NbinsR];
+       TH1F *ESD_Conversion_Mapping_Phi_in_Z_input2[NbinsZ];
+       TH1F *ESD_Conversion_Mapping_R_in_Z_input2[NbinsZ];
+       TH1F *ESD_Conversion_Mapping_MidPt_Phi_in_R_input2[NbinsR];
+       TH1F *ESD_Conversion_Mapping_MidPt_Z_in_R_input2[NbinsR];
+       TH1F *ESD_Conversion_Mapping_MidPt_Phi_in_Z_input2[NbinsZ];
+       TH1F *ESD_Conversion_Mapping_MidPt_R_in_Z_input2[NbinsZ];
+       
+       if(secondinput != ""){
+               
+               input2 = new TFile(Form("%s%s",path, secondinput));     
+
+                TDirectory *fPWG4GammaConversion_input2 = new TDirectory(); // definition of first folder / list       
+                TList *fHistosGammaConversion_input2 = new TList(); // definition of first folder / list
+                TList *fMappingContainer_input2 = new TList();  // definition of following folder / list
+                TList *fESDContainer_input2 = new TList();  // definition of following folder / list
+                
+               fPWG4GammaConversion_input2 = (TDirectory*)input2->Get(GammaDirectory); 
+               fHistosGammaConversion_input2 = (TList*)fPWG4GammaConversion_input2->Get(GammaList); 
+               fMappingContainer_input2 = (TList*)fHistosGammaConversion_input2->FindObject("Mapping histograms");
+               fESDContainer_input2 = (TList*)fHistosGammaConversion_input2->FindObject("ESD histograms"); 
+
+               TH1F * ESD_NumberOfGoodESDTracks_input2=fESDContainer_input2->FindObject("ESD_NumberOfGoodESDTracksVtx");                       
+               TH1F *ESD_Conversion_R_input2=fESDContainer_input2->FindObject("ESD_Conversion_R");        
+               TH2F *ESD_Conversion_ZR_input2=fESDContainer_input2->FindObject("ESD_Conversion_ZR");
+               TH2F *ESD_Conversion_XY_input2=fESDContainer_input2->FindObject("ESD_Conversion_XY");
+               TH1F *ESD_Conversion_OpeningAngle_input2=fESDContainer_input2->FindObject("ESD_Conversion_OpeningAngle");
+               TH1D *ESD_Conversion_Z_input2=ESD_Conversion_ZR_input2->ProjectionX("ESD_Conversion_Z_input2");
+               TH1F * ESD_NumberOfContributorsVtx_input2=fESDContainer_input2->FindObject("ESD_NumberOfContributorsVtx");
+               TH1F *ScalingDiagramm_input2= fMappingContainer_input2->FindObject("ESD_Conversion_Mapping_Phi_in_R_11");
+
+               ESD_NumberOfContributorsVtx_input2->SetAxisRange(1.,100.);
+       //      ESD_NumberOfGoodESDTracks_input2->SetAxisRange(1.,100.);
+       
+               Float_t Scaling_input2 = ScalingDiagramm_input2->Integral();
+               Float_t nGoodEvents_input2 = ESD_NumberOfContributorsVtx_input2->Integral();
+               Float_t nGoodTrig_input2 = ESD_NumberOfContributorsVtx_input2->GetEntries();
+               Float_t nRecGamma_input2 = ESD_Conversion_R_input2->GetEntries();
+               cout<< secondinput << "    Number of events::   " << nGoodEvents_input2 << "    Number of triggers::   " << nGoodTrig_input2 << "    Number reconstructed gammas::    "<< nRecGamma_input2 <<endl;
+
+               Double_t mean_input2 = ESD_NumberOfGoodESDTracks_input2->GetMean();
+
+       //      Float_t normFacRec_input2=1./nGoodEvents_input2;
+               Float_t normFacRec_input2=1./nGoodEvents_input2 * mean_input1/mean_input2;
+               
+               //Scaling reconstr.
+               GammaScalingHistogramm(ESD_Conversion_R_input2,normFacRec_input2);
+//             GammaScalingHistogramm(ESD_Conversion_ZR_input2,normFacRec_input2);
+//             GammaScalingHistogramm(ESD_Conversion_XY_input2,normFacRec_input2);
+               GammaScalingHistogramm(ESD_Conversion_OpeningAngle_input2,normFacRec_input2);
+               GammaScalingHistogramm(ESD_Conversion_Z_input2,normFacRec_input2);
+
+               TH1F *ESD_Conversion_R_summed_input2 = (TH1F*) ESD_Conversion_R_input2->Clone("ESD_Conversion_R_summed_input2");
+               ESD_Conversion_R_summed_input2->Reset();
+               Int_t ConvBinsR = ESD_Conversion_R_input2->GetNbinsX();
+               for(Int_t ConvR = 1; ConvR < ConvBinsR +1; ConvR++){
+                       if (ConvR == 1){
+                               ESD_Conversion_R_summed_input2->AddBinContent(ConvR, ESD_Conversion_R_input2-> GetBinContent(ConvR));
+                       } else {
+                               ESD_Conversion_R_summed_input2->AddBinContent(ConvR,(ESD_Conversion_R_summed_input2->GetBinContent(ConvR -1) + ESD_Conversion_R_input2->GetBinContent(ConvR)));         
+                       }
+               }
+
+               Char_t histoname_Phi_in_R_input2[100];
+               Char_t histoname_Ratio_Phi_in_R_input2[100];
+               TH1F *Ratio_Mapping_Phi_in_R[NbinsR];
+               for(Int_t iR = 0; iR < NbinsR; iR++){
+                       sprintf(histoname_Phi_in_R_input2,"ESD_Conversion_Mapping_Phi_in_R_%02d",iR);
+                       ESD_Conversion_Mapping_Phi_in_R_input2[iR] = dynamic_cast<TH1F*>(fMappingContainer_input2->FindObject(histoname_Phi_in_R_input2));
+                       GammaScalingHistogramm(ESD_Conversion_Mapping_Phi_in_R_input2[iR],normFacRec_input2);
+                       ESD_Conversion_Mapping_Phi_in_R_input2[iR]->Rebin(rebin);
+       
+                       sprintf(histoname_Ratio_Phi_in_R_input2,"Ratio_Mapping_Phi_in_R_%02d",iR);
+                       Ratio_Mapping_Phi_in_R[iR]= (TH1F*)ESD_Conversion_Mapping_Phi_in_R_input1[iR]->Clone();
+                       Ratio_Mapping_Phi_in_R[iR]->SetName(histoname_Ratio_Phi_in_R_input2); 
+                       Ratio_Mapping_Phi_in_R[iR]->Divide(Ratio_Mapping_Phi_in_R[iR],ESD_Conversion_Mapping_Phi_in_R_input2[iR]);
+               }
+               
+               Char_t histoname_Z_in_R_input2[100];
+               Char_t histoname_Ratio_Z_in_R_input2[100];
+               TH1F *Ratio_Mapping_Z_in_R[NbinsR];
+               for(Int_t iR = 0; iR < NbinsR; iR++){
+                       sprintf(histoname_Z_in_R_input2,"ESD_Conversion_Mapping_Z_in_R_%02d",iR);
+                       ESD_Conversion_Mapping_Z_in_R_input2[iR] = dynamic_cast<TH1F*>(fMappingContainer_input2->FindObject(histoname_Z_in_R_input2));
+                       GammaScalingHistogramm(ESD_Conversion_Mapping_Z_in_R_input2[iR],normFacRec_input2);
+                       ESD_Conversion_Mapping_Z_in_R_input2[iR]->Rebin(rebin);
+                       sprintf(histoname_Ratio_Z_in_R_input2,"Ratio_Mapping_Z_in_R_%02d",iR);
+                       Ratio_Mapping_Z_in_R[iR]= (TH1F*)ESD_Conversion_Mapping_Z_in_R_input1[iR]->Clone();
+                       Ratio_Mapping_Z_in_R[iR]->SetName(histoname_Ratio_Z_in_R_input2); 
+                       Ratio_Mapping_Z_in_R[iR]->Divide(Ratio_Mapping_Z_in_R[iR],ESD_Conversion_Mapping_Z_in_R_input2[iR]);
+               }
+               
+               Char_t histoname_Phi_in_Z_input2[100];
+               Char_t histoname_Ratio_Phi_in_Z_input2[100];
+               TH1F *Ratio_Mapping_Phi_in_Z[NbinsZ];
+               for(Int_t iZ = 0; iZ < NbinsZ; iZ++){
+                       sprintf(histoname_Phi_in_Z_input2,"ESD_Conversion_Mapping_Phi_in_Z_%02d",iZ);
+                       ESD_Conversion_Mapping_Phi_in_Z_input2[iZ] = dynamic_cast<TH1F*>(fMappingContainer_input2->FindObject(histoname_Phi_in_Z_input2));
+                       GammaScalingHistogramm(ESD_Conversion_Mapping_Phi_in_Z_input2[iZ],normFacRec_input2);
+                       ESD_Conversion_Mapping_Phi_in_Z_input2[iZ] ->Rebin(rebin);                      
+                       sprintf(histoname_Ratio_Phi_in_Z_input2,"Ratio_Mapping_Phi_in_Z_%02d",iZ);
+                       Ratio_Mapping_Phi_in_Z[iZ]= (TH1F*)ESD_Conversion_Mapping_Phi_in_Z_input1[iZ]->Clone();
+                       Ratio_Mapping_Phi_in_Z[iZ]->SetName(histoname_Ratio_Phi_in_Z_input2); 
+                       Ratio_Mapping_Phi_in_Z[iZ]->Divide(Ratio_Mapping_Phi_in_Z[iZ],ESD_Conversion_Mapping_Phi_in_Z_input2[iZ]);
+               }
+               
+               Char_t histoname_R_in_Z_input2[100];
+               Char_t histoname_Ratio_R_in_Z_input2[100];
+               TH1F *Ratio_Mapping_R_in_Z[NbinsZ];
+               for(Int_t iZ = 0; iZ < NbinsZ; iZ++){
+                       sprintf(histoname_R_in_Z_input2,"ESD_Conversion_Mapping_R_in_Z_%02d",iZ);
+                       ESD_Conversion_Mapping_R_in_Z_input2[iZ] = dynamic_cast<TH1F*>(fMappingContainer_input2->FindObject(histoname_R_in_Z_input2));
+                       GammaScalingHistogramm(ESD_Conversion_Mapping_R_in_Z_input2[iZ],normFacRec_input2);
+                       ESD_Conversion_Mapping_R_in_Z_input2[iZ] ->Rebin(rebin);
+                       sprintf(histoname_Ratio_Phi_in_Z_input2,"Ratio_Mapping_R_in_Z_%02d",iZ);
+                       Ratio_Mapping_R_in_Z[iZ]= (TH1F*)ESD_Conversion_Mapping_R_in_Z_input1[iZ]->Clone();
+                       Ratio_Mapping_R_in_Z[iZ]->SetName(histoname_Ratio_R_in_Z_input2); 
+                       Ratio_Mapping_R_in_Z[iZ]->Divide(Ratio_Mapping_R_in_Z[iZ],ESD_Conversion_Mapping_R_in_Z_input2[iZ]);
+               }
+               
+               // Middle Pt    
+               Char_t histoname_MidPt_Phi_in_R_input2[100];
+               for(Int_t iR = 0; iR < NbinsR; iR++){
+                       sprintf(histoname_MidPt_Phi_in_R_input2,"ESD_Conversion_Mapping_MidPt_Phi_in_R_%02d",iR);
+                       ESD_Conversion_Mapping_MidPt_Phi_in_R_input2[iR] = dynamic_cast<TH1F*>(fMappingContainer_input2->FindObject(histoname_MidPt_Phi_in_R_input2));
+                       GammaScalingHistogramm(ESD_Conversion_Mapping_MidPt_Phi_in_R_input2[iR],normFacRec_input2);
+                       ESD_Conversion_Mapping_MidPt_Phi_in_R_input2[iR] ->Rebin(rebin);
+               }
+               
+               Char_t histoname_MidPt_Z_in_R_input2[100];
+               for(Int_t iR = 0; iR < NbinsR; iR++){
+                       sprintf(histoname_MidPt_Z_in_R_input2,"ESD_Conversion_Mapping_MidPt_Z_in_R_%02d",iR);
+                       ESD_Conversion_Mapping_MidPt_Z_in_R_input2[iR] = dynamic_cast<TH1F*>(fMappingContainer_input2->FindObject(histoname_MidPt_Z_in_R_input2));
+                       GammaScalingHistogramm(ESD_Conversion_Mapping_MidPt_Z_in_R_input2[iR],normFacRec_input2);
+                       ESD_Conversion_Mapping_MidPt_Z_in_R_input2[iR] ->Rebin(rebin);
+               }
+               
+               Char_t histoname_MidPt_Phi_in_Z_input2[100];
+               for(Int_t iZ = 0; iZ < NbinsZ; iZ++){
+                       sprintf(histoname_MidPt_Phi_in_Z_input2,"ESD_Conversion_Mapping_MidPt_Phi_in_Z_%02d",iZ);
+                       ESD_Conversion_Mapping_MidPt_Phi_in_Z_input2[iZ] = dynamic_cast<TH1F*>(fMappingContainer_input2->FindObject(histoname_MidPt_Phi_in_Z_input2));
+                       GammaScalingHistogramm(ESD_Conversion_Mapping_MidPt_Phi_in_Z_input2[iZ],normFacRec_input2);
+                       ESD_Conversion_Mapping_MidPt_Phi_in_Z_input2[iZ] ->Rebin(rebin);
+               }
+               
+               Char_t histoname_MidPt_R_in_Z_input2[100];
+               for(Int_t iZ = 0; iZ < NbinsZ; iZ++){
+                       sprintf(histoname_MidPt_R_in_Z_input2,"ESD_Conversion_Mapping_MidPt_R_in_Z_%02d",iZ);
+                       ESD_Conversion_Mapping_MidPt_R_in_Z_input2[iZ] = dynamic_cast<TH1F*>(fMappingContainer_input2->FindObject(histoname_MidPt_R_in_Z_input2));
+                       GammaScalingHistogramm(ESD_Conversion_Mapping_MidPt_R_in_Z_input2[iZ],normFacRec_input2);
+                       ESD_Conversion_Mapping_MidPt_R_in_Z_input2[iZ] ->Rebin(rebin);
+               }       
+       }
+       // end second file
+       
+       
+       // -----------------page 1---------------------------------------------------------------------------
+       
+       // plot the ESD histos
+               
+       TLine * linePhi = new TLine (-3.2,1,3.2,1);
+       TLine * lineZ = new TLine (-300,1,300,1);
+       TLine * lineR = new TLine (0,1,200,1);
+       linePhi->SetLineColor(2);
+       lineZ->SetLineColor(2);
+       lineR->SetLineColor(2);
+
+       leg1 = new TLegend(0.6,0.82,0.9,0.9);
+       leg1->AddEntry(ESD_Conversion_R_input1,("Data"),"l");
+       if(secondinput != ""){
+       leg1->AddEntry(ESD_Conversion_R_input2,("MC"),"l");}
+       leg1->SetFillColor(0);
+       leg1->SetTextSize(0.04);
+
+
+if (!SinglePlots) {    
+       ps_mapping->NewPage();
+//     c_0 = new TCanvas("c_0","",200,10,700,1000);  // gives the page size
+       
+       title0 = new TPaveLabel(0.05,0.92,0.95,0.96,(Form("Input1: %s",input1)));       
+       title0->SetFillColor(16);
+       title0->SetTextSize(0.25);
+//     title0->Draw();
+       
+       if(secondinput != ""){
+               title1 = new TPaveLabel(0.05,0.87,0.95,0.91,(Form("Input2: %s",secondinput)));  
+               title1->SetFillColor(16);
+               title1->SetTextSize(0.25);
+//             title1->Draw();
+       }
+//     c_0->Update();
+       
+       // --------------------------------page 2 - R-distributions -----------------------------------         
+       
+       ps_mapping->NewPage();
+       
+       c_R = new TCanvas("c_R","",200,10,700,1000);  // gives the page size
+       
+       pad_R = new TPad("pad_R","",0.05,0.05,0.95,0.85,0);   // gives the size of the histo areas      
+       pad_R->SetFillColor(0);
+       pad_R->GetFrame()->SetFillColor(0);
+       pad_R->SetBorderMode(0);
+       pad_R->Divide(2,2);
+       pad_R->Draw();
+       
+       title0->Draw(); if(secondinput != ""){title1->Draw();}
+       
+       pad_R->cd(1);
+       pad_R->cd(1)->SetLogy(1);
+               if(secondinput == ""){
+                               DrawAutoGammaHisto( ESD_Conversion_R_input1, 
+                                                                "Conversions R distribution","R [cm]",StandardYAxis,
+                                                                kTRUE, 1.5,0.00001,
+                                                                kFALSE,0. ,0,
+                                                                kTRUE, 0.,180.);
+               }else{
+                               DrawAutoGammaHistos( ESD_Conversion_R_input1, 
+                                                                ESD_Conversion_R_input2, 
+                                                                "Conversions R distribution","R [cm]",StandardYAxis,
+                                                                kTRUE, 1.5,0.00001,
+                                                                kFALSE,0. ,0.,
+                                                                kTRUE, 0.,180.);
+               }
+               for(Int_t i=0; i < 12 ; i++){
+                       DrawGammaLines(ArrayRbins[i], ArrayRbins[i], 0.00001,ESD_Conversion_R_input1->GetMaximum());
+               }               
+               DrawAliceLogo(right_up [0],right_up[1],right_up[2],right_up[3]);        
+               
+       pad_R->cd(2);   
+               if(secondinput == ""){
+                               DrawAutoGammaHisto( ESD_Conversion_R_input1, 
+                                                                "Conversions R distribution","R [cm]",StandardYAxis,
+                                                                kFALSE, 1.5,0,
+                                                                kFALSE,0. ,0.,
+                                                                kTRUE, 0.,180.);
+               }else{
+                               DrawAutoGammaHistos( ESD_Conversion_R_input1, 
+                                                                ESD_Conversion_R_input2, 
+                                                                "Conversions R distribution","R [cm] ",StandardYAxis,
+                                                                kFALSE, 1.5,0,
+                                                                kFALSE,0. ,0.,
+                                                                kTRUE, 0.,180.);
+               }
+               for(Int_t i=0; i < 12 ; i++){
+                       DrawGammaLines(ArrayRbins[i], ArrayRbins[i], 0.,ESD_Conversion_R_input1->GetMaximum());
+               }
+
+               DrawAliceLogo(right_up [0],right_up[1],right_up[2],right_up[3]);        
+
+       
+       //----------------------------- Integrated Radius -----------------------
+       pad_R->cd(3);
+       pad_R->cd(3)->SetLogy(1);
+               if(secondinput == ""){
+                               DrawAutoGammaHisto( ESD_Conversion_R_summed_input1, 
+                                                                "Conversions R distribution","R [cm]","Integrated (0-to-R) #gamma candidates/event scaled by multiplicity",
+                                                                kTRUE, 1.5,0.000001,
+                                                                kFALSE,0. ,0.,
+                                                                kTRUE, 0.,180.);
+               }else{
+                               DrawAutoGammaHistos( ESD_Conversion_R_summed_input1, 
+                                                                ESD_Conversion_R_summed_input2, 
+                                                                "Integrated Radius of Conversion","R [cm] ","Integrated (0-to-R) #gamma candidates/event scaled by multiplicity",
+                                                                kTRUE, 1.5,0.000001,
+                                                                kFALSE,0. ,0.,
+                                                                kTRUE, 0.,180.);
+               }
+               DrawAliceLogo(right_down [0],right_down[1],right_down[2],right_down[3]);        
+               
+       pad_R->cd(4);
+       pad_R->cd(4)->SetLogy(0);
+               if(secondinput == ""){
+                               DrawAutoGammaHisto( ESD_Conversion_R_summed_input1, 
+                                                                "Conversions R distribution","R [cm]","Integrated (0-to-R) #gamma candidates/event scaled by multiplicity",
+                                                                kTRUE, 1.5,0,
+                                                                kFALSE,0. ,0.,
+                                                                kTRUE, 0.,180.);
+               }else{
+                               DrawAutoGammaHistos( ESD_Conversion_R_summed_input1, 
+                                                                ESD_Conversion_R_summed_input2, 
+                                                                "Integrated Radius of Conversion","R [cm] ","Integrated (0-to-R) #gamma candidates/event scaled by multiplicity",
+                                                                kTRUE, 1.5,0,
+                                                                kFALSE,0. ,0.,
+                                                                kTRUE, 0.,180.);
+               }
+               DrawAliceLogo(left_up [0],left_up[1],left_up[2],left_up[3]);    
+
+       pad_R->Update();
+
+       //--------------------------- Page 3  - Z-Distributions -----------------------------------------------
+       ps_mapping->NewPage();
+       
+       c_Z = new TCanvas("c_Z","",200,10,700,1000);  // gives the page size
+       
+       pad_Z = new TPad("pad_Z","",0.05,0.05,0.95,0.85,0);   // gives the size of the histo areas 
+       pad_Z->SetFillColor(0);
+       pad_Z->GetFrame()->SetFillColor(0);
+       pad_Z->SetBorderMode(0);
+       pad_Z->Divide(2,2);
+       pad_Z->Draw();
+       
+       title0->Draw(); if(secondinput != ""){title1->Draw();}
+       
+       pad_Z->cd(1);
+       pad_Z->cd(1)->SetLogy(1);
+               if(secondinput == ""){
+                               DrawAutoGammaHisto( ESD_Conversion_Z_input1
+                                                                "Conversions Z distribution","Z [cm]",StandardYAxis,
+                                                                kTRUE, 1.5,0.00001,
+                                                                kFALSE,0. ,0,
+                                                                kTRUE, -201.,201.);
+               }else{
+                               DrawAutoGammaHistos( ESD_Conversion_Z_input1, 
+                                                                ESD_Conversion_Z_input2, 
+                                                                "Conversions Z distribution","Z [cm] ",StandardYAxis,
+                                                                kTRUE, 1.5,0.00001,
+                                                                kFALSE,0. ,0.,
+                                                                kTRUE, -201.,201.);
+               }
+               for(Int_t i=0; i < 12 ; i++){
+                       DrawGammaLines(ArrayZbins[i], ArrayZbins[i], 0.00001,ESD_Conversion_Z_input1->GetMaximum());
+               }
+               DrawAliceLogo(right_up [0],right_up[1],right_up[2],right_up[3]);        
+       pad_Z->cd(2);
+       pad_Z->cd(2)->SetLogy(0);
+               if(secondinput == ""){
+                               DrawAutoGammaHisto( ESD_Conversion_Z_input1
+                                                                "Conversions Z distribution","Z [cm]",StandardYAxis,
+                                                                kTRUE, 1.5,0.00001,
+                                                                kFALSE,0. ,0,
+                                                                kTRUE, -201.,201.);
+               }else{
+                               DrawAutoGammaHistos( ESD_Conversion_Z_input1, 
+                                                                ESD_Conversion_Z_input2, 
+                                                                "Conversions Z distribution","Z [cm] ",StandardYAxis,
+                                                                kTRUE, 1.5,0.00001,
+                                                                kFALSE,0. ,0.,
+                                                                kTRUE, -201.,201.);
+               }
+               for(Int_t i=0; i < 12 ; i++){
+                       DrawGammaLines(ArrayZbins[i], ArrayZbins[i], 0.00001,ESD_Conversion_Z_input1->GetMaximum());
+               }               
+               DrawAliceLogo(right_up [0],right_up[1],right_up[2],right_up[3]);        
+
+       pad_Z->Update();
+
+       
+       // --------------------------------page 4 - 2 Dimensional Plots-----------------------------------              
+       
+       //hier
+       
+       ps_mapping->NewPage();
+       
+       c_2dims = new TCanvas("c_2dims","",200,10,700,1000);  // gives the page size
+
+       pad_2dims = new TPad("pad_2dims","",0.05,0.05,0.95,0.85,0);   // gives the size of the histo areas 
+       pad_2dims->SetFillColor(0);
+       pad_2dims->GetFrame()->SetFillColor(0);
+       pad_2dims->SetBorderMode(0);
+       pad_2dims->Divide(2,2);
+       pad_2dims->Draw();
+       
+       title0->Draw(); if(secondinput != ""){title1->Draw();}
+
+       pad_2dims->cd(1)->SetRightMargin(RightMargin);                          
+       pad_2dims->cd(1);
+       pad_2dims->cd(1)->SetLogz(1);           
+                       DrawAutoGammaHisto2D(   ESD_Conversion_ZR_input1,
+                                                               "Conversion in ZR- input 1", "Z [cm]", "R [cm]", "Data",
+                                                               kTRUE, 0., 200.,
+                                                               kFALSE, 0., 20.);
+                       DrawAliceLogo(right_up2D [0],right_up2D[1],right_up2D[2],right_up2D[3]);
+       pad_2dims->cd(2)->SetRightMargin(RightMargin);                                     
+       pad_2dims->cd(2);
+       pad_2dims->cd(2)->SetLogz(1);   
+                       DrawAutoGammaHisto2D(   ESD_Conversion_XY_input1,
+                                                               "Conversion in XY- input 1", "X [cm]", "Y [cm]", "Data",
+                                                               kTRUE, -180., 180.,
+                                                               kTRUE, -180., 180.);
+                       DrawAliceLogo(right_up2D [0],right_up2D[1],right_up2D[2],right_up2D[3]);
+       
+       if(secondinput != ""){
+               pad_2dims->cd(3)->SetRightMargin(RightMargin);                          
+               pad_2dims->cd(3);
+               pad_2dims->cd(3)->SetLogz(1);   
+                       DrawAutoGammaHisto2D(   ESD_Conversion_ZR_input2,
+                                                               "Conversion in ZR- input 2", "Z [cm]", "R [cm]", "MC",
+                                                               kTRUE, 0., 200.,
+                                                               kFALSE, 0., 20.);
+                       DrawAliceLogo(right_up2D [0],right_up2D[1],right_up2D[2],right_up2D[3]);
+               pad_2dims->cd(4)->SetRightMargin(RightMargin);                          
+               pad_2dims->cd(4);
+               pad_2dims->cd(4)->SetLogz(1);   
+                       DrawAutoGammaHisto2D(   ESD_Conversion_XY_input2,
+                                                               "Conversion in XY- input 2", "X [cm]", "Y [cm]", "MC",
+                                                               kTRUE, -180., 180.,
+                                                               kTRUE, -180., 180.);
+                       DrawAliceLogo(right_up2D [0],right_up2D[1],right_up2D[2],right_up2D[3]);
+       }       
+       
+       pad_2dims->Update();
+
+
+       // ----------------------------------- Page 5 - Phi in R -------------------------------------
+       ps_mapping->NewPage();
+
+       c_Phi_in_R = new TCanvas("c_Phi_in_R","",200,10,700,1000);  // gives the page size
+       
+       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 
+       pad_Phi_in_R->SetFillColor(0);
+       pad_Phi_in_R->GetFrame()->SetFillColor(0);
+       pad_Phi_in_R->SetBorderMode(0);
+       pad_Phi_in_R->Divide(column,raw);
+       pad_Phi_in_R->Draw();
+       
+       title0->Draw();
+       if(secondinput != ""){
+               title1->Draw();
+       }
+       
+       Double_t Integ_R_input1[NbinsR];        
+       Double_t Integ_R_input2[NbinsR];                        
+
+       for(Int_t iR = 0; iR < NbinsR; iR++){
+               Int_t place = iR + 1;
+               
+               pad_Phi_in_R->cd(place);
+               pad_Phi_in_R->cd(place)->SetLogy(1);
+               sprintf(histoname_Phi_in_R_input1,"ESD_Conversion_Mapping_Phi_in_R_iR%02d",iR);
+               if(secondinput == ""){          
+                       DrawAutoGammaHisto( ESD_Conversion_Mapping_Phi_in_R_input1[iR], 
+                                                                histoname_Phi_in_R_input1,"#Phi",StandardYAxis,
+                                                                kTRUE,3 ,0.000001,
+                                                                kFALSE,0. ,0.,
+                                                                kFALSE, 0.,180.);
+               }else{
+                       DrawAutoGammaHistos( ESD_Conversion_Mapping_Phi_in_R_input1[iR], 
+                                                                ESD_Conversion_Mapping_Phi_in_R_input2[iR], 
+                                                                histoname_Phi_in_R_input1,"#Phi",StandardYAxis,
+                                                                kTRUE,3 ,0.000001,
+                                                                kFALSE,0. ,0.,
+                                                                kFALSE, 0.,180.);
+                       Integ_R_input1[iR]=ESD_Conversion_Mapping_Phi_in_R_input1[iR]->Integral() ;                     
+                       Integ_R_input2[iR]=ESD_Conversion_Mapping_Phi_in_R_input2[iR]->Integral() ;     
+               }       
+       }
+       pad_Phi_in_R->Update();
+       
+       //------------------------------ Page 6 - Ratio Phi in R --------------------------------------
+       if(secondinput != ""){  ps_mapping->NewPage();
+
+       c_Ratio_Phi_in_R = new TCanvas("c_Ratio_Phi_in_R","",200,10,700,1000);  // gives the page size
+       
+       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 
+       pad_Ratio_Phi_in_R->SetFillColor(0);
+       pad_Ratio_Phi_in_R->GetFrame()->SetFillColor(0);
+       pad_Ratio_Phi_in_R->SetBorderMode(0);
+       pad_Ratio_Phi_in_R->Divide(column,raw);
+       pad_Ratio_Phi_in_R->Draw();
+       
+       title0->Draw();
+       if(secondinput != ""){
+               title1->Draw();
+       }
+
+       for(Int_t iR = 0; iR < NbinsR; iR++){
+               Int_t place = iR + 1;
+               
+               pad_Ratio_Phi_in_R->cd(place);
+               pad_Ratio_Phi_in_R->cd(place)->SetLogy(1);
+               sprintf(histoname_Ratio_Phi_in_R_input2,"Ratio_Phi_in_R_iR%02d",iR);
+               if(secondinput != ""){          
+                       DrawRatioGammaHisto(    Ratio_Mapping_Phi_in_R[iR], 
+                                                                histoname_Ratio_Phi_in_R_input2,"#Phi","norm Data/norm MC",
+                                                                kFALSE,3 ,0.000001,
+                                                                kTRUE,0.1 ,5.,
+                                                                kFALSE, 0.,180.);
+                       linePhi->Draw("same");
+               }       
+       }
+       pad_Ratio_Phi_in_R->Update();
+}
+
+
+       //--------------- page 7 - Z in R ---------------------------------------------------
+       
+       ps_mapping->NewPage();
+       
+       c_Z_in_R = new TCanvas("c_Z_in_R","",200,10,700,1000);  // gives the page size
+       
+       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 
+       pad_Z_in_R->SetFillColor(0);
+       pad_Z_in_R->GetFrame()->SetFillColor(0);
+       pad_Z_in_R->SetBorderMode(0);
+       pad_Z_in_R->Divide(column,raw);
+       pad_Z_in_R->Draw();
+       
+       title0->Draw(); 
+       if(secondinput != ""){title1->Draw();}
+       
+       Double_t Integ_ZinR_input1[NbinsR];     
+       Double_t Integ_ZinR_input2[NbinsR];                     
+       
+       
+       for(Int_t iR = 0; iR < NbinsR; iR++){
+               Int_t place = iR + 1;
+               pad_Z_in_R->cd(place);
+               pad_Z_in_R->cd(place)->SetLogy(1);
+               sprintf(histoname_Z_in_R_input1,"ESD_Conversion_Mapping_Z_in_R_iR%02d",iR);
+               if(secondinput == ""){          
+                       DrawAutoGammaHisto( ESD_Conversion_Mapping_Z_in_R_input1[iR], 
+                                                                histoname_Z_in_R_input1,"Z [cm]",StandardYAxis,
+                                                                kTRUE,3 ,0.00001,
+                                                                kFALSE,0. ,0.,
+                                                                kFALSE, 0.,180.);
+               }else{
+                       DrawAutoGammaHistos( ESD_Conversion_Mapping_Z_in_R_input1[iR], 
+                                                                ESD_Conversion_Mapping_Z_in_R_input2[iR], 
+                                                                histoname_Z_in_R_input1,"Z [cm]",StandardYAxis,
+                                                                kTRUE,3 ,0.00001,
+                                                                kFALSE,0. ,0.,
+                                                                kFALSE, 0.,180.);
+                       Integ_ZinR_input1[iR]=ESD_Conversion_Mapping_Z_in_R_input1[iR]->Integral() ;                    
+                       Integ_ZinR_input2[iR]=ESD_Conversion_Mapping_Z_in_R_input2[iR]->Integral() ;    
+               }       
+       }
+       
+       pad_Z_in_R->Update();
+       
+       //------------------------------ Page 8 - Ratio Z in R --------------------------------------
+       if(secondinput != ""){  ps_mapping->NewPage();
+
+       c_Ratio_Z_in_R = new TCanvas("c_Ratio_Z_in_R","",200,10,700,1000);  // gives the page size
+       
+       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 
+       pad_Ratio_Z_in_R->SetFillColor(0);
+       pad_Ratio_Z_in_R->GetFrame()->SetFillColor(0);
+       pad_Ratio_Z_in_R->SetBorderMode(0);
+       pad_Ratio_Z_in_R->Divide(column,raw);
+       pad_Ratio_Z_in_R->Draw();
+       
+       title0->Draw();
+       if(secondinput != ""){
+               title1->Draw();
+       }
+
+       for(Int_t iR = 0; iR < NbinsR; iR++){
+               Int_t place = iR + 1;
+               
+               pad_Ratio_Z_in_R->cd(place);
+               pad_Ratio_Z_in_R->cd(place)->SetLogy(1);
+               sprintf(histoname_Ratio_Z_in_R_input2,"Ratio_Z_in_R_iR%02d",iR);
+               if(secondinput != ""){          
+                       Float_t ZRange = RangeZinR[iR];
+                       DrawRatioGammaHisto( Ratio_Mapping_Z_in_R[iR], 
+                                                                histoname_Ratio_Z_in_R_input2,"Z","norm Data/norm MC",
+                                                                kFALSE,3 ,0.000001,
+                                                                kTRUE,0.1 ,5.,
+                                                                kTRUE, -ZRange,ZRange);
+                       DrawGammaLines(-ZRange,ZRange,1,1);
+               }       
+       }
+
+       pad_Ratio_Z_in_R->Update();
+}
+
+
+
+       //---------page 9 - Phi in Z --------------------------------   
+       
+       ps_mapping->NewPage();
+       
+       
+       c_Phi_in_Z = new TCanvas("c_Phi_in_Z","",200,10,700,1000);  // gives the page size
+       
+       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 
+       pad_Phi_in_Z->SetFillColor(0);
+       pad_Phi_in_Z->GetFrame()->SetFillColor(0);
+       pad_Phi_in_Z->SetBorderMode(0);
+       pad_Phi_in_Z->Divide(column,raw);
+       pad_Phi_in_Z->Draw();
+       
+       title0->Draw(); if(secondinput != ""){title1->Draw();}
+       
+       Double_t Integ_Z_input1[NbinsZ];        
+       Double_t Integ_Z_input2[NbinsZ];                        
+       
+       for(Int_t iZ = 0; iZ < NbinsZ; iZ++){
+               Int_t place = iZ + 1;
+               pad_Phi_in_Z->cd(place);
+               pad_Phi_in_Z->cd(place)->SetLogy(1);
+               sprintf(histoname_Phi_in_Z_input1,"ESD_Conversion_Mapping_Phi_in_Z_iZ%02d",iZ);
+               if(secondinput == ""){          
+                       DrawAutoGammaHisto( ESD_Conversion_Mapping_Phi_in_Z_input1[iZ], 
+                                                                histoname_Phi_in_Z_input1,"#Phi",StandardYAxis,
+                                                                kTRUE,3 ,0.000001,
+                                                                kFALSE,0. ,0.,
+                                                                kFALSE, 0.,180.);
+               }else{
+                       DrawAutoGammaHistos( ESD_Conversion_Mapping_Phi_in_Z_input1[iZ], 
+                                                                ESD_Conversion_Mapping_Phi_in_Z_input2[iZ], 
+                                                                histoname_Phi_in_Z_input1,"#Phi",StandardYAxis,
+                                                                kTRUE,3 ,0.000001,
+                                                                kFALSE,0. ,0.,
+                                                                kFALSE, 0.,180.);
+                       Integ_Z_input1[iZ]=ESD_Conversion_Mapping_Phi_in_Z_input1[iZ]->Integral() ;                     
+                       Integ_Z_input2[iZ]=ESD_Conversion_Mapping_Phi_in_Z_input2[iZ]->Integral() ;     
+               }       
+       }
+       
+       pad_Phi_in_Z->Update();
+
+       //------------------------------------- Page 10 - Ratio Phi in Z -----------------------------------    
+
+       if(secondinput != ""){  ps_mapping->NewPage();
+
+       c_Ratio_Phi_in_Z = new TCanvas("c_Ratio_Phi_in_Z","",200,10,700,1000);  // gives the page size
+       
+       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 
+       pad_Ratio_Phi_in_Z->SetFillColor(0);
+       pad_Ratio_Phi_in_Z->GetFrame()->SetFillColor(0);
+       pad_Ratio_Phi_in_Z->SetBorderMode(0);
+       pad_Ratio_Phi_in_Z->Divide(column,raw);
+       pad_Ratio_Phi_in_Z->Draw();
+       
+       title0->Draw();
+       if(secondinput != ""){
+               title1->Draw();
+       }
+
+       for(Int_t iZ = 0; iZ < NbinsZ; iZ++){
+               Int_t place = iZ + 1;
+               
+               pad_Ratio_Phi_in_Z->cd(place);
+               pad_Ratio_Phi_in_Z->cd(place)->SetLogy(1);
+               sprintf(histoname_Ratio_Phi_in_Z_input2,"Ratio_Phi_in_Z_iZ%02d",iZ);
+               if(secondinput != ""){          
+                       DrawRatioGammaHisto( Ratio_Mapping_Phi_in_Z[iZ], 
+                                                                histoname_Ratio_Phi_in_Z_input2,"#Phi","norm Data/norm MC",
+                                                                kFALSE,3 ,0.000001,
+                                                                kTRUE,0.1 ,5.,
+                                                                kFALSE, 0,0);
+                       linePhi->Draw("same");
+               }       
+       }
+
+       pad_Ratio_Phi_in_Z->Update();
+}
+
+       //---------------page 11 - R in Z ---------------------------------------------------
+       
+       ps_mapping->NewPage();
+       
+       c_R_in_Z = new TCanvas("c_R_in_Z","",200,10,700,1000);  // gives the page size
+       
+       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 
+       pad_R_in_Z->SetFillColor(0);
+       pad_R_in_Z->GetFrame()->SetFillColor(0);
+       pad_R_in_Z->SetBorderMode(0);
+       pad_R_in_Z->Divide(column,raw);
+       pad_R_in_Z->Draw();
+       
+       title0->Draw(); if(secondinput != ""){title1->Draw();}
+       
+       Double_t Integ_RinZ_input1[NbinsZ];     
+       Double_t Integ_RinZ_input2[NbinsZ];                     
+
+       for(Int_t iZ = 0; iZ < NbinsZ; iZ++){
+               Int_t place = iZ + 1;
+               pad_R_in_Z->cd(place);
+               pad_R_in_Z->cd(place)->SetLogy(1);
+               sprintf(histoname_R_in_Z_input1,"ESD_Conversion_Mapping_R_in_Z_iZ%02d",iZ);
+               if(secondinput == ""){          
+                       DrawAutoGammaHisto( ESD_Conversion_Mapping_R_in_Z_input1[iZ], 
+                                                                histoname_R_in_Z_input1,"R [cm]",StandardYAxis,
+                                                                kTRUE,3 ,0.000001,
+                                                                kFALSE,0. ,0.,
+                                                                kFALSE, 0.,180.);
+               }else{
+                       DrawAutoGammaHistos( ESD_Conversion_Mapping_R_in_Z_input1[iZ], 
+                                                                ESD_Conversion_Mapping_R_in_Z_input2[iZ], 
+                                                                histoname_R_in_Z_input1,"R [cm]",StandardYAxis,
+                                                                kTRUE,3 ,0.000001,
+                                                                kFALSE,0. ,0.,
+                                                                kFALSE, 0.,180.);
+                       Integ_RinZ_input1[iZ]=ESD_Conversion_Mapping_R_in_Z_input1[iZ]->Integral() ;                    
+                       Integ_RinZ_input2[iZ]=ESD_Conversion_Mapping_R_in_Z_input2[iZ]->Integral() ;    
+               }       
+       }
+       pad_R_in_Z->Update();
+       
+       //------------------------------ Page 12 - Ratio R in Z --------------------------------------
+       if(secondinput != ""){  ps_mapping->NewPage();
+
+       c_Ratio_R_in_Z = new TCanvas("c_Ratio_R_in_Z","",200,10,700,1000);  // gives the page size
+       
+       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 
+       pad_Ratio_R_in_Z->SetFillColor(0);
+       pad_Ratio_R_in_Z->GetFrame()->SetFillColor(0);
+       pad_Ratio_R_in_Z->SetBorderMode(0);
+       pad_Ratio_R_in_Z->Divide(column,raw);
+       pad_Ratio_R_in_Z->Draw();
+       
+       title0->Draw();
+       if(secondinput != ""){
+               title1->Draw();
+       }
+
+       for(Int_t iZ = 0; iZ < NbinsZ; iZ++){
+               Int_t place = iZ + 1;
+               
+               pad_Ratio_R_in_Z->cd(place);
+               pad_Ratio_R_in_Z->cd(place)->SetLogy(1);
+               sprintf(histoname_Ratio_R_in_Z_input2,"Ratio_R_in_Z_iZ%02d",iZ);
+               if(secondinput != ""){          
+                       DrawRatioGammaHisto( Ratio_Mapping_R_in_Z[iZ], 
+                                                                histoname_Ratio_R_in_Z_input2,"R [cm]","norm Data/norm MC",
+                                                                kFALSE,3 ,0.000001,
+                                                                kTRUE,0.1 ,5.,
+                                                                kFALSE, 0,0);
+                       lineR->Draw("same");
+               }       
+       }
+       
+       pad_Ratio_R_in_Z->Update();
+}      
+
+       // --------------------page 13 - MidPt Phi in R-------------------------------------------------------------
+       
+       
+       ps_mapping->NewPage();
+       
+       
+       c_MidPt_Phi_in_R = new TCanvas("c_MidPt_Phi_in_R","",200,10,700,1000);  // gives the page size
+
+       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 
+       pad_MidPt_Phi_in_R->SetFillColor(0);
+       pad_MidPt_Phi_in_R->GetFrame()->SetFillColor(0);
+       pad_MidPt_Phi_in_R->SetBorderMode(0);
+       pad_MidPt_Phi_in_R->Divide(column,raw);
+       pad_MidPt_Phi_in_R->Draw();
+       
+       title0->Draw(); if(secondinput != ""){title1->Draw();}
+
+       Double_t Integ_midpt_R_input1[NbinsR];  
+       Double_t Integ_midpt_R_input2[NbinsR];                  
+       
+       for(Int_t iR = 0; iR < NbinsR; iR++){
+               Int_t place = iR + 1;
+               pad_MidPt_Phi_in_R->cd(place);
+               pad_MidPt_Phi_in_R->cd(place)->SetLogy(1);
+               sprintf(histoname_MidPt_Phi_in_R_input1,"ESD_Conversion_Mapping_MidPt_Phi_in_R_iR%02d",iR);
+               if(secondinput == ""){          
+                       DrawAutoGammaHisto( ESD_Conversion_Mapping_MidPt_Phi_in_R_input1[iR], 
+                                                                histoname_MidPt_Phi_in_R_input1,"#Phi",StandardYAxis,
+                                                                kTRUE,3 ,0.000001,
+                                                                kFALSE,0. ,0.,
+                                                                kFALSE, 0.,180.);
+               }else{
+                       DrawAutoGammaHistos(ESD_Conversion_Mapping_MidPt_Phi_in_R_input1[iR], 
+                                                       ESD_Conversion_Mapping_MidPt_Phi_in_R_input2[iR], 
+                                                                histoname_MidPt_Phi_in_Z_input1,"#Phi",StandardYAxis,
+                                                                kTRUE,3 ,0.000001,
+                                                                kFALSE,0. ,0.,
+                                                                kFALSE, 0.,180.);
+                       Integ_midpt_R_input1[iR]=ESD_Conversion_Mapping_MidPt_Phi_in_R_input1[iR]->Integral() ;                 
+                       Integ_midpt_R_input2[iR]=ESD_Conversion_Mapping_MidPt_Phi_in_R_input2[iR]->Integral() ; 
+               }       
+       }
+       
+       pad_MidPt_Phi_in_R->Update();
+       
+       //---------------------------page 14 - MidPt Z in R ---------------------------------------
+       
+       ps_mapping->NewPage();
+       
+       c_midpt_Z_in_R = new TCanvas("c_midpt_Z_in_R","",200,10,700,1000);  // gives the page size
+       
+       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 
+       pad_midpt_Z_in_R->SetFillColor(0);
+       pad_midpt_Z_in_R->GetFrame()->SetFillColor(0);
+       pad_midpt_Z_in_R->SetBorderMode(0);
+       pad_midpt_Z_in_R->Divide(column,raw);
+       pad_midpt_Z_in_R->Draw();
+       
+       title0->Draw(); if(secondinput != ""){title1->Draw();}
+       
+       Double_t Integ_midpt_ZinR_input1[NbinsR];       
+       Double_t Integ_midpt_ZinR_input2[NbinsR];                       
+       
+       
+
+       for(Int_t iR = 0; iR < NbinsR; iR++){
+               Int_t place = iR + 1;
+               pad_midpt_Z_in_R->cd(place);
+               pad_midpt_Z_in_R->cd(place)->SetLogy(1);
+               sprintf(histoname_MidPt_Z_in_R_input1,"ESD_Conversion_Mapping_MidPt_Z_in_R_iR%02d",iR);
+               if(secondinput == ""){          
+                       DrawAutoGammaHisto( ESD_Conversion_Mapping_MidPt_Z_in_R_input1[iR], 
+                                                                histoname_MidPt_Z_in_R_input1,"Z [cm]",StandardYAxis,
+                                                                kTRUE,3 ,0.000001,
+                                                                kFALSE,0. ,0.,
+                                                                kFALSE, 0.,180.);
+               }else{
+                       DrawAutoGammaHistos(ESD_Conversion_Mapping_MidPt_Z_in_R_input1[iR], 
+                                                       ESD_Conversion_Mapping_MidPt_Z_in_R_input2[iR], 
+                                                                histoname_MidPt_Z_in_R_input1,"Z [cm]",StandardYAxis,
+                                                                kTRUE,3 ,0.000001,
+                                                                kFALSE,0. ,0.,
+                                                                kFALSE, 0.,180.);
+                       Integ_midpt_ZinR_input1[iR]=ESD_Conversion_Mapping_MidPt_Z_in_R_input1[iR]->Integral() ;                        
+                       Integ_midpt_ZinR_input2[iR]=ESD_Conversion_Mapping_MidPt_Z_in_R_input2[iR]->Integral() ;        
+               }       
+       }
+
+       pad_midpt_Z_in_R->Update();
+
+       
+       //---------------------page 15 - MidPt Phi in Z--------------------     
+       
+       if(!SinglePlots)ps_mapping->NewPage();
+       
+       
+       c_MidPt_Phi_in_Z = new TCanvas("c_MidPt_Phi_in_Z","",200,10,700,1000);  // gives the page size
+       
+       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 
+       pad_MidPt_Phi_in_Z->SetFillColor(0);
+       pad_MidPt_Phi_in_Z->GetFrame()->SetFillColor(0);
+       pad_MidPt_Phi_in_Z->SetBorderMode(0);
+       pad_MidPt_Phi_in_Z->Divide(column,raw);
+       pad_MidPt_Phi_in_Z->Draw();
+       
+       title0->Draw(); if(secondinput != ""){title1->Draw();}
+       
+       Double_t Integ_midpt_Z_input1[NbinsZ];  
+       Double_t Integ_midpt_Z_input2[NbinsZ];                  
+       
+       for(Int_t iZ = 0; iZ < NbinsZ; iZ++){
+               Int_t place = iZ + 1;
+               pad_MidPt_Phi_in_Z->cd(place);
+               pad_MidPt_Phi_in_Z->cd(place)->SetLogy(1);
+               sprintf(histoname_MidPt_Phi_in_Z_input1,"ESD_Conversion_Mapping_MidPt_Phi_in_Z_iR%02d",iR);
+               if(secondinput == ""){          
+                       DrawAutoGammaHisto( ESD_Conversion_Mapping_MidPt_Phi_in_Z_input1[iZ], 
+                                                                histoname_MidPt_Phi_in_Z_input1,"#Phi",StandardYAxis,
+                                                                kTRUE,3 ,0.000001,
+                                                                kFALSE,0. ,0.,
+                                                                kFALSE, 0.,180.);
+               }else{
+                       DrawAutoGammaHistos(ESD_Conversion_Mapping_MidPt_Phi_in_Z_input1[iZ], 
+                                                       ESD_Conversion_Mapping_MidPt_Phi_in_Z_input2[iZ], 
+                                                                histoname_MidPt_Phi_in_Z_input1,"#Phi",StandardYAxis,
+                                                                kTRUE,3 ,0.000001,
+                                                                kFALSE,0. ,0.,
+                                                                kFALSE, 0.,180.);
+                       Integ_midpt_Z_input1[iZ]=ESD_Conversion_Mapping_MidPt_Phi_in_Z_input1[iZ]->Integral() ;                 
+                       Integ_midpt_Z_input2[iZ]=ESD_Conversion_Mapping_MidPt_Phi_in_Z_input2[iZ]->Integral() ; 
+               }       
+       }
+       pad_MidPt_Phi_in_Z->Update();
+       
+       //---------------------------page 16 - MidPt R in Z ---------------------------------------
+       
+       if(!SinglePlots)ps_mapping->NewPage();
+       
+       c_MidPt_R_in_Z = new TCanvas("c_MidPt_R_in_Z","",200,10,700,1000);  // gives the page size
+       
+       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 
+       pad_MidPt_R_in_Z->SetFillColor(0);
+       pad_MidPt_R_in_Z->GetFrame()->SetFillColor(0);
+       pad_MidPt_R_in_Z->SetBorderMode(0);
+       pad_MidPt_R_in_Z->Divide(column,raw);
+       pad_MidPt_R_in_Z->Draw();
+       
+       title0->Draw(); if(secondinput != ""){title1->Draw();}
+       
+       Double_t Integ_midpt_RinZ_input1[NbinsZ];       
+       Double_t Integ_midpt_RinZ_input2[NbinsZ];                       
+
+       for(Int_t iZ = 0; iZ < NbinsZ; iZ++){
+               Int_t place = iZ + 1;
+               pad_MidPt_R_in_Z->cd(place);
+               pad_MidPt_R_in_Z->cd(place)->SetLogy(1);
+               sprintf(histoname_MidPt_R_in_Z_input1,"ESD_Conversion_Mapping_MidPt_R_in_Z_iR%02d",iR);
+               if(secondinput == ""){          
+                       DrawAutoGammaHisto( ESD_Conversion_Mapping_MidPt_R_in_Z_input1[iZ], 
+                                                                histoname_MidPt_R_in_Z_input1,"R [cm]",StandardYAxis,
+                                                                kTRUE,3 ,0.000001,
+                                                                kFALSE,0. ,0.,
+                                                                kFALSE, 0.,180.);
+               }else{
+                       DrawAutoGammaHistos(ESD_Conversion_Mapping_MidPt_R_in_Z_input1[iZ], 
+                                                       ESD_Conversion_Mapping_MidPt_R_in_Z_input2[iZ], 
+                                                                histoname_MidPt_R_in_Z_input1,"R [cm]",StandardYAxis,
+                                                                kTRUE,3 ,0.000001,
+                                                                kFALSE,0. ,0.,
+                                                                kFALSE, 0.,180.);
+                       Integ_midpt_RinZ_input1[iZ]=ESD_Conversion_Mapping_MidPt_R_in_Z_input1[iZ]->Integral() ;                        
+                       Integ_midpt_RinZ_input2[iZ]=ESD_Conversion_Mapping_MidPt_R_in_Z_input2[iZ]->Integral() ;        
+               }       
+       }
+       pad_MidPt_R_in_Z->Update();
+       
+          if(secondinput != ""){
+               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.;
+               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.;
+               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.;
+               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.;
+               
+               for(Int_t iR = 0; iR < NbinsR; iR++){
+                       Sum_phi_in_R_input1 = Sum_phi_in_R_input1 + Integ_R_input1[iR];
+                       Sum_phi_in_R_input2 = Sum_phi_in_R_input2 + Integ_R_input2[iR];
+                       Sum_midpt_phi_in_R_input1 = Sum_midpt_phi_in_R_input1 + Integ_midpt_R_input1[iR];
+                       Sum_midpt_phi_in_R_input2 = Sum_midpt_phi_in_R_input2 + Integ_midpt_R_input2[iR];
+                       Sum_Z_in_R_input1 = Sum_Z_in_R_input1 + Integ_ZinR_input1[iR];
+                       Sum_Z_in_R_input2 = Sum_Z_in_R_input2 + Integ_ZinR_input2[iR];
+                       Sum_midpt_Z_in_R_input1 = Sum_midpt_Z_in_R_input1 + Integ_midpt_ZinR_input1[iR];
+                       Sum_midpt_Z_in_R_input2 = Sum_midpt_Z_in_R_input2 + Integ_midpt_ZinR_input2[iR];
+                               
+               }
+               for(Int_t iZ = 0; iZ < NbinsZ; iZ++){
+                       Sum_phi_in_Z_input1 = Sum_phi_in_Z_input1 + Integ_Z_input1[iZ];
+                       Sum_phi_in_Z_input2 = Sum_phi_in_Z_input2 + Integ_Z_input2[iZ];
+                       Sum_midpt_phi_in_Z_input1 = Sum_midpt_phi_in_Z_input1 + Integ_midpt_Z_input1[iZ];
+                       Sum_midpt_phi_in_Z_input2 = Sum_midpt_phi_in_Z_input2 + Integ_midpt_Z_input2[iZ];
+                       Sum_R_in_Z_input1 = Sum_R_in_Z_input1 + Integ_RinZ_input1[iZ];
+                       Sum_R_in_Z_input2 = Sum_R_in_Z_input2 + Integ_RinZ_input2[iZ];
+                       Sum_midpt_R_in_Z_input1 = Sum_midpt_R_in_Z_input1 + Integ_midpt_RinZ_input1[iZ];
+                       Sum_midpt_R_in_Z_input2 = Sum_midpt_R_in_Z_input2 + Integ_midpt_RinZ_input2[iZ];
+               }
+                                       
+               const char *outlname = "Export_Mapping.dat";
+               fstream outl;
+               outl.open(outlname, ios::out);
+               outl << "#Calculating Integrals" << endl;       
+               outl << "------------------------------------------------------------------------------------------" << endl;
+               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;
+               outl << "------------------------------------------------------------------------------------------" << endl;
+
+               outl << "input1 :\t" << input1  << endl;
+               outl << "input2 :\t" << secondinput << endl;
+               outl << "------------------------------------------------------------------------------------------" << endl;
+               outl << endl;
+               outl << "\t input1 \t input2 " << endl;
+               outl << "Number of events" << "\t" << nGoodEvents_input1 << "\t" << nGoodEvents_input2 << endl;
+               outl << "Number of triggers" << "\t" << nGoodTrig_input1 << "\t" << nGoodTrig_input2 << endl;
+               outl << "Number reconstructed gammas"<< "\t" << nRecGamma_input1 << "\t" << nRecGamma_input2 <<endl;
+               outl << "Mean Multiplicity" << "\t" <<  mean_input1 << "\t" << mean_input2 << endl;
+               outl << endl;
+               outl << endl;
+
+               outl << "------------------------------------------------------------------------------------------" << endl;           
+               outl << "graph \t bin \t Input1 \t % \t Input2 \t % \t Input1-Input2 \t %" <<endl;
+
+
+               outl << "Phi in R" <<endl;
+               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;         
+               for(Int_t iR = 1; iR < NbinsR; iR++){
+                       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;
+               }
+               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;
+               outl << endl;
+
+               outl << "Phi in Z" <<endl;
+//             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;
+               for(Int_t iZ = 1; iZ < NbinsZ; iZ++){
+                       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;
+               }
+               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;
+               outl << endl;
+       
+               outl << "MidPt Phi in R" <<endl;
+               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;       
+               for(Int_t iR = 1; iR < NbinsR; iR++){
+                       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;
+               }
+               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;
+       
+               outl << endl;
+
+               outl << "MidPt Phi in Z" <<endl;
+//             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;
+               for(Int_t iZ = 1; iZ < NbinsZ; iZ++){
+                       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;
+               }
+               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;
+               outl << endl;
+
+               outl << "Z in R" <<endl;
+               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;    
+               for(Int_t iR = 1; iR < NbinsR; iR++){
+                       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;
+               }
+               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;
+               outl << endl;
+
+               outl << "R in Z" <<endl;
+//             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;
+               for(Int_t iZ = 1; iZ < NbinsZ; iZ++){
+                       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;
+               }
+               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;
+               outl << endl;
+
+               outl << "MidPt Z in R" <<endl;
+               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;        
+               for(Int_t iR = 1; iR < NbinsR; iR++){
+                       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;
+               }
+               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;
+               outl << endl;
+               
+               outl << "MidPt R in Z" <<endl;
+//             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;
+               for(Int_t iZ = 1; iZ < NbinsZ; iZ++){
+                       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;
+               }
+               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;
+
+               outl << "------------------------------------------------------------------------------------------" << endl;           
+          }
+       ps_mapping->Close();
+       // hier ende
+       }       
+       
+       // --------------------------- single plots  ----------------------------
+       if(SinglePlots){
+       
+
+               // ---------------------------- R- Distribution -----------------------
+               TCanvas * c_SinglePlot_2 = new TCanvas("c_SinglePlot_2","",1000,1000);  // gives the page size  
+               c_SinglePlot_2->SetLogy(0);             
+               c_SinglePlot_2->cd();
+
+               if(secondinput == ""){
+                               DrawAutoGammaHisto( ESD_Conversion_R_input1, 
+                                                                "","R [cm]",StandardYAxis,
+                                                                kTRUE, 1.1,0.00001,
+                                                                kFALSE,0. ,0,
+                                                                kTRUE, 0.,180.);
+               }else{
+                               DrawAutoGammaHistos( ESD_Conversion_R_input1, 
+                                                                ESD_Conversion_R_input2, 
+                                                                "","R [cm]",StandardYAxis,
+                                                                kTRUE, 1.1,0.00001,
+                                                                kFALSE,0. ,0.,
+                                                                kTRUE, 0.,180.);
+               }
+               for(Int_t i=0; i < 12 ; i++){
+                       DrawGammaLines(ArrayRbins[i], ArrayRbins[i], 0.00001,ESD_Conversion_R_input1->GetMaximum());
+               }               
+               DrawAliceLogoPerformance(right_up [0],right_up[1],right_up[2],right_up[3],0.03, Date);  
+               c_SinglePlot_2->Update();
+               c_SinglePlot_2->SaveAs(Form("%sR_distribution_lin.%s",path,suffix));
+               delete c_SinglePlot_2;          
+
+
+               TCanvas * c_SinglePlot_1 = new TCanvas("c_SinglePlot_1","",1000,1000);  // gives the page size
+               c_SinglePlot_1->cd();
+               c_SinglePlot_1->SetLogy(1);
+
+               if(secondinput == ""){
+                               DrawAutoGammaHisto( ESD_Conversion_R_input1, 
+                                                                "","R [cm]",StandardYAxis,
+                                                                kTRUE, 1.5,0.00001,
+                                                                kFALSE,0. ,0,
+                                                                kTRUE, 0.,180.);
+               }else{
+                               DrawAutoGammaHistos( ESD_Conversion_R_input1, 
+                                                                ESD_Conversion_R_input2, 
+                                                                "","R [cm]",StandardYAxis,
+                                                                kTRUE, 1.5,0.00001,
+                                                                kFALSE,0. ,0.,
+                                                                kTRUE, 0.,180.);
+               }
+               for(Int_t i=0; i < 12 ; i++){
+                       DrawGammaLines(ArrayRbins[i], ArrayRbins[i], 0.00001,ESD_Conversion_R_input1->GetMaximum());
+               }               
+               DrawAliceLogoPerformance(right_up [0],right_up[1],right_up[2],right_up[3],0.03, Date);  
+
+               c_SinglePlot_1->Update();
+               c_SinglePlot_1->SaveAs(Form("%sR_distribution_log.%s",path,suffix));
+               delete c_SinglePlot_1;
+
+
+               //----------------------------- Integrated Radius -----------------------
+               TCanvas * c_SinglePlot_18 = new TCanvas("c_SinglePlot_18","",1000,1000);  // gives the page size                
+               c_SinglePlot_18->SetLogy(0);
+               c_SinglePlot_18->cd();
+               if(secondinput == ""){
+                               DrawAutoGammaHisto( ESD_Conversion_R_summed_input1, 
+                                                                "Conversions R distribution","R [cm]","Integrated (0-to-R) #gamma candidates/event scaled by multiplicity",
+                                                                kTRUE, 1.2,0,
+                                                                kTRUE,0. ,0.,
+                                                                kTRUE, 0.,180.);
+               }else{
+                               DrawAutoGammaHistos( ESD_Conversion_R_summed_input1, 
+                                                                ESD_Conversion_R_summed_input2, 
+                                                                "Integrated Radius of Conversion","R [cm] ","Integrated (0-to-R) #gamma candidates/event scaled by multiplicity",
+                                                                kTRUE, 1.2,0,
+                                                                kFALSE,0. ,0.,
+                                                                kTRUE, 0.,180.);
+               }
+               DrawAliceLogo(left_up [0],left_up[1],left_up[2],left_up[3]);    
+
+               c_SinglePlot_18->Update();
+               c_SinglePlot_18->SaveAs(Form("%sInteg_Radius.%s",path,suffix));
+               delete c_SinglePlot_18;         
+
+
+               TCanvas * c_SinglePlot_17 = new TCanvas("c_SinglePlot_17","",1000,1000);  // gives the page size
+               c_SinglePlot_17->SetLogy(1);
+               c_SinglePlot_17->cd();
+               if(secondinput == ""){
+                               DrawAutoGammaHisto( ESD_Conversion_R_summed_input1, 
+                                                                "Conversions R distribution","R [cm]","Integrated (0-to-R) #gamma candidates/event scaled by multiplicity",
+                                                                kTRUE,2.5,0,
+                                                                kFALSE,0. ,0.,
+                                                                kTRUE, 0.,180.);
+               }else{
+                               DrawAutoGammaHistos( ESD_Conversion_R_summed_input1, 
+                                                                ESD_Conversion_R_summed_input2, 
+                                                                "Integrated Radius of Conversion","R [cm] ","Integrated (0-to-R) #gamma candidates/event scaled by multiplicity",
+                                                                kTRUE, 2.5,0,
+                                                                kFALSE,0. ,0.,
+                                                                kTRUE, 0.,180.);
+               }
+               DrawAliceLogo(right_down [0],right_down[1],right_down[2],right_down[3]);        
+
+                       
+               c_SinglePlot_17->Update();
+               c_SinglePlot_17->SaveAs(Form("%sInteg_Radius_log.%s",path,suffix));
+               delete c_SinglePlot_17;
+
+
+
+               // -----------------------  2 dim Plots -----------------------------------
+               TCanvas * c_SinglePlot_3 = new TCanvas("c_SinglePlot_3","",1000,1000);  // gives the page size
+               c_SinglePlot_3->SetLogz(1);     
+               c_SinglePlot_3->SetRightMargin(RightMargin);                                            
+               c_SinglePlot_3->cd();
+                       DrawAutoGammaHisto2D(   ESD_Conversion_ZR_input1,
+                                                               "", "Z [cm]", "R [cm]", "",
+                                                               kTRUE, 0., 200.,
+                                                               kFALSE, 0., 20.);
+                       DrawAliceLogoPerformance(right_up2D [0],right_up2D[1],right_up2D[2],right_up2D[3],0.03,Date);
+//                     DrawAliceText(left_down[0], left_down[1 ], left_down[3]);
+                       EtaRange->Draw();
+               c_SinglePlot_3->Update();
+               c_SinglePlot_3->SaveAs(Form("%sZR_distribution.%s",path,suffix));
+               delete c_SinglePlot_3;
+
+               TCanvas * c_SinglePlot_4 = new TCanvas("c_SinglePlot_4","",1000,1000);  // gives the page size
+               c_SinglePlot_4->SetLogz(1);
+               c_SinglePlot_4->SetRightMargin(RightMargin);                                            
+               c_SinglePlot_4->cd();
+                       DrawAutoGammaHisto2D(   ESD_Conversion_XY_input1,
+                                                               "", "X [cm]", "Y [cm]", "",
+                                                               kTRUE, -180., 180.,
+                                                               kTRUE, -180., 180.);
+                       DrawStructure();
+                       EtaRange->Draw();
+                       DrawAliceLogoPerformance(right_up2D [0],right_up2D[1],right_up2D[2],right_up2D[3],0.03,Date);
+//                     DrawAliceText(left_down[0], left_down[1 ], left_down[3]);
+               c_SinglePlot_4->Update();
+               c_SinglePlot_4->SaveAs(Form("%sXY_distribution.%s",path,suffix));
+               delete c_SinglePlot_4;
+
+               TCanvas * c_SinglePlot_4 = new TCanvas("c_SinglePlot_4","",1000,1000);  // gives the page size
+               c_SinglePlot_4->SetLogz(1);
+               c_SinglePlot_4->SetRightMargin(RightMargin);                                            
+               c_SinglePlot_4->cd();
+                       ESD_Conversion_XY_input1->SetMinimum(minimumXY);
+                       DrawAutoGammaHisto2D(   ESD_Conversion_XY_input1,
+                                                               "", "X [cm]", "Y [cm]", "",
+                                                               kTRUE, -180., 180.,
+                                                               kTRUE, -180., 180.);
+                       DrawStructure();
+                       EtaRange->Draw();
+                       DrawAliceLogoPerformance(right_up2D [0],right_up2D[1],right_up2D[2],right_up2D[3],0.03,Date);
+//                     DrawAliceText(left_down[0], left_down[1 ], left_down[3]);
+               c_SinglePlot_4->Update();
+               c_SinglePlot_4->SaveAs(Form("%sXY_distribution_minimum.%s",path,suffix));
+               delete c_SinglePlot_4;
+
+
+               
+               if(secondinput != ""){
+                       TCanvas * c_SinglePlot_5 = new TCanvas("c_SinglePlot_5","",1000,1000);  // gives the page size
+                       c_SinglePlot_5->SetLogz(1);
+                       c_SinglePlot_5->SetRightMargin(RightMargin);                                            
+                       c_SinglePlot_5->cd();
+                       Diff_XY_distribution = (TH1D*)ESD_Conversion_XY_input1->Clone();
+                       Diff_XY_distribution->Divide(ESD_Conversion_XY_input1,ESD_Conversion_XY_input2,1.,1.,"B");
+                       Diff_XY_distribution->Draw("col2");     
+                       DrawAliceLogo(right_up2D [0],right_up2D[1],right_up2D[2],right_up2D[3]);
+                       c_SinglePlot_5->Update();
+                       c_SinglePlot_5->SaveAs(Form("%sDiff_XY_distributions.%s",path,suffix));
+                       delete c_SinglePlot_5;
+               }
+               
+
+               //-------------------- Z - Distribution ------------------------------
+
+               TCanvas * c_SinglePlot_19 = new TCanvas("c_SinglePlot_19","",1000,1000);  // gives the page size
+               c_SinglePlot_19->SetLogy(0);
+               c_SinglePlot_19->cd();
+               if(secondinput == ""){
+                               DrawAutoGammaHisto( ESD_Conversion_Z_input1
+                                                                "Conversions Z distribution","Z [cm]",StandardYAxis,
+                                                                kTRUE, 1.1,0.00001,
+                                                                kFALSE,0. ,0,
+                                                                kTRUE, -201.,201.);
+               }else{
+                               DrawAutoGammaHistos( ESD_Conversion_Z_input1, 
+                                                                ESD_Conversion_Z_input2, 
+                                                                "Conversions Z distribution","Z [cm] ",StandardYAxis,
+                                                                kTRUE, 1.1,0.00001,
+                                                                kFALSE,0. ,0.,
+                                                                kFALSE, -201.,201.);
+               }
+               for(Int_t i=0; i < 12 ; i++){
+                       DrawGammaLines(ArrayZbins[i], ArrayZbins[i], 0.00001,ESD_Conversion_Z_input1->GetMaximum());
+               }               
+               
+               leg1 = new TLegend( 0.6,0.82,0.9,0.9);
+               leg1->SetTextSize(0.04);                        
+               leg1->SetFillColor(0);
+               leg1->AddEntry(ESD_Conversion_Z_input1,("Data"));
+               if(secondinput != ""){leg1->AddEntry(ESD_Conversion_Z_input2,("MC"));}
+               leg1->Draw();
+
+               DrawAliceLogo(right_up [0],right_up[1],right_up[2],right_up[3]);        
+
+               c_SinglePlot_19->Update();
+               c_SinglePlot_19->SaveAs(Form("%sZ_distribution_lin.%s",path,suffix));
+               delete c_SinglePlot_19;
+
+               TCanvas * c_SinglePlot_6 = new TCanvas("c_SinglePlot_6","",1000,1000);  // gives the page size
+               c_SinglePlot_6->SetLogy(1);
+               c_SinglePlot_6->cd();
+               if(secondinput == ""){
+                               DrawAutoGammaHisto( ESD_Conversion_Z_input1
+                                                                "Conversions Z distribution","Z [cm]",StandardYAxis,
+                                                                kTRUE, 1.5,0.00001,
+                                                                kFALSE,0. ,0,
+                                                                kTRUE, -250.,250.);
+               }else{
+                               DrawAutoGammaHistos( ESD_Conversion_Z_input1, 
+                                                                ESD_Conversion_Z_input2, 
+                                                                "Conversions Z distribution","Z [cm] ",StandardYAxis,
+                                                                kTRUE, 1.5,0.0000001,
+                                                                kFALSE,0. ,0.,
+                                                                kFALSE, -201.,201.);
+               }
+               for(Int_t i=0; i < 12 ; i++){
+                       DrawGammaLines(ArrayZbins[i], ArrayZbins[i], 0.0000001,ESD_Conversion_Z_input1->GetMaximum());
+               }               
+               leg1->Draw();
+               DrawAliceLogo(right_up [0],right_up[1],right_up[2],right_up[3]);        
+
+               c_SinglePlot_6->Update();
+               c_SinglePlot_6->SaveAs(Form("%sZ_distribution_log.%s",path,suffix));
+               delete c_SinglePlot_6;
+
+               
+               //------------------- Giving the Pad Phi in R in better resolution
+
+               c_Single_Phi_in_R = new TCanvas("c_Single_Phi_in_R","",400,20,1400,2000);  // gives the page size
+               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 
+               pad_Single_Phi_in_R->SetFillColor(0);
+               pad_Single_Phi_in_R->GetFrame()->SetFillColor(0);
+               pad_Single_Phi_in_R->SetBorderMode(0);
+               pad_Single_Phi_in_R->Divide(column,raw);
+               pad_Single_Phi_in_R->Draw();
+
+               for(Int_t iR = 0; iR < NbinsR; iR++){
+                       Int_t place = iR + 1;
+                       
+                       pad_Single_Phi_in_R->cd(place);
+                       pad_Single_Phi_in_R->cd(place)->SetLogy(1);
+                       sprintf(histoname_Phi_in_R_input1,"ESD_Conversion_Mapping_Phi_in_R_iR%02d",iR);
+                       if(secondinput == ""){          
+                               DrawAutoGammaHisto( ESD_Conversion_Mapping_Phi_in_R_input1[iR], 
+                                                                        histoname_Phi_in_R_input1,"#Phi",StandardYAxis,
+                                                                        kTRUE,2 ,0.0000002,
+                                                                        kFALSE,0. ,0.,
+                                                                        kFALSE, 0.,180.);
+                       }else{
+                               DrawAutoGammaHistos( ESD_Conversion_Mapping_Phi_in_R_input1[iR], 
+                                                                        ESD_Conversion_Mapping_Phi_in_R_input2[iR], 
+                                                                        histoname_Phi_in_R_input1,"#Phi",StandardYAxis,
+                                                                        kTRUE,2 ,0.0000002,
+                                                                        kFALSE,0. ,0.,
+                                                                        kFALSE, 0.,180.);
+                       }       
+               DrawAliceText(right_up_text[0],right_up_text[1], right_up_text[3]);             
+               }
+                       pad_Single_Phi_in_R->Update();
+                       c_Single_Phi_in_R->Print(Form("%spad_Phi_in_R.%s",path,suffix));        
+                       delete  pad_Single_Phi_in_R;
+                       delete c_Single_Phi_in_R;               
+
+
+               // --------------- Giving Phi in R for several bins -------------------------------------------------------------
+               TCanvas * c_SinglePlot_7 = new TCanvas("c_SinglePlot_7","",1000,700);  // gives the page size
+               c_SinglePlot_7->SetLogy(1);
+               c_SinglePlot_7->cd();
+                       if(secondinput == ""){          
+                               DrawAutoGammaHisto( ESD_Conversion_Mapping_Phi_in_R_input1[4],
+                                                                       "ESD_Conversion_Mapping_Phi_in_R_R04","#Phi",StandardYAxis,
+                                                                        kFALSE,3 ,0.000001,
+                                                                        kFALSE,0. ,0.,
+                                                                        kFALSE, 0.,180.);
+                       }else{
+                               DrawAutoGammaHistos( ESD_Conversion_Mapping_Phi_in_R_input1[4], 
+                                                                        ESD_Conversion_Mapping_Phi_in_R_input2[4], 
+                                                                        "ESD_Conversion_Mapping_Phi_in_R_R04","#Phi",StandardYAxis,
+                                                                        kFALSE,3 ,0.000001,
+                                                                        kFALSE,0. ,0.,
+                                                                        kFALSE, 0.,180.);
+                       }       
+               DrawAliceText(right_up_text[0],right_up_text[1], right_up_text[3]);             
+
+               c_SinglePlot_7->Update();
+               c_SinglePlot_7->SaveAs(Form("%sPhi_in_R_04.%s",path,suffix));
+               delete c_SinglePlot_7;
+               
+               TCanvas * c_SinglePlot_8 = new TCanvas("c_SinglePlot_8","",1000,700);  // gives the page size           
+               c_SinglePlot_8->SetLogy(1);             
+               c_SinglePlot_8->cd();
+                       if(secondinput == ""){          
+                               DrawAutoGammaHisto( ESD_Conversion_Mapping_Phi_in_R_input1[5],
+                                                                       "ESD_Conversion_Mapping_Phi_in_R_R05","#Phi",StandardYAxis,
+                                                                        kFALSE,3 ,0.000001,
+                                                                        kFALSE,0. ,0.,
+                                                                        kFALSE, 0.,180.);
+                       }else{
+                               DrawAutoGammaHistos( ESD_Conversion_Mapping_Phi_in_R_input1[5], 
+                                                                        ESD_Conversion_Mapping_Phi_in_R_input2[5], 
+                                                                        "ESD_Conversion_Mapping_Phi_in_R_R05","#Phi",StandardYAxis,
+                                                                        kFALSE,3 ,0.000001,
+                                                                        kFALSE,0. ,0.,
+                                                                        kFALSE, 0.,180.);
+                       }       
+               DrawAliceText(right_up_text[0],right_up_text[1], right_up_text[3]);             
+               c_SinglePlot_8->Update();
+               c_SinglePlot_8->SaveAs(Form("%sPhi_in_R_05.%s",path,suffix));
+               delete c_SinglePlot_8;
+
+               TCanvas * c_SinglePlot_12 = new TCanvas("c_SinglePlot_12","",1000,700);  // gives the page size         
+               c_SinglePlot_12->SetLogy(1);
+               c_SinglePlot_12->cd();
+                       if(secondinput == ""){          
+                               DrawAutoGammaHisto( ESD_Conversion_Mapping_Phi_in_R_input1[2],
+                                                                       "ESD_Conversion_Mapping_Phi_in_R_R02","#Phi",StandardYAxis,
+                                                                        kFALSE,3 ,0.000001,
+                                                                        kFALSE,0. ,0.,
+                                                                        kFALSE, 0.,180.);
+                       }else{
+                               DrawAutoGammaHistos( ESD_Conversion_Mapping_Phi_in_R_input1[2], 
+                                                                        ESD_Conversion_Mapping_Phi_in_R_input2[2], 
+                                                                        "ESD_Conversion_Mapping_Phi_in_R_R02","#Phi",StandardYAxis,
+                                                                        kFALSE,3 ,0.000001,
+                                                                        kFALSE,0. ,0.,
+                                                                        kFALSE, 0.,180.);
+                       }       
+               DrawAliceText(right_up_text[0],right_up_text[1], right_up_text[3]);             
+
+               c_SinglePlot_12->Update();
+               c_SinglePlot_12->SaveAs(Form("%sPhi_in_R_02.%s",path,suffix));
+               delete c_SinglePlot_12;                         
+
+               TCanvas * c_SinglePlot_13 = new TCanvas("c_SinglePlot_13","",1000,700);  // gives the page size
+               c_SinglePlot_13->SetLogy(1);
+               c_SinglePlot_13->cd();
+                       if(secondinput == ""){          
+                               DrawAutoGammaHisto( ESD_Conversion_Mapping_Phi_in_R_input1[6],
+                                                                       "ESD_Conversion_Mapping_Phi_in_R_R06","#Phi",StandardYAxis,
+                                                                        kFALSE,3 ,0.000001,
+                                                                        kFALSE,0. ,0.,
+                                                                        kFALSE, 0.,180.);
+                       }else{
+                               DrawAutoGammaHistos( ESD_Conversion_Mapping_Phi_in_R_input1[6], 
+                                                                        ESD_Conversion_Mapping_Phi_in_R_input2[6], 
+                                                                        "ESD_Conversion_Mapping_Phi_in_R_R06","#Phi",StandardYAxis,
+                                                                        kFALSE,3 ,0.000001,
+                                                                        kFALSE,0. ,0.,
+                                                                        kFALSE, 0.,180.);
+                       }       
+               DrawAliceText(right_up_text[0],right_up_text[1], right_up_text[3]);             
+               c_SinglePlot_13->Update();
+               c_SinglePlot_13->SaveAs(Form("%sPhi_in_R_06.%s",path,suffix));
+               delete c_SinglePlot_13;         
+
+               TCanvas * c_SinglePlot_14 = new TCanvas("c_SinglePlot_14","",1000,700);  // gives the page size
+               c_SinglePlot_14->SetLogy(1);
+               c_SinglePlot_14->cd();          
+               if(secondinput == ""){          
+                               DrawAutoGammaHisto( ESD_Conversion_Mapping_Phi_in_R_input1[7],
+                                                                       "ESD_Conversion_Mapping_Phi_in_R_R07","#Phi",StandardYAxis,
+                                                                        kFALSE,3 ,0.000001,
+                                                                        kFALSE,0. ,0.,
+                                                                        kFALSE, 0.,180.);
+                       }else{
+                               DrawAutoGammaHistos( ESD_Conversion_Mapping_Phi_in_R_input1[7], 
+                                                                        ESD_Conversion_Mapping_Phi_in_R_input2[7], 
+                                                                        "ESD_Conversion_Mapping_Phi_in_R_R07","#Phi",StandardYAxis,
+                                                                        kFALSE,3 ,0.000001,
+                                                                        kFALSE,0. ,0.,
+                                                                        kFALSE, 0.,180.);
+                       }       
+               DrawAliceText(right_up_text[0],right_up_text[1], right_up_text[3]);             
+
+               c_SinglePlot_14->Update();
+               c_SinglePlot_14->SaveAs(Form("%sPhi_in_R_07.%s",path,suffix));
+               delete c_SinglePlot_14;                         
+
+               TCanvas * c_SinglePlot_15 = new TCanvas("c_SinglePlot_15","",1000,700);  // gives the page size
+               c_SinglePlot_15->SetLogy(1);
+               c_SinglePlot_15->cd();
+                       if(secondinput == ""){          
+                               DrawAutoGammaHisto( ESD_Conversion_Mapping_Phi_in_R_input1[9 ],
+                                                                       "ESD_Conversion_Mapping_Phi_in_R_R09","#Phi",StandardYAxis,
+                                                                        kFALSE,3 ,0.000001,
+                                                                        kFALSE,0. ,0.,
+                                                                        kFALSE, 0.,180.);
+                       }else{
+                               DrawAutoGammaHistos( ESD_Conversion_Mapping_Phi_in_R_input1[9], 
+                                                                        ESD_Conversion_Mapping_Phi_in_R_input2[9], 
+                                                                        "ESD_Conversion_Mapping_Phi_in_R_R09","#Phi",StandardYAxis,
+                                                                        kFALSE,3 ,0.000001,
+                                                                        kFALSE,0. ,0.,
+                                                                        kFALSE, 0.,180.);
+                       }       
+               DrawAliceText(right_up_text[0],right_up_text[1], right_up_text[3]);             
+               c_SinglePlot_15->Update();
+               c_SinglePlot_15->SaveAs(Form("%sPhi_in_R_09.%s",path,suffix));
+               delete c_SinglePlot_15;
+
+               TCanvas * c_SinglePlot_16 = new TCanvas("c_SinglePlot_16","",1000,700);  // gives the page size         
+               c_SinglePlot_16->SetLogy(1);
+               c_SinglePlot_16->cd();
+                       if(secondinput == ""){          
+                               DrawAutoGammaHisto( ESD_Conversion_Mapping_Phi_in_R_input1[10],
+                                                                       "ESD_Conversion_Mapping_Phi_in_R_R10","#Phi",StandardYAxis,
+                                                                        kFALSE,3 ,0.000001,
+                                                                        kFALSE,0. ,0.,
+                                                                        kFALSE, 0.,180.);
+                       }else{
+                               DrawAutoGammaHistos( ESD_Conversion_Mapping_Phi_in_R_input1[10], 
+                                                                        ESD_Conversion_Mapping_Phi_in_R_input2[10], 
+                                                                        "ESD_Conversion_Mapping_Phi_in_R_R10","#Phi",StandardYAxis,
+                                                                        kFALSE,3 ,0.000001,
+                                                                        kFALSE,0. ,0.,
+                                                                        kFALSE, 0.,180.);
+                       }       
+               DrawAliceText(right_up_text[0],right_up_text[1], right_up_text[3]);             
+               c_SinglePlot_16->Update();
+               c_SinglePlot_16->SaveAs(Form("%sPhi_in_R_10.%s",path,suffix));
+               delete c_SinglePlot_16;
+               
+       //----------- Giving Z in R as single Pad ----------------
+               c_Single_Z_in_R = new TCanvas("c_Single_Z_in_R","",400,20,1400,2000);  // gives the page size
+       
+               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 
+               pad_Single_Z_in_R->SetFillColor(0);
+               pad_Single_Z_in_R->GetFrame()->SetFillColor(0);
+               pad_Single_Z_in_R->SetBorderMode(0);
+               pad_Single_Z_in_R->Divide(column,raw);
+               pad_Single_Z_in_R->Draw();
+       
+/*             title0->Draw(); 
+               if(secondinput != ""){title1->Draw();}  
+*/             
+       for(Int_t iR = 0; iR < NbinsR; iR++){
+               Int_t place = iR + 1;
+               pad_Single_Z_in_R->cd(place);
+               pad_Single_Z_in_R->cd(place)->SetLogy(1);
+               sprintf(histoname_Z_in_R_input1,"ESD_Conversion_Mapping_Z_in_R_iR%02d",iR);
+               if(secondinput == ""){          
+                       DrawAutoGammaHisto( ESD_Conversion_Mapping_Z_in_R_input1[iR], 
+                                                                histoname_Z_in_R_input1,"Z [cm]",StandardYAxis,
+                                                                kTRUE,2 ,0.00001,
+                                                                kFALSE,0. ,0.,
+                                                                kFALSE, 0.,180.);
+               }else{
+                       DrawAutoGammaHistos( ESD_Conversion_Mapping_Z_in_R_input1[iR], 
+                                                                ESD_Conversion_Mapping_Z_in_R_input2[iR], 
+                                                                histoname_Z_in_R_input1,"Z [cm]",StandardYAxis,
+                                                                kTRUE,2 ,0.00001,
+                                                                kFALSE,0. ,0.,
+                                                                kFALSE, 0.,180.);
+               }       
+               DrawAliceText(right_up_text[0],right_up_text[1], right_up_text[3]);             
+       }
+       
+               pad_Single_Z_in_R->Update();
+               c_Single_Z_in_R->SaveAs(Form("%spad_Z_in_R.%s",path,suffix));
+               delete pad_Single_Z_in_R;
+               delete c_Single_Z_in_R;
+
+               // -------------- Giving Z in R for 4th and 5th bin
+               TCanvas * c_SinglePlot_9 = new TCanvas("c_SinglePlot_9","",1000,1000);  // gives the page size
+               c_SinglePlot_9->SetLogy(1);             
+               c_SinglePlot_9->cd();
+               if(secondinput == ""){          
+                       DrawAutoGammaHisto( ESD_Conversion_Mapping_Z_in_R_input1[9], 
+                                                                "ESD_Conversion_Mapping_Z_in_R_iR09","Z [cm]",StandardYAxis,
+                                                                kFALSE,3 ,0.0001,
+                                                                kFALSE,0. ,0.,
+                                                                kFALSE, 0.,180.);
+               }else{
+                       DrawAutoGammaHistos( ESD_Conversion_Mapping_Z_in_R_input1[9], 
+                                                                ESD_Conversion_Mapping_Z_in_R_input2[9], 
+                                                                "ESD_Conversion_Mapping_Z_in_R_iR09","Z [cm]",StandardYAxis,
+                                                                kFALSE,3 ,0.0001,
+                                                                kFALSE,0. ,0.,
+                                                                kFALSE, 0.,180.);
+               }       
+               DrawAliceText(right_up_text[0],right_up_text[1], right_up_text[3]);             
+               c_SinglePlot_9->Update();
+               c_SinglePlot_9->SaveAs(Form("%sZ_in_R_09.%s",path,suffix));
+               delete c_SinglePlot_9;
+                               
+               TCanvas * c_SinglePlot_10 = new TCanvas("c_SinglePlot_10","",1000,1000);  // gives the page size
+               c_SinglePlot_10->SetLogy(1);            
+               c_SinglePlot_10->cd();
+               if(secondinput == ""){          
+                       DrawAutoGammaHisto( ESD_Conversion_Mapping_Z_in_R_input1[10], 
+                                                                "ESD_Conversion_Mapping_Z_in_R_iR10","Z [cm]",StandardYAxis,
+                                                                kFALSE,3 ,0.0001,
+                                                                kFALSE,0. ,0.,
+                                                                kFALSE, 0.,180.);
+               }else{
+                       DrawAutoGammaHistos( ESD_Conversion_Mapping_Z_in_R_input1[10], 
+                                                                ESD_Conversion_Mapping_Z_in_R_input2[10], 
+                                                                "ESD_Conversion_Mapping_Z_in_R_iR10","Z [cm]",StandardYAxis,
+                                                                kFALSE,3 ,0.0001,
+                                                                kFALSE,0. ,0.,
+                                                                kFALSE, 0.,180.);
+               }       
+               DrawAliceText(right_up_text[0],right_up_text[1], right_up_text[3]);             
+               c_SinglePlot_10->Update();
+               c_SinglePlot_10->SaveAs(Form("%sZ_in_R_10.%s",path,suffix));
+               delete c_SinglePlot_10;
+
+               // ------------- Giving Z in phi in singleplot
+               c_Single_Phi_in_Z = new TCanvas("c_Single_Phi_in_Z","",200,10,1400,2000);  // gives the page size
+       
+               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 
+               pad_Single_Phi_in_Z->SetFillColor(0);
+               pad_Single_Phi_in_Z->GetFrame()->SetFillColor(0);
+               pad_Single_Phi_in_Z->SetBorderMode(0);
+               pad_Single_Phi_in_Z->Divide(column,raw);
+               pad_Single_Phi_in_Z->Draw();
+       
+
+       for(Int_t iZ = 0; iZ < NbinsZ; iZ++){
+               Int_t place = iZ + 1;
+               pad_Single_Phi_in_Z->cd(place);
+               pad_Single_Phi_in_Z->cd(place)->SetLogy(1);
+               sprintf(histoname_Phi_in_Z_input1,"ESD_Conversion_Mapping_Phi_in_Z_iZ%02d",iZ);
+               if(secondinput == ""){          
+                       DrawAutoGammaHisto( ESD_Conversion_Mapping_Phi_in_Z_input1[iZ], 
+                                                                histoname_Phi_in_Z_input1,"#Phi",StandardYAxis,
+                                                                kTRUE,2 ,0.0000002,
+                                                                kFALSE,0. ,0.,
+                                                                kFALSE, 0.,180.);
+               }else{
+                       DrawAutoGammaHistos( ESD_Conversion_Mapping_Phi_in_Z_input1[iZ], 
+                                                                ESD_Conversion_Mapping_Phi_in_Z_input2[iZ], 
+                                                                histoname_Phi_in_Z_input1,"#Phi",StandardYAxis,
+                                                                kTRUE,2 ,0.0000002,
+                                                                kFALSE,0. ,0.,
+                                                                kFALSE, 0.,180.);
+               }       
+               DrawAliceText(right_up_text[0],right_up_text[1], right_up_text[3]);             
+       }
+
+               pad_Single_Phi_in_Z->Update();
+               c_Single_Phi_in_Z->SaveAs(Form("%spad_Phi_in_Z.%s",path,suffix));
+               delete pad_Single_Phi_in_Z ;
+               delete c_Single_Phi_in_Z;
+
+               // ----- Giving R in Z in SinglePlot    
+               c_Single_R_in_Z = new TCanvas("c_Single_R_in_Z","",400,20,1400,2000);  // gives the page size
+       
+               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 
+               pad_Single_R_in_Z->SetFillColor(0);
+               pad_Single_R_in_Z->GetFrame()->SetFillColor(0);
+               pad_Single_R_in_Z->SetBorderMode(0);
+               pad_Single_R_in_Z->Divide(column,raw);
+               pad_Single_R_in_Z->Draw();
+       
+
+       for(Int_t iZ = 0; iZ < NbinsZ; iZ++){
+               Int_t place = iZ + 1;
+               pad_Single_R_in_Z->cd(place);
+               pad_Single_R_in_Z->cd(place)->SetLogy(1);
+               sprintf(histoname_R_in_Z_input1,"ESD_Conversion_Mapping_R_in_Z_iZ%02d",iZ);
+               if(secondinput == ""){          
+                       DrawAutoGammaHisto( ESD_Conversion_Mapping_R_in_Z_input1[iZ], 
+                                                                histoname_R_in_Z_input1,"R [cm]",StandardYAxis,
+                                                                kTRUE,2 ,0.0000002,
+                                                                kFALSE,0. ,0.,
+                                                                kFALSE, 0.,180.);
+               }else{
+                       DrawAutoGammaHistos( ESD_Conversion_Mapping_R_in_Z_input1[iZ], 
+                                                                ESD_Conversion_Mapping_R_in_Z_input2[iZ], 
+                                                                histoname_R_in_Z_input1,"R [cm]",StandardYAxis,
+                                                                kTRUE,2 ,0.0000002,
+                                                                kFALSE,0. ,0.,
+                                                                kFALSE, 0.,180.);
+               }       
+               DrawAliceText(right_up_text[0],right_up_text[1], right_up_text[3]);             
+       }
+
+               pad_Single_R_in_Z->Update();
+               c_Single_R_in_Z->SaveAs(Form("%spad_R_in_Z.%s",path,suffix));
+               delete pad_Single_R_in_Z ;
+               delete c_Single_R_in_Z;
+               //---------------------------- Ratio Pads ----------------------------------
+
+if(secondinput != ""){
+
+       c_Ratio_Phi_in_R = new TCanvas("c_Ratio_Phi_in_R","",400,20,1400,2000);  // gives the page size
+       
+       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 
+       pad_Ratio_Phi_in_R->SetFillColor(0);
+       pad_Ratio_Phi_in_R->GetFrame()->SetFillColor(0);
+       pad_Ratio_Phi_in_R->SetBorderMode(0);
+       pad_Ratio_Phi_in_R->Divide(column,raw);
+       pad_Ratio_Phi_in_R->Draw();
+       
+       for(Int_t iR = 0; iR < NbinsR; iR++){
+               Int_t place = iR + 1;
+               
+               pad_Ratio_Phi_in_R->cd(place);
+               pad_Ratio_Phi_in_R->cd(place)->SetLogy(1);
+               sprintf(histoname_Ratio_Phi_in_R_input2,"Ratio_Phi_in_R_iR%02d",iR);
+                       DrawRatioGammaHisto(    Ratio_Mapping_Phi_in_R[iR], 
+                                                                histoname_Ratio_Phi_in_R_input2,"#Phi","norm Data/norm MC",
+                                                                kFALSE,3 ,0.000001,
+                                                                kTRUE,0.1 ,5.,
+                                                                kFALSE, 0.,180.);
+                       linePhi->Draw("same");
+               DrawAliceText(right_up_text[0],right_up_text[1], right_up_text[3]);             
+       }
+       
+       pad_Ratio_Phi_in_R->Update();
+       c_Ratio_Phi_in_R->SaveAs(Form("%sRatio_Phi_in_R.%s",path,suffix));
+       delete pad_Ratio_Phi_in_R ;
+       delete  c_Ratio_Phi_in_R;
+}
+
+if(secondinput != ""){
+
+       c_Ratio_Z_in_R = new TCanvas("c_Ratio_Z_in_R","",400,20,1400,2000);  // gives the page size
+       
+       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 
+       pad_Ratio_Z_in_R->SetFillColor(0);
+       pad_Ratio_Z_in_R->GetFrame()->SetFillColor(0);
+       pad_Ratio_Z_in_R->SetBorderMode(0);
+       pad_Ratio_Z_in_R->Divide(column,raw);
+       pad_Ratio_Z_in_R->Draw();
+
+       for(Int_t iR = 0; iR < NbinsR; iR++){
+               Int_t place = iR + 1;
+               
+               pad_Ratio_Z_in_R->cd(place);
+               pad_Ratio_Z_in_R->cd(place)->SetLogy(1);
+               sprintf(histoname_Ratio_Z_in_R_input2,"Ratio_Z_in_R_iR%02d",iR);        
+                       Float_t ZRange = RangeZinR[iR];
+                       DrawRatioGammaHisto( Ratio_Mapping_Z_in_R[iR], 
+                                                                histoname_Ratio_Z_in_R_input2,"Z","norm Data/norm MC",
+                                                                kFALSE,3 ,0.000001,
+                                                                kTRUE,0.1 ,5.,
+                                                                kTRUE, -ZRange,ZRange);
+                       DrawGammaLines(-ZRange,ZRange,1,1);
+               DrawAliceText(right_up_text[0],right_up_text[1], right_up_text[3]);             
+       }
+       pad_Ratio_Z_in_R->Update();
+       c_Ratio_Z_in_R->SaveAs(Form("%sRatio_Z_in_R.%s",path,suffix));
+       delete pad_Ratio_Z_in_R ;
+       delete c_Ratio_Z_in_R;
+}
+
+if(secondinput != ""){
+
+       c_Ratio_Phi_in_Z = new TCanvas("c_Ratio_Phi_in_Z","",400,20,1400,2000);  // gives the page size
+       
+       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 
+       pad_Ratio_Phi_in_Z->SetFillColor(0);
+       pad_Ratio_Phi_in_Z->GetFrame()->SetFillColor(0);
+       pad_Ratio_Phi_in_Z->SetBorderMode(0);
+       pad_Ratio_Phi_in_Z->Divide(column,raw);
+       pad_Ratio_Phi_in_Z->Draw();
+
+       for(Int_t iZ = 0; iZ < NbinsZ; iZ++){
+               Int_t place = iZ + 1;
+               
+               pad_Ratio_Phi_in_Z->cd(place);
+               pad_Ratio_Phi_in_Z->cd(place)->SetLogy(1);
+               sprintf(histoname_Ratio_Phi_in_Z_input2,"Ratio_Phi_in_Z_iZ%02d",iZ);
+                       DrawRatioGammaHisto( Ratio_Mapping_Phi_in_Z[iZ], 
+                                                                histoname_Ratio_Phi_in_Z_input2,"#Phi","norm Data/norm MC",
+                                                                kFALSE,3 ,0.000001,
+                                                                kTRUE,0.1 ,5.,
+                                                                kFALSE, 0,0);
+                       linePhi->Draw("same");
+               DrawAliceText(right_up_text[0],right_up_text[1], right_up_text[3]);             
+       }
+       
+       pad_Ratio_Phi_in_Z->Update();
+       c_Ratio_Phi_in_Z->SaveAs(Form("%sRatio_Phi_in_Z.%s",path,suffix));
+       delete pad_Ratio_Phi_in_Z ;
+       delete c_Ratio_Phi_in_Z;
+}
+
+if(secondinput != ""){
+
+       c_Ratio_R_in_Z = new TCanvas("c_Ratio_R_in_Z","",400,20,1400,2000);  // gives the page size
+       
+       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 
+       pad_Ratio_R_in_Z->SetFillColor(0);
+       pad_Ratio_R_in_Z->GetFrame()->SetFillColor(0);
+       pad_Ratio_R_in_Z->SetBorderMode(0);
+       pad_Ratio_R_in_Z->Divide(column,raw);
+       pad_Ratio_R_in_Z->Draw();
+       
+       for(Int_t iZ = 0; iZ < NbinsZ; iZ++){
+               Int_t place = iZ + 1;
+               
+               pad_Ratio_R_in_Z->cd(place);
+               pad_Ratio_R_in_Z->cd(place)->SetLogy(1);
+               sprintf(histoname_Ratio_R_in_Z_input2,"Ratio_R_in_Z_iZ%02d",iZ);
+                       DrawRatioGammaHisto( Ratio_Mapping_R_in_Z[iZ], 
+                                                                histoname_Ratio_R_in_Z_input2,"R [cm]","norm Data/norm MC",
+                                                                kFALSE,3 ,0.000001,
+                                                                kTRUE,0.1 ,5.,
+                                                                kFALSE, 0,0);
+                       lineR->Draw("same");
+               DrawAliceText(right_up_text[0],right_up_text[1], right_up_text[3]);             
+       }
+       
+       pad_Ratio_R_in_Z->Update();
+       c_Ratio_R_in_Z->SaveAs(Form("%sRatio_R_in_Z.%s",path,suffix));
+       delete pad_Ratio_R_in_Z ;
+       delete c_Ratio_R_in_Z;
+}      
+       
+       }       
+
+//Dealocating all reserved resources
+
+}
diff --git a/PWG4/GammaConv/macros/Plot_Pi0_Characteristics.C b/PWG4/GammaConv/macros/Plot_Pi0_Characteristics.C
new file mode 100644 (file)
index 0000000..2baa850
--- /dev/null
@@ -0,0 +1,471 @@
+#include <fstream>
+#include <Riostream.h>
+/*
+ *
+ *
+ *
+ */
+
+extern TRandom *gRandom;
+extern TBenchmark *gBenchmark;
+extern TSystem *gSystem;
+
+void Plot_Pi0_Characteristics(const char *inputRootFile = "Pi0Characteristics",const char *path = "./Output/"){        
+
+  gROOT->Reset();      
+  gROOT->SetStyle("Plain");
+  gStyle->SetOptFit(0);
+
+  TString filename = Form("%s%s.root",path,inputRootFile);     
+  TFile f(filename.Data());  
+  
+  TList *histograms = f.GetListOfKeys(); // get the list of directories in the file
+  
+  TString cutSelectionArray[15];
+  Int_t cutsAdded=0;
+  //Per pt bin histograms:
+  TH1F* YieldPerBin[32];
+  TH1F* StoBPerBin[32];
+  TH1F* SignificancePerBin[32];
+  TH1F* MassPerBin[32];
+  TH1F* FWHMPerBin[32];
+
+  Float_t lowBinLimits[32];
+  Float_t highBinLimits[32];
+
+  TH1F * Raw_Yield;
+  TH1F * StoB;
+  TH1F * Significance;
+  TH1F * Mass;
+  TH1F * FWHM;
+
+
+
+  Int_t colorCounterRawYield=1;
+  Int_t histogramCounterRawYield=2;
+  TCanvas *canvasRawYield = new  TCanvas("canvasRawYield","",200,10,600,600);
+  canvasRawYield->SetFillColor(0);
+  canvasRawYield->SetLogy();
+  TLegend *legRawYield= new TLegend(0.7,0.7,1.,1.);
+  legRawYield->SetFillColor(0);
+
+  Int_t colorCounterStoB=1;
+  Int_t histogramCounterStoB=2;
+  TCanvas *canvasStoB = new  TCanvas("canvasStoB","",200,10,600,600);
+  canvasStoB->SetFillColor(0);
+  canvasStoB->SetLogy();
+  TLegend *legStoB= new TLegend(0.7,0.7,1.,1.);
+  legStoB->SetFillColor(0);
+
+  Int_t colorCounterSignificance=1;
+  Int_t histogramCounterSignificance=2;
+  TCanvas *canvasSignificance = new  TCanvas("canvasSignificance","",200,10,600,600);
+  canvasSignificance->SetFillColor(0);
+  canvasSignificance->SetLogy();
+  TLegend *legSignificance= new TLegend(0.7,0.7,1.,1.);
+  legSignificance->SetFillColor(0);
+
+  Int_t colorCounterMass=1;
+  Int_t histogramCounterMass=2;
+  TCanvas *canvasMass = new  TCanvas("canvasMass","",200,10,600,600);
+  canvasMass->SetFillColor(0);
+  //  canvasMass->SetLogy();
+  TLegend *legMass= new TLegend(0.7,0.7,1.,1.);
+  legMass->SetFillColor(0);
+
+  Int_t colorCounterFWHM=1;
+  Int_t histogramCounterFWHM=2;
+  TCanvas *canvasFWHM = new  TCanvas("canvasFWHM","",200,10,600,600);
+  canvasFWHM->SetFillColor(0);
+  //  canvasFWHM->SetLogy();
+  TLegend *legFWHM= new TLegend(0.7,0.7,1.,1.);
+  legFWHM->SetFillColor(0);
+
+
+  for(Int_t entFile=0;entFile<histograms->GetEntries();entFile++){
+
+    TString histoname = histograms->At(entFile)->GetName();
+    if(histoname.Contains("Raw_Yield")){
+      canvasRawYield->cd();
+      cout<<"Histogram contains Raw_Yield: "<<histoname.Data()<<endl;
+      if(Raw_Yield==NULL){
+       cout<<"Setting first histogram"<<endl;
+       Raw_Yield = (TH1F*)f.Get(histoname.Data());
+       cout<<"Histoname: "<<histoname.Data()<<endl;
+       TString cutValue= histoname(histoname.Index("Pi0_")+4,histoname.Length());
+       cutSelectionArray[cutsAdded]= cutValue;
+       cutsAdded++;
+       cout<<"Cut Value is: "<<cutValue.Data()<<endl;
+       for(Int_t bin=1;bin<Raw_Yield->GetNbinsX();bin++){
+         TString perBinHistoName = Form("Raw Yield %f <pt <%f",Raw_Yield->GetBinLowEdge(bin),Raw_Yield->GetBinLowEdge(bin)+Raw_Yield->GetBinWidth(bin));
+         lowBinLimits[bin]=Raw_Yield->GetBinLowEdge(bin);
+         highBinLimits[bin]=Raw_Yield->GetBinLowEdge(bin)+Raw_Yield->GetBinWidth(bin);
+         YieldPerBin[bin]= new TH1F(perBinHistoName.Data(),perBinHistoName.Data(),32,0,32);
+         YieldPerBin[bin]->SetBinContent(histogramCounterRawYield,Raw_Yield->GetBinContent(bin));
+         YieldPerBin[bin]->SetBinError(histogramCounterRawYield,Raw_Yield->GetBinError(bin));
+         YieldPerBin[bin]->GetXaxis()->SetBinLabel(histogramCounterRawYield,cutValue.Data());
+       }
+       cout<<"Raw_Yield: "<<Raw_Yield<<endl;
+       legRawYield->AddEntry(Raw_Yield,cutValue.Data(),"l");        
+       //              Raw_Yield->DrawCopy();
+               Raw_Yield->Draw();
+       canvasRawYield->Update();
+      }
+      else{
+       colorCounterRawYield++;
+       TH1F* histogram = (TH1F*)f.Get(histoname.Data());
+       cout<<"histogram number of bins: "<<histogram->GetNbinsX()<<endl;
+       TString cutValue= histoname(histoname.Index("Pi0_")+4,histoname.Length());
+       cutSelectionArray[cutsAdded]= cutValue;
+       cutsAdded++;
+       for(Int_t bin=1;bin<histogram->GetNbinsX();bin++){
+         //       YieldPerBin[bin]= new TH1F(Form("yield bin %d",bin),Form("yield bin %d",bin),32,0,32);
+         YieldPerBin[bin]->SetBinContent(histogramCounterRawYield,histogram->GetBinContent(bin));
+         YieldPerBin[bin]->SetBinError(histogramCounterRawYield,histogram->GetBinError(bin));
+         YieldPerBin[bin]->GetXaxis()->SetBinLabel(histogramCounterRawYield,cutValue.Data());
+       }
+
+       histogram->SetLineColor(colorCounterRawYield);
+       legRawYield->AddEntry(histogram,cutValue.Data(),"l");
+       legRawYield->Draw();
+       //      histogram->DrawCopy("same");
+       histogram->Draw("same");
+       canvasRawYield->Update();
+      }
+      histogramCounterRawYield+=2;
+      
+    }
+
+    if(histoname.Contains("SB_Pi0")){
+      canvasStoB->cd();
+      cout<<"Histogram contains SB: "<<histoname.Data()<<endl;
+      if(StoB==NULL){
+       cout<<"Setting first histogram"<<endl;
+       StoB = (TH1F*)f.Get(histoname.Data());
+       cout<<"Histoname: "<<histoname.Data()<<endl;
+       TString cutValue= histoname(histoname.Index("Pi0_")+4,histoname.Length());
+       cout<<"Cut Value is: "<<cutValue.Data()<<endl;
+       for(Int_t bin=1;bin<Raw_Yield->GetNbinsX();bin++){
+         TString perBinHistoName = Form("S/B %f <pt <%f",StoB->GetBinLowEdge(bin),StoB->GetBinLowEdge(bin)+StoB->GetBinWidth(bin));
+         StoBPerBin[bin]= new TH1F(perBinHistoName.Data(),perBinHistoName.Data(),32,0,32);
+         StoBPerBin[bin]->SetBinContent(histogramCounterStoB,StoB->GetBinContent(bin));
+         StoBPerBin[bin]->SetBinError(histogramCounterStoB,StoB->GetBinError(bin));
+         StoBPerBin[bin]->GetXaxis()->SetBinLabel(histogramCounterStoB,cutValue.Data());
+       }
+       legStoB->AddEntry(StoB,cutValue.Data(),"l");         
+       StoB->DrawCopy();
+       canvasStoB->Update();
+      }
+      else{
+       colorCounterStoB++;
+       TH1F* histogram = (TH1F*)f.Get(histoname.Data());
+       cout<<"histogram number of bins: "<<histogram->GetNbinsX()<<endl;
+       TString cutValue= histoname(histoname.Index("Pi0_")+4,histoname.Length());
+       for(Int_t bin=1;bin<histogram->GetNbinsX();bin++){
+         //       YieldPerBin[bin]= new TH1F(Form("yield bin %d",bin),Form("yield bin %d",bin),32,0,32);
+         StoBPerBin[bin]->SetBinContent(histogramCounterStoB,histogram->GetBinContent(bin));
+         StoBPerBin[bin]->SetBinError(histogramCounterStoB,histogram->GetBinError(bin));
+         StoBPerBin[bin]->GetXaxis()->SetBinLabel(histogramCounterStoB,cutValue.Data());
+       }
+
+       histogram->SetLineColor(colorCounterStoB);
+       legStoB->AddEntry(histogram,cutValue.Data(),"l");
+       legStoB->Draw();
+       histogram->DrawCopy("same");
+       canvasStoB->Update();
+      }
+      histogramCounterStoB+=2;
+    }
+
+    if(histoname.Contains("Significance_Pi0")){
+      canvasSignificance->cd();
+      cout<<"Histogram contains Significance: "<<histoname.Data()<<endl;
+      if(Significance==NULL){
+       cout<<"Setting first histogram"<<endl;
+       Significance = (TH1F*)f.Get(histoname.Data());
+       cout<<"Histoname: "<<histoname.Data()<<endl;
+       TString cutValue= histoname(histoname.Index("Pi0_")+4,histoname.Length());
+       cout<<"Cut Value is: "<<cutValue.Data()<<endl;
+       for(Int_t bin=1;bin<Raw_Yield->GetNbinsX();bin++){
+         TString perBinHistoName = Form("Significance %f <pt <%f",Significance->GetBinLowEdge(bin),Significance->GetBinLowEdge(bin)+Significance->GetBinWidth(bin));
+         SignificancePerBin[bin]= new TH1F(perBinHistoName.Data(),perBinHistoName.Data(),32,0,32);
+         SignificancePerBin[bin]->SetBinContent(histogramCounterSignificance,Significance->GetBinContent(bin));
+         SignificancePerBin[bin]->SetBinError(histogramCounterSignificance,Significance->GetBinError(bin));
+         SignificancePerBin[bin]->GetXaxis()->SetBinLabel(histogramCounterSignificance,cutValue.Data());
+       }
+       legSignificance->AddEntry(Significance,cutValue.Data(),"l");         
+       Significance->DrawCopy();
+       canvasSignificance->Update();
+       //      Raw_Yield = new TH1F("Raw_Yield","Raw_Yield",histogram->GetN)
+      }
+      else{
+       colorCounterSignificance++;
+       TH1F* histogram = (TH1F*)f.Get(histoname.Data());
+       cout<<"histogram number of bins: "<<histogram->GetNbinsX()<<endl;
+       TString cutValue= histoname(histoname.Index("Pi0_")+4,histoname.Length());
+       for(Int_t bin=1;bin<histogram->GetNbinsX();bin++){
+         //       YieldPerBin[bin]= new TH1F(Form("yield bin %d",bin),Form("yield bin %d",bin),32,0,32);
+         SignificancePerBin[bin]->SetBinContent(histogramCounterSignificance,histogram->GetBinContent(bin));
+         SignificancePerBin[bin]->SetBinError(histogramCounterSignificance,histogram->GetBinError(bin));
+         SignificancePerBin[bin]->GetXaxis()->SetBinLabel(histogramCounterSignificance,cutValue.Data());
+       }
+
+       histogram->SetLineColor(colorCounterSignificance);
+       legSignificance->AddEntry(histogram,cutValue.Data(),"l");
+       legSignificance->Draw();
+       histogram->DrawCopy("same");
+       canvasSignificance->Update();
+      }
+      histogramCounterSignificance+=2;
+    }
+
+    if(histoname.Contains("Mass_Pi0")){
+      canvasMass->cd();
+      cout<<"Histogram contains Mass: "<<histoname.Data()<<endl;
+      if(Mass==NULL){
+       cout<<"Setting first histogram"<<endl;
+       Mass = (TH1F*)f.Get(histoname.Data());
+       Mass->SetMinimum(0.1);
+       Mass->SetMaximum(.16);
+       cout<<"Histoname: "<<histoname.Data()<<endl;
+       TString cutValue= histoname(histoname.Index("Pi0_")+4,histoname.Length());
+       cout<<"Cut Value is: "<<cutValue.Data()<<endl;
+       for(Int_t bin=1;bin<Raw_Yield->GetNbinsX();bin++){
+         TString perBinHistoName = Form("Mass %f <pt <%f",Mass->GetBinLowEdge(bin),Mass->GetBinLowEdge(bin)+Mass->GetBinWidth(bin));
+         MassPerBin[bin]= new TH1F(perBinHistoName.Data(),perBinHistoName.Data(),32,0,32);
+         MassPerBin[bin]->SetBinContent(histogramCounterMass,Mass->GetBinContent(bin));
+         MassPerBin[bin]->SetBinError(histogramCounterMass,Mass->GetBinError(bin));
+         MassPerBin[bin]->GetXaxis()->SetBinLabel(histogramCounterMass,cutValue.Data());
+       }
+       legMass->AddEntry(Mass,cutValue.Data(),"l");         
+       Mass->DrawCopy();
+       canvasMass->Update();
+       //      Raw_Yield = new TH1F("Raw_Yield","Raw_Yield",histogram->GetN)
+      }
+      else{
+       colorCounterMass++;
+       TH1F* histogram = (TH1F*)f.Get(histoname.Data());
+       cout<<"histogram number of bins: "<<histogram->GetNbinsX()<<endl;
+       TString cutValue= histoname(histoname.Index("Pi0_")+4,histoname.Length());
+       for(Int_t bin=1;bin<histogram->GetNbinsX();bin++){
+         //       YieldPerBin[bin]= new TH1F(Form("yield bin %d",bin),Form("yield bin %d",bin),32,0,32);
+         MassPerBin[bin]->SetBinContent(histogramCounterMass,histogram->GetBinContent(bin));
+         MassPerBin[bin]->SetBinError(histogramCounterMass,histogram->GetBinError(bin));
+         MassPerBin[bin]->GetXaxis()->SetBinLabel(histogramCounterMass,cutValue.Data());
+       }
+
+       histogram->SetLineColor(colorCounterMass);
+       legMass->AddEntry(histogram,cutValue.Data(),"l");
+       legMass->Draw();
+       histogram->DrawCopy("same");
+       canvasMass->Update();
+      }
+      histogramCounterMass+=2;
+    }
+
+    if(histoname.Contains("FWHM_Pi0")){
+      canvasFWHM->cd();
+      cout<<"Histogram contains FWHM: "<<histoname.Data()<<endl;
+      if(FWHM==NULL){
+       cout<<"Setting first histogram"<<endl;
+       FWHM = (TH1F*)f.Get(histoname.Data());
+       cout<<"Histoname: "<<histoname.Data()<<endl;
+       TString cutValue= histoname(histoname.Index("Pi0_")+4,histoname.Length());
+       cout<<"Cut Value is: "<<cutValue.Data()<<endl;
+       for(Int_t bin=1;bin<Raw_Yield->GetNbinsX();bin++){
+         TString perBinHistoName = Form("FWHM %f <pt <%f",FWHM->GetBinLowEdge(bin),FWHM->GetBinLowEdge(bin)+FWHM->GetBinWidth(bin));
+         FWHMPerBin[bin]= new TH1F(perBinHistoName.Data(),perBinHistoName.Data(),32,0,32);
+         FWHMPerBin[bin]->SetBinContent(histogramCounterFWHM,FWHM->GetBinContent(bin));
+         FWHMPerBin[bin]->SetBinError(histogramCounterFWHM,FWHM->GetBinError(bin));
+         FWHMPerBin[bin]->GetXaxis()->SetBinLabel(histogramCounterFWHM,cutValue.Data());
+       }
+       legFWHM->AddEntry(FWHM,cutValue.Data(),"l");         
+       FWHM->DrawCopy();
+       canvasFWHM->Update();
+       //      Raw_Yield = new TH1F("Raw_Yield","Raw_Yield",histogram->GetN)
+      }
+      else{
+       colorCounterFWHM++;
+       TH1F* histogram = (TH1F*)f.Get(histoname.Data());
+       cout<<"histogram number of bins: "<<histogram->GetNbinsX()<<endl;
+       TString cutValue= histoname(histoname.Index("Pi0_")+4,histoname.Length());
+       for(Int_t bin=1;bin<histogram->GetNbinsX();bin++){
+         //       YieldPerBin[bin]= new TH1F(Form("yield bin %d",bin),Form("yield bin %d",bin),32,0,32);
+         FWHMPerBin[bin]->SetBinContent(histogramCounterFWHM,histogram->GetBinContent(bin));
+         FWHMPerBin[bin]->SetBinError(histogramCounterFWHM,histogram->GetBinError(bin));
+         FWHMPerBin[bin]->GetXaxis()->SetBinLabel(histogramCounterFWHM,cutValue.Data());
+       }
+
+       histogram->SetLineColor(colorCounterFWHM);
+       legFWHM->AddEntry(histogram,cutValue.Data(),"l");
+       legFWHM->Draw();
+       histogram->DrawCopy("same");
+       canvasFWHM->Update();
+      }
+      histogramCounterFWHM+=2;
+    }
+
+  }//end of for loop over histograms 
+
+
+
+  TPostScript *ps_characteristics;
+  ps_characteristics = new TPostScript(Form("%sPi0Characteristics.ps",path),111);      
+  ps_characteristics->NewPage();
+
+  canvasRawYield->Update();
+  canvasRawYield->Draw();
+  ps_characteristics->NewPage();
+  canvasSignificance->Update();
+  canvasSignificance->Draw();
+  ps_characteristics->NewPage();
+  canvasStoB->Update();
+  canvasStoB->Draw();
+  ps_characteristics->NewPage();
+  canvasMass->Update();
+  canvasMass->Draw();
+  ps_characteristics->NewPage();
+  canvasFWHM->Update();
+  canvasFWHM->Draw();
+  ps_characteristics->NewPage();
+
+
+
+  /*  
+  
+  TCanvas *canvas1 = new TCanvas("Integrated1","",10,10,700,1000);
+  TPad *pad1 = new TPad("pad1","",0.,0.,1.,1.,0);
+  pad1->SetFillColor(0);
+  pad1->GetFrame()->SetFillColor(0);
+  pad1->SetBorderMode(0);
+  pad1->Divide(1,2);
+  pad1->Draw();
+  
+  pad1->cd(1);
+  Raw_Yield->Draw();
+  
+  pad1->cd(2);
+  StoB->Draw();
+  ps_characteristics->NewPage();
+  
+  
+  TCanvas *canvas2 = new TCanvas("Integrated2","",10,10,700,1000);
+  TPad *pad2 = new TPad("pad2","",0.,0.,1.,1.,0);
+  pad2->SetFillColor(0);
+  pad2->GetFrame()->SetFillColor(0);
+  pad2->SetBorderMode(0);
+  pad2->Divide(1,2);
+  pad2->Draw();
+  
+  pad2->cd(1);
+  Significance->Draw();
+  
+  pad2->cd(2);
+  Mass->Draw();
+  
+  ps_characteristics->NewPage();   
+  
+  TCanvas *canvas3 = new TCanvas("Integrated3","",10,10,700,1000);
+  TPad *pad3 = new TPad("pad3","",0.,0.,1.,1.,0);
+  pad3->SetFillColor(0);
+  pad3->GetFrame()->SetFillColor(0);
+  pad3->SetBorderMode(0);
+  pad3->Divide(1,2);
+  pad3->Draw();
+  
+  pad3->cd(1);
+  FWHM->Draw();
+  
+  pad3->cd(2);
+  //    Mass->Draw();
+  */
+  ps_characteristics->NewPage();
+  
+  for(Int_t bin=2;bin<Raw_Yield->GetNbinsX();bin++){
+    TString canvasname= Form("bin %d",bin);
+    TCanvas *binC = new TCanvas(canvasname.Data(),"",10,10,700,1000);
+    TString padname= Form("pad %d",bin);
+    //    TPad *pad = new TPad(padname.Data(),"",0.05,0.05,0.95,0.95,0);
+    TPad *pad = new TPad(padname.Data(),"",0.,0.,1.,1.,0);
+    pad->SetFillColor(0);
+    pad->GetFrame()->SetFillColor(0);
+    pad->SetBorderMode(0);
+    pad->Divide(1,5);
+    pad->Draw();
+
+    pad->cd(1);
+    YieldPerBin[bin]->Draw();
+
+    pad->cd(2);
+    StoBPerBin[bin]->Draw();
+    
+    pad->cd(3);
+    SignificancePerBin[bin]->Draw();
+    pad->cd(4);
+    MassPerBin[bin]->Draw();
+
+    pad->cd(5);
+    FWHMPerBin[bin]->Draw();
+
+    binC->Update();
+    binC->Close();
+
+    ps_characteristics->NewPage();
+    binC->Close();
+  }
+
+  Int_t rebinValue=4;
+
+  for(Int_t cuts=0;cuts<cutsAdded;cuts++){
+    cout<<"CUT: "<<cutSelectionArray[cuts].Data()<<endl;
+    for(Int_t bin=2;bin<32;bin++){
+      TCanvas *canvasTest = new  TCanvas("canvastest","",200,10,600,600);
+      TPad *pad = new TPad(padname.Data(),"",0.,0.,1.,1.,0);
+      pad->SetFillColor(0);
+      pad->GetFrame()->SetFillColor(0);
+      pad->SetBorderMode(0);
+      pad->Divide(1,2);
+      pad->Draw();
+
+      pad->cd(1);
+      TString namet= Form("Mapping_Reco_InvMass_in_Pt_Bin%s%02d",cutSelectionArray[cuts].Data(),bin);
+      cout<<"Getting histogram: "<<namet.Data()<<endl;
+      TH1F * signalt = (TH1F*)f.Get(namet.Data());
+      signalt->Rebin(rebinValue);
+      TString titlet= Form("Inv_Mass_cut%s_pt[%f,%f]",cutSelectionArray[cuts].Data(),lowBinLimits[bin],highBinLimits[bin]);
+      signalt->SetTitle(titlet.Data());
+      signalt->Sumw2();
+      signalt->SetAxisRange(0.,0.4);
+      signalt->Draw();
+
+      TString nameb= Form("Mapping_Back_InvMass_in_Pt_Bin%s%02d",cutSelectionArray[cuts].Data(),bin);
+      cout<<"Getting histogram: "<<nameb.Data()<<endl;
+      TH1F * signalb = (TH1F*)f.Get(nameb.Data());
+      signalb->Rebin(rebinValue);
+      TString titleb= Form("Inv_Mass_cut%s_pt[%f,%f]",cutSelectionArray[cuts].Data(),lowBinLimits[bin],highBinLimits[bin]);
+      signalb->SetTitle(titleb.Data());
+      signalb->SetAxisRange(0.,0.4);
+      signalb->SetLineColor(4);
+      signalb->Draw("same");
+      
+      pad->cd(2);
+      canvasTest->SetFillColor(0);
+      TString name= Form("Mapping_Signal_InvMass_in_Pt_Bin%s%02d",cutSelectionArray[cuts].Data(),bin);
+      cout<<"Getting histogram: "<<name.Data()<<endl;
+      TH1F * signal = (TH1F*)f.Get(name.Data());
+      signal->Rebin(rebinValue);
+      TString title= Form("Signal_Inv_Mass_cut%s_pt[%f,%f]",cutSelectionArray[cuts].Data(),lowBinLimits[bin],highBinLimits[bin]);
+      signal->SetTitle(title.Data());
+      signal->SetAxisRange(0.,0.4);
+      signal->Draw();
+      canvasTest->Update();
+
+      ps_characteristics->NewPage();
+    }
+
+  }
+  ps_characteristics->Close();
+}
diff --git a/PWG4/GammaConv/macros/printCuts.C b/PWG4/GammaConv/macros/printCuts.C
new file mode 100644 (file)
index 0000000..c69cdce
--- /dev/null
@@ -0,0 +1,207 @@
+
+
+using namespace std;
+void printCuts(TString str){
+
+
+
+  TString s = str(0,1);
+  Int_t goodId= s.Atoi();
+  s = str(1,1);
+  Int_t v0FinderType= s.Atoi();
+  s = str(2,1);
+  Int_t eProbCut= s.Atoi();
+  s = str(3,1);
+  Int_t ededxSigmaCut= s.Atoi();
+  s = str(4,1);
+  Int_t pidedxSigmaCut= s.Atoi();
+  s = str(5,1);
+  Int_t piMomdedxSigmaCut= s.Atoi();
+  s = str(6,1);
+  Int_t chi2GammaCut= s.Atoi();
+  s = str(7,1);
+  Int_t singlePtCut= s.Atoi();
+  s = str(8,1);
+  Int_t clsTPCCut= s.Atoi();
+  s = str(9,1);
+  Int_t etaCut= s.Atoi();
+
+  /*  cout<<"etaCut: "<<etaCut<<endl;
+  cout<<"clsTPCCut: "<<clsTPCCut<<endl;
+  cout<<"singlePtCut: "<<singlePtCut<<endl;
+  cout<<"chi2GammaCut: "<<chi2GammaCut<<endl;
+  cout<<"piMomdedxSigmaCut: "<<piMomdedxSigmaCut<<endl;
+  cout<<"pidedxSigmaCut: "<<pidedxSigmaCut <<endl;
+  cout<<"ededxSigmaCut: "<<ededxSigmaCut <<endl;
+  cout<<"eProbCut: "<< eProbCut<<endl;
+  cout<<"v0FinderType: "<<v0FinderType <<endl;
+  cout<<"goodId: "<<goodId <<endl;
+  */
+
+  if(goodId !=9){
+    cout<<"Analysis Cut Selection too short or does not start with 9"<<endl;
+    return;
+  }
+
+  switch (v0FinderType){
+  case 0:  // on fly V0 finder
+    cout<<"Using the on fly v0 finder"<<endl;
+    break;
+  case 1:  // offline V0 finder
+    cout<<"Using the offline v0 finder"<<endl;
+    break;
+  default:
+    return;
+  }
+  switch(eProbCut){
+  case 0:  // 0.
+    cout<<"Prob electron is 0.000"<<endl;
+    //    kGCprobElectron = 0.000;
+    break;
+  case 1:  // 0.001
+    cout<<"Prob electron is 0.001"<<endl;
+    //    kGCprobElectron = 0.001;
+    break;
+  case 2:  // 0.01
+    cout<<"Prob electron is 0.01"<<endl;
+    //    kGCprobElectron = 0.01;
+    break;
+  default:
+    return;
+  }
+
+  switch(ededxSigmaCut){
+  case 0: // -10,10
+    cout<<"Using sigma dedx [-10,10]"<<endl;
+    //    kGCPIDnSigmaBelowElectronLine=-10;
+    //    kGCPIDnSigmaAboveElectronLine=10;
+    break;
+  case 1: // -5,5 
+    cout<<"Using sigma dedx [-5,5]"<<endl;
+    //    kGCPIDnSigmaBelowElectronLine=-5;
+    //   kGCPIDnSigmaAboveElectronLine=5;
+    break;
+  case 2: // -3,5
+    cout<<"Using sigma dedx [-3,5]"<<endl;
+    //    kGCPIDnSigmaBelowElectronLine=-3;
+    //    kGCPIDnSigmaAboveElectronLine=5;
+    break;
+  default:
+    return;
+  }
+  
+  switch(pidedxSigmaCut){
+  case 0:  // -10
+    cout<<"using pidedxsigmacut: -10"<<endl;
+    //   kGCPIDnSigmaAbovePionLine=-10;
+    break;
+  case 1:   // 0
+    cout<<"using pidedxsigmacut: 0"<<endl;
+    //    kGCPIDnSigmaAbovePionLine=0;
+    break;
+  case 2:  // 1
+    cout<<"using pidedxsigmacut: 1"<<endl;
+    //   kGCPIDnSigmaAbovePionLine=1;
+    break;
+  default:
+    return;
+  }
+  
+  switch(piMomdedxSigmaCut){
+  case 0:  // 0.5 GeV
+    cout<<"piMomdedxSigmaCut: 0.5"<<endl;
+    //  kGCPIDMinPnSigmaAbovePionLine=0.5;
+    break;
+  case 1:  // 1. GeV
+    cout<<"piMomdedxSigmaCut: 1"<<endl;
+    //   kGCPIDMinPnSigmaAbovePionLine=1.;
+    break;
+  case 2:  // 1.5 GeV
+    cout<<"piMomdedxSigmaCut: 1.5"<<endl;
+    //   kGCPIDMinPnSigmaAbovePionLine=1.5;
+    break;
+  default:
+    return;
+  }
+  
+  switch(chi2GammaCut){
+  case 0: // 100
+    cout<<"chi2CutConversion = 100."<<endl;
+    //   kGCchi2CutConversion = 100.;
+    break;
+  case 1:  // 50
+    cout<<"chi2CutConversion = 50."<<endl;
+    //   kGCchi2CutConversion = 50.;
+    break;
+  case 2:  // 30
+    cout<<"chi2CutConversion = 30."<<endl;
+    //   kGCchi2CutConversion = 30.;
+    break;
+  default:
+    return;
+  }
+
+  switch(singlePtCut){
+  case 0: // 0.050 GeV
+    cout<<"kGCsingleptCut = 0,050"<<endl;
+    //   kGCsingleptCut = 0.050;
+    break;
+  case 1:  // 0.100 GeV
+    cout<<"kGCsingleptCut = 0,100"<<endl;
+    //   kGCsingleptCut = 0.100;
+    break;
+  case 2:  // 0.150 GeV
+    cout<<"kGCsingleptCut = 0,150"<<endl;
+    //   kGCsingleptCut = 0.150;
+    break;
+  case 3:  // 0.200 GeV
+    cout<<"kGCsingleptCut = 0,200"<<endl;
+    //   kGCsingleptCut = 0.200;
+    break;
+  default:
+    return;
+ }
+
+  switch(clsTPCCut){
+  case 0: // 0 
+    cout<<"kGCminClsTPCCut = 0"<<endl;
+    //   kGCminClsTPCCut= 0.;
+    break;
+  case 1:  // 70 
+    //   kGCminClsTPCCut= 70.;
+    cout<<"kGCminClsTPCCut = 70"<<endl;
+    break;
+  case 2:  // 80 
+    //   kGCminClsTPCCut= 80.;
+    cout<<"kGCminClsTPCCut = 80"<<endl;
+    break;
+  case 3:  // 100 
+    //   kGCminClsTPCCut= 100.;
+    cout<<"kGCminClsTPCCut = 100"<<endl;
+    break;
+  default:
+    return;
+  }
+
+  switch(etaCut){
+  case 0: // 0.9 
+    cout<<"eta 0.9"<<endl;
+    //   kGCetaCut    = 0.9;
+    //    kGCLineCutZRSlope = tan(2*atan(exp(-kGCetaCut)));
+    break;
+  case 1:  // 1.2
+    cout<<"eta 1.2"<<endl;
+    //   kGCetaCut    = 1.2;
+    //   kGCLineCutZRSlope = tan(2*atan(exp(-kGCetaCut)));
+    break;
+  case 2:  // 1.4
+    cout<<"eta 1.4"<<endl;
+    //    kGCetaCut    = 1.4;
+    //   kGCLineCutZRSlope = tan(2*atan(exp(-kGCetaCut)));
+    break;
+  default:
+    return;
+  }
+
+
+}
diff --git a/PWG4/GammaConv/macros/start_GammaConversionAnalysis.sh b/PWG4/GammaConv/macros/start_GammaConversionAnalysis.sh
new file mode 100755 (executable)
index 0000000..98b5f92
--- /dev/null
@@ -0,0 +1,67 @@
+#! /bin/bash
+#
+#
+#
+# This script gests as input a directory where the AnalysisResults root file is stored
+# , it also needs the desired output directory where the produced root files are put.
+# If nothing is given it will use ./ for the input directory and ./Output for the output
+#
+#Input 1: Root file to analyze (not including the .root) Default: AnalyisResults
+#Input 2: Input directory  Default:$PWD 
+#Input 3: Output directory Default: $PWD/Output  (directory will be created if it does not exist)
+#
+
+RootFile="";
+if [ -n $1 ]; then
+    RootFile=AnalysisResults
+else
+    RootFile=$1
+fi
+
+
+InputDirectory="";
+if [ -n $2 ]; then
+    InputDirectory=$PWD/
+else
+    InputDirectory=$2
+fi
+echo Input directory is $InputDirectory
+
+OutputDirectory="";
+if [ -n $3 ]; then
+    OutputDirectory=$PWD/Output/
+else
+    OutputDirectory=$3
+fi
+if [ ! -d $OutputDirectory ]; then
+    mkdir $OutputDirectory
+fi 
+echo Output directory is $OutputDirectory
+
+DatFilenameBase=RB-data-AnalysisResults;
+Suffix=gif;
+
+if [ -f $OutputDirectory/$DatFilenameBase.dat ]; then
+    echo Warning: The file RB-data-AnalysisResults.dat exists, please remove before continuing.
+    echo -e "\t Otherwise the file will accumulate more entries than it is supposed to."
+    exit;
+fi
+
+
+root -b -q $ALICE_ROOT/PWG4/GammaConv/macros/MakeCutLog.C\(\"$RootFile\"\,\"$InputDirectory\"\,\"$OutputDirectory\"\)
+
+# Read the different cuts form the Cut selection log file
+exec<"$OutputDirectory/CutSelection.log"
+
+while read cutSelection
+do
+    echo CutSelection is $cutSelection;
+    root -b -q $ALICE_ROOT/PWG4/GammaConv/macros/Extract_IntegratedPi0Yield.C\(\"$cutSelection\"\,\"$RootFile\"\,\"$InputDirectory\"\,\"$OutputDirectory\"\"\);
+    
+    root -b -q $ALICE_ROOT/PWG4/GammaConv/macros/Extract_Pi0_Characteristics.C\(\"$cutSelection\"\,\"$RootFile\"\,\"$InputDirectory\"\,\"$OutputDirectory\"\);
+
+done
+
+    root -b -q $ALICE_ROOT/PWG4/GammaConv/macros/Plot_IntegratedPi0Yield.C\(\"$DatFilenameBase\"\,\"$OutputDirectory\"\,\"$Suffix\"\)
+