ra4_draw  4bd0201e3d922d42bd545d4b045ed44db33454a4
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
plot_2016-06-03_prelim_status_talk.cxx
Go to the documentation of this file.
1 #include <iostream>
2 #include <string>
3 #include <vector>
4 #include <memory>
5 
6 #include "TError.h"
7 #include "TColor.h"
8 
9 #include "baby.hpp"
10 #include "process.hpp"
11 #include "named_func.hpp"
12 #include "plot_maker.hpp"
13 #include "plot_opt.hpp"
14 #include "palette.hpp"
15 
16 using namespace std;
17 using namespace PlotOptTypes;
18 
19 template<typename T>
20 shared_ptr<Process> Proc(const string process_name, Process::Type type,
21  int color, const set<string> &files, const string &cut = "1"){
22  return make_shared<Process>(process_name, type, color,
23  unique_ptr<Baby>(new T(files)),
24  cut);
25 }
26 
27 int main(){
28  gErrorIgnoreLevel = 6000;
29 
30  double lumi = 0.589;
31 
32  // 74x
33  string trig_skim_mc = "/net/cms27/cms27r0/babymaker/2016_04_29/mc/merged_1lht500met200/";
34  string trig_mc = "/net/cms27/cms27r0/babymaker/2016_04_29/mc/unskimmed/";
35 
36  Palette colors("txt/colors.txt", "default");
37 
38  auto tt1l = Proc<Baby_full>("t#bar{t} (1l)", Process::Type::background, colors("tt_1l"),
39  {trig_skim_mc+"*_TTJets*Lept*.root", trig_skim_mc+"*_TTJets_HT*.root"},
40  "ntruleps<=1&&stitch");
41  auto tt2l = Proc<Baby_full>("t#bar{t} (2l)", Process::Type::background, colors("tt_2l"),
42  {trig_skim_mc+"*_TTJets*Lept*.root", trig_skim_mc+"*_TTJets_HT*.root"},
43  "ntruleps>=2&&stitch");
44  auto wjets = Proc<Baby_full>("W+jets", Process::Type::background, colors("wjets"),
45  {trig_skim_mc+"*_WJetsToLNu*.root"});
46  auto single_t = Proc<Baby_full>("Single t", Process::Type::background, colors("single_t"),
47  {trig_skim_mc+"*_ST_*.root"});
48  auto ttv = Proc<Baby_full>("t#bar{t}V", Process::Type::background, colors("ttv"),
49  {trig_skim_mc+"*_TTWJets*.root", trig_skim_mc+"*_TTZTo*.root"});
50  auto other = Proc<Baby_full>("Other", Process::Type::background, colors("other"),
51  {trig_skim_mc+"*DYJetsToLL*.root", trig_skim_mc+"*_QCD_HT*.root",
52  trig_skim_mc+"*_ZJet*.root", trig_skim_mc+"*_WWTo*.root",
53  trig_skim_mc+"*ggZH_HToBB*.root", trig_skim_mc+"*ttHJetTobb*.root",
54  trig_skim_mc+"*_TTGJets*.root", trig_skim_mc+"*_TTTT_*.root",
55  trig_skim_mc+"*_WH_HToBB*.root", trig_skim_mc+"*_WZTo*.root",
56  trig_skim_mc+"*_ZH_HToBB*.root", trig_skim_mc+"_ZZ_*.root"});
57 
58  auto t1tttt_nc = Proc<Baby_full>("T1tttt(1500,100)", Process::Type::signal, colors("t1tttt"),
59  {trig_mc+"*SMS-T1tttt_mGluino-1500_mLSP-100*.root"});
60  auto t1tttt_c = Proc<Baby_full>("T1tttt(1200,800)", Process::Type::signal, colors("t1tttt"),
61  {trig_mc+"*SMS-T1tttt_mGluino-1200_mLSP-800*.root"});
62  t1tttt_c->SetLineStyle(2);
63 
64  auto data_1l = Proc<Baby_full>("Data", Process::Type::data, kBlack,
65  {"/net/cms2/cms2r0/babymaker/babies/2016_05_31/data/met/*.root"},"pass&&trig[28]"); // 0.589 fb-1
66  vector<shared_ptr<Process> > full_trig_skim_1l = {data_1l, t1tttt_nc, t1tttt_c, tt1l, tt2l, wjets, single_t, ttv, other};
67 
68  //
69  // 2l / 0l
70  //
71  auto tt1l_unskim = Proc<Baby_full>("t#bar{t} (1l)", Process::Type::background, colors("tt_1l"),
72  {trig_mc+"*_TTJets*Lept*.root"},
73  "ntruleps<=1");
74  auto tt2l_unskim = Proc<Baby_full>("t#bar{t} (2l)", Process::Type::background, colors("tt_2l"),
75  {trig_mc+"*_TTJets*Lept*.root"},
76  "ntruleps>=2");
77  auto tt_unskim = Proc<Baby_full>("t#bar{t}", Process::Type::background, colors("tt_1l"),
78  {trig_mc+"*_TTJets_TuneCUETP8M1_13TeV*.root"});
79  auto dy_unskim = Proc<Baby_full>("DY", Process::Type::background, colors("wjets"),
80  {trig_mc+"*DYJetsToLL*HT*.root"});
81  auto qcd_unskim = Proc<Baby_full>("QCD", Process::Type::background, colors("qcd"),
82  {trig_mc+"*_QCD_HT700to1000*.root",trig_mc+"*_QCD_HT1000to1500*.root",
83  trig_mc+"*_QCD_HT1500to2000*.root",trig_mc+"*_QCD_HT2000toInf*.root"});
84  auto other_unskim = Proc<Baby_full>("Other", Process::Type::background, colors("ttv"),
85  {trig_mc+"*_TTWJet*root", trig_mc+"*_TTZTo*.root",
86  trig_mc+"*_ZJet*.root", trig_mc+"*_WWTo*.root",
87  trig_mc+"*ggZH_HToBB*.root", trig_mc+"*ttHJetTobb*.root",
88  trig_mc+"*_TTGJets*.root", trig_mc+"*_TTTT_*.root",
89  trig_mc+"*_WH_HToBB*.root", trig_mc+"*_WZTo*.root",
90  trig_skim_mc+"*_ST_*.root", trig_skim_mc+"*_WJetsToLNu*.root",
91  trig_mc+"*_ZH_HToBB*.root", trig_mc+"_ZZ_*.root"});
92 
93  auto data_2l = Proc<Baby_full>("Data", Process::Type::data, kBlack,
94  {"/net/cms2/cms2r0/babymaker/babies/2016_05_31/data/singlelep/combined/*.root"},"pass&&(trig[20]||trig[22])"); // 0.589 fb-1
95  vector<shared_ptr<Process> > full_trig_skim_2l = {data_2l, t1tttt_nc, t1tttt_c, tt1l_unskim, tt2l_unskim, dy_unskim, other_unskim};
96 
97  auto data_0l = Proc<Baby_full>("Data", Process::Type::data, kBlack,
98  {"/net/cms2/cms2r0/babymaker/babies/2016_05_31/data/jetht/*.root"},"pass&&trig[12]"); // FIXME: trigger
99  vector<shared_ptr<Process> > full_trig_skim_0l = {data_0l, t1tttt_nc, t1tttt_c, qcd_unskim, tt_unskim, other_unskim};
100 
101  PlotOpt log_lumi("txt/plot_styles.txt", "CMSPaper");
102  log_lumi.Title(TitleType::preliminary)
103  .Bottom(BottomType::ratio)
104  .YAxis(YAxisType::log)
105  .Stack(StackType::data_norm);
106  PlotOpt lin_lumi = log_lumi().YAxis(YAxisType::linear);
107  PlotOpt log_shapes = log_lumi().Stack(StackType::shapes)
108  .Bottom(BottomType::off)
109  .ShowBackgroundError(false);
110  PlotOpt lin_shapes = log_shapes().YAxis(YAxisType::linear);
111  PlotOpt log_lumi_info = log_lumi().Title(TitleType::info);
112  PlotOpt lin_lumi_info = lin_lumi().Title(TitleType::info);
113  PlotOpt log_shapes_info = log_shapes().Title(TitleType::info);
114  PlotOpt lin_shapes_info = lin_shapes().Title(TitleType::info);
115  vector<PlotOpt> all_plot_types = {log_lumi_info, lin_lumi_info};
116 
117 
118  string commoncut = "mt<140&&ht>500&&met>200";
119  PlotMaker pm;
120 
121 
125 
126  for(int ilep=2; ilep<3; ilep++)
127  {
128  string lepcut;
129  if(ilep==0) lepcut=commoncut+"&&nels==1&&nmus==0";
130  if(ilep==1) lepcut=commoncut+"&&nels==0&&nmus==1";
131  if(ilep==2) lepcut=commoncut+"&&nleps==1";
132 
133  //
134  // event-level variables except ones related to fatjet
135  //
136  pm.AddPlot(HistoDef(15, 500, 2000., "ht", "H_{T} [GeV]",
137  lepcut+"&&njets>=5&&nbm>=1", "weight", {500.}),
138  full_trig_skim_1l, all_plot_types);
139  pm.AddPlot(HistoDef(10, 200, 500., "met", "E_{T}^{miss} [GeV]",
140  lepcut+"&&njets>=5&&nbm>=1", "weight", {200., 350., 500.}),
141  full_trig_skim_1l, all_plot_types);
142  pm.AddPlot(HistoDef(16, -0.5, 15.5, "njets", "N_{jets}",
143  lepcut+"&&nbm>=1", "weight", {5.5, 8.5}),
144  full_trig_skim_1l, all_plot_types);
145 
146  pm.AddPlot(HistoDef(16, 0., 280., "mt", "m_{T} [GeV]",
147  lepcut+"&&njets>=5&&nbm>=1", "weight", {140.}),
148  full_trig_skim_1l, all_plot_types);
149 
150  //
151  // fatjets
152  //
153  pm.AddPlot(HistoDef(10, 0, 500., "fjets14_m[0]", "m_{J1} [GeV]",
154  lepcut+"&&njets>=5&&nbm>=1", "weight", {999.}),
155  full_trig_skim_1l, all_plot_types);
156  pm.AddPlot(HistoDef(20, 0, 400., "fjets14_m[0]", "m_{J1} [GeV]",
157  lepcut+"&&njets<=5&&nbm>=1", "weight", {999.}),
158  full_trig_skim_1l, all_plot_types);
159 
160  // event-level variables related to fatjet
161  pm.AddPlot(HistoDef(10, 0., 1500., "mj14", "M_{J} [GeV]",
162  lepcut+"&&njets>=5&&nbm>=1", "weight", {400.}),
163  full_trig_skim_1l, all_plot_types);
164 
165  }
166 
167 
171 
172  string mll="(mumu_m*(mumu_m>0&&mumu_pt1>30)+elel_m*(elel_m>0&&elel_pt1>30))";
173  string mllcut="(mumu_m*(mumu_m>0&&mumu_pt1>30)+elel_m*(elel_m>0&&elel_pt1>30))>80&&(mumu_m*(mumu_m>0&&mumu_pt1>30)+elel_m*(elel_m>0&&elel_pt1>30))<100";
174 
175  pm.AddPlot(HistoDef(10, 0., 1000., "mj14", "M_{J} [GeV]",
176  "nels==1&&nmus==1&&ht>300&&met>100&&njets>=2&&met<400&&nbm<3&&nbm>=1&&((leps_pt[0]>30&&leps_eta[0]<2.1&&leps_eta[0]>-2.1)||(leps_pt[1]>30&&leps_eta[1]<2.1&&leps_eta[1]>-2.1))", "weight", {400.}),
177  full_trig_skim_2l, all_plot_types);
178 
179  pm.AddPlot(HistoDef(10, 0., 1000., "mj14", "M_{J} [GeV]",
180  "(nmus>=2||nels>=2)&&ht>350&&njets>=4&&"+mllcut, "weight", {400.}),
181  full_trig_skim_2l, all_plot_types);
182 
186 
187  pm.AddPlot(HistoDef(30, 0., 1500., "mj14", "M_{J} [GeV]",
188  "nleps==0&&met<50&&ht>1000&&njets>=9", "weight", {400.}),
189  full_trig_skim_0l, all_plot_types);
190 
191  //
192  //
193  //
194  pm.MakePlots(lumi);
195 }
shared_ptr< Process > Proc(const string process_name, Process::Type type, int color, const set< string > &files, const string &cut="1")
PlotOpt & Stack(PlotOptTypes::StackType stack_type)
Definition: plot_opt.cpp:120
PlotOpt & YAxis(PlotOptTypes::YAxisType y_axis_type)
Definition: plot_opt.cpp:102
STL namespace.
Organizes efficient production of plots with single loop over each process.
Definition: plot_maker.hpp:14
PlotOpt & Bottom(PlotOptTypes::BottomType bottom_type)
Definition: plot_opt.cpp:93
PlotOpt & ShowBackgroundError(bool show_background_error)
Definition: plot_opt.cpp:386
void MakePlots(double luminosity, const std::string &subdir="")
Prints all added plots with given luminosity.
Definition: plot_maker.cpp:54
PlotOpt & Title(PlotOptTypes::TitleType title_type)
Definition: plot_opt.cpp:111
Loads colors from a text configuration file.
Definition: palette.hpp:8