StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
prd2009Zstack.C
1 
2 bool colorPlot;
3 TString iPathData;
4 
5 void prd2009Zstack(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  //mc file for testing
18  //f=new TFile("/star/u/stevens4/wAnalysis/efficXsec/wana/sl11b/Ze+e-Interf.wana.hist.root"); assert(f->IsOpen());
19 
20  const int mxHist=4;
21  TH1F* h[mxHist];
22 
23  if(colorPlot){
24  int lineColor[mxHist]={kBlack,kGreen,kRed,kBlue};
25  int fillColor[mxHist]={0,kGreen,kRed,kBlue};
26  }
27  else {
28  int lineColor[mxHist]={1,kGray+2,kGray,kGray+3};
29  int fillColor[mxHist]={0,kGray+2,kGray,kGray+3};
30  }
31 
32  for(int i=0; i<mxHist; i++){
33  int j=i;
34  if(i==1) j=2; if(i==2) j=1; //remove after re-run data
35  h[i]=(TH1F*)f->Get(Form("_Z_ZmassUnlike%d",j));
36  //h[i]=(TH1F*)f->Get(Form("_Z_ZmassLike%d",j));
37  h[i]->Rebin();
38  h[i]->SetTitle("; m_{#scale[1.3]{e^{#font[52]{+}}e^{#font[52]{#scale[1.2]{-}}}}} (GeV/c^{2}); Counts ");
39 
40  h[i]->GetXaxis()->SetRangeUser(25,125);
41  h[i]->GetXaxis()->CenterTitle();
42  h[i]->SetFillColor(fillColor[j]); h[i]->SetLineColor(lineColor[j]);
43  h[i]->GetYaxis()->SetTitleOffset(0.9);
44  h[i]->GetYaxis()->CenterTitle();
45  }
46 
47  TCanvas *c=new TCanvas("aa","bb",500*canvasScale,300*canvasScale);
48  c->SetTopMargin(0.05); c->SetBottomMargin(0.13);
49  c->SetLeftMargin(0.08); c->SetRightMargin(0.04);
50  gPad->SetGridy(false); gPad->SetGridx(false);
51  if(!colorPlot) c->SetGrayscale();
52  gPad->SetLogy();
53  h[0]->Draw();
54  h[0]->GetXaxis()->SetTitleOffset(0.9);
55  h[0]->GetXaxis()->CenterTitle();
56  h[0]->GetXaxis()->SetTitleSize(0.06);
57  h[0]->GetXaxis()->SetLabelSize(0.05);
58  h[0]->GetYaxis()->SetTitleOffset(0.6);
59  h[0]->GetYaxis()->CenterTitle();
60  h[0]->GetYaxis()->SetTitleSize(0.06);
61  h[0]->GetYaxis()->SetLabelSize(0.05);
62  for(int i=1; i<mxHist; i++){
63  h[i]->GetXaxis()->SetLabelSize(0.06);
64  h[i]->GetYaxis()->SetLabelSize(0.06);
65  h[i]->Draw("same");
66  }
67 
68  TLegend *leg = new TLegend(0.55,0.6,0.90,0.93);
69  leg->SetEntrySeparation(0.01);
70  leg->SetMargin(0.2);
71  leg->SetFillColor(0);
72  leg->SetTextSize(0.045);
73  leg->SetLineColor(0);
74  leg->AddEntry(h[0]," #splitline{Candidate track and BEMC}{ cluster reconstructed}","l");
75  leg->AddEntry(h[1]," E_{T}^{e} > 15 GeV and |#Deltar| < 0.7 cm","f");
76  leg->AddEntry(h[2]," E_{T}^{e}/E_{T}^{4#times4} > 0.95","f");
77  leg->AddEntry(h[3]," E_{T}^{e}/E_{T}^{#DeltaR<0.7} > 0.88","f");
78  leg->Draw();
79 
80  string like="";
81  if(colorPlot) {
82  c->Print(Form("/star/u/stevens4/wAnalysis/xSecPaper/plots/color/zStack%sColor.eps",like));
83  c->Print(Form("/star/u/stevens4/wAnalysis/xSecPaper/plots/color/zStack%sColor.png",like));
84  }
85  else {
86  c->Print(Form("/star/u/stevens4/wAnalysis/xSecPaper/plots/bw/zStack%sBW.eps",like));
87  c->Print(Form("/star/u/stevens4/wAnalysis/xSecPaper/plots/bw/zStack%sBW.png",like));
88  }
89 
90  return;
91 
92 }
93