13 TFile *File_InPut_HCALIN = TFile::Open(
"/sphenix/user/xusun/software/data/beam/SampleFrac/Proto4SampleFrac_HCALIN.root");
14 TH1F *h_sf_in = (TH1F*)File_InPut_HCALIN->Get(
"h_QAG4Sim_HCALIN_G4Hit_SF");
15 TH2F *h_mCal_in = (TH2F*)File_InPut_HCALIN->Get(
"h_QAG4Sim_HCALIN_G4Hit_XY_cal");
16 TH2F *h_mAbs_in = (TH2F*)File_InPut_HCALIN->Get(
"h_QAG4Sim_HCALIN_G4Hit_XY_abs");
18 TFile *File_InPut_HCALOUT = TFile::Open(
"/sphenix/user/xusun/software/data/beam/SampleFrac/Proto4SampleFrac_HCALOUT.root");
19 TH1F *h_sf_out = (TH1F*)File_InPut_HCALOUT->Get(
"h_QAG4Sim_HCALOUT_G4Hit_SF");
20 TH2F *h_mCal_out = (TH2F*)File_InPut_HCALOUT->Get(
"h_QAG4Sim_HCALOUT_G4Hit_XY_cal");
21 TH2F *h_mAbs_out = (TH2F*)File_InPut_HCALOUT->Get(
"h_QAG4Sim_HCALOUT_G4Hit_XY_abs");
23 TH1F *h_play =
new TH1F(
"h_play",
"h_play",500,0,500);
24 for(
int i_bin = 0; i_bin < 500; ++i_bin)
26 h_play->SetBinContent(i_bin+1,-10000.0);
27 h_play->SetBinError(i_bin+1,1.0);
31 h_play->GetYaxis()->SetRangeUser(-100,100);
32 h_play->GetXaxis()->SetRangeUser(50,350);
34 TCanvas *c_cal_in =
new TCanvas(
"c_cal",
"c_cal",10,10,1000,1000);
36 for(
int i_pad = 0; i_pad < 4; ++i_pad)
38 c_cal->cd(i_pad+1)->SetLeftMargin(0.15);
39 c_cal->cd(i_pad+1)->SetBottomMargin(0.15);
40 c_cal->cd(i_pad+1)->SetGrid(0,0);
41 c_cal->cd(i_pad+1)->SetTicks(1,1);
45 h_play->SetTitle(
"HCALIN Cal G4Hit Display");
46 h_play->DrawCopy(
"pE");
47 h_mCal_in->Draw(
"colz same");
50 h_play->SetTitle(
"HCALOUT Cal G4Hit Display");
51 h_play->DrawCopy(
"pE");
52 h_mCal_out->Draw(
"colz same");
55 h_play->SetTitle(
"HCALIN Abs G4Hit Display");
56 h_play->DrawCopy(
"pE");
57 h_mAbs_in->Draw(
"colz same");
60 h_play->SetTitle(
"HCALOUT Abs G4Hit Display");
61 h_play->DrawCopy(
"pE");
62 h_mAbs_out->Draw(
"colz same");
64 c_cal->SaveAs(
"./figures/sPHENIX_CollMeeting/c_G4HitDisplay.eps");
68 TCanvas *c_play =
new TCanvas(
"c_play",
"c_play",10,10,1600,800);
70 for(
int i_pad = 0; i_pad < 2; ++i_pad)
72 c_play->cd(i_pad+1)->SetLeftMargin(0.15);
73 c_play->cd(i_pad+1)->SetBottomMargin(0.15);
74 c_play->cd(i_pad+1)->SetGrid(0,0);
75 c_play->cd(i_pad+1)->SetTicks(1,1);
79 h_sf_in->GetXaxis()->SetRangeUser(0.0,0.3);
81 TF1 *f_sf_in =
new TF1(
"f_sf_in",
"gaus",0.0,0.3);
82 f_sf_in->SetParameter(0,100);
83 f_sf_in->SetParameter(1,0.1);
84 f_sf_in->SetParameter(2,0.1);
85 f_sf_in->SetRange(0.0,0.3);
86 h_sf_in->Fit(f_sf_in,
"NR");
88 float mean_sf_in = f_sf_in->GetParameter(1);
89 float sigma_sf_in = f_sf_in->GetParameter(2);
90 f_sf_in->SetParameter(0,100);
91 f_sf_in->SetParameter(1,mean_sf_in);
92 f_sf_in->SetParameter(2,sigma_sf_in);
93 f_sf_in->SetRange(mean_sf_in-nSigma*sigma_sf_in,mean_sf_in+nSigma*sigma_sf_in);
94 h_sf_in->Fit(f_sf_in,
"R");
95 float sf_in = f_sf_in->GetParameter(1);
97 std::string label_sf_in = Form(
"inner sf: %1.4f",sf_in);
98 TLegend *leg_in =
new TLegend(0.5,0.5,0.9,0.8);
99 leg_in->SetFillColor(0);
100 leg_in->SetBorderSize(0);
101 leg_in->AddEntry(f_sf_in,label_sf_in.c_str(),
"L");
102 leg_in->Draw(
"same");
105 h_sf_out->GetXaxis()->SetRangeUser(0.0,0.3);
106 h_sf_out->Draw(
"hE");
107 TF1 *f_sf_out =
new TF1(
"f_sf_out",
"gaus",0.0,0.3);
108 f_sf_out->SetParameter(0,100);
109 f_sf_out->SetParameter(1,0.03);
110 f_sf_out->SetParameter(2,0.03);
111 f_sf_out->SetRange(0.0,0.3);
112 h_sf_out->Fit(f_sf_out,
"NR");
113 float mean_sf_out = f_sf_out->GetParameter(1);
114 float sigma_sf_out = f_sf_out->GetParameter(2);
115 f_sf_out->SetParameter(0,100);
116 f_sf_out->SetParameter(1,mean_sf_out);
117 f_sf_out->SetParameter(2,sigma_sf_out);
118 f_sf_out->SetRange(mean_sf_out-nSigma*sigma_sf_out,mean_sf_out+nSigma*sigma_sf_out);
119 h_sf_out->Fit(f_sf_out,
"R");
120 float sf_out = f_sf_out->GetParameter(1);
122 std::string label_sf_out = Form(
"outer sf: %1.4f",sf_out);
123 TLegend *leg_out =
new TLegend(0.4,0.5,0.8,0.8);
124 leg_out->SetFillColor(0);
125 leg_out->SetBorderSize(0);
126 leg_out->AddEntry(f_sf_out,label_sf_out.c_str(),
"L");
127 leg_out->Draw(
"same");
129 c_play->SaveAs(
"./figures/sPHENIX_CollMeeting/c_sf.eps");
131 ofstream File_OutPut(
"samplefrac.txt");
132 File_OutPut <<
"inner sf = " << sf_in << endl;
133 File_OutPut <<
"outer sf = " << sf_out << endl;