67 |
|
bool is53reco=true; |
68 |
|
bool openBox = true; |
69 |
|
vector<TH1F*> FakeHistoHeap; |
70 |
< |
|
70 |
> |
bool DrawMetSignalRegionMllLines=false; // whether to draw the lines in mll plots for the MET signal region |
71 |
> |
float ConsideredZWidth=20; |
72 |
|
} |
73 |
|
|
74 |
|
bool dopng=false; |
95 |
|
void write_info(string funcname, string text); |
96 |
|
string get_directory(); |
97 |
|
bool Contains(string wholestring, string findme); |
98 |
+ |
TH1F* CollapseStack(THStack stack,TString hname); |
99 |
|
//------------------------------------------------------------------------------------- |
100 |
|
|
101 |
|
template<typename U> |
599 |
|
string prel=" Preliminary"; |
600 |
|
if(PlottingSetup::PaperMode) prel=""; |
601 |
|
//prelimtext << "CMS Preliminary 2011 , #sqrt{s}= 7 TeV, L= O(1) fb^{-1}"; //temporary replacement |
602 |
< |
if(PlottingSetup::is53reco) prel += " 53X"; |
602 |
> |
// if(PlottingSetup::is53reco) prel += " 53X"; |
603 |
|
string energy="7 TeV"; |
604 |
|
if(PlottingSetup::is2012) energy="8 TeV"; |
605 |
|
if(writelumi == 0) { |
606 |
|
if(isMC) prelimtext << "CMS Simulation, #sqrt{s} = " << energy; |
607 |
|
else prelimtext << "CMS" << prel << ", #sqrt{s} = " << energy; |
608 |
|
} else { |
609 |
< |
if(isMC) prelimtext << "CMS Simulation, #sqrt{s} = " << energy << ", L_{int} = " << std::setprecision(3) <<writelumi<<" "<<barn<<"^{-1}"; |
610 |
< |
else prelimtext << "CMS" << prel << ", #sqrt{s} = " << energy << ", L_{int} = " << std::setprecision(3) <<writelumi<<" "<<barn<<"^{-1}"; |
609 |
> |
if(isMC) prelimtext << "CMS Simulation, #sqrt{s} = " << energy << ", #scale[0.6]{#int}L dt = " << std::setprecision(3) <<writelumi<<" "<<barn<<"^{-1}"; |
610 |
> |
else prelimtext << "CMS" << prel << ", #sqrt{s} = " << energy << ", #scale[0.6]{#int}L dt = " << std::setprecision(3) <<writelumi<<" "<<barn<<"^{-1}"; |
611 |
|
} |
612 |
|
TPaveText *eventSelectionPaveText = new TPaveText(0.27, 0.93,0.77, 1.0,"blNDC"); |
613 |
|
eventSelectionPaveText->SetFillStyle(4000); |
1238 |
|
else return false; |
1239 |
|
} |
1240 |
|
|
1241 |
+ |
|
1242 |
|
////////////////////////////////////////////////////////////////////////////// |
1243 |
|
// |
1244 |
|
// http://stackoverflow.com/questions/669438/how-to-get-memory-usage-at-run-time-in-c |
1251 |
|
/* usage: |
1252 |
|
double vm2, rss2; |
1253 |
|
process_mem_usage(vm2, rss2); |
1254 |
< |
cout << "Memory usage: VM: " << vm << "; RSS: " << rss << endl; |
1254 |
> |
cout << "Memory usage: VM: " << vm2 << "; RSS: " << rss2 << endl; |
1255 |
|
*/ |
1256 |
|
|
1257 |
|
void process_mem_usage(double& vm_usage, double& resident_set) |
1310 |
|
} |
1311 |
|
|
1312 |
|
|
1313 |
< |
TText* WriteSelection(int njets) { |
1313 |
> |
TLatex* WriteSelection(int njets) { |
1314 |
|
string sel="Loose selection"; |
1315 |
< |
if(njets==3) sel="Tight selection"; |
1315 |
> |
if(njets==3) sel="Low E_{T}^{miss} selection"; |
1316 |
|
assert(njets==2||njets==3); |
1317 |
< |
TText *sele = new TText(0.97,0.135,sel.c_str()); |
1317 |
> |
TLatex *sele = new TLatex(0.97,0.135,sel.c_str()); |
1318 |
|
sele->SetNDC(true); |
1319 |
|
sele->SetTextColor(TColor::GetColor("#848484")); |
1320 |
|
sele->SetTextFont(42); |
1372 |
|
Ratio_main_canvas->Range(0,0,1,1); |
1373 |
|
Ratio_main_canvas->SetBorderSize(0); |
1374 |
|
Ratio_main_canvas->SetFrameFillColor(0); |
1372 |
– |
|
1375 |
|
mainpad->Draw(); |
1376 |
|
mainpad->cd(); |
1377 |
|
mainpad->Range(0,0,1,1); |
1398 |
|
bottompad->SetFillColor(kWhite); |
1399 |
|
TH1F *ratio = (TH1F*)nominator->Clone(GetNumericHistoName().c_str()); |
1400 |
|
ratio->Divide(denominator); |
1399 |
– |
|
1401 |
|
TGraphAsymmErrors *eratio; |
1402 |
|
TH1F *SystDown; |
1403 |
|
TH1F *SystUp; |
1435 |
|
SystUp->SetLineColor(TColor::GetColor("#006DE1")); |
1436 |
|
} |
1437 |
|
eratio->SetFillColor(TColor::GetColor("#00ADE1")); |
1437 |
– |
|
1438 |
|
ratio->SetTitle(""); |
1439 |
|
ratio->GetYaxis()->SetRangeUser(0.0,2.0); |
1440 |
|
if(do_bpred_ratio) ratio->GetYaxis()->SetRangeUser(0.0,2.0); |
1452 |
|
ratio->GetYaxis()->SetNdivisions(502,false); |
1453 |
|
ratio->SetFillColor(TColor::GetColor("#58D3F7")); |
1454 |
|
ratio->SetMarkerSize(0); |
1455 |
< |
ratio->Draw("e2"); |
1455 |
> |
ratio->Draw("e20"); |
1456 |
|
|
1457 |
|
TGraphAsymmErrors *ratio_center = (TGraphAsymmErrors*)eratio->Clone("ratio_center"); |
1458 |
|
for(int i=0;i<ratio_center->GetN();i++) { |
1459 |
|
ratio_center->SetPointError(i,ratio_center->GetErrorXlow(i),ratio_center->GetErrorXhigh(i),0.005,0.005); |
1460 |
|
} |
1461 |
– |
|
1461 |
|
ratio_center->SetFillColor(TColor::GetColor("#006381")); |
1462 |
|
|
1463 |
|
if(syshisto!=0) { |
1464 |
|
// sysratio->Draw("2"); |
1465 |
|
// eratio->Draw("2,same"); |
1466 |
< |
eratio->Draw("2"); |
1466 |
> |
eratio->Draw("20"); |
1467 |
|
SystDown->Draw("histo,same"); |
1468 |
|
SystUp->Draw("histo,same"); |
1469 |
|
} else { |
1470 |
< |
eratio->Draw("2"); |
1470 |
> |
eratio->Draw("20"); |
1471 |
|
} |
1472 |
< |
ratio_center->Draw("2"); |
1472 |
> |
ratio_center->Draw("20"); |
1473 |
|
ratio->Draw("same,axis"); |
1474 |
|
TLine *oneline = new TLine(ratio->GetXaxis()->GetBinLowEdge(1),1,ratio->GetXaxis()->GetBinLowEdge(ratio->GetNbinsX())+ratio->GetXaxis()->GetBinWidth(ratio->GetNbinsX()),1); |
1475 |
|
oneline->SetLineStyle(2); |
1476 |
|
oneline->SetLineColor(kBlue); |
1477 |
|
oneline->Draw("same"); |
1478 |
< |
|
1478 |
> |
if(PlottingSetup::DrawMetSignalRegionMllLines) { |
1479 |
> |
cout << "Drawing extra lines in ratio this time around ... " << endl; |
1480 |
> |
float RatioYMax=2.0; |
1481 |
> |
if(extendrange) RatioYMax=4.0; |
1482 |
> |
|
1483 |
> |
TLine *SRline = new TLine(70,0,70,RatioYMax); |
1484 |
> |
TLine *ZLowLine = new TLine(91.2-PlottingSetup::ConsideredZWidth,0,91.2-PlottingSetup::ConsideredZWidth,RatioYMax); |
1485 |
> |
TLine *ZHiLine = new TLine(91.2+PlottingSetup::ConsideredZWidth,0,91.2+PlottingSetup::ConsideredZWidth,RatioYMax); |
1486 |
> |
|
1487 |
> |
SRline->SetLineStyle(2); |
1488 |
> |
ZLowLine->SetLineStyle(2); |
1489 |
> |
ZHiLine->SetLineStyle(2); |
1490 |
> |
SRline->SetLineColor(kGray+2); |
1491 |
> |
ZLowLine->SetLineColor(kGray+2); |
1492 |
> |
ZHiLine->SetLineColor(kGray+2); |
1493 |
> |
SRline->Draw(); |
1494 |
> |
ZLowLine->Draw(); |
1495 |
> |
ZHiLine->Draw(); |
1496 |
> |
} |
1497 |
> |
|
1498 |
|
Ratio_main_canvas->cd(); |
1499 |
|
Ratio_main_canvas->Modified(); |
1500 |
|
Ratio_main_canvas->cd(); |
1541 |
|
delete Ratio_main_canvas; |
1542 |
|
} |
1543 |
|
|
1544 |
< |
void save_with_ratio_and_sys_band(TH1F *nominator, TH1F *denominator, TVirtualPad *orig_canvas, string savemeas, bool do_bpred_ratio=false, bool extendrange=false, string yaxistitle="ratio",TH1F *syshisto=NULL) { |
1544 |
> |
void Save_With_Ratio_And_Line(TH1F *nominator, TH1F *denominator, TVirtualPad *orig_canvas, string savemeas, bool do_bpred_ratio=false, bool extendrange=false, string yaxistitle="ratio",TH1F *syshisto=NULL) { |
1545 |
> |
PlottingSetup::ConsideredZWidth=10.0; |
1546 |
> |
PlottingSetup::DrawMetSignalRegionMllLines=true; |
1547 |
> |
Save_With_Ratio(nominator, denominator, orig_canvas, savemeas, do_bpred_ratio, extendrange, yaxistitle,syshisto); |
1548 |
> |
PlottingSetup::DrawMetSignalRegionMllLines=false; |
1549 |
> |
} |
1550 |
> |
|
1551 |
> |
void Save_With_Ratio_And_Line(TH1F *nominator, THStack denominator, TVirtualPad *canvas, string savemeas, bool do_bpred_ratio=false) { |
1552 |
> |
TH1F *denominator_histo = (TH1F*) CollapseStack(denominator,"TemporaryStack"); |
1553 |
> |
Save_With_Ratio_And_Line(nominator, denominator_histo, canvas, savemeas, do_bpred_ratio); |
1554 |
> |
delete denominator_histo; |
1555 |
> |
} |
1556 |
> |
|
1557 |
> |
void save_with_ratio_and_sys_band(float ConsideredZWidth, TH1F *nominator, TH1F *denominator, TVirtualPad *orig_canvas, string savemeas, bool do_bpred_ratio=false, bool extendrange=false, string yaxistitle="ratio",TH1F *syshisto=NULL) { |
1558 |
|
//this function saves the pad being passed as well as a new one including the SysRatio. |
1559 |
|
orig_canvas->cd(); |
1560 |
|
orig_canvas->Update(); |
1639 |
|
ratio->GetYaxis()->SetTitleSize(xstretchfactor*gStyle->GetTitleSize()); |
1640 |
|
ratio->GetYaxis()->SetNdivisions(502,false); |
1641 |
|
ratio->SetFillColor(TColor::GetColor("#58D3F7")); |
1642 |
< |
ratio->Draw("e1"); |
1642 |
> |
ratio->Draw("e0"); |
1643 |
|
|
1644 |
|
if(syshisto!=0) { |
1645 |
|
SysEnvelope->SetFillColor(TColor::GetColor("#FE9A2E")); |
1646 |
< |
SysEnvelope->Draw("2,same"); |
1647 |
< |
ratio->Draw("e1,same"); |
1646 |
> |
SysEnvelope->Draw("2,0,same"); |
1647 |
> |
ratio->Draw("e0,same"); |
1648 |
|
} else { |
1649 |
< |
eratio->Draw("1"); |
1649 |
> |
eratio->Draw("0"); |
1650 |
|
} |
1651 |
|
ratio->Draw("same,axis"); |
1652 |
|
TLine *oneline = new TLine(ratio->GetXaxis()->GetBinLowEdge(1),1,ratio->GetXaxis()->GetBinLowEdge(ratio->GetNbinsX())+ratio->GetXaxis()->GetBinWidth(ratio->GetNbinsX()),1); |
1653 |
|
oneline->SetLineStyle(2); |
1654 |
|
oneline->SetLineColor(kBlue); |
1655 |
|
oneline->Draw("same"); |
1656 |
+ |
|
1657 |
+ |
|
1658 |
+ |
|
1659 |
+ |
if(ConsideredZWidth>0.1) { |
1660 |
+ |
cout << "Drawing extra lines in ratio this time around ... " << endl; |
1661 |
+ |
float RatioYMax=2.0; |
1662 |
+ |
if(extendrange) RatioYMax=4.0; |
1663 |
+ |
|
1664 |
+ |
TLine *SRline = new TLine(70,0,70,RatioYMax); |
1665 |
+ |
TLine *ZLowLine = new TLine(91.2-ConsideredZWidth,0,91.2-ConsideredZWidth,RatioYMax); |
1666 |
+ |
TLine *ZHiLine = new TLine(91.2+ConsideredZWidth,0,91.2+ConsideredZWidth,RatioYMax); |
1667 |
+ |
|
1668 |
+ |
SRline->SetLineStyle(2); |
1669 |
+ |
ZLowLine->SetLineStyle(2); |
1670 |
+ |
ZHiLine->SetLineStyle(2); |
1671 |
+ |
SRline->SetLineColor(kGray+2); |
1672 |
+ |
ZLowLine->SetLineColor(kGray+2); |
1673 |
+ |
ZHiLine->SetLineColor(kGray+2); |
1674 |
+ |
SRline->Draw(); |
1675 |
+ |
ZLowLine->Draw(); |
1676 |
+ |
ZHiLine->Draw(); |
1677 |
+ |
} |
1678 |
|
|
1679 |
|
Ratio_main_canvas->cd(); |
1680 |
|
Ratio_main_canvas->Modified(); |
1958 |
|
y[nPoints]=y[0]; |
1959 |
|
|
1960 |
|
TPolyLine *l = new TPolyLine(nPoints+1,x,y); |
1961 |
< |
l->SetFillColor(TColor::GetColor("#5858FA")); |
1962 |
< |
l->SetLineColor(TColor::GetColor("#5858FA")); |
1961 |
> |
l->SetFillColor(TColor::GetColor("#A2A2FA")); |
1962 |
> |
l->SetLineColor(TColor::GetColor("#A2A2FA")); |
1963 |
|
l->SetLineWidth(1); |
1964 |
|
return l; |
1965 |
|
} |