24 TH1::SetDefaultSumw2(
true);
30 TColor
ucsb_blue(1000, 1/255.,57/255.,166/255.);
31 TColor
ucsb_gold(1001, 255/255.,200/255.,47/255);
32 TColor
penn_red(1002, 149/255.,0/255.,26/255.);
33 TColor
uf_orange(1003, 255/255.,74/255.,0/255.);
34 TColor
uo_green(1004, 0/255.,79/255.,39/255.);
35 TColor
tcu_purple(1005, 72/255.,42/255.,100/255.);
37 TColor
sig_teal(1007, 96/255.,159/255.,128/255.);
38 TColor
sig_gold(1008, 215/255.,162/255.,50/255.);
39 TColor
seal_brown(1010, 89/255.,38/255.,11/255.);
41 TString folder=
"archive/15-03-17/skims/";
44 s_tt.push_back(folder+
"*_TTJet*");
45 vector<TString> s_wjets;
46 s_wjets.push_back(folder+
"*_WJets*");
47 vector<TString> s_single;
48 s_single.push_back(folder+
"*_T*channel*");
49 vector<TString> s_ttv;
50 s_ttv.push_back(folder+
"*TTW*");
51 s_ttv.push_back(folder+
"*TTZ*");
52 vector<TString> s_other;
53 s_other.push_back(folder+
"*QCD_HT*");
54 s_other.push_back(folder+
"*_ZJet*");
55 s_other.push_back(folder+
"*DY*");
56 s_other.push_back(folder+
"*WH_HToBB*");
57 vector<TString> s_t1t;
58 s_t1t.push_back(folder+
"*T1tttt*1500_*PU20*");
59 vector<TString> s_t1tc;
60 s_t1tc.push_back(folder+
"*T1tttt*1200_*PU20*");
63 vector<TChain *> chain;
64 vector<sfeats> Samples;
65 Samples.push_back(
sfeats(s_other,
"Other", 1001));
66 Samples.push_back(
sfeats(s_ttv,
"ttV", 1002));
67 Samples.push_back(
sfeats(s_single,
"Single top", 1005));
68 Samples.push_back(
sfeats(s_wjets,
"W + jets", 1004));
69 Samples.push_back(
sfeats(s_tt,
"t#bar{t}, 2 l", 1006,1,
"((mc_type&0x0F00)/0x100+(mc_type&0x000F)-(mc_type&0x00F0)/0x10)>=2"));
70 Samples.push_back(
sfeats(s_tt,
"t#bar{t}, 1 l", 1000,1,
"((mc_type&0x0F00)/0x100+(mc_type&0x000F)-(mc_type&0x00F0)/0x10)<=1"));
71 Samples.push_back(
sfeats(s_t1t,
"T1tttt(1500,100)", 2));
72 Samples.push_back(
sfeats(s_t1tc,
"T1tttt(1200,800)", 2,2));
74 Samples.push_back(
sfeats(s_tt,
"t#bar{t} 2l, 200<MET<400", 1,1,
75 "met>200&&met<400&&((mc_type&0x0F00)/0x100+(mc_type&0x000F)-(mc_type&0x00F0)/0x10)>=2"));
76 Samples.push_back(
sfeats(s_tt,
"t#bar{t} 2l, MET #geq 400", 1,2,
77 "met>=400&&((mc_type&0x0F00)/0x100+(mc_type&0x000F)-(mc_type&0x00F0)/0x10)>=2"));
82 Samples.push_back(
sfeats(s_t1t,
"T1tttt(1500,100), 200<MET<400", 2,1,
"met>200&&met<400"));
83 Samples.push_back(
sfeats(s_t1t,
"T1tttt(1500,100), MET#geq400", 2,2,
"met>=400"));
84 Samples.push_back(
sfeats(s_t1tc,
"T1tttt(1200,800), 200<MET<400", 4,1,
"met>200&&met<400"));
85 Samples.push_back(
sfeats(s_t1tc,
"T1tttt(1200,800), MET#geq400", 4,2,
"met>=400"));
87 for(
unsigned sam(0); sam < Samples.size(); sam++){
88 chain.push_back(
new TChain(
"tree"));
89 for(
unsigned insam(0); insam < Samples[sam].file.size(); insam++)
90 chain[sam]->Add(Samples[sam].
file[insam]);
100 all_sam.push_back(6);
101 all_sam.push_back(7);
103 TString cuts_1b(
"ht>500&&met>200&&nbm==1&&njets>=6&&mt>=150&&(nmus+nels)==1");
104 TString cuts_2b(
"ht>500&&met>200&&nbm>=2&&njets>=6&&mt>=150&&(nmus+nels)==1");
108 float mj_binning[] = {0,100,200,300,400,500,600,700,800,900,1000,1100,1200,1300,1400,1500};
119 slices.push_back(10);
120 slices.push_back(11);
121 slices.push_back(12);
122 slices.push_back(13);
123 vars.push_back(
hfeats(
"mj",mj_nbins,mj_binning, slices,
"M_{J} (GeV)", cuts_1b));
124 vars.push_back(
hfeats(
"mj",mj_nbins,mj_binning, slices,
"M_{J} (GeV)", cuts_2b));
127 vector<int> bkg_ind(vars.size(), -1);
132 float minLog = 0.04, maxLog = 10;
133 double legX = 0.37, legY = 0.87, legSingle = 0.055;
134 double legW = 0.12, legH = legSingle*vars[0].samples.size();
135 TLegend
leg(legX, legY-legH, legX+legW, legY);
136 leg.SetTextSize(0.052); leg.SetFillColor(0); leg.SetFillStyle(0); leg.SetBorderSize(0);
137 leg.SetTextFont(132);
139 TLine line; line.SetLineColor(28); line.SetLineWidth(4); line.SetLineStyle(2);
140 vector< vector<TH1D*> > histo[2];
141 vector<TH1D*> varhisto;
142 vector<float> nentries;
143 TString hname, pname, variable, leghisto, totCut, title, ytitle;
144 for(
unsigned var(0); var<vars.size(); var++){
147 title = vars[var].cuts;
if(title==
"1") title =
"";
148 title.ReplaceAll(
"nvmus==1&&nmus==1&&nvels==0",
"1 #mu");
149 title.ReplaceAll(
"(nmus+nels)",
"n_{lep}");
150 title.ReplaceAll(
"nvmus10==0&&nvels10==0",
"0 leptons");
151 title.ReplaceAll(
"(Max$(els_pt*els_sigid*(els_miniso_tr10<0.1))>20||Max$(mus_pt*mus_sigid*(mus_miniso_tr10<0.4))>20)&&(nmus+nels)",
"n_{lep}"); title.ReplaceAll(
"njets30",
"n_{jets}^{30}");
152 title.ReplaceAll(
"els_pt",
"p^{e}_{T}");title.ReplaceAll(
"mus_pt",
"p^{#mu}_{T}");
153 title.ReplaceAll(
"mus_reliso",
"RelIso"); title.ReplaceAll(
"els_reliso",
"RelIso");
154 title.ReplaceAll(
"mus_miniso_tr15",
"MiniIso"); title.ReplaceAll(
"els_miniso_tr15",
"MiniIso");
155 title.ReplaceAll(
"njets",
"n_{jets}");title.ReplaceAll(
"abs(lep_id)==13&&",
"");
156 title.ReplaceAll(
">=",
" #geq "); title.ReplaceAll(
">",
" > "); title.ReplaceAll(
"&&",
", ");
157 title.ReplaceAll(
"<",
" < ");
158 title.ReplaceAll(
"met",
"MET"); title.ReplaceAll(
"ht",
"H_{T}"); title.ReplaceAll(
"mt",
"m_{T}");
159 title.ReplaceAll(
"nleps==1",
"1 lepton"); title.ReplaceAll(
"nbm",
"n_{b}"); title.ReplaceAll(
"==",
" = ");
160 title.ReplaceAll(
"nbl[1]",
"n_{b,l}");
161 for(
unsigned his(0); his < 2; his++){
163 for(
unsigned sam(0); sam < vars[var].samples.size(); sam++){
164 hname =
"histo"; hname += var; hname += his; hname += sam;
165 varhisto.push_back(
new TH1D(hname, title, vars[var].
nbins, vars[var].binning));
167 histo[his].push_back(varhisto);
173 variable = vars[var].varname;
174 float maxhisto(-999);
175 for(
unsigned sam(0); sam < vars[var].samples.size(); sam++){
176 int isam = vars[var].samples[sam];
177 bool isSig = Samples[isam].isSig;
178 totCut = Samples[isam].factor+
"*"+luminosity+
"*weight*("+vars[var].cuts+
"&&"+Samples[isam].cut+
")";
180 histo[0][var][sam]->Sumw2();
181 chain[isam]->Project(histo[0][var][sam]->GetName(), variable, totCut);
182 histo[0][var][sam]->SetBinContent(vars[var].
nbins,
183 histo[0][var][sam]->GetBinContent(vars[var].nbins)+
184 histo[0][var][sam]->GetBinContent(vars[var].nbins+1));
185 histo[0][var][sam]->SetBinError(vars[var].nbins,
186 sqrt(pow(histo[0][var][sam]->GetBinError(vars[var].nbins),2)+
187 pow(histo[0][var][sam]->GetBinError(vars[var].nbins+1),2)));
188 nentries.push_back(histo[0][var][sam]->Integral(1,vars[var].nbins));
189 histo[0][var][sam]->SetXTitle(vars[var].title);
190 ytitle =
"Entries for "+luminosity+
" fb^{-1}";
191 if(vars[var].unit!=
"") {
193 float binwidth((vars[var].maxx-vars[var].minx)/static_cast<float>(vars[var].nbins));
195 if(binwidth<1) digits = 1;
196 ytitle += (
"/("+
RoundNumber(binwidth,digits) +
" "+vars[var].unit+
")");
198 histo[0][var][sam]->SetYTitle(ytitle);
200 for(
int bin(0); bin<=histo[0][var][sam]->GetNbinsX()+1; bin++){
201 float val(histo[0][var][sam]->GetBinContent(bin)), errval(histo[0][var][sam]->GetBinError(bin));
202 float thisbinW(histo[0][var][sam]->GetBinWidth(bin));
203 histo[0][var][sam]->SetBinContent(bin, val*binW/thisbinW);
204 histo[0][var][sam]->SetBinError(bin, errval*binW/thisbinW);
205 histo[1][var][sam]->SetBinContent(bin, histo[0][var][sam]->GetBinContent(bin));
209 for(
int bsam(sam-1); bsam >= 0; bsam--){
210 histo[0][var][sam]->Add(histo[0][var][bsam]);
217 histo[0][var][sam]->SetFillColor(Samples[isam].color);
218 histo[0][var][sam]->SetFillStyle(1001);
219 histo[0][var][sam]->SetLineColor(1);
220 histo[0][var][sam]->SetLineWidth(1);
222 histo[0][var][sam]->SetLineColor(Samples[isam].color);
223 histo[0][var][sam]->SetLineStyle(Samples[isam].style);
224 histo[0][var][sam]->SetLineWidth(3);
226 if(maxhisto < histo[0][var][sam]->GetMaximum()) maxhisto = histo[0][var][sam]->GetMaximum();
228 int firstplotted(-1);
229 for(
int sam(vars[var].samples.size()-1); sam >= 0; sam--){
230 int isam = vars[var].samples[sam];
231 leghisto = Samples[isam].label+
" [N = " +
RoundNumber(nentries[sam],0) +
"]";
232 leg.AddEntry(histo[0][var][sam], leghisto);
233 bool isSig = Samples[isam].isSig;
235 if(firstplotted < 0) {
236 histo[0][var][sam]->Draw(
"hist");
238 }
else histo[0][var][sam]->Draw(
"hist same");
241 for(
int sam(vars[var].samples.size()-1); sam >= 0; sam--){
242 int isam = vars[var].samples[sam];
243 bool isSig = Samples[isam].isSig;
244 if(isSig) histo[0][var][sam]->Draw(
"hist same");
246 legH = legSingle*vars[var].samples.size(); leg.SetY1NDC(legY-legH);
248 if(histo[0][var][firstplotted]->GetMinimum() > minLog) histo[0][var][firstplotted]->SetMinimum(minLog);
249 histo[0][var][firstplotted]->SetMinimum(minLog);
250 histo[0][var][firstplotted]->SetMaximum(maxhisto*maxLog);
251 if(variable==
"mt" && var==vars.size()-1) {
252 histo[0][var][firstplotted]->SetMinimum(0.2);
253 histo[0][var][firstplotted]->SetMaximum(maxhisto*2);
255 if(vars[var].cut>0) line.DrawLine(vars[var].cut, 0, vars[var].cut, maxhisto*maxLog);
257 pname =
"plots/1d/log_lumi_"+vars[var].tag+
".eps";
259 histo[0][var][firstplotted]->SetMinimum(0);
260 histo[0][var][firstplotted]->SetMaximum(maxhisto*1.1);
262 pname =
"plots/1d/lumi_"+vars[var].tag+
".eps";
266 leg.Clear(); maxhisto = -999;
267 for(
unsigned sam(0); sam < vars[var].samples.size(); sam++){
268 int isam = vars[var].samples[sam];
269 histo[1][var][sam]->SetLineColor(Samples[isam].color);
270 histo[1][var][sam]->SetLineStyle(Samples[isam].style);
271 histo[1][var][sam]->SetLineWidth(3);
272 if(nentries[sam]) histo[1][var][sam]->Scale(100./nentries[sam]);
273 if(maxhisto < histo[1][var][sam]->GetMaximum()) maxhisto = histo[1][var][sam]->GetMaximum();
275 histo[1][var][sam]->SetXTitle(vars[var].title);
276 histo[1][var][sam]->SetYTitle(
"Entries (%)");
277 histo[1][var][sam]->Draw();
278 }
else histo[1][var][sam]->Draw(
"same");
279 leghisto = Samples[isam].label+
" [#mu = ";
281 leghisto +=
RoundNumber(histo[1][var][sam]->GetMean(),digits) +
"]";
282 leg.AddEntry(histo[1][var][sam], leghisto);
285 if(vars[var].cut>0) line.DrawLine(vars[var].cut, 0, vars[var].cut, maxhisto*1.1);
286 histo[1][var][0]->SetMaximum(maxhisto*1.1);
288 pname =
"plots/1d/shapes_"+vars[var].tag+
".eps";
290 histo[1][var][0]->SetMaximum(maxhisto*maxLog);
292 pname =
"plots/1d/log_shapes_"+vars[var].tag+
".eps";
321 for(
unsigned his(0); his < 2; his++){
322 for(
unsigned var(0); var<vars.size(); var++){
323 for(
unsigned sam(0); sam < vars[var].samples.size(); sam++)
324 if(histo[his][var][sam]) histo[his][var][sam]->Delete();
TColor tcu_purple(2005, 52/255., 42/255., 123/255.)
TColor ucsb_gold(2001, 255/255., 200/255., 47/255)
TColor uf_orange(2003, 255/255., 74/255., 0/255.)
TColor tar_heel_blue(2006, 86/255., 160/255., 211/255.)
TColor ucsb_blue(2000, 1/255., 57/255., 166/255.)
TString RoundNumber(double num, int decimals, double denom=1.)
TColor sig_gold(2008, 215/255., 162/255., 50/255.)
TColor uo_green(2004, 0/255., 79/255., 39/255.)
TColor penn_red(2002, 149/255., 0/255., 26/255.)
TColor seal_brown(2010, 89/255., 38/255., 11/255.)
TColor sig_teal(2007, 96/255., 159/255., 128/255.)