ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/cbrown/Development/Plotting/Modules/GeneralToolBox.C
(Generate patch)

Comparing UserCode/cbrown/Development/Plotting/Modules/GeneralToolBox.C (file contents):
Revision 1.35 by buchmann, Mon Feb 25 15:36:39 2013 UTC vs.
Revision 1.40 by buchmann, Fri Apr 12 13:34:35 2013 UTC

# Line 67 | Line 67 | namespace PlottingSetup {
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;
# Line 94 | Line 95 | void write_error(string funcname, string
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>
# Line 597 | Line 599 | void DrawPrelim(float writelumi=generalt
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);
# Line 1308 | Line 1310 | TGraphAsymmErrors* produce_ratio_graph(T
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);
# Line 1370 | Line 1372 | void Save_With_Ratio(TH1F *nominator, TH
1372    Ratio_main_canvas->Range(0,0,1,1);
1373    Ratio_main_canvas->SetBorderSize(0);
1374    Ratio_main_canvas->SetFrameFillColor(0);
1373  
1375    mainpad->Draw();
1376    mainpad->cd();
1377    mainpad->Range(0,0,1,1);
# Line 1397 | Line 1398 | void Save_With_Ratio(TH1F *nominator, TH
1398    bottompad->SetFillColor(kWhite);
1399    TH1F *ratio = (TH1F*)nominator->Clone(GetNumericHistoName().c_str());
1400    ratio->Divide(denominator);
1400
1401    TGraphAsymmErrors *eratio;
1402    TH1F *SystDown;
1403    TH1F *SystUp;
# Line 1435 | Line 1435 | void Save_With_Ratio(TH1F *nominator, TH
1435         SystUp->SetLineColor(TColor::GetColor("#006DE1"));
1436    }
1437    eratio->SetFillColor(TColor::GetColor("#00ADE1"));
1438
1438    ratio->SetTitle("");
1439    ratio->GetYaxis()->SetRangeUser(0.0,2.0);
1440    if(do_bpred_ratio) ratio->GetYaxis()->SetRangeUser(0.0,2.0);
# Line 1459 | Line 1458 | void Save_With_Ratio(TH1F *nominator, TH
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    }
1462  
1461    ratio_center->SetFillColor(TColor::GetColor("#006381"));
1462    
1463    if(syshisto!=0) {
# Line 1477 | Line 1475 | void Save_With_Ratio(TH1F *nominator, TH
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();
# Line 1524 | Line 1541 | void Save_With_Ratio(TH1F *nominator, TH
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();
# Line 1609 | Line 1639 | void save_with_ratio_and_sys_band(TH1F *
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");
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();
# Line 1906 | Line 1958 | TPolyLine* GetFitUncertaintyShape(TF1 *f
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   }  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines