6 TFile *fin =
new TFile(fin_name,
"OPEN");
7 THnSparse *hfull = (THnSparse*)fin->Get(
"hn_dis_electron_accept");
9 TH2F* hxQ2 = (TH2F*)hfull->Projection(1,0);
10 hxQ2->SetName(
"hxQ2");
18 TObjString* gen_crossSection_s = (TObjString*)fin->Get(
"crossSection");
19 TObjString* gen_nEvents_s = (TObjString*)fin->Get(
"nEvents");
20 TObjString* gen_lumi_ifb_s = (TObjString*)fin->Get(
"luminosity");
22 float gen_crossSection_mb = (TString((gen_crossSection_s)->GetName())).Atof();
23 float gen_nEvents = (TString((gen_nEvents_s)->GetName())).Atof();
24 float gen_lumi_ifb = (TString((gen_lumi_ifb_s)->GetName())).Atof();
26 float target_lumi_ifb = 10.;
28 cout <<
"Pythia cross section (microbarn): " << gen_crossSection_mb <<
" mb" << endl;
30 cout <<
"Pythia generated (scaled) luminosity: " << gen_lumi_ifb <<
" fb^-1" << endl;
31 cout <<
"Target luminosity: " << target_lumi_ifb <<
" fb^-1" << endl;
34 TTree *tcount =
new TTree(
"tcount",
"A tree with counts in kinematics bins");
35 float t_pbeam_lepton = 0;
36 float t_pbeam_proton = 0;
46 tcount->Branch(
"pbeam_lepton", &t_pbeam_lepton,
"pbeam_lepton/F");
47 tcount->Branch(
"pbeam_proton", &t_pbeam_proton,
"pbeam_proton/F");
48 tcount->Branch(
"luminosity", &t_lumi_ifb,
"luminosity/F");
49 tcount->Branch(
"s", &t_s,
"s/F");
50 tcount->Branch(
"x", &t_x,
"x/F");
51 tcount->Branch(
"Q2", &t_Q2,
"Q2/F");
52 tcount->Branch(
"y", &t_y,
"y/F");
53 tcount->Branch(
"N", &t_N,
"N/F");
54 tcount->Branch(
"stdev_N", &t_stdev_N,
"stdev_N/F");
55 tcount->Branch(
"stdev_g1", &t_stdev_g1,
"stdev_g1/F");
56 tcount->Branch(
"stdev_A1", &t_stdev_A1,
"stdev_A1/F");
59 t_pbeam_lepton = ebeam_e;
60 t_pbeam_proton = ebeam_p;
61 t_lumi_ifb = gen_lumi_ifb;
64 t_s = 4 * ebeam_e * ebeam_p;
70 for (
int bin_x = 1; bin_x <= hxQ2->GetNbinsX(); bin_x++ )
72 for (
int bin_y = 1; bin_y <= hxQ2->GetNbinsY(); bin_y++ )
74 t_x = TMath::Power(10, 0.5 * ( ( TMath::Log10( hxQ2->GetXaxis()->GetBinLowEdge(bin_x) ) )
75 + ( TMath::Log10( hxQ2->GetXaxis()->GetBinLowEdge(bin_x) + hxQ2->GetXaxis()->GetBinWidth(bin_x) ) ) ) );
77 t_Q2 = TMath::Power(10, 0.5 * ( ( TMath::Log10( hxQ2->GetYaxis()->GetBinLowEdge(bin_y) ) )
78 + ( TMath::Log10( hxQ2->GetYaxis()->GetBinLowEdge(bin_y) + hxQ2->GetYaxis()->GetBinWidth(bin_y) ) ) ) );
80 t_y = t_Q2 / ( t_x * t_s );
82 t_N = (float)hxQ2->GetBinContent( bin_x, bin_y ) * (target_lumi_ifb / gen_lumi_ifb);
88 t_stdev_N = 1./(sqrt(t_N));
89 t_stdev_g1 =
get_g1_sigma( t_x, t_Q2, t_y, t_N, 0.000511 );
90 t_stdev_A1 =
get_A1_sigma( t_x, t_Q2, t_y, t_N, 0.000511 );
96 std::cout.precision(3);
98 cout <<
"lepton = " << std::fixed << t_pbeam_lepton
99 <<
" x proton = " << std::fixed << t_pbeam_proton
100 <<
" , L = " << std::fixed << t_lumi_ifb <<
" fb^-1"
101 <<
" , sqrt(s) = " << std::fixed << sqrt( t_s ) <<
" GeV"
102 <<
" , x = " << std::scientific << t_x
103 <<
" , Q2 = " << std::scientific << t_Q2
104 <<
" , y = " << std::fixed << t_y
105 <<
" , N = " << std::scientific << t_N
106 <<
" , g1 = " << std::fixed << -1
107 <<
" , g1_stdev = " << std::fixed << t_stdev_g1
108 <<
" , A1_stdev = " << std::fixed << t_stdev_A1
114 TFile *
fout =
new TFile(
"output/eic_sphenix_dis_tree.root",
"RECREATE");
124 gen_lumi_ifb_s->Write(
"luminosity");