File indexing completed on 2026-07-16 08:11:23
0001
0002
0003
0004
0005 #include <ctime>
0006 #include <sstream>
0007 #include <algorithm>
0008 #include <cmath>
0009
0010 std::string _getDate(){
0011 std::time_t t=std::time(0); std::tm* n=std::localtime(&t);
0012 std::stringstream s;
0013 s<<(n->tm_mon+1)<<'/'<<n->tm_mday<<'/'<<(n->tm_year+1900);
0014 return s.str();
0015 }
0016 void _label(double x1,double y1,double x2,double y2){
0017 TPaveText *p=new TPaveText(x1,y1,x2,y2,"NDC");
0018 p->SetFillStyle(0); p->SetBorderSize(0); p->SetTextFont(42);
0019 p->AddText("#it{#bf{sPHENIX}} Internal, #it{p}+#it{p} #sqrt{s} = 200 GeV");
0020 p->Draw();
0021 }
0022 void _date(double x1,double y1){
0023 TLatex l; l.SetNDC(); l.SetTextFont(42); l.SetTextSize(0.035);
0024 l.SetTextColor(kGray+2); l.DrawLatex(x1,y1,_getDate().c_str());
0025 }
0026
0027 void plot_mass_smear_fracs_ks() {
0028 gStyle->SetOptStat(0); gStyle->SetOptTitle(0);
0029
0030 const int N = 7;
0031 double avg_pt[] = {0.6544, 0.9343, 1.2300, 1.5638, 1.9643, 2.4712, 3.3271};
0032 double sig_data[] = {5.8413, 7.0841, 8.2642, 9.3537, 10.6817, 12.0176, 13.1953};
0033 double sig_derr[] = {0.0404, 0.0548, 0.0828, 0.1267, 0.1594, 0.1806, 0.4918};
0034 double sig_sim0[] = {2.7631, 2.6199, 2.6236, 2.7225, 2.7388, 2.8742, 3.1924};
0035 double sig_check[] = {5.8310, 7.1219, 8.2659, 9.5721, 11.1457, 12.4020, 13.6752};
0036 double frac_pct[] = {2.9298, 3.5090, 3.7633, 3.9927, 4.3454, 5.1751, 4.5065};
0037 double xerr[] = {0.150, 0.150, 0.150, 0.200, 0.200, 0.400, 0.500};
0038 double zero[] = {0, 0, 0, 0, 0, 0, 0};
0039
0040
0041 TCanvas *c1 = new TCanvas("c1","K0S mass sigma comparison",900,650);
0042 c1->SetLeftMargin(0.13); c1->SetBottomMargin(0.13); c1->SetRightMargin(0.06);
0043
0044 TGraphErrors *gD = new TGraphErrors(N, avg_pt, sig_data, xerr, sig_derr);
0045 TGraph *gS = new TGraph(N, avg_pt, sig_sim0);
0046 TGraph *gC = new TGraph(N, avg_pt, sig_check);
0047
0048 gD->SetMarkerStyle(20); gD->SetMarkerSize(1.3);
0049 gD->SetMarkerColor(kBlack); gD->SetLineColor(kBlack); gD->SetLineWidth(2);
0050 gS->SetMarkerStyle(24); gS->SetMarkerSize(1.3);
0051 gS->SetMarkerColor(kAzure+7); gS->SetLineColor(kAzure+7); gS->SetLineWidth(2);
0052 gC->SetMarkerStyle(21); gC->SetMarkerSize(1.3);
0053 gC->SetMarkerColor(kRed+1); gC->SetLineColor(kRed+1); gC->SetLineWidth(2);
0054
0055 double ymax = 0;
0056 for(int i=0;i<N;++i) ymax = std::max(ymax, std::max({sig_data[i]+sig_derr[i], sig_sim0[i]}));
0057 ymax *= 1.35;
0058
0059 TMultiGraph *mg1 = new TMultiGraph();
0060 mg1->Add(gS,"PL"); mg1->Add(gD,"PE"); mg1->Add(gC,"PL");
0061 mg1->Draw("A");
0062 mg1->GetXaxis()->SetTitle("#it{p}_{T}^{K_{S}^{0}} (GeV/#it{c})");
0063 mg1->GetYaxis()->SetTitle("Gaussian #sigma of K_{S}^{0} mass (MeV/#it{c}^{2})");
0064 mg1->GetYaxis()->SetRangeUser(0, ymax);
0065 mg1->GetXaxis()->SetTitleSize(0.05); mg1->GetYaxis()->SetTitleSize(0.047);
0066 mg1->GetYaxis()->SetTitleOffset(1.25);
0067
0068 TLegend *leg1 = new TLegend(0.14,0.72,0.65,0.87);
0069 leg1->SetBorderSize(0); leg1->SetFillStyle(0); leg1->SetTextSize(0.033);
0070 leg1->AddEntry(gD,"Data", "lpe");
0071 leg1->AddEntry(gS,"SV sim (unsmeared)", "lp");
0072 leg1->AddEntry(gC,"SV sim (mass-width smeared)","lp");
0073 leg1->Draw();
0074 _label(0.14,0.88,0.68,0.96);
0075 _date(0.72,0.90);
0076
0077 c1->SaveAs("plot_mass_smear_sigma_comparison.pdf");
0078 c1->SaveAs("plot_mass_smear_sigma_comparison.png");
0079 std::cout << "Saved plot_mass_smear_sigma_comparison.pdf/.png\n";
0080
0081
0082 TCanvas *c2 = new TCanvas("c2","Mass-width smearing fractions",900,650);
0083 c2->SetLeftMargin(0.13); c2->SetBottomMargin(0.20); c2->SetRightMargin(0.06);
0084
0085 TGraphErrors *gF = new TGraphErrors(N, avg_pt, frac_pct, xerr, zero);
0086 gF->SetMarkerStyle(20); gF->SetMarkerSize(1.4);
0087 gF->SetMarkerColor(kViolet+1); gF->SetLineColor(kViolet+1); gF->SetLineWidth(2);
0088 gF->Draw("APE");
0089 gF->GetXaxis()->SetTitle("#it{p}_{T}^{K_{S}^{0}} (GeV/#it{c})");
0090 gF->GetYaxis()->SetTitle("Smearing fraction (%)");
0091 double fmax = *std::max_element(frac_pct,frac_pct+N)*1.4 + 0.2;
0092 gF->GetYaxis()->SetRangeUser(0, fmax);
0093 gF->GetXaxis()->SetTitleSize(0.03); gF->GetYaxis()->SetTitleSize(0.05);
0094 gF->GetYaxis()->SetTitleOffset(1.2);
0095
0096 _label(0.14,0.88,0.68,0.96);
0097 _date(0.72,0.90);
0098
0099 TLegend *leg2 = new TLegend(0.14,0.74,0.60,0.85);
0100 leg2->SetBorderSize(0); leg2->SetFillStyle(0); leg2->SetTextSize(0.033);
0101 leg2->AddEntry(gF,"Frac needed to match K_{S}^{0} mass #sigma","lp");
0102 leg2->Draw();
0103
0104 c2->Update();
0105 c2->SaveAs("plot_mass_smear_fracs_ks.pdf");
0106 c2->SaveAs("plot_mass_smear_fracs_ks.png");
0107 std::cout << "Saved plot_mass_smear_fracs_ks.pdf/.png\n";
0108 }