Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:12:06

0001 int
0002 plot_dis_acceptance()
0003 {
0004   // TFile *fin = new TFile("output/eic_sphenix_dis_histo_1M.root","OPEN");
0005  TFile *fin = new TFile("output/x_q2_pythia_ep_18x275_10M.root","OPEN");
0006 
0007   THnSparse *hfull = (THnSparse*)fin->Get("hn_dis_electron");
0008   THnSparse *hfull_accept = (THnSparse*)fin->Get("hn_dis_electron_accept");
0009 
0010   TH2F* hxQ2 = (TH2F*)hfull->Projection(1,0);
0011   hxQ2->SetName("hxQ2");
0012 
0013   TH2F* hxQ2_accept = (TH2F*)hfull_accept->Projection(1,0);
0014   hxQ2_accept->SetName("hxQ2_accept");
0015 
0016   TH2F *hxQ2 = (TH2F*)fin->Get("hxQ2");
0017   TH2F *hxQ2_fullaccept = (TH2F*)fin->Get("hxQ2");
0018 
0019   /* beam energies */
0020   float ebeam_e = 20;
0021   float ebeam_p = 250;
0022 
0023   /* Prepare TPaveText for plots */
0024   TString str_ebeam = TString::Format("%.0f GeV x %.0f GeV", ebeam_e, ebeam_p );
0025 
0026   TPaveText *pt_ebeam_lumi_ul = new TPaveText(1e-5,1e3,1e-3,1e4,"none");
0027   pt_ebeam_lumi_ul->SetFillStyle(0);
0028   pt_ebeam_lumi_ul->SetLineColor(0);
0029   pt_ebeam_lumi_ul->AddText(str_ebeam);
0030 
0031   /* Prepare inelasticity (y) cut lines for plots */
0032   TF1 *f_y095 = new TF1("f_y095", "4*x*[0]*[1]*[2]", 1e-5, 1);
0033   f_y095->SetParameter( 0, ebeam_e);
0034   f_y095->SetParameter( 1, ebeam_p);
0035   f_y095->SetParameter( 2, 0.95);
0036   TF1 *f_y001 = (TF1*)f_y095->Clone("f_y01");
0037   f_y001->SetParameter(2 , 0.01);
0038 
0039 
0040   /* make x-Q2 acceptance fraction pot */
0041   TCanvas *c3 = new TCanvas();
0042   c3->SetRightMargin(0.12);
0043   TH2F* hxQ2_acceptance_ratio = hxQ2_accept->Clone("x_Q2_acceptance_ratio");
0044   hxQ2_acceptance_ratio->GetZaxis()->SetNdivisions(505);
0045   hxQ2_acceptance_ratio->Divide(hxQ2);
0046   hxQ2_acceptance_ratio->Draw("colz");
0047   c3->SetLogx(1);
0048   c3->SetLogy(1);
0049 
0050   f_y095->Draw("same");
0051   f_y001->Draw("same");
0052 
0053   pt_ebeam_lumi_ul->Draw();
0054   gPad->RedrawAxis();
0055 
0056   return 0;
0057 }