19 void makePlot(vector<sfeats> Samples, vector<TChain *> chain, TString cuts);
26 string hostname =
execute(
"echo $HOSTNAME");
28 bfolder =
"/net/cms2";
30 TString foldermc(bfolder+
"/cms2r0/babymaker/babies/2016_06_14/mc/unskimmed/");
31 TString folderscan(bfolder+
"/cms2r0/babymaker/babies/2016_06_21/mc/T1tttt/");
33 vector<TString> s_t1t;
34 s_t1t.push_back(folderscan+
"*T1tttt*1400_mLSP-1*");
35 s_t1t.push_back(folderscan+
"*T1tttt*1450_mLSP-1*");
36 s_t1t.push_back(folderscan+
"*T1tttt*1500_mLSP-1*");
37 s_t1t.push_back(folderscan+
"*T1tttt*1550_mLSP-1*");
38 s_t1t.push_back(folderscan+
"*T1tttt*1600_mLSP-1*");
39 s_t1t.push_back(folderscan+
"*T1tttt*1650_mLSP-1*");
40 s_t1t.push_back(folderscan+
"*T1tttt*1700_mLSP-1*");
41 s_t1t.push_back(folderscan+
"*T1tttt*1750_mLSP-1*");
42 s_t1t.push_back(folderscan+
"*T1tttt*1800_mLSP-1*");
43 s_t1t.push_back(folderscan+
"*T1tttt*1850_mLSP-1*");
44 s_t1t.push_back(folderscan+
"*T1tttt*1900_mLSP-1*");
45 vector<TString> s_t1tc;
46 s_t1tc.push_back(folderscan+
"*T1tttt*1200_mLSP-800*");
47 s_t1tc.push_back(folderscan+
"*T1tttt*1250_mLSP-850*");
48 s_t1tc.push_back(folderscan+
"*T1tttt*1300_mLSP-900*");
49 s_t1tc.push_back(folderscan+
"*T1tttt*1350_mLSP-950*");
50 s_t1tc.push_back(folderscan+
"*T1tttt*1400_mLSP-1000*");
51 s_t1tc.push_back(folderscan+
"*T1tttt*1450_mLSP-1050*");
52 s_t1tc.push_back(folderscan+
"*T1tttt*1500_mLSP-1100*");
53 s_t1tc.push_back(folderscan+
"*T1tttt*1550_mLSP-1150*");
54 s_t1tc.push_back(folderscan+
"*T1tttt*1600_mLSP-1200*");
55 s_t1tc.push_back(folderscan+
"*T1tttt*1650_mLSP-1250*");
56 s_t1tc.push_back(folderscan+
"*T1tttt*1700_mLSP-1300*");
57 vector<TString> s_tt_1l;
58 s_tt_1l.push_back(foldermc+
"*_TTJets*SingleLeptFromTbar*");
59 s_tt_1l.push_back(foldermc+
"*_TTJets*SingleLeptFromT_*");
60 vector<TString> s_tt_2l;
61 s_tt_2l.push_back(foldermc+
"*_TTJets*DiLept*");
63 vector<TString> s_other;
64 s_other.push_back(foldermc+
"*_WJetsToLNu*.root");
65 s_other.push_back(foldermc+
"*_TTWJets*.root");
66 s_other.push_back(foldermc+
"*_TTZTo*.root");
67 s_other.push_back(foldermc+
"*_ST_*.root");
68 s_other.push_back(foldermc+
"*QCD_HT*.root");
69 s_other.push_back(foldermc+
"*DYJetsToLL*.root");
70 s_other.push_back(foldermc+
"*_ZJet*.root");
71 s_other.push_back(foldermc+
"*ggZH_HToBB*.root");
72 s_other.push_back(foldermc+
"*ttHJetTobb*.root");
73 s_other.push_back(foldermc+
"*_TTGJets*.root");
74 s_other.push_back(foldermc+
"*_TTTT*.root");
75 s_other.push_back(foldermc+
"*_WH_HToBB*.root");
76 s_other.push_back(foldermc+
"*_ZH_HToBB*.root");
77 s_other.push_back(foldermc+
"*_WWTo*.root");
78 s_other.push_back(foldermc+
"*_WZTo*.root");
79 s_other.push_back(foldermc+
"*_ZZ_*.root");
82 vector<sfeats> Samples;
90 vector<TChain *> chain;
91 for(
unsigned sam(0); sam < Samples.size(); sam++){
92 chain.push_back(
new TChain(
"tree"));
93 for(
unsigned insam(0); insam < Samples[sam].file.size(); insam++){
94 chain[sam]->Add(Samples[sam].
file[insam]);
98 vector<TString> cuts = {
"nleps==1",
"ht>500",
"met>200",
"njets>=6",
"nbm>=2",
"mj14>=400",
"met>400",
"mt>140",
99 "nleps==1&&ht>500&&met>200&&njets>=6&&nbm>=1",
100 "nleps==1&&ht>500&&met>200&&njets>=6&&nbm>=1&&mj14>=400",
101 "nleps==1&&ht>500&&met>200&&njets>=6&&nbm>=1&&mj14>=400&&mt>140"};
103 for(
size_t ind(0); ind<cuts.size(); ind++)
104 makePlot(Samples, chain, cuts[ind]);
107 void makePlot(vector<sfeats> Samples, vector<TChain *> chain, TString cuts){
110 double legSingle = 0.08;
111 double legX=0.22, legY=0.18, legW=0.1, legH=legSingle*Samples.size();
112 TLegend
leg(legX,legY, legX+legW, legY+legH);
113 leg.SetTextSize(0.05); leg.SetFillColor(0); leg.SetBorderSize(0); leg.SetFillStyle(0);
114 float minh = 0, maxh = 50;
115 int nbins = (maxh-minh)/5;
117 vector<TH1D*> histo[2];
118 for(
unsigned sam(0); sam < Samples.size(); sam++){
119 for(
size_t ind(0); ind<2; ind++){
120 hname =
"histo"; hname += sam; hname += ind;
121 histo[ind].push_back(
new TH1D(hname,
cuts2title(cuts), nbins, minh, maxh));
123 histo[ind][sam]->SetBinErrorOption(TH1::kPoisson);
124 histo[ind][sam]->SetLineColor(Samples[sam].color);
125 histo[ind][sam]->SetLineWidth(3);
126 histo[ind][sam]->SetXTitle(
"True n_{PV}");
127 histo[ind][sam]->SetYTitle(
"#epsilon normalized to [15 #leq n_{PV} < 20]");
128 histo[ind][sam]->SetBinContent(nbins, histo[ind][sam]->GetBinContent(nbins)+
129 histo[ind][sam]->GetBinContent(nbins+1));
131 chain[sam]->Project(histo[0][sam]->GetName(),
"ntrupv",
"weight*("+cuts+
")");
132 chain[sam]->Project(histo[1][sam]->GetName(),
"ntrupv",
"weight");
133 histo[0][sam]->Divide(histo[1][sam]);
134 histo[0][sam]->Scale(1/histo[0][sam]->GetBinContent(4));
135 histo[0][sam]->SetMinimum(0.55);
136 histo[0][sam]->SetMaximum(1.3);
137 leg.AddEntry(histo[0][sam], Samples[sam].label);
139 histo[0][sam]->Draw(
"");
140 TLine line; line.SetLineStyle(2);
141 line.DrawLine(minh, 1, maxh, 1);
142 }
else histo[0][sam]->Draw(
"same");
145 TString pname =
"eff_pu_"+
format_tag(cuts)+
".pdf";
146 can.SaveAs(
"plots/eff_pu/"+pname);
148 for(
unsigned sam(0); sam < Samples.size(); sam++)
149 for(
size_t ind(0); ind<2; ind++)
150 histo[ind][sam]->Delete();
void makePlot(vector< sfeats > Samples, vector< TChain * > chain, TString cuts)
bool Contains(const std::string &text, const std::string &pattern)
TString cuts2title(TString title)
std::string execute(const std::string &cmd)
TString format_tag(TString tag)