ra4_macros  bede988c286599a3a84b77a4d788ac0a971e89f9
plot_gs.cxx
Go to the documentation of this file.
1 // plot_note: Macro that plots the Nb distribution with and without additional gluon splitting
2 
3 #include <iostream>
4 #include <vector>
5 #include "TChain.h"
6 #include "TH1D.h"
7 #include "TCanvas.h"
8 #include "TLegend.h"
9 #include "TLine.h"
10 #include "TString.h"
11 #include "TColor.h"
12 
13 #include "styles.hpp"
14 #include "utilities.hpp"
15 #include "utilities_macros.hpp"
16 #include "utilities_macros_rpv.hpp"
17 
18 namespace {
19  TString plot_type=".pdf";
20  TString plot_style="CMSPaper";
21  int section(11);
22 }
23 
24 using namespace std;
25 using std::cout;
26 using std::endl;
27 
28 
29 int main(){
30  std::string extraWeight("w_lumi/weight");
31  std::string extraWeightGsUp("w_lumi/weight*(1+0.2*fromGS)");
32  std::string extraWeightGs("w_lumi/weight*(fromGS)");
33  std::string extraWeightGsDown("w_lumi/weight*(1-0.2*fromGS)");
34 
35  bool showData=false;
36 
37  TString folder_links="/homes/cawest/links/";
38 
39  vector<TString> s_tt_MLM;
40  s_tt_MLM.push_back(filestring("TTJets_TuneCUETP8M1_13TeV-madgraphMLM", false));
41  vector<TString> s_tt_amcatnlo;
42  s_tt_amcatnlo.push_back(filestring("TTJets_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8", false));
43  vector<TString> s_tt_powheg;
44  s_tt_powheg.push_back(filestring("TT_TuneCUETP8M1_13TeV-powheg-pythia8", false));
45  vector<TString> s_qcd;
46  s_qcd.push_back(filestring("QCD*HT", false));
47 
48  // Reading ntuples
49  vector<sfeats> Samples;
50  // Samples.push_back(sfeats(s_tt_powheg, "t#bar{t}, GS up 20%", ra4::c_t1tttt, 2, cutandweight("1", extraWeightGsUp)));
51  // Samples.back().doStack = false;
52  Samples.push_back(sfeats(s_tt_MLM, "t#bar{t}", ra4::c_t1tttt, 1, cutandweight("1", extraWeight)));
53  Samples.back().doStack = false;
54  Samples.push_back(sfeats(s_qcd, "QCD", ra4::c_t1tttt, 1, cutandweight("1", extraWeight)));
55  Samples.back().doStack = false;
56  // Samples.push_back(sfeats(s_tt_powheg, "t#bar{t}, GS down %20", kBlack, 2, cutandweight("1", extraWeightGsDown)));
57  // Samples.back().doStack = false;
58  // Samples.push_back(sfeats(s_tt_powheg, "t#bar{t}, GS only", kBlue, 1, cutandweight("1", extraWeightGs)));
59  // Samples.back().doStack = false;
60 
61 
62 
63  // Adding non-skimmed samples
64  vector<int> ra4_sam, ra4_sam_ns;
65  unsigned nsam(Samples.size());
66  for(unsigned sam(0); sam < nsam; sam++){
67  ra4_sam.push_back(sam);
68  } // Loop over samples
69 
70  vector<hfeats> vars;
71 
72  switch(section){
73  case 11:
74 
75  if(!showData) {
76 
77  std::vector<TString> cutlist = {"(nmus+nels)==0",
78  "(nmus+nels)==1",
79  "(nmus+nels)==0&&nbm>=1&&mj>500&&njets>=4&&ht>1500",
80  "(nmus+nels)==1&&nbm>=1&&mj>500&&njets>=4&&ht>1200"};
81  for(auto icut : cutlist) {
82  vars.push_back(hfeats("nbm",6, 0, 6, ra4_sam, "N_{b}", icut));
83  vars.push_back(hfeats("dr_bb",8, 0, 6.4, ra4_sam, "dr_bb", icut));
84  vars.push_back(hfeats("dr_bb",8, 0, 6.4, ra4_sam, "dr_bb", icut+"&&fromGS"));
85  vars.push_back(hfeats("dr_bb",8, 0, 6.4, ra4_sam, "dr_bb", icut+"&&!fromGS"));
86  vars.back().normalize = true;
87  }
88 
89 
90  }
91  else {
92  TString cuts("(nmus+nels)==1");
93  cuts = "(nmus+nels)==1&&ht>1000&&ht<1500&&nbm>=1";
94  vars.push_back(hfeats("njets",15, 0, 15, ra4_sam, "N_{jets}", cuts));
95  vars.back().normalize = true;
96  cuts = "(nmus+nels)==1&&ht>1000&&ht<1500&&nbt>=1&&njets==5";
97  vars.push_back(hfeats("nbt",6, 0, 6, ra4_sam, "N_{b,tight}", cuts));
98  vars.back().normalize = true;
99  cuts = "(nmus+nels)==1&&ht>1000&&ht<1500&&nbm>=1&&njets==5";
100  vars.push_back(hfeats("nbm",6, 0, 6, ra4_sam, "N_{b}", cuts));
101  vars.back().normalize = true;
102  vars.push_back(hfeats("mj",12, 0, 600, ra4_sam, "M_{J} (GeV)", cuts));
103  vars.back().normalize = true;
104  vars.push_back(hfeats("Max$(jets_pt)",20, 0, 1000, ra4_sam, "p_{T1} (GeV)", cuts));
105  vars.back().normalize = true;
106  vars.push_back(hfeats("(jets_csv-0.89)/0.11", 10, 0, 1, ra4_sam, "(CSV-CSV_{cut})/(CSV_{max}-CSV_{cut})", cuts));
107  vars.back().normalize = true;
108  }
109  default:
110  break;
111  }
112 
113  if(showData) {
114  plot_distributions(Samples, vars, rpv::luminosity, plot_type, plot_style, "gs", true);
115  }
116  else {
117  plot_distributions(Samples, vars, rpv::luminosity, plot_type, plot_style, "gs", false);
118  }
119 }
120 
void plot_distributions(std::vector< sfeats > Samples, std::vector< hfeats > vars, TString luminosity="10", TString filetype=".eps", TString namestyle="LargeLabels", TString dir="1d", bool doRatio=false, bool showcuts=false)
STL namespace.
int main()
Definition: plot_gs.cxx:29
std::string cutandweight(std::string cut, std::string weight)
TString luminosity
TString filestring(TString dataset, bool isSkimmed=true)