14 #include "TGraphAsymmErrors.h" 17 #include "core/baby_full.hpp" 29 float bignum = numeric_limits<float>::max();
34 hout.SetName((hout.GetName()+string(
"_rownorm")).c_str());
35 for(
int irow = 1; irow <= hout.GetNbinsY(); ++irow){
37 for(
int icol = 1; icol <= hout.GetNbinsX(); ++icol){
38 y += hout.GetBinContent(icol, irow);
41 for(
int icol = 1; icol <= hout.GetNbinsY(); ++icol){
42 hout.SetBinContent(icol, irow, hout.GetBinContent(icol, irow)*y);
43 hout.SetBinError(icol, irow, hout.GetBinError(icol, irow)*y);
47 hout.SetMaximum(100.);
53 hout.SetName((hout.GetName()+string(
"_colnorm")).c_str());
54 for(
int icol = 1; icol <= hout.GetNbinsY(); ++icol){
56 for(
int irow = 1; irow <= hout.GetNbinsX(); ++irow){
57 y += hout.GetBinContent(icol, irow);
60 for(
int irow = 1; irow <= hout.GetNbinsY(); ++irow){
61 hout.SetBinContent(icol, irow, hout.GetBinContent(icol, irow)*y);
62 hout.SetBinError(icol, irow, hout.GetBinError(icol, irow)*y);
66 hout.SetMaximum(100.);
71 double low_nj,
double high_nj,
72 double low_met,
double high_met,
84 && b.
mm_met()->at(i)>low_met && b.
mm_met()->at(i)<=high_met
86 && b.
mm_nbm()->at(i)>low_nb;
88 if(!pass_baseline)
return -1;
90 if(mj<=250.)
return 0;
91 double mt = b.
mm_mt()->at(i);
94 if(mj<=400.)
return 1;
98 if(mt<=140.)
return 3;
101 if(mt<=140.)
return 4;
105 if(mj<=400.)
return 7;
123 void Fill(
bool pass, TH1D &h_pass, TH1D &h_total,
double x,
double w){
124 if(pass) h_pass.Fill(x, w);
128 void Format(TH1D &h,
bool no_stats =
false){
129 h.SetLineColor(kBlack);
132 if(no_stats) h.SetStats(
false);
135 void Format(TH2D &h,
bool no_stats =
false){
138 h.SetMarkerColor(kBlack);
140 if(no_stats) h.SetStats(
false);
143 void Print(TH1D &h,
bool no_stats =
false){
147 c.Print((
string(
"plots/")+h.GetName()+
".pdf").c_str());
151 for(
int i=0; i < h.GetNbinsX(); ++i){
152 double y = h.GetBinContent(i);
153 if(y >= 0.)
continue;
154 double e = h.GetBinError(i);
157 h.SetBinContent(i, y);
164 a.SetBinLabel(1,
"Total");
165 a.SetBinLabel(2,
"Other");
166 a.SetBinLabel(3,
"Very Low MJ");
167 a.SetBinLabel(4,
"0l, Low MJ");
168 a.SetBinLabel(5,
"0l, High MJ");
169 a.SetBinLabel(6,
"R1");
170 a.SetBinLabel(7,
"R2");
171 a.SetBinLabel(8,
"R3");
172 a.SetBinLabel(9,
"R4");
173 a.SetBinLabel(10,
"D3");
174 a.SetBinLabel(11,
"D4");
176 a.SetBinLabel(1,
"Other");
177 a.SetBinLabel(2,
"Very Low MJ");
178 a.SetBinLabel(3,
"0l, Low MJ");
179 a.SetBinLabel(4,
"0l, High MJ");
180 a.SetBinLabel(5,
"R1");
181 a.SetBinLabel(6,
"R2");
182 a.SetBinLabel(7,
"R3");
183 a.SetBinLabel(8,
"R4");
184 a.SetBinLabel(9,
"D3");
185 a.SetBinLabel(10,
"D4");
191 h.GetNbinsX()+1, -2.5, h.GetNbinsX()-1.5,
192 h.GetNbinsY()+1, -2.5, h.GetNbinsY()-1.5);
194 for(
int ix = 0; ix <= h.GetNbinsX()+1; ++ix){
195 for(
int iy = 0; iy <= h.GetNbinsY()+1; ++iy){
196 g.SetBinContent(ix+1, iy+1, h.GetBinContent(ix, iy));
197 g.SetBinError(ix+1, iy+1, h.GetBinError(ix, iy));
201 for(
int ix = g.GetNbinsX(); ix > 1; --ix){
202 double sumw = 0., sumw2 = 0.;
203 for(
int iy = g.GetNbinsY(); iy > 1; --iy){
204 sumw += g.GetBinContent(ix, iy);
205 double e = g.GetBinError(ix, iy);
208 g.SetBinContent(ix, 1, sumw);
209 g.SetBinError(ix, 1, sqrt(sumw2));
212 for(
int iy = g.GetNbinsY(); iy > 0; --iy){
213 double sumw = 0., sumw2 = 0.;
214 for(
int ix = g.GetNbinsX(); ix > 1; --ix){
215 sumw += g.GetBinContent(ix, iy);
216 double e = g.GetBinError(ix, iy);
219 g.SetBinContent(1, iy, sumw);
220 g.SetBinError(1, iy, sqrt(sumw2));
235 for(
int ix = 1; ix <= gg.GetNbinsX(); ++ix){
236 gg.SetBinContent(ix, 1, 0.);
237 gg.SetBinError(ix, 1, 0.);
239 for(
int iy = 1; iy <= gg.GetNbinsY(); ++iy){
240 gg.SetBinContent(1, iy, 0.);
241 gg.SetBinError(1, iy, 0.);
250 c.Print((
string(
"plots/")+h.GetName()+
".pdf").c_str());
253 rn.Draw(
"text same");
254 c.Print((
string(
"plots/")+h.GetName()+
"_rownorm.pdf").c_str());
257 cn.Draw(
"text same");
258 c.Print((
string(
"plots/")+h.GetName()+
"_colnorm.pdf").c_str());
261 void Print(TH2D &h,
bool no_stats =
false){
263 h.SetTitle((
"#rho="+to_string(h.GetCorrelationFactor())).c_str());
267 c.Print((
string(
"plots/")+h.GetName()+
".pdf").c_str());
270 void Print(TH1D &pass, TH1D &total){
276 TGraphAsymmErrors g(&pass, &total);
277 g.SetTitle((
string(
";")+pass.GetXaxis()->GetTitle()+
";Fraction Mismeasured").c_str());
281 c.Print((
string(
"plots/")+g.GetName()+
".pdf").c_str());
285 gErrorIgnoreLevel = 6000;
286 gStyle->SetOptStat(
"iouMRen");
287 double stops[2] = {0., 1.};
288 double red[2] = {1., 1.};
289 double green[2] = {1., 0.};
290 double blue[2] = {1., 0.};
291 gStyle->SetNumberContours(256);
292 gStyle->SetPaintTextFormat(
"4.2f");
293 TColor::CreateGradientColorTable(2, stops, red, green, blue, 256);
299 string folder_mc=
"/net/cms29/cms29r0/babymaker/babies/mismeasured_v2/2016_06_14/mc/merged_mm_std_nj5mj250/";
300 auto baby_nontt = make_shared<Baby_full>(set<string>{
301 folder_mc+
"*_DYJetsToLL*.root",
302 folder_mc+
"*_QCD_HT*.root",
303 folder_mc+
"*_ST*channel*.root",
304 folder_mc+
"*_TTGJets*.root",
305 folder_mc+
"*_TTTT*.root",
306 folder_mc+
"*_TTWJetsTo*.root",
307 folder_mc+
"*_TTZTo*.root",
308 folder_mc+
"*_WH_HToBB*.root",
309 folder_mc+
"*_WJetsToLNu_HT-*.root",
310 folder_mc+
"*_WWTo*.root",
311 folder_mc+
"*_WZTo*.root",
312 folder_mc+
"*_ZH*.root",
313 folder_mc+
"*_ZZ*.root",
314 folder_mc+
"*_ttHJetTobb*.root" 316 auto baby_tt = make_shared<Baby_full>(set<string>{
317 folder_mc+
"*_TTJets*Lept*.root", folder_mc+
"*_TTJets_HT*.root" 320 TH1D h_1l_mm_lep_pt(
"h_1l_mm_lep_pt",
";Mismeasured Lepton p_{T} [GeV];Entries", 20, 0., 2000.);
321 TH2D h_1l_mt_mj_lep(
"h_1l_mt_mj_lep",
";M_{J} (with lep) [GeV];m_{T} [GeV]", 100, 0., 1000., 100, 0., 1000.);
322 TH2D h_1l_mt_mj_nolep(
"h_1l_mt_mj_nolep",
";M_{J} (no lep) [GeV];m_{T} [GeV]", 100, 0., 1000., 100, 0., 1000.);
323 TH2D h_1l_mm_mt_mm_mj_lep(
"h_1l_mm_mt_mm_mj_lep",
";M_{J} (with lep) [GeV];m_{T} [GeV]", 100, 0., 1000., 100, 0., 1000.);
324 TH2D h_1l_mm_mt_mm_mj_nolep(
"h_1l_mm_mt_mm_mj_nolep",
";M_{J} (no lep) [GeV];m_{T} [GeV]", 100, 0., 1000., 100, 0., 1000.);
325 TH2D h_1l_mj_nolep_mj_lep(
"h_1l_mj_nolep_mj_lep",
";M_{J} (with lep) [GeV];M_{J} (no lep) [GeV]", 100, 0., 1000., 100, 0., 1000.);
326 TH2D h_1l_mm_mj_nolep_mm_mj_lep(
"h_1l_mm_mj_nolep_mm_mj_lep",
";M_{J} (with lep) [GeV];M_{J} (no lep) [GeV]", 100, 0., 1000., 100, 0., 1000.);
327 TH2D h_1l_mm_mt_mt(
"h_1l_mm_mt_mt",
";Correct m_{T} [GeV];Mismeasured m_{T} [GeV]", 100, -1000., 1000., 100, 0., 2000.);
328 TH2D h_1l_mm_mj_nolep_mj_nolep(
"h_1l_mm_mj_nolep_mj_nolep",
";Correct M_{J} (no lep) [GeV];Mismeasured M_{J} (no lep) [GeV]", 100, 0., 1000., 100, 0., 1000.);
329 TH2D h_1l_mm_mj_lep_mj_lep(
"h_1l_mm_mj_lep_mj_lep",
";Correct M_{J} (with lep) [GeV];Mismeasured M_{J} (with lep) [GeV]", 100, 0., 1000., 100, 0., 1000.);
330 TH1D h_2l_mm_lep_pt(
"h_2l_mm_lep_pt",
";Mismeasured Lepton p_{T} [GeV];Entries", 20, 0., 2000.);
331 TH2D h_2l_mt_mj_lep(
"h_2l_mt_mj_lep",
";M_{J} (with lep) [GeV];m_{T} [GeV]", 100, 0., 1000., 100, 0., 1000.);
332 TH2D h_2l_mt_mj_nolep(
"h_2l_mt_mj_nolep",
";M_{J} (no lep) [GeV];m_{T} [GeV]", 100, 0., 1000., 100, 0., 1000.);
333 TH2D h_2l_mm_mt_mm_mj_lep(
"h_2l_mm_mt_mm_mj_lep",
";M_{J} (with lep) [GeV];m_{T} [GeV]", 100, 0., 1000., 100, 0., 1000.);
334 TH2D h_2l_mm_mt_mm_mj_nolep(
"h_2l_mm_mt_mm_mj_nolep",
";M_{J} (no lep) [GeV];m_{T} [GeV]", 100, 0., 1000., 100, 0., 1000.);
335 TH2D h_2l_mj_nolep_mj_lep(
"h_2l_mj_nolep_mj_lep",
";M_{J} (with lep) [GeV];M_{J} (no lep) [GeV]", 100, 0., 1000., 100, 0., 1000.);
336 TH2D h_2l_mm_mj_nolep_mm_mj_lep(
"h_2l_mm_mj_nolep_mm_mj_lep",
";M_{J} (with lep) [GeV];M_{J} (no lep) [GeV]", 100, 0., 1000., 100, 0., 1000.);
337 TH2D h_2l_mm_mt_mt(
"h_2l_mm_mt_mt",
";Correct m_{T} [GeV];Mismeasured m_{T} [GeV]", 100, -1000., 1000., 100, 0., 2000.);
338 TH2D h_2l_mm_mj_nolep_mj_nolep(
"h_2l_mm_mj_nolep_mj_nolep",
";Correct M_{J} (no lep) [GeV];Mismeasured M_{J} (no lep) [GeV]", 100, 0., 1000., 100, 0., 1000.);
339 TH2D h_2l_mm_mj_lep_mj_lep(
"h_2l_mm_mj_lep_mj_lep",
";Correct M_{J} (with lep) [GeV];Mismeasured M_{J} (with lep) [GeV]", 100, 0., 1000., 100, 0., 1000.);
341 TH2D h_1l_dmt_dmjlep(
"h_1l_dmt_dmjlep",
";#Delta M_{J} (with lep) [GeV];#Delta m_{T} [GeV]", 60, -100., 500., 110, -100., 1000.);
342 TH2D h_1l_dmt_dmjnolep(
"h_1l_dmt_dmjnolep",
";#Delta M_{J} (no lep) [GeV];#Delta m_{T} [GeV]", 60, -300., 300., 110, -100., 1000.);
343 TH2D h_1l_dmt_dmjlep_highmet(
"h_1l_dmt_dmjlep_highmet",
";#Delta M_{J} (with lep) [GeV];#Delta m_{T} [GeV]", 60, -100., 500., 110, -100., 1000.);
344 TH2D h_1l_dmt_dmjnolep_highmet(
"h_1l_dmt_dmjnolep_highmet",
";#Delta M_{J} (no lep) [GeV];#Delta m_{T} [GeV]", 60, -300., 300., 110, -100., 1000.);
345 TH2D h_1l_dmt_dmjlep_highnj(
"h_1l_dmt_dmjlep_highnj",
";#Delta M_{J} (with lep) [GeV];#Delta m_{T} [GeV]", 60, -100., 500., 110, -100., 1000.);
346 TH2D h_1l_dmt_dmjnolep_highnj(
"h_1l_dmt_dmjnolep_highnj",
";#Delta M_{J} (no lep) [GeV];#Delta m_{T} [GeV]", 60, -300., 300., 110, -100., 1000.);
348 TH2D h_transfer_mm_lep(
"h_transfer_mm_lep",
"Baseline;Correct Region;Mismeasured Region", 10, -1.5, 8.5, 10, -1.5, 8.5);
349 TH2D h_transfer_all_lep(
"h_transfer_all_lep",
"Baseline;Correct Region;Mismeasured Region", 10, -1.5, 8.5, 10, -1.5, 8.5);
350 TH2D h_transfer_mm_nolep(
"h_transfer_mm_nolep",
"Baseline;Correct Region;Mismeasured Region", 10, -1.5, 8.5, 10, -1.5, 8.5);
351 TH2D h_transfer_all_nolep(
"h_transfer_all_nolep",
"Baseline;Correct Region;Mismeasured Region", 10, -1.5, 8.5, 10, -1.5, 8.5);
352 TH2D h_transfer_lowmet_mm_lep(
"h_transfer_lowmet_mm_lep",
"Low MET;Correct Region;Mismeasured Region", 10, -1.5, 8.5, 10, -1.5, 8.5);
353 TH2D h_transfer_lowmet_all_lep(
"h_transfer_lowmet_all_lep",
"Low MET;Correct Region;Mismeasured Region", 10, -1.5, 8.5, 10, -1.5, 8.5);
354 TH2D h_transfer_lowmet_mm_nolep(
"h_transfer_lowmet_mm_nolep",
"Low MET;Correct Region;Mismeasured Region", 10, -1.5, 8.5, 10, -1.5, 8.5);
355 TH2D h_transfer_lowmet_all_nolep(
"h_transfer_lowmet_all_nolep",
"Low MET;Correct Region;Mismeasured Region", 10, -1.5, 8.5, 10, -1.5, 8.5);
356 TH2D h_transfer_medmet_mm_lep(
"h_transfer_medmet_mm_lep",
"Med MET;Correct Region;Mismeasured Region", 10, -1.5, 8.5, 10, -1.5, 8.5);
357 TH2D h_transfer_medmet_all_lep(
"h_transfer_medmet_all_lep",
"Med MET;Correct Region;Mismeasured Region", 10, -1.5, 8.5, 10, -1.5, 8.5);
358 TH2D h_transfer_medmet_mm_nolep(
"h_transfer_medmet_mm_nolep",
"Med MET;Correct Region;Mismeasured Region", 10, -1.5, 8.5, 10, -1.5, 8.5);
359 TH2D h_transfer_medmet_all_nolep(
"h_transfer_medmet_all_nolep",
"Med MET;Correct Region;Mismeasured Region", 10, -1.5, 8.5, 10, -1.5, 8.5);
360 TH2D h_transfer_highmet_mm_lep(
"h_transfer_highmet_mm_lep",
"High MET;Correct Region;Mismeasured Region", 10, -1.5, 8.5, 10, -1.5, 8.5);
361 TH2D h_transfer_highmet_all_lep(
"h_transfer_highmet_all_lep",
"High MET;Correct Region;Mismeasured Region", 10, -1.5, 8.5, 10, -1.5, 8.5);
362 TH2D h_transfer_highmet_mm_nolep(
"h_transfer_highmet_mm_nolep",
"High MET;Correct Region;Mismeasured Region", 10, -1.5, 8.5, 10, -1.5, 8.5);
363 TH2D h_transfer_highmet_all_nolep(
"h_transfer_highmet_all_nolep",
"High MET;Correct Region;Mismeasured Region", 10, -1.5, 8.5, 10, -1.5, 8.5);
364 TH2D h_transfer_lownj_mm_lep(
"h_transfer_lownj_mm_lep",
"Low N_{jets};Correct Region;Mismeasured Region", 10, -1.5, 8.5, 10, -1.5, 8.5);
365 TH2D h_transfer_lownj_all_lep(
"h_transfer_lownj_all_lep",
"Low N_{jets};Correct Region;Mismeasured Region", 10, -1.5, 8.5, 10, -1.5, 8.5);
366 TH2D h_transfer_lownj_mm_nolep(
"h_transfer_lownj_mm_nolep",
"Low N_{jets};Correct Region;Mismeasured Region", 10, -1.5, 8.5, 10, -1.5, 8.5);
367 TH2D h_transfer_lownj_all_nolep(
"h_transfer_lownj_all_nolep",
"Low N_{jets};Correct Region;Mismeasured Region", 10, -1.5, 8.5, 10, -1.5, 8.5);
368 TH2D h_transfer_highnj_mm_lep(
"h_transfer_highnj_mm_lep",
"High N_{jets};Correct Region;Mismeasured Region", 10, -1.5, 8.5, 10, -1.5, 8.5);
369 TH2D h_transfer_highnj_all_lep(
"h_transfer_highnj_all_lep",
"High N_{jets};Correct Region;Mismeasured Region", 10, -1.5, 8.5, 10, -1.5, 8.5);
370 TH2D h_transfer_highnj_mm_nolep(
"h_transfer_highnj_mm_nolep",
"High N_{jets};Correct Region;Mismeasured Region", 10, -1.5, 8.5, 10, -1.5, 8.5);
371 TH2D h_transfer_highnj_all_nolep(
"h_transfer_highnj_all_nolep",
"High N_{jets};Correct Region;Mismeasured Region", 10, -1.5, 8.5, 10, -1.5, 8.5);
373 TH1D h_num_1l_mt(
"h_num_1l_mt",
"Numerator;m_{T} [GeV];Entries", 20, 0., 1000.);
374 TH1D h_den_1l_mt(
"h_den_1l_mt",
"Denominator;m_{T} [GeV];Entries", 20, 0., 1000.);
375 TH1D h_num_1l_mj_lep(
"h_num_1l_mj_lep",
"Numerator;M_{J} (with lep) [GeV];Entries", 20, 0., 1000.);
376 TH1D h_den_1l_mj_lep(
"h_den_1l_mj_lep",
"Denominator;M_{J} (with lep) [GeV];Entries", 20, 0., 1000.);
377 TH1D h_num_1l_mj_nolep(
"h_num_1l_mj_nolep",
"Numerator;M_{J} (no lep) [GeV];Entries", 20, 0., 1000.);
378 TH1D h_den_1l_mj_nolep(
"h_den_1l_mj_nolep",
"Denominator;M_{J} (no lep) [GeV];Entries", 20, 0., 1000.);
379 TH1D h_num_1l_met(
"h_num_1l_met",
"Numerator;MET [GeV];Entries", 20, 0., 1000.);
380 TH1D h_den_1l_met(
"h_den_1l_met",
"Denominator;MET [GeV];Entries", 20, 0., 1000.);
381 TH1D h_num_1l_njets(
"h_num_1l_njets",
"Numerator;N_{jets};Entries", 7, 4.5, 11.5);
382 TH1D h_den_1l_njets(
"h_den_1l_njets",
"Denominator;N_{jets};Entries", 7, 4.5, 11.5);
383 TH1D h_num_1l_nbm(
"h_num_1l_nbm",
"Numerator;N_{b};Entries", 5, -0.5, 4.5);
384 TH1D h_den_1l_nbm(
"h_den_1l_nbm",
"Denominator;N_{b};Entries", 5, -0.5, 4.5);
385 TH1D h_num_2l_mt(
"h_num_2l_mt",
"Numerator;m_{T} [GeV];Entries", 20, 0., 1000.);
386 TH1D h_den_2l_mt(
"h_den_2l_mt",
"Denominator;m_{T} [GeV];Entries", 20, 0., 1000.);
387 TH1D h_num_2l_mj_lep(
"h_num_2l_mj_lep",
"Numerator;M_{J} (with lep) [GeV];Entries", 20, 0., 1000.);
388 TH1D h_den_2l_mj_lep(
"h_den_2l_mj_lep",
"Denominator;M_{J} (with lep) [GeV];Entries", 20, 0., 1000.);
389 TH1D h_num_2l_mj_nolep(
"h_num_2l_mj_nolep",
"Numerator;M_{J} (no lep) [GeV];Entries", 20, 0., 1000.);
390 TH1D h_den_2l_mj_nolep(
"h_den_2l_mj_nolep",
"Denominator;M_{J} (no lep) [GeV];Entries", 20, 0., 1000.);
391 TH1D h_num_2l_met(
"h_num_2l_met",
"Numerator;MET [GeV];Entries", 20, 0., 1000.);
392 TH1D h_den_2l_met(
"h_den_2l_met",
"Denominator;MET [GeV];Entries", 20, 0., 1000.);
393 TH1D h_num_2l_njets(
"h_num_2l_njets",
"Numerator;N_{jets};Entries", 7, 4.5, 11.5);
394 TH1D h_den_2l_njets(
"h_den_2l_njets",
"Denominator;N_{jets};Entries", 7, 4.5, 11.5);
395 TH1D h_num_2l_nbm(
"h_num_2l_nbm",
"Numerator;N_{b};Entries", 5, -0.5, 4.5);
396 TH1D h_den_2l_nbm(
"h_den_2l_nbm",
"Denominator;N_{b};Entries", 5, -0.5, 4.5);
398 for(
auto &b: {baby_nontt, baby_tt}){
399 auto activator = b->Activate();
400 cout <<
"Getting entries..." << endl;
401 long num_entries = b->GetEntries();
402 cout << num_entries <<
" entries found." << endl;
403 Timer timer(num_entries, 1.);
404 for(
long event = 0;
event < num_entries; ++event){
408 if(!b->stitch())
continue;
409 double w = lumi*b->weight();
411 bool mm = b->mm()->at(ibad);
420 h_transfer_lowmet_mm_lep.Fill(
RegionIndex(*b, igood, 5.5,
bignum, 200., 350.,
true),
423 h_transfer_lowmet_mm_nolep.Fill(
RegionIndex(*b, igood, 5.5,
bignum, 200., 350.,
false),
426 h_transfer_medmet_mm_lep.Fill(
RegionIndex(*b, igood, 5.5,
bignum, 350., 500.,
true),
429 h_transfer_medmet_mm_nolep.Fill(
RegionIndex(*b, igood, 5.5,
bignum, 350., 500.,
false),
438 h_transfer_lownj_mm_lep.Fill(
RegionIndex(*b, igood, 5.5, 8.5, 200.,
bignum,
true),
441 h_transfer_lownj_mm_nolep.Fill(
RegionIndex(*b, igood, 5.5, 8.5, 200.,
bignum,
false),
457 h_transfer_lowmet_all_lep.Fill(
RegionIndex(*b, igood, 5.5,
bignum, 200., 350.,
true),
460 h_transfer_lowmet_all_nolep.Fill(
RegionIndex(*b, igood, 5.5,
bignum, 200., 350.,
false),
463 h_transfer_medmet_all_lep.Fill(
RegionIndex(*b, igood, 5.5,
bignum, 350., 500.,
true),
466 h_transfer_medmet_all_nolep.Fill(
RegionIndex(*b, igood, 5.5,
bignum, 350., 500.,
false),
475 h_transfer_lownj_all_lep.Fill(
RegionIndex(*b, igood, 5.5, 8.5, 200.,
bignum,
true),
478 h_transfer_lownj_all_nolep.Fill(
RegionIndex(*b, igood, 5.5, 8.5, 200.,
bignum,
false),
489 && (b->mm_nleps()->at(igood)>0 || b->mm_nleps()->at(ibad)>0)
490 && (b->mm_ht()->at(igood)>500 || b->mm_ht()->at(ibad)>500)
491 && (b->mm_met()->at(igood)>200 || b->mm_met()->at(ibad)>200)
492 && (b->mm_njets()->at(igood)>=5 || b->mm_njets()->at(ibad)>=5)){
494 if(b->mm_nleps()->at(ibad)==1){
495 h_1l_dmt_dmjlep.Fill(b->mm_mj14_lep()->at(ibad)-b->mm_mj14_lep()->at(igood),
496 b->mm_mt()->at(ibad)-b->mm_mt()->at(igood),
498 h_1l_dmt_dmjnolep.Fill(b->mm_mj14_nolep()->at(ibad)-b->mm_mj14_nolep()->at(igood),
499 b->mm_mt()->at(ibad)-b->mm_mt()->at(igood),
501 if(b->mm_met()->at(ibad)>500.){
502 h_1l_dmt_dmjlep_highmet.Fill(b->mm_mj14_lep()->at(ibad)-b->mm_mj14_lep()->at(igood),
503 b->mm_mt()->at(ibad)-b->mm_mt()->at(igood),
505 h_1l_dmt_dmjnolep_highmet.Fill(b->mm_mj14_nolep()->at(ibad)-b->mm_mj14_nolep()->at(igood),
506 b->mm_mt()->at(ibad)-b->mm_mt()->at(igood),
509 if(b->mm_njets()->at(ibad)>8.5){
510 h_1l_dmt_dmjlep_highnj.Fill(b->mm_mj14_lep()->at(ibad)-b->mm_mj14_lep()->at(igood),
511 b->mm_mt()->at(ibad)-b->mm_mt()->at(igood),
513 h_1l_dmt_dmjnolep_highnj.Fill(b->mm_mj14_nolep()->at(ibad)-b->mm_mj14_nolep()->at(igood),
514 b->mm_mt()->at(ibad)-b->mm_mt()->at(igood),
517 h_1l_mm_lep_pt.Fill(b->mm_lep_pt()->at(ibad), w);
518 h_1l_mt_mj_lep.Fill(b->mm_mj14_lep()->at(igood), b->mm_mt()->at(igood), w);
519 h_1l_mt_mj_nolep.Fill(b->mm_mj14_nolep()->at(igood), b->mm_mt()->at(igood), w);
520 h_1l_mm_mt_mm_mj_lep.Fill(b->mm_mj14_lep()->at(ibad), b->mm_mt()->at(ibad), w);
521 h_1l_mm_mt_mm_mj_nolep.Fill(b->mm_mj14_nolep()->at(ibad), b->mm_mt()->at(ibad), w);
522 h_1l_mj_nolep_mj_lep.Fill(b->mm_mj14_lep()->at(igood), b->mm_mj14_nolep()->at(igood), w);
523 h_1l_mm_mj_nolep_mm_mj_lep.Fill(b->mm_mj14_lep()->at(ibad), b->mm_mj14_nolep()->at(ibad), w);
524 h_1l_mm_mt_mt.Fill(b->mm_mt()->at(igood), b->mm_mt()->at(ibad), w);
525 h_1l_mm_mj_nolep_mj_nolep.Fill(b->mm_mj14_nolep()->at(igood), b->mm_mj14_nolep()->at(ibad), w);
526 h_1l_mm_mj_lep_mj_lep.Fill(b->mm_mj14_lep()->at(igood), b->mm_mj14_lep()->at(ibad), w);
527 }
else if(b->mm_nleps()->at(ibad)==2){
528 h_2l_mm_lep_pt.Fill(b->mm_lep_pt()->at(ibad), w);
529 h_2l_mt_mj_lep.Fill(b->mm_mj14_lep()->at(igood), b->mm_mt()->at(igood), w);
530 h_2l_mt_mj_nolep.Fill(b->mm_mj14_nolep()->at(igood), b->mm_mt()->at(igood), w);
531 h_2l_mm_mt_mm_mj_lep.Fill(b->mm_mj14_lep()->at(ibad), b->mm_mt()->at(ibad), w);
532 h_2l_mm_mt_mm_mj_nolep.Fill(b->mm_mj14_nolep()->at(ibad), b->mm_mt()->at(ibad), w);
533 h_2l_mj_nolep_mj_lep.Fill(b->mm_mj14_lep()->at(igood), b->mm_mj14_nolep()->at(igood), w);
534 h_2l_mm_mj_nolep_mm_mj_lep.Fill(b->mm_mj14_lep()->at(ibad), b->mm_mj14_nolep()->at(ibad), w);
535 h_2l_mm_mt_mt.Fill(b->mm_mt()->at(igood), b->mm_mt()->at(ibad), w);
536 h_2l_mm_mj_nolep_mj_nolep.Fill(b->mm_mj14_nolep()->at(igood), b->mm_mj14_nolep()->at(ibad), w);
537 h_2l_mm_mj_lep_mj_lep.Fill(b->mm_mj14_lep()->at(igood), b->mm_mj14_lep()->at(ibad), w);
541 if(b->mm_ht()->at(ibad)>500. && b->mm_met()->at(ibad)>200.
542 && b->mm_njets()->at(ibad)>=5 && b->mm_nbm()->at(ibad)>=1){
543 if(b->mm_nleps()->at(ibad)==1){
544 Fill(mm, h_num_1l_mt, h_den_1l_mt, b->mm_mt()->at(ibad), w);
545 Fill(mm, h_num_1l_mj_lep, h_den_1l_mj_lep, b->mm_mj14_lep()->at(ibad), w);
546 Fill(mm, h_num_1l_mj_nolep, h_den_1l_mj_nolep, b->mm_mj14_nolep()->at(ibad), w);
547 Fill(mm, h_num_1l_met, h_den_1l_met, b->mm_met()->at(ibad), w);
548 Fill(mm, h_num_1l_njets, h_den_1l_njets, b->mm_njets()->at(ibad), w);
549 Fill(mm, h_num_1l_nbm, h_den_1l_nbm, b->mm_nbm()->at(ibad), w);
550 }
else if(b->mm_nleps()->at(ibad)>=2){
551 Fill(mm, h_num_2l_mt, h_den_2l_mt, b->mm_mt()->at(ibad), w);
552 Fill(mm, h_num_2l_mj_lep, h_den_2l_mj_lep, b->mm_mj14_lep()->at(ibad), w);
553 Fill(mm, h_num_2l_mj_nolep, h_den_2l_mj_nolep, b->mm_mj14_nolep()->at(ibad), w);
554 Fill(mm, h_num_2l_met, h_den_2l_met, b->mm_met()->at(ibad), w);
555 Fill(mm, h_num_2l_njets, h_den_2l_njets, b->mm_njets()->at(ibad), w);
556 Fill(mm, h_num_2l_nbm, h_den_2l_nbm, b->mm_nbm()->at(ibad), w);
563 Print(h_num_1l_mt, h_den_1l_mt);
564 Print(h_num_1l_mj_lep, h_den_1l_mj_lep);
565 Print(h_num_1l_mj_nolep, h_den_1l_mj_nolep);
566 Print(h_num_1l_met, h_den_1l_met);
567 Print(h_num_1l_njets, h_den_1l_njets);
568 Print(h_num_1l_nbm, h_den_1l_nbm);
569 Print(h_num_2l_mt, h_den_2l_mt);
570 Print(h_num_2l_mj_lep, h_den_2l_mj_lep);
571 Print(h_num_2l_mj_nolep, h_den_2l_mj_nolep);
572 Print(h_num_2l_met, h_den_2l_met);
573 Print(h_num_2l_njets, h_den_2l_njets);
574 Print(h_num_2l_nbm, h_den_2l_nbm);
576 Print(h_1l_mm_lep_pt);
577 Print(h_1l_mt_mj_lep);
578 Print(h_1l_mt_mj_nolep);
579 Print(h_1l_mm_mt_mm_mj_lep);
580 Print(h_1l_mm_mt_mm_mj_nolep);
581 Print(h_1l_mj_nolep_mj_lep);
582 Print(h_1l_mm_mj_nolep_mm_mj_lep);
583 Print(h_1l_mm_mt_mt);
584 Print(h_1l_mm_mj_nolep_mj_nolep);
585 Print(h_1l_mm_mj_lep_mj_lep);
586 Print(h_2l_mm_lep_pt);
587 Print(h_2l_mt_mj_lep);
588 Print(h_2l_mt_mj_nolep);
589 Print(h_2l_mm_mt_mm_mj_lep);
590 Print(h_2l_mm_mt_mm_mj_nolep);
591 Print(h_2l_mj_nolep_mj_lep);
592 Print(h_2l_mm_mj_nolep_mm_mj_lep);
593 Print(h_2l_mm_mt_mt);
594 Print(h_2l_mm_mj_nolep_mj_nolep);
595 Print(h_2l_mm_mj_lep_mj_lep);
598 Print(h_1l_dmt_dmjlep);
599 Print(h_1l_dmt_dmjnolep);
600 Print(h_1l_dmt_dmjlep_highmet);
601 Print(h_1l_dmt_dmjnolep_highmet);
602 Print(h_1l_dmt_dmjlep_highnj);
603 Print(h_1l_dmt_dmjnolep_highnj);
635 Palette colors(
"txt/colors.txt",
"default");
638 {folder_mc+
"*_TTJets*Lept*.root", folder_mc+
"*_TTJets_HT*.root"},
"ntruleps<=1&&stitch");
640 {folder_mc+
"*_TTJets*Lept*.root", folder_mc+
"*_TTJets_HT*.root"},
"ntruleps>=2&&stitch");
642 {folder_mc+
"*_WJetsToLNu_HT-*.root"});
644 {folder_mc+
"*_ST*channel*.root"});
646 {folder_mc+
"*_TTWJetsTo*.root", folder_mc+
"*_TTZTo*.root"});
648 {folder_mc+
"*_DYJetsToLL*.root", folder_mc+
"*_QCD_HT*.root",
649 folder_mc+
"*_TTGJets*.root", folder_mc+
"*_TTTT*.root",
650 folder_mc+
"*_WH_HToBB*.root", folder_mc+
"*_WWTo*.root",
651 folder_mc+
"*_WZTo*.root", folder_mc+
"*_ZH*.root",
652 folder_mc+
"*_ZZ*.root", folder_mc+
"*_ttHJetTobb*.root"});
654 vector<shared_ptr<Process> > procs = {
tt1l,
tt2l, wjets, single_t, ttv, other};
655 PlotOpt log_lumi(
"txt/plot_styles.txt",
"CMSPaper");
656 log_lumi.
Title(TitleType::info)
658 .
YAxis(YAxisType::log)
659 .
Stack(StackType::signal_overlay);
661 vector<PlotOpt> plot_types = {log_lumi, lin_lumi};
667 pm.
Push<
Hist1D>(
Axis(5, -0.5, 4.5,
"ntruleps",
"True Num. Leptons"),
668 is_transfer_lep, procs, plot_types).Tag(
"transfer");
669 pm.
Push<
Hist1D>(
Axis(5, -0.5, 4.5,
"mm_nleps[0]",
"Correct Num. Leptons"),
670 is_transfer_lep, procs, plot_types).Tag(
"transfer");
671 pm.
Push<
Hist1D>(
Axis(5, -0.5, 4.5,
"mm_nleps[2]",
"Mismeasured Num. Leptons"),
672 is_transfer_lep, procs, plot_types).Tag(
"transfer");
673 pm.
Push<
Hist1D>(
Axis(20, 0., 2000.,
"mm_ht[0]",
"Correct H_{T} [GeV]"),
674 is_transfer_lep, procs, plot_types).Tag(
"transfer");
675 pm.
Push<
Hist1D>(
Axis(20, 0., 2000.,
"mm_ht[2]",
"Mismeasured H_{T} [GeV]"),
676 is_transfer_lep, procs, plot_types).Tag(
"transfer");
677 pm.
Push<
Hist1D>(
Axis(15, 0., 1500.,
"mm_met[0]",
"Correct MET [GeV]"),
678 is_transfer_lep, procs, plot_types).Tag(
"transfer");
679 pm.
Push<
Hist1D>(
Axis(15, 0., 1500.,
"mm_met[2]",
"Mismeasured MET [GeV]"),
680 is_transfer_lep, procs, plot_types).Tag(
"transfer");
681 pm.
Push<
Hist1D>(
Axis(16, -0.5, 15.5,
"mm_njets[0]",
"Correct N_{jets}"),
682 is_transfer_lep, procs, plot_types).Tag(
"transfer");
683 pm.
Push<
Hist1D>(
Axis(16, -0.5, 15.5,
"mm_njets[2]",
"Mismeasured N_{jets}"),
684 is_transfer_lep, procs, plot_types).Tag(
"transfer");
686 is_transfer_lep, procs, plot_types).Tag(
"transfer");
687 pm.
Push<
Hist1D>(
Axis(7, -0.5, 6.5,
"mm_nbm[2]",
"Mismeasured N_{b}"),
688 is_transfer_lep, procs, plot_types).Tag(
"transfer");
689 pm.
Push<
Hist1D>(
Axis(10, 0., 700.,
"mm_mt[0]",
"Correct m_{T} [GeV]"),
690 is_transfer_lep, procs, plot_types).Tag(
"transfer");
691 pm.
Push<
Hist1D>(
Axis(10, 0., 700.,
"mm_mt[2]",
"Mismeasured m_{T} [GeV]"),
692 is_transfer_lep, procs, plot_types).Tag(
"transfer");
693 pm.
Push<
Hist1D>(
Axis(20, 0., 1000.,
"mm_mj14_lep[0]",
"Correct M_{J} (with lep) [GeV]"),
694 is_transfer_lep, procs, plot_types).Tag(
"transfer");
695 pm.
Push<
Hist1D>(
Axis(20, 0., 1000.,
"mm_mj14_lep[2]",
"Mismeasured M_{J} (with lep) [GeV]"),
696 is_transfer_lep, procs, plot_types).Tag(
"transfer");
697 pm.
Push<
Hist1D>(
Axis(20, 0., 1000.,
"mm_mj14_nolep[0]",
"Correct M_{J} (no lep) [GeV]"),
698 is_transfer_lep, procs, plot_types).Tag(
"transfer");
699 pm.
Push<
Hist1D>(
Axis(20, 0., 1000.,
"mm_mj14_nolep[2]",
"Mismeasured M_{J} (no lep) [GeV]"),
700 is_transfer_lep, procs, plot_types).Tag(
"transfer");
701 pm.
Push<
Hist1D>(
Axis(5, -0.5, 4.5,
"ntruleps",
"True Num. Leptons"),
702 is_transfer_nolep, procs, plot_types).Tag(
"transfer");
703 pm.
Push<
Hist1D>(
Axis(5, -0.5, 4.5,
"mm_nleps[0]",
"Correct Num. Leptons"),
704 is_transfer_nolep, procs, plot_types).Tag(
"transfer");
705 pm.
Push<
Hist1D>(
Axis(5, -0.5, 4.5,
"mm_nleps[2]",
"Mismeasured Num. Leptons"),
706 is_transfer_nolep, procs, plot_types).Tag(
"transfer");
707 pm.
Push<
Hist1D>(
Axis(20, 0., 2000.,
"mm_ht[0]",
"Correct H_{T} [GeV]"),
708 is_transfer_nolep, procs, plot_types).Tag(
"transfer");
709 pm.
Push<
Hist1D>(
Axis(20, 0., 2000.,
"mm_ht[2]",
"Mismeasured H_{T} [GeV]"),
710 is_transfer_nolep, procs, plot_types).Tag(
"transfer");
711 pm.
Push<
Hist1D>(
Axis(15, 0., 1500.,
"mm_met[0]",
"Correct MET [GeV]"),
712 is_transfer_nolep, procs, plot_types).Tag(
"transfer");
713 pm.
Push<
Hist1D>(
Axis(15, 0., 1500.,
"mm_met[2]",
"Mismeasured MET [GeV]"),
714 is_transfer_nolep, procs, plot_types).Tag(
"transfer");
715 pm.
Push<
Hist1D>(
Axis(16, -0.5, 15.5,
"mm_njets[0]",
"Correct N_{jets}"),
716 is_transfer_nolep, procs, plot_types).Tag(
"transfer");
717 pm.
Push<
Hist1D>(
Axis(16, -0.5, 15.5,
"mm_njets[2]",
"Mismeasured N_{jets}"),
718 is_transfer_nolep, procs, plot_types).Tag(
"transfer");
720 is_transfer_nolep, procs, plot_types).Tag(
"transfer");
721 pm.
Push<
Hist1D>(
Axis(7, -0.5, 6.5,
"mm_nbm[2]",
"Mismeasured N_{b}"),
722 is_transfer_nolep, procs, plot_types).Tag(
"transfer");
723 pm.
Push<
Hist1D>(
Axis(10, 0., 700.,
"mm_mt[0]",
"Correct m_{T} [GeV]"),
724 is_transfer_nolep, procs, plot_types).Tag(
"transfer");
725 pm.
Push<
Hist1D>(
Axis(10, 0., 700.,
"mm_mt[2]",
"Mismeasured m_{T} [GeV]"),
726 is_transfer_nolep, procs, plot_types).Tag(
"transfer");
727 pm.
Push<
Hist1D>(
Axis(20, 0., 1000.,
"mm_mj14_lep[0]",
"Correct M_{J} (with lep) [GeV]"),
728 is_transfer_nolep, procs, plot_types).Tag(
"transfer");
729 pm.
Push<
Hist1D>(
Axis(20, 0., 1000.,
"mm_mj14_lep[2]",
"Mismeasured M_{J} (with lep) [GeV]"),
730 is_transfer_nolep, procs, plot_types).Tag(
"transfer");
731 pm.
Push<
Hist1D>(
Axis(20, 0., 1000.,
"mm_mj14_nolep[0]",
"Correct M_{J} (no lep) [GeV]"),
732 is_transfer_nolep, procs, plot_types).Tag(
"transfer");
733 pm.
Push<
Hist1D>(
Axis(20, 0., 1000.,
"mm_mj14_nolep[2]",
"Mismeasured M_{J} (no lep) [GeV]"),
734 is_transfer_nolep, procs, plot_types).Tag(
"transfer");
735 pm.
Push<
Hist1D>(
Axis(20, 0., 1000.,
"mm_mj14_nolep[2]",
"Mismeasured M_{J} (no lep) [GeV]"),
736 is_transfer_nolep, procs, plot_types).Tag(
"transfer");
int RegionIndex(const Baby &b, size_t i, double low_nj, double high_nj, double low_met, double high_met, bool cluster_leps)
PlotOpt & Stack(PlotOptTypes::StackType stack_type)
PlotOpt & YAxis(PlotOptTypes::YAxisType y_axis_type)
std::vector< int > *const & mm_nbm() const
Get mm_nbm for current event and cache it.
TH2D Expand(const TH2D &h)
void Print(TH1D &h, bool no_stats=false)
std::vector< int > *const & mm_nleps() const
Get mm_nleps for current event and cache it.
void Fill(bool pass, TH1D &h_pass, TH1D &h_total, double x, double w)
void MakePositive(TH1D &h)
std::string FullTitle(const TH1 &h)
void SetAxisLabels(TAxis &a, bool use_total)
std::vector< float > *const & mm_mt() const
Get mm_mt for current event and cache it.
Abstract base class for access to ntuple variables.
Combines a callable function taking a Baby and returning a scalar or vector with its string represent...
std::vector< float > *const & mm_mj14_nolep() const
Get mm_mj14_nolep for current event and cache it.
std::vector< float > *const & mm_ht() const
Get mm_ht for current event and cache it.
bool IsTransferNoLep(const Baby &b)
void Format(TH1D &h, bool no_stats=false)
TH2D ColNorm(const TH2D &hin)
FigureType & Push(Args &&...args)
Organizes efficient production of plots with single loop over each process.
PlotOpt & Bottom(PlotOptTypes::BottomType bottom_type)
void PrintTransfer(TH2D &h)
std::vector< int > *const & mm_njets() const
Get mm_njets for current event and cache it.
TH2D RowNorm(const TH2D &hin)
A full 1D plot with stacked/overlayed histograms.
bool IsTransferLep(const Baby &b)
std::vector< float > *const & mm_met() const
Get mm_met for current event and cache it.
void MakePlots(double luminosity, const std::string &subdir="")
Prints all added plots with given luminosity.
std::vector< float > *const & mm_mj14_lep() const
Get mm_mj14_lep for current event and cache it.
PlotOpt & Title(PlotOptTypes::TitleType title_type)
Loads colors from a text configuration file.