Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:18:32

0001 // This file is part of the Acts project.
0002 //
0003 // Copyright (C) 2020 CERN for the benefit of the Acts project
0004 //
0005 // This Source Code Form is subject to the terms of the Mozilla Public
0006 // License, v. 2.0. If a copy of the MPL was not distributed with this
0007 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
0008 
0009 #include <TROOT.h>
0010 
0011 #include <string>
0012 #include <fstream>
0013 #include <iostream>
0014 #include <sstream>
0015 
0016 using namespace std ;
0017 
0018 /// Function used to make ratio plot.
0019 
0020 void Draw_ratio(TCanvas* c, TProfile* h1, TProfile* h2, TLegend* leg, std::string name){
0021 
0022   // Upper plot will be in pad1
0023   TPad *pad1 = new TPad("pad1", "pad1", 0, 0.3, 1, 1.0);
0024 
0025   pad1->SetBottomMargin(0); // Upper and lower plot are joined
0026   pad1->SetGridx();         // Vertical grid
0027   pad1->Draw();             // Draw the upper pad: pad1
0028   pad1->cd();               // pad1 becomes the current pad
0029   h1->Draw("E");
0030   h2->Draw("E SAME");
0031   leg->Draw("SAME");
0032 
0033   double max_hist [4];
0034   max_hist[0] = h1->GetMaximum()+h1->GetMaximum()*0.05;
0035   max_hist[1] = h2->GetMaximum()+h2->GetMaximum()*0.05;
0036 
0037   h1->GetYaxis()->SetTitleOffset(1.5);
0038   h1->GetYaxis()->SetRangeUser(0, 1);
0039   // h1->GetYaxis()->SetRangeUser(0, *max_element( begin(max_hist),end(max_hist) ) );
0040 
0041   // h1->SetMinimum( 0. );  // Define Y ..
0042   // h1->SetMaximum( 0.5 ); // .. range
0043 
0044   // lower plot will be in pad
0045   c->cd();          // Go back to the main canvas before defining pad2
0046   TPad *pad2 = new TPad("pad2", "pad2", 0, 0.05, 1, 0.3);
0047   pad2->SetTopMargin(0);
0048   pad2->SetBottomMargin(0.2);
0049   pad2->SetGridx(); // vertical grid
0050   pad2->Draw();
0051   pad2->cd();       // pad2 becomes the current pad
0052 
0053   TLine line = TLine(h1->GetXaxis()->GetXmin(),1,h1->GetXaxis()->GetXmax(),1);
0054   line.SetLineColor(kRed);
0055   line.SetLineWidth(1);
0056 
0057   // Define the ratio plot
0058   TProfile *h5 = (TProfile*)h2->Clone( (name+"_ratio").c_str() );
0059   h5->SetLineColor(kBlack);
0060 
0061   h5->SetStats(0);      // No statistics on lower plot
0062   h5->Divide(h1);
0063 
0064   // double maxi = min( max( fabs(h5->GetMinimum()-0.1*h5->GetMinimum()),h5->GetMaximum()+0.1*h5->GetMaximum() ), 10. );
0065 
0066   h5->SetMinimum( 0.5 );  // Define Y ..
0067   h5->SetMaximum( 2   ); // .. range
0068 
0069   h5->SetMarkerStyle(7);
0070   h5->Draw("hist P");       // Draw the ratio plot
0071   line.Draw("SAME");
0072 
0073   // Y axis ratio plot settings
0074   h5->GetYaxis()->SetTitle("Ratio Validation/Geantino ");
0075   h5->GetYaxis()->SetNdivisions(505);
0076   h5->GetYaxis()->SetTitleSize(15);
0077   h5->GetYaxis()->SetTitleFont(43);
0078   h5->GetYaxis()->SetTitleOffset(1.55);
0079   h5->GetYaxis()->SetLabelFont(43);
0080   h5->GetYaxis()->SetLabelSize(15);
0081 
0082   // X axis ratio plot settings
0083   h5->GetXaxis()->SetTitleSize(20);
0084   h5->GetXaxis()->SetTitleFont(43);
0085   h5->GetXaxis()->SetTitleOffset(3);
0086   h5->GetXaxis()->SetLabelFont(43);
0087   h5->GetXaxis()->SetLabelSize(15);
0088 
0089   std::string name_axis = h1->GetXaxis()->GetTitle();
0090 
0091   c->Print( (name+"/Ratio_Val_geant_mat_X0_"+name_axis+".png").c_str());
0092 
0093   delete h5;
0094 
0095 }
0096 
0097 
0098 void mat_map_local(std::string Val = "", std::string geantino = "", std::string name = ""){
0099 
0100 
0101   gStyle->SetOptStat(0);
0102   gStyle->SetOptTitle(0);
0103 
0104   TProfile * Val_X0_Eta = new TProfile("Val_X0_Eta","Val_X0_Eta",160,-4,4);
0105   TProfile * Val_X0_Phi = new TProfile("Val_X0_Phi","Val_X0_Phi",160,-4,4);
0106   TH2F * Val_X0 = new TH2F("Val_X0","Val_X0",160,-4,4,160,-4,4);
0107 
0108   TProfile * geantino_X0_Eta = new TProfile("geantino_X0_Eta","geantino_X0_Eta",160,-4,4);
0109   TProfile * geantino_X0_Phi = new TProfile("geantino_X0_Phi","geantino_X0_Phi",160,-4,4);
0110   TH2F * geantino_X0 = new TH2F("geantino_X0","geantinol_X0",160,-4,4,160,-4,4);
0111 
0112   TH1F * comp_X0_Eta = new TH1F("comp_X0_Eta","comp_X0_Eta",160,-4,4);
0113   TH1F * comp_X0_Phi = new TH1F("comp_X0_Phi","comp_X0_Phi",160,-4,4);
0114   TH2F * comp_X0 = new TH2F("comp_X0","comp_X0",160,-4,4,160,-4,4);
0115 
0116     TH2F * mat_map1 = new TH2F("mat_map1","",2000,-3000,3000,1000,-10,1000);
0117     TH2F * mat_map2 = new TH2F("mat_map2","",2000,-3000,3000,1000,-10,1000);
0118 
0119   TChain *Val_file = new TChain("material-tracks");
0120   TChain *geantino_file = new TChain("material-tracks");
0121 
0122    // Define line corresponding to the different eta value
0123   TLine *eta_0 = new TLine(0,-1200,0,1200);
0124   eta_0->SetLineColor(kRed);
0125 
0126   TLine *eta_1p = new TLine(-1250,-1064,1250,1064);
0127   eta_1p->SetLineColor(kRed);
0128   TLine *eta_2p = new TLine(-3000,-827,3000,827);
0129   eta_2p->SetLineColor(kRed);
0130   TLine *eta_3p = new TLine(-3000,-300,3000,300);
0131   eta_3p->SetLineColor(kRed);
0132   TLine *eta_4p = new TLine(-3000,-110,3000,110);
0133   eta_4p->SetLineColor(kRed);
0134 
0135   TLine *eta_1n = new TLine(-1250,1064,1250,-1064);
0136   eta_1n->SetLineColor(kRed);
0137   TLine *eta_2n = new TLine(-3000,827,3000,-827);
0138   eta_2n->SetLineColor(kRed);
0139   TLine *eta_3n = new TLine(-3000,300,3000,-300);
0140   eta_3n->SetLineColor(kRed);
0141   TLine *eta_4n = new TLine(-3000,110,3000,-110);
0142   eta_4n->SetLineColor(kRed);
0143 
0144 
0145     // 2D map for ACTS input
0146     Val_file->Add(Val.c_str());
0147     TCanvas *VM = new TCanvas("VM","Validation Map") ;
0148 
0149     Val_file->Draw("sqrt(mat_x**2+mat_y**2):mat_z>>mat_map1","abs(mat_z)<5000");
0150 
0151     VM->SetGrid();
0152 
0153     VM->Print( (name+"/Val_mat_map.png").c_str());
0154 
0155     Val_file->Add(Val.c_str());
0156     TCanvas *VM_eta = new TCanvas("VM_eta","Validation Map") ;
0157     Val_file->Draw("sqrt(mat_x**2+mat_y**2):v_eta","abs(mat_z)<5000");
0158     VM_eta->SetGrid();
0159     VM_eta->Print( (name+"/Val_mat_map_eta.png").c_str());
0160 
0161     // X0 as function of Eta for Validation input
0162     TCanvas *VM_X0_Eta = new TCanvas("VM_X0_Eta","Validation X0 Eta") ;
0163     Val_file->Draw("t_X0:v_eta>>Val_X0_Eta","","profile");
0164     Val_X0_Eta->SetMarkerStyle(7);
0165     // Val_X0_Eta->Draw("HIST PC");
0166     Val_X0_Eta->GetXaxis()->SetTitle("Eta");
0167     Val_X0_Eta->GetYaxis()->SetTitle("X0");
0168 
0169     // 2D map for Geantino input
0170     geantino_file->Add(geantino.c_str());
0171     TCanvas *GM = new TCanvas("GM","Geantino Map") ;
0172     geantino_file->Draw("sqrt(mat_x**2+mat_y**2):mat_z>>mat_map2","abs(mat_z)<5000");
0173 
0174 
0175     eta_0->Draw("Same");
0176     eta_1p->Draw("Same");
0177     eta_1n->Draw("Same");
0178     eta_2p->Draw("Same");
0179     eta_2n->Draw("Same");
0180     eta_3p->Draw("Same");
0181     eta_3n->Draw("Same");
0182     eta_4p->Draw("Same");
0183     eta_4n->Draw("Same");
0184 
0185     GM->Print( (name+"/geant_mat_map.png").c_str());
0186     //GM->Print( (name+"/geant_mat_map.pdf").c_str());
0187 
0188     // X0 as function of Eta for Geantino input
0189     TCanvas *GM_X0_Eta = new TCanvas("GM_X0_Eta","Geantino X0 Eta") ;
0190     geantino_file->Draw("t_X0:v_eta>>geantino_X0_Eta","","profile");
0191     // geantino_X0_Eta->SetMarkerStyle(7);
0192     // geantino_X0_Eta->Draw("HIST PC");
0193     // geantino_X0_Eta->GetXaxis()->SetTitle("Eta");
0194     // geantino_X0_Eta->GetYaxis()->SetTitle("X0");
0195     // GM_X0_Eta->Print( (name+"/geant_mat_Eta_X0.pdf").c_str());
0196 
0197     // X0 ratio plot as function of eta of the Validation and Geantino input
0198     TCanvas *Comp_Eta = new TCanvas("Comp_Eta","Ratio geantino_Validation Eta") ;
0199     Val_X0_Eta->SetMarkerStyle(7);
0200     geantino_X0_Eta->SetMarkerStyle(7);
0201     Val_X0_Eta->SetMarkerColor(kBlack);
0202     geantino_X0_Eta->SetMarkerColor(kRed);
0203     Val_X0_Eta->SetLineColor(kBlack);
0204     geantino_X0_Eta->SetLineColor(kRed);
0205 
0206     Val_X0_Eta->SetMarkerColor(kBlack);
0207     Val_X0_Eta->SetLineColor(kBlack);
0208     geantino_X0_Eta->SetMarkerColor(kRed);
0209     geantino_X0_Eta->SetLineColor(kRed);
0210 
0211     TLegend* leg = new TLegend(0.1,0.15,0.25,0.30);
0212     leg->AddEntry(Val_X0_Eta,"Validation X0");
0213     leg->AddEntry(geantino_X0_Eta,"Geantino X0");
0214 
0215 
0216     Draw_ratio(Comp_Eta, geantino_X0_Eta, Val_X0_Eta, leg, name);
0217 
0218 }
0219 /// Compare two set of material tracks (for exemple one obtain with propagator and material map and one with geantino scan).
0220 /// Draw the ammont of material (in X0) encounter by tracks as function of eta and phi.
0221 /// Plot the ratio between the two set to help identify inconsistency.
0222 
0223 void Mat_map(std::string Val = "", std::string geantino = "", std::string name = ""){
0224 
0225   gStyle->SetOptStat(0);
0226   gStyle->SetOptTitle(0);
0227 
0228   TProfile * Val_X0_Eta = new TProfile("Val_X0_Eta","Val_X0_Eta",160,-4,4);
0229   TProfile * Val_X0_Phi = new TProfile("Val_X0_Phi","Val_X0_Phi",160,-4,4);
0230   TH2F * Val_X0_Eta_spread = new TH2F("Val_X0_Eta_spread","Val_X0_Eta_spread",160,-4,4,160,0,4);
0231   TH2F * Val_X0_Phi_spread = new TH2F("Val_X0_Phi_spread","Val_X0_Phi_spread",160,-4,4,160,0,4);
0232   TH2F * Val_X0 = new TH2F("Val_X0","Val_X0",160,-4,4,160,-4,4);
0233 
0234   TProfile * geantino_X0_Eta = new TProfile("geantino_X0_Eta","geantino_X0_Eta",160,-4,4);
0235   TProfile * geantino_X0_Phi = new TProfile("geantino_X0_Phi","geantino_X0_Phi",160,-4,4);
0236   TH2F * geantino_X0_Eta_spread = new TH2F("geantino_X0_Eta_spread","geantino_X0_Eta_spread",160,-4,4,160,0,4);
0237   TH2F * geantino_X0_Phi_spread = new TH2F("geantino_X0_Phi_spread","geantino_X0_Phi_spread",160,-4,4,160,0,4);
0238   TH2F * geantino_X0 = new TH2F("geantino_X0","geantinol_X0",160,-4,4,160,-4,4);
0239 
0240   TH1F * comp_X0_Eta = new TH1F("comp_X0_Eta","comp_X0_Eta",160,-4,4);
0241   TH1F * comp_X0_Phi = new TH1F("comp_X0_Phi","comp_X0_Phi",160,-4,4);
0242   TH2F * comp_X0 = new TH2F("comp_X0","comp_X0",160,-4,4,160,-4,4);
0243 
0244   TChain *Val_file = new TChain("material-tracks");
0245   TChain *geantino_file = new TChain("material-tracks");
0246 
0247   // Define line corresponding to the different eta value
0248   TLine *eta_0 = new TLine(0,-1200,0,1200);
0249   eta_0->SetLineColor(kRed);
0250 
0251   TLine *eta_1p = new TLine(-1250,-1064,1250,1064);
0252   eta_1p->SetLineColor(kRed);
0253   TLine *eta_2p = new TLine(-3000,-827,3000,827);
0254   eta_2p->SetLineColor(kRed);
0255   TLine *eta_3p = new TLine(-3000,-300,3000,300);
0256   eta_3p->SetLineColor(kRed);
0257   TLine *eta_4p = new TLine(-3000,-110,3000,110);
0258   eta_4p->SetLineColor(kRed);
0259 
0260   TLine *eta_1n = new TLine(-1250,1064,1250,-1064);
0261   eta_1n->SetLineColor(kRed);
0262   TLine *eta_2n = new TLine(-3000,827,3000,-827);
0263   eta_2n->SetLineColor(kRed);
0264   TLine *eta_3n = new TLine(-3000,300,3000,-300);
0265   eta_3n->SetLineColor(kRed);
0266   TLine *eta_4n = new TLine(-3000,110,3000,-110);
0267   eta_4n->SetLineColor(kRed);
0268 
0269   if(Val != ""){
0270     Val_file->Add(Val.c_str());
0271 
0272     // 2D map for Validation input
0273     TCanvas *VM = new TCanvas("VM","Validation Map") ;
0274     Val_file->Draw("mat_y:mat_z","fabs(mat_x)<1");
0275 
0276     // eta_0->Draw("Same");
0277     // eta_1p->Draw("Same");
0278     // eta_1n->Draw("Same");
0279     // eta_2p->Draw("Same");
0280     // eta_2n->Draw("Same");
0281     // eta_3p->Draw("Same");
0282     // eta_3n->Draw("Same");
0283     // eta_4p->Draw("Same");
0284     // eta_4n->Draw("Same");
0285 
0286     // VM->Print( (name+"/Val_mat_map.png").c_str());
0287     VM->Print( (name+"/Val_mat_map.png").c_str());
0288 
0289     // X0 as function of Eta for Validation input
0290     TCanvas *VM_X0_Eta = new TCanvas("VM_X0_Eta","Validation X0 Eta") ;
0291     Val_file->Draw("t_X0:v_eta>>Val_X0_Eta","","profile");
0292     Val_X0_Eta->SetMarkerStyle(7);
0293     Val_X0_Eta->Draw("HIST PC");
0294     Val_X0_Eta->GetXaxis()->SetTitle("Eta");
0295     Val_X0_Eta->GetYaxis()->SetTitle("X0");
0296     VM_X0_Eta->Print( (name+"/Val_mat_Eta_X0.pdf").c_str());
0297 
0298     // X0 as function of Eta for Validation input
0299     TCanvas *VM_X0_Eta_spread = new TCanvas("VM_X0_Eta_spread","Validation X0 Eta") ;
0300     Val_file->Draw("t_X0:v_eta>>Val_X0_Eta_spread","","");
0301     Val_X0_Eta_spread->GetXaxis()->SetTitle("Eta");
0302     Val_X0_Eta_spread->GetYaxis()->SetTitle("X0");
0303     VM_X0_Eta_spread->Print( (name+"/Val_X0_Eta_spread.pdf").c_str());
0304 
0305     // X0 as function of Phi for Validation input
0306     TCanvas *VM_X0_Phi = new TCanvas("VM_X0_Phi","Validation X0 Phi") ;
0307     Val_file->Draw("t_X0:v_phi>>Val_X0_Phi","exp(-v_eta)/(1+exp(-2*v_eta))","profile");
0308     Val_X0_Phi->SetMarkerStyle(7);
0309     Val_X0_Phi->Draw("HIST PC");
0310     Val_X0_Phi->GetXaxis()->SetTitle("Phi");
0311     Val_X0_Phi->GetYaxis()->SetTitle("X0");
0312     VM_X0_Phi->Print( (name+"/Val_mat_Phi_X0.pdf").c_str());
0313 
0314     // X0 as function of Phi for Validation input
0315     TCanvas *VM_X0_Phi_spread = new TCanvas("VM_X0_Phi_spread","Validation X0 Phi") ;
0316     Val_file->Draw("t_X0:v_phi>>Val_X0_Phi_spread","exp(-v_eta)/(1+exp(-2*v_eta))","");
0317     Val_X0_Phi_spread->GetXaxis()->SetTitle("Phi");
0318     Val_X0_Phi_spread->GetYaxis()->SetTitle("X0");
0319     VM_X0_Phi_spread->Print( (name+"/Val_mat_Phi_X0_spread.pdf").c_str());
0320 
0321     // 2D map of X0 for Validation input
0322     TCanvas *VM_2D = new TCanvas("VM_2D","Validation X0 2D") ;
0323     Val_file->Draw("v_phi:v_eta:t_X0>>Val_X0","","COLZ");
0324     Val_X0->GetXaxis()->SetTitle("Eta");
0325     Val_X0->GetYaxis()->SetTitle("Phi");
0326     Val_X0->GetZaxis()->SetTitle("X0");
0327     VM_2D->Print( (name+"/Val_mat_X0.png").c_str());
0328   }
0329 
0330   if(geantino != ""){
0331     geantino_file->Add(geantino.c_str());
0332 
0333     // 2D map for Geantino input
0334     TCanvas *GM = new TCanvas("GM","Geantino Map") ;
0335     geantino_file->Draw("mat_y:mat_z","fabs(mat_x)<1");
0336 
0337     eta_0->Draw("Same");
0338     eta_1p->Draw("Same");
0339     eta_1n->Draw("Same");
0340     eta_2p->Draw("Same");
0341     eta_2n->Draw("Same");
0342     eta_3p->Draw("Same");
0343     eta_3n->Draw("Same");
0344     eta_4p->Draw("Same");
0345     eta_4n->Draw("Same");
0346 
0347     GM->Print( (name+"/geant_mat_map.png").c_str());
0348     //GM->Print( (name+"/geant_mat_map.pdf").c_str());
0349 
0350     // X0 as function of Eta for Geantino input
0351     TCanvas *GM_X0_Eta = new TCanvas("GM_X0_Eta","Geantino X0 Eta") ;
0352     geantino_file->Draw("t_X0:v_eta>>geantino_X0_Eta","","profile");
0353     geantino_X0_Eta->SetMarkerStyle(7);
0354     geantino_X0_Eta->Draw("HIST PC");
0355     geantino_X0_Eta->GetXaxis()->SetTitle("Eta");
0356     geantino_X0_Eta->GetYaxis()->SetTitle("X0");
0357     GM_X0_Eta->Print( (name+"/geant_mat_Eta_X0.pdf").c_str());
0358 
0359     // X0 as function of Eta for Geantino input
0360     TCanvas *GM_X0_Eta_spread = new TCanvas("GM_X0_Eta_spread","Geantino X0 Eta") ;
0361     geantino_file->Draw("t_X0:v_eta>>geantino_X0_Eta_spread","","");
0362     geantino_X0_Eta_spread->GetXaxis()->SetTitle("Eta");
0363     geantino_X0_Eta_spread->GetYaxis()->SetTitle("X0");
0364     GM_X0_Eta->Print( (name+"/geant_mat_Eta_X0_spread.pdf").c_str());
0365 
0366     // X0 as function of Phi for Geantino input
0367     TCanvas *GM_X0_Phi = new TCanvas("GM_X0_Phi","Geantino X0 Phi") ;
0368     geantino_file->Draw("t_X0:v_phi>>geantino_X0_Phi","","profile");
0369     geantino_X0_Phi->SetMarkerStyle(7);
0370     geantino_X0_Phi->Draw("HIST PC");
0371     geantino_X0_Phi->GetXaxis()->SetTitle("Phi");
0372     geantino_X0_Phi->GetYaxis()->SetTitle("X0");
0373     GM_X0_Phi->Print( (name+"/geant_mat_Phi_X0.pdf").c_str());
0374 
0375     // X0 as function of Phi for Geantino input
0376     TCanvas *GM_X0_Phi_spread = new TCanvas("GM_X0_Phi_spread","Geantino X0 Phi") ;
0377     geantino_file->Draw("t_X0:v_phi>>geantino_X0_Phi_spread","","");
0378     geantino_X0_Phi_spread->GetXaxis()->SetTitle("Phi");
0379     geantino_X0_Phi_spread->GetYaxis()->SetTitle("X0");
0380     GM_X0_Phi->Print( (name+"/geant_mat_Phi_X0_spread.pdf").c_str());
0381 
0382     // 2D map of X0 for Geantino input
0383     TCanvas *GM_2D = new TCanvas("GM_2D","Geantino X0 2D") ;
0384     geantino_file->Draw("v_phi:v_eta:t_X0>>geantino_X0","","COLZ");
0385     geantino_X0->GetXaxis()->SetTitle("Eta");
0386     geantino_X0->GetYaxis()->SetTitle("Phi");
0387     geantino_X0->GetZaxis()->SetTitle("X0");
0388     GM_2D->Print( (name+"/geant_mat_X0.png").c_str());
0389   }
0390 
0391   if(Val != "" && geantino != ""){
0392 
0393     Val_X0_Eta->SetMarkerColor(kBlack);
0394     Val_X0_Eta->SetLineColor(kBlack);
0395     geantino_X0_Eta->SetMarkerColor(kRed);
0396     geantino_X0_Eta->SetLineColor(kRed);
0397 
0398     Val_X0_Phi->SetMarkerColor(kBlack);
0399     Val_X0_Phi->SetLineColor(kBlack);
0400     geantino_X0_Phi->SetMarkerColor(kRed);
0401     geantino_X0_Phi->SetLineColor(kRed);
0402 
0403     TLegend* leg = new TLegend(0.1,0.15,0.25,0.30);
0404     leg->AddEntry(Val_X0_Eta,"Validation X0");
0405     leg->AddEntry(geantino_X0_Eta,"Geantino X0");
0406 
0407     TLegend* leg2 = new TLegend(0.1,0.15,0.25,0.30);
0408     leg2->AddEntry(Val_X0_Phi,"Validation X0");
0409     leg2->AddEntry(geantino_X0_Phi,"Geantino X0");
0410 
0411     // X0 differences as function of eta of the Validation and Geantino input
0412     comp_X0_Eta->Add(Val_X0_Eta);
0413     comp_X0_Eta->Add(geantino_X0_Eta,-1);
0414     comp_X0_Eta->Divide(Val_X0_Eta);
0415     comp_X0_Eta->Scale(100);
0416     comp_X0_Eta->GetXaxis()->SetTitle("Eta");
0417     comp_X0_Eta->GetYaxis()->SetTitle("(Validation X0 - geantino X0) / Validation X0 [%]");
0418     TCanvas *Diff_Eta = new TCanvas("Diff_Eta","Comparison geantino_Validation Eta") ;
0419     comp_X0_Eta->Draw();
0420     Diff_Eta->Print( (name+"/Comp_Val_geant_mat_X0_Eta.pdf").c_str());
0421 
0422     // X0 comparison as function of eta of the Validation and Geantino input
0423     TCanvas *Comp_Eta_spread = new TCanvas("Comp_Eta_spread","Comparison geantino_Validation Eta") ;
0424     Val_X0_Eta_spread->Draw();
0425     geantino_X0_Eta_spread->SetMarkerColor(kRed);
0426     geantino_X0_Eta_spread->Draw("SAME");
0427     leg->Draw("SAME");
0428     Comp_Eta_spread->Print( (name+"/Comp_Val_geant_mat_X0_Eta_spread.pdf").c_str());
0429 
0430     // X0 differences as function of phi of the Validation and Geantino input
0431     comp_X0_Phi->Add(Val_X0_Phi);
0432     comp_X0_Phi->Add(geantino_X0_Phi,-1);
0433     comp_X0_Phi->Divide(Val_X0_Phi);
0434     comp_X0_Phi->Scale(100);
0435     comp_X0_Phi->GetXaxis()->SetTitle("Phi");
0436     comp_X0_Phi->GetYaxis()->SetTitle("(Validation X0 - geantino X0) / Validation X0 [%]");
0437     TCanvas *Diff_Phi = new TCanvas("Diff_Phi","Comparison geantino_Validation") ;
0438     comp_X0_Phi->Draw();
0439     Diff_Phi->Print( (name+"/Comp_Val_geant_mat_X0_Phi.pdf").c_str());
0440 
0441     // X0 comparison as function of eta of the Validation and Geantino input
0442     TCanvas *Comp_Phi_spread = new TCanvas("Comp_Phi_spread","Comparison geantino_Validation Phi") ;
0443     Val_X0_Phi_spread->Draw();
0444     geantino_X0_Phi_spread->SetMarkerColor(kRed);
0445     geantino_X0_Phi_spread->Draw("SAME");
0446     leg2->Draw("SAME");
0447     Comp_Phi_spread->Print( (name+"/Comp_Val_geant_mat_X0_Phi_spread.pdf").c_str());
0448 
0449     Float_t score = 0;
0450     for(int i=0; i<Val_X0->GetXaxis()->GetNbins(); i++){
0451       score += (Val_X0->GetBinContent(i+1)-geantino_X0->GetBinContent(i+1))*
0452       (Val_X0->GetBinContent(i+1)-geantino_X0->GetBinContent(i+1))/
0453       geantino_X0->GetBinError(i+1)*geantino_X0->GetBinError(i+1);
0454     }
0455     std::cout << "Score : " << score << std::endl;
0456 
0457     TText *t = new TText(0,10, ("Chi^2 score : " + to_string(score)).c_str());
0458     t->Draw();
0459 
0460     // X0 ratio plot as function of eta of the Validation and Geantino input
0461     TCanvas *Comp_Eta = new TCanvas("Comp_Eta","Ratio geantino_Validation Eta") ;
0462     Val_X0_Eta->SetMarkerStyle(7);
0463     geantino_X0_Eta->SetMarkerStyle(7);
0464     Val_X0_Eta->SetMarkerColor(kBlack);
0465     geantino_X0_Eta->SetMarkerColor(kRed);
0466     Val_X0_Eta->SetLineColor(kBlack);
0467     geantino_X0_Eta->SetLineColor(kRed);
0468 
0469     Draw_ratio(Comp_Eta, geantino_X0_Eta, Val_X0_Eta, leg, name);
0470 
0471     // X0 ratio plot as function of phi of the Validation and Geantino input
0472     TCanvas *Comp_Phi = new TCanvas("Comp_Phi","Ratio geantino_Validation Phi") ;
0473     Val_X0_Phi->SetMarkerStyle(7);
0474     geantino_X0_Phi->SetMarkerStyle(7);
0475     Val_X0_Phi->SetMarkerColor(kBlack);
0476     geantino_X0_Phi->SetMarkerColor(kRed);
0477     Val_X0_Phi->SetLineColor(kBlack);
0478     geantino_X0_Phi->SetLineColor(kRed);
0479 
0480     Draw_ratio(Comp_Phi, geantino_X0_Phi, Val_X0_Phi, leg, name);
0481   }
0482 
0483   return;
0484 
0485 }