00001 const int mxTheo=4, mxPN=2;
00002 TString theoNameA[mxTheo]={"dns_k", "dns_kkp","dssv08","dssv08/mrst02"};
00003 TString pnS[mxPN]={"+","-"};
00004 TString pnL[mxPN]={"p","n"};
00005 TH1F *hTheoA[mxPN][mxTheo];
00006 int theoCol[mxTheo]={kBlue,kRed, 8,kMagenta};
00007 TGraphErrors *grP[mxPN];
00008 TString iPath="asyWALfinalAPS/";
00009
00010 int justTheo=0;
00011
00012 void plWAL_APS() {
00013 gStyle->SetOptStat(0);
00014
00015
00016 c=new TCanvas("aa","aa",500,700);
00017 c->SetFillColor(kWhite); c->SetFrameBorderMode(0);
00018 gPad->SetLeftMargin(0.10); gPad->SetRightMargin(0.05);
00019
00020 h0=new TH1F("bb", "; lepton #eta ",10,-2,2);
00021 h0->SetMaximum(0.59); h0->SetMinimum(-0.59);h0->Draw();
00022 h0->GetXaxis()->SetNdivisions(5); h0->GetXaxis()->SetTickLength(0.02);
00023 if(justTheo){
00024 ln=new TLine(-1,-0.59,-1,0.3); ln->Draw(); ln->SetLineStyle(3);
00025 ln=new TLine(1,-0.59,1,0.4); ln->Draw(); ln->SetLineStyle(3);
00026 }
00027 uploadData();
00028
00029
00030 uploadTheoryRhicbos();
00031 uploadTheoryDeFlor();
00032 plotTheory();
00033 if(!justTheo) plotSysErr();
00034 if(!justTheo) plotData();
00035 plotMiscText();
00036
00037 }
00038
00039
00040
00041
00042
00043
00044 void plotMiscText() {
00045
00046
00047 float x0=0.14, y0=0.86;
00048 tlx=new TLatex(x0,y0,"STAR Preliminary Run9 #sqrt{s}=500 GeV"); tlx->SetNDC(); tlx->SetTextSize(0.048);
00049 if(!justTheo) tlx->Draw();
00050
00051 tlx=new TLatex(x0+0.05,y0-0.05,"#vec{p}+p #rightarrow W^{#\pm} #rightarrow e^{#\pm} + #nu"); tlx->Draw(); tlx->SetNDC(); tlx->SetTextSize(0.05);
00052
00053 tlx=new TLatex(x0+0.05,y0-0.1,"E_{T}^{e} >25 GeV"); tlx->Draw(); tlx->SetNDC(); tlx->SetTextSize(0.045);
00054
00055
00056 tlx=new TLatex(0.4,0.68,"W^{ -}"); tlx->Draw(); tlx->SetNDC(); tlx->SetTextSize(0.06);
00057 tlx=new TLatex(0.4,0.22,"W^{+}"); tlx->Draw(); tlx->SetNDC(); tlx->SetTextSize(0.06);
00058
00059
00060 tlx=new TLatex(0.025,.85,"A_{L}"); tlx->Draw(); tlx->SetNDC(); tlx->SetTextSize(0.06);
00061
00062
00063 tlx=new TLatex(0.73,.53,"A_{L}= #frac{#sigma_{+} - #sigma_{-}}{#sigma_{+} + #sigma_{-}}"); tlx->Draw(); tlx->SetNDC(); tlx->SetTextSize(0.04);
00064
00065
00066
00067
00068 if(justTheo==2) {
00069 TLatex *lat3 = new TLatex(0.25,0.87,"Theory scaled by #pm 4.7%, #sqrt{s}=500 GeV");
00070 lat3->SetNDC(); lat3->Draw("same"); lat3->SetTextSize(0.035); lat3->SetTextColor(12);
00071 }
00072
00073 return;
00074 TDatime dt;
00075 tx=new TText(-2,-0.72,dt.AsString()); tx->SetTextSize(0.035);
00076 if(!justTheo) tx->Draw();
00077 }
00078
00079
00080
00081
00082
00083
00084 void plotTheory() {
00085
00086 float x0=0.68, y0=0.46;
00087 tlx=new TLatex(x0,y0,"W- W+ RHICBOS"); tlx->Draw(); tlx->SetNDC(); tlx->SetTextSize(0.03);
00088 TLegend *thLg[mxPN*2];
00089 float x,y,dy=0.117;
00090 x=x0+0.06; y=y0-0.08;
00091 thLg[0]=new TLegend(x,y,x+0.27,y+0.07);
00092 thLg[2]=new TLegend(x,y0-dy,x+0.27,y0-dy);
00093 x=x-0.07; thLg[1]=new TLegend(x,y,x+0.27,y+0.07);
00094 thLg[3]=new TLegend(x,y0-dy,x+0.27,y0-dy);
00095
00096 for( int iPN=0; iPN<mxPN*2;iPN++) {
00097 TLegend *lg=thLg[iPN];
00098 lg->SetFillColor(kWhite);lg->SetLineColor(kWhite); lg->SetTextSize(0.03);
00099 }
00100
00101 char *theoL[mxTheo]={"DNS-K","DNS-KKP","DSSV08","DSSV08"};
00102 for( int iPN=0; iPN<mxPN;iPN++) {
00103 for (int ith=0;ith<mxTheo; ith++){
00104 TH1F *hTheo=hTheoA[iPN][ith];
00105 if(justTheo==2) plotOneBandTheory(hTheo,ith);
00106 hTheo->Draw("same");
00107 int ko=0; if(ith==3) ko=2;
00108 if(iPN==0)
00109 thLg[iPN+ko]->AddEntry(hTheo,theoL[ith],"l");
00110 else
00111 thLg[iPN+ko]->AddEntry(hTheo," ","l");
00112
00113 }
00114 gPad->SetGrid(0,0);
00115 }
00116 thLg[1]->Draw();
00117 thLg[0]->Draw();
00118 thLg[3]->Draw();
00119 thLg[2]->Draw();
00120 tlx=new TLatex(x0,y0-dy+0.015," deFlorian & Vogelsang"); tlx->Draw(); tlx->SetNDC(); tlx->SetTextSize(0.025);
00121
00122
00123 ln=new TLine(2,-0.4,2,0); ln->Draw();
00124
00125 tb=new TBox(0.62,-0.26,1.96,-0.01); tb->Draw();
00126 tb->SetFillStyle(0); tb->SetLineColor(12);
00127
00128 }
00129
00130
00131
00132
00133 void uploadData() {
00134
00135
00136 TString inpCore="run9setP1234";
00137 TString fullInpName=iPath; fullInpName+=inpCore;
00138 fullInpName+=".wasy.hist.root";
00139 fdd=new TFile(fullInpName);
00140 if(! fdd->IsOpen()) {
00141 printf("EROR: input histo file not found, quit\n",fullInpName.Data());
00142 return;
00143 } else {
00144 printf("Opened: %s\n",fullInpName.Data());
00145 }
00146
00147
00148 for(int iq=0;iq<mxPN;iq++) {
00149 TGraphErrors *gr=new TGraphErrors;
00150 gr->SetMarkerStyle(21-iq);
00151 gr->SetMarkerSize(1.5);
00152 gr->SetMarkerColor(kBlack);
00153 gr->SetLineWidth(3);
00154 gr->SetLineColor(kBlack);
00155
00156 char *tt1="hAsyP";
00157 if(iq==1) tt1="hAsyN";
00158 TH1F *hAsy=(TH1F *)fdd->Get(tt1); assert( hAsy);
00159
00160 double asy=hAsy->GetBinContent(3);
00161 double asyEr=hAsy->GetBinError(3);
00162 printf("W %s AL=%.3f +/- %.3f nSig=%.1f\n", pnS[iq].Data(),asy,asyEr,asy/asyEr);
00163 gr->Clear();
00164 gr->SetPoint(0,0,asy);
00165 gr->SetPointError(0,1.,asyEr);
00166
00167 grP[iq]=gr;
00168
00169 }
00170 }
00171
00172
00173
00174
00175 void plotData(){
00176
00177 for(int iq=0;iq<mxPN;iq++) {
00178 grP[iq]->Draw("p");
00179
00180 }
00181
00182
00183
00184 }
00185
00186
00187
00188 void plotSysErr() {
00189
00190
00191 float dx=0.08;
00192 for(int iq=0;iq<mxPN;iq++) {
00193 float x=grP[iq]->GetX()[0];
00194 float y=grP[iq]->GetY()[0];
00195
00196
00197 float facYup=0.89, facYdw=1.13;
00198 if(iq==1) facYup=1.21, facYdw=0.83;
00199
00200 bx=new TBox(x-dx,y*facYdw,x+dx,y*facYup);
00201 bx->Draw(); bx->SetFillColor(kBlack);
00202 bx->SetFillStyle(3001);
00203 }
00204
00205 float x0=-1.8,y0=-0.57;
00206 bx=new TBox(x0,y0,x0+2*dx,y0+0.08);
00207 bx->Draw(); bx->SetFillColor(kBlack);
00208 bx->SetFillStyle(3001);
00209 tlx=new TLatex(x0+0.2,y0+.045,"Syst. uncertainty due to abs. "); tlx->Draw(); tlx->SetTextSize(0.03);
00210 tlx=new TLatex(x0+0.2,y0+.01,"polarization and background"); tlx->Draw(); tlx->SetTextSize(0.03);
00211
00212 }
00213
00214
00215
00216
00217
00218
00219
00220
00221 void uploadTheoryRhicbos(){
00222 for( int iPN=0; iPN<mxPN;iPN++) {
00223 TString nameUn="rb400_w"+pnL[iPN]+"_unp_ct5m_pt25.root";
00224 funp=new TFile( iPath+nameUn); assert(funp->IsOpen());
00225 hunp= (TH1F*)funp->Get("h3"); assert(hunp);
00226
00227
00228 for (int ith=0;ith<mxTheo-1; ith++){
00229 TString namePol="rb400_w"+pnL[iPN]+"_pol_"+theoNameA[ith]+"_pt25.root";
00230
00231 fpol=new TFile( iPath+namePol); assert(fpol->IsOpen());
00232 TH1F* hpol=(TH1F*) fpol->Get("h3"); assert(hpol);
00233
00234 hal=(TH1F*) hpol->Clone();
00235 hal->Divide(hunp);
00236 TString hName="w"+pnL[iPN]+"_"+theoNameA[ith];
00237 TString hTitle="W"+pnS[iPN]+" "+theoNameA[ith]+"; lepton #eta";
00238
00239 hal->SetNameTitle(hName,hTitle);
00240
00241
00242 hTheoA[iPN][ith]=hal;
00243 hal->SetLineColor( theoCol[ith]);
00244 if(iPN) hal->SetLineStyle(2);
00245 hal->SetLineWidth(2);
00246
00247
00248 continue;
00249
00250 c=new TCanvas();
00251 c->Divide(2,2);
00252 c->cd(1);hunp->Draw();
00253 c->cd(2);hpol->Draw();
00254
00255 c->cd(3);hal->Draw(); hal->SetLineColor(kRed);;
00256 hal->SetMaximum(0.6); hal->SetMinimum(-0.6);
00257
00258 }
00259 }
00260 return;
00261 }
00262
00263
00264
00265
00266
00267 void uploadTheoryDeFlor(){
00268 for( int iPN=0; iPN<mxPN;iPN++) {
00269 TString nameUn="deFlor_w"+pnL[iPN]+"_unp_mrst02_pt25_full.root";
00270 funp=new TFile( iPath+nameUn); assert(funp->IsOpen());
00271 hunp= (TH1F*)funp->Get("h3"); assert(hunp);
00272
00273 char * theoName="dssv08";
00274 int ith=mxTheo-1;
00275 TString namePol="deFlor_w"+pnL[iPN]+"_pol_"+theoName+"_pt25_full.root";
00276 fpol=new TFile( iPath+namePol); assert(fpol->IsOpen());
00277 TH1F* hpol=(TH1F*) fpol->Get("h3"); assert(hpol);
00278
00279 hal=(TH1F*) hpol->Clone();
00280 hal->Divide(hunp);
00281 TString hName="w"+pnL[iPN]+"_deFlor_dssv";
00282 TString hTitle="W"+pnS[iPN]+" deFlor dssv; lepton #eta";
00283
00284 hal->SetNameTitle(hName,hTitle);
00285
00286
00287 hTheoA[iPN][ith]=hal;
00288 hal->SetLineColor( theoCol[ith]);
00289 if(iPN) hal->SetLineStyle(2);
00290 hal->SetLineWidth(2);
00291
00292 }
00293 }
00294
00295
00296
00297
00298
00299
00300
00301 void plotOneBandTheory(TH1F*hIn , int it) {
00302
00303 float sysErr=.047;
00304 for(int ib=0;ib<2;ib++){
00305 TH1F * hu=(TH1F*) hIn->Clone();
00306
00307 hu->Draw("same e3");
00308 TAxis *ax=hu->GetXaxis();
00309 for(ib=1;ib<=ax->GetNbins();ib++){
00310 float y= hu->GetBinContent(ib);
00311 hu->SetBinError(ib,y*sysErr);
00312 }
00313 hu->SetFillStyle(3003+it);
00314
00315 hu->SetFillColor( hu->GetLineColor());
00316 }
00317 }
00318
00319
00320
00321