File indexing completed on 2025-01-30 09:14:58
0001
0002
0003
0004
0005
0006
0007
0008
0009 #include "Mat_map_surface_plot.C"
0010
0011
0012
0013 void plot_ratio(std::vector<TH2F*> Map_prop, std::vector<TH2F*> Map_geant, const sinfo& surface_info, const std::string& name){
0014
0015 std::string out_name = name+"/"+surface_info.name+"/"+surface_info.name+"_"+surface_info.idname;
0016 gSystem->Exec( Form("mkdir %s", (name+"/"+surface_info.name).c_str()) );
0017
0018
0019 if(surface_info.type == 2){
0020
0021 TText *vol = new TText(.1,.95,surface_info.name.c_str());
0022 vol->SetNDC();
0023 TText *surface = new TText(.1,.9,surface_info.id.c_str());
0024 surface->SetNDC();
0025 TText *surface_z = new TText(.1,.85,("Z = " + to_string(surface_info.pos)).c_str() );
0026 surface_z->SetNDC();
0027
0028 TCanvas *c1 = new TCanvas("c1","mat_X0",1200,1200);
0029 c1->SetRightMargin(0.14);
0030 c1->SetTopMargin(0.14);
0031 c1->SetLeftMargin(0.14);
0032 c1->SetBottomMargin(0.14);
0033 Map_prop[0]->Divide(Map_geant[0]);
0034 Map_prop[0]->GetZaxis()->SetTitle("X0 ratio");
0035 Map_prop[0]->SetMaximum(2.);
0036 Map_prop[0]->Draw("COLZ");
0037 vol->Draw();
0038 surface->Draw();
0039 surface_z->Draw();
0040 c1->Print( (out_name+"_X0.pdf").c_str());
0041
0042
0043 delete c1;
0044
0045 delete vol;
0046 delete surface;
0047 delete surface_z;
0048 }
0049
0050
0051 if(surface_info.type == 1){
0052
0053 TText *vol = new TText(.1,.95,surface_info.name.c_str());
0054 vol->SetNDC();
0055 TText *surface = new TText(.1,.9,surface_info.id.c_str());
0056 surface->SetNDC();
0057 TText *surface_r = new TText(.1,.85,("R = " + to_string(surface_info.pos)).c_str() );
0058 surface_r->SetNDC();
0059
0060 TCanvas *c1 = new TCanvas("c1","mat_X0",1200,1200);
0061 c1->SetRightMargin(0.14);
0062 c1->SetTopMargin(0.14);
0063 c1->SetLeftMargin(0.14);
0064 c1->SetBottomMargin(0.14);
0065 Map_prop[0]->Divide(Map_geant[0]);
0066 Map_prop[0]->GetZaxis()->SetTitle("X0 ratio");
0067 Map_prop[0]->SetMaximum(2.);
0068 Map_prop[0]->Draw("COLZ");
0069 vol->Draw();
0070 surface->Draw();
0071 surface_r->Draw();
0072 c1->Print( (out_name+"_X0.pdf").c_str());
0073
0074
0075 delete c1;
0076
0077 delete vol;
0078 delete surface;
0079 delete surface_r;
0080 }
0081
0082 return;
0083 }
0084
0085
0086
0087
0088
0089
0090
0091
0092
0093 void Mat_map_surface_plot_ratio(std::string input_file_prop = "", std::string input_file_geant = "", int nbprocess = -1, std::string name = "", std::string name_prop = "", std::string name_geant = ""){
0094
0095 gStyle->SetOptStat(0);
0096 gStyle->SetOptTitle(0);
0097
0098 std::map<std::uint64_t,std::vector<TH2F*>> surface_hist_prop;
0099 std::map<std::uint64_t,sinfo> surface_info_prop;
0100
0101 std::map<std::uint64_t,std::vector<TH2F*>> surface_hist_geant;
0102 std::map<std::uint64_t,sinfo> surface_info_geant;
0103
0104 Fill(surface_hist_prop, surface_info_prop, input_file_prop, nbprocess);
0105 Fill(surface_hist_geant, surface_info_geant, input_file_geant, nbprocess);
0106
0107 for (auto hist_it = surface_hist_prop.begin(); hist_it != surface_hist_prop.end(); hist_it++){
0108 if(name_prop != "") plot(hist_it->second, surface_info_prop[hist_it->first], name_prop);
0109 if(name_geant != "") plot(surface_hist_geant[hist_it->first], surface_info_geant[hist_it->first], name_geant);
0110 plot_ratio(hist_it->second,surface_hist_geant[hist_it->first], surface_info_prop[hist_it->first], name);
0111
0112 for (auto hist : hist_it->second){
0113 delete hist;
0114 }
0115 hist_it->second.clear();
0116 for (auto hist : surface_hist_geant[hist_it->first]){
0117 delete hist;
0118 }
0119 surface_hist_geant[hist_it->first].clear();
0120 }
0121
0122 }