Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
plot_sidis_proj_uncertainty.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file plot_sidis_proj_uncertainty.C
1 int
3 {
4  /* Get tree with projected pseudodata and uncertainties */
5  TFile *fin = new TFile("output/eic_sphenix_sidis_piplus_tree.root","OPEN");
6  TTree *tcount = (TTree*)fin->Get("tcount");
7 
8  /* select cuts for plots */
9  const int nplots = 3;
10  float v_z_min [nplots] = { 0.30, 0.70, 0.50 };
11  float v_z_max [nplots] = { 0.35, 0.75, 0.55 };
12  float v_pT_min [nplots] = { 0.4, 0.8, 0.0 };
13  float v_pT_max [nplots] = { 0.6, 1.0, 0.2 };
14 
15  /* Strings for figure description */
16  float ebeam_e = 20;
17  float ebeam_p = 250;
18  float target_lumi = 0.0016;
19  TString str_ebeam = TString::Format("%.0f GeV x %.0f GeV", ebeam_e, ebeam_p );
20  TString str_lumin = TString::Format("L = %.4f fb^{-1}", target_lumi );
21 
22  /* Frame histogram */
23  TH1F* hframe_g1 = new TH1F("hframe_g1","",100,1e-5,1);
24  hframe_g1->Reset();
25  hframe_g1->GetXaxis()->CenterTitle();
26  hframe_g1->GetYaxis()->CenterTitle();
27  hframe_g1->GetXaxis()->SetTitle("x");
28  hframe_g1->GetYaxis()->SetTitle("Q^{2} (GeV^{2})");
29  hframe_g1->GetYaxis()->SetRangeUser(0, 300);
30  //hframe_g1->GetYaxis()->SetRangeUser(1e-1, 1e3);
31  hframe_g1->GetYaxis()->SetNdivisions(505);
32 
33  /* loop over cuts for plots */
34  for ( int i = 0; i < nplots; i++ )
35  {
36  TCut select_z( TString::Format("%0.2f < z && z < %0.2f", v_z_min[i], v_z_max[i] ) );
37  TCut select_pT( TString::Format("%0.2f < pT && pT < %0.2f", v_pT_min[i], v_pT_max[i] ) );
38 
39  /* Prepare TPaveText for plots */
40  //TPaveText *pt_select_ul = new TPaveText(1e-5,1e2,1e-3,1e3,"none");
41  TPaveText *pt_select_ul = new TPaveText(1e-5,200,1e-3,300,"none");
42  pt_select_ul->SetFillStyle(0);
43  pt_select_ul->SetLineColor(0);
44  pt_select_ul->AddText(str_ebeam);
45  pt_select_ul->AddText(str_lumin);
46  pt_select_ul->AddText( select_z.GetTitle() );
47  pt_select_ul->AddText( select_pT.GetTitle() );
48 
49  /* plot Q2 vs x for various combinations of z and pT */
50  TCanvas *c2 = new TCanvas();
51  c2->SetLogx();
52  // c2->SetLogy();
53 
54  hframe_g1->Draw();
55  pt_select_ul->Draw();
56 
57  /* draw graphs */
58  TCanvas *ctmp = new TCanvas();
59  ctmp->cd();
60 
61  unsigned npoints = tcount->GetEntries( select_z && select_pT );
62  tcount->Draw( TString::Format("Q2:x:stdev_N*10"),
63  select_z && select_pT );
64 
65  TGraphErrors* gnew = new TGraphErrors( npoints, tcount->GetV2(), tcount->GetV1(), 0, tcount->GetV3() );
66  gnew->SetMarkerColor(kRed);
67 
68  c2->cd();
69  gnew->Draw("PSame");
70 
71  gPad->RedrawAxis();
72 
73  c2->Print( TString::Format("plots/sidis_proj_uncertainty_c%d.eps", i ) );
74 
75  delete ctmp;
76  }
77 
78  return 0;
79 }