4 TFile *fin =
new TFile(
"output/eic_sphenix_dis_histo_1M.root",
"OPEN");
5 THnSparse *hfull = (THnSparse*)fin->Get(
"hn_sidis_pion_plus_accept");
6 THnSparse *hfull_fullaccept = (THnSparse*)fin->Get(
"hn_sidis_pion_plus");
8 TH2F* hxQ2 = (TH2F*)hfull->Projection(1,0);
9 TH2F* hxQ2_fullaccept = (TH2F*)hfull_fullaccept->Projection(1,0);
16 float pythia_ngen = 1e6;
17 float pythia_xsec = 0.60785660255324614;
18 float convert_microbarn_to_femtobarn = 1e9;
19 float pythia_lumi = pythia_ngen / ( pythia_xsec * convert_microbarn_to_femtobarn );
22 float target_lumi = pythia_lumi;
23 float lumi_scaling = target_lumi / pythia_lumi;
25 cout <<
"Pythia luminosity: " << pythia_lumi <<
" fb^-1" << endl;
26 cout <<
"Target luminosity: " << target_lumi <<
" fb^-1" << endl;
27 cout <<
"Luminosity scaling: " << lumi_scaling << endl;
33 TTree *tcount =
new TTree(
"tcount",
"A tree with counts in kinematics bins");
34 float t_pbeam_lepton = 0;
35 float t_pbeam_proton = 0;
44 tcount->Branch(
"pbeam_lepton", &t_pbeam_lepton,
"pbeam_lepton/F");
45 tcount->Branch(
"pbeam_proton", &t_pbeam_proton,
"pbeam_proton/F");
46 tcount->Branch(
"s", &t_s,
"s/F");
47 tcount->Branch(
"x", &t_x,
"x/F");
48 tcount->Branch(
"Q2", &t_Q2,
"Q2/F");
49 tcount->Branch(
"y", &t_y,
"y/F");
50 tcount->Branch(
"z", &t_z,
"z/F");
51 tcount->Branch(
"pT", &t_pT,
"pT/F");
52 tcount->Branch(
"N", &t_N,
"N/F");
53 tcount->Branch(
"stdev_N", &t_stdev_N,
"stdev_N/F");
56 t_pbeam_lepton = ebeam_e;
57 t_pbeam_proton = ebeam_p;
60 t_s = 4 * ebeam_e * ebeam_p;
64 TAxis *ax_x = hfull->GetAxis(0);
65 TAxis *ax_Q2 = hfull->GetAxis(1);
66 TAxis *ax_z = hfull->GetAxis(2);
67 TAxis *ax_pT = hfull->GetAxis(3);
78 for (
int bin_x = 1; bin_x <= ax_x->GetNbins(); bin_x++ )
80 for (
int bin_Q2 = 1; bin_Q2 <= ax_Q2->GetNbins(); bin_Q2++ )
82 t_x = TMath::Power(10, 0.5 * ( ( TMath::Log10( ax_x->GetBinLowEdge(bin_x) ) )
83 + ( TMath::Log10( ax_x->GetBinLowEdge(bin_x) + ax_x->GetBinWidth(bin_x) ) ) ) );
85 t_Q2 = TMath::Power(10, 0.5 * ( ( TMath::Log10( ax_Q2->GetBinLowEdge(bin_Q2) ) )
86 + ( TMath::Log10( ax_Q2->GetBinLowEdge(bin_Q2) + ax_Q2->GetBinWidth(bin_Q2) ) ) ) );
89 t_y = t_Q2 / ( t_x * t_s );
92 if ( t_y > 0.95 || t_y < 1
e-2 )
95 for (
int bin_z = 1; bin_z <= ax_z->GetNbins(); bin_z++ )
98 t_z = ax_z->GetBinCenter( bin_z );
100 for (
int bin_pT = 1; bin_pT <= ax_pT->GetNbins(); bin_pT++ )
103 t_pT = ax_pT->GetBinCenter( bin_pT );
106 int binloc[4] = { bin_x, bin_Q2, bin_z, bin_pT };
107 t_N = hfull->GetBinContent( binloc ) * lumi_scaling;
113 t_stdev_N = 1./(sqrt(t_N));
119 std::cout.precision(2);
121 bool toscreen =
false;
127 <<
" , x = " << std::scientific << t_x
128 <<
" , Q2 = " << std::scientific << t_Q2
129 <<
" , y = " << std::fixed << t_y
130 <<
" , z = " << std::fixed << t_z
131 <<
" , pT = " << std::fixed << t_pT
132 <<
" , N = " << std::scientific << t_N
141 TString str_ebeam = TString::Format(
"%.0f GeV x %.0f GeV", ebeam_e, ebeam_p );
142 TString str_lumin = TString::Format(
"L = %.4f fb^{-1}", target_lumi );
144 TPaveText *pt_ebeam_lumi_ul =
new TPaveText(1
e-5,1e3,1
e-3,1e4,
"none");
145 pt_ebeam_lumi_ul->SetFillStyle(0);
146 pt_ebeam_lumi_ul->SetLineColor(0);
147 pt_ebeam_lumi_ul->AddText(str_ebeam);
148 pt_ebeam_lumi_ul->AddText(str_lumin);
150 TPaveText *pt_ebeam_lumi_ll =
new TPaveText(1e2,45,1e3,50,
"none");
151 pt_ebeam_lumi_ll->SetFillStyle(0);
152 pt_ebeam_lumi_ll->SetLineColor(0);
153 pt_ebeam_lumi_ll->AddText(str_ebeam);
154 pt_ebeam_lumi_ll->AddText(str_lumin);
157 TF1 *f_y095 =
new TF1(
"f_y095",
"4*x*[0]*[1]*[2]", 1
e-5, 1);
158 f_y095->SetParameter( 0, ebeam_e);
159 f_y095->SetParameter( 1, ebeam_p);
160 f_y095->SetParameter( 2, 0.95);
161 TF1 *f_y001 = (TF1*)f_y095->Clone(
"f_y01");
162 f_y001->SetParameter(2 , 0.01);
165 TCanvas *c1 =
new TCanvas();
166 c1->SetRightMargin(0.12);
172 f_y095->Draw(
"same");
173 f_y001->Draw(
"same");
175 pt_ebeam_lumi_ul->Draw();
179 TCanvas *c4 =
new TCanvas();
180 c4->SetRightMargin(0.12);
181 hxQ2_fullaccept->Draw(
"colz");
186 f_y095->Draw(
"same");
187 f_y001->Draw(
"same");
189 pt_ebeam_lumi_ul->Draw();
193 TCanvas *c3 =
new TCanvas();
194 c3->SetRightMargin(0.12);
195 TH2F* hxQ2_acceptance_ratio = hxQ2->Clone(
"x_Q2_acceptance_ratio");
196 hxQ2_acceptance_ratio->GetZaxis()->SetNdivisions(505);
197 hxQ2_acceptance_ratio->Divide(hxQ2_fullaccept);
198 hxQ2_acceptance_ratio->Draw(
"colz");
202 f_y095->Draw(
"same");
203 f_y001->Draw(
"same");
205 pt_ebeam_lumi_ul->Draw();
209 TFile *
fout =
new TFile(
"output/eic_sphenix_sidis_tree.root",
"RECREATE");