17 #include <TGraphErrors.h>
29 "/phenix/u/jinhuang/tmp/miliped_work/Production_0414/calirbated_")
32 gStyle->SetOptStat(0);
33 gStyle->SetGridStyle(0);
38 TVirtualFitter::SetDefaultFitter(
"Minuit2");
42 { 2, 3, 4, 8, 12, 16 };
44 { 2042, 2040, 2039, 2038, 2067, 2063 };
52 TCanvas *c1 =
new TCanvas(
53 "DrawPrototype2EMCalTower_ResolutionRecalib_RunSummary"
54 + TString(
mask ?
"Mask" :
""),
55 "DrawPrototype2EMCalTower_ResolutionRecalib_RunSummary", 1800, 900);
59 for (
int i = 0;
i <
N; ++
i)
62 p = (TPad *) c1->cd(idx++);
68 const double E = Es[
i];
78 dres[
i] = v[3] / v[0];
80 cout <<
"mean[i] = " << mean[
i] <<
", "
81 <<
"dmean[i] = " << dmean[
i] <<
", "
82 <<
"res[i] = " << res[
i] <<
", "
83 <<
"dres[i] = " << dres[
i] << endl;
86 SaveCanvas(c1, base + TString(c1->GetName()), kTRUE);
88 TGraphErrors * ge_linear =
new TGraphErrors(N, Es, mean, 0, dmean);
89 TGraphErrors * ge_res =
new TGraphErrors(N, Es, res, 0, dres);
91 ge_linear->SetLineColor(kBlue + 3);
92 ge_linear->SetMarkerColor(kBlue + 3);
93 ge_linear->SetLineWidth(2);
94 ge_linear->SetMarkerStyle(kFullCircle);
95 ge_linear->SetMarkerSize(2);
97 ge_res->SetLineColor(kBlue + 3);
98 ge_res->SetMarkerColor(kBlue + 3);
99 ge_res->SetLineWidth(2);
100 ge_res->SetMarkerStyle(kFullCircle);
101 ge_res->SetMarkerSize(2);
103 TF1 * f_calo_r =
new TF1(
"f_calo_r",
"sqrt([0]*[0]+[1]*[1]/x)/100", 0.5, 25);
104 TF1 * f_calo_l =
new TF1(
"f_calo_l",
"pol2", 0.5, 25);
106 f_calo_r->SetLineColor(kBlue + 3);
107 f_calo_r->SetLineWidth(3);
109 TF1 * f_calo_sim =
new TF1(
"f_calo_sim",
"sqrt([0]*[0]+[1]*[1]/x)/100", 0.5,
111 f_calo_sim->SetParameters(2.4, 11.8);
112 f_calo_sim->SetLineWidth(3);
113 f_calo_sim->SetLineColor(kGreen + 2);
115 TF1 * f_calo_l_sim =
new TF1(
"f_calo_l",
"pol2", 0.5, 25);
117 f_calo_l_sim->SetParameters(-0., 1, -0.);
119 f_calo_l_sim->SetLineColor(kGreen + 2);
120 f_calo_l_sim->SetLineWidth(3);
124 "/gpfs/mnt/gpfs02/sphenix/user/jinhuang/Prototype_2016/Production_0417_CEMC_MIP_set2_v3/DrawPrototype2EMCalTower_Resolution_Run2042_col1_row2_5x5_Valid_HODO_center_col1_row2.root");
127 TGraphErrors * ge_res_ref = (TGraphErrors *) f_ref->GetObjectChecked(
"Graph",
130 ge_res_ref->SetObjectStat(0);
132 TF1 * f_calo_r_ref = (TF1 *) f_ref->GetObjectChecked(
"f_calo_r",
"TF1");
135 ge_res_ref->SetLineColor(kBlue);
136 ge_res_ref->SetMarkerColor(kBlue);
137 ge_res_ref->SetLineWidth(2);
138 ge_res_ref->SetMarkerStyle(kOpenCircle);
139 ge_res_ref->SetMarkerSize(2);
141 f_calo_r_ref->SetLineColor(kBlue);
142 f_calo_r_ref->SetMarkerColor(kBlue);
143 f_calo_r_ref->SetLineWidth(2);
146 TCanvas *c1 =
new TCanvas(
147 Form(
"DrawPrototype2EMCalTower_ResolutionRecalib%.0f_", runs[0]),
148 Form(
"DrawPrototype2EMCalTower_ResolutionRecalib%.0f_", runs[0]), 1300,
154 p = (TPad *) c1->cd(idx++);
160 TLegend*
leg =
new TLegend(.15, .7, .6, .85);
162 p->DrawFrame(0, 0, 25, 25,
163 Form(
"Electron Linearity;Input energy (GeV);Measured Energy (GeV)"));
164 TLine * l =
new TLine(0, 0, 25, 25);
165 l->SetLineColor(kGray);
168 f_calo_l_sim->Draw(
"same");
169 ge_linear->Draw(
"p");
173 leg->AddEntry(ge_linear,
"T-1044 data",
"ep");
174 leg->AddEntry(f_calo_l_sim,
"Unity",
"l");
177 p = (TPad *) c1->cd(idx++);
183 TH1 * hframe = p->DrawFrame(0, 0, 25, 0.2,
184 Form(
"Resolution;Input energy (GeV);#DeltaE/<E>"));
186 ge_res->Fit(f_calo_r,
"RM0Q");
188 f_calo_r_ref->Draw(
"same");
189 ge_res_ref->Draw(
"p");
190 f_calo_r->Draw(
"same");
191 f_calo_sim->Draw(
"same");
194 TLegend* leg =
new TLegend(.2, .6, .85, .9);
195 leg->AddEntry(ge_res_ref,
"T-1044, MIP calib.",
"ep");
196 leg->AddEntry(f_calo_r_ref,
197 Form(
"#DeltaE/E = %.1f%% #oplus %.1f%%/#sqrt{E}",
198 f_calo_r_ref->GetParameter(0), f_calo_r_ref->GetParameter(1)),
"l");
200 leg->AddEntry((TObject*)0,
" ",
"");
201 leg->AddEntry(ge_res,
"T-1044, e-shower calib.",
"ep");
202 leg->AddEntry(f_calo_r,
203 Form(
"#DeltaE/E = %.1f%% #oplus %.1f%%/#sqrt{E}",
204 f_calo_r->GetParameter(0), f_calo_r->GetParameter(1)),
"l");
207 TLegend* leg =
new TLegend(.2, .15, .85, .3);
209 leg->AddEntry(f_calo_sim,
210 Form(
"Simulation, #DeltaE/E = %.1f%% #oplus %.1f%%/#sqrt{E}",
211 f_calo_sim->GetParameter(0), f_calo_sim->GetParameter(1)),
"l");
214 hframe->SetTitle(
"Electron Resolution");
216 SaveCanvas(c1, base + TString(c1->GetName()), kTRUE);
224 TString
fname = base + Form(
"%d.dat", run);
227 cout <<
"Process " << fname << endl;
232 TH1 * EnergySum_LG_production =
new TH1F(
233 Form(
"EnergySum_LG_production_%d", run),
234 Form(
";Run %d: 5x5 EMCal Energy Sum (GeV);Count / bin", run), 400, 0, 30);
235 TH1 * EnergySum_LG_recalib =
new TH1F(Form(
"EnergySum_LG_recalib_%d", run),
236 Form(
";Run %d: 5x5 EMCal Energy Sum (GeV);Count / bin", run), 400, 0, 30);
244 if (line.length() == 0)
247 double old_E = -1, new_E = -1;
250 stringstream sline(line);
251 sline >> old_E >> tab >> new_E;
257 EnergySum_LG_production->Fill(old_E);
258 EnergySum_LG_recalib->Fill(new_E);
262 EnergySum_LG_production->SetLineColor(kBlue + 3);
263 EnergySum_LG_production->SetLineWidth(2);
264 EnergySum_LG_production->SetMarkerStyle(kFullCircle);
265 EnergySum_LG_production->SetMarkerColor(kBlue + 3);
266 EnergySum_LG_recalib->SetLineColor(kRed + 3);
267 EnergySum_LG_recalib->SetLineWidth(2);
268 EnergySum_LG_recalib->SetMarkerStyle(kFullCircle);
269 EnergySum_LG_recalib->SetMarkerColor(kRed + 3);
271 EnergySum_LG_recalib->Sumw2();
273 TH1 *
h = (TH1 *) EnergySum_LG_recalib->DrawClone();
275 EnergySum_LG_production->DrawClone(
"same");
277 TF1 * fgaus_g =
new TF1(
"fgaus_LG_g",
"gaus", h->GetMean() - 1 * h->GetRMS(),
278 h->GetMean() + 4 * h->GetRMS());
279 fgaus_g->SetParameters(1, h->GetMean() - 2 * h->GetRMS(),
280 h->GetMean() + 2 * h->GetRMS());
281 h->Fit(fgaus_g,
"MR0N");
283 TF1 * fgaus =
new TF1(
"fgaus_LG",
"gaus",
284 fgaus_g->GetParameter(1) - 2 * fgaus_g->GetParameter(2),
285 fgaus_g->GetParameter(1) + 2 * fgaus_g->GetParameter(2));
286 fgaus->SetParameters(fgaus_g->GetParameter(0), fgaus_g->GetParameter(1),
287 fgaus_g->GetParameter(2));
288 fgaus->SetLineColor(kRed);
289 fgaus->SetLineWidth(4);
293 h->GetXaxis()->SetRangeUser(h->GetMean() - 5 * h->GetRMS(),
294 h->GetMean() + 5 * h->GetRMS());
297 Form(
"#DeltaE/<E> = %.1f%% @ Beam = %.0f GeV",
298 100 * fgaus->GetParameter(2) / fgaus->GetParameter(1),
E));
300 h->SetTitle(Form(
"Beam = %.0f GeV", E));
305 v[0] = fgaus->GetParameter(1);
306 v[1] = fgaus->GetParError(1);
307 v[2] = fgaus->GetParameter(2);
308 v[3] = fgaus->GetParError(2);