9 #include "core/baby.hpp" 26 gErrorIgnoreLevel = 6000;
30 string mc_folder =
"/net/cms29/cms29r0/babymaker/babies/2016_08_10/mc/skim_nleps1__metG250__htG250/";
31 string data_folder =
"/net/cms29/cms29r0/babymaker/babies/2016_08_10/data/skim_nleps1__metG250__htG250/";
33 Palette colors(
"txt/colors.txt",
"default");
36 {data_folder+
"*.root"},
"pass&&(trig[13]||trig[33])&&json12p9");
39 {mc_folder+
"*_TTJets*Lept*.root"},
"pass&&ntruleps<=1");
41 {mc_folder+
"*_TTJets*Lept*.root"},
"pass&&ntruleps>=2");
43 {mc_folder+
"*_WJets*HT*.root"},
"pass");
45 {mc_folder+
"*_ST_*.root"},
"pass");
47 vector<shared_ptr<Process> > full_sam = {
data, tt_1l, tt_2l, wjets, st};
49 PlotOpt log_lumi(
"txt/plot_styles.txt",
"CMSPaper");
50 log_lumi.
Title(TitleType::preliminary)
52 .
YAxis(YAxisType::log)
53 .
Stack(StackType::data_norm)
59 PlotOpt lin_shapes = log_shapes().
YAxis(YAxisType::linear);
60 PlotOpt log_lumi_info = log_lumi().
Title(TitleType::info);
61 PlotOpt lin_lumi_info = lin_lumi().
Title(TitleType::info);
62 PlotOpt log_shapes_info = log_shapes().
Title(TitleType::info);
63 PlotOpt lin_shapes_info = lin_shapes().
Title(TitleType::info);
64 vector<PlotOpt> all_plot_types = {log_lumi_info};
71 NamedFunc baseline =
"ht>250 && met>250 && njets>=2";
73 for(
int ilep=0; ilep<3; ilep++){
75 if(ilep==0) lepcut = nelstight25==1;
76 if(ilep==1) lepcut = nmus25==1;
77 if(ilep==2) lepcut = nelstight25+nmus25==1;
79 for(
int ictrl=0; ictrl<3; ictrl++){
81 if(ictrl==0) ctrlreg =
"nbm==0";
82 if(ictrl==1) ctrlreg =
"nbm>=1";
83 if(ictrl==2) ctrlreg =
"nbm>=2";
85 vector<NamedFunc> weights;
95 for(
const auto &iwght: weights){
97 pm.
Push<
Hist1D>(
Axis(25, 250., 1500.,
"ht",
"H_{T} [GeV]"), baseline && ctrlreg && lepcut, full_sam, all_plot_types).Weight(iwght);
98 pm.
Push<
Hist1D>(
Axis(20, 250., 1250.,
"met",
"MET [GeV]"), baseline && ctrlreg && lepcut, full_sam, all_plot_types).Weight(iwght);
99 pm.
Push<
Hist1D>(
Axis(10, 2., 12.,
"njets",
"N_{jets}"), baseline && ctrlreg && lepcut, full_sam, all_plot_types).Weight(iwght);
100 pm.
Push<
Hist1D>(
Axis(5, 0., 5.,
"nbm",
"N_{b}^{med}"), baseline && ctrlreg && lepcut, full_sam, all_plot_types).Weight(iwght);
101 pm.
Push<
Hist1D>(
Axis(20, 0, 1000,
"mj14",
"M_{J}"), baseline && ctrlreg && lepcut, full_sam, all_plot_types).Weight(iwght);
102 pm.
Push<
Hist1D>(
Axis(12, 0, 420,
"mt",
"m_{T}"), baseline && ctrlreg && lepcut, full_sam, all_plot_types).Weight(iwght);
113 double weight = -99999999999;
149 for (
size_t iel(0); iel<b.
els_pt()->size(); iel++){
158 for (
size_t iel(0); iel<b.
els_pt()->size(); iel++){
167 for (
size_t imu(0); imu<b.
mus_pt()->size(); imu++){
float const & w_btag() const
Get w_btag for current event and cache it.
PlotOpt & Stack(PlotOptTypes::StackType stack_type)
PlotOpt & FileExtensions(const std::set< std::string > &file_extensions)
PlotOpt & YAxis(PlotOptTypes::YAxisType y_axis_type)
std::vector< float > *const & els_pt() const
Get els_pt for current event and cache it.
std::vector< bool > *const & els_sig() const
Get els_sig for current event and cache it.
float const & w_isr() const
Get w_isr for current event and cache it.
Abstract base class for access to ntuple variables.
std::vector< float > *const & mus_pt() const
Get mus_pt for current event and cache it.
Combines a callable function taking a Baby and returning a scalar or vector with its string represent...
NamedFunc::ScalarType nElsTight25(const Baby &b)
std::vector< float > *const & els_miniso() const
Get els_miniso for current event and cache it.
FigureType & Push(Args &&...args)
std::vector< bool > *const & els_tight() const
Get els_tight for current event and cache it.
Organizes efficient production of plots with single loop over each process.
PlotOpt & Bottom(PlotOptTypes::BottomType bottom_type)
float const & w_lep() const
Get w_lep for current event and cache it.
NamedFunc::ScalarType nEls25(const Baby &b)
float const & w_lumi() const
Get w_lumi for current event and cache it.
PlotOpt & ShowBackgroundError(bool show_background_error)
std::vector< bool > *const & mus_sig() const
Get mus_sig for current event and cache it.
A full 1D plot with stacked/overlayed histograms.
double getWeight(const Baby &b, int bin)
const NamedFunc st("st", [](const Baby &b) -> NamedFunc::ScalarType{float stvar=b.ht();for(const auto &pt:*(b.leps_pt())) stvar+=pt;return stvar;})
std::vector< float > *const & mus_miniso() const
Get mus_miniso for current event and cache it.
int const & ntrupv() const
Get ntrupv for current event and cache it.
NamedFunc::ScalarType nMus25(const Baby &b)
void MakePlots(double luminosity, const std::string &subdir="")
Prints all added plots with given luminosity.
PlotOpt & Title(PlotOptTypes::TitleType title_type)
float const & w_pu() const
Get w_pu for current event and cache it.
Loads colors from a text configuration file.