ra4_draw  4bd0201e3d922d42bd545d4b045ed44db33454a4
plot_2016-06-03_prelim_status_mj_radii.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 = 10.0;
31 
32  string trig_skim_mc = "/net/cms27/cms27r0/babymaker/2016_04_29/mc/merged_baseline/";
33  string trig_skim_data = "/net/cms27/cms27r0/babymaker/2016_04_29/mc/T1tttt/skim_baseline/";
34 
35  Palette colors("txt/colors.txt", "default");
36 
37  auto tt = Proc<Baby_full>("t#bar{t}", Process::Type::background, colors("tt_1l"),
38  {trig_skim_mc+"*_TTJets*Lept*.root", trig_skim_mc+"*_TTJets_HT*.root"},
39  "stitch");
40 
41  auto t1tttt_nc = Proc<Baby_full>("T1tttt(1800,200)", Process::Type::signal, colors("t1tttt"),
42  {trig_skim_data+"*SMS-T1tttt_mGluino-1800_mLSP-200_*.root"});
43  auto t1tttt_c = Proc<Baby_full>("T1tttt(1400,1000)", Process::Type::signal, colors("t1tttt"),
44  {trig_skim_data+"*SMS-T1tttt_mGluino-1400_mLSP-1000_*.root"});
45  t1tttt_c->SetLineStyle(2);
46 
47  vector<shared_ptr<Process> > full_trig_skim = {t1tttt_nc, t1tttt_c, tt};
48 
49  PlotOpt log_lumi("txt/plot_styles.txt", "CMSPaper");
50  log_lumi.Title(TitleType::preliminary)
51  .Bottom(BottomType::ratio)
52  .YAxis(YAxisType::log)
53  .Stack(StackType::data_norm)
54  .FileExtensions({"pdf","root"});
55  PlotOpt lin_lumi = log_lumi().YAxis(YAxisType::linear);
56  PlotOpt log_shapes = log_lumi().Stack(StackType::shapes)
57  .Bottom(BottomType::off)
58  .ShowBackgroundError(false);
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, lin_lumi, log_shapes, lin_shapes,
65  log_lumi_info, lin_lumi_info, log_shapes_info, lin_shapes_info};
66 
67  PlotMaker pm;
68  pm.AddPlot(HistoDef(30, 0., 1500., "mj", "M_{J}^{R=1.2} [GeV]",
69  "nleps==1&&ht>500&&met>200&&njets>=6&&nbm>=1", "weight", {250., 400.}),
70  full_trig_skim, all_plot_types);
71  pm.AddPlot(HistoDef(30, 0., 1500., "mj14", "M_{J}^{R=1.4} [GeV]",
72  "nleps==1&&ht>500&&met>200&&njets>=6&&nbm>=1", "weight", {250., 400.}),
73  full_trig_skim, all_plot_types);
74 
75  pm.MakePlots(lumi);
76 }
PlotOpt & Stack(PlotOptTypes::StackType stack_type)
Definition: plot_opt.cpp:120
PlotOpt & FileExtensions(const std::set< std::string > &file_extensions)
Definition: plot_opt.cpp:138
PlotOpt & YAxis(PlotOptTypes::YAxisType y_axis_type)
Definition: plot_opt.cpp:102
STL namespace.
shared_ptr< Process > Proc(const string process_name, Process::Type type, int color, const set< string > &files, const string &cut="1")
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