Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:10:54

0001 draw_phenix(float an)
0002 {
0003   const int nn=1;
0004   float xx[nn] = {4.4};
0005   float sx[nn] = {2.6};
0006   float yy[nn] = {3.14e-2};
0007   //  float yy[nn] = {1e-2};
0008   float sy[nn] = {0.37e-2};
0009 
0010   yy[0] = an;
0011 
0012   TGraphErrors* gr = new TGraphErrors(nn,xx,yy,sx,sy);
0013   gr->SetFillColor(3);
0014   gr->SetFillStyle(3001);
0015   //  gr->Draw("A2");
0016   //  gr->Draw("P");
0017 
0018   int icol = 29;
0019   int iw = 10; // Line width
0020   float wa = 0.025; // Arrow width
0021   TArrow *arx = new TArrow(xx[0]-sx[0],yy[0],xx[0]+sx[0],yy[0],wa,"<|>");
0022   arx->SetLineWidth(iw);
0023   arx->SetLineColor(icol);
0024   arx->SetFillColor(icol);
0025   arx->Draw();
0026   
0027   TArrow *ary = new TArrow(xx[0],yy[0]-sy[0],xx[0],yy[0]+sy[0],wa,"<|>");
0028   ary->SetLineWidth(iw);
0029   ary->SetLineColor(icol);
0030   ary->SetFillColor(icol);
0031   ary->Draw();
0032 }
0033 
0034 
0035 han()
0036 {
0037   const int nxf = 20;
0038   TFile* f = new TFile("han.root");
0039   TGraphErrors* gan[nxf];
0040 
0041   const float dy = 0.01; // to plot different xF bins
0042 
0043   char hname[100];
0044   for( int ix=0; ix<nxf; ix++ ) {
0045     sprintf(hname,"gan%d",ix);
0046     gan[ix] = (TGraphErrors*)f->Get(hname);
0047   }
0048 
0049   gStyle->SetOptStat(0);
0050   c3 = new TCanvas("c3","The Ntuple canvas",200,200,500,450);
0051   c3->Range(0,0,1,1);
0052   pad31 = new TPad("pad31","This is pad1",0.0,0.0,1.0,1.0);
0053   pad31->Draw();
0054 
0055   TH1F* h = new TH1F("h"," ",10,0,11);
0056   //  h->SetTitle("#pi^{+} #delta(A_{N}) proj.");
0057   h->SetYTitle("A_{N}");
0058   h->SetXTitle("p_{T} (GeV/c)");
0059   h->SetMinimum(0.);
0060   h->SetMaximum(0.053);
0061 
0062   pad31->cd();
0063   h->Draw();
0064   draw_phenix(0.025);
0065   TLatex *tex = new TLatex();
0066   tex->SetTextSize(0.035);
0067   char str[100];
0068   float xfbin = 1./float(nxf);
0069   for( int i=1; i<=4; i++ ) {
0070     gan[i]->SetMarkerStyle(20);
0071     gan[i]->SetMarkerColor(2);
0072     gan[i]->SetLineColor(2);
0073     gan[i]->Draw("P");
0074     sprintf(str,"x_{F}=%4.2f-%4.2f",xfbin*i,xfbin*(i+1));
0075     tex->DrawLatex(8.5,dy*i-0.0003,str);
0076   }
0077 
0078   tex->DrawLatex(0.4,0.048,"sPHENIX:");
0079   tex->DrawLatex(0.4,0.044,"p+p, #sqrt{s}=200 GeV");
0080   tex->DrawLatex(0.4,0.040,"L=10/pb P=0.57");
0081   //  tex->DrawLatex(0.4,0.0265,"0<#eta<3");
0082   tex->DrawLatex(0.4,0.0025,"Shown only points with #delta(A_{N})<1%");
0083 
0084 }