12 #include <TGraphErrors.h>
34 TGraphErrors *linearity;
35 TGraphErrors *resolution;
48 "/phenix/u/jinhuang/links/sPHENIX_work/Prototype_2018/Scan2018b1Tower36/dst.lst_EMCalCalib.root"
52 gStyle->SetOptStat(0);
53 gStyle->SetOptFit(1111);
54 gStyle->SetPadGridX(0);
55 gStyle->SetPadGridY(0);
56 TVirtualFitter::SetDefaultFitter(
"Minuit2");
58 gSystem->Load(
"libPrototype4.so");
59 gSystem->Load(
"libProto4ShowCalib.so");
65 TString chian_str =
infile;
66 chian_str.ReplaceAll(
"ALL",
"*");
68 TChain *
t =
new TChain(
"T");
69 const int n = t->Add(chian_str);
71 cout <<
"Loaded " << n <<
" root files with " << chian_str << endl;
116 event_sel =
"good_e && info.hodo_h==3 && info.hodo_v==3";
117 cuts =
"_good_e_h3_v3";
126 T->SetAlias(
"SimEnergyScale",
"1*1");
139 cout <<
"Build event selection of " << (
const char *)
event_sel << endl;
142 TEventList *elist = gDirectory->GetObjectChecked(
"EventList",
"TEventList");
143 cout << elist->GetN() <<
" / " <<
T->GetEntriesFast() <<
" events selected"
146 T->SetEventList(elist);
170 const double z_shift = 0,
const int n_div = 1)
172 TH3F *EnergySum_LG3 =
173 new TH3F(
"EnergySum_LG3",
174 ";Horizontal Hodoscope (5 mm);Vertical Hodoscope (5 mm);5x5 Cluster Energy (GeV)",
179 T->Draw(sTOWER +
":7-hodo_v:hodo_h>>EnergySum_LG3",
"",
"goff");
181 TProfile2D *EnergySum_LG3_prof_xy = EnergySum_LG3->Project3DProfile(
"yx");
182 TH2 *EnergySum_LG3_yx = EnergySum_LG3->Project3D(
"yx");
183 TH2 *EnergySum_LG3_zx = EnergySum_LG3->Project3D(
"zx");
184 TH2 *EnergySum_LG3_zy = EnergySum_LG3->Project3D(
"zy");
186 TGraphErrors *ge_EnergySum_LG3_zx =
FitProfile(EnergySum_LG3_zx);
187 TGraphErrors *ge_EnergySum_LG3_zy =
FitProfile(EnergySum_LG3_zy);
190 TCanvas *c1 =
new TCanvas(
191 TString(Form(
"EMCDistributionVSBeam_SUM_NDiv%d_", n_div)) + sTOWER +
cuts,
192 TString(Form(
"EMCDistributionVSBeam_SUM_NDiv%d_", n_div)) + sTOWER +
cuts,
198 p = (TPad *) c1->cd(idx++);
204 EnergySum_LG3_prof_xy->SetMinimum(0);
206 EnergySum_LG3_prof_xy->Draw(
"colz");
207 EnergySum_LG3_prof_xy->SetTitle(
208 "Energy response;Horizontal Hodoscope (5 mm);7 - Vertical Hodoscope (5 mm)");
210 p = (TPad *) c1->cd(idx++);
216 EnergySum_LG3_yx->SetMinimum(0);
217 EnergySum_LG3_yx->Draw(
"colz");
218 EnergySum_LG3_yx->SetTitle(
219 "Event counts;Horizontal Hodoscope (5 mm);7 - Vertical Hodoscope (5 mm)");
221 p = (TPad *) c1->cd(idx++);
227 EnergySum_LG3_zx->Draw(
"colz");
228 EnergySum_LG3_zx->SetTitle(
229 "Position scan;Horizontal Hodoscope (5 mm);5x5 Cluster Energy (GeV)");
231 ge_EnergySum_LG3_zx->SetLineWidth(2);
232 ge_EnergySum_LG3_zx->SetMarkerStyle(kFullCircle);
233 ge_EnergySum_LG3_zx->Draw(
"pe");
235 p = (TPad *) c1->cd(idx++);
241 EnergySum_LG3_zy->Draw(
"colz");
242 EnergySum_LG3_zy->SetTitle(
243 "Position scan;7 - Vertical Hodoscope (5 mm);5x5 Cluster Energy (GeV)");
245 ge_EnergySum_LG3_zy->SetLineWidth(2);
246 ge_EnergySum_LG3_zy->SetMarkerStyle(kFullCircle);
247 ge_EnergySum_LG3_zy->Draw(
"pe");
278 TString(
_file0->GetName()) + TString(
"_DrawPrototype3ShowerCalib_") + TString(c1->GetName()), kTRUE);
282 const double z_shift = 0,
const int n_div = 1)
284 TH3F *EnergySum_LG3 =
285 new TH3F(
"EnergySum_LG3",
286 ";Beam Horizontal Pos (cm);Beam Vertical Pos (cm);5x5 Cluster Energy (GeV)",
287 20 * n_div, z_shift - 5, z_shift + 5,
291 T->Draw(sTOWER +
":info.truth_y:info.truth_z>>EnergySum_LG3",
"",
"goff");
293 TProfile2D *EnergySum_LG3_xy = EnergySum_LG3->Project3DProfile(
"yx");
294 TH2 *EnergySum_LG3_zx = EnergySum_LG3->Project3D(
"zx");
295 TH2 *EnergySum_LG3_zy = EnergySum_LG3->Project3D(
"zy");
297 TGraphErrors *ge_EnergySum_LG3_zx =
FitProfile(EnergySum_LG3_zx);
298 TGraphErrors *ge_EnergySum_LG3_zy =
FitProfile(EnergySum_LG3_zy);
301 TCanvas *c1 =
new TCanvas(
302 TString(Form(
"EMCDistributionVSBeam_SUM_NDiv%d_", n_div)) + sTOWER +
cuts,
303 TString(Form(
"EMCDistributionVSBeam_SUM_NDiv%d_", n_div)) + sTOWER +
cuts,
309 p = (TPad *) c1->cd(idx++);
315 EnergySum_LG3_xy->Draw(
"colz");
316 EnergySum_LG3_xy->SetTitle(
317 "Position scan;Beam Horizontal Pos (cm);Beam Vertical Pos (cm)");
319 p = (TPad *) c1->cd(idx++);
325 EnergySum_LG3_zx->Draw(
"colz");
326 EnergySum_LG3_zx->SetTitle(
327 "Position scan;Beam Horizontal Pos (cm);5x5 Cluster Energy (GeV)");
329 ge_EnergySum_LG3_zx->SetLineWidth(2);
330 ge_EnergySum_LG3_zx->SetMarkerStyle(kFullCircle);
331 ge_EnergySum_LG3_zx->Draw(
"pe");
333 p = (TPad *) c1->cd(idx++);
339 EnergySum_LG3_zy->Draw(
"colz");
340 EnergySum_LG3_zy->SetTitle(
341 "Position scan;Beam Vertical Pos (cm);5x5 Cluster Energy (GeV)");
343 ge_EnergySum_LG3_zy->SetLineWidth(2);
344 ge_EnergySum_LG3_zy->SetMarkerStyle(kFullCircle);
345 ge_EnergySum_LG3_zy->Draw(
"pe");
347 p = (TPad *) c1->cd(idx++);
353 TH1 *
h = (TH1 *) EnergySum_LG3->ProjectionZ();
355 TF1 *fgaus =
new TF1(
"fgaus_LG",
"gaus", 0, 100);
356 fgaus->SetParameters(1, h->GetMean() - 2 * h->GetRMS(),
357 h->GetMean() + 2 * h->GetRMS());
361 h->GetXaxis()->SetRangeUser(h->GetMean() - 4 * h->GetRMS(),
362 h->GetMean() + 4 * h->GetRMS());
363 EnergySum_LG3_zx->GetYaxis()->SetRangeUser(h->GetMean() - 4 * h->GetRMS(),
364 h->GetMean() + 4 * h->GetRMS());
365 EnergySum_LG3_zy->GetYaxis()->SetRangeUser(h->GetMean() - 4 * h->GetRMS(),
366 h->GetMean() + 4 * h->GetRMS());
369 h->SetMarkerStyle(kFullCircle);
372 Form(
"#DeltaE/<E> = %.1f%%",
373 100 * fgaus->GetParameter(2) / fgaus->GetParameter(1)));
376 TString(
_file0->GetName()) + TString(
"_DrawPrototype3ShowerCalib_") + TString(c1->GetName()), kTRUE);
380 "(info.C2_sum)>500 && (info.C2_sum)<1300")
385 TCanvas *c1 =
new TCanvas(
"LineShapeData" +
cuts,
"LineShapeData" +
cuts,
392 p = (TPad *) c1->cd(idx++);
398 T->Draw(
"info.C2_sum>>h_c2_sum(300,-500,22500)");
399 h_c2_sum->SetTitle(
"Cherenkov Checks;Sum C2 (ADC)");
400 T->Draw(
"info.C2_sum>>h_c2_h(300,-500,22500)", c2_h,
"same");
401 T->Draw(
"info.C2_sum>>h_c2_e(300,-500,22500)", c2_e,
"same");
403 h_c2_h->SetLineColor(kBlue);
404 h_c2_e->SetLineColor(kRed);
406 h_c2_sum->SetLineWidth(2);
407 h_c2_h->SetLineWidth(2);
408 h_c2_e->SetLineWidth(2);
410 p = (TPad *) c1->cd(idx++);
414 T->Draw(
"clus_5x5_prod.sum_E>>h_5x5sum_c2_sum(170,-1,16)");
415 h_5x5sum_c2_sum->SetTitle(
416 "Cluster spectrum decomposition;5x5 cluster energy (GeV)");
417 T->Draw(
"clus_5x5_prod.sum_E>>h_5x5sum_c2_h(170,-1,16)", c2_h,
"same");
418 T->Draw(
"clus_5x5_prod.sum_E>>h_5x5sum_c2_rej_h(170,-1,16)", !c2_h,
420 T->Draw(
"clus_5x5_prod.sum_E>>h_5x5sum_c2_e(170,-1,16)", c2_e,
"same");
422 h_5x5sum_c2_h->SetLineColor(kBlue);
423 h_5x5sum_c2_rej_h->SetLineColor(kMagenta);
424 h_5x5sum_c2_e->SetLineColor(kRed);
426 h_5x5sum_c2_sum->SetLineWidth(2);
427 h_5x5sum_c2_h->SetLineWidth(2);
428 h_5x5sum_c2_rej_h->SetLineWidth(2);
429 h_5x5sum_c2_e->SetLineWidth(2);
431 p = (TPad *) c1->cd(idx++);
435 TH1 *h_5x5sum_c2_h2 = h_5x5sum_c2_h->DrawClone();
436 h_5x5sum_c2_h2->Sumw2();
437 h_5x5sum_c2_h2->SetMarkerColor(kBlue);
438 h_5x5sum_c2_h2->SetMarkerStyle(kFullCircle);
439 h_5x5sum_c2_h2->SetTitle(
";5x5 cluster energy (GeV)");
441 TH1 *h_5x5sum_c2_e2 = h_5x5sum_c2_e->DrawClone(
"same");
442 h_5x5sum_c2_e2->Sumw2();
443 h_5x5sum_c2_e2->SetMarkerColor(kRed);
444 h_5x5sum_c2_e2->SetMarkerStyle(kFullCircle);
445 h_5x5sum_c2_e2->SetTitle(
";5x5 cluster energy (GeV)");
447 p = (TPad *) c1->cd(idx++);
451 TH1F *h_5x5sum_c2_h3 = h_5x5sum_c2_h->DrawClone();
452 h_5x5sum_c2_h3->SetName(
"h_5x5sum_c2_h3");
453 h_5x5sum_c2_h3->Sumw2();
454 h_5x5sum_c2_h3->Scale(1. / h_5x5sum_c2_h3->GetSum());
455 h_5x5sum_c2_h3->SetMarkerColor(kBlue);
456 h_5x5sum_c2_h3->SetMarkerStyle(kFullCircle);
457 h_5x5sum_c2_h3->SetTitle(
";5x5 cluster energy (GeV);Probability / bin");
460 TString(
_file0->GetName()) +
"_DrawPrototype3ShowerCalib_" + TString(c1->GetName()), kTRUE);
468 TCanvas *c1 =
new TCanvas(
"LineShapeSim" +
cuts,
"LineShapeSim" +
cuts, 1000,
475 p = (TPad *) c1->cd(idx++);
479 T->Draw(
"clus_5x5_prod.sum_E*SimEnergyScale>>h_5x5sum_c2_sum(170,-1,16)");
480 h_5x5sum_c2_sum->SetTitle(
481 "Cluster spectrum decomposition;5x5 cluster energy (GeV)");
482 h_5x5sum_c2_sum->SetLineWidth(2);
485 TString(
_file0->GetName()) +
"_DrawPrototype3ShowerCalib_" + TString(c1->GetName()), kTRUE);
493 TCanvas *c1 =
new TCanvas(
"HodoscopeCheck" +
cuts,
"HodoscopeCheck" +
cuts,
500 p = (TPad *) c1->cd(idx++);
506 T->Draw(
"clus_5x5_prod.average_col:hodo_h>>h2_h(8,-.5,7.5,160,-.5,7.5)",
509 "Horizontal hodoscope check;Horizontal Hodoscope;5x5 cluster mean col");
511 p = (TPad *) c1->cd(idx++);
517 T->Draw(
"clus_5x5_prod.average_row:hodo_v>>h2_v(8,-.5,7.5,160,-.5,7.5)",
520 "Vertical hodoscope check;Vertical Hodoscope;5x5 cluster mean row");
523 TString(
_file0->GetName()) +
"_DrawPrototype3ShowerCalib_" + TString(c1->GetName()), kTRUE);
533 TCanvas *c1 =
new TCanvas(
"SimPositionCheck" +
cuts,
534 "SimPositionCheck" +
cuts, 1300, 950);
540 p = (TPad *) c1->cd(idx++);
547 Form(
"clus_5x5_prod.average_col:truth_z>>h2_h(30,%f,%f,160,-.5,7.5)",
548 shift_z - 1.5, shift_z + 1.5),
551 "Horizontal hodoscope check;Horizontal beam pos;5x5 cluster mean col");
553 p = (TPad *) c1->cd(idx++);
559 T->Draw(
"clus_5x5_prod.average_row:truth_y>>h2_v(30,-1.5,1.5,160,-.5,7.5)",
562 "Vertical hodoscope check;Vertical beam pos;5x5 cluster mean row");
565 TString(
_file0->GetName()) +
"_DrawPrototype3ShowerCalib_" + TString(c1->GetName()), kTRUE);
584 TCanvas *c1 =
new TCanvas(Form(
"Res_linear") +
cuts,
585 Form(
"Res_linear") +
cuts, 1300, 600);
590 p = (TPad *) c1->cd(idx++);
594 TLegend *
leg =
new TLegend(.15, .7, .6, .85);
596 p->DrawFrame(0, 0, max_E, max_E,
597 Form(
"Electron Linearity;Input energy (GeV);Measured Energy (GeV)"));
599 TF1 *f_calo_l_sim =
new TF1(
"f_calo_l",
"pol2", 0.5, max_E);
601 f_calo_l_sim->SetParameters(-0., 1, -0.);
603 f_calo_l_sim->SetLineColor(kGreen + 2);
604 f_calo_l_sim->SetLineWidth(3);
606 f_calo_l_sim->Draw(
"same");
610 ges_clus_5x5_recalib.
linearity->Draw(
"p");
614 leg->AddEntry(ges_clus_5x5_prod.
linearity, ges_clus_5x5_prod.
name,
"ep");
615 leg->AddEntry(ges_clus_3x3_prod.
linearity, ges_clus_3x3_prod.
name,
"ep");
616 leg->AddEntry(ges_clus_1x1_prod.
linearity, ges_clus_1x1_prod.
name,
"ep");
617 leg->AddEntry(ges_clus_5x5_recalib.
linearity,
"clus_5x5_recalib",
"ep");
618 leg->AddEntry(f_calo_l_sim,
"Unity",
"l");
621 p = (TPad *) c1->cd(idx++);
627 TF1 *f_calo_sim =
new TF1(
"f_calo_sim",
"sqrt([0]*[0]+[1]*[1]/x)/100", 0.5,
631 f_calo_sim->SetParameters(3.7, 12.8, 0);
632 f_calo_sim->SetLineWidth(3);
633 f_calo_sim->SetLineColor(kGreen + 2);
635 TH1 *hframe = p->DrawFrame(0, 0, max_E, 0.3,
636 Form(
"Resolution;Input energy (GeV);#DeltaE/<E>"));
638 TLegend *leg =
new TLegend(.2, .6, .85, .9);
640 ges_clus_5x5_prod.
f_res->Draw(
"same");
646 ges_clus_5x5_recalib.
f_res->Draw(
"same");
648 f_calo_sim->Draw(
"same");
650 leg->AddEntry(ges_clus_5x5_prod.
resolution, ges_clus_5x5_prod.
name,
"ep");
651 leg->AddEntry(ges_clus_5x5_prod.
f_res,
652 Form(
"#DeltaE/E = %.1f%% #oplus %.1f%%/#sqrt{E}",
654 ges_clus_5x5_prod.
f_res->GetParameter(0),
655 ges_clus_5x5_prod.
f_res->GetParameter(1)
660 leg->AddEntry(ges_clus_3x3_prod.
resolution, ges_clus_3x3_prod.
name,
"ep");
661 leg->AddEntry(ges_clus_3x3_prod.
f_res,
662 Form(
"#DeltaE/E = %.1f%% #oplus %.1f%%/#sqrt{E}",
664 ges_clus_3x3_prod.
f_res->GetParameter(0),
665 ges_clus_3x3_prod.
f_res->GetParameter(1)
692 TLegend *leg =
new TLegend(.1, .15, .85, .25);
694 leg->AddEntry(f_calo_sim,
696 "#splitline{Simulation w/ flat light collection}{#DeltaE/E = %.1f%% #oplus %.1f%%/#sqrt{E}}",
697 f_calo_sim->GetParameter(0), f_calo_sim->GetParameter(1)),
701 hframe->SetTitle(
"Electron Resolution");
704 TString(
_file0->GetName()) +
"_DrawPrototype3ShowerCalib_" + TString(c1->GetName()), kTRUE);
717 TCanvas *c1 =
new TCanvas(Form(
"Res_linear") +
cuts,
718 Form(
"Res_linear") +
cuts, 1300, 600);
723 p = (TPad *) c1->cd(idx++);
727 TLegend *
leg =
new TLegend(.15, .7, .6, .85);
729 p->DrawFrame(0, 0, 25, 25,
730 Form(
"Electron Linearity;Input energy (GeV);Measured Energy (GeV)"));
731 TLine *l =
new TLine(0, 0, 25, 25);
732 l->SetLineColor(kGray);
735 TF1 *f_calo_l_sim =
new TF1(
"f_calo_l",
"pol2", 0.5, 25);
737 f_calo_l_sim->SetParameters(-0., 1, -0.);
739 f_calo_l_sim->SetLineColor(kGreen + 2);
740 f_calo_l_sim->SetLineWidth(3);
742 f_calo_l_sim->Draw(
"same");
748 leg->AddEntry(ges_clus_5x5_prod.
linearity, ges_clus_5x5_prod.
name,
"ep");
749 leg->AddEntry(ges_clus_3x3_prod.
linearity, ges_clus_3x3_prod.
name,
"ep");
750 leg->AddEntry(f_calo_l_sim,
"Unity",
"l");
753 p = (TPad *) c1->cd(idx++);
759 TF1 *f_calo_sim =
new TF1(
"f_calo_sim",
"sqrt([0]*[0]+[1]*[1]/x)/100", 0.5,
761 f_calo_sim->SetParameters(2.4, 11.8);
762 f_calo_sim->SetLineWidth(3);
763 f_calo_sim->SetLineColor(kGreen + 2);
765 TH1 *hframe = p->DrawFrame(0, 0, 25, 0.3,
766 Form(
"Resolution;Input energy (GeV);#DeltaE/<E>"));
768 TLegend *leg =
new TLegend(.2, .6, .85, .9);
770 ges_clus_5x5_prod.
f_res->Draw(
"same");
772 ges_clus_3x3_prod.
f_res->Draw(
"same");
774 f_calo_sim->Draw(
"same");
776 leg->AddEntry(ges_clus_5x5_prod.
resolution, ges_clus_5x5_prod.
name,
"ep");
777 leg->AddEntry(ges_clus_5x5_prod.
f_res,
778 Form(
"#DeltaE/E = %.1f%% #oplus %.1f%%/#sqrt{E}",
779 ges_clus_5x5_prod.
f_res->GetParameter(0),
780 ges_clus_5x5_prod.
f_res->GetParameter(1)),
783 leg->AddEntry(ges_clus_3x3_prod.
resolution, ges_clus_3x3_prod.
name,
"ep");
784 leg->AddEntry(ges_clus_3x3_prod.
f_res,
785 Form(
"#DeltaE/E = %.1f%% #oplus %.1f%%/#sqrt{E}",
786 ges_clus_3x3_prod.
f_res->GetParameter(0),
787 ges_clus_3x3_prod.
f_res->GetParameter(1)),
795 TLegend *leg =
new TLegend(.2, .1, .85, .3);
797 leg->AddEntry(f_calo_sim,
798 Form(
"Prelim. Sim., #DeltaE/E = %.1f%% #oplus %.1f%%/#sqrt{E}",
799 f_calo_sim->GetParameter(0), f_calo_sim->GetParameter(1)),
803 hframe->SetTitle(
"Electron Resolution");
806 TString(
_file0->GetName()) +
"_DrawPrototype3ShowerCalib_" + TString(c1->GetName()), kTRUE);
814 TH1F *hbeam_mom =
new TH1F(
"hbeam_mom",
";beam momentum (GeV)", 32, .5,
818 TCanvas *c1 =
new TCanvas(
"GetBeamMom" +
cuts,
"GetBeamMom" +
cuts, 1800,
821 T->Draw(
"abs(info.beam_mom)>>hbeam_mom");
823 for (
int bin = 1; bin < hbeam_mom->GetNbinsX(); bin++)
825 if (hbeam_mom->GetBinContent(bin) > 40)
827 const double momentum = hbeam_mom->GetBinCenter(bin);
829 if (momentum == 1 || momentum == 2 || momentum == 3 || momentum == 4 || momentum == 5 || momentum == 6 || momentum == 8 || momentum == 12 || momentum == 16 || momentum == 24 || momentum == 28 || momentum == 32)
831 mom.push_back(momentum);
833 cout <<
"GetBeamMom - " << momentum <<
" GeV for "
834 << hbeam_mom->GetBinContent(bin) <<
" event" << endl;
840 TString(
_file0->GetName()) +
"_DrawPrototype3ShowerCalib_" + TString(c1->GetName()), kTRUE);
846 GetResolution(TString cluster_name, vector<double> beam_mom, Color_t
col, TString e_sum =
"sum_E")
849 vector<double> mean_err;
851 vector<double> res_err;
853 TCanvas *c1 =
new TCanvas(
"GetResolution_LineShape_" + cluster_name +
cuts,
854 "GetResolution_LineShape_" + cluster_name +
cuts, 1800, 900);
860 for (
int i = 0;
i < beam_mom.size(); ++
i)
862 p = (TPad *) c1->cd(idx++);
865 const double momemtum = beam_mom[
i];
866 const TString histname = Form(
"hLineShape%.0fGeV_", momemtum) + cluster_name;
868 TH1F *
h =
new TH1F(histname, histname +
";Observed energy (GeV)",
869 (momemtum < 6 ? 25 : 40), 0.5, momemtum * 1.5);
870 T->Draw(cluster_name +
"." + e_sum +
">>" + histname,
871 Form(
"abs(abs(info.beam_mom)-%f)/%f<.06", momemtum, momemtum));
875 TF1 *fgaus_g =
new TF1(
"fgaus_LG_g_" + cluster_name,
"gaus",
876 h->GetMean() - 1 * h->GetRMS(), h->GetMean() + 4 * h->GetRMS());
877 fgaus_g->SetParameters(1, h->GetMean() - 2 * h->GetRMS(),
878 h->GetMean() + 2 * h->GetRMS());
879 h->Fit(fgaus_g,
"MR0N");
881 TF1 *fgaus =
new TF1(
"fgaus_LG_" + cluster_name,
"gaus",
882 fgaus_g->GetParameter(1) - 2 * fgaus_g->GetParameter(2),
883 fgaus_g->GetParameter(1) + 3 * fgaus_g->GetParameter(2));
884 fgaus->SetParameters(fgaus_g->GetParameter(0), fgaus_g->GetParameter(1),
885 fgaus_g->GetParameter(2));
889 h->SetMarkerStyle(kFullCircle);
890 fgaus->SetLineWidth(2);
893 Form(
"%.0f GeV/c: #DeltaE/<E> = %.1f%%", momemtum,
894 100 * fgaus->GetParameter(2) / fgaus->GetParameter(1)));
896 mean.push_back(fgaus->GetParameter(1));
897 mean_err.push_back(fgaus->GetParError(1));
898 res.push_back(fgaus->GetParameter(2) / fgaus->GetParameter(1));
899 res_err.push_back(fgaus->GetParError(2) / fgaus->GetParameter(1));
903 TString(
_file0->GetName()) +
"_DrawPrototype3ShowerCalib_" + TString(c1->GetName()), kTRUE);
905 TGraphErrors *ge_linear =
new TGraphErrors(beam_mom.size(), &beam_mom[0],
906 &mean[0], 0, &mean_err[0]);
908 TGraphErrors *ge_res =
new TGraphErrors(beam_mom.size(), &beam_mom[0],
909 &res[0], 0, &res_err[0]);
910 ge_res->GetHistogram()->SetStats(0);
914 ret.
name = cluster_name;
917 ret.
f_res =
new TF1(
"f_calo_r_" + cluster_name,
"sqrt([0]*[0]+[1]*[1]/x)/100",
920 ret.
f_res->SetParLimits(0, 2, 20);
921 ret.
f_res->SetParLimits(1, 10, 40);
922 ret.
f_res->SetParLimits(2, 10, 10);
923 ret.
f_res->SetParameters(2, 12, 10);
924 ge_res->Fit(ret.
f_res,
"RM0QN");
926 static int MarkerStyle = kOpenCircle - 1;
929 ge_linear->SetLineColor(col);
930 ge_linear->SetMarkerColor(col);
931 ge_linear->SetLineWidth(2);
932 ge_linear->SetMarkerStyle(MarkerStyle);
933 ge_linear->SetMarkerSize(2);
935 ge_res->SetLineColor(col);
936 ge_res->SetMarkerColor(col);
937 ge_res->SetLineWidth(2);
938 ge_res->SetMarkerStyle(MarkerStyle);
939 ge_res->SetMarkerSize(2);
941 ge_res->GetHistogram()->SetStats(0);
943 ret.
f_res->SetLineColor(col);
944 ret.
f_res->SetLineWidth(3);
952 TProfile *p2 = h2->ProfileX();
960 for (
int i = 1;
i <= h2->GetNbinsX();
i++)
962 TH1D *
h1 = h2->ProjectionY(Form(
"htmp_%d", rand()),
i,
i);
964 if (h1->GetSum() < 30)
966 cout <<
"FitProfile - ignore bin " <<
i << endl;
971 cout <<
"FitProfile - fit bin " <<
i << endl;
974 TF1 fgaus(
"fgaus",
"gaus", -p2->GetBinError(
i) * 4,
975 p2->GetBinError(
i) * 4);
977 TF1
f2(Form(
"dgaus"),
"gaus + [3]*exp(-0.5*((x-[1])/[4])**2) + [5]",
978 -p2->GetBinError(
i) * 4, p2->GetBinError(
i) * 4);
980 fgaus.SetParameter(1, p2->GetBinContent(
i));
981 fgaus.SetParameter(2, p2->GetBinError(
i));
983 h1->Fit(&fgaus,
"MQ");
985 f2.SetParameters(fgaus.GetParameter(0) / 2, fgaus.GetParameter(1),
986 fgaus.GetParameter(2), fgaus.GetParameter(0) / 2,
987 fgaus.GetParameter(2) / 4, 0);
996 x[
n] = p2->GetBinCenter(
i);
997 ex[
n] = (p2->GetBinCenter(2) - p2->GetBinCenter(1)) / 2;
998 y[
n] = fgaus.GetParameter(1);
999 ey[
n] = fgaus.GetParError(1);
1008 return new TGraphErrors(n, x, y, ex, ey);