17 #include <TGraphErrors.h>
26 "../../sPHENIX_work/Prototype_2016/EMCal_sim/15Degree_1Col_LightCollection/")
29 gStyle->SetOptStat(0);
30 gStyle->SetOptFit(1111);
31 TVirtualFitter::SetDefaultFitter(
"Minuit2");
35 { 1, 2, 4, 8, 12, 16, 24 };
41 for (
int i = 0;
i <
N; ++
i)
43 const double E = Es[
i];
47 const TString sE = Form(
"%.0f", E);
53 dres[
i] = v[3] / v[0];
55 cout <<
"mean[i] = " << mean[
i] <<
", "
56 <<
"dmean[i] = " << dmean[
i] <<
", "
57 <<
"res[i] = " << res[
i] <<
", "
58 <<
"dres[i] = " << dres[
i] << endl;
61 TGraphErrors * ge_linear =
new TGraphErrors(N, Es, mean, 0, dmean);
62 TGraphErrors * ge_res =
new TGraphErrors(N, Es, res, 0, dres);
64 ge_linear->SetLineColor(kBlue + 3);
65 ge_linear->SetMarkerColor(kBlue + 3);
66 ge_linear->SetLineWidth(2);
67 ge_linear->SetMarkerStyle(kFullCircle);
68 ge_linear->SetMarkerSize(1.5);
70 ge_res->SetLineColor(kBlue + 3);
71 ge_res->SetMarkerColor(kBlue + 3);
72 ge_res->SetLineWidth(2);
73 ge_res->SetMarkerStyle(kFullCircle);
74 ge_res->SetMarkerSize(1.5);
76 TF1 * f_calo_r =
new TF1(
"f_calo_r",
"sqrt([0]*[0]+[1]*[1]/x)/100", 0.5, 60);
77 TF1 * f_calo_l =
new TF1(
"f_calo_l",
"pol2", 0.5, 60);
80 TCanvas *c1 =
new TCanvas(
"DrawEMCalTower_Resolution",
81 "DrawEMCalTower_Resolution", 1300, 600);
86 p = (TPad *) c1->cd(idx++);
92 p->DrawFrame(0, 0, 30, 30,
93 Form(
"Linearity;Input energy (GeV);Measured Energy (GeV)",
E));
94 TLine * l =
new TLine(0, 0, 30, 30);
95 l->SetLineColor(kGray);
99 ge_linear->Fit(f_calo_l,
"RM0");
100 f_calo_l->Draw(
"same");
102 p = (TPad *) c1->cd(idx++);
108 TH1 * hframe = p->DrawFrame(0, 0, 30, 0.2,
109 Form(
"Resolution;Input energy (GeV);#DeltaE/<E>",
E));
112 ge_res->Fit(f_calo_r,
"RM0");
113 f_calo_r->Draw(
"same");
116 Form(
"#DeltaE/E = %.1f%% #oplus %.1f%%/#sqrt{E}",
117 f_calo_r->GetParameter(0), f_calo_r->GetParameter(1)));
119 SaveCanvas(c1, base + TString(c1->GetName()), kTRUE);
127 base + TString(
"Prototype_") + particle +
"_" + sE
128 +
"_SegALL_DSTReader.root_DrawEMCalTower_EMCDistribution_SUM_all_event.root";
131 cout <<
"Process " << fname << endl;
132 TFile *
f =
new TFile(fname);
135 TH1 * hEnergySum = (TH1 *) f->GetObjectChecked(
"EnergySum_LG",
"TH1");
138 hEnergySum->DrawClone();
140 hEnergySum->Scale(1. / hEnergySum->Integral(1, -1));
141 TF1 * fgaus = hEnergySum->GetFunction(
"fgaus_LG");
145 v[0] = fgaus->GetParameter(1);
146 v[1] = fgaus->GetParError(1);
147 v[2] = fgaus->GetParameter(2);
148 v[3] = fgaus->GetParError(2);
156 gStyle->SetOptStat(0);
160 "/phenix/u/jinhuang/links/sPHENIX_work/Prototype_2016/EMCal_sim/15Degree_1Col/DrawEMCalTower_Resolution.root");
162 TGraphErrors * g1 = f1->GetObjectChecked(
"Graph",
"TGraphErrors");
163 TF1 * f_calo_r1 = f1->GetObjectChecked(
"f_calo_r",
"TF1");
165 g1->SetLineColor(kBlue + 3);
166 g1->SetMarkerColor(kBlue + 3);
167 f_calo_r1->SetLineColor(kBlue + 3);
169 g1->FindObject(
"stats")->Delete();
173 "/phenix/u/jinhuang/links/sPHENIX_work/Prototype_2016/EMCal_sim/15Degree_1Col_LightCollection/DrawEMCalTower_Resolution.root");
175 TGraphErrors * g2 = f2->GetObjectChecked(
"Graph",
"TGraphErrors");
176 TF1 * f_calo_r2 = f2->GetObjectChecked(
"f_calo_r",
"TF1");
178 g2->SetLineColor(kRed + 3);
179 g2->SetMarkerColor(kRed + 3);
180 f_calo_r2->SetLineColor(kRed + 3);
182 g2->FindObject(
"stats")->Delete();
184 TCanvas *c1 =
new TCanvas(
"DrawEMCalTower_Resolution_Compare",
185 "DrawEMCalTower_Resolution_Compare", 700, 600);
190 TLegend *
leg =
new TLegend(0.3, 0.5, 0.9, 0.9);
192 p = (TPad *) c1->cd(idx++);
198 TH1 * hframe = p->DrawFrame(0, 0, 30, 0.2,
199 Form(
"Resolution Comparison;Input energy (GeV);#DeltaE/<E>"));
202 f_calo_r1->Draw(
"same");
204 leg->AddEntry(g1,
"Pre-test beam simulation",
"p");
205 leg->AddEntry(f_calo_r1,
206 Form(
"#DeltaE/E = %.1f%% #oplus %.1f%%/#sqrt{E}",
207 f_calo_r1->GetParameter(0), f_calo_r1->GetParameter(1)),
"l");
210 f_calo_r2->Draw(
"same");
212 leg->AddEntry(g2,
"Pre-test beam simulation",
"p");
213 leg->AddEntry(f_calo_r2,
214 Form(
"#DeltaE/E = %.1f%% #oplus %.1f%%/#sqrt{E}",
215 f_calo_r2->GetParameter(0), f_calo_r2->GetParameter(1)),
"l");
219 SaveCanvas(c1, TString(c1->GetName()), kTRUE);