13 #include "RooStats/NumberCountingUtils.h" 29 TString
YieldsCut(TString title, TString cuts, vector<TChain*> chain, vector<sfeats> Samples,
int nsig);
34 TString folder=
"archive/2015_05_02/skim/";
36 s_tt.push_back(folder+
"*_TTJet*");
37 vector<TString> s_wjets;
38 s_wjets.push_back(folder+
"*_WJets*");
39 vector<TString> s_single;
40 s_single.push_back(folder+
"*_T*channel*");
41 vector<TString> s_ttv;
42 s_ttv.push_back(folder+
"*TTW*");
43 s_ttv.push_back(folder+
"*TTZ*");
44 vector<TString> s_other;
45 s_other.push_back(folder+
"*QCD_HT*");
46 s_other.push_back(folder+
"*_ZJet*");
47 s_other.push_back(folder+
"*DY*");
48 s_other.push_back(folder+
"*WH_HToBB*");
49 vector<TString> s_t1t;
50 s_t1t.push_back(folder+
"*T1tttt*1500_*PU20*");
51 vector<TString> s_t1tc;
52 s_t1tc.push_back(folder+
"*T1tttt*1200_*PU20*");
54 vector<TChain *> chain;
55 vector<sfeats> Samples;
56 Samples.push_back(
sfeats(s_other,
"Other", 1001));
57 Samples.push_back(
sfeats(s_ttv,
"$t\\bar{t}V$", 1002));
58 Samples.push_back(
sfeats(s_single,
"Single $t$", 1005));
59 Samples.push_back(
sfeats(s_wjets,
"W+jets", 1004));
60 Samples.push_back(
sfeats(s_tt,
"$t\\bar{t}$ (1$\\ell$)", 1000,1,
61 "((mc_type&0x0F00)/0x100+(mc_type&0x000F)-(mc_type&0x00F0)/0x10)<=1"));
62 Samples.push_back(
sfeats(s_tt,
"$t\\bar{t}$ ($2\\ell$)", 1006,1,
63 "((mc_type&0x0F00)/0x100+(mc_type&0x000F)-(mc_type&0x00F0)/0x10)>=2"));
65 Samples.push_back(
sfeats(s_t1t,
"T1tttt NC", 2));
66 Samples.push_back(
sfeats(s_t1t,
"T1tttt NC, $1\\ell$", 2, 1,
67 "((mc_type&0x0F00)/0x100+(mc_type&0x000F)-(mc_type&0x00F0)/0x10)<=1"));
68 Samples.push_back(
sfeats(s_t1tc,
"T1tttt C", 2,2));
70 for(
unsigned sam(0); sam < Samples.size(); sam++){
71 chain.push_back(
new TChain(
"tree"));
72 for(
unsigned insam(0); insam < Samples[sam].file.size(); insam++)
73 chain[sam]->Add(Samples[sam].
file[insam]);
78 TString name =
"txt/all_track_veto_lumi_"+
luminosity+
".tex";
79 TString cuts(
"(nmus+nels)==1&&ht>500&&met>200&&nbm>=1&&njets>=6&&mt>140&&mj>300");
81 ifstream header(
"txt/header.tex");
82 ifstream footer(
"txt/footer.tex");
85 file <<
"\n\\begin{tabular}{ l | ";
86 for(
unsigned sam(0); sam < Samples.size()-nsig; sam++) file <<
"r";
88 for(
int sam(0); sam < nsig; sam++) file<<
"| rr ";
89 file<<
"}\\hline\\hline\n";
90 file <<
" \\multicolumn{1}{c|}{${\\cal L} = 10$ fb$^{-1}$} ";
91 for(
unsigned sam(0); sam < Samples.size()-nsig; sam++)
92 file <<
" & "<<Samples[sam].label;
94 for(
unsigned sam(Samples.size()-nsig); sam < Samples.size(); sam++)
95 file <<
" & "<<Samples[sam].label<<
" &";
96 file <<
"\\\\ \\hline \n ";
99 TString os(
"((tks_id*lep_charge)>0)");
100 TString os_had(
"((tks_id*lep_charge)<0)");
103 TString notp(
"&&(!tks_is_primary)");
106 TString elec(
"&&tks_id*tks_id==121");
107 TString muon(
"&&tks_id*tks_id==169");
108 TString had(
"&&!(tks_id*tks_id==121||tks_id*tks_id==169)");
111 TString iso[6] = {
"&&(tks_pt*(tks_mini_ne+tks_mini_ch))<10",
"&&(tks_pt*(tks_mini_ne+tks_mini_ch))<20",
"&&(tks_pt*(tks_mini_ne+tks_mini_ch))<30",
"&&(tks_pt*(tks_mini_ne+tks_mini_ch))<50",
"&&(tks_pt*(tks_mini_ch))<2.5",
"&&tks_mini_ch<0.05"};
115 TString mtc[3] = {
"&&tks_mt<80",
"&&tks_mt<90",
"&&tks_mt<100"};
120 file <<
" \\multicolumn{"<< Samples.size()+1+nsig<<
"}{c}{" 121 <<
"$H_T>500, $M_J>300, \\mathrm{MET}>200, m_T>140, n_{\\rm jets}\\geq 6, n_b\\geq 1, n_{\\rm lep}=1$" 122 <<
"} \\\\ \\hline\n";
128 chain, Samples, nsig);
132 file <<
YieldsCut(
"removed by had TV, mu TV or e TV, $", cuts+
"&&(Sum$("+os_had+had+notp+iso[4]+mtc[1]+
")>0||"+
"Sum$("+os+muon+notp+iso[2]+mtc[1]+
")>0||"+
"Sum$("+os+elec+notp+iso[0]+mtc[1]+
")>0)",
133 chain, Samples, nsig);
175 file <<
" \\hline\\multicolumn{1}{c|}{} ";
176 for(
unsigned sam(0); sam < Samples.size()-nsig; sam++)
177 file <<
" & "<<Samples[sam].label;
178 file<<
" & SM bkg. ";
179 for(
unsigned sam(Samples.size()-nsig); sam < Samples.size(); sam++)
180 file <<
" & "<<Samples[sam].label<<
"&";
183 file<<
"\\hline\\hline\n\\end{tabular}"<<endl<<endl;
184 file<<footer.rdbuf();
186 cout<<
"Written "<<name<<endl;
189 TString
YieldsCut(TString title, TString cuts, vector<TChain*> chain, vector<sfeats> Samples,
int nsig){
190 TString totCut, Hname =
"histo", out;
191 vector<double> yield, error;
192 double bkg(0), bkg_err(0), err;
193 int nsam(chain.size());
194 TH1D histo(Hname,
"",100, 0, 10000);
196 for(
int sam(0); sam < nsam; sam++){
197 totCut =
luminosity+
"*weight*("+cuts+
"&&"+Samples[sam].cut+
")";
198 chain[sam]->Project(Hname,
"met", totCut);
199 yield.push_back(histo.IntegralAndError(0,101,err));
200 error.push_back(err);
203 bkg_err = sqrt(pow(bkg_err,2)+pow(err,2));
210 for(
int sam(0); sam < nsam-nsig; sam++) out += (
" \t & " +
RoundNumber(yield[sam],1));
212 for(
int sam(nsam-nsig); sam < nsam; sam++) {
TString RoundNumber(double num, int decimals, double denom=1.)
TString YieldsCut(TString title, TString cuts, vector< TChain * > chain, vector< sfeats > Samples, int nsig)