17 #include <TGraphErrors.h>
34 TGraphErrors * linearity;
35 TGraphErrors * resolution;
59 "/phenix/u/jinhuang/links/sPHENIX_work/Prototype_2017/sim/EMCalOnly_0Tilt_FlatLightCollection/Prototype_e-_ALL_SegA_ALL_EMCalCalib.root"
64 gStyle->SetOptStat(0);
65 gStyle->SetOptFit(1111);
66 gStyle->SetPadGridX(0);
67 gStyle->SetPadGridY(0);
68 TVirtualFitter::SetDefaultFitter(
"Minuit2");
70 gSystem->Load(
"libPrototype2.so");
71 gSystem->Load(
"libProto2ShowCalib.so");
77 TString chian_str =
infile;
78 chian_str.ReplaceAll(
"ALL",
"*");
80 TChain *
t =
new TChain(
"T");
81 const int n = t->Add(chian_str);
83 cout <<
"Loaded " << n <<
" root files with " << chian_str << endl;
164 T->SetAlias(
"SimEnergyScale",
"1*1");
177 cout <<
"Build event selection of " << (
const char *)
event_sel << endl;
180 TEventList * elist = gDirectory->GetObjectChecked(
"EventList",
"TEventList");
181 cout << elist->GetN() <<
" / " <<
T->GetEntriesFast() <<
" events selected"
184 T->SetEventList(elist);
209 const double z_shift = 0,
const int n_div = 1)
211 TH3F * EnergySum_LG3 =
212 new TH3F(
"EnergySum_LG3",
213 ";Horizontal Hodoscope (5 mm);Vertical Hodoscope (5 mm);5x5 Cluster Energy (GeV)",
218 T->Draw(sTOWER +
":7-hodo_v:hodo_h>>EnergySum_LG3",
"",
"goff");
220 TProfile2D * EnergySum_LG3_xy = EnergySum_LG3->Project3DProfile(
"yx");
221 TH2 * EnergySum_LG3_zx = EnergySum_LG3->Project3D(
"zx");
222 TH2 * EnergySum_LG3_zy = EnergySum_LG3->Project3D(
"zy");
224 TGraphErrors * ge_EnergySum_LG3_zx =
FitProfile(EnergySum_LG3_zx);
225 TGraphErrors * ge_EnergySum_LG3_zy =
FitProfile(EnergySum_LG3_zy);
228 TCanvas *c1 =
new TCanvas(
229 TString(Form(
"EMCDistributionVSBeam_SUM_NDiv%d_", n_div)) + sTOWER +
cuts,
230 TString(Form(
"EMCDistributionVSBeam_SUM_NDiv%d_", n_div)) + sTOWER +
cuts,
236 p = (TPad *) c1->cd(idx++);
242 EnergySum_LG3_xy->Draw(
"colz");
243 EnergySum_LG3_xy->SetTitle(
244 "Position scan;Horizontal Hodoscope (5 mm);Vertical Hodoscope (5 mm)");
246 p = (TPad *) c1->cd(idx++);
252 EnergySum_LG3_zx->Draw(
"colz");
253 EnergySum_LG3_zx->SetTitle(
254 "Position scan;Horizontal Hodoscope (5 mm);5x5 Cluster Energy (GeV)");
256 ge_EnergySum_LG3_zx->SetLineWidth(2);
257 ge_EnergySum_LG3_zx->SetMarkerStyle(kFullCircle);
258 ge_EnergySum_LG3_zx->Draw(
"pe");
260 p = (TPad *) c1->cd(idx++);
266 EnergySum_LG3_zy->Draw(
"colz");
267 EnergySum_LG3_zy->SetTitle(
268 "Position scan;Vertical Hodoscope (5 mm);5x5 Cluster Energy (GeV)");
270 ge_EnergySum_LG3_zy->SetLineWidth(2);
271 ge_EnergySum_LG3_zy->SetMarkerStyle(kFullCircle);
272 ge_EnergySum_LG3_zy->Draw(
"pe");
274 p = (TPad *) c1->cd(idx++);
280 TH1 *
h = (TH1 *) EnergySum_LG3->ProjectionZ();
282 TF1 * fgaus =
new TF1(
"fgaus_LG",
"gaus", 0, 100);
283 fgaus->SetParameters(1, h->GetMean() - 2 * h->GetRMS(),
284 h->GetMean() + 2 * h->GetRMS());
288 h->GetXaxis()->SetRangeUser(h->GetMean() - 4 * h->GetRMS(),
289 h->GetMean() + 4 * h->GetRMS());
290 EnergySum_LG3_zx->GetYaxis()->SetRangeUser(h->GetMean() - 4 * h->GetRMS(),
291 h->GetMean() + 4 * h->GetRMS());
292 EnergySum_LG3_zy->GetYaxis()->SetRangeUser(h->GetMean() - 4 * h->GetRMS(),
293 h->GetMean() + 4 * h->GetRMS());
296 h->SetMarkerStyle(kFullCircle);
299 Form(
"#DeltaE/<E> = %.1f%%",
300 100 * fgaus->GetParameter(2) / fgaus->GetParameter(1)));
303 TString(
_file0->GetName()) + TString(
"_DrawPrototype2ShowerCalib_")
304 + TString(c1->GetName()), kTRUE);
309 const double z_shift = 0,
const int n_div = 1)
311 TH3F * EnergySum_LG3 =
312 new TH3F(
"EnergySum_LG3",
313 ";Beam Horizontal Pos (cm);Beam Vertical Pos (cm);5x5 Cluster Energy (GeV)",
314 20 * n_div, z_shift - 5, z_shift + 5,
318 T->Draw(sTOWER +
":info.truth_y:info.truth_z>>EnergySum_LG3",
"",
"goff");
320 TProfile2D * EnergySum_LG3_xy = EnergySum_LG3->Project3DProfile(
"yx");
321 TH2 * EnergySum_LG3_zx = EnergySum_LG3->Project3D(
"zx");
322 TH2 * EnergySum_LG3_zy = EnergySum_LG3->Project3D(
"zy");
324 TGraphErrors * ge_EnergySum_LG3_zx =
FitProfile(EnergySum_LG3_zx);
325 TGraphErrors * ge_EnergySum_LG3_zy =
FitProfile(EnergySum_LG3_zy);
328 TCanvas *c1 =
new TCanvas(
329 TString(Form(
"EMCDistributionVSBeam_SUM_NDiv%d_", n_div)) + sTOWER +
cuts,
330 TString(Form(
"EMCDistributionVSBeam_SUM_NDiv%d_", n_div)) + sTOWER +
cuts,
336 p = (TPad *) c1->cd(idx++);
342 EnergySum_LG3_xy->Draw(
"colz");
343 EnergySum_LG3_xy->SetTitle(
344 "Position scan;Beam Horizontal Pos (cm);Beam Vertical Pos (cm)");
346 p = (TPad *) c1->cd(idx++);
352 EnergySum_LG3_zx->Draw(
"colz");
353 EnergySum_LG3_zx->SetTitle(
354 "Position scan;Beam Horizontal Pos (cm);5x5 Cluster Energy (GeV)");
356 ge_EnergySum_LG3_zx->SetLineWidth(2);
357 ge_EnergySum_LG3_zx->SetMarkerStyle(kFullCircle);
358 ge_EnergySum_LG3_zx->Draw(
"pe");
360 p = (TPad *) c1->cd(idx++);
366 EnergySum_LG3_zy->Draw(
"colz");
367 EnergySum_LG3_zy->SetTitle(
368 "Position scan;Beam Vertical Pos (cm);5x5 Cluster Energy (GeV)");
370 ge_EnergySum_LG3_zy->SetLineWidth(2);
371 ge_EnergySum_LG3_zy->SetMarkerStyle(kFullCircle);
372 ge_EnergySum_LG3_zy->Draw(
"pe");
374 p = (TPad *) c1->cd(idx++);
380 TH1 *
h = (TH1 *) EnergySum_LG3->ProjectionZ();
382 TF1 * fgaus =
new TF1(
"fgaus_LG",
"gaus", 0, 100);
383 fgaus->SetParameters(1, h->GetMean() - 2 * h->GetRMS(),
384 h->GetMean() + 2 * h->GetRMS());
388 h->GetXaxis()->SetRangeUser(h->GetMean() - 4 * h->GetRMS(),
389 h->GetMean() + 4 * h->GetRMS());
390 EnergySum_LG3_zx->GetYaxis()->SetRangeUser(h->GetMean() - 4 * h->GetRMS(),
391 h->GetMean() + 4 * h->GetRMS());
392 EnergySum_LG3_zy->GetYaxis()->SetRangeUser(h->GetMean() - 4 * h->GetRMS(),
393 h->GetMean() + 4 * h->GetRMS());
396 h->SetMarkerStyle(kFullCircle);
399 Form(
"#DeltaE/<E> = %.1f%%",
400 100 * fgaus->GetParameter(2) / fgaus->GetParameter(1)));
403 TString(
_file0->GetName()) + TString(
"_DrawPrototype2ShowerCalib_")
404 + TString(c1->GetName()), kTRUE);
409 "(info.C2_sum)>500 && (info.C2_sum)<1300")
415 TCanvas *c1 =
new TCanvas(
"LineShapeData" +
cuts,
"LineShapeData" +
cuts,
422 p = (TPad *) c1->cd(idx++);
428 T->Draw(
"info.C2_sum>>h_c2_sum(300,-500,2500)");
429 h_c2_sum->SetTitle(
"Cherenkov Checks;Sum C2 (ADC)");
430 T->Draw(
"info.C2_sum>>h_c2_h(300,-500,2500)", c2_h,
"same");
431 T->Draw(
"info.C2_sum>>h_c2_e(300,-500,2500)", c2_e,
"same");
433 h_c2_h->SetLineColor(kBlue);
434 h_c2_e->SetLineColor(kRed);
436 h_c2_sum->SetLineWidth(2);
437 h_c2_h->SetLineWidth(2);
438 h_c2_e->SetLineWidth(2);
440 p = (TPad *) c1->cd(idx++);
444 T->Draw(
"clus_5x5_recalib.sum_E>>h_5x5sum_c2_sum(170,-1,16)");
445 h_5x5sum_c2_sum->SetTitle(
446 "Cluster spectrum decomposition;5x5 cluster energy (GeV)");
447 T->Draw(
"clus_5x5_recalib.sum_E>>h_5x5sum_c2_h(170,-1,16)", c2_h,
"same");
448 T->Draw(
"clus_5x5_recalib.sum_E>>h_5x5sum_c2_rej_h(170,-1,16)", !c2_h,
450 T->Draw(
"clus_5x5_recalib.sum_E>>h_5x5sum_c2_e(170,-1,16)", c2_e,
"same");
452 h_5x5sum_c2_h->SetLineColor(kBlue);
453 h_5x5sum_c2_rej_h->SetLineColor(kMagenta);
454 h_5x5sum_c2_e->SetLineColor(kRed);
456 h_5x5sum_c2_sum->SetLineWidth(2);
457 h_5x5sum_c2_h->SetLineWidth(2);
458 h_5x5sum_c2_rej_h->SetLineWidth(2);
459 h_5x5sum_c2_e->SetLineWidth(2);
461 p = (TPad *) c1->cd(idx++);
465 TH1 * h_5x5sum_c2_h2 = h_5x5sum_c2_h->DrawClone();
466 h_5x5sum_c2_h2->Sumw2();
467 h_5x5sum_c2_h2->SetMarkerColor(kBlue);
468 h_5x5sum_c2_h2->SetMarkerStyle(kFullCircle);
469 h_5x5sum_c2_h2->SetTitle(
";5x5 cluster energy (GeV)");
471 TH1 * h_5x5sum_c2_e2 = h_5x5sum_c2_e->DrawClone(
"same");
472 h_5x5sum_c2_e2->Sumw2();
473 h_5x5sum_c2_e2->SetMarkerColor(kRed);
474 h_5x5sum_c2_e2->SetMarkerStyle(kFullCircle);
475 h_5x5sum_c2_e2->SetTitle(
";5x5 cluster energy (GeV)");
477 p = (TPad *) c1->cd(idx++);
481 TH1F * h_5x5sum_c2_h3 = h_5x5sum_c2_h->DrawClone();
482 h_5x5sum_c2_h3->SetName(
"h_5x5sum_c2_h3");
483 h_5x5sum_c2_h3->Sumw2();
484 h_5x5sum_c2_h3->Scale(1. / h_5x5sum_c2_h3->GetSum());
485 h_5x5sum_c2_h3->SetMarkerColor(kBlue);
486 h_5x5sum_c2_h3->SetMarkerStyle(kFullCircle);
487 h_5x5sum_c2_h3->SetTitle(
";5x5 cluster energy (GeV);Probability / bin");
490 TString(
_file0->GetName()) +
"_DrawPrototype2ShowerCalib_"
491 + TString(c1->GetName()), kTRUE);
500 TCanvas *c1 =
new TCanvas(
"LineShapeSim" +
cuts,
"LineShapeSim" +
cuts, 1000,
507 p = (TPad *) c1->cd(idx++);
511 T->Draw(
"clus_5x5_prod.sum_E*SimEnergyScale>>h_5x5sum_c2_sum(170,-1,16)");
512 h_5x5sum_c2_sum->SetTitle(
513 "Cluster spectrum decomposition;5x5 cluster energy (GeV)");
514 h_5x5sum_c2_sum->SetLineWidth(2);
517 TString(
_file0->GetName()) +
"_DrawPrototype2ShowerCalib_"
518 + TString(c1->GetName()), kTRUE);
528 TCanvas *c1 =
new TCanvas(
"HodoscopeCheck" +
cuts,
"HodoscopeCheck" +
cuts,
535 p = (TPad *) c1->cd(idx++);
541 T->Draw(
"clus_5x5_prod.average_col:hodo_h>>h2_h(8,-.5,7.5,160,-.5,7.5)",
542 "good_data",
"colz");
544 "Horizontal hodoscope check;Horizontal Hodoscope;5x5 cluster mean col");
546 p = (TPad *) c1->cd(idx++);
552 T->Draw(
"clus_5x5_prod.average_row:hodo_v>>h2_v(8,-.5,7.5,160,-.5,7.5)",
553 "good_data",
"colz");
555 "Vertical hodoscope check;Vertical Hodoscope;5x5 cluster mean row");
558 TString(
_file0->GetName()) +
"_DrawPrototype2ShowerCalib_"
559 + TString(c1->GetName()), kTRUE);
570 TCanvas *c1 =
new TCanvas(
"SimPositionCheck" +
cuts,
571 "SimPositionCheck" +
cuts, 1300, 950);
577 p = (TPad *) c1->cd(idx++);
584 Form(
"clus_5x5_prod.average_col:truth_z>>h2_h(30,%f,%f,160,-.5,7.5)",
585 shift_z - 1.5, shift_z + 1.5),
"1",
"colz");
587 "Horizontal hodoscope check;Horizontal beam pos;5x5 cluster mean col");
589 p = (TPad *) c1->cd(idx++);
595 T->Draw(
"clus_5x5_prod.average_row:truth_y>>h2_v(30,-1.5,1.5,160,-.5,7.5)",
598 "Vertical hodoscope check;Vertical beam pos;5x5 cluster mean row");
601 TString(
_file0->GetName()) +
"_DrawPrototype2ShowerCalib_"
602 + TString(c1->GetName()), kTRUE);
623 TCanvas *c1 =
new TCanvas(Form(
"Res_linear") +
cuts,
624 Form(
"Res_linear") +
cuts, 1300, 600);
629 p = (TPad *) c1->cd(idx++);
633 TLegend*
leg =
new TLegend(.15, .7, .6, .85);
635 p->DrawFrame(0, 0, 25, 25,
636 Form(
"Electron Linearity;Input energy (GeV);Measured Energy (GeV)"));
637 TLine * l =
new TLine(0, 0, 25, 25);
638 l->SetLineColor(kGray);
641 TF1 * f_calo_l_sim =
new TF1(
"f_calo_l",
"pol2", 0.5, 25);
643 f_calo_l_sim->SetParameters(-0., 1, -0.);
645 f_calo_l_sim->SetLineColor(kGreen + 2);
646 f_calo_l_sim->SetLineWidth(3);
648 f_calo_l_sim->Draw(
"same");
652 ges_clus_5x5_recalib.
linearity->Draw(
"p");
656 leg->AddEntry(ges_clus_5x5_prod.
linearity, ges_clus_5x5_prod.
name,
"ep");
657 leg->AddEntry(ges_clus_3x3_prod.
linearity, ges_clus_3x3_prod.
name,
"ep");
658 leg->AddEntry(ges_clus_5x5_temp.
linearity, ges_clus_5x5_temp.
name,
"ep");
659 leg->AddEntry(ges_clus_5x5_recalib.
linearity,
"clus_5x5_recalib",
"ep");
660 leg->AddEntry(f_calo_l_sim,
"Unity",
"l");
663 p = (TPad *) c1->cd(idx++);
669 TF1 * f_calo_sim =
new TF1(
"f_calo_sim",
"sqrt([0]*[0]+[1]*[1]/x)/100", 0.5,
671 f_calo_sim->SetParameters(2.4, 11.8);
672 f_calo_sim->SetLineWidth(3);
673 f_calo_sim->SetLineColor(kGreen + 2);
675 TH1 * hframe = p->DrawFrame(0, 0, 25, 0.3,
676 Form(
"Resolution;Input energy (GeV);#DeltaE/<E>"));
678 TLegend* leg =
new TLegend(.2, .6, .85, .9);
680 ges_clus_5x5_prod.
f_res->Draw(
"same");
682 ges_clus_3x3_prod.
f_res->Draw(
"same");
684 ges_clus_5x5_temp.
f_res->Draw(
"same");
686 ges_clus_5x5_recalib.
f_res->Draw(
"same");
688 f_calo_sim->Draw(
"same");
690 leg->AddEntry(ges_clus_5x5_prod.
resolution, ges_clus_5x5_prod.
name,
"ep");
691 leg->AddEntry(ges_clus_5x5_prod.
f_res,
692 Form(
"#DeltaE/E = %.1f%% #oplus %.1f%%/#sqrt{E}",
693 ges_clus_5x5_prod.
f_res->GetParameter(0),
694 ges_clus_5x5_prod.
f_res->GetParameter(1)),
"l");
696 leg->AddEntry(ges_clus_3x3_prod.
resolution, ges_clus_3x3_prod.
name,
"ep");
697 leg->AddEntry(ges_clus_3x3_prod.
f_res,
698 Form(
"#DeltaE/E = %.1f%% #oplus %.1f%%/#sqrt{E}",
699 ges_clus_3x3_prod.
f_res->GetParameter(0),
700 ges_clus_3x3_prod.
f_res->GetParameter(1)),
"l");
702 leg->AddEntry(ges_clus_5x5_temp.
resolution, ges_clus_5x5_temp.
name,
"ep");
703 leg->AddEntry(ges_clus_5x5_temp.
f_res,
704 Form(
"#DeltaE/E = %.1f%% #oplus %.1f%%/#sqrt{E}",
705 ges_clus_5x5_temp.
f_res->GetParameter(0),
706 ges_clus_5x5_temp.
f_res->GetParameter(1)),
"l");
708 leg->AddEntry(ges_clus_5x5_recalib.
resolution,
"clus_5x5_recalib",
"ep");
709 leg->AddEntry(ges_clus_5x5_recalib.
f_res,
710 Form(
"#DeltaE/E = %.1f%% #oplus %.1f%%/#sqrt{E}",
711 ges_clus_5x5_recalib.
f_res->GetParameter(0),
712 ges_clus_5x5_recalib.
f_res->GetParameter(1)),
"l");
718 TLegend* leg =
new TLegend(.2, .1, .85, .3);
720 leg->AddEntry(f_calo_sim,
721 Form(
"Prelim. Sim., #DeltaE/E = %.1f%% #oplus %.1f%%/#sqrt{E}",
722 f_calo_sim->GetParameter(0), f_calo_sim->GetParameter(1)),
"l");
725 hframe->SetTitle(
"Electron Resolution");
728 TString(
_file0->GetName()) +
"_DrawPrototype2ShowerCalib_"
729 + TString(c1->GetName()), kTRUE);
744 TCanvas *c1 =
new TCanvas(Form(
"Res_linear") +
cuts,
745 Form(
"Res_linear") +
cuts, 1300, 600);
750 p = (TPad *) c1->cd(idx++);
754 TLegend*
leg =
new TLegend(.15, .7, .6, .85);
756 p->DrawFrame(0, 0, 25, 25,
757 Form(
"Electron Linearity;Input energy (GeV);Measured Energy (GeV)"));
758 TLine * l =
new TLine(0, 0, 25, 25);
759 l->SetLineColor(kGray);
762 TF1 * f_calo_l_sim =
new TF1(
"f_calo_l",
"pol2", 0.5, 25);
764 f_calo_l_sim->SetParameters(-0., 1, -0.);
766 f_calo_l_sim->SetLineColor(kGreen + 2);
767 f_calo_l_sim->SetLineWidth(3);
769 f_calo_l_sim->Draw(
"same");
775 leg->AddEntry(ges_clus_5x5_prod.
linearity, ges_clus_5x5_prod.
name,
"ep");
776 leg->AddEntry(ges_clus_3x3_prod.
linearity, ges_clus_3x3_prod.
name,
"ep");
777 leg->AddEntry(f_calo_l_sim,
"Unity",
"l");
780 p = (TPad *) c1->cd(idx++);
786 TF1 * f_calo_sim =
new TF1(
"f_calo_sim",
"sqrt([0]*[0]+[1]*[1]/x)/100", 0.5,
788 f_calo_sim->SetParameters(2.4, 11.8);
789 f_calo_sim->SetLineWidth(3);
790 f_calo_sim->SetLineColor(kGreen + 2);
792 TH1 * hframe = p->DrawFrame(0, 0, 25, 0.3,
793 Form(
"Resolution;Input energy (GeV);#DeltaE/<E>"));
795 TLegend* leg =
new TLegend(.2, .6, .85, .9);
797 ges_clus_5x5_prod.
f_res->Draw(
"same");
799 ges_clus_3x3_prod.
f_res->Draw(
"same");
801 f_calo_sim->Draw(
"same");
803 leg->AddEntry(ges_clus_5x5_prod.
resolution, ges_clus_5x5_prod.
name,
"ep");
804 leg->AddEntry(ges_clus_5x5_prod.
f_res,
805 Form(
"#DeltaE/E = %.1f%% #oplus %.1f%%/#sqrt{E}",
806 ges_clus_5x5_prod.
f_res->GetParameter(0),
807 ges_clus_5x5_prod.
f_res->GetParameter(1)),
"l");
809 leg->AddEntry(ges_clus_3x3_prod.
resolution, ges_clus_3x3_prod.
name,
"ep");
810 leg->AddEntry(ges_clus_3x3_prod.
f_res,
811 Form(
"#DeltaE/E = %.1f%% #oplus %.1f%%/#sqrt{E}",
812 ges_clus_3x3_prod.
f_res->GetParameter(0),
813 ges_clus_3x3_prod.
f_res->GetParameter(1)),
"l");
820 TLegend* leg =
new TLegend(.2, .1, .85, .3);
822 leg->AddEntry(f_calo_sim,
823 Form(
"Prelim. Sim., #DeltaE/E = %.1f%% #oplus %.1f%%/#sqrt{E}",
824 f_calo_sim->GetParameter(0), f_calo_sim->GetParameter(1)),
"l");
827 hframe->SetTitle(
"Electron Resolution");
830 TString(
_file0->GetName()) +
"_DrawPrototype2ShowerCalib_"
831 + TString(c1->GetName()), kTRUE);
839 TH1F * hbeam_mom =
new TH1F(
"hbeam_mom",
";beam momentum (GeV)", 32, .5,
843 TCanvas *c1 =
new TCanvas(
"GetBeamMom" +
cuts,
"GetBeamMom" +
cuts, 1800,
846 T->Draw(
"abs(info.beam_mom)>>hbeam_mom");
848 for (
int bin = 1; bin < hbeam_mom->GetNbinsX(); bin++)
850 if (hbeam_mom->GetBinContent(bin) > 50)
852 const double momentum = hbeam_mom->GetBinCenter(bin);
854 if (momentum == 1 || momentum == 2 || momentum == 3 || momentum == 4
855 || momentum == 6 || momentum == 8 || momentum == 12
856 || momentum == 16 || momentum == 24 || momentum == 32)
858 mom.push_back(momentum);
860 cout <<
"GetBeamMom - " << momentum <<
" GeV for "
861 << hbeam_mom->GetBinContent(bin) <<
" event" << endl;
867 TString(
_file0->GetName()) +
"_DrawPrototype2ShowerCalib_"
868 + TString(c1->GetName()), kTRUE);
877 vector<double> mean_err;
879 vector<double> res_err;
881 TCanvas *c1 =
new TCanvas(
"GetResolution_LineShape_" + cluster_name +
cuts,
882 "GetResolution_LineShape_" + cluster_name +
cuts, 1800, 900);
888 for (
int i = 0;
i < beam_mom.size(); ++
i)
890 p = (TPad *) c1->cd(idx++);
893 const double momemtum = beam_mom[
i];
894 const TString histname = Form(
"hLineShape%.0fGeV", momemtum);
896 TH1F *
h =
new TH1F(histname, histname +
";Observed energy (GeV)",
897 (momemtum <= 6 ? 25 : 50), momemtum / 2, momemtum * 1.5);
898 T->Draw(cluster_name +
".sum_E>>" + histname,
899 Form(
"abs(abs(info.beam_mom)-%f)/%f<.06", momemtum, momemtum));
903 TF1 * fgaus_g =
new TF1(
"fgaus_LG_g",
"gaus",
904 h->GetMean() - 1 * h->GetRMS(), h->GetMean() + 4 * h->GetRMS());
905 fgaus_g->SetParameters(1, h->GetMean() - 2 * h->GetRMS(),
906 h->GetMean() + 2 * h->GetRMS());
907 h->Fit(fgaus_g,
"MR0N");
909 TF1 * fgaus =
new TF1(
"fgaus_LG",
"gaus",
910 fgaus_g->GetParameter(1) - 2 * fgaus_g->GetParameter(2),
911 fgaus_g->GetParameter(1) + 2 * fgaus_g->GetParameter(2));
912 fgaus->SetParameters(fgaus_g->GetParameter(0), fgaus_g->GetParameter(1),
913 fgaus_g->GetParameter(2));
917 h->SetMarkerStyle(kFullCircle);
918 fgaus->SetLineWidth(2);
921 Form(
"%.0f GeV/c: #DeltaE/<E> = %.1f%%", momemtum,
922 100 * fgaus->GetParameter(2) / fgaus->GetParameter(1)));
924 mean.push_back(fgaus->GetParameter(1));
925 mean_err.push_back(fgaus->GetParError(1));
926 res.push_back(fgaus->GetParameter(2) / fgaus->GetParameter(1));
927 res_err.push_back(fgaus->GetParError(2) / fgaus->GetParameter(1));
932 TString(
_file0->GetName()) +
"_DrawPrototype2ShowerCalib_"
933 + TString(c1->GetName()), kTRUE);
935 TGraphErrors * ge_linear =
new TGraphErrors(beam_mom.size(), &beam_mom[0],
936 &mean[0], 0, &mean_err[0]);
938 TGraphErrors * ge_res =
new TGraphErrors(beam_mom.size(), &beam_mom[0],
939 &res[0], 0, &res_err[0]);
940 ge_res->GetHistogram()->SetStats(0);
944 ret.
name = cluster_name;
947 ret.
f_res =
new TF1(
"f_calo_r",
"sqrt([0]*[0]+[1]*[1]/x)/100", 0.5, 25);
948 ge_res->Fit(ret.
f_res,
"RM0QN");
950 ge_linear->SetLineColor(col);
951 ge_linear->SetMarkerColor(col);
952 ge_linear->SetLineWidth(2);
953 ge_linear->SetMarkerStyle(kFullCircle);
954 ge_linear->SetMarkerSize(1.5);
956 ge_res->SetLineColor(col);
957 ge_res->SetMarkerColor(col);
958 ge_res->SetLineWidth(2);
959 ge_res->SetMarkerStyle(kFullCircle);
960 ge_res->SetMarkerSize(1.5);
962 ge_res->GetHistogram()->SetStats(0);
964 ret.
f_res->SetLineColor(col);
965 ret.
f_res->SetLineWidth(3);
974 TProfile * p2 = h2->ProfileX();
982 for (
int i = 1;
i <= h2->GetNbinsX();
i++)
984 TH1D *
h1 = h2->ProjectionY(Form(
"htmp_%d", rand()),
i,
i);
986 if (h1->GetSum() < 30)
988 cout <<
"FitProfile - ignore bin " <<
i << endl;
993 cout <<
"FitProfile - fit bin " <<
i << endl;
996 TF1 fgaus(
"fgaus",
"gaus", -p2->GetBinError(
i) * 4,
997 p2->GetBinError(
i) * 4);
999 TF1
f2(Form(
"dgaus"),
"gaus + [3]*exp(-0.5*((x-[1])/[4])**2) + [5]",
1000 -p2->GetBinError(
i) * 4, p2->GetBinError(
i) * 4);
1002 fgaus.SetParameter(1, p2->GetBinContent(
i));
1003 fgaus.SetParameter(2, p2->GetBinError(
i));
1005 h1->Fit(&fgaus,
"MQ");
1007 f2.SetParameters(fgaus.GetParameter(0) / 2, fgaus.GetParameter(1),
1008 fgaus.GetParameter(2), fgaus.GetParameter(0) / 2,
1009 fgaus.GetParameter(2) / 4, 0);
1018 x[
n] = p2->GetBinCenter(
i);
1019 ex[
n] = (p2->GetBinCenter(2) - p2->GetBinCenter(1)) / 2;
1020 y[
n] = fgaus.GetParameter(1);
1021 ey[
n] = fgaus.GetParError(1);
1030 return new TGraphErrors(n, x, y, ex, ey);