29 if(mj <= 300.)
return orig * (1.3 - 0.4*mj/300.);
30 else return 0.9 * orig;
35 gErrorIgnoreLevel = 6000;
39 Palette colors(
"txt/colors.txt",
"default");
41 string folder_mc =
"/net/cms29/cms29r0/babymaker/babies/mismeasured_v2/2016_06_14/mc/unskimmed/";
42 set<string> file_names = {folder_mc+
"*_TTJets*Lept*.root", folder_mc+
"*_TTJets_HT*.root",
43 folder_mc+
"*_WJetsToLNu*.root", folder_mc+
"*_ST_*.root",
44 folder_mc+
"*_TTWJets*.root", folder_mc+
"*_TTZTo*.root",
45 folder_mc+
"*DYJetsToLL*.root", folder_mc+
"*_QCD_HT*.root",
46 folder_mc+
"*ggZH_HToBB*.root", folder_mc+
"*ttHJetTobb*.root",
47 folder_mc+
"*_TTGJets*.root", folder_mc+
"*_TTTT_*.root",
48 folder_mc+
"*_WH_HToBB*.root", folder_mc+
"*_WZTo*.root",
49 folder_mc+
"*_ZH_HToBB*.root", folder_mc+
"_ZZ_*.root"};
50 file_names = {folder_mc+
"*_TTJets*Lept*.root", folder_mc+
"*_TTJets_HT*.root"};
52 vector<int> scenarios = {0,2,5};
54 vector<string> tags = {
"lownj",
"highnj",
"allnj"};
55 vector<float> lownj = {5.5, 8.5, 5.5};
56 vector<float> highnj = {8.5, 9999., 9999.};
57 for(
size_t i = 0; i < tags.size(); ++i){
58 for(
const auto &scenario: scenarios){
59 string s =
"["+to_string(scenario)+
"]";
60 NamedFunc baseline(
"pass&&stitch&&mm_nleps"+s+
">=1&&mm_met"+s+
">200&&mm_ht"+s+
">500");
61 NamedFunc lowmt_cut(
"mm_nleps"+s+
"==1&&mm_mt"+s+
"<=140&&mm_njets"+s+
">="+to_string(lownj.at(i))+
"&&mm_njets"+s+
"<"+to_string(highnj.at(i))+
"&&mm_nbm"+s+
">=1");
62 NamedFunc highmt_cut(
"mm_nleps"+s+
"==1&&mm_mt"+s+
">140&&mm_njets"+s+
">="+to_string(lownj.at(i))+
"&&mm_njets"+s+
"<"+to_string(highnj.at(i))+
"&&mm_nbm"+s+
">=1&&ntruleps==2");
63 NamedFunc dilep_cut_lep(
"mm_nleps"+s+
"==2&&mm_njets"+s+
">="+to_string(lownj.at(i)-1)+
"&&mm_njets"+s+
"<"+to_string(highnj.at(i)-1)+
"&&mm_nbm"+s+
">=0");
64 NamedFunc dilep_cut_nolep(
"mm_nleps"+s+
"==2&&mm_njets"+s+
">="+to_string(lownj.at(i))+
"&&mm_njets"+s+
"<"+to_string(highnj.at(i))+
"&&mm_nbm"+s+
">=0");
67 file_names, baseline&&lowmt_cut);
69 file_names, baseline&&highmt_cut);
71 file_names, baseline&&dilep_cut_lep);
73 file_names, baseline&&dilep_cut_nolep);
75 vector<shared_ptr<Process> > procs_lep = {lowmt, highmt, dilep_lep};
76 vector<shared_ptr<Process> > procs_nolep = {lowmt, highmt, dilep_nolep};
78 string tag =
"rohanplot_"+tags.at(i);
80 PlotOpt log_lumi(
"txt/plot_styles.txt",
"CMSPaper");
81 log_lumi.
Title(TitleType::info)
83 .
YAxis(YAxisType::log)
84 .
Stack(StackType::shapes);
85 PlotOpt noinfo = log_lumi().
Title(TitleType::preliminary);
86 vector<PlotOpt> plot_types = {log_lumi, noinfo};
89 NamedFunc mjnolep(
"mm_mj14_nolep"+s+
">250.");
91 NamedFunc med_met(
"mm_met"+s+
">350&&mm_met"+s+
"<=500");
94 pm.
Push<
Hist1D>(
Axis(30, 0., 1500.,
"mm_mj14_lep"+s,
"M_{J} (with lep) [GeV]", {250., 400.}),
95 true, procs_lep, plot_types).
Tag(tag);
96 pm.
Push<
Hist1D>(
Axis(30, 0., 1500.,
"mm_mj14_nolep"+s,
"M_{J} (no lep) [GeV]", {250., 400.}),
97 true, procs_nolep, plot_types).
Tag(tag);
98 pm.
Push<
Hist1D>(
Axis(30, 0., 1500.,
"mm_mj14_lep"+s,
"M_{J} (with lep) [GeV]", {250., 400.}),
99 low_met, procs_lep, plot_types).
Tag(tag);
100 pm.
Push<
Hist1D>(
Axis(30, 0., 1500.,
"mm_mj14_nolep"+s,
"M_{J} (no lep) [GeV]", {250., 400.}),
101 low_met, procs_nolep, plot_types).
Tag(tag);
102 pm.
Push<
Hist1D>(
Axis(30, 0., 1500.,
"mm_mj14_lep"+s,
"M_{J} (with lep) [GeV]", {250., 400.}),
103 med_met, procs_lep, plot_types).
Tag(tag);
104 pm.
Push<
Hist1D>(
Axis(30, 0., 1500.,
"mm_mj14_nolep"+s,
"M_{J} (no lep) [GeV]", {250., 400.}),
105 med_met, procs_nolep, plot_types).
Tag(tag);
106 pm.
Push<
Hist1D>(
Axis(30, 0., 1500.,
"mm_mj14_lep"+s,
"M_{J} (with lep) [GeV]", {250., 400.}),
107 high_met, procs_lep, plot_types).
Tag(tag);
108 pm.
Push<
Hist1D>(
Axis(30, 0., 1500.,
"mm_mj14_nolep"+s,
"M_{J} (no lep) [GeV]", {250., 400.}),
109 high_met, procs_nolep, plot_types).
Tag(tag);
111 NamedFunc w_no_toppt(
"weight/(eff_trig*w_toppt)");
112 pm.
Push<
Hist1D>(
Axis(30, 0., 1500.,
"mm_mj14_lep"+s,
"M_{J} (with lep) [GeV]", {250., 400.}),
113 true, procs_lep, plot_types).
Tag(tag).
Weight(w_no_toppt);
114 pm.
Push<
Hist1D>(
Axis(30, 0., 1500.,
"mm_mj14_nolep"+s,
"M_{J} (no lep) [GeV]", {250., 400.}),
115 true, procs_nolep, plot_types).
Tag(tag).
Weight(w_no_toppt);
116 pm.
Push<
Hist1D>(
Axis(30, 0., 1500.,
"mm_mj14_lep"+s,
"M_{J} (with lep) [GeV]", {250., 400.}),
117 low_met, procs_lep, plot_types).
Tag(tag).
Weight(w_no_toppt);
118 pm.
Push<
Hist1D>(
Axis(30, 0., 1500.,
"mm_mj14_nolep"+s,
"M_{J} (no lep) [GeV]", {250., 400.}),
119 low_met, procs_nolep, plot_types).
Tag(tag).
Weight(w_no_toppt);
120 pm.
Push<
Hist1D>(
Axis(30, 0., 1500.,
"mm_mj14_lep"+s,
"M_{J} (with lep) [GeV]", {250., 400.}),
121 med_met, procs_lep, plot_types).
Tag(tag).
Weight(w_no_toppt);
122 pm.
Push<
Hist1D>(
Axis(30, 0., 1500.,
"mm_mj14_nolep"+s,
"M_{J} (no lep) [GeV]", {250., 400.}),
123 med_met, procs_nolep, plot_types).
Tag(tag).
Weight(w_no_toppt);
124 pm.
Push<
Hist1D>(
Axis(30, 0., 1500.,
"mm_mj14_lep"+s,
"M_{J} (with lep) [GeV]", {250., 400.}),
125 high_met, procs_lep, plot_types).
Tag(tag).
Weight(w_no_toppt);
126 pm.
Push<
Hist1D>(
Axis(30, 0., 1500.,
"mm_mj14_nolep"+s,
"M_{J} (no lep) [GeV]", {250., 400.}),
127 high_met, procs_nolep, plot_types).
Tag(tag).
Weight(w_no_toppt);
129 pm.
Push<
Hist1D>(
Axis(30, 0., 1500.,
"mm_mj14_lep"+s,
"M_{J} (with lep) [GeV]", {250., 400.}),
131 pm.
Push<
Hist1D>(
Axis(30, 0., 1500.,
"mm_mj14_nolep"+s,
"M_{J} (no lep) [GeV]", {250., 400.}),
133 pm.
Push<
Hist1D>(
Axis(30, 0., 1500.,
"mm_mj14_lep"+s,
"M_{J} (with lep) [GeV]", {250., 400.}),
135 pm.
Push<
Hist1D>(
Axis(30, 0., 1500.,
"mm_mj14_nolep"+s,
"M_{J} (no lep) [GeV]", {250., 400.}),
137 pm.
Push<
Hist1D>(
Axis(30, 0., 1500.,
"mm_mj14_lep"+s,
"M_{J} (with lep) [GeV]", {250., 400.}),
139 pm.
Push<
Hist1D>(
Axis(30, 0., 1500.,
"mm_mj14_nolep"+s,
"M_{J} (no lep) [GeV]", {250., 400.}),
141 pm.
Push<
Hist1D>(
Axis(30, 0., 1500.,
"mm_mj14_lep"+s,
"M_{J} (with lep) [GeV]", {250., 400.}),
143 pm.
Push<
Hist1D>(
Axis(30, 0., 1500.,
"mm_mj14_nolep"+s,
"M_{J} (no lep) [GeV]", {250., 400.}),
146 pm.
Push<
Hist1D>(
Axis(30, 0., 1500.,
"mm_mj14_lep"+s,
"M_{J} (with lep) [GeV]", {250., 400.}),
148 pm.
Push<
Hist1D>(
Axis(30, 0., 1500.,
"mm_mj14_nolep"+s,
"M_{J} (no lep) [GeV]", {250., 400.}),
150 pm.
Push<
Hist1D>(
Axis(30, 0., 1500.,
"mm_mj14_lep"+s,
"M_{J} (with lep) [GeV]", {250., 400.}),
152 pm.
Push<
Hist1D>(
Axis(30, 0., 1500.,
"mm_mj14_nolep"+s,
"M_{J} (no lep) [GeV]", {250., 400.}),
154 pm.
Push<
Hist1D>(
Axis(30, 0., 1500.,
"mm_mj14_lep"+s,
"M_{J} (with lep) [GeV]", {250., 400.}),
156 pm.
Push<
Hist1D>(
Axis(30, 0., 1500.,
"mm_mj14_nolep"+s,
"M_{J} (no lep) [GeV]", {250., 400.}),
158 pm.
Push<
Hist1D>(
Axis(30, 0., 1500.,
"mm_mj14_lep"+s,
"M_{J} (with lep) [GeV]", {250., 400.}),
160 pm.
Push<
Hist1D>(
Axis(30, 0., 1500.,
"mm_mj14_nolep"+s,
"M_{J} (no lep) [GeV]", {250., 400.}),
163 NamedFunc mc_cut =
"mm_mj14_nolep"+s+
">250.&&mm_mj14_lep"+s+
"<=400&&mm_met"+s+
"<=500&&mm_nbm"+s+
"<=2&&mm_nleps"+s+
"==1&&mm_ht"+s+
">500&&mm_met"+s+
">200&&mm_njets"+s+
">=6&&mm_nbm"+s+
">=1";
165 {folder_mc+
"*_TTJets*Lept*.root", folder_mc+
"*_TTJets_HT*.root"}, mc_cut&&
"ntruleps<=1&&stitch");
167 {folder_mc+
"*_TTJets*Lept*.root", folder_mc+
"*_TTJets_HT*.root"}, mc_cut&&
"ntruleps>=2&&stitch");
169 {folder_mc+
"*_WJetsToLNu*.root"}, mc_cut);
171 {folder_mc+
"*_ST_*.root"}, mc_cut);
173 {folder_mc+
"*_TTWJets*.root", folder_mc+
"*_TTZTo*.root"}, mc_cut);
175 {folder_mc+
"*DYJetsToLL*.root", folder_mc+
"*_QCD_HT*.root",
176 folder_mc+
"*_ZJet*.root", folder_mc+
"*_WWTo*.root",
177 folder_mc+
"*ggZH_HToBB*.root", folder_mc+
"*ttHJetTobb*.root",
178 folder_mc+
"*_TTGJets*.root", folder_mc+
"*_TTTT_*.root",
179 folder_mc+
"*_WH_HToBB*.root", folder_mc+
"*_WZTo*.root",
180 folder_mc+
"*_ZH_HToBB*.root", folder_mc+
"_ZZ_*.root"}, mc_cut);
182 {
"/net/cms2/cms2r0/babymaker/babies/2016_06_26/data/merged_standard/*.root"},
183 "json2p6&&pass&&(trig[4]||trig[8]||trig[13]||trig[33])&&mj14>250.&&mj14<=400&&met<=500&&nbm<=2&&nleps==1&&ht>500&&met>200&&njets>=6&&nbm>=1");
184 vector<shared_ptr<Process> > procs = {
tt1l,
tt2l, wjets, single_t, ttv,
other, data_2016};
186 bool is_data =
false;
193 if(is_data)
return b.
mt();
194 else return b.
mm_mt()->at(scenario);
196 pm.
Push<
Hist1D>(
Axis(30, 0., 1500., mt,
"m_{T} [GeV]", {140.}),
true, procs,
197 vector<PlotOpt>{log_lumi().
Stack(StackType::data_norm),
198 noinfo().
Stack(StackType::data_norm)}).Tag(
"mm"+to_string(scenario));
PlotOpt & Stack(PlotOptTypes::StackType stack_type)
PlotOpt & YAxis(PlotOptTypes::YAxisType y_axis_type)
const NamedFunc njets_weights_ttisr
float const & eff_trig() const
Get eff_trig for current event and cache it.
const std::set< std::string > & FileNames() const
std::vector< float > *const & mm_mt() const
Get mm_mt for current event and cache it.
Abstract base class for access to ntuple variables.
Hist1D & Weight(const NamedFunc &weight)
ScalarType GetScalar(const Baby &b) const
Evaluate scalar function with b as argument.
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)
NamedFunc full_weight("full_weight", [](const Baby &b) -> NamedFunc::ScalarType{if(b.ntrupv()< 0) return b.weight();double orig=isr_weight.GetScalar(b);double mj=b.mj14();if(mj<=300.) return orig *(1.3-0.4 *mj/300.);else return 0.9 *orig;})
float const & w_toppt() const
Get w_toppt for current event and cache it.
float const & mj14() const
Get mj14 for current event and cache it.
float const & mt() const
Get mt for current event and cache it.
FigureType & Push(Args &&...args)
static Int_t RGB(Int_t r, Int_t g, Int_t b)
Gets the ROOT color number corresponding to a given RGB color.
Organizes efficient production of plots with single loop over each process.
PlotOpt & Bottom(PlotOptTypes::BottomType bottom_type)
float const & weight() const
Get weight for current event and cache it.
A full 1D plot with stacked/overlayed histograms.
NamedFunc isr_weight("isr_weight", [](const Baby &b) -> NamedFunc::ScalarType{if(b.ntrupv()< 0) return b.weight();return b.SampleType()==20?Functions::njets_weights_ttisr.GetScalar(b):b.weight()/(b.eff_trig()*b.w_toppt());})
int const & ntrupv() const
Get ntrupv for current event and cache it.
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.