StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
plWxsec_APS.C
1 const int mxTheo=6, mxQ=2; // iQ=0=W+, iQ=1=W-
2 const int mxD=3, mxEr=4; // stat, +sys, -sys, lumi
3 float theoA[mxQ][mxTheo]={{83.3,80.5,75.4}{19.3,18.8,17.7}};
4 float theoErr[2*mxQ][mxTheo]={{0.,0.,4.3}{0.,0.,1.}{0.,0.,3.9}{0.,0.,0.9}};
5 float errA[mxQ][mxEr]={{3.,10.,-13.,14.}{2.,3.,-4.,4.}};
6 float crossA[mxQ]={61,17};
7 TString theoN[mxTheo]={"#splitline{ RHICBOS}{CTEQ5M Resum.}","#splitline{ RHICBOS}{MRST02 Resum.}","#splitline{deFlorian, et al.}{ MRST02 NLO}"};
8 TH1F *hBase;
9 TGraphAsymmErrors *grT[mxQ][mxTheo]; //theory graph
10 TGraphAsymmErrors *grD[mxQ][mxD]; //theory graph*grEx[mxQ][mx]; //theory graph
11 TLegend *leg;
12 
13 
14 void plWxsec_APS() {
15  gStyle->SetOptStat(0);
16  gStyle->SetOptDate(0);
17  initTheory();
18  initData();
19 
20  //make legend
21  leg=new TLegend(0.47,0.48,0.88,0.35);
22  leg->SetNColumns(2);
23  //leg->SetColumnSeparation(0.01);
24  leg->SetEntrySeparation(0.01);
25  leg->SetMargin(0.2);
26  leg->SetFillColor(0);
27  leg->SetTextSize(0.023);
28  leg->AddEntry(grD[0][0]," STAR Data","pl");
29  leg->AddEntry(grT[0][2],theoN[2],"p");
30  leg->AddEntry(grD[0][2]," Lumi. Uncert.","f");
31  leg->AddEntry(grT[0][1],theoN[1],"p");
32  leg->AddEntry(grT[0][2],"#splitline{ Theoretical}{ Scale Uncert.}","f");
33  leg->AddEntry(grT[0][0],theoN[0],"p");
34 
35  c=new TCanvas("aa","bb",550,700);
36  c->SetTopMargin(0.025); c->SetBottomMargin(0.05);
37  gPad->SetGridy(false); gPad->SetGridx(false);
38  initHisto();
39  hBase->GetXaxis()->SetTickLength(0);
40  hBase->GetXaxis()->SetLabelColor(0);
41  hBase->GetYaxis()->SetTitleOffset(1.2);
42  hBase->SetMinimum(0); hBase->SetMaximum(99.9);
43  hBase->Draw();
44  for(int iq=0; iq<mxQ;iq++) {
45  drawTheo(iq);
46  drawData(iq);
47  //break;
48  }
49 
50  leg->Draw("same");
51 
52  //insert text
53  TLatex *lat0 = new TLatex(0.13,0.945,"Run 9 STAR Preliminary #font[52]{p+p} #sqrt{#font[72]{s}}_{ }=_{ }500 GeV");
54  lat0->SetNDC(); lat0->SetTextSize(0.04); lat0->Draw("same");
55  TLatex *lat1 = new TLatex(0.18,0.915,"Kinematic acceptance: |#eta_{#font[52]{e}}| < 1 and #font[52]{E_{T}^{e}} > 25 GeV");
56  lat1->SetNDC(); lat1->SetTextSize(0.03); lat1->Draw("same");
57  TLatex *lat2 = new TLatex(0.6,0.86,"#sigma(#font[52]{W^{#scale[1.2]{#pm}} #rightarrow e^{#scale[1.2]{#pm}} + #nu_{e}})");
58  lat2->SetNDC(); lat2->SetTextSize(0.042); lat2->Draw("same");
59  TLatex *lat3 = new TLatex(0.7,0.59,"#font[52]{W^{+}}");
60  lat3->SetNDC(); lat3->SetTextSize(0.09); lat3->Draw("same");
61  TLatex *lat4 = new TLatex(0.7,0.18,"#font[52]{W^{#scale[1.2]{-}}}");
62  lat4->SetNDC(); lat4->SetTextSize(0.09); lat4->Draw("same");
63 
64 
65 }
66 
67 //------------------------------
68 void initHisto() {
69  char *txt0="h";
70  hBase=new TH1F(txt0, "; ; #sigma (pb)", 100, 0,0.8);
71 }
72 
73 //----------------------
74 void initTheory() {
75 
76  int color[3]={kBlack,kGreen+3,kBlue+1};
77  int marker[3]={26,28,4};
78 
79  for(int iq=0; iq<mxQ;iq++)
80  for(int t=0;t<mxTheo; t++) {
81  int tb=t;
82  if(t>2) tb=t-3;
83  TGraphAsymmErrors *gr=new TGraphAsymmErrors;
84  gr->SetMarkerColor(color[tb]);
85  gr->SetLineWidth(2);
86  gr->SetLineColor(0);
87  gr->SetMarkerSize(1.0);
88  if(t>2) gr->SetMarkerSize(0.8);
89  gr->SetMarkerStyle(marker[tb]);
90  gr->SetPoint(0,(tb+3)*0.1,theoA[iq][tb]);
91 
92 
93  if(t==2) {
94  gr->SetPointError(0,0.01,0.01,theoErr[iq+2][tb],theoErr[iq][tb]);
95  gr->SetFillColor(kRed+2);
96  gr->SetFillStyle(3001);
97  }
98  grT[iq][t]=gr;
99  }
100 
101 }
102 
103 
104 //----------------------
105 void initData() {
106  int iq=0;
107  for(int iq=0; iq<mxQ;iq++)
108  for(int id=0;id<mxD; id++) {
109  if(id>2) break;
110  TGraphAsymmErrors *gr=new TGraphAsymmErrors;
111  if(id==0)gr->SetMarkerStyle(21);
112  else gr->SetMarkerStyle(1);
113  gr->SetMarkerColor(kRed+id);
114  gr->SetMarkerSize(1.5);
115  gr->SetLineWidth(2);
116  gr->SetLineColor(kBlack);
117 
118  if(id<2) gr->SetPoint(0,0.15,crossA[iq]);
119  else gr->SetPoint(0,0.1,crossA[iq]);
120 
121  if(id==0)
122  gr->SetPointError(0,0,0,errA[iq][id],errA[iq][id]);
123  if(id==1) {
124  float a=errA[iq][0]; // stat
125  float b=errA[iq][1]; // +sys
126  float c=errA[iq][2]; // -sys
127  float d=errA[iq][3]; // lumi
128  float yu=sqrt(a*a+b*b);//+d*d);
129  float yd=sqrt(a*a+c*c);//+d*d);
130  gr->SetPointError(0,0,0,yd,yu);
131  }
132  if(id==2){
133  gr->SetPointError(0,0.015,0.015,errA[iq][3],errA[iq][3]);
134  gr->SetFillColor(13);
135  gr->SetLineColor(0);
136  }
137  grD[iq][id]=gr;
138 
139  }
140 
141 }
142 
143 
144 
145 //---------------------
146 void drawTheo(int iq) {
147 
148  for(int t=mxTheo-1;t>=0; t--) {
149  if(t==2) {
150  grT[iq][t]->Draw("2 same");
151  grT[iq][t]->Draw("p X");
152  }
153  else grT[iq][t]->Draw("p");
154  if(t<3) grT[iq][t]->Print();
155  }
156 
157 }
158 
159 
160 
161 //---------------------
162 void drawData(int iq) {
163 
164  for(int id=mxD-1;id>=0; id--) {
165  if(id==0) grD[iq][id]->Draw("p e same");
166  else if(id==1) grD[iq][id]->Draw("p e same");
167  else if(id==2) grD[iq][id]->Draw("2 same");
168  grD[iq][id]->Print();
169  }
170 
171 
172 }