ra4_draw  4bd0201e3d922d42bd545d4b045ed44db33454a4
plot_tt_comp.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 "core/baby.hpp"
10 #include "core/hist1d.hpp"
11 #include "core/process.hpp"
12 #include "core/named_func.hpp"
13 #include "core/plot_maker.hpp"
14 #include "core/plot_opt.hpp"
15 #include "core/palette.hpp"
16 #include "core/utilities.hpp"
17 
18 using namespace std;
19 using namespace PlotOptTypes;
20 
21 int main(){
22  gErrorIgnoreLevel = 6000;
23 
24  double lumi = 2.6;
25 
26  string mc_amcatnlo_lo = "/homes/cawest/links/TTJets_TuneCUETP8M1_13TeV-madgraphMLM/";
27  string mc_powheg = "/homes/cawest/links/TT_TuneCUETP8M1_13TeV-powheg-pythia8/";
28  string mc_amcatnlo_nlo = "/homes/cawest/links/TTJets_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8/";
29 
30  Palette colors("txt/colors.txt", "default");
31 
32  //tt amcanlo lo
33  auto tt_amcatnlo_lo = Process::MakeShared<Baby_full>("t#bar{t}, aMC@NLO (LO, MLM)", Process::Type::background, kBlack,
34  {mc_amcatnlo_lo+"*TTJets_TuneCUETP8M1*madgraphMLM*.root"});
35  //tt Powheg
36  auto tt_powheg = Process::MakeShared<Baby_full>("t#bar{t}, Powheg", Process::Type::background, kRed,
37  {mc_powheg+"*_TT_*powheg*.root"});
38  tt_powheg->SetLineStyle(2);
39  //tt amcanlo nlo
40  auto tt_amcatnlo_nlo = Process::MakeShared<Baby_full>("t#bar{t}, aMC@NLO (NLO, FxFx)", Process::Type::background, kBlue,
41  {mc_amcatnlo_nlo+"*TTJets_TuneCUETP8M1*amcatnlo*.root"});
42  tt_amcatnlo_nlo->SetLineStyle(3);
43 
44  vector<shared_ptr<Process> > tt_sams = {tt_amcatnlo_lo, tt_powheg, tt_amcatnlo_nlo};
45 
46  //
47  PlotOpt log_lumi("txt/plot_styles.txt", "CMSPaper");
48  log_lumi.Title(TitleType::preliminary)
49  .Bottom(BottomType::ratio)
50  .YAxis(YAxisType::log)
51  .Stack(StackType::data_norm)
52  .FileExtensions({"pdf"});
53 
54  PlotOpt lin_lumi = log_lumi().YAxis(YAxisType::linear);
55  PlotOpt log_shapes = log_lumi().Stack(StackType::shapes)
56  .Bottom(BottomType::ratio)
57  .ShowBackgroundError(false);
58  PlotOpt lin_shapes = log_shapes().YAxis(YAxisType::linear);
59  PlotOpt log_lumi_info = log_lumi().Title(TitleType::info);
60  PlotOpt lin_lumi_info = lin_lumi().Title(TitleType::info);
61  PlotOpt log_shapes_info = log_shapes().Title(TitleType::info).Bottom(BottomType::ratio).Stack(StackType::data_norm);
62  PlotOpt lin_shapes_info = lin_shapes().Title(TitleType::info).Bottom(BottomType::ratio).Stack(StackType::data_norm);
63  vector<PlotOpt> plot_types = {log_shapes};
64 
65  PlotMaker pm;
66 
67  NamedFunc rpv_wgt("weight*w_pu_rpv/eff_trig");
68 
69  // 0-lepton selection
70  pm.Push<Hist1D>(Axis(6, 0, 6, "nbm", "N_{b}"),
71  "nleps==0", tt_sams, plot_types).Weight(rpv_wgt);
72  pm.Push<Hist1D>(Axis(25, 0, 2500, "mj", "M_{J} [GeV]"),
73  "nleps==0", tt_sams, plot_types).Weight(rpv_wgt);
74  pm.Push<Hist1D>(Axis(20, 0, 20, "njets", "N_{jets}"),
75  "nleps==0", tt_sams, plot_types).Weight(rpv_wgt);
76  pm.Push<Hist1D>(Axis(40, 0, 4000, "ht", "H_{T} [GeV]"),
77  "nleps==0", tt_sams, plot_types).Weight(rpv_wgt);
78 
79  pm.Push<Hist1D>(Axis(6, 0, 6, "nbm", "N_{b}"),
80  "nleps==0&&ht>1500&&njets>=4&&mj>500&&nbm>=1", tt_sams, plot_types).Weight(rpv_wgt);
81  pm.Push<Hist1D>(Axis(25, 0, 2500, "mj", "M_{J} [GeV]"),
82  "nleps==0&&ht>1500&&njets>=4&&mj>500&&nbm>=1", tt_sams, plot_types).Weight(rpv_wgt);
83  pm.Push<Hist1D>(Axis(20, 0, 20, "njets", "N_{jets}"),
84  "nleps==0&&ht>1500&&njets>=4&&mj>500&&nbm>=1", tt_sams, plot_types).Weight(rpv_wgt);
85  pm.Push<Hist1D>(Axis(40, 0, 4000, "ht", "H_{T} [GeV]"),
86  "nleps==0&&ht>1500&&njets>=4&&mj>500&&nbm>=1", tt_sams, plot_types).Weight(rpv_wgt);
87 
88  pm.Push<Hist1D>(Axis(6, 0, 6, "nbm", "N_{b}"),
89  "nleps==0&&ht>1500&&njets>=8&&mj>500&&nbm>=1", tt_sams, plot_types).Weight(rpv_wgt);
90  pm.Push<Hist1D>(Axis(25, 0, 2500, "mj", "M_{J} [GeV]"),
91  "nleps==0&&ht>1500&&njets>=8&&mj>500&&nbm>=1", tt_sams, plot_types).Weight(rpv_wgt);
92  pm.Push<Hist1D>(Axis(20, 0, 20, "njets", "N_{jets}"),
93  "nleps==0&&ht>1500&&njets>=8&&mj>500&&nbm>=1", tt_sams, plot_types).Weight(rpv_wgt);
94  pm.Push<Hist1D>(Axis(40, 0, 4000, "ht", "H_{T} [GeV]"),
95  "nleps==0&&ht>1500&&njets>=8&&mj>500&&nbm>=1", tt_sams, plot_types).Weight(rpv_wgt);
96 
97  // 1-lepton selectio
98  pm.Push<Hist1D>(Axis(6, 0, 6, "nbm", "N_{b}"),
99  "nleps==1", tt_sams, plot_types).Weight(rpv_wgt);
100  pm.Push<Hist1D>(Axis(25, 0, 2500, "mj", "M_{J} [GeV]"),
101  "nleps==1", tt_sams, plot_types).Weight(rpv_wgt);
102  pm.Push<Hist1D>(Axis(20, 0, 20, "njets", "N_{jets}"),
103  "nleps==1", tt_sams, plot_types).Weight(rpv_wgt);
104  pm.Push<Hist1D>(Axis(40, 0, 4000, "ht", "H_{T} [GeV]"),
105  "nleps==1", tt_sams, plot_types).Weight(rpv_wgt);
106 
107  pm.Push<Hist1D>(Axis(6, 0, 6, "nbm", "N_{b}"),
108  "nleps==1&&ht>1200&&njets>=4&&mj>500&&nbm>=1", tt_sams, plot_types).Weight(rpv_wgt);
109  pm.Push<Hist1D>(Axis(25, 0, 2500, "mj", "M_{J} [GeV]"),
110  "nleps==1&&ht>1200&&njets>=4&&mj>500&&nbm>=1", tt_sams, plot_types).Weight(rpv_wgt);
111  pm.Push<Hist1D>(Axis(20, 0, 20, "njets", "N_{jets}"),
112  "nleps==1&&ht>1200&&njets>=4&&mj>500&&nbm>=1", tt_sams, plot_types).Weight(rpv_wgt);
113  pm.Push<Hist1D>(Axis(40, 0, 4000, "ht", "H_{T} [GeV]"),
114  "nleps==1&&ht>1200&&njets>=4&&mj>500&&nbm>=1", tt_sams, plot_types).Weight(rpv_wgt);
115 
116  pm.Push<Hist1D>(Axis(6, 0, 6, "nbm", "N_{b}"),
117  "nleps==1&&ht>1200&&njets>=8&&mj>500&&nbm>=1", tt_sams, plot_types).Weight(rpv_wgt);
118  pm.Push<Hist1D>(Axis(25, 0, 2500, "mj", "M_{J} [GeV]"),
119  "nleps==1&&ht>1200&&njets>=8&&mj>500&&nbm>=1", tt_sams, plot_types).Weight(rpv_wgt);
120  pm.Push<Hist1D>(Axis(20, 0, 20, "njets", "N_{jets}"),
121  "nleps==1&&ht>1200&&njets>=8&&mj>500&&nbm>=1", tt_sams, plot_types).Weight(rpv_wgt);
122  pm.Push<Hist1D>(Axis(40, 0, 4000, "ht", "H_{T} [GeV]"),
123  "nleps==1&&ht>1200&&njets>=8&&mj>500&&nbm>=1", tt_sams, plot_types).Weight(rpv_wgt);
124 
125  pm.MakePlots(lumi);
126 }
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.
Combines a callable function taking a Baby and returning a scalar or vector with its string represent...
Definition: named_func.hpp:13
FigureType & Push(Args &&...args)
Definition: plot_maker.hpp:24
Definition: axis.hpp:12
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
int main()
A full 1D plot with stacked/overlayed histograms.
Definition: hist1d.hpp:23
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