Back to home page

sPhenix code displayed by LXR

 
 

    


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

0001 int
0002 plot_sidis_proj_uncertainty()
0003 {
0004   /* Get tree with projected pseudodata and uncertainties */
0005   TFile *fin = new TFile("output/eic_sphenix_sidis_piplus_tree.root","OPEN");
0006   TTree *tcount = (TTree*)fin->Get("tcount");
0007 
0008   /* select cuts for plots */
0009   const int nplots = 3;
0010   float v_z_min  [nplots] = { 0.30, 0.70, 0.50 };
0011   float v_z_max  [nplots] = { 0.35, 0.75, 0.55 };
0012   float v_pT_min [nplots] = { 0.4,  0.8,  0.0  };
0013   float v_pT_max [nplots] = { 0.6,  1.0,  0.2  };
0014 
0015   /* Strings for figure description */
0016   float ebeam_e = 20;
0017   float ebeam_p = 250;
0018   float target_lumi = 0.0016;
0019   TString str_ebeam = TString::Format("%.0f GeV x %.0f GeV", ebeam_e, ebeam_p );
0020   TString str_lumin = TString::Format("L = %.4f fb^{-1}", target_lumi );
0021 
0022   /* Frame histogram */
0023   TH1F* hframe_g1 = new TH1F("hframe_g1","",100,1e-5,1);
0024   hframe_g1->Reset();
0025   hframe_g1->GetXaxis()->CenterTitle();
0026   hframe_g1->GetYaxis()->CenterTitle();
0027   hframe_g1->GetXaxis()->SetTitle("x");
0028   hframe_g1->GetYaxis()->SetTitle("Q^{2} (GeV^{2})");
0029   hframe_g1->GetYaxis()->SetRangeUser(0, 300);
0030   //hframe_g1->GetYaxis()->SetRangeUser(1e-1, 1e3);
0031   hframe_g1->GetYaxis()->SetNdivisions(505);
0032 
0033   /* loop over cuts for plots */
0034   for ( int i = 0; i < nplots; i++ )
0035     {
0036       TCut select_z( TString::Format("%0.2f < z && z < %0.2f", v_z_min[i], v_z_max[i] ) );
0037       TCut select_pT( TString::Format("%0.2f < pT && pT < %0.2f", v_pT_min[i], v_pT_max[i] ) );
0038 
0039       /* Prepare TPaveText for plots */
0040       //TPaveText *pt_select_ul = new TPaveText(1e-5,1e2,1e-3,1e3,"none");
0041       TPaveText *pt_select_ul = new TPaveText(1e-5,200,1e-3,300,"none");
0042       pt_select_ul->SetFillStyle(0);
0043       pt_select_ul->SetLineColor(0);
0044       pt_select_ul->AddText(str_ebeam);
0045       pt_select_ul->AddText(str_lumin);
0046       pt_select_ul->AddText( select_z.GetTitle() );
0047       pt_select_ul->AddText( select_pT.GetTitle() );
0048 
0049       /* plot Q2 vs x for various combinations of z and pT */
0050       TCanvas *c2 = new TCanvas();
0051       c2->SetLogx();
0052       //      c2->SetLogy();
0053 
0054       hframe_g1->Draw();
0055       pt_select_ul->Draw();
0056 
0057       /* draw graphs */
0058       TCanvas *ctmp = new TCanvas();
0059       ctmp->cd();
0060 
0061       unsigned npoints = tcount->GetEntries( select_z && select_pT );
0062       tcount->Draw( TString::Format("Q2:x:stdev_N*10"),
0063             select_z && select_pT );
0064 
0065       TGraphErrors* gnew = new TGraphErrors( npoints, tcount->GetV2(), tcount->GetV1(), 0, tcount->GetV3() );
0066       gnew->SetMarkerColor(kRed);
0067 
0068       c2->cd();
0069       gnew->Draw("PSame");
0070 
0071       gPad->RedrawAxis();
0072 
0073       c2->Print( TString::Format("plots/sidis_proj_uncertainty_c%d.eps", i ) );
0074 
0075       delete ctmp;
0076     }
0077 
0078   return 0;
0079 }