29 TString folder=
"archive/15-03-17/skims/";
30 vector<TString> bkgfiles;
31 bkgfiles.push_back(folder+
"*_TTJet*");
32 bkgfiles.push_back(folder+
"*_WJets*");
33 bkgfiles.push_back(folder+
"*_T*channel*");
34 bkgfiles.push_back(folder+
"*TTW*");
35 bkgfiles.push_back(folder+
"*TTZ*");
36 bkgfiles.push_back(folder+
"*QCD_HT*");
37 bkgfiles.push_back(folder+
"*_ZJet*");
38 bkgfiles.push_back(folder+
"*DY*");
39 bkgfiles.push_back(folder+
"*WH_HToBB*");
41 bool do_t1t(
true),
do_2b(
true);
42 int colors[] = {4,kGreen+2};
43 TString leglab[] = {
"Total bkg.",
"T1tttt(1500,100)"}, sigfile(
"*T1tttt*1500_*PU20*"), sigtag(
"t1t");
45 leglab[1] =
"T1tttt(1200,800)";
46 sigfile =
"*T1tttt*1200_*PU20*";
48 colors[1] = kMagenta+1;
51 vector<TChain *> chain;
52 for(
unsigned icha(0); icha<2; icha++){
53 chain.push_back(
new TChain(
"tree"));
55 for(
unsigned sam(0); sam < bkgfiles.size(); sam++)
56 chain[icha]->Add(bkgfiles[sam]);
57 }
else chain[icha]->Add(folder+sigfile);
60 double legX = 0.15, legY = 0.87, legSingle = 0.06;
61 double legW = 0.3, legH = legSingle*chain.size();
62 TLegend
leg(legX, legY-legH, legX+legW, legY);
63 leg.SetTextSize(0.052);
66 TLine line; line.SetLineColor(28); line.SetLineWidth(4); line.SetLineStyle(2);
68 TString cuts(
"ht>500&&met>200&&mt>=150&&nbm>=2&&njets>=6&&(nmus+nels)==1"), hname;
69 if(!do_2b) cuts.ReplaceAll(
"nbm>=2",
"nbm==1");
70 int mj_scat_nbins(20), met_scat_nbins(10), mj_nrebin(2), met_nrebin(1);
74 float limits[2][2] = {{0,1000},{200,700}};
75 vector<TH2D *>hscat, hsb;
76 for(
unsigned icha(0); icha<2; icha++){
77 hname =
"hscatter"; hname += icha;
78 hscat.push_back(
new TH2D(hname,
"",mj_scat_nbins,limits[0][0],limits[0][1],
79 met_scat_nbins,limits[1][0],limits[1][1]));
80 totCut = luminosity+
"*weight*("+cuts+
")";
81 chain[icha]->Project(hname,
"met:mj",totCut);
84 title = cuts;
if(title==
"1") title =
"";
85 title.ReplaceAll(
"nvmus==1&&nmus==1&&nvels==0",
"1 #mu");
86 title.ReplaceAll(
"(nmus+nels)",
"n_{lep}");
87 title.ReplaceAll(
"nvmus10==0&&nvels10==0",
"0 leptons");
88 title.ReplaceAll(
"njets30",
"n_{jets}^{30}");
89 title.ReplaceAll(
"els_pt",
"p^{e}_{T}");title.ReplaceAll(
"mus_pt",
"p^{#mu}_{T}");
90 title.ReplaceAll(
"njets",
"n_{jets}"); title.ReplaceAll(
"<",
" < ");
91 title.ReplaceAll(
">=",
" #geq "); title.ReplaceAll(
">",
" > "); title.ReplaceAll(
"&&",
", ");
92 title.ReplaceAll(
"met",
"MET"); title.ReplaceAll(
"ht",
"H_{T}"); title.ReplaceAll(
"mt",
"m_{T}");
93 title.ReplaceAll(
"nleps==1",
"1 lepton"); title.ReplaceAll(
"nbm",
"n_{b}"); title.ReplaceAll(
"==",
" = ");
94 hscat[icha]->SetTitle(title);
95 hscat[icha]->SetXTitle(
"M_{J} (GeV)");
96 hscat[icha]->SetYTitle(
"MET (GeV)");
97 hscat[icha]->SetMarkerColor(colors[icha]);
98 hscat[icha]->SetLineColor(colors[icha]);
99 hscat[icha]->SetMarkerStyle(20);
100 hscat[icha]->SetMarkerSize(0.7);
101 if(icha==0) hscat[icha]->Draw(
"scat=40");
102 else hscat[icha]->Draw(
"scat=40 same");
103 line.DrawLine(400,200,400,700); line.DrawLine(0,350,1000,350);
105 hname =
"hsb"; hname += icha;
106 hsb.push_back(static_cast<TH2D*>(hscat[icha]->Rebin2D(mj_nrebin,met_nrebin,hname)));
107 leg.AddEntry(hscat[icha],leglab[icha]);
111 TString pname(
"plots/scatter_"+sigtag+(do_2b?
"2b":
"1b")); pname +=
".eps";
114 const unsigned num_conts = 50;
115 const unsigned num_stops = 2;
116 double stops[num_stops] = {0., 1.};
117 double red[num_stops] = {1., 0.23};
118 double green[num_stops] = {1., 0.72};
119 double blue[num_stops] = {1., 0.52};
125 gStyle->SetNumberContours(num_conts); gStyle->SetPaintTextFormat(
"4.2f");
126 TColor::CreateGradientColorTable(num_stops, stops, red, green, blue, num_conts);
128 can.SetRightMargin(0.13);
130 for(
int xbin(1); xbin <= hsb[1]->GetNbinsX(); xbin++){
131 for(
int ybin(1); ybin <= hsb[1]->GetNbinsY(); ybin++){
132 double num(hsb[1]->GetBinContent(xbin,ybin)), den(hsb[0]->GetBinContent(xbin,ybin));
135 if(
num>0) val = 9.99;
137 }
else val =
num/den;
138 hsb[1]->SetBinContent(xbin,ybin,val);
141 hsb[1]->SetMinimum(0);
142 hsb[1]->SetMaximum(1);
143 hsb[1]->SetMarkerSize(2.5);
144 hsb[1]->SetMarkerColor(1);
145 hsb[1]->SetZTitle(
"S/B");
146 hsb[1]->SetTitleOffset(0.56,
"Z");
147 hsb[1]->Draw(
"colz");
148 hsb[1]->Draw(
"text same");
149 line.DrawLine(400,200,400,700); line.DrawLine(0,350,1000,350);
150 pname.ReplaceAll(
"scatter",
"s_over_b");
154 for(
unsigned icha(0); icha<2; icha++){
155 hscat[icha]->Delete();
157 chain[icha]->Delete();
TColor red(2015, 250/255., 96/255., 1/255.)