14 string inputfile =
"/sphenix/user/xusun/TestBeam/ShowerCalibAna/Proto4ShowerInfoRAW_0422.root";
15 TFile *File_InPut = TFile::Open(inputfile.c_str());
16 TH2F *h_mAsymmEnergy_pion_levl = (TH2F*)File_InPut->Get(
"h_mAsymmEnergy_pion_leveling");
17 TH1F *h_mEnergy_pion_levl = (TH1F*)h_mAsymmEnergy_pion_levl->ProjectionY()->Clone(
"h_mEnergy_pion_levl");
19 TCanvas *c_shower =
new TCanvas(
"c_shower",
"c_shower",1600,800);
20 c_shower->Divide(2,1);
21 for(
int i_pad = 0; i_pad < 2; ++i_pad)
23 c_shower->cd(i_pad+1);
24 c_shower->cd(i_pad+1)->SetLeftMargin(0.15);
25 c_shower->cd(i_pad+1)->SetBottomMargin(0.15);
26 c_shower->cd(i_pad+1)->SetTicks(1,1);
27 c_shower->cd(i_pad+1)->SetGrid(0,0);
30 string energy_cut =
"E_{in} > 1 MeV & E_{out} > 1 MeV && E > MIP+3#sigma";
33 h_mAsymmEnergy_pion_levl->SetStats(0);
34 h_mAsymmEnergy_pion_levl->SetTitle(energy_cut.c_str());
35 h_mAsymmEnergy_pion_levl->GetYaxis()->SetTitle(
"Energy (GeV)");
36 h_mAsymmEnergy_pion_levl->GetYaxis()->CenterTitle();
37 h_mAsymmEnergy_pion_levl->GetYaxis()->SetNdivisions(505);
38 h_mAsymmEnergy_pion_levl->GetXaxis()->SetTitle(
"E_{Asymm}");
39 h_mAsymmEnergy_pion_levl->GetXaxis()->CenterTitle();
40 h_mAsymmEnergy_pion_levl->Draw(
"colz");
42 TLegend *
leg =
new TLegend(0.35,0.7,0.75,0.85);
43 leg->SetBorderSize(0);
44 leg->SetFillColor(10);
45 leg->AddEntry(h_mAsymmEnergy_pion_levl,
"8 GeV",
"h");
49 h_mEnergy_pion_levl->SetStats(0);
50 h_mEnergy_pion_levl->SetTitle(
"8 GeV & #pi^{-}");
51 h_mEnergy_pion_levl->GetXaxis()->SetTitle(
"Energy (GeV)");
52 h_mEnergy_pion_levl->GetXaxis()->CenterTitle();
53 h_mEnergy_pion_levl->GetXaxis()->SetNdivisions(505);
54 h_mEnergy_pion_levl->Draw(
"hE");
56 TF1 *f_gaus =
new TF1(
"f_gaus",
"gaus",0,100);
57 f_gaus->SetParameter(0,1.0);
58 f_gaus->SetParameter(1,h_mEnergy_pion_levl->GetMean());
59 f_gaus->SetParameter(2,1.0);
60 f_gaus->SetRange(1.0,7.0);
61 h_mEnergy_pion_levl->Fit(f_gaus,
"NR");
63 float norm = f_gaus->GetParameter(0);
64 float mean = f_gaus->GetParameter(1);
65 float sigma = f_gaus->GetParameter(2);
66 f_gaus->SetParameter(0,norm);
67 f_gaus->SetParameter(1,mean);
68 f_gaus->SetParameter(2,sigma);
69 f_gaus->SetRange(mean-3.0*sigma,mean+3.0*sigma);
71 h_mEnergy_pion_levl->Fit(f_gaus,
"MNR");
72 float energy_twrcalib = f_gaus->GetParameter(1);
74 f_gaus->SetLineColor(2);
75 f_gaus->SetLineStyle(2);
76 f_gaus->SetLineWidth(2);
77 f_gaus->Draw(
"l same");
79 const float showercalib = 8.0/energy_twrcalib;
80 cout <<
"showercalib = " << showercalib << endl;
82 ofstream File_OutPut(
"showercalib.txt");
83 File_OutPut <<
"8 GeV: showercalib = " << showercalib << endl;