5 TString iPathMC,iPathData;
7 void prd2009WdataMCetaSidebySide(
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){
13 c=
new TCanvas(
"aa",
"bb",500*canvasScale,300*canvasScale);
14 if(!colorPlot) c->SetGrayscale();
16 TPad *cT =
new TPad(
"padT",
"padT",0,0,0.5,1.); cT->Draw();
17 TPad *cB =
new TPad(
"padB",
"padB",0.5,0,1.,1.0); cB->Draw();
22 prd2009WdataMCetaX(
"Wplus",
"pos",128.6,270.0,1,canvasScale);
24 prd2009WdataMCetaX(
"Wminus",
"neg",385.0,85.0,2,canvasScale);
27 c->Print(
"/star/u/stevens4/wAnalysis/xSecPaper/plots/color/wEtaColor.eps");
28 c->Print(
"/star/u/stevens4/wAnalysis/xSecPaper/plots/color/wEtaColor.png");
31 c->Print(
"/star/u/stevens4/wAnalysis/xSecPaper/plots/bw/wEtaBW.eps");
32 c->Print(
"/star/u/stevens4/wAnalysis/xSecPaper/plots/bw/wEtaBW.png");
39 void prd2009WdataMCetaX(
string charge,
string charge2,
float wlumi,
float max,
int pad,
float canvasScale) {
41 gStyle->SetOptStat(0);
42 gStyle->SetOptDate(0);
44 float lumi[4] = {13.18,wlumi,96.2,531.9};
46 TFile *f[4]; TH2F *h[4];
47 TString name[4]={
"run9setABCD",Form(
"%s",charge),
"Wtau",
"Ze+e-Interf"};
48 TString path[4]={iPathData,iPathMC,iPathMC,iPathMC};
49 for(
int i=0; i<4; i++){
50 f[i]=
new TFile(Form(
"%s%s.wana.hist.root",path[i].Data(),name[i].Data())); assert(f[i]->IsOpen());
51 h[i]=(TH2F*)f[i]->Get(Form(
"%s_muclustpTbal_wE_etaBin",charge2));
52 h[i]->Scale(13.18/lumi[i]);
57 gPad->SetTopMargin(0.01); gPad->SetBottomMargin(0.15);
58 gPad->SetLeftMargin(0.2); gPad->SetRightMargin(0.03);
61 gPad->SetTopMargin(0.01); gPad->SetBottomMargin(0.15);
62 gPad->SetLeftMargin(0.2); gPad->SetRightMargin(0.03);
64 gPad->SetGridy(
false); gPad->SetGridx(
false);
66 hBase->SetMinimum(0.0); hBase->SetMaximum(max);
68 hBase->GetXaxis()->SetTitleSize(0.07);
69 hBase->GetXaxis()->SetTitleOffset(0.98);
70 hBase->GetXaxis()->CenterTitle();
71 hBase->GetXaxis()->SetNdivisions(4);
72 hBase->GetXaxis()->SetLabelSize(0.06);
73 hBase->GetYaxis()->CenterTitle();
74 hBase->GetYaxis()->SetTitleSize(0.07);
75 hBase->GetYaxis()->SetTitleOffset(1.3);
76 hBase->GetYaxis()->SetLabelSize(0.06);
77 hBase->GetYaxis()->SetLabelOffset(0.012);
78 hBase->GetYaxis()->SetNdivisions(6);
80 hBase->GetYaxis()->SetTitleOffset(1.2);
83 THStack *hs =
new THStack(
"hs",
"test");
89 hEta[4]=(TH1F*)hBase->Clone(); hEta[4]->SetName(
"bin4");
90 hEta[5]=(TH1F*)hBase->Clone(); hEta[5]->SetName(
"bin5");
93 hEta[4]->SetBinContent(1,0.13); hEta[4]->SetBinContent(2,2.71);
94 hEta[4]->SetBinContent(3,0.88); hEta[4]->SetBinContent(4,5.35);
96 hEta[5]->SetBinContent(1,2.28); hEta[5]->SetBinContent(2,3.02);
97 hEta[5]->SetBinContent(3,0.0); hEta[5]->SetBinContent(4,2.00);
99 else if(charge==
"Wminus"){
101 hEta[4]->SetBinContent(1,3.31); hEta[4]->SetBinContent(2,3.28);
102 hEta[4]->SetBinContent(3,0.21); hEta[4]->SetBinContent(4,2.45);
104 hEta[5]->SetBinContent(1,2.27); hEta[5]->SetBinContent(2,2.34);
105 hEta[5]->SetBinContent(3,0.82); hEta[5]->SetBinContent(4,0.68);
110 int color[6]={1,kMagenta,kGreen,kBlue,kRed,kOrange};
111 hEta[4]->SetLineColor(color[4]);
112 hEta[4]->SetFillColor(color[4]);
113 hEta[5]->SetLineColor(color[5]);
114 hEta[5]->SetFillColor(color[5]);
117 int color[6]={1,kMagenta,kYellow+2,kYellow+4,kYellow};
118 hEta[4]->SetLineColor(1); hEta[4]->SetFillColor(color[4]);
119 hEta[5]->SetFillStyle(3344); hEta[5]->SetLineColor(1); hEta[5]->SetFillColor(1);
123 float low[4]={-.99,-.49,0.01,0.51};
124 float high[4]={-.51,-.01,0.49,0.99};
125 for(
int j=3; j>=0; j--) {
126 hEta[j]=(TH1F*)hBase->Clone(); hEta[j]->SetName(Form(
"bin%d",j));
127 for(
int ieta=0; ieta<4; ieta++) {
128 int etaLow=h[j]->GetXaxis()->FindBin(low[ieta]);
129 int etaHigh=h[j]->GetXaxis()->FindBin(high[ieta]);
130 float yield=h[j]->Integral(etaLow,etaHigh,26,100);
132 hEta[j]->SetBinContent(ieta+1,yield);
133 if(j==0) hEta[j]->SetBinError(ieta+1,sqrt(yield));
136 hEta[j]->SetLineColor(color[j]);
137 if(j==1) hEta[j]->SetLineStyle(2);
139 hEta[j]->SetFillColor(color[j]);
143 hEta[j]->SetLineWidth(2);
145 if(j>0) hs->Add(hEta[j]);
153 hEta[0]->Draw(
"same e");
156 float textSize=0.047;
if(canvasScale>1.0) textSize=0.044;
157 if(charge==
"Wplus") {
158 TLegend *leg =
new TLegend(0.25,0.75,0.8,0.97);
159 leg->SetEntrySeparation(0.01);
161 leg->SetFillColor(kWhite);
162 leg->SetTextSize(textSize);
163 leg->SetLineColor(kWhite);
164 leg->SetHeader(
"#scale[1.25]{Positron E^{e}_{T}>25 GeV}");
165 leg->AddEntry(hEta[0],
" STAR 2009 Data",
"l");
166 leg->AddEntry(hEta[1],
" W #rightarrow e #nu MC",
"l");
167 leg->AddEntry(hEta[5],
" Data-driven QCD",
"f");
171 TLegend *leg =
new TLegend(0.25,0.75,0.8,0.97);
172 leg->SetEntrySeparation(0.01);
174 leg->SetFillColor(kWhite);
175 leg->SetTextSize(textSize);
176 leg->SetLineColor(kWhite);
177 leg->SetHeader(
"#scale[1.25]{Electron E^{e}_{T}>25 GeV}");
178 leg->AddEntry(hEta[4],
" Second EEMC",
"f");
179 leg->AddEntry(hEta[2],
" W #rightarrow #tau #nu MC",
"f");
180 leg->AddEntry(hEta[3],
" Z #rightarrow ee MC",
"f");
193 hBase=
new TH1F(txt0,
"; #eta_{e}; Counts", 4, -1.,1.);