17 #include <TGraphErrors.h>
34 TGraphErrors * linearity;
35 TGraphErrors * resolution;
42 "/sphenix/user/jinhuang/Prototype_2017/ShowerCalib/JointEnergyScan1_Neg.lst_EMCalCalib.root"
53 gStyle->SetOptStat(0);
54 gStyle->SetOptFit(1111);
55 gStyle->SetPadGridX(0);
56 gStyle->SetPadGridY(0);
57 TVirtualFitter::SetDefaultFitter(
"Minuit2");
59 gSystem->Load(
"libPrototype3.so");
60 gSystem->Load(
"libProto3ShowCalib.so");
66 TString chian_str =
infile;
67 chian_str.ReplaceAll(
"ALL",
"*");
69 TChain *
t =
new TChain(
"T");
70 const int n = t->Add(chian_str);
72 cout <<
"Loaded " << n <<
" root files with " << chian_str << endl;
121 event_sel =
"good_e && info.hodo_h==3 && info.hodo_v==6";
122 cuts =
"_good_data_h3_v6";
183 T->SetAlias(
"SimEnergyScale",
"1*1");
196 cout <<
"Build event selection of " << (
const char *)
event_sel << endl;
199 TEventList * elist = gDirectory->GetObjectChecked(
"EventList",
"TEventList");
200 cout << elist->GetN() <<
" / " <<
T->GetEntriesFast() <<
" events selected"
203 T->SetEventList(elist);
229 const double z_shift = 0,
const int n_div = 1)
231 TH3F * EnergySum_LG3 =
232 new TH3F(
"EnergySum_LG3",
233 ";Horizontal Hodoscope (5 mm);Vertical Hodoscope (5 mm);5x5 Cluster Energy (GeV)",
238 T->Draw(sTOWER +
":7-hodo_v:hodo_h>>EnergySum_LG3",
"",
"goff");
240 TProfile2D * EnergySum_LG3_prof_xy = EnergySum_LG3->Project3DProfile(
"yx");
241 TH2 * EnergySum_LG3_yx = EnergySum_LG3->Project3D(
"yx");
242 TH2 * EnergySum_LG3_zx = EnergySum_LG3->Project3D(
"zx");
243 TH2 * EnergySum_LG3_zy = EnergySum_LG3->Project3D(
"zy");
245 TGraphErrors * ge_EnergySum_LG3_zx =
FitProfile(EnergySum_LG3_zx);
246 TGraphErrors * ge_EnergySum_LG3_zy =
FitProfile(EnergySum_LG3_zy);
249 TCanvas *c1 =
new TCanvas(
250 TString(Form(
"EMCDistributionVSBeam_SUM_NDiv%d_", n_div)) + sTOWER +
cuts,
251 TString(Form(
"EMCDistributionVSBeam_SUM_NDiv%d_", n_div)) + sTOWER +
cuts,
257 p = (TPad *) c1->cd(idx++);
263 EnergySum_LG3_prof_xy->SetMinimum(0);
265 EnergySum_LG3_prof_xy->Draw(
"colz");
266 EnergySum_LG3_prof_xy->SetTitle(
267 "Energy response;Horizontal Hodoscope (5 mm);7 - Vertical Hodoscope (5 mm)");
269 p = (TPad *) c1->cd(idx++);
275 EnergySum_LG3_yx->SetMinimum(0);
276 EnergySum_LG3_yx->Draw(
"colz");
277 EnergySum_LG3_yx->SetTitle(
278 "Event counts;Horizontal Hodoscope (5 mm);7 - Vertical Hodoscope (5 mm)");
280 p = (TPad *) c1->cd(idx++);
286 EnergySum_LG3_zx->Draw(
"colz");
287 EnergySum_LG3_zx->SetTitle(
288 "Position scan;Horizontal Hodoscope (5 mm);5x5 Cluster Energy (GeV)");
290 ge_EnergySum_LG3_zx->SetLineWidth(2);
291 ge_EnergySum_LG3_zx->SetMarkerStyle(kFullCircle);
292 ge_EnergySum_LG3_zx->Draw(
"pe");
294 p = (TPad *) c1->cd(idx++);
300 EnergySum_LG3_zy->Draw(
"colz");
301 EnergySum_LG3_zy->SetTitle(
302 "Position scan;7 - Vertical Hodoscope (5 mm);5x5 Cluster Energy (GeV)");
304 ge_EnergySum_LG3_zy->SetLineWidth(2);
305 ge_EnergySum_LG3_zy->SetMarkerStyle(kFullCircle);
306 ge_EnergySum_LG3_zy->Draw(
"pe");
337 TString(
_file0->GetName()) + TString(
"_DrawPrototype3ShowerCalib_")
338 + TString(c1->GetName()), kTRUE);
343 const double z_shift = 0,
const int n_div = 1)
345 TH3F * EnergySum_LG3 =
346 new TH3F(
"EnergySum_LG3",
347 ";Beam Horizontal Pos (cm);Beam Vertical Pos (cm);5x5 Cluster Energy (GeV)",
348 20 * n_div, z_shift - 5, z_shift + 5,
352 T->Draw(sTOWER +
":info.truth_y:info.truth_z>>EnergySum_LG3",
"",
"goff");
354 TProfile2D * EnergySum_LG3_xy = EnergySum_LG3->Project3DProfile(
"yx");
355 TH2 * EnergySum_LG3_zx = EnergySum_LG3->Project3D(
"zx");
356 TH2 * EnergySum_LG3_zy = EnergySum_LG3->Project3D(
"zy");
358 TGraphErrors * ge_EnergySum_LG3_zx =
FitProfile(EnergySum_LG3_zx);
359 TGraphErrors * ge_EnergySum_LG3_zy =
FitProfile(EnergySum_LG3_zy);
362 TCanvas *c1 =
new TCanvas(
363 TString(Form(
"EMCDistributionVSBeam_SUM_NDiv%d_", n_div)) + sTOWER +
cuts,
364 TString(Form(
"EMCDistributionVSBeam_SUM_NDiv%d_", n_div)) + sTOWER +
cuts,
370 p = (TPad *) c1->cd(idx++);
376 EnergySum_LG3_xy->Draw(
"colz");
377 EnergySum_LG3_xy->SetTitle(
378 "Position scan;Beam Horizontal Pos (cm);Beam Vertical Pos (cm)");
380 p = (TPad *) c1->cd(idx++);
386 EnergySum_LG3_zx->Draw(
"colz");
387 EnergySum_LG3_zx->SetTitle(
388 "Position scan;Beam Horizontal Pos (cm);5x5 Cluster Energy (GeV)");
390 ge_EnergySum_LG3_zx->SetLineWidth(2);
391 ge_EnergySum_LG3_zx->SetMarkerStyle(kFullCircle);
392 ge_EnergySum_LG3_zx->Draw(
"pe");
394 p = (TPad *) c1->cd(idx++);
400 EnergySum_LG3_zy->Draw(
"colz");
401 EnergySum_LG3_zy->SetTitle(
402 "Position scan;Beam Vertical Pos (cm);5x5 Cluster Energy (GeV)");
404 ge_EnergySum_LG3_zy->SetLineWidth(2);
405 ge_EnergySum_LG3_zy->SetMarkerStyle(kFullCircle);
406 ge_EnergySum_LG3_zy->Draw(
"pe");
408 p = (TPad *) c1->cd(idx++);
414 TH1 *
h = (TH1 *) EnergySum_LG3->ProjectionZ();
416 TF1 * fgaus =
new TF1(
"fgaus_LG",
"gaus", 0, 100);
417 fgaus->SetParameters(1, h->GetMean() - 2 * h->GetRMS(),
418 h->GetMean() + 2 * h->GetRMS());
422 h->GetXaxis()->SetRangeUser(h->GetMean() - 4 * h->GetRMS(),
423 h->GetMean() + 4 * h->GetRMS());
424 EnergySum_LG3_zx->GetYaxis()->SetRangeUser(h->GetMean() - 4 * h->GetRMS(),
425 h->GetMean() + 4 * h->GetRMS());
426 EnergySum_LG3_zy->GetYaxis()->SetRangeUser(h->GetMean() - 4 * h->GetRMS(),
427 h->GetMean() + 4 * h->GetRMS());
430 h->SetMarkerStyle(kFullCircle);
433 Form(
"#DeltaE/<E> = %.1f%%",
434 100 * fgaus->GetParameter(2) / fgaus->GetParameter(1)));
437 TString(
_file0->GetName()) + TString(
"_DrawPrototype3ShowerCalib_")
438 + TString(c1->GetName()), kTRUE);
443 "(info.C2_sum)>500 && (info.C2_sum)<1300")
449 TCanvas *c1 =
new TCanvas(
"LineShapeData" +
cuts,
"LineShapeData" +
cuts,
456 p = (TPad *) c1->cd(idx++);
462 T->Draw(
"info.C2_sum>>h_c2_sum(300,-500,2500)");
463 h_c2_sum->SetTitle(
"Cherenkov Checks;Sum C2 (ADC)");
464 T->Draw(
"info.C2_sum>>h_c2_h(300,-500,2500)", c2_h,
"same");
465 T->Draw(
"info.C2_sum>>h_c2_e(300,-500,2500)", c2_e,
"same");
467 h_c2_h->SetLineColor(kBlue);
468 h_c2_e->SetLineColor(kRed);
470 h_c2_sum->SetLineWidth(2);
471 h_c2_h->SetLineWidth(2);
472 h_c2_e->SetLineWidth(2);
474 p = (TPad *) c1->cd(idx++);
478 T->Draw(
"clus_5x5_recalib.sum_E>>h_5x5sum_c2_sum(170,-1,16)");
479 h_5x5sum_c2_sum->SetTitle(
480 "Cluster spectrum decomposition;5x5 cluster energy (GeV)");
481 T->Draw(
"clus_5x5_recalib.sum_E>>h_5x5sum_c2_h(170,-1,16)", c2_h,
"same");
482 T->Draw(
"clus_5x5_recalib.sum_E>>h_5x5sum_c2_rej_h(170,-1,16)", !c2_h,
484 T->Draw(
"clus_5x5_recalib.sum_E>>h_5x5sum_c2_e(170,-1,16)", c2_e,
"same");
486 h_5x5sum_c2_h->SetLineColor(kBlue);
487 h_5x5sum_c2_rej_h->SetLineColor(kMagenta);
488 h_5x5sum_c2_e->SetLineColor(kRed);
490 h_5x5sum_c2_sum->SetLineWidth(2);
491 h_5x5sum_c2_h->SetLineWidth(2);
492 h_5x5sum_c2_rej_h->SetLineWidth(2);
493 h_5x5sum_c2_e->SetLineWidth(2);
495 p = (TPad *) c1->cd(idx++);
499 TH1 * h_5x5sum_c2_h2 = h_5x5sum_c2_h->DrawClone();
500 h_5x5sum_c2_h2->Sumw2();
501 h_5x5sum_c2_h2->SetMarkerColor(kBlue);
502 h_5x5sum_c2_h2->SetMarkerStyle(kFullCircle);
503 h_5x5sum_c2_h2->SetTitle(
";5x5 cluster energy (GeV)");
505 TH1 * h_5x5sum_c2_e2 = h_5x5sum_c2_e->DrawClone(
"same");
506 h_5x5sum_c2_e2->Sumw2();
507 h_5x5sum_c2_e2->SetMarkerColor(kRed);
508 h_5x5sum_c2_e2->SetMarkerStyle(kFullCircle);
509 h_5x5sum_c2_e2->SetTitle(
";5x5 cluster energy (GeV)");
511 p = (TPad *) c1->cd(idx++);
515 TH1F * h_5x5sum_c2_h3 = h_5x5sum_c2_h->DrawClone();
516 h_5x5sum_c2_h3->SetName(
"h_5x5sum_c2_h3");
517 h_5x5sum_c2_h3->Sumw2();
518 h_5x5sum_c2_h3->Scale(1. / h_5x5sum_c2_h3->GetSum());
519 h_5x5sum_c2_h3->SetMarkerColor(kBlue);
520 h_5x5sum_c2_h3->SetMarkerStyle(kFullCircle);
521 h_5x5sum_c2_h3->SetTitle(
";5x5 cluster energy (GeV);Probability / bin");
524 TString(
_file0->GetName()) +
"_DrawPrototype3ShowerCalib_"
525 + TString(c1->GetName()), kTRUE);
534 TCanvas *c1 =
new TCanvas(
"LineShapeSim" +
cuts,
"LineShapeSim" +
cuts, 1000,
541 p = (TPad *) c1->cd(idx++);
545 T->Draw(
"clus_5x5_prod.sum_E*SimEnergyScale>>h_5x5sum_c2_sum(170,-1,16)");
546 h_5x5sum_c2_sum->SetTitle(
547 "Cluster spectrum decomposition;5x5 cluster energy (GeV)");
548 h_5x5sum_c2_sum->SetLineWidth(2);
551 TString(
_file0->GetName()) +
"_DrawPrototype3ShowerCalib_"
552 + TString(c1->GetName()), kTRUE);
562 TCanvas *c1 =
new TCanvas(
"HodoscopeCheck" +
cuts,
"HodoscopeCheck" +
cuts,
569 p = (TPad *) c1->cd(idx++);
575 T->Draw(
"clus_5x5_prod.average_col:hodo_h>>h2_h(8,-.5,7.5,160,-.5,7.5)",
578 "Horizontal hodoscope check;Horizontal Hodoscope;5x5 cluster mean col");
580 p = (TPad *) c1->cd(idx++);
586 T->Draw(
"clus_5x5_prod.average_row:hodo_v>>h2_v(8,-.5,7.5,160,-.5,7.5)",
589 "Vertical hodoscope check;Vertical Hodoscope;5x5 cluster mean row");
592 TString(
_file0->GetName()) +
"_DrawPrototype3ShowerCalib_"
593 + TString(c1->GetName()), kTRUE);
604 TCanvas *c1 =
new TCanvas(
"SimPositionCheck" +
cuts,
605 "SimPositionCheck" +
cuts, 1300, 950);
611 p = (TPad *) c1->cd(idx++);
618 Form(
"clus_5x5_prod.average_col:truth_z>>h2_h(30,%f,%f,160,-.5,7.5)",
619 shift_z - 1.5, shift_z + 1.5),
"1",
"colz");
621 "Horizontal hodoscope check;Horizontal beam pos;5x5 cluster mean col");
623 p = (TPad *) c1->cd(idx++);
629 T->Draw(
"clus_5x5_prod.average_row:truth_y>>h2_v(30,-1.5,1.5,160,-.5,7.5)",
632 "Vertical hodoscope check;Vertical beam pos;5x5 cluster mean row");
635 TString(
_file0->GetName()) +
"_DrawPrototype3ShowerCalib_"
636 + TString(c1->GetName()), kTRUE);
657 TCanvas *c1 =
new TCanvas(Form(
"Res_linear") +
cuts,
658 Form(
"Res_linear") +
cuts, 1300, 600);
663 p = (TPad *) c1->cd(idx++);
667 TLegend*
leg =
new TLegend(.15, .7, .6, .85);
669 p->DrawFrame(0, 0, 25, 25,
670 Form(
"Electron Linearity;Input energy (GeV);Measured Energy (GeV)"));
671 TLine * l =
new TLine(0, 0, 25, 25);
672 l->SetLineColor(kGray);
675 TF1 * f_calo_l_sim =
new TF1(
"f_calo_l",
"pol2", 0.5, 25);
677 f_calo_l_sim->SetParameters(-0., 1, -0.);
679 f_calo_l_sim->SetLineColor(kGreen + 2);
680 f_calo_l_sim->SetLineWidth(3);
682 f_calo_l_sim->Draw(
"same");
690 leg->AddEntry(ges_clus_5x5_prod.
linearity, ges_clus_5x5_prod.
name,
"ep");
694 leg->AddEntry(f_calo_l_sim,
"Unity",
"l");
697 p = (TPad *) c1->cd(idx++);
703 TF1 * f_calo_sim =
new TF1(
"f_calo_sim",
"sqrt([0]*[0]+[1]*[1]/x)/100", 0.5,
705 f_calo_sim->SetParameters(3.7, 12.8);
706 f_calo_sim->SetLineWidth(3);
707 f_calo_sim->SetLineColor(kGreen + 2);
709 TH1 * hframe = p->DrawFrame(0, 0, 25, 0.2,
710 Form(
"Resolution;Input energy (GeV);#DeltaE/<E>"));
712 TLegend* leg =
new TLegend(.2, .6, .85, .9);
714 ges_clus_5x5_prod.
f_res->Draw(
"same");
722 f_calo_sim->Draw(
"same");
724 leg->AddEntry(ges_clus_5x5_prod.
resolution, ges_clus_5x5_prod.
name,
"ep");
725 leg->AddEntry(ges_clus_5x5_prod.
f_res,
726 Form(
"#DeltaE/E = %.1f%% #oplus %.1f%%/#sqrt{E}",
727 ges_clus_5x5_prod.
f_res->GetParameter(0),
728 ges_clus_5x5_prod.
f_res->GetParameter(1)),
"l");
752 TLegend* leg =
new TLegend(.1, .15, .85, .25);
754 leg->AddEntry(f_calo_sim,
756 "#splitline{Simulation w/ flat light collection}{#DeltaE/E = %.1f%% #oplus %.1f%%/#sqrt{E}}",
757 f_calo_sim->GetParameter(0), f_calo_sim->GetParameter(1)),
"l");
760 hframe->SetTitle(
"Electron Resolution");
763 TString(
_file0->GetName()) +
"_DrawPrototype3ShowerCalib_"
764 + TString(c1->GetName()), kTRUE);
779 TCanvas *c1 =
new TCanvas(Form(
"Res_linear") +
cuts,
780 Form(
"Res_linear") +
cuts, 1300, 600);
785 p = (TPad *) c1->cd(idx++);
789 TLegend*
leg =
new TLegend(.15, .7, .6, .85);
791 p->DrawFrame(0, 0, 25, 25,
792 Form(
"Electron Linearity;Input energy (GeV);Measured Energy (GeV)"));
793 TLine * l =
new TLine(0, 0, 25, 25);
794 l->SetLineColor(kGray);
797 TF1 * f_calo_l_sim =
new TF1(
"f_calo_l",
"pol2", 0.5, 25);
799 f_calo_l_sim->SetParameters(-0., 1, -0.);
801 f_calo_l_sim->SetLineColor(kGreen + 2);
802 f_calo_l_sim->SetLineWidth(3);
804 f_calo_l_sim->Draw(
"same");
810 leg->AddEntry(ges_clus_5x5_prod.
linearity, ges_clus_5x5_prod.
name,
"ep");
811 leg->AddEntry(ges_clus_3x3_prod.
linearity, ges_clus_3x3_prod.
name,
"ep");
812 leg->AddEntry(f_calo_l_sim,
"Unity",
"l");
815 p = (TPad *) c1->cd(idx++);
821 TF1 * f_calo_sim =
new TF1(
"f_calo_sim",
"sqrt([0]*[0]+[1]*[1]/x)/100", 0.5,
823 f_calo_sim->SetParameters(2.4, 11.8);
824 f_calo_sim->SetLineWidth(3);
825 f_calo_sim->SetLineColor(kGreen + 2);
827 TH1 * hframe = p->DrawFrame(0, 0, 25, 0.3,
828 Form(
"Resolution;Input energy (GeV);#DeltaE/<E>"));
830 TLegend* leg =
new TLegend(.2, .6, .85, .9);
832 ges_clus_5x5_prod.
f_res->Draw(
"same");
834 ges_clus_3x3_prod.
f_res->Draw(
"same");
836 f_calo_sim->Draw(
"same");
838 leg->AddEntry(ges_clus_5x5_prod.
resolution, ges_clus_5x5_prod.
name,
"ep");
839 leg->AddEntry(ges_clus_5x5_prod.
f_res,
840 Form(
"#DeltaE/E = %.1f%% #oplus %.1f%%/#sqrt{E}",
841 ges_clus_5x5_prod.
f_res->GetParameter(0),
842 ges_clus_5x5_prod.
f_res->GetParameter(1)),
"l");
844 leg->AddEntry(ges_clus_3x3_prod.
resolution, ges_clus_3x3_prod.
name,
"ep");
845 leg->AddEntry(ges_clus_3x3_prod.
f_res,
846 Form(
"#DeltaE/E = %.1f%% #oplus %.1f%%/#sqrt{E}",
847 ges_clus_3x3_prod.
f_res->GetParameter(0),
848 ges_clus_3x3_prod.
f_res->GetParameter(1)),
"l");
855 TLegend* leg =
new TLegend(.2, .1, .85, .3);
857 leg->AddEntry(f_calo_sim,
858 Form(
"Prelim. Sim., #DeltaE/E = %.1f%% #oplus %.1f%%/#sqrt{E}",
859 f_calo_sim->GetParameter(0), f_calo_sim->GetParameter(1)),
"l");
862 hframe->SetTitle(
"Electron Resolution");
865 TString(
_file0->GetName()) +
"_DrawPrototype3ShowerCalib_"
866 + TString(c1->GetName()), kTRUE);
874 TH1F * hbeam_mom =
new TH1F(
"hbeam_mom",
";beam momentum (GeV)", 32, .5,
878 TCanvas *c1 =
new TCanvas(
"GetBeamMom" +
cuts,
"GetBeamMom" +
cuts, 1800,
881 T->Draw(
"abs(info.beam_mom)>>hbeam_mom");
883 for (
int bin = 1; bin < hbeam_mom->GetNbinsX(); bin++)
885 if (hbeam_mom->GetBinContent(bin) > 40)
887 const double momentum = hbeam_mom->GetBinCenter(bin);
889 if (momentum == 1 || momentum == 2 || momentum == 3 || momentum == 4
890 || momentum == 6 || momentum == 8 || momentum == 12
891 || momentum == 16 || momentum == 24 || momentum == 32)
893 mom.push_back(momentum);
895 cout <<
"GetBeamMom - " << momentum <<
" GeV for "
896 << hbeam_mom->GetBinContent(bin) <<
" event" << endl;
902 TString(
_file0->GetName()) +
"_DrawPrototype3ShowerCalib_"
903 + TString(c1->GetName()), kTRUE);
909 GetResolution(TString cluster_name, vector<double> beam_mom, Color_t
col,TString e_sum =
"sum_E")
912 vector<double> mean_err;
914 vector<double> res_err;
916 TCanvas *c1 =
new TCanvas(
"GetResolution_LineShape_" + cluster_name +
cuts,
917 "GetResolution_LineShape_" + cluster_name +
cuts, 1800, 900);
923 for (
int i = 0;
i < beam_mom.size(); ++
i)
925 p = (TPad *) c1->cd(idx++);
928 const double momemtum = beam_mom[
i];
929 const TString histname = Form(
"hLineShape%.0fGeV_", momemtum)
932 TH1F *
h =
new TH1F(histname, histname +
";Observed energy (GeV)",
933 (momemtum <= 8 ? 25 : 50), momemtum / 2, momemtum * 1.5);
934 T->Draw(cluster_name +
"."+e_sum+
">>" + histname,
935 Form(
"abs(abs(info.beam_mom)-%f)/%f<.06", momemtum, momemtum));
939 TF1 * fgaus_g =
new TF1(
"fgaus_LG_g_" + cluster_name,
"gaus",
940 h->GetMean() - 1 * h->GetRMS(), h->GetMean() + 4 * h->GetRMS());
941 fgaus_g->SetParameters(1, h->GetMean() - 2 * h->GetRMS(),
942 h->GetMean() + 2 * h->GetRMS());
943 h->Fit(fgaus_g,
"MR0N");
945 TF1 * fgaus =
new TF1(
"fgaus_LG_" + cluster_name,
"gaus",
946 fgaus_g->GetParameter(1) - 3 * fgaus_g->GetParameter(2),
947 fgaus_g->GetParameter(1) + 3 * fgaus_g->GetParameter(2));
948 fgaus->SetParameters(fgaus_g->GetParameter(0), fgaus_g->GetParameter(1),
949 fgaus_g->GetParameter(2));
953 h->SetMarkerStyle(kFullCircle);
954 fgaus->SetLineWidth(2);
957 Form(
"%.0f GeV/c: #DeltaE/<E> = %.1f%%", momemtum,
958 100 * fgaus->GetParameter(2) / fgaus->GetParameter(1)));
960 mean.push_back(fgaus->GetParameter(1));
961 mean_err.push_back(fgaus->GetParError(1));
962 res.push_back(fgaus->GetParameter(2) / fgaus->GetParameter(1));
963 res_err.push_back(fgaus->GetParError(2) / fgaus->GetParameter(1));
968 TString(
_file0->GetName()) +
"_DrawPrototype3ShowerCalib_"
969 + TString(c1->GetName()), kTRUE);
971 TGraphErrors * ge_linear =
new TGraphErrors(beam_mom.size(), &beam_mom[0],
972 &mean[0], 0, &mean_err[0]);
974 TGraphErrors * ge_res =
new TGraphErrors(beam_mom.size(), &beam_mom[0],
975 &res[0], 0, &res_err[0]);
976 ge_res->GetHistogram()->SetStats(0);
980 ret.
name = cluster_name;
983 ret.
f_res =
new TF1(
"f_calo_r_" + cluster_name,
"sqrt([0]*[0]+[1]*[1]/x)/100",
985 ge_res->Fit(ret.
f_res,
"RM0QN");
987 ge_linear->SetLineColor(col);
988 ge_linear->SetMarkerColor(col);
989 ge_linear->SetLineWidth(2);
990 ge_linear->SetMarkerStyle(kFullCircle);
991 ge_linear->SetMarkerSize(1.5);
993 ge_res->SetLineColor(col);
994 ge_res->SetMarkerColor(col);
995 ge_res->SetLineWidth(2);
996 ge_res->SetMarkerStyle(kFullCircle);
997 ge_res->SetMarkerSize(1.5);
999 ge_res->GetHistogram()->SetStats(0);
1001 ret.
f_res->SetLineColor(col);
1002 ret.
f_res->SetLineWidth(3);
1011 TProfile * p2 = h2->ProfileX();
1019 for (
int i = 1;
i <= h2->GetNbinsX();
i++)
1021 TH1D *
h1 = h2->ProjectionY(Form(
"htmp_%d", rand()),
i,
i);
1023 if (h1->GetSum() < 30)
1025 cout <<
"FitProfile - ignore bin " <<
i << endl;
1030 cout <<
"FitProfile - fit bin " <<
i << endl;
1033 TF1 fgaus(
"fgaus",
"gaus", -p2->GetBinError(
i) * 4,
1034 p2->GetBinError(
i) * 4);
1036 TF1
f2(Form(
"dgaus"),
"gaus + [3]*exp(-0.5*((x-[1])/[4])**2) + [5]",
1037 -p2->GetBinError(
i) * 4, p2->GetBinError(
i) * 4);
1039 fgaus.SetParameter(1, p2->GetBinContent(
i));
1040 fgaus.SetParameter(2, p2->GetBinError(
i));
1042 h1->Fit(&fgaus,
"MQ");
1044 f2.SetParameters(fgaus.GetParameter(0) / 2, fgaus.GetParameter(1),
1045 fgaus.GetParameter(2), fgaus.GetParameter(0) / 2,
1046 fgaus.GetParameter(2) / 4, 0);
1055 x[
n] = p2->GetBinCenter(
i);
1056 ex[
n] = (p2->GetBinCenter(2) - p2->GetBinCenter(1)) / 2;
1057 y[
n] = fgaus.GetParameter(1);
1058 ey[
n] = fgaus.GetParError(1);
1067 return new TGraphErrors(n, x, y, ex, ey);