StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
prd2009Wstack.C
1 
2 bool colorPlot;
3 TString iPathData;
4 
5 void prd2009Wstack(bool x=false,TString y="/star/data01/pwg/stevens4/wAnalysis/xSecPaper/sl11b/data/",float canvasScale=1.0){
6 
7  colorPlot=x;
8  iPathData=y;
9 
10  gStyle->SetOptStat(00000);
11  gStyle->SetOptDate(0);
12 
13  //init files
14  TFile *f;
15  f=new TFile(Form("%srun9setABCD.wana.hist.root",iPathData.Data())); assert(f->IsOpen());
16 
17  const int mxHist=5;
18  TH1F* h[mxHist];
19  TH1F *h2[mxHist];
20 
21  if(colorPlot){
22  int lineColor[mxHist]={kBlack,kOrange,kRed,kGreen,kBlue};
23  int fillColor[mxHist]={0,kOrange,kRed,kGreen,kBlue};
24  }
25  else {
26  int lineColor[mxHist]={1,kGray,kGray+1,kGray+2,kGray+3};
27  int fillColor[mxHist]={0,kGray,kGray+1,kGray+2,kGray+3};
28  }
29 
30  for(int i=0; i<mxHist; i++){
31  h[i]=(TH1F*)f->Get(Form("muETlive%d",i));
32 
33  //rebin histos
34  h2[i]=new TH1F(Form("muETliveRebin%d",i),"; E_{T}^{e} (GeV); Counts ",49,1,99);
35  for (int j=1; j<=49; j++) //2 GeV bins
36  h2[i]->SetBinContent(j,h[i]->GetBinContent(2*j)+h[i]->GetBinContent(2*j+1));
37 
38  h[i]->GetXaxis()->SetRangeUser(10,70);
39  h[i]->GetXaxis()->CenterTitle();
40  h[i]->SetFillColor(fillColor[i]); h[i]->SetLineColor(lineColor[i]);
41  h[i]->GetYaxis()->SetTitleOffset(0.9);
42  h[i]->GetYaxis()->CenterTitle();
43 
44  h2[i]->GetXaxis()->SetRangeUser(10,70);
45  h2[i]->GetXaxis()->CenterTitle();
46  h2[i]->SetFillColor(fillColor[i]); h2[i]->SetLineColor(lineColor[i]);
47  h2[i]->GetYaxis()->SetTitleOffset(0.9);
48  h2[i]->GetYaxis()->CenterTitle();
49 
50  }
51 
52  TCanvas *c=new TCanvas("aa","bb",500*canvasScale,300*canvasScale);
53  c->SetTopMargin(0.05); c->SetBottomMargin(0.13);
54  c->SetLeftMargin(0.09); c->SetRightMargin(0.04);
55  gPad->SetGridy(false); gPad->SetGridx(false);
56  if(!colorPlot) c->SetGrayscale();
57  gPad->SetLogy();
58  h2[0]->Draw();
59  h2[0]->SetMaximum(70000.);
60  h2[0]->GetXaxis()->SetTitleOffset(0.9);
61  h2[0]->GetXaxis()->CenterTitle();
62  h2[0]->GetXaxis()->SetTitleSize(0.06);
63  h2[0]->GetXaxis()->SetLabelSize(0.05);
64  h2[0]->GetYaxis()->SetTitleOffset(0.67);
65  h2[0]->GetYaxis()->CenterTitle();
66  h2[0]->GetYaxis()->SetTitleSize(0.06);
67  h2[0]->GetYaxis()->SetLabelSize(0.05);
68  for(int i=1; i<mxHist; i++){
69  h2[i]->GetXaxis()->SetLabelSize(0.06);
70  h2[i]->GetYaxis()->SetLabelSize(0.06);
71  h2[i]->Draw("same");
72  }
73 
74  TLegend *leg = new TLegend(0.55,0.56,0.90,0.93);
75  leg->SetEntrySeparation(0.04);
76  leg->SetMargin(0.2);
77  leg->SetFillColor(0);
78  leg->SetTextSize(0.045);
79  leg->SetLineColor(0);
80  leg->AddEntry(h[0]," #splitline{Candidate track and BEMC}{ cluster reconstructed}","l");
81  leg->AddEntry(h[1]," E_{T}^{e} > 15 GeV and |#Deltar| < 0.7 cm","f");
82  leg->AddEntry(h[2]," E_{T}^{e}/E_{T}^{4#times4} > 0.95","f");
83  leg->AddEntry(h[3]," E_{T}^{e}/E_{T}^{#DeltaR<0.7} > 0.88","f");
84  leg->AddEntry(h[4]," Signed P_{T}- balance > 15 GeV/c","f");
85  leg->Draw();
86 
87  if(colorPlot) {
88  c->Print("/star/u/stevens4/wAnalysis/xSecPaper/plots/color/wStackColor.eps");
89  c->Print("/star/u/stevens4/wAnalysis/xSecPaper/plots/color/wStackColor.png");
90  }
91  else {
92  c->Print("/star/u/stevens4/wAnalysis/xSecPaper/plots/bw/wStackBW.eps");
93  c->Print("/star/u/stevens4/wAnalysis/xSecPaper/plots/bw/wStackBW.png");
94  }
95 
96  return;
97 
98 }
99