21 marker_class(
float icut,
float isize,
int icolor,
int istyle);
28 var_class(TString ivarname,
float iminx,
float imaxx, TString ititle,
int icolor,
29 int istyle=1, std::vector<marker_class> icuts=std::vector<marker_class>());
30 TString title, varname;
32 std::vector<marker_class> cuts;
43 string hostname =
execute(
"echo $HOSTNAME");
45 bfolder =
"/net/cms2";
47 TString folder=bfolder+
"/cms2r0/babymaker/babies/2015_01_30/small_tree/";
49 vector<TString> s_t1t;
50 s_t1t.push_back(folder+
"*T1tttt*1500_mLSP-100*");
51 vector<TString> s_t1tc;
52 s_t1tc.push_back(folder+
"*T1tttt*1200_mLSP-800*");
54 s_tt.push_back(folder+
"*_TTJets*");
58 TString
lsp =
"{#lower[-0.1]{#tilde{#chi}}#lower[0.2]{#scale[0.85]{^{0}}}#kern[-1.3]{#scale[0.85]{_{1}}}}";
59 TString t1t_label =
"#tilde{g}#kern[0.2]{#tilde{g}}, #tilde{g}#rightarrowt#kern[0.18]{#bar{t}}#kern[0.18]"+
lsp;
60 vector<sfeats> Samples;
62 Samples.push_back(
sfeats(s_t1tc, t1t_label+
" (1200,800)", kGreen+1));
63 Samples.push_back(
sfeats(s_tt,
"t#bar{t}", kRed+1));
66 vector<TChain *> chain;
67 for(
unsigned sam(0); sam < Samples.size(); sam++){
68 chain.push_back(
new TChain(
"tree"));
69 for(
unsigned insam(0); insam < Samples[sam].file.size(); insam++){
70 chain[sam]->Add(Samples[sam].
file[insam]);
73 TString mj_s(
"M#lower[-.1]{_{J}}");
74 vector<var_class> mj_vars;
75 mj_vars.push_back(
var_class(
"mj_cands",2200,0,mj_s+
" with PFcands",kMagenta+1,1));
76 mj_vars.push_back(
var_class(
"mj_cands_trim",2200,0,mj_s+
" with PFcands trim",kRed,1));
77 mj_vars.push_back(
var_class(
"mj_10",2200,0,mj_s+
" with 10 GeV jets",kGreen+1,1));
78 mj_vars.push_back(
var_class(
"mj_30", 2200,0,mj_s+
" with 30 GeV jets",kAzure+2,1));
79 TLatex label; label.SetNDC(kTRUE);
80 label.SetTextSize(0.052);
81 label.SetTextAlign(31);
85 double legSingle = 0.06;
87 TLegend
leg(legX,legY-legH, legX+legW, legY);
88 leg.SetTextSize(0.045); leg.SetFillColor(0); leg.SetBorderSize(0); leg.SetFillStyle(0);
89 float binw=5., minh[] = {5,0}, maxh[] = {40,1000};
90 int nbins[] = {
static_cast<int>((maxh[0]-minh[0])/binw), 400};
91 TF1 linFit(
"linFit",
"[0]+[1]*x", minh[0], maxh[0]);
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[ind], minh[ind], maxh[ind]));
100 histo[ind][var]->Sumw2();
102 histo[ind][var]->SetLineColor(mj_vars[var].
color);
103 histo[ind][var]->SetLineWidth(4);
105 for(
int bin=1; bin<=nbins[0]; bin++){
106 TString cuts =
"weight*(ntrupv>="+
RoundNumber(minh[0]+(bin-1)*binw,1)+
"&&ntrupv<"+
RoundNumber(minh[0]+bin*binw,1)+
")";
107 chain[sam]->Project(histo[1][var]->GetName(), mj_vars[var].varname, cuts);
108 histo[0][var]->SetBinContent(bin, histo[1][var]->GetMean());
109 histo[0][var]->SetBinError(bin, histo[1][var]->GetMeanError());
111 histo[0][var]->SetMinimum(0);
112 histo[0][var]->SetMaximum(histo[0][var]->GetMaximum()*1.6);
113 histo[0][var]->Fit(&linFit,
"QEMN+");
115 leg.AddEntry(histo[0][var], mj_vars[var].title+
" (<"+mj_s+
"#kern[0.3]{>} = "+mean0+
" + "+slope+
"n_{PV})");
117 histo[0][var]->Draw(
"");
118 style.
setTitles(histo[0][var],
"True n_{PV}",
"Average "+mj_s+
" [GeV]",
119 "#scale[0.8]{#font[62]{CMS}} #scale[0.6]{#font[52]{Supplementary (Simulation)}}",
"#scale[0.8]{13 TeV}");
120 TLine line; line.SetLineStyle(2);
121 line.DrawLine(minh[0], 1, maxh[0], 1);
122 }
else histo[0][var]->Draw(
"same");
126 Samples[sam].label.ReplaceAll(t1t_label,
"T1tttt");
127 TString pname =
"plots/mj_pu_"+
format_tag(Samples[sam].label)+
".pdf";
131 for(
unsigned var(0); var<mj_vars.size(); var++){
132 for(
size_t ind(0); ind<2; ind++)
133 histo[ind][var]->Delete();
143 int istyle, vector<marker_class> icuts){
144 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)
TString RoundNumber(double num, int decimals, double denom=1.)
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 >())