StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
prd2009ZdataMC.C
1 
2 bool colorPlot;
3 TString iPathMC,iPathData;
4 
5 void prd2009ZdataMC(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  char* core0="Ze+e-Interf";
12 
13  gStyle->SetOptStat(0);
14  gStyle->SetOptDate(0);
15 
16  //load file
17  TString fullInpName=iPathMC; fullInpName+=core0;
18  fullInpName+=".wana.hist.root";
19  fd=new TFile(fullInpName);
20  if(!fd->IsOpen()) {
21  printf("ERROR: input histo file not found, quit\n",fullInpName.Data());
22  return;
23  } else {
24  printf("Opened: %s\n",fullInpName.Data());
25  }
26 
27  //Data MC comparison plot
28  fdata=new TFile(Form("%srun9setABCD.wana.hist.root",iPathData.Data()));
29  TCanvas *c=new TCanvas("zData/MC","zData/MC",500*canvasScale,300*canvasScale);
30  c->SetTopMargin(0.05); c->SetBottomMargin(0.13);
31  c->SetRightMargin(0.04); c->SetLeftMargin(0.08);
32  gPad->SetGridy(false); gPad->SetGridx(false);
33  if(!colorPlot) c->SetGrayscale();
34  TH1F* data = (TH1F*)fdata->Get("_Z_ZmassUnlike");
35  TH1F* mc = (TH1F*)fd->Get("_Z_ZmassUnlike"); mc->Sumw2();
36  mc->Scale(13.18/531.9);
37 
38  //remove default lines (need to improve for final plot)
39  TList *LxMC; TList *LxData;
40  LxMC=mc->GetListOfFunctions(); LxMC->Delete();
41  LxData=data->GetListOfFunctions(); LxData->Delete();
42 
43  mc->SetTitle(";m_{e^{#font[52]{+}}e^{#font[52]{#scale[1.2]{-}}}} (GeV/c^{2}) ; Counts");
44  mc->SetLineStyle(2); mc->SetLineColor(kMagenta);
45  mc->SetLineWidth(2); mc->SetFillColor(0);
46  mc->Rebin(4); mc->SetMaximum(13.99.);
47  mc->GetXaxis()->SetTitleOffset(0.9);
48  mc->GetXaxis()->CenterTitle();
49  mc->GetXaxis()->SetRangeUser(30,120);
50  mc->GetXaxis()->SetTitleSize(0.06);
51  mc->GetXaxis()->SetLabelSize(0.05);
52  mc->GetYaxis()->SetTitleOffset(0.6);
53  mc->GetYaxis()->CenterTitle();
54  mc->GetYaxis()->SetTitleSize(0.06);
55  mc->GetYaxis()->SetLabelSize(0.05);
56  mc->Draw("h e");
57  data->SetFillColor(0); data->SetLineWidth(2);
58  data->Rebin(4);
59  data->GetXaxis()->SetRangeUser(30,120);
60  data->GetXaxis()->SetLabelSize(0.06);
61  data->GetYaxis()->SetLabelSize(0.06);
62  data->Draw("e same");
63 
64  TLegend *leg = new TLegend(0.2,0.72,0.4,0.87);
65  leg->SetEntrySeparation(0.01);
66  leg->SetMargin(0.2);
67  leg->SetFillColor(0);
68  leg->SetTextSize(0.05);
69  leg->SetLineColor(0);
70  leg->AddEntry(data," STAR 2009 Data","l");
71  leg->AddEntry(mc," Z #rightarrow ee MC","l");
72  leg->Draw();
73 
74  if(colorPlot) {
75  c->Print("/star/u/stevens4/wAnalysis/xSecPaper/plots/color/zDataMCcolor.eps");
76  c->Print("/star/u/stevens4/wAnalysis/xSecPaper/plots/color/zDataMCcolor.png");
77  }
78  else {
79  c->Print("/star/u/stevens4/wAnalysis/xSecPaper/plots/bw/zDataMCbw.eps");
80  c->Print("/star/u/stevens4/wAnalysis/xSecPaper/plots/bw/zDataMCbw.png");
81  }
82  return;
83 }
84