Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-12-17 09:24:08

0001 #include <sPhenixStyle.C>
0002 
0003 #include <TCanvas.h>
0004 #include <TFile.h>
0005 #include <TGraph.h>
0006 #include <TH1.h>
0007 #include <TH2.h>
0008 #include <TLatex.h>
0009 #include <TPad.h>
0010 #include <TProfile2D.h>
0011 
0012 #include <format>
0013 #include <fstream>
0014 
0015 void myText(Double_t x,Double_t y,Color_t color, const char *text, Double_t tsize=0.04) {
0016 
0017   TLatex l; l.SetTextAlign(12); l.SetTextSize(tsize);
0018   l.SetNDC();
0019   l.SetTextColor(color);
0020   l.DrawLatex(x,y,text);
0021 }
0022 
0023 TH1* proj(TH2* h2);
0024 
0025 TH1* FBratio(TH1* h){
0026 
0027    const int Nbin =  h->GetXaxis()->GetNbins();
0028    TH1* hfb = new TH1F("temp32","",Nbin/2,0,Nbin/2.);
0029 
0030    for(int i=0; i<Nbin/2; i++){
0031      int b1 = i+1;
0032      int b2 = Nbin-i;
0033      float ratio = h->GetBinContent(b1)/h->GetBinContent(b2);
0034      float err = sqrt( pow(h->GetBinError(b1)/h->GetBinContent(b1),2)+ pow(h->GetBinError(b2)/h->GetBinContent(b2),2))*pow(ratio,2);
0035      hfb->SetBinContent(i,ratio); 
0036      hfb->SetBinError(i,err);
0037    }
0038    return hfb;
0039 }
0040 
0041 
0042 
0043 void figmaker(){
0044 
0045 
0046   SetsPhenixStyle();
0047 
0048   int totalEvents = 0;
0049 
0050   std::ifstream infile("../condor/runList.txt");
0051   if (!infile) { std::cerr << "Error: Unable to open the file\n"; return;}
0052   std::vector<int> runList;
0053   int num;
0054   while (infile >> num)  runList.push_back(num);
0055 
0056   int Nruns= runList.size();
0057 
0058   for (int ir=0; ir<Nruns; ir++){
0059 
0060     int run = runList[ir];
0061 
0062     TFile* fin = new TFile(std::format("../condor/combine_out/out_{}.root",run).c_str());
0063 
0064     TH2* h_emcal_mbd_correlation  = (TH2*) fin->Get("h_emcal_mbd_correlation" );
0065     TH2* h_ihcal_mbd_correlation  = (TH2*) fin->Get("h_ihcal_mbd_correlation" );
0066     TH2* h_ohcal_mbd_correlation  = (TH2*) fin->Get("h_ohcal_mbd_correlation" );
0067     TH2* h_emcal_hcal_correlation = (TH2*) fin->Get("h_emcal_hcal_correlation");
0068     TH1* h_InvMass                = (TH1*) fin->Get("h_InvMass"               );
0069     TH2* h_cemc_etaphi            = (TH2*) fin->Get("h_cemc_etaphi_wQA"           );
0070     TH2* h_ihcal_etaphi           = (TH2*) fin->Get("h_ihcal_etaphi_wQA"          );
0071     TH2* h_ohcal_etaphi           = (TH2*) fin->Get("h_ohcal_etaphi_wQA"          );
0072     TH2* h_zdc_emcal_correlation  = (TH2*) fin->Get("h_zdc_emcal_correlation");
0073     TH1* hzdcNorthcalib           = (TH1*) fin->Get("hzdcNorthcalib");
0074     TH1* hzdcSouthcalib           = (TH1*) fin->Get("hzdcSouthcalib");
0075     TH2* h_etaphi_clus            = (TH2*) fin->Get("h_etaphi_clus"           );
0076     TH1* hvtx_z_raw               = (TH1*) fin->Get("hvtx_z_raw");
0077     TProfile2D* h_cemc_etaphi_time = (TProfile2D*) fin->Get("h_cemc_etaphi_time");
0078     TProfile2D* h_ihcal_etaphi_time = (TProfile2D*) fin->Get("h_ihcal_etaphi_time");
0079     TProfile2D* h_ohcal_etaphi_time = (TProfile2D*) fin->Get("h_ohcal_etaphi_time");
0080 
0081    TH2* h_cemc_e_chi2 = (TH2*) fin->Get("h_cemc_e_chi2");
0082    TH2* h_ohcal_e_chi2 = (TH2*) fin->Get("h_ohcal_e_chi2");
0083    TH2* h_ihcal_e_chi2 = (TH2*) fin->Get("h_ihcal_e_chi2");
0084 
0085     TCanvas* c1 = new TCanvas("c1", "c1", 400, 400);
0086     h_emcal_mbd_correlation ->Draw("COLZ");
0087     h_emcal_mbd_correlation ->SetXTitle("#Sigma #it{E}^{EMCal} [Arb]");
0088     h_emcal_mbd_correlation ->SetYTitle("#Sigma #it{E}^{MBD} [Arb]");
0089     h_emcal_mbd_correlation->GetXaxis()->SetNdivisions(505);
0090     myText(0.22, 0.9, 1, "#it{#bf{sPHENIX}} Internal");
0091     myText(0.22, 0.85, 1, std::format("run {}", run).c_str());
0092     gPad->SetRightMargin(0.15);
0093     gPad->SetLogz();
0094 
0095     c1->SaveAs(std::format("../plots/emcal_mbd_correlation_{}.pdf",run).c_str());
0096 
0097 
0098     TCanvas* c2 = new TCanvas("c2", "c2", 400, 400);
0099     h_ihcal_mbd_correlation ->Draw("COLZ");
0100     h_ihcal_mbd_correlation ->SetXTitle("#Sigma #it{E}^{ihcal} [Arb]");
0101     h_ihcal_mbd_correlation ->SetYTitle("#Sigma #it{E}^{MBD} [Arb]");
0102     h_ihcal_mbd_correlation->GetXaxis()->SetNdivisions(505);
0103     myText(0.22, 0.9, 1, "#it{#bf{sPHENIX}} Internal");
0104     myText(0.22, 0.85, 1, std::format("run {}", run).c_str());
0105     gPad->SetRightMargin(0.15);
0106     gPad->SetLogz();
0107 
0108     c2->SaveAs(std::format("../plots/ihcal_mbd_correlation_{}.pdf",run).c_str());
0109 
0110     TCanvas* c3 = new TCanvas("c3", "c3", 400, 400);
0111     h_ohcal_mbd_correlation ->Draw("COLZ");
0112     h_ohcal_mbd_correlation ->SetXTitle("#Sigma #it{E}^{ohcal} [Arb]");
0113     h_ohcal_mbd_correlation ->SetYTitle("#Sigma #it{E}^{MBD} [Arb]");
0114     h_ohcal_mbd_correlation->GetXaxis()->SetNdivisions(505);
0115     myText(0.22, 0.9, 1, "#it{#bf{sPHENIX}} Internal");
0116     myText(0.22, 0.85, 1, std::format("run {}", run).c_str());
0117     gPad->SetRightMargin(0.15);
0118     gPad->SetLogz();
0119 
0120     c3->SaveAs(std::format("../plots/ohcal_mbd_correlation_{}.pdf",run).c_str());
0121 
0122 
0123     TCanvas* c4 = new TCanvas("c4", "c4", 400, 400);
0124     h_emcal_hcal_correlation->Draw("COLZ");
0125     h_emcal_hcal_correlation->SetXTitle("#Sigma #it{E}^{EMCal} [Arb]");
0126     h_emcal_hcal_correlation->SetYTitle("#Sigma #it{E}^{HCal} [Arb]");
0127     h_emcal_hcal_correlation->GetXaxis()->SetNdivisions(505);
0128     myText(0.22, 0.9, 1, "#it{#bf{sPHENIX}} Internal");
0129     myText(0.22, 0.85, 1, std::format("run {}", run).c_str());
0130     gPad->SetRightMargin(0.15);
0131     gPad->SetLogz();
0132 
0133     c4->SaveAs(std::format("../plots/emcal_hcal_correlation_{}.pdf",run).c_str());
0134 
0135 
0136     TCanvas* c5 = new TCanvas("c5", "c5", 400, 400);
0137     h_InvMass               ->Draw("");
0138     h_InvMass               ->SetXTitle("#it{M}_{#gamma#gamma}");
0139     h_InvMass               ->SetYTitle("counts");
0140     myText(0.22, 0.9, 1, "#it{#bf{sPHENIX}} Internal");
0141     myText(0.22, 0.85, 1, std::format("run {}", run).c_str());
0142 
0143     c5->SaveAs(std::format("../plots/InvMass_{}.pdf",run).c_str());
0144 
0145 
0146     TCanvas* c6 = new TCanvas("c6", "c6", 400, 400);
0147     h_cemc_etaphi           ->Draw("COLZ");
0148     h_cemc_etaphi           ->SetXTitle("#it{#eta}_{i} EMCal");
0149     h_cemc_etaphi           ->SetYTitle("#it{#phi}_{i} EMCal");
0150     myText(0.22, 0.9, 1, "#it{#bf{sPHENIX}} Internal");
0151     myText(0.22, 0.85, 1, std::format("run {}", run).c_str());
0152     myText(0.22, 0.80,1,"EMCal");
0153     gPad->SetRightMargin(0.15);
0154 
0155     c6->SaveAs(std::format("../plots/cemc_etaphi_{}.pdf",run).c_str());
0156 
0157 
0158 
0159 
0160     TCanvas* c7 = new TCanvas("c7", "c7", 400, 400);
0161     h_ihcal_etaphi          ->Draw("COLZ");
0162     h_ihcal_etaphi          ->SetXTitle("#it{#eta}_{i} iHcal");
0163     h_ihcal_etaphi          ->SetYTitle("#it{#phi}_{i} iHcal");
0164     myText(0.22, 0.9, 1, "#it{#bf{sPHENIX}} Internal");
0165     myText(0.22, 0.85, 1, std::format("run {}", run).c_str());
0166     myText(0.22, 0.80,1,"iHCal");
0167     gPad->SetRightMargin(0.15);
0168 
0169     c7->SaveAs(std::format("../plots/ihcal_etaphi_{}.pdf",run).c_str());
0170 
0171 
0172     TCanvas* c8 = new TCanvas("c8", "c8", 400, 400);
0173     h_ohcal_etaphi          ->Draw("COLZ");
0174     h_ohcal_etaphi          ->SetXTitle("#it{#eta}_{i} oHcal");
0175     h_ohcal_etaphi          ->SetYTitle("#it{#phi}_{i} oHcal");
0176     myText(0.22, 0.9, 1, "#it{#bf{sPHENIX}} Internal");
0177     myText(0.22, 0.85, 1, std::format("run {}", run).c_str());
0178     myText(0.22, 0.80,1,"oHCal");
0179     gPad->SetRightMargin(0.15);
0180 
0181     c8->SaveAs(std::format("../plots/ohcal_etaphi_{}.pdf",run).c_str());
0182 
0183 
0184     TH1* h_emcal_proj = (TH1*) proj(h_cemc_etaphi)->Clone("h_emcal_proj");
0185 
0186     TCanvas* c9 = new TCanvas("c9", "c9", 400, 400);
0187     h_emcal_proj->Draw("hist");
0188     h_emcal_proj->SetYTitle("N^{twr}(E_{T} > 1 GeV)");
0189 
0190     myText(0.22, 0.9, 1, "#it{#bf{sPHENIX}} Internal");
0191     myText(0.22, 0.85, 1, std::format("run {}", run).c_str());
0192     myText(0.22, 0.80,1,"EMCal");
0193     
0194     c9->SaveAs(std::format("../plots/cemc_proj_{}.pdf",run).c_str());
0195 
0196 
0197     TH1* h_ohcal_proj = (TH1*) proj(h_ohcal_etaphi)->Clone("h_ohcal_proj");
0198 
0199     TCanvas* c10 = new TCanvas("c10", "c10", 400, 400);
0200     h_ohcal_proj->Draw("hist");
0201     h_ohcal_proj->SetYTitle("N^{twr}(E_{T} > 1 GeV)");
0202     h_ohcal_proj->GetYaxis()->SetRangeUser(0, h_ohcal_proj->GetMaximum()*1.05);
0203 
0204     myText(0.22, 0.9, 1, "#it{#bf{sPHENIX}} Internal");
0205     myText(0.22, 0.85, 1, std::format("run {}", run).c_str());
0206     myText(0.22, 0.80,1,"oHCal");
0207     
0208     c10->SaveAs(std::format("../plots/ohcal_proj_{}.pdf",run).c_str());
0209 
0210 
0211     TH1* h_ihcal_proj = (TH1*) proj(h_ihcal_etaphi)->Clone("h_ihcal_proj");
0212 
0213     TCanvas* c11 = new TCanvas("c11", "c10", 400, 400);
0214     h_ihcal_proj->Draw("hist");
0215     h_ihcal_proj->SetYTitle("N^{twr}(E_{T} > 1 GeV)");
0216     h_ihcal_proj->SetXTitle("#eta_{i}");
0217 
0218     myText(0.22, 0.9, 1, "#it{#bf{sPHENIX}} Internal");
0219     myText(0.22, 0.85, 1, std::format("run {}", run).c_str());
0220     myText(0.22, 0.80,1,"iHCal");
0221     
0222     c11->SaveAs(std::format("../plots/ihcal_proj_{}.pdf",run).c_str());
0223 
0224 
0225     TH1* h_fb_ratio_emcal = FBratio(h_emcal_proj);
0226     TH1* h_fb_ratio_ihcal = FBratio(h_ihcal_proj);
0227     TH1* h_fb_ratio_ohcal = FBratio(h_ohcal_proj);
0228 
0229     TCanvas* c12 = new TCanvas("c12", "c12", 400, 400);
0230     h_fb_ratio_emcal->Draw("ex0");
0231     h_fb_ratio_emcal->SetYTitle("N^{twr}(#eta_{i})/N^{twr}(#eta_{N-i})");
0232     h_fb_ratio_emcal->SetXTitle("#eta_{i}");
0233     h_fb_ratio_emcal->GetYaxis()->SetRangeUser(0.1,2);
0234 
0235     h_fb_ratio_ohcal->Draw("ex0 same");
0236     h_fb_ratio_ohcal->SetLineColor(kBlue);
0237     h_fb_ratio_ohcal->SetMarkerColor(kBlue);
0238     h_fb_ratio_ohcal->SetMarkerStyle(22);
0239 
0240     h_fb_ratio_ihcal->Draw("ex0 same");
0241     h_fb_ratio_ihcal->SetLineColor(kRed);
0242     h_fb_ratio_ihcal->SetMarkerColor(kRed);
0243     h_fb_ratio_ihcal->SetMarkerStyle(33);
0244 
0245     myText(0.22, 0.9, 1, "#it{#bf{sPHENIX}} Internal");
0246     myText(0.22, 0.85, 1, std::format("run {}", run).c_str());
0247     myText(0.22, 0.80,1,"EMCal");
0248     myText(0.32,0.80,kBlue,"oHCal");
0249     myText(0.42,0.80,kRed,"iHCal");
0250     
0251     c12->SaveAs(std::format("../plots/h_fb_ratio_emcal_{}.pdf",run).c_str());
0252 
0253 
0254     TCanvas* c13 = new TCanvas("c13", "c13", 400, 400);
0255     h_zdc_emcal_correlation->Draw("COLZ");
0256     h_zdc_emcal_correlation->SetXTitle("#Sigma #it{E}^{EMCal} [Arb]");
0257     h_zdc_emcal_correlation->SetYTitle("#Sigma #it{E}^{ZDC} [Arb]");
0258     h_zdc_emcal_correlation->GetXaxis()->SetNdivisions(505);
0259     myText(0.22, 0.9, 1, "#it{#bf{sPHENIX}} Internal");
0260     myText(0.22, 0.85, 1, std::format("run {}", run).c_str());
0261     gPad->SetRightMargin(0.15);
0262     gPad->SetLogz();
0263 
0264     c13->SaveAs(std::format("../plots/zdc_emcal_correlation_{}.pdf",run).c_str());
0265 
0266 
0267     TCanvas* c14 = new TCanvas("c14", "c14", 400, 400);
0268     hzdcNorthcalib->Draw();
0269     hzdcNorthcalib->SetLineColor(kBlue);
0270     hzdcNorthcalib->GetXaxis()->SetRangeUser(0.0,12000);
0271     hzdcNorthcalib->SetXTitle("#Sigma #it{E}^{ZDC Side}");
0272     hzdcNorthcalib->SetYTitle("Events");
0273     hzdcNorthcalib->GetXaxis()->SetNdivisions(505);
0274 
0275     hzdcSouthcalib->Draw("same");
0276     hzdcSouthcalib->SetLineColor(kRed);
0277     gPad->SetLogy();
0278 
0279     myText(0.7, 0.9, 1, "#it{#bf{sPHENIX}} Internal");
0280     myText(0.7, 0.85, 1, std::format("run {}", run).c_str());
0281     myText(0.75, 0.80, kBlue,"North");
0282     myText(0.65, 0.80, kRed,"South");
0283 
0284     c14->SaveAs(std::format("../plots/zdc_e_northSouth_{}.pdf",run).c_str());
0285 
0286 
0287 
0288 
0289     TCanvas* c15 = new TCanvas("c15", "c15", 400, 400);
0290     h_etaphi_clus          ->Draw("COLZ");
0291     h_etaphi_clus          ->SetXTitle("#it{#eta}_{i} EMCal Clusters");
0292     h_etaphi_clus          ->SetYTitle("#it{#phi}_{i} EMCal Clusters");
0293     myText(0.22, 0.9, 1, "#it{#bf{sPHENIX}} Internal");
0294     myText(0.22, 0.85, 1, std::format("run {}", run).c_str());
0295     gPad->SetRightMargin(0.15);
0296 
0297     c15->SaveAs(std::format("../plots/etaphi_clus_{}.pdf",run).c_str());
0298 
0299     totalEvents += hvtx_z_raw->GetEntries();
0300     int events =  hvtx_z_raw->GetEntries();
0301 
0302     TCanvas* c16 = new TCanvas("c16", "c16", 400, 400);
0303     hvtx_z_raw          ->Draw("COLZ");
0304     hvtx_z_raw          ->SetXTitle("MBD Vertex #it{z} [cm]");
0305     hvtx_z_raw          ->SetYTitle("Events");
0306     myText(0.22, 0.9, 1, "#it{#bf{sPHENIX}} Internal");
0307     myText(0.22, 0.85, 1, std::format("run {}", run).c_str());
0308     myText(0.22, 0.80, 1, std::format("events {}", events).c_str());
0309 
0310     c16->SaveAs(std::format("../plots/vtx_z_{}.pdf",run).c_str());
0311 
0312 
0313     TCanvas* c17 = new TCanvas("c17", "c17", 400, 400);
0314     hzdcNorthcalib->Draw();
0315     hzdcNorthcalib->SetLineColor(kBlue);
0316     hzdcNorthcalib->GetXaxis()->SetRangeUser(10,300);
0317     hzdcNorthcalib->SetXTitle("#Sigma #it{E}^{ZDC Side}");
0318     hzdcNorthcalib->SetYTitle("Events");
0319 
0320     TGraph* gr_1n = new TGraph();
0321     gr_1n->SetPoint(0,100,0);
0322     gr_1n->SetPoint(1,100,1e7);
0323     gr_1n->SetLineStyle(7);
0324     gr_1n->Draw("l");
0325 
0326     hzdcSouthcalib->Draw("same");
0327     hzdcSouthcalib->SetLineColor(kRed);
0328     gPad->SetLogy();
0329 
0330     myText(0.7, 0.9, 1, "#it{#bf{sPHENIX}} Internal");
0331     myText(0.7, 0.85, 1, std::format("run {}", run).c_str());
0332     myText(0.75, 0.80, kBlue,"North");
0333     myText(0.65, 0.80, kRed,"South");
0334 
0335     c17->SaveAs(std::format("../plots/zdc_e_northSouth_1n_{}.pdf",run).c_str());
0336 
0337 
0338     TCanvas* c18 = new TCanvas("c18", "c18", 400, 400);
0339     h_cemc_etaphi_time->Draw("COLZ");
0340     h_cemc_etaphi_time->SetXTitle("#it{#eta}_{i} EMCal");
0341     h_cemc_etaphi_time->SetYTitle("#it{#phi}_{i} EMCal");
0342     h_cemc_etaphi_time->GetXaxis()->SetNdivisions(505);
0343 
0344     myText(0.22, 0.9, 1, "#it{#bf{sPHENIX}} Internal");
0345     myText(0.22, 0.85, 1, std::format("run {}", run).c_str());
0346     myText(0.22, 0.80, 1, "mean hit peak time EMCal");
0347     gPad->SetRightMargin(0.15);
0348 
0349     c18->SaveAs(std::format("../plots/cemc_etaphi_time{}.pdf",run).c_str());
0350 
0351     TCanvas* c19 = new TCanvas("c19", "c19", 400, 400);
0352     h_ohcal_etaphi_time->Draw("COLZ");
0353     h_ohcal_etaphi_time->SetXTitle("#it{#eta}_{i} oHcal");
0354     h_ohcal_etaphi_time->SetYTitle("#it{#phi}_{i} oHcal");
0355     h_ohcal_etaphi_time->GetXaxis()->SetNdivisions(505);
0356 
0357     myText(0.22, 0.9, 1, "#it{#bf{sPHENIX}} Internal");
0358     myText(0.22, 0.85, 1, std::format("run {}", run).c_str());
0359     myText(0.22, 0.80, 1, "mean hit peak time Outter HCal");
0360     gPad->SetRightMargin(0.15);
0361 
0362     c19->SaveAs(std::format("../plots/ohcal_etaphi_time{}.pdf",run).c_str());
0363 
0364 
0365     TCanvas* c20 = new TCanvas("c20", "c20", 400, 400);
0366     h_ihcal_etaphi_time->Draw("COLZ");
0367     h_ihcal_etaphi_time->SetXTitle("#it{#eta}_{i} iHcal");
0368     h_ihcal_etaphi_time->SetYTitle("#it{#phi}_{i} iHcal");
0369     h_ihcal_etaphi_time->GetXaxis()->SetNdivisions(505);
0370 
0371     myText(0.22, 0.9, 1, "#it{#bf{sPHENIX}} Internal");
0372     myText(0.22, 0.85, 1, std::format("run {}", run).c_str());
0373     myText(0.22, 0.80, 1, "mean hit peak time Inner HCal");
0374     gPad->SetRightMargin(0.15);
0375 
0376     c20->SaveAs(std::format("../plots/ihcal_etaphi_time{}.pdf",run).c_str());
0377 
0378     TCanvas* c21 = new TCanvas("c21", "c21", 400, 400);
0379     h_ihcal_e_chi2->Draw("COLZ");
0380     h_ihcal_e_chi2->SetXTitle("#i{E} [GeV] iHcal");
0381     h_ihcal_e_chi2->SetYTitle("chi2 iHcal");
0382     h_ihcal_e_chi2->GetXaxis()->SetNdivisions(505);
0383     h_ihcal_e_chi2->GetXaxis()->SetRangeUser(-1,2);
0384     gPad->SetLogy();
0385     gPad->SetLogz();
0386 
0387     myText(0.52, 0.9, 1, "#it{#bf{sPHENIX}} Internal");
0388     myText(0.52, 0.85, 1, std::format("run {}", run).c_str());
0389     myText(0.52, 0.80, 1, "Inner HCal");
0390     gPad->SetRightMargin(0.15);
0391 
0392     c21->SaveAs(std::format("../plots/ihcal_e_chi2{}.pdf",run).c_str());
0393 
0394 
0395     TCanvas* c22 = new TCanvas("c22", "c22", 400, 400);
0396     h_ohcal_e_chi2->Draw("COLZ");
0397     h_ohcal_e_chi2->SetXTitle("#i{E} [GeV] oHcal");
0398     h_ohcal_e_chi2->SetYTitle("chi2 oHcal");
0399     h_ohcal_e_chi2->GetXaxis()->SetNdivisions(505);
0400     h_ohcal_e_chi2->GetXaxis()->SetRangeUser(-1,7);
0401     gPad->SetLogy();
0402     gPad->SetLogz();
0403 
0404     myText(0.52, 0.9, 1, "#it{#bf{sPHENIX}} Internal");
0405     myText(0.52, 0.85, 1, std::format("run {}", run).c_str());
0406     myText(0.52, 0.80, 1, "Outer HCal");
0407     gPad->SetRightMargin(0.15);
0408 
0409     c22->SaveAs(std::format("../plots/ohcal_e_chi2{}.pdf",run).c_str());
0410 
0411 
0412     TCanvas* c23 = new TCanvas("c23", "c23", 400, 400);
0413     h_cemc_e_chi2->Draw("COLZ");
0414     h_cemc_e_chi2->SetXTitle("#i{E} [GeV] EMCal ");
0415     h_cemc_e_chi2->SetYTitle("chi2 EMCal");
0416     h_cemc_e_chi2->GetXaxis()->SetNdivisions(505);
0417     h_cemc_e_chi2->GetXaxis()->SetRangeUser(-1,15);
0418     gPad->SetLogy();
0419     gPad->SetLogz();
0420 
0421     myText(0.52, 0.9, 1, "#it{#bf{sPHENIX}} Internal");
0422     myText(0.52, 0.85, 1, std::format("run {}", run).c_str());
0423     myText(0.52, 0.80, 1, "EMCal");
0424     gPad->SetRightMargin(0.15);
0425 
0426     c23->SaveAs(std::format("../plots/cemc_e_chi2{}.pdf",run).c_str());
0427 
0428   }
0429 
0430   for (int ir=0; ir<Nruns; ir++){
0431     std::cout << runList[ir] << ",";
0432   }
0433   std::cout << std::endl;
0434   std::cout << "total events=" << totalEvents <<std::endl;
0435   std::cout << std::endl;
0436 
0437 }
0438 
0439 
0440 
0441 
0442 
0443 
0444 TH1* proj(TH2* h2){
0445 
0446   int x = h2->GetXaxis()->GetNbins();
0447   int y = h2->GetYaxis()->GetNbins();
0448   TH1* h = (TH1*) h2->ProjectionX("temp");
0449   h->Reset();
0450   for (int ix=1; ix<x+1; ix++){
0451     float sum = 0;
0452     float cc = 0;
0453     for(int iy=1; iy<y+1; iy++){
0454       float bc = h2->GetBinContent(ix,iy);
0455       if (bc==0) cc+=1;
0456       sum += bc;
0457     }
0458     if (cc==y) continue;
0459     float sum_cor = sum*y/(y-cc);
0460     h->SetBinContent(ix,sum_cor);
0461     h->SetBinError(ix,std::sqrt(sum_cor));
0462   }
0463 
0464 
0465   return h;
0466 }
0467