StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
plPRL_Jpeak.C
1 float thresET=25; // cut of for computations of yields & backg
2 TH1F *hRaw[5];
3 TH1F *hFinW[5];
4 int stage=3;
5 
6 void plPRL_Jpeak(TString cCore="WAL_PRL_Jpeak") {
7  TString iPath="joeBackgMar18/";
8  TString fullInpName=iPath+"bkgd_histos_pos_final.root";
9  fdP=new TFile(fullInpName); assert(fdP->IsOpen());
10  TString fullInpName=iPath+"bkgd_histos_neg_final.root";
11  fdN=new TFile(fullInpName); assert(fdN->IsOpen());
12  //fdP->ls();
13  //fdN->ls();
14 
15  const Char_t *title = "W boson signal";
16  c=new TCanvas(cCore,title,400,450);
17  setPadPaperSize(245.0); // column width, approx. 3.4 in = 245 pt
18  c->Divide(1,2,0,0);
19 
20  c->cd(1);
21  gPad->SetPad(0,(((245.0*c->GetWh()/c->GetWw())-26.0)*(0.5 + 0.5*(10.0/170.0)) + 26.0)/(245.0*c->GetWh()/c->GetWw()),1,1);
22  setPadMarginWidthPoint(gPad, 32, 1, 1, 0, gPad);
23  setPadLineWidthPoint(gPad, 0.5);
24 
25  c->cd(2);
26  gPad->SetPad(0,0,1,(((245.0*c->GetWh()/c->GetWw())-26.0)*(0.5 + 0.5*(10.0/170.0)) + 26.0)/(245.0*c->GetWh()/c->GetWw()));
27  setPadMarginWidthPoint(gPad, 32, 0, 1, (2.0*12.0) + 2, gPad);
28  setPadLineWidthPoint(gPad, 0.5);
29 
30  c->cd(1);
31  doJob1(fdN,"W^{-}",1); // W-
32  c->cd(2);
33  doJob1(fdP,"W^{+}",0); // W+
34 }
35 
36 //===================
37 void doJob1(TFile *fd, TString charge, int q) {
38  gStyle->SetPalette(1,0);
39  gStyle->SetEndErrorSize(0);
40  gStyle->SetFillStyle(0);
41  //float fs=0.06;
42  //if(q==1)fs=0.07;
43 
44  TString fileEnd;
45  if(q==1) fileEnd="_r";
46 
47  //error histograms
48  TH1F *hRaw2= (TH1F*) fd->Get(Form("raw_stat_err2%s",fileEnd.Data())); assert(hRaw2);
49  TH1F *hEemcBack2= (TH1F*) fd->Get(Form("eemc_stat_err2%s",fileEnd.Data())); assert(hEemcBack2);
50  TH1F *hTauBack2= (TH1F*) fd->Get(Form("tau_stat_err2%s",fileEnd.Data())); assert(hTauBack2);
51  TH1F *hQcdBack2= (TH1F*) fd->Get(Form("QCD_stat_err2%s",fileEnd.Data())); assert(hQcdBack2);
52 
53  hRaw[q]= (TH1F*) fd->Get(Form("signal2%s",fileEnd.Data())); assert(hRaw[q]);
54  hFinW[q]= (TH1F*) fd->Get(Form("signal_final3%s",fileEnd.Data())); assert(hFinW[q]);
55  hRaw[q]->SetAxisRange(8,74);
56  if(q==0){
57  hRaw[q]->SetMaximum(79.999);
58  hRaw[q]->SetMinimum(-9.999);
59  }
60  else {
61  hRaw[q]->SetMaximum(69.999);
62  hRaw[q]->SetMinimum(-9.999);
63  }
64  hRaw[q]->SetStats(false);
65  hRaw[q]->Draw("h");
66  zeroline = new TLine(hRaw[q]->GetXaxis()->GetBinLowEdge(hRaw[q]->GetXaxis()->GetFirst()), 0, hRaw[q]->GetXaxis()->GetBinUpEdge(hRaw[q]->GetXaxis()->GetLast()), 0);
67  zeroline->SetLineColor(kBlack);
68  setLineWidthPoint(zeroline, 0.5);
69  zeroline->Draw();
70  if(stage < 3) {
71  setLineWidthPoint(hRaw[q], 0.5);
72  }
73  h=hRaw[q];
74 
75  h->UseCurrentStyle();
76  stripCmdHist(h);
77  setHistFontSize(h, 10.0);
78  setLineWidthPoint(h, 0.5);
79  setHistTickLength(h, 4.0, 4.0);
80  setHistTitleLabelOffset(h, 2.0*12.0 - 3.0, 23, 12.0 - 2.0, 4.5 - 2.0);
81 
82 
83  TH1F * hBack=(TH1F*) hRaw[q]->Clone(); hBack->SetNameTitle("totBackg", "totBackg");
84 
85  hBack->Add(hFinW[q],-1.);
86  setLineWidthPoint(hBack, 0.5);
87  setMarkerSizePoint(hBack, 3.5);
88  // hx=(TH1F*) hBack->Clone();
89  hBack->SetLineColor(kBlue);
90  hBack->SetMarkerColor(kBlue);
91 
92 
93  //draw histograms
94  hFinW[q]->SetMarkerStyle(8);
95  hFinW[q]->SetLineColor(kBlack);
96  hFinW[q]->SetFillColor(kYellow);
97  setMarkerSizePoint(hFinW[q], 3.5);
98  setLineWidthPoint(hFinW[q], 0.5);
99  if(stage > 2) hFinW[q]->Draw("same h");
100  float startLine=9;
101  if(q==1) startLine=3;
102 
103  if(stage > 1) {
104  hBack->Draw("h same");
105  }
106 
107  // hx->Draw("e same");
108  // ET-cut lines
109  float yy=50;
110  if(q)yy=38;
111 
112  ln=new TLine(25,0.,25,yy); ln->SetLineColor(kRed); ln->SetLineStyle(2);
113  setLineWidthPoint(ln, 1); ln->Draw();
114 
115  ln=new TLine(50,0.,50,yy);
116  ln->SetLineColor(kRed);
117  ln->SetLineStyle(2);
118  setLineWidthPoint(ln, 1);
119  ln->Draw();
120 
121  //set stat errors
122  int startbin=8;
123  if(q==1) startbin=4;
124  float xpos[50],ypos[50],err[50];
125  for(int ibin=startbin;ibin<hRaw[q]->GetNbinsX();ibin++){
126  float eemcBack2=hEemcBack2->GetBinContent(ibin);
127  float tauBack2=hTauBack2->GetBinContent(ibin);
128  float qcdBack2=hQcdBack2->GetBinContent(ibin);
129  float rawErr2=hRaw[q]->GetBinContent(ibin);
130  float backToterr=sqrt(eemcBack2+tauBack2+qcdBack2);
131  float finToterr=sqrt(eemcBack2+tauBack2+qcdBack2+rawErr2);
132  hBack->SetBinError(ibin,backToterr);
133  xpos[ibin-startbin]=hBack->GetBinCenter(ibin);
134  ypos[ibin-startbin]=hFinW[q]->GetBinContent(ibin);
135  err[ibin-startbin]=finToterr;
136  }
137  TGraphErrors *errors = new TGraphErrors(50,xpos,ypos,0,err);
138  errors->SetMarkerStyle(8);
139 
140  setMarkerSizePoint(errors, 3.5);
141  errors->SetLineColor(kBlack);
142  if(stage > 2) errors->Draw("p");
143 
144 
145  lg=new TLegend(0.72,0.35,0.98,0.82); // top
146  if(!q) lg=new TLegend(0.72,0.50,0.98,0.82); // top
147  if(q==0) lg->SetHeader(" Positron #font[122]{|}_{_{ }}#eta_{_{ }}#font[122]{|}_{ }_{_{ }}<_{ }1");
148  else lg->SetHeader(" Electron #font[122]{|}_{_{ }}#eta_{_{ }}#font[122]{|}_{ }_{_{ }}<_{ }1");
149  if(q) {
150  lg->AddEntry(hRaw[q],"Candidates","lf");
151  lg->AddEntry(hBack,"Backg. est.","l e");
152  lg->AddEntry(hFinW[q],"Signal","lfep");
153  }
154  lg->SetFillColor(kWhite);
155  lg->SetLineColor(kWhite);
156  lg->SetShadowColor(kWhite);
157  lg->Draw();
158  stripCmdLegend(lg);
159  setTextFontSize(lg, 10.0);
160 
161 
162  if(q==0){
163  TLatex *lat2 = new TLatex(0.36,0.88,SYMBOL_pplusp + "_{ }#rightarrow_{ }#font[12]{W}^{#font[122]{+}}^{}#rightarrow_{ }#font[12]{e}^{#font[122]{+}}_{ }#font[122]{+}_{ }#nu_{#font[12]{e}}");
164  stripCmdLatex(lat2);
165  setTextFontSize(lat2, 10.0);
166  }
167  else{
168  TLatex *lat2 = new TLatex(0.36,0.88,SYMBOL_pplusp + "_{ }#rightarrow_{ }#font[12]{W}^{#font[122]{-}}^{}#rightarrow_{ }#font[12]{e}^{#font[122]{-}}_{ }#font[122]{+}_{ }#bar{#nu}_{#font[12]{e}}");
169  setLineWidthPoint(lat2, 0.5);
170  stripCmdLatex(lat2);
171  setTextFontSize(lat2, 10.0);
172  }
173 
174  lat2->SetNDC(); lat2->Draw("same");
175 
176 
177  if(q){
178  tx=new TLatex(14,3,"Software threshold"); tx->Draw();
179  tx->SetTextAngle(90); stripCmdLatex(tx); setTextFontSize(tx, 10.0);
180  }
181 
182  if(q){
183  tx=new TLatex(58,61,"STAR 2009"); tx->Draw();
184  stripCmdLatex(tx); setTextFontSize(tx, 10.0);
185  }
186 
187  if (q==0) {
188  hRaw[q]->SetTitle("; E^{e}_{T} (" + SYMBOL_GeV + ");Counts");
189  } else
190  hRaw[q]->SetTitle(";;Counts");
191  hRaw[q]->GetXaxis()->CenterTitle(true);
192  hRaw[q]->GetYaxis()->CenterTitle(true);
193 
194 
195  ln=new TLine(7.5,0.,75,0); setLineWidthPoint(ln, 0.5); ln->Draw();
196 
197 
198 }
199 
200 //------------------
201 float getSum(TH1F* h) {
202  h->SetAxisRange(thresET,100);
203  float sum=h->Integral();
204  h->SetAxisRange(0,100);
205  return sum;
206 }