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 string ntupletag=
"metG200";
40 string foldermc(bfolder+
"/cms2r0/babymaker/babies/2016_08_10/mc/merged_mcbase_met100_stdnj5/");
42 Palette colors(
"txt/colors.txt",
"default");
45 NamedFunc baseline =
"stitch && nleps==1 && nveto==0 && st>500 && met>100 && njets>=5 && nbm>=1 && weight<1";
47 set<string> allfiles = {foldermc+
"*_TTJets*Lept*"+ntupletag+
"*.root", foldermc+
"*_TTJets_HT*"+ntupletag+
"*.root",
48 foldermc+
"*_WJetsToLNu*"+ntupletag+
"*.root",foldermc+
"*_ST_*"+ntupletag+
"*.root",
49 foldermc+
"*_TTW*"+ntupletag+
"*.root",foldermc+
"*_TTZ*"+ntupletag+
"*.root",
50 foldermc+
"*_TTGJets*"+ntupletag+
"*.root",foldermc+
"*_TTTT*"+ntupletag+
"*.root",
51 foldermc+
"*QCD_HT*Inf_Tune*"+ntupletag+
"*.root",
52 foldermc+
"*QCD_HT*0_Tune*"+ntupletag+
"*.root",foldermc+
"*DYJetsToLL*"+ntupletag+
"*.root",
53 foldermc+
"*_ZJet*"+ntupletag+
"*.root",foldermc+
"*_ttHJetTobb*"+ntupletag+
"*.root",
54 foldermc+
"*_WH_HToBB*"+ntupletag+
"*.root",foldermc+
"*_ZH_HToBB*"+ntupletag+
"*.root",
55 foldermc+
"*_WWTo*"+ntupletag+
"*.root",foldermc+
"*_WZ*"+ntupletag+
"*.root",
56 foldermc+
"*_ZZ_*"+ntupletag+
"*.root" 59 set<string> ttfiles = {foldermc+
"*_TTJets*Lept*"+ntupletag+
"*.root", foldermc+
"*_TTJets_HT*"+ntupletag+
"*.root"};
60 set<string> wfiles = {foldermc+
"*_WJetsToLNu*"+ntupletag+
"*.root"};
62 set<string> otherfiles = {foldermc+
"*_ST_*"+ntupletag+
"*.root", foldermc+
"*_TTW*"+ntupletag+
"*.root",foldermc+
"*_TTZ*"+ntupletag+
"*.root",
63 foldermc+
"*_TTGJets*"+ntupletag+
"*.root",foldermc+
"*_TTTT*"+ntupletag+
"*.root",
64 foldermc+
"*QCD_HT*Inf_Tune*"+ntupletag+
"*.root",
65 foldermc+
"*QCD_HT*0_Tune*"+ntupletag+
"*.root",foldermc+
"*DYJetsToLL*"+ntupletag+
"*.root",
66 foldermc+
"*_ZJet*"+ntupletag+
"*.root",foldermc+
"*_ttHJetTobb*"+ntupletag+
"*.root",
67 foldermc+
"*_WH_HToBB*"+ntupletag+
"*.root",foldermc+
"*_ZH_HToBB*"+ntupletag+
"*.root",
68 foldermc+
"*_WWTo*"+ntupletag+
"*.root",foldermc+
"*_WZ*"+ntupletag+
"*.root",
69 foldermc+
"*_ZZ_*"+ntupletag+
"*.root"};
72 allfiles, baseline &&
"stitch && ntruleps>=2");
74 allfiles, baseline &&
"stitch && ntruleps==1 && mt-mt_tru<=60");
76 allfiles, baseline &&
"stitch && ntruleps==1 && mt-mt_tru>60");
79 allfiles, baseline &&
"stitch && ntruleps>=2 && mt>140");
80 auto proc_1lgood_himt = Process::MakeShared<Baby_full>(
"tru 1l well meas. m_{T}>140",
Process::Type::background, kGreen-3,
81 allfiles, baseline &&
"stitch && ntruleps==1 && mt_tru>=140 && mt>140");
83 allfiles, baseline &&
"stitch && ntruleps==1 && mt_tru<=140 && mt>140");
85 allfiles, baseline &&
"stitch && ntruleps==0 && mt>140");
89 allfiles, baseline &&
"stitch && mt<=140");
91 ttfiles, baseline &&
"stitch && mt<=140 && ntruleps==1");
95 allfiles, baseline &&
"stitch && ntruleps==1 && mt>140");
97 allfiles, baseline &&
"stitch && ntruleps<=1 && mt>140");
101 colors(
"tt_2l"), ttfiles,
102 baseline &&
"stitch && ntruleps>=2 && mt>140");
104 colors(
"tt_1l"), ttfiles,
105 baseline &&
"stitch && ntruleps==1 && mt>140");
107 colors(
"wjets"), wfiles,
108 baseline &&
"stitch && mt>140");
113 colors(
"other"), otherfiles,
114 baseline &&
"stitch && mt>140");
118 vector<shared_ptr<Process> > goodbad_procs = {proc_lomt, proc_1lbad_himt, proc_1lgood_himt, proc_2l_himt};
119 vector<shared_ptr<Process> > goodbad0_procs = {proc_lomt, proc_0l_himt, proc_1lbad_himt, proc_1lgood_himt, proc_2l_himt};
120 vector<shared_ptr<Process> > proc_procs = {proc_lomt, proc_other_himt,
121 proc_w_himt, proc_tt1l_himt, proc_tt2l_himt};
122 vector<shared_ptr<Process> > lep_procs = {proc_lomt, proc_01l_himt, proc_2l_himt};
124 PlotOpt log_shapes(
"txt/plot_styles.txt",
"CMSPaper");
125 log_shapes.
Title(TitleType::info)
126 .
Bottom(BottomType::ratio)
127 .
YAxis(YAxisType::log)
128 .
Stack(StackType::shapes)
130 PlotOpt lin_shapes = log_shapes().
YAxis(YAxisType::linear);
131 vector<PlotOpt> plot_types = {lin_shapes};
134 vector<NamedFunc> metbins;
138 metbins.push_back(
NamedFunc(
"met>200&&met<=350"));
139 metbins.push_back(
NamedFunc(
"met>350&&met<=500"));
144 vector<string> nobjbins;
145 nobjbins = vector<string>();
149 nobjbins.push_back(
"njets>=6");
150 nobjbins.push_back(
"njets>=9");
154 for (
auto &imet: metbins) {
155 for (
auto &inobj: nobjbins) {
157 pm.
Push<
Hist1D>(
Axis(10, 100., 850.,
"mj14",
"M_{J} [GeV]", {250., 400.}),
158 icut, goodbad_procs, plot_types).
Tag(
"thin_goodbad");
159 pm.
Push<
Hist1D>(
Axis(10, 100., 850.,
"mj14",
"M_{J} [GeV]", {250., 400.}),
160 icut, goodbad0_procs, plot_types).
Tag(
"thin_goodbad0");
161 pm.
Push<
Hist1D>(
Axis(10, 100., 850.,
"mj14",
"M_{J} [GeV]", {250., 400.}),
162 icut, proc_procs, plot_types).
Tag(
"thin_proc");
163 pm.
Push<
Hist1D>(
Axis(10, 100., 850.,
"mj14",
"M_{J} [GeV]", {250., 400.}),
164 icut, lep_procs, plot_types).
Tag(
"thin_lep");
166 pm.
Push<
Hist1D>(
Axis(5, 100., 850.,
"mj14",
"M_{J} [GeV]", {250., 400.}),
167 icut, goodbad_procs, plot_types).
Tag(
"fat_goodbad");
168 pm.
Push<
Hist1D>(
Axis(5, 100., 850.,
"mj14",
"M_{J} [GeV]", {250., 400.}),
169 icut, goodbad0_procs, plot_types).
Tag(
"fat_goodbad0");
170 pm.
Push<
Hist1D>(
Axis(5, 100., 850.,
"mj14",
"M_{J} [GeV]", {250., 400.}),
171 icut, proc_procs, plot_types).
Tag(
"fat_proc");
172 pm.
Push<
Hist1D>(
Axis(5, 100., 850.,
"mj14",
"M_{J} [GeV]", {250., 400.}),
173 icut, lep_procs, plot_types).
Tag(
"fat_lep");
187 double seconds = (chrono::duration<double>(chrono::high_resolution_clock::now() - begTime)).count();
189 cout<<endl<<
"Making "<<Nplots<<
" 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)
A full 1D plot with stacked/overlayed histograms.
void MakePlots(double luminosity, const std::string &subdir="")
Prints all added plots with given luminosity.
Hist1D & Tag(const std::string &tag)
PlotOpt & Title(PlotOptTypes::TitleType title_type)
Loads colors from a text configuration file.