Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
han.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file han.C
1 draw_phenix(float an)
2 {
3  const int nn=1;
4  float xx[nn] = {4.4};
5  float sx[nn] = {2.6};
6  float yy[nn] = {3.14e-2};
7  // float yy[nn] = {1e-2};
8  float sy[nn] = {0.37e-2};
9 
10  yy[0] = an;
11 
12  TGraphErrors* gr = new TGraphErrors(nn,xx,yy,sx,sy);
13  gr->SetFillColor(3);
14  gr->SetFillStyle(3001);
15  // gr->Draw("A2");
16  // gr->Draw("P");
17 
18  int icol = 29;
19  int iw = 10; // Line width
20  float wa = 0.025; // Arrow width
21  TArrow *arx = new TArrow(xx[0]-sx[0],yy[0],xx[0]+sx[0],yy[0],wa,"<|>");
22  arx->SetLineWidth(iw);
23  arx->SetLineColor(icol);
24  arx->SetFillColor(icol);
25  arx->Draw();
26 
27  TArrow *ary = new TArrow(xx[0],yy[0]-sy[0],xx[0],yy[0]+sy[0],wa,"<|>");
28  ary->SetLineWidth(iw);
29  ary->SetLineColor(icol);
30  ary->SetFillColor(icol);
31  ary->Draw();
32 }
33 
34 
35 han()
36 {
37  const int nxf = 20;
38  TFile* f = new TFile("han.root");
39  TGraphErrors* gan[nxf];
40 
41  const float dy = 0.01; // to plot different xF bins
42 
43  char hname[100];
44  for( int ix=0; ix<nxf; ix++ ) {
45  sprintf(hname,"gan%d",ix);
46  gan[ix] = (TGraphErrors*)f->Get(hname);
47  }
48 
49  gStyle->SetOptStat(0);
50  c3 = new TCanvas("c3","The Ntuple canvas",200,200,500,450);
51  c3->Range(0,0,1,1);
52  pad31 = new TPad("pad31","This is pad1",0.0,0.0,1.0,1.0);
53  pad31->Draw();
54 
55  TH1F* h = new TH1F("h"," ",10,0,11);
56  // h->SetTitle("#pi^{+} #delta(A_{N}) proj.");
57  h->SetYTitle("A_{N}");
58  h->SetXTitle("p_{T} (GeV/c)");
59  h->SetMinimum(0.);
60  h->SetMaximum(0.053);
61 
62  pad31->cd();
63  h->Draw();
64  draw_phenix(0.025);
65  TLatex *tex = new TLatex();
66  tex->SetTextSize(0.035);
67  char str[100];
68  float xfbin = 1./float(nxf);
69  for( int i=1; i<=4; i++ ) {
70  gan[i]->SetMarkerStyle(20);
71  gan[i]->SetMarkerColor(2);
72  gan[i]->SetLineColor(2);
73  gan[i]->Draw("P");
74  sprintf(str,"x_{F}=%4.2f-%4.2f",xfbin*i,xfbin*(i+1));
75  tex->DrawLatex(8.5,dy*i-0.0003,str);
76  }
77 
78  tex->DrawLatex(0.4,0.048,"sPHENIX:");
79  tex->DrawLatex(0.4,0.044,"p+p, #sqrt{s}=200 GeV");
80  tex->DrawLatex(0.4,0.040,"L=10/pb P=0.57");
81  // tex->DrawLatex(0.4,0.0265,"0<#eta<3");
82  tex->DrawLatex(0.4,0.0025,"Shown only points with #delta(A_{N})<1%");
83 
84 }