15 |
|
#include <TSQLResult.h> |
16 |
|
#include <TProfile.h> |
17 |
|
#include <TLegendEntry.h> |
18 |
+ |
#include "TMath.h" |
19 |
+ |
#include "Math/DistFunc.h" |
20 |
|
|
21 |
|
using namespace std; |
22 |
|
|
34 |
|
} |
35 |
|
|
36 |
|
|
37 |
+ |
namespace PeakLibrary { |
38 |
+ |
bool StoreHistos=false; |
39 |
+ |
vector<TH1F*> DataHistogram; |
40 |
+ |
vector<TH1F*> MCHistogram; |
41 |
+ |
} |
42 |
+ |
|
43 |
|
|
44 |
|
void find_one_peak_combination(TCut specialcut, bool SwitchOffNJetsCut, float &MCPeak,float &MCPeakError, float &DataPeak, float &DataPeakError, float &MCSigma, float &MCSigmaError, float &DataSigma, float& DataSigmaError, stringstream &result, bool doPUreweighting = true, string saveas="") |
45 |
|
{ |
53 |
|
TCut nJetsCut(cutnJets); |
54 |
|
if(SwitchOffNJetsCut) nJetsCut=specialcut; |
55 |
|
|
56 |
+ |
|
57 |
|
TCanvas *tempcan = new TCanvas("tempcan","Temporary canvas for peak finding preparations"); |
58 |
|
TH1F *rawJZBeemmMC = allsamples.Draw("rawJZBeemmMC",jzbvariablemc,nbins,-50,50, "JZB [GeV]", "events", cutmass&&cutOSSF&&nJetsCut&&specialcut,mc, luminosity); |
59 |
|
TH1F *rawJZBeemmData = allsamples.Draw("rawJZBeemmData",jzbvariabledata,nbins, -50,50, "JZB [GeV]", "events", cutmass&&cutOSSF&&nJetsCut&&specialcut,data, luminosity); |
89 |
|
result << " We have found the peak in Data at " << DataPeak << " +/- " << DataPeakError << " with sigma=" << DataSigma << " +/- " << DataSigmaError << endl; |
90 |
|
dout << " We have found the peak in MC at " << MCPeak << " +/- " << MCPeakError << " with sigma=" << MCSigma << " +/- " << MCSigmaError << endl; |
91 |
|
result << " We have found the peak in MC at " << MCPeak << " +/- " << MCPeakError << " with sigma=" << MCSigma << " +/- " << MCSigmaError << endl; |
92 |
< |
delete rawJZBeemmData; |
93 |
< |
delete rawJZBeemmMC; |
92 |
> |
|
93 |
> |
if(!PeakLibrary::StoreHistos) { |
94 |
> |
delete rawJZBeemmData; |
95 |
> |
delete rawJZBeemmMC; |
96 |
> |
} else { |
97 |
> |
rawJZBeemmMC->SetName(GetNumericHistoName().c_str()); |
98 |
> |
rawJZBeemmData->SetName(GetNumericHistoName().c_str()); |
99 |
> |
rawJZBeemmMC->Add(rawJZBemMC,-1); |
100 |
> |
rawJZBeemmData->Add(rawJZBemData,-1); |
101 |
> |
PeakLibrary::DataHistogram.push_back(rawJZBeemmData); |
102 |
> |
PeakLibrary::MCHistogram.push_back(rawJZBeemmMC); |
103 |
> |
} |
104 |
> |
|
105 |
> |
|
106 |
> |
|
107 |
|
delete rawJZBemData; |
108 |
|
delete rawJZBemMC; |
109 |
|
delete tempcan; |
110 |
|
} |
111 |
|
|
112 |
< |
void DoPeakVsPU() { |
113 |
< |
cout << "Trying to find peak position as a function of PU" << endl; |
112 |
> |
|
113 |
> |
void FindPeakPileUpCorrection() { |
114 |
> |
bool StoreResultsInSeparateFile=true; |
115 |
> |
PeakLibrary::StoreHistos=true; |
116 |
> |
|
117 |
> |
|
118 |
> |
dout << "Finding peak position as a function of PU" << endl; |
119 |
|
float MCPeak, MCPeakError, DataPeak, DataPeakError; |
120 |
|
stringstream result, datajzb, mcjzb; |
121 |
|
bool doPUreweighting=true; |
125 |
|
TCanvas *can = new TCanvas("can","can"); |
126 |
|
float mcSigma,mcSigmaError,dataSigma,dataSigmaError; |
127 |
|
|
128 |
< |
float NumVtxBin[6] = {0,5,10,15,20,30}; |
128 |
> |
const int nbins=10; |
129 |
> |
float NumVtxBin[nbins] = {0,7,9,11,13,15,17,19,21,50}; |
130 |
|
|
131 |
|
stringstream NowCut; |
132 |
|
|
133 |
< |
TGraphErrors *gMCPeak = new TGraphErrors(); |
133 |
> |
|
134 |
> |
Double_t mc_peak_x[nbins]; |
135 |
> |
Double_t mc_peak_y[nbins]; |
136 |
> |
Double_t mc_peak_dxh[nbins]; |
137 |
> |
Double_t mc_peak_dxl[nbins]; |
138 |
> |
Double_t mc_peak_dy[nbins]; |
139 |
> |
|
140 |
> |
Double_t data_peak_x[nbins]; |
141 |
> |
Double_t data_peak_y[nbins]; |
142 |
> |
Double_t data_peak_dxh[nbins]; |
143 |
> |
Double_t data_peak_dxl[nbins]; |
144 |
> |
Double_t data_peak_dy[nbins]; |
145 |
> |
|
146 |
> |
Double_t mc_width_x[nbins]; |
147 |
> |
Double_t mc_width_y[nbins]; |
148 |
> |
Double_t mc_width_dxh[nbins]; |
149 |
> |
Double_t mc_width_dxl[nbins]; |
150 |
> |
Double_t mc_width_dy[nbins]; |
151 |
> |
|
152 |
> |
Double_t data_width_x[nbins]; |
153 |
> |
Double_t data_width_y[nbins]; |
154 |
> |
Double_t data_width_dxh[nbins]; |
155 |
> |
Double_t data_width_dxl[nbins]; |
156 |
> |
Double_t data_width_dy[nbins]; |
157 |
> |
|
158 |
> |
for(int i=0;i<nbins-1;i++) { |
159 |
> |
NowCut.str(""); |
160 |
> |
NowCut << "numVtx>" << NumVtxBin[i] << "&&numVtx<=" << NumVtxBin[i+1]; |
161 |
> |
cout << "NVtx cut is now : " << NowCut.str() << endl; |
162 |
> |
find_one_peak_combination(TCut(NowCut.str().c_str()),SwitchOffNJetsCut,MCPeak,MCPeakError, DataPeak,DataPeakError,mcSigma,mcSigmaError, dataSigma,dataSigmaError,result,doPUreweighting,""); |
163 |
> |
cout << " " << MCPeak << " +/- " << MCPeakError << endl; |
164 |
> |
cout << " " << DataPeak << " +/- " << DataPeakError << endl; |
165 |
> |
|
166 |
> |
TH1F *hDataSFNumVtx = allsamples.Draw("hDataSFNumVtx","numVtx",100,-0.5,49.5, "N_{vtx}", "events", cutmass&&cutOSSF&&cutnJets&&TCut(NowCut.str().c_str()),data, luminosity); |
167 |
> |
TH1F *hDataOFNumVtx = allsamples.Draw("hDataOFNumVtx","numVtx",100,-0.5,49.5, "N_{vtx}", "events", cutmass&&cutOSOF&&cutnJets&&TCut(NowCut.str().c_str()),data, luminosity); |
168 |
> |
TH1F *hMCSFNumVtx = allsamples.Draw("hMCSFNumVtx","numVtx",100,-0.5,49.5, "N_{vtx}", "events", cutmass&&cutOSSF&&cutnJets&&TCut(NowCut.str().c_str()),mc, luminosity); |
169 |
> |
TH1F *hMCOFNumVtx = allsamples.Draw("hMCOFNumVtx","numVtx",100,-0.5,49.5, "N_{vtx}", "events", cutmass&&cutOSOF&&cutnJets&&TCut(NowCut.str().c_str()),mc, luminosity); |
170 |
> |
|
171 |
> |
hDataSFNumVtx->Add(hDataOFNumVtx,-1); |
172 |
> |
hMCSFNumVtx->Add(hMCOFNumVtx,-1); |
173 |
> |
|
174 |
> |
mc_peak_x[i]=hMCSFNumVtx->GetMean(); |
175 |
> |
mc_peak_y[i]=MCPeak; |
176 |
> |
mc_peak_dy[i]=MCPeakError; |
177 |
> |
|
178 |
> |
data_peak_x[i]=hDataSFNumVtx->GetMean(); |
179 |
> |
data_peak_y[i]=DataPeak; |
180 |
> |
data_peak_dy[i]=DataPeakError; |
181 |
> |
|
182 |
> |
mc_width_x[i]=hMCSFNumVtx->GetMean(); |
183 |
> |
mc_width_y[i]=mcSigma; |
184 |
> |
mc_width_dy[i]=mcSigmaError; |
185 |
> |
|
186 |
> |
data_width_x[i]=hDataSFNumVtx->GetMean(); |
187 |
> |
data_width_y[i]=dataSigma; |
188 |
> |
data_width_dy[i]=dataSigmaError; |
189 |
> |
|
190 |
> |
delete hDataSFNumVtx; |
191 |
> |
delete hDataOFNumVtx; |
192 |
> |
delete hMCSFNumVtx; |
193 |
> |
delete hMCOFNumVtx; |
194 |
> |
} |
195 |
> |
|
196 |
> |
for(int i=0;i<nbins-1;i++) { |
197 |
> |
if(i==0) { |
198 |
> |
data_width_dxl[i]=data_width_x[i]; |
199 |
> |
data_peak_dxl[i]=data_peak_x[i]; |
200 |
> |
data_width_dxh[i]=0.5*(data_width_x[i+1]-data_width_x[i]); |
201 |
> |
data_peak_dxh[i]=0.5*(data_peak_x[i+1]-data_peak_x[i]); |
202 |
> |
|
203 |
> |
mc_width_dxl[i]=mc_width_x[i]; |
204 |
> |
mc_peak_dxl[i]=mc_peak_x[i]; |
205 |
> |
mc_width_dxh[i]=0.5*(mc_width_x[i+1]-mc_width_x[i]); |
206 |
> |
mc_peak_dxh[i]=0.5*(mc_peak_x[i+1]-mc_peak_x[i]); |
207 |
> |
} else if(i==nbins-2) { |
208 |
> |
data_width_dxl[i]=0.5*(data_width_x[i]-data_width_x[i-1]); |
209 |
> |
data_peak_dxl[i]=0.5*(data_peak_x[i]-data_peak_x[i-1]); |
210 |
> |
data_width_dxh[i]=50-data_width_x[i]; |
211 |
> |
data_peak_dxh[i]=50-data_peak_x[i]; |
212 |
> |
|
213 |
> |
mc_width_dxl[i]=0.5*(mc_width_x[i]-mc_width_x[i-1]); |
214 |
> |
mc_peak_dxl[i]=0.5*(mc_peak_x[i]-mc_peak_x[i-1]); |
215 |
> |
mc_width_dxh[i]=50-mc_width_x[i]; |
216 |
> |
mc_peak_dxh[i]=50-mc_peak_x[i]; |
217 |
> |
} else { |
218 |
> |
data_width_dxl[i]=0.5*(data_width_x[i]-data_width_x[i-1]); |
219 |
> |
data_peak_dxl[i]=0.5*(data_peak_x[i]-data_peak_x[i-1]); |
220 |
> |
data_width_dxh[i]=0.5*(data_width_x[i+1]-data_width_x[i]); |
221 |
> |
data_peak_dxh[i]=0.5*(data_peak_x[i+1]-data_peak_x[i]); |
222 |
> |
|
223 |
> |
mc_width_dxl[i]=0.5*(mc_width_x[i]-mc_width_x[i-1]); |
224 |
> |
mc_peak_dxl[i]=0.5*(mc_peak_x[i]-mc_peak_x[i-1]); |
225 |
> |
mc_width_dxh[i]=0.5*(mc_width_x[i+1]-mc_width_x[i]); |
226 |
> |
mc_peak_dxh[i]=0.5*(mc_peak_x[i+1]-mc_peak_x[i]); |
227 |
> |
} |
228 |
> |
} |
229 |
> |
|
230 |
> |
TGraphAsymmErrors *gMCPeak = new TGraphAsymmErrors(nbins-1,mc_peak_x,mc_peak_y,mc_peak_dxl,mc_peak_dxh,mc_peak_dy,mc_peak_dy); |
231 |
|
gMCPeak->SetTitle("gMCPeak"); |
232 |
|
gMCPeak->SetName("gMCPeak"); |
233 |
< |
TGraphErrors *gDataPeak = new TGraphErrors(); |
233 |
> |
|
234 |
> |
TGraphAsymmErrors *gDataPeak = new TGraphAsymmErrors(nbins-1,data_peak_x,data_peak_y,data_peak_dxl,data_peak_dxh,data_peak_dy,data_peak_dy); |
235 |
|
gDataPeak->SetTitle("gDataPeak"); |
236 |
|
gDataPeak->SetName("gDataPeak"); |
237 |
< |
TGraphErrors *gMCWidth = new TGraphErrors(); |
237 |
> |
|
238 |
> |
TGraphAsymmErrors *gMCWidth = new TGraphAsymmErrors(nbins-1,mc_width_x,mc_width_y,mc_width_dxl,mc_width_dxh,mc_width_dy,mc_width_dy); |
239 |
|
gMCWidth->SetTitle("gMCWidth"); |
240 |
|
gMCWidth->SetName("gMCWidth"); |
241 |
< |
TGraphErrors *gDataWidth = new TGraphErrors(); |
241 |
> |
|
242 |
> |
TGraphAsymmErrors *gDataWidth = new TGraphAsymmErrors(nbins-1,data_width_x,data_width_y,data_width_dxl,data_width_dxh,data_width_dy,data_width_dy); |
243 |
|
gDataWidth->SetTitle("gDataWidth"); |
244 |
|
gDataWidth->SetName("gDataWidth"); |
245 |
|
|
118 |
– |
for(int i=0;i<5;i++) { |
119 |
– |
NowCut.str(""); |
120 |
– |
NowCut << "numVtx>=" << NumVtxBin[i] << "&&numVtx<" << NumVtxBin[i+1]; |
121 |
– |
find_one_peak_combination(TCut(NowCut.str().c_str()),SwitchOffNJetsCut,MCPeak,MCPeakError, DataPeak,DataPeakError,mcSigma,mcSigmaError, dataSigma,dataSigmaError,result,doPUreweighting,""); |
122 |
– |
cout << " " << MCPeak << " +/- " << MCPeakError << endl; |
123 |
– |
cout << " " << DataPeak << " +/- " << DataPeakError << endl; |
124 |
– |
|
125 |
– |
gMCPeak->SetPoint(i,0.5*(NumVtxBin[i]+NumVtxBin[i+1]),MCPeak); |
126 |
– |
gMCPeak->SetPointError(i,0.5*(NumVtxBin[i+1]-NumVtxBin[i]),MCPeakError); |
127 |
– |
|
128 |
– |
gDataPeak->SetPoint(i,0.5*(NumVtxBin[i]+NumVtxBin[i+1]),DataPeak); |
129 |
– |
gDataPeak->SetPointError(i,0.5*(NumVtxBin[i+1]-NumVtxBin[i]),DataPeakError); |
130 |
– |
|
131 |
– |
gMCWidth->SetPoint(i,0.5*(NumVtxBin[i]+NumVtxBin[i+1]),mcSigma); |
132 |
– |
gMCWidth->SetPointError(i,0.5*(NumVtxBin[i+1]-NumVtxBin[i]),mcSigmaError); |
133 |
– |
|
134 |
– |
gDataWidth->SetPoint(i,0.5*(NumVtxBin[i]+NumVtxBin[i+1]),dataSigma); |
135 |
– |
gDataWidth->SetPointError(i,0.5*(NumVtxBin[i+1]-NumVtxBin[i]),dataSigmaError); |
136 |
– |
} |
137 |
– |
|
246 |
|
can->cd(); |
247 |
|
gMCPeak->GetXaxis()->SetTitle("N(Vertices)"); |
248 |
|
gMCPeak->GetYaxis()->SetTitle("Peak position"); |
267 |
|
gDataWidth->SetFillColor(TColor::GetColor("#2E9AFE")); |
268 |
|
gMCWidth->SetFillColor(TColor::GetColor("#2E9AFE")); |
269 |
|
|
270 |
+ |
can->cd(); |
271 |
|
gMCPeak->Draw("A2"); |
272 |
|
DrawMCPrelim(); |
273 |
|
CompleteSave(can,"PUStudy/MCPeak"); |
274 |
+ |
|
275 |
|
can->cd(); |
276 |
< |
gMCWidth->Draw("A2"); |
276 |
> |
gStyle->SetOptFit(0); |
277 |
> |
gMCPeak->Fit("pol1"); |
278 |
> |
gMCPeak->GetYaxis()->SetRangeUser(0,15); |
279 |
> |
TF1 *MCFit = (TF1*)gMCPeak->GetFunction("pol1"); |
280 |
> |
|
281 |
> |
gMCPeak->Draw("A2"); |
282 |
> |
MCFit->SetLineColor(kBlue); |
283 |
> |
MCFit->SetLineWidth(2); |
284 |
> |
MCFit->Draw("same"); |
285 |
> |
stringstream mresult; |
286 |
> |
mresult << "Slope: " << std::setprecision(2) << MCFit->GetParameter(1) << " +/- " << MCFit->GetParError(1); |
287 |
> |
TText* mrestitle = write_text(0.7,0.2,mresult.str()); |
288 |
> |
mrestitle->Draw(); |
289 |
> |
DrawMCPrelim(); |
290 |
> |
CompleteSave(can,"PUStudy/MCPeak_Fit"); |
291 |
> |
|
292 |
> |
gMCPeak->Draw("A2"); |
293 |
|
DrawMCPrelim(); |
294 |
|
CompleteSave(can,"PUStudy/MCWidth"); |
169 |
– |
can->cd(); |
295 |
|
|
296 |
+ |
|
297 |
+ |
can->cd(); |
298 |
|
gDataPeak->Draw("A2"); |
299 |
|
DrawPrelim(); |
300 |
|
CompleteSave(can,"PUStudy/DataPeak"); |
301 |
+ |
|
302 |
+ |
can->cd(); |
303 |
+ |
gStyle->SetOptFit(0); |
304 |
+ |
gDataPeak->GetYaxis()->SetRangeUser(0,15); |
305 |
+ |
gDataPeak->Fit("pol1"); |
306 |
+ |
|
307 |
+ |
TF1 *DataFit = (TF1*)gDataPeak->GetFunction("pol1"); |
308 |
+ |
DataFit->SetLineColor(kBlue); |
309 |
+ |
DataFit->SetLineWidth(2); |
310 |
+ |
DataFit->Draw("same"); |
311 |
+ |
stringstream dresult; |
312 |
+ |
dresult << "Slope: " << std::setprecision(2) << DataFit->GetParameter(1) << " +/- " << DataFit->GetParError(1); |
313 |
+ |
TText* drestitle = write_text(0.7,0.2,dresult.str()); |
314 |
+ |
drestitle->Draw(); |
315 |
+ |
DrawPrelim(); |
316 |
+ |
CompleteSave(can,"PUStudy/DataPeak_Fit"); |
317 |
+ |
|
318 |
|
can->cd(); |
319 |
|
gDataWidth->Draw("A2"); |
320 |
|
DrawPrelim(); |
321 |
|
CompleteSave(can,"PUStudy/DataWidth"); |
322 |
|
|
323 |
+ |
if(StoreResultsInSeparateFile) { |
324 |
+ |
TFile *PeakFinding = new TFile("PeakFindingWithPeakCorrection.root","RECREATE"); |
325 |
+ |
gMCPeak->Write(); |
326 |
+ |
gDataPeak->Write(); |
327 |
+ |
gMCWidth->Write(); |
328 |
+ |
gDataWidth->Write(); |
329 |
+ |
PeakFinding->Close(); |
330 |
+ |
} |
331 |
|
|
332 |
|
|
333 |
< |
delete can; |
333 |
> |
dout << "The suggested correction for Data is : " << DataFit->GetParameter(1) << endl; |
334 |
> |
dout << "The suggested correction for MC is : " << MCFit->GetParameter(1) << endl; |
335 |
|
|
336 |
+ |
TLegend *leg = make_legend(); |
337 |
+ |
can->cd(); |
338 |
+ |
int j=0; |
339 |
+ |
for(int i=PeakLibrary::DataHistogram.size()-5;i<PeakLibrary::DataHistogram.size();i++) { |
340 |
+ |
PeakLibrary::DataHistogram[i]->Rebin(5); |
341 |
+ |
PeakLibrary::DataHistogram[i]->SetLineColor(j+1); |
342 |
+ |
if(i==PeakLibrary::DataHistogram.size()-5) PeakLibrary::DataHistogram[i]->DrawNormalized("histo"); |
343 |
+ |
else PeakLibrary::DataHistogram[i]->DrawNormalized("histo,same"); |
344 |
+ |
stringstream name; |
345 |
+ |
name << NumVtxBin[j] << " < N_{vtx} < " << NumVtxBin[j+1]; |
346 |
+ |
leg->AddEntry(PeakLibrary::DataHistogram[i],name.str().c_str(),"l"); |
347 |
+ |
j++; |
348 |
+ |
} |
349 |
+ |
|
350 |
+ |
leg->Draw(); |
351 |
+ |
DrawPrelim(); |
352 |
+ |
CompleteSave(can,"PUStudy/DataOverview"); |
353 |
+ |
|
354 |
+ |
TLegend *leg2 = make_legend(); |
355 |
+ |
can->cd(); |
356 |
+ |
j=0; |
357 |
+ |
for(int i=PeakLibrary::MCHistogram.size()-5;i<PeakLibrary::MCHistogram.size();i++) { |
358 |
+ |
PeakLibrary::MCHistogram[i]->Rebin(5); |
359 |
+ |
PeakLibrary::MCHistogram[i]->SetLineColor(j+1); |
360 |
+ |
if(i==PeakLibrary::MCHistogram.size()-5) PeakLibrary::MCHistogram[i]->DrawNormalized("histo"); |
361 |
+ |
else PeakLibrary::MCHistogram[i]->DrawNormalized("histo,same"); |
362 |
+ |
stringstream name; |
363 |
+ |
name << NumVtxBin[j] << " < N_{vtx} < " << NumVtxBin[j+1]; |
364 |
+ |
leg->AddEntry(PeakLibrary::MCHistogram[i],name.str().c_str(),"l"); |
365 |
+ |
j++; |
366 |
+ |
} |
367 |
+ |
|
368 |
+ |
leg->Draw(); |
369 |
+ |
DrawPrelim(); |
370 |
+ |
CompleteSave(can,"PUStudy/MCOverview"); |
371 |
+ |
|
372 |
+ |
delete can; |
373 |
+ |
PeakLibrary::StoreHistos=false; |
374 |
|
} |
375 |
|
|
376 |
+ |
|
377 |
+ |
|
378 |
|
void find_peaks(float &MCPeak,float &MCPeakError, float &DataPeak, float &DataPeakError, stringstream &result, bool doPUreweighting, stringstream &datajzb, stringstream &mcjzb, string sSpecialCut="", bool SwitchOffNJetsCut=false) |
379 |
|
{ |
380 |
|
bool overunderflowstatus=addoverunderflowbins; |
432 |
|
|
433 |
|
} else { |
434 |
|
datajzb << "(" << jzbvariabledata; |
435 |
< |
mcjzb << "(" << jzbvariablemc; |
435 |
> |
mcjzb << "(" << jzbvariablemc; |
436 |
|
|
437 |
|
if(datapeak>0) datajzb << "- " << TMath::Abs(datapeak) << " "; |
438 |
|
else datajzb << "+ " << TMath::Abs(datapeak) << " "; |
452 |
|
switch_overunderflow(overunderflowstatus); |
453 |
|
} |
454 |
|
|
455 |
< |
void make_special_obs_pred_mll_plot(string datajzb, string mcjzb, float jzbthreshold, float binWidth = 5.0) { |
455 |
> |
void make_special_obs_pred_mll_plot(string datajzb, string mcjzb, float jzbthreshold, float binWidth, int MCorData) { |
456 |
|
float min=70.0; |
457 |
|
float max=115.0; |
458 |
|
if(!PlottingSetup::RestrictToMassPeak) { |
461 |
|
} |
462 |
|
int nbins=int((max-min)/binWidth); |
463 |
|
|
464 |
+ |
string prefix=""; |
465 |
+ |
if(MCorData==mc) prefix="MC__"; |
466 |
+ |
|
467 |
+ |
|
468 |
+ |
if(MCorData==mc) datajzb=mcjzb; |
469 |
+ |
|
470 |
|
TCanvas *ckin = new TCanvas("ckin","Kinematic Plots (in the making)",600,600); |
471 |
|
|
472 |
|
stringstream largerzeroS; |
482 |
|
largerzeroMS << "(" << mcjzb << ">" << jzbthreshold << ")"; |
483 |
|
TCut largerzeroM(largerzeroMS.str().c_str()); |
484 |
|
|
485 |
< |
TH1F *RcorrJZBeemm = allsamples.Draw("RcorrJZBeemm", "mll",nbins,min,max, "m_{ll} [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&largerzeroD,data,luminosity); |
486 |
< |
THStack mcRcorrJZBeemm = allsamples.DrawStack("mcRcorrJZBeemm","mll",nbins,min,max, "m_{ll} [GeV}", "events", cutmass&&cutOSSF&&cutnJets&&largerzeroM,mc,luminosity); |
487 |
< |
TH1F *LcorrJZBeemm = allsamples.Draw("LcorrJZBeemm", "mll",nbins,min,max, "m_{ll} [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&smallerzeroD,data,luminosity); |
488 |
< |
TH1F *RcorrJZBem = allsamples.Draw("RcorrJZBem", "mll",nbins,min,max, "m_{ll} [GeV]", "events", cutmass&&cutOSOF&&cutnJets&&largerzeroD,data,luminosity); |
489 |
< |
TH1F *LcorrJZBem = allsamples.Draw("LcorrJZBem", "mll",nbins,min,max, "m_{ll} [GeV]", "events", cutmass&&cutOSOF&&cutnJets&&smallerzeroD,data,luminosity); |
485 |
> |
|
486 |
> |
stringstream smallerzeroMS; |
487 |
> |
smallerzeroMS << "(" << mcjzb << "<-" << jzbthreshold << ")"; |
488 |
> |
TCut smallerzeroM(smallerzeroMS.str().c_str()); |
489 |
> |
|
490 |
> |
TH1F *RcorrJZBeemm = allsamples.Draw("RcorrJZBeemm", "mll",nbins,min,max, "m_{ll} [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&largerzeroD,MCorData,luminosity); |
491 |
> |
THStack mcRcorrJZBeemm = allsamples.DrawStack("mcRcorrJZBeemm","mll",nbins,min,max, "m_{ll} [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&largerzeroM,mc,luminosity); |
492 |
> |
TH1F *LcorrJZBeemm = allsamples.Draw("LcorrJZBeemm", "mll",nbins,min,max, "m_{ll} [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&smallerzeroD,MCorData,luminosity); |
493 |
> |
TH1F *RcorrJZBem = allsamples.Draw("RcorrJZBem", "mll",nbins,min,max, "m_{ll} [GeV]", "events", cutmass&&cutOSOF&&cutnJets&&largerzeroD,MCorData,luminosity); |
494 |
> |
TH1F *LcorrJZBem = allsamples.Draw("LcorrJZBem", "mll",nbins,min,max, "m_{ll} [GeV]", "events", cutmass&&cutOSOF&&cutnJets&&smallerzeroD,MCorData,luminosity); |
495 |
|
|
496 |
|
TH1F *RcorrJZBSBem; |
497 |
|
TH1F *LcorrJZBSBem; |
501 |
|
// TH1F *RcorrJZBeemmNoS; |
502 |
|
|
503 |
|
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
504 |
< |
RcorrJZBSBem = allsamples.Draw("RcorrJZBSBem", "mll",nbins,min,max, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets&&largerzeroD,data, luminosity); |
505 |
< |
LcorrJZBSBem = allsamples.Draw("LcorrJZBSBem", "mll",nbins,min,max, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets&&smallerzeroD,data, luminosity); |
506 |
< |
RcorrJZBSBeemm = allsamples.Draw("RcorrJZBSBeemm","mll",nbins,min,max, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets&&largerzeroD,data, luminosity); |
507 |
< |
LcorrJZBSBeemm = allsamples.Draw("LcorrJZBSBeemm","mll",nbins,min,max, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets&&smallerzeroD,data, luminosity); |
504 |
> |
RcorrJZBSBem = allsamples.Draw("RcorrJZBSBem", "mll",nbins,min,max, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets&&largerzeroD,MCorData, luminosity); |
505 |
> |
LcorrJZBSBem = allsamples.Draw("LcorrJZBSBem", "mll",nbins,min,max, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets&&smallerzeroD,MCorData, luminosity); |
506 |
> |
RcorrJZBSBeemm = allsamples.Draw("RcorrJZBSBeemm","mll",nbins,min,max, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets&&largerzeroD,MCorData, luminosity); |
507 |
> |
LcorrJZBSBeemm = allsamples.Draw("LcorrJZBSBeemm","mll",nbins,min,max, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets&&smallerzeroD,MCorData, luminosity); |
508 |
|
} |
509 |
< |
|
510 |
< |
// Separate predictions |
509 |
> |
|
510 |
> |
// Separate predictions |
511 |
|
TH1F* SFN = (TH1F*)LcorrJZBeemm->Clone("SFN"); |
512 |
|
TH1F* OFP = (TH1F*)RcorrJZBem->Clone("OFP"); |
513 |
|
TH1F* OFN = (TH1F*)LcorrJZBem->Clone("OFN"); |
514 |
+ |
|
515 |
+ |
TH1F *BpredSys = (TH1F*)SFN->Clone("BpredSys"); |
516 |
+ |
ClearHisto(BpredSys); |
517 |
+ |
AddSquared(BpredSys,SFN,pow(PlottingSetup::zjetsestimateuncertOFFPEAK,2)); |
518 |
+ |
|
519 |
|
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
520 |
|
OFP->Scale(1.0/3.0); |
521 |
|
OFP->Add(RcorrJZBSBem,1.0/3.); |
523 |
|
OFN->Scale(1.0/3.0); |
524 |
|
OFN->Add(LcorrJZBSBem,1.0/3.); |
525 |
|
OFN->Add(LcorrJZBSBeemm,1.0/3.); |
526 |
< |
} |
526 |
> |
AddSquared(BpredSys,RcorrJZBem,pow((1.0/3) * PlottingSetup::emuncertOFFPEAK,2)); |
527 |
> |
AddSquared(BpredSys,RcorrJZBSBem,pow((1.0/3) * PlottingSetup::emuncertOFFPEAK,2)); |
528 |
> |
AddSquared(BpredSys,RcorrJZBSBeemm,pow((1.0/3) * PlottingSetup::emuncertOFFPEAK,2)); |
529 |
> |
} else { |
530 |
> |
AddSquared(BpredSys,OFN,pow(PlottingSetup::emuncertOFFPEAK,2)); |
531 |
> |
} |
532 |
|
|
533 |
+ |
SQRT(BpredSys); |
534 |
+ |
|
535 |
+ |
TGraphErrors *BpredSysBand = new TGraphErrors(); |
536 |
+ |
// TH1F *BpredSysBand = (TH1F*)BpredSys->Clone("BpredSysBand"); |
537 |
+ |
|
538 |
+ |
for(int i=1;i<=BpredSys->GetNbinsX();i++) { |
539 |
+ |
/*BpredSysBand->SetBinError(i,BpredSysBand->GetBinContent(i)); |
540 |
+ |
BpredSysBand->SetBinContent(i,0);*/ |
541 |
+ |
float dx=0.5*BpredSys->GetBinWidth(i); |
542 |
+ |
float dy=BpredSys->GetBinContent(i); |
543 |
+ |
BpredSysBand->SetPoint(i-1,BpredSys->GetBinCenter(i),0); |
544 |
+ |
BpredSysBand->SetPointError(i-1,dx,dy); |
545 |
+ |
} |
546 |
+ |
|
547 |
+ |
delete BpredSys; |
548 |
+ |
BpredSysBand->SetFillColor(TColor::GetColor("#2E9AFE")); |
549 |
+ |
|
550 |
|
TH1F* Bpred = (TH1F*)SFN->Clone("Bpred"); |
551 |
|
Bpred->Add(OFP); |
552 |
|
Bpred->Add(OFN,-1); |
565 |
|
leg->Draw("same"); |
566 |
|
|
567 |
|
stringstream saveas; |
568 |
< |
saveas << "kin/Mll_After_Cut/Cut_At" << jzbthreshold; |
568 |
> |
saveas << "kin/Mll_After_Cut/" << prefix << "Cut_At" << jzbthreshold; |
569 |
|
CompleteSave(ckin,saveas.str()); |
570 |
|
|
571 |
|
// Draw all predictions overlayed |
588 |
|
RcorrJZBeemm->Draw("same"); |
589 |
|
|
590 |
|
TLegend *leg2 = make_legend("",0.52,0.7); |
591 |
< |
// leg2->AddEntry(RcorrJZBeemm,"observed (data)","lp"); |
592 |
< |
leg2->AddEntry(Bpred,"predicted (data)","l"); |
593 |
< |
leg2->AddEntry(SFN, " SF JZB<0","l"); |
594 |
< |
leg2->AddEntry(OFN, " OF JZB<0","l"); |
595 |
< |
leg2->AddEntry(OFP, " OF JZB>0","l"); |
591 |
> |
if(MCorData==data) { |
592 |
> |
leg2->AddEntry(RcorrJZBeemm,"observed (data)","lp"); |
593 |
> |
leg2->AddEntry(Bpred,"predicted (data)","l"); |
594 |
> |
} else { |
595 |
> |
leg2->AddEntry(RcorrJZBeemm,"true (MC)","lp"); |
596 |
> |
leg2->AddEntry(Bpred,"predicted (MC)","l"); |
597 |
> |
} |
598 |
> |
|
599 |
> |
if(jzbthreshold>0) { |
600 |
> |
leg2->AddEntry(SFN, (" SF JZB<-"+any2string(jzbthreshold)).c_str(),"l"); |
601 |
> |
leg2->AddEntry(OFN, (" OF JZB<-"+any2string(jzbthreshold)).c_str(),"l"); |
602 |
> |
} else { |
603 |
> |
leg2->AddEntry(SFN, " SF JZB<0","l"); |
604 |
> |
leg2->AddEntry(OFN, " OF JZB<0","l"); |
605 |
> |
} |
606 |
> |
leg2->AddEntry(OFP, (" OF JZB>"+any2string(jzbthreshold)).c_str(),"l"); |
607 |
|
leg2->Draw("same"); |
608 |
|
|
609 |
|
saveas.str(""); |
610 |
< |
saveas << "kin/Mll_After_Cut/Cut_At" << jzbthreshold << "_nomc"; |
610 |
> |
saveas << "kin/Mll_After_Cut/" << prefix << "Cut_At" << jzbthreshold << "_nomc"; |
611 |
> |
CompleteSave(ckin,saveas.str()); |
612 |
> |
|
613 |
> |
|
614 |
> |
TH1F *diff = (TH1F*)RcorrJZBeemm->Clone("diff"); |
615 |
> |
diff->Add(Bpred,-1); |
616 |
> |
|
617 |
> |
TLegend *dleg = make_legend(); |
618 |
> |
if(MCorData==data) dleg->AddEntry(diff,"Obs-predicted","p"); |
619 |
> |
else dleg->AddEntry(diff,"True-predicted","p"); |
620 |
> |
dleg->AddEntry(BpredSysBand,"Sys. envelope","f"); |
621 |
> |
dleg->SetY1(0.7); |
622 |
> |
|
623 |
> |
|
624 |
> |
diff->GetYaxis()->SetTitle("true - predicted"); |
625 |
> |
if(MCorData==data) diff->GetYaxis()->SetTitle("observed - predicted"); |
626 |
> |
diff->Draw("e1"); |
627 |
> |
BpredSysBand->Draw("e2"); |
628 |
> |
diff->Draw("e1,same"); |
629 |
> |
dleg->Draw(); |
630 |
> |
|
631 |
> |
if(MCorData==data) DrawPrelim(); |
632 |
> |
else DrawMCPrelim(); |
633 |
> |
|
634 |
> |
saveas.str(""); |
635 |
> |
saveas << "kin/Mll_After_Cut/" << prefix << "Cut_At" << jzbthreshold << "_nomc_Diff"; |
636 |
|
CompleteSave(ckin,saveas.str()); |
637 |
+ |
|
638 |
+ |
delete BpredSysBand; |
639 |
+ |
delete diff; |
640 |
|
|
641 |
|
delete RcorrJZBeemm; |
642 |
|
delete LcorrJZBeemm; |
643 |
|
delete RcorrJZBem; |
644 |
|
delete LcorrJZBem; |
645 |
+ |
|
646 |
|
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
647 |
|
delete RcorrJZBSBeemm; |
648 |
|
delete LcorrJZBSBeemm; |
772 |
|
// signalhisto->SetLineStyle(2); |
773 |
|
datahistoSF->SetMarkerSize(DataMarkerSize); |
774 |
|
datahistoOF->SetLineColor(kRed); |
775 |
+ |
datahistoOF->SetLineWidth(2); |
776 |
+ |
|
777 |
+ |
datahistoOF->Scale(1.02); // R(SF/OF) |
778 |
|
|
779 |
|
if ( !logscale ) { |
780 |
|
datahistoSF->SetMinimum(0); // Defaults |
795 |
|
datahistoSF->GetXaxis()->CenterTitle(); |
796 |
|
datahistoSF->GetYaxis()->CenterTitle(); |
797 |
|
|
798 |
< |
TLegend *mleg = make_legend(legendTitle.c_str(),legendPosition,0.7,false,legendPosition+0.2); |
798 |
> |
TLegend *mleg = make_legend(legendTitle.c_str(),legendPosition,0.6,false,legendPosition+0.2); |
799 |
|
mleg->AddEntry(datahistoSF, "Same-flavor", "PL"); |
800 |
|
if (datahistoOF->Integral()>0) { |
801 |
< |
mleg->AddEntry(datahistoOF, "Opposite-flavor", "L"); |
801 |
> |
mleg->AddEntry(datahistoOF, "OF based estimate", "L"); |
802 |
|
} else { |
803 |
|
mleg->AddEntry((TObject*)0, "", ""); |
804 |
|
} |
805 |
|
//mleg->AddEntry(signalhisto, "LM3", "L"); |
806 |
|
|
807 |
|
datahistoSF->Draw("E1"); |
808 |
+ |
|
809 |
+ |
TH1F *syshisto = (TH1F*)datahistoOF->Clone("syshisto"); |
810 |
+ |
TGraphAsymmErrors *datahistoOFboxes = produce_ratio_graph(datahistoOF); |
811 |
+ |
for(int i=0;i<datahistoOFboxes->GetN();i++) { |
812 |
+ |
float ex=datahistoOFboxes->GetErrorX(i); |
813 |
+ |
float ey=datahistoOFboxes->GetErrorY(i); |
814 |
+ |
double x,y; |
815 |
+ |
datahistoOFboxes->GetPoint(i,x,y); |
816 |
+ |
float pey = sqrt(pow(y*0.07,2)+pow(datahistoOF->GetBinError(i+1),2)); |
817 |
+ |
datahistoOFboxes->SetPointError(ex,ex,pey,pey); |
818 |
+ |
syshisto->SetBinContent(i+1,0.07); |
819 |
+ |
syshisto->SetBinError(i+1,0.07); |
820 |
+ |
if(y<0.01) datahistoOF->SetBinContent(i+1,0); |
821 |
+ |
} |
822 |
+ |
mleg->AddEntry(datahistoOFboxes,"Total uncert.","F"); |
823 |
+ |
datahistoOFboxes->SetFillColor(TColor::GetColor("#2E9AFE")); |
824 |
+ |
|
825 |
+ |
if (datahistoOF->Integral()>0) datahistoOFboxes->Draw("20"); |
826 |
|
if (datahistoOF->Integral()>0) datahistoOF->Draw("HIST,SAMES"); |
827 |
+ |
|
828 |
+ |
datahistoSF->Draw("E1,same"); |
829 |
+ |
|
830 |
|
//signalhisto->Draw("HIST,SAMES"); |
831 |
|
mleg->Draw(); |
832 |
|
DrawPrelim(); |
833 |
|
if (datahistoOF->Integral()>0) { |
834 |
< |
Save_With_Ratio( datahistoSF, datahistoOF, rcan, "SFOF/" + filename, false, false, "SF/OF" ); |
834 |
> |
// Save_With_Ratio( datahistoSF, datahistoOF, rcan, "SFOF/" + filename, false, false, "SF/OF" ); |
835 |
> |
save_with_ratio_and_sys_band(0, datahistoSF, datahistoOF, rcan, "SFOF/" + filename, false, false, "SF/OF",syshisto); |
836 |
|
} else { |
837 |
|
CompleteSave(rcan, "SFOF/" + filename); |
838 |
|
} |
840 |
|
datahistoSF->Delete(); |
841 |
|
datahistoOF->Delete(); |
842 |
|
//signalhisto->Delete(); |
843 |
+ |
delete datahistoOFboxes; |
844 |
+ |
delete syshisto; |
845 |
|
delete mleg; |
846 |
|
delete rcan; |
847 |
|
delete ofsf_can; |
550 |
– |
|
848 |
|
return ymaxSet; |
552 |
– |
|
849 |
|
} |
850 |
|
|
851 |
|
// Compare data to data |
906 |
|
} |
907 |
|
|
908 |
|
void make_OFSF_plots(string variable, string addcut, int nbins, float min, float max, bool logscale, |
909 |
< |
string xlabel, string filename, float legendPosition=0.55) { |
909 |
> |
string xlabel, string filename, float tymax=-1, float legendPosition=0.55) { |
910 |
|
|
911 |
|
string mllcuts[] = { "mll>20","mll>15&&mll<70", "mll>75&&mll<105", "mll>120" }; |
912 |
|
string mllcutname[] = { "m_{ll} > 20 GeV", "20 < m_{ll} < 70 GeV", "70 < m_{ll} < 110 GeV", "m_{ll} > 120 GeV" }; |
913 |
|
string plotname[] = {"_all","_low","_peak","_high"}; |
914 |
|
float ymax; |
915 |
+ |
if(tymax>0) ymax=tymax; |
916 |
|
|
917 |
|
int start = 0; |
918 |
|
if ( !PlottingSetup::openBox ) start = 3; |
919 |
|
|
920 |
|
for ( int i=start; i<4; ++i ) { |
921 |
|
if ( addcut != "" ) mllcuts[i] += "&&"+addcut; |
922 |
< |
if ( i==start ) { |
922 |
> |
if ( i==start && !(tymax>0) ) { |
923 |
|
ymax = make_one_OFSF_plot(variable, mllcuts[i], mllcutname[i], nbins, min, max, -1, logscale, xlabel, |
924 |
|
filename+plotname[i], legendPosition ); |
925 |
|
} else { |
1344 |
|
string xlabel="m_{ll} [GeV]"; |
1345 |
|
|
1346 |
|
TCanvas *can2 = new TCanvas("can2","can2"); |
1347 |
< |
TH1F *TwoOF = allsamples.Draw("TwoOF","mll",nbins,min,max, xlabel, "events",cutOSOF&&signal&&TwoJets,mc,luminosity,allsamples.FindSample("TTJets_")); |
1348 |
< |
TH1F *TwoSF = allsamples.Draw("TwoSF","mll",nbins,min,max, xlabel, "events",cutOSSF&&signal&&TwoJets,mc,luminosity,allsamples.FindSample("TTJets_")); |
1349 |
< |
TH1F *ThreeOF = allsamples.Draw("ThreeOF","mll",nbins,min,max, xlabel, "events",cutOSOF&&signal&&ThreeJets,mc,luminosity,allsamples.FindSample("TTJets_")); |
1350 |
< |
TH1F *ThreeSF = allsamples.Draw("ThreeSF","mll",nbins,min,max, xlabel, "events",cutOSSF&&signal&&ThreeJets,mc,luminosity,allsamples.FindSample("TTJets_")); |
1347 |
> |
TH1F *TwoOF = allsamples.Draw("TwoOF","mll",nbins,min,max, xlabel, "events",cutOSOF&&signal&&TwoJets,mc,luminosity,allsamples.FindSample("/TT_")); |
1348 |
> |
TH1F *TwoSF = allsamples.Draw("TwoSF","mll",nbins,min,max, xlabel, "events",cutOSSF&&signal&&TwoJets,mc,luminosity,allsamples.FindSample("/TT_")); |
1349 |
> |
TH1F *ThreeOF = allsamples.Draw("ThreeOF","mll",nbins,min,max, xlabel, "events",cutOSOF&&signal&&ThreeJets,mc,luminosity,allsamples.FindSample("/TT_")); |
1350 |
> |
TH1F *ThreeSF = allsamples.Draw("ThreeSF","mll",nbins,min,max, xlabel, "events",cutOSSF&&signal&&ThreeJets,mc,luminosity,allsamples.FindSample("/TT_")); |
1351 |
|
|
1352 |
|
can2->cd(1); |
1353 |
|
|
1463 |
|
TH1F *MCcentral = CollapseStack(mcstack); |
1464 |
|
|
1465 |
|
cout << "\r Creating " << filename << " : MC central (histo) (3/7)" << std::flush; |
1466 |
< |
TH1F *TCentral = allsamples.Draw ("TCentral", mcvariable,nbins,min,max,xlabel,"events",cut,mc,luminosity,allsamples.FindSample("TTJets_")); |
1466 |
> |
TH1F *TCentral = allsamples.Draw ("TCentral", mcvariable,nbins,min,max,xlabel,"events",cut,mc,luminosity,allsamples.FindSample("/TT_")); |
1467 |
|
TH1F *RCentral = ProduceTTbarRatio(datahisto,MCcentral,TCentral,TCentral); |
1468 |
|
|
1469 |
|
cout << "\r Creating " << filename << " : MC Matching up (4/7)" << std::flush; |
2306 |
|
BaseMetCut="met[4]>150"; |
2307 |
|
Prefix="Aachen/"; |
2308 |
|
} |
2309 |
< |
// make_OFSF_plots("st", BaseMetCut, 20, 0, 2000., false, "S_{T}", Prefix+"FrankT"); |
2310 |
< |
make_OFSF_plots("mt2j", BaseMetCut, 35, 0, 700., false, "M_{T2J}", Prefix+"MT2J"); |
2311 |
< |
|
2312 |
< |
make_OFSF_plots("ml1b", BaseMetCut, 20, 0, 800., false, "m_{l_{1}b}", Prefix+"ML1B"); |
2313 |
< |
make_OFSF_plots("ml2b", BaseMetCut, 20, 0, 400., false, "m_{l_{2}b}", Prefix+"ML2B"); |
2314 |
< |
make_OFSF_plots("min(ml1b,ml2b)", BaseMetCut, 20, 0, 400., false, "m_{lb}", Prefix+"MLB"); |
2018 |
< |
|
2019 |
< |
// make_OFSF_plots(datajzb, BaseMetCut, 55, -100, 450., false, "JZB", Prefix+"JZB_In_Signal_Region"); |
2020 |
< |
make_OFSF_plots("mt2", BaseMetCut, 15, 0, 150., false, "M_{T2}", Prefix+"MT2"); |
2021 |
< |
make_OFSF_plots("d2", BaseMetCut, 20, 0, 200., true, "D2", Prefix+"D2"); |
2022 |
< |
make_OFSF_plots("pfJetGoodNum40", BaseMetCut, 10, -0.5, 9.5, true, "N_{jets}", Prefix+"nJets"); |
2309 |
> |
|
2310 |
> |
// make_OFSF_plots("met[4]", BaseMetCut, 30, 100., 400., true, "E_{T}^{miss}", Prefix+"MET",1500); |
2311 |
> |
// make_OFSF_plots("pfJetGoodNumBtag30", BaseMetCut, 6, -0.5, 5.5, true, "N_{b-jets}", Prefix+"nbjets",5000); |
2312 |
> |
make_OFSF_plots("max(eta1,eta2)", BaseMetCut, 20, -2.4, 2.4, true, "max(#eta_{l1},#eta_{l2})", Prefix+"MaxEta",-1); |
2313 |
> |
// make_OFSF_plots("st", BaseMetCut, 20, 0, 2000., false, "#tilde{S}_{T}", Prefix+"FrankT",120); |
2314 |
> |
// make_OFSF_plots("pt1+pt2+met[4]+Sum$(pfJetGoodPt)", BaseMetCut, 20, 0, 2000., false, "#tilde{S}_{T}", Prefix+"POOR_FrankT",120); |
2315 |
|
|
2316 |
< |
// make_OFSF_plots("mll", BaseMetCut, 60, 20., 320., false, "m_{ll}", Prefix+"mll"); |
2317 |
< |
// make_OFSF_plots("leptonNum", BaseMetCut, 3, 2, 5., false, "N(leptons)", Prefix+"NLeptons"); |
2318 |
< |
|
2319 |
< |
// make_OFSF_plots("pfJetGoodNum40", BaseMetCut, 7, 3, 10, true, "#(jets)", Prefix+"njets"); |
2320 |
< |
// make_OFSF_plots("pfJetGoodNum40", BaseMetCut+"&&pfJetGoodNumBtag30==0", 7, 3, 10, true, "#(jets)", Prefix+"njets_btagVeto"); |
2321 |
< |
// make_OFSF_plots("pfJetGoodNum40", BaseMetCut"&&pfJetGoodNumBtag30>0", 7, 3, 10, true, "#(jets)", Prefix+"njets_AtLeastOneBJet30"); |
2322 |
< |
|
2323 |
< |
// make_OFSF_plots("pfJetGoodNumBtag30", BaseMetCut, 5, -0.5, 4.5, true, "N_{b-jets}", Prefix+"nbjets"); |
2324 |
< |
// make_OFSF_plots("pfJetGoodPtBtag[0]", BaseMetCut+"&&pfJetGoodNumBtag30>0", 20, 0, 400, true, "p_{T}(leading b-jet)", Prefix+"ptb1"); |
2325 |
< |
// make_OFSF_plots("pfJetGoodPt", BaseMetCut, 30, 0., 400., true, "p_{T}^{J}", Prefix+"ptJet"); |
2326 |
< |
|
2327 |
< |
// make_OFSF_plots("iso1", BaseMetCut, 20, 0, 0.3, true, "lepton 1 isolation", Prefix+"iso1"); |
2328 |
< |
// make_OFSF_plots("iso2", BaseMetCut, 20, 0, 0.3, true, "lepton 2 isolation", Prefix+"iso2"); |
2329 |
< |
make_OFSF_plots("pt", BaseMetCut, 30, 0., 300., true, "p_{ll}", Prefix+"pt"); |
2330 |
< |
make_OFSF_plots("pt1", BaseMetCut, 30, 0., 300., true, "p_{T,1}", Prefix+"pt1"); |
2331 |
< |
make_OFSF_plots("pt2", BaseMetCut, 22, 0., 220., true, "p_{T,2}", Prefix+"pt2"); |
2332 |
< |
// make_OFSF_plots("eta1", BaseMetCut, 10, -2.5, 2.5, false, "#eta_{1}", Prefix+"eta1", 0.15); |
2333 |
< |
// make_OFSF_plots("eta2", BaseMetCut, 10, -2.5, 2.5, false, "#eta_{2}", Prefix+"eta2", 0.15); |
2334 |
< |
// make_OFSF_plots("phi1", BaseMetCut, 10, -TMath::Pi(), TMath::Pi(), false, "#phi_{1}", Prefix+"phi1", 0.2); |
2335 |
< |
// make_OFSF_plots("phi2", BaseMetCut, 10, -TMath::Pi(), TMath::Pi(), false, "#phi_{2}", Prefix+"phi2", 0.2); |
2336 |
< |
// make_OFSF_plots("pfJetGoodPt[0]/pfJetGoodPt[1]", BaseMetCut, 20, 1, 10, true, "pt_{j}^{1}/pt_{j}^{2}", Prefix+"jpt1pt2", 0.2); |
2337 |
< |
// make_OFSF_plots("TMath::Abs(pfJetDphiMet[0])", BaseMetCut, 16, 0, 3.2, false, "|#Delta#phi(jet1,MET)|", Prefix+"dphij1met", 0.2); |
2316 |
> |
|
2317 |
> |
// make_OFSF_plots("mt2j", BaseMetCut, 35, 0, 700., false, "M_{T2J}", Prefix+"MT2J"); |
2318 |
> |
// |
2319 |
> |
// make_OFSF_plots("ml1b", BaseMetCut, 20, 0, 800., false, "m_{l_{1}b}", Prefix+"ML1B"); |
2320 |
> |
// make_OFSF_plots("ml2b", BaseMetCut, 20, 0, 400., false, "m_{l_{2}b}", Prefix+"ML2B"); |
2321 |
> |
// make_OFSF_plots("min(ml1b,ml2b)", BaseMetCut, 20, 0, 400., false, "m_{lb}", Prefix+"MLB"); |
2322 |
> |
// |
2323 |
> |
// make_OFSF_plots(datajzb, BaseMetCut, 55, -100, 450., false, "JZB", Prefix+"JZB_In_Signal_Region"); |
2324 |
> |
// make_OFSF_plots("mt2", BaseMetCut, 15, 0, 150., false, "M_{T2}", Prefix+"MT2"); |
2325 |
> |
// make_OFSF_plots("d2", BaseMetCut, 20, 0, 200., true, "D2", Prefix+"D2"); |
2326 |
> |
make_OFSF_plots("pfJetGoodNum40", BaseMetCut, 10, -0.5, 9.5, true, "N_{jets}", Prefix+"nJets"); |
2327 |
> |
// |
2328 |
> |
// make_OFSF_plots("mll", BaseMetCut, 60, 20., 320., false, "m_{ll}", Prefix+"mll"); |
2329 |
> |
// make_OFSF_plots("leptonNum", BaseMetCut, 3, 2, 5., false, "N(leptons)", Prefix+"NLeptons"); |
2330 |
> |
// |
2331 |
> |
// make_OFSF_plots("pfJetGoodNum40", BaseMetCut, 7, 3, 10, true, "#(jets)", Prefix+"njets"); |
2332 |
> |
// make_OFSF_plots("pfJetGoodNum40", BaseMetCut+"&&pfJetGoodNumBtag30==0", 7, 3, 10, true, "#(jets)", Prefix+"njets_btagVeto"); |
2333 |
> |
// make_OFSF_plots("pfJetGoodNum40", BaseMetCut"&&pfJetGoodNumBtag30>0", 7, 3, 10, true, "#(jets)", Prefix+"njets_AtLeastOneBJet30"); |
2334 |
> |
// |
2335 |
> |
// make_OFSF_plots("pfJetGoodPtBtag[0]", BaseMetCut+"&&pfJetGoodNumBtag30>0", 20, 0, 400, true, "p_{T}(leading b-jet)", Prefix+"ptb1"); |
2336 |
> |
make_OFSF_plots("pfJetGoodPt", BaseMetCut, 30, 0., 400., true, "p_{T}^{J}", Prefix+"ptJet"); |
2337 |
> |
// |
2338 |
> |
// make_OFSF_plots("iso1", BaseMetCut, 20, 0, 0.3, true, "lepton 1 isolation", Prefix+"iso1"); |
2339 |
> |
// make_OFSF_plots("iso2", BaseMetCut, 20, 0, 0.3, true, "lepton 2 isolation", Prefix+"iso2"); |
2340 |
> |
make_OFSF_plots("pt", BaseMetCut, 30, 0., 300., true, "p_{ll}", Prefix+"pt"); |
2341 |
> |
make_OFSF_plots("pt1", BaseMetCut, 30, 0., 300., true, "p_{T,1}", Prefix+"pt1"); |
2342 |
> |
make_OFSF_plots("pt2", BaseMetCut, 22, 0., 220., true, "p_{T,2}", Prefix+"pt2"); |
2343 |
> |
// make_OFSF_plots("eta1", BaseMetCut, 10, -2.5, 2.5, false, "#eta_{1}", Prefix+"eta1", -1, 0.15); |
2344 |
> |
// make_OFSF_plots("eta2", BaseMetCut, 10, -2.5, 2.5, false, "#eta_{2}", Prefix+"eta2", -1, 0.15); |
2345 |
> |
// make_OFSF_plots("phi1", BaseMetCut, 10, -TMath::Pi(), TMath::Pi(), false, "#phi_{1}", Prefix+"phi1", -1, 0.2); |
2346 |
> |
// make_OFSF_plots("phi2", BaseMetCut, 10, -TMath::Pi(), TMath::Pi(), false, "#phi_{2}", Prefix+"phi2", -1, 0.2); |
2347 |
> |
// make_OFSF_plots("pfJetGoodPt[0]/pfJetGoodPt[1]", BaseMetCut, 20, 1, 10, true, "pt_{j}^{1}/pt_{j}^{2}", Prefix+"jpt1pt2", -1, 0.2); |
2348 |
> |
make_OFSF_plots("TMath::Abs(pfJetDphiMet[0])", BaseMetCut, 16, 0, 3.2, false, "|#Delta#phi(jet1,MET)|", Prefix+"dphij1met", -1, 0.2); |
2349 |
|
|
2350 |
< |
// make_OFSF_plots("met[4]", BaseMetCut, 30, 100., 400., true, "E_{T}^{miss}", Prefix+"MET"); |
2351 |
< |
// make_OFSF_plots("TMath::Abs(dphi)", BaseMetCut, 16, 0, 3.2, false, "|#Delta#phi(l1,l2)|", Prefix+"dphi", 0.2); |
2352 |
< |
// make_OFSF_plots("TMath::Abs(dphiMet1)", BaseMetCut, 16, 0, 3.2, false, "|#Delta#phi(l1,MET)|", Prefix+"dphiMet1", 0.2); |
2050 |
< |
// make_OFSF_plots("TMath::Abs(dphiMet2)", BaseMetCut, 16, 0, 3.2, false, "|#Delta#phi(l2,MET)|", Prefix+"dphiMet2", 0.2); |
2350 |
> |
// make_OFSF_plots("TMath::Abs(dphi)", BaseMetCut, 16, 0, 3.2, false, "|#Delta#phi(l1,l2)|", Prefix+"dphi", -1, 0.2); |
2351 |
> |
// make_OFSF_plots("TMath::Abs(dphiMet1)", BaseMetCut, 16, 0, 3.2, false, "|#Delta#phi(l1,MET)|", Prefix+"dphiMet1", -1, 0.2); |
2352 |
> |
// make_OFSF_plots("TMath::Abs(dphiMet2)", BaseMetCut, 16, 0, 3.2, false, "|#Delta#phi(l2,MET)|", Prefix+"dphiMet2", -1, 0.2); |
2353 |
|
// make_OFSF_plots("TMath::Min(TMath::Abs(dphiMet1), TMath::Abs(dphiMet2))", BaseMetCut, 16, 0, 3.2, false, "Min(|#Delta#phi(l,MET)|)", Prefix+"dphilc"); |
2354 |
|
// make_OFSF_plots("TMath::Min(TMath::Abs(pfJetDphiMet[0]), TMath::Min(TMath::Abs(pfJetDphiMet[1]), TMath::Abs(pfJetDphiMet[2])))", BaseMetCut, 16, 0, 3.2, false, "Min(|#Delta#phi(jet,MET)|)", Prefix+"dphijc"); |
2355 |
|
// make_OFSF_plots("TMath::Min((TMath::Pi()-TMath::Abs(dphiMet1)), (TMath::Pi() - TMath::Abs(dphiMet2)))", BaseMetCut, 16, 0, 3.2, false, "Min(#pi - |#Delta#phi(l,MET)|)", Prefix+"dphilco"); |
2363 |
|
//FIRST : ETH SELECTION |
2364 |
|
ProduceOFSFPlots(mcjzb,datajzb,0); // this is the ETH selection |
2365 |
|
|
2064 |
– |
|
2065 |
– |
|
2366 |
|
string backup_cutnJets = (const char*)cutnJets; |
2367 |
|
cutnJets = ReplaceInCut(cutnJets,"pfJetGoodNum40>=3","pfJetGoodNum40>=2"); |
2368 |
|
cutnJets = ReplaceInCut(cutnJets,"1.4","2.4"); |
2387 |
|
bool dolog=true; |
2388 |
|
bool nolog=false; |
2389 |
|
|
2390 |
< |
bool doOFSF = true; |
2390 |
> |
bool doOFSF = false; |
2391 |
|
bool doKin = false; |
2392 |
|
bool doDataComp = false; |
2393 |
|
bool MakeTwoThreeJetComparison = false; |
2411 |
|
// make_plain_kin_plot("pt",Cut2Str(cutOSSF&&TCut("mll>20&&pfJetGoodNumBtag30>=2")),40,0,200,nolog,"Z p_{T}","PlotForKostas",doPF,true); |
2412 |
|
|
2413 |
|
if ( doOFSF ) ProduceOFSFPlots(mcjzb,datajzb); |
2114 |
– |
assert(0); |
2414 |
|
|
2415 |
|
if ( doDataComp) { |
2416 |
|
TCut mllCut(""); |
2504 |
|
|
2505 |
|
if ( doKin ) { |
2506 |
|
string mllCut(""); |
2507 |
< |
|
2507 |
> |
/* |
2508 |
|
make_plain_kin_plot("mll",Cut2Str(cutOSSF&&TCut("mll>20")),56,20,300,dolog,"m_{ll}","NoPreselection/mll_SF",doPF,true); |
2509 |
|
make_plain_kin_plot("mll",Cut2Str(cutOSOF&&TCut("mll>20")),56,20,300,dolog,"m_{ll}","NoPreselection/mll_OF",doPF,true); |
2510 |
|
|
2678 |
|
//make_kin_plot("mll","met[4]>150&&id1==1",(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{#mu#mu} [GeV] (MET>150GeV)","mll_met150_mm",doPF,true);*/ |
2679 |
|
} |
2680 |
|
|
2681 |
< |
make_special_obs_pred_mll_plot(datajzb,mcjzb,0); |
2682 |
< |
make_special_obs_pred_mll_plot(datajzb,mcjzb,50); |
2683 |
< |
make_special_obs_pred_mll_plot(datajzb,mcjzb,80); |
2684 |
< |
make_special_obs_pred_mll_plot(datajzb,mcjzb,100); |
2685 |
< |
make_special_obs_pred_mll_plot(datajzb,mcjzb,150); |
2686 |
< |
make_special_obs_pred_mll_plot(datajzb,mcjzb,200); |
2687 |
< |
make_special_obs_pred_mll_plot(datajzb,mcjzb,250); |
2681 |
> |
int jzbcuts[7]={0,50,80,100,150,200,250}; |
2682 |
> |
int MCorData[2]={data,mc}; |
2683 |
> |
|
2684 |
> |
for(int d=0;d<2;d++) { |
2685 |
> |
for(int j=0;j<7;j++) { |
2686 |
> |
make_special_obs_pred_mll_plot(datajzb,mcjzb,jzbcuts[j],5.0,MCorData[d]); // 5.0 is the binwidth |
2687 |
> |
} |
2688 |
> |
} |
2689 |
> |
|
2690 |
|
/* |
2691 |
|
make_JES_plot(cutmass&&cutOSSF&&basiccut,"_ossf"); |
2692 |
|
make_JES_plot(cutmass&&cutOSOF&&basiccut,"_osof"); |
2712 |
|
} |
2713 |
|
|
2714 |
|
string sRegions[] = { "SFZP","OFZP","SFSB","OFSB" }; |
2715 |
+ |
if(!RestrictToMassPeak) { |
2716 |
+ |
sRegions[0]="SF"; |
2717 |
+ |
sRegions[1]="OF"; |
2718 |
+ |
} |
2719 |
|
TCut kRegions[] = { cutOSSF&&cutnJets&&cutmass, cutOSOF&&cutnJets&&cutmass, |
2720 |
|
cutOSSF&&cutnJets&&sidebandcut, cutOSOF&&cutnJets&&sidebandcut }; |
2721 |
|
|
2814 |
|
TH1F *JZBplotLM4; |
2815 |
|
if(PlottingSetup::RestrictToMassPeak) JZBplotLM4 = allsamples.Draw("JZBplotLM4",jzbvariablemc,sbg_nbins,sbg_min,sbg_max, "JZB [GeV]", "events",cutmass&&cutOSSF&&cutnJets,mc,simulatedlumi,allsamples.FindSample("LM4")); |
2816 |
|
else JZBplotLM4 = allsamples.Draw("JZBplotLM4",jzbvariablemc,sbg_nbins,sbg_min,sbg_max, "JZB [GeV]", "events",cutmass&&cutOSSF&&cutnJets,mc,simulatedlumi,allsamples.FindSample("LM3")); |
2817 |
< |
TH1F *JZBplotTtbar = allsamples.Draw("JZBplotTtbar",jzbvariablemc,sbg_nbins,sbg_min,sbg_max, "JZB [GeV]", "events",cutmass&&cutOSSF&&cutnJets,mc,simulatedlumi,allsamples.FindSample("TTJets")); |
2817 |
> |
TH1F *JZBplotTtbar = allsamples.Draw("JZBplotTtbar",jzbvariablemc,sbg_nbins,sbg_min,sbg_max, "JZB [GeV]", "events",cutmass&&cutOSSF&&cutnJets,mc,simulatedlumi,allsamples.FindSample("TT_")); |
2818 |
|
|
2819 |
|
JZBplotTtbar->SetLineColor(allsamples.GetColor("TTJet")); |
2820 |
|
JZBplotZJETs->SetFillColor(allsamples.GetColor("DY")); |
2825 |
|
|
2826 |
|
JZBplotTtbar->SetMaximum(JZBplotZJETs->GetMaximum()); |
2827 |
|
JZBplotTtbar->SetMinimum(0.01); |
2828 |
< |
JZBplotTtbar->SetFillColor(allsamples.GetColor("TTJets")); |
2828 |
> |
JZBplotTtbar->SetFillColor(allsamples.GetColor("TT_")); |
2829 |
|
JZBplotTtbar->DrawClone("histo"); |
2830 |
|
JZBplotZJETs->Draw("histo,same"); |
2831 |
|
JZBplotTtbar->SetFillColor(0); |
2832 |
|
JZBplotTtbar->DrawClone("histo,same"); |
2833 |
< |
JZBplotTtbar->SetFillColor(allsamples.GetColor("TTJets")); |
2833 |
> |
JZBplotTtbar->SetFillColor(allsamples.GetColor("TT_")); |
2834 |
|
JZBplotLM4->Draw("histo,same"); |
2835 |
|
|
2836 |
|
|
2868 |
|
// Draw all plots overlaid |
2869 |
|
JZBplotTtbar->SetMaximum(JZBplotZJETs->GetMaximum()); |
2870 |
|
JZBplotTtbar->SetMinimum(0.01); |
2871 |
< |
JZBplotTtbar->SetFillColor(allsamples.GetColor("TTJets")); |
2871 |
> |
JZBplotTtbar->SetFillColor(allsamples.GetColor("TT_")); |
2872 |
|
JZBplotTtbar->DrawClone("histo"); |
2873 |
|
JZBplotZJETs->Draw("histo,same"); |
2874 |
|
JZBplotTtbar->SetFillColor(0); |
2875 |
|
JZBplotTtbar->DrawClone("histo,same"); |
2876 |
< |
JZBplotTtbar->SetFillColor(allsamples.GetColor("TTJets")); |
2876 |
> |
JZBplotTtbar->SetFillColor(allsamples.GetColor("TT_")); |
2877 |
|
|
2878 |
|
JZBplotSMS1->SetLineColor(kRed+1); |
2879 |
|
JZBplotSMS2->SetLineColor(kBlue+1); |
3080 |
|
return return_functions; |
3081 |
|
} |
3082 |
|
|
3083 |
< |
void do_prediction_plot(string jzb, TCanvas *globalcanvas, float high, int use_data, bool overlay_signal = false,string subdir="" ) |
3083 |
> |
void do_prediction_plot(TCut addcut, string Cname, string jzb, TCanvas *globalcanvas, float high, int use_data, bool overlay_signal = false,string subdir="" ) |
3084 |
|
{ |
3085 |
|
|
3086 |
|
bool is_data=false; |
3101 |
|
|
3102 |
|
|
3103 |
|
TH1F *blankback = new TH1F("blankback","blankback",int(high/10),0,high); |
3104 |
< |
TH1F *RcorrJZBeemm = allsamples.Draw("RcorrJZBeemm",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutpositive&&cutmass&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
3105 |
< |
TH1F *LcorrJZBeemm = allsamples.Draw("LcorrJZBeemm",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", cutnegative&&cutmass&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
3106 |
< |
TH1F *RcorrJZBem = allsamples.Draw("RcorrJZBem",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutpositive&&cutmass&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
3107 |
< |
TH1F *LcorrJZBem = allsamples.Draw("LcorrJZBem",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", cutnegative&&cutmass&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
3104 |
> |
TH1F *RcorrJZBeemm = allsamples.Draw("RcorrJZBeemm",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", addcut&&cutpositive&&cutmass&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
3105 |
> |
TH1F *LcorrJZBeemm = allsamples.Draw("LcorrJZBeemm",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", addcut&&cutnegative&&cutmass&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
3106 |
> |
TH1F *RcorrJZBem = allsamples.Draw("RcorrJZBem",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", addcut&&cutpositive&&cutmass&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
3107 |
> |
TH1F *LcorrJZBem = allsamples.Draw("LcorrJZBem",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", addcut&&cutnegative&&cutmass&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
3108 |
|
|
3109 |
|
blankback->GetXaxis()->SetTitle(RcorrJZBeemm->GetXaxis()->GetTitle()); |
3110 |
|
blankback->GetYaxis()->SetTitle(RcorrJZBeemm->GetYaxis()->GetTitle()); |
3120 |
|
TH1F *RcorrJZBeemmNoS; |
3121 |
|
|
3122 |
|
//these are for the ratio |
3123 |
< |
TH1F *JRcorrJZBeemm = allsamples.Draw("JRcorrJZBeemm",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutpositive&&cutmass&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
3124 |
< |
TH1F *JLcorrJZBeemm = allsamples.Draw("JLcorrJZBeemm",("-"+jzb).c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutnegative&&cutmass&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
3125 |
< |
TH1F *JRcorrJZBem = allsamples.Draw("JRcorrJZBem",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutpositive&&cutmass&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
3126 |
< |
TH1F *JLcorrJZBem = allsamples.Draw("JLcorrJZBem",("-"+jzb).c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutnegative&&cutmass&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
3123 |
> |
TH1F *JRcorrJZBeemm = allsamples.Draw("JRcorrJZBeemm",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", addcut&&cutpositive&&cutmass&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
3124 |
> |
TH1F *JLcorrJZBeemm = allsamples.Draw("JLcorrJZBeemm",("-"+jzb).c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", addcut&&cutnegative&&cutmass&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
3125 |
> |
TH1F *JRcorrJZBem = allsamples.Draw("JRcorrJZBem",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", addcut&&cutpositive&&cutmass&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
3126 |
> |
TH1F *JLcorrJZBem = allsamples.Draw("JLcorrJZBem",("-"+jzb).c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", addcut&&cutnegative&&cutmass&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
3127 |
|
|
3128 |
|
TH1F *JRcorrJZBSBem; |
3129 |
|
TH1F *JLcorrJZBSBem; |
3130 |
|
TH1F *JRcorrJZBSBeemm; |
3131 |
|
TH1F *JLcorrJZBSBeemm; |
3132 |
|
|
3133 |
< |
if(use_data==2 || overlay_signal) RcorrJZBeemmNoS = allsamples.Draw("RcorrJZBeemmNoS",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutpositive&&cutmass&&cutOSSF&&cutnJets,is_data, luminosity,false); |
3133 |
> |
if(use_data==2 || overlay_signal) RcorrJZBeemmNoS = allsamples.Draw("RcorrJZBeemmNoS",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", addcut&&cutpositive&&cutmass&&cutOSSF&&cutnJets,is_data, luminosity,false); |
3134 |
|
|
3135 |
|
|
3136 |
|
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
3137 |
< |
RcorrJZBSBem = allsamples.Draw("RcorrJZBSBem",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutpositive&&sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
3138 |
< |
LcorrJZBSBem = allsamples.Draw("LcorrJZBSBem",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", cutnegative&&sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
3139 |
< |
RcorrJZBSBeemm = allsamples.Draw("RcorrJZBSBeemm",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutpositive&&sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
3140 |
< |
LcorrJZBSBeemm = allsamples.Draw("LcorrJZBSBeemm",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", cutnegative&&sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
3137 |
> |
RcorrJZBSBem = allsamples.Draw("RcorrJZBSBem",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", addcut&&cutpositive&&sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
3138 |
> |
LcorrJZBSBem = allsamples.Draw("LcorrJZBSBem",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", addcut&&cutnegative&&sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
3139 |
> |
RcorrJZBSBeemm = allsamples.Draw("RcorrJZBSBeemm",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", addcut&&cutpositive&&sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
3140 |
> |
LcorrJZBSBeemm = allsamples.Draw("LcorrJZBSBeemm",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", addcut&&cutnegative&&sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
3141 |
|
|
3142 |
|
//these are for the ratio |
3143 |
< |
JRcorrJZBSBem = allsamples.Draw("JRcorrJZBSBem",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutpositive&&sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
3144 |
< |
JLcorrJZBSBem = allsamples.Draw("JLcorrJZBSBem",("-"+jzb).c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutnegative&&sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
3145 |
< |
JRcorrJZBSBeemm = allsamples.Draw("JRcorrJZBSBeemm",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutpositive&&sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
3146 |
< |
JLcorrJZBSBeemm = allsamples.Draw("JLcorrJZBSBeemm",("-"+jzb).c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutnegative&&sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
3143 |
> |
JRcorrJZBSBem = allsamples.Draw("JRcorrJZBSBem",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", addcut&&cutpositive&&sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
3144 |
> |
JLcorrJZBSBem = allsamples.Draw("JLcorrJZBSBem",("-"+jzb).c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", addcut&&cutnegative&&sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
3145 |
> |
JRcorrJZBSBeemm = allsamples.Draw("JRcorrJZBSBeemm",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", addcut&&cutpositive&&sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
3146 |
> |
JLcorrJZBSBeemm = allsamples.Draw("JLcorrJZBSBeemm",("-"+jzb).c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", addcut&&cutnegative&&sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
3147 |
|
} |
3148 |
|
|
3149 |
|
TH1F *lm4RcorrJZBeemm; |
3150 |
< |
if(overlay_signal || use_data == 2 || use_data == 1) lm4RcorrJZBeemm = allsamples.Draw("lm4RcorrJZBSBeemm",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutpositive&&cutmass&&cutOSSF&&cutnJets,is_data, luminosity,allsamples.FindSample("LM")); |
3150 |
> |
if(overlay_signal || use_data == 2 || use_data == 1) lm4RcorrJZBeemm = allsamples.Draw("lm4RcorrJZBSBeemm",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", addcut&&cutpositive&&cutmass&&cutOSSF&&cutnJets,is_data, luminosity,allsamples.FindSample("LM")); |
3151 |
|
|
3152 |
|
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak ---- prediction changed. |
3153 |
|
|
3284 |
|
|
3285 |
|
jzbnegative->SetFillColor(allsamples.GetColor((allsamples.FindSample("DY"))[0])); |
3286 |
|
jzbnegative->SetLineColor(allsamples.GetColor((allsamples.FindSample("DY"))[0])); |
3287 |
< |
sidebandsemu->SetLineColor(allsamples.GetColor((allsamples.FindSample("TTJets"))[0])); |
3288 |
< |
sidebandsemu->SetFillColor(allsamples.GetColor((allsamples.FindSample("TTJets"))[0])); |
3287 |
> |
sidebandsemu->SetLineColor(allsamples.GetColor((allsamples.FindSample("TT_"))[0])); |
3288 |
> |
sidebandsemu->SetFillColor(allsamples.GetColor((allsamples.FindSample("TT_"))[0])); |
3289 |
|
|
3290 |
|
THStack predcomposition("predcomposition","prediction composition"); |
3291 |
|
predcomposition.Add(sidebandsemu); |
3311 |
|
// speciallegBpred->AddEntry(lm4RcorrJZBeemmC,"LM4","l"); |
3312 |
|
// speciallegBpred->AddEntry(lm4RcorrJZBeemm,"LM4","l"); |
3313 |
|
speciallegBpred->Draw(); |
3314 |
< |
Save_With_Ratio(JRcorrJZBeemm,JBpred,predcomppad,subdir+"Bpred_Data_____PredictionComposition",true,true,"data/pred",BpredSys); |
3314 |
> |
Save_With_Ratio(JRcorrJZBeemm,JBpred,predcomppad,subdir+"Bpred_Data_____PredictionComposition"+Cname,true,true,"data/pred",BpredSys); |
3315 |
|
delete predcomppad; |
3316 |
|
|
3317 |
|
TCanvas *specialcanv = new TCanvas("specialcanv","specialcanv"); |
3378 |
|
|
3379 |
|
RcorrJZBeemmNoS->SetLineStyle(2); |
3380 |
|
legBpred2->AddEntry(RcorrJZBeemmNoS,"MC B","l"); |
3381 |
< |
// legBpred2->AddEntry(lm4RcorrJZBeemm,"MC S","l"); |
3381 |
> |
legBpred2->AddEntry(lm4RcorrJZBeemm,"MC S","l"); |
3382 |
|
legBpred2->Draw(); |
3383 |
|
RcorrJZBeemmNoS->SetLineColor(TColor::GetColor("#61210B")); |
3384 |
|
RcorrJZBeemmNoS->Draw("histo,same"); |
3391 |
|
} |
3392 |
|
|
3393 |
|
|
3394 |
+ |
Bpredsaveas+="_"+Cname+"_"; |
3395 |
|
//3rd last argument: do special bpred ratio, 2nd last argument: extended range!, last: y-axis title |
3396 |
|
string ytitle("ratio"); |
3397 |
|
if ( use_data==1 ) ytitle = "data/pred"; |
3440 |
|
if(use_data==1) |
3441 |
|
{ |
3442 |
|
legBpredc->AddEntry(RcorrJZBeemm,"observed","p"); |
3443 |
< |
legBpredc->AddEntry(Bpredem,"OFZP","l"); |
3444 |
< |
legBpredc->AddEntry(BpredSBem,"OFSB","l"); |
3445 |
< |
legBpredc->AddEntry(BpredSBeemm,"SFSB","l"); |
3443 |
> |
if(RestrictToMassPeak) { |
3444 |
> |
legBpredc->AddEntry(Bpredem,"OFZP","l"); |
3445 |
> |
legBpredc->AddEntry(BpredSBem,"OFSB","l"); |
3446 |
> |
legBpredc->AddEntry(BpredSBeemm,"SFSB","l"); |
3447 |
> |
} else legBpredc->AddEntry(Bpredem,"OF","l"); |
3448 |
> |
|
3449 |
> |
|
3450 |
|
legBpredc->Draw(); |
3451 |
|
CompleteSave(globalcanvas,subdir+"Bpred_Data_comparison"); |
3452 |
|
} |
3453 |
|
if(use_data==0) { |
3454 |
|
legBpredc->AddEntry(RcorrJZBeemm,"MC true","p"); |
3455 |
< |
legBpredc->AddEntry(Bpredem,"MC OFZP","l"); |
3456 |
< |
legBpredc->AddEntry(BpredSBem,"MC OFSB","l"); |
3457 |
< |
legBpredc->AddEntry(BpredSBeemm,"MC SFSB","l"); |
3455 |
> |
if(RestrictToMassPeak) { |
3456 |
> |
legBpredc->AddEntry(Bpredem,"MC OFZP","l"); |
3457 |
> |
legBpredc->AddEntry(BpredSBem,"MC OFSB","l"); |
3458 |
> |
legBpredc->AddEntry(BpredSBeemm,"MC SFSB","l"); |
3459 |
> |
} else legBpredc->AddEntry(Bpredem,"MC OF","l"); |
3460 |
> |
|
3461 |
|
legBpredc->Draw(); |
3462 |
|
CompleteSave(globalcanvas,subdir+"Bpred_MC_comparison"); |
3463 |
|
} |
3464 |
|
if(use_data==2) { |
3465 |
|
legBpredc->AddEntry(RcorrJZBeemm,"MC true","p"); |
3466 |
< |
legBpredc->AddEntry(Bpredem,"MC OFZP","l"); |
3467 |
< |
legBpredc->AddEntry(BpredSBem,"MC OFSB","l"); |
3468 |
< |
legBpredc->AddEntry(BpredSBeemm,"MC SFSB","l"); |
3466 |
> |
if(RestrictToMassPeak) { |
3467 |
> |
legBpredc->AddEntry(Bpredem,"MC OFZP","l"); |
3468 |
> |
legBpredc->AddEntry(BpredSBem,"MC OFSB","l"); |
3469 |
> |
legBpredc->AddEntry(BpredSBeemm,"MC SFSB","l"); |
3470 |
> |
} else { |
3471 |
> |
legBpredc->AddEntry(Bpredem,"MC OF","l"); |
3472 |
> |
} |
3473 |
|
// if ( overlay_signal ) legBpred->AddEntry(lm4RcorrJZBeemm,"LM4","l"); |
3474 |
|
legBpredc->Draw(); |
3475 |
|
CompleteSave(globalcanvas,subdir+"Bpred_MCwithS_comparison"); |
3476 |
|
} |
3477 |
|
} |
3478 |
|
|
3162 |
– |
TFile *f = new TFile("tester.root","RECREATE"); |
3163 |
– |
RcorrJZBeemm->Write(); |
3164 |
– |
Bpred->Write(); |
3165 |
– |
f->Close(); |
3166 |
– |
|
3479 |
|
delete RcorrJZBeemm; |
3480 |
|
delete LcorrJZBeemm; |
3481 |
|
delete RcorrJZBem; |
3505 |
|
|
3506 |
|
void do_prediction_plots(string mcjzb, string datajzb, float DataSigma, float MCSigma, bool overlay_signal ) { |
3507 |
|
switch_overunderflow(true); |
3508 |
+ |
|
3509 |
+ |
TCut cuts[3] = {TCut("mll>0"),Restrmasscut,TCut("mll>20&&mll<70")}; |
3510 |
+ |
string cutnames[3] = {"NoMassCut","ZWindow","LowMassRegion2070"}; |
3511 |
+ |
|
3512 |
|
TCanvas *globalcanvas = new TCanvas("globalcanvas","Prediction Canvas"); |
3513 |
< |
do_prediction_plot(datajzb,globalcanvas,jzbHigh ,data,overlay_signal); |
3514 |
< |
if ( !PlottingSetup::Approved ) { |
3515 |
< |
do_prediction_plot(mcjzb,globalcanvas,jzbHigh ,mc,overlay_signal); |
3516 |
< |
do_prediction_plot(mcjzb,globalcanvas,jzbHigh ,mcwithsignal,overlay_signal); |
3517 |
< |
} else { |
3518 |
< |
write_info(__FUNCTION__,"You set approved to true, therefore not producing prediction/observation plots for MC with and without signal."); |
3513 |
> |
for(int i=0;i<3;i++) { |
3514 |
> |
do_prediction_plot(cuts[i],cutnames[i],datajzb,globalcanvas,jzbHigh ,data,overlay_signal); |
3515 |
> |
if ( !PlottingSetup::Approved ) { |
3516 |
> |
do_prediction_plot(cuts[i],cutnames[i],mcjzb,globalcanvas,jzbHigh ,mc,overlay_signal); |
3517 |
> |
do_prediction_plot(cuts[i],cutnames[i],mcjzb,globalcanvas,jzbHigh ,mcwithsignal,overlay_signal); |
3518 |
> |
} else { |
3519 |
> |
write_info(__FUNCTION__,"You set approved to true, therefore not producing prediction/observation plots for MC with and without signal."); |
3520 |
> |
} |
3521 |
|
} |
3522 |
+ |
|
3523 |
|
delete globalcanvas; |
3524 |
|
switch_overunderflow(false); |
3525 |
|
} |
3816 |
|
TCanvas *gloca = new TCanvas("gloca","gloca"); |
3817 |
|
|
3818 |
|
dout << "Going to produce prediction plots" << endl; |
3819 |
< |
do_prediction_plot(mcjzb, gloca, PlottingSetup::jzbHigh, 0, false,"Dibosons/Bpred/" ); // do only MC plots, no signal |
3820 |
< |
do_prediction_plot(mcjzb, gloca, PlottingSetup::jzbHigh, 0, false,"Dibosons/Bpred/" ); // do MC plots with signal |
3819 |
> |
do_prediction_plot(TCut("mll>0"),"",mcjzb, gloca, PlottingSetup::jzbHigh, 0, false,"Dibosons/Bpred/" ); // do only MC plots, no signal |
3820 |
> |
do_prediction_plot(TCut("mll>0"),"",mcjzb, gloca, PlottingSetup::jzbHigh, 0, false,"Dibosons/Bpred/" ); // do MC plots with signal |
3821 |
|
delete gloca; |
3822 |
|
|
3823 |
|
dout << "Going to reset the cross section for diboson samples ... " << endl; |
3945 |
|
// \SFZPJZBPOS |
3946 |
|
// Sample & \OFZPJZBPOS & \OFZPJZBNEG & \SFZPJZBPOS & \SFZPJZBNEG & \OFSBJZBPOS & \OFSBJZBNEG & \SFSBJZBPOS & \SFSBJZBNEG \\\hline |
3947 |
|
|
3948 |
+ |
|
3949 |
+ |
void compute_Improved_MC_yields(string mcjzb,vector<float> jzb_cuts) { |
3950 |
+ |
dout << "Calculating background yields in MC:" << endl; |
3951 |
+ |
|
3952 |
+ |
TCanvas *yica = new TCanvas("yica","yield canvas"); |
3953 |
+ |
|
3954 |
+ |
int nRegions=2; |
3955 |
+ |
if(!PlottingSetup::RestrictToMassPeak||!PlottingSetup::UseSidebandsForcJZB) nRegions=2; |
3956 |
+ |
string tsRegions[] = {"SFZP","OFZP"}; |
3957 |
+ |
string posneg[] = {"pos","neg"}; |
3958 |
+ |
TCut tkRegions[] = {cutOSSF&&cutnJets&&cutmass,cutOSOF&&cutnJets&&cutmass}; |
3959 |
+ |
|
3960 |
+ |
|
3961 |
+ |
|
3962 |
+ |
for(int ijzb=0;ijzb<(int)jzb_cuts.size();ijzb++) { |
3963 |
+ |
TCut posJZB = give_jzb_expression(mcjzb,jzb_cuts[ijzb],"pos"); |
3964 |
+ |
TCut negJZB = give_jzb_expression(mcjzb,jzb_cuts[ijzb],"neg"); |
3965 |
+ |
|
3966 |
+ |
dout << "_________________________________________________________" << endl; |
3967 |
+ |
dout << "Table for JZB> " << jzb_cuts[ijzb] << endl; |
3968 |
+ |
|
3969 |
+ |
|
3970 |
+ |
THStack *spstack = new THStack(allsamples.DrawStack("spstack","mll<10e6||mll>1",1,0,500,"tester","events",cutOSSF&&cutnJets&&cutmass&&posJZB,mc,luminosity)); |
3971 |
+ |
THStack *snstack = new THStack(allsamples.DrawStack("snstack","mll<10e6||mll>1",1,0,500,"tester","events",cutOSSF&&cutnJets&&cutmass&&negJZB,mc,luminosity)); |
3972 |
+ |
THStack *opstack = new THStack(allsamples.DrawStack("opstack","mll<10e6||mll>1",1,0,500,"tester","events",cutOSOF&&cutnJets&&cutmass&&posJZB,mc,luminosity)); |
3973 |
+ |
THStack *onstack = new THStack(allsamples.DrawStack("onstack","mll<10e6||mll>1",1,0,500,"tester","events",cutOSOF&&cutnJets&&cutmass&&negJZB,mc,luminosity)); |
3974 |
+ |
|
3975 |
+ |
|
3976 |
+ |
vector<pair<string,Value> > obs_yields = WriteYield(spstack, -10, 10, true); |
3977 |
+ |
vector<pair<string,Value> > neg_sf_yields = WriteYield(snstack, -10, 10, true); |
3978 |
+ |
vector<pair<string,Value> > pos_of_yields = WriteYield(opstack, -10, 10, true); |
3979 |
+ |
vector<pair<string,Value> > neg_of_yields = WriteYield(onstack, -10, 10, true); |
3980 |
+ |
|
3981 |
+ |
Value TotObs=Value(0,0); |
3982 |
+ |
Value TotPred=Value(0,0); |
3983 |
+ |
|
3984 |
+ |
for(int ientry=0;ientry<obs_yields.size();ientry++) { |
3985 |
+ |
if(Contains(obs_yields[ientry].first,"t_bar_t")) continue; // ttbar |
3986 |
+ |
if(Contains(obs_yields[ientry].first,"W_Jets")) continue; // W+Jets |
3987 |
+ |
if(Contains(obs_yields[ientry].first,"WW_")) continue; // WW (fully flavor symmetric) |
3988 |
+ |
if(Contains(obs_yields[ientry].first,"Single_top")) continue; // Single Top |
3989 |
+ |
if(Contains(obs_yields[ientry].first,"ee_mumu")) continue; // DY |
3990 |
+ |
if(Contains(obs_yields[ientry].first,"tau_tau")) continue; // DY |
3991 |
+ |
Value pred = neg_sf_yields[ientry].second + pos_of_yields[ientry].second - neg_of_yields[ientry].second; |
3992 |
+ |
Value obs=obs_yields[ientry].second; |
3993 |
+ |
Value diff=obs-pred; |
3994 |
+ |
dout << obs_yields[ientry].first << "\t & \t " << obs << " \t & \t " << pred << "\t & \t " << diff << endl; |
3995 |
+ |
TotObs=TotObs+obs_yields[ientry].second; |
3996 |
+ |
TotPred=TotPred+pred; |
3997 |
+ |
} |
3998 |
+ |
|
3999 |
+ |
float Systematic=sqrt(pow(TotPred.getValue(),2)*0.5*0.5 + pow(TotObs.getValue(),2)*0.5*0.5); |
4000 |
+ |
|
4001 |
+ |
|
4002 |
+ |
} |
4003 |
+ |
|
4004 |
+ |
delete yica; |
4005 |
+ |
} |
4006 |
+ |
|
4007 |
|
void compute_MC_yields(string mcjzb,vector<float> jzb_cuts) { |
4008 |
|
dout << "Calculating background yields in MC:" << endl; |
4009 |
|
|
4099 |
|
TText *titlecenter; |
4100 |
|
bool frommc=false; |
4101 |
|
if(frommc) { |
4102 |
< |
osof = allsamples.Draw("osof",datajzb,40,-200,200, "JZB [GeV]", "events", massat40&&cutOSSF&&jetcut&&lepcut,mc,luminosity,allsamples.FindSample("TTJets")); |
4102 |
> |
osof = allsamples.Draw("osof",datajzb,40,-200,200, "JZB [GeV]", "events", massat40&&cutOSSF&&jetcut&&lepcut,mc,luminosity,allsamples.FindSample("TT_")); |
4103 |
|
titlecenter = write_title("Extracting ttbar shape (from ossf MC)"); |
4104 |
|
} |
4105 |
|
else { |
4316 |
|
(allsamples.collection)[SampleIndices[iSample]].events->Draw("sumJetPt[1]/pt:pt>>+niceresponseplotd",(zptforresponsepresentation&&cutOSSF)*cutWeight); |
4317 |
|
(allsamples.collection)[SampleIndices[iSample]].events->Draw("sumJetPt[1]/pt:pt>>+emuResponse",(zptforresponsepresentation&&cutOSOF)*cutWeight); |
4318 |
|
} |
4319 |
+ |
|
4320 |
|
niceresponseplotd->Add(emuResponse,-1); |
4321 |
|
|
4322 |
+ |
//TF1 *resp_func = new TF1("resp_func","[0]+[1]/x + [2]/pow(x,2)",10,600); |
4323 |
+ |
|
4324 |
|
niceresponseplotd->SetStats(0); |
4325 |
|
niceresponseplotd->GetXaxis()->SetTitle("Z p_{T} [GeV]"); |
4326 |
|
niceresponseplotd->GetYaxis()->SetTitle("Response"); |
4330 |
|
TProfile * profd = (TProfile*)niceresponseplotd->ProfileX(); |
4331 |
|
profd->Rebin(2); |
4332 |
|
profd->SetMarkerSize(DataMarkerSize); |
4333 |
+ |
//profd->Fit(resp_func,"","same,e1",10,400); |
4334 |
|
profd->Fit("pol0","","same,e1",100,400); |
4335 |
+ |
//resp_func->SetLineColor(kBlue); |
4336 |
|
DrawPrelim(); |
4337 |
|
string stitle="Data"; |
4338 |
|
if(!Contains(FindKeyword,"Data")) stitle="MC"; |
4339 |
|
TText* title = write_text(0.5,0.7,stitle.c_str()); |
4340 |
|
title->SetTextAlign(12); |
4341 |
|
title->Draw(); |
4342 |
+ |
// TF1 *datapol=(TF1*)profd->GetFunction("pol0"); |
4343 |
|
TF1 *datapol=(TF1*)profd->GetFunction("pol0"); |
4344 |
|
float correction=datapol->GetParameter(0); |
4345 |
+ |
|
4346 |
+ |
// float correction=resp_func->GetParameter(0); |
4347 |
|
stringstream resstring; |
4348 |
|
resstring<<"Response: "<<std::setprecision(2)<<100*correction<<" %"; |
4349 |
|
TText* restitle = write_text(0.5,0.65,resstring.str()); |
4364 |
|
float datacorrection=find_one_correction_factor("Data",true,"","Data"); |
4365 |
|
float mccorrection=find_one_correction_factor("DY",false,"","MC"); |
4366 |
|
|
4367 |
< |
float dataEEcorrection=find_one_correction_factor("Data",true,"id1==0","Data_ee"); |
4367 |
> |
/* float dataEEcorrection=find_one_correction_factor("Data",true,"id1==0","Data_ee"); |
4368 |
|
float mcEEcorrection=find_one_correction_factor("DY",false,"id1==0","MC_ee"); |
4369 |
|
|
4370 |
|
float dataMMcorrection=find_one_correction_factor("Data",true,"id1==1","Data_mm"); |
4371 |
|
float mcMMcorrection=find_one_correction_factor("DY",false,"id1==1","MC_mm"); |
4372 |
< |
|
4372 |
> |
*/ |
4373 |
|
cout << "Corrections : " << endl; |
4374 |
|
cout << " Data : " << datacorrection << endl; |
4375 |
< |
cout << " ee (" << dataEEcorrection << ") , mm (" << dataMMcorrection << ")" << endl; |
4375 |
> |
// cout << " ee (" << dataEEcorrection << ") , mm (" << dataMMcorrection << ")" << endl; |
4376 |
|
cout << " MC : " << mccorrection << endl; |
4377 |
< |
cout << " ee (" << mcEEcorrection << ") , mm (" << mcMMcorrection << ")" << endl; |
4377 |
> |
// cout << " ee (" << mcEEcorrection << ") , mm (" << mcMMcorrection << ")" << endl; |
4378 |
|
|
4379 |
|
//Step 2: Processing the result and making it into something useful :-) |
4380 |
|
stringstream jzbvardatas; |
4381 |
+ |
/* |
4382 |
|
jzbvardatas << "("; |
4383 |
|
|
4384 |
|
if(dataEEcorrection>=1) jzbvardatas<<"((id1==0&&id1==id2)*(jzb[1]-" << dataEEcorrection-1 << "*pt))"; |
4394 |
|
|
4395 |
|
jzbvardatas << ")"; |
4396 |
|
jzbvardata=jzbvardatas.str(); |
4397 |
< |
|
4397 |
> |
*/ |
4398 |
|
stringstream jzbvarmcs; |
4399 |
+ |
/* |
4400 |
|
jzbvarmcs << "("; |
4401 |
< |
|
4401 |
> |
|
4402 |
|
if(mcEEcorrection>=1) jzbvarmcs<<"((id1==0&&id1==id2)*(jzb[1]-" << mcEEcorrection-1 << "*pt))"; |
4403 |
|
if(mcEEcorrection<1) jzbvarmcs<<"((id1==0&&id1==id2)*(jzb[1]+" << 1-mcEEcorrection << "*pt))"; |
4404 |
|
|
4412 |
|
|
4413 |
|
jzbvarmcs << ")"; |
4414 |
|
jzbvarmc=jzbvarmcs.str(); |
4415 |
< |
|
4415 |
> |
*/ |
4416 |
> |
|
4417 |
> |
if(datacorrection>=1) jzbvardatas<<"(jzb[1]-" << datacorrection-1 << "*pt)"; |
4418 |
> |
if(datacorrection<1) jzbvardatas<<"(jzb[1]+" << 1-datacorrection << "*pt)"; |
4419 |
> |
|
4420 |
> |
if(mccorrection>=1) jzbvarmcs<<"(jzb[1]-" << mccorrection-1 << "*pt)"; |
4421 |
> |
if(mccorrection<1) jzbvarmcs<<"(jzb[1]+" << 1-mccorrection << "*pt)"; |
4422 |
> |
|
4423 |
> |
jzbvardata = jzbvardatas.str(); |
4424 |
> |
jzbvarmc = jzbvarmcs.str(); |
4425 |
> |
|
4426 |
|
dout << "JZB Z pt correction summary : " << endl; |
4427 |
|
dout << " Data: The response is " << datacorrection << " --> jzb variable is now : " << jzbvardata << endl; |
4428 |
|
dout << " MC : The response is " << mccorrection << " --> jzb variable is now : " << jzbvarmc << endl; |
4516 |
|
} |
4517 |
|
} |
4518 |
|
|
4519 |
< |
void ttbar_sidebands_comparison(string mcjzb, vector<float> binning, string prestring) { |
4519 |
> |
void ttbar_sidebands_comparison(string mcjzb, vector<float> binning, string prestring, TCut cut) { |
4520 |
|
//in the case of the on peak analysis, we compare the 3 control regions to the real value |
4521 |
|
//in the case of the OFF peak analysis, we compare our control region to the real value |
4522 |
|
TCut weightbackup=cutWeight; |
4523 |
|
switch_overunderflow(true); |
4524 |
|
|
4525 |
< |
bool doPURW=false; |
4525 |
> |
bool doPURW=true; |
4526 |
|
|
4527 |
|
|
4528 |
|
if(!doPURW) { |
4542 |
|
|
4543 |
|
float simulatedlumi = luminosity; //in pb please - adjust to your likings |
4544 |
|
|
4545 |
< |
TH1F *TZem = allsamples.Draw("TZem", mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSOF&&cutnJets,mc,simulatedlumi,allsamples.FindSample("/TT")); |
4546 |
< |
TH1F *nTZem = allsamples.Draw("nTZem","-"+mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSOF&&cutnJets,mc,simulatedlumi,allsamples.FindSample("/TT")); |
4545 |
> |
TH1F *TZem = allsamples.Draw("TZem", mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSOF&&cutnJets&&cut,mc,simulatedlumi,allsamples.FindSample("/TT")); |
4546 |
> |
TH1F *nTZem = allsamples.Draw("nTZem","-"+mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSOF&&cutnJets&&cut,mc,simulatedlumi,allsamples.FindSample("/TT")); |
4547 |
|
TH1F *TSem; |
4548 |
|
TH1F *nTSem; |
4549 |
< |
TH1F *TZeemm = allsamples.Draw("TZeemm", mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSSF&&cutnJets,mc,simulatedlumi,allsamples.FindSample("/TT")); |
4550 |
< |
TH1F *nTZeemm = allsamples.Draw("nTZeemm","-"+mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSSF&&cutnJets,mc,simulatedlumi,allsamples.FindSample("/TT")); |
4549 |
> |
TH1F *TZeemm = allsamples.Draw("TZeemm", mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSSF&&cutnJets&&cut,mc,simulatedlumi,allsamples.FindSample("/TT")); |
4550 |
> |
TH1F *nTZeemm = allsamples.Draw("nTZeemm","-"+mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSSF&&cutnJets&&cut,mc,simulatedlumi,allsamples.FindSample("/TT")); |
4551 |
|
TH1F *TSeemm; |
4552 |
|
TH1F *nTSeemm; |
4553 |
|
|
4554 |
|
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
4555 |
< |
TSem = allsamples.Draw("TSem", mcjzb,binning,"JZB [GeV]","events",sidebandcut&&cutOSOF&&cutnJets,mc,simulatedlumi,allsamples.FindSample("/TT")); |
4556 |
< |
nTSem = allsamples.Draw("nTSem", "-"+mcjzb,binning,"JZB [GeV]","events",sidebandcut&&cutOSOF&&cutnJets,mc,simulatedlumi,allsamples.FindSample("/TT")); |
4557 |
< |
TSeemm = allsamples.Draw("TSeemm", mcjzb,binning,"JZB [GeV]","events",sidebandcut&&cutOSSF&&cutnJets,mc,simulatedlumi,allsamples.FindSample("/TT")); |
4558 |
< |
nTSeemm = allsamples.Draw("nTSeemm","-"+mcjzb,binning,"JZB [GeV]","events",sidebandcut&&cutOSSF&&cutnJets,mc,simulatedlumi,allsamples.FindSample("/TT")); |
4555 |
> |
TSem = allsamples.Draw("TSem", mcjzb,binning,"JZB [GeV]","events",sidebandcut&&cutOSOF&&cutnJets&&cut,mc,simulatedlumi,allsamples.FindSample("/TT")); |
4556 |
> |
nTSem = allsamples.Draw("nTSem", "-"+mcjzb,binning,"JZB [GeV]","events",sidebandcut&&cutOSOF&&cutnJets&&cut,mc,simulatedlumi,allsamples.FindSample("/TT")); |
4557 |
> |
TSeemm = allsamples.Draw("TSeemm", mcjzb,binning,"JZB [GeV]","events",sidebandcut&&cutOSSF&&cutnJets&&cut,mc,simulatedlumi,allsamples.FindSample("/TT")); |
4558 |
> |
nTSeemm = allsamples.Draw("nTSeemm","-"+mcjzb,binning,"JZB [GeV]","events",sidebandcut&&cutOSSF&&cutnJets&&cut,mc,simulatedlumi,allsamples.FindSample("/TT")); |
4559 |
|
} |
4560 |
|
|
4561 |
|
TCanvas *tcan = new TCanvas("tcan","tcan"); |
4810 |
|
// nicer_binning.push_back(300); |
4811 |
|
// nicer_binning.push_back(400); |
4812 |
|
|
4813 |
< |
ttbar_sidebands_comparison(mcjzb,nicer_binning, "ttbar/"); |
4813 |
> |
ttbar_sidebands_comparison(mcjzb,nicer_binning, "ttbar/",TCut("mll>0")); |
4814 |
> |
ttbar_sidebands_comparison(mcjzb,nicer_binning, "ttbar/CutAt20",TCut("mll>20")); |
4815 |
> |
ttbar_sidebands_comparison(mcjzb,nicer_binning, "ttbar/LowMassRegion2070",TCut("mll>20&&mll<70")); |
4816 |
> |
ttbar_sidebands_comparison(mcjzb,nicer_binning, "ttbar/ZWindow",Restrmasscut); |
4817 |
> |
|
4818 |
|
} |
4819 |
|
|
4820 |
|
|
4821 |
|
void zjets_prediction_comparison(string mcjzbWithPUa, TCut massregioncut, string massregionname) { |
4822 |
|
cout << "****************************************************************************************************************************************************************" << endl; |
4823 |
|
TCanvas *zcan = new TCanvas("zcan","zcan"); |
4422 |
– |
// zcan->SetLogy(1); |
4824 |
|
TCut weightbackup=cutWeight; |
4825 |
|
|
4826 |
|
bool UsePURW=true; |
4850 |
|
vector<float> binning; |
4851 |
|
binning.push_back(0); |
4852 |
|
binning.push_back(10); |
4853 |
< |
binning.push_back(20); |
4854 |
< |
binning.push_back(40); |
4855 |
< |
binning.push_back(60); |
4856 |
< |
// binning.push_back(50); |
4853 |
> |
binning.push_back(30); |
4854 |
> |
// binning.push_back(40); |
4855 |
> |
// binning.push_back(60); |
4856 |
> |
binning.push_back(50); |
4857 |
|
// binning.push_back(60); |
4858 |
|
// binning.push_back(70); |
4859 |
|
// binning.push_back(80); |
4868 |
|
string var( "abs("+mcjzb+")" ); |
4869 |
|
|
4870 |
|
|
4871 |
< |
TCut notTau("abs(genMID1)!=15"); |
4871 |
> |
TCut notTau("!EventZToTaus"); |
4872 |
|
TCut ee_mm_tautau("mll>0"); |
4873 |
|
|
4473 |
– |
|
4874 |
|
TH1F *hJZBpos = allsamples.Draw("hJZBpos",var,binning, "JZB [GeV]", "events",cutmass&&cutOSSF&&cutnJets&¬Tau&&kPos&&massregioncut,mc,simulatedlumi,allsamples.FindSample("DYJetsToLL")); |
4875 |
|
TH1F *hJZBneg = allsamples.Draw("hJZBneg",var,binning, "JZB [GeV]", "events",cutmass&&cutOSSF&&cutnJets&¬Tau&&kNeg&&massregioncut,mc,simulatedlumi,allsamples.FindSample("DYJetsToLL")); |
4876 |
|
|
4893 |
|
hratio->Divide(hJZBneg); |
4894 |
|
|
4895 |
|
for(int i=1;i<=hJZBpos->GetNbinsX();i++) { |
4896 |
< |
cout << "Positive: " << hJZBpos->GetBinContent(i) << " vs Negative : " << hJZBneg->GetBinContent(i) << " (ratio : " << hJZBpos->GetBinContent(i) / hJZBneg->GetBinContent(i) << " +/- " << (hJZBpos->GetBinContent(i) / hJZBneg->GetBinContent(i)) * sqrt(1.0/hJZBpos->GetBinContent(i) + 1.0/hJZBneg->GetBinContent(i)) << ")" << endl; |
4896 |
> |
cout << "Positive: " << hJZBpos->GetBinContent(i) << " +/- " << hJZBpos->GetBinError(i) << " vs Negative : " << hJZBneg->GetBinContent(i) << " +/- " << hJZBneg->GetBinError(i) << " (ratio : " << hJZBpos->GetBinContent(i) / hJZBneg->GetBinContent(i) << " +/- " << (hJZBpos->GetBinContent(i) / hJZBneg->GetBinContent(i)) * sqrt(pow(hJZBpos->GetBinError(i)/hJZBpos->GetBinContent(i),2) + pow(hJZBneg->GetBinError(i)/hJZBneg->GetBinContent(i),2)) << ")" << endl; |
4897 |
|
} |
4898 |
|
|
4899 |
|
// zcan->SetLogy(0); |
4921 |
|
DrawMCPrelim(simulatedlumi); |
4922 |
|
CompleteSave(zcan,"Systematics/ZJets/zjets_eemm_prediction_ratio"+any2string(massregionname)); |
4923 |
|
|
4524 |
– |
|
4924 |
|
TH1F *TAUhJZBpos = allsamples.Draw("TAUhJZBpos",var,binning, "JZB [GeV]", "events",cutmass&&cutOSSF&&reducedNJets&&ee_mm_tautau&&kPos&&massregioncut,mc,simulatedlumi,allsamples.FindSample("DYJetsToLL")); |
4925 |
|
TH1F *LcorrJZBeemm = allsamples.Draw("LcorrJZBeemm",var,binning, "JZB [GeV]", "events",cutmass&&cutOSSF&&reducedNJets&&ee_mm_tautau&&kNeg&&massregioncut,mc,simulatedlumi,allsamples.FindSample("DYJetsToLL")); |
4926 |
|
TH1F *RcorrJZBem = allsamples.Draw("RcorrJZBem",var,binning, "JZB [GeV]", "events",cutmass&&cutOSOF&&reducedNJets&&ee_mm_tautau&&kPos&&massregioncut,mc,simulatedlumi,allsamples.FindSample("DYJetsToLL")); |
4972 |
|
TAUhratio->Divide(Bpred); |
4973 |
|
|
4974 |
|
for(int i=1;i<=TAUhJZBpos->GetNbinsX();i++) { |
4975 |
< |
cout << "ee/mm/tautau observed: " << TAUhJZBpos->GetBinContent(i) << " vs predicted : " << Bpred->GetBinContent(i) << " (ratio : " << TAUhJZBpos->GetBinContent(i) / Bpred->GetBinContent(i) << endl; |
4975 |
> |
cout << "ee/mm/tautau observed: " << TAUhJZBpos->GetBinContent(i) << " +/- " << TAUhJZBpos->GetBinError(i) << " vs Negative : " << Bpred->GetBinContent(i) << " +/- " << Bpred->GetBinError(i) << " (ratio : " << TAUhJZBpos->GetBinContent(i) / Bpred->GetBinContent(i) << " +/- " << (TAUhJZBpos->GetBinContent(i) / Bpred->GetBinContent(i)) * sqrt(pow(TAUhJZBpos->GetBinError(i)/TAUhJZBpos->GetBinContent(i),2) + pow(Bpred->GetBinError(i)/Bpred->GetBinContent(i),2)) << ")" << endl; |
4976 |
> |
|
4977 |
> |
|
4978 |
|
} |
4979 |
|
|
4980 |
|
zcan->SetLogy(0); |
5011 |
|
//*************************************************************************************************** |
5012 |
|
|
5013 |
|
string jzbvar=var; |
5014 |
+ |
/* |
5015 |
|
for(int i=0;i<60;i+=10) { |
5016 |
|
stringstream sSpecialJZBCut; |
5017 |
|
sSpecialJZBCut << jzbvar << ">" << i; |
5113 |
|
|
5114 |
|
} |
5115 |
|
//*************************************************************************************************** |
5116 |
< |
|
5116 |
> |
*/ |
5117 |
|
delete zcan; |
5118 |
|
cutWeight=weightbackup; |
5119 |
|
} |
5120 |
|
|
5121 |
|
|
5122 |
|
void zjets_prediction_comparison(string mcjzbWithPUa) { |
5123 |
< |
zjets_prediction_comparison(mcjzbWithPUa, TCut("mll>20"), "nomasscut"); |
5123 |
> |
zjets_prediction_comparison(mcjzbWithPUa, TCut("mll>20"), "nomasscut"); |
5124 |
|
zjets_prediction_comparison(mcjzbWithPUa, TCut("abs(mll-91)<10"), "Zwindow_10"); |
4723 |
– |
zjets_prediction_comparison(mcjzbWithPUa, TCut("abs(mll-91)>10&&mll>20"), "Outside_Zwindow_10"); |
5125 |
|
zjets_prediction_comparison(mcjzbWithPUa, TCut("mll>20&&mll<70"), "LowMassRegion2070"); |
5126 |
< |
zjets_prediction_comparison(mcjzbWithPUa, TCut("mll>110"), "HighMassRegion110"); |
5126 |
> |
// zjets_prediction_comparison(mcjzbWithPUa, TCut("abs(mll-91)>10&&mll>20"), "Outside_Zwindow_10"); |
5127 |
> |
// zjets_prediction_comparison(mcjzbWithPUa, TCut("mll>110"), "HighMassRegion110"); |
5128 |
|
} |
5129 |
|
|
5130 |
|
void sideband_assessment(string datajzb, float min=30.0, float max=50.0) { |
5641 |
|
|
5642 |
|
vector<string> findme; |
5643 |
|
findme.push_back("DY"); |
5644 |
< |
findme.push_back("TTJets"); |
5644 |
> |
findme.push_back("TT_"); |
5645 |
|
findme.push_back("LM"); |
5646 |
|
/* |
5647 |
|
for(int ifind=0;ifind<(int)findme.size();ifind++) { |
5949 |
|
|
5950 |
|
|
5951 |
|
TCanvas *ttcan2 = new TCanvas("ttcan2","ttcan2"); |
5952 |
< |
vanilla_ratio->GetYaxis()->SetRangeUser(0.6,1.4); |
5952 |
> |
vanilla_ratio->GetYaxis()->SetRangeUser(0.5,1.5); |
5953 |
|
vanilla_ratio->SetFillColor(kGreen); |
5954 |
|
vanilla_ratio->SetLineColor(kGreen); |
5955 |
|
vanilla_ratio->SetMarkerColor(kGreen); |
6184 |
|
ttbar_region_search(mcjzb); |
6185 |
|
} |
6186 |
|
|
6187 |
+ |
Value GetYieldBetween(TH1F *h, float low, float high) { |
6188 |
+ |
float Yield=0; |
6189 |
+ |
float YieldErr=0; |
6190 |
+ |
for(int i=1;i<=h->GetNbinsX()+1;i++) { |
6191 |
+ |
if(h->GetBinLowEdge(i)+h->GetBinWidth(i)<=low) continue;// considered in the next bin |
6192 |
+ |
if(h->GetBinLowEdge(i)>=high) continue;//above the threshold, out! |
6193 |
+ |
Yield+=h->GetBinContent(i); |
6194 |
+ |
YieldErr=sqrt(YieldErr*YieldErr+h->GetBinError(i)*h->GetBinError(i)); |
6195 |
+ |
} |
6196 |
+ |
|
6197 |
+ |
Value a(Yield,YieldErr); |
6198 |
+ |
return a; |
6199 |
+ |
} |
6200 |
+ |
|
6201 |
+ |
|
6202 |
+ |
void make_SF_over_OF_plot(string datajzb, string mcjzb, TCut cut, string variable, int nbins, float xmin, float ymin, string varname, string filename) { |
6203 |
+ |
TCanvas *SFoOF_can = new TCanvas("SFoOF_can","SFoOF_can"); |
6204 |
+ |
TH1F *data_sf = allsamples.Draw("data_sf","mll",20,0,200, "m_{ll} [GeV]", "events", cut&&cutOSSF,data,luminosity); |
6205 |
+ |
TH1F *data_of = allsamples.Draw("data_of","mll",20,0,200, "m_{ll} [GeV]", "events", cut&&cutOSOF,data,luminosity); |
6206 |
+ |
|
6207 |
+ |
TH1F *mc_sf = allsamples.Draw("mc_sf","mll",20,0,200, "m_{ll} [GeV]", "events", cut&&cutOSSF,mc,luminosity); |
6208 |
+ |
TH1F *mc_of = allsamples.Draw("mc_of","mll",20,0,200, "m_{ll} [GeV]", "events", cut&&cutOSOF,mc,luminosity); |
6209 |
+ |
|
6210 |
+ |
TH1F *mc_ratio = (TH1F*)mc_sf->Clone("mc_ratio"); |
6211 |
+ |
mc_ratio->Divide(mc_of); |
6212 |
+ |
|
6213 |
+ |
TH1F *data_ratio = (TH1F*)data_sf->Clone("data_ratio"); |
6214 |
+ |
data_ratio->Divide(data_of); |
6215 |
+ |
|
6216 |
+ |
mc_ratio->SetFillColor(TColor::GetColor("#00ADE1")); |
6217 |
+ |
mc_ratio->SetMarkerColor(TColor::GetColor("#00ADE1")); |
6218 |
+ |
mc_ratio->GetYaxis()->SetRangeUser(0.5,1.5); |
6219 |
+ |
|
6220 |
+ |
mc_ratio->GetYaxis()->SetTitle("R(SF / OF)"); |
6221 |
+ |
|
6222 |
+ |
|
6223 |
+ |
Value R_sf_of_low_mass = GetYieldBetween(data_sf,20,70)/GetYieldBetween(data_of,20,70); |
6224 |
+ |
Value R_sf_of_high_mass = GetYieldBetween(data_sf,120,200)/GetYieldBetween(data_of,120,200); |
6225 |
+ |
|
6226 |
+ |
Value R_sf_of_low_mass_mc = GetYieldBetween(mc_sf,20,70)/GetYieldBetween(mc_of,20,70); |
6227 |
+ |
Value R_sf_of_high_mass_mc = GetYieldBetween(mc_sf,120,200)/GetYieldBetween(mc_of,120,200); |
6228 |
+ |
|
6229 |
+ |
dout << "Ratio at low mass : " << R_sf_of_low_mass << " (mc : " << R_sf_of_low_mass_mc << " )" << endl; |
6230 |
+ |
dout << "Ratio at high mass : " << R_sf_of_high_mass << " (mc : " << R_sf_of_high_mass_mc << " )" << endl; |
6231 |
+ |
|
6232 |
+ |
TGraphAsymmErrors *gra = produce_ratio_graph(mc_ratio); |
6233 |
+ |
gra->Draw(); |
6234 |
+ |
mc_ratio->Draw(); |
6235 |
+ |
gra->Draw("e20"); |
6236 |
+ |
gra->SetFillColor(TColor::GetColor("#00ADE1")); |
6237 |
+ |
gra->SetMarkerColor(TColor::GetColor("#00ADE1")); |
6238 |
+ |
data_ratio->Draw("e1,same"); |
6239 |
+ |
|
6240 |
+ |
TLegend *leg = new TLegend(0.17,0.16,0.53,0.31); |
6241 |
+ |
// leg->SetHeader("R( SF / OF )"); |
6242 |
+ |
leg->SetFillColor(kWhite); |
6243 |
+ |
leg->SetBorderSize(0); |
6244 |
+ |
leg->AddEntry(data_ratio,"Data","p"); |
6245 |
+ |
leg->AddEntry(gra,"MC","fp"); |
6246 |
+ |
leg->Draw(); |
6247 |
+ |
|
6248 |
+ |
TLine *g = new TLine(0,1.0,200,1.0); |
6249 |
+ |
g->SetLineColor(kBlue); |
6250 |
+ |
g->Draw(); |
6251 |
+ |
|
6252 |
+ |
TLine *l = new TLine(70,0.5,70,1.5); |
6253 |
+ |
l->SetLineStyle(2); |
6254 |
+ |
l->SetLineColor(TColor::GetColor("#00ADE1")); |
6255 |
+ |
TLine *m = new TLine(120,0.5,120,1.5); |
6256 |
+ |
m->SetLineStyle(2); |
6257 |
+ |
m->SetLineColor(TColor::GetColor("#00ADE1")); |
6258 |
+ |
l->Draw(); |
6259 |
+ |
m->Draw(); |
6260 |
+ |
|
6261 |
+ |
|
6262 |
+ |
DrawPrelim(); |
6263 |
+ |
|
6264 |
+ |
CompleteSave(SFoOF_can,"iTTbar/"+filename+"SF_vs_OF"); |
6265 |
+ |
|
6266 |
+ |
delete leg; |
6267 |
+ |
delete mc_sf; |
6268 |
+ |
delete mc_of; |
6269 |
+ |
delete mc_ratio; |
6270 |
+ |
delete data_sf; |
6271 |
+ |
delete data_of; |
6272 |
+ |
delete data_ratio; |
6273 |
+ |
delete SFoOF_can; |
6274 |
+ |
} |
6275 |
+ |
|
6276 |
+ |
void make_iTTbar_JZB_plot(string datajzb, string mcjzb, TCut cut) { |
6277 |
+ |
TCanvas *can = new TCanvas("can","can"); |
6278 |
+ |
vector<float> binning; |
6279 |
+ |
binning.push_back(-100); |
6280 |
+ |
binning.push_back(-50); |
6281 |
+ |
binning.push_back(-20); |
6282 |
+ |
binning.push_back(0); |
6283 |
+ |
// binning.push_back(10); |
6284 |
+ |
binning.push_back(20); |
6285 |
+ |
// binning.push_back(30); |
6286 |
+ |
binning.push_back(50); |
6287 |
+ |
binning.push_back(100); |
6288 |
+ |
binning.push_back(300); |
6289 |
+ |
|
6290 |
+ |
TH1F *hdata = allsamples.Draw("hdata", datajzb, binning, "JZB [GeV]", "events", cut&&cutOSSF,data,luminosity); |
6291 |
+ |
TH1F *hodata = allsamples.Draw("hodata", datajzb, binning, "JZB [GeV]", "events", cut&&cutOSOF,data,luminosity); |
6292 |
+ |
TH1F *hndata = allsamples.Draw("hndata", "-"+datajzb,binning, "JZB [GeV]", "events", cut&&cutOSSF,data,luminosity); |
6293 |
+ |
TH1F *hnodata = allsamples.Draw("hnodata","-"+datajzb,binning, "JZB [GeV]", "events", cut&&cutOSOF,data,luminosity); |
6294 |
+ |
|
6295 |
+ |
TH1F *hmc = allsamples.Draw("hmc", datajzb, binning, "JZB [GeV]", "events", cut&&cutOSSF,mc,luminosity); |
6296 |
+ |
TH1F *homc = allsamples.Draw("homc", datajzb, binning, "JZB [GeV]", "events", cut&&cutOSOF,mc,luminosity); |
6297 |
+ |
|
6298 |
+ |
hodata->SetLineColor(kRed); |
6299 |
+ |
hmc->SetLineColor(kRed); |
6300 |
+ |
// hodata->Add(hndata); |
6301 |
+ |
// hodata->Add(hnodata,-1); |
6302 |
+ |
|
6303 |
+ |
if(hdata->GetMaximum()>hodata->GetMaximum()) { |
6304 |
+ |
hdata->SetMinimum(1.0); |
6305 |
+ |
hdata->Draw(); |
6306 |
+ |
hodata->Draw("histo,same"); |
6307 |
+ |
hdata->Draw("same"); |
6308 |
+ |
} else { |
6309 |
+ |
hodata->SetMinimum(1.0); |
6310 |
+ |
hodata->Draw("histo"); |
6311 |
+ |
hdata->Draw("same"); |
6312 |
+ |
} |
6313 |
+ |
|
6314 |
+ |
CompleteSave(can,"iTTbar/JZB_plot"); |
6315 |
+ |
TH1F *ratio = (TH1F*)hdata->Clone("ratio"); |
6316 |
+ |
ratio->Divide(hodata); |
6317 |
+ |
ratio->GetYaxis()->SetTitle("obs/pred"); |
6318 |
+ |
ratio->GetYaxis()->SetRangeUser(0,2); |
6319 |
+ |
|
6320 |
+ |
ratio->Draw(); |
6321 |
+ |
TLine *l = new TLine(-100,1.0,300,1.0); |
6322 |
+ |
l->SetLineColor(kBlue); |
6323 |
+ |
l->SetLineStyle(2); |
6324 |
+ |
l->Draw(); |
6325 |
+ |
TLine *llow = new TLine(-100,1.0-0.07,300,1.0-0.07); |
6326 |
+ |
TLine *lhi = new TLine(-100,1.0+0.07,300,1.0+0.07); |
6327 |
+ |
llow->SetLineColor(kBlue); |
6328 |
+ |
llow->SetLineStyle(2); |
6329 |
+ |
llow->Draw(); |
6330 |
+ |
lhi->SetLineColor(kBlue); |
6331 |
+ |
lhi->SetLineStyle(2); |
6332 |
+ |
lhi->Draw(); |
6333 |
+ |
|
6334 |
+ |
CompleteSave(can,"iTTbar/JZB_plot_ratio"); |
6335 |
+ |
|
6336 |
+ |
delete hdata; |
6337 |
+ |
delete hodata; |
6338 |
+ |
delete ratio; |
6339 |
+ |
delete can; |
6340 |
+ |
// THStack *hmc = new THStack(allsamples.DrawStack("hmc","mll",40,0,200, "m_{ll} [GeV]", "events", cut&&cutOSSF,mc,luminosity)); |
6341 |
+ |
// THStack *homc = new THStack(allsamples.DrawStack("homc","mll",40,0,200, "m_{ll} [GeV]", "events", cut&&cutOSOF,mc,luminosity)); |
6342 |
+ |
} |
6343 |
+ |
|
6344 |
+ |
|
6345 |
+ |
|
6346 |
+ |
void MakeSpecialiTTbarClosurePlot(TCut fullcut, string datajzb, string mcjzb, string MassRegion) { |
6347 |
+ |
TCanvas *iTTbarClosureTestCanvas = new TCanvas("iTTbarClosureTestCanvas","iTTbarClosureTestCanvas"); |
6348 |
+ |
|
6349 |
+ |
vector<float> binning; |
6350 |
+ |
/* |
6351 |
+ |
binning.push_back(0); |
6352 |
+ |
binning.push_back(20); |
6353 |
+ |
binning.push_back(50); |
6354 |
+ |
binning.push_back(100); |
6355 |
+ |
// binning.push_back(200); |
6356 |
+ |
*/ |
6357 |
+ |
binning.push_back(0); |
6358 |
+ |
binning.push_back(10); |
6359 |
+ |
binning.push_back(30); |
6360 |
+ |
binning.push_back(50); |
6361 |
+ |
binning.push_back(100); |
6362 |
+ |
// binning.push_back(200); |
6363 |
+ |
|
6364 |
+ |
|
6365 |
+ |
TH1F *hdata = allsamples.Draw("hdata", datajzb,binning, "JZB [GeV]", "events", fullcut&&TCut("id1==id2"),data,luminosity); |
6366 |
+ |
TH1F *hodata = allsamples.Draw("hodata",datajzb,binning, "JZB [GeV]", "events", fullcut&&TCut("id1!=id2"),data,luminosity); |
6367 |
+ |
TH1F *hmc = allsamples.Draw("hmc", mcjzb,binning, "JZB [GeV]", "events", fullcut&&TCut("id1==id2"),mc,luminosity); |
6368 |
+ |
TH1F *homc = allsamples.Draw("homc", mcjzb,binning, "JZB [GeV]", "events", fullcut&&TCut("id1!=id2"),mc,luminosity); |
6369 |
+ |
|
6370 |
+ |
hdata->SetLineColor(kBlack); |
6371 |
+ |
hmc->SetLineColor(kBlack); |
6372 |
+ |
hodata->SetLineColor(kRed); |
6373 |
+ |
homc->SetLineColor(kRed); |
6374 |
+ |
hodata->SetMarkerColor(kRed); |
6375 |
+ |
|
6376 |
+ |
hdata->GetYaxis()->SetTitle("events"); |
6377 |
+ |
|
6378 |
+ |
float maximum=hdata->GetMaximum()+1.2*sqrt(hdata->GetMaximum()); |
6379 |
+ |
float minimum=hdata->GetMinimum()-1.2*sqrt(hdata->GetMinimum()); |
6380 |
+ |
if(hmc->GetMinimum()<minimum) minimum=hmc->GetMinimum()-1.2*sqrt(hmc->GetMinimum()); |
6381 |
+ |
if(hmc->GetMaximum()>maximum) maximum=hmc->GetMaximum()+1.2*sqrt(hmc->GetMaximum()); |
6382 |
+ |
if(homc->GetMinimum()<minimum) minimum=homc->GetMinimum()-1.2*sqrt(homc->GetMinimum()); |
6383 |
+ |
if(homc->GetMaximum()>maximum) maximum=homc->GetMaximum()+1.2*sqrt(homc->GetMaximum()); |
6384 |
+ |
if(hodata->GetMinimum()<minimum) minimum=hodata->GetMinimum()-1.2*sqrt(hodata->GetMinimum()); |
6385 |
+ |
if(hodata->GetMaximum()>maximum) maximum=hodata->GetMaximum()+1.2*sqrt(hodata->GetMaximum()); |
6386 |
+ |
|
6387 |
+ |
hdata->SetMaximum(maximum); |
6388 |
+ |
hdata->SetMinimum(minimum); |
6389 |
+ |
|
6390 |
+ |
|
6391 |
+ |
hdata->Draw(); |
6392 |
+ |
hmc->Draw("same,histo"); |
6393 |
+ |
homc->Draw("same,histo"); |
6394 |
+ |
hdata->Draw("same"); |
6395 |
+ |
hodata->Draw("same"); |
6396 |
+ |
|
6397 |
+ |
TLegend *leg = make_legend(); |
6398 |
+ |
leg->AddEntry(hdata,"SF data","pe"); |
6399 |
+ |
leg->AddEntry(hodata,"OF data","pe"); |
6400 |
+ |
leg->AddEntry(hmc,"SF MC","l"); |
6401 |
+ |
leg->AddEntry(homc,"OF MC","l"); |
6402 |
+ |
leg->Draw(); |
6403 |
+ |
|
6404 |
+ |
DrawPrelim(); |
6405 |
+ |
|
6406 |
+ |
CompleteSave(iTTbarClosureTestCanvas,"iTTbar/TTbar_CR_Closure_"+MassRegion); |
6407 |
+ |
|
6408 |
+ |
TH1F *ratio_data = (TH1F*)hdata->Clone("ratio_data"); |
6409 |
+ |
ratio_data->Divide(hodata); |
6410 |
+ |
TH1F *ratio_mc = (TH1F*)hmc->Clone("ratio_mc"); |
6411 |
+ |
ratio_mc->Divide(homc); |
6412 |
+ |
|
6413 |
+ |
ratio_mc->SetFillColor(kBlue); |
6414 |
+ |
ratio_mc->SetMarkerSize(0); |
6415 |
+ |
|
6416 |
+ |
TGraphAsymmErrors *eratio = produce_ratio_graph(ratio_mc); |
6417 |
+ |
|
6418 |
+ |
eratio->SetFillColor(TColor::GetColor("#00ADE1")); |
6419 |
+ |
ratio_data->GetYaxis()->SetRangeUser(0.5,1.5); |
6420 |
+ |
ratio_data->Draw("e1"); |
6421 |
+ |
eratio->Draw("20"); |
6422 |
+ |
ratio_data->Draw("e1,same"); |
6423 |
+ |
|
6424 |
+ |
TLegend *leg2 = make_legend(); |
6425 |
+ |
leg2->AddEntry(ratio_data,"R(SF/OF) in #bar{t}t CR, data","pe"); |
6426 |
+ |
leg2->AddEntry(eratio ,"R(SF/OF) in #bar{t}t CR, MC" ,"f"); |
6427 |
+ |
leg2->SetY1(0.8); |
6428 |
+ |
leg2->SetX1(0.45); |
6429 |
+ |
leg2->Draw(); |
6430 |
+ |
|
6431 |
+ |
DrawPrelim(); |
6432 |
+ |
CompleteSave(iTTbarClosureTestCanvas,"iTTbar/TTbar_CR_Closure_Ratio_"+MassRegion); |
6433 |
+ |
|
6434 |
+ |
TFile *f = new TFile("fout.root","RECREATE"); |
6435 |
+ |
eratio->Write(); |
6436 |
+ |
ratio_data->Write(); |
6437 |
+ |
leg2->Write(); |
6438 |
+ |
f->Close(); |
6439 |
+ |
|
6440 |
+ |
|
6441 |
+ |
delete leg; |
6442 |
+ |
delete leg2; |
6443 |
+ |
delete ratio_data; |
6444 |
+ |
delete ratio_mc; |
6445 |
+ |
delete hdata; |
6446 |
+ |
delete hmc; |
6447 |
+ |
delete hodata; |
6448 |
+ |
delete iTTbarClosureTestCanvas; |
6449 |
+ |
} |
6450 |
+ |
|
6451 |
+ |
|
6452 |
+ |
|
6453 |
+ |
void make_ijzb_ttbar_closure_test(string datajzb, string mcjzb) { |
6454 |
+ |
TCut tt_nJets("pfJetGoodNum40==2"); |
6455 |
+ |
TCut tt_bJet("pfJetGoodNumBtag40==2 && met[4]>10"); |
6456 |
+ |
TCut tt_LowMass("mll>20&&mll<70"); |
6457 |
+ |
TCut tt_HighMass("mll>120&&mll<200"); |
6458 |
+ |
TCut tt_noZ(tt_LowMass || tt_HighMass); |
6459 |
+ |
|
6460 |
+ |
/* |
6461 |
+ |
make_iTTbar_JZB_plot(datajzb, mcjzb,tt_nJets&&tt_bJet&&tt_noZ); |
6462 |
+ |
*/ |
6463 |
+ |
TCanvas *can = new TCanvas("can","can"); |
6464 |
+ |
|
6465 |
+ |
TH1F *hdata = allsamples.Draw( "hdata", "mll",40,0,200, "m_{ll} [GeV]", "events", tt_nJets&&tt_bJet&&tt_noZ&&cutOSSF,data,luminosity); |
6466 |
+ |
THStack *hmc = new THStack( allsamples.DrawStack( "hmc", "mll",40,0,200, "m_{ll} [GeV]", "events", tt_nJets&&tt_bJet&&tt_noZ&&cutOSSF,mc, luminosity)); |
6467 |
+ |
TH1F *hodata = allsamples.Draw( "hodata","mll",40,0,200, "m_{ll} [GeV]", "events", tt_nJets&&tt_bJet&&tt_noZ&&cutOSOF,data,luminosity); |
6468 |
+ |
THStack *homc = new THStack( allsamples.DrawStack( "homc", "mll",40,0,200, "m_{ll} [GeV]", "events", tt_nJets&&tt_bJet&&tt_noZ&&cutOSOF,mc, luminosity)); |
6469 |
+ |
|
6470 |
+ |
TH1F *coll_hmc = CollapseStack(hmc); |
6471 |
+ |
TH1F *coll_homc = CollapseStack(homc); |
6472 |
+ |
|
6473 |
+ |
bool dolog=true; |
6474 |
+ |
bool nolog=false; |
6475 |
+ |
|
6476 |
+ |
dout << " SF: " << endl; |
6477 |
+ |
dout << " Data : " << hdata->Integral() << endl; |
6478 |
+ |
WriteYield(hmc, 0, 10000); |
6479 |
+ |
dout << " OF: " << endl; |
6480 |
+ |
dout << " Data : " << hodata->Integral() << endl; |
6481 |
+ |
WriteYield(homc, 0, 10000); |
6482 |
+ |
hodata->SetLineColor(kRed); |
6483 |
+ |
hdata->Draw(); |
6484 |
+ |
hmc->Draw("histo,same"); |
6485 |
+ |
hodata->Draw("histo,same"); |
6486 |
+ |
hdata->Draw("e1,same"); |
6487 |
+ |
DrawPrelim(); |
6488 |
+ |
CompleteSave(can,"TestingPrediction"); |
6489 |
+ |
|
6490 |
+ |
dout << "We get an expected ratio of " << coll_hmc->Integral()/coll_homc->Integral() << endl; |
6491 |
+ |
dout << "In data we find " << hdata->Integral()/hodata->Integral() << endl; |
6492 |
+ |
|
6493 |
+ |
Value R_sf_of_low_mass = GetYieldBetween(hdata,20,70)/GetYieldBetween(hodata,20,70); |
6494 |
+ |
Value R_sf_of_high_mass = GetYieldBetween(hdata,120,200)/GetYieldBetween(hodata,120,200); |
6495 |
+ |
|
6496 |
+ |
Value R_sf_of_low_mass_mc = GetYieldBetween(coll_hmc,20,70)/GetYieldBetween(coll_homc,20,70); |
6497 |
+ |
Value R_sf_of_high_mass_mc = GetYieldBetween(coll_hmc,120,200)/GetYieldBetween(coll_homc,120,200); |
6498 |
+ |
|
6499 |
+ |
dout << "Ratio at low mass : " << R_sf_of_low_mass << " (mc : " << R_sf_of_low_mass_mc << " )" << endl; |
6500 |
+ |
dout << "Ratio at high mass : " << R_sf_of_high_mass << " (mc : " << R_sf_of_high_mass_mc << " )" << endl; |
6501 |
+ |
|
6502 |
+ |
dout << "Composition at low mass : " << endl; |
6503 |
+ |
dout << "Same flavor: " << endl; |
6504 |
+ |
ProduceYields(20, 70, hdata, hmc); |
6505 |
+ |
dout << "Opposite flavor: " << endl; |
6506 |
+ |
ProduceYields(20, 70, hodata, homc); |
6507 |
+ |
|
6508 |
+ |
dout << endl << endl; |
6509 |
+ |
|
6510 |
+ |
dout << "Composition at high mass : " << endl; |
6511 |
+ |
dout << "Same flavor: " << endl; |
6512 |
+ |
ProduceYields(120, 200, hdata, hmc); |
6513 |
+ |
dout << "Opposite flavor: " << endl; |
6514 |
+ |
ProduceYields(120, 200, hodata, homc); |
6515 |
+ |
|
6516 |
+ |
|
6517 |
+ |
|
6518 |
+ |
|
6519 |
+ |
make_plain_kin_plot(mcjzb,(const char*) (tt_nJets&&tt_bJet&&tt_noZ&&cutOSSF),20,-200,200,dolog,"JZB","iTTbar/JZB_SF",false,true); |
6520 |
+ |
make_plain_kin_plot(mcjzb,(const char*) (tt_nJets&&tt_bJet&&tt_noZ&&cutOSOF),20,-200,200,dolog,"JZB","iTTbar/JZB_OF",false,true); |
6521 |
+ |
|
6522 |
+ |
make_plain_kin_plot("mll",(const char*) (tt_nJets&&tt_bJet&&tt_noZ&&cutOSSF),40,0,200,nolog,"m_{ll} [GeV]","iTTbar/mll_SF",false,true); |
6523 |
+ |
make_plain_kin_plot("mll",(const char*) (tt_nJets&&tt_bJet&&tt_noZ&&cutOSOF),40,0,200,nolog,"m_{ll} [GeV]","iTTbar/mll_OF",false,true); |
6524 |
+ |
|
6525 |
+ |
make_SF_over_OF_plot(datajzb, mcjzb,tt_nJets&&tt_bJet&&tt_noZ,"mll",20,0,200,"m_{ll} [GeV]","mll"); |
6526 |
+ |
|
6527 |
+ |
MakeSpecialiTTbarClosurePlot((tt_nJets&&tt_bJet&&tt_LowMass),datajzb,mcjzb,"LowMassRegion2070"); |
6528 |
+ |
MakeSpecialiTTbarClosurePlot((tt_nJets&&tt_bJet&&tt_HighMass),datajzb,mcjzb,"HighMassRegion"); |
6529 |
+ |
MakeSpecialiTTbarClosurePlot((tt_nJets&&tt_bJet&&tt_noZ),datajzb,mcjzb,"NoZ"); |
6530 |
+ |
|
6531 |
+ |
// make_plain_kin_plot("pfJetGoodNum40",(const char*) (tt_nJets&&tt_bJet&&tt_noZ&&cutOSSF),10,-0.5,9.5,dolog,"n_{jets}","iTTbar/nJets_SF",false,true); |
6532 |
+ |
// make_plain_kin_plot("pfJetGoodNum40",(const char*) (tt_nJets&&tt_bJet&&tt_noZ&&cutOSOF),10,-0.5,9.5,dolog,"n_{jets}","iTTbar/nJets_OF",false,true); |
6533 |
+ |
// |
6534 |
+ |
// make_plain_kin_plot("pfJetGoodNumBtag40",(const char*) (tt_nJets&&tt_bJet&&tt_noZ&&cutOSSF),10,-0.5,9.5,dolog,"n_{btags}","iTTbar/nBtags_SF",false,true); |
6535 |
+ |
// make_plain_kin_plot("pfJetGoodNumBtag40",(const char*) (tt_nJets&&tt_bJet&&tt_noZ&&cutOSOF),10,-0.5,9.5,dolog,"n_{btags}","iTTbar/nBtags_OF",false,true); |
6536 |
+ |
|
6537 |
+ |
|
6538 |
+ |
delete coll_hmc; |
6539 |
+ |
delete coll_homc; |
6540 |
+ |
delete hmc; |
6541 |
+ |
delete homc; |
6542 |
+ |
delete hdata; |
6543 |
+ |
delete hodata; |
6544 |
+ |
delete can; |
6545 |
+ |
} |
6546 |
+ |
|
6547 |
+ |
void compute_global_significance(float local_significance) { |
6548 |
+ |
float global_sigificance = ROOT::Math::normal_quantile_c(ROOT::Math::normal_cdf_c(local_significance,1)*4,1); |
6549 |
+ |
dout << "local significance : " << local_significance << endl; |
6550 |
+ |
dout << "global significance : " << global_sigificance << endl; |
6551 |
+ |
} |
6552 |
+ |
|
6553 |
+ |
|
6554 |
|
void test() { |
6555 |
|
|
6556 |
|
|