StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
finalRatios.C
1 #include "commonmacro/common.h"
2 #include "common/Name.cc"
3 #include "commonmacro/histutil.h"
4 #include "commonmacro/ua1.h"
5 
6 void finalRatios(
7  const char* inCentral=
8  "links/P01hi.central.2000.hist/finish_cut88778999_iter3.hist.root",
9  const char* inMinbias=
10  "links/P01hi.minbias.2000.hist/finish_cut97778999_iter3.hist.root",
11  const char* inPeripheral=
12  "links/P01hi.minbias.2000.hist/finish_cut57778999_iter3.hist.root",
13  const char* psDir="psFinal"
14  )
15 {
16  gSystem->Clear();
17 
18  TFile* rCentral=new TFile(inCentral);
19  TFile* rMinbias=new TFile(inMinbias);
20  TFile* rPeripheral=new TFile(inPeripheral);
21 
22  int DOKLUDGE=1;
23 
24 
25  //
26  // get the graphs
27  //
28  char name[200],title[200],txt[500];
29  char* sign=0; // "Minus"
30  int bin=0;
31 
32  setName(name,"gSpecCorrected",bin,sign);
33 
34  TGraphAsymmErrors* gCentral=(TGraphAsymmErrors*)rCentral->Get(name);
35  TGraphAsymmErrors* gMinbias=(TGraphAsymmErrors*)rMinbias->Get(name);
36  TGraphAsymmErrors* gPeripheral=(TGraphAsymmErrors*)rPeripheral->Get(name);
37 
38  //
39  // kludges
40  //
41  if(DOKLUDGE){
42  cout << ">>>>WARNING DOING KLUDGE" << endl;
43  cout << ">>>>WARNING DOING KLUDGE" << endl;
44  cout << ">>>>WARNING DOING KLUDGE" << endl;
45 
46  kludgeBackground(gCentral,0.08);
47  kludgeBackground(gMinbias,0.08);
48  kludgeBackground(gPeripheral,0.05);
49 
50  kludgeSystematics(gCentral);
51  kludgeSystematics(gMinbias);
52  kludgeSystematics(gPeripheral);
53 
54  }
55 
56 
57  // gStyles
58  gStyle->SetOptStat(0); gStyle->SetOptTitle(0);
59  //gStyle->SetPadTickX(1);
60  gStyle->SetPadTickY(1);
61 
62  // follow manuel in the fonts
63  int font = 42;
64  gStyle->SetTextFont(font); gStyle->SetTitleFont(font);
65  gStyle->SetLabelFont(font,"x"); gStyle->SetLabelFont(font,"y");
66 
67 
68  //
69  // divide the canvas into 3 pads
70  //
71  TCanvas* c1=new TCanvas("c1","c1",400,600);
72 
73  TPad* p1=new TPad("p1","p1",0.01,0.67,1,1,0,0,0);
74  p1->SetBottomMargin(0); p1->Draw();
75 
76  TPad* p2=new TPad("p2","p2",0.01,0.33,1,.67,0,0,0);
77  p2->SetTopMargin(0); p2->SetBottomMargin(0); p2->Draw();
78 
79  TPad* p3=new TPad("p3","p3",0.01,0.01,1,.33,0,0,0);
80  p3->SetTopMargin(0); p3->Draw();
81 
82  // TLatex
83  TLatex* ltx=new TLatex;
84  double xText=2.2,textSize=0.05,titleSize=0.05,iTextSize=0.03;
85 
86  double yMin=0,yMax=1.6;
87  double xMin=0,xMax=6.2;
88  double tickSize =.07;
89  double markerSize = 0.8;
90  int markerStyle=4;
91  int lowPtMarkerStyle=4;
92 
93  TCanvas* c2=new TCanvas("c2","c2",400,400);
94 
95  //
96  //------------------------Minbias/ua1
97  //
98  double geom=7200;
99  double Asq = 197*197;
100  double geomScale=geom/Asq;
101 
102  TGraphAsymmErrors* minbiasUA1X=makeUA1Ratio(gMinbias,0,geomScale);
103  // chop off x errors
104  TGraphAsymmErrors* minbiasUA1=removeXErrors(minbiasUA1X);
105 
106  TGraphAsymmErrors* minbiasUA1Err=
107  makeUA1ScaleError(gMinbias,geomScale,geomScale,geomScale);
108 
109  TGraphAsymmErrors* hMinbias=makeHMinus(0);
110  TGraphAsymmErrors* hMinbiasUA1=makeUA1Ratio(hMinbias,0,geomScale);
111  TGraphAsymmErrors* hMinbiasUA1Err=
112  makeUA1ScaleError(hMinbias,geomScale,geomScale,geomScale);
113  TGraphAsymmErrors* hMinbiasUA1=removeXErrors(hMinbiasUA1);
114  p1->cd();
115 
116  minbiasUA1->SetMarkerStyle(markerStyle);
117  minbiasUA1->SetMarkerSize(markerSize);
118  minbiasUA1->SetMinimum(yMin); minbiasUA1->SetMaximum(yMax);
119  minbiasUA1->Draw("ap");
120  minbiasUA1Err->Draw("[]");
121 
122  hMinbiasUA1->SetMarkerStyle(lowPtMarkerStyle);
123  hMinbiasUA1->SetMarkerSize(markerSize);
124  hMinbiasUA1->Draw("p");
125  hMinbiasUA1Err->Draw("[]");
126 
127 
128  TAxis* axis=minbiasUA1->GetXaxis();
129  axis->SetLimits(xMin,xMax);
130 
131  // draw bins on axis
132  drawAxisBins(minbiasUA1X,tickSize,minbiasUA1->GetYaxis()->GetXmax());
133 
134  drawLine(axis);
135 
136  // label
137  ltx->SetTextSize(textSize);
138  strcpy(txt,"#frac{ 1/p_{T} d^{2} N/dp_{T}d#eta(STAR minbias) #sigma_{geom}}{ 2#pi Ed^{3}#sigma/dp^{3} (UA1) A^{2}}");
139  ltx->DrawLatex(xText,.3,txt);
140 
141 
142  //******* individual plot
143 
144  c2->cd();
145  minbiasUA1->SetMinimum(yMin); minbiasUA1->SetMaximum(yMax);
146  minbiasUA1->SetMarkerSize(1);
147  minbiasUA1->Draw("ap");
148  minbiasUA1Err->Draw("[]");
149 
150  hMinbiasUA1->SetMarkerStyle(lowPtMarkerStyle);
151  hMinbiasUA1->SetMarkerSize(1);
152  hMinbiasUA1->Draw("p");
153  hMinbiasUA1Err->Draw("[]");
154 
155  minbiasUA1->GetXaxis()->SetTitle("p_{T} (GeV/c)");
156 
157  drawLine(minbiasUA1->GetXaxis());
158 
159  ltx->SetTextSize(iTextSize);
160  strcpy(txt,"#frac{ 1/p_{T} d^{2} N/dp_{T}d#eta(STAR minbias) #sigma_{geom}}{ 2#pi Ed^{3}#sigma/dp^{3} (UA1) A^{2}}");
161  ltx->DrawLatex(xText,.20,txt);
162 
163  Print(c2,psDir,"minbiasOverUA1.ps");
164 
165 
166  //
167  //---------------------- central/ua1
168  //
169  double TAA=26;
170  double TAAScale=1./TAA;
171  double TAAScaleLow=1./(TAA+1),TAAScaleHigh=1./(TAA-1);
172 
173  TGraphAsymmErrors* centralUA1X=makeUA1Ratio(gCentral,0,TAAScale);
174  TGraphAsymmErrors* centralUA1Err=
175  makeUA1ScaleError(gCentral,TAAScale,TAAScaleLow,TAAScaleHigh);
176  TGraphAsymmErrors* centralUA1=removeXErrors(centralUA1X);
177 
178  // low pt
179  TGraphAsymmErrors* hCentral=makeHMinus(2);
180  TGraphAsymmErrors* hCentralUA1=makeUA1Ratio(hCentral,0,TAAScale);
181  TGraphAsymmErrors* hCentralUA1Err=
182  makeUA1ScaleError(hCentral,TAAScale,TAAScaleLow,TAAScaleHigh);
183  TGraphAsymmErrors* hCentralUA1=removeXErrors(hCentralUA1);
184 
185  p2->cd();
186  centralUA1->SetMarkerStyle(markerStyle);
187  centralUA1->SetMinimum(yMin); centralUA1->SetMaximum(yMax-0.01);
188  centralUA1->Draw("ap");
189 
190  centralUA1Err->Draw("[]");
191 
192  hCentralUA1->SetMarkerStyle(lowPtMarkerStyle);
193  hCentralUA1->SetMarkerSize(markerSize);
194  hCentralUA1->Draw("p");
195  hCentralUA1Err->Draw("[]");
196 
197  axis=centralUA1->GetXaxis();
198  axis->SetLimits(xMin,xMax);
199  drawLine(axis);
200 
201  // draw bins on axis
202  drawAxisBins(centralUA1X,tickSize,minbiasUA1->GetYaxis()->GetXmax());
203 
204  // label
205  ltx->SetTextSize(textSize);
206  strcpy(txt,"#frac{ 1/p_{T} d^{2}N/dp_{T}d#eta(STAR central)}{ 2#pi Ed^{3}#sigma/dp^{3} (UA1) T_{AA} }");
207  ltx->DrawLatex(xText,1.2,txt);
208 
209  strcpy(txt,"STAR h^{-}");
210  ltx->DrawLatex(1.2,.35,txt);
211 
212  //***** individual plot
213  c2->Clear();
214  c2->cd();
215  centralUA1->SetMinimum(yMin); centralUA1->SetMaximum(yMax);
216  centralUA1->SetMarkerSize(1);
217  centralUA1->Draw("ap");
218  centralUA1Err->Draw("[]");
219  hCentralUA1->SetMarkerSize(1);
220  hCentralUA1->Draw("p");
221  hCentralUA1Err->Draw("[]");
222  centralUA1->GetXaxis()->SetTitle("p_{T} (GeV/c)");
223 
224  drawLine(centralUA1->GetXaxis());
225 
226  ltx->SetTextSize(iTextSize);
227  strcpy(txt,"#frac{ 1/p_{T} d^{2}N/dp_{T}d#eta(STAR central)}{ 2#pi Ed^{3}#sigma/dp^{3} (UA1) T_{AA} }");
228  ltx->DrawLatex(xText,1.2,txt);
229 
230  Print(c2,psDir,"centralOverUA1.ps");
231 
232  //
233  //---------------- central/peripheral
234  //
235  TGraphAsymmErrors* centralPeriphX=divide(gCentral,gPeripheral);
236  TGraphAsymmErrors* centralPeriph=removeXErrors(centralPeriphX);
237 
238  TGraphAsymmErrors* hPeriph=makeHMinus(1);
239  TGraphAsymmErrors* hCentralPeriph=divide(hCentral,hPeriph);
240 
241  p3->cd();
242  double sc=0;
243  double* y=centralPeriph->GetY();
244 
245  sc=1./y[2];
246  scale(centralPeriph,sc); // scale at 2 for now
247  // scale(hCentralPeriph,sc);
248 
249 
250 
251 
252  centralPeriph->SetMarkerStyle(markerStyle);
253  centralPeriph->SetMarkerSize(markerSize);
254  centralPeriph->SetMinimum(0); centralPeriph->SetMaximum(yMax-0.01);
255  centralPeriph->Draw("ap");
256 
257  hCentralPeriph->SetMarkerStyle(lowPtMarkerStyle);
258  hCentralPeriph->SetMarkerSize(markerSize);
259  hCentralPeriph->Draw("p");
260 
261  drawLine(axis);
262 
263  axis=centralPeriph->GetXaxis();
264  axis->SetLimits(xMin,xMax);
265 
266  axis->SetTitle("p_{T} (GeV/c)");
267  axis->SetTitleSize(titleSize);
268  axis->SetLabelOffset(0.003);
269 
270  drawAxisBins(centralPeriphX,tickSize,minbiasUA1->GetYaxis()->GetXmax());
271 
272  // label
273  ltx->SetTextSize(textSize);
274  strcpy(txt,"#frac{ STAR central }{ STAR peripheral } (normalized to 1 @ 2GeV/c)");
275  ltx->DrawLatex(xText,1.3,txt);
276 
277  Print(c1,psDir,"ratios");
278 
279  //**** inidividual plot
280  c2->Clear(); c2->cd();
281 
282  centralPeriph->SetMarkerStyle(markerStyle);
283  centralPeriph->SetMinimum(0); centralPeriph->SetMaximum(yMax);
284  centralPeriph->SetMarkerSize(1);
285  centralPeriph->Draw("ap");
286  centralPeriph->GetXaxis()->SetTitle("p_{T} (GeV/c)");
287 
288  hCentralPeriph->SetMarkerStyle(lowPtMarkerStyle);
289  hCentralPeriph->SetMarkerSize(1);
290  // hCentralPeriph->Draw("p");
291 
292 
293  drawLine(axis);
294 
295  ltx->SetTextSize(iTextSize);
296  strcpy(txt,"#frac{ STAR central }{ STAR peripheral } (normalized to 1 @ 2GeV/c)");
297  ltx->DrawLatex(1,1.3,txt);
298 
299  Print(c2,psDir,"centralOverPeriph");
300 
301 
302 
303 }
304 
305 void drawLine(TAxis* a)
306 {
307  TLine* line = new TLine;
308  line->SetLineStyle(2);
309 
310  line->DrawLine(a->GetXmin(),1,a->GetXmax(),1);
311 }
312