11 #include "core/histo_stack.hpp" 27 gErrorIgnoreLevel = 6000;
29 chrono::high_resolution_clock::time_point begTime;
30 begTime = chrono::high_resolution_clock::now();
34 string hostname(
execute(
"echo $HOSTNAME"));
36 bfolder =
"/net/cms2";
38 Palette colors(
"txt/colors.txt",
"default");
41 string folder_mc(bfolder+
"/cms2r0/babymaker/babies/2016_08_10/mc/merged_mcbase_stdnj5/");
42 string ntupletag =
"*.root";
43 if (!
do_met150) ntupletag =
"*metG200*.root";
45 set<string> files_tt({folder_mc+
"*_TTJets*Lept"+ntupletag, folder_mc+
"*_TTJets_HT"+ntupletag});
46 set<string> files_wjets({folder_mc+
"*_WJetsToLNu"+ntupletag});
47 set<string> files_st({folder_mc+
"*_ST_"+ntupletag});
48 set<string> files_other({
49 folder_mc+
"*DYJetsToLL"+ntupletag,
50 folder_mc+
"*_QCD_HT*00_Tune"+ntupletag, folder_mc+
"*_QCD_HT*Inf_Tune"+ntupletag,
51 folder_mc+
"*_ZJet"+ntupletag, folder_mc+
"*_WWTo"+ntupletag,
52 folder_mc+
"*ggZH_HToBB"+ntupletag, folder_mc+
"*ttHJetTobb"+ntupletag,
53 folder_mc+
"*_TTGJets"+ntupletag, folder_mc+
"*_TTTT_"+ntupletag,
54 folder_mc+
"*_TTWJets"+ntupletag, folder_mc+
"*_TTZTo"+ntupletag,
55 folder_mc+
"*_WH_HToBB"+ntupletag, folder_mc+
"*_WZTo"+ntupletag,
56 folder_mc+
"*_ZH_HToBB"+ntupletag, folder_mc+
"_ZZ_"+ntupletag});
58 set<string> files_nontt(files_other);
59 files_nontt.insert(files_wjets.begin(), files_wjets.end());
60 files_nontt.insert(files_st.begin(), files_st.end());
62 set<string> files_all(files_nontt);
63 files_all.insert(files_tt.begin(), files_tt.end());
65 PlotOpt log_shapes(
"txt/plot_styles.txt",
"CMSPaper");
66 log_shapes.
Title(TitleType::info)
68 .
YAxis(YAxisType::log)
69 .
Stack(StackType::shapes)
71 PlotOpt lin_shapes = log_shapes().
YAxis(YAxisType::linear);
72 vector<PlotOpt> plot_types = {lin_shapes};
74 NamedFunc baseline_1l =
"stitch && nleps==1 && nveto==0 && nbm>=1 && weight<1";
75 NamedFunc baseline_2l =
"stitch && nleps==2";
76 NamedFunc baseline_lveto =
"stitch && nleps==1 && nveto==1 && nbm>=1 && mt>140";
78 auto tt1l_lowmt = Process::MakeShared<Baby_full>(
"t#bar{t}(1l), m_{T} #leq 140",
80 tt1l_lowmt->SetLineStyle(2);
81 auto tt1l_highmt = Process::MakeShared<Baby_full>(
"t#bar{t}(1l), m_{T} > 140",
83 auto tt2l = Process::MakeShared<Baby_full>(
"t#bar{t}(2l)",
85 auto ttlveto = Process::MakeShared<Baby_full>(
"t#bar{t}(lv), m_{T} > 140",
87 auto tt2lveto = Process::MakeShared<Baby_full>(
"t#bar{t}(2l or 1l+trk)",
90 auto tt1l_highmt_2trul = Process::MakeShared<Baby_full>(
"t#bar{t}(1l), m_{T} > 140, tru: 2l",
92 baseline_1l &&
"ntruleps>=1 && ntruels+ntrumus+ntrutausl==2 && mt>140");
93 auto tt1l_highmt_1trul_1trutauh = Process::MakeShared<Baby_full>(
"t#bar{t}(1l), m_{T} > 140, tru: l#tau_{h}",
95 baseline_1l &&
"ntruleps>=1 && ntruels+ntrumus+ntrutausl==1 && ntrutaush==1 && mt>140");
96 auto tt1l_highmt_1trul = Process::MakeShared<Baby_full>(
"t#bar{t}(1l), m_{T} > 140, tru: 1l",
98 baseline_1l &&
"ntruleps>=1 && ntruels+ntrumus+ntrutausl==1 && ntrutaush==0 && mt>140");
100 auto bkg1l_lowmt = Process::MakeShared<Baby_full>(
"Tot. bkgd (1l), m_{T}#leq140",
102 bkg1l_lowmt->SetLineStyle(2);
103 auto bkg1l_highmt = Process::MakeShared<Baby_full>(
"Tot. bkgd (1l), m_{T}>140",
105 auto bkg2l = Process::MakeShared<Baby_full>(
"Tot. bkgd (2l)",
107 auto bkglveto = Process::MakeShared<Baby_full>(
"Tot. bkgd (lv), m_{T} > 140",
110 auto wjets1l_lowmt = Process::MakeShared<Baby_full>(
"W+jets (1l), m_{T}#leq140",
113 auto st1l_lowmt = Process::MakeShared<Baby_full>(
"Single t (1l), m_{T}#leq140",
116 auto other1l_lowmt = Process::MakeShared<Baby_full>(
"Other (1l), m_{T}#leq140",
119 auto nontt2l = Process::MakeShared<Baby_full>(
"Non-t#bar{t} (2l)",
121 auto nontt1l_highmt = Process::MakeShared<Baby_full>(
"Non-t#bar{t} (1l), m_{T}>140",
124 map<string, vector<shared_ptr<Process> > > procs, procs_pie, procs_isr;
126 procs[
"lowmt"] = vector<shared_ptr<Process> >({tt1l_lowmt, other1l_lowmt, st1l_lowmt, wjets1l_lowmt});
127 procs_pie[
"lowmt"] = vector<shared_ptr<Process> >({tt1l_lowmt, other1l_lowmt, st1l_lowmt, wjets1l_lowmt});
129 procs[
"highmt"] = vector<shared_ptr<Process> >({tt1l_lowmt, tt1l_highmt_2trul,
130 tt1l_highmt_1trul_1trutauh, tt1l_highmt_1trul, nontt1l_highmt});
131 procs_pie[
"highmt"] = vector<shared_ptr<Process> >({tt1l_highmt_2trul,
132 tt1l_highmt_1trul_1trutauh, tt1l_highmt_1trul, nontt1l_highmt});
134 procs[
"dilep"] = vector<shared_ptr<Process> >({tt1l_lowmt, nontt2l, ttlveto, tt2l});
135 procs_pie[
"dilep"] = vector<shared_ptr<Process> >({nontt2l, ttlveto, tt2l});
137 procs[
"totbkg"] = vector<shared_ptr<Process> >({bkg1l_lowmt, bkg2l, bkglveto, bkg1l_highmt});
138 procs_pie[
"totbkg"] = vector<shared_ptr<Process> >({bkg2l, bkglveto, bkg1l_highmt});
140 procs[
"2lonly"] = vector<shared_ptr<Process> >({tt1l_lowmt, tt1l_highmt,
tt2l, tt2lveto});
142 vector<NamedFunc> metbins;
145 metbins.push_back(
NamedFunc(
"met>200&&met<=350"));
146 metbins.push_back(
NamedFunc(
"met>350&&met<=500"));
153 vector<string> nobjbins;
155 nobjbins.push_back(
"njets+nleps==6");
156 nobjbins.push_back(
"njets+nleps>=7 && njets+nleps<=9");
157 nobjbins.push_back(
"njets+nleps>=10");
159 nobjbins.push_back(
"njets+nleps>=7");
163 for (
auto &iht: {
"ht>500",
"st>500"}){
164 for (
auto &iproc:procs){
165 vector<TableRow> table_cuts;
166 for (
auto &imet: metbins) {
167 for (
auto &inobj: nobjbins) {
169 if(iproc.first ==
"dilep" &&
Contains(inobj,
"==6"))
continue;
170 vector<shared_ptr<Process> > procs_tmp = iproc.second;
172 if (iproc.first ==
"totbkg" &&
Contains(inobj,
"==6"))
173 procs_tmp = vector<shared_ptr<Process> >({bkg1l_lowmt, bkglveto, bkg1l_highmt});
176 pm.
Push<HistoStack>(HistoDef(iproc.first,
177 15, 100., 700.,
"mj14",
"M_{J} [GeV]", icut,
"weight", {250.,400.}), procs_tmp, plot_types);
185 double seconds = (chrono::duration<double>(chrono::high_resolution_clock::now() - begTime)).count();
187 cout<<endl<<
"Making plots took "<<round(seconds)<<
" seconds ("<<hhmmss<<
")"<<endl<<endl;
PlotOpt & Stack(PlotOptTypes::StackType stack_type)
PlotOpt & YAxis(PlotOptTypes::YAxisType y_axis_type)
TString HoursMinSec(float fseconds)
Combines a callable function taking a Baby and returning a scalar or vector with its string represent...
bool Contains(const std::string &str, const std::string &pat)
std::string execute(const std::string &cmd)
FigureType & Push(Args &&...args)
Organizes efficient production of plots with single loop over each process.
PlotOpt & Bottom(PlotOptTypes::BottomType bottom_type)
PlotOpt & RatioMaximum(double ratio_maximum)
void MakePlots(double luminosity, const std::string &subdir="")
Prints all added plots with given luminosity.
PlotOpt & Title(PlotOptTypes::TitleType title_type)
Loads colors from a text configuration file.