File indexing completed on 2025-08-06 08:12:39
0001 #include "sPhenixStyle.C"
0002
0003 int MakePlot_INTTzEffi()
0004 {
0005 std::string input_file_directory = "/sphenix/user/ChengWei/sPH_dNdeta/Run24AuAuMC/Sim_HIJING_MDC2_ana472_20250307/Run7/EvtVtxZ/completed/VtxZDist/completed";
0006 std::string input_file_name = "MC_vtxZDist_VtxZQA_merged.root";
0007 std::string target_plot_truth_name = "h2D_TruthCount_TruthZ_Centrality";
0008 std::string target_plot2_reco_name = "h2D_GoodRecoZ_TruthZ_Centrality";
0009
0010 std::string output_directory = input_file_directory;
0011 std::string output_file_name = "h2D_RecoZEffi_TruthZ_Centrality";
0012 std::string Zaxis_title = "Efficiency";
0013 std::pair<std::string, std::string> axes_label = {"Truth Z [cm]", "Centrality Interval [%]"};
0014
0015 std::string sPH_label = "Simulation";
0016 std::vector<std::tuple<double,double,std::string>> additional_text = {
0017
0018
0019
0020 {0.18, 0.96, "HIJING, |VtxZDiff| #leq 1 cm"},
0021 };
0022
0023 SetsPhenixStyle();
0024
0025 TCanvas * c1 = new TCanvas("c1", "c1", 950, 800);
0026
0027 TLatex * ltx = new TLatex();
0028 ltx->SetNDC();
0029 ltx->SetTextSize(0.045);
0030 ltx->SetTextAlign(31);
0031
0032 TLatex * draw_text = new TLatex();
0033 draw_text -> SetNDC();
0034 draw_text -> SetTextSize(0.03);
0035
0036 TFile * file_in = TFile::Open(Form("%s/%s", input_file_directory.c_str(), input_file_name.c_str()));
0037 TH2D * h2D_truth = (TH2D*)file_in->Get(target_plot_truth_name.c_str());
0038 TH2D * h2D_reco = (TH2D*)file_in->Get(target_plot2_reco_name.c_str());
0039
0040 TH2D * final = (TH2D*)h2D_reco->Clone("final");
0041 final -> Sumw2();
0042 final -> Divide(h2D_reco, h2D_truth, 1, 1);
0043
0044 final -> GetXaxis() -> SetTitle(axes_label.first.c_str());
0045 final -> GetYaxis() -> SetTitle(axes_label.second.c_str());
0046 final -> GetZaxis() -> SetTitle(Zaxis_title.c_str());
0047
0048 gStyle->SetPaintTextFormat("1.3f");
0049
0050 final -> SetMarkerSize(0.4);
0051 final -> Draw("colz0 TEXT90 E");
0052
0053 ltx->DrawLatex(1 - gPad->GetRightMargin(), 1 - gPad->GetTopMargin() + 0.01, Form("#it{#bf{sPHENIX}} %s", sPH_label.c_str()));
0054
0055 for (auto text : additional_text){
0056 double x = std::get<0>(text);
0057 double y = std::get<1>(text);
0058 std::string text_str = std::get<2>(text);
0059
0060 draw_text -> DrawLatex(x, y, text_str.c_str());
0061 }
0062
0063 c1 -> Print(Form("%s/%s.pdf", output_directory.c_str(), output_file_name.c_str()));
0064 return 0;
0065 }