11 #include "core/baby.hpp"    26     for (
unsigned i(0); i<b.
mc_pt()->size(); i++){
    27       if (abs(b.
mc_id()->at(i))!=24) 
continue;
    28       if (b.
mc_mass()->at(i) > 140.) {
    36   gErrorIgnoreLevel=6000; 
    38   time_t begtime, endtime;
    44   string hostname = 
execute(
"echo $HOSTNAME");
    46     bfolder = 
"/net/cms2"; 
    48   string foldermc(bfolder+
"/cms2r0/babymaker/babies/2016_08_10/mc/merged_mcbase_stdnj5/");
    50   Palette colors(
"txt/colors.txt", 
"default");
    52   string ntupletag = 
"";
    53   set<string> allfiles = {foldermc+
"*_TTJets*Lept*"+ntupletag+
"*.root", foldermc+
"*_TTJets_HT*"+ntupletag+
"*.root",
    54          foldermc+
"*_WJetsToLNu*"+ntupletag+
"*.root",foldermc+
"*_ST_*"+ntupletag+
"*.root",
    55          foldermc+
"*_TTW*"+ntupletag+
"*.root",foldermc+
"*_TTZ*"+ntupletag+
"*.root",
    56          foldermc+
"*_TTGJets*"+ntupletag+
"*.root",foldermc+
"*_TTTT*"+ntupletag+
"*.root",
    57          foldermc+
"*QCD_HT*Inf_Tune*"+ntupletag+
"*.root", foldermc+
"*QCD_HT*0_Tune*"+ntupletag+
"*.root",
    58          foldermc+
"*DYJetsToLL*"+ntupletag+
"*.root",
    59          foldermc+
"*_ZJet*"+ntupletag+
"*.root",foldermc+
"*_ttHJetTobb*"+ntupletag+
"*.root",
    60          foldermc+
"*_WH_HToBB*"+ntupletag+
"*.root",foldermc+
"*_ZH_HToBB*"+ntupletag+
"*.root",
    61          foldermc+
"*_WWTo*"+ntupletag+
"*.root",foldermc+
"*_WZ*"+ntupletag+
"*.root",foldermc+
"*_ZZ_*"+ntupletag+
"*.root"    65   string baseline = 
"pass && stitch && mj14>250 && nleps>=1 && st>500 && met>100 && njets>=5 && weight<1"; 
    67   map<string, vector<shared_ptr<Process> > > procs;
    68   procs[
"procs"] = vector<shared_ptr<Process> >();
    70     {foldermc+
"*_TTJets*SingleLept*.root", foldermc+
"*_TTJets_HT*.root"},
    71     baseline+
" && ntruleps==1"));
    73     {foldermc+
"*_TTJets*DiLept*.root", foldermc+
"*_TTJets_HT*.root"},
    74     baseline+
" && ntruleps==2 && ntrutaush==0"));
    75   procs[
"procs"].push_back(Process::MakeShared<Baby_full>(
"t#bar{t} (#tau_{h}l)", 
Process::Type::background, colors(
"tt_ltau"),
    76     {foldermc+
"*_TTJets*DiLept*.root", foldermc+
"*_TTJets_HT*.root"},
    77     baseline+
" && ntruleps==2 && ntrutaush>=1"));
    79     {foldermc+
"*_WJetsToLNu*.root"}, baseline));
    81     {foldermc+
"*_ST_*.root"}, baseline));
    83     {foldermc+
"*_TTZ*.root"}, baseline));
    85     {foldermc+
"*_TTW*.root"}, baseline));
    87   {foldermc+
"*QCD_HT*0_Tune*.root",
    88     foldermc+
"*QCD_HT*Inf_Tune*.root"},
    91     {foldermc+
"*_TTGJets*.root"}, baseline));
    93     {foldermc+
"*_TTTT*.root"}, baseline));
    95     {foldermc+
"*DYJetsToLL*.root",
    96     foldermc+
"*_ZJet*.root",
    97     foldermc+
"*_ttHJetTobb*.root",
    98     foldermc+
"*_WH_HToBB*.root",
    99     foldermc+
"*_ZH_HToBB*.root",
   100     foldermc+
"*_WWTo*.root",
   101     foldermc+
"*_WZ*.root",
   102     foldermc+
"*_ZZ_*.root"},
   105   procs[
"goodbad"] = vector<shared_ptr<Process> >();
   108     allfiles, baseline && 
"ntruleps>=2"));
   110     allfiles, baseline && 
"ntruleps<=1 && mt_tru>140"));
   112     allfiles, baseline && 
"ntruleps<=1 && mt_tru<=140"));
   114   procs[
"goodbad0l"] = vector<shared_ptr<Process> >();
   117     allfiles, baseline && 
"ntruleps>=2"));
   119     allfiles, baseline && 
"ntruleps==1 && mt_tru>140"));
   121     allfiles, baseline && 
"ntruleps==1 && mt_tru<=140"));
   123     allfiles, baseline && 
"ntruleps==0"));
   140   vector<TString> metcuts({
"met>100 && met<=150",
"met>150 && met<=200",
"met>200 && met<=350",
"met>350 && met<=500",
"met>500"});
   141   vector<TString> nbcuts({
"nbm==1", 
"nbm>=1",
"nbm>=2"});
   142   vector<TString> njcuts({
"njets==5", 
"njets>=6", 
"njets>=6 && njets<=8",
"njets>=9"});
   144   vector<TString> mtcuts({
"mt<=140", 
"mt>140"});
   147   vector<TString> cuts;
   148   vector<TableRow> table_cuts;
   150   for(
auto &imet: metcuts) 
for(
auto &inb: nbcuts) 
for(
auto &inj: njcuts) 
for(
auto &imt: mtcuts)
   151     cuts.push_back(
"nleps==1 && nveto==0 && "+imet+
"&&"+inb+
"&&"+inj+
"&&"+imt);
   152   for(
size_t icut=0; icut<cuts.size(); icut++)
   154   for(
auto &ipr: procs) 
   155     pm.
Push<
Table>(
"chart_"+ipr.first,  table_cuts, ipr.second, 
true, 
true, 
true);
   159   for(
auto &imet: metcuts) 
for(
auto &inb: nbcuts) 
for(
auto &inj: njcuts) 
for(
auto &imt: mtcuts)
   160     cuts.push_back(
"ntruleps<=1 && nleps==1 && nveto==0 && "+imet+
"&&"+inb+
"&&"+inj+
"&&"+imt);
   161   for(
size_t icut=0; icut<cuts.size(); icut++)
   163   pm.
Push<
Table>(
"chart_01l",  table_cuts, procs[
"procs"], 
true, 
true, 
true);
   167   for(
auto &imet: metcuts) 
for(
auto &inb: nbcuts) 
for(
auto &inj: njcuts) 
for(
auto &imt: mtcuts)
   168     cuts.push_back(
"ntruleps>=2 && nleps==1 && nveto==0 && "+imet+
"&&"+inb+
"&&"+inj+
"&&"+imt);
   169   for(
size_t icut=0; icut<cuts.size(); icut++)
   171   pm.
Push<
Table>(
"chart_2l",  table_cuts, procs[
"procs"], 
true, 
true, 
true);
   177   cout<<endl<<
"Making "<<table_cuts.size()<<
" piecharts took "<<difftime(endtime, begtime)<<
" seconds"<<endl<<endl;
 
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...
bool Contains(const std::string &str, const std::string &pat)
std::string execute(const std::string &cmd)
std::vector< float > *const & mc_pt() const 
Get mc_pt for current event and cache it. 
FigureType & Push(Args &&...args)
std::string CodeToLatex(std::string code)
NamedFunc offshellw("offshellw",[](const Baby &b) -> NamedFunc::ScalarType{for(unsigned i(0);i< b.mc_pt() ->size();i++){if(abs(b.mc_id() ->at(i))!=24) continue;if(b.mc_mass() ->at(i) > 140.){return 99;}}return-1;})
Organizes efficient production of plots with single loop over each process. 
std::vector< int > *const & mc_id() const 
Get mc_id 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 & mc_mass() const 
Get mc_mass for current event and cache it. 
Loads colors from a text configuration file.