32 |
|
} |
33 |
|
|
34 |
|
|
35 |
+ |
namespace PeakLibrary { |
36 |
+ |
bool StoreHistos=false; |
37 |
+ |
vector<TH1F*> DataHistogram; |
38 |
+ |
vector<TH1F*> MCHistogram; |
39 |
+ |
} |
40 |
+ |
|
41 |
|
|
42 |
< |
void find_one_peak_combination(TCut specialcut, float &MCPeak,float &MCPeakError, float &DataPeak, float &DataPeakError, float &MCSigma, float &MCSigmaError, float &DataSigma, float& DataSigmaError, stringstream &result, bool doPUreweighting = true, string saveas="") |
42 |
> |
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="") |
43 |
|
{ |
44 |
|
// Temporarily switch off PU reweighting, if asked |
45 |
|
TCut weightbackup=cutWeight; |
48 |
|
int nbins=100; |
49 |
|
if(PlottingSetup::DoBTag) nbins=25; |
50 |
|
|
51 |
+ |
TCut nJetsCut(cutnJets); |
52 |
+ |
if(SwitchOffNJetsCut) nJetsCut=specialcut; |
53 |
+ |
|
54 |
+ |
|
55 |
|
TCanvas *tempcan = new TCanvas("tempcan","Temporary canvas for peak finding preparations"); |
56 |
< |
TH1F *rawJZBeemmMC = allsamples.Draw("rawJZBeemmMC",jzbvariablemc,nbins,-50,50, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&specialcut,mc, luminosity); |
57 |
< |
TH1F *rawJZBeemmData = allsamples.Draw("rawJZBeemmData",jzbvariabledata,nbins, -50,50, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&specialcut,data, luminosity); |
58 |
< |
TH1F *rawJZBemMC = allsamples.Draw("rawJZBemMC",jzbvariablemc,nbins,-50,50, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets&&specialcut,mc, luminosity); |
59 |
< |
TH1F *rawJZBemData = allsamples.Draw("rawJZBemData",jzbvariabledata,nbins, -50,50, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets&&specialcut,data, luminosity); |
56 |
> |
TH1F *rawJZBeemmMC = allsamples.Draw("rawJZBeemmMC",jzbvariablemc,nbins,-50,50, "JZB [GeV]", "events", cutmass&&cutOSSF&&nJetsCut&&specialcut,mc, luminosity); |
57 |
> |
TH1F *rawJZBeemmData = allsamples.Draw("rawJZBeemmData",jzbvariabledata,nbins, -50,50, "JZB [GeV]", "events", cutmass&&cutOSSF&&nJetsCut&&specialcut,data, luminosity); |
58 |
> |
TH1F *rawJZBemMC = allsamples.Draw("rawJZBemMC",jzbvariablemc,nbins,-50,50, "JZB [GeV]", "events", cutmass&&cutOSOF&&nJetsCut&&specialcut,mc, luminosity); |
59 |
> |
TH1F *rawJZBemData = allsamples.Draw("rawJZBemData",jzbvariabledata,nbins, -50,50, "JZB [GeV]", "events", cutmass&&cutOSOF&&nJetsCut&&specialcut,data, luminosity); |
60 |
|
TH1F *rawttbarjzbeemmMC; |
61 |
|
|
62 |
|
if(method==doKM) { |
63 |
|
//we only need this histo for the KM fitting... |
64 |
< |
rawttbarjzbeemmMC = allsamples.Draw("rawttbarjzbeemmMC",jzbvariablemc,nbins, -50,50, "JZB [GeV]", "events",cutmass&&cutOSSF&&cutnJets&&specialcut,mc,luminosity,allsamples.FindSample("TTJet")); |
64 |
> |
rawttbarjzbeemmMC = allsamples.Draw("rawttbarjzbeemmMC",jzbvariablemc,nbins, -50,50, "JZB [GeV]", "events",cutmass&&cutOSSF&&nJetsCut&&specialcut,mc,luminosity,allsamples.FindSample("TTJet")); |
65 |
|
MCPeak=find_peak(rawJZBeemmMC, rawttbarjzbeemmMC, -40, 40, mc, MCPeakError,MCSigma,MCSigmaError,method,saveas); |
66 |
|
DataPeak=find_peak(rawJZBeemmData, rawJZBeemmData, -40, 40, data, DataPeakError,DataSigma,DataSigmaError,method,saveas); |
67 |
|
delete rawttbarjzbeemmMC; |
87 |
|
result << " We have found the peak in Data at " << DataPeak << " +/- " << DataPeakError << " with sigma=" << DataSigma << " +/- " << DataSigmaError << endl; |
88 |
|
dout << " We have found the peak in MC at " << MCPeak << " +/- " << MCPeakError << " with sigma=" << MCSigma << " +/- " << MCSigmaError << endl; |
89 |
|
result << " We have found the peak in MC at " << MCPeak << " +/- " << MCPeakError << " with sigma=" << MCSigma << " +/- " << MCSigmaError << endl; |
90 |
< |
delete rawJZBeemmData; |
91 |
< |
delete rawJZBeemmMC; |
90 |
> |
|
91 |
> |
if(!PeakLibrary::StoreHistos) { |
92 |
> |
delete rawJZBeemmData; |
93 |
> |
delete rawJZBeemmMC; |
94 |
> |
} else { |
95 |
> |
rawJZBeemmMC->SetName(GetNumericHistoName().c_str()); |
96 |
> |
rawJZBeemmData->SetName(GetNumericHistoName().c_str()); |
97 |
> |
rawJZBeemmMC->Add(rawJZBemMC,-1); |
98 |
> |
rawJZBeemmData->Add(rawJZBemData,-1); |
99 |
> |
PeakLibrary::DataHistogram.push_back(rawJZBeemmData); |
100 |
> |
PeakLibrary::MCHistogram.push_back(rawJZBeemmMC); |
101 |
> |
} |
102 |
> |
|
103 |
> |
|
104 |
> |
|
105 |
|
delete rawJZBemData; |
106 |
|
delete rawJZBemMC; |
107 |
|
delete tempcan; |
108 |
|
} |
109 |
|
|
110 |
< |
void find_peaks(float &MCPeak,float &MCPeakError, float &DataPeak, float &DataPeakError, stringstream &result, bool doPUreweighting, stringstream &datajzb, stringstream &mcjzb) |
110 |
> |
void Old_FindPeakPileUpCorrection() { |
111 |
> |
bool StoreResultsInSeparateFile=false; |
112 |
> |
PeakLibrary::StoreHistos=true; |
113 |
> |
|
114 |
> |
|
115 |
> |
dout << "Finding peak position as a function of PU" << endl; |
116 |
> |
float MCPeak, MCPeakError, DataPeak, DataPeakError; |
117 |
> |
stringstream result, datajzb, mcjzb; |
118 |
> |
bool doPUreweighting=true; |
119 |
> |
bool SwitchOffNJetsCut=false; |
120 |
> |
|
121 |
> |
|
122 |
> |
TCanvas *can = new TCanvas("can","can"); |
123 |
> |
float mcSigma,mcSigmaError,dataSigma,dataSigmaError; |
124 |
> |
|
125 |
> |
float NumVtxBin[6] = {0,5,10,15,20,30}; |
126 |
> |
|
127 |
> |
stringstream NowCut; |
128 |
> |
|
129 |
> |
TGraphErrors *gMCPeak = new TGraphErrors(); |
130 |
> |
gMCPeak->SetTitle("gMCPeak"); |
131 |
> |
gMCPeak->SetName("gMCPeak"); |
132 |
> |
TGraphErrors *gDataPeak = new TGraphErrors(); |
133 |
> |
gDataPeak->SetTitle("gDataPeak"); |
134 |
> |
gDataPeak->SetName("gDataPeak"); |
135 |
> |
TGraphErrors *gMCWidth = new TGraphErrors(); |
136 |
> |
gMCWidth->SetTitle("gMCWidth"); |
137 |
> |
gMCWidth->SetName("gMCWidth"); |
138 |
> |
TGraphErrors *gDataWidth = new TGraphErrors(); |
139 |
> |
gDataWidth->SetTitle("gDataWidth"); |
140 |
> |
gDataWidth->SetName("gDataWidth"); |
141 |
> |
|
142 |
> |
|
143 |
> |
for(int i=0;i<5;i++) { |
144 |
> |
NowCut.str(""); |
145 |
> |
NowCut << "numVtx>=" << NumVtxBin[i] << "&&numVtx<" << NumVtxBin[i+1]; |
146 |
> |
find_one_peak_combination(TCut(NowCut.str().c_str()),SwitchOffNJetsCut,MCPeak,MCPeakError, DataPeak,DataPeakError,mcSigma,mcSigmaError, dataSigma,dataSigmaError,result,doPUreweighting,""); |
147 |
> |
cout << " " << MCPeak << " +/- " << MCPeakError << endl; |
148 |
> |
cout << " " << DataPeak << " +/- " << DataPeakError << endl; |
149 |
> |
|
150 |
> |
gMCPeak->SetPoint(i,0.5*(NumVtxBin[i]+NumVtxBin[i+1]),MCPeak); |
151 |
> |
gMCPeak->SetPointError(i,0.5*(NumVtxBin[i+1]-NumVtxBin[i]),MCPeakError); |
152 |
> |
|
153 |
> |
gDataPeak->SetPoint(i,0.5*(NumVtxBin[i]+NumVtxBin[i+1]),DataPeak); |
154 |
> |
gDataPeak->SetPointError(i,0.5*(NumVtxBin[i+1]-NumVtxBin[i]),DataPeakError); |
155 |
> |
|
156 |
> |
gMCWidth->SetPoint(i,0.5*(NumVtxBin[i]+NumVtxBin[i+1]),mcSigma); |
157 |
> |
gMCWidth->SetPointError(i,0.5*(NumVtxBin[i+1]-NumVtxBin[i]),mcSigmaError); |
158 |
> |
|
159 |
> |
gDataWidth->SetPoint(i,0.5*(NumVtxBin[i]+NumVtxBin[i+1]),dataSigma); |
160 |
> |
gDataWidth->SetPointError(i,0.5*(NumVtxBin[i+1]-NumVtxBin[i]),dataSigmaError); |
161 |
> |
} |
162 |
> |
|
163 |
> |
can->cd(); |
164 |
> |
gMCPeak->GetXaxis()->SetTitle("N(Vertices)"); |
165 |
> |
gMCPeak->GetYaxis()->SetTitle("Peak position"); |
166 |
> |
gMCPeak->GetXaxis()->CenterTitle(); |
167 |
> |
gMCPeak->GetYaxis()->CenterTitle(); |
168 |
> |
gDataPeak->GetXaxis()->SetTitle("N(Vertices)"); |
169 |
> |
gDataPeak->GetYaxis()->SetTitle("Peak position"); |
170 |
> |
gDataPeak->GetXaxis()->CenterTitle(); |
171 |
> |
gDataPeak->GetYaxis()->CenterTitle(); |
172 |
> |
|
173 |
> |
gDataWidth->GetXaxis()->SetTitle("N(Vertices)"); |
174 |
> |
gDataWidth->GetYaxis()->SetTitle("#sigma_{JZB}"); |
175 |
> |
gDataWidth->GetXaxis()->CenterTitle(); |
176 |
> |
gDataWidth->GetYaxis()->CenterTitle(); |
177 |
> |
gMCWidth->GetXaxis()->SetTitle("N(Vertices)"); |
178 |
> |
gMCWidth->GetYaxis()->SetTitle("#sigma_{JZB}"); |
179 |
> |
gMCWidth->GetXaxis()->CenterTitle(); |
180 |
> |
gMCWidth->GetYaxis()->CenterTitle(); |
181 |
> |
|
182 |
> |
gMCPeak->SetFillColor(TColor::GetColor("#2E9AFE")); |
183 |
> |
gDataPeak->SetFillColor(TColor::GetColor("#2E9AFE")); |
184 |
> |
gDataWidth->SetFillColor(TColor::GetColor("#2E9AFE")); |
185 |
> |
gMCWidth->SetFillColor(TColor::GetColor("#2E9AFE")); |
186 |
> |
|
187 |
> |
gMCPeak->Draw("A2"); |
188 |
> |
DrawMCPrelim(); |
189 |
> |
CompleteSave(can,"PUStudy/MCPeak"); |
190 |
> |
can->cd(); |
191 |
> |
gMCWidth->Draw("A2"); |
192 |
> |
DrawMCPrelim(); |
193 |
> |
CompleteSave(can,"PUStudy/MCWidth"); |
194 |
> |
|
195 |
> |
can->cd(); |
196 |
> |
gDataPeak->Draw("A2"); |
197 |
> |
|
198 |
> |
DrawPrelim(); |
199 |
> |
CompleteSave(can,"PUStudy/DataPeak"); |
200 |
> |
can->cd(); |
201 |
> |
gDataWidth->Draw("A2"); |
202 |
> |
DrawPrelim(); |
203 |
> |
CompleteSave(can,"PUStudy/DataWidth"); |
204 |
> |
|
205 |
> |
if(StoreResultsInSeparateFile) { |
206 |
> |
TFile *PeakFinding = new TFile("PeakFindingWithPeakCorrection.root","RECREATE"); |
207 |
> |
gMCPeak->Write(); |
208 |
> |
gDataPeak->Write(); |
209 |
> |
gMCWidth->Write(); |
210 |
> |
gDataWidth->Write(); |
211 |
> |
PeakFinding->Close(); |
212 |
> |
} |
213 |
> |
|
214 |
> |
gDataPeak->Fit("pol1","L"); |
215 |
> |
TF1 *DataFit = (TF1*)gDataPeak->GetFunction("pol1"); |
216 |
> |
gMCPeak->Fit("pol1","L"); |
217 |
> |
TF1 *MCFit = (TF1*)gMCPeak->GetFunction("pol1"); |
218 |
> |
|
219 |
> |
|
220 |
> |
can->cd(); |
221 |
> |
gMCPeak->Draw("A2"); |
222 |
> |
DrawMCPrelim(); |
223 |
> |
CompleteSave(can,"PUStudy/MCPeak_WithFit"); |
224 |
> |
can->cd(); |
225 |
> |
|
226 |
> |
can->cd(); |
227 |
> |
gDataPeak->Draw("A2"); |
228 |
> |
DrawPrelim(); |
229 |
> |
CompleteSave(can,"PUStudy/DataPeak_WithFit"); |
230 |
> |
|
231 |
> |
|
232 |
> |
|
233 |
> |
dout << "The suggested correction for Data is : " << DataFit->GetParameter(1) << endl; |
234 |
> |
dout << "The suggested correction for MC is : " << MCFit->GetParameter(1) << endl; |
235 |
> |
|
236 |
> |
TLegend *leg = make_legend(); |
237 |
> |
can->cd(); |
238 |
> |
int j=0; |
239 |
> |
for(int i=PeakLibrary::DataHistogram.size()-5;i<PeakLibrary::DataHistogram.size();i++) { |
240 |
> |
PeakLibrary::DataHistogram[i]->Rebin(5); |
241 |
> |
PeakLibrary::DataHistogram[i]->SetLineColor(j+1); |
242 |
> |
if(i==PeakLibrary::DataHistogram.size()-5) PeakLibrary::DataHistogram[i]->DrawNormalized("histo"); |
243 |
> |
else PeakLibrary::DataHistogram[i]->DrawNormalized("histo,same"); |
244 |
> |
stringstream name; |
245 |
> |
name << NumVtxBin[j] << " < N_{vtx} < " << NumVtxBin[j+1]; |
246 |
> |
leg->AddEntry(PeakLibrary::DataHistogram[i],name.str().c_str(),"l"); |
247 |
> |
j++; |
248 |
> |
} |
249 |
> |
|
250 |
> |
leg->Draw(); |
251 |
> |
DrawPrelim(); |
252 |
> |
CompleteSave(can,"PUStudy/DataOverview"); |
253 |
> |
|
254 |
> |
TLegend *leg2 = make_legend(); |
255 |
> |
can->cd(); |
256 |
> |
j=0; |
257 |
> |
for(int i=PeakLibrary::MCHistogram.size()-5;i<PeakLibrary::MCHistogram.size();i++) { |
258 |
> |
PeakLibrary::MCHistogram[i]->Rebin(5); |
259 |
> |
PeakLibrary::MCHistogram[i]->SetLineColor(j+1); |
260 |
> |
if(i==PeakLibrary::MCHistogram.size()-5) PeakLibrary::MCHistogram[i]->DrawNormalized("histo"); |
261 |
> |
else PeakLibrary::MCHistogram[i]->DrawNormalized("histo,same"); |
262 |
> |
stringstream name; |
263 |
> |
name << NumVtxBin[j] << " < N_{vtx} < " << NumVtxBin[j+1]; |
264 |
> |
leg->AddEntry(PeakLibrary::MCHistogram[i],name.str().c_str(),"l"); |
265 |
> |
j++; |
266 |
> |
} |
267 |
> |
|
268 |
> |
leg->Draw(); |
269 |
> |
DrawPrelim(); |
270 |
> |
CompleteSave(can,"PUStudy/MCOverview"); |
271 |
> |
|
272 |
> |
delete can; |
273 |
> |
PeakLibrary::StoreHistos=false; |
274 |
> |
} |
275 |
> |
|
276 |
> |
void FindPeakPileUpCorrection() { |
277 |
> |
bool StoreResultsInSeparateFile=true; |
278 |
> |
PeakLibrary::StoreHistos=true; |
279 |
> |
|
280 |
> |
|
281 |
> |
dout << "Finding peak position as a function of PU" << endl; |
282 |
> |
float MCPeak, MCPeakError, DataPeak, DataPeakError; |
283 |
> |
stringstream result, datajzb, mcjzb; |
284 |
> |
bool doPUreweighting=true; |
285 |
> |
bool SwitchOffNJetsCut=false; |
286 |
> |
|
287 |
> |
|
288 |
> |
TCanvas *can = new TCanvas("can","can"); |
289 |
> |
float mcSigma,mcSigmaError,dataSigma,dataSigmaError; |
290 |
> |
|
291 |
> |
const int nbins=11; |
292 |
> |
float NumVtxBin[nbins] = {0,7,9,11,13,15,17,19,21,24,50}; |
293 |
> |
|
294 |
> |
stringstream NowCut; |
295 |
> |
|
296 |
> |
|
297 |
> |
Double_t mc_peak_x[nbins]; |
298 |
> |
Double_t mc_peak_y[nbins]; |
299 |
> |
Double_t mc_peak_dxh[nbins]; |
300 |
> |
Double_t mc_peak_dxl[nbins]; |
301 |
> |
Double_t mc_peak_dy[nbins]; |
302 |
> |
|
303 |
> |
Double_t data_peak_x[nbins]; |
304 |
> |
Double_t data_peak_y[nbins]; |
305 |
> |
Double_t data_peak_dxh[nbins]; |
306 |
> |
Double_t data_peak_dxl[nbins]; |
307 |
> |
Double_t data_peak_dy[nbins]; |
308 |
> |
|
309 |
> |
Double_t mc_width_x[nbins]; |
310 |
> |
Double_t mc_width_y[nbins]; |
311 |
> |
Double_t mc_width_dxh[nbins]; |
312 |
> |
Double_t mc_width_dxl[nbins]; |
313 |
> |
Double_t mc_width_dy[nbins]; |
314 |
> |
|
315 |
> |
Double_t data_width_x[nbins]; |
316 |
> |
Double_t data_width_y[nbins]; |
317 |
> |
Double_t data_width_dxh[nbins]; |
318 |
> |
Double_t data_width_dxl[nbins]; |
319 |
> |
Double_t data_width_dy[nbins]; |
320 |
> |
|
321 |
> |
for(int i=0;i<nbins-1;i++) { |
322 |
> |
NowCut.str(""); |
323 |
> |
NowCut << "numVtx>" << NumVtxBin[i] << "&&numVtx<=" << NumVtxBin[i+1]; |
324 |
> |
cout << "NVtx cut is now : " << NowCut.str() << endl; |
325 |
> |
find_one_peak_combination(TCut(NowCut.str().c_str()),SwitchOffNJetsCut,MCPeak,MCPeakError, DataPeak,DataPeakError,mcSigma,mcSigmaError, dataSigma,dataSigmaError,result,doPUreweighting,""); |
326 |
> |
cout << " " << MCPeak << " +/- " << MCPeakError << endl; |
327 |
> |
cout << " " << DataPeak << " +/- " << DataPeakError << endl; |
328 |
> |
|
329 |
> |
TH1F *hDataSFNumVtx = allsamples.Draw("hDataSFNumVtx","numVtx",100,-0.5,49.5, "N_{vtx}", "events", cutmass&&cutOSSF&&cutnJets&&TCut(NowCut.str().c_str()),data, luminosity); |
330 |
> |
TH1F *hDataOFNumVtx = allsamples.Draw("hDataOFNumVtx","numVtx",100,-0.5,49.5, "N_{vtx}", "events", cutmass&&cutOSOF&&cutnJets&&TCut(NowCut.str().c_str()),data, luminosity); |
331 |
> |
TH1F *hMCSFNumVtx = allsamples.Draw("hMCSFNumVtx","numVtx",100,-0.5,49.5, "N_{vtx}", "events", cutmass&&cutOSSF&&cutnJets&&TCut(NowCut.str().c_str()),mc, luminosity); |
332 |
> |
TH1F *hMCOFNumVtx = allsamples.Draw("hMCOFNumVtx","numVtx",100,-0.5,49.5, "N_{vtx}", "events", cutmass&&cutOSOF&&cutnJets&&TCut(NowCut.str().c_str()),mc, luminosity); |
333 |
> |
|
334 |
> |
hDataSFNumVtx->Add(hDataOFNumVtx,-1); |
335 |
> |
hMCSFNumVtx->Add(hMCOFNumVtx,-1); |
336 |
> |
|
337 |
> |
mc_peak_x[i]=hMCSFNumVtx->GetMean(); |
338 |
> |
mc_peak_y[i]=MCPeak; |
339 |
> |
mc_peak_dy[i]=MCPeakError; |
340 |
> |
|
341 |
> |
data_peak_x[i]=hDataSFNumVtx->GetMean(); |
342 |
> |
data_peak_y[i]=DataPeak; |
343 |
> |
data_peak_dy[i]=DataPeakError; |
344 |
> |
|
345 |
> |
mc_width_x[i]=hMCSFNumVtx->GetMean(); |
346 |
> |
mc_width_y[i]=mcSigma; |
347 |
> |
mc_width_dy[i]=mcSigmaError; |
348 |
> |
|
349 |
> |
data_width_x[i]=hDataSFNumVtx->GetMean(); |
350 |
> |
data_width_y[i]=dataSigma; |
351 |
> |
data_width_dy[i]=dataSigmaError; |
352 |
> |
|
353 |
> |
delete hDataSFNumVtx; |
354 |
> |
delete hDataOFNumVtx; |
355 |
> |
delete hMCSFNumVtx; |
356 |
> |
delete hMCOFNumVtx; |
357 |
> |
} |
358 |
> |
|
359 |
> |
for(int i=0;i<nbins-1;i++) { |
360 |
> |
if(i==0) { |
361 |
> |
data_width_dxl[i]=data_width_x[i]; |
362 |
> |
data_peak_dxl[i]=data_peak_x[i]; |
363 |
> |
data_width_dxh[i]=0.5*(data_width_x[i+1]-data_width_x[i]); |
364 |
> |
data_peak_dxh[i]=0.5*(data_peak_x[i+1]-data_peak_x[i]); |
365 |
> |
|
366 |
> |
mc_width_dxl[i]=mc_width_x[i]; |
367 |
> |
mc_peak_dxl[i]=mc_peak_x[i]; |
368 |
> |
mc_width_dxh[i]=0.5*(mc_width_x[i+1]-mc_width_x[i]); |
369 |
> |
mc_peak_dxh[i]=0.5*(mc_peak_x[i+1]-mc_peak_x[i]); |
370 |
> |
} else if(i==nbins-2) { |
371 |
> |
data_width_dxl[i]=0.5*(data_width_x[i]-data_width_x[i-1]); |
372 |
> |
data_peak_dxl[i]=0.5*(data_peak_x[i]-data_peak_x[i-1]); |
373 |
> |
data_width_dxh[i]=50-data_width_x[i]; |
374 |
> |
data_peak_dxh[i]=50-data_peak_x[i]; |
375 |
> |
|
376 |
> |
mc_width_dxl[i]=0.5*(mc_width_x[i]-mc_width_x[i-1]); |
377 |
> |
mc_peak_dxl[i]=0.5*(mc_peak_x[i]-mc_peak_x[i-1]); |
378 |
> |
mc_width_dxh[i]=50-mc_width_x[i]; |
379 |
> |
mc_peak_dxh[i]=50-mc_peak_x[i]; |
380 |
> |
} else { |
381 |
> |
data_width_dxl[i]=0.5*(data_width_x[i]-data_width_x[i-1]); |
382 |
> |
data_peak_dxl[i]=0.5*(data_peak_x[i]-data_peak_x[i-1]); |
383 |
> |
data_width_dxh[i]=0.5*(data_width_x[i+1]-data_width_x[i]); |
384 |
> |
data_peak_dxh[i]=0.5*(data_peak_x[i+1]-data_peak_x[i]); |
385 |
> |
|
386 |
> |
mc_width_dxl[i]=0.5*(mc_width_x[i]-mc_width_x[i-1]); |
387 |
> |
mc_peak_dxl[i]=0.5*(mc_peak_x[i]-mc_peak_x[i-1]); |
388 |
> |
mc_width_dxh[i]=0.5*(mc_width_x[i+1]-mc_width_x[i]); |
389 |
> |
mc_peak_dxh[i]=0.5*(mc_peak_x[i+1]-mc_peak_x[i]); |
390 |
> |
} |
391 |
> |
} |
392 |
> |
|
393 |
> |
TGraphAsymmErrors *gMCPeak = new TGraphAsymmErrors(nbins-1,mc_peak_x,mc_peak_y,mc_peak_dxl,mc_peak_dxh,mc_peak_dy,mc_peak_dy); |
394 |
> |
gMCPeak->SetTitle("gMCPeak"); |
395 |
> |
gMCPeak->SetName("gMCPeak"); |
396 |
> |
|
397 |
> |
TGraphAsymmErrors *gDataPeak = new TGraphAsymmErrors(nbins-1,data_peak_x,data_peak_y,data_peak_dxl,data_peak_dxh,data_peak_dy,data_peak_dy); |
398 |
> |
gDataPeak->SetTitle("gDataPeak"); |
399 |
> |
gDataPeak->SetName("gDataPeak"); |
400 |
> |
|
401 |
> |
TGraphAsymmErrors *gMCWidth = new TGraphAsymmErrors(nbins-1,mc_width_x,mc_width_y,mc_width_dxl,mc_width_dxh,mc_width_dy,mc_width_dy); |
402 |
> |
gMCWidth->SetTitle("gMCWidth"); |
403 |
> |
gMCWidth->SetName("gMCWidth"); |
404 |
> |
|
405 |
> |
TGraphAsymmErrors *gDataWidth = new TGraphAsymmErrors(nbins-1,data_width_x,data_width_y,data_width_dxl,data_width_dxh,data_width_dy,data_width_dy); |
406 |
> |
gDataWidth->SetTitle("gDataWidth"); |
407 |
> |
gDataWidth->SetName("gDataWidth"); |
408 |
> |
|
409 |
> |
can->cd(); |
410 |
> |
gMCPeak->GetXaxis()->SetTitle("N(Vertices)"); |
411 |
> |
gMCPeak->GetYaxis()->SetTitle("Peak position"); |
412 |
> |
gMCPeak->GetXaxis()->CenterTitle(); |
413 |
> |
gMCPeak->GetYaxis()->CenterTitle(); |
414 |
> |
gDataPeak->GetXaxis()->SetTitle("N(Vertices)"); |
415 |
> |
gDataPeak->GetYaxis()->SetTitle("Peak position"); |
416 |
> |
gDataPeak->GetXaxis()->CenterTitle(); |
417 |
> |
gDataPeak->GetYaxis()->CenterTitle(); |
418 |
> |
|
419 |
> |
gDataWidth->GetXaxis()->SetTitle("N(Vertices)"); |
420 |
> |
gDataWidth->GetYaxis()->SetTitle("#sigma_{JZB}"); |
421 |
> |
gDataWidth->GetXaxis()->CenterTitle(); |
422 |
> |
gDataWidth->GetYaxis()->CenterTitle(); |
423 |
> |
gMCWidth->GetXaxis()->SetTitle("N(Vertices)"); |
424 |
> |
gMCWidth->GetYaxis()->SetTitle("#sigma_{JZB}"); |
425 |
> |
gMCWidth->GetXaxis()->CenterTitle(); |
426 |
> |
gMCWidth->GetYaxis()->CenterTitle(); |
427 |
> |
|
428 |
> |
gMCPeak->SetFillColor(TColor::GetColor("#2E9AFE")); |
429 |
> |
gDataPeak->SetFillColor(TColor::GetColor("#2E9AFE")); |
430 |
> |
gDataWidth->SetFillColor(TColor::GetColor("#2E9AFE")); |
431 |
> |
gMCWidth->SetFillColor(TColor::GetColor("#2E9AFE")); |
432 |
> |
|
433 |
> |
gMCPeak->Draw("A2"); |
434 |
> |
DrawMCPrelim(); |
435 |
> |
CompleteSave(can,"PUStudy/MCPeak"); |
436 |
> |
can->cd(); |
437 |
> |
gMCWidth->Draw("A2"); |
438 |
> |
DrawMCPrelim(); |
439 |
> |
CompleteSave(can,"PUStudy/MCWidth"); |
440 |
> |
|
441 |
> |
can->cd(); |
442 |
> |
gDataPeak->Draw("A2"); |
443 |
> |
|
444 |
> |
DrawPrelim(); |
445 |
> |
CompleteSave(can,"PUStudy/DataPeak"); |
446 |
> |
can->cd(); |
447 |
> |
gDataWidth->Draw("A2"); |
448 |
> |
DrawPrelim(); |
449 |
> |
CompleteSave(can,"PUStudy/DataWidth"); |
450 |
> |
|
451 |
> |
if(StoreResultsInSeparateFile) { |
452 |
> |
TFile *PeakFinding = new TFile("PeakFindingWithPeakCorrection.root","RECREATE"); |
453 |
> |
gMCPeak->Write(); |
454 |
> |
gDataPeak->Write(); |
455 |
> |
gMCWidth->Write(); |
456 |
> |
gDataWidth->Write(); |
457 |
> |
PeakFinding->Close(); |
458 |
> |
} |
459 |
> |
|
460 |
> |
gDataPeak->Fit("pol1"); |
461 |
> |
TF1 *DataFit = (TF1*)gDataPeak->GetFunction("pol1"); |
462 |
> |
gMCPeak->Fit("pol1"); |
463 |
> |
TF1 *MCFit = (TF1*)gMCPeak->GetFunction("pol1"); |
464 |
> |
|
465 |
> |
dout << "The suggested correction for Data is : " << DataFit->GetParameter(1) << endl; |
466 |
> |
dout << "The suggested correction for MC is : " << MCFit->GetParameter(1) << endl; |
467 |
> |
|
468 |
> |
TLegend *leg = make_legend(); |
469 |
> |
can->cd(); |
470 |
> |
int j=0; |
471 |
> |
for(int i=PeakLibrary::DataHistogram.size()-5;i<PeakLibrary::DataHistogram.size();i++) { |
472 |
> |
PeakLibrary::DataHistogram[i]->Rebin(5); |
473 |
> |
PeakLibrary::DataHistogram[i]->SetLineColor(j+1); |
474 |
> |
if(i==PeakLibrary::DataHistogram.size()-5) PeakLibrary::DataHistogram[i]->DrawNormalized("histo"); |
475 |
> |
else PeakLibrary::DataHistogram[i]->DrawNormalized("histo,same"); |
476 |
> |
stringstream name; |
477 |
> |
name << NumVtxBin[j] << " < N_{vtx} < " << NumVtxBin[j+1]; |
478 |
> |
leg->AddEntry(PeakLibrary::DataHistogram[i],name.str().c_str(),"l"); |
479 |
> |
j++; |
480 |
> |
} |
481 |
> |
|
482 |
> |
leg->Draw(); |
483 |
> |
DrawPrelim(); |
484 |
> |
CompleteSave(can,"PUStudy/DataOverview"); |
485 |
> |
|
486 |
> |
TLegend *leg2 = make_legend(); |
487 |
> |
can->cd(); |
488 |
> |
j=0; |
489 |
> |
for(int i=PeakLibrary::MCHistogram.size()-5;i<PeakLibrary::MCHistogram.size();i++) { |
490 |
> |
PeakLibrary::MCHistogram[i]->Rebin(5); |
491 |
> |
PeakLibrary::MCHistogram[i]->SetLineColor(j+1); |
492 |
> |
if(i==PeakLibrary::MCHistogram.size()-5) PeakLibrary::MCHistogram[i]->DrawNormalized("histo"); |
493 |
> |
else PeakLibrary::MCHistogram[i]->DrawNormalized("histo,same"); |
494 |
> |
stringstream name; |
495 |
> |
name << NumVtxBin[j] << " < N_{vtx} < " << NumVtxBin[j+1]; |
496 |
> |
leg->AddEntry(PeakLibrary::MCHistogram[i],name.str().c_str(),"l"); |
497 |
> |
j++; |
498 |
> |
} |
499 |
> |
|
500 |
> |
leg->Draw(); |
501 |
> |
DrawPrelim(); |
502 |
> |
CompleteSave(can,"PUStudy/MCOverview"); |
503 |
> |
|
504 |
> |
delete can; |
505 |
> |
PeakLibrary::StoreHistos=false; |
506 |
> |
} |
507 |
> |
|
508 |
> |
|
509 |
> |
|
510 |
> |
void find_peaks(float &MCPeak,float &MCPeakError, float &DataPeak, float &DataPeakError, stringstream &result, bool doPUreweighting, stringstream &datajzb, stringstream &mcjzb, string sSpecialCut="", bool SwitchOffNJetsCut=false) |
511 |
|
{ |
512 |
+ |
bool overunderflowstatus=addoverunderflowbins; |
513 |
+ |
switch_overunderflow(false); |
514 |
+ |
|
515 |
+ |
TCut SpecialCut("mll>=0"); |
516 |
+ |
if(sSpecialCut!="") SpecialCut=TCut(sSpecialCut.c_str()); |
517 |
|
|
518 |
|
bool DoInvidualeemmPeaks=false; |
519 |
|
|
529 |
|
float mcSigma,mcSigmaError, dataSigma, dataSigmaError; |
530 |
|
|
531 |
|
dout << "Finding global peak : " << endl; |
532 |
< |
find_one_peak_combination(TCut(""),mcpeak,mcpeakerr, datapeak,datapeakerr,mcSigma,mcSigmaError, dataSigma,dataSigmaError,result,doPUreweighting,""); |
532 |
> |
find_one_peak_combination(SpecialCut,SwitchOffNJetsCut,mcpeak,mcpeakerr, datapeak,datapeakerr,mcSigma,mcSigmaError, dataSigma,dataSigmaError,result,doPUreweighting,""); |
533 |
|
|
534 |
|
if(DoInvidualeemmPeaks) { |
535 |
|
dout << "Finding peak for electrons : " << endl; |
536 |
< |
find_one_peak_combination(TCut("id1==0"),mceepeak,mceepeakerr,dataeepeak,dataeepeakerr,mcSigma,mcSigmaError,dataSigma,dataSigmaError,result,doPUreweighting,"_ele"); |
536 |
> |
find_one_peak_combination(SpecialCut&&TCut("id1==0"),SwitchOffNJetsCut,mceepeak,mceepeakerr,dataeepeak,dataeepeakerr,mcSigma,mcSigmaError,dataSigma,dataSigmaError,result,doPUreweighting,"_ele"); |
537 |
|
dout << "Finding peak for muons : " << endl; |
538 |
< |
find_one_peak_combination(TCut("id1==1"),mcmmpeak,mcmmpeakerr,datammpeak,datammpeakerr,mcSigma,mcSigmaError,dataSigma,dataSigmaError,result,doPUreweighting,"_mu"); |
538 |
> |
find_one_peak_combination(SpecialCut&&TCut("id1==1"),SwitchOffNJetsCut,mcmmpeak,mcmmpeakerr,datammpeak,datammpeakerr,mcSigma,mcSigmaError,dataSigma,dataSigmaError,result,doPUreweighting,"_mu"); |
539 |
|
|
540 |
|
datajzb << "(" << jzbvariabledata; |
541 |
|
mcjzb << "(" << jzbvariablemc; |
561 |
|
else mcjzb << "+ (id1!=id2)*" << TMath::Abs(mcpeak) << " "; |
562 |
|
|
563 |
|
mcjzb << ")"; |
564 |
+ |
|
565 |
|
} else { |
566 |
|
datajzb << "(" << jzbvariabledata; |
567 |
< |
mcjzb << "(" << jzbvariablemc; |
567 |
> |
mcjzb << "(" << jzbvariablemc; |
568 |
|
|
569 |
|
if(datapeak>0) datajzb << "- " << TMath::Abs(datapeak) << " "; |
570 |
|
else datajzb << "+ " << TMath::Abs(datapeak) << " "; |
577 |
|
mcjzb << ")"; |
578 |
|
} |
579 |
|
|
580 |
< |
|
580 |
> |
MCPeak=mcpeak; |
581 |
> |
MCPeakError=mcpeakerr; |
582 |
> |
DataPeak=datapeak; |
583 |
> |
DataPeakError=datapeakerr; |
584 |
> |
switch_overunderflow(overunderflowstatus); |
585 |
|
} |
586 |
|
|
587 |
|
void make_special_obs_pred_mll_plot(string datajzb, string mcjzb, float jzbthreshold, float binWidth = 5.0) { |
609 |
|
TCut largerzeroM(largerzeroMS.str().c_str()); |
610 |
|
|
611 |
|
TH1F *RcorrJZBeemm = allsamples.Draw("RcorrJZBeemm", "mll",nbins,min,max, "m_{ll} [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&largerzeroD,data,luminosity); |
612 |
< |
THStack mcRcorrJZBeemm = allsamples.DrawStack("mcRcorrJZBeemm","mll",nbins,min,max, "m_{ll} [GeV}", "events", cutmass&&cutOSSF&&cutnJets&&largerzeroM,mc,luminosity); |
612 |
> |
THStack mcRcorrJZBeemm = allsamples.DrawStack("mcRcorrJZBeemm","mll",nbins,min,max, "m_{ll} [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&largerzeroM,mc,luminosity); |
613 |
|
TH1F *LcorrJZBeemm = allsamples.Draw("LcorrJZBeemm", "mll",nbins,min,max, "m_{ll} [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&smallerzeroD,data,luminosity); |
614 |
|
TH1F *RcorrJZBem = allsamples.Draw("RcorrJZBem", "mll",nbins,min,max, "m_{ll} [GeV]", "events", cutmass&&cutOSOF&&cutnJets&&largerzeroD,data,luminosity); |
615 |
|
TH1F *LcorrJZBem = allsamples.Draw("LcorrJZBem", "mll",nbins,min,max, "m_{ll} [GeV]", "events", cutmass&&cutOSOF&&cutnJets&&smallerzeroD,data,luminosity); |
621 |
|
|
622 |
|
// TH1F *RcorrJZBeemmNoS; |
623 |
|
|
624 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
624 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
625 |
|
RcorrJZBSBem = allsamples.Draw("RcorrJZBSBem", "mll",nbins,min,max, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets&&largerzeroD,data, luminosity); |
626 |
|
LcorrJZBSBem = allsamples.Draw("LcorrJZBSBem", "mll",nbins,min,max, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets&&smallerzeroD,data, luminosity); |
627 |
|
RcorrJZBSBeemm = allsamples.Draw("RcorrJZBSBeemm","mll",nbins,min,max, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets&&largerzeroD,data, luminosity); |
632 |
|
TH1F* SFN = (TH1F*)LcorrJZBeemm->Clone("SFN"); |
633 |
|
TH1F* OFP = (TH1F*)RcorrJZBem->Clone("OFP"); |
634 |
|
TH1F* OFN = (TH1F*)LcorrJZBem->Clone("OFN"); |
635 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
635 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
636 |
|
OFP->Scale(1.0/3.0); |
637 |
|
OFP->Add(RcorrJZBSBem,1.0/3.); |
638 |
|
OFP->Add(RcorrJZBSBeemm,1.0/3.); |
648 |
|
|
649 |
|
RcorrJZBeemm->SetTitleOffset(1.3,"y"); |
650 |
|
RcorrJZBeemm->Draw(); |
651 |
< |
mcRcorrJZBeemm.Draw("same"); |
651 |
> |
mcRcorrJZBeemm.Draw("histo,same"); |
652 |
|
Bpred->Draw("histo,same"); |
653 |
|
RcorrJZBeemm->Draw("same"); |
654 |
|
|
655 |
|
TLegend *leg = allsamples.allbglegend(); |
656 |
|
leg->SetX1(0.58); |
657 |
< |
leg->AddEntry(RcorrJZBeemm,"observed (data)","l"); |
657 |
> |
// leg->AddEntry(RcorrJZBeemm,"observed (data)","l"); |
658 |
|
leg->AddEntry(Bpred,"predicted (data)","l"); |
659 |
|
leg->Draw("same"); |
660 |
|
|
682 |
|
RcorrJZBeemm->Draw("same"); |
683 |
|
|
684 |
|
TLegend *leg2 = make_legend("",0.52,0.7); |
685 |
< |
leg2->AddEntry(RcorrJZBeemm,"observed (data)","lp"); |
685 |
> |
// leg2->AddEntry(RcorrJZBeemm,"observed (data)","lp"); |
686 |
|
leg2->AddEntry(Bpred,"predicted (data)","l"); |
687 |
|
leg2->AddEntry(SFN, " SF JZB<0","l"); |
688 |
|
leg2->AddEntry(OFN, " OF JZB<0","l"); |
697 |
|
delete LcorrJZBeemm; |
698 |
|
delete RcorrJZBem; |
699 |
|
delete LcorrJZBem; |
700 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
700 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
701 |
|
delete RcorrJZBSBeemm; |
702 |
|
delete LcorrJZBSBeemm; |
703 |
|
delete RcorrJZBSBem; |
705 |
|
} |
706 |
|
delete Bpred; |
707 |
|
delete ckin; |
708 |
+ |
CleanLegends(); |
709 |
|
} |
710 |
|
|
711 |
|
void make_special_mll_plot(int nbins, float min, float max, bool logscale,string xlabel) { |
726 |
|
datahistoOSSF->SetMarkerSize(DataMarkerSize); |
727 |
|
datahistoOSSF->Draw(); |
728 |
|
|
729 |
< |
mcstackOSSF.Draw("same"); |
729 |
> |
mcstackOSSF.Draw("histo,same"); |
730 |
|
datahistoOSSF->Draw("same"); |
731 |
|
|
732 |
|
datahistoOSOF->SetMarkerColor(TColor::GetColor("#FE642E")); |
752 |
|
delete datahistoOSOF; |
753 |
|
delete datahistoOSSF; |
754 |
|
delete ckin; |
755 |
+ |
CleanLegends(); |
756 |
|
} |
757 |
|
|
758 |
|
|
793 |
|
oneline->Draw("same"); |
794 |
|
} |
795 |
|
|
796 |
< |
void make_OFSF_plot(string variable, string addcut, string legendTitle, int nbins, float min, float max, bool logscale, |
797 |
< |
string xlabel, string filename, bool isPF=true, bool plotratio=true, bool loadlastminmax=false, float legendPosition=0.3) { |
796 |
> |
float make_one_OFSF_plot(string variable, string addcut, string legendTitle, int nbins, float min, float max, float ymax, bool logscale, |
797 |
> |
string xlabel, string filename, float legendPosition=0.55) { |
798 |
|
|
799 |
|
TCut ibasiccut=basiccut; |
800 |
|
bool draw_separation_lines=false; |
801 |
|
|
367 |
– |
if(isPF) ibasiccut=basiccut&&"pfjzb[0]>-998"; |
368 |
– |
|
802 |
|
if(addcut != "") ibasiccut = ibasiccut && addcut.c_str(); |
803 |
|
|
804 |
|
TCut cutSF; |
805 |
|
TCut cutOF; |
806 |
|
|
807 |
< |
cutOF=cutOSOF&&cutnJets&&ibasiccut; |
808 |
< |
cutSF=cutOSSF&&cutnJets&&ibasiccut; |
807 |
> |
cout << "Going to use cutOSSF " << (const char*) cutOSSF << " and cutnJets " << (const char*) cutnJets << " and ibasiccut " << (const char*) ibasiccut << endl; |
808 |
> |
cutOF = cutOSOF&&cutnJets&&ibasiccut; |
809 |
> |
cutSF = cutOSSF&&cutnJets&&ibasiccut; |
810 |
> |
|
811 |
> |
TCanvas *ofsf_can = new TCanvas("ofsf_can","ofsf_can"); |
812 |
|
|
813 |
+ |
TPad* rcan = new TPad("rcan","rcan",0,0,1,1); |
814 |
+ |
rcan->SetLogy(logscale); |
815 |
+ |
rcan->cd(); |
816 |
|
|
817 |
< |
TCanvas *ckin = new TCanvas("ckin","Kinematic Plots (in the making)",600,600); |
379 |
< |
ckin->SetLogy(logscale); |
817 |
> |
std::cout << "OF/SF comparison: variable = " << variable << ", cut = " << cutSF.GetTitle() << std::endl; |
818 |
|
TH1F *datahistoSF = allsamples.Draw("datahistoSF",variable,nbins,min,max, xlabel, "events",cutSF,data,luminosity); |
819 |
|
TH1F *datahistoOF = allsamples.Draw("datahistoOF",variable,nbins,min,max, xlabel, "events",cutOF,data,luminosity); |
820 |
< |
string signal("LM3"); |
821 |
< |
TH1F* signalhisto = new TH1F("signalhisto",signal.c_str(),nbins,min,max); |
822 |
< |
int idx = signalsamples.FindSample(signal)[0]; |
823 |
< |
(signalsamples.collection)[idx].events->Project("signalhisto",variable.c_str(),cutSF); |
824 |
< |
signalhisto->Scale((signalsamples.collection)[idx].weight*luminosity); |
825 |
< |
signalhisto->SetLineColor((signalsamples.collection)[idx].samplecolor); |
820 |
> |
// string signal("LM3"); |
821 |
> |
// TH1F* signalhisto = new TH1F("signalhisto",signal.c_str(),nbins,min,max); |
822 |
> |
// int idx = signalsamples.FindSample(signal)[0]; |
823 |
> |
// (signalsamples.collection)[idx].events->Project("signalhisto",variable.c_str(),cutSF); |
824 |
> |
// signalhisto->Scale((signalsamples.collection)[idx].weight*luminosity); |
825 |
> |
// signalhisto->SetLineColor((signalsamples.collection)[idx].samplecolor); |
826 |
> |
// signalhisto->SetLineStyle(2); |
827 |
|
datahistoSF->SetMarkerSize(DataMarkerSize); |
828 |
|
datahistoOF->SetLineColor(kRed); |
829 |
|
|
830 |
|
if ( !logscale ) { |
831 |
|
datahistoSF->SetMinimum(0); // Defaults |
393 |
– |
datahistoOF->SetMinimum(0); // Defaults |
832 |
|
} else { |
833 |
|
datahistoSF->SetMinimum(0.5); |
396 |
– |
datahistoOF->SetMinimum(0.5); |
834 |
|
} |
835 |
< |
if (logscale) { |
836 |
< |
datahistoSF->SetMaximum(5.3*datahistoSF->GetMaximum()); |
837 |
< |
datahistoOF->SetMaximum(5.3*datahistoSF->GetMaximum()); |
835 |
> |
if (ymax<0) { |
836 |
> |
if ( logscale ) datahistoSF->SetMaximum(5.3*datahistoSF->GetMaximum()); |
837 |
> |
else datahistoSF->SetMaximum(0.8*datahistoSF->GetMaximum()); |
838 |
|
} else { |
839 |
< |
datahistoSF->SetMaximum(2.0*datahistoSF->GetMaximum()); |
403 |
< |
datahistoOF->SetMaximum(2.0*datahistoOF->GetMaximum()); |
839 |
> |
datahistoSF->SetMaximum(ymax); |
840 |
|
} |
841 |
|
|
842 |
+ |
float ymaxSet = datahistoSF->GetMaximum(); |
843 |
+ |
|
844 |
|
datahistoSF->GetXaxis()->SetTitle(xlabel.c_str()); |
845 |
< |
datahistoOF->GetXaxis()->SetTitle(xlabel.c_str()); |
408 |
< |
signalhisto->GetXaxis()->SetTitle(xlabel.c_str()); |
409 |
< |
datahistoSF->GetYaxis()->SetTitle("N. Events"); |
410 |
< |
datahistoOF->GetYaxis()->SetTitle("N. Events"); |
411 |
< |
signalhisto->GetYaxis()->SetTitle("N. Events"); |
845 |
> |
datahistoSF->GetYaxis()->SetTitle("Events"); |
846 |
|
datahistoSF->GetXaxis()->CenterTitle(); |
413 |
– |
datahistoOF->GetXaxis()->CenterTitle(); |
414 |
– |
signalhisto->GetXaxis()->CenterTitle(); |
847 |
|
datahistoSF->GetYaxis()->CenterTitle(); |
416 |
– |
datahistoOF->GetYaxis()->CenterTitle(); |
417 |
– |
signalhisto->GetYaxis()->CenterTitle(); |
848 |
|
|
849 |
< |
TLegend *mleg = new TLegend(0.2+legendPosition, 0.72, 0.55+legendPosition, 0.87, legendTitle.c_str()); |
850 |
< |
mleg->SetFillColor(kWhite); |
851 |
< |
mleg->SetTextFont(42); |
852 |
< |
mleg->SetTextSize(0.048); |
853 |
< |
mleg->SetLineWidth(0); |
854 |
< |
mleg->SetBorderSize(0); |
855 |
< |
mleg->AddEntry(datahistoSF, "S. Flavor", "PL"); |
856 |
< |
mleg->AddEntry(datahistoOF, "O. Flavor", "L"); |
427 |
< |
mleg->AddEntry(signalhisto, "LM3", "L"); |
849 |
> |
TLegend *mleg = make_legend(legendTitle.c_str(),legendPosition,0.7,false,legendPosition+0.2); |
850 |
> |
mleg->AddEntry(datahistoSF, "Same-flavor", "PL"); |
851 |
> |
if (datahistoOF->Integral()>0) { |
852 |
> |
mleg->AddEntry(datahistoOF, "Opposite-flavor", "L"); |
853 |
> |
} else { |
854 |
> |
mleg->AddEntry((TObject*)0, "", ""); |
855 |
> |
} |
856 |
> |
//mleg->AddEntry(signalhisto, "LM3", "L"); |
857 |
|
|
858 |
|
datahistoSF->Draw("E1"); |
859 |
< |
datahistoOF->Draw("HIST,SAMES"); |
860 |
< |
signalhisto->Draw("HIST,SAMES"); |
859 |
> |
if (datahistoOF->Integral()>0) datahistoOF->Draw("HIST,SAMES"); |
860 |
> |
//signalhisto->Draw("HIST,SAMES"); |
861 |
|
mleg->Draw(); |
862 |
|
DrawPrelim(); |
863 |
< |
CompleteSave(ckin, "./SFOF/" + filename); |
863 |
> |
if (datahistoOF->Integral()>0) { |
864 |
> |
Save_With_Ratio( datahistoSF, datahistoOF, rcan, "SFOF/" + filename, false, false, "SF/OF" ); |
865 |
> |
} else { |
866 |
> |
CompleteSave(rcan, "SFOF/" + filename); |
867 |
> |
} |
868 |
|
|
869 |
|
datahistoSF->Delete(); |
870 |
|
datahistoOF->Delete(); |
871 |
< |
signalhisto->Delete(); |
871 |
> |
//signalhisto->Delete(); |
872 |
> |
delete mleg; |
873 |
> |
delete rcan; |
874 |
> |
delete ofsf_can; |
875 |
> |
|
876 |
> |
return ymaxSet; |
877 |
> |
|
878 |
> |
} |
879 |
> |
|
880 |
> |
// Compare data to data |
881 |
> |
float make_data_comparison_plot(string variable, TCut cut, int nbins, float min, float max, float ymax, bool logscale, |
882 |
> |
string xlabel, string filename, float legendPosition=0.55) { |
883 |
> |
|
884 |
> |
TCut ibasiccut=basiccut&&cut; |
885 |
> |
|
886 |
> |
TCanvas *ckin = new TCanvas("ckin","Kinematic Plots (in the making)",600,600); |
887 |
> |
TPad* rcan = new TPad("rcan","rcan",0,0,1,1); |
888 |
> |
rcan->SetLogy(logscale); |
889 |
> |
rcan->cd(); |
890 |
> |
|
891 |
> |
std::cout << "Data comparison: variable = " << variable << ", cut = " << ibasiccut.GetTitle() << std::endl; |
892 |
> |
|
893 |
> |
TH1F *data1 = allsamples.Draw("data1",variable,nbins,min,max, xlabel, "events",ibasiccut,data,luminosity); |
894 |
> |
TH1F *data2 = comparesamples.Draw("data2",variable,nbins,min,max, xlabel, "events",ibasiccut,data,luminosity); |
895 |
> |
data1->Scale(5.0/9.2); |
896 |
> |
|
897 |
> |
data1->SetMarkerSize(DataMarkerSize); |
898 |
> |
data2->SetLineColor(kRed); |
899 |
> |
|
900 |
> |
if ( !logscale ) { |
901 |
> |
data1->SetMinimum(0); // Defaults |
902 |
> |
} else { |
903 |
> |
data1->SetMinimum(0.5); |
904 |
> |
} |
905 |
> |
if (ymax<0) { |
906 |
> |
if ( logscale ) data1->SetMaximum(5.3*data1->GetMaximum()); |
907 |
> |
else data1->SetMaximum(1.5*data1->GetMaximum()); |
908 |
> |
} else { |
909 |
> |
data1->SetMaximum(ymax); |
910 |
> |
} |
911 |
> |
|
912 |
> |
float ymaxSet = data1->GetMaximum(); |
913 |
> |
|
914 |
> |
data1->GetXaxis()->SetTitle(xlabel.c_str()); |
915 |
> |
data1->GetYaxis()->SetTitle("Events"); |
916 |
> |
data1->GetXaxis()->CenterTitle(); |
917 |
> |
data1->GetYaxis()->CenterTitle(); |
918 |
> |
|
919 |
> |
TLegend *mleg = make_legend("",legendPosition,0.7,false,legendPosition+0.2); |
920 |
> |
mleg->AddEntry(data1, "2012 data (scaled)", "PL"); |
921 |
> |
mleg->AddEntry(data2, "2011 data", "L"); |
922 |
> |
|
923 |
> |
data1->Draw("E1"); |
924 |
> |
data2->Draw("HIST,SAMES"); |
925 |
> |
mleg->Draw(); |
926 |
> |
DrawPrelim(); |
927 |
> |
Save_With_Ratio( data1, data2, rcan, "compareData/" + filename, false, false, "new/old" ); |
928 |
> |
|
929 |
> |
data1->Delete(); |
930 |
> |
data2->Delete(); |
931 |
|
delete mleg; |
932 |
+ |
delete rcan; |
933 |
|
delete ckin; |
934 |
|
|
935 |
|
} |
936 |
|
|
937 |
+ |
void make_OFSF_plots(string variable, string addcut, int nbins, float min, float max, bool logscale, |
938 |
+ |
string xlabel, string filename, float legendPosition=0.55) { |
939 |
|
|
940 |
+ |
string mllcuts[] = { "mll>20","mll>15&&mll<70", "mll>75&&mll<105", "mll>120" }; |
941 |
+ |
string mllcutname[] = { "m_{ll} > 20 GeV", "20 < m_{ll} < 70 GeV", "70 < m_{ll} < 110 GeV", "m_{ll} > 120 GeV" }; |
942 |
+ |
string plotname[] = {"_all","_low","_peak","_high"}; |
943 |
+ |
float ymax; |
944 |
+ |
|
945 |
+ |
int start = 0; |
946 |
+ |
if ( !PlottingSetup::openBox ) start = 3; |
947 |
+ |
|
948 |
+ |
for ( int i=start; i<4; ++i ) { |
949 |
+ |
if ( addcut != "" ) mllcuts[i] += "&&"+addcut; |
950 |
+ |
if ( i==start ) { |
951 |
+ |
ymax = make_one_OFSF_plot(variable, mllcuts[i], mllcutname[i], nbins, min, max, -1, logscale, xlabel, |
952 |
+ |
filename+plotname[i], legendPosition ); |
953 |
+ |
} else { |
954 |
+ |
make_one_OFSF_plot(variable, mllcuts[i], mllcutname[i], nbins, min, max, ymax, logscale, xlabel, |
955 |
+ |
filename+plotname[i], legendPosition ); |
956 |
+ |
} |
957 |
+ |
make_one_OFSF_plot(variable, "id1==1&&id1==id2&&"+mllcuts[i], mllcutname[i], nbins, min, max, ymax, logscale, xlabel, |
958 |
+ |
filename+plotname[i]+"_mm", legendPosition ); |
959 |
+ |
make_one_OFSF_plot(variable, "id1==0&&id1==id2&&"+mllcuts[i], mllcutname[i], nbins, min, max, ymax, logscale, xlabel, |
960 |
+ |
filename+plotname[i]+"_ee", legendPosition ); |
961 |
+ |
} |
962 |
+ |
|
963 |
+ |
} |
964 |
+ |
|
965 |
+ |
TCut ReplaceInCut(TCut cut, string replacethis, string withthis) { |
966 |
+ |
string scut=(string)(const char*)cut; |
967 |
+ |
string acut=ReplaceAll(scut,replacethis,withthis); |
968 |
+ |
return TCut(acut.c_str()); |
969 |
+ |
} |
970 |
+ |
|
971 |
+ |
void DoMCSystPlot(string datavariable, string mcvariable, int nbins, float min, float max, TCut addcut, bool dolog, string xlabel, string filename) { |
972 |
+ |
TCut cut=addcut&&basiccut; |
973 |
|
|
974 |
+ |
TCanvas *ckin = new TCanvas("ckin","Kinematic Plots (in the making)",600,600); |
975 |
+ |
ckin->SetLogy(dolog); |
976 |
+ |
cout << "\r Creating " << filename << " : data (1/6)" << std::flush; |
977 |
+ |
TH1F *datahisto = allsamples.Draw("datahisto",datavariable,nbins,min,max, xlabel, "events",cut,data,luminosity); |
978 |
+ |
datahisto->SetMarkerSize(DataMarkerSize); |
979 |
+ |
if ( !dolog ) datahisto->SetMinimum(0); // Defaults |
980 |
+ |
else datahisto->SetMinimum(0.5); |
981 |
+ |
if (dolog) datahisto->SetMaximum(5.3*datahisto->GetMaximum()); |
982 |
+ |
else datahisto->SetMaximum(1.3*datahisto->GetMaximum()); |
983 |
+ |
cout << "\r Creating " << filename << " : MC central (2/6)" << std::flush; |
984 |
+ |
THStack mcstack = allsamples.DrawStack("mcstack", mcvariable,nbins,min,max,xlabel,"events",cut,mc,luminosity); |
985 |
+ |
TH1F *MCcentral = CollapseStack(mcstack); |
986 |
+ |
|
987 |
+ |
TCut bkpcut = cut; |
988 |
+ |
cut = ReplaceInCut(cut,"pfJetGoodNum40","pfJetGoodNum40p1sigma"); |
989 |
+ |
cout << "\r Creating " << filename << " : MC JES up (3/6)" << std::flush; |
990 |
+ |
TH1F *MCJESup = allsamples.Draw("MCJESup", mcvariable,nbins,min,max,xlabel,"events",cut,mc,luminosity); |
991 |
+ |
|
992 |
+ |
cut = ReplaceInCut(cut,"pfJetGoodNum40p1sigma","pfJetGoodNum40n1sigma"); |
993 |
+ |
cout << "\r Creating " << filename << " : MC JES down (4/6)" << std::flush; |
994 |
+ |
TH1F *MCJESdn = allsamples.Draw("MCJESdn", mcvariable,nbins,min,max,xlabel,"events",cut,mc,luminosity); |
995 |
+ |
|
996 |
+ |
cut=bkpcut; |
997 |
+ |
TCut bkpweight = cutWeight; |
998 |
+ |
cutWeight= ReplaceInCut(cutWeight,"weight","PUweightUP"); |
999 |
+ |
cout << "\r Creating " << filename << " : MC PU up (5/6)" << std::flush; |
1000 |
+ |
TH1F *MCPUup = allsamples.Draw("MCPUup", mcvariable,nbins,min,max,xlabel,"events",cut,mc,luminosity); |
1001 |
+ |
|
1002 |
+ |
cutWeight= ReplaceInCut(cutWeight,"PUweightUP","PUweightDOWN"); |
1003 |
+ |
cout << "\r Creating " << filename << " : MC PU down (6/6)" << std::flush; |
1004 |
+ |
TH1F *MCPUdn = allsamples.Draw("MCPUdn", mcvariable,nbins,min,max,xlabel,"events",cut,mc,luminosity); |
1005 |
+ |
cutWeight=bkpweight; |
1006 |
+ |
cout << "\r Creating " << filename << " : Processing systematics ..." << std::flush; |
1007 |
+ |
TH1F *Systematic = (TH1F*)MCPUdn->Clone("Systematic"); |
1008 |
+ |
for(int i=1;i<=Systematic->GetNbinsX();i++) { |
1009 |
+ |
float jesdn = abs(MCcentral->GetBinContent(i)-MCJESdn->GetBinContent(i)); |
1010 |
+ |
float jesup = abs(MCcentral->GetBinContent(i)-MCJESup->GetBinContent(i)); |
1011 |
+ |
float jes = jesdn>jesup?jesdn:jesup; |
1012 |
+ |
|
1013 |
+ |
float PUup = abs(MCcentral->GetBinContent(i)-MCPUup->GetBinContent(i)); |
1014 |
+ |
float PUdn = abs(MCcentral->GetBinContent(i)-MCPUdn->GetBinContent(i)); |
1015 |
+ |
float pu = PUdn>PUup?PUdn:PUup; |
1016 |
+ |
|
1017 |
+ |
float sys=sqrt(jes*jes+pu*pu); |
1018 |
+ |
sys/=MCcentral->GetBinContent(i); |
1019 |
+ |
if(MCcentral->GetBinContent(i)==0) sys=0; |
1020 |
+ |
Systematic->SetBinContent(i,sys); |
1021 |
+ |
} |
1022 |
+ |
|
1023 |
+ |
datahisto->Draw("e1"); |
1024 |
+ |
ckin->Update(); |
1025 |
+ |
mcstack.Draw("histo,same"); |
1026 |
+ |
|
1027 |
+ |
datahisto->Draw("same,e1"); |
1028 |
+ |
TLegend *kinleg = allsamples.allbglegend(); |
1029 |
+ |
kinleg->Draw(); |
1030 |
+ |
|
1031 |
+ |
TPad *kinpad = new TPad("kinpad","kinpad",0,0,1,1); |
1032 |
+ |
kinpad->SetLogy(dolog); |
1033 |
+ |
kinpad->cd(); |
1034 |
+ |
datahisto->Draw("e1"); |
1035 |
+ |
mcstack.Draw("histo,same"); |
1036 |
+ |
datahisto->Draw("same,e1"); |
1037 |
+ |
datahisto->Draw("same,axis"); |
1038 |
+ |
|
1039 |
+ |
kinleg->Draw("same"); |
1040 |
+ |
DrawPrelim(); |
1041 |
+ |
string saveas="kin/"+filename; |
1042 |
+ |
|
1043 |
+ |
cout << "Passing filename to be saved : " << filename << " as " << saveas << endl; |
1044 |
+ |
save_with_ratio_and_sys_band(0.0, datahisto, CollapseStack(mcstack), kinpad->cd(), saveas, false, false, "data/mc",Systematic ); |
1045 |
+ |
|
1046 |
+ |
ckin->cd(); |
1047 |
+ |
MCcentral->SetFillColor(kWhite); |
1048 |
+ |
MCcentral->SetLineColor(kBlack); |
1049 |
+ |
MCcentral->SetLineWidth(2); |
1050 |
+ |
MCPUdn->SetLineColor(kRed); |
1051 |
+ |
MCPUup->SetLineColor(kYellow); |
1052 |
+ |
MCJESdn->SetLineColor(kBlue); |
1053 |
+ |
MCJESup->SetLineColor(kGreen); |
1054 |
+ |
|
1055 |
+ |
TLegend *legsmall = new TLegend(0.0,0.85,1.0,1.00); |
1056 |
+ |
legsmall->SetNColumns(5); |
1057 |
+ |
legsmall->AddEntry(MCcentral,"central","L"); |
1058 |
+ |
legsmall->AddEntry(MCPUdn,"PU down","L"); |
1059 |
+ |
legsmall->AddEntry(MCPUup,"PU up","L"); |
1060 |
+ |
legsmall->AddEntry(MCJESdn,"JES down","L"); |
1061 |
+ |
legsmall->AddEntry(MCJESup,"JES up","L"); |
1062 |
+ |
legsmall->SetFillColor(kWhite); |
1063 |
+ |
legsmall->SetBorderSize(0); |
1064 |
+ |
|
1065 |
+ |
datahisto->Draw("e1"); |
1066 |
+ |
MCcentral->Draw("histo,same"); |
1067 |
+ |
MCPUdn->Draw("histo,same"); |
1068 |
+ |
MCPUup->Draw("histo,same"); |
1069 |
+ |
MCJESdn->Draw("histo,same"); |
1070 |
+ |
MCJESup->Draw("histo,same"); |
1071 |
+ |
datahisto->Draw("e1,same"); |
1072 |
+ |
legsmall->Draw(); |
1073 |
+ |
CompleteSave(ckin,saveas+"___AllLines"); |
1074 |
+ |
|
1075 |
+ |
delete datahisto; |
1076 |
+ |
delete MCcentral; |
1077 |
+ |
delete MCPUdn; |
1078 |
+ |
delete MCPUup; |
1079 |
+ |
delete MCJESdn; |
1080 |
+ |
delete MCJESup; |
1081 |
+ |
delete ckin; |
1082 |
+ |
} |
1083 |
+ |
|
1084 |
+ |
void DoMCSystPlot(string variable, int nbins, float min, float max, TCut addcut, bool dolog, string xlabel, string filename) { |
1085 |
+ |
DoMCSystPlot(variable, variable, nbins, min, max, addcut, dolog, xlabel, filename); |
1086 |
+ |
} |
1087 |
+ |
|
1088 |
|
float lastrange_min=0; |
1089 |
|
float lastrange_max=0; |
1090 |
|
|
1093 |
|
// TCut basiccut("(pfJetGoodNum>=2&&pfJetGoodID[0])&&(pfJetGoodNum>=2&&pfJetGoodID[1])&&(passed_triggers||!is_data)"); |
1094 |
|
TCut ibasiccut=basiccut; |
1095 |
|
bool draw_separation_lines=false; |
1096 |
+ |
bool drawsignal = false; |
1097 |
|
|
1098 |
|
if(isPF) ibasiccut=basiccut&&"pfjzb[0]>-998"; |
1099 |
|
|
1115 |
|
//Step 2: Refine the cut |
1116 |
|
TCut cut; |
1117 |
|
cut=cutmass&&cutOSSF&&cutnJets&&ibasiccut; |
1118 |
< |
if(filename=="nJets") cut=cutmass&&cutOSSF&&ibasiccut; |
1119 |
< |
if(filename=="nJets_osof") cut=cutmass&&cutOSOF&&ibasiccut; |
1118 |
> |
if(filename=="nJets" || filename=="nJets_inclusive" || filename=="nJets_met100" || filename=="nJets_inclusive_met100") cut=cutmass&&cutOSSF&&ibasiccut; |
1119 |
> |
if(filename=="nJets_osof" || filename=="nJets_osof_inclusive" || filename=="nJets_osof_met100" || filename=="nJets_osof_inclusive_met100") cut=cutmass&&cutOSOF&&ibasiccut; |
1120 |
|
if(filename=="nJets_nocuts_except_mll_ossf") cut=cutmass&&cutOSSF; |
1121 |
< |
if(filename=="mll") { |
1121 |
> |
if(filename=="mll"||filename=="mll_met100") { |
1122 |
|
cut=cutOSSF&&cutnJets&&ibasiccut; |
1123 |
|
draw_separation_lines=true; |
1124 |
|
} |
1125 |
< |
if(filename=="mll_ee") cut=cutOSSF&&cutnJets&&ibasiccut&&"id1==0"; |
1126 |
< |
if(filename=="mll_osof") { |
1125 |
> |
if(filename=="mll_ee"||filename=="mll_ee_met100") cut=cutOSSF&&cutnJets&&ibasiccut&&"id1==0"; |
1126 |
> |
if(filename=="mll_mm"||filename=="mll_mm_met100") cut=cutOSSF&&cutnJets&&ibasiccut&&"id1==1"; |
1127 |
> |
if(filename=="mll_osof"||filename=="mll_osof_met100") { |
1128 |
|
cut=cutOSOF&&cutnJets&&ibasiccut; |
1129 |
|
draw_separation_lines=true; |
1130 |
|
} |
487 |
– |
if(filename=="mll_mm") cut=cutOSSF&&cutnJets&&ibasiccut&&"id1==1"; |
1131 |
|
if(Contains(filename,"aboveJZB")) cut=cutOSSF&&cutnJets&&ibasiccut; |
1132 |
|
if(Contains(filename,"mll_ee_above")) cut=cut&&"id1==0"; |
1133 |
|
if(Contains(filename,"mll_mm_above")) cut=cut&&"id1==1"; |
1138 |
|
if(filename=="mll_inclusive_mm") cut=cutOSSF&&"id1==1"; |
1139 |
|
if(filename=="pfJetGoodEta_0") cut=cutOSSF&&cutmass&&ibasiccut&&cutnJets; |
1140 |
|
if(filename=="pfJetGoodPt_0") cut=cutOSSF&&cutmass&&ibasiccut&&cutnJets; |
1141 |
+ |
if(filename=="numVtx") cut=cutmass&&ibasiccut; |
1142 |
|
|
1143 |
|
TCanvas *ckin = new TCanvas("ckin","Kinematic Plots (in the making)",600,600); |
1144 |
|
ckin->SetLogy(logscale); |
1156 |
|
if (logscale) datahisto->SetMaximum(5.3*datahisto->GetMaximum()); |
1157 |
|
else datahisto->SetMaximum(1.3*datahisto->GetMaximum()); |
1158 |
|
|
1159 |
+ |
cout << "******** Cut used : " << (const char*) cut << " for plot " << filename << endl; |
1160 |
|
if(loadlastminmax) { |
1161 |
|
datahisto->SetMinimum(lastrange_min); |
1162 |
|
datahisto->SetMaximum(lastrange_max); |
1170 |
|
string signal("LM3"); |
1171 |
|
TH1F* signalhisto = new TH1F("signalhisto",signal.c_str(),nbins,min,max); |
1172 |
|
int idx = signalsamples.FindSample(signal)[0]; |
1173 |
< |
(signalsamples.collection)[idx].events->Project("signalhisto",variable.c_str(),cut); |
1174 |
< |
signalhisto->Scale((signalsamples.collection)[idx].weight*luminosity); |
1175 |
< |
signalhisto->SetLineColor(kOrange); |
1173 |
> |
if(drawsignal) (signalsamples.collection)[idx].events->Project("signalhisto",variable.c_str(),cut); |
1174 |
> |
if(drawsignal) signalhisto->Scale((signalsamples.collection)[idx].weight*luminosity); |
1175 |
> |
if(drawsignal) signalhisto->SetLineColor(kOrange); |
1176 |
|
|
1177 |
|
THStack mcstack = allsamples.DrawStack("mcstack", variable,nbins,min,max,xlabel,"events",cut,mc,luminosity); |
1178 |
|
datahisto->Draw("e1"); |
1179 |
|
ckin->Update(); |
1180 |
< |
mcstack.Draw("same"); |
1180 |
> |
mcstack.Draw("histo,same"); |
1181 |
|
|
1182 |
|
datahisto->Draw("same,e1"); |
1183 |
|
TLegend *kinleg = allsamples.allbglegend(); |
1220 |
|
kinpad->cd(); |
1221 |
|
kinpad->SetLogy(logscale); |
1222 |
|
datahisto->Draw("e1"); |
1223 |
< |
mcstack.Draw("same"); |
1224 |
< |
signalhisto->Draw("same"); |
1223 |
> |
mcstack.Draw("histo,same"); |
1224 |
> |
if(drawsignal) signalhisto->Draw("same"); |
1225 |
|
datahisto->Draw("same,e1"); |
1226 |
|
datahisto->Draw("same,axis"); |
1227 |
|
if(RestrictToMassPeak&&draw_separation_lines) { |
1229 |
|
upperboundary->Draw("same"); |
1230 |
|
} |
1231 |
|
|
1232 |
< |
kinleg->AddEntry("signalhisto",signal.c_str(),"l"); |
1232 |
> |
if(drawsignal) kinleg->AddEntry("signalhisto",signal.c_str(),"l"); |
1233 |
|
kinleg->Draw(); |
1234 |
|
write_cut->Draw(); |
1235 |
|
DrawPrelim(); |
1236 |
|
string saveas="kin/"+filename; |
1237 |
|
if(isPF) saveas="kin/"+filename+"__PF"; |
1238 |
< |
save_with_ratio(datahisto,mcstack,kinpad->cd(),saveas); |
1238 |
> |
Save_With_Ratio(datahisto,mcstack,kinpad->cd(),saveas); |
1239 |
|
// if(isPF) CompleteSave(with_ratio,"kin/"+filename+"__PF_withratio"); |
1240 |
|
// else CompleteSave(with_ratio,"kin/"+filename+"_withratio"); |
1241 |
|
// delete with_ratio; |
1244 |
|
else CompleteSave(ckin,"kin/"+filename); |
1245 |
|
} |
1246 |
|
datahisto->Delete(); |
1247 |
+ |
delete signalhisto; |
1248 |
+ |
delete ckin; |
1249 |
+ |
} |
1250 |
+ |
|
1251 |
+ |
|
1252 |
+ |
void make_plain_kin_plot(string variable, string addcut, int nbins, float min, float max, bool logscale, |
1253 |
+ |
string xlabel, string filename, bool isPF=true, bool plotratio=true, bool loadlastminmax=false ) { |
1254 |
+ |
TCut cut=TCut(addcut.c_str())&&basiccut; |
1255 |
+ |
|
1256 |
+ |
TCanvas *ckin = new TCanvas("ckin","Kinematic Plots (in the making)",600,600); |
1257 |
+ |
ckin->SetLogy(logscale); |
1258 |
+ |
TH1F *datahisto = allsamples.Draw("datahisto",variable,nbins,min,max, xlabel, "events",cut,data,luminosity); |
1259 |
+ |
datahisto->SetMarkerSize(DataMarkerSize); |
1260 |
+ |
if ( !logscale ) datahisto->SetMinimum(0); // Defaults |
1261 |
+ |
else datahisto->SetMinimum(0.5); |
1262 |
+ |
// Custom max. |
1263 |
+ |
if (logscale) datahisto->SetMaximum(5.3*datahisto->GetMaximum()); |
1264 |
+ |
else datahisto->SetMaximum(1.3*datahisto->GetMaximum()); |
1265 |
+ |
|
1266 |
+ |
cout << "******** Cut used : " << (const char*) cut << " for plot " << filename << endl; |
1267 |
+ |
if(loadlastminmax) { |
1268 |
+ |
datahisto->SetMinimum(lastrange_min); |
1269 |
+ |
datahisto->SetMaximum(lastrange_max); |
1270 |
+ |
if(logscale) { |
1271 |
+ |
datahisto->SetMinimum(pow(10,lastrange_min)); |
1272 |
+ |
datahisto->SetMaximum(pow(10,lastrange_max)); |
1273 |
+ |
} |
1274 |
+ |
} |
1275 |
+ |
|
1276 |
+ |
THStack mcstack = allsamples.DrawStack("mcstack", variable,nbins,min,max,xlabel,"events",cut,mc,luminosity); |
1277 |
+ |
datahisto->Draw("e1"); |
1278 |
+ |
ckin->Update(); |
1279 |
+ |
mcstack.Draw("histo,same"); |
1280 |
+ |
|
1281 |
+ |
datahisto->Draw("same,e1"); |
1282 |
+ |
TLegend *kinleg = allsamples.allbglegend(); |
1283 |
+ |
kinleg->Draw(); |
1284 |
+ |
|
1285 |
+ |
lastrange_min=ckin->GetUymin(); |
1286 |
+ |
lastrange_max=ckin->GetUymax(); |
1287 |
+ |
|
1288 |
+ |
if ( plotratio ) { |
1289 |
+ |
TPad *kinpad = new TPad("kinpad","kinpad",0,0,1,1); |
1290 |
+ |
kinpad->cd(); |
1291 |
+ |
kinpad->SetLogy(logscale); |
1292 |
+ |
datahisto->Draw("e1"); |
1293 |
+ |
mcstack.Draw("histo,same"); |
1294 |
+ |
datahisto->Draw("same,e1"); |
1295 |
+ |
datahisto->Draw("same,axis"); |
1296 |
+ |
|
1297 |
+ |
kinleg->Draw(); |
1298 |
+ |
DrawPrelim(); |
1299 |
+ |
string saveas="kin/"+filename; |
1300 |
+ |
if(isPF) saveas="kin/"+filename+"__PF"; |
1301 |
+ |
Save_With_Ratio(datahisto,mcstack,kinpad->cd(),saveas); |
1302 |
+ |
} else { |
1303 |
+ |
if(isPF) CompleteSave(ckin,"kin/"+filename+"__PF"); |
1304 |
+ |
else CompleteSave(ckin,"kin/"+filename); |
1305 |
+ |
} |
1306 |
+ |
datahisto->Delete(); |
1307 |
|
delete ckin; |
1308 |
|
} |
1309 |
|
|
1310 |
+ |
|
1311 |
|
void make_JES_plot(TCut cut, string name) { |
1312 |
|
|
1313 |
|
int nbins=10; |
1341 |
|
JESunc->SetFillColor(TColor::GetColor("#00ADE1")); |
1342 |
|
JESunc->SetFillStyle(3002); |
1343 |
|
datahisto->Draw("e1"); |
1344 |
< |
mcstack.Draw("same"); |
1344 |
> |
mcstack.Draw("histo,same"); |
1345 |
|
JESunc->Draw("2"); |
1346 |
|
datahisto->Draw("same,e1"); |
1347 |
|
TLegend *kinleg = allsamples.allbglegend(); |
1350 |
|
CompleteSave(ckin,"Systematics/JES"+name); |
1351 |
|
datahisto->Delete(); |
1352 |
|
delete ckin; |
1353 |
+ |
delete JESunc; |
1354 |
+ |
delete JESup; |
1355 |
+ |
delete JESdn; |
1356 |
+ |
CleanLegends(); |
1357 |
+ |
} |
1358 |
+ |
|
1359 |
+ |
string Cut2Str(TCut cut) { |
1360 |
+ |
return ((string)(const char*)cut); |
1361 |
+ |
} |
1362 |
+ |
|
1363 |
+ |
void MakeElegantTwoThreeComparisons() { |
1364 |
+ |
|
1365 |
+ |
TCut signal("met[4]>100&&met[4]<150&&mll>20"&&PlottingSetup::basicqualitycut); |
1366 |
+ |
TCut TwoJets("pfJetGoodNum40==2"); |
1367 |
+ |
TCut ThreeJets("pfJetGoodNum40>=3"); |
1368 |
+ |
|
1369 |
+ |
float min=20; |
1370 |
+ |
float max=300; |
1371 |
+ |
int nbins=int((max-min)/5.0); |
1372 |
+ |
string xlabel="m_{ll} [GeV]"; |
1373 |
+ |
|
1374 |
+ |
TCanvas *can2 = new TCanvas("can2","can2"); |
1375 |
+ |
TH1F *TwoOF = allsamples.Draw("TwoOF","mll",nbins,min,max, xlabel, "events",cutOSOF&&signal&&TwoJets,mc,luminosity,allsamples.FindSample("/TT_")); |
1376 |
+ |
TH1F *TwoSF = allsamples.Draw("TwoSF","mll",nbins,min,max, xlabel, "events",cutOSSF&&signal&&TwoJets,mc,luminosity,allsamples.FindSample("/TT_")); |
1377 |
+ |
TH1F *ThreeOF = allsamples.Draw("ThreeOF","mll",nbins,min,max, xlabel, "events",cutOSOF&&signal&&ThreeJets,mc,luminosity,allsamples.FindSample("/TT_")); |
1378 |
+ |
TH1F *ThreeSF = allsamples.Draw("ThreeSF","mll",nbins,min,max, xlabel, "events",cutOSSF&&signal&&ThreeJets,mc,luminosity,allsamples.FindSample("/TT_")); |
1379 |
+ |
|
1380 |
+ |
can2->cd(1); |
1381 |
+ |
|
1382 |
+ |
TwoSF->SetFillColor(kWhite); |
1383 |
+ |
TwoOF->SetFillColor(kWhite); |
1384 |
+ |
ThreeSF->SetFillColor(kWhite); |
1385 |
+ |
ThreeOF->SetFillColor(kWhite); |
1386 |
+ |
|
1387 |
+ |
TPad *kin3 = new TPad("kin3","kin3",0,0,1,1); |
1388 |
+ |
kin3->cd(); |
1389 |
+ |
TwoOF->Draw("histo"); |
1390 |
+ |
TwoSF->Draw("e1,same"); |
1391 |
+ |
TLegend *leg_SFOF_Two = make_legend(); |
1392 |
+ |
leg_SFOF_Two->SetHeader("t#bar{t} MC:"); |
1393 |
+ |
leg_SFOF_Two->AddEntry(TwoOF,"OF, nJets==2","l"); |
1394 |
+ |
leg_SFOF_Two->AddEntry(TwoSF,"SF, nJets==2","lp"); |
1395 |
+ |
leg_SFOF_Two->Draw(); |
1396 |
+ |
Save_With_Ratio(TwoSF,TwoOF,kin3->cd(),"DoubleRatios/SFOF_Two"); |
1397 |
+ |
|
1398 |
+ |
TPad *kin4 = new TPad("kin4","kin4",0,0,1,1); |
1399 |
+ |
kin4->cd(); |
1400 |
+ |
ThreeOF->Draw("histo"); |
1401 |
+ |
ThreeSF->Draw("e1,same"); |
1402 |
+ |
TLegend *leg_SFOF_Three = make_legend(); |
1403 |
+ |
leg_SFOF_Three->SetHeader("t#bar{t} MC:"); |
1404 |
+ |
leg_SFOF_Three->AddEntry(TwoOF,"OF, nJet#geq3","l"); |
1405 |
+ |
leg_SFOF_Three->AddEntry(TwoSF,"SF, nJets#geq3","lp"); |
1406 |
+ |
leg_SFOF_Three->Draw(); |
1407 |
+ |
Save_With_Ratio(ThreeSF,ThreeOF,kin4->cd(),"DoubleRatios/SFOF_Three"); |
1408 |
+ |
|
1409 |
+ |
|
1410 |
+ |
TwoSF->Scale(ThreeSF->Integral()/TwoSF->Integral()); |
1411 |
+ |
TPad *kin = new TPad("kin","kin",0,0,1,1); |
1412 |
+ |
kin->cd(); |
1413 |
+ |
TwoSF->Draw("histo"); |
1414 |
+ |
ThreeSF->Draw("e1,same"); |
1415 |
+ |
TLegend *leg_SF_Two_Three = make_legend(); |
1416 |
+ |
leg_SF_Two_Three->SetHeader("t#bar{t} MC:"); |
1417 |
+ |
leg_SF_Two_Three->AddEntry(TwoSF,"#splitline{SF, nJets==2}{ (scaled)}","l"); |
1418 |
+ |
leg_SF_Two_Three->AddEntry(ThreeSF,"SF, nJets#geq3","lp"); |
1419 |
+ |
leg_SF_Two_Three->Draw(); |
1420 |
+ |
Save_With_Ratio(TwoSF,ThreeSF,kin->cd(),"DoubleRatios/SF_Two_Three"); |
1421 |
+ |
|
1422 |
+ |
TwoOF->Scale(ThreeOF->Integral()/TwoOF->Integral()); |
1423 |
+ |
TPad *kin2 = new TPad("kin2","kin2",0,0,1,1); |
1424 |
+ |
kin2->cd(); |
1425 |
+ |
TwoOF->Draw("histo"); |
1426 |
+ |
ThreeOF->Draw("e1,same"); |
1427 |
+ |
TLegend *leg_OF_Two_Three = make_legend(); |
1428 |
+ |
leg_OF_Two_Three->SetHeader("t#bar{t} MC:"); |
1429 |
+ |
leg_OF_Two_Three->AddEntry(TwoSF,"#splitline{OF, nJets==2}{ (scaled)}","l"); |
1430 |
+ |
leg_OF_Two_Three->AddEntry(ThreeSF,"OF, nJets#geq3","lp"); |
1431 |
+ |
leg_OF_Two_Three->Draw(); |
1432 |
+ |
Save_With_Ratio(TwoOF,ThreeOF,kin2->cd(),"DoubleRatios/OF_Two_Three"); |
1433 |
+ |
|
1434 |
+ |
} |
1435 |
+ |
|
1436 |
+ |
void PresentRange(TH1F *Down, TH1F *Up, TH1F *central, TVirtualPad *pad, string title) { |
1437 |
+ |
pad->cd(); |
1438 |
+ |
TGraphErrors *gr = new TGraphErrors(Down->GetNbinsX()); |
1439 |
+ |
for(int i=1;i<=Down->GetNbinsX();i++) { |
1440 |
+ |
float average=0.5*(Down->GetBinContent(i)+Up->GetBinContent(i)); |
1441 |
+ |
float error=abs(Down->GetBinContent(i)-average); |
1442 |
+ |
gr->SetPoint(i-1,Down->GetBinCenter(i),average); |
1443 |
+ |
gr->SetPointError(i-1,Down->GetBinWidth(i)/2.0,error); |
1444 |
+ |
} |
1445 |
+ |
gr->SetFillColor(TColor::GetColor("#F79F81")); |
1446 |
+ |
gr->GetYaxis()->SetRangeUser(0,2); |
1447 |
+ |
gr->GetXaxis()->SetTitle(central->GetXaxis()->GetTitle()); |
1448 |
+ |
gr->GetYaxis()->SetTitle(central->GetYaxis()->GetTitle()); |
1449 |
+ |
gr->GetXaxis()->CenterTitle(); |
1450 |
+ |
gr->GetYaxis()->CenterTitle(); |
1451 |
+ |
|
1452 |
+ |
gr->Draw("A2"); |
1453 |
+ |
central->Draw("e1,same"); |
1454 |
+ |
DrawMCPrelim(); |
1455 |
+ |
TText *rtitle = write_text(0.8,0.8,title); |
1456 |
+ |
TLine *line = new TLine(Down->GetBinLowEdge(1),1.0,Down->GetBinLowEdge(Down->GetNbinsX())+Down->GetBinWidth(Down->GetNbinsX()),1.0); |
1457 |
+ |
line->SetLineColor(kBlue); |
1458 |
+ |
line->SetLineStyle(2); |
1459 |
+ |
line->Draw("same"); |
1460 |
+ |
rtitle->Draw("same"); |
1461 |
+ |
} |
1462 |
+ |
|
1463 |
+ |
TH1F* ProduceTTbarRatio(TH1F *datahisto, TH1F *fullmc, TH1F *originalttbar, TH1F *httbar) { |
1464 |
+ |
TH1F *basehisto = (TH1F*)fullmc->Clone("basehisto"); |
1465 |
+ |
basehisto->Add(originalttbar,-1); |
1466 |
+ |
basehisto->Add(httbar); |
1467 |
+ |
|
1468 |
+ |
string sname=httbar->GetName(); |
1469 |
+ |
sname="R"+sname.substr(1,sname.length()); |
1470 |
+ |
TH1F *ratio = (TH1F*)datahisto->Clone(sname.c_str()); |
1471 |
+ |
ratio->Divide(basehisto); |
1472 |
+ |
delete basehisto; |
1473 |
+ |
return ratio; |
1474 |
+ |
} |
1475 |
+ |
|
1476 |
+ |
void make_ttbar_comparison(string datavariable, string mcvariable, int nbins, float min, float max, TCut addcut, bool dolog, string xlabel, string filename) { |
1477 |
+ |
|
1478 |
+ |
TCut cut=addcut&&basiccut; |
1479 |
+ |
|
1480 |
+ |
TCanvas *ckin = new TCanvas("ckin","Kinematic Plots (in the making)",600,600); |
1481 |
+ |
ckin->SetLogy(dolog); |
1482 |
+ |
cout << "\r Creating " << filename << " : data (1/7)" << std::flush; |
1483 |
+ |
TH1F *datahisto = allsamples.Draw("datahisto",datavariable,nbins,min,max, xlabel, "events",cut,data,luminosity); |
1484 |
+ |
datahisto->SetMarkerSize(DataMarkerSize); |
1485 |
+ |
if ( !dolog ) datahisto->SetMinimum(0); // Defaults |
1486 |
+ |
else datahisto->SetMinimum(0.5); |
1487 |
+ |
if (dolog) datahisto->SetMaximum(5.3*datahisto->GetMaximum()); |
1488 |
+ |
else datahisto->SetMaximum(1.3*datahisto->GetMaximum()); |
1489 |
+ |
cout << "\r Creating " << filename << " : MC central (stack) (2/7)" << std::flush; |
1490 |
+ |
THStack mcstack = allsamples.DrawStack("mcstack", mcvariable,nbins,min,max,xlabel,"events",cut,mc,luminosity); |
1491 |
+ |
TH1F *MCcentral = CollapseStack(mcstack); |
1492 |
+ |
|
1493 |
+ |
cout << "\r Creating " << filename << " : MC central (histo) (3/7)" << std::flush; |
1494 |
+ |
TH1F *TCentral = allsamples.Draw ("TCentral", mcvariable,nbins,min,max,xlabel,"events",cut,mc,luminosity,allsamples.FindSample("/TT_")); |
1495 |
+ |
TH1F *RCentral = ProduceTTbarRatio(datahisto,MCcentral,TCentral,TCentral); |
1496 |
+ |
|
1497 |
+ |
cout << "\r Creating " << filename << " : MC Matching up (4/7)" << std::flush; |
1498 |
+ |
TH1F *TMatchingUp = systsamples.Draw("TMatchingUp", mcvariable,nbins,min,max,xlabel,"events",cut,mc,luminosity,systsamples.FindSample("TTJets_matchingup")); |
1499 |
+ |
TH1F *RMatchingUp = ProduceTTbarRatio(datahisto,MCcentral,TCentral,TMatchingUp); |
1500 |
+ |
|
1501 |
+ |
cout << "\r Creating " << filename << " : MC Matching down (5/7)" << std::flush; |
1502 |
+ |
TH1F *TMatchingDown = systsamples.Draw("TMatchingDown",mcvariable,nbins,min,max,xlabel,"events",cut,mc,luminosity,systsamples.FindSample("TTJets_matchingdown")); |
1503 |
+ |
TH1F *RMatchingDown = ProduceTTbarRatio(datahisto,MCcentral,TCentral,TMatchingDown); |
1504 |
+ |
|
1505 |
+ |
cout << "\r Creating " << filename << " : MC Scale up (6/7)" << std::flush; |
1506 |
+ |
TH1F *TScaleUp = systsamples.Draw("TScaleUp", mcvariable,nbins,min,max,xlabel,"events",cut,mc,luminosity,systsamples.FindSample("TTJets_scaleup")); |
1507 |
+ |
TH1F *RScaleUp = ProduceTTbarRatio(datahisto,MCcentral,TCentral,TScaleUp); |
1508 |
+ |
|
1509 |
+ |
cout << "\r Creating " << filename << " : MC Scale down (7/7)" << std::flush; |
1510 |
+ |
TH1F *TScaleDown = systsamples.Draw("TScaleDown", mcvariable,nbins,min,max,xlabel,"events",cut,mc,luminosity,systsamples.FindSample("TTJets_scaledown")); |
1511 |
+ |
TH1F *RScaleDown = ProduceTTbarRatio(datahisto,MCcentral,TCentral,TScaleDown); |
1512 |
+ |
|
1513 |
+ |
datahisto->Draw("e1"); |
1514 |
+ |
ckin->Update(); |
1515 |
+ |
mcstack.Draw("histo,same"); |
1516 |
+ |
|
1517 |
+ |
datahisto->Draw("same,e1"); |
1518 |
+ |
TLegend *kinleg = allsamples.allbglegend(); |
1519 |
+ |
kinleg->Draw(); |
1520 |
+ |
|
1521 |
+ |
TPad *kinpad = new TPad("kinpad","kinpad",0,0,1,1); |
1522 |
+ |
kinpad->SetLogy(dolog); |
1523 |
+ |
kinpad->cd(); |
1524 |
+ |
datahisto->Draw("e1"); |
1525 |
+ |
mcstack.Draw("histo,same"); |
1526 |
+ |
datahisto->Draw("same,e1"); |
1527 |
+ |
datahisto->Draw("same,axis"); |
1528 |
+ |
|
1529 |
+ |
kinleg->Draw("same"); |
1530 |
+ |
DrawPrelim(); |
1531 |
+ |
string saveas="kin/"+filename; |
1532 |
+ |
|
1533 |
+ |
cout << "Passing filename to be saved : " << filename << " as " << saveas << endl; |
1534 |
+ |
Save_With_Ratio( datahisto, CollapseStack(mcstack), kinpad->cd(), saveas, false, false, "data/mc"); |
1535 |
+ |
delete kinpad; |
1536 |
+ |
|
1537 |
+ |
ckin->cd(); |
1538 |
+ |
TCentral->SetLineColor(kBlack); |
1539 |
+ |
|
1540 |
+ |
TMatchingUp->SetLineColor(TColor::GetColor("#2c17b1"));//blue |
1541 |
+ |
TMatchingUp->SetLineStyle(2);//dashed |
1542 |
+ |
TMatchingDown->SetLineColor(TColor::GetColor("#2c17b1")); |
1543 |
+ |
TMatchingDown->SetLineStyle(3);//dotted |
1544 |
+ |
|
1545 |
+ |
TScaleUp->SetLineColor(TColor::GetColor("#FF8500"));//orange |
1546 |
+ |
TScaleUp->SetLineStyle(2);//dashed |
1547 |
+ |
TScaleDown->SetLineColor(TColor::GetColor("#FF8500")); |
1548 |
+ |
TScaleDown->SetLineStyle(3);//dotted |
1549 |
+ |
|
1550 |
+ |
MCcentral->SetLineStyle(3); |
1551 |
+ |
MCcentral->SetLineColor(kRed); |
1552 |
+ |
|
1553 |
+ |
TCentral->Draw("e1,same"); |
1554 |
+ |
TCentral->Draw("histo,same"); |
1555 |
+ |
TMatchingUp->Draw("histo,same"); |
1556 |
+ |
TMatchingDown->Draw("histo,same"); |
1557 |
+ |
TScaleUp->Draw("histo,same"); |
1558 |
+ |
TScaleDown->Draw("histo,same"); |
1559 |
+ |
|
1560 |
+ |
TLegend *sleg = make_legend(); |
1561 |
+ |
sleg->AddEntry(TCentral,"Central","L"); |
1562 |
+ |
sleg->AddEntry(TMatchingUp,"matching up","L"); |
1563 |
+ |
sleg->AddEntry(TMatchingDown,"matching down","L"); |
1564 |
+ |
sleg->AddEntry(TScaleUp,"scale up","L"); |
1565 |
+ |
sleg->AddEntry(TScaleDown,"scale down","L"); |
1566 |
+ |
sleg->Draw(); |
1567 |
+ |
|
1568 |
+ |
CompleteSave(ckin,saveas+"___AllLines"); |
1569 |
+ |
ckin->cd(); |
1570 |
+ |
ckin->SetLogy(0); |
1571 |
+ |
|
1572 |
+ |
RCentral->SetLineColor(kBlack); |
1573 |
+ |
|
1574 |
+ |
RMatchingUp->SetLineColor(TColor::GetColor("#2c17b1"));//blue |
1575 |
+ |
RMatchingUp->SetLineStyle(2);//dashed |
1576 |
+ |
RMatchingDown->SetLineColor(TColor::GetColor("#2c17b1")); |
1577 |
+ |
RMatchingDown->SetLineStyle(3);//dotted |
1578 |
+ |
|
1579 |
+ |
RScaleUp->SetLineColor(TColor::GetColor("#FF8500"));//orange |
1580 |
+ |
RScaleUp->SetLineStyle(2);//dashed |
1581 |
+ |
RScaleDown->SetLineColor(TColor::GetColor("#FF8500")); |
1582 |
+ |
RScaleDown->SetLineStyle(3);//dotted |
1583 |
+ |
|
1584 |
+ |
RCentral->GetYaxis()->SetRangeUser(0,2); |
1585 |
+ |
RCentral->Draw("e1"); |
1586 |
+ |
RMatchingUp->Draw("histo,same"); |
1587 |
+ |
RMatchingDown->Draw("histo,same"); |
1588 |
+ |
RScaleUp->Draw("histo,same"); |
1589 |
+ |
RScaleDown->Draw("histo,same"); |
1590 |
+ |
|
1591 |
+ |
CompleteSave(ckin,saveas+"___AllRatios"); |
1592 |
+ |
|
1593 |
+ |
TCanvas *multicanvas = new TCanvas("multicanvas","multicanvas",1400,700); |
1594 |
+ |
multicanvas->Divide(2,1); |
1595 |
+ |
PresentRange(RMatchingUp,RMatchingDown,RCentral,multicanvas->cd(1),"Matching"); |
1596 |
+ |
PresentRange(RScaleUp,RScaleDown,RCentral,multicanvas->cd(2),"Scale"); |
1597 |
+ |
CompleteSave(multicanvas,saveas+"___RangeIllustration"); |
1598 |
+ |
|
1599 |
+ |
|
1600 |
+ |
delete datahisto; |
1601 |
+ |
delete TCentral; |
1602 |
+ |
delete TMatchingUp; |
1603 |
+ |
delete TMatchingDown; |
1604 |
+ |
delete TScaleUp; |
1605 |
+ |
delete TScaleDown; |
1606 |
+ |
// delete Ttmass166; |
1607 |
+ |
// delete Ttmass169; |
1608 |
+ |
// delete Ttmass175; |
1609 |
+ |
// delete Ttmass178; |
1610 |
+ |
|
1611 |
+ |
delete ckin; |
1612 |
+ |
|
1613 |
+ |
} |
1614 |
+ |
|
1615 |
+ |
void make_ttbar_comparison(string variable, int nbins, float min, float max, TCut addcut, bool dolog, string xlabel, string filename) { |
1616 |
+ |
make_ttbar_comparison(variable, variable, nbins, min, max, addcut, dolog, xlabel, filename); |
1617 |
+ |
} |
1618 |
+ |
|
1619 |
+ |
void ProduceJanPlots() { |
1620 |
+ |
TCanvas *c1 = new TCanvas("c1","c1"); |
1621 |
+ |
TH1F *metSF = allsamples.Draw("metSF","met[4]",30,100,400, "E_{T}^{miss} [GeV]", "events", cutmass&&cutOSSF&&cutnJets,data, luminosity); |
1622 |
+ |
TH1F *metOF = allsamples.Draw("metOF","met[4]",30,100,400, "E_{T}^{miss} [GeV]", "events", cutmass&&cutOSOF&&cutnJets,data, luminosity); |
1623 |
+ |
|
1624 |
+ |
TPad* rcan = new TPad("rcan","rcan",0,0,1,1); |
1625 |
+ |
rcan->cd(); |
1626 |
+ |
|
1627 |
+ |
metOF->SetLineColor(kRed); |
1628 |
+ |
metSF->Draw("e1"); |
1629 |
+ |
metOF->Draw("histo,same"); |
1630 |
+ |
metSF->Draw("e1,same"); |
1631 |
+ |
|
1632 |
+ |
TLegend *leg = make_legend(); |
1633 |
+ |
|
1634 |
+ |
leg->AddEntry(metSF,"Data SF","p"); |
1635 |
+ |
leg->AddEntry(metOF,"Data OF","l"); |
1636 |
+ |
leg->Draw(); |
1637 |
+ |
|
1638 |
+ |
DrawPrelim(); |
1639 |
+ |
|
1640 |
+ |
Save_With_Ratio(metSF,metOF,rcan,"JanPlots/ETHConfig",false,false,"SF/OF"); |
1641 |
+ |
|
1642 |
+ |
delete rcan; |
1643 |
+ |
delete metSF; |
1644 |
+ |
delete metOF; |
1645 |
+ |
delete c1; |
1646 |
+ |
} |
1647 |
+ |
|
1648 |
+ |
THStack MakeOneSystematicsPlot(TCut cut, string saveas, string variation, TH1F *hdata, string variable, int nbins, float bmin, float bmax, string label, TH1F* &thisto) { |
1649 |
+ |
THStack SystPlot = allsamples.DrawStack(variation,variable,nbins,bmin,bmax,label,"events",cut,mc,PlottingSetup::luminosity); |
1650 |
+ |
|
1651 |
+ |
//now need to process the plot (calculate the variation and set the member of thstack accordingly!) |
1652 |
+ |
if(variation!="Central") { |
1653 |
+ |
TH1F *varttbar; |
1654 |
+ |
if(variation=="MatchingUp") varttbar = systsamples.Draw("varttbar",variable,nbins,bmin,bmax,label,"events",cut,mc,PlottingSetup::luminosity,systsamples.FindSample("TTJets_matchingup_TuneZ2s")); |
1655 |
+ |
if(variation=="MatchingDown") varttbar = systsamples.Draw("varttbar",variable,nbins,bmin,bmax,label,"events",cut,mc,PlottingSetup::luminosity,systsamples.FindSample("TTJets_matchingdown")); |
1656 |
+ |
if(variation=="ScaleUp") varttbar = systsamples.Draw("varttbar",variable,nbins,bmin,bmax,label,"events",cut,mc,PlottingSetup::luminosity,systsamples.FindSample("TTJets_scaleup")); |
1657 |
+ |
if(variation=="ScaleDown") varttbar = systsamples.Draw("varttbar",variable,nbins,bmin,bmax,label,"events",cut,mc,PlottingSetup::luminosity,systsamples.FindSample("TTJets_scaledown")); |
1658 |
+ |
assert(varttbar); |
1659 |
+ |
|
1660 |
+ |
TIter nextHisto(SystPlot.GetHists()); |
1661 |
+ |
TH1F* h; |
1662 |
+ |
while ( h = (TH1F*)nextHisto() ) { |
1663 |
+ |
if(Contains(h->GetName(),"t_bar_t")) { |
1664 |
+ |
varttbar->Scale(h->Integral()/varttbar->Integral()); |
1665 |
+ |
for(int i=0;i<=h->GetNbinsX()+1;i++) {//note that we deliberatly consider the under/overflow bin as well! |
1666 |
+ |
h->SetBinContent(i,varttbar->GetBinContent(i)); |
1667 |
+ |
h->SetBinError(i,varttbar->GetBinError(i)); |
1668 |
+ |
} |
1669 |
+ |
thisto=(TH1F*)varttbar->Clone(variation.c_str()); |
1670 |
+ |
SystPlot.Modified(); |
1671 |
+ |
} |
1672 |
+ |
} |
1673 |
+ |
delete varttbar; |
1674 |
+ |
} else { |
1675 |
+ |
TIter nextHisto(SystPlot.GetHists()); |
1676 |
+ |
TH1F* h; |
1677 |
+ |
while ( h = (TH1F*)nextHisto() ) { |
1678 |
+ |
if(Contains(h->GetName(),"t_bar_t")) thisto=(TH1F*)h->Clone(variation.c_str()); |
1679 |
+ |
} |
1680 |
+ |
} |
1681 |
+ |
|
1682 |
+ |
TLegend *fullleg = allsamples.allbglegend(); |
1683 |
+ |
fullleg->SetHeader(variation.c_str()); |
1684 |
+ |
TPad *kinpad = new TPad("kinpad","kinpad",0,0,1,1); |
1685 |
+ |
kinpad->SetLogy(1); |
1686 |
+ |
kinpad->cd(); |
1687 |
+ |
|
1688 |
+ |
hdata->Draw("e1"); |
1689 |
+ |
SystPlot.Draw("histo,same"); |
1690 |
+ |
hdata->Draw("e1,same"); |
1691 |
+ |
fullleg->Draw(); |
1692 |
+ |
DrawPrelim(); |
1693 |
+ |
|
1694 |
+ |
Save_With_Ratio(hdata,SystPlot,kinpad,saveas+"_"+variation); |
1695 |
+ |
CleanLegends(); |
1696 |
+ |
|
1697 |
+ |
delete kinpad; |
1698 |
+ |
return SystPlot; |
1699 |
+ |
} |
1700 |
+ |
|
1701 |
+ |
|
1702 |
+ |
|
1703 |
+ |
void ProduceMCSystematicPlot(string variable, int nbins, float bmin, float bmax, string label, TCut thiscut, string saveas) { |
1704 |
+ |
TCanvas *ca = new TCanvas("ca","ca"); |
1705 |
+ |
TH1F *hdata = allsamples.Draw("hdata",variable,nbins,bmin,bmax,label,"events",thiscut,data,luminosity); |
1706 |
+ |
|
1707 |
+ |
TH1F *tScaleUp,*tScaleDown,*tMatchingUp,*tMatchingDown,*tCentral; |
1708 |
+ |
|
1709 |
+ |
THStack ScaleUp = MakeOneSystematicsPlot(thiscut,saveas,"ScaleUp",hdata,variable, nbins, bmin, bmax, label,tScaleUp); |
1710 |
+ |
THStack ScaleDown = MakeOneSystematicsPlot(thiscut,saveas,"ScaleDown",hdata,variable, nbins, bmin, bmax, label,tScaleDown); |
1711 |
+ |
THStack MatchingUp = MakeOneSystematicsPlot(thiscut,saveas,"MatchingUp",hdata,variable, nbins, bmin, bmax, label,tMatchingUp); |
1712 |
+ |
THStack MatchingDown = MakeOneSystematicsPlot(thiscut,saveas,"MatchingDown",hdata,variable, nbins, bmin, bmax, label,tMatchingDown); |
1713 |
+ |
|
1714 |
+ |
TH1F *HScaleUp = CollapseStack(ScaleUp); |
1715 |
+ |
TH1F *HScaleDown = CollapseStack(ScaleDown); |
1716 |
+ |
TH1F *HMatchingUp = CollapseStack(MatchingUp); |
1717 |
+ |
TH1F *HMatchingDown = CollapseStack(MatchingDown); |
1718 |
+ |
|
1719 |
+ |
THStack Central = MakeOneSystematicsPlot(thiscut,saveas,"Central",hdata,variable, nbins, bmin, bmax, label,tCentral); |
1720 |
+ |
TH1F *HCentral = CollapseStack(Central); |
1721 |
+ |
|
1722 |
+ |
TH1F *Systematic = (TH1F*)hdata->Clone("Systematic"); |
1723 |
+ |
for(int i=1;i<=Systematic->GetNbinsX();i++) { |
1724 |
+ |
float matchingup = abs(HMatchingUp->GetBinContent(i)-HCentral->GetBinContent(i)); |
1725 |
+ |
float matchingdown = abs(HMatchingDown->GetBinContent(i)-HCentral->GetBinContent(i)); |
1726 |
+ |
float scaleup = abs(HScaleUp->GetBinContent(i)-HCentral->GetBinContent(i)); |
1727 |
+ |
float scaledown = abs(HScaleDown->GetBinContent(i)-HCentral->GetBinContent(i)); |
1728 |
+ |
|
1729 |
+ |
float matching = matchingup>matchingdown?matchingup:matchingdown; |
1730 |
+ |
float scale = scaleup>scaledown?scaleup:scaledown; |
1731 |
+ |
|
1732 |
+ |
float sys=sqrt(matching*matching+scale*scale); |
1733 |
+ |
sys/=HCentral->GetBinContent(i); |
1734 |
+ |
if(HCentral->GetBinContent(i)==0) sys=0; |
1735 |
+ |
Systematic->SetBinContent(i,sys); |
1736 |
+ |
} |
1737 |
+ |
|
1738 |
+ |
TPad *kinpad = new TPad("kinpad","kinpad",0,0,1,1); |
1739 |
+ |
kinpad->SetLogy(1); |
1740 |
+ |
kinpad->cd(); |
1741 |
+ |
if(variable=="genMET") { |
1742 |
+ |
Central.Draw("histo"); |
1743 |
+ |
} else { |
1744 |
+ |
hdata->Draw("e1"); |
1745 |
+ |
Central.Draw("histo,same"); |
1746 |
+ |
hdata->Draw("e1,same"); |
1747 |
+ |
} |
1748 |
+ |
|
1749 |
+ |
DrawPrelim(); |
1750 |
+ |
|
1751 |
+ |
save_with_ratio_and_sys_band( 0.0, hdata, HCentral, kinpad->cd(), saveas, false, false, "data/mc",Systematic ); |
1752 |
+ |
|
1753 |
+ |
kinpad->cd(); |
1754 |
+ |
tCentral->SetFillColor(kWhite); |
1755 |
+ |
tCentral->SetLineColor(kBlack); |
1756 |
+ |
tScaleUp->SetLineColor(kRed); |
1757 |
+ |
tScaleDown->SetLineColor(kRed); |
1758 |
+ |
tMatchingUp->SetLineColor(kBlue); |
1759 |
+ |
tMatchingDown->SetLineColor(kBlue); |
1760 |
+ |
tScaleUp->SetLineStyle(2); |
1761 |
+ |
tScaleDown->SetLineStyle(3); |
1762 |
+ |
tMatchingUp->SetLineStyle(2); |
1763 |
+ |
tMatchingDown->SetLineStyle(3); |
1764 |
+ |
|
1765 |
+ |
TLegend *leg2 = make_legend(); |
1766 |
+ |
leg2->AddEntry(hdata,"Data","p"); |
1767 |
+ |
leg2->AddEntry(tCentral,"Central (ttbar)","l"); |
1768 |
+ |
leg2->AddEntry(tScaleUp,"ScaleUp (ttbar)","l"); |
1769 |
+ |
leg2->AddEntry(tScaleDown,"ScaleDown (ttbar)","l"); |
1770 |
+ |
leg2->AddEntry(tMatchingUp,"MatchingUp (ttbar)","l"); |
1771 |
+ |
leg2->AddEntry(tMatchingDown,"MatchingDown (ttbar)","l"); |
1772 |
+ |
if(variable=="genMET") { |
1773 |
+ |
Central.Draw("histo"); |
1774 |
+ |
}else { |
1775 |
+ |
hdata->Draw("e1"); |
1776 |
+ |
Central.Draw("histo,same"); |
1777 |
+ |
hdata->Draw("e1,same"); |
1778 |
+ |
} |
1779 |
+ |
tCentral->Draw("histo,same"); |
1780 |
+ |
tScaleUp->Draw("histo,same"); |
1781 |
+ |
tScaleDown->Draw("histo,same"); |
1782 |
+ |
tMatchingUp->Draw("histo,same"); |
1783 |
+ |
tMatchingDown->Draw("histo,same"); |
1784 |
+ |
leg2->Draw(); |
1785 |
+ |
|
1786 |
+ |
CompleteSave(kinpad,saveas+"__TTbarComparison"); |
1787 |
+ |
|
1788 |
+ |
gStyle->SetOptFit(0); |
1789 |
+ |
|
1790 |
+ |
kinpad->cd(); |
1791 |
+ |
kinpad->SetLogy(0); |
1792 |
+ |
TH1F *MatchingRatio = (TH1F*)tMatchingUp->Clone("MatchingRatio"); |
1793 |
+ |
MatchingRatio->Divide(tMatchingDown); |
1794 |
+ |
TLine *lone = new TLine(tScaleUp->GetBinLowEdge(1),1,tScaleUp->GetBinLowEdge(tScaleUp->GetNbinsX())+tScaleUp->GetBinWidth(tScaleUp->GetNbinsX()),1); |
1795 |
+ |
lone->SetLineColor(TColor::GetColor("#01DF01")); |
1796 |
+ |
lone->SetLineStyle(2); |
1797 |
+ |
TH1F *ScaleRatio = (TH1F*)tScaleUp->Clone("ScaleRatio"); |
1798 |
+ |
ScaleRatio->Divide(tScaleDown); |
1799 |
+ |
MatchingRatio->GetYaxis()->SetRangeUser(0,3); |
1800 |
+ |
MatchingRatio->Draw("e1"); |
1801 |
+ |
TF1 *QP1 = new TF1("QP1","[0]+[1]*x",50,200);//simple linear function ranging from 50 to 200 |
1802 |
+ |
MatchingRatio->Fit("QP1","R"); |
1803 |
+ |
lone->Draw(); |
1804 |
+ |
stringstream summary; |
1805 |
+ |
summary << " #splitline{Fit result for f(x) = a+bx :}{#splitline{a=" << DigitsAfterComma(QP1->GetParameter(0),4) << " +/- " << DigitsAfterComma(QP1->GetParError(0),4) << "}{b=" << DigitsAfterComma(QP1->GetParameter(1),4); |
1806 |
+ |
summary << " +/- " << DigitsAfterComma(QP1->GetParError(1),4) << "}}"; |
1807 |
+ |
TText *infobox = write_title(summary.str()); |
1808 |
+ |
infobox->SetX(0.75); |
1809 |
+ |
infobox->SetTextSize(0.03); |
1810 |
+ |
infobox->SetY(0.75); |
1811 |
+ |
infobox->Draw(); |
1812 |
+ |
CompleteSave(kinpad,saveas+"__TTbarComparison_MatchingUpDividedMatchingDown"); |
1813 |
+ |
kinpad->cd(); |
1814 |
+ |
ScaleRatio->GetYaxis()->SetRangeUser(0,3); |
1815 |
+ |
ScaleRatio->Draw("e1"); |
1816 |
+ |
ScaleRatio->Fit("QP1","R"); |
1817 |
+ |
summary.str(""); |
1818 |
+ |
summary << " #splitline{Fit result for f(x) = a+bx :}{#splitline{a=" << DigitsAfterComma(QP1->GetParameter(0),4) << " +/- " << DigitsAfterComma(QP1->GetParError(0),4) << "}{b=" << DigitsAfterComma(QP1->GetParameter(1),4); |
1819 |
+ |
summary << " +/- " << DigitsAfterComma(QP1->GetParError(1),4) << "}}"; |
1820 |
+ |
TText *infobox2 = write_title(summary.str()); |
1821 |
+ |
infobox2->SetX(0.75); |
1822 |
+ |
infobox2->SetTextSize(0.03); |
1823 |
+ |
infobox2->SetY(0.75); |
1824 |
+ |
infobox2->Draw(); |
1825 |
+ |
|
1826 |
+ |
lone->Draw(); |
1827 |
+ |
CompleteSave(kinpad,saveas+"__TTbarComparison_ScaleUpDividedScaleDown"); |
1828 |
+ |
|
1829 |
+ |
|
1830 |
+ |
delete QP1; |
1831 |
+ |
delete infobox; |
1832 |
+ |
delete infobox2; |
1833 |
+ |
delete MatchingRatio; |
1834 |
+ |
delete ScaleRatio; |
1835 |
+ |
DeleteStack(ScaleUp); |
1836 |
+ |
DeleteStack(ScaleDown); |
1837 |
+ |
DeleteStack(MatchingUp); |
1838 |
+ |
DeleteStack(MatchingDown); |
1839 |
+ |
delete leg2; |
1840 |
+ |
CleanLegends(); |
1841 |
+ |
DeleteStack(Central); |
1842 |
+ |
delete Systematic; |
1843 |
+ |
delete HScaleUp; |
1844 |
+ |
delete HScaleDown; |
1845 |
+ |
delete HMatchingUp; |
1846 |
+ |
delete HMatchingDown; |
1847 |
+ |
delete hdata; |
1848 |
+ |
delete HCentral; |
1849 |
+ |
delete ca; |
1850 |
+ |
} |
1851 |
+ |
|
1852 |
+ |
TH1F* ImposeBinning(TH1F *binninghisto, TH1F* histo) { |
1853 |
+ |
float val=0,err=0; |
1854 |
+ |
vector<float> bins; |
1855 |
+ |
vector<float> vals; |
1856 |
+ |
vector<float> errs; |
1857 |
+ |
|
1858 |
+ |
bins.push_back(binninghisto->GetBinLowEdge(1)); |
1859 |
+ |
int iBin=1; |
1860 |
+ |
|
1861 |
+ |
for(unsigned int i=1;i<histo->GetNbinsX();i++) {//going to second last one on purpose! |
1862 |
+ |
if((histo->GetBinLowEdge(i)+0.00001>=binninghisto->GetBinLowEdge(iBin)+binninghisto->GetBinWidth(iBin))) { |
1863 |
+ |
bins.push_back(histo->GetBinLowEdge(i)); |
1864 |
+ |
vals.push_back(val);val=0; |
1865 |
+ |
errs.push_back(err);err=0; |
1866 |
+ |
iBin++; |
1867 |
+ |
} |
1868 |
+ |
val+=histo->GetBinContent(i); |
1869 |
+ |
err=sqrt(err*err+histo->GetBinError(i)*histo->GetBinError(i)); |
1870 |
+ |
} |
1871 |
+ |
bins.push_back(histo->GetBinLowEdge(histo->GetNbinsX())+histo->GetBinWidth(histo->GetNbinsX())); |
1872 |
+ |
vals.push_back(val);val=0; |
1873 |
+ |
errs.push_back(err);err=0; |
1874 |
+ |
|
1875 |
+ |
TH1F *h = new TH1F(("r"+(string)histo->GetName()).c_str(),("r"+(string)histo->GetName()).c_str(),bins.size()-1,&bins[0]); |
1876 |
+ |
for(unsigned int i=0;i<vals.size();i++) { |
1877 |
+ |
h->SetBinContent(i+1,vals[i]); |
1878 |
+ |
h->SetBinError(i+1,errs[i]); |
1879 |
+ |
} |
1880 |
+ |
|
1881 |
+ |
h->GetXaxis()->SetTitle(histo->GetXaxis()->GetTitle()); |
1882 |
+ |
h->GetYaxis()->SetTitle(histo->GetYaxis()->GetTitle()); |
1883 |
+ |
|
1884 |
+ |
h->GetXaxis()->CenterTitle(); |
1885 |
+ |
h->GetYaxis()->CenterTitle(); |
1886 |
+ |
|
1887 |
+ |
return h; |
1888 |
+ |
} |
1889 |
+ |
|
1890 |
+ |
|
1891 |
+ |
TH1F* ReBinOptimizingStats(int nbins, TH1F *histo) { |
1892 |
+ |
float statsperbin = (1/(float)nbins) * histo->Integral(); |
1893 |
+ |
float val=0,err=0; |
1894 |
+ |
vector<float> bins; |
1895 |
+ |
vector<float> vals; |
1896 |
+ |
vector<float> errs; |
1897 |
+ |
|
1898 |
+ |
bins.push_back(histo->GetBinLowEdge(1)); |
1899 |
+ |
for(unsigned int i=1;i<=histo->GetNbinsX();i++) { |
1900 |
+ |
val+=histo->GetBinContent(i); |
1901 |
+ |
err=sqrt(err*err+histo->GetBinError(i)*histo->GetBinError(i)); |
1902 |
+ |
if( val/statsperbin > 0.85) { |
1903 |
+ |
if(bins.size()<nbins) { |
1904 |
+ |
bins.push_back(histo->GetBinLowEdge(i)+histo->GetBinWidth(i)); |
1905 |
+ |
vals.push_back(val);val=0; |
1906 |
+ |
errs.push_back(err);err=0; |
1907 |
+ |
} |
1908 |
+ |
} |
1909 |
+ |
if(i==histo->GetNbinsX()) { |
1910 |
+ |
bins.push_back(histo->GetBinLowEdge(i)+histo->GetBinWidth(i)); |
1911 |
+ |
vals.push_back(val);val=0; |
1912 |
+ |
errs.push_back(err);err=0; |
1913 |
+ |
} |
1914 |
+ |
} |
1915 |
+ |
TH1F *h = new TH1F(("r"+(string)histo->GetName()).c_str(),("r"+(string)histo->GetName()).c_str(),bins.size()-1,&bins[0]); |
1916 |
+ |
|
1917 |
+ |
h->GetXaxis()->SetTitle(histo->GetXaxis()->GetTitle()); |
1918 |
+ |
h->GetYaxis()->SetTitle(histo->GetYaxis()->GetTitle()); |
1919 |
+ |
|
1920 |
+ |
h->GetXaxis()->CenterTitle(); |
1921 |
+ |
h->GetYaxis()->CenterTitle(); |
1922 |
+ |
|
1923 |
+ |
for(unsigned int i=0;i<vals.size();i++) { |
1924 |
+ |
h->SetBinContent(i+1,vals[i]); |
1925 |
+ |
h->SetBinError(i+1,errs[i]); |
1926 |
+ |
} |
1927 |
+ |
|
1928 |
+ |
return h; |
1929 |
+ |
} |
1930 |
+ |
|
1931 |
+ |
|
1932 |
+ |
|
1933 |
+ |
void ShowBinning(TH1F *histo) { |
1934 |
+ |
cout << "Showing binning for " << histo->GetName() << " (\" " << histo->GetTitle() << "\")" << endl; |
1935 |
+ |
for(unsigned int i=1;i<=histo->GetNbinsX();i++) cout << " Bin " << i << " : " << histo->GetBinLowEdge(i) << " , " << histo->GetBinLowEdge(i) + histo->GetBinWidth(i) << " : " << histo->GetBinContent(i) << endl; |
1936 |
+ |
} |
1937 |
+ |
|
1938 |
+ |
void QuickProduceMCSystematicPlot(string variable, int nbins, float bmin, float bmax, string label, TCut thiscut, string saveas) { |
1939 |
+ |
TCanvas *ca = new TCanvas("ca","ca"); |
1940 |
+ |
TH1F *tScaleUp = systsamples.Draw("tScaleUp",variable,nbins,bmin,bmax,label,"events",thiscut,mc,luminosity,systsamples.FindSample("scaleup")); |
1941 |
+ |
TH1F *tScaleDown = systsamples.Draw("tScaleDown",variable,nbins,bmin,bmax,label,"events",thiscut,mc,luminosity,systsamples.FindSample("scaledown")); |
1942 |
+ |
TH1F *tMatchingUp = systsamples.Draw("tMatchingUp",variable,nbins,bmin,bmax,label,"events",thiscut,mc,luminosity,systsamples.FindSample("matchingup")); |
1943 |
+ |
TH1F *tMatchingDown = systsamples.Draw("tMatchingDown",variable,nbins,bmin,bmax,label,"events",thiscut,mc,luminosity,systsamples.FindSample("matchingdown")); |
1944 |
+ |
TH1F *tCentral = systsamples.Draw("tCentral",variable,nbins,bmin,bmax,label,"events",thiscut,mc,luminosity,systsamples.FindSample("TTJets_MassiveBinDECAY_TuneZ2sta")); |
1945 |
+ |
|
1946 |
+ |
tScaleUp->Scale(1.0/tScaleUp->Integral()); |
1947 |
+ |
tScaleDown->Scale(1.0/tScaleDown->Integral()); |
1948 |
+ |
tMatchingDown->Scale(1.0/tMatchingDown->Integral()); |
1949 |
+ |
tMatchingUp->Scale(1.0/tMatchingUp->Integral()); |
1950 |
+ |
tCentral->Scale(1.0/tCentral->Integral()); |
1951 |
+ |
|
1952 |
+ |
cout << "At this point we want to rebin the scale/matching histograms so we get decent stats!" << endl; |
1953 |
+ |
|
1954 |
+ |
|
1955 |
+ |
TH1F *rtScaleUp = ReBinOptimizingStats(7,tScaleUp); // using the scale up sample to get the binning (shouldn't use the central one for obvious reasons) |
1956 |
+ |
TH1F *rtScaleDown = ImposeBinning(rtScaleUp,tScaleDown); |
1957 |
+ |
TH1F *rtMatchingDown = ImposeBinning(rtScaleUp,tMatchingDown); |
1958 |
+ |
TH1F *rtMatchingUp = ImposeBinning(rtScaleUp,tMatchingUp); |
1959 |
+ |
TH1F *rtCentral = ImposeBinning(rtScaleUp,tCentral); |
1960 |
+ |
|
1961 |
+ |
float min=rtScaleUp->GetMinimum(); |
1962 |
+ |
float max=rtScaleUp->GetMaximum(); |
1963 |
+ |
|
1964 |
+ |
if(rtScaleDown->GetMinimum()<min) min=rtScaleDown->GetMinimum(); |
1965 |
+ |
if(rtMatchingDown->GetMinimum()<min) min=rtMatchingDown->GetMinimum(); |
1966 |
+ |
if(rtMatchingDown->GetMinimum()<min) min=rtMatchingDown->GetMinimum(); |
1967 |
+ |
if(rtMatchingUp->GetMinimum()<min) min=rtMatchingUp->GetMinimum(); |
1968 |
+ |
if(rtCentral->GetMinimum()<min) min=rtCentral->GetMinimum(); |
1969 |
+ |
|
1970 |
+ |
if(rtScaleDown->GetMaximum()<min) max=rtScaleDown->GetMaximum(); |
1971 |
+ |
if(rtMatchingDown->GetMaximum()<min) max=rtMatchingDown->GetMaximum(); |
1972 |
+ |
if(rtMatchingDown->GetMaximum()<min) max=rtMatchingDown->GetMaximum(); |
1973 |
+ |
if(rtMatchingUp->GetMaximum()<min) max=rtMatchingUp->GetMaximum(); |
1974 |
+ |
if(rtCentral->GetMaximum()<min) max=rtCentral->GetMaximum(); |
1975 |
+ |
|
1976 |
+ |
rtCentral->SetMaximum(1.2*max); |
1977 |
+ |
rtCentral->SetMinimum(0.8*min); |
1978 |
+ |
|
1979 |
+ |
/* tScaleUp->Rebin(40); |
1980 |
+ |
tScaleDown->Rebin(40); |
1981 |
+ |
tMatchingDown->Rebin(40); |
1982 |
+ |
tMatchingUp->Rebin(40); |
1983 |
+ |
tCentral->Rebin(40);*/ |
1984 |
+ |
|
1985 |
+ |
TPad *kinpad = new TPad("kinpad","kinpad",0,0,1,1); |
1986 |
+ |
kinpad->SetLogy(1); |
1987 |
+ |
kinpad->cd(); |
1988 |
+ |
tCentral->SetFillColor(kWhite); |
1989 |
+ |
tCentral->SetLineColor(kBlack); |
1990 |
+ |
tScaleUp->SetLineColor(kRed); |
1991 |
+ |
tScaleDown->SetLineColor(kRed); |
1992 |
+ |
tMatchingUp->SetLineColor(kBlue); |
1993 |
+ |
tMatchingDown->SetLineColor(kBlue); |
1994 |
+ |
tScaleUp->SetLineStyle(2); |
1995 |
+ |
tScaleDown->SetLineStyle(3); |
1996 |
+ |
tMatchingUp->SetLineStyle(2); |
1997 |
+ |
tMatchingDown->SetLineStyle(3); |
1998 |
+ |
|
1999 |
+ |
rtScaleDown->SetLineColor(kRed); |
2000 |
+ |
rtMatchingUp->SetLineColor(kBlue); |
2001 |
+ |
rtMatchingDown->SetLineColor(kBlue); |
2002 |
+ |
rtScaleUp->SetLineStyle(2); |
2003 |
+ |
rtScaleDown->SetLineStyle(3); |
2004 |
+ |
rtMatchingUp->SetLineStyle(2); |
2005 |
+ |
rtMatchingDown->SetLineStyle(3); |
2006 |
+ |
|
2007 |
+ |
TLegend *leg2 = make_legend(); |
2008 |
+ |
leg2->AddEntry(tCentral,"Central (ttbar)","l"); |
2009 |
+ |
leg2->AddEntry(tScaleUp,"ScaleUp (ttbar)","l"); |
2010 |
+ |
leg2->AddEntry(tScaleDown,"ScaleDown (ttbar)","l"); |
2011 |
+ |
leg2->AddEntry(tMatchingUp,"MatchingUp (ttbar)","l"); |
2012 |
+ |
leg2->AddEntry(tMatchingDown,"MatchingDown (ttbar)","l"); |
2013 |
+ |
|
2014 |
+ |
tCentral->Draw("histo"); |
2015 |
+ |
tScaleUp->Draw("histo,same"); |
2016 |
+ |
tScaleDown->Draw("histo,same"); |
2017 |
+ |
tMatchingUp->Draw("histo,same"); |
2018 |
+ |
tMatchingDown->Draw("histo,same"); |
2019 |
+ |
leg2->Draw(); |
2020 |
+ |
DrawMCPrelim(); |
2021 |
+ |
CompleteSave(kinpad,saveas+"__TTbarComparison"); |
2022 |
+ |
kinpad->cd(); |
2023 |
+ |
kinpad->SetLogy(0); |
2024 |
+ |
rtCentral->Draw("histo"); |
2025 |
+ |
rtScaleUp->Draw("histo,same"); |
2026 |
+ |
rtScaleDown->Draw("histo,same"); |
2027 |
+ |
rtMatchingUp->Draw("histo,same"); |
2028 |
+ |
rtMatchingDown->Draw("histo,same"); |
2029 |
+ |
leg2->Draw(); |
2030 |
+ |
DrawMCPrelim(); |
2031 |
+ |
CompleteSave(kinpad,saveas+"__TTbarComparison__REBINNED"); |
2032 |
+ |
|
2033 |
+ |
|
2034 |
+ |
gStyle->SetOptFit(0); |
2035 |
+ |
|
2036 |
+ |
kinpad->cd(); |
2037 |
+ |
kinpad->SetLogy(0); |
2038 |
+ |
TH1F *MatchingRatio = (TH1F*)rtMatchingUp->Clone("MatchingRatio"); |
2039 |
+ |
MatchingRatio->Divide(rtMatchingDown); |
2040 |
+ |
TLine *lone = new TLine(tScaleUp->GetBinLowEdge(1),1,tScaleUp->GetBinLowEdge(tScaleUp->GetNbinsX())+tScaleUp->GetBinWidth(tScaleUp->GetNbinsX()),1); |
2041 |
+ |
lone->SetLineColor(TColor::GetColor("#01DF01")); |
2042 |
+ |
lone->SetLineStyle(2); |
2043 |
+ |
TH1F *ScaleRatio = (TH1F*)rtScaleUp->Clone("ScaleRatio"); |
2044 |
+ |
ScaleRatio->Divide(rtScaleDown); |
2045 |
+ |
MatchingRatio->GetYaxis()->SetRangeUser(0,3); |
2046 |
+ |
MatchingRatio->Draw("e1"); |
2047 |
+ |
TF1 *QP1 = new TF1("QP1","[0]+[1]*x",50,200);//simple linear function ranging from 50 to 200 |
2048 |
+ |
if(variable=="genMET" || variable=="met[4]" || variable=="met[1]") MatchingRatio->Fit("QP1","RQ"); |
2049 |
+ |
lone->Draw(); |
2050 |
+ |
stringstream summary; |
2051 |
+ |
summary << " #splitline{Fit result for f(x) = a+bx :}{#splitline{a=" << DigitsAfterComma(QP1->GetParameter(0),4) << " +/- " << DigitsAfterComma(QP1->GetParError(0),4) << "}{b=" << DigitsAfterComma(QP1->GetParameter(1),4); |
2052 |
+ |
summary << " +/- " << DigitsAfterComma(QP1->GetParError(1),4) << "}}"; |
2053 |
+ |
TText *infobox = write_title(summary.str()); |
2054 |
+ |
infobox->SetX(0.75); |
2055 |
+ |
infobox->SetTextSize(0.03); |
2056 |
+ |
infobox->SetY(0.75); |
2057 |
+ |
if(variable=="genMET" || variable=="met[4]" || variable=="met[1]") infobox->Draw(); |
2058 |
+ |
DrawMCPrelim(); |
2059 |
+ |
CompleteSave(kinpad,saveas+"__TTbarComparison_MatchingUpDividedMatchingDown"); |
2060 |
+ |
kinpad->cd(); |
2061 |
+ |
ScaleRatio->GetYaxis()->SetRangeUser(0,3); |
2062 |
+ |
ScaleRatio->Draw("e1"); |
2063 |
+ |
if(variable=="genMET" || variable=="met[4]" || variable=="met[1]") ScaleRatio->Fit("QP1","RQ"); |
2064 |
+ |
summary.str(""); |
2065 |
+ |
summary << " #splitline{Fit result for f(x) = a+bx :}{#splitline{a=" << DigitsAfterComma(QP1->GetParameter(0),4) << " +/- " << DigitsAfterComma(QP1->GetParError(0),4) << "}{b=" << DigitsAfterComma(QP1->GetParameter(1),4); |
2066 |
+ |
summary << " +/- " << DigitsAfterComma(QP1->GetParError(1),4) << "}}"; |
2067 |
+ |
TText *infobox2 = write_title(summary.str()); |
2068 |
+ |
infobox2->SetX(0.75); |
2069 |
+ |
infobox2->SetTextSize(0.03); |
2070 |
+ |
infobox2->SetY(0.75); |
2071 |
+ |
if(variable=="genMET" || variable=="met[4]" || variable=="met[1]") infobox2->Draw(); |
2072 |
+ |
|
2073 |
+ |
lone->Draw(); |
2074 |
+ |
DrawMCPrelim(); |
2075 |
+ |
CompleteSave(kinpad,saveas+"__TTbarComparison_ScaleUpDividedScaleDown"); |
2076 |
+ |
|
2077 |
+ |
kinpad->cd(); |
2078 |
+ |
TH1F *SysMatching = (TH1F*)rtMatchingDown->Clone("SysMatching"); |
2079 |
+ |
TH1F *SysScale = (TH1F*)rtScaleDown->Clone("SysMatching"); |
2080 |
+ |
TH1F *SysHisto = (TH1F*)rtScaleDown->Clone("SysHisto"); |
2081 |
+ |
|
2082 |
+ |
for(int i=1;i<=SysScale->GetNbinsX();i++) { |
2083 |
+ |
float matching, scale; |
2084 |
+ |
bool AssumeFactor=false; |
2085 |
+ |
if(AssumeFactor) { |
2086 |
+ |
// assume that an upward/downward variation means a change by a constant factor, i.e. f(up) = alpha * f(central) |
2087 |
+ |
matching=0.; |
2088 |
+ |
scale=0.; |
2089 |
+ |
} else { |
2090 |
+ |
// assume that the central value is exactly between up & down, i.e. central = (up-down)/2 |
2091 |
+ |
matching = fabs( ( rtMatchingUp->GetBinContent(i) - rtMatchingDown->GetBinContent(i)) / (rtMatchingUp->GetBinContent(i) + rtMatchingDown->GetBinContent(i)) ); |
2092 |
+ |
scale = fabs( ( rtScaleUp->GetBinContent(i) - rtScaleDown->GetBinContent(i)) / (rtScaleUp->GetBinContent(i) + rtScaleDown->GetBinContent(i)) ); |
2093 |
+ |
} |
2094 |
+ |
|
2095 |
+ |
SysMatching->SetBinContent(i,1+matching); |
2096 |
+ |
SysScale->SetBinContent(i,1+scale); |
2097 |
+ |
SysHisto->SetBinContent(i,sqrt(matching*matching+scale*scale)+1); |
2098 |
+ |
} |
2099 |
+ |
|
2100 |
+ |
SysHisto->SetLineColor(kGreen); |
2101 |
+ |
|
2102 |
+ |
SysMatching->SetMaximum(3.0); |
2103 |
+ |
SysMatching->SetMinimum(0.0); |
2104 |
+ |
SysMatching->Draw("histo"); |
2105 |
+ |
SysScale->Draw("histo,same"); |
2106 |
+ |
SysHisto->Draw("histo,same"); |
2107 |
+ |
CompleteSave(kinpad,saveas+"__TTbarComparison_DerivedSystematic"); |
2108 |
+ |
|
2109 |
+ |
delete SysMatching; |
2110 |
+ |
delete SysScale; |
2111 |
+ |
|
2112 |
+ |
if(!Contains(variable,"gen")) { |
2113 |
+ |
TH1F *hdata = allsamples.Draw("hdata", variable,nbins,bmin,bmax,label,"events",thiscut,data,luminosity); |
2114 |
+ |
THStack smc = allsamples.DrawStack("smc",variable,nbins,bmin,bmax,label,"events",thiscut,mc,luminosity); |
2115 |
+ |
|
2116 |
+ |
TH1F *Systematic = (TH1F*)hdata->Clone("Systematic"); |
2117 |
+ |
|
2118 |
+ |
for(int i=1;i<=Systematic->GetNbinsX();i++) { |
2119 |
+ |
int iBin=SysHisto->FindBin(Systematic->GetBinCenter(i)); |
2120 |
+ |
if(iBin>SysHisto->GetNbinsX()) --iBin; // if we're over the end of the histo, use the last bin |
2121 |
+ |
float sys = SysHisto->GetBinContent(iBin)-1; |
2122 |
+ |
Systematic->SetBinContent(i,sys); |
2123 |
+ |
} |
2124 |
+ |
|
2125 |
+ |
kinpad->cd(); |
2126 |
+ |
TLegend *leg = allsamples.allbglegend(); |
2127 |
+ |
hdata->Draw(); |
2128 |
+ |
smc.Draw("histo,same"); |
2129 |
+ |
hdata->Draw("same"); |
2130 |
+ |
leg->Draw(); |
2131 |
+ |
DrawPrelim(); |
2132 |
+ |
save_with_ratio_and_sys_band( 0.0, hdata, CollapseStack(smc), kinpad->cd(), saveas+"__DataVsMC", false, false, "data/mc",Systematic ); |
2133 |
+ |
|
2134 |
+ |
delete Systematic; |
2135 |
+ |
delete hdata; |
2136 |
+ |
} |
2137 |
+ |
|
2138 |
+ |
|
2139 |
+ |
delete SysHisto; |
2140 |
+ |
delete tScaleUp; |
2141 |
+ |
delete tScaleDown; |
2142 |
+ |
delete tCentral; |
2143 |
+ |
delete tMatchingUp; |
2144 |
+ |
delete tMatchingDown; |
2145 |
+ |
delete rtScaleUp; |
2146 |
+ |
delete rtScaleDown; |
2147 |
+ |
delete rtCentral; |
2148 |
+ |
delete rtMatchingUp; |
2149 |
+ |
delete rtMatchingDown; |
2150 |
+ |
delete QP1; |
2151 |
+ |
delete infobox; |
2152 |
+ |
delete infobox2; |
2153 |
+ |
delete MatchingRatio; |
2154 |
+ |
delete ScaleRatio; |
2155 |
+ |
delete leg2; |
2156 |
+ |
CleanLegends(); |
2157 |
+ |
delete ca; |
2158 |
+ |
} |
2159 |
+ |
|
2160 |
+ |
void ProduceMCSystematicPlots() { |
2161 |
+ |
cout << "Getting ready to produce systematic plots " << endl; |
2162 |
+ |
TCut cutweightBKP = cutWeight; |
2163 |
+ |
|
2164 |
+ |
QuickProduceMCSystematicPlot("genMET",20,0,200,"gen#slash{E}_{T} [GeV]",cutOSSF&&cutnJets&&TCut("mll>20&&mll<70"),"MCSystPlots/genMET/ETH_SameFlavor"); |
2165 |
+ |
QuickProduceMCSystematicPlot("genMET",20,0,200,"gen#slash{E}_{T} [GeV]",cutOSOF&&cutnJets&&TCut("mll>20&&mll<70"),"MCSystPlots/genMET/ETH_OppositeFlavor"); |
2166 |
+ |
QuickProduceMCSystematicPlot("met[4]",20,0,200,"PF#slash{E}_{T} [GeV]",cutOSSF&&cutnJets&&TCut("mll>20&&mll<70"),"MCSystPlots/MET/ETH_SameFlavor"); |
2167 |
+ |
QuickProduceMCSystematicPlot("met[4]",20,0,200,"PF#slash{E}_{T} [GeV]",cutOSOF&&cutnJets&&TCut("mll>20&&mll<70"),"MCSystPlots/MET/ETH_OppositeFlavor"); |
2168 |
+ |
|
2169 |
+ |
QuickProduceMCSystematicPlot("genMET",20,0,200,"gen#slash{E}_{T} [GeV]",cutOSSF&&TCut("mll>20&&mll<70"),"MCSystPlots/genMET/ETH_SameFlavor_INCLUSIVE"); |
2170 |
+ |
QuickProduceMCSystematicPlot("genMET",20,0,200,"gen#slash{E}_{T} [GeV]",cutOSOF&&TCut("mll>20&&mll<70"),"MCSystPlots/genMET/ETH_OppositeFlavor_INCLUSIVE"); |
2171 |
+ |
QuickProduceMCSystematicPlot("genMET",20,0,200,"gen#slash{E}_{T} [GeV]",cutOSSF&&TCut("mll>120"),"MCSystPlots/genMET/ETH_SameFlavor_INCLUSIVE_HighMass"); |
2172 |
+ |
QuickProduceMCSystematicPlot("genMET",20,0,200,"gen#slash{E}_{T} [GeV]",cutOSOF&&TCut("mll>120"),"MCSystPlots/genMET/ETH_OppositeFlavor_INCLUSIVE_HighMass"); |
2173 |
+ |
|
2174 |
+ |
QuickProduceMCSystematicPlot("met[4]",20,0,200,"PF#slash{E}_{T} [GeV]",cutOSSF&&TCut("mll>20&&mll<70"),"MCSystPlots/MET/ETH_SameFlavor_INCLUSIVE"); |
2175 |
+ |
QuickProduceMCSystematicPlot("met[4]",20,0,200,"PF#slash{E}_{T} [GeV]",cutOSOF&&TCut("mll>20&&mll<70"),"MCSystPlots/MET/ETH_OppositeFlavor_INCLUSIVE"); |
2176 |
+ |
QuickProduceMCSystematicPlot("met[4]",20,0,200,"PF#slash{E}_{T} [GeV]",cutOSSF&&TCut("mll>120"),"MCSystPlots/MET/ETH_SameFlavor_INCLUSIVE_HighMass"); |
2177 |
+ |
QuickProduceMCSystematicPlot("met[4]",20,0,200,"PF#slash{E}_{T} [GeV]",cutOSOF&&TCut("mll>120"),"MCSystPlots/MET/ETH_OppositeFlavor_INCLUSIVE_HighMass"); |
2178 |
+ |
QuickProduceMCSystematicPlot("pfJetGoodNum40",8,-0.5,7.5,"NJets",cutOSSF&&cutnJets&&TCut("mll>20&&mll<70&&met[4]>100"),"MCSystPlots/NJets/ETH_SameFlavor"); |
2179 |
+ |
QuickProduceMCSystematicPlot("pfJetGoodNum40",8,-0.5,7.5,"NJets",cutOSOF&&cutnJets&&TCut("mll>20&&mll<70&&met[4]>100"),"MCSystPlots/NJets/ETH_OppositeFlavor"); |
2180 |
+ |
|
2181 |
+ |
|
2182 |
+ |
|
2183 |
+ |
cout << "Kicking cutWeight " << (const char*) cutWeight << endl; |
2184 |
+ |
cout << "Keeping OSSF cut " << (const char*)cutOSSF << endl; |
2185 |
+ |
cutWeight="1.0"; |
2186 |
+ |
|
2187 |
+ |
QuickProduceMCSystematicPlot("genMET",20,0,200,"gen#slash{E}_{T} [GeV]",cutOSSF&&TCut("mll>20&&mll<70"),"MCSystPlots/genMET/ETH_SameFlavor_INCLUSIVE__NOPURW"); |
2188 |
+ |
QuickProduceMCSystematicPlot("genMET",20,0,200,"gen#slash{E}_{T} [GeV]",cutOSOF&&TCut("mll>20&&mll<70"),"MCSystPlots/genMET/ETH_OppositeFlavor_INCLUSIVE__NOPURW"); |
2189 |
+ |
QuickProduceMCSystematicPlot("genMET",20,0,200,"gen#slash{E}_{T} [GeV]",cutOSSF&&TCut("mll>120"),"MCSystPlots/genMET/ETH_SameFlavor_INCLUSIVE_HighMass__NOPURW"); |
2190 |
+ |
QuickProduceMCSystematicPlot("genMET",20,0,200,"gen#slash{E}_{T} [GeV]",cutOSOF&&TCut("mll>120"),"MCSystPlots/genMET/ETH_OppositeFlavor_INCLUSIVE_HighMass__NOPURW"); |
2191 |
+ |
|
2192 |
+ |
QuickProduceMCSystematicPlot("met[4]",20,0,200,"PF#slash{E}_{T} [GeV]",cutOSSF&&TCut("mll>20&&mll<70"),"MCSystPlots/MET/ETH_SameFlavor_INCLUSIVE__NOPURW"); |
2193 |
+ |
QuickProduceMCSystematicPlot("met[4]",20,0,200,"PF#slash{E}_{T} [GeV]",cutOSOF&&TCut("mll>20&&mll<70"),"MCSystPlots/MET/ETH_OppositeFlavor_INCLUSIVE__NOPURW"); |
2194 |
+ |
QuickProduceMCSystematicPlot("met[4]",20,0,200,"PF#slash{E}_{T} [GeV]",cutOSSF&&TCut("mll>120"),"MCSystPlots/MET/ETH_SameFlavor_INCLUSIVE_HighMass__NOPURW"); |
2195 |
+ |
QuickProduceMCSystematicPlot("met[4]",20,0,200,"PF#slash{E}_{T} [GeV]",cutOSOF&&TCut("mll>120"),"MCSystPlots/MET/ETH_OppositeFlavor_INCLUSIVE_HighMass__NOPURW"); |
2196 |
+ |
|
2197 |
+ |
|
2198 |
+ |
// -------------------------------------- ***** AACHEN ***** -------------------------------------- |
2199 |
+ |
|
2200 |
+ |
/* |
2201 |
+ |
cutWeight=cutweightBKP; |
2202 |
+ |
TCut essentialcutBKP = essentialcut; |
2203 |
+ |
cout << (const char*) essentialcut << endl; |
2204 |
+ |
|
2205 |
+ |
essentialcut = TCut((ReplaceAll((const char*)essentialcut,"pt2>20","pt2>10")).c_str()); |
2206 |
+ |
essentialcut = TCut((ReplaceAll((const char*)essentialcut,"abs(eta1)<1.4","abs(eta1)<2.4")).c_str()); |
2207 |
+ |
essentialcut = TCut((ReplaceAll((const char*)essentialcut,"abs(eta2)<1.4","abs(eta2)<2.4")).c_str()); |
2208 |
+ |
|
2209 |
+ |
TCut cutnJetsBKP = cutnJets; |
2210 |
+ |
cutnJets = TCut((ReplaceAll((const char*)cutnJets,"pt2>20","pt2>10")).c_str()); |
2211 |
+ |
cutnJets = TCut((ReplaceAll((const char*)cutnJets,"pfJetGoodNum40>=3","pfJetGoodNum40>=2")).c_str()); |
2212 |
+ |
cutnJets = TCut((ReplaceAll((const char*)cutnJets,"abs(eta2)<1.4","abs(eta2)<2.4")).c_str()); |
2213 |
+ |
cutnJets = TCut((ReplaceAll((const char*)cutnJets,"abs(eta1)<1.4","abs(eta1)<2.4")).c_str()); |
2214 |
+ |
|
2215 |
+ |
QuickProduceMCSystematicPlot("genMET",20,0,200,"gen#slash{E}_{T} [GeV]",cutOSSF&&cutnJets&&TCut("mll>20&&mll<70"),"MCSystPlots/genMET/Aachen_SameFlavor"); |
2216 |
+ |
QuickProduceMCSystematicPlot("genMET",20,0,200,"gen#slash{E}_{T} [GeV]",cutOSOF&&cutnJets&&TCut("mll>20&&mll<70"),"MCSystPlots/genMET/Aachen_OppositeFlavor"); |
2217 |
+ |
QuickProduceMCSystematicPlot("met[4]",20,0,200,"PF#slash{E}_{T} [GeV]",cutOSSF&&cutnJets&&TCut("mll>20&&mll<70"),"MCSystPlots/MET/Aachen_SameFlavor"); |
2218 |
+ |
QuickProduceMCSystematicPlot("met[4]",20,0,200,"PF#slash{E}_{T} [GeV]",cutOSOF&&cutnJets&&TCut("mll>20&&mll<70"),"MCSystPlots/MET/Aachen_OppositeFlavor"); |
2219 |
+ |
|
2220 |
+ |
QuickProduceMCSystematicPlot("genMET",20,0,200,"gen#slash{E}_{T} [GeV]",cutOSSF&&TCut("mll>20&&mll<70"),"MCSystPlots/genMET/Aachen_SameFlavor_INCLUSIVE"); |
2221 |
+ |
QuickProduceMCSystematicPlot("genMET",20,0,200,"gen#slash{E}_{T} [GeV]",cutOSOF&&TCut("mll>20&&mll<70"),"MCSystPlots/genMET/Aachen_OppositeFlavor_INCLUSIVE"); |
2222 |
+ |
QuickProduceMCSystematicPlot("genMET",20,0,200,"gen#slash{E}_{T} [GeV]",cutOSSF&&TCut("mll>120"),"MCSystPlots/genMET/Aachen_SameFlavor_INCLUSIVE_HighMass"); |
2223 |
+ |
QuickProduceMCSystematicPlot("genMET",20,0,200,"gen#slash{E}_{T} [GeV]",cutOSOF&&TCut("mll>120"),"MCSystPlots/genMET/Aachen_OppositeFlavor_INCLUSIVE_HighMass"); |
2224 |
+ |
|
2225 |
+ |
QuickProduceMCSystematicPlot("met[4]",20,0,200,"PF#slash{E}_{T} [GeV]",cutOSSF&&TCut("mll>20&&mll<70"),"MCSystPlots/MET/Aachen_SameFlavor_INCLUSIVE"); |
2226 |
+ |
QuickProduceMCSystematicPlot("met[4]",20,0,200,"PF#slash{E}_{T} [GeV]",cutOSOF&&TCut("mll>20&&mll<70"),"MCSystPlots/MET/Aachen_OppositeFlavor_INCLUSIVE"); |
2227 |
+ |
QuickProduceMCSystematicPlot("met[4]",20,0,200,"PF#slash{E}_{T} [GeV]",cutOSSF&&TCut("mll>120"),"MCSystPlots/MET/Aachen_SameFlavor_INCLUSIVE_HighMass"); |
2228 |
+ |
QuickProduceMCSystematicPlot("met[4]",20,0,200,"PF#slash{E}_{T} [GeV]",cutOSOF&&TCut("mll>120"),"MCSystPlots/MET/Aachen_OppositeFlavor_INCLUSIVE_HighMass"); |
2229 |
+ |
QuickProduceMCSystematicPlot("pfJetGoodNum40",8,-0.5,7.5,"NJets",cutOSSF&&cutnJets&&TCut("mll>20&&mll<70&&met[4]>100"),"MCSystPlots/NJets/Aachen_SameFlavor"); |
2230 |
+ |
QuickProduceMCSystematicPlot("pfJetGoodNum40",8,-0.5,7.5,"NJets",cutOSOF&&cutnJets&&TCut("mll>20&&mll<70&&met[4]>100"),"MCSystPlots/NJets/Aachen_OppositeFlavor"); |
2231 |
+ |
|
2232 |
+ |
|
2233 |
+ |
|
2234 |
+ |
cout << "Kicking cutWeight " << (const char*) cutWeight << endl; |
2235 |
+ |
cout << "Keeping OSSF cut " << (const char*)cutOSSF << endl; |
2236 |
+ |
cutWeight="1.0"; |
2237 |
+ |
|
2238 |
+ |
QuickProduceMCSystematicPlot("genMET",20,0,200,"gen#slash{E}_{T} [GeV]",cutOSSF&&TCut("mll>20&&mll<70"),"MCSystPlots/genMET/Aachen_SameFlavor_INCLUSIVE__NOPURW"); |
2239 |
+ |
QuickProduceMCSystematicPlot("genMET",20,0,200,"gen#slash{E}_{T} [GeV]",cutOSOF&&TCut("mll>20&&mll<70"),"MCSystPlots/genMET/Aachen_OppositeFlavor_INCLUSIVE__NOPURW"); |
2240 |
+ |
QuickProduceMCSystematicPlot("genMET",20,0,200,"gen#slash{E}_{T} [GeV]",cutOSSF&&TCut("mll>120"),"MCSystPlots/genMET/Aachen_SameFlavor_INCLUSIVE_HighMass__NOPURW"); |
2241 |
+ |
QuickProduceMCSystematicPlot("genMET",20,0,200,"gen#slash{E}_{T} [GeV]",cutOSOF&&TCut("mll>120"),"MCSystPlots/genMET/Aachen_OppositeFlavor_INCLUSIVE_HighMass__NOPURW"); |
2242 |
+ |
|
2243 |
+ |
QuickProduceMCSystematicPlot("met[4]",20,0,200,"PF#slash{E}_{T} [GeV]",cutOSSF&&TCut("mll>20&&mll<70"),"MCSystPlots/MET/Aachen_SameFlavor_INCLUSIVE__NOPURW"); |
2244 |
+ |
QuickProduceMCSystematicPlot("met[4]",20,0,200,"PF#slash{E}_{T} [GeV]",cutOSOF&&TCut("mll>20&&mll<70"),"MCSystPlots/MET/Aachen_OppositeFlavor_INCLUSIVE__NOPURW"); |
2245 |
+ |
QuickProduceMCSystematicPlot("met[4]",20,0,200,"PF#slash{E}_{T} [GeV]",cutOSSF&&TCut("mll>120"),"MCSystPlots/MET/Aachen_SameFlavor_INCLUSIVE_HighMass__NOPURW"); |
2246 |
+ |
QuickProduceMCSystematicPlot("met[4]",20,0,200,"PF#slash{E}_{T} [GeV]",cutOSOF&&TCut("mll>120"),"MCSystPlots/MET/Aachen_OppositeFlavor_INCLUSIVE_HighMass__NOPURW"); |
2247 |
+ |
|
2248 |
+ |
cutnJets = cutnJetsBKP; |
2249 |
+ |
cutWeight = cutweightBKP; |
2250 |
+ |
essentialcut = essentialcutBKP; |
2251 |
+ |
*/ |
2252 |
+ |
write_error(__FUNCTION__,"Still need to add systematic shape");assert(0); |
2253 |
+ |
} |
2254 |
+ |
|
2255 |
+ |
void MakeTauPlot(string label, TCut pcut, string filename, bool TauOnly) { |
2256 |
+ |
TCut cut=pcut&&basiccut; |
2257 |
+ |
string variable="mll"; |
2258 |
+ |
string xlabel="m_{ll} [GeV]"; |
2259 |
+ |
int nbins=40; |
2260 |
+ |
float min=0; |
2261 |
+ |
float max=200; |
2262 |
+ |
|
2263 |
+ |
TCanvas *ckin = new TCanvas("ckin","Kinematic Plots (in the making)",600,600); |
2264 |
+ |
TH1F *datahistoSF = allsamples.Draw("datahistoSF",variable,nbins,min,max, xlabel, "events",cut&&cutOSSF,data,luminosity); |
2265 |
+ |
TH1F *datahistoOF = allsamples.Draw("datahistoOF",variable,nbins,min,max, xlabel, "events",cut&&cutOSOF,data,luminosity); |
2266 |
+ |
TH1F *tauSF = allsamples.Draw("tauSF",variable,nbins,min,max, xlabel, "events",cut&&cutOSSF,data,luminosity,systsamples.FindSample("DYToTauTau")); |
2267 |
+ |
TH1F *tauOF = allsamples.Draw("tauOF",variable,nbins,min,max, xlabel, "events",cut&&cutOSOF,data,luminosity,systsamples.FindSample("DYToTauTau")); |
2268 |
+ |
datahistoSF->SetMarkerSize(DataMarkerSize); |
2269 |
+ |
datahistoSF->SetMaximum(1.3*datahistoSF->GetMaximum()); |
2270 |
+ |
datahistoOF->SetMarkerSize(DataMarkerSize); |
2271 |
+ |
datahistoOF->SetMaximum(1.3*datahistoOF->GetMaximum()); |
2272 |
+ |
|
2273 |
+ |
THStack mcstackSF = allsamples.DrawStack("mcstackSF", variable,nbins,min,max,xlabel,"events",cut&&cutOSSF,mc,luminosity); |
2274 |
+ |
THStack mcstackOF = allsamples.DrawStack("mcstackOF", variable,nbins,min,max,xlabel,"events",cut&&cutOSOF,mc,luminosity); |
2275 |
+ |
datahistoSF->Draw("e1"); |
2276 |
+ |
ckin->Update(); |
2277 |
+ |
mcstackSF.Draw("histo,same"); |
2278 |
+ |
|
2279 |
+ |
datahistoSF->Draw("same,e1"); |
2280 |
+ |
TLegend *kinleg = allsamples.allbglegend(); |
2281 |
+ |
kinleg->Draw(); |
2282 |
+ |
|
2283 |
+ |
TPad *kinpad = new TPad("kinpad","kinpad",0,0,1,1); |
2284 |
+ |
kinpad->cd(); |
2285 |
+ |
datahistoSF->Draw("e1"); |
2286 |
+ |
mcstackSF.Draw("histo,same"); |
2287 |
+ |
datahistoSF->Draw("same,e1"); |
2288 |
+ |
datahistoSF->Draw("same,axis"); |
2289 |
+ |
kinleg->Draw(); |
2290 |
+ |
DrawPrelim(); |
2291 |
+ |
Save_With_Ratio(datahistoSF,mcstackSF,kinpad->cd(),filename+"__SF_mc"); |
2292 |
+ |
|
2293 |
+ |
kinpad->cd(); |
2294 |
+ |
datahistoOF->Draw("e1"); |
2295 |
+ |
mcstackOF.Draw("histo,same"); |
2296 |
+ |
datahistoOF->Draw("same,e1"); |
2297 |
+ |
datahistoOF->Draw("same,axis"); |
2298 |
+ |
kinleg->Draw(); |
2299 |
+ |
DrawPrelim(); |
2300 |
+ |
Save_With_Ratio(datahistoOF,mcstackOF,kinpad->cd(),filename+"__OF_mc"); |
2301 |
+ |
|
2302 |
+ |
kinpad->cd(); |
2303 |
+ |
tauSF->Draw("e1"); |
2304 |
+ |
tauOF->Draw("histo,same"); |
2305 |
+ |
tauSF->Draw("e1,same"); |
2306 |
+ |
TLegend *legtau = make_legend(); |
2307 |
+ |
legtau->AddEntry(tauSF,"DY->#tau#tau, SF","p"); |
2308 |
+ |
legtau->AddEntry(tauSF,"DY->#tau#tau, OF","l"); |
2309 |
+ |
legtau->Draw(); |
2310 |
+ |
DrawPrelim(); |
2311 |
+ |
Save_With_Ratio(tauSF,tauOF,kinpad->cd(),filename+"__Tau_SF_vs_OF"); |
2312 |
+ |
|
2313 |
+ |
delete datahistoSF; |
2314 |
+ |
delete datahistoOF; |
2315 |
+ |
delete tauSF; |
2316 |
+ |
delete tauOF; |
2317 |
+ |
delete kinpad; |
2318 |
+ |
delete ckin; |
2319 |
+ |
CleanLegends(); |
2320 |
+ |
} |
2321 |
+ |
|
2322 |
+ |
|
2323 |
+ |
void TauQuestion() { |
2324 |
+ |
// MakeTauPlot("MET>100 GeV, #geq 3 jets",cutnJets&&TCut("met[4]>100"),"TauQ/MET100_3Jets",true); |
2325 |
+ |
// MakeTauPlot("MET>100 GeV",TCut("met[4]>100"),"TauQ/MET100",true); |
2326 |
+ |
// MakeTauPlot("MET>0 GeV",TCut("met[4]>0"),"TauQ/MET0",true); |
2327 |
+ |
MakeTauPlot("b-tag veto, 50<MET<100",TCut("pfJetGoodNumBtag30==0&&met[4]>50&&met[4]<100"),"TauQ/ControlPlots",false); |
2328 |
+ |
} |
2329 |
+ |
|
2330 |
+ |
void ProduceOFSFPlots(string mcjzb, string datajzb, bool isAachen) { |
2331 |
+ |
string BaseMetCut="met[4]>100"; |
2332 |
+ |
string Prefix="ETH/"; |
2333 |
+ |
if(isAachen) { |
2334 |
+ |
BaseMetCut="met[4]>150"; |
2335 |
+ |
Prefix="Aachen/"; |
2336 |
+ |
} |
2337 |
+ |
// make_OFSF_plots("st", BaseMetCut, 20, 0, 2000., false, "S_{T}", Prefix+"FrankT"); |
2338 |
+ |
make_OFSF_plots("mt2j", BaseMetCut, 35, 0, 700., false, "M_{T2J}", Prefix+"MT2J"); |
2339 |
+ |
|
2340 |
+ |
make_OFSF_plots("ml1b", BaseMetCut, 20, 0, 800., false, "m_{l_{1}b}", Prefix+"ML1B"); |
2341 |
+ |
make_OFSF_plots("ml2b", BaseMetCut, 20, 0, 400., false, "m_{l_{2}b}", Prefix+"ML2B"); |
2342 |
+ |
make_OFSF_plots("min(ml1b,ml2b)", BaseMetCut, 20, 0, 400., false, "m_{lb}", Prefix+"MLB"); |
2343 |
+ |
|
2344 |
+ |
// make_OFSF_plots(datajzb, BaseMetCut, 55, -100, 450., false, "JZB", Prefix+"JZB_In_Signal_Region"); |
2345 |
+ |
make_OFSF_plots("mt2", BaseMetCut, 15, 0, 150., false, "M_{T2}", Prefix+"MT2"); |
2346 |
+ |
make_OFSF_plots("d2", BaseMetCut, 20, 0, 200., true, "D2", Prefix+"D2"); |
2347 |
+ |
make_OFSF_plots("pfJetGoodNum40", BaseMetCut, 10, -0.5, 9.5, true, "N_{jets}", Prefix+"nJets"); |
2348 |
+ |
|
2349 |
+ |
// make_OFSF_plots("mll", BaseMetCut, 60, 20., 320., false, "m_{ll}", Prefix+"mll"); |
2350 |
+ |
// make_OFSF_plots("leptonNum", BaseMetCut, 3, 2, 5., false, "N(leptons)", Prefix+"NLeptons"); |
2351 |
+ |
|
2352 |
+ |
// make_OFSF_plots("pfJetGoodNum40", BaseMetCut, 7, 3, 10, true, "#(jets)", Prefix+"njets"); |
2353 |
+ |
// make_OFSF_plots("pfJetGoodNum40", BaseMetCut+"&&pfJetGoodNumBtag30==0", 7, 3, 10, true, "#(jets)", Prefix+"njets_btagVeto"); |
2354 |
+ |
// make_OFSF_plots("pfJetGoodNum40", BaseMetCut"&&pfJetGoodNumBtag30>0", 7, 3, 10, true, "#(jets)", Prefix+"njets_AtLeastOneBJet30"); |
2355 |
+ |
|
2356 |
+ |
// make_OFSF_plots("pfJetGoodNumBtag30", BaseMetCut, 5, -0.5, 4.5, true, "N_{b-jets}", Prefix+"nbjets"); |
2357 |
+ |
// make_OFSF_plots("pfJetGoodPtBtag[0]", BaseMetCut+"&&pfJetGoodNumBtag30>0", 20, 0, 400, true, "p_{T}(leading b-jet)", Prefix+"ptb1"); |
2358 |
+ |
// make_OFSF_plots("pfJetGoodPt", BaseMetCut, 30, 0., 400., true, "p_{T}^{J}", Prefix+"ptJet"); |
2359 |
+ |
|
2360 |
+ |
// make_OFSF_plots("iso1", BaseMetCut, 20, 0, 0.3, true, "lepton 1 isolation", Prefix+"iso1"); |
2361 |
+ |
// make_OFSF_plots("iso2", BaseMetCut, 20, 0, 0.3, true, "lepton 2 isolation", Prefix+"iso2"); |
2362 |
+ |
make_OFSF_plots("pt", BaseMetCut, 30, 0., 300., true, "p_{ll}", Prefix+"pt"); |
2363 |
+ |
make_OFSF_plots("pt1", BaseMetCut, 30, 0., 300., true, "p_{T,1}", Prefix+"pt1"); |
2364 |
+ |
make_OFSF_plots("pt2", BaseMetCut, 22, 0., 220., true, "p_{T,2}", Prefix+"pt2"); |
2365 |
+ |
// make_OFSF_plots("eta1", BaseMetCut, 10, -2.5, 2.5, false, "#eta_{1}", Prefix+"eta1", 0.15); |
2366 |
+ |
// make_OFSF_plots("eta2", BaseMetCut, 10, -2.5, 2.5, false, "#eta_{2}", Prefix+"eta2", 0.15); |
2367 |
+ |
// make_OFSF_plots("phi1", BaseMetCut, 10, -TMath::Pi(), TMath::Pi(), false, "#phi_{1}", Prefix+"phi1", 0.2); |
2368 |
+ |
// make_OFSF_plots("phi2", BaseMetCut, 10, -TMath::Pi(), TMath::Pi(), false, "#phi_{2}", Prefix+"phi2", 0.2); |
2369 |
+ |
// make_OFSF_plots("pfJetGoodPt[0]/pfJetGoodPt[1]", BaseMetCut, 20, 1, 10, true, "pt_{j}^{1}/pt_{j}^{2}", Prefix+"jpt1pt2", 0.2); |
2370 |
+ |
// make_OFSF_plots("TMath::Abs(pfJetDphiMet[0])", BaseMetCut, 16, 0, 3.2, false, "|#Delta#phi(jet1,MET)|", Prefix+"dphij1met", 0.2); |
2371 |
+ |
|
2372 |
+ |
// make_OFSF_plots("met[4]", BaseMetCut, 30, 100., 400., true, "E_{T}^{miss}", Prefix+"MET"); |
2373 |
+ |
// make_OFSF_plots("TMath::Abs(dphi)", BaseMetCut, 16, 0, 3.2, false, "|#Delta#phi(l1,l2)|", Prefix+"dphi", 0.2); |
2374 |
+ |
// make_OFSF_plots("TMath::Abs(dphiMet1)", BaseMetCut, 16, 0, 3.2, false, "|#Delta#phi(l1,MET)|", Prefix+"dphiMet1", 0.2); |
2375 |
+ |
// make_OFSF_plots("TMath::Abs(dphiMet2)", BaseMetCut, 16, 0, 3.2, false, "|#Delta#phi(l2,MET)|", Prefix+"dphiMet2", 0.2); |
2376 |
+ |
// make_OFSF_plots("TMath::Min(TMath::Abs(dphiMet1), TMath::Abs(dphiMet2))", BaseMetCut, 16, 0, 3.2, false, "Min(|#Delta#phi(l,MET)|)", Prefix+"dphilc"); |
2377 |
+ |
// 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"); |
2378 |
+ |
// 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"); |
2379 |
+ |
// make_OFSF_plots("TMath::Min((TMath::Pi()-TMath::Abs(pfJetDphiMet[0])), TMath::Min( (TMath::Pi()-TMath::Abs(pfJetDphiMet[1])), (TMath::Pi() - TMath::Abs(pfJetDphiMet[2]))))", BaseMetCut, 16, 0, 3.2, false, "Min(#pi - |#Delta#phi(jet,MET)|)", Prefix+"dphijco"); |
2380 |
+ |
|
2381 |
+ |
} |
2382 |
|
|
2383 |
+ |
void ProduceOFSFPlots(string mcjzb, string datajzb) { |
2384 |
+ |
|
2385 |
+ |
|
2386 |
+ |
//FIRST : ETH SELECTION |
2387 |
+ |
ProduceOFSFPlots(mcjzb,datajzb,0); // this is the ETH selection |
2388 |
+ |
|
2389 |
+ |
|
2390 |
+ |
|
2391 |
+ |
string backup_cutnJets = (const char*)cutnJets; |
2392 |
+ |
cutnJets = ReplaceInCut(cutnJets,"pfJetGoodNum40>=3","pfJetGoodNum40>=2"); |
2393 |
+ |
cutnJets = ReplaceInCut(cutnJets,"1.4","2.4"); |
2394 |
+ |
|
2395 |
+ |
string backup_basiccut = (const char*)basiccut; |
2396 |
+ |
basiccut = ReplaceInCut(basiccut,"1.4","2.4"); |
2397 |
+ |
|
2398 |
+ |
string backup_essential = (const char*) essentialcut; |
2399 |
+ |
essentialcut = ReplaceInCut(essentialcut,"1.4","2.4"); |
2400 |
+ |
|
2401 |
+ |
ProduceOFSFPlots(mcjzb,datajzb,1); // this is the Aachen selection |
2402 |
+ |
|
2403 |
+ |
cutnJets = TCut(backup_cutnJets.c_str()); |
2404 |
+ |
basiccut = TCut(backup_basiccut.c_str()); |
2405 |
+ |
essentialcut = TCut(backup_essential.c_str()); |
2406 |
|
} |
2407 |
+ |
|
2408 |
|
|
2409 |
|
void do_kinematic_plots(string mcjzb, string datajzb, bool doPF=false) |
2410 |
|
{ |
2411 |
+ |
// switch_overunderflow(true); |
2412 |
|
bool dolog=true; |
2413 |
|
bool nolog=false; |
2414 |
+ |
|
2415 |
+ |
bool doOFSF = true; |
2416 |
+ |
bool doKin = false; |
2417 |
+ |
bool doDataComp = false; |
2418 |
+ |
bool MakeTwoThreeJetComparison = false; |
2419 |
+ |
|
2420 |
+ |
|
2421 |
|
if(doPF) write_warning(__FUNCTION__,"Please use caution when trying to produce PF plots; not all versions of the JZB trees have these variables!"); |
2422 |
|
float mll_low=50; |
2423 |
|
float mll_hi=160; |
2424 |
|
if(!PlottingSetup::RestrictToMassPeak) { |
2425 |
|
mll_low=20; |
2426 |
< |
mll_hi=300; |
2426 |
> |
mll_hi=320; |
2427 |
|
} |
2428 |
+ |
|
2429 |
+ |
if(MakeTwoThreeJetComparison) MakeElegantTwoThreeComparisons(); |
2430 |
+ |
|
2431 |
+ |
//TauQuestion(); |
2432 |
|
|
2433 |
< |
make_OFSF_plot("pfJetGoodNum40", "mll>20&&mll<40&&met[4]>100", "20 GeV < mll < 40 GeV", 5, 3, 8, true, "N. jets", "njetsLow", false, false, false, 0.2); |
2434 |
< |
make_OFSF_plot("pfJetGoodNum40", "mll>40&&mll<70&&met[4]>100", "40 GeV < mll < 70 GeV", 5, 3, 8, true, "N. jets", "njetsMed", false, false, false, 0.2); |
2435 |
< |
make_OFSF_plot("pfJetGoodPt[0]/pfJetGoodPt[1]", "mll>20&&mll<40&&met[4]>100", "20 GeV < mll < 40 GeV", 20, 1, 10, true, "pt_{j}^{1}/pt_{j}^{2}", "jpt1pt2Low", false, false, false, 0.2); |
2436 |
< |
make_OFSF_plot("pfJetGoodPt[0]/pfJetGoodPt[1]", "mll>40&&mll<70&&met[4]>100", "40 GeV < mll < 70 GeV", 20, 1, 10, true, "pt_{j}^{1}/pt_{j}^{2}", "jpt1pt2Med", false, false, false, 0.2); |
2437 |
< |
make_OFSF_plot("TMath::Abs(pfJetDphiMet[0])", "mll>20&&mll<40&&met[4]>100", "20 GeV < mll < 40 GeV", 16, 0, 3.2, false, "|#Delta#phi(jet1,MET)|", "dphijetmetLow", false, false, false, 0.0); |
2438 |
< |
make_OFSF_plot("TMath::Abs(pfJetDphiMet[0])", "mll>40&&mll<70&&met[4]>100", "40 GeV < mll < 70 GeV", 16, 0, 3.2, false, "|#Delta#phi(jet1,MET)|", "dphijetmetMed", false, false, false, 0.0); |
2439 |
< |
make_OFSF_plot("TMath::Abs(dphi)", "mll>20&&mll<40&&met[4]>100", "20 GeV < mll < 40 GeV", 16, 0, 3.2, false, "|#Delta#phi(l1,l2)|", "dphiLow", false, false, false, 0.2); |
669 |
< |
make_OFSF_plot("TMath::Abs(dphi)", "mll>40&&mll<70&&met[4]>100", "40 GeV < mll < 70 GeV", 16, 0, 3.2, false, "|#Delta#phi(l1,l2)|", "dphiMed", false, false, false, 0.2); |
670 |
< |
make_OFSF_plot("TMath::Abs(dphiMet1)", "mll>20&&mll<40&&met[4]>100", "20 GeV < mll < 40 GeV", 16, 0, 3.2, false, "|#Delta#phi(l1,MET)|", "dphiMet1Low", false, false, false, 0.2); |
671 |
< |
make_OFSF_plot("TMath::Abs(dphiMet1)", "mll>40&&mll<70&&met[4]>100", "40 GeV < mll < 70 GeV", 16, 0, 3.2, false, "|#Delta#phi(l1,MET)|", "dphiMet1Med", false, false, false, 0.2); |
672 |
< |
make_OFSF_plot("TMath::Abs(dphiMet2)", "mll>20&&mll<40&&met[4]>100", "20 GeV < mll < 40 GeV", 16, 0, 3.2, false, "|#Delta#phi(l2,MET)|", "dphiMet2Low", false, false, false, 0.2); |
673 |
< |
make_OFSF_plot("TMath::Abs(dphiMet2)", "mll>40&&mll<70&&met[4]>100", "40 GeV < mll < 70 GeV", 16, 0, 3.2, false, "|#Delta#phi(l2,MET)|", "dphiMet2Med", false, false, false, 0.2); |
674 |
< |
make_OFSF_plot("TMath::Min(TMath::Abs(dphiMet1), TMath::Abs(dphiMet2))", "mll>20&&mll<40&&met[4]>100", "20 GeV < mll < 40 GeV", 16, 0, 3.2, false, "Min(|#Delta#phi(l,MET)|)", "dphilcLow", false, false, false, 0.2); |
675 |
< |
make_OFSF_plot("TMath::Min(TMath::Abs(dphiMet1), TMath::Abs(dphiMet2))", "mll>40&&mll<70&&met[4]>100", "40 GeV < mll < 70 GeV", 16, 0, 3.2, false, "Min(|#Delta#phi(l,MET)|)", "dphilcMed", false, false, false, 0.2); |
676 |
< |
make_OFSF_plot("TMath::Min(TMath::Abs(pfJetDphiMet[0]), TMath::Min(TMath::Abs(pfJetDphiMet[1]), TMath::Abs(pfJetDphiMet[2])))", "mll>20&&mll<40&&met[4]>100", "20 GeV < mll < 40 GeV", 16, 0, 3.2, false, "Min(|#Delta#phi(jet,MET)|)", "dphijcLow", false, false, false, 0.2); |
677 |
< |
make_OFSF_plot("TMath::Min(TMath::Abs(pfJetDphiMet[0]), TMath::Min(TMath::Abs(pfJetDphiMet[1]), TMath::Abs(pfJetDphiMet[2])))", "mll>20&&mll<40&&met[4]>100", "40 GeV < mll < 70 GeV", 16, 0, 3.2, false, "Min(|#Delta#phi(jet,MET)|)", "dphijcMed", false, false, false, 0.2); |
678 |
< |
make_OFSF_plot("TMath::Min((TMath::Pi()-TMath::Abs(dphiMet1)), (TMath::Pi() - TMath::Abs(dphiMet2)))", "mll>20&&mll<40&&met[4]>100", "20 GeV < mll < 40 GeV", 16, 0, 3.2, false, "Min(#Pi - |#Delta#phi(l,MET)|)", "dphilcoLow", false, false, false, 0.2); |
679 |
< |
make_OFSF_plot("TMath::Min((TMath::Pi()-TMath::Abs(dphiMet1)), (TMath::Pi() - TMath::Abs(dphiMet2)))", "mll>20&&mll<40&&met[4]>100", "40 GeV < mll < 70 GeV", 16, 0, 3.2, false, "Min(#Pi - |#Delta#phi(l,MET)|)", "dphilcoMed", false, false, false, 0.2); |
680 |
< |
make_OFSF_plot("TMath::Min((TMath::Pi()-TMath::Abs(pfJetDphiMet[0])), TMath::Min( (TMath::Pi()-TMath::Abs(pfJetDphiMet[1])), (TMath::Pi() - TMath::Abs(pfJetDphiMet[2]))))", "mll>20&&mll<40&&met[4]>100", "20 GeV < mll < 40 GeV", 16, 0, 3.2, false, "Min(#Pi - |#Delta#phi(jet,MET)|)", "dphijcoLow", false, false, false, 0.2); |
681 |
< |
make_OFSF_plot("TMath::Min((TMath::Pi()-TMath::Abs(pfJetDphiMet[0])), TMath::Min( (TMath::Pi()-TMath::Abs(pfJetDphiMet[1])), (TMath::Pi() - TMath::Abs(pfJetDphiMet[2]))))", "mll>20&&mll<40&&met[4]>100", "40 GeV < mll < 70 GeV", 16, 0, 3.2, false, "Min(#Pi - |#Delta#phi(jet,MET)|)", "dphijcoMed", false, false, false, 0.2); |
682 |
< |
|
683 |
< |
|
684 |
< |
|
685 |
< |
make_kin_plot("met[4]","",70,0,350,dolog,"MET [GeV]","met",doPF,true); |
686 |
< |
|
687 |
< |
make_kin_plot("mll","",(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll",doPF,true); |
688 |
< |
make_kin_plot("mll","",(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_osof",doPF,true,true); |
689 |
< |
make_kin_plot("mll","",(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_ee",doPF,true); |
690 |
< |
make_kin_plot("mll","",(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_mm",doPF,true); |
691 |
< |
make_kin_plot("mll","",(int)((mll_hi-mll_low))/5,mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive",doPF,true); |
692 |
< |
make_kin_plot("mll","",(int)((mll_hi-mll_low))/5,mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive_ee",doPF,true); |
693 |
< |
make_kin_plot("mll","",(int)((mll_hi-mll_low))/5,mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive_mm",doPF,true); |
694 |
< |
make_kin_plot("mll","",(int)((mll_hi-mll_low))/5,mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive_osof",doPF,true); |
695 |
< |
make_kin_plot("mll","",(int)((350-mll_low))/5,mll_low,350,dolog,"m_{ll} [GeV]","mll_inclusive_highrange",doPF); |
696 |
< |
if(!doPF) make_special_mll_plot((int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]"); |
697 |
< |
|
698 |
< |
make_kin_plot("pfJetGoodPt[0]/pfJetGoodPt[1]","",45,1,10,dolog,"pt_{j}^{1}/pt_{j}^{2}","j1j2ratio",doPF,true); |
699 |
< |
make_kin_plot("TMath::Abs(pfJetDphiMet[0])","",32,0,3.2,nolog,"|#Delta#phi(jet1,MET)|","dphiJ1MET",doPF,true); |
700 |
< |
|
701 |
< |
make_kin_plot("pfJetGoodNum40","",9,-0.5,8.5,dolog,"nJets","nJets",doPF); |
702 |
< |
make_kin_plot("pfJetGoodNum40","",9,-0.5,8.5,dolog,"nJets","nJets_osof",doPF); |
703 |
< |
make_kin_plot("pfJetGoodNum40","",9,-0.5,8.5,dolog,"nJets","nJets_nocuts_except_mll_ossf",doPF); |
704 |
< |
|
705 |
< |
make_kin_plot("numVtx","",(int)(30.5-(-0.5)),-0.5,30.5,nolog,"N(Vtx)","numVtx",doPF); |
706 |
< |
// make_kin_plot("jetpt[0]","",40,0,200,dolog,"leading jet p_{T} [GeV]","pfJetGoodPt_0",doPF); |
707 |
< |
// make_kin_plot("jeteta[0]","",40,-5,5,nolog,"leading jet #eta","pfJetGoodEta_0",doPF); |
708 |
< |
make_kin_plot("pt","",50,0,500,dolog,"Z p_{T} [GeV]","Zpt",doPF); |
709 |
< |
make_kin_plot("pt1","",50,0,200,nolog,"p_{T} [GeV]","pt1",doPF); |
710 |
< |
make_kin_plot("pt2","",50,0,200,nolog,"p_{T} [GeV]","pt2",doPF); |
711 |
< |
make_kin_plot("eta1","",40,-3,3,nolog,"#eta_{l}","eta",doPF); |
712 |
< |
make_kin_plot("jzb[1]","",100,-150,200,dolog,"JZB [GeV]","jzb_ossf",doPF); |
713 |
< |
stringstream jzbcut; |
714 |
< |
jzbcut << "((is_data&&("<<datajzb<<")>100)||(!is_data&&("<<mcjzb<<")>100))"; |
715 |
< |
make_kin_plot("mll",jzbcut.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ll} [GeV]","mll_aboveJZB100",doPF,true); |
716 |
< |
make_kin_plot("mll",jzbcut.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ll} [GeV]","mll_osof_aboveJZB100",doPF,true); |
717 |
< |
make_kin_plot("mll",jzbcut.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ll} [GeV]","mll_ee_aboveJZB100",doPF,true); |
718 |
< |
make_kin_plot("mll",jzbcut.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ll} [GeV]","mll_mm_aboveJZB100",doPF,true); |
719 |
< |
stringstream jzbcut2; |
720 |
< |
jzbcut2 << "((is_data&&("<<datajzb<<")>150)||(!is_data&&("<<mcjzb<<")>150))"; |
721 |
< |
make_kin_plot("mll",jzbcut2.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ll} [GeV]","mll_aboveJZB150",doPF,true); |
722 |
< |
make_kin_plot("mll",jzbcut2.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ll} [GeV]","mll_osof_aboveJZB150",doPF,true); |
723 |
< |
make_kin_plot("mll",jzbcut2.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ll} [GeV]","mll_ee_aboveJZB150",doPF,true); |
724 |
< |
make_kin_plot("mll",jzbcut2.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ll} [GeV]","mll_mm_aboveJZB150",doPF,true); |
725 |
< |
stringstream jzbcut3; |
726 |
< |
jzbcut3 << "((is_data&&("<<datajzb<<")>50)||(!is_data&&("<<mcjzb<<")>50))"; |
727 |
< |
make_kin_plot("mll",jzbcut3.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ll} [GeV]","mll_aboveJZB50",doPF,true); |
728 |
< |
make_kin_plot("mll",jzbcut3.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ll} [GeV]","mll_osof_aboveJZB50",doPF,true,true); |
729 |
< |
make_kin_plot("mll",jzbcut3.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ll} [GeV]","mll_ee_aboveJZB50",doPF,true); |
730 |
< |
make_kin_plot("mll",jzbcut3.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ll} [GeV]","mll_mm_aboveJZB50",doPF,true); |
731 |
< |
|
732 |
< |
make_kin_plot("mll","met[4]>100",(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ll} [GeV] (MET>100GeV)","mll_met100",doPF,true); |
733 |
< |
|
734 |
< |
make_special_obs_pred_mll_plot(datajzb,mcjzb,0); |
735 |
< |
make_special_obs_pred_mll_plot(datajzb,mcjzb,50); |
736 |
< |
make_special_obs_pred_mll_plot(datajzb,mcjzb,80); |
737 |
< |
make_special_obs_pred_mll_plot(datajzb,mcjzb,100); |
738 |
< |
// make_special_obs_pred_mll_plot(datajzb,mcjzb,150); |
739 |
< |
// make_special_obs_pred_mll_plot(datajzb,mcjzb,200); |
740 |
< |
// make_special_obs_pred_mll_plot(datajzb,mcjzb,250); |
2433 |
> |
//ProduceJanPlots(); |
2434 |
> |
//ProduceMCSystematicPlots(); |
2435 |
> |
//assert(0); |
2436 |
> |
// make_plain_kin_plot("pt",Cut2Str(cutOSSF&&TCut("mll>20&&pfJetGoodNumBtag30>=2")),40,0,200,nolog,"Z p_{T}","PlotForKostas",doPF,true); |
2437 |
> |
|
2438 |
> |
if ( doOFSF ) ProduceOFSFPlots(mcjzb,datajzb); |
2439 |
> |
assert(0); |
2440 |
|
|
2441 |
< |
make_JES_plot(cutmass&&cutOSSF&&basiccut,"_ossf"); |
2442 |
< |
make_JES_plot(cutmass&&cutOSOF&&basiccut,"_osof"); |
2441 |
> |
if ( doDataComp) { |
2442 |
> |
TCut mllCut(""); |
2443 |
> |
float massmin = 15.; |
2444 |
> |
float massmax = 315; |
2445 |
> |
int massnbins = 60; |
2446 |
> |
/* if ( !PlottingSetup::openBox ) { |
2447 |
> |
mllCut = "mll>70"; |
2448 |
> |
massmin = 120; |
2449 |
> |
massmax = 360; |
2450 |
> |
massnbins = 14; |
2451 |
> |
}*/ |
2452 |
|
|
2453 |
+ |
TCut cutSignal = cutmass&&cutnJets&&"met[4]>100"; |
2454 |
+ |
|
2455 |
+ |
make_data_comparison_plot("numVtx", "",40, -0.5, 39.5,-1., true, "N(Vertices)", "numVtx"); |
2456 |
+ |
make_data_comparison_plot("pfJetGoodEta[0]", "",50, -3.0, 3.0,-1., true, "N(Jets)", "pfJetGoodEta0"); |
2457 |
+ |
|
2458 |
+ |
|
2459 |
+ |
make_data_comparison_plot("pfJetGoodNum40", cutOSOF,10, -0.5, 9.5,-1., true, "N(Jets)", "njets_OF"); |
2460 |
+ |
make_data_comparison_plot("met[4]", cutOSSF,60, 0., 300.,-1., true, "pfMET", "met_SF_inclusive"); |
2461 |
+ |
make_data_comparison_plot("met[1]", cutOSSF,60, 0., 300.,-1., true, "type 1 corrected pfMET", "mett1_SF_inclusive"); |
2462 |
+ |
make_data_comparison_plot("met[4]", cutOSOF,60, 0., 300.,-1., true, "pfMET", "met_OF_inclusive"); |
2463 |
+ |
make_data_comparison_plot("met[1]", cutOSOF,60, 0., 300.,-1., true, "type 1 corrected pfMET", "mett1_OF_inclusive"); |
2464 |
+ |
|
2465 |
+ |
make_data_comparison_plot("met[4]", cutnJets&&cutOSSF,60, 0., 300.,-1., true, "pfMET", "met_SF_exclusive"); |
2466 |
+ |
make_data_comparison_plot("met[1]", cutnJets&&cutOSSF,60, 0., 300.,-1., true, "type 1 corrected pfMET", "mett1_SF_exclusive"); |
2467 |
+ |
make_data_comparison_plot("met[4]", cutnJets&&cutOSOF,60, 0., 300.,-1., true, "pfMET", "met_OF_exclusive"); |
2468 |
+ |
make_data_comparison_plot("met[1]", cutnJets&&cutOSOF,60, 0., 300.,-1., true, "type 1 corrected pfMET", "mett1_OF_exclusive"); |
2469 |
|
|
2470 |
+ |
|
2471 |
+ |
string basiccutsaved = (const char*)basiccut; |
2472 |
+ |
|
2473 |
+ |
string newbasiccut=basiccutsaved; |
2474 |
+ |
|
2475 |
+ |
size_t found; |
2476 |
+ |
found = newbasiccut.find( "pt2>20" ); |
2477 |
+ |
while (found!=string::npos){ |
2478 |
+ |
newbasiccut.replace( found, string( "pt2>20" ).length(), "pt2>10" ); |
2479 |
+ |
found = newbasiccut.find( "pt2>20" ); |
2480 |
+ |
} |
2481 |
+ |
basiccut=TCut(newbasiccut.c_str()); |
2482 |
+ |
make_data_comparison_plot("mll", TCut("pfJetGoodNum40>=2&&met[4]>150")&&cutOSSF,60, 0., 300.,-1., false, "mll", "mll_SF_Aachen_pt2010_met"); |
2483 |
+ |
make_data_comparison_plot("mll", TCut("pfJetGoodNum40>=2&&met[4]>150")&&cutOSOF,60, 0., 300.,-1., false, "mll", "mll_OF_Aachen_pt2010_met"); |
2484 |
+ |
make_data_comparison_plot("mll", TCut("pfJetGoodNum40>=2&&met[1]>150")&&cutOSSF,60, 0., 300.,-1., true, "mll", "mll_SF_Aachen_pt2010_t1cpfmet"); |
2485 |
+ |
make_data_comparison_plot("mll", TCut("pfJetGoodNum40>=2&&met[1]>150")&&cutOSOF,60, 0., 300.,-1., true, "mll", "mll_OF_Aachen_pt2010_t1cpfmet"); |
2486 |
+ |
basiccut=TCut(basiccutsaved.c_str()); |
2487 |
+ |
|
2488 |
+ |
make_data_comparison_plot("pfJetGoodNum40", cutOSSF, 8, 0., 8.,-1., true, "#(jets)", "njets_SF"); |
2489 |
+ |
make_data_comparison_plot("pfJetGoodNum40", cutOSOF, 8, 0., 8.,-1., true, "#(jets)", "njets_OF"); |
2490 |
+ |
|
2491 |
+ |
make_data_comparison_plot("mll", TCut("pfJetGoodNum40>=3&&met[4]>100")&&cutOSSF,60, 0., 300.,-1., true, "mll", "mll_SF_ETH_met"); |
2492 |
+ |
make_data_comparison_plot("mll", TCut("pfJetGoodNum40>=3&&met[4]>100")&&cutOSOF,60, 0., 300.,-1., true, "mll", "mll_OF_ETH_met"); |
2493 |
+ |
make_data_comparison_plot("mll", TCut("pfJetGoodNum40>=3&&met[1]>100")&&cutOSSF,60, 0., 300.,-1., true, "mll", "mll_SF_ETH_t1cpfmet"); |
2494 |
+ |
make_data_comparison_plot("mll", TCut("pfJetGoodNum40>=3&&met[1]>100")&&cutOSOF,60, 0., 300.,-1., true, "mll", "mll_OF_ETH_t1cpfmet"); |
2495 |
+ |
|
2496 |
+ |
|
2497 |
+ |
make_data_comparison_plot("mll", cutOSSF,60, 15., 315.,-1., true, "m_{ll}", "mll_SF_inclusive"); |
2498 |
+ |
make_data_comparison_plot("mll", cutOSSF&&TCut("id1==0"),60, 15., 315.,-1., true, "m_{ll}", "mll_SF_inclusive_ee"); |
2499 |
+ |
make_data_comparison_plot("mll", cutOSSF&&TCut("id1==1"),60, 15., 315.,-1., true, "m_{ll}", "mll_SF_inclusive_mm"); |
2500 |
+ |
make_data_comparison_plot("mll", cutOSOF,60, 15., 315.,-1., true, "m_{ll}", "mll_OF_inclusive"); |
2501 |
+ |
make_data_comparison_plot("mll", cutnJets&&cutOSSF&&TCut("id1==0"),60, 15., 315.,-1., true, "m_{ll}", "mll_SF_exclusive_ee"); |
2502 |
+ |
make_data_comparison_plot("mll", cutnJets&&cutOSSF&&TCut("id1==1"),60, 15., 315.,-1., true, "m_{ll}", "mll_SF_exclusive_mm"); |
2503 |
+ |
make_data_comparison_plot("mll", cutnJets&&cutOSSF,60, 15., 315.,-1., true, "m_{ll}", "mll_SF_exclusive"); |
2504 |
+ |
make_data_comparison_plot("mll", cutnJets&&cutOSOF,60, 15., 315.,-1., true, "m_{ll}", "mll_OF_exclusive"); |
2505 |
+ |
|
2506 |
+ |
make_data_comparison_plot("mll", cutOSSF&&cutSignal&&mllCut, massnbins, 15., 315.,-1., false, "m_{ll}", "mll_SF_sig"); |
2507 |
+ |
make_data_comparison_plot("mll", cutOSOF&&cutSignal&&mllCut, massnbins, 15., 315.,-1., false, "m_{ll}", "mll_OF_sig"); |
2508 |
+ |
|
2509 |
+ |
make_data_comparison_plot("mll", TCut("abs(eta1)<1.4&&abs(eta2)<1.4") && cutOSSF&&cutSignal&&mllCut, massnbins, 15., 315.,-1., false, "m_{ll}", "mll_SF_sig_central"); |
2510 |
+ |
make_data_comparison_plot("mll", TCut("abs(eta1)<1.4&&abs(eta2)<1.4") && cutOSOF&&cutSignal&&mllCut, massnbins, 15., 315.,-1., false, "m_{ll}", "mll_OF_sig_central"); |
2511 |
+ |
|
2512 |
+ |
make_data_comparison_plot("mll", cutOSSF&&cutSignal&&mllCut&&"pfJetGoodNumBtag30==0", massnbins, 15., 315.,-1., false, "m_{ll}", "mll_SF_sig_btagVeto"); |
2513 |
+ |
make_data_comparison_plot("mll", cutOSOF&&cutSignal&&mllCut&&"pfJetGoodNumBtag30==0", massnbins, 15., 315.,-1., false, "m_{ll}", "mll_OF_sig_btagVeto"); |
2514 |
+ |
|
2515 |
+ |
make_data_comparison_plot("mll", cutOSSF&&cutSignal&&mllCut&&"pfJetGoodNumBtag30>0", massnbins, 15., 315.,-1., false, "m_{ll}", "mll_SF_sig_AtLeastOneBJet"); |
2516 |
+ |
make_data_comparison_plot("mll", cutOSOF&&cutSignal&&mllCut&&"pfJetGoodNumBtag30>0", massnbins, 15., 315.,-1., false, "m_{ll}", "mll_OF_sig_AtLeastOneBJet"); |
2517 |
+ |
|
2518 |
+ |
|
2519 |
+ |
make_data_comparison_plot("mll", mllCut&&cutOSOF&&cutSignal, massnbins, 15., 315.,-1., false, "m_{ll}", "mll_OF_sig"); |
2520 |
+ |
make_data_comparison_plot("mll", cutmass&&cutOSSF&&"met[4]>100&&met[4]<150&&pfJetGoodNum40==2", massnbins, 15., 315.,-1., false, "m_{ll}", "mll_SF_CR"); |
2521 |
+ |
make_data_comparison_plot("mll", cutmass&&cutOSOF&&"met[4]>100&&met[4]<150&&pfJetGoodNum40==2", massnbins, 15., 315.,-1., false, "m_{ll}", "mll_OF_CR"); |
2522 |
+ |
|
2523 |
+ |
make_data_comparison_plot("pfJetGoodNum40", cutOSSF&&cutSignal&&mllCut, 8, 0., 8.,-1., false, "#(jets)", "njets_SF_sig"); |
2524 |
+ |
make_data_comparison_plot("pfJetGoodNum40", cutOSOF&&cutSignal&&mllCut, 8, 0., 8.,-1., false, "#(jets)", "njets_OF_sig"); |
2525 |
+ |
make_data_comparison_plot("pfJetGoodNumBtag30", cutOSSF&&cutSignal&&mllCut, 8, 0., 8.,-1., false, "#(b-jets)", "nbjets_SF_sig"); |
2526 |
+ |
make_data_comparison_plot("pfJetGoodNumBtag30", cutOSOF&&cutSignal&&mllCut, 8, 0., 8.,-1., false, "#(b-jets)", "nbjets_OF_sig"); |
2527 |
+ |
|
2528 |
+ |
} |
2529 |
+ |
|
2530 |
+ |
|
2531 |
+ |
if ( doKin ) { |
2532 |
+ |
string mllCut(""); |
2533 |
+ |
|
2534 |
+ |
make_plain_kin_plot("mll",Cut2Str(cutOSSF&&TCut("mll>20")),56,20,300,dolog,"m_{ll}","NoPreselection/mll_SF",doPF,true); |
2535 |
+ |
make_plain_kin_plot("mll",Cut2Str(cutOSOF&&TCut("mll>20")),56,20,300,dolog,"m_{ll}","NoPreselection/mll_OF",doPF,true); |
2536 |
+ |
|
2537 |
+ |
make_plain_kin_plot("met[4]",Cut2Str(cutOSSF&&TCut("mll>20")),80,0,400,dolog,"E_{T}^{miss}","NoPreselection/met_SF",doPF,true); |
2538 |
+ |
make_plain_kin_plot("met[4]",Cut2Str(cutOSOF&&TCut("mll>20")),80,0,400,dolog,"E_{T}^{miss}","NoPreselection/met_OF",doPF,true); |
2539 |
+ |
|
2540 |
+ |
make_plain_kin_plot("pfTightHT",Cut2Str(cutOSSF&&TCut("mll>20")),20,0,800,dolog,"H_{T}","NoPreselection/HT_SF",doPF,true); |
2541 |
+ |
make_plain_kin_plot("pfTightHT",Cut2Str(cutOSOF&&TCut("mll>20")),20,0,800,dolog,"H_{T}","NoPreselection/HT_OF",doPF,true); |
2542 |
+ |
|
2543 |
+ |
make_plain_kin_plot("pfJetGoodNum40",Cut2Str(cutOSSF&&TCut("mll>20")),10,-0.5,9.5,dolog,"n_{jets}","NoPreselection/NJets_SF",doPF,true); |
2544 |
+ |
make_plain_kin_plot("pfJetGoodNum40",Cut2Str(cutOSOF&&TCut("mll>20")),10,-0.5,9.5,dolog,"n_{jets}","NoPreselection/NJets_OF",doPF,true); |
2545 |
+ |
|
2546 |
+ |
make_plain_kin_plot("pfJetGoodNumBtag30",Cut2Str(cutOSSF&&TCut("mll>20")),10,-0.5,9.5,dolog,"n_{btags}","NoPreselection/NBTags_SF",doPF,true); |
2547 |
+ |
make_plain_kin_plot("pfJetGoodNumBtag30",Cut2Str(cutOSOF&&TCut("mll>20")),10,-0.5,9.5,dolog,"n_{btags}","NoPreselection/NBTags_OF",doPF,true); |
2548 |
+ |
|
2549 |
+ |
make_plain_kin_plot("pt1",Cut2Str(cutOSSF&&TCut("mll>20")),80,0,400,dolog,"p_{T}^{1}","NoPreselection/Pt1_SF",doPF,true); |
2550 |
+ |
make_plain_kin_plot("pt1",Cut2Str(cutOSOF&&TCut("mll>20")),80,0,400,dolog,"p_{T}^{1}","NoPreselection/Pt1_OF",doPF,true); |
2551 |
+ |
|
2552 |
+ |
make_plain_kin_plot("pt2",Cut2Str(cutOSSF&&TCut("mll>20")),80,0,400,dolog,"p_{T}^{2}","NoPreselection/Pt2_SF",doPF,true); |
2553 |
+ |
make_plain_kin_plot("pt2",Cut2Str(cutOSOF&&TCut("mll>20")),80,0,400,dolog,"p_{T}^{2}","NoPreselection/Pt2_OF",doPF,true); |
2554 |
+ |
|
2555 |
+ |
|
2556 |
+ |
assert(0); |
2557 |
+ |
make_plain_kin_plot("mll",Cut2Str(cutOSSF&&TCut("mll>60&&mll<120")),60,60,120,dolog,"m_{ll}","TestingLuminosity_SF",doPF,true); |
2558 |
+ |
make_plain_kin_plot("mll",Cut2Str(cutOSOF&&TCut("mll>60&&mll<120")),60,60,120,dolog,"m_{ll}","TestingLuminosity_OF",doPF,true); |
2559 |
+ |
|
2560 |
+ |
make_plain_kin_plot("met[4]",Cut2Str(cutOSOF&&TCut("mll>30&&mll<70&&pfJetGoodNum40==0")),40,0,400,dolog,"PFMET","Debunking/MET_OF_30to70_0j",doPF,true); |
2561 |
+ |
make_plain_kin_plot("met[4]",Cut2Str(cutOSOF&&TCut("mll>30&&mll<70&&pfJetGoodNum40==1")),40,0,400,dolog,"PFMET","Debunking/MET_OF_30to70_1j",doPF,true); |
2562 |
+ |
make_plain_kin_plot("met[4]",Cut2Str(cutOSOF&&TCut("mll>30&&mll<70&&pfTightHT>100&&pfJetGoodNum40==2")),40,0,400,dolog,"PFMET","Debunking/MET_OF_30to70_2j",doPF,true); |
2563 |
+ |
make_plain_kin_plot("met[4]",Cut2Str(cutOSOF&&TCut("mll>30&&mll<70&&pfTightHT>100&&pfJetGoodNum40==3")),40,0,400,dolog,"PFMET","Debunking/MET_OF_30to70_3j",doPF,true); |
2564 |
+ |
|
2565 |
+ |
make_plain_kin_plot("met[4]",Cut2Str(cutOSOF&&TCut("mll>80&&mll<100&&pfJetGoodNum40==0")),40,0,400,dolog,"PFMET","Debunking/MET_OF_Z_0j",doPF,true); |
2566 |
+ |
make_plain_kin_plot("met[4]",Cut2Str(cutOSOF&&TCut("mll>80&&mll<100&&pfJetGoodNum40==1")),40,0,400,dolog,"PFMET","Debunking/MET_OF_Z_1j",doPF,true); |
2567 |
+ |
make_plain_kin_plot("met[4]",Cut2Str(cutOSOF&&TCut("mll>80&&mll<100&&pfTightHT>100&&pfJetGoodNum40==2")),40,0,400,dolog,"PFMET","Debunking/MET_OF_Z_2j",doPF,true); |
2568 |
+ |
make_plain_kin_plot("met[4]",Cut2Str(cutOSOF&&TCut("mll>80&&mll<100&&pfTightHT>100&&pfJetGoodNum40==3")),40,0,400,dolog,"PFMET","Debunking/MET_OF_Z_3j",doPF,true); |
2569 |
+ |
|
2570 |
+ |
|
2571 |
+ |
make_plain_kin_plot("pfTightHT",Cut2Str(cutOSOF&&cutnJets),120,0,1200,dolog,"H_{T}","HT_3jets_OF",doPF,true); |
2572 |
+ |
make_plain_kin_plot("pfTightHT",Cut2Str(cutOSSF&&cutnJets) ,120,0,1200,dolog,"H_{T}","HT_3jets_SF",doPF,true); |
2573 |
+ |
make_plain_kin_plot("pfTightHT",Cut2Str(cutOSOF&&cutnJets&&TCut("met[4]>100")),120,0,1200,dolog,"H_{T}","HT_3jets_OF_MET100",doPF,true); |
2574 |
+ |
make_plain_kin_plot("pfTightHT",Cut2Str(cutOSSF&&cutnJets&&TCut("met[4]>100")) ,120,0,1200,dolog,"H_{T}","HT_3jets_SF_MET100",doPF,true); |
2575 |
+ |
|
2576 |
+ |
|
2577 |
+ |
make_plain_kin_plot("met[1]",Cut2Str(cutOSOF&&TCut("mll>30&&mll<70&&pfJetGoodNum40==0")),40,0,400,dolog,"PFMET","Debunking/T1MET_OF_30to70_0j",doPF,true); |
2578 |
+ |
make_plain_kin_plot("met[1]",Cut2Str(cutOSOF&&TCut("mll>30&&mll<70&&pfJetGoodNum40==1")),40,0,400,dolog,"PFMET","Debunking/T1MET_OF_30to70_1j",doPF,true); |
2579 |
+ |
make_plain_kin_plot("met[1]",Cut2Str(cutOSOF&&TCut("mll>30&&mll<70&&pfTightHT>100&&pfJetGoodNum40==2")),40,0,400,dolog,"PFMET","Debunking/T1MET_OF_30to70_2j",doPF,true); |
2580 |
+ |
make_plain_kin_plot("met[1]",Cut2Str(cutOSOF&&TCut("mll>30&&mll<70&&pfTightHT>100&&pfJetGoodNum40==3")),40,0,400,dolog,"PFMET","Debunking/T1MET_OF_30to70_3j",doPF,true); |
2581 |
+ |
|
2582 |
+ |
make_plain_kin_plot("met[1]",Cut2Str(cutOSOF&&TCut("mll>80&&mll<100&&pfJetGoodNum40==0")),40,0,400,dolog,"PFMET","Debunking/T1MET_OF_Z_0j",doPF,true); |
2583 |
+ |
make_plain_kin_plot("met[1]",Cut2Str(cutOSOF&&TCut("mll>80&&mll<100&&pfJetGoodNum40==1")),40,0,400,dolog,"PFMET","Debunking/T1MET_OF_Z_1j",doPF,true); |
2584 |
+ |
make_plain_kin_plot("met[1]",Cut2Str(cutOSOF&&TCut("mll>80&&mll<100&&pfTightHT>100&&pfJetGoodNum40==2")),40,0,400,dolog,"PFMET","Debunking/T1MET_OF_Z_2j",doPF,true); |
2585 |
+ |
make_plain_kin_plot("met[1]",Cut2Str(cutOSOF&&TCut("mll>80&&mll<100&&pfTightHT>100&&pfJetGoodNum40==3")),40,0,400,dolog,"PFMET","Debunking/T1MET_OF_Z_3j",doPF,true); |
2586 |
+ |
|
2587 |
+ |
make_plain_kin_plot("met[4]",Cut2Str(cutOSSF&&cutnJets&&TCut("mll>20&&mll<70")),50,0,300,dolog,"PFMET","MET_SF_20to70",doPF,true); |
2588 |
+ |
make_plain_kin_plot("met[4]",Cut2Str(cutOSOF&&cutnJets&&TCut("mll>20&&mll<70")),50,0,300,dolog,"PFMET","MET_OF_20to70",doPF,true); |
2589 |
+ |
|
2590 |
+ |
make_plain_kin_plot("met[4]",Cut2Str(cutOSSF&&cutnJets&&TCut("mll>120")),50,0,300,dolog,"PFMET","MET_SF_above120",doPF,true); |
2591 |
+ |
make_plain_kin_plot("met[4]",Cut2Str(cutOSOF&&cutnJets&&TCut("mll>120")),50,0,300,dolog,"PFMET","MET_OF_above120",doPF,true); |
2592 |
+ |
|
2593 |
+ |
make_plain_kin_plot("met[4]",Cut2Str(cutOSSF&&TCut("pfJetGoodNum40==2")&&TCut("mll>20&&mll<70")),50,0,300,dolog,"PFMET","MET_SF_20to70___2jetsonly",doPF,true); |
2594 |
+ |
make_plain_kin_plot("met[4]",Cut2Str(cutOSOF&&TCut("pfJetGoodNum40==2")&&TCut("mll>20&&mll<70")),50,0,300,dolog,"PFMET","MET_OF_20to70___2jetsonly",doPF,true); |
2595 |
+ |
|
2596 |
+ |
make_plain_kin_plot("met[4]",Cut2Str(cutOSSF&&TCut("pfJetGoodNum40==2")&&TCut("mll>120")),50,0,300,dolog,"PFMET","MET_SF_above120___2jetsonly",doPF,true); |
2597 |
+ |
make_plain_kin_plot("met[4]",Cut2Str(cutOSOF&&TCut("pfJetGoodNum40==2")&&TCut("mll>120")),50,0,300,dolog,"PFMET","MET_OF_above120___2jetsonly",doPF,true); |
2598 |
+ |
|
2599 |
+ |
|
2600 |
+ |
make_kin_plot("pfJetGoodPt[0]/pfJetGoodPt[1]","",45,1,10,dolog,"pt_{j}^{1}/pt_{j}^{2}","j1j2ratio",doPF,true); |
2601 |
+ |
make_kin_plot("TMath::Abs(pfJetDphiMet[0])","",32,0,3.2,nolog,"|#Delta#phi(jet1,MET)|","dphiJ1MET",doPF,true); |
2602 |
+ |
// Plots in signal region |
2603 |
+ |
make_kin_plot("met[4]","",70,0,350,dolog,"#slash{E}_{T} [GeV]","met",doPF,true); |
2604 |
+ |
|
2605 |
+ |
|
2606 |
+ |
make_kin_plot("MetFactor","",20,0,2,nolog,"MetFactor","MetFactor",doPF,true); |
2607 |
+ |
|
2608 |
+ |
make_ttbar_comparison("met[4]",40,0,400,(cutOSOF&&TCut("mll>30&&mll<70&&pfTightHT>100&&pfJetGoodNum40==2")),dolog,"PFMET","Debunking/MET_OF_30to70_2j__ALLMCSAMPLES"); |
2609 |
+ |
/* |
2610 |
+ |
DoMCSystPlot("met[4]",40,0,400,(cutOSOF&&TCut("mll>30&&mll<70&&pfJetGoodNum40==0")),dolog,"PFMET","Debunking/MET_OF_30to70_0j"); |
2611 |
+ |
DoMCSystPlot("met[4]",40,0,400,(cutOSOF&&TCut("mll>30&&mll<70&&pfJetGoodNum40==1")),dolog,"PFMET","Debunking/MET_OF_30to70_1j"); |
2612 |
+ |
DoMCSystPlot("met[4]",40,0,400,(cutOSOF&&TCut("mll>30&&mll<70&&pfTightHT>100&&pfJetGoodNum40==2")),dolog,"PFMET","Debunking/MET_OF_30to70_2j"); |
2613 |
+ |
DoMCSystPlot("met[4]",40,0,400,(cutOSOF&&TCut("mll>30&&mll<70&&pfTightHT>100&&pfJetGoodNum40==3")),dolog,"PFMET","Debunking/MET_OF_30to70_3j"); |
2614 |
+ |
|
2615 |
+ |
DoMCSystPlot("met[4]",40,0,400,(cutOSSF&&TCut("mll>30&&mll<70&&pfJetGoodNum40==0")),dolog,"PFMET","Debunking/MET_SF_30to70_0j"); |
2616 |
+ |
DoMCSystPlot("met[4]",40,0,400,(cutOSSF&&TCut("mll>30&&mll<70&&pfJetGoodNum40==1")),dolog,"PFMET","Debunking/MET_SF_30to70_1j"); |
2617 |
+ |
DoMCSystPlot("met[4]",40,0,400,(cutOSSF&&TCut("mll>30&&mll<70&&pfTightHT>100&&pfJetGoodNum40==2")),dolog,"PFMET","Debunking/MET_SF_30to70_2j"); |
2618 |
+ |
DoMCSystPlot("met[4]",40,0,400,(cutOSSF&&TCut("mll>30&&mll<70&&pfTightHT>100&&pfJetGoodNum40==3")),dolog,"PFMET","Debunking/MET_SF_30to70_3j"); |
2619 |
+ |
|
2620 |
+ |
DoMCSystPlot("met[4]",40,0,400,(cutOSOF&&TCut("mll>80&&mll<100&&pfJetGoodNum40==0")),dolog,"PFMET","Debunking/MET_OF_Z_0j"); |
2621 |
+ |
DoMCSystPlot("met[4]",40,0,400,(cutOSOF&&TCut("mll>80&&mll<100&&pfJetGoodNum40==1")),dolog,"PFMET","Debunking/MET_OF_Z_1j"); |
2622 |
+ |
DoMCSystPlot("met[4]",40,0,400,(cutOSOF&&TCut("mll>80&&mll<100&&pfTightHT>100&&pfJetGoodNum40==2")),dolog,"PFMET","Debunking/MET_OF_Z_2j"); |
2623 |
+ |
DoMCSystPlot("met[4]",40,0,400,(cutOSOF&&TCut("mll>80&&mll<100&&pfTightHT>100&&pfJetGoodNum40==3")),dolog,"PFMET","Debunking/MET_OF_Z_3j"); |
2624 |
+ |
|
2625 |
+ |
|
2626 |
+ |
DoMCSystPlot("mll", (int)((mll_hi-mll_low)/5),mll_low,mll_hi,cutnJets&&cutOSSF,dolog,"m_{ll} [GeV]","kinSys/mll"); |
2627 |
+ |
DoMCSystPlot("mll", (int)((mll_hi-mll_low)/5),mll_low,mll_hi,cutnJets&&cutOSSF&&TCut("id1==0"),dolog,"m_{ll} [GeV]","kinSys/mll_ee"); |
2628 |
+ |
DoMCSystPlot("mll", (int)((mll_hi-mll_low)/5),mll_low,mll_hi,cutnJets&&cutOSSF&&TCut("id1==1"),dolog,"m_{ll} [GeV]","kinSys/mll_mm"); |
2629 |
+ |
DoMCSystPlot("mll", (int)((mll_hi-mll_low)/5),mll_low,mll_hi,cutnJets&&cutOSOF,dolog,"m_{ll} [GeV]","kinSys/mll_osof"); |
2630 |
+ |
|
2631 |
+ |
DoMCSystPlot("mll", (int)((mll_hi-mll_low)/5),mll_low,mll_hi,cutOSSF,dolog,"m_{ll} [GeV]","kinSys/mll_inclusive"); |
2632 |
+ |
DoMCSystPlot("mll", (int)((mll_hi-mll_low)/5),mll_low,mll_hi,cutOSOF,dolog,"m_{ll} [GeV]","kinSys/mll_inclusive_osof"); |
2633 |
+ |
|
2634 |
+ |
DoMCSystPlot("pfJetGoodNum40", 9,-0.5,8.5,cutOSSF,dolog,"nJets","kinSys/nJets_ossf"); |
2635 |
+ |
DoMCSystPlot("pfJetGoodNum40", 9,-0.5,8.5,cutOSOF,dolog,"nJets","kinSys/nJets_osof"); |
2636 |
+ |
|
2637 |
+ |
DoMCSystPlot("pfJetGoodPt[0]/pfJetGoodPt[1]",45,1,10,cutnJets&&cutOSSF,dolog,"p_{T}^{J1} / p_{T}^{J2}","kinSys/j1j2ratio"); |
2638 |
+ |
DoMCSystPlot("TMath::Abs(pfJetDphiMet[0])",32,0,3.2,cutnJets&&cutOSSF,dolog,"|#Delta#phi(jet1,MET)|","kinSys/dphiJ1MET"); |
2639 |
+ |
DoMCSystPlot(datajzb,mcjzb, (int)((PlottingSetup::jzbHigh+110)/10),-110,PlottingSetup::jzbHigh,cutnJets&&cutOSSF&&Restrmasscut,dolog,"m_{ll} [GeV]","kinSys/jzb_OS_SFZP"); |
2640 |
+ |
DoMCSystPlot(datajzb,mcjzb, (int)((PlottingSetup::jzbHigh+110)/10),-110,PlottingSetup::jzbHigh,cutnJets&&cutOSOF&&Restrmasscut,dolog,"m_{ll} [GeV]","kinSys/jzb_OS_OFZP"); |
2641 |
+ |
|
2642 |
+ |
make_kin_plot("mll","mll>20"+mllCut,(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll",doPF,true); |
2643 |
+ |
make_kin_plot("mll","mll>20",(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_osof",doPF,true,true); |
2644 |
+ |
make_kin_plot("mll","mll>20"+mllCut,(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_ee",doPF,true); |
2645 |
+ |
make_kin_plot("mll","mll>20"+mllCut,(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_mm",doPF,true); |
2646 |
+ |
|
2647 |
+ |
make_kin_plot("pfJetGoodNum40",mllCut,9,-0.5,8.5,dolog,"nJets","nJets",doPF); |
2648 |
+ |
make_kin_plot("pfJetGoodNum40","",9,-0.5,8.5,dolog,"nJets","nJets_osof",doPF); |
2649 |
+ |
|
2650 |
+ |
make_kin_plot("mll","mll>20&&met[4]>100"+mllCut,(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_met100",doPF,true); |
2651 |
+ |
make_kin_plot("mll","mll>20&&met[4]>100",(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_osof_met100",doPF,true,true); |
2652 |
+ |
make_kin_plot("mll","mll>20&&met[4]>100"+mllCut,(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_ee_met100",doPF,true); |
2653 |
+ |
make_kin_plot("mll","mll>20&&met[4]>100"+mllCut,(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_mm_met100",doPF,true); |
2654 |
+ |
|
2655 |
+ |
|
2656 |
+ |
make_kin_plot("pfJetGoodNum40","met[4]>100"+mllCut,9,-0.5,8.5,dolog,"nJets","nJets_met100",doPF); |
2657 |
+ |
make_kin_plot("pfJetGoodNum40","met[4]>100",9,-0.5,8.5,dolog,"nJets","nJets_osof_met100",doPF); |
2658 |
+ |
|
2659 |
+ |
// Further inclusive invariant mass plots |
2660 |
+ |
make_kin_plot("mll",mllCut,(int)((mll_hi-mll_low))/5,mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive",doPF,true); |
2661 |
+ |
make_kin_plot("mll","",(int)((mll_hi-mll_low))/5,mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive_ee",doPF,true); |
2662 |
+ |
make_kin_plot("mll","",(int)((mll_hi-mll_low))/5,mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive_mm",doPF,true); |
2663 |
+ |
make_kin_plot("mll",mllCut,(int)((mll_hi-mll_low))/5,mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive_osof",doPF,true); |
2664 |
+ |
|
2665 |
+ |
make_kin_plot("mll","",(int)((350-mll_low))/5,mll_low,350,dolog,"m_{ll} [GeV]","mll_inclusive_highrange",doPF); |
2666 |
+ |
//if(!doPF) make_special_mll_plot((int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]"); |
2667 |
+ |
|
2668 |
+ |
|
2669 |
+ |
// Number of jets |
2670 |
+ |
make_kin_plot("pfJetGoodNum40","",9,-0.5,8.5,dolog,"nJets","nJets_inclusive",doPF); |
2671 |
+ |
make_kin_plot("pfJetGoodNum40","",9,-0.5,8.5,dolog,"nJets","nJets_osof_inclusive",doPF); |
2672 |
+ |
make_kin_plot("pfJetGoodNum40","",9,-0.5,8.5,dolog,"nJets","nJets_nocuts_except_mll_ossf",doPF); |
2673 |
+ |
|
2674 |
+ |
// Others |
2675 |
+ |
make_kin_plot("numVtx","",(int)(30.5-(-0.5)),-0.5,30.5,nolog,"N(Vtx)","numVtx",doPF); |
2676 |
+ |
// make_kin_plot("jetpt[0]","",40,0,200,dolog,"leading jet p_{T} [GeV]","pfJetGoodPt_0",doPF); |
2677 |
+ |
// make_kin_plot("jeteta[0]","",40,-5,5,nolog,"leading jet #eta","pfJetGoodEta_0",doPF); |
2678 |
+ |
make_kin_plot("pt","",50,0,500,dolog,"Z p_{T} [GeV]","Zpt",doPF); |
2679 |
+ |
make_kin_plot("pt1","",50,0,200,nolog,"p_{T} [GeV]","pt1",doPF); |
2680 |
+ |
make_kin_plot("pt2","",50,0,200,nolog,"p_{T} [GeV]","pt2",doPF); |
2681 |
+ |
make_kin_plot("eta1","",40,-3,3,nolog,"#eta_{l}","eta",doPF); |
2682 |
+ |
make_kin_plot("jzb[1]","",100,-150,200,dolog,"JZB [GeV]","jzb_ossf",doPF); |
2683 |
+ |
// stringstream jzbcut; |
2684 |
+ |
// jzbcut << "((is_data&&("<<datajzb<<")>100)||(!is_data&&("<<mcjzb<<")>100))"; |
2685 |
+ |
// make_kin_plot("mll",jzbcut.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ll} [GeV]","mll_aboveJZB100",doPF,true); |
2686 |
+ |
// make_kin_plot("mll",jzbcut.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ll} [GeV]","mll_osof_aboveJZB100",doPF,true); |
2687 |
+ |
// make_kin_plot("mll",jzbcut.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ll} [GeV]","mll_ee_aboveJZB100",doPF,true); |
2688 |
+ |
// make_kin_plot("mll",jzbcut.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ll} [GeV]","mll_mm_aboveJZB100",doPF,true); |
2689 |
+ |
// stringstream jzbcut2; |
2690 |
+ |
// jzbcut2 << "((is_data&&("<<datajzb<<")>150)||(!is_data&&("<<mcjzb<<")>150))"; |
2691 |
+ |
// make_kin_plot("mll",jzbcut2.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ll} [GeV]","mll_aboveJZB150",doPF,true); |
2692 |
+ |
// make_kin_plot("mll",jzbcut2.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ll} [GeV]","mll_osof_aboveJZB150",doPF,true); |
2693 |
+ |
// make_kin_plot("mll",jzbcut2.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ll} [GeV]","mll_ee_aboveJZB150",doPF,true); |
2694 |
+ |
// make_kin_plot("mll",jzbcut2.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ll} [GeV]","mll_mm_aboveJZB150",doPF,true); |
2695 |
+ |
// stringstream jzbcut3; |
2696 |
+ |
// jzbcut3 << "((is_data&&("<<datajzb<<")>50)||(!is_data&&("<<mcjzb<<")>50))"; |
2697 |
+ |
// make_kin_plot("mll",jzbcut3.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ll} [GeV]","mll_aboveJZB50",doPF,true); |
2698 |
+ |
// make_kin_plot("mll",jzbcut3.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ll} [GeV]","mll_osof_aboveJZB50",doPF,true,true); |
2699 |
+ |
// make_kin_plot("mll",jzbcut3.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ll} [GeV]","mll_ee_aboveJZB50",doPF,true); |
2700 |
+ |
// make_kin_plot("mll",jzbcut3.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ll} [GeV]","mll_mm_aboveJZB50",doPF,true); |
2701 |
+ |
|
2702 |
+ |
// make_kin_plot("mll","met[4]>100",(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ll} [GeV] (MET>100GeV)","mll_met100_ll",doPF,true); |
2703 |
+ |
//make_kin_plot("mll","met[4]>150&&id1==0",(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ee} [GeV] (MET>150GeV)","mll_met150_ee",doPF,true); |
2704 |
+ |
//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);*/ |
2705 |
+ |
} |
2706 |
+ |
|
2707 |
+ |
make_special_obs_pred_mll_plot(datajzb,mcjzb,0); |
2708 |
+ |
make_special_obs_pred_mll_plot(datajzb,mcjzb,50); |
2709 |
+ |
make_special_obs_pred_mll_plot(datajzb,mcjzb,80); |
2710 |
+ |
make_special_obs_pred_mll_plot(datajzb,mcjzb,100); |
2711 |
+ |
make_special_obs_pred_mll_plot(datajzb,mcjzb,150); |
2712 |
+ |
make_special_obs_pred_mll_plot(datajzb,mcjzb,200); |
2713 |
+ |
make_special_obs_pred_mll_plot(datajzb,mcjzb,250); |
2714 |
+ |
/* |
2715 |
+ |
make_JES_plot(cutmass&&cutOSSF&&basiccut,"_ossf"); |
2716 |
+ |
make_JES_plot(cutmass&&cutOSOF&&basiccut,"_osof"); |
2717 |
+ |
*/ |
2718 |
+ |
switch_overunderflow(false); |
2719 |
|
} |
2720 |
|
|
2721 |
|
void make_comp_plot( string var, string xlabel, string filename, float jzbcut, string mcjzb, string datajzb, |
2731 |
|
|
2732 |
|
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak ---- below: the next ~20 lines changed! |
2733 |
|
int nRegions=4; |
2734 |
< |
if(!PlottingSetup::RestrictToMassPeak) { |
2734 |
> |
if(!PlottingSetup::RestrictToMassPeak||!PlottingSetup::UseSidebandsForcJZB) { |
2735 |
|
nRegions=2; |
2736 |
|
} |
2737 |
|
|
2738 |
|
string sRegions[] = { "SFZP","OFZP","SFSB","OFSB" }; |
2739 |
+ |
if(!RestrictToMassPeak) { |
2740 |
+ |
sRegions[0]="SF"; |
2741 |
+ |
sRegions[1]="OF"; |
2742 |
+ |
} |
2743 |
|
TCut kRegions[] = { cutOSSF&&cutnJets&&cutmass, cutOSOF&&cutnJets&&cutmass, |
2744 |
|
cutOSSF&&cutnJets&&sidebandcut, cutOSOF&&cutnJets&&sidebandcut }; |
2745 |
|
|
2759 |
|
if (ymax>ymin) datahisto->SetMaximum(ymax); |
2760 |
|
lm3histo->SetLineStyle(2); |
2761 |
|
datahisto->Draw("e1"); |
2762 |
< |
mcstack.Draw("same"); |
2762 |
> |
mcstack.Draw("histo,same"); |
2763 |
|
datahisto->Draw("same,e1"); |
2764 |
|
lm3histo->Draw("hist,same"); |
2765 |
|
TLegend *kinleg = allsamples.allbglegend((sRegions[iregion]+(ijzb?"neg":"pos")).c_str()); |
2789 |
|
|
2790 |
|
// switch_overunderflow(true); // switching overflow/underflow bins on |
2791 |
|
|
2792 |
< |
|
2792 |
> |
switch_overunderflow(true); |
2793 |
|
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak ---- the arguments changed |
2794 |
|
for(int ijzb=0;ijzb<(int)jzb_cuts.size();ijzb++) { |
2795 |
|
float jzbcut=jzb_cuts[ijzb]; // Comparison plots are done for this JZB cut |
2802 |
|
make_comp_plot("TMath::Abs(pfJetDphiMet[0])","|#Delta#phi(jet1,MET)|","dphiJ1MET",jzbcut,mcjzb,datajzb,32,0,3.2,false,0,0,true); |
2803 |
|
|
2804 |
|
make_comp_plot("mll","m_{ll} [GeV]","mll",jzbcut,mcjzb,datajzb,56,mll_low,mll_high,false,0,16.); |
2805 |
< |
make_comp_plot("met[4]","pfMET [GeV]","pfmet",jzbcut,mcjzb,datajzb,18,0,360,false,0,16.); |
2805 |
> |
make_comp_plot("met[4]","E_{T}^{miss} [GeV]","pfmet",jzbcut,mcjzb,datajzb,18,0,360,false,0,16.); |
2806 |
|
make_comp_plot("pfJetGoodNum40","#(jets)","njets",jzbcut,mcjzb,datajzb,10,0,10, false,0,35.); |
2807 |
|
make_comp_plot("pfJetGoodNumBtag","#(b-jets)","nBjets",jzbcut,mcjzb,datajzb,10,0,10, false,0,35.); |
2808 |
|
make_comp_plot("pt","Z p_{T} [GeV]","Zpt",jzbcut,mcjzb,datajzb,26,0,525,false,0.,21.); |
2834 |
|
|
2835 |
|
float simulatedlumi=luminosity;//in pb please - adjust to your likings |
2836 |
|
|
2837 |
< |
TH1F *JZBplotZJETs = allsamples.Draw("JZBplotZJETs",jzbvariablemc,sbg_nbins,sbg_min,sbg_max, "JZB [GeV]", "events",cutmass&&cutOSSF&&cutnJets,mc,simulatedlumi,allsamples.FindSample("/DY")); |
2837 |
> |
TH1F *JZBplotZJETs = allsamples.Draw("JZBplotZJETs",jzbvariablemc,sbg_nbins,sbg_min,sbg_max, "JZB [GeV]", "events",cutmass&&cutOSSF&&cutnJets,mc,simulatedlumi,allsamples.FindSample("M-20_CT10_")); |
2838 |
|
TH1F *JZBplotLM4; |
2839 |
|
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")); |
2840 |
|
else JZBplotLM4 = allsamples.Draw("JZBplotLM4",jzbvariablemc,sbg_nbins,sbg_min,sbg_max, "JZB [GeV]", "events",cutmass&&cutOSSF&&cutnJets,mc,simulatedlumi,allsamples.FindSample("LM3")); |
2841 |
< |
TH1F *JZBplotTtbar = allsamples.Draw("JZBplotTtbar",jzbvariablemc,sbg_nbins,sbg_min,sbg_max, "JZB [GeV]", "events",cutmass&&cutOSSF&&cutnJets,mc,simulatedlumi,allsamples.FindSample("TTJets")); |
2841 |
> |
TH1F *JZBplotTtbar = allsamples.Draw("JZBplotTtbar",jzbvariablemc,sbg_nbins,sbg_min,sbg_max, "JZB [GeV]", "events",cutmass&&cutOSSF&&cutnJets,mc,simulatedlumi,allsamples.FindSample("TT_")); |
2842 |
|
|
2843 |
|
JZBplotTtbar->SetLineColor(allsamples.GetColor("TTJet")); |
2844 |
|
JZBplotZJETs->SetFillColor(allsamples.GetColor("DY")); |
2849 |
|
|
2850 |
|
JZBplotTtbar->SetMaximum(JZBplotZJETs->GetMaximum()); |
2851 |
|
JZBplotTtbar->SetMinimum(0.01); |
2852 |
< |
JZBplotTtbar->SetFillColor(allsamples.GetColor("TTJets")); |
2852 |
> |
JZBplotTtbar->SetFillColor(allsamples.GetColor("TT_")); |
2853 |
|
JZBplotTtbar->DrawClone("histo"); |
2854 |
|
JZBplotZJETs->Draw("histo,same"); |
2855 |
|
JZBplotTtbar->SetFillColor(0); |
2856 |
|
JZBplotTtbar->DrawClone("histo,same"); |
2857 |
< |
JZBplotTtbar->SetFillColor(allsamples.GetColor("TTJets")); |
2857 |
> |
JZBplotTtbar->SetFillColor(allsamples.GetColor("TT_")); |
2858 |
|
JZBplotLM4->Draw("histo,same"); |
2859 |
|
|
2860 |
|
|
2892 |
|
// Draw all plots overlaid |
2893 |
|
JZBplotTtbar->SetMaximum(JZBplotZJETs->GetMaximum()); |
2894 |
|
JZBplotTtbar->SetMinimum(0.01); |
2895 |
< |
JZBplotTtbar->SetFillColor(allsamples.GetColor("TTJets")); |
2895 |
> |
JZBplotTtbar->SetFillColor(allsamples.GetColor("TT_")); |
2896 |
|
JZBplotTtbar->DrawClone("histo"); |
2897 |
|
JZBplotZJETs->Draw("histo,same"); |
2898 |
|
JZBplotTtbar->SetFillColor(0); |
2899 |
|
JZBplotTtbar->DrawClone("histo,same"); |
2900 |
< |
JZBplotTtbar->SetFillColor(allsamples.GetColor("TTJets")); |
2900 |
> |
JZBplotTtbar->SetFillColor(allsamples.GetColor("TT_")); |
2901 |
|
|
2902 |
|
JZBplotSMS1->SetLineColor(kRed+1); |
2903 |
|
JZBplotSMS2->SetLineColor(kBlue+1); |
3009 |
|
// the line above is not necessary anymore as we're now looking at a prediction without Z+Jets, and not multiplied with (1.0/3) |
3010 |
|
TF1 *ttbarlogpar = do_logpar_fit_to_plot(Tprediction); |
3011 |
|
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak |
3012 |
< |
if(PlottingSetup::RestrictToMassPeak) ttbarlogpar->SetParameter(0,1.0/3*ttbarlogpar->GetParameter(0));//correcting for the fact that we didn't multiply with (1.0/3); |
3012 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) ttbarlogpar->SetParameter(0,1.0/3*ttbarlogpar->GetParameter(0));//correcting for the fact that we didn't multiply with (1.0/3); |
3013 |
|
|
3014 |
|
|
3015 |
|
TF1 *ttbarlogparP = new TF1("ttbarlogparP",LogParabolaP,0,(prediction->GetXaxis()->GetBinLowEdge(prediction->GetNbinsX())+prediction->GetXaxis()->GetBinWidth(prediction->GetNbinsX())),8); |
3104 |
|
return return_functions; |
3105 |
|
} |
3106 |
|
|
3107 |
< |
void do_prediction_plot(string jzb, TCanvas *globalcanvas, float high, int use_data, bool overlay_signal = false,string subdir="" ) |
3107 |
> |
void do_prediction_plot(TCut addcut, string Cname, string jzb, TCanvas *globalcanvas, float high, int use_data, bool overlay_signal = false,string subdir="" ) |
3108 |
|
{ |
3109 |
< |
// switch_overunderflow(true); |
3109 |
> |
|
3110 |
|
bool is_data=false; |
3111 |
|
bool use_signal=false; |
3112 |
|
if(use_data==1) is_data=true; |
3113 |
|
if(use_data==2) use_signal=true; |
3114 |
< |
int nbins=50;//100; |
3115 |
< |
if(is_data) nbins=50; |
3114 |
> |
int nbins=int(high/10);//100; |
3115 |
> |
if(is_data) nbins=int(high/10); |
3116 |
|
float low=0; |
3117 |
< |
float hi=500; |
3117 |
> |
float hi=high; |
3118 |
> |
|
3119 |
> |
stringstream cutpositiveS; |
3120 |
> |
cutpositiveS << "(" << jzb << ">0)"; |
3121 |
> |
TCut cutpositive(cutpositiveS.str().c_str()); |
3122 |
> |
stringstream cutnegativeS; |
3123 |
> |
cutnegativeS << "(" << jzb << "<0)"; |
3124 |
> |
TCut cutnegative(cutnegativeS.str().c_str()); |
3125 |
> |
|
3126 |
|
|
3127 |
|
TH1F *blankback = new TH1F("blankback","blankback",int(high/10),0,high); |
3128 |
< |
TH1F *RcorrJZBeemm = allsamples.Draw("RcorrJZBeemm",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
3129 |
< |
TH1F *LcorrJZBeemm = allsamples.Draw("LcorrJZBeemm",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
3130 |
< |
TH1F *RcorrJZBem = allsamples.Draw("RcorrJZBem",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
3131 |
< |
TH1F *LcorrJZBem = allsamples.Draw("LcorrJZBem",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
3128 |
> |
TH1F *RcorrJZBeemm = allsamples.Draw("RcorrJZBeemm",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", addcut&&cutpositive&&cutmass&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
3129 |
> |
TH1F *LcorrJZBeemm = allsamples.Draw("LcorrJZBeemm",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", addcut&&cutnegative&&cutmass&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
3130 |
> |
TH1F *RcorrJZBem = allsamples.Draw("RcorrJZBem",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", addcut&&cutpositive&&cutmass&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
3131 |
> |
TH1F *LcorrJZBem = allsamples.Draw("LcorrJZBem",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", addcut&&cutnegative&&cutmass&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
3132 |
|
|
3133 |
|
blankback->GetXaxis()->SetTitle(RcorrJZBeemm->GetXaxis()->GetTitle()); |
3134 |
|
blankback->GetYaxis()->SetTitle(RcorrJZBeemm->GetYaxis()->GetTitle()); |
3143 |
|
|
3144 |
|
TH1F *RcorrJZBeemmNoS; |
3145 |
|
|
3146 |
< |
//these are for the ratio |
3147 |
< |
|
3148 |
< |
TH1F *JRcorrJZBeemm = allsamples.Draw("JRcorrJZBeemm",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
3149 |
< |
TH1F *JLcorrJZBeemm = allsamples.Draw("JLcorrJZBeemm",("-"+jzb).c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
3150 |
< |
TH1F *JRcorrJZBem = allsamples.Draw("JRcorrJZBem",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
1166 |
< |
TH1F *JLcorrJZBem = allsamples.Draw("JLcorrJZBem",("-"+jzb).c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
3146 |
> |
//these are for the ratio |
3147 |
> |
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); |
3148 |
> |
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); |
3149 |
> |
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); |
3150 |
> |
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); |
3151 |
|
|
3152 |
|
TH1F *JRcorrJZBSBem; |
3153 |
|
TH1F *JLcorrJZBSBem; |
3154 |
|
TH1F *JRcorrJZBSBeemm; |
3155 |
|
TH1F *JLcorrJZBSBeemm; |
3156 |
|
|
3157 |
< |
if(use_data==2 || overlay_signal) RcorrJZBeemmNoS = allsamples.Draw("RcorrJZBeemmNoS",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,is_data, luminosity,false); |
3157 |
> |
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); |
3158 |
|
|
3159 |
|
|
3160 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
3161 |
< |
RcorrJZBSBem = allsamples.Draw("RcorrJZBSBem",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
3162 |
< |
LcorrJZBSBem = allsamples.Draw("LcorrJZBSBem",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
3163 |
< |
RcorrJZBSBeemm = allsamples.Draw("RcorrJZBSBeemm",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
3164 |
< |
LcorrJZBSBeemm = allsamples.Draw("LcorrJZBSBeemm",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
3160 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
3161 |
> |
RcorrJZBSBem = allsamples.Draw("RcorrJZBSBem",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", addcut&&cutpositive&&sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
3162 |
> |
LcorrJZBSBem = allsamples.Draw("LcorrJZBSBem",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", addcut&&cutnegative&&sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
3163 |
> |
RcorrJZBSBeemm = allsamples.Draw("RcorrJZBSBeemm",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", addcut&&cutpositive&&sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
3164 |
> |
LcorrJZBSBeemm = allsamples.Draw("LcorrJZBSBeemm",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", addcut&&cutnegative&&sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
3165 |
|
|
3166 |
|
//these are for the ratio |
3167 |
< |
JRcorrJZBSBem = allsamples.Draw("JRcorrJZBSBem",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
3168 |
< |
JLcorrJZBSBem = allsamples.Draw("JLcorrJZBSBem",("-"+jzb).c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
3169 |
< |
JRcorrJZBSBeemm = allsamples.Draw("JRcorrJZBSBeemm",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
3170 |
< |
JLcorrJZBSBeemm = allsamples.Draw("JLcorrJZBSBeemm",("-"+jzb).c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
3167 |
> |
JRcorrJZBSBem = allsamples.Draw("JRcorrJZBSBem",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", addcut&&cutpositive&&sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
3168 |
> |
JLcorrJZBSBem = allsamples.Draw("JLcorrJZBSBem",("-"+jzb).c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", addcut&&cutnegative&&sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
3169 |
> |
JRcorrJZBSBeemm = allsamples.Draw("JRcorrJZBSBeemm",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", addcut&&cutpositive&&sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
3170 |
> |
JLcorrJZBSBeemm = allsamples.Draw("JLcorrJZBSBeemm",("-"+jzb).c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", addcut&&cutnegative&&sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
3171 |
|
} |
3172 |
|
|
3173 |
|
TH1F *lm4RcorrJZBeemm; |
3174 |
< |
if(overlay_signal || use_data == 2 || use_data == 1) lm4RcorrJZBeemm = allsamples.Draw("lm4RcorrJZBSBeemm",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,is_data, luminosity,allsamples.FindSample("LM")); |
3174 |
> |
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")); |
3175 |
|
|
3176 |
|
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak ---- prediction changed. |
3177 |
|
|
3184 |
|
TH1F *BpredSys = new TH1F("Bpredsys","Bpredsys",PlottingSetup::global_ratio_binning.size()-1,&PlottingSetup::global_ratio_binning[0]); |
3185 |
|
ClearHisto(BpredSys); |
3186 |
|
|
3187 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
3187 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
3188 |
|
Bpred->Add(RcorrJZBem,1.0/3.); |
3189 |
|
Bpred->Add(LcorrJZBem,-1.0/3.); |
3190 |
|
Bpred->Add(RcorrJZBSBem,1.0/3.); |
3235 |
|
SQRT(BpredSys); |
3236 |
|
BpredSys->Divide(JBpred); |
3237 |
|
|
1254 |
– |
|
3238 |
|
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak ---- prediction changed |
3239 |
|
TH1F *Tpred = (TH1F*)RcorrJZBem->Clone("Bpred"); |
3240 |
|
Tpred->Add(LcorrJZBem,-1.0); |
3241 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
3241 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
3242 |
|
Tpred->Add(RcorrJZBSBem,1.0); |
3243 |
|
Tpred->Add(LcorrJZBSBem,-1.0); |
3244 |
|
Tpred->Add(RcorrJZBSBeemm,1.0); |
3287 |
|
Bpred->Draw("hist,same"); |
3288 |
|
//analytical_function[0]->Draw("same"); analytical_function[1]->Draw("same");analytical_function[2]->Draw("same"); |
3289 |
|
RcorrJZBeemm->Draw("e1x0,same");//HAVE IT ON TOP! |
3290 |
< |
lm4RcorrJZBeemm->Draw("hist,same"); |
3290 |
> |
//lm4RcorrJZBeemm->Draw("hist,same"); |
3291 |
|
legBpred->AddEntry(RcorrJZBeemm,"observed","p"); |
3292 |
|
legBpred->AddEntry(Bpred,"predicted","l"); |
3293 |
|
// legBpred->AddEntry(analytical_function[1],"predicted fit","l"); |
3294 |
|
// legBpred->AddEntry(analytical_function[2],"stat. uncert.","l"); |
3295 |
< |
legBpred->AddEntry(lm4RcorrJZBeemm,(allsamples.collection[allsamples.FindSample("LM")[0]].samplename).c_str(),"l"); |
3295 |
> |
// legBpred->AddEntry(lm4RcorrJZBeemm,(allsamples.collection[allsamples.FindSample("LM")[0]].samplename).c_str(),"l"); |
3296 |
|
legBpred->Draw(); |
3297 |
|
DrawPrelim(); |
3298 |
|
|
3302 |
|
Bpred->SetLineWidth(2); |
3303 |
|
predcomppad->cd(); |
3304 |
|
predcomppad->SetLogy(1); |
1322 |
– |
|
3305 |
|
TH1F *jzbnegative = (TH1F*)LcorrJZBeemm->Clone("jzbnegative"); |
3306 |
|
TH1F *sidebandsemu = (TH1F*)Bpred->Clone("sidebandsemu"); |
3307 |
|
sidebandsemu->Add(jzbnegative,-1); |
3308 |
|
|
3309 |
|
jzbnegative->SetFillColor(allsamples.GetColor((allsamples.FindSample("DY"))[0])); |
3310 |
|
jzbnegative->SetLineColor(allsamples.GetColor((allsamples.FindSample("DY"))[0])); |
3311 |
< |
sidebandsemu->SetLineColor(allsamples.GetColor((allsamples.FindSample("TTJets"))[0])); |
3312 |
< |
sidebandsemu->SetFillColor(allsamples.GetColor((allsamples.FindSample("TTJets"))[0])); |
3311 |
> |
sidebandsemu->SetLineColor(allsamples.GetColor((allsamples.FindSample("TT_"))[0])); |
3312 |
> |
sidebandsemu->SetFillColor(allsamples.GetColor((allsamples.FindSample("TT_"))[0])); |
3313 |
|
|
3314 |
|
THStack predcomposition("predcomposition","prediction composition"); |
3315 |
|
predcomposition.Add(sidebandsemu); |
3323 |
|
// lm4RcorrJZBeemm->SetLineColor(kOrange+1); |
3324 |
|
lm4RcorrJZBeemm->SetLineWidth(2); |
3325 |
|
//lm4RcorrJZBeemm->SetLineWidth(2); // paper style. overruled. |
3326 |
< |
lm4RcorrJZBeemm->Draw("histo,same"); |
3326 |
> |
// lm4RcorrJZBeemm->Draw("histo,same"); |
3327 |
|
DrawPrelim(); |
3328 |
|
TLegend *speciallegBpred = make_legend("",0.45,0.55); |
3329 |
|
//TLegend *speciallegBpred = make_legend("",0.35,0.55); // paper style. overruled. |
3330 |
|
speciallegBpred->AddEntry(RcorrJZBeemm,"Data","pl"); |
3331 |
|
speciallegBpred->AddEntry(Bpred,"Total background","l"); |
3332 |
|
speciallegBpred->AddEntry(jzbnegative,"JZB<0 (data)","f"); |
3333 |
< |
if(PlottingSetup::RestrictToMassPeak) speciallegBpred->AddEntry(sidebandsemu,"Sidebands/e#mu (data)","f"); |
3333 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) speciallegBpred->AddEntry(sidebandsemu,"Sidebands/e#mu (data)","f"); |
3334 |
|
else speciallegBpred->AddEntry(sidebandsemu,"e#mu (data)","f"); |
3335 |
|
// speciallegBpred->AddEntry(lm4RcorrJZBeemmC,"LM4","l"); |
3336 |
< |
speciallegBpred->AddEntry(lm4RcorrJZBeemm,"LM4","l"); |
3336 |
> |
// speciallegBpred->AddEntry(lm4RcorrJZBeemm,"LM4","l"); |
3337 |
|
speciallegBpred->Draw(); |
3338 |
< |
save_with_ratio(JRcorrJZBeemm,JBpred,predcomppad,subdir+"Bpred_Data_____PredictionComposition",true,true,"data/pred",BpredSys); |
3338 |
> |
Save_With_Ratio(JRcorrJZBeemm,JBpred,predcomppad,subdir+"Bpred_Data_____PredictionComposition",true,true,"data/pred",BpredSys); |
3339 |
> |
delete predcomppad; |
3340 |
|
|
3341 |
|
TCanvas *specialcanv = new TCanvas("specialcanv","specialcanv"); |
3342 |
|
specialcanv->SetLogy(1); |
3343 |
|
// THStack kostack = allsamples.DrawStack("RcorrJZBeemm",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,!is_data, luminosity,use_signal); |
3344 |
|
blankback->Draw(); |
3345 |
|
// kostack.Draw("same"); |
3346 |
< |
predcomposition.Draw(); |
3346 |
> |
predcomposition.Draw("hist"); |
3347 |
|
Bpred->Draw("hist,same"); |
3348 |
|
//analytical_function[0]->Draw("same"); analytical_function[1]->Draw("same");analytical_function[2]->Draw("same"); |
3349 |
|
RcorrJZBeemm->Draw("e1x0,same");//HAVE IT ON TOP! |
3370 |
|
legBpred->AddEntry(Bpred,"MC predicted","l"); |
3371 |
|
if(versok) legBpred->AddEntry((TObject*)0,"",""); // Just for alignment // causes seg fault on root v5.18 |
3372 |
|
if(versok) legBpred->AddEntry((TObject*)0,"",""); // causes seg fault on root v5.18 |
3373 |
< |
if ( overlay_signal ) legBpred->AddEntry(lm4RcorrJZBeemm,"LM4","l"); |
3373 |
> |
// if ( overlay_signal ) legBpred->AddEntry(lm4RcorrJZBeemm,"LM4","l"); |
3374 |
|
legBpred->Draw(); |
3375 |
|
DrawMCPrelim(); |
3376 |
|
Bpredsaveas="Bpred_MC"; |
3402 |
|
|
3403 |
|
RcorrJZBeemmNoS->SetLineStyle(2); |
3404 |
|
legBpred2->AddEntry(RcorrJZBeemmNoS,"MC B","l"); |
3405 |
< |
legBpred2->AddEntry(lm4RcorrJZBeemm,"MC S","l"); |
3405 |
> |
// legBpred2->AddEntry(lm4RcorrJZBeemm,"MC S","l"); |
3406 |
|
legBpred2->Draw(); |
3407 |
|
RcorrJZBeemmNoS->SetLineColor(TColor::GetColor("#61210B")); |
3408 |
|
RcorrJZBeemmNoS->Draw("histo,same"); |
3415 |
|
} |
3416 |
|
|
3417 |
|
|
3418 |
+ |
Bpredsaveas+="_"+Cname+"_"; |
3419 |
|
//3rd last argument: do special bpred ratio, 2nd last argument: extended range!, last: y-axis title |
3420 |
|
string ytitle("ratio"); |
3421 |
|
if ( use_data==1 ) ytitle = "data/pred"; |
3422 |
|
//save_with_ratio(JRcorrJZBeemm,JBpred,kinpad,Bpredsaveas,true,use_data!=1,ytitle); |
3423 |
< |
save_with_ratio(JRcorrJZBeemm,JBpred,kinpad,subdir+Bpredsaveas,true,false,ytitle,BpredSys);//not extending the y range anymore up to 4 |
3423 |
> |
Save_With_Ratio(JRcorrJZBeemm,JBpred,kinpad,subdir+Bpredsaveas,true,false,ytitle,BpredSys);//not extending the y range anymore up to 4 |
3424 |
> |
|
3425 |
> |
delete kinpad; |
3426 |
> |
|
3427 |
|
|
3428 |
|
|
3429 |
|
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak |
3430 |
|
// The part below is meaningless for the offpeak analysis (it's a comparison of the different estimates but there is but one estimate!) |
3431 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
3431 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
3432 |
|
TH1F *Bpredem = (TH1F*)LcorrJZBeemm->Clone("Bpredem"); |
3433 |
|
Bpredem->Add(RcorrJZBem); |
3434 |
|
Bpredem->Add(LcorrJZBem,-1); |
3464 |
|
if(use_data==1) |
3465 |
|
{ |
3466 |
|
legBpredc->AddEntry(RcorrJZBeemm,"observed","p"); |
3467 |
< |
legBpredc->AddEntry(Bpredem,"OFZP","l"); |
3468 |
< |
legBpredc->AddEntry(BpredSBem,"OFSB","l"); |
3469 |
< |
legBpredc->AddEntry(BpredSBeemm,"SFSB","l"); |
3467 |
> |
if(RestrictToMassPeak) { |
3468 |
> |
legBpredc->AddEntry(Bpredem,"OFZP","l"); |
3469 |
> |
legBpredc->AddEntry(BpredSBem,"OFSB","l"); |
3470 |
> |
legBpredc->AddEntry(BpredSBeemm,"SFSB","l"); |
3471 |
> |
} else legBpredc->AddEntry(Bpredem,"OF","l"); |
3472 |
> |
|
3473 |
> |
|
3474 |
|
legBpredc->Draw(); |
3475 |
|
CompleteSave(globalcanvas,subdir+"Bpred_Data_comparison"); |
3476 |
|
} |
3477 |
|
if(use_data==0) { |
3478 |
|
legBpredc->AddEntry(RcorrJZBeemm,"MC true","p"); |
3479 |
< |
legBpredc->AddEntry(Bpredem,"MC OFZP","l"); |
3480 |
< |
legBpredc->AddEntry(BpredSBem,"MC OFSB","l"); |
3481 |
< |
legBpredc->AddEntry(BpredSBeemm,"MC SFSB","l"); |
3479 |
> |
if(RestrictToMassPeak) { |
3480 |
> |
legBpredc->AddEntry(Bpredem,"MC OFZP","l"); |
3481 |
> |
legBpredc->AddEntry(BpredSBem,"MC OFSB","l"); |
3482 |
> |
legBpredc->AddEntry(BpredSBeemm,"MC SFSB","l"); |
3483 |
> |
} else legBpredc->AddEntry(Bpredem,"MC OF","l"); |
3484 |
> |
|
3485 |
|
legBpredc->Draw(); |
3486 |
|
CompleteSave(globalcanvas,subdir+"Bpred_MC_comparison"); |
3487 |
|
} |
3488 |
|
if(use_data==2) { |
3489 |
|
legBpredc->AddEntry(RcorrJZBeemm,"MC true","p"); |
3490 |
< |
legBpredc->AddEntry(Bpredem,"MC OFZP","l"); |
3491 |
< |
legBpredc->AddEntry(BpredSBem,"MC OFSB","l"); |
3492 |
< |
legBpredc->AddEntry(BpredSBeemm,"MC SFSB","l"); |
3493 |
< |
if ( overlay_signal ) legBpred->AddEntry(lm4RcorrJZBeemm,"LM4","l"); |
3490 |
> |
if(RestrictToMassPeak) { |
3491 |
> |
legBpredc->AddEntry(Bpredem,"MC OFZP","l"); |
3492 |
> |
legBpredc->AddEntry(BpredSBem,"MC OFSB","l"); |
3493 |
> |
legBpredc->AddEntry(BpredSBeemm,"MC SFSB","l"); |
3494 |
> |
} else { |
3495 |
> |
legBpredc->AddEntry(Bpredem,"MC OF","l"); |
3496 |
> |
} |
3497 |
> |
// if ( overlay_signal ) legBpred->AddEntry(lm4RcorrJZBeemm,"LM4","l"); |
3498 |
|
legBpredc->Draw(); |
3499 |
|
CompleteSave(globalcanvas,subdir+"Bpred_MCwithS_comparison"); |
3500 |
|
} |
3501 |
|
} |
3502 |
|
|
1505 |
– |
TFile *f = new TFile("tester.root","RECREATE"); |
1506 |
– |
RcorrJZBeemm->Write(); |
1507 |
– |
Bpred->Write(); |
1508 |
– |
f->Close(); |
1509 |
– |
|
3503 |
|
delete RcorrJZBeemm; |
3504 |
|
delete LcorrJZBeemm; |
3505 |
|
delete RcorrJZBem; |
3513 |
|
delete blankback; |
3514 |
|
|
3515 |
|
delete BpredSys; |
3516 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
3516 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
3517 |
|
delete RcorrJZBSBem; |
3518 |
|
delete LcorrJZBSBem; |
3519 |
|
delete RcorrJZBSBeemm; |
3525 |
|
delete JLcorrJZBSBeemm; |
3526 |
|
} |
3527 |
|
if(overlay_signal || use_data==2) delete lm4RcorrJZBeemm; |
1535 |
– |
switch_overunderflow(false); |
3528 |
|
} |
3529 |
|
|
3530 |
|
void do_prediction_plots(string mcjzb, string datajzb, float DataSigma, float MCSigma, bool overlay_signal ) { |
3531 |
< |
TCanvas *globalcanvas = new TCanvas("globalcanvas","Prediction Canvas"); |
1540 |
< |
do_prediction_plot(datajzb,globalcanvas,jzbHigh ,data,overlay_signal); |
1541 |
< |
if ( !PlottingSetup::Approved ) { |
1542 |
< |
do_prediction_plot(mcjzb,globalcanvas,jzbHigh ,mc,overlay_signal); |
1543 |
< |
do_prediction_plot(mcjzb,globalcanvas,jzbHigh ,mcwithsignal,overlay_signal); |
1544 |
< |
} else { |
1545 |
< |
write_info(__FUNCTION__,"You set approved to true, therefore not producing prediction/observation plots for MC with and without signal."); |
1546 |
< |
} |
1547 |
< |
} |
1548 |
< |
|
1549 |
< |
void do_ratio_plot(int is_data,vector<float> binning, string jzb, TCanvas *can, float high=-9999) { |
1550 |
< |
bool do_data=0; |
1551 |
< |
bool dosignal=0; |
1552 |
< |
if(is_data==1) do_data=1; |
1553 |
< |
if(is_data==2) dosignal=1; |
1554 |
< |
TH1F *RcorrJZBeemm = allsamples.Draw("RcorrJZBeemm",jzb.c_str(),binning, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,do_data, luminosity,dosignal); |
1555 |
< |
TH1F *LcorrJZBeemm = allsamples.Draw("LcorrJZBeemm",("-"+jzb).c_str(),binning, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,do_data, luminosity,dosignal); |
1556 |
< |
TH1F *RcorrJZBem = allsamples.Draw("RcorrJZBem",jzb.c_str(),binning, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets,do_data, luminosity,dosignal); |
1557 |
< |
TH1F *LcorrJZBem = allsamples.Draw("LcorrJZBem",("-"+jzb).c_str(),binning, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets,do_data, luminosity,dosignal); |
3531 |
> |
switch_overunderflow(true); |
3532 |
|
|
3533 |
< |
TH1F *RcorrJZBSBem; |
3534 |
< |
TH1F *LcorrJZBSBem; |
1561 |
< |
TH1F *RcorrJZBSBeemm; |
1562 |
< |
TH1F *LcorrJZBSbeemm; |
3533 |
> |
TCut cuts[3] = {TCut("mll>0"),Restrmasscut,TCut("mll>20&&mll<70")}; |
3534 |
> |
string cutnames[3] = {"NoMassCut","ZWindow","LowMassRegion2070"}; |
3535 |
|
|
3536 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
3537 |
< |
RcorrJZBSBem = allsamples.Draw("RcorrJZBSbem",jzb.c_str(),binning, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,do_data, luminosity,dosignal); |
3538 |
< |
LcorrJZBSBem = allsamples.Draw("LcorrJZBSbem",("-"+jzb).c_str(),binning, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,do_data, luminosity,dosignal); |
3539 |
< |
RcorrJZBSBeemm = allsamples.Draw("RcorrJZBSbeemm",jzb.c_str(),binning, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets,do_data, luminosity,dosignal); |
3540 |
< |
LcorrJZBSbeemm = allsamples.Draw("LcorrJZBSbeemm",("-"+jzb).c_str(),binning, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets,do_data, luminosity,dosignal); |
3541 |
< |
} |
3542 |
< |
|
3543 |
< |
|
3544 |
< |
|
1573 |
< |
|
1574 |
< |
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak |
1575 |
< |
TH1F *Bpred = (TH1F*)LcorrJZBeemm->Clone("Bpred"); |
1576 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
1577 |
< |
Bpred->Add(RcorrJZBem,1.0/3); |
1578 |
< |
Bpred->Add(LcorrJZBem,-1.0/3); |
1579 |
< |
Bpred->Add(RcorrJZBSBem,1.0/3); |
1580 |
< |
Bpred->Add(LcorrJZBSBem,-1.0/3); |
1581 |
< |
Bpred->Add(RcorrJZBSBeemm,1.0/3); |
1582 |
< |
Bpred->Add(LcorrJZBSbeemm,-1.0/3); |
1583 |
< |
} else { |
1584 |
< |
Bpred->Add(RcorrJZBem,1.0); |
1585 |
< |
Bpred->Add(LcorrJZBem,-1.0); |
3536 |
> |
TCanvas *globalcanvas = new TCanvas("globalcanvas","Prediction Canvas"); |
3537 |
> |
for(int i=0;i<3;i++) { |
3538 |
> |
do_prediction_plot(cuts[i],cutnames[i],datajzb,globalcanvas,jzbHigh ,data,overlay_signal); |
3539 |
> |
if ( !PlottingSetup::Approved ) { |
3540 |
> |
do_prediction_plot(cuts[i],cutnames[i],mcjzb,globalcanvas,jzbHigh ,mc,overlay_signal); |
3541 |
> |
do_prediction_plot(cuts[i],cutnames[i],mcjzb,globalcanvas,jzbHigh ,mcwithsignal,overlay_signal); |
3542 |
> |
} else { |
3543 |
> |
write_info(__FUNCTION__,"You set approved to true, therefore not producing prediction/observation plots for MC with and without signal."); |
3544 |
> |
} |
3545 |
|
} |
1587 |
– |
|
1588 |
– |
can->cd(); |
1589 |
– |
can->SetLogy(0); |
1590 |
– |
Bpred->SetLineColor(kRed); |
1591 |
– |
Bpred->SetStats(0); |
1592 |
– |
if(high>0) Bpred->GetXaxis()->SetRangeUser(0,high); |
1593 |
– |
TH1F *JZBratioforfitting=(TH1F*)RcorrJZBeemm->Clone("JZBratioforfitting"); |
1594 |
– |
JZBratioforfitting->Divide(Bpred); |
1595 |
– |
TGraphAsymmErrors *JZBratio = histRatio(RcorrJZBeemm,Bpred,is_data,binning,false); |
1596 |
– |
|
1597 |
– |
|
1598 |
– |
JZBratio->SetTitle(""); |
1599 |
– |
JZBratio->GetYaxis()->SetRangeUser(0.0,9.0); |
1600 |
– |
// if(is_data==1) JZBratio->GetXaxis()->SetRangeUser(0,jzbHigh ); |
1601 |
– |
|
1602 |
– |
TF1 *pol0 = new TF1("pol0","[0]",0,1000); |
1603 |
– |
TF1 *pol0d = new TF1("pol0","[0]",0,1000); |
1604 |
– |
// straightline_fit->SetParameter(0,1); |
1605 |
– |
JZBratioforfitting->Fit(pol0,"Q0R","",0,30); |
1606 |
– |
pol0d->SetParameter(0,pol0->GetParameter(0)); |
1607 |
– |
|
1608 |
– |
JZBratio->GetYaxis()->SetTitle("Observed/Predicted"); |
1609 |
– |
JZBratio->GetXaxis()->SetTitle("JZB [GeV]"); |
1610 |
– |
if ( high>0 ) JZBratio->GetXaxis()->SetRangeUser(0.0,high); |
1611 |
– |
JZBratio->GetYaxis()->SetNdivisions(519); |
1612 |
– |
JZBratio->GetYaxis()->SetRangeUser(0.0,4.0); |
1613 |
– |
JZBratio->GetYaxis()->CenterTitle(); |
1614 |
– |
JZBratio->GetXaxis()->CenterTitle(); |
1615 |
– |
JZBratio->SetMarkerSize(DataMarkerSize); |
1616 |
– |
JZBratio->Draw("AP"); |
1617 |
– |
/////---------------------------- |
1618 |
– |
TPaveText *writeresult = new TPaveText(0.15,0.78,0.49,0.91,"blNDC"); |
1619 |
– |
writeresult->SetFillStyle(4000); |
1620 |
– |
writeresult->SetFillColor(kWhite); |
1621 |
– |
writeresult->SetTextFont(42); |
1622 |
– |
writeresult->SetTextSize(0.03); |
1623 |
– |
writeresult->SetTextAlign(12); |
1624 |
– |
ostringstream jzb_agreement_data_text; |
1625 |
– |
jzb_agreement_data_text<< setprecision(2) << "mean =" << pol0->GetParameter(0) << " #pm " << setprecision(1) << pol0->GetParError(0); |
1626 |
– |
if(is_data==1) fitresultconstdata=pol0->GetParameter(0);// data |
1627 |
– |
if(is_data==0) fitresultconstmc=pol0->GetParameter(0); // monte carlo, no signal |
1628 |
– |
/* if(is_data) writeresult->AddText("Data closure test"); |
1629 |
– |
else writeresult->AddText("MC closure test"); |
1630 |
– |
*/ |
1631 |
– |
writeresult->AddText(jzb_agreement_data_text.str().c_str()); |
1632 |
– |
// writeresult->Draw("same"); |
1633 |
– |
// pol0d->Draw("same"); |
1634 |
– |
TF1 *topline = new TF1("","1.5",0,1000); |
1635 |
– |
TF1 *bottomline = new TF1("","0.5",0,1000); |
1636 |
– |
topline->SetLineColor(kBlue); |
1637 |
– |
topline->SetLineStyle(2); |
1638 |
– |
bottomline->SetLineColor(kBlue); |
1639 |
– |
bottomline->SetLineStyle(2); |
1640 |
– |
// topline->Draw("same"); |
1641 |
– |
// bottomline->Draw("same"); |
1642 |
– |
TF1 *oneline = new TF1("","1.0",0,1000); |
1643 |
– |
oneline->SetLineColor(kBlue); |
1644 |
– |
oneline->SetLineStyle(1); |
1645 |
– |
oneline->Draw("same"); |
1646 |
– |
TLegend *phony_leg = make_legend("ratio",0.6,0.55,false);//this line is just to have the default CMS Preliminary (...) on the canvas as well. |
1647 |
– |
if(is_data==1) DrawPrelim(); |
1648 |
– |
else DrawMCPrelim(); |
1649 |
– |
TLegend *leg = new TLegend(0.55,0.75,0.89,0.89); |
1650 |
– |
leg->SetTextFont(42); |
1651 |
– |
leg->SetTextSize(0.04); |
1652 |
– |
// if(is_data==1) leg->SetHeader("Ratio (data)"); |
1653 |
– |
// else leg->SetHeader("Ratio (MC)"); |
1654 |
– |
|
1655 |
– |
TString MCtitle("MC "); |
1656 |
– |
if (is_data==1) MCtitle = ""; |
1657 |
– |
|
1658 |
– |
leg->SetFillStyle(4000); |
1659 |
– |
leg->SetFillColor(kWhite); |
1660 |
– |
leg->SetTextFont(42); |
1661 |
– |
// leg->AddEntry(topline,"+20\% sys envelope","l"); |
1662 |
– |
leg->AddEntry(JZBratio,MCtitle+"obs / "+MCtitle+"pred","p"); |
1663 |
– |
leg->AddEntry(oneline,"ratio = 1","l"); |
1664 |
– |
// leg->AddEntry(pol0d,"fit in [0,30] GeV","l"); |
1665 |
– |
// leg->AddEntry(bottomline,"#pm50% envelope","l"); |
1666 |
– |
|
1667 |
– |
|
1668 |
– |
//leg->Draw("same"); // no longer drawing legend |
1669 |
– |
|
1670 |
– |
if(is_data==1) CompleteSave(can, "jzb_ratio_data"); |
1671 |
– |
if(is_data==0) CompleteSave(can, "jzb_ratio_mc"); |
1672 |
– |
if(is_data==2) CompleteSave(can, "jzb_ratio_mc_BandS");//special case, MC with signal! |
1673 |
– |
|
1674 |
– |
delete RcorrJZBeemm; |
1675 |
– |
delete LcorrJZBeemm; |
1676 |
– |
delete RcorrJZBem; |
1677 |
– |
delete LcorrJZBem; |
3546 |
|
|
3547 |
< |
delete RcorrJZBSBem; |
3548 |
< |
delete LcorrJZBSBem; |
1681 |
< |
delete RcorrJZBSBeemm; |
1682 |
< |
delete LcorrJZBSbeemm; |
1683 |
< |
} |
1684 |
< |
|
1685 |
< |
void do_ratio_plots(string mcjzb,string datajzb,vector<float> ratio_binning) { |
1686 |
< |
TCanvas *globalc = new TCanvas("globalc","Ratio Plot Canvas"); |
1687 |
< |
globalc->SetLogy(0); |
1688 |
< |
|
1689 |
< |
do_ratio_plot(mc,ratio_binning,mcjzb,globalc, jzbHigh ); |
1690 |
< |
do_ratio_plot(data,ratio_binning,datajzb,globalc, jzbHigh ); |
1691 |
< |
do_ratio_plot(mcwithsignal,ratio_binning,mcjzb,globalc, jzbHigh ); |
3547 |
> |
delete globalcanvas; |
3548 |
> |
switch_overunderflow(false); |
3549 |
|
} |
3550 |
|
|
3551 |
|
string give_jzb_expression(float peak, int type) { |
3568 |
|
Float_t ymin = 1.e-5, ymax = 0.25; |
3569 |
|
TCanvas *can = new TCanvas("can","Lepton Comparison Canvas"); |
3570 |
|
can->SetLogy(1); |
3571 |
< |
TH1F *eemc = allsamples.Draw("eemc","mll",50,50,150, "mll [GeV]", "events", cutOSSF&&cutnJets&&"(id1==0)",mc, luminosity,allsamples.FindSample("/DY")); |
3572 |
< |
TH1F *mmmc = allsamples.Draw("mmmc","mll",50,50,150, "mll [GeV]", "events", cutOSSF&&cutnJets&&"(id1==1)",mc, luminosity,allsamples.FindSample("/DY")); |
3571 |
> |
TH1F *eemc = allsamples.Draw("eemc","mll",50,50,150, "mll [GeV]", "events", cutOSSF&&cutnJets&&"(id1==0)",mc, luminosity,allsamples.FindSample("M-20_CT10_")); |
3572 |
> |
TH1F *mmmc = allsamples.Draw("mmmc","mll",50,50,150, "mll [GeV]", "events", cutOSSF&&cutnJets&&"(id1==1)",mc, luminosity,allsamples.FindSample("M-20_CT10_")); |
3573 |
|
eemc->SetLineColor(kBlue); |
3574 |
|
mmmc->SetLineColor(kRed); |
3575 |
|
eemc->SetMinimum(0.1); |
3632 |
|
eemmlegend->AddEntry(jmmd,"#mu#mu","l"); |
3633 |
|
eemmlegend->Draw(); |
3634 |
|
DrawPrelim(); |
3635 |
< |
save_with_ratio(jeed,jmmd,eemmpad->cd(),"lepton_comparison/jzb_Comparing_ee_mm_data"); |
3635 |
> |
Save_With_Ratio(jeed,jmmd,eemmpad->cd(),"lepton_comparison/jzb_Comparing_ee_mm_data"); |
3636 |
|
|
3637 |
< |
TH1F *zjeed = allsamples.Draw("zjeed",jzbvariablemc, int((jzbHigh+150)/5),-150,jzbHigh , "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&"(id1==0)",mc, luminosity,allsamples.FindSample("/DY")); |
3638 |
< |
TH1F *zjmmd = allsamples.Draw("zjmmd",jzbvariablemc, int((jzbHigh+150)/5),-150,jzbHigh , "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&"(id1==1)",mc, luminosity,allsamples.FindSample("/DY")); |
3639 |
< |
TH1F *zjeemmd = allsamples.Draw("zjeemmd",jzbvariablemc,int((jzbHigh+150)/5),-150,jzbHigh , "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets, mc, luminosity,allsamples.FindSample("/DY")); |
3637 |
> |
TH1F *zjeed = allsamples.Draw("zjeed",jzbvariablemc, int((jzbHigh+150)/5),-150,jzbHigh , "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&"(id1==0)",mc, luminosity,allsamples.FindSample("M-20_CT10_")); |
3638 |
> |
TH1F *zjmmd = allsamples.Draw("zjmmd",jzbvariablemc, int((jzbHigh+150)/5),-150,jzbHigh , "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&"(id1==1)",mc, luminosity,allsamples.FindSample("M-20_CT10_")); |
3639 |
> |
TH1F *zjeemmd = allsamples.Draw("zjeemmd",jzbvariablemc,int((jzbHigh+150)/5),-150,jzbHigh , "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets, mc, luminosity,allsamples.FindSample("M-20_CT10_")); |
3640 |
|
dout << "Z+Jets ee : " << zjeed->GetMean() << "+/-" << zjeed->GetMeanError() << endl; |
3641 |
|
dout << "Z+Jets ee : " << zjmmd->GetMean() << "+/-" << zjmmd->GetMeanError() << endl; |
3642 |
|
dout << "Z+Jets eemd : " << zjeemmd->GetMean() << "+/-" << zjeemmd->GetMeanError() << endl; |
3733 |
|
datahisto->SetMinimum(0.1); |
3734 |
|
datahisto->SetMarkerSize(DataMarkerSize); |
3735 |
|
datahisto->Draw("e1"); |
3736 |
< |
mcstack.Draw("same"); |
3736 |
> |
mcstack.Draw("histo,same"); |
3737 |
|
datahisto->Draw("same,e1"); |
3738 |
|
|
3739 |
|
TLegend *leg; |
3740 |
< |
if (!PlottingSetup::RestrictToMassPeak) { |
3740 |
> |
if (!PlottingSetup::RestrictToMassPeak||!PlottingSetup::UseSidebandsForcJZB) { |
3741 |
|
if(is_OF(cut)) leg = allsamples.allbglegend("Opposite flavor",datahisto); |
3742 |
|
else leg = allsamples.allbglegend("Same flavor",datahisto); |
3743 |
|
} else { |
3755 |
|
TText *writeline1 = write_cut_on_canvas(write_cut.c_str()); |
3756 |
|
writeline1->SetTextSize(0.035); |
3757 |
|
writeline1->Draw(); |
3758 |
< |
if(!Contains(savename,"Dibosons")) save_with_ratio(datahisto,mcstack,jzbpad->cd(),("jzb/"+savename)); |
3759 |
< |
else save_with_ratio(datahisto,mcstack,jzbpad->cd(),savename); |
3758 |
> |
if(!Contains(savename,"Dibosons")) Save_With_Ratio(datahisto,mcstack,jzbpad->cd(),("jzb/"+savename)); |
3759 |
> |
else Save_With_Ratio(datahisto,mcstack,jzbpad->cd(),savename); |
3760 |
|
TPad *jzbpad2 = new TPad("jzbpad2","jzbpad2",0,0,1,1); |
3761 |
|
jzbpad2->cd(); |
3762 |
|
jzbpad2->SetLogy(1); |
3764 |
|
datahisto->SetMinimum(0.1); |
3765 |
|
datahisto->SetMarkerSize(DataMarkerSize); |
3766 |
|
datahisto->Draw("e1"); |
3767 |
< |
mcstack.Draw("same"); |
3767 |
> |
mcstack.Draw("histo,same"); |
3768 |
|
datahisto->Draw("same,e1"); |
3769 |
|
leg->SetHeader(""); |
3770 |
|
leg->Draw(); |
3771 |
|
writeline1->SetTextSize(0.035); |
3772 |
|
writeline1->Draw(); |
3773 |
|
DrawPrelim(); |
3774 |
< |
if(!Contains(savename,"Dibosons")) save_with_ratio(datahisto,mcstack,jzbpad2->cd(),("jzb/PositiveSideOnly/"+savename+"")); |
3775 |
< |
else save_with_ratio(datahisto,mcstack,jzbpad2->cd(),(savename+"__PosOnly")); |
3774 |
> |
if(!Contains(savename,"Dibosons")) Save_With_Ratio(datahisto,mcstack,jzbpad2->cd(),("jzb/PositiveSideOnly/"+savename+"")); |
3775 |
> |
else Save_With_Ratio(datahisto,mcstack,jzbpad2->cd(),(savename+"__PosOnly")); |
3776 |
|
datahisto->Delete(); |
3777 |
|
mcstack.Delete(); |
3778 |
|
} |
3800 |
|
draw_pure_jzb_histo(cutOSSF&&cutnJets&&cutmass&&"id1==1",datajzb,mcjzb,"Dibosons/mm/jzb_OS_SFZP",dican,binning); |
3801 |
|
draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass&&"id1==0",datajzb,mcjzb,"Dibosons/ee/jzb_OS_OFZP",dican,binning); |
3802 |
|
draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass&&"id1==1",datajzb,mcjzb,"Dibosons/mm/jzb_OS_OFZP",dican,binning); |
3803 |
< |
if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSSF&&cutnJets&&sidebandcut,datajzb,mcjzb,"Dibosons/jzb_OS_SFSB",dican,binning); |
3804 |
< |
if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSOF&&cutnJets&&sidebandcut,datajzb,mcjzb,"Dibosons/jzb_OS_OFSB",dican,binning); |
3803 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) draw_pure_jzb_histo(cutOSSF&&cutnJets&&sidebandcut,datajzb,mcjzb,"Dibosons/jzb_OS_SFSB",dican,binning); |
3804 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) draw_pure_jzb_histo(cutOSOF&&cutnJets&&sidebandcut,datajzb,mcjzb,"Dibosons/jzb_OS_OFSB",dican,binning); |
3805 |
|
|
3806 |
|
draw_pure_jzb_histo(cutOSSF&&cutnJets&&cutmass,datajzb,mcjzb,"Dibosons/jzb_OS_SFZP_coarse",dican,coarse_binning); |
3807 |
|
draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass,datajzb,mcjzb,"Dibosons/jzb_OS_OFZP_coarse",dican,coarse_binning); |
3808 |
< |
if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSSF&&cutnJets&&sidebandcut,datajzb,mcjzb,"Dibosons/jzb_OS_SFSB_coarse",dican,coarse_binning); |
3809 |
< |
if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSOF&&cutnJets&&sidebandcut,datajzb,mcjzb,"Dibosons/jzb_OS_OFSB_coarse",dican,coarse_binning); |
3808 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) draw_pure_jzb_histo(cutOSSF&&cutnJets&&sidebandcut,datajzb,mcjzb,"Dibosons/jzb_OS_SFSB_coarse",dican,coarse_binning); |
3809 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) draw_pure_jzb_histo(cutOSOF&&cutnJets&&sidebandcut,datajzb,mcjzb,"Dibosons/jzb_OS_OFSB_coarse",dican,coarse_binning); |
3810 |
|
|
3811 |
|
delete dican; |
3812 |
|
} |
3813 |
|
|
3814 |
|
|
3815 |
|
void diboson_plots(string mcjzb, string datajzb,vector<float> ratio_binning) { |
3816 |
+ |
switch_overunderflow(true); |
3817 |
|
vector<int> SamplesToBeModified = allsamples.FindSampleBySampleName("WW/WZ/ZZ"); |
3818 |
|
|
3819 |
|
if(SamplesToBeModified.size()==0 || SamplesToBeModified[0]==-1) { |
3840 |
|
TCanvas *gloca = new TCanvas("gloca","gloca"); |
3841 |
|
|
3842 |
|
dout << "Going to produce prediction plots" << endl; |
3843 |
< |
do_prediction_plot(mcjzb, gloca, PlottingSetup::jzbHigh, 0, false,"Dibosons/Bpred/" ); // do only MC plots, no signal |
3844 |
< |
do_prediction_plot(mcjzb, gloca, PlottingSetup::jzbHigh, 0, false,"Dibosons/Bpred/" ); // do MC plots with signal |
3843 |
> |
do_prediction_plot(TCut("mll>0"),"",mcjzb, gloca, PlottingSetup::jzbHigh, 0, false,"Dibosons/Bpred/" ); // do only MC plots, no signal |
3844 |
> |
do_prediction_plot(TCut("mll>0"),"",mcjzb, gloca, PlottingSetup::jzbHigh, 0, false,"Dibosons/Bpred/" ); // do MC plots with signal |
3845 |
|
delete gloca; |
3846 |
|
|
3847 |
|
dout << "Going to reset the cross section for diboson samples ... " << endl; |
3853 |
|
dout << " Reset xs for sample " << (allsamples.collection)[SamplesToBeModified[i]].samplename << " from " << Upxs << " to " << (allsamples.collection)[SamplesToBeModified[i]].xs << " (by a factor of " << stretchfactor << ") and reset the correct name (from " << Upname << ")" << endl; |
3854 |
|
|
3855 |
|
} |
3856 |
< |
|
3856 |
> |
// switch_overunderflow(false); |
3857 |
|
} |
3858 |
|
|
3859 |
|
|
3880 |
|
leg->AddEntry(datahisto2,legentry2.c_str()); |
3881 |
|
leg->Draw(); |
3882 |
|
|
3883 |
< |
save_with_ratio(datahisto1,datahisto2,jzbpad->cd(),("jzb/"+savename)); |
3883 |
> |
Save_With_Ratio(datahisto1,datahisto2,jzbpad->cd(),("jzb/"+savename)); |
3884 |
|
|
3885 |
|
datahisto1->Delete(); |
3886 |
|
datahisto2->Delete(); |
3888 |
|
|
3889 |
|
|
3890 |
|
void jzb_plots(string mcjzb, string datajzb,vector<float> ratio_binning) { |
3891 |
+ |
switch_overunderflow(true); |
3892 |
|
TCanvas *can = new TCanvas("can","JZB Plots Canvas"); |
3893 |
|
float max=jzbHigh ; |
3894 |
|
float min=-120; |
3909 |
|
draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass&&"id1==0",datajzb,mcjzb,"ee/jzb_OS_OFZP",can,binning); |
3910 |
|
draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass&&"id1==1",datajzb,mcjzb,"mm/jzb_OS_OFZP",can,binning); |
3911 |
|
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak |
3912 |
< |
if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSSF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_SFSB",can,binning); |
3913 |
< |
if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSOF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_OFSB",can,binning); |
3912 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) draw_pure_jzb_histo(cutOSSF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_SFSB",can,binning); |
3913 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) draw_pure_jzb_histo(cutOSOF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_OFSB",can,binning); |
3914 |
|
draw_normalized_data_vs_data_histo(cutOSOF&&cutnJets&&cutmass&&"id1==0",cutOSOF&&cutnJets&&cutmass&&"id1==1",datajzb,"ee","mm","jzb_ee_vs_mm",can,binning); |
3915 |
|
draw_normalized_data_vs_data_histo(cutOSOF&&cutnJets&&cutmass&&"id1==0",cutOSOF&&cutnJets&&cutmass&&"id1==1",datajzb,"ee","mm","jzb_ee_vs_mm_coarse",can,coarse_binning); |
3916 |
|
draw_normalized_data_vs_data_histo(cutOSOF&&cutnJets&&cutmass&&"id1==0",cutOSOF&&cutnJets&&cutmass&&"id1==1",datajzb,"ee","mm","jzb_ee_vs_mm_coarsest",can,coarsest_binning); |
3921 |
|
if ( !PlottingSetup::Approved ) { |
3922 |
|
draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass,datajzb,mcjzb,"jzb_OS_OFZP_coarse",can,coarse_binning); |
3923 |
|
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak |
3924 |
< |
if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSSF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_SFSB_coarse",can,coarse_binning); |
3925 |
< |
if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSOF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_OFSB_coarse",can,coarse_binning); |
3924 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) draw_pure_jzb_histo(cutOSSF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_SFSB_coarse",can,coarse_binning); |
3925 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) draw_pure_jzb_histo(cutOSOF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_OFSB_coarse",can,coarse_binning); |
3926 |
|
} |
3927 |
|
delete can; |
3928 |
+ |
switch_overunderflow(false); |
3929 |
|
} |
3930 |
|
|
3931 |
|
|
3975 |
|
TCanvas *yica = new TCanvas("yica","yield canvas"); |
3976 |
|
|
3977 |
|
int nRegions=4; |
3978 |
< |
if(!PlottingSetup::RestrictToMassPeak) nRegions=2; |
3978 |
> |
if(!PlottingSetup::RestrictToMassPeak||!PlottingSetup::UseSidebandsForcJZB) nRegions=2; |
3979 |
|
string tsRegions[] = {"SFZP","OFZP","SFSB","OFSB"}; |
3980 |
|
string posneg[] = {"pos","neg"}; |
3981 |
|
TCut tkRegions[] = {cutOSSF&&cutnJets&&cutmass,cutOSOF&&cutnJets&&cutmass,cutOSSF&&cutnJets&&sidebandcut,cutOSOF&&cutnJets&&sidebandcut}; |
4064 |
|
TText *titlecenter; |
4065 |
|
bool frommc=false; |
4066 |
|
if(frommc) { |
4067 |
< |
osof = allsamples.Draw("osof",datajzb,40,-200,200, "JZB [GeV]", "events", massat40&&cutOSSF&&jetcut&&lepcut,mc,luminosity,allsamples.FindSample("TTJets")); |
4067 |
> |
osof = allsamples.Draw("osof",datajzb,40,-200,200, "JZB [GeV]", "events", massat40&&cutOSSF&&jetcut&&lepcut,mc,luminosity,allsamples.FindSample("TT_")); |
4068 |
|
titlecenter = write_title("Extracting ttbar shape (from ossf MC)"); |
4069 |
|
} |
4070 |
|
else { |
4292 |
|
TProfile * profd = (TProfile*)niceresponseplotd->ProfileX(); |
4293 |
|
profd->Rebin(2); |
4294 |
|
profd->SetMarkerSize(DataMarkerSize); |
4295 |
< |
profd->Fit("pol0","","same,e1",100,400); |
4295 |
> |
profd->Fit("pol2","","same,e1",10,400); |
4296 |
|
DrawPrelim(); |
4297 |
|
string stitle="Data"; |
4298 |
|
if(!Contains(FindKeyword,"Data")) stitle="MC"; |
4321 |
|
float datacorrection=find_one_correction_factor("Data",true,"","Data"); |
4322 |
|
float mccorrection=find_one_correction_factor("DY",false,"","MC"); |
4323 |
|
|
4324 |
< |
float dataEEcorrection=find_one_correction_factor("Data",true,"id1==0","Data_ee"); |
4324 |
> |
/* float dataEEcorrection=find_one_correction_factor("Data",true,"id1==0","Data_ee"); |
4325 |
|
float mcEEcorrection=find_one_correction_factor("DY",false,"id1==0","MC_ee"); |
4326 |
|
|
4327 |
|
float dataMMcorrection=find_one_correction_factor("Data",true,"id1==1","Data_mm"); |
4328 |
|
float mcMMcorrection=find_one_correction_factor("DY",false,"id1==1","MC_mm"); |
4329 |
< |
|
4329 |
> |
*/ |
4330 |
|
cout << "Corrections : " << endl; |
4331 |
|
cout << " Data : " << datacorrection << endl; |
4332 |
< |
cout << " ee (" << dataEEcorrection << ") , mm (" << dataMMcorrection << ")" << endl; |
4332 |
> |
// cout << " ee (" << dataEEcorrection << ") , mm (" << dataMMcorrection << ")" << endl; |
4333 |
|
cout << " MC : " << mccorrection << endl; |
4334 |
< |
cout << " ee (" << mcEEcorrection << ") , mm (" << mcMMcorrection << ")" << endl; |
4334 |
> |
// cout << " ee (" << mcEEcorrection << ") , mm (" << mcMMcorrection << ")" << endl; |
4335 |
|
|
4336 |
|
//Step 2: Processing the result and making it into something useful :-) |
4337 |
|
stringstream jzbvardatas; |
4338 |
|
jzbvardatas << "("; |
4339 |
|
|
4340 |
+ |
/* |
4341 |
|
if(dataEEcorrection>=1) jzbvardatas<<"((id1==0&&id1==id2)*(jzb[1]-" << dataEEcorrection-1 << "*pt))"; |
4342 |
|
if(dataEEcorrection<1) jzbvardatas<<"((id1==0&&id1==id2)*(jzb[1]+" << 1-dataEEcorrection << "*pt))"; |
4343 |
|
|
4351 |
|
|
4352 |
|
jzbvardatas << ")"; |
4353 |
|
jzbvardata=jzbvardatas.str(); |
4354 |
< |
|
4354 |
> |
*/ |
4355 |
|
stringstream jzbvarmcs; |
4356 |
|
jzbvarmcs << "("; |
4357 |
< |
|
4357 |
> |
/* |
4358 |
|
if(mcEEcorrection>=1) jzbvarmcs<<"((id1==0&&id1==id2)*(jzb[1]-" << mcEEcorrection-1 << "*pt))"; |
4359 |
|
if(mcEEcorrection<1) jzbvarmcs<<"((id1==0&&id1==id2)*(jzb[1]+" << 1-mcEEcorrection << "*pt))"; |
4360 |
|
|
4368 |
|
|
4369 |
|
jzbvarmcs << ")"; |
4370 |
|
jzbvarmc=jzbvarmcs.str(); |
4371 |
< |
|
4371 |
> |
*/ |
4372 |
> |
|
4373 |
> |
if(datacorrection>=1) jzbvardatas<<"(jzb[1]-" << datacorrection-1 << "*pt)"; |
4374 |
> |
if(datacorrection<1) jzbvardatas<<"(jzb[1]+" << 1-datacorrection << "*pt)"; |
4375 |
> |
|
4376 |
> |
if(mccorrection>=1) jzbvarmcs<<"(jzb[1]-" << mccorrection-1 << "*pt)"; |
4377 |
> |
if(mccorrection<1) jzbvarmcs<<"(jzb[1]+" << 1-mccorrection << "*pt)"; |
4378 |
> |
|
4379 |
> |
jzbvardata = jzbvardatas.str(); |
4380 |
> |
jzbvarmc = jzbvarmcs.str(); |
4381 |
> |
|
4382 |
|
dout << "JZB Z pt correction summary : " << endl; |
4383 |
|
dout << " Data: The response is " << datacorrection << " --> jzb variable is now : " << jzbvardata << endl; |
4384 |
|
dout << " MC : The response is " << mccorrection << " --> jzb variable is now : " << jzbvarmc << endl; |
4385 |
|
|
4386 |
|
} |
4387 |
|
|
4388 |
< |
void pick_up_events(string cut) { |
4389 |
< |
dout << "Picking up events with cut " << cut << endl; |
2519 |
< |
allsamples.PickUpEvents(cut); |
4388 |
> |
void pick_up_events(string cut, string filename, bool QuietMode=false) { |
4389 |
> |
allsamples.PickUpEvents(cut,filename,QuietMode); |
4390 |
|
} |
4391 |
|
|
4392 |
|
void save_template(string mcjzb, string datajzb,vector<float> jzb_cuts,float MCPeakError,float DataPeakError, vector<float> jzb_shape_limit_bins) { |
4433 |
|
configfile<<"\n\n"; |
4434 |
|
configfile<<"luminosity="<<luminosity<<";\n"; |
4435 |
|
configfile<<"RestrictToMassPeak="<<RestrictToMassPeak<<";//defines the type of analysis we're running\n"; |
4436 |
+ |
configfile<<"UseSidebandsForcJZB="<<UseSidebandsForcJZB<<";//tells us whether to use the sidebands or not\n"; |
4437 |
|
|
4438 |
|
configfile<<"\n\ncout << \"Configuration successfully loaded!\" << endl; \n \n } \n \n"; |
4439 |
|
|
4472 |
|
} |
4473 |
|
} |
4474 |
|
|
4475 |
< |
void ttbar_sidebands_comparison(string mcjzb, vector<float> binning, string prestring) { |
4475 |
> |
void ttbar_sidebands_comparison(string mcjzb, vector<float> binning, string prestring, TCut cut) { |
4476 |
|
//in the case of the on peak analysis, we compare the 3 control regions to the real value |
4477 |
|
//in the case of the OFF peak analysis, we compare our control region to the real value |
4478 |
|
TCut weightbackup=cutWeight; |
4479 |
+ |
switch_overunderflow(true); |
4480 |
|
|
4481 |
< |
bool doPURW=false; |
4481 |
> |
bool doPURW=true; |
4482 |
|
|
4483 |
|
|
4484 |
|
if(!doPURW) { |
4498 |
|
|
4499 |
|
float simulatedlumi = luminosity; //in pb please - adjust to your likings |
4500 |
|
|
4501 |
< |
TH1F *TZem = systsamples.Draw("TZem", mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSOF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets")); |
4502 |
< |
TH1F *nTZem = systsamples.Draw("nTZem","-"+mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSOF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets")); |
4501 |
> |
TH1F *TZem = allsamples.Draw("TZem", mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSOF&&cutnJets&&cut,mc,simulatedlumi,allsamples.FindSample("/TT")); |
4502 |
> |
TH1F *nTZem = allsamples.Draw("nTZem","-"+mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSOF&&cutnJets&&cut,mc,simulatedlumi,allsamples.FindSample("/TT")); |
4503 |
|
TH1F *TSem; |
4504 |
|
TH1F *nTSem; |
4505 |
< |
TH1F *TZeemm = systsamples.Draw("TZeemm", mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSSF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets")); |
4506 |
< |
TH1F *nTZeemm = systsamples.Draw("nTZeemm","-"+mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSSF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets")); |
4505 |
> |
TH1F *TZeemm = allsamples.Draw("TZeemm", mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSSF&&cutnJets&&cut,mc,simulatedlumi,allsamples.FindSample("/TT")); |
4506 |
> |
TH1F *nTZeemm = allsamples.Draw("nTZeemm","-"+mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSSF&&cutnJets&&cut,mc,simulatedlumi,allsamples.FindSample("/TT")); |
4507 |
|
TH1F *TSeemm; |
4508 |
|
TH1F *nTSeemm; |
4509 |
|
|
4510 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
4511 |
< |
TSem = systsamples.Draw("TSem", mcjzb,binning,"JZB [GeV]","events",sidebandcut&&cutOSOF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets")); |
4512 |
< |
nTSem = systsamples.Draw("nTSem", "-"+mcjzb,binning,"JZB [GeV]","events",sidebandcut&&cutOSOF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets")); |
4513 |
< |
TSeemm = systsamples.Draw("TSeemm", mcjzb,binning,"JZB [GeV]","events",sidebandcut&&cutOSSF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets")); |
4514 |
< |
nTSeemm = systsamples.Draw("nTSeemm","-"+mcjzb,binning,"JZB [GeV]","events",sidebandcut&&cutOSSF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets")); |
4510 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
4511 |
> |
TSem = allsamples.Draw("TSem", mcjzb,binning,"JZB [GeV]","events",sidebandcut&&cutOSOF&&cutnJets&&cut,mc,simulatedlumi,allsamples.FindSample("/TT")); |
4512 |
> |
nTSem = allsamples.Draw("nTSem", "-"+mcjzb,binning,"JZB [GeV]","events",sidebandcut&&cutOSOF&&cutnJets&&cut,mc,simulatedlumi,allsamples.FindSample("/TT")); |
4513 |
> |
TSeemm = allsamples.Draw("TSeemm", mcjzb,binning,"JZB [GeV]","events",sidebandcut&&cutOSSF&&cutnJets&&cut,mc,simulatedlumi,allsamples.FindSample("/TT")); |
4514 |
> |
nTSeemm = allsamples.Draw("nTSeemm","-"+mcjzb,binning,"JZB [GeV]","events",sidebandcut&&cutOSSF&&cutnJets&&cut,mc,simulatedlumi,allsamples.FindSample("/TT")); |
4515 |
|
} |
4516 |
|
|
4517 |
|
TCanvas *tcan = new TCanvas("tcan","tcan"); |
4523 |
|
TZem->SetMarkerColor(kRed); |
4524 |
|
|
4525 |
|
|
4526 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
4526 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
4527 |
|
TSem->SetLineColor(TColor::GetColor("#00A616")); |
4528 |
|
TSeemm->SetLineColor(kMagenta+2); |
4529 |
|
TSem->SetMarkerColor(TColor::GetColor("#00A616")); |
4537 |
|
TZeemm->GetXaxis()->SetRangeUser(-100,binning[binning.size()-1]); |
4538 |
|
histos.push_back(TZem); |
4539 |
|
histos.push_back(TZeemm); |
4540 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
4540 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
4541 |
|
TSeemm->GetXaxis()->SetRangeUser(-100,binning[binning.size()-1]); |
4542 |
|
TSem->GetXaxis()->SetRangeUser(-100,binning[binning.size()-1]); |
4543 |
|
histos.push_back(TSem); |
4544 |
|
histos.push_back(TSeemm); |
4545 |
|
} |
4546 |
< |
draw_all_ttbar_histos(tcan,histos,"histo",1); |
4546 |
> |
draw_all_ttbar_histos(tcan,histos,"histo",8); |
4547 |
|
|
4548 |
|
TLegend *leg = make_legend("MC t#bar{t}",0.6,0.65,false); |
4549 |
|
leg->AddEntry(TZeemm,"SFZP","l"); |
4550 |
|
leg->AddEntry(TZem,"OFZP","l"); |
4551 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
4551 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
4552 |
|
leg->AddEntry(TSeemm,"SFSB","l"); |
4553 |
|
leg->AddEntry(TSem,"OFSB","l"); |
4554 |
|
} |
4555 |
|
leg->Draw("same"); |
4556 |
|
DrawMCPrelim(simulatedlumi); |
4557 |
|
CompleteSave(tcan,"Systematics/"+prestring+"/ttbar_shape_comparison"); |
4558 |
+ |
|
4559 |
|
TH1F *TZemcopy = (TH1F*)TZem->Clone("TZemcopy"); |
4560 |
|
TH1F *TZeemmcopy = (TH1F*)TZeemm->Clone("TZeemmcopy"); |
4561 |
|
TH1F *TSeemmcopy; |
4562 |
|
TH1F *TSemcopy; |
4563 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
4563 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
4564 |
|
TSeemmcopy = (TH1F*)TSeemm->Clone("TSeemmcopy"); |
4565 |
|
TSemcopy = (TH1F*)TSem->Clone("TSemcopy"); |
4566 |
|
} |
4567 |
|
|
4568 |
|
TZem->Divide(TZeemm); |
4569 |
|
TZem->SetMarkerStyle(21); |
4570 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
4570 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
4571 |
|
TSem->Divide(TZeemm); |
4572 |
|
TSeemm->Divide(TZeemm); |
4573 |
|
TSem->SetMarkerStyle(24); |
4578 |
|
TZem->GetYaxis()->SetRangeUser(0,2.5); |
4579 |
|
TZem->GetYaxis()->SetTitle("ratio"); |
4580 |
|
TZem->Draw(); |
4581 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
4581 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
4582 |
|
TSem->Draw("same"); |
4583 |
|
TSeemm->Draw("same"); |
4584 |
|
} |
4608 |
|
|
4609 |
|
TLegend *leg2 = make_legend("MC t#bar{t}",0.55,0.75,false); |
4610 |
|
leg2->AddEntry(TZem,"OFZP / SFZP","ple"); |
4611 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
4611 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
4612 |
|
leg2->AddEntry(TSeemm,"SFSB / SFZP","ple"); |
4613 |
|
leg2->AddEntry(TSem,"OFSB / SFZP","ple"); |
4614 |
|
} |
4621 |
|
DrawMCPrelim(simulatedlumi); |
4622 |
|
CompleteSave(tcan,"Systematics/"+prestring+"/ttbar_shape_comparison_ratio"); |
4623 |
|
|
4624 |
+ |
|
4625 |
|
if (0) { // Turn this off: we don't need this |
4626 |
|
|
4627 |
|
///-------------- second part: only look at the quantity we actually care about! |
4635 |
|
TH1F *rightofsb; |
4636 |
|
TH1F *leftsfsb; |
4637 |
|
TH1F *rightsfsb; |
4638 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
4638 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
4639 |
|
leftofsb = (TH1F*)nTSem->Clone("leftofsb"); |
4640 |
|
rightofsb = (TH1F*)TSemcopy->Clone("rightofsb"); |
4641 |
|
rightofsb->Add(leftofsb,-1); |
4649 |
|
rightsfzp->GetYaxis()->SetTitle("#deltaJZB / 25 GeV"); |
4650 |
|
rightsfzp->Draw("histo"); |
4651 |
|
rightofzp->Draw("histo,same"); |
4652 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
4652 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
4653 |
|
rightofsb->Draw("histo,same"); |
4654 |
|
rightsfsb->Draw("histo,same"); |
4655 |
|
} |
4658 |
|
TLegend *legA = make_legend("MC t#bar{t}",0.6,0.65,false); |
4659 |
|
legA->AddEntry(rightsfzp,"SFZP","l"); |
4660 |
|
legA->AddEntry(rightofzp,"OFZP","l"); |
4661 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
4661 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
4662 |
|
legA->AddEntry(rightofsb,"SFSB","l"); |
4663 |
|
legA->AddEntry(rightsfsb,"OFSB","l"); |
4664 |
|
} |
4672 |
|
rightofzp->GetYaxis()->SetRangeUser(0.0,2.5); |
4673 |
|
rightofzp->GetYaxis()->SetTitle("#deltaJZB ratio"); |
4674 |
|
rightofzp->Draw(); |
4675 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
4675 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
4676 |
|
rightofsb->Divide(rightsfzp); |
4677 |
|
rightsfsb->Divide(rightsfzp); |
4678 |
|
rightofsb->Draw("same"); |
4692 |
|
bottom2->Draw("same"); |
4693 |
|
|
4694 |
|
rightofzp->SetMarkerStyle(21); |
4695 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
4695 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
4696 |
|
rightofsb->SetMarkerStyle(24); |
4697 |
|
rightsfsb->SetMarkerStyle(32); |
4698 |
|
} |
4699 |
|
|
4700 |
|
TLegend *leg3 = make_legend("MC t#bar{t}",0.55,0.75,false); |
4701 |
|
leg3->AddEntry(rightofzp,"OFZP / SFZP","ple"); |
4702 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
4702 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
4703 |
|
leg3->AddEntry(rightsfsb,"SFSB / SFZP","ple"); |
4704 |
|
leg3->AddEntry(rightofsb,"OFSB / SFZP","ple"); |
4705 |
|
} |
4718 |
|
delete nTZem; |
4719 |
|
delete TZeemm; |
4720 |
|
delete nTZeemm; |
4721 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
4721 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
4722 |
|
delete TSem; |
4723 |
|
delete nTSem; |
4724 |
|
delete TSeemm; |
4727 |
|
|
4728 |
|
delete tcan; |
4729 |
|
cutWeight=weightbackup; |
4730 |
+ |
switch_overunderflow(false); |
4731 |
|
} |
4732 |
|
|
4733 |
|
void ttbar_sidebands_comparison(string mcjzb, vector<float> jzb_binning) { |
4762 |
|
nicer_binning.push_back(150); |
4763 |
|
//nicer_binning.push_back(175); |
4764 |
|
nicer_binning.push_back(200); |
4765 |
< |
nicer_binning.push_back(250); |
4766 |
< |
nicer_binning.push_back(300); |
4767 |
< |
nicer_binning.push_back(400); |
4765 |
> |
// nicer_binning.push_back(250); |
4766 |
> |
// nicer_binning.push_back(300); |
4767 |
> |
// nicer_binning.push_back(400); |
4768 |
> |
|
4769 |
> |
ttbar_sidebands_comparison(mcjzb,nicer_binning, "ttbar/",TCut("mll>0")); |
4770 |
> |
ttbar_sidebands_comparison(mcjzb,nicer_binning, "ttbar/LowMassRegion2070",TCut("mll>20&&mll<70")); |
4771 |
> |
ttbar_sidebands_comparison(mcjzb,nicer_binning, "ttbar/ZWindow",Restrmasscut); |
4772 |
|
|
2894 |
– |
ttbar_sidebands_comparison(mcjzb,nicer_binning, "ttbar/"); |
4773 |
|
} |
4774 |
|
|
4775 |
|
|
4776 |
< |
void zjets_prediction_comparison(string mcjzbWithPUa) { |
4776 |
> |
void zjets_prediction_comparison(string mcjzbWithPUa, TCut massregioncut, string massregionname) { |
4777 |
> |
cout << "****************************************************************************************************************************************************************" << endl; |
4778 |
|
TCanvas *zcan = new TCanvas("zcan","zcan"); |
2900 |
– |
// zcan->SetLogy(1); |
4779 |
|
TCut weightbackup=cutWeight; |
4780 |
|
|
4781 |
< |
bool UsePURW=false; |
4781 |
> |
bool UsePURW=true; |
4782 |
|
|
4783 |
|
|
4784 |
|
string mcjzb; |
4785 |
|
if(UsePURW) { |
4786 |
|
mcjzb=mcjzbWithPUa; |
4787 |
+ |
cout << "Using PURW peak positions" << endl; |
4788 |
|
} else { |
4789 |
|
// Do it without PU re-weighting |
4790 |
+ |
cutWeight="1.0"; |
4791 |
|
float MCPeakNoPU=0,MCPeakErrorNoPU=0,DataPeakNoPU=0,DataPeakErrorNoPU=0,MCSigma=0,DataSigma=0; |
4792 |
|
stringstream resultsNoPU; |
4793 |
|
stringstream noPUdatajzb; |
4798 |
|
|
4799 |
|
mcjzb = noPUmcjzb.str(); |
4800 |
|
|
2921 |
– |
cutWeight="1.0"; |
4801 |
|
} |
4802 |
|
|
4803 |
|
|
4804 |
+ |
|
4805 |
|
vector<float> binning; |
4806 |
|
binning.push_back(0); |
4807 |
|
binning.push_back(10); |
4808 |
< |
binning.push_back(20); |
4809 |
< |
binning.push_back(40); |
4810 |
< |
binning.push_back(60); |
4811 |
< |
// binning.push_back(50); |
4808 |
> |
binning.push_back(30); |
4809 |
> |
// binning.push_back(40); |
4810 |
> |
// binning.push_back(60); |
4811 |
> |
binning.push_back(50); |
4812 |
|
// binning.push_back(60); |
4813 |
|
// binning.push_back(70); |
4814 |
|
// binning.push_back(80); |
4819 |
|
|
4820 |
|
TCut kPos((mcjzb+">0").c_str()); |
4821 |
|
TCut kNeg((mcjzb+"<0").c_str()); |
4822 |
+ |
TCut reducedNJets(cutnJets); |
4823 |
|
string var( "abs("+mcjzb+")" ); |
4824 |
|
|
2944 |
– |
TCut notTau("abs(genMID1)!=15"); |
2945 |
– |
TCut ONLYTau("mll>20"); |
4825 |
|
|
4826 |
< |
|
4827 |
< |
TH1F *hJZBpos = systsamples.Draw("hJZBpos",var,binning, "JZB [GeV]", "events",cutmass&&cutOSSF&&cutnJets&¬Tau&&kPos,mc,simulatedlumi,systsamples.FindSample("/DY")); |
4828 |
< |
TH1F *hJZBneg = systsamples.Draw("hJZBneg",var,binning, "JZB [GeV]", "events",cutmass&&cutOSSF&&cutnJets&¬Tau&&kNeg,mc,simulatedlumi,systsamples.FindSample("/DY")); |
4826 |
> |
TCut notTau("!EventZToTaus"); |
4827 |
> |
TCut ee_mm_tautau("mll>0"); |
4828 |
> |
|
4829 |
> |
TH1F *hJZBpos = allsamples.Draw("hJZBpos",var,binning, "JZB [GeV]", "events",cutmass&&cutOSSF&&cutnJets&¬Tau&&kPos&&massregioncut,mc,simulatedlumi,allsamples.FindSample("M-20_CT10_")); |
4830 |
> |
TH1F *hJZBneg = allsamples.Draw("hJZBneg",var,binning, "JZB [GeV]", "events",cutmass&&cutOSSF&&cutnJets&¬Tau&&kNeg&&massregioncut,mc,simulatedlumi,allsamples.FindSample("M-20_CT10_")); |
4831 |
|
|
4832 |
|
hJZBpos->SetLineColor(kBlack); |
4833 |
|
hJZBneg->SetLineColor(kRed); |
4842 |
|
leg->AddEntry(hJZBneg,"Predicted","l"); |
4843 |
|
leg->Draw("same"); |
4844 |
|
DrawMCPrelim(simulatedlumi); |
4845 |
< |
CompleteSave(zcan,"Systematics/ZJets/zjets_eemm_prediction"); |
4845 |
> |
CompleteSave(zcan,"Systematics/ZJets/zjets_eemm_prediction"+any2string(massregionname)); |
4846 |
|
|
4847 |
|
TH1F* hratio = (TH1F*)hJZBpos->Clone("hratio"); |
4848 |
|
hratio->Divide(hJZBneg); |
4849 |
|
|
4850 |
|
for(int i=1;i<=hJZBpos->GetNbinsX();i++) { |
4851 |
< |
cout << "Positive: " << hJZBpos->GetBinContent(i) << " vs Negative : " << hJZBneg->GetBinContent(i) << " (ratio : " << hJZBpos->GetBinContent(i) / hJZBneg->GetBinContent(i) << endl; |
4851 |
> |
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; |
4852 |
|
} |
4853 |
|
|
4854 |
< |
zcan->SetLogy(0); |
4855 |
< |
hratio->GetYaxis()->SetRangeUser(0,2.0); |
4854 |
> |
// zcan->SetLogy(0); |
4855 |
> |
hratio->GetYaxis()->SetRangeUser(0,2.5); |
4856 |
|
hratio->GetYaxis()->SetTitle("Observed/Predicted"); |
4857 |
|
hratio->Draw("e1"); |
4858 |
|
|
4859 |
< |
TLine *top = new TLine(binning[0],1.25,binning[binning.size()-1],1.25); |
4859 |
> |
TLine *top = new TLine(binning[0],1.2,binning[binning.size()-1],1.2); |
4860 |
|
TLine *center = new TLine(binning[0],1.0,binning[binning.size()-1],1.0); |
4861 |
< |
TLine *bottom = new TLine(binning[0],0.75,binning[binning.size()-1],0.75); |
4861 |
> |
TLine *bottom = new TLine(binning[0],0.8,binning[binning.size()-1],0.8); |
4862 |
|
|
4863 |
|
|
4864 |
|
top->SetLineColor(kBlue);top->SetLineStyle(2); |
4874 |
|
leg2->AddEntry(bottom,"syst. envelope","l"); |
4875 |
|
leg2->Draw("same"); |
4876 |
|
DrawMCPrelim(simulatedlumi); |
4877 |
< |
CompleteSave(zcan,"Systematics/ZJets/zjets_eemm_prediction_ratio"); |
2997 |
< |
|
2998 |
< |
TCut reducedNJets(cutnJets); |
4877 |
> |
CompleteSave(zcan,"Systematics/ZJets/zjets_eemm_prediction_ratio"+any2string(massregionname)); |
4878 |
|
|
4879 |
< |
TH1F *TAUhJZBpos = systsamples.Draw("TAUhJZBpos",var,binning, "JZB [GeV]", "events",cutmass&&cutOSSF&&reducedNJets&&ONLYTau&&kPos,mc,simulatedlumi,systsamples.FindSample("/DY")); |
4880 |
< |
TH1F *LcorrJZBeemm = systsamples.Draw("LcorrJZBeemm",var,binning, "JZB [GeV]", "events",cutmass&&cutOSSF&&reducedNJets&&ONLYTau&&kNeg,mc,simulatedlumi,systsamples.FindSample("/DY")); |
4881 |
< |
TH1F *RcorrJZBem = systsamples.Draw("RcorrJZBem",var,binning, "JZB [GeV]", "events",cutmass&&cutOSOF&&reducedNJets&&ONLYTau&&kPos,mc,simulatedlumi,systsamples.FindSample("/DY")); |
4882 |
< |
TH1F *LcorrJZBem = systsamples.Draw("LcorrJZBem",var,binning, "JZB [GeV]", "events",cutmass&&cutOSOF&&reducedNJets&&ONLYTau&&kNeg,mc,simulatedlumi,systsamples.FindSample("/DY")); |
4879 |
> |
TH1F *TAUhJZBpos = allsamples.Draw("TAUhJZBpos",var,binning, "JZB [GeV]", "events",cutmass&&cutOSSF&&reducedNJets&&ee_mm_tautau&&kPos&&massregioncut,mc,simulatedlumi,allsamples.FindSample("M-20_CT10_")); |
4880 |
> |
TH1F *LcorrJZBeemm = allsamples.Draw("LcorrJZBeemm",var,binning, "JZB [GeV]", "events",cutmass&&cutOSSF&&reducedNJets&&ee_mm_tautau&&kNeg&&massregioncut,mc,simulatedlumi,allsamples.FindSample("M-20_CT10_")); |
4881 |
> |
TH1F *RcorrJZBem = allsamples.Draw("RcorrJZBem",var,binning, "JZB [GeV]", "events",cutmass&&cutOSOF&&reducedNJets&&ee_mm_tautau&&kPos&&massregioncut,mc,simulatedlumi,allsamples.FindSample("M-20_CT10_")); |
4882 |
> |
TH1F *LcorrJZBem = allsamples.Draw("LcorrJZBem",var,binning, "JZB [GeV]", "events",cutmass&&cutOSOF&&reducedNJets&&ee_mm_tautau&&kNeg&&massregioncut,mc,simulatedlumi,allsamples.FindSample("M-20_CT10_")); |
4883 |
|
|
4884 |
|
TH1F *RcorrJZBSBem; |
4885 |
|
TH1F *LcorrJZBSBem; |
4886 |
|
TH1F *RcorrJZBSBeemm; |
4887 |
|
TH1F *LcorrJZBSBeemm; |
4888 |
|
|
4889 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
4890 |
< |
RcorrJZBSBem = systsamples.Draw("RcorrJZBSBem",var,binning, "JZB [GeV]", "events",sidebandcut&&cutOSOF&&reducedNJets&&ONLYTau&&kPos,mc,simulatedlumi,systsamples.FindSample("/DY")); |
4891 |
< |
LcorrJZBSBem = systsamples.Draw("LcorrJZBSBem",var,binning, "JZB [GeV]", "events",sidebandcut&&cutOSOF&&reducedNJets&&ONLYTau&&kNeg,mc,simulatedlumi,systsamples.FindSample("/DY")); |
4892 |
< |
RcorrJZBSBeemm = systsamples.Draw("RcorrJZBSBeemm",var,binning, "JZB [GeV]", "events",sidebandcut&&cutOSSF&&reducedNJets&&ONLYTau&&kPos,mc,simulatedlumi,systsamples.FindSample("/DY")); |
4893 |
< |
LcorrJZBSBeemm = systsamples.Draw("LcorrJZBSBeemm",var,binning, "JZB [GeV]", "events",sidebandcut&&cutOSSF&&reducedNJets&&ONLYTau&&kNeg,mc,simulatedlumi,systsamples.FindSample("/DY")); |
4889 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
4890 |
> |
RcorrJZBSBem = allsamples.Draw("RcorrJZBSBem",var,binning, "JZB [GeV]", "events",sidebandcut&&cutOSOF&&reducedNJets&&ee_mm_tautau&&kPos&&massregioncut,mc,simulatedlumi,allsamples.FindSample("M-20_CT10_")); |
4891 |
> |
LcorrJZBSBem = allsamples.Draw("LcorrJZBSBem",var,binning, "JZB [GeV]", "events",sidebandcut&&cutOSOF&&reducedNJets&&ee_mm_tautau&&kNeg&&massregioncut,mc,simulatedlumi,allsamples.FindSample("M-20_CT10_")); |
4892 |
> |
RcorrJZBSBeemm = allsamples.Draw("RcorrJZBSBeemm",var,binning, "JZB [GeV]", "events",sidebandcut&&cutOSSF&&reducedNJets&&ee_mm_tautau&&kPos&&massregioncut,mc,simulatedlumi,allsamples.FindSample("M-20_CT10_")); |
4893 |
> |
LcorrJZBSBeemm = allsamples.Draw("LcorrJZBSBeemm",var,binning, "JZB [GeV]", "events",sidebandcut&&cutOSSF&&reducedNJets&&ee_mm_tautau&&kNeg&&massregioncut,mc,simulatedlumi,allsamples.FindSample("M-20_CT10_")); |
4894 |
|
} |
4895 |
|
|
4896 |
|
TH1F *Bpred = (TH1F*)LcorrJZBeemm->Clone("Bpred"); |
4897 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
4897 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
4898 |
|
Bpred->Add(RcorrJZBem,1.0/3.); |
4899 |
|
Bpred->Add(LcorrJZBem,-1.0/3.); |
4900 |
|
Bpred->Add(RcorrJZBSBem,1.0/3.); |
4921 |
|
TAUleg->AddEntry(Bpred,"Predicted","l"); |
4922 |
|
TAUleg->Draw("same"); |
4923 |
|
DrawMCPrelim(simulatedlumi); |
4924 |
< |
CompleteSave(zcan,"Systematics/ZJets/zjets_eemumutautau_prediction"); |
4924 |
> |
CompleteSave(zcan,"Systematics/ZJets/zjets_eemumutautau_prediction__"+any2string(massregionname)); |
4925 |
|
|
4926 |
|
TH1F* TAUhratio = (TH1F*)TAUhJZBpos->Clone("TAUhratio"); |
4927 |
|
TAUhratio->Divide(Bpred); |
4928 |
|
|
4929 |
|
for(int i=1;i<=TAUhJZBpos->GetNbinsX();i++) { |
4930 |
|
cout << "ee/mm/tautau observed: " << TAUhJZBpos->GetBinContent(i) << " vs predicted : " << Bpred->GetBinContent(i) << " (ratio : " << TAUhJZBpos->GetBinContent(i) / Bpred->GetBinContent(i) << endl; |
4931 |
+ |
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; |
4932 |
+ |
|
4933 |
+ |
|
4934 |
|
} |
4935 |
|
|
4936 |
|
zcan->SetLogy(0); |
4942 |
|
center->Draw("same"); |
4943 |
|
bottom->Draw("same"); |
4944 |
|
|
4945 |
< |
TLegend *TAUleg2 = make_legend("MC Z+jets #rightarrow #tau#tau",0.25,0.75,false); |
4945 |
> |
TLegend *TAUleg2 = make_legend("MC Z+jets #rightarrow ee,#mu#mu",0.25,0.75,false); |
4946 |
|
TAUleg2->AddEntry(TAUhratio,"obs / pred","pe"); |
4947 |
|
TAUleg2->AddEntry(bottom,"syst. envelope","l"); |
4948 |
|
TAUleg2->Draw("same"); |
4949 |
|
DrawMCPrelim(simulatedlumi); |
4950 |
< |
CompleteSave(zcan,"Systematics/ZJets/zjets_eemumutautau_prediction_ratio"); |
4950 |
> |
CompleteSave(zcan,"Systematics/ZJets/zjets_eemumutautau_prediction_ratio"+any2string(massregionname)); |
4951 |
|
|
4952 |
|
delete Bpred; |
4953 |
|
delete TAUhJZBpos; |
4954 |
|
delete LcorrJZBeemm; |
4955 |
|
delete RcorrJZBem; |
4956 |
|
delete LcorrJZBem; |
4957 |
+ |
delete hJZBpos; |
4958 |
+ |
delete hJZBneg; |
4959 |
|
|
4960 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
4960 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
4961 |
|
delete RcorrJZBSBem; |
4962 |
|
delete LcorrJZBSBem; |
4963 |
|
delete RcorrJZBSBeemm; |
4964 |
|
delete LcorrJZBSBeemm; |
4965 |
|
} |
4966 |
|
|
4967 |
+ |
//*************************************************************************************************** |
4968 |
+ |
|
4969 |
+ |
string jzbvar=var; |
4970 |
+ |
/* |
4971 |
+ |
for(int i=0;i<60;i+=10) { |
4972 |
+ |
stringstream sSpecialJZBCut; |
4973 |
+ |
sSpecialJZBCut << jzbvar << ">" << i; |
4974 |
+ |
TCut SpecialJZBCut(sSpecialJZBCut.str().c_str()); |
4975 |
+ |
|
4976 |
+ |
var="mll"; |
4977 |
+ |
|
4978 |
+ |
TH1F *FullJZBhJZBpos = allsamples.Draw("FullJZBhJZBpos",var,10,0,200, "m_{ll} [GeV]", "events",cutmass&&cutOSSF&&reducedNJets&¬Tau&&kPos&&massregioncut&&SpecialJZBCut,mc,simulatedlumi,allsamples.FindSample("M-20_CT10_")); |
4979 |
+ |
TH1F *LcorrJZBPluseemm = allsamples.Draw("LcorrJZBPluseemm",var,10,0,200, "m_{ll} [GeV]", "events",cutmass&&cutOSSF&&reducedNJets&¬Tau&&kNeg&&massregioncut&&SpecialJZBCut,mc,simulatedlumi,allsamples.FindSample("M-20_CT10_")); |
4980 |
+ |
TH1F *RcorrJZBPlusem = allsamples.Draw("RcorrJZBPlusem",var,10,0,200, "m_{ll} [GeV]", "events",cutmass&&cutOSOF&&reducedNJets&¬Tau&&kPos&&massregioncut&&SpecialJZBCut,mc,simulatedlumi,allsamples.FindSample("M-20_CT10_")); |
4981 |
+ |
TH1F *LcorrJZBPlusem = allsamples.Draw("LcorrJZBPlusem",var,10,0,200, "m_{ll} [GeV]", "events",cutmass&&cutOSOF&&reducedNJets&¬Tau&&kNeg&&massregioncut&&SpecialJZBCut,mc,simulatedlumi,allsamples.FindSample("M-20_CT10_")); |
4982 |
+ |
|
4983 |
+ |
TH1F *RcorrJZBPlusSBem; |
4984 |
+ |
TH1F *LcorrJZBPlusSBem; |
4985 |
+ |
TH1F *RcorrJZBPlusSBeemm; |
4986 |
+ |
TH1F *LcorrJZBPlusSBeemm; |
4987 |
+ |
|
4988 |
+ |
|
4989 |
+ |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
4990 |
+ |
RcorrJZBPlusSBem = allsamples.Draw("RcorrJZBPlusSBem",var,10,0,200, "m_{ll} [GeV]", "events",sidebandcut&&cutOSOF&&reducedNJets&¬Tau&&kPos&&massregioncut&&SpecialJZBCut,mc,simulatedlumi,allsamples.FindSample("M-20_CT10_")); |
4991 |
+ |
LcorrJZBPlusSBem = allsamples.Draw("LcorrJZBPlusSBem",var,10,0,200, "m_{ll} [GeV]", "events",sidebandcut&&cutOSOF&&reducedNJets&¬Tau&&kNeg&&massregioncut&&SpecialJZBCut,mc,simulatedlumi,allsamples.FindSample("M-20_CT10_")); |
4992 |
+ |
RcorrJZBPlusSBeemm = allsamples.Draw("RcorrJZBPlusSBeemm",var,10,0,200, "m_{ll} [GeV]", "events",sidebandcut&&cutOSSF&&reducedNJets&¬Tau&&kPos&&massregioncut&&SpecialJZBCut,mc,simulatedlumi,allsamples.FindSample("M-20_CT10_")); |
4993 |
+ |
LcorrJZBPlusSBeemm = allsamples.Draw("LcorrJZBPlusSBeemm",var,10,0,200, "m_{ll} [GeV]", "events",sidebandcut&&cutOSSF&&reducedNJets&¬Tau&&kNeg&&massregioncut&&SpecialJZBCut,mc,simulatedlumi,allsamples.FindSample("M-20_CT10_")); |
4994 |
+ |
} |
4995 |
+ |
|
4996 |
+ |
TH1F *BpredPrime = (TH1F*)LcorrJZBPluseemm->Clone("BpredPrime"); |
4997 |
+ |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
4998 |
+ |
BpredPrime->Add(RcorrJZBPlusem,1.0/3.); |
4999 |
+ |
BpredPrime->Add(LcorrJZBPlusem,-1.0/3.); |
5000 |
+ |
BpredPrime->Add(RcorrJZBPlusSBem,1.0/3.); |
5001 |
+ |
BpredPrime->Add(LcorrJZBPlusSBem,-1.0/3.); |
5002 |
+ |
BpredPrime->Add(RcorrJZBPlusSBeemm,1.0/3.); |
5003 |
+ |
BpredPrime->Add(LcorrJZBPlusSBeemm,-1.0/3.); |
5004 |
+ |
} else { |
5005 |
+ |
BpredPrime->Add(RcorrJZBPlusem,1.0); |
5006 |
+ |
BpredPrime->Add(LcorrJZBPlusem,-1.0); |
5007 |
+ |
} |
5008 |
+ |
|
5009 |
+ |
BpredPrime->SetLineColor(kRed); |
5010 |
+ |
|
5011 |
+ |
FullJZBhJZBpos->SetLineColor(kBlack); |
5012 |
+ |
BpredPrime->SetLineColor(kRed); |
5013 |
+ |
|
5014 |
+ |
FullJZBhJZBpos->SetMinimum(1.0); |
5015 |
+ |
FullJZBhJZBpos->Draw("e1"); |
5016 |
+ |
BpredPrime->Draw("same,hist"); |
5017 |
+ |
FullJZBhJZBpos->Draw("same,e1"); |
5018 |
+ |
|
5019 |
+ |
TLegend *FullJZBleg = make_legend("MC Z+jets #rightarrow ee,#mu#mu",0.55,0.75,false); |
5020 |
+ |
FullJZBleg->AddEntry(FullJZBhJZBpos,"Observed","pe"); |
5021 |
+ |
FullJZBleg->AddEntry(BpredPrime,"Predicted","l"); |
5022 |
+ |
FullJZBleg->Draw("same"); |
5023 |
+ |
DrawMCPrelim(simulatedlumi); |
5024 |
+ |
CompleteSave(zcan,"Systematics/ZJets/Mll_Distribution_JZB"+any2string(i)+"_zjets_eemumu_prediction__"+any2string(massregionname)); |
5025 |
+ |
|
5026 |
+ |
TH1F* FullJZBhratio = (TH1F*)FullJZBhJZBpos->Clone("FullJZBhratio"); |
5027 |
+ |
FullJZBhratio->Divide(BpredPrime); |
5028 |
+ |
|
5029 |
+ |
zcan->SetLogy(0); |
5030 |
+ |
FullJZBhratio->GetYaxis()->SetRangeUser(0,2.5); |
5031 |
+ |
FullJZBhratio->GetYaxis()->SetTitle("Observed/Predicted"); |
5032 |
+ |
FullJZBhratio->Draw("e1"); |
5033 |
+ |
|
5034 |
+ |
TLine *atop = new TLine(0,1.2,200,1.2); |
5035 |
+ |
TLine *acenter = new TLine(0,1.0,200,1.0); |
5036 |
+ |
TLine *abottom = new TLine(0,0.8,200,0.8); |
5037 |
+ |
|
5038 |
+ |
atop->SetLineColor(kBlue); |
5039 |
+ |
atop->SetLineStyle(2); |
5040 |
+ |
acenter->SetLineColor(kBlue); |
5041 |
+ |
abottom->SetLineColor(kBlue); |
5042 |
+ |
abottom->SetLineStyle(2); |
5043 |
+ |
|
5044 |
+ |
atop->Draw("same"); |
5045 |
+ |
acenter->Draw("same"); |
5046 |
+ |
abottom->Draw("same"); |
5047 |
+ |
|
5048 |
+ |
TLegend *FullJZBleg2 = make_legend("MC Z+jets #rightarrow ee,#mu#mu",0.25,0.75,false); |
5049 |
+ |
FullJZBleg2->AddEntry(FullJZBhratio,"obs / pred","pe"); |
5050 |
+ |
FullJZBleg2->AddEntry(abottom,"syst. envelope","l"); |
5051 |
+ |
FullJZBleg2->Draw("same"); |
5052 |
+ |
DrawMCPrelim(simulatedlumi); |
5053 |
+ |
CompleteSave(zcan,"Systematics/ZJets/Mll_Distribution_JZB"+any2string(i)+"zjets_eemumu_prediction_ratio"+any2string(massregionname)); |
5054 |
+ |
|
5055 |
+ |
|
5056 |
+ |
delete BpredPrime; |
5057 |
+ |
delete FullJZBhJZBpos; |
5058 |
+ |
delete LcorrJZBPluseemm; |
5059 |
+ |
delete RcorrJZBPlusem; |
5060 |
+ |
delete LcorrJZBPlusem; |
5061 |
+ |
// delete FullJZBhJZBpos; |
5062 |
+ |
|
5063 |
+ |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
5064 |
+ |
delete RcorrJZBPlusSBem; |
5065 |
+ |
delete LcorrJZBPlusSBem; |
5066 |
+ |
delete RcorrJZBPlusSBeemm; |
5067 |
+ |
delete LcorrJZBPlusSBeemm; |
5068 |
+ |
} |
5069 |
|
|
5070 |
+ |
} |
5071 |
+ |
//*************************************************************************************************** |
5072 |
+ |
*/ |
5073 |
|
delete zcan; |
5074 |
|
cutWeight=weightbackup; |
3086 |
– |
|
5075 |
|
} |
5076 |
|
|
5077 |
|
|
5078 |
< |
|
5078 |
> |
void zjets_prediction_comparison(string mcjzbWithPUa) { |
5079 |
> |
zjets_prediction_comparison(mcjzbWithPUa, TCut("mll>20"), "nomasscut"); |
5080 |
> |
zjets_prediction_comparison(mcjzbWithPUa, TCut("abs(mll-91)<10"), "Zwindow_10"); |
5081 |
> |
zjets_prediction_comparison(mcjzbWithPUa, TCut("mll>20&&mll<70"), "LowMassRegion2070"); |
5082 |
> |
// zjets_prediction_comparison(mcjzbWithPUa, TCut("abs(mll-91)>10&&mll>20"), "Outside_Zwindow_10"); |
5083 |
> |
// zjets_prediction_comparison(mcjzbWithPUa, TCut("mll>110"), "HighMassRegion110"); |
5084 |
> |
} |
5085 |
> |
|
5086 |
|
void sideband_assessment(string datajzb, float min=30.0, float max=50.0) { |
5087 |
|
tout << endl << endl; |
5088 |
|
stringstream bordercut; |
5133 |
|
TH1F *RcorrJZBSBeemm; |
5134 |
|
TH1F *LcorrJZBSBeemm; |
5135 |
|
|
5136 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
5136 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
5137 |
|
RcorrJZBSBem = coll.Draw("RcorrJZBSBem",jzbexpr.c_str(),nbins,low,14000, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity, mysample); |
5138 |
|
LcorrJZBSBem = coll.Draw("LcorrJZBSBem",("-("+jzbexpr+")").c_str(),nbins,low,14000, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity, mysample); |
5139 |
|
RcorrJZBSBeemm = coll.Draw("RcorrJZBSBeemm",jzbexpr.c_str(),nbins,low,14000, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity, mysample); |
5141 |
|
} |
5142 |
|
|
5143 |
|
TH1F *Bpred = (TH1F*)LcorrJZBeemm->Clone("Bpred"); |
5144 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
5144 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
5145 |
|
Bpred->Add(RcorrJZBem,1.0/3.); |
5146 |
|
Bpred->Add(LcorrJZBem,-1.0/3.); |
5147 |
|
Bpred->Add(RcorrJZBSBem,1.0/3.); |
5190 |
|
} |
5191 |
|
|
5192 |
|
void met_jzb_cut(string datajzb, string mcjzb, vector<float> jzb_cut) { |
5193 |
+ |
cout << "You probably don't want --met, you want --metplots ... " << endl; |
5194 |
+ |
assert(0); |
5195 |
|
/*we want a table like this: |
5196 |
|
__________________ 50 | 100 | ... |
5197 |
|
| Data prediction | a vs b | a vs b | ... |
5354 |
|
TH1F *JRcorrJZBSBeemm; |
5355 |
|
TH1F *JLcorrJZBSBeemm; |
5356 |
|
|
5357 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
5357 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
5358 |
|
RcorrJZBSBem = qcdsamples.Draw("RcorrJZBSBem",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
5359 |
|
LcorrJZBSBem = qcdsamples.Draw("LcorrJZBSBem",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
5360 |
|
RcorrJZBSBeemm = qcdsamples.Draw("RcorrJZBSBeemm",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
5375 |
|
|
5376 |
|
TH1F *Bpred = (TH1F*)LcorrJZBeemm->Clone("Bpred"); |
5377 |
|
TH1F *JBpred = (TH1F*)JLcorrJZBeemm->Clone("Bpred"); |
5378 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
5378 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
5379 |
|
Bpred->Add(RcorrJZBem,1.0/3.); |
5380 |
|
Bpred->Add(LcorrJZBem,-1.0/3.); |
5381 |
|
Bpred->Add(RcorrJZBSBem,1.0/3.); |
5425 |
|
//3rd last argument: do special bpred ratio, 2nd last argument: extended range!, last: y-axis title |
5426 |
|
string ytitle("ratio"); |
5427 |
|
if ( use_data==1 ) ytitle = "data/pred"; |
5428 |
< |
save_with_ratio(JRcorrJZBeemm,JBpred,kinpad,"QCD/Bpred",true,false,ytitle); |
5428 |
> |
Save_With_Ratio(JRcorrJZBeemm,JBpred,kinpad,"QCD/Bpred",true,false,ytitle); |
5429 |
> |
delete kinpad; |
5430 |
|
|
5431 |
|
TH1F *allevents = qcdsamples.Draw("allevents","pfJetGoodNum",1,0,100, "internal code", "events", "" ,mc, luminosity); |
5432 |
|
TH1F *ossf = qcdsamples.Draw("ossf","pfJetGoodNum",1,0,100, "internal code", "events", cutOSSF ,mc, luminosity); |
5446 |
|
dout << "______________________________________________" << endl; |
5447 |
|
dout << "How QCD shows up in the different regions: " << endl; |
5448 |
|
dout << "OSSF: " << endl; |
5449 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
5449 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
5450 |
|
dout << " Z window: \t" << RcorrJZBeemm->Integral() << " (JZB>0) , " << LcorrJZBeemm->Integral() << " (JZB<0) --> total: " << RcorrJZBeemm->Integral() + LcorrJZBeemm->Integral() << endl; |
5451 |
|
dout << " sideband: \t" << RcorrJZBSBeemm->Integral() << " (JZB>0) , " << LcorrJZBSBeemm->Integral() << " (JZB<0) --> total: " << RcorrJZBSBeemm->Integral() + LcorrJZBSBeemm->Integral() << endl; |
5452 |
|
} else { |
5453 |
|
dout << " " << RcorrJZBeemm->Integral() << " (JZB>0) , " << LcorrJZBeemm->Integral() << " (JZB<0) --> total: " << RcorrJZBeemm->Integral() + LcorrJZBeemm->Integral() << endl; |
5454 |
|
} |
5455 |
|
dout << "OSOF: " << endl; |
5456 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
5456 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
5457 |
|
dout << " Z window: \t" << RcorrJZBem->Integral() << " (JZB>0) , " << LcorrJZBem->Integral() << " (JZB<0) --> total: " << RcorrJZBem->Integral() + LcorrJZBem->Integral() << endl; |
5458 |
|
dout << " sideband: \t" << RcorrJZBSBem->Integral() << " (JZB>0) , " << LcorrJZBSBem->Integral() << " (JZB<0) --> total: " << RcorrJZBSBem->Integral() + LcorrJZBSBem->Integral() << endl; |
5459 |
|
} else { |
5460 |
|
dout << " Z window: \t" << RcorrJZBem->Integral() << " (JZB>0) , " << LcorrJZBem->Integral() << " (JZB<0) --> total: " << RcorrJZBem->Integral() + LcorrJZBem->Integral() << endl; |
5461 |
|
} |
5462 |
|
dout << "Therefore: " << endl; |
5463 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
5463 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
5464 |
|
dout << " Prediction increases by : " << LcorrJZBeemm->Integral() << " + (1.0/3)*(" << RcorrJZBSBeemm->Integral() <<"-"<< LcorrJZBSBeemm->Integral() << ") (SFSB) "; |
5465 |
|
dout << " + (1.0/3)*(" << RcorrJZBem->Integral() <<"-"<< LcorrJZBem->Integral() << ") (OFZP) "; |
5466 |
|
dout << " + (1.0/3)*(" << RcorrJZBSBem->Integral() <<"-"<< LcorrJZBSBem->Integral() << ") (OFSB) "; |
5476 |
|
for(int i=0;i<(int)bins.size();i++) { |
5477 |
|
dout << " JZB > " << bins[i] << " : " << endl; |
5478 |
|
dout << " Observation increases by : " << RcorrJZBeemm->Integral(RcorrJZBeemm->FindBin(bins[i]),RcorrJZBeemm->GetNbinsX()) << endl; |
5479 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
5479 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
5480 |
|
dout << " Prediction increases by : " << LcorrJZBeemm->Integral(RcorrJZBeemm->FindBin(bins[i]),RcorrJZBeemm->GetNbinsX()) + (1.0/3)*(RcorrJZBSBeemm->Integral(RcorrJZBeemm->FindBin(bins[i]),RcorrJZBeemm->GetNbinsX()) - LcorrJZBSBeemm->Integral(RcorrJZBeemm->FindBin(bins[i]),RcorrJZBeemm->GetNbinsX()) + RcorrJZBem->Integral(RcorrJZBeemm->FindBin(bins[i]),RcorrJZBeemm->GetNbinsX()) - LcorrJZBem->Integral(RcorrJZBeemm->FindBin(bins[i]),RcorrJZBeemm->GetNbinsX()) + RcorrJZBSBem->Integral(RcorrJZBeemm->FindBin(bins[i]),RcorrJZBeemm->GetNbinsX()) - LcorrJZBSBem->Integral(RcorrJZBeemm->FindBin(bins[i]),RcorrJZBeemm->GetNbinsX())) << endl; |
5481 |
|
} else { |
5482 |
|
dout << " Prediction increases by : " << LcorrJZBeemm->Integral(RcorrJZBeemm->FindBin(bins[i]),RcorrJZBeemm->GetNbinsX()) + RcorrJZBem->Integral(RcorrJZBeemm->FindBin(bins[i]),RcorrJZBeemm->GetNbinsX()) - LcorrJZBem->Integral(RcorrJZBeemm->FindBin(bins[i]),RcorrJZBeemm->GetNbinsX()) << endl; |
5490 |
|
if(LcorrJZBem) delete LcorrJZBem; |
5491 |
|
if(RcorrJZBeemm) delete RcorrJZBeemm; |
5492 |
|
if(LcorrJZBeemm) delete LcorrJZBeemm; |
5493 |
< |
if(PlottingSetup::RestrictToMassPeak&&RcorrJZBSBem) delete RcorrJZBSBem; |
5494 |
< |
if(PlottingSetup::RestrictToMassPeak&&LcorrJZBSBem) delete LcorrJZBSBem; |
5495 |
< |
if(PlottingSetup::RestrictToMassPeak&&RcorrJZBSBeemm) delete RcorrJZBSBeemm; |
5496 |
< |
if(PlottingSetup::RestrictToMassPeak&&LcorrJZBSBeemm) delete LcorrJZBSBeemm; |
5493 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB&&RcorrJZBSBem) delete RcorrJZBSBem; |
5494 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB&&LcorrJZBSBem) delete LcorrJZBSBem; |
5495 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB&&RcorrJZBSBeemm) delete RcorrJZBSBeemm; |
5496 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB&&LcorrJZBSBeemm) delete LcorrJZBSBeemm; |
5497 |
|
} |
5498 |
|
|
5499 |
|
void check_ptsanity() { |
5597 |
|
|
5598 |
|
vector<string> findme; |
5599 |
|
findme.push_back("DY"); |
5600 |
< |
findme.push_back("TTJets"); |
5600 |
> |
findme.push_back("TT_"); |
5601 |
|
findme.push_back("LM"); |
5602 |
< |
|
5602 |
> |
/* |
5603 |
|
for(int ifind=0;ifind<(int)findme.size();ifind++) { |
5604 |
|
vector<int> selsamples = allsamples.FindSample(findme[ifind]); |
5605 |
|
TH2F *metvsjzb = new TH2F("metvsjzb","metvsjzb",200,0,100,400,-100,100); |
5619 |
|
title->Draw(); |
5620 |
|
CompleteSave(canmetjzb,(string)"METvsJZBplots/"+findme[ifind]); |
5621 |
|
} |
5622 |
< |
|
5622 |
> |
*/ |
5623 |
|
|
5624 |
|
dout << "About to produce MET plot for DY split up by JZB" << endl; |
5625 |
|
|
5634 |
|
sRIGHT << "((" << mcjzb << ")>0)"; |
5635 |
|
TCut RIGHT(sRIGHT.str().c_str()); |
5636 |
|
|
5637 |
< |
TH1F *metleft = allsamples.Draw("metleft","met[4]",nbins,low,high, "MET [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&LEFT,mc, luminosity, allsamples.FindSample("DYJets")); |
5638 |
< |
TH1F *metleftO = allsamples.Draw("metleftO","met[4]",nbins,low,high, "MET [GeV]", "events", cutmass&&cutOSOF&&cutnJets&&LEFT,mc, luminosity, allsamples.FindSample("DYJets")); |
5639 |
< |
TH1F *metright = allsamples.Draw("metright","met[4]",nbins,low,high, "MET [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&RIGHT,mc, luminosity, allsamples.FindSample("DYJets")); |
5640 |
< |
TH1F *metrightO = allsamples.Draw("metrightO","met[4]",nbins,low,high, "MET [GeV]", "events", cutmass&&cutOSOF&&cutnJets&&RIGHT,mc, luminosity, allsamples.FindSample("DYJets")); |
5637 |
> |
TH1F *metleft = allsamples.Draw("metleft","met[4]",nbins,low,high, "#slash{E}_{T} [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&LEFT,mc, luminosity, allsamples.FindSample("DYJets")); |
5638 |
> |
TH1F *metleftO = allsamples.Draw("metleftO","met[4]",nbins,low,high, "#slash{E}_{T} [GeV]", "events", cutmass&&cutOSOF&&cutnJets&&LEFT,mc, luminosity, allsamples.FindSample("DYJets")); |
5639 |
> |
TH1F *metright = allsamples.Draw("metright","met[4]",nbins,low,high, "#slash{E}_{T} [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&RIGHT,mc, luminosity, allsamples.FindSample("DYJets")); |
5640 |
> |
TH1F *metrightO = allsamples.Draw("metrightO","met[4]",nbins,low,high, "#slash{E}_{T} [GeV]", "events", cutmass&&cutOSOF&&cutnJets&&RIGHT,mc, luminosity, allsamples.FindSample("DYJets")); |
5641 |
> |
|
5642 |
> |
|
5643 |
> |
TH1F *Bpred = (TH1F*)metleft->Clone("Bpred"); |
5644 |
> |
Bpred->Add(metleftO,-1); |
5645 |
> |
Bpred->Add(metrightO); |
5646 |
> |
TH1F *obs = (TH1F*)metright->Clone("obs"); |
5647 |
|
|
5648 |
|
metleft->Add(metleftO,-1); |
5649 |
|
metright->Add(metrightO,-1); |
5657 |
|
metright->Draw("same"); |
5658 |
|
TLegend *lg = make_legend(); |
5659 |
|
lg->SetX1(0.5); |
5660 |
+ |
lg->SetY1(0.7); |
5661 |
|
lg->AddEntry(metright,"JZB>0 (OSOF corrected)","P"); |
5662 |
|
lg->AddEntry(metleft,"JZB<0 (OSOF corrected)","L"); |
5663 |
< |
lg->Draw(); |
3659 |
< |
save_with_ratio(metright,metleft,metpad->cd(),"METvsJZBplots/ComparingLeftToRightinMETspectrum"); |
3660 |
< |
TPad *metpad2 = new TPad("metpad2","metpad2",0,0,1,1); |
3661 |
< |
|
3662 |
< |
TH1F *metlefta = allsamples.Draw("metlefta","met[2]",nbins,low,high, "MET [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&LEFT,mc, luminosity, allsamples.FindSample("DYJets")); |
3663 |
< |
TH1F *metleftOa = allsamples.Draw("metleftOa","met[2]",nbins,low,high, "MET [GeV]", "events", cutmass&&cutOSOF&&cutnJets&&LEFT,mc, luminosity, allsamples.FindSample("DYJets")); |
3664 |
< |
TH1F *metrighta = allsamples.Draw("metrighta","met[2]",nbins,low,high, "MET [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&RIGHT,mc, luminosity, allsamples.FindSample("DYJets")); |
3665 |
< |
TH1F *metrightOa = allsamples.Draw("metrightOa","met[2]",nbins,low,high, "MET [GeV]", "events", cutmass&&cutOSOF&&cutnJets&&RIGHT,mc, luminosity, allsamples.FindSample("DYJets")); |
3666 |
< |
|
3667 |
< |
TH1F *Bpred = (TH1F*)metlefta->Clone("Bpred"); |
3668 |
< |
Bpred->Add(metleftOa,-1); |
3669 |
< |
Bpred->Add(metrightOa); |
3670 |
< |
TH1F *obs = (TH1F*)metrighta->Clone("obs"); |
5663 |
> |
lg->SetHeader("DY"); |
5664 |
|
|
3672 |
– |
metlefta->Add(metleftOa,-1); |
3673 |
– |
metrighta->Add(metrightOa,-1); |
3674 |
– |
|
3675 |
– |
metlefta->SetLineColor(kRed); |
3676 |
– |
metpad2->cd(); |
3677 |
– |
metlefta->Draw("histo"); |
3678 |
– |
metrighta->Draw("same"); |
5665 |
|
lg->Draw(); |
5666 |
< |
save_with_ratio(metrighta,metlefta,metpad2->cd(),"METvsJZBplots/ComparingLeftToRightinMET_type1_spectrum"); |
5666 |
> |
Save_With_Ratio(metright,metleft,metpad->cd(),"METvsJZBplots/ComparingLeftToRightinMETspectrum"); |
5667 |
|
|
5668 |
|
TPad *metpad3 = new TPad("metpad3","metpad3",0,0,1,1); |
5669 |
|
metpad3->cd(); |
5670 |
+ |
metpad3->SetLogy(1); |
5671 |
|
Bpred->SetLineColor(kRed); |
5672 |
|
Bpred->Draw("histo"); |
5673 |
|
obs->SetLineColor(kBlack); |
5674 |
|
obs->Draw("same"); |
5675 |
|
TLegend *lg2 = make_legend(); |
5676 |
|
lg2->SetX1(0.5); |
5677 |
+ |
lg2->SetY1(0.7); |
5678 |
|
lg2->AddEntry(obs,"observed","P"); |
5679 |
|
lg2->AddEntry(Bpred,"predicted","L"); |
5680 |
+ |
lg2->SetHeader("DY"); |
5681 |
+ |
|
5682 |
|
lg2->Draw(); |
5683 |
|
|
5684 |
< |
save_with_ratio(obs,Bpred,metpad3->cd(),"METvsJZBplots/ComparingPredObsinMET_type1_spectrum"); |
5684 |
> |
Save_With_Ratio(obs,Bpred,metpad3->cd(),"METvsJZBplots/ComparingPredObsinMET"); |
5685 |
> |
|
5686 |
> |
TPad *metpad2 = new TPad("metpad2","metpad2",0,0,1,1); |
5687 |
> |
metpad2->cd(); |
5688 |
> |
metpad2->SetLogy(1); |
5689 |
> |
|
5690 |
> |
TH1F *metlefta = allsamples.Draw("metlefta","met[2]",nbins,low,high, "#slash{E}_{T} [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&LEFT,mc, luminosity, allsamples.FindSample("DYJets")); |
5691 |
> |
TH1F *metleftOa = allsamples.Draw("metleftOa","met[2]",nbins,low,high, "#slash{E}_{T} [GeV]", "events", cutmass&&cutOSOF&&cutnJets&&LEFT,mc, luminosity, allsamples.FindSample("DYJets")); |
5692 |
> |
TH1F *metrighta = allsamples.Draw("metrighta","met[2]",nbins,low,high, "#slash{E}_{T} [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&RIGHT,mc, luminosity, allsamples.FindSample("DYJets")); |
5693 |
> |
TH1F *metrightOa = allsamples.Draw("metrightOa","met[2]",nbins,low,high, "#slash{E}_{T} [GeV]", "events", cutmass&&cutOSOF&&cutnJets&&RIGHT,mc, luminosity, allsamples.FindSample("DYJets")); |
5694 |
> |
|
5695 |
> |
metlefta->Add(metleftOa,-1); |
5696 |
> |
metrighta->Add(metrightOa,-1); |
5697 |
> |
|
5698 |
> |
metlefta->SetLineColor(kRed); |
5699 |
> |
metpad2->cd(); |
5700 |
> |
metlefta->Draw("histo"); |
5701 |
> |
metrighta->Draw("same"); |
5702 |
> |
lg->Draw(); |
5703 |
> |
Save_With_Ratio(metrighta,metlefta,metpad2->cd(),"METvsJZBplots/ComparingLeftToRightinMET_type1_spectrum"); |
5704 |
> |
|
5705 |
> |
delete Bpred; |
5706 |
> |
delete obs; |
5707 |
> |
|
5708 |
> |
float newhigh=300; |
5709 |
> |
int newNBins=30; |
5710 |
> |
|
5711 |
> |
TPad *metpad4 = new TPad("metpad4","metpad4",0,0,1,1); |
5712 |
> |
TH1F *Ametleft = allsamples.Draw("Ametleft","met[4]",newNBins,low,newhigh, "#slash{E}_{T} [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&LEFT,mc, luminosity); |
5713 |
> |
TH1F *AmetleftO = allsamples.Draw("AmetleftO","met[4]",newNBins,low,newhigh, "#slash{E}_{T} [GeV]", "events", cutmass&&cutOSOF&&cutnJets&&LEFT,mc, luminosity); |
5714 |
> |
TH1F *Ametright = allsamples.Draw("Ametright","met[4]",newNBins,low,newhigh, "#slash{E}_{T} [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&RIGHT,mc, luminosity); |
5715 |
> |
TH1F *AmetrightO = allsamples.Draw("AmetrightO","met[4]",newNBins,low,newhigh, "#slash{E}_{T} [GeV]", "events", cutmass&&cutOSOF&&cutnJets&&RIGHT,mc, luminosity); |
5716 |
> |
|
5717 |
> |
TH1F *aBpred = (TH1F*)Ametleft->Clone("aBpred"); |
5718 |
> |
aBpred->Add(AmetleftO,-1); |
5719 |
> |
aBpred->Add(AmetrightO); |
5720 |
> |
aBpred->SetLineColor(kRed); |
5721 |
> |
|
5722 |
> |
TH1F *aobs = (TH1F*)Ametright->Clone("aobs"); |
5723 |
> |
metpad4->cd(); |
5724 |
> |
metpad4->SetLogy(1); |
5725 |
> |
aobs->Draw(); |
5726 |
> |
aBpred->Draw("histo,same"); |
5727 |
> |
aobs->Draw("same"); |
5728 |
> |
lg->SetHeader("All MC"); |
5729 |
> |
lg->Draw(); |
5730 |
> |
Save_With_Ratio(aobs,aBpred,metpad4->cd(),"METvsJZBplots/ComparingPredObsinMET_ALLSAMPLES"); |
5731 |
> |
|
5732 |
> |
|
5733 |
|
delete lg; |
5734 |
|
delete canmetjzb; |
5735 |
|
delete metleft; |
5737 |
|
delete metright; |
5738 |
|
delete metrightO; |
5739 |
|
} |
5740 |
+ |
|
5741 |
+ |
|
5742 |
+ |
void do_one_ttbar_test(TH1F* &observed, TH1F* &predicted, TH1F* &ratio, TH1F* &ratio2, string mcjzb, string prestring) { |
5743 |
+ |
|
5744 |
+ |
if(PlottingSetup::RestrictToMassPeak) { |
5745 |
+ |
write_error(__FUNCTION__,"This function (ttbar_tests) was not written for on-peak studies - sorry."); |
5746 |
+ |
assert(!PlottingSetup::RestrictToMassPeak); |
5747 |
+ |
} |
5748 |
+ |
|
5749 |
+ |
vector<float> binning; |
5750 |
+ |
|
5751 |
+ |
binning.push_back(-200); |
5752 |
+ |
binning.push_back(-150); |
5753 |
+ |
binning.push_back(-125); |
5754 |
+ |
binning.push_back(-100); |
5755 |
+ |
binning.push_back(-75); |
5756 |
+ |
binning.push_back(-50); |
5757 |
+ |
binning.push_back(-25); |
5758 |
+ |
binning.push_back(0); |
5759 |
+ |
binning.push_back(25); |
5760 |
+ |
binning.push_back(50); |
5761 |
+ |
binning.push_back(75); |
5762 |
+ |
binning.push_back(100); |
5763 |
+ |
binning.push_back(125); |
5764 |
+ |
binning.push_back(150); |
5765 |
+ |
binning.push_back(200); |
5766 |
+ |
|
5767 |
+ |
switch_overunderflow(true); |
5768 |
+ |
|
5769 |
+ |
TH1F *TZem = allsamples.Draw("TZem", mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSOF&&cutnJets,mc,luminosity,allsamples.FindSample("/TT")); |
5770 |
+ |
TH1F *nTZem = allsamples.Draw("nTZem","-"+mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSOF&&cutnJets,mc,luminosity,allsamples.FindSample("/TT")); |
5771 |
+ |
TH1F *TZeemm = allsamples.Draw("TZeemm", mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSSF&&cutnJets,mc,luminosity,allsamples.FindSample("/TT")); |
5772 |
+ |
TH1F *nTZeemm = allsamples.Draw("nTZeemm","-"+mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSSF&&cutnJets,mc,luminosity,allsamples.FindSample("/TT")); |
5773 |
+ |
|
5774 |
+ |
TCanvas *tcan = new TCanvas("tcan","tcan"); |
5775 |
+ |
tcan->SetLogy(1); |
5776 |
+ |
|
5777 |
+ |
TZeemm->SetLineColor(kBlack); |
5778 |
+ |
TZem->SetLineColor(kRed); |
5779 |
+ |
TZeemm->SetMarkerColor(kBlack); |
5780 |
+ |
TZem->SetMarkerColor(kRed); |
5781 |
+ |
|
5782 |
+ |
vector<TH1F*> histos; |
5783 |
+ |
// TZem->GetXaxis()->SetRangeUser(-100,binning[binning.size()-1]); |
5784 |
+ |
// TZeemm->GetXaxis()->SetRangeUser(-100,binning[binning.size()-1]); |
5785 |
+ |
histos.push_back(TZem); |
5786 |
+ |
histos.push_back(TZeemm); |
5787 |
+ |
draw_all_ttbar_histos(tcan,histos,"histo",8); |
5788 |
+ |
|
5789 |
+ |
TLegend *leg = make_legend("MC t#bar{t}",0.6,0.65,false); |
5790 |
+ |
leg->AddEntry(TZeemm,"SFZP","l"); |
5791 |
+ |
leg->AddEntry(TZem,"OFZP","l"); |
5792 |
+ |
leg->Draw("same"); |
5793 |
+ |
DrawMCPrelim(); |
5794 |
+ |
CompleteSave(tcan,"Systematics/TtbarTests/"+prestring+"/ttbar_shape_comparison"); |
5795 |
+ |
|
5796 |
+ |
TH1F *TZemcopy = (TH1F*)TZem->Clone("TZemcopy"); |
5797 |
+ |
TH1F *TZeemmcopy = (TH1F*)TZeemm->Clone("TZeemmcopy"); |
5798 |
+ |
TH1F *TSeemmcopy; |
5799 |
+ |
TH1F *TSemcopy; |
5800 |
+ |
|
5801 |
+ |
predicted=(TH1F*)TZem->Clone(((string)"predicted_"+prestring).c_str()); |
5802 |
+ |
observed=(TH1F*)TZeemm->Clone(((string)"observed_"+prestring).c_str()); |
5803 |
+ |
|
5804 |
+ |
vector<float> posbinning; |
5805 |
+ |
for(unsigned int i=0;i<binning.size();i++) { |
5806 |
+ |
if(binning[i]<0) continue; |
5807 |
+ |
posbinning.push_back(binning[i]); |
5808 |
+ |
} |
5809 |
+ |
|
5810 |
+ |
TH1F *pred2 = new TH1F("pred2","pred2",posbinning.size()-1,&posbinning[0]);pred2->Sumw2(); |
5811 |
+ |
TH1F *obs2 = new TH1F("obs2","obs2",posbinning.size()-1,&posbinning[0]);obs2->Sumw2(); |
5812 |
+ |
|
5813 |
+ |
for(unsigned int i=1;i<=predicted->GetNbinsX();i++) { |
5814 |
+ |
int index=pred2->FindBin(abs(TZem->GetBinCenter(i))); |
5815 |
+ |
if(TZem->GetBinCenter(i)<0) { |
5816 |
+ |
//we're on the left: subtract em! |
5817 |
+ |
pred2->SetBinContent(index,pred2->GetBinContent(index)-TZem->GetBinContent(i)); |
5818 |
+ |
pred2->SetBinError(index,sqrt(pow(pred2->GetBinError(index),2)+pow(TZem->GetBinError(i),2))); |
5819 |
+ |
//we're on the left: add eemm! |
5820 |
+ |
pred2->SetBinContent(index,pred2->GetBinContent(index)+TZeemm->GetBinContent(i)); |
5821 |
+ |
pred2->SetBinError(index,sqrt(pow(pred2->GetBinError(index),2)+pow(TZeemm->GetBinError(i),2))); |
5822 |
+ |
} else { |
5823 |
+ |
//we're on the right: add em! |
5824 |
+ |
pred2->SetBinContent(index,pred2->GetBinContent(index)+TZem->GetBinContent(i)); |
5825 |
+ |
pred2->SetBinError(index,sqrt(pow(pred2->GetBinError(index),2)+pow(TZem->GetBinError(i),2))); |
5826 |
+ |
//we're on the left: add eemm! |
5827 |
+ |
obs2->SetBinContent(index,obs2->GetBinContent(index)+TZeemm->GetBinContent(i)); |
5828 |
+ |
obs2->SetBinError(index,sqrt(pow(pred2->GetBinError(index),2)+pow(TZeemm->GetBinError(i),2))); |
5829 |
+ |
} |
5830 |
+ |
} |
5831 |
+ |
|
5832 |
+ |
ratio2 = (TH1F*)pred2->Clone(((string)"ratio2_"+prestring).c_str()); |
5833 |
+ |
ratio2->Divide(obs2); |
5834 |
+ |
|
5835 |
+ |
TZem->Divide(TZeemm); |
5836 |
+ |
TZem->SetMarkerStyle(21); |
5837 |
+ |
|
5838 |
+ |
TZem->SetTitle("OF / SF"); |
5839 |
+ |
ratio = (TH1F*)TZem->Clone(((string)"ratio_"+prestring).c_str()); |
5840 |
+ |
|
5841 |
+ |
tcan->SetLogy(0); |
5842 |
+ |
TZem->GetYaxis()->SetRangeUser(0,2.5); |
5843 |
+ |
TZem->GetYaxis()->SetTitle("ratio"); |
5844 |
+ |
TZem->Draw(); |
5845 |
+ |
|
5846 |
+ |
float linepos=emuncertOFFPEAK; |
5847 |
+ |
|
5848 |
+ |
TLine *top = new TLine(binning[0],1.0+linepos,binning[binning.size()-1],1.0+linepos); |
5849 |
+ |
TLine *center = new TLine(binning[0],1.0,binning[binning.size()-1],1.0); |
5850 |
+ |
TLine *bottom = new TLine(binning[0],1.0-linepos,binning[binning.size()-1],1.0-linepos); |
5851 |
+ |
|
5852 |
+ |
top->SetLineColor(kBlue);top->SetLineStyle(2); |
5853 |
+ |
bottom->SetLineColor(kBlue);bottom->SetLineStyle(2); |
5854 |
+ |
center->SetLineColor(kBlue); |
5855 |
+ |
|
5856 |
+ |
top->Draw("same"); |
5857 |
+ |
center->Draw("same"); |
5858 |
+ |
bottom->Draw("same"); |
5859 |
+ |
|
5860 |
+ |
TLegend *leg2 = make_legend("MC t#bar{t}",0.55,0.75,false); |
5861 |
+ |
leg2->AddEntry(TZem,"OFZP / SFZP","ple"); |
5862 |
+ |
leg2->AddEntry(bottom,"syst. envelope","l"); |
5863 |
+ |
leg2->SetX1(0.25);leg2->SetX2(0.6); |
5864 |
+ |
leg2->SetY1(0.65); |
5865 |
+ |
|
5866 |
+ |
leg2->Draw("same"); |
5867 |
+ |
|
5868 |
+ |
DrawMCPrelim(); |
5869 |
+ |
CompleteSave(tcan,"Systematics/TtbarTests/"+prestring+"/ttbar_shape_comparison_ratio"); |
5870 |
+ |
|
5871 |
+ |
ratio2->SetLineColor(TZem->GetLineColor()); |
5872 |
+ |
ratio2->SetMarkerColor(TZem->GetMarkerColor()); |
5873 |
+ |
ratio2->GetYaxis()->SetRangeUser(0,2.5); |
5874 |
+ |
ratio2->GetYaxis()->SetTitle("ratio"); |
5875 |
+ |
ratio2->Draw(); |
5876 |
+ |
|
5877 |
+ |
TLine *top2 = new TLine(0,1.0+linepos,binning[binning.size()-1],1.0+linepos); |
5878 |
+ |
TLine *center2 = new TLine(0,1.0,binning[binning.size()-1],1.0); |
5879 |
+ |
TLine *bottom2 = new TLine(0,1.0-linepos,binning[binning.size()-1],1.0-linepos); |
5880 |
+ |
|
5881 |
+ |
top2->SetLineColor(kBlue);top->SetLineStyle(2); |
5882 |
+ |
bottom2->SetLineColor(kBlue);bottom->SetLineStyle(2); |
5883 |
+ |
center2->SetLineColor(kBlue); |
5884 |
+ |
|
5885 |
+ |
top2->Draw("same"); |
5886 |
+ |
center2->Draw("same"); |
5887 |
+ |
bottom2->Draw("same"); |
5888 |
+ |
|
5889 |
+ |
leg2->Draw("same"); |
5890 |
+ |
|
5891 |
+ |
DrawMCPrelim(); |
5892 |
+ |
CompleteSave(tcan,"Systematics/TtbarTests/"+prestring+"/ttbar_shape_comparison_FINALratio"); |
5893 |
+ |
|
5894 |
+ |
delete TZem; |
5895 |
+ |
delete nTZem; |
5896 |
+ |
delete TZeemm; |
5897 |
+ |
delete nTZeemm; |
5898 |
+ |
delete obs2; |
5899 |
+ |
delete pred2; |
5900 |
+ |
delete tcan; |
5901 |
+ |
switch_overunderflow(false); |
5902 |
+ |
} |
5903 |
+ |
|
5904 |
+ |
void IllustrateVariation(TH1F *vanilla_ratio, TH1F *response_only_up_ratio, TH1F *response_only_down_ratio, TH1F *reponse_plus_peak_up_ratio, TH1F *reponse_plus_peak_down_ratio, string PostString) { |
5905 |
|
|
5906 |
+ |
|
5907 |
+ |
TCanvas *ttcan2 = new TCanvas("ttcan2","ttcan2"); |
5908 |
+ |
vanilla_ratio->GetYaxis()->SetRangeUser(0.5,1.5); |
5909 |
+ |
vanilla_ratio->SetFillColor(kGreen); |
5910 |
+ |
vanilla_ratio->SetLineColor(kGreen); |
5911 |
+ |
vanilla_ratio->SetMarkerColor(kGreen); |
5912 |
+ |
vanilla_ratio->SetFillStyle(3001); |
5913 |
+ |
vanilla_ratio->Draw("e3"); |
5914 |
+ |
|
5915 |
+ |
response_only_up_ratio->SetFillColor(kRed); |
5916 |
+ |
response_only_up_ratio->SetMarkerColor(kRed); |
5917 |
+ |
response_only_up_ratio->SetLineColor(kRed); |
5918 |
+ |
response_only_up_ratio->SetFillStyle(3003); |
5919 |
+ |
response_only_up_ratio->Draw("e3,same"); |
5920 |
+ |
|
5921 |
+ |
response_only_down_ratio->SetFillColor(kOrange); |
5922 |
+ |
response_only_down_ratio->SetMarkerColor(kOrange); |
5923 |
+ |
response_only_down_ratio->SetLineColor(kOrange); |
5924 |
+ |
response_only_down_ratio->SetFillStyle(3004); |
5925 |
+ |
response_only_down_ratio->Draw("e3,same"); |
5926 |
+ |
|
5927 |
+ |
reponse_plus_peak_up_ratio->SetFillColor(TColor::GetColor("#BDBDBD")); |
5928 |
+ |
reponse_plus_peak_up_ratio->SetMarkerColor(TColor::GetColor("#BDBDBD")); |
5929 |
+ |
reponse_plus_peak_up_ratio->SetLineColor(TColor::GetColor("#BDBDBD")); |
5930 |
+ |
reponse_plus_peak_up_ratio->SetFillStyle(3005); |
5931 |
+ |
reponse_plus_peak_up_ratio->Draw("e3,same"); |
5932 |
+ |
|
5933 |
+ |
reponse_plus_peak_down_ratio->SetFillColor(kBlue); |
5934 |
+ |
reponse_plus_peak_down_ratio->SetMarkerColor(kBlue); |
5935 |
+ |
reponse_plus_peak_down_ratio->SetLineColor(kBlue); |
5936 |
+ |
reponse_plus_peak_down_ratio->SetFillStyle(3006); |
5937 |
+ |
reponse_plus_peak_down_ratio->Draw("e3,same"); |
5938 |
+ |
|
5939 |
+ |
TLine *llow = new TLine(vanilla_ratio->GetBinLowEdge(1),1.0-emuncertOFFPEAK,vanilla_ratio->GetBinLowEdge(vanilla_ratio->GetNbinsX())+vanilla_ratio->GetBinWidth(vanilla_ratio->GetNbinsX()),1.0-emuncertOFFPEAK); |
5940 |
+ |
TLine *lhi = new TLine(vanilla_ratio->GetBinLowEdge(1),1.0+emuncertOFFPEAK,vanilla_ratio->GetBinLowEdge(vanilla_ratio->GetNbinsX())+vanilla_ratio->GetBinWidth(vanilla_ratio->GetNbinsX()),1.0+emuncertOFFPEAK); |
5941 |
+ |
TLine *lOne = new TLine(vanilla_ratio->GetBinLowEdge(1),1.0,vanilla_ratio->GetBinLowEdge(vanilla_ratio->GetNbinsX())+vanilla_ratio->GetBinWidth(vanilla_ratio->GetNbinsX()),1.0); |
5942 |
+ |
|
5943 |
+ |
TLine *llowA = new TLine(vanilla_ratio->GetBinLowEdge(1),1.0-0.07,vanilla_ratio->GetBinLowEdge(vanilla_ratio->GetNbinsX())+vanilla_ratio->GetBinWidth(vanilla_ratio->GetNbinsX()),1.0-0.07); |
5944 |
+ |
TLine *lhiA = new TLine(vanilla_ratio->GetBinLowEdge(1),1.0+0.07,vanilla_ratio->GetBinLowEdge(vanilla_ratio->GetNbinsX())+vanilla_ratio->GetBinWidth(vanilla_ratio->GetNbinsX()),1.0+0.07); |
5945 |
+ |
|
5946 |
+ |
lhiA->SetLineColor(kRed); |
5947 |
+ |
lhiA->SetLineStyle(2); |
5948 |
+ |
llowA->SetLineColor(kRed); |
5949 |
+ |
llowA->SetLineStyle(2); |
5950 |
+ |
|
5951 |
+ |
llow->SetLineColor(kBlue); |
5952 |
+ |
llow->SetLineStyle(2); |
5953 |
+ |
lhi->SetLineColor(kBlue); |
5954 |
+ |
lhi->SetLineStyle(2); |
5955 |
+ |
lOne->SetLineColor(kBlue); |
5956 |
+ |
|
5957 |
+ |
llow->Draw(); |
5958 |
+ |
lhi->Draw(); |
5959 |
+ |
lOne->Draw(); |
5960 |
+ |
|
5961 |
+ |
llowA->Draw(); |
5962 |
+ |
lhiA->Draw(); |
5963 |
+ |
|
5964 |
+ |
TLegend *leg = make_legend(); |
5965 |
+ |
leg->SetX1(0.15); |
5966 |
+ |
leg->SetY1(0.7); |
5967 |
+ |
leg->AddEntry(vanilla_ratio,"Raw JZB","pf"); |
5968 |
+ |
leg->AddEntry(response_only_up_ratio,"With response correction","pf"); |
5969 |
+ |
leg->AddEntry(response_only_down_ratio,"With inverted response correction","pf"); |
5970 |
+ |
leg->AddEntry(reponse_plus_peak_up_ratio,"With response and peak correction","pf"); |
5971 |
+ |
leg->AddEntry(reponse_plus_peak_down_ratio,"With response and inverted peak corr.","pf"); |
5972 |
+ |
leg->AddEntry(lhi,"Systematic envelope","l"); |
5973 |
+ |
// leg->SetNColumns(2); |
5974 |
+ |
leg->Draw(); |
5975 |
+ |
|
5976 |
+ |
CompleteSave(ttcan2,"Systematics/TtbarTests/Comparison"+PostString); |
5977 |
+ |
|
5978 |
+ |
vanilla_ratio->GetYaxis()->SetRangeUser(0.6,1.4); |
5979 |
+ |
vanilla_ratio->Draw("e3"); |
5980 |
+ |
response_only_up_ratio->Draw("e3 same"); |
5981 |
+ |
response_only_down_ratio->Draw("e3 same"); |
5982 |
+ |
TLegend *leg2 = make_legend(); |
5983 |
+ |
leg2->SetX1(0.15); |
5984 |
+ |
leg2->SetY1(0.7); |
5985 |
+ |
leg2->AddEntry(vanilla_ratio,"Raw JZB","pf"); |
5986 |
+ |
leg2->AddEntry(response_only_up_ratio,"With response correction","pf"); |
5987 |
+ |
leg2->AddEntry(response_only_down_ratio,"With inverted response correction","pf"); |
5988 |
+ |
leg2->AddEntry(lhi,"Systematic envelope","l"); |
5989 |
+ |
leg2->Draw(); |
5990 |
+ |
llow->Draw(); |
5991 |
+ |
lOne->Draw(); |
5992 |
+ |
llowA->Draw(); |
5993 |
+ |
lhiA->Draw(); |
5994 |
+ |
|
5995 |
+ |
CompleteSave(ttcan2,"Systematics/TtbarTests/Comparison_Response"+PostString); |
5996 |
+ |
|
5997 |
+ |
response_only_up_ratio->GetYaxis()->SetRangeUser(0.6,1.4); |
5998 |
+ |
response_only_up_ratio->Draw("e3"); |
5999 |
+ |
reponse_plus_peak_up_ratio->Draw("e3 same"); |
6000 |
+ |
reponse_plus_peak_down_ratio->Draw("e3 same"); |
6001 |
+ |
TLegend *leg3 = make_legend(); |
6002 |
+ |
leg3->SetX1(0.15); |
6003 |
+ |
leg3->SetY1(0.7); |
6004 |
+ |
leg3->AddEntry(response_only_up_ratio,"With response correction","pf"); |
6005 |
+ |
leg3->AddEntry(reponse_plus_peak_up_ratio,"With response and peak correction","pf"); |
6006 |
+ |
leg3->AddEntry(reponse_plus_peak_down_ratio,"With response and inverted peak corr.","pf"); |
6007 |
+ |
leg3->AddEntry(lhi,"Systematic envelope","l"); |
6008 |
+ |
leg3->Draw(); |
6009 |
+ |
llow->Draw(); |
6010 |
+ |
lOne->Draw(); |
6011 |
+ |
llowA->Draw(); |
6012 |
+ |
lhiA->Draw(); |
6013 |
+ |
|
6014 |
+ |
CompleteSave(ttcan2,"Systematics/TtbarTests/Comparison_Peak"+PostString); |
6015 |
+ |
|
6016 |
+ |
delete ttcan2; |
6017 |
+ |
} |
6018 |
+ |
|
6019 |
+ |
void ttbar_correction_tests() { |
6020 |
+ |
TCanvas *ttcan = new TCanvas("ttcan","ttcan"); |
6021 |
+ |
|
6022 |
+ |
TH1F *vanilla_observed, *response_only_up_observed, *response_only_down_observed, *reponse_plus_peak_up_observed, *reponse_plus_peak_down_observed; |
6023 |
+ |
|
6024 |
+ |
TH1F *vanilla_predicted, *response_only_up_predicted, *response_only_down_predicted, *reponse_plus_peak_up_predicted, *reponse_plus_peak_down_predicted; |
6025 |
+ |
|
6026 |
+ |
TH1F *vanilla_ratio, *response_only_up_ratio, *response_only_down_ratio, *reponse_plus_peak_up_ratio, *reponse_plus_peak_down_ratio; |
6027 |
+ |
|
6028 |
+ |
TH1F *vanilla_ratio2, *response_only_up_ratio2, *response_only_down_ratio2, *reponse_plus_peak_up_ratio2, *reponse_plus_peak_down_ratio2; |
6029 |
+ |
|
6030 |
+ |
string vanilla="jzb[1]"; |
6031 |
+ |
string response_only_up="((jzb[1]+0.034665*pt))"; |
6032 |
+ |
string response_only_down="((jzb[1]-0.034665*pt))"; |
6033 |
+ |
string reponse_plus_peak_up="((jzb[1]+0.034665*pt)- 3.58273 )"; |
6034 |
+ |
string reponse_plus_peak_down="((jzb[1]+0.034665*pt)+ 3.58273 )"; |
6035 |
+ |
|
6036 |
+ |
do_one_ttbar_test(vanilla_observed,vanilla_predicted,vanilla_ratio,vanilla_ratio2,vanilla,"vanilla"); |
6037 |
+ |
do_one_ttbar_test(response_only_up_observed,response_only_up_predicted,response_only_up_ratio,response_only_up_ratio2,response_only_up,"response_only_up"); |
6038 |
+ |
do_one_ttbar_test(response_only_down_observed,response_only_down_predicted,response_only_down_ratio,response_only_down_ratio2,response_only_down,"response_only_down"); |
6039 |
+ |
do_one_ttbar_test(reponse_plus_peak_up_observed,reponse_plus_peak_up_predicted,reponse_plus_peak_up_ratio,reponse_plus_peak_up_ratio2,reponse_plus_peak_up,"reponse_plus_peak_up"); |
6040 |
+ |
do_one_ttbar_test(reponse_plus_peak_down_observed,reponse_plus_peak_down_predicted,reponse_plus_peak_down_ratio,reponse_plus_peak_down_ratio2,reponse_plus_peak_down,"reponse_plus_peak_down"); |
6041 |
+ |
|
6042 |
+ |
ttcan->cd(); |
6043 |
+ |
|
6044 |
+ |
IllustrateVariation(vanilla_ratio,response_only_up_ratio,response_only_down_ratio,reponse_plus_peak_up_ratio,reponse_plus_peak_down_ratio,"PartialRatio"); |
6045 |
+ |
IllustrateVariation(vanilla_ratio2,response_only_up_ratio2,response_only_down_ratio2,reponse_plus_peak_up_ratio2,reponse_plus_peak_down_ratio2,"FullRatio"); |
6046 |
+ |
|
6047 |
+ |
delete vanilla_observed; |
6048 |
+ |
delete response_only_up_observed; |
6049 |
+ |
delete response_only_down_observed; |
6050 |
+ |
delete reponse_plus_peak_up_observed; |
6051 |
+ |
delete reponse_plus_peak_down_observed; |
6052 |
+ |
|
6053 |
+ |
delete vanilla_predicted; |
6054 |
+ |
delete response_only_up_predicted; |
6055 |
+ |
delete response_only_down_predicted; |
6056 |
+ |
delete reponse_plus_peak_up_predicted; |
6057 |
+ |
delete reponse_plus_peak_down_predicted; |
6058 |
+ |
|
6059 |
+ |
delete vanilla_ratio; |
6060 |
+ |
delete response_only_up_ratio; |
6061 |
+ |
delete response_only_down_ratio; |
6062 |
+ |
delete reponse_plus_peak_up_ratio; |
6063 |
+ |
delete reponse_plus_peak_down_ratio; |
6064 |
+ |
|
6065 |
+ |
delete ttcan; |
6066 |
+ |
} |
6067 |
+ |
|
6068 |
+ |
void ttbar_region_search(string mcjzb) { |
6069 |
+ |
cout << "Looking for a nice control region" << endl; |
6070 |
+ |
TCanvas *can = new TCanvas("can","can",1200,1200); |
6071 |
+ |
can->Divide(2,2); |
6072 |
+ |
can->cd(1); |
6073 |
+ |
can->cd(1)->SetLogy(1); |
6074 |
+ |
|
6075 |
+ |
THStack JZBdistSF = allsamples.DrawStack("JZBdistSF",mcjzb,100,-150,150, "JZB [GeV]", "events", cutmass&&cutOSSF&&TCut("pfJetGoodNum40==2"),mc, luminosity); |
6076 |
+ |
THStack JZBdistOF = allsamples.DrawStack("JZBdistOF",mcjzb,100,-150,150, "JZB [GeV]", "events", cutmass&&cutOSOF&&TCut("pfJetGoodNum40==2"),mc, luminosity); |
6077 |
+ |
|
6078 |
+ |
JZBdistSF.Draw("histo"); |
6079 |
+ |
JZBdistSF.SetMaximum(1000); |
6080 |
+ |
JZBdistSF.SetMinimum(0.1); |
6081 |
+ |
JZBdistSF.Draw("histo"); |
6082 |
+ |
DrawMCPrelim(); |
6083 |
+ |
|
6084 |
+ |
can->cd(2); |
6085 |
+ |
can->cd(2)->SetLogy(1); |
6086 |
+ |
JZBdistOF.Draw("histo"); |
6087 |
+ |
JZBdistOF.SetMaximum(1000); |
6088 |
+ |
JZBdistOF.SetMinimum(0.1); |
6089 |
+ |
JZBdistOF.Draw("histo"); |
6090 |
+ |
DrawMCPrelim(); |
6091 |
+ |
|
6092 |
+ |
can->cd(3); |
6093 |
+ |
|
6094 |
+ |
|
6095 |
+ |
write_warning(__FUNCTION__,"Missing negative JZB subtraction "); |
6096 |
+ |
|
6097 |
+ |
DrawMCPrelim(); |
6098 |
+ |
|
6099 |
+ |
/* |
6100 |
+ |
THStack *Subtracted = new THStack(); |
6101 |
+ |
|
6102 |
+ |
TIter nextSF(JZBdistSF.GetHists()); |
6103 |
+ |
TIter nextOF(JZBdistOF.GetHists()); |
6104 |
+ |
TObject* SFobj; |
6105 |
+ |
TObject* OFobj; |
6106 |
+ |
|
6107 |
+ |
TH1* sfh = NULL; |
6108 |
+ |
TH1* ofh = NULL; |
6109 |
+ |
|
6110 |
+ |
while ( (SFobj = nextSF()) && (OFobj = nextOF()) ) { |
6111 |
+ |
TH1F *sfstart = (TH1*)SFobj->Clone(); |
6112 |
+ |
TH1F *ofstart = (TH1*)OFobj->Clone(); |
6113 |
+ |
TH1F *obs, *pred; |
6114 |
+ |
MakeObservationPrediction(obs,pred,sfstart,ofstart); |
6115 |
+ |
|
6116 |
+ |
if ( !hratio ) { |
6117 |
+ |
hratio = (TH1*)obj->Clone(); |
6118 |
+ |
hratio->SetName("hratio"); |
6119 |
+ |
} else hratio->Add( (TH1*)obj ); |
6120 |
+ |
|
6121 |
+ |
} |
6122 |
+ |
hratio->Divide(hdata); |
6123 |
+ |
*/ |
6124 |
+ |
|
6125 |
+ |
|
6126 |
+ |
can->cd(4); |
6127 |
+ |
JZBdistOF.Draw("histo"); |
6128 |
+ |
DrawMCPrelim(); |
6129 |
+ |
|
6130 |
+ |
|
6131 |
+ |
|
6132 |
+ |
CompleteSave(can,"Systematics/TtbarTests/ControlRegion"); |
6133 |
+ |
|
6134 |
+ |
CleanLegends(); |
6135 |
+ |
delete can; |
6136 |
+ |
} |
6137 |
+ |
|
6138 |
+ |
void ttbar_tests(string mcjzb) { |
6139 |
+ |
//ttbar_correction_tests(); |
6140 |
+ |
ttbar_region_search(mcjzb); |
6141 |
+ |
} |
6142 |
+ |
|
6143 |
+ |
Value GetYieldBetween(TH1F *h, float low, float high) { |
6144 |
+ |
float Yield=0; |
6145 |
+ |
float YieldErr=0; |
6146 |
+ |
for(int i=1;i<=h->GetNbinsX()+1;i++) { |
6147 |
+ |
if(h->GetBinLowEdge(i)+h->GetBinWidth(i)<=low) continue;// considered in the next bin |
6148 |
+ |
if(h->GetBinLowEdge(i)>=high) continue;//above the threshold, out! |
6149 |
+ |
Yield+=h->GetBinContent(i); |
6150 |
+ |
YieldErr=sqrt(YieldErr*YieldErr+h->GetBinError(i)*h->GetBinError(i)); |
6151 |
+ |
} |
6152 |
+ |
|
6153 |
+ |
Value a(Yield,YieldErr); |
6154 |
+ |
return a; |
6155 |
+ |
} |
6156 |
+ |
|
6157 |
+ |
|
6158 |
+ |
void make_SF_over_OF_plot(string datajzb, string mcjzb, TCut cut, string variable, int nbins, float xmin, float ymin, string varname, string filename) { |
6159 |
+ |
TCanvas *SFoOF_can = new TCanvas("SFoOF_can","SFoOF_can"); |
6160 |
+ |
TH1F *data_sf = allsamples.Draw("data_sf","mll",20,0,200, "m_{ll} [GeV]", "events", cut&&cutOSSF,data,luminosity); |
6161 |
+ |
TH1F *data_of = allsamples.Draw("data_of","mll",20,0,200, "m_{ll} [GeV]", "events", cut&&cutOSOF,data,luminosity); |
6162 |
+ |
|
6163 |
+ |
TH1F *mc_sf = allsamples.Draw("mc_sf","mll",20,0,200, "m_{ll} [GeV]", "events", cut&&cutOSSF,mc,luminosity); |
6164 |
+ |
TH1F *mc_of = allsamples.Draw("mc_of","mll",20,0,200, "m_{ll} [GeV]", "events", cut&&cutOSOF,mc,luminosity); |
6165 |
+ |
|
6166 |
+ |
TH1F *mc_ratio = (TH1F*)mc_sf->Clone("mc_ratio"); |
6167 |
+ |
mc_ratio->Divide(mc_of); |
6168 |
+ |
|
6169 |
+ |
TH1F *data_ratio = (TH1F*)data_sf->Clone("data_ratio"); |
6170 |
+ |
data_ratio->Divide(data_of); |
6171 |
+ |
|
6172 |
+ |
mc_ratio->SetFillColor(TColor::GetColor("#00ADE1")); |
6173 |
+ |
mc_ratio->SetMarkerColor(TColor::GetColor("#00ADE1")); |
6174 |
+ |
mc_ratio->GetYaxis()->SetRangeUser(0.5,1.5); |
6175 |
+ |
|
6176 |
+ |
mc_ratio->GetYaxis()->SetTitle("R(SF / OF)"); |
6177 |
+ |
|
6178 |
+ |
|
6179 |
+ |
Value R_sf_of_low_mass = GetYieldBetween(data_sf,20,70)/GetYieldBetween(data_of,20,70); |
6180 |
+ |
Value R_sf_of_high_mass = GetYieldBetween(data_sf,120,200)/GetYieldBetween(data_of,120,200); |
6181 |
+ |
|
6182 |
+ |
Value R_sf_of_low_mass_mc = GetYieldBetween(mc_sf,20,70)/GetYieldBetween(mc_of,20,70); |
6183 |
+ |
Value R_sf_of_high_mass_mc = GetYieldBetween(mc_sf,120,200)/GetYieldBetween(mc_of,120,200); |
6184 |
+ |
|
6185 |
+ |
dout << "Ratio at low mass : " << R_sf_of_low_mass << " (mc : " << R_sf_of_low_mass_mc << " )" << endl; |
6186 |
+ |
dout << "Ratio at high mass : " << R_sf_of_high_mass << " (mc : " << R_sf_of_high_mass_mc << " )" << endl; |
6187 |
+ |
|
6188 |
+ |
TGraphAsymmErrors *gra = produce_ratio_graph(mc_ratio); |
6189 |
+ |
gra->Draw(); |
6190 |
+ |
mc_ratio->Draw(); |
6191 |
+ |
gra->Draw("e20"); |
6192 |
+ |
gra->SetFillColor(TColor::GetColor("#00ADE1")); |
6193 |
+ |
gra->SetMarkerColor(TColor::GetColor("#00ADE1")); |
6194 |
+ |
data_ratio->Draw("e1,same"); |
6195 |
+ |
|
6196 |
+ |
TLegend *leg = new TLegend(0.17,0.16,0.53,0.31); |
6197 |
+ |
// leg->SetHeader("R( SF / OF )"); |
6198 |
+ |
leg->SetFillColor(kWhite); |
6199 |
+ |
leg->SetBorderSize(0); |
6200 |
+ |
leg->AddEntry(data_ratio,"Data","p"); |
6201 |
+ |
leg->AddEntry(gra,"MC","fp"); |
6202 |
+ |
leg->Draw(); |
6203 |
+ |
|
6204 |
+ |
TLine *g = new TLine(0,R_sf_of_low_mass.getValue(),200,R_sf_of_low_mass.getValue()); |
6205 |
+ |
g->SetLineColor(kBlue); |
6206 |
+ |
g->Draw(); |
6207 |
+ |
|
6208 |
+ |
TLine *l = new TLine(70,0.5,70,1.5); |
6209 |
+ |
l->SetLineStyle(2); |
6210 |
+ |
l->SetLineColor(TColor::GetColor("#00ADE1")); |
6211 |
+ |
TLine *m = new TLine(70,0.5,70,1.5); |
6212 |
+ |
m->SetLineStyle(2); |
6213 |
+ |
m->SetLineColor(TColor::GetColor("#00ADE1")); |
6214 |
+ |
l->Draw(); |
6215 |
+ |
m->Draw(); |
6216 |
+ |
|
6217 |
+ |
|
6218 |
+ |
DrawPrelim(); |
6219 |
+ |
|
6220 |
+ |
CompleteSave(SFoOF_can,"iTTbar/"+filename+"SF_vs_OF"); |
6221 |
+ |
|
6222 |
+ |
delete leg; |
6223 |
+ |
delete mc_sf; |
6224 |
+ |
delete mc_of; |
6225 |
+ |
delete mc_ratio; |
6226 |
+ |
delete data_sf; |
6227 |
+ |
delete data_of; |
6228 |
+ |
delete data_ratio; |
6229 |
+ |
delete SFoOF_can; |
6230 |
+ |
} |
6231 |
+ |
|
6232 |
+ |
void make_iTTbar_JZB_plot(string datajzb, string mcjzb, TCut cut) { |
6233 |
+ |
TCanvas *can = new TCanvas("can","can"); |
6234 |
+ |
vector<float> binning; |
6235 |
+ |
binning.push_back(-100); |
6236 |
+ |
binning.push_back(-50); |
6237 |
+ |
binning.push_back(-20); |
6238 |
+ |
binning.push_back(0); |
6239 |
+ |
// binning.push_back(10); |
6240 |
+ |
binning.push_back(20); |
6241 |
+ |
// binning.push_back(30); |
6242 |
+ |
binning.push_back(50); |
6243 |
+ |
binning.push_back(100); |
6244 |
+ |
binning.push_back(300); |
6245 |
+ |
|
6246 |
+ |
TH1F *hdata = allsamples.Draw("hdata", datajzb, binning, "JZB [GeV]", "events", cut&&cutOSSF,data,luminosity); |
6247 |
+ |
TH1F *hodata = allsamples.Draw("hodata", datajzb, binning, "JZB [GeV]", "events", cut&&cutOSOF,data,luminosity); |
6248 |
+ |
TH1F *hndata = allsamples.Draw("hndata", "-"+datajzb,binning, "JZB [GeV]", "events", cut&&cutOSSF,data,luminosity); |
6249 |
+ |
TH1F *hnodata = allsamples.Draw("hnodata","-"+datajzb,binning, "JZB [GeV]", "events", cut&&cutOSOF,data,luminosity); |
6250 |
+ |
|
6251 |
+ |
TH1F *hmc = allsamples.Draw("hmc", datajzb, binning, "JZB [GeV]", "events", cut&&cutOSSF,mc,luminosity); |
6252 |
+ |
TH1F *homc = allsamples.Draw("homc", datajzb, binning, "JZB [GeV]", "events", cut&&cutOSOF,mc,luminosity); |
6253 |
+ |
|
6254 |
+ |
hodata->SetLineColor(kRed); |
6255 |
+ |
hmc->SetLineColor(kRed); |
6256 |
+ |
// hodata->Add(hndata); |
6257 |
+ |
// hodata->Add(hnodata,-1); |
6258 |
+ |
|
6259 |
+ |
if(hdata->GetMaximum()>hodata->GetMaximum()) { |
6260 |
+ |
hdata->SetMinimum(1.0); |
6261 |
+ |
hdata->Draw(); |
6262 |
+ |
hodata->Draw("histo,same"); |
6263 |
+ |
hdata->Draw("same"); |
6264 |
+ |
} else { |
6265 |
+ |
hodata->SetMinimum(1.0); |
6266 |
+ |
hodata->Draw("histo"); |
6267 |
+ |
hdata->Draw("same"); |
6268 |
+ |
} |
6269 |
+ |
|
6270 |
+ |
CompleteSave(can,"iTTbar/JZB_plot"); |
6271 |
+ |
TH1F *ratio = (TH1F*)hdata->Clone("ratio"); |
6272 |
+ |
ratio->Divide(hodata); |
6273 |
+ |
ratio->GetYaxis()->SetTitle("obs/pred"); |
6274 |
+ |
ratio->GetYaxis()->SetRangeUser(0,2); |
6275 |
+ |
|
6276 |
+ |
ratio->Draw(); |
6277 |
+ |
TLine *l = new TLine(-100,1.0,300,1.0); |
6278 |
+ |
l->SetLineColor(kBlue); |
6279 |
+ |
l->SetLineStyle(2); |
6280 |
+ |
l->Draw(); |
6281 |
+ |
TLine *llow = new TLine(-100,1.0-0.07,300,1.0-0.07); |
6282 |
+ |
TLine *lhi = new TLine(-100,1.0+0.07,300,1.0+0.07); |
6283 |
+ |
llow->SetLineColor(kBlue); |
6284 |
+ |
llow->SetLineStyle(2); |
6285 |
+ |
llow->Draw(); |
6286 |
+ |
lhi->SetLineColor(kBlue); |
6287 |
+ |
lhi->SetLineStyle(2); |
6288 |
+ |
lhi->Draw(); |
6289 |
+ |
|
6290 |
+ |
CompleteSave(can,"iTTbar/JZB_plot_ratio"); |
6291 |
+ |
|
6292 |
+ |
delete hdata; |
6293 |
+ |
delete hodata; |
6294 |
+ |
delete ratio; |
6295 |
+ |
delete can; |
6296 |
+ |
// THStack *hmc = new THStack(allsamples.DrawStack("hmc","mll",40,0,200, "m_{ll} [GeV]", "events", cut&&cutOSSF,mc,luminosity)); |
6297 |
+ |
// THStack *homc = new THStack(allsamples.DrawStack("homc","mll",40,0,200, "m_{ll} [GeV]", "events", cut&&cutOSOF,mc,luminosity)); |
6298 |
+ |
} |
6299 |
+ |
|
6300 |
+ |
|
6301 |
+ |
|
6302 |
+ |
void MakeSpecialiTTbarClosurePlot(TCut fullcut, string datajzb, string mcjzb, string MassRegion) { |
6303 |
+ |
TCanvas *iTTbarClosureTestCanvas = new TCanvas("iTTbarClosureTestCanvas","iTTbarClosureTestCanvas"); |
6304 |
+ |
|
6305 |
+ |
vector<float> binning; |
6306 |
+ |
/* |
6307 |
+ |
binning.push_back(0); |
6308 |
+ |
binning.push_back(20); |
6309 |
+ |
binning.push_back(50); |
6310 |
+ |
binning.push_back(100); |
6311 |
+ |
// binning.push_back(200); |
6312 |
+ |
*/ |
6313 |
+ |
binning.push_back(0); |
6314 |
+ |
binning.push_back(10); |
6315 |
+ |
binning.push_back(30); |
6316 |
+ |
binning.push_back(50); |
6317 |
+ |
binning.push_back(100); |
6318 |
+ |
// binning.push_back(200); |
6319 |
+ |
|
6320 |
+ |
|
6321 |
+ |
TH1F *hdata = allsamples.Draw("hdata", datajzb,binning, "JZB [GeV]", "events", fullcut&&TCut("id1==id2"),data,luminosity); |
6322 |
+ |
TH1F *hodata = allsamples.Draw("hodata",datajzb,binning, "JZB [GeV]", "events", fullcut&&TCut("id1!=id2"),data,luminosity); |
6323 |
+ |
TH1F *hmc = allsamples.Draw("hmc", mcjzb,binning, "JZB [GeV]", "events", fullcut&&TCut("id1==id2"),mc,luminosity); |
6324 |
+ |
TH1F *homc = allsamples.Draw("homc", mcjzb,binning, "JZB [GeV]", "events", fullcut&&TCut("id1!=id2"),mc,luminosity); |
6325 |
+ |
|
6326 |
+ |
hdata->SetLineColor(kBlack); |
6327 |
+ |
hmc->SetLineColor(kBlack); |
6328 |
+ |
hodata->SetLineColor(kRed); |
6329 |
+ |
homc->SetLineColor(kRed); |
6330 |
+ |
hodata->SetMarkerColor(kRed); |
6331 |
+ |
|
6332 |
+ |
hdata->GetYaxis()->SetTitle("events"); |
6333 |
+ |
|
6334 |
+ |
float maximum=hdata->GetMaximum()+1.2*sqrt(hdata->GetMaximum()); |
6335 |
+ |
float minimum=hdata->GetMinimum()-1.2*sqrt(hdata->GetMinimum()); |
6336 |
+ |
if(hmc->GetMinimum()<minimum) minimum=hmc->GetMinimum()-1.2*sqrt(hmc->GetMinimum()); |
6337 |
+ |
if(hmc->GetMaximum()>maximum) maximum=hmc->GetMaximum()+1.2*sqrt(hmc->GetMaximum()); |
6338 |
+ |
if(homc->GetMinimum()<minimum) minimum=homc->GetMinimum()-1.2*sqrt(homc->GetMinimum()); |
6339 |
+ |
if(homc->GetMaximum()>maximum) maximum=homc->GetMaximum()+1.2*sqrt(homc->GetMaximum()); |
6340 |
+ |
if(hodata->GetMinimum()<minimum) minimum=hodata->GetMinimum()-1.2*sqrt(hodata->GetMinimum()); |
6341 |
+ |
if(hodata->GetMaximum()>maximum) maximum=hodata->GetMaximum()+1.2*sqrt(hodata->GetMaximum()); |
6342 |
+ |
|
6343 |
+ |
hdata->SetMaximum(maximum); |
6344 |
+ |
hdata->SetMinimum(minimum); |
6345 |
+ |
|
6346 |
+ |
|
6347 |
+ |
hdata->Draw(); |
6348 |
+ |
hmc->Draw("same,histo"); |
6349 |
+ |
homc->Draw("same,histo"); |
6350 |
+ |
hdata->Draw("same"); |
6351 |
+ |
hodata->Draw("same"); |
6352 |
+ |
|
6353 |
+ |
TLegend *leg = make_legend(); |
6354 |
+ |
leg->AddEntry(hdata,"SF data","pe"); |
6355 |
+ |
leg->AddEntry(hodata,"OF data","pe"); |
6356 |
+ |
leg->AddEntry(hmc,"SF MC","l"); |
6357 |
+ |
leg->AddEntry(homc,"OF MC","l"); |
6358 |
+ |
leg->Draw(); |
6359 |
+ |
|
6360 |
+ |
DrawPrelim(); |
6361 |
+ |
|
6362 |
+ |
CompleteSave(iTTbarClosureTestCanvas,"iTTbar/TTbar_CR_Closure_"+MassRegion); |
6363 |
+ |
|
6364 |
+ |
TH1F *ratio_data = (TH1F*)hdata->Clone("ratio_data"); |
6365 |
+ |
ratio_data->Divide(hodata); |
6366 |
+ |
TH1F *ratio_mc = (TH1F*)hmc->Clone("ratio_mc"); |
6367 |
+ |
ratio_mc->Divide(homc); |
6368 |
+ |
|
6369 |
+ |
ratio_mc->SetFillColor(kBlue); |
6370 |
+ |
ratio_mc->SetMarkerSize(0); |
6371 |
+ |
|
6372 |
+ |
TGraphAsymmErrors *eratio = produce_ratio_graph(ratio_mc); |
6373 |
+ |
|
6374 |
+ |
eratio->SetFillColor(TColor::GetColor("#00ADE1")); |
6375 |
+ |
ratio_data->GetYaxis()->SetRangeUser(0.5,1.5); |
6376 |
+ |
ratio_data->Draw("e1"); |
6377 |
+ |
eratio->Draw("20"); |
6378 |
+ |
ratio_data->Draw("e1,same"); |
6379 |
+ |
|
6380 |
+ |
TLegend *leg2 = make_legend(); |
6381 |
+ |
leg2->AddEntry(ratio_data,"R(SF/OF) in #bar{t}t CR, data","pe"); |
6382 |
+ |
leg2->AddEntry(eratio ,"R(SF/OF) in #bar{t}t CR, MC" ,"f"); |
6383 |
+ |
leg2->SetY1(0.8); |
6384 |
+ |
leg2->SetX1(0.45); |
6385 |
+ |
leg2->Draw(); |
6386 |
+ |
|
6387 |
+ |
DrawPrelim(); |
6388 |
+ |
CompleteSave(iTTbarClosureTestCanvas,"iTTbar/TTbar_CR_Closure_Ratio_"+MassRegion); |
6389 |
+ |
|
6390 |
+ |
TFile *f = new TFile("fout.root","RECREATE"); |
6391 |
+ |
eratio->Write(); |
6392 |
+ |
ratio_data->Write(); |
6393 |
+ |
leg2->Write(); |
6394 |
+ |
f->Close(); |
6395 |
+ |
|
6396 |
+ |
|
6397 |
+ |
delete leg; |
6398 |
+ |
delete leg2; |
6399 |
+ |
delete ratio_data; |
6400 |
+ |
delete ratio_mc; |
6401 |
+ |
delete hdata; |
6402 |
+ |
delete hmc; |
6403 |
+ |
delete hodata; |
6404 |
+ |
delete iTTbarClosureTestCanvas; |
6405 |
+ |
} |
6406 |
+ |
|
6407 |
+ |
|
6408 |
+ |
|
6409 |
+ |
void make_ijzb_ttbar_closure_test(string datajzb, string mcjzb) { |
6410 |
+ |
TCut tt_nJets("pfJetGoodNum40==2"); |
6411 |
+ |
TCut tt_bJet("pfJetGoodNumBtag40==2"); |
6412 |
+ |
TCut tt_LowMass("mll>20&&mll<70"); |
6413 |
+ |
TCut tt_HighMass("mll>120&&mll<200"); |
6414 |
+ |
TCut tt_noZ(tt_LowMass || tt_HighMass); |
6415 |
+ |
|
6416 |
+ |
|
6417 |
+ |
make_iTTbar_JZB_plot(datajzb, mcjzb,tt_nJets&&tt_bJet&&tt_noZ); |
6418 |
+ |
|
6419 |
+ |
TCanvas *can = new TCanvas("can","can"); |
6420 |
+ |
|
6421 |
+ |
TH1F *hdata = allsamples.Draw("hdata","mll",40,0,200, "m_{ll} [GeV]", "events", tt_nJets&&tt_bJet&&tt_noZ&&cutOSSF,data,luminosity); |
6422 |
+ |
TH1F *hodata = allsamples.Draw("hodata","mll",40,0,200, "m_{ll} [GeV]", "events", tt_nJets&&tt_bJet&&tt_noZ&&cutOSOF,data,luminosity); |
6423 |
+ |
THStack *hmc = new THStack(allsamples.DrawStack("hmc","mll",40,0,200, "m_{ll} [GeV]", "events", tt_nJets&&tt_bJet&&tt_noZ&&cutOSSF,mc,luminosity)); |
6424 |
+ |
THStack *homc = new THStack(allsamples.DrawStack("homc","mll",40,0,200, "m_{ll} [GeV]", "events", tt_nJets&&tt_bJet&&tt_noZ&&cutOSOF,mc,luminosity)); |
6425 |
+ |
|
6426 |
+ |
TH1F *coll_hmc = CollapseStack(hmc); |
6427 |
+ |
TH1F *coll_homc = CollapseStack(homc); |
6428 |
+ |
|
6429 |
+ |
bool dolog=true; |
6430 |
+ |
bool nolog=false; |
6431 |
+ |
|
6432 |
+ |
dout << "Data : " << hdata->Integral() << endl; |
6433 |
+ |
dout << " SF: " << endl; |
6434 |
+ |
WriteYield(hmc, 0, 10000); |
6435 |
+ |
dout << " OF: " << endl; |
6436 |
+ |
WriteYield(homc, 0, 10000); |
6437 |
+ |
hodata->SetLineColor(kRed); |
6438 |
+ |
hdata->Draw(); |
6439 |
+ |
hmc->Draw("histo,same"); |
6440 |
+ |
hodata->Draw("histo,same"); |
6441 |
+ |
hdata->Draw("e1,same"); |
6442 |
+ |
DrawPrelim(); |
6443 |
+ |
CompleteSave(can,"TestingPrediction"); |
6444 |
+ |
|
6445 |
+ |
dout << "We get an expected ratio of " << coll_hmc->Integral()/coll_homc->Integral() << endl; |
6446 |
+ |
dout << "In data we find " << hdata->Integral()/hodata->Integral() << endl; |
6447 |
+ |
|
6448 |
+ |
Value R_sf_of_low_mass = GetYieldBetween(hdata,20,70)/GetYieldBetween(hodata,20,70); |
6449 |
+ |
Value R_sf_of_high_mass = GetYieldBetween(hdata,120,200)/GetYieldBetween(hodata,120,200); |
6450 |
+ |
|
6451 |
+ |
Value R_sf_of_low_mass_mc = GetYieldBetween(coll_hmc,20,70)/GetYieldBetween(coll_homc,20,70); |
6452 |
+ |
Value R_sf_of_high_mass_mc = GetYieldBetween(coll_hmc,120,200)/GetYieldBetween(coll_homc,120,200); |
6453 |
+ |
|
6454 |
+ |
dout << "Ratio at low mass : " << R_sf_of_low_mass << " (mc : " << R_sf_of_low_mass_mc << " )" << endl; |
6455 |
+ |
dout << "Ratio at high mass : " << R_sf_of_high_mass << " (mc : " << R_sf_of_high_mass_mc << " )" << endl; |
6456 |
+ |
|
6457 |
+ |
dout << "Composition at low mass : " << endl; |
6458 |
+ |
dout << "Same flavor: " << endl; |
6459 |
+ |
ProduceYields(20, 70, hdata, hmc); |
6460 |
+ |
dout << "Opposite flavor: " << endl; |
6461 |
+ |
ProduceYields(20, 70, hodata, homc); |
6462 |
+ |
|
6463 |
+ |
dout << endl << endl; |
6464 |
+ |
|
6465 |
+ |
dout << "Composition at high mass : " << endl; |
6466 |
+ |
dout << "Same flavor: " << endl; |
6467 |
+ |
ProduceYields(120, 200, hdata, hmc); |
6468 |
+ |
dout << "Opposite flavor: " << endl; |
6469 |
+ |
ProduceYields(120, 200, hodata, homc); |
6470 |
+ |
|
6471 |
+ |
|
6472 |
+ |
|
6473 |
+ |
|
6474 |
+ |
make_plain_kin_plot(mcjzb,(const char*) (tt_nJets&&tt_bJet&&tt_noZ&&cutOSSF),20,-200,200,dolog,"JZB","iTTbar/JZB_SF",false,true); |
6475 |
+ |
make_plain_kin_plot(mcjzb,(const char*) (tt_nJets&&tt_bJet&&tt_noZ&&cutOSOF),20,-200,200,dolog,"JZB","iTTbar/JZB_OF",false,true); |
6476 |
+ |
|
6477 |
+ |
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); |
6478 |
+ |
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); |
6479 |
+ |
|
6480 |
+ |
make_SF_over_OF_plot(datajzb, mcjzb,tt_nJets&&tt_bJet&&tt_noZ,"mll",20,0,200,"m_{ll} [GeV]","mll"); |
6481 |
+ |
|
6482 |
+ |
MakeSpecialiTTbarClosurePlot((tt_nJets&&tt_bJet&&tt_LowMass),datajzb,mcjzb,"LowMassRegion2070"); |
6483 |
+ |
MakeSpecialiTTbarClosurePlot((tt_nJets&&tt_bJet&&tt_HighMass),datajzb,mcjzb,"HighMassRegion"); |
6484 |
+ |
MakeSpecialiTTbarClosurePlot((tt_nJets&&tt_bJet&&tt_noZ),datajzb,mcjzb,"NoZ"); |
6485 |
+ |
/* |
6486 |
+ |
// 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); |
6487 |
+ |
// 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); |
6488 |
+ |
// |
6489 |
+ |
// 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); |
6490 |
+ |
// 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); |
6491 |
+ |
|
6492 |
+ |
|
6493 |
+ |
delete coll_hmc; |
6494 |
+ |
delete coll_homc; |
6495 |
+ |
delete hmc; |
6496 |
+ |
delete homc; |
6497 |
+ |
delete hdata; |
6498 |
+ |
delete hodata; |
6499 |
+ |
delete can;*/ |
6500 |
+ |
} |
6501 |
+ |
|
6502 |
|
|
6503 |
|
void test() { |
6504 |
|
|
6505 |
+ |
|
6506 |
+ |
float MCPeak, MCPeakError, DataPeak, DataPeakError; |
6507 |
+ |
stringstream result, datajzb, mcjzb; |
6508 |
+ |
bool doPUreweighting=true; |
6509 |
+ |
bool SwitchOffNJetsCut=false; |
6510 |
+ |
|
6511 |
+ |
|
6512 |
+ |
TCanvas *can = new TCanvas("can","can"); |
6513 |
+ |
float mcSigma,mcSigmaError,dataSigma,dataSigmaError; |
6514 |
+ |
|
6515 |
+ |
float NumVtxBin[6] = {0,5,10,15,20,30}; |
6516 |
+ |
|
6517 |
+ |
stringstream NowCut; |
6518 |
+ |
|
6519 |
+ |
TGraphErrors *gMCPeak = new TGraphErrors(); |
6520 |
+ |
gMCPeak->SetTitle("gMCPeak"); |
6521 |
+ |
gMCPeak->SetName("gMCPeak"); |
6522 |
+ |
TGraphErrors *gDataPeak = new TGraphErrors(); |
6523 |
+ |
gDataPeak->SetTitle("gDataPeak"); |
6524 |
+ |
gDataPeak->SetName("gDataPeak"); |
6525 |
+ |
TGraphErrors *gMCWidth = new TGraphErrors(); |
6526 |
+ |
gMCWidth->SetTitle("gMCWidth"); |
6527 |
+ |
gMCWidth->SetName("gMCWidth"); |
6528 |
+ |
TGraphErrors *gDataWidth = new TGraphErrors(); |
6529 |
+ |
gDataWidth->SetTitle("gDataWidth"); |
6530 |
+ |
gDataWidth->SetName("gDataWidth"); |
6531 |
+ |
|
6532 |
+ |
float AllMCPeaks[200]; |
6533 |
+ |
float AllMCPeaksErrors[200]; |
6534 |
+ |
|
6535 |
+ |
for(int i=10;i<180;i+=20) { |
6536 |
+ |
NowCut.str(""); |
6537 |
+ |
NowCut << "mll>=" << i << "&&mll<" << i+20; |
6538 |
+ |
find_one_peak_combination(TCut(NowCut.str().c_str()),SwitchOffNJetsCut,MCPeak,MCPeakError, DataPeak,DataPeakError,mcSigma,mcSigmaError, dataSigma,dataSigmaError,result,doPUreweighting,""); |
6539 |
+ |
AllMCPeaks[i]=MCPeak; |
6540 |
+ |
AllMCPeaksErrors[i]=MCPeakError; |
6541 |
+ |
} |
6542 |
+ |
|
6543 |
+ |
dout << "Summary : " << endl; |
6544 |
+ |
for(int i=10;i<180;i+=20) { |
6545 |
+ |
dout << "For the slice at [" << i << " , " << i+20 << "] we get a peak at " << AllMCPeaks[i] << " +/- " << AllMCPeaksErrors[i] << endl; |
6546 |
+ |
} |
6547 |
+ |
/* |
6548 |
|
TCanvas *testcanv = new TCanvas("testcanv","testcanv"); |
6549 |
|
testcanv->cd(); |
6550 |
|
// switch_overunderflow(true); |
6551 |
< |
TH1F *ptdistr = allsamples.Draw("ptdistr","pt1",100,30,200, "p_{T} [GeV]", "events", cutOSSF,data,luminosity); |
6552 |
< |
switch_overunderflow(false); |
6553 |
< |
ptdistr->Draw(); |
6554 |
< |
testcanv->SaveAs("test.png"); |
3713 |
< |
dout << "HELLO there!" << endl; |
6551 |
> |
TH1F *histo1 = new TH1F("histo","histo",100,0,1); |
6552 |
> |
histo1->Sumw2(); |
6553 |
> |
TH1F *histo2 = new TH1F("histo2","histo2",100,0,1); |
6554 |
> |
histo2->Sumw2(); |
6555 |
|
|
6556 |
+ |
for(int i=0;i<100;i++) { |
6557 |
+ |
histo1->Fill(1.0/i,i); |
6558 |
+ |
histo2->Fill(1.0/(i*i),i); |
6559 |
+ |
} |
6560 |
+ |
|
6561 |
+ |
histo1->Draw(); |
6562 |
+ |
histo2->Draw("e1,same"); |
6563 |
+ |
|
6564 |
+ |
Save_With_Ratio( histo1, histo2, testcanv->cd(), "Bullshit", false, false, "AnyCrap" ); |
6565 |
+ |
|
6566 |
+ |
|
6567 |
+ |
dout << "HELLO there!" << endl; |
6568 |
+ |
*/ |
6569 |
|
} |