Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-06 08:21:01

0001 #include "sPhenixStyle.C"
0002 
0003 void myText(Double_t x,Double_t y,Color_t color, const char *text, Double_t tsize=0.04) {
0004 
0005   TLatex l; l.SetTextAlign(12); l.SetTextSize(tsize);
0006   l.SetNDC();
0007   l.SetTextColor(color);
0008   l.DrawLatex(x,y,text);
0009 }
0010 
0011 
0012 
0013 
0014 void plot(){
0015 
0016 SetsPhenixStyle();
0017 
0018 std::string file_path = "runList.txt";
0019 
0020 std::ifstream file(file_path);
0021 
0022 std::vector<int> run_numbers;
0023 std::string line;
0024 while (std::getline(file, line)) {
0025     std::istringstream iss(line);
0026     int run_number;
0027     if (iss >> run_number) {
0028         run_numbers.push_back(run_number);
0029     } else {
0030         std::cerr << "Warning: Invalid integer on line: " << line << std::endl;
0031     }
0032 }
0033 
0034 file.close();
0035 
0036 if (run_numbers.empty()) {
0037     std::cerr << "Error: No valid run numbers found in the file." << std::endl;
0038     return 1;
0039 }
0040 
0041 int first_run = run_numbers.front();
0042 int last_run = run_numbers.back();
0043 
0044 string func_str = "[0]/[2]/2.5*exp(-0.5*((x-[1])/[2])^2) + [3] + [4]*x + [5]*x^2 + [6]*x^3";
0045 
0046 TFile* fintsc = new TFile("tsc_fitout.root");
0047 TFile* finpi0 = new TFile("fitout_iter21.root");
0048 
0049 TH2F* tsc_corr = (TH2F*) fintsc->Get("corrPat");
0050 
0051 TCanvas* c1 = new TCanvas("c1","c1",600,600);
0052 tsc_corr->Draw("COLZ");
0053 tsc_corr->SetXTitle("ieta");
0054 tsc_corr->SetYTitle("iphi");
0055 
0056 gPad->SetRightMargin(0.15);
0057 
0058 myText(0.2,0.98,1,Form("%d-%d",first_run,last_run));
0059 
0060 c1->SaveAs("plots/tsc_coef.pdf");
0061 
0062 
0063 
0064 TH1F* h_peak_eta = (TH1F*) finpi0->Get("h_peak_eta");
0065 TH1F* h_sigma_eta = (TH1F*) finpi0->Get("h_sigma_eta");
0066 TH1F* h_p0_eta = (TH1F*) finpi0->Get("h_p0_eta");
0067 TH1F* h_p3_eta = (TH1F*) finpi0->Get("h_p3_eta");
0068 TH1F* h_p4_eta = (TH1F*) finpi0->Get("h_p4_eta");
0069 TH1F* h_p5_eta = (TH1F*) finpi0->Get("h_p5_eta");
0070 TH1F* h_p6_eta = (TH1F*) finpi0->Get("h_p6_eta");
0071 
0072 TCanvas* c2 = new TCanvas("c2","c2",600,600);
0073 h_peak_eta->Draw("ex0");
0074 h_peak_eta->SetXTitle("ieta");
0075 h_peak_eta->SetYTitle("#it{#pi}^{0} mass");
0076 myText(0.2,0.98,1,Form("%d-%d",first_run,last_run));
0077 
0078 c2->SaveAs("plots/mass_eta.pdf");
0079 
0080 
0081 TCanvas* c3 = new TCanvas("c3","c3",600,600);
0082 h_p0_eta->Draw("ex0");
0083 h_p0_eta->SetXTitle("ieta");
0084 h_p0_eta->SetYTitle("gauss scale fit parameter");
0085 
0086 c3->SaveAs("plots/p0_eta.pdf");
0087 
0088 
0089 TCanvas* c4 = new TCanvas("c4","c4",600,600);
0090 h_p3_eta->Draw("ex0");
0091 h_p3_eta->SetXTitle("ieta");
0092 h_p3_eta->SetYTitle("0th order pol fit parameter");
0093 myText(0.2,0.98,1,Form("%d-%d",first_run,last_run));
0094 
0095 c4->SaveAs("plots/p3_eta.pdf");
0096 
0097 
0098 TCanvas* c5 = new TCanvas("c5","c5",600,600);
0099 h_p4_eta->Draw("ex0");
0100 h_p4_eta->SetXTitle("ieta");
0101 h_p4_eta->SetYTitle("1st order pol fit parameter");
0102 
0103 c5->SaveAs("plots/p4_eta.pdf");
0104 
0105 
0106 TCanvas* c6 = new TCanvas("c6","c6",600,600);
0107 h_p5_eta->Draw("ex0");
0108 h_p5_eta->SetXTitle("ieta");
0109 h_p5_eta->SetYTitle("2nd order pol fit parameter");
0110 
0111 c6->SaveAs("plots/p5_eta.pdf");
0112 
0113 
0114 TCanvas* c7 = new TCanvas("c7","c7",600,600);
0115 h_p6_eta->Draw("ex0");
0116 h_p6_eta->SetXTitle("ieta");
0117 h_p6_eta->SetYTitle("3rd order pol fit parameter");
0118 
0119 c7->SaveAs("plots/p6_eta.pdf");
0120 
0121 
0122 TCanvas* c8 = new TCanvas("c8","c8",600,600);
0123 h_sigma_eta->Draw("ex0");
0124 h_sigma_eta->SetXTitle("ieta");
0125 h_sigma_eta->SetYTitle("gauss sigma fit parameter");
0126 
0127 c8->SaveAs("plots/sigma_eta.pdf");
0128 
0129 
0130 }