StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
prd2009Cuts2plots.C
1 
2 bool colorPlot;
3 TString iPathMC,iPathData;
4 
5 void prd2009Cuts2plots(bool x=false,TString y="/star/u/stevens4/wAnalysis/efficXsec/outEmb/gainUp2/",TString z="/star/data01/pwg/stevens4/wAnalysis/xSecPaper/sl11b/data/",float canvasScale=1.0){
6 
7  colorPlot=x;
8  iPathMC=y;
9  iPathData=z;
10 
11  TString cCore="WprdCuts";
12  TString dataFinalRoot=iPathData+"run9setABCD.wana.hist.root";
13  TString mcFinalRoot=iPathMC+"Wplus.wana.hist.root";
14  TFile* fd=0;
15  fd=new TFile(dataFinalRoot); assert(fd->IsOpen()); assert(fd->IsOpen());
16  fdmc=new TFile(mcFinalRoot); assert(fd->IsOpen()); assert(fdmc->IsOpen());
17  //gStyle->SetFillStyle(0);
18  gStyle->SetPalette(1,0);
19  gStyle->SetOptStat(0);
20  gStyle->SetOptDate(0);
21 
22  const Char_t *title = "Selection of W events";
23 
24  c=new TCanvas(cCore,title,500*canvasScale,300*canvasScale);
25  if(!colorPlot) {
26  c->SetGrayscale();
27  //define new color pallete
28  const Int_t Number = 2;
29  Double_t Red[Number] = { 0.9, 0.00};
30  Double_t Green[Number] = { 0.9, 0.00};
31  Double_t Blue[Number] = { 0.9, 0.00};
32  Double_t Length[Number] = { 0.00, 1.00};
33  Int_t nb=50;
34  TColor::CreateGradientColorTable(Number,Length,Red,Green,Blue,nb);
35  }
36 
37 
38  float xx1=0.5175;
39  TPad *cL = new TPad("padD", "apdD",0,0,xx1,1.); cL->Draw();
40  TPad *cR = new TPad("padD", "apdD",xx1,0,1.,1.); cR->Draw();
41 
42  // signed Pt-balance
43  cL->cd();
44  gPad->SetGridy(false); gPad->SetGridx(false);
45  gPad->SetRightMargin(0.0); gPad->SetTopMargin(0.01);
46  gPad->SetBottomMargin(0.12);
47  gPad->SetLeftMargin(0.18);
48  h2=(TH2F*)fd->Get("musPtBalance_clust");
49  //h2->Draw("box");
50  //h2->Draw("cont1");
51  h2->Draw("col");
52  h2->Rebin2D(); //h2->SetMaximum(100);
53  h2->SetAxisRange(8,70,"x");h2->SetAxisRange(-40,60,"y");
54  h2->GetXaxis()->SetNdivisions(5);
55  h2->SetTitle("; E^{e}_{T} (GeV); Signed P_{T}- balance (GeV/c) ");
56  h2->GetXaxis()->CenterTitle(true);
57  h2->GetXaxis()->SetLabelSize(0.05);
58  h2->GetXaxis()->SetTitleSize(0.06);
59  h2->GetXaxis()->SetTitleOffset(0.9);
60  h2->GetYaxis()->CenterTitle(true);
61  h2->GetYaxis()->SetLabelSize(0.05);
62  h2->GetYaxis()->SetTitleSize(0.06);
63  h2->GetYaxis()->SetTitleOffset(1.2);
64 
65  TList *list=h2->GetListOfFunctions(); // to capture old
66  TLine* ln = (TLine*)list->At(0);
67  ln->SetX1(8);ln->SetX2(72); ln->SetLineStyle(2); ln->SetLineWidth(1.5);
68  tx=new TLatex(54,-33,"STAR 2009 Data"); tx->Draw();
69  tx->SetTextAlign(21);
70 
71  cR->cd();
72  gPad->SetGridy(false); gPad->SetGridx(false);
73  gPad->SetRightMargin(0.12); gPad->SetTopMargin(0.01);
74  gPad->SetBottomMargin(0.12);
75  gPad->SetLeftMargin(0.0);
76  h2mc=(TH2F*)fdmc->Get("musPtBalance_clust");
77  //h2mc->Draw("box");
78  //h2mc->Draw("cont1");
79  h2mc->Draw("colz");
80  h2mc->Rebin2D(); h2mc->Scale(h2->GetMaximum()/h2mc->GetMaximum());
81  h2mc->SetAxisRange(8,70,"x");h2mc->SetAxisRange(-40,60,"y");
82  h2mc->GetXaxis()->SetNdivisions(5);
83  h2mc->SetTitle("; E^{e}_{T} (GeV);");
84 
85  h2mc->GetXaxis()->CenterTitle(true);
86  h2mc->GetXaxis()->SetLabelSize(0.0518);
87  h2mc->GetXaxis()->SetTitleSize(0.062);
88  h2mc->GetXaxis()->SetTitleOffset(0.9);
89  h2mc->GetYaxis()->CenterTitle(true);
90  h2mc->GetYaxis()->SetLabelSize(0);
91  h2mc->GetYaxis()->SetLabelColor(0);
92  h2mc->GetYaxis()->SetTitleSize(0.062);
93  h2mc->GetYaxis()->SetTitleOffset(1.15);
94 
95  TList *list=h2mc->GetListOfFunctions(); // to capture old
96  TLine* ln = (TLine*)list->At(0);
97  ln->SetX1(8);ln->SetX2(72); ln->SetLineStyle(2); ln->SetLineWidth(1.5);
98  tx=new TLatex(58,-33,"W #rightarrow e#nu MC"); tx->Draw();
99  tx->SetTextAlign(21);
100 
101  if(colorPlot) {
102  c->Print("/star/u/stevens4/wAnalysis/xSecPaper/plots/color/sPtBalcutColor.eps");
103  c->Print("/star/u/stevens4/wAnalysis/xSecPaper/plots/color/sPtBalcutColor.png");
104  }
105  else {
106  c->Print("/star/u/stevens4/wAnalysis/xSecPaper/plots/bw/sPtBalcutBW.eps");
107  c->Print("/star/u/stevens4/wAnalysis/xSecPaper/plots/bw/sPtBalcutBW.png");
108  }
109 
110 
111  c2=new TCanvas("isoCuts","isoCuts",500*canvasScale,250*canvasScale);
112  if(!colorPlot) c2->SetGrayscale();
113 
114  float xx2=0.51;
115  TPad *cL2 = new TPad("padL2", "padL2",0,0,xx2,1.);
116  TPad *cR2 = new TPad("padR2", "padR2",xx2,0,1,1.);
117  cL2->Draw();
118  cR2->Draw();
119 
120  //====================== 2x2/4x4
121  cL2->cd();
122  gPad->SetGridy(false); gPad->SetGridx(false);
123  gPad->SetBottomMargin(0.16);gPad->SetTopMargin(0.02);
124  gPad->SetLeftMargin(0.2); gPad->SetRightMargin(0.00);
125  h=(TH1F*)fd->Get("muBclET24R"); h->Draw();
126  h->SetLineWidth(1.);
127  hmc=(TH1F*)fdmc->Get("muBclET24R"); hmc->Draw("same");
128  hmc->SetFillColor(93); hmc->Scale(0.7); hmc->SetLineColor(93);
129 
130  h->SetTitle(";E^{e}_{T} / E^{4#times4}_{T} ;Counts ");
131  h->GetYaxis()->SetNdivisions(5);
132  h->GetYaxis()->CenterTitle(true);
133  h->GetYaxis()->SetTitleSize(0.07);
134  h->GetYaxis()->SetTitleOffset(1.4);
135  h->GetYaxis()->SetLabelSize(0.06);
136  h->GetXaxis()->SetNdivisions(3);
137  h->GetXaxis()->CenterTitle(true);
138  h->GetXaxis()->SetTitleSize(0.07);
139  h->GetXaxis()->SetTitleOffset(1.0);
140  h->GetXaxis()->SetRangeUser(0.02,1.1);
141  h->GetXaxis()->SetLabelSize(0.06);
142 
143  list=h->GetListOfFunctions(); // to capture old
144  hmc->GetListOfFunctions()->Delete();
145  ln = (TLine*)list->At(0);
146  ln->SetY2(h->GetMaximum()*1.02);ln->SetLineStyle(2); ln->SetLineWidth(1.5);
147  lnclone = (TLine*)ln->Clone(); lnclone->Draw("same");
148  TLine *lnAxis = new TLine(0,0,1.1,0);
149  lnAxis->Draw("same");
150 
151  TLegend *leg = new TLegend(0.3,0.68,0.6,0.85);
152  leg->SetEntrySeparation(0.01);
153  //leg->SetMargin(0.2);
154  leg->SetFillColor(0);
155  leg->SetTextSize(0.058);
156  leg->SetLineColor(0);
157  leg->AddEntry(h," STAR 2009 Data","l");
158  leg->AddEntry(hmc," W #rightarrow e#nu MC","f");
159  leg->Draw();
160 
161  //====================== 2x2/near
162  cR2->cd();
163  gPad->SetGridy(false); gPad->SetGridx(false);
164  gPad->SetBottomMargin(0.16); gPad->SetTopMargin(0.02);
165  gPad->SetLeftMargin(0.0); gPad->SetRightMargin(0.01);
166  h=(TH1F*)fd->Get("muBjetETR"); h->Draw();
167  h->SetLineWidth(1.);
168  hmc=(TH1F*)fdmc->Get("muBjetETR"); hmc->Draw("same");
169  hmc->SetFillColor(93); hmc->Scale(.2); hmc->SetLineColor(93);
170 
171  h->SetTitle(";E^{e}_{T} / E^{#DeltaR<0.7}_{T} ");
172  h->GetXaxis()->SetNdivisions(3);
173  h->GetXaxis()->CenterTitle(true);
174  h->GetXaxis()->SetTitleSize(0.07);
175  h->GetXaxis()->SetTitleOffset(1.0);
176  h->GetXaxis()->SetLabelSize(0.06);
177  h->GetXaxis()->SetRangeUser(0.02,1.1);
178  h->GetYaxis()->SetNdivisions(4);
179  h->GetYaxis()->SetLabelSize(0.06);
180  h->GetYaxis()->SetLabelOffset(-0.13);
181  h->SetMinimum(0.02);
182 
183  list=h->GetListOfFunctions(); // to capture old
184  hmc->GetListOfFunctions()->Delete();
185  ln = (TLine*)list->At(0);
186  ln->SetY2(h->GetMaximum()*1.02); ln->SetLineStyle(2); ln->SetLineWidth(1.5);
187  lnclone = (TLine*)ln->Clone(); lnclone->Draw("same");
188  lnAxis->Draw("same");
189 
190  if(colorPlot) {
191  c2->Print("/star/u/stevens4/wAnalysis/xSecPaper/plots/color/isoCutsColor.eps");
192  c2->Print("/star/u/stevens4/wAnalysis/xSecPaper/plots/color/isoCutsColor.png");
193  }
194  else {
195  c2->Print("/star/u/stevens4/wAnalysis/xSecPaper/plots/bw/isoCutsBW.eps");
196  c2->Print("/star/u/stevens4/wAnalysis/xSecPaper/plots/bw/isoCutsBW.png");
197  }
198 
199  return;
200 
201  float yy1=0.57;
202  TPad *cT = new TPad("padT", "apdT",0,yy1,1,1.);
203  TPad *cB = new TPad("padB", "apdB",0,0.0,1,yy1);
204  cB->Draw();
205  cT->Draw();
206 
207  //====================== 2x2/4x4
208  float xx3=0.1;
209  cT->cd();
210  gPad->SetGridy(false); gPad->SetGridx(false);
211  gPad->SetBottomMargin(0.0);gPad->SetTopMargin(0.02);
212  gPad->SetLeftMargin(xx3); gPad->SetRightMargin(0.01);
213  h=(TH1F*)fd->Get("muBclET24R"); h->Draw();
214  hmc=(TH1F*)fdmc->Get("muBclET24R"); hmc->Draw("same");
215  hmc->SetFillColor(93); hmc->Scale(0.85);
216 
217  h->SetTitle("; ;Counts ");
218  h->GetYaxis()->SetNdivisions(0);
219  h->GetYaxis()->CenterTitle(true);
220  h->GetYaxis()->SetTitleSize(0.085);
221  h->GetYaxis()->SetTitleOffset(0.55);
222  h->GetXaxis()->SetNdivisions(3);
223 
224  list=h->GetListOfFunctions(); // to capture old
225  hmc->GetListOfFunctions()->Delete();
226  ln = (TLine*)list->At(0);
227  ln->SetY2(h->GetMaximum()*1.02);ln->SetLineStyle(2); ln->SetLineWidth(1.5);
228 
229  tx=new TLatex(0.4,500," E^{e}_{T} / E^{4#times4}_{T} "); tx->SetTextSize(0.09); tx->Draw();
230  tx->SetTextAlign(21);
231 
232  tx=new TLatex(-0.02,15,"0"); tx->SetTextSize(0.07); tx->Draw();
233  tx->SetTextAlign(21);
234 
235  tx=new TLatex(-0.05,3000,"3000"); tx->SetTextSize(0.07); tx->Draw();
236  tx->SetTextAlign(21);
237 
238  tx=new TLatex(0.125,2960,"a)"); tx->SetTextSize(0.09); tx->Draw();
239  tx->SetTextAlign(21);
240 
241  //====================== 2x2/near
242  cB->cd();
243  gPad->SetGridy(false); gPad->SetGridx(false);
244  gPad->SetBottomMargin(0.15); gPad->SetTopMargin(0.00);
245  gPad->SetLeftMargin(xx3); gPad->SetRightMargin(0.01);
246  h=(TH1F*)fd->Get("muBjetETR"); h->Draw();
247  hmc=(TH1F*)fdmc->Get("muBjetETR"); hmc->Draw("same");
248  hmc->SetFillColor(93); hmc->Scale(.2);
249 
250  h->SetTitle("; E^{e}_{T} / E^{#DeltaR<0.7}_{T} ;Counts");
251  h->GetXaxis()->SetNdivisions(3); h->GetXaxis()->CenterTitle(true);
252  h->GetXaxis()->SetTitleSize(0.06); h->GetXaxis()->SetTitleOffset(0.9);
253  h->GetYaxis()->SetNdivisions(4); h->GetYaxis()->CenterTitle(true);
254  h->GetYaxis()->SetTitleSize(0.06); h->GetYaxis()->SetTitleOffset(0.8);
255  h->GetYaxis()->SetLabelSize(0.055); h->GetXaxis()->SetLabelSize(0.055);
256 
257  list=h->GetListOfFunctions(); // to capture old
258  hmc->GetListOfFunctions()->Delete();
259  ln = (TLine*)list->At(0);
260  ln->SetY2(h->GetMaximum()*1.02); ln->SetLineStyle(2); ln->SetLineWidth(1.5);
261 
262  tx=new TLatex(0.125,275,"b)"); tx->SetTextSize(0.07); tx->Draw();
263  tx->SetTextAlign(30);
264 
265  if(colorPlot) {
266  c2->Print("/star/u/stevens4/wAnalysis/xSecPaper/plots/color/isoCutsColor.eps");
267  c2->Print("/star/u/stevens4/wAnalysis/xSecPaper/plots/color/isoCutsColor.png");
268  }
269  else {
270  c2->Print("/star/u/stevens4/wAnalysis/xSecPaper/plots/bw/isoCutsBW.eps");
271  c2->Print("/star/u/stevens4/wAnalysis/xSecPaper/plots/bw/isoCutsBW.png");
272  }
273 
274  return;
275 
276 }
277