Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-06 08:12:39

0001 #include "sPhenixStyle.C"
0002 
0003 int MakePlot_ColumnUniformity()
0004 {
0005     std::string input_file_directory = "/sphenix/user/ChengWei/sPH_dNdeta/Run24AuAuMC/Sim_HIJING_MDC2_ana472_20250307/Run7/EvtVtxZ/ColumnCheck/baseline/completed/MulMap/completed"; 
0006     std::string input_file_name = "MulMap_BcoFullDiffCut_Mbin70_VtxZ-30to30cm_ClusQAAdc35PhiSize40_00054280.root";
0007     std::string output_directory = input_file_directory;
0008 
0009     std::vector<std::tuple<double,double,std::string>> additional_text = {
0010         {0.22, 0.86, "Centrality 0-70%"},
0011         {0.22, 0.82, "|MBD vtxZ| #leq 30 cm"},
0012         {0.22, 0.78, "MC: HIJING"}
0013     };
0014 
0015     std::string sPH_label_data = "Internal";
0016     std::string sPH_label_MC = "Simulation";
0017 
0018     system(Form("mkdir -p %s", output_directory.c_str()));
0019     
0020     SetsPhenixStyle();
0021 
0022     TCanvas * c1 = new TCanvas("c1", "c1", 950, 800);
0023 
0024     TLatex * ltx = new TLatex();
0025     ltx->SetNDC();
0026     ltx->SetTextSize(0.045);
0027     ltx->SetTextAlign(31);
0028 
0029     TLatex * draw_text = new TLatex();
0030     draw_text -> SetNDC();
0031     draw_text -> SetTextSize(0.03);
0032 
0033     TLegend * leg = new TLegend(0.52,0.81,0.72,0.9);
0034     // leg -> SetNColumns(2);
0035     leg -> SetBorderSize(0);
0036     leg -> SetTextSize(0.025);
0037     leg -> SetMargin(0.2);
0038 
0039     TFile * file_in = TFile::Open(Form("%s/%s", input_file_directory.c_str(), input_file_name.c_str()));
0040     if (!file_in){
0041         std::cout<<"Error: cannot open file: "<<input_file_name<<std::endl;
0042         return 1;
0043     }
0044 
0045     
0046     TH1D * h1D_Ratio_All = (TH1D*)file_in->Get("h1D_Ratio_All");
0047     h1D_Ratio_All -> SetTitle(";Multiplicity Ratio (data/MC);Entries");
0048     
0049     TH2D * h2D_ClusCountLayerPhiId_ZId12_data = (TH2D*)file_in->Get("h2D_ClusCountLayerPhiId_ZId12_data");
0050     // h2D_ClusCountLayerPhiId_ZId12_data -> SetTitle("");
0051     
0052     TH2D * h2D_ClusCountLayerPhiId_ZId12_MC = (TH2D*)file_in->Get("h2D_ClusCountLayerPhiId_ZId12_MC");
0053     // h2D_ClusCountLayerPhiId_ZId12_MC -> SetTitle("");
0054     
0055     TH2D * h2D_MulMap = (TH2D*)file_in->Get("h2D_MulMap");
0056     // h2D_MulMap -> GetZaxis() -> SetTitle("Ratio (data/MC)");
0057     
0058     TH2D * h2D_RatioLayerPhiId_ZId12 = (TH2D*)file_in->Get("h2D_RatioLayerPhiId_ZId12");
0059     h2D_RatioLayerPhiId_ZId12 -> SetTitle(";INTT LayerID;INTT LadderPhiId;Ratio (data/MC)");
0060     
0061     TH2D * h2D_RatioMap = (TH2D*)file_in->Get("h2D_RatioMap");
0062     h2D_RatioMap -> GetZaxis() -> SetTitle("Ratio (data/MC)");
0063 
0064 
0065     c1 -> cd();
0066     c1 -> SetLogy(1);
0067     h1D_Ratio_All -> Draw("hist");
0068     ltx->DrawLatex(1 - gPad->GetRightMargin(), 1 - gPad->GetTopMargin() + 0.01, Form("#it{#bf{sPHENIX}} %s", sPH_label_data.c_str())); 
0069     c1 -> Print(Form("%s/h1D_Ratio_All.pdf", output_directory.c_str()));
0070     c1 -> Clear();
0071     c1 -> SetLogy(0);
0072 
0073 
0074     c1 -> cd();
0075     h2D_ClusCountLayerPhiId_ZId12_data -> Draw("colz0");
0076     ltx->DrawLatex(1 - gPad->GetRightMargin(), 1 - gPad->GetTopMargin() + 0.01, Form("#it{#bf{sPHENIX}} %s", sPH_label_data.c_str()));
0077     for (auto text : additional_text){
0078         double x = std::get<0>(text);
0079         double y = std::get<1>(text);
0080         std::string text_str = std::get<2>(text);
0081 
0082         draw_text -> DrawLatex(x, y, text_str.c_str());
0083     }
0084     c1 -> Print(Form("%s/h2D_ClusCountLayerPhiId_ZId12_data.pdf", output_directory.c_str()));
0085     c1 -> Clear();
0086 
0087     c1 -> cd();
0088     h2D_ClusCountLayerPhiId_ZId12_MC -> Draw("colz0");
0089     ltx->DrawLatex(1 - gPad->GetRightMargin(), 1 - gPad->GetTopMargin() + 0.01, Form("#it{#bf{sPHENIX}} %s", sPH_label_MC.c_str()));
0090     for (auto text : additional_text){
0091         double x = std::get<0>(text);
0092         double y = std::get<1>(text);
0093         std::string text_str = std::get<2>(text);
0094 
0095         draw_text -> DrawLatex(x, y, text_str.c_str());
0096     }
0097     c1 -> Print(Form("%s/h2D_ClusCountLayerPhiId_ZId12_MC.pdf", output_directory.c_str()));
0098     c1 -> Clear();
0099 
0100     c1 -> cd();
0101     h2D_MulMap -> Draw("colz0");
0102     ltx->DrawLatex(1 - gPad->GetRightMargin(), 1 - gPad->GetTopMargin() + 0.01, Form("#it{#bf{sPHENIX}} %s", sPH_label_data.c_str()));
0103     c1 -> Print(Form("%s/h2D_MulMap.pdf", output_directory.c_str()));
0104     c1 -> Clear();
0105 
0106     c1 -> cd();
0107     h2D_RatioLayerPhiId_ZId12 -> Draw("colz0");
0108     ltx->DrawLatex(1 - gPad->GetRightMargin(), 1 - gPad->GetTopMargin() + 0.01, Form("#it{#bf{sPHENIX}} %s", sPH_label_data.c_str()));
0109     for (auto text : additional_text){
0110         double x = std::get<0>(text);
0111         double y = std::get<1>(text);
0112         std::string text_str = std::get<2>(text);
0113 
0114         draw_text -> DrawLatex(x, y, text_str.c_str());
0115     }
0116     c1 -> Print(Form("%s/h2D_RatioLayerPhiId_ZId12.pdf", output_directory.c_str()));
0117     c1 -> Clear();
0118 
0119     c1 -> cd();
0120     h2D_RatioMap -> Draw("colz0");
0121     ltx->DrawLatex(1 - gPad->GetRightMargin(), 1 - gPad->GetTopMargin() + 0.01, Form("#it{#bf{sPHENIX}} %s", sPH_label_data.c_str()));
0122     c1 -> Print(Form("%s/h2D_RatioMap.pdf", output_directory.c_str()));
0123     c1 -> Clear();
0124 
0125 
0126     return 999;
0127 
0128 }