7 void plWJacob(
int charge=0) {
8 gStyle->SetPalette(1,0);
9 gStyle->SetOptStat(1000000);
11 TString iPath=
"/star/data05/scratch/stevens4/wAnalysisOut/apsXsec/data/";
12 TString core=
"run9setABCD";
14 TFile *fd = TFile::Open(iPath+core+
".wana.hist.root");
20 hwE=(TH1F*)fd->Get(
"muclustPtBal"); assert(hwE);
21 hnE=(TH1F*)fd->Get(
"muclustPtBalnoE"); assert(hnE);
22 hQCD=(TH1F*)fd->Get(
"muclustPtBal_bckgrd"); assert(hQCD);
26 hwE=(TH1F*)fd->Get(
"pubclustPtBalP"); assert(hwE);
27 hnE=(TH1F*)fd->Get(
"pubclustPtBalnoEP"); assert(hnE);
28 hQCD=(TH1F*)fd->Get(
"pubclustPtBal_bckgrdP"); assert(hQCD);
32 hwE=(TH1F*)fd->Get(
"pubclustPtBalN"); assert(hwE);
33 hnE=(TH1F*)fd->Get(
"pubclustPtBalnoEN"); assert(hnE);
34 hQCD=(TH1F*)fd->Get(
"pubclustPtBal_bckgrdN"); assert(hQCD);
46 TAxis* axX=hwE->GetXaxis();
47 float x1=axX->GetXmin()+1.0;
48 float x2=axX->GetXmax()+1.0;
49 int nbX=axX->GetNbins();
54 hA=
new TH1F(
"hA",
"W candidates (input)",nbX,x1,x2);
55 hAA=
new TH1F(
"hAA",
"W candidates- 2nd Endcap",nbX,x1,x2);
57 hB=
new TH1F(
"hB",
"rejected by including Endcap",nbX,x1,x2);
58 hC=
new TH1F(
"hC",
"rejected by inverting cut",nbX,x1,x2);
61 float sumA=0,sumB=0,sumC=0;
62 for(
int i=1;i<=nbX-1;i++) {
63 float y1=hwE->GetBinContent(i+1);
64 float y2=hnE->GetBinContent(i+1);
65 float y3=hQCD->GetBinContent(i+1);
71 hA->SetBinContent(i,yA);
72 hB->SetBinContent(i,yB);
73 hC->SetBinContent(i,yC);
76 hC->Sumw2(); hAA->Sumw2();
78 hAA->Add(hA,1.); hAA->Add(hB,-1.);
82 c->cd(3); hB->Draw(); hB->SetFillColor(8);
85 c->cd(5); hC->Draw(
"he");
86 hC->SetLineColor(kRed);
89 hA->Rebin(); hAA->Rebin(); hB->Rebin(); hC->Rebin();
91 hA->SetLineWidth(2.); hA->SetAxisRange(0.,etMax);
92 hB->SetAxisRange(0.,etMax);
93 hC->SetAxisRange(0.,etMax);
96 for(
int i=1;i<=nbX;i++) {
97 float y1=hAA->GetBinContent(i);
98 float y2=hC->GetBinContent(i);
100 if(i>=8 && i<=9) { sumA+=y1; sumC+=y2;}
102 float fact=sumA/sumC;
103 printf(
"sumA=%.1f sumC=%.1f fac=%.3f\n",sumA, sumC, fact);
111 TString tt=
"W2009-prelimB"; tt+=stage;
113 c=
new TCanvas(tt,tt,600,600);
114 gStyle->SetOptStat(0);
115 c->SetFillColor(kWhite);
116 c->SetLeftMargin(0.15);
117 c->SetFrameBorderMode(0);
122 hA3=(TH1F*) hA->Clone();
123 hA3->SetTitle(
"PT Balance Cut; EMC cluster #font[72]{E_{T}} (GeV) ;Counts");
124 hA3->GetYaxis()->SetTitleOffset(1.5);
125 hA3->SetAxisRange(7,69); hA3->SetMinimum(-39); hA3->SetMaximum(yMax);
126 hA3->Draw(
"h"); hA3->SetLineWidth(2);
127 ln=
new TLine(8,0,70,0); ln->Draw();
128 printf(
"raw sum=%.0f\n",hA3->Integral());
129 hA3->SetTitle(iPath+core);
132 hDD=(TH1F*) hAA->Clone();
134 hDD->SetMarkerStyle(8);
135 hDD2=(TH1F*) hDD->Clone();
136 hDD2->SetMarkerStyle(8); hDD2->SetMarkerSize(1);
137 hDD->SetFillColor(yellCol);
139 if( stage>2) { hDD->Draw(
"same h"); hDD2->Draw(
"same h"); }
142 hCB=(TH1F*) hC->Clone();
144 hCB->SetMarkerStyle(8); hCB->SetMarkerSize(1); hCB->SetMarkerColor(blueCol);
145 hCB->SetLineColor(blueCol); hCB->SetLineWidth(2);
147 hCB->SetAxisRange(14.5,65);
148 if(stage>1) hCB->Draw(
"p e h same");
151 hA3b=(TH1F*) hA3->Clone();
152 hA3b->SetLineStyle(2);
153 hA3b->Draw(
"same"); hA3b->SetAxisRange(15,18);
156 lg=
new TLegend(0.32,0.64,0.66,0.80);
157 TDatime dt;lg->SetHeader(dt.AsString());
160 lg->AddEntry(hA,
"#font[52]{W} candidates (charge summed)",
"l");
162 lg->AddEntry(hA,
"#font[52]{W+} candidates ",
"l");
164 lg->AddEntry(hA,
"#font[52]{W-} candidates ",
"l");
165 lg->AddEntry(hCB,
"QCD backg. est.",
"lfep");
166 lg->AddEntry(hDD,
"Backg. subtr. #font[52]{W}s",
"lfep");
167 lg->SetFillColor(kWhite);
168 lg->SetLineColor(kWhite);
171 TLatex *lat1 =
new TLatex(0.32,0.84,
"STAR #font[72]{#vec{p}_{ }+_{ }#vec{p}} #sqrt{#font[72]{s}}_{ }=_{ }500 GeV");
172 lat1->SetNDC(); lat1->Draw(
"same");
175 tx=
new TText(14,20,
"software threshold"); tx->SetTextAngle(90);
176 tx->SetTextSize(0.03);
184 float tot_xsec_err_num = 0.;
185 float tot_xsec_err_den = 0.;
186 float tot_al_err_num = 0.;
187 float tot_al_err_den = 0.;
188 for (
int i=11; i<=hA->GetNbinsX(); i++) {
189 tot_xsec_err_num += hA->GetBinError(i)*hA->GetBinError(i);
190 tot_xsec_err_num += hB->GetBinError(i)*hB->GetBinError(i);
191 tot_xsec_err_num += hC->GetBinError(i)*hC->GetBinError(i);
192 tot_xsec_err_den += hDD->GetBinContent(i);
196 for (
int i=13; i<=hA->GetNbinsX(); i++) {
197 tot_al_err_num += hA->GetBinError(i)*hA->GetBinError(i);
198 tot_al_err_den += hDD->GetBinContent(i);
201 float tot_xsec_rel_err = sqrt(tot_xsec_err_num)/tot_xsec_err_den;
202 float tot_al_err = sqrt(tot_al_err_num)/tot_al_err_den;
203 printf(
" Joe measures: xsec_rel_err=%.3f AL_err=%.3f\n", tot_xsec_rel_err, tot_al_err);
206 sprintf(text,
"Error estim: xSec_rel=%.4f AL=%.3f", tot_xsec_rel_err, tot_al_err);
207 tx=
new TText(21,-18,text); tx->Draw(); tx->SetTextSize(0.03);
212 for(
int i=1;i<=nbX;i++) {
213 printf(
"%d , %.1f,",i,hA->GetBinCenter(i));
214 printf(
" %.1f, %.1f, ", hA->GetBinContent(i), hA->GetBinError(i));
215 printf(
" %.1f, %.1f, ", hCB->GetBinContent(i), hCB->GetBinError(i));
216 printf(
" %.1f, %.1f\n ", hDD->GetBinContent(i), hDD->GetBinError(i));