ra4_macros  bede988c286599a3a84b77a4d788ac0a971e89f9
plot_paper.cxx
Go to the documentation of this file.
1 // plot_dps: Macro that plots variables both for comissioning DPS
2 
3 #include <iostream>
4 #include <vector>
5 
6 #include "TChain.h"
7 #include "TH1D.h"
8 #include "TCanvas.h"
9 #include "TLegend.h"
10 #include "TLine.h"
11 #include "TString.h"
12 #include "TColor.h"
13 
14 #include "styles.hpp"
15 #include "utilities.hpp"
16 #include "utilities_macros.hpp"
17 
18 namespace {
19  TString luminosity="2.3";
20  int stcolor(42);
21  TString plot_type=".pdf";
22  TString plot_style="CMSPaper";
23 }
24 
25 using namespace std;
26 using std::cout;
27 using std::endl;
28 
29 int main(){
30 
31  TString bfolder("");
32  string hostname = execute("echo $HOSTNAME");
33  if(Contains(hostname, "cms") || Contains(hostname, "compute-"))
34  bfolder = "/net/cms2"; // In laptops, you can't create a /net folder
35 
36  TString folder1l(bfolder+"/cms2r0/babymaker/babies/2016_02_04/data/singlelep/combined/skim_1lht500met200/");
37  TString foldermc(bfolder+"/cms2r0/babymaker/babies/2015_11_28/mc/skim_1lht500met200/");
38 
39  vector<TString> s_slep;
40  s_slep.push_back(folder1l+"*root"); // With "__Single" you exclude the extra 48 ipb
41 
42 
43  vector<TString> s_t1t;
44  s_t1t.push_back(foldermc+"*T1tttt*1500_*");
45  vector<TString> s_t1tc;
46  s_t1tc.push_back(foldermc+"*T1tttt*1200_*");
47  vector<TString> s_tt;
48  s_tt.push_back(foldermc+"*_TTJets*Lept*");
49  s_tt.push_back(foldermc+"*_TTJets_HT*");
50  vector<TString> s_wjets;
51  s_wjets.push_back(foldermc+"*_WJetsToLNu*");
52  vector<TString> s_ttv;
53  s_ttv.push_back(foldermc+"*_TTWJets*");
54  s_ttv.push_back(foldermc+"*_TTZTo*");
55  vector<TString> s_single;
56  s_single.push_back(foldermc+"*_ST_*");
57  vector<TString> s_other;
58  s_other.push_back(foldermc+"*DYJetsToLL*");
59  s_other.push_back(foldermc+"*_QCD_HT*");
60  s_other.push_back(foldermc+"*_ZJet*");
61  s_other.push_back(foldermc+"*_WWTo*");
62  s_other.push_back(foldermc+"*ggZH_HToBB*");
63  s_other.push_back(foldermc+"*ttHJetTobb*");
64 
65 
66  // Reading ntuples
67  int sigcolor(2);
68  TString lsp = "{#lower[-0.1]{#tilde{#chi}}#lower[0.2]{#scale[0.85]{^{0}}}#kern[-1.3]{#scale[0.85]{_{1}}}}";
69  TString t1t_label = "#scale[0.95]{#tilde{g}#kern[0.2]{#tilde{g}}, #tilde{g}#rightarrowt#kern[0.18]{#bar{t}}#kern[0.18]"+lsp;
70  vector<sfeats> Samples;
71  Samples.push_back(sfeats(s_slep, "Data", kBlack,1,"(trig[4]||trig[8])&&pass")); Samples.back().isData = true;
72  Samples.push_back(sfeats(s_t1t, t1t_label+" (1500,100)}", sigcolor, 1));
73  Samples.push_back(sfeats(s_t1tc, t1t_label+" (1200,800)}", sigcolor, 2));
74  Samples.push_back(sfeats(s_tt, "t#bar{t}, 1 true lepton", dps::c_tt_1l, 1,"ntruleps<=1&&stitch"));
75  Samples.push_back(sfeats(s_tt, "t#bar{t}, 2 true leptons", dps::c_tt_2l,1,"ntruleps>=2&&stitch"));
76  Samples.push_back(sfeats(s_wjets, "W+jets", dps::c_wjets,1));
77  Samples.push_back(sfeats(s_single, "Single t", stcolor));
78  Samples.push_back(sfeats(s_ttv, "ttV", ra4::c_ttv));
79  Samples.push_back(sfeats(s_other, "Other", 2001, 1));
80 
81  vector<int> ra4_sam;
82  unsigned nsam(Samples.size());
83  for(unsigned sam(0); sam < nsam; sam++){
84  ra4_sam.push_back(sam);
85  } // Loop over samples
86 
87 
88  int imj(Samples.size());
89  Samples.push_back(sfeats(s_slep, "Data, m_{T} > 140 GeV", kBlack,1,"(trig[4]||trig[8])&&pass&&mt>140")); Samples.back().isData=true;
90  Samples.push_back(sfeats(s_slep, "Data, m_{T} #leq 140 GeV", kBlue+2,1,"(trig[4]||trig[8])&&pass&&mt<=140"));
91  Samples.back().doBand = true;
92  Samples.push_back(sfeats(s_t1t, t1t_label+" (1500,100)}", sigcolor, 1, "mt>140"));
93  Samples.push_back(sfeats(s_t1tc, t1t_label+" (1200,800)}", sigcolor, 2, "mt>140"));
94  vector<int> mj_sam;
95  mj_sam.push_back(imj);
96  mj_sam.push_back(imj+1);
97  mj_sam.push_back(imj+2);
98  mj_sam.push_back(imj+3);
99 
100 
101  vector<hfeats> vars_mt;
102  vector<hfeats> vars_mj;
103 
104 
105  // bool do_mt = true;
106 
107 
108  plot_style="CMSPaper";
109  vars_mt.push_back(hfeats("mt",12,0,420, ra4_sam, "m_{T} [GeV]",
110  "nleps==1&&ht>500&&met>200&&pass&&njets>=6&&nbm>=1",140, "baseline"));
111  vars_mt.back().whichPlots = "1"; vars_mt.back().normalize = true;
112 
113  plot_distributions(Samples, vars_mt, luminosity, plot_type, plot_style, "paper",true);
114 
115  plot_style="CMSPaperNoRatio";
116  vars_mj.push_back(hfeats("mj",10,25,775, mj_sam, "M_{J} [GeV]",
117  "nleps==1&&ht>500&&met>200&&pass&&njets>=6&&nbm==1",400,"results"));
118  vars_mj.back().whichPlots = "2"; vars_mj.back().normalize = true; vars_mj.back().moveRLegend = -0.05;
119  vars_mj.push_back(hfeats("mj",10,25,775, mj_sam, "M_{J} [GeV]",
120  "nleps==1&&ht>500&&met>200&&pass&&njets>=6&&nbm>=2",400,"results"));
121  vars_mj.back().whichPlots = "2"; vars_mj.back().normalize = true; vars_mj.back().moveRLegend = -0.05;
122 
123  plot_distributions(Samples, vars_mj, luminosity, plot_type, plot_style, "paper",false);
124 
125 
126 }
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)
bool Contains(const std::string &text, const std::string &pattern)
STL namespace.
int main()
Definition: plot_paper.cxx:29
std::string execute(const std::string &cmd)