Back to home page

sPhenix code displayed by LXR

 
 

    


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

0001 #include "sPhenixStyle.C"
0002 #include "../Constants.cpp"
0003 
0004 int MakePlot_ValidPairDeltaEta()
0005 {
0006 
0007     std::string input_file_directory = Form("/sphenix/tg/tg01/commissioning/INTT/work/cwshih/seflgendata/run_54280_HR_Feb102025/Run6_EvtZFitWidthChange/EvtVtxZ/TrackHist/baseline/completed"); 
0008     std::string input_file_name = Form("Data_TrackHist_BcoFullDiffCut_VtxZQA_ClusQAAdc35PhiSize40_ColMulMask_00054280_merged_merged_001.root");
0009     std::string target_plot_name = "h1D_PairDeltaEta_inclusive";
0010     std::string output_directory = input_file_directory;
0011     
0012     double y_max = 1.5;
0013 
0014     std::string sPH_label = "Internal";
0015     
0016     std::pair<std::string, std::string> axes_label = {"Cluster Pair #Delta#eta", ""};
0017     std::vector<std::tuple<double,double,std::string>> additional_text = {
0018         // {0.2, 0.9, "The cluster pairs post the VtxZ linking requirement are filled"},
0019 
0020         // {0.22, 0.9, "Au+Au 200 GeV"},
0021         // {0.22, 0.86, "HIJING"},
0022         // {0.22, 0.82, "Centrality 0-70%"},
0023         // {0.22, 0.78, "|INTT vtxZ| #leq 10 cm"}
0024 
0025         {0.22, 0.90, Form("%s", "Cluster pairs able to link to vertex Z are binned")}
0026         // {0.22, 0.86, "#eta: [-0.1 - 0.1]"},
0027         // {0.22, 0.82, Form("Centrality interval: [%s]%%", Constants::centrality_text[Mbin].c_str())},
0028         // {0.22, 0.78, "|INTT vtxZ| #leq 10 cm"}
0029     };
0030 
0031     bool isSetLogY = false;
0032     bool isSetLogZ = false;
0033     double y_min = 0;
0034     bool set_X_505 = true;
0035 
0036     system(Form("mkdir -p %s", output_directory.c_str()));
0037     
0038     SetsPhenixStyle();
0039 
0040     TCanvas * c1 = new TCanvas("c1", "c1", 950, 800);
0041 
0042     TLatex * ltx = new TLatex();
0043     ltx->SetNDC();
0044     ltx->SetTextSize(0.045);
0045     ltx->SetTextAlign(31);
0046 
0047     TLatex * draw_text = new TLatex();
0048     draw_text -> SetNDC();
0049     draw_text -> SetTextSize(0.03);
0050 
0051     TFile * file_in = TFile::Open(Form("%s/%s", input_file_directory.c_str(), input_file_name.c_str()));
0052     if (!file_in){
0053         std::cout<<"Error: cannot open file: "<<input_file_name<<std::endl;
0054         return 1;
0055     }
0056 
0057     TH1D * h1 = (TH1D*)file_in->Get(target_plot_name.c_str());
0058 
0059     if (axes_label.first.size() > 0){
0060         h1 -> GetXaxis() -> SetTitle(axes_label.first.c_str());
0061     }
0062     if (axes_label.second.size() > 0){
0063         h1 -> GetYaxis() -> SetTitle(axes_label.second.c_str());
0064     }
0065 
0066     c1 -> cd();
0067     if (isSetLogY) c1 -> SetLogy();
0068     if (set_X_505) {h1 -> GetXaxis() -> SetNdivisions(505);}
0069     h1 -> SetMaximum(h1 -> GetBinContent(h1 -> GetMaximumBin()) * y_max);
0070     h1 -> Draw("hist");
0071     h1 -> SetStats(0);
0072 
0073     ltx->DrawLatex(1 - gPad->GetRightMargin(), 1 - gPad->GetTopMargin() + 0.01, Form("#it{#bf{sPHENIX}} %s", sPH_label.c_str())); 
0074 
0075     for (auto text : additional_text){
0076         double x = std::get<0>(text);
0077         double y = std::get<1>(text);
0078         std::string text_str = std::get<2>(text);
0079 
0080         draw_text -> DrawLatex(x, y, text_str.c_str());
0081     }
0082 
0083     c1 -> Print(Form("%s/%s.pdf", output_directory.c_str(), target_plot_name.c_str()));
0084     c1 -> Clear();
0085 
0086     return 0;
0087 }