20 marker_class(
float icut,
float isize,
int icolor,
int istyle);
27 var_class(TString ivarname,
float iminx,
float imaxx, TString ititle,
int icolor,
28 int istyle=1, std::vector<marker_class> icuts=std::vector<marker_class>());
29 TString title, varname;
31 std::vector<marker_class> cuts;
37 void makePlot(vector<sfeats> Samples, vector<TChain *> chain, TString cuts);
44 string hostname =
execute(
"echo $HOSTNAME");
46 bfolder =
"/net/cms2";
48 TString folder=bfolder+
"/cms2r0/babymaker/babies/2015_01_30/small_tree/";
50 vector<TString> s_t1t;
51 s_t1t.push_back(folder+
"*T1tttt*1500_mLSP-100*");
52 vector<TString> s_t1tc;
53 s_t1tc.push_back(folder+
"*T1tttt*1200_mLSP-800*");
55 s_tt.push_back(folder+
"*_TTJets*");
59 TString
lsp =
"{#lower[-0.1]{#tilde{#chi}}#lower[0.2]{#scale[0.85]{^{0}}}#kern[-1.3]{#scale[0.85]{_{1}}}}";
60 TString t1t_label =
"#tilde{g}#kern[0.2]{#tilde{g}}, #tilde{g}#rightarrowt#kern[0.18]{#bar{t}}#kern[0.18]"+
lsp;
61 vector<sfeats> Samples;
62 Samples.push_back(
sfeats(s_tt,
"t#bar{t}", kRed+1));
63 Samples.push_back(
sfeats(s_t1t, t1t_label+
" (1500,100)", kAzure+2));
64 Samples.push_back(
sfeats(s_t1tc, t1t_label+
" (1200,800)", kGreen+1));
67 vector<TChain *> chain;
68 for(
unsigned sam(0); sam < Samples.size(); sam++){
69 chain.push_back(
new TChain(
"tree"));
70 for(
unsigned insam(0); insam < Samples[sam].file.size(); insam++){
71 chain[sam]->Add(Samples[sam].
file[insam]);
76 vector<var_class> mj_vars;
77 mj_vars.push_back(
var_class(
"mj_cands",2200,0,
"M_{J} with PFcands",kMagenta,1));
78 mj_vars.push_back(
var_class(
"mj_cands_trim",2200,0,
"M_{J} with PFcands trimmed",kRed,1));
79 mj_vars.push_back(
var_class(
"mj_10",2200,0,
"M_{J} with 10 GeV jets",kGreen+1,1));
80 mj_vars.push_back(
var_class(
"mj_30", 2200,0,
"M_{J} with 30 GeV jets",kAzure+2,1));
81 TLatex label; label.SetNDC(kTRUE);
82 label.SetTextSize(0.052);
83 label.SetTextAlign(31);
87 double legSingle = 0.08;
89 TLegend
leg(legX,legY-legH, legX+legW, legY);
90 leg.SetTextSize(0.05); leg.SetFillColor(0); leg.SetBorderSize(0); leg.SetFillStyle(0);
91 float minh = 5, maxh = 40;
92 int nbins = (maxh-minh)/5;
94 vector<TH1D*> histo[2];
95 for(
unsigned sam(0); sam < Samples.size(); sam++){
96 for(
unsigned var(0); var<mj_vars.size(); var++){
97 for(
size_t ind(0); ind<2; ind++){
98 hname =
"histo"; hname += sam; hname += var; hname += ind;
99 histo[ind].push_back(
new TH1D(hname,
"", nbins, minh, maxh));
100 histo[ind][var]->Sumw2();
102 histo[ind][var]->SetLineColor(mj_vars[var].
color);
103 histo[ind][var]->SetLineWidth(4);
104 style.
setTitles(histo[ind][var],
"True n_{PV}",
"#epsilon^{norm} for M_{J} > "+mjcut+
" GeV",
105 "#scale[0.8]{#font[62]{CMS}} #scale[0.6]{#font[52]{Supplementary (Simulation)}}",
"#scale[0.8]{13 TeV}");
106 histo[ind][var]->SetBinContent(nbins, histo[ind][var]->GetBinContent(nbins)+
107 histo[ind][var]->GetBinContent(nbins+1));
109 chain[sam]->Project(histo[0][var]->GetName(),
"ntrupv",
"1*("+mj_vars[var].varname+
">"+mjcut+
")");
110 chain[sam]->Project(histo[1][var]->GetName(),
"ntrupv",
"1");
111 histo[0][var]->Divide(histo[1][var]);
112 histo[0][var]->Scale(1/histo[0][var]->GetBinContent(4));
113 histo[0][var]->SetMinimum(0.15);
114 histo[0][var]->SetMaximum(2.1);
115 leg.AddEntry(histo[0][var], mj_vars[var].title);
117 histo[0][var]->Draw(
"");
118 TLine line; line.SetLineStyle(2);
119 line.DrawLine(minh, 1, maxh, 1);
120 }
else histo[0][var]->Draw(
"same");
125 TString pname =
"plots/eff_pu_"+
format_tag(Samples[sam].label)+
".pdf";
129 for(
unsigned var(0); var<mj_vars.size(); var++){
130 for(
size_t ind(0); ind<2; ind++)
131 histo[ind][var]->Delete();
141 int istyle, vector<marker_class> icuts){
142 varname = ivarname; minx = iminx; maxx = imaxx; title = ititle;
bool Contains(const std::string &text, const std::string &pattern)
std::string execute(const std::string &cmd)
TString format_tag(TString tag)
void makePlot(vector< sfeats > Samples, vector< TChain * > chain, TString cuts)
void setTitles(TH1 *h, TString xTitle="", TString yTitle="", TString Left="", TString Right="")
marker_class(float icut, float isize, int icolor, int istyle)
var_class(std::vector< sample_class > samples, TString ivarname, float iminx, float imaxx, TString ititle, int icolor, int istyle=1, std::vector< marker_class > icuts=std::vector< marker_class >())