30 #include "TDirectory.h" 40 TString filetype, TString namestyle, TString dir,
bool doRatio){
41 TString outfolder(
"plots/"+dir);
42 gSystem->mkdir(outfolder, kTRUE);
45 if(namestyle.Contains(
"_Supplementary")) {
46 CMStype =
"Supplementary";
47 namestyle.ReplaceAll(
"_Supplementary",
"");
49 if(namestyle.Contains(
"_Preliminary")) {
50 CMStype =
"Preliminary";
51 namestyle.ReplaceAll(
"_Preliminary",
"");
54 bool showcuts(!namestyle.Contains(
"CMSPaper"));
57 if(namestyle.Contains(
"CMSPaper")) style.nDivisions = 706;
59 style.LabelSize *=1.1;
61 style.TitleSize *=1.2;
62 style.yTitleOffset /=1.3;
63 style.xTitleOffset /= 1.08;
65 style.setDefaultStyle();
68 TPad *pad(NULL), *bpad(NULL);
70 float bpadHeight = 0.3;
71 pad =
new TPad(
"tpad",
"tpad",0.,bpadHeight,1.,1.);
72 pad->SetBottomMargin(0.02);
73 pad->SetTopMargin(style.PadTopMargin+0.01);
75 bpad =
new TPad(
"bpad",
"bpad",0.,0.,1.,bpadHeight+0.005);
76 bpad->SetTopMargin(0.);
77 bpad->SetBottomMargin(2.35*style.PadBottomMargin);
78 bpad->SetFillStyle(4000);
81 pad =
static_cast<TPad *
>(can.cd());
84 bool rohanHack(
false);
85 if(rohanHack) cout<<
"WARNING: RohanHack is On."<<endl;
88 vector<TChain *> chain;
89 for(
unsigned sam(0); sam < Samples.size(); sam++){
90 chain.push_back(
new TChain(
"tree"));
91 for(
unsigned insam(0); insam < Samples[sam].file.size(); insam++){
93 chain[sam]->Add(Samples[sam].
file[insam]);
98 TString lumi_nodot =
luminosity; lumi_nodot.ReplaceAll(
".",
"p");
99 TString plot_tag(
"_lumi"+lumi_nodot+filetype);
100 float minLog = 0.002, fracLeg = 0.36;
102 double legLeft(style.PadLeftMargin+0.08), legRight(1-style.PadRightMargin-0.02);
103 double legY(1-style.PadTopMargin-0.03), legSingle = 0.052;
104 if (doRatio) {legY=1-style.PadTopMargin-0.042; legSingle = 0.06;}
105 double legW = 0.13, legH = legSingle*(vars[0].samples.size()+1)/2;
106 double legX1[] = {legLeft, legLeft+(legRight-legLeft)/2.*1.15};
107 TLegend
leg[2];
int nLegs(2);
108 for(
int ileg(0); ileg<nLegs; ileg++){
109 leg[ileg].SetX1NDC(legX1[ileg]); leg[ileg].SetX2NDC(legX1[ileg]+legW);
110 leg[ileg].SetY1NDC(legY-legH); leg[ileg].SetY2NDC(legY);
111 leg[ileg].SetTextSize(style.LegendSize); leg[ileg].SetFillColor(0);
112 leg[ileg].SetFillStyle(0); leg[ileg].SetBorderSize(0);
113 leg[ileg].SetTextFont(style.nFont);
115 TLine line; line.SetLineColor(1); line.SetLineWidth(5); line.SetLineStyle(2);
116 TLine line2; line2.SetLineColor(kBlack); line2.SetLineWidth(5); line2.SetLineStyle(1);
117 TLine line3; line3.SetLineColor(kBlack); line3.SetLineWidth(2); line3.SetLineStyle(3);
118 vector< vector<TH1D*> > histo[2];
119 vector<TH1D*> varhisto;
120 vector<float> nentries;
121 TString hname, pname, variable, samVariable, leghisto, totCut, title, ytitle, lumilabel, cmslabel;
122 for(
unsigned var(0); var<vars.size(); var++){
123 unsigned Nsam(vars[var].samples.size());
124 legH = (Nsam<=3?legSingle*Nsam:legSingle*(Nsam+1)/2);
125 fracLeg = legH/(1-style.PadTopMargin-style.PadBottomMargin)*1.4;
126 for(
int ileg(0); ileg<nLegs; ileg++) leg[ileg].SetY1NDC(legY-legH);
130 if(namestyle.Contains(
"CMSPaper") && !showcuts) title =
"";
131 for(
unsigned his(0); his < 2; his++){
133 for(
unsigned sam(0); sam < Nsam; sam++){
134 hname =
"histo"; hname += var; hname += his; hname += sam;
135 delete gROOT->FindObject(hname);
136 varhisto.push_back(
new TH1D(hname, title, vars[var].
nbins, vars[var].minx, vars[var].maxx));
138 histo[his].push_back(varhisto);
140 nentries.resize(Nsam);
141 variable = vars[var].varname;
142 float maxhisto(-999);
144 for(
unsigned sam(Nsam-1); sam < Nsam; sam--){
145 int isam = vars[var].samples[sam];
146 if(!Samples[isam].isSig && !Samples[isam].isData) nbkg++;
147 samVariable = Samples[isam].samVariable;
148 totCut = Samples[isam].factor+
"*"+luminosity+
"*weight*("+vars[var].cuts+
"&&"+Samples[isam].cut+
")";
151 histo[0][var][sam]->Sumw2();
152 if(samVariable==
"noPlot") chain[isam]->Project(histo[0][var][sam]->GetName(), variable, totCut);
153 else chain[isam]->Project(histo[0][var][sam]->GetName(), samVariable, totCut);
154 histo[0][var][sam]->SetBinContent(vars[var].
nbins,
155 histo[0][var][sam]->GetBinContent(vars[var].nbins)+
156 histo[0][var][sam]->GetBinContent(vars[var].nbins+1));
158 if(rohanHack && (sam==0||sam==1)) {histo[0][var][sam]->Add(histo[0][var][sam+2]);}
160 nentries[sam] = histo[0][var][sam]->Integral(1,vars[var].nbins);
161 if(nentries[sam]<0) nentries[sam]=0;
164 if(!namestyle.Contains(
"CMSPaper") || showcuts) {
169 lumilabel = TString::Format(
"L = %1.f",luminosity.Atof())+
" fb^{-1} (13 TeV)";
170 cmslabel =
"#font[62]{CMS} #scale[0.8]{#font[52]{Simulation}}";
171 if(CMStype==
"Supplementary")cmslabel =
"#scale[0.8]{#font[62]{CMS}} #scale[0.6]{#font[52]{Supplementary (Simulation)}}";
173 if(vars[var].unit!=
"") {
175 float binwidth((vars[var].maxx-vars[var].minx)/static_cast<float>(vars[var].nbins));
176 if(binwidth<1) digits = 1;
177 ytitle += (
"/("+
RoundNumber(binwidth,digits) +
" "+vars[var].unit+
")");
179 histo[0][var][sam]->SetYTitle(ytitle);
181 for(
int bin(0); bin<=histo[0][var][sam]->GetNbinsX()+1; bin++){
182 double val(histo[0][var][sam]->GetBinContent(bin));
183 histo[1][var][sam]->SetBinContent(bin, val);
185 histo[1][var][sam]->SetBinError(bin, histo[0][var][sam]->GetBinError(bin));
188 if(rohanHack) Nsam-=2;
190 if(nbkg>0 && (vars[var].whichPlots.Contains(
"0") || vars[var].whichPlots.Contains(
"1")
191 || vars[var].whichPlots.Contains(
"2"))){
194 unsigned int last_hist=9999;
195 float normalization_ratio=1;
196 for(
unsigned sam(Nsam-1); sam < Nsam; sam--){
197 int isam = vars[var].samples[sam];
198 bool noStack = Samples[isam].isSig || Samples[isam].isData;
200 if(sam<last_hist) last_hist=sam;
201 for(
unsigned bsam(sam+1); bsam < Nsam; bsam++){
202 histo[0][var][sam]->Add(histo[0][var][bsam]);
207 histo[0][var][sam]->SetFillColor(Samples[isam].color);
208 histo[0][var][sam]->SetFillStyle(1001);
209 histo[0][var][sam]->SetLineColor(1);
210 histo[0][var][sam]->SetLineWidth(1);
213 histo[0][var][sam]->SetLineColor(Samples[isam].color);
214 if(Samples[isam].isData){
215 histo[0][var][sam]->SetMarkerStyle(Samples[isam].style);
216 histo[0][var][sam]->SetMarkerSize(1.2);
217 histo[0][var][sam]->SetLineWidth(2);
218 histo[0][var][sam]->SetLineStyle(0);
220 histo[0][var][sam]->SetLineWidth(6);
221 histo[0][var][sam]->SetLineStyle(abs(Samples[isam].style));
223 if(Samples[isam].doStack) histo[0][var][sam]->Add(histo[0][var][bkgind]);
228 if(vars[var].normalize || doRatio){
229 double err_num(0), err_den(0);
230 float num = histo[0][var][0]->IntegralAndError(1,histo[0][var][0]->GetNbinsX(),err_num);
231 float den = histo[0][var][last_hist]->IntegralAndError(1,histo[0][var][last_hist]->GetNbinsX(),err_den);
232 normalization_ratio = num/den;
233 double err_tot(den/num*sqrt(pow(err_num/num,2)+pow(err_den/den,2)));
234 err_tot = num/den*sqrt(pow(err_num/num,2)+pow(err_den/den,2));
238 cout<<
"Markers [data] are ("<<
RoundNumber((num/den)*100,1)
239 <<
" +- "<<
RoundNumber(err_tot*100,1)<<
")% the histogram [MC]"<<endl;
242 for(
unsigned sam(Nsam-1); sam < Nsam; sam--){
243 int isam = vars[var].samples[sam];
245 if(sam>=last_hist && vars[var].normalize ){ histo[0][var][sam]->Scale(normalization_ratio); nentries[sam]*= normalization_ratio;}
247 if(Samples[isam].mcerr){ histo[0][var][sam]->SetLineWidth(4); histo[0][var][sam]->SetMarkerStyle(20);
249 histo[0][var][sam]->SetMarkerSize(1.2);
250 histo[0][var][sam]->SetLineStyle(abs(Samples[isam].style));
251 histo[0][var][2]->SetFillColorAlpha(Samples[2].color, 0.5);
253 double maxval(histo[0][var][sam]->GetMaximum());
254 if(maxhisto < maxval) maxhisto = maxval;
255 maxval += sqrt(maxval);
256 if(Samples[isam].isData && maxhisto < maxval) maxhisto = maxval;
262 for(
int ileg(0); ileg<nLegs; ileg++) leg[ileg].Clear();
263 unsigned legcount(0);
264 int firstplotted(-1);
265 for(
unsigned sam(0); sam < Nsam; sam++){
266 int isam = vars[var].samples[sam];
267 leghisto = Samples[isam].label;
268 if(!namestyle.Contains(
"CMSPaper") || showcuts) leghisto +=
" [N=" +
RoundNumber(nentries[sam],0) +
"]";
270 bool noStack = Samples[isam].isSig || Samples[isam].isData;
271 unsigned ileg = (Nsam<=3?0:legcount>=(Nsam+1)/2);
273 leg[ileg].AddEntry(histo[0][var][sam], leghisto,
"LEP");
275 if(firstplotted < 0) {
276 if(!Samples[isam].mcerr) histo[0][var][sam]->Draw(
"hist");
277 else histo[0][var][sam]->Draw(
"ELP");
279 style.setTitles(histo[0][var][sam],vars[var].title, ytitle, cmslabel,
"13 TeV");
281 if(!Samples[isam].mcerr) histo[0][var][sam]->Draw(
"hist same");
282 else histo[0][var][sam]->Draw(
"ELP same");
285 if(Samples[isam].isSig) leg[ileg].AddEntry(histo[0][var][sam], leghisto,
"LEP");
286 else leg[ileg].AddEntry(histo[0][var][sam], leghisto,
"elp");
290 for(
int sam(Nsam-1); sam >= 0; sam--){
291 int isam = vars[var].samples[sam];
292 if(Samples[isam].isSig){
if(!Samples[isam].mcerr) histo[0][var][sam]->Draw(
"hist same");
else histo[0][var][sam]->Draw(
"EP same"); }
293 if(Samples[isam].isData) histo[0][var][sam]->Draw(
"e1 same");
295 for(
int ileg(0); ileg<nLegs; ileg++) leg[ileg].Draw();
296 if(histo[0][var][firstplotted]->GetMinimum() > minLog) histo[0][var][firstplotted]->SetMinimum(minLog);
297 float maxpadLog(maxhisto*exp(fracLeg*log(maxhisto/minLog)/(1-fracLeg)));
298 histo[0][var][firstplotted]->SetMinimum(minLog);
299 histo[0][var][firstplotted]->SetMaximum(maxpadLog);
300 if (!doRatio) style.moveYAxisLabel(histo[0][var][firstplotted], maxpadLog,
true);
301 histo[0][var][firstplotted]->Draw(
"axis same");
302 if(vars[var].cut>0) line.DrawLine(vars[var].cut, 0, vars[var].cut, maxhisto);
303 if(vars[var].varname==
"mj14" && vars[var].cut>0) line2.DrawLine(250, 0, 250, maxhisto);
306 TH1D* hratio_data(NULL), *hratio_mcscale(NULL);
311 unsigned ndatasam(0);
312 for(
unsigned sam(Nsam-1); sam < Nsam; sam--) {
313 int isam = vars[var].samples[sam];
314 if (Samples[isam].isData) {
315 if (ndatasam==0) hdata =
static_cast<TH1D*
>(histo[0][var][sam]->Clone());
316 else hdata->Add(histo[0][var][sam]);
321 float maxRatio = 1.9;
322 if(vars[var].maxRatio > 0) maxRatio = vars[var].maxRatio;
323 hratio_data =
static_cast<TH1D*
>(hdata->Clone());
324 hratio_mcscale =
static_cast<TH1D*
>(histo[0][var][firstplotted]->Clone());
327 hratio_data->SetTitle(
"");
328 hratio_mcscale->SetTitle(
"");
329 hratio_data->Divide(hratio_mcscale);
330 hratio_data->GetYaxis()->SetRangeUser(0.0000001,maxRatio);
331 hratio_data->GetXaxis()->SetLabelOffset(0.02);
332 hratio_data->GetXaxis()->SetLabelSize(style.LabelSize*2.2);
333 hratio_data->GetYaxis()->SetLabelSize(style.LabelSize*1.8);
334 hratio_data->GetYaxis()->SetTitle(
"Data / MC ");
335 if(Nsam==2) hratio_data->GetYaxis()->SetTitle(
"High m_{T} / Low m_{T}");
336 hratio_data->GetXaxis()->SetTitle(histo[0][var][firstplotted]->GetXaxis()->GetTitle());
337 hratio_data->GetYaxis()->SetTitleSize(style.TitleSize*2.4);
338 hratio_data->GetYaxis()->SetTitleOffset(0.65);
339 hratio_data->GetXaxis()->SetTitleSize(style.TitleSize*3);
340 hratio_data->GetXaxis()->SetTitleOffset(style.xTitleOffset*0.9);
342 histo[0][var][firstplotted]->GetXaxis()->SetLabelOffset(2.);
345 hratio_data->SetLineColor(kBlack);
346 hratio_data->SetMarkerStyle(20);
347 hratio_data->Draw(
"e0");
348 if(vars[var].hline>0) line3.DrawLine(vars[var].minx, vars[var].hline, vars[var].maxx, vars[var].hline);
350 if(vars[var].varname==
"mj"){
351 int xshade[] = {0,250,250,0,0};
352 int yshade[] = {1,1,0,0,1};
353 TGraph *hratio_shade =
new TGraph(5,xshade,yshade);
354 hratio_shade->SetFillColorAlpha(kBlack,0.2);
355 hratio_shade->Draw(
"F same");
358 if(vars[var].cut>0) line.DrawLine(vars[var].cut, 0, vars[var].cut, 1);
359 if(vars[var].cut>0) line2.DrawLine(250, 0, 250, 1);
361 l1 =
new TLine(histo[0][var][firstplotted]->GetXaxis()->GetXmin(), 1., histo[0][var][firstplotted]->GetXaxis()->GetXmax(), 1.);
365 cerr<<
"ERROR: Ratio plots currently only supported for plots with data."<<endl;
373 if(!namestyle.Contains(
"CMSPaper") || showcuts) {
375 TString lumilbl = TString::Format(
"L = %1.f",luminosity.Atof())+
" fb^{-1}";
377 llbl.SetTextSize(style.LegendSize*0.8);
378 llbl.SetNDC(); llbl.SetTextAlign(33);
379 llbl.DrawLatex(1-style.PadRightMargin-0.02,leg[0].GetY1NDC()-0.02,lumilbl);
383 pname =
"plots/"+dir+
"/log_lumi_"+vars[var].tag+plot_tag;
384 if(vars[var].normalize) pname.ReplaceAll(
"/log_lumi",
"/log_norm");
385 if(!vars[var].skiplog && (vars[var].whichPlots.Contains(
"0") || vars[var].whichPlots.Contains(
"1")))
388 float maxpad(maxhisto + fracLeg*(maxhisto-minLog)/(1-fracLeg));
389 if(vars[var].maxYaxis > 0) maxpad = vars[var].maxYaxis;
390 histo[0][var][firstplotted]->SetMinimum(0);
391 histo[0][var][firstplotted]->SetMaximum(maxpad);
393 if (!doRatio) style.moveYAxisLabel(histo[0][var][firstplotted], maxpad,
false);
394 pname =
"plots/"+dir+
"/lumi_"+vars[var].tag+plot_tag;
395 if(vars[var].normalize) pname.ReplaceAll(
"/lumi",
"/norm");
396 if(vars[var].whichPlots.Contains(
"0") || vars[var].whichPlots.Contains(
"2")) can.SaveAs(pname);
402 for(
int ileg(0); ileg<nLegs; ileg++) leg[ileg].Clear();
403 unsigned legcount = 0;
404 for(
unsigned sam(0); sam < Nsam; sam++){
405 int isam = vars[var].samples[sam];
406 histo[1][var][sam]->SetLineColor(Samples[isam].color);
407 histo[1][var][sam]->SetMarkerColor(Samples[isam].color);
408 histo[1][var][sam]->SetMarkerStyle(Samples[isam].style);
409 histo[1][var][sam]->SetLineStyle(0);
410 if(Samples[isam].isData) histo[1][var][sam]->SetLineWidth(2);
411 else histo[1][var][sam]->SetLineWidth(4);
413 if(nentries[sam]) histo[1][var][sam]->Scale(100./nentries[sam]);
414 if(maxhisto < histo[1][var][sam]->GetMaximum()) maxhisto = histo[1][var][sam]->GetMaximum();
415 style.setTitles(histo[1][var][sam],vars[var].title,
"", cmslabel,
"13 TeV");
417 histo[1][var][sam]->SetXTitle(vars[var].title);
418 histo[1][var][sam]->GetXaxis()->SetLabelSize(0);
420 if(vars[var].unit!=
"") {
422 float binwidth((vars[var].maxx-vars[var].minx)/static_cast<float>(vars[var].
nbins));
423 if(binwidth<1) digits = 1;
424 ytitle += (
"/("+
RoundNumber(binwidth,digits) +
" "+vars[var].unit+
")");
427 histo[1][var][sam]->SetYTitle(ytitle);
428 if(Samples[isam].isData) histo[1][var][sam]->Draw(
"e1 x0");
429 else histo[1][var][sam]->Draw(
"hist");
432 if(Samples[isam].style>0 && !Samples[isam].isData) histo[1][var][sam]->Draw(
"hist same");
433 else histo[1][var][sam]->Draw(
"e1 x0 same");
435 leghisto = Samples[isam].label;
436 unsigned ileg = (Nsam<=3?0:legcount>=(Nsam+1)/2);
437 if(!namestyle.Contains(
"CMSPaper") || showcuts){
438 if(vars[var].nevents.at(sam)<0){
439 leghisto +=
" [#mu=";
441 if(histo[1][var][sam]->GetMean()<30) digits = 1;
442 leghisto +=
RoundNumber(histo[1][var][sam]->GetMean(),digits) +
"]";
444 leg[ileg].SetX1NDC(0.24); leg[ileg].SetX2NDC(0.7);
445 leg[ileg].SetTextSize(0.75*style.LegendSize);
449 if(Samples[isam].isData) leg[ileg].AddEntry(histo[1][var][sam], leghisto,
"P");
450 else leg[ileg].AddEntry(histo[1][var][sam], leghisto,
"L");
454 if(vars[var].varname==
"mj"){
455 float xshade[] = {0,250,250,0,0};
456 float yshade[] = {maxhisto,maxhisto,0,0,maxhisto};
457 TGraph* shade =
new TGraph(5,xshade,yshade);
458 shade->SetFillColorAlpha(kBlack,0.2);
459 shade->Draw(
"F same");
462 for(
int ileg(0); ileg<nLegs; ileg++) leg[ileg].Draw();
463 if(vars[var].cut>0) line.DrawLine(vars[var].cut, 0, vars[var].cut, maxhisto);
464 if(vars[var].cut>0) line2.DrawLine(250, 0, 250, maxhisto);
465 float maxpad = maxhisto + fracLeg*maxhisto/(1-fracLeg);
466 histo[1][var][0]->SetMaximum(maxpad);
467 histo[1][var][0]->Draw(
"axis same");
468 style.moveYAxisLabel(histo[1][var][0], maxpad,
false);
470 pname =
"plots/"+dir+
"/shapes_"+vars[var].tag+plot_tag;
471 if(vars[var].whichPlots.Contains(
"0") || vars[var].whichPlots.Contains(
"3")) can.SaveAs(pname);
472 float maxpadLog = maxhisto*exp(fracLeg*log(maxhisto/minLog)/(1-fracLeg));
473 histo[1][var][0]->SetMaximum(maxpadLog);
474 style.moveYAxisLabel(histo[1][var][0], maxpadLog,
true);
476 pname =
"plots/"+dir+
"/log_shapes_"+vars[var].tag+plot_tag;
477 if(!vars[var].skiplog && (vars[var].whichPlots.Contains(
"0") || vars[var].whichPlots.Contains(
"4")))
482 for(
unsigned his(0); his < 2; his++){
483 for(
unsigned var(0); var<vars.size(); var++){
484 for(
unsigned sam(0); sam < vars[var].samples.size(); sam++)
485 if(histo[his][var][sam]) histo[his][var][sam]->Delete();
492 TString filetype, TString namestyle, TString dir){
494 TString lumi_nodot =
luminosity; lumi_nodot.ReplaceAll(
".",
"p");
497 if(namestyle.Contains(
"CMSPaper")) style.
nDivisions = 706;
503 vector<TChain *> chain;
504 for(
unsigned sam(0); sam < Samples.size(); sam++){
505 chain.push_back(
new TChain(
"tree"));
506 for(
unsigned insam(0); insam < Samples[sam].file.size(); insam++){
508 chain[sam]->Add(Samples[sam].
file[insam]);
514 TString hname, title, variable, totCut;
517 for(
unsigned int i=0; i<vars.size(); i++){
518 hname =
"hist"; hname += i;
519 title =
cuts2title(vars[i].cuts); title +=
";"; title += vars[i].titlex; title +=
";"; title += vars[i].titley;
520 variable = vars[i].varnamey+
":"+vars[i].varnamex;
521 totCut = luminosity+
"*weight*("+vars[i].cuts+
")";
526 printf(
"\rSetting up chain %i of %lu for 2D plots...",i+1,vars.size());
528 if(i==vars.size()-1) printf(
"\n");
532 TChain *tempChain =
new TChain(
"tree");
533 for(
unsigned int j=0; j<vars[i].samples.size(); j++){
535 tempChain->Add(chain[vars[i].samples[j]]);
540 hists.push_back(
new TH2D(hname, title, vars[i].nbinsx,vars[i].minx,vars[i].maxx,vars[i].nbinsy,vars[i].miny,vars[i].maxy));
541 tempChain->Project(hname, variable, totCut,
"colz");
545 gStyle->SetOptStat(
"emr");
546 gStyle->SetStatX(0.338); gStyle->SetStatW(0.18); gStyle->SetStatY(0.90); gStyle->SetStatH(0.14);
548 cout<<
"Printing 2D plots"<<endl;
549 for(
unsigned int doLogz=0; doLogz<2; doLogz++){
550 for(
unsigned int i=0; i<vars.size(); i++){
551 if(doLogz==0 && vars[i].whichPlots.Contains(
"2"))
continue;
552 if(doLogz==1 && vars[i].whichPlots.Contains(
"1"))
continue;
554 TString plot_tag(
"_lumi"+lumi_nodot+filetype);
555 hists[i]->SetStats(1);
556 hists[i]->Draw(
"colz");
557 pname =
"plots/"+dir+
"/"+vars[i].tag+plot_tag;
558 if(doLogz) pname =
"plots/"+dir+
"/logz_"+vars[i].tag+plot_tag;
561 if(vars[i].cutx>0 || vars[i].cuty>0){
562 TLine line; line.SetLineColor(1); line.SetLineWidth(6); line.SetLineStyle(2);
563 if(vars[i].cutx>0 && vars[i].cuty>0){
564 line.DrawLine(vars[i].cutx,0,vars[i].cutx,vars[i].cuty);
566 else if(vars[i].cutx>0 && vars[i].cuty<0){
567 line.DrawLine(vars[i].cutx,0,vars[i].cutx,vars[i].maxy);
569 else if(vars[i].cutx<0 && vars[i].cuty>0){
570 line.DrawLine(0,vars[i].cuty,vars[i].maxx,vars[i].cuty);
577 for(
unsigned int i=0; i<vars.size(); i++){
578 if(hists[i]) hists[i]->Delete();
583 if(title==
"1") title =
"";
584 title.ReplaceAll(
"1==1",
"Full Sample");
585 title.ReplaceAll(
"ht>500&&met>200&&njets>=7&&nbm>=2&&nleps==1",
"Baseline");
586 title.ReplaceAll(
"ht>500&&met>200&&njets>=7&&nbm>=1&&nleps==1",
"BaselineNb1");
587 title.ReplaceAll(
"Sum$(abs(mc_id)==11)",
"n^{true}_{e}");
588 title.ReplaceAll(
"Sum$(abs(mc_id)==13)",
"n^{true}_{#mu}");
589 title.ReplaceAll(
"Sum$(genels_pt>0)",
"n^{true}_{e}");
590 title.ReplaceAll(
"Sum$(genmus_pt>0)",
"n^{true}_{#mu}");
591 title.ReplaceAll(
"Sum$(mus_sigid&&mus_miniso<0.2)",
"n_{#mu}^{10}");
592 title.ReplaceAll(
"Sum$(els_sigid&&els_miniso<0.1)",
"n_{e}^{10}");
593 title.ReplaceAll(
"nvmus==1&&nmus==1&&nvels==0",
"1 #mu");
594 title.ReplaceAll(
"nvmus10==0&&nvels10==0",
"0 leptons");
595 title.ReplaceAll(
"(nmus+nels)",
"n_{lep}");
596 title.ReplaceAll(
"(nvmus+nvels)",
"n^{veto}_{lep}");
597 title.ReplaceAll(
"(nvmus>=2||nvels>=2)",
"n^{veto}_{lep} #geq 2");
598 title.ReplaceAll(
"(mumu_m*(mumu_m>0)+elel_m*(elel_m>0))>80&&(mumu_m*(mumu_m>0)+elel_m*(elel_m>0))<100",
600 title.ReplaceAll(
"(mumuv_m*(mumuv_m>0)+elelv_m*(elelv_m>0))>80&&(mumuv_m*(mumuv_m>0)+elelv_m*(elelv_m>0))<100",
602 title.ReplaceAll(
"onht>350&&onmet>100&&",
"");
604 title.ReplaceAll(
"nmus",
"n_{#mu}");
605 title.ReplaceAll(
"nels",
"n_{e}");
606 title.ReplaceAll(
"nvmus",
"n^{veto}_{#mu}");
607 title.ReplaceAll(
"nvels",
"n^{veto}_{e}");
608 title.ReplaceAll(
"ntruleps",
"n^{true}_{l}");
609 title.ReplaceAll(
"_ra2b",
"^{ra2b}");
610 title.ReplaceAll(
"npv",
"n_{PV}");
611 title.ReplaceAll(
"mumu_pt1",
"p_{T}^{#mu}"); title.ReplaceAll(
"elel_pt1",
"p_{T}^{e}");
613 title.ReplaceAll(
"onmet",
"MET^{on}"); title.ReplaceAll(
"onht",
"H_{T}^{on}");
614 title.ReplaceAll(
"njets30",
"n_{jets}^{30}");
615 title.ReplaceAll(
"els_pt",
"p^{e}_{T}");title.ReplaceAll(
"mus_pt",
"p^{#mu}_{T}");title.ReplaceAll(
"jets_pt",
"p^{jet}_{T}");
616 title.ReplaceAll(
"mus_reliso",
"RelIso"); title.ReplaceAll(
"els_reliso",
"RelIso");
617 title.ReplaceAll(
"mus_miniso_tr15",
"MiniIso"); title.ReplaceAll(
"els_miniso_tr15",
"MiniIso");
618 title.ReplaceAll(
"njets",
"n_{jets}");title.ReplaceAll(
"abs(lep_id)==13&&",
"");
619 title.ReplaceAll(
">=",
" #geq "); title.ReplaceAll(
">",
" > ");
620 title.ReplaceAll(
"<=",
" #leq "); title.ReplaceAll(
"<",
" < ");
621 title.ReplaceAll(
"&&",
", "); title.ReplaceAll(
"==",
" = ");
622 title.ReplaceAll(
"met",
"MET"); title.ReplaceAll(
"ht_hlt",
"H_{T}^{HLT}");
623 title.ReplaceAll(
"ht",
"H_{T}"); title.ReplaceAll(
"mt",
"m_{T}");
624 title.ReplaceAll(
"ntks_chg==0",
" ITV");
625 title.ReplaceAll(
"nbm",
"n_{b}");
626 title.ReplaceAll(
"nbl",
"n_{b,l}");
627 title.ReplaceAll(
"mj",
" M_{J}");
633 if (cut.Contains(
"<"))
634 cut.ReplaceAll(
"<",
">=");
635 else if (cut.Contains(
">"))
636 cut.ReplaceAll(
">",
"<=");
637 else if (cut.Contains(
"<="))
638 cut.ReplaceAll(
"<=",
">");
639 else if (cut.Contains(
">="))
640 cut.ReplaceAll(
">=",
"<");
645 pfeats::pfeats(
const vector<int> &isamples,
const TString &icut,
const TString &itagname):
651 hfeats::hfeats(TString ivarname,
int inbins,
float iminx,
float imaxx, vector<int> isamples,
652 TString ititle, TString icuts,
float icut, TString itagname,
bool iskiplog, vector<double> inevents):
667 if(inevents.at(0)<0) nevents = vector<double>(isamples.size(),-1);
668 else nevents = inevents;
669 if(nevents.size() != samples.size() ) cout<<
"hfeats samples/nevents size mismatch: "<<ititle<<endl;
674 string ctitle(title.Data());
675 if(!(ctitle.find(
"GeV")==std::string::npos)) unit =
"GeV";
676 if(!(ctitle.find(
"phi")==std::string::npos)) unit =
"rad";
678 hfeats::hfeats(TString ivarnamex, TString ivarnamey,
int inbinsx,
float iminx,
float imaxx,
int inbinsy,
float iminy,
float imaxy, vector<int> isamples,
679 TString ititlex, TString ititley, TString icuts,
float icutx,
float icuty, TString itagname):
700 string ctitle(title.Data());
701 if(!(ctitle.find(
"GeV")==std::string::npos)) unit =
"GeV";
702 if(!(ctitle.find(
"phi")==std::string::npos)) unit =
"rad";
705 hfeats::hfeats(TString ivarname,
int inbins,
float *ibinning, vector<int> isamples,
706 TString ititle, TString icuts,
float icut, TString itagname,
bool iskiplog, vector<double> inevents):
715 minx = binning[0]; maxx = binning[
nbins];
720 if(inevents.at(0)<0) nevents = vector<double>(isamples.size(),-1);
721 else nevents = inevents;
722 if(nevents.size() != samples.size() ) cout<<
"hfeats samples/nevents size mismatch: "<<ititle<<endl;
726 string ctitle(title.Data());
727 if(!(ctitle.find(
"GeV")==std::string::npos)) unit =
"GeV";
728 if(!(ctitle.find(
"phi")==std::string::npos)) unit =
"rad";
733 if(varnamex!=
"" && varnamey!=
"")
tag = varnamex+
"_vs_"+varnamey;
734 if(cuts!=
"1")
tag+=
"_"+cuts;
735 if(tagname!=
"")
tag.Prepend(tagname+
"_");
737 tag.ReplaceAll(
"1==1",
"full_sample");
738 tag.ReplaceAll(
".",
"");
739 tag.ReplaceAll(
"(",
"");
tag.ReplaceAll(
"$",
"");
tag.ReplaceAll(
")",
"");
740 tag.ReplaceAll(
"[",
"");
tag.ReplaceAll(
"]",
"");
tag.ReplaceAll(
"||",
"_");
741 tag.ReplaceAll(
"/",
"_");
tag.ReplaceAll(
"*",
"");
tag.ReplaceAll(
"&&",
"_");
742 tag.ReplaceAll(
">=",
"ge");
tag.ReplaceAll(
"<=",
"se");
743 tag.ReplaceAll(
">",
"g");
tag.ReplaceAll(
"<",
"s");
tag.ReplaceAll(
"=",
"");
744 tag.ReplaceAll(
"+",
"");
tag.ReplaceAll(
"&",
"");
745 tag.ReplaceAll(
"!",
"not");
746 tag.ReplaceAll(
"#",
"");
tag.ReplaceAll(
"{",
"");
tag.ReplaceAll(
"}",
"");
748 tag.ReplaceAll(
"htg500_metg200_njetsge7_nbmge1_nmusnels1_",
"Baseline1B_");
749 tag.ReplaceAll(
"htg500_metg200_njetsge7_nbmge2_nmusnels1_",
"Baseline_");
751 tag.ReplaceAll(
"htg500_metg200_njetsge7_nbmge1_nleps1_",
"Baseline1B_");
752 tag.ReplaceAll(
"htg500_metg200_njetsge7_nbmge2_nleps1_",
"Baseline_");
754 tag.ReplaceAll(
"tks_idlep_chargeg0_nottks_is_primary_tks_idtks_id121_",
"os_els_");
755 tag.ReplaceAll(
"tks_idlep_chargeg0_nottks_is_primary_tks_idtks_id169_",
"os_mus_");
756 tag.ReplaceAll(
"tks_idlep_charges0_nottks_is_primary_nottks_idtks_id169_tks_idtks_id121_",
"os_had_");
758 tag.ReplaceAll(
"nottks_from_w",
"fakes");
759 tag.ReplaceAll(
"tks_from_w",
"prompt");
761 tag.ReplaceAll(
"tks_ptmintks_mini_netks_mini_ch,tks_r02_netks_r02_ch",
"abs_mini_iso_chgneu");
762 tag.ReplaceAll(
"tks_ptmintks_mini_netks_mini_ch,tks_r05_netks_r05_ch",
"abs_r_05_mini_iso_chgneu");
763 tag.ReplaceAll(
"tks_pttks_mini_netks_mini_ch",
"abs_untruncated_mini_iso_chgneu");
764 tag.ReplaceAll(
"mintks_mini_netks_mini_ch,tks_r02_netks_r02_ch",
"rel_02_mini_iso_chgneu");
765 tag.ReplaceAll(
"mintks_mini_netks_mini_ch,tks_r05_netks_r05_ch",
"rel_05_mini_iso_chgneu");
766 tag.ReplaceAll(
"tks_mini_netks_mini_ch",
"rel_untruncated_mini_iso_chgneu");
768 tag.ReplaceAll(
"tks_ptmintks_mini_ch,tks_r02_ch",
"abs_mini_iso_chg");
769 tag.ReplaceAll(
"tks_ptmintks_mini_ch,tks_r05_ch",
"abs_r05_mini_iso_chg");
770 tag.ReplaceAll(
"tks_pttks_mini_ch",
"abs_untruncated_mini_iso_chg");
771 tag.ReplaceAll(
"mintks_mini_ch,tks_r02_ch",
"rel_02_mini_iso_chg");
772 tag.ReplaceAll(
"mintks_mini_ch,tks_r05_ch",
"rel_05_mini_iso_chg");
773 tag.ReplaceAll(
"tks_mini_ch",
"rel_untruncated_mini_iso_chg");
780 tag.ReplaceAll(
".",
"");
781 tag.ReplaceAll(
"(",
""); tag.ReplaceAll(
"$",
""); tag.ReplaceAll(
")",
"");
782 tag.ReplaceAll(
"[",
""); tag.ReplaceAll(
"]",
""); tag.ReplaceAll(
"||",
"_");
783 tag.ReplaceAll(
"/",
"_"); tag.ReplaceAll(
"*",
""); tag.ReplaceAll(
"&&",
"_");
784 tag.ReplaceAll(
">=",
"ge"); tag.ReplaceAll(
"<=",
"se");
785 tag.ReplaceAll(
">",
"g"); tag.ReplaceAll(
"<",
"s"); tag.ReplaceAll(
"=",
"");
786 tag.ReplaceAll(
"+",
""); tag.ReplaceAll(
"&",
"");
787 tag.ReplaceAll(
"!",
"not");
788 tag.ReplaceAll(
"#",
""); tag.ReplaceAll(
"{",
""); tag.ReplaceAll(
"}",
"");
793 sfeats::sfeats(vector<TString> ifile, TString ilabel,
int icolor,
int istyle, TString icut,
794 TString isamVariable){
795 file = ifile; label = ilabel; cut = icut;
796 color = icolor; style = istyle;
797 isSig = ifile[0].Contains(
"T1tttt");
798 samVariable = isamVariable;
800 if (ifile.size() && ifile[0].Contains(
"ST_")) factor =
"0.4";
802 tag.ReplaceAll(
"(",
"");
tag.ReplaceAll(
",",
"_");
tag.ReplaceAll(
")",
"");
803 tag.ReplaceAll(
"{",
"");
tag.ReplaceAll(
"#,",
"");
tag.ReplaceAll(
"}",
"");
804 doStack =
false; isData =
false; mcerr=
false;
810 bincuts = vector<TString>();
811 weights = vector<double>();
814 bincuts.push_back(ibincut);
815 weights.push_back(iweight);
818 if (i<bincuts.size())
return bincuts[i];
819 else {cout<<
"ERROR: bincut out of range"<<endl;
return "";}
822 if (i<weights.size())
return weights[i];
823 else {cout<<
"ERROR: weight out of range"<<endl;
return -1.;}
826 return weights.size();
830 void calc_chi2(TH1D *histo,
float &chi2,
int &ndof,
float &pvalue,
float &average){
831 vector<double> vals[2];
832 double sumx_sig2(0), sum_sig2(0);
834 for(
int bin(1); bin<=histo->GetNbinsX(); bin++){
835 if(histo->GetBinError(bin) > 0){
836 vals[0].push_back(histo->GetBinContent(bin));
837 vals[1].push_back(histo->GetBinError(bin));
839 sumx_sig2 += vals[0][ndof]/pow(vals[1][ndof],2);
840 sum_sig2 += 1/pow(vals[1][ndof],2);
844 if(sum_sig2<=0){cout<<
"All errors in histo are zero. Exiting."<<endl;
return;}
845 average = sumx_sig2/sum_sig2;
847 for(
int ival(0); ival <= ndof; ival++){
848 chi2 += pow((vals[0][ival]-average)/vals[1][ival],2);
850 pvalue = TMath::Prob(chi2,ndof);
854 void calc_chi2_diff(TH1D *histo1, TH1D *histo2,
float &chi2,
int &ndof,
float &pvalue,
float *average){
855 TH1D *histos[] = {histo1, histo2};
856 vector<double> vals[2][2];
857 double sumx_sig2[] = {0,0}, sum_sig2[] = {0,0};
859 for(
int his(0); his<2; his++){
860 for(
int bin(1); bin<=histos[his]->GetNbinsX(); bin++){
861 if(histos[his]->GetBinError(bin) > 0){
862 vals[his][0].push_back(histos[his]->GetBinContent(bin));
863 vals[his][1].push_back(histos[his]->GetBinError(bin));
865 sumx_sig2[his] += vals[his][0][ndofs[his]];
870 if(sum_sig2[his]<=0){cout<<
"All errors in histo are zero. Exiting."<<endl;
return;}
871 average[his] = sumx_sig2[his]/sum_sig2[his];
876 if(ndofs[0] != ndofs[1]) {cout<<
"First histo has "<<ndofs[0]<<
" ndof and second "<<ndofs[1]<<endl;
return;}
877 else ndof = ndofs[0];
879 double Raver = average[0]/average[1];
880 for(
int ival(0); ival <= ndof; ival++){
881 double error(sqrt(pow(vals[0][1][ival],2)+pow(vals[1][1][ival]*Raver,2)));
882 chi2 += pow((vals[0][0][ival]-vals[1][0][ival]*Raver)/error,2);
884 pvalue = TMath::Prob(chi2,ndof);
887 long getYieldErr(TChain& tree, TString cut,
double& yield,
double& uncertainty){
888 const TString hist_name(
"temp");
889 TH1D temp(hist_name,
"", 1, -1.0, 1.0);
891 long entries = tree.Project(hist_name,
"0.0", cut);
892 yield = temp.IntegralAndError(0,2,uncertainty);
900 cout<<Form(
"event num: %i",tree.
event())<<endl;
902 cout<<
"print MC doc: "<<endl;
903 for(
unsigned int igen = 0; igen<tree.
mc_pt().size();igen++){
904 cout<<Form(
"%i: ID= %i \tpT=%.1f \teta=%.1f \tphi=%.1f \tmom= %i",igen,tree.
mc_id().at(igen),tree.
mc_pt().at(igen),tree.
mc_eta().at(igen),tree.
mc_phi().at(igen),
static_cast<int>(tree.
mc_mom().at(igen)))<<endl;
907 cout<<
"Dumping Tracks"<<endl;
908 for(
unsigned int itks = 0; itks<tree.
tks_pt().size();itks++){
909 cout<<Form(
"%i: ID= %i \tpT=%.1f \teta=%.1f \tphi=%.1f \tisPrimary= %i \tfrom W= %i \ttruID = %i",itks,tree.
tks_id().at(itks),tree.
tks_pt().at(itks),tree.
tks_eta().at(itks),tree.
tks_phi().at(itks),
static_cast<int>(tree.
tks_is_primary().at(itks)),static_cast<int>(tree.
tks_from_w().at(itks)),tree.
tks_tru_id().at(itks))<<endl;
914 TColor
ucsb_blue(2000, 1/255.,57/255.,166/255.);
915 TColor
ucsb_gold(2001, 255/255.,200/255.,47/255);
916 TColor
penn_red(2002, 149/255.,0/255.,26/255.);
917 TColor
uf_orange(2003, 255/255.,74/255.,0/255.);
918 TColor
uo_green(2004, 0/255.,79/255.,39/255.);
919 TColor
tcu_purple(2005, 52/255.,42/255.,123/255.);
921 TColor
sig_teal(2007, 96/255.,159/255.,128/255.);
922 TColor
sig_gold(2008, 215/255.,162/255.,50/255.);
923 TColor
seal_brown(2010, 89/255.,38/255.,11/255.);
927 TColor
light_blue(2011, 153/255.,220/255.,255/255.);
928 TColor
med_blue(2012, 1/255.,148/255.,218/255.);
929 TColor
red(2015, 250/255.,96/255.,1/255.);
932 TColor
purple(2019, 183/255.,66/255.,176/255.);
933 TColor
ucsb_gold(2020, 255/255.,200/255.,47/255);
937 double intGaus(
double mean,
double sigma,
double minX,
double maxX){
938 return (TMath::Erf((maxX-mean)/sigma/sqrt(2.))-TMath::Erf((minX-mean)/sigma/sqrt(2.)))/2.;
946 double u = rand.Uniform(1);
951 double d = a - 1.0 / 3.0;
952 double c = (1.0 / 3.0) / sqrt (d);
956 x = rand.Gaus(0, 1.0);
964 if (u < 1 - 0.0331 * x * x * x * x)
967 if (log (u) < 0.5 * x * x + d * (1 - v + log (v)))
978 double calcKappa(vector<vector<float> > &entries, vector<vector<float> > &weights,
979 vector<float> &powers,
float &mSigma,
float &pSigma,
bool do_data,
985 vector<float> fKappas;
986 double mean(0.), bignum(1e10);
988 for(
int rep(0), irep(0); rep <
nrep; rep++) {
989 fKappas.push_back(1.);
990 bool Denom_is0(
false);
991 for(
unsigned obs(0); obs < powers.size(); obs++) {
993 for(
unsigned sam(0); sam < entries[obs].size(); sam++) {
996 if(do_data) observed += entries[obs][sam]*weights[obs][sam];
997 else observed +=
gsl_ran_gamma(entries[obs][sam]+1,1,rand)*weights[obs][sam];
1001 if(observed <= 0 && powers[obs] < 0) Denom_is0 =
true;
1002 else fKappas[irep] *= pow(observed, powers[obs]);
1004 if(Denom_is0 && fKappas[irep]==0) {
1008 if(Denom_is0) fKappas[irep] = bignum;
1009 else mean += fKappas[irep];
1013 int ntot(nrep-nbadk);
1014 mean /=
static_cast<double>(ntot);
1016 sort(fKappas.begin(), fKappas.end());
1017 double gSigma =
intGaus(0,1,0,1);
1018 int iMedian((nrep-nbadk+1)/2-1);
1019 int imSigma(iMedian-static_cast<int>(gSigma*ntot)), ipSigma(iMedian+static_cast<int>(gSigma*ntot));
1020 float median(fKappas[iMedian]);
1021 mSigma = median-fKappas[imSigma]; pSigma = fKappas[ipSigma]-median;
1026 for(
unsigned obs(0); obs < powers.size(); obs++) {
1028 if(verbose) cout<<obs<<
": ";
1029 for(
unsigned sam(0); sam < entries[obs].size(); sam++) {
1030 if(verbose) cout<<
"Yield"<<sam<<
" "<<entries[obs][sam]*weights[obs][sam]
1031 <<
", N"<<sam<<
" "<<entries[obs][sam]
1032 <<
", avW"<<sam<<
" "<<weights[obs][sam]<<
". ";
1033 stdyield += entries[obs][sam]*weights[obs][sam];
1035 if(verbose) cout<<
" ==> Total yield "<<stdyield<<endl;
1036 if(stdyield <= 0 && powers[obs] < 0) infStd =
true;
1037 else stdval *= pow(stdyield, powers[obs]);
1039 if(infStd) stdval = median;
1042 for(
int rep(0); rep < ntot; rep++)
1043 if(fKappas[rep]>stdval) {istd = rep;
break;}
1044 imSigma = istd-
static_cast<int>(gSigma*ntot);
1045 ipSigma = istd+
static_cast<int>(gSigma*ntot);
1047 ipSigma += (-imSigma);
1051 imSigma -= (ipSigma-ntot+1);
1054 mSigma = stdval-fKappas[imSigma]; pSigma = fKappas[ipSigma]-stdval;
1058 double minH(stdval-3*mSigma), maxH(stdval+3*pSigma);
1059 if(minH < fKappas[0]) minH = fKappas[0];
1060 if(maxH > fKappas[ntot-1]) maxH = fKappas[ntot-1];
1061 TH1D histo(
"h",
"",nbins, minH, maxH);
1062 for(
int rep(0); rep < ntot; rep++)
1063 histo.Fill(fKappas[rep]);
1066 histo.Scale(1/histo.Integral());
1067 histo.SetMaximum(histo.GetMaximum()*1.2);
1068 histo.SetLineWidth(3);
1070 histo.SetXTitle(
"Expected value");
1071 histo.SetYTitle(
"Probability");
1073 if(do_plot) can.SaveAs(
"test.eps");
1075 double mode(histo.GetBinLowEdge(histo.GetMaximumBin()));
1076 if(verbose) cout<<
"Std kappa = "<<stdval<<
"+"<<pSigma<<
"-"<<mSigma<<
". Mean = "<<mean
1077 <<
". Mode = "<<mode<<
". Median = "<<median<<endl;
TColor med_blue(2012, 1/255., 148/255., 218/255.)
virtual int const & ntruleps() const
TColor skype_green(2018, 9/255., 186/255., 1/255.)
TColor tcu_purple(2005, 52/255., 42/255., 123/255.)
TColor ucsb_gold(2001, 255/255., 200/255., 47/255)
double weight(unsigned i)
TString cuts2title(TString title)
void calc_chi2_diff(TH1D *histo1, TH1D *histo2, float &chi2, int &ndof, float &pvalue, float *average)
virtual std::vector< size_t > const & mc_mom() const
TColor uf_orange(2003, 255/255., 74/255., 0/255.)
virtual std::vector< int > const & tks_tru_id() const
virtual std::vector< bool > const & tks_is_primary() const
virtual int const & ntrutausl() const
TColor tar_heel_blue(2006, 86/255., 160/255., 211/255.)
sfeats(std::vector< TString > ifile, TString ilabel, int icolor=1, int istyle=1, TString icut="1", TString samVariable="noPlot")
double intGaus(double mean, double sigma, double minX, double maxX)
double calcKappa(vector< vector< float > > &entries, vector< vector< float > > &weights, vector< float > &powers, float &mSigma, float &pSigma, bool do_data, bool verbose, bool do_plot, int nrep)
virtual std::vector< float > const & tks_pt() const
TString bincut(unsigned i)
int const & event() const
TString invertcut(TString cut)
hfeats(TString ivarname, int inbins, float iminx, float imaxx, std::vector< int > isamples, TString ititle="", TString icuts="1", float icut=-1, TString itagname="", bool iskiplog=false, std::vector< double > inevents=std::vector< double >(1,-1.))
TColor ucsb_blue(2000, 1/255., 57/255., 166/255.)
virtual std::vector< float > const & tks_eta() const
TColor light_blue(2011, 153/255., 220/255., 255/255.)
void calc_chi2(TH1D *histo, float &chi2, int &ndof, float &pvalue, float &average)
void plot_2D_distributions(vector< sfeats > Samples, vector< hfeats > vars, TString luminosity, TString filetype, TString namestyle, TString dir)
TString format_tag(TString tag)
double gsl_ran_gamma(const double a, const double b, TRandom3 &rand)
TString RoundNumber(double num, int decimals, double denom=1.)
TColor sig_gold(2008, 215/255., 162/255., 50/255.)
virtual std::vector< int > const & mc_id() const
virtual std::vector< float > const & mc_pt() const
TColor red(2015, 250/255., 96/255., 1/255.)
virtual std::vector< float > const & mc_phi() const
virtual int const & ntrutaush() const
TColor uo_green(2004, 0/255., 79/255., 39/255.)
virtual std::vector< bool > const & tks_from_w() const
TColor penn_red(2002, 149/255., 0/255., 26/255.)
TColor purple(2019, 183/255., 66/255., 176/255.)
void push_back(TString bincut, double weight)
pfeats(const std::vector< int > &isamples, const TString &icut="1", const TString &itagname="")
virtual int const & ntrumus() const
virtual std::vector< int > const & tks_id() const
virtual void GetEntry(const long entry)
virtual std::vector< float > const & tks_phi() const
TColor seal_brown(2010, 89/255., 38/255., 11/255.)
virtual std::vector< float > const & mc_eta() const
TColor sig_teal(2007, 96/255., 159/255., 128/255.)
void dump_event(small_tree_full &tree, int entry)
sysfeats(TString iname, TString ititle)
void plot_distributions(vector< sfeats > Samples, vector< hfeats > vars, TString luminosity, TString filetype, TString namestyle, TString dir, bool doRatio)
virtual int const & ntruels() const
long getYieldErr(TChain &tree, TString cut, double &yield, double &uncertainty)