15 #include "core/baby.hpp" 25 gErrorIgnoreLevel=6000;
27 chrono::high_resolution_clock::time_point begTime;
28 begTime = chrono::high_resolution_clock::now();
33 string hostname =
execute(
"echo $HOSTNAME");
35 bfolder =
"/net/cms2";
37 string foldermc(bfolder+
"/cms2r0/babymaker/babies/2016_08_10/mc/merged_higmc_higloose/");
40 string baseline =
"pass && stitch && hig_drmax<2.2&&ntks==0&&njets>=4&&njets<=5&&!low_dphi&&nvleps==0";
42 string c_2b=
"nbt==2&&nbm==2";
43 string c_3b=
"nbt>=2&&nbm==3&&nbl==3";
44 string c_4b=
"nbt>=2&&nbm>=3&&nbl>=4";
47 {foldermc+
"*_TTJets*.root"}, baseline+
"&&"+c_2b);
49 {foldermc+
"*_TTJets*.root"}, baseline+
"&&"+c_3b);
51 {foldermc+
"*_TTJets*.root"}, baseline+
"&&"+c_4b);
55 vector<string> vnames_bkg({
"_TTJets",
"_WJetsToLNu",
"_TTW",
"_TTZ",
"DYJetsToLL",
56 "_ZJet",
"_ttHJetTobb",
"_TTGJets",
"_TTTT",
57 "_WH_HToBB",
"_ZH_HToBB",
"_WWTo",
"_WZ",
"_ZZ_"});
59 set<string> names_bkg;
60 for(
auto name : vnames_bkg)
61 names_bkg.insert(name = foldermc +
"*" + name +
"*.root");
64 names_bkg, baseline+
"&&"+c_2b);
66 names_bkg, baseline+
"&&"+c_3b);
68 names_bkg, baseline+
"&&"+c_4b);
71 vector<shared_ptr<Process> > procs_tt = {proc_tt_2b, proc_tt_3b, proc_tt_4b};
72 vector<shared_ptr<Process> > procs_bkg = {proc_bkg_2b, proc_bkg_3b, proc_bkg_4b};
74 PlotOpt log_lumi(
"txt/plot_styles.txt",
"CMSPaper");
75 log_lumi.
Title(TitleType::preliminary)
77 .
YAxis(YAxisType::log)
78 .
Stack(StackType::data_norm);
82 PlotOpt lin_shapes = log_shapes().
YAxis(YAxisType::linear);
83 PlotOpt log_lumi_info = log_lumi().
Title(TitleType::info);
84 PlotOpt lin_lumi_info = lin_lumi().
Title(TitleType::info);
85 PlotOpt log_shapes_info = log_shapes().
Title(TitleType::info);
86 PlotOpt lin_shapes_info = lin_shapes().
Title(TitleType::info);
87 vector<PlotOpt> all_plot_types = {lin_shapes_info};
92 NamedFunc cuts =
"nvleps==0&&met>100&&!low_dphi&&hig_drmax<2.2&&ntks==0&&njets>=4&&njets<=5";
93 pm.
Push<
Hist1D>(
Axis(22,0,110,
"hig_dm",
"#Deltam_{jj} [GeV]", {40.}),
94 cuts, procs_tt, all_plot_types).
Tag(
"tt");
95 pm.
Push<
Hist1D>(
Axis(25,0,250,
"hig_am",
"<m_{jj}> [GeV]", {100., 140.}),
96 cuts, procs_tt, all_plot_types).
Tag(
"tt");
97 pm.
Push<
Hist1D>(
Axis(22,0,110,
"hig_dm",
"#Deltam_{jj} [GeV]", {40.}),
98 cuts, procs_bkg, all_plot_types).
Tag(
"bkg");
99 pm.
Push<
Hist1D>(
Axis(25,0,250,
"hig_am",
"<m_{jj}> [GeV]", {100., 140.}),
100 cuts, procs_bkg, all_plot_types).
Tag(
"bkg");
105 double seconds = (chrono::duration<double>(chrono::high_resolution_clock::now() - begTime)).count();
107 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 & ShowBackgroundError(bool show_background_error)
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)