11 TString fullInpName=iPath+
"bkgd_histos_pos_output4.root";
12 fdP=
new TFile(fullInpName); assert(fdP->IsOpen());
13 TString fullInpName=iPath+
"bkgd_histos_neg_4GeV_output4.root";
14 fdN=
new TFile(fullInpName); assert(fdN->IsOpen());
18 c=
new TCanvas(
"aa",
"aa",900,450);
20 c->SetFillColor(kWhite);
22 c->cd(2); doJob1(fdP,
"W^{#scale[1.5]{+}}",0);
23 c->cd(1); doJob1(fdN,
"W^{#scale[1.5]{-}}",1);
28 void doJob1(TFile *fd, TString charge,
int q) {
29 gStyle->SetPalette(1,0);
30 gStyle->SetEndErrorSize(0);
32 gPad->SetGridy(
false);
33 gPad->SetGridx(
false);
36 if(q==1) fileEnd=
"_r";
39 TH1F *hRaw2= (TH1F*) fd->Get(Form(
"raw_stat_err2%s",fileEnd.Data())); assert(hRaw2);
40 TH1F *hEemcBack2= (TH1F*) fd->Get(Form(
"eemc_stat_err2%s",fileEnd.Data())); assert(hEemcBack2);
41 TH1F *hTauBack2= (TH1F*) fd->Get(Form(
"tau_stat_err2%s",fileEnd.Data())); assert(hTauBack2);
42 TH1F *hQcdBack2= (TH1F*) fd->Get(Form(
"QCD_stat_err2%s",fileEnd.Data())); assert(hQcdBack2);
44 hRaw[q]= (TH1F*) fd->Get(Form(
"signal2%s",fileEnd.Data())); assert(hRaw[q]);
45 hFinW[q]= (TH1F*) fd->Get(Form(
"signal_final3%s",fileEnd.Data())); assert(hFinW[q]);
46 hRaw[q]->SetAxisRange(0,70);
48 hRaw[q]->SetMaximum(99.9);
49 hRaw[q]->SetMinimum(-10);
52 hRaw[q]->SetMaximum(99.9);
53 hRaw[q]->SetMinimum(-10);
55 hRaw[q]->SetStats(
false);
57 if(stage < 3) hRaw[q]->SetLineWidth(2);
59 TH1F * hBack=(TH1F*) hRaw[q]->Clone(); hBack->SetNameTitle(
"totBackg",
"totBackg");
60 hBack->Add(hFinW[q],-1.);
61 hBack->SetLineColor(kBlue);
62 hBack->SetLineWidth(2);
63 hBack->SetMarkerStyle(8);
64 hBack->SetMarkerColor(kBlue);
65 hBack->SetMarkerSize(0.8);
68 hFinW[q]->SetMarkerStyle(8); hFinW[q]->SetMarkerSize(0.8); hFinW[q]->SetLineColor(kBlack);
69 hFinW[q]->SetFillColor(kYellow);
70 hFinW[q]->SetLineWidth(2);
71 if(stage > 2) hFinW[q]->Draw(
"same h");
74 ln=
new TLine(startLine,0,71,0); ln->Draw();
76 hBack->Draw(
"h e same");
77 ln2=
new TLine(startLine,0,15,0); ln2->SetLineWidth(2); ln2->Draw();
83 float xpos[50],ypos[50],err[50];
84 for(
int ibin=startbin;ibin<hRaw[q]->GetNbinsX();ibin++){
85 float eemcBack2=hEemcBack2->GetBinContent(ibin);
86 float tauBack2=hTauBack2->GetBinContent(ibin);
87 float qcdBack2=hQcdBack2->GetBinContent(ibin);
88 float rawErr2=hRaw[q]->GetBinContent(ibin);
89 float backToterr=sqrt(eemcBack2+tauBack2+qcdBack2);
90 float finToterr=sqrt(eemcBack2+tauBack2+qcdBack2+rawErr2);
91 hBack->SetBinError(ibin,backToterr);
92 xpos[ibin-startbin]=hBack->GetBinCenter(ibin);
93 ypos[ibin-startbin]=hFinW[q]->GetBinContent(ibin);
94 err[ibin-startbin]=finToterr;
96 TGraphErrors *errors =
new TGraphErrors(50,xpos,ypos,0,err);
97 errors->SetMarkerStyle(8);
98 errors->SetMarkerSize(0.8); errors->SetLineColor(kBlack);
99 if(stage > 2) errors->Draw(
"p");
101 lg=
new TLegend(0.6,0.62,0.88,0.78);
103 if(q==0) lg->SetHeader(
" positron |#eta|_{ }<_{ }1");
104 else lg->SetHeader(
" electron |#eta|_{ }<_{ }1");
105 lg->AddEntry(hRaw[q],Form(
"#font[52]{%s} candidates",charge.Data()),
"l");
106 lg->AddEntry(hBack,
"Backg. est.",
"lfep");
107 lg->AddEntry(hFinW[q],Form(
"Backg. subtr. #font[52]{%s} ",charge.Data()),
"lfep");
108 lg->SetFillColor(kWhite);
109 lg->SetLineColor(kWhite);
112 TLatex *lat1 =
new TLatex(0.15,0.84,
"Run 9 STAR Preliminary #sqrt{#font[72]{s}}_{ }=_{ }500 GeV");
113 lat1->SetNDC(); lat1->SetTextSize(0.045); lat1->Draw(
"same");
115 TLatex *lat2 =
new TLatex(0.48,0.79,
"#font[52]{p+p #rightarrow W^{#scale[1.2]{+}} #rightarrow e^{#scale[1.2]{+}} + #nu_{e}}");
116 lat2->SetNDC(); lat2->Draw(
"same");
119 TLatex *lat2 =
new TLatex(0.48,0.79,
"#font[52]{p+p #rightarrow W^{#scale[1.2]{-}} #rightarrow e^{#scale[1.2]{-}} + #bar{#nu}_{e}}");
120 lat2->SetNDC(); lat2->Draw(
"same");
123 if(max==100) tx=
new TText(14,20,
"software threshold");
124 else tx=
new TText(14,10,
"software threshold");
125 tx->SetTextAngle(90);
126 tx->SetTextSize(0.03);
129 char tt[100]; sprintf(tt,
"; EMC cluster #font[72]{E_{T}} (GeV) ;Counts",charge.Data());
130 hRaw[q]->GetYaxis()->SetTitleOffset(1.25);
131 hRaw[q]->SetTitle(tt);
143 float getSum(TH1F* h) {
144 h->SetAxisRange(thresET,100);
145 float sum=h->Integral();
146 h->SetAxisRange(0,100);