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.15 by buchmann, Tue Aug 14 12:16:04 2012 UTC vs.
Revision 1.22 by fronga, Tue Nov 13 13:27:37 2012 UTC

# Line 62 | Line 62 | namespace PlottingSetup {
62      int PaperMode=0; // PaperMode=true will suppress "Preliminary" in DrawPrelim()
63      int Approved=0; // Approved=true will only plot approved plots
64      bool is2012=true;
65 +    bool is53reco=true;
66 +    bool openBox = true;
67   }
68  
69   bool dopng=false;
# Line 581 | Line 583 | void DrawPrelim(float writelumi=generalt
583    string prel=" Preliminary";
584    if(PlottingSetup::PaperMode) prel="";
585    //prelimtext << "CMS Preliminary 2011 , #sqrt{s}= 7 TeV, L= O(1) fb^{-1}"; //temporary replacement
586 +  if(PlottingSetup::is53reco) prel += " 53X";
587    string energy="7 TeV";
588    if(PlottingSetup::is2012) energy="8 TeV";
589    if(writelumi == 0) {
# Line 943 | Line 946 | string interpret_cut(string incut, bool
946    
947      if(incut=="id1==0") return "ee";
948      if(incut=="id1==1") return "#mu#mu";
949 <    if(incut=="abs(mll-91.2)<20") return "|m_{l^{+}l^{-}}-m_{Z}|<20";
949 >    if(incut=="abs(mll-91)<10") return "|m_{l^{+}l^{-}}-m_{Z}|<10";
950      if(incut=="pfJetGoodID[0]") return "";
951      if(incut=="pfJetGoodID[1]") return "";
952      if((int)incut.find("pfJetGoodNum")>-1) {
# Line 1421 | Line 1424 | void save_with_ratio(TH1F *nominator, TH
1424    
1425  
1426    ratio->SetTitle("");
1427 <  ratio->GetYaxis()->SetRangeUser(0.5,1.5);
1427 >  ratio->GetYaxis()->SetRangeUser(0.0,2.0);
1428    if(do_bpred_ratio) ratio->GetYaxis()->SetRangeUser(0.0,2.0);
1429    if(extendrange) ratio->GetYaxis()->SetRangeUser(0.0,4.0);
1430    ratio->GetXaxis()->SetTitle(nominator->GetXaxis()->GetTitle());
# Line 1497 | Line 1500 | void save_with_ratio(TH1F *nominator, TH
1500    delete main_canvas;
1501   }
1502  
1503 + void save_with_ratio_and_sys_band(TH1F *nominator, TH1F *denominator, TVirtualPad *canvas, string savemeas, float systematic, string yaxistitle="SysRatio") {
1504 +  //this function saves the pad being passed as well as a new one including the SysRatio.
1505 +  CompleteSave(canvas,savemeas);
1506 +
1507 +  float bottommargin=gStyle->GetPadBottomMargin();
1508 +  float canvas_height=gStyle->GetCanvasDefH();
1509 +  float canvas_width=gStyle->GetCanvasDefW();
1510 +  float SysRatiospace=0.25;// space the SysRatio should take up (relative to original pad)
1511 +  
1512 +  float SysRatiobottommargin=0.3;
1513 +  float SysRatiotopmargin=0.1;
1514 +  
1515 +  float xstretchfactor=((1-SysRatiospace)*(1-gStyle->GetPadTopMargin()))/((1)*SysRatiospace);
1516 +  
1517 +  TCanvas *MainCanvas = new TCanvas("MainCanvas","MainCanvas",(Int_t)canvas_width,(Int_t)(canvas_height*(1+SysRatiospace)));
1518 +  TPad *MainPad = new TPad("MainPad","MainPad",0,1-(1.0/(1+SysRatiospace)),1,1);//top (main) pad
1519 +  TPad *CoverPad = new TPad("CoverPad","CoverPad",gStyle->GetPadLeftMargin()-0.008,1-(1.0/(1+SysRatiospace))-0.04,1,1-(1.0/(1+SysRatiospace))+0.103);//pad covering up the x scale
1520 +  TPad *BottomPad = new TPad("BottomPad", "Ratio Pad",0,0,1,(1-(1-bottommargin)/(1+SysRatiospace))-0.015); //bottom pad
1521 +  
1522 +  MainCanvas->Range(0,0,1,1);
1523 +  MainCanvas->SetBorderSize(0);
1524 +  MainCanvas->SetFrameFillColor(0);
1525 +  
1526 +  MainPad->Draw();
1527 +  MainPad->cd();
1528 +  MainPad->Range(0,0,1,1);
1529 +  MainPad->SetFillColor(kWhite);
1530 +  MainPad->SetBorderSize(0);
1531 +  MainPad->SetFrameFillColor(0);
1532 +  canvas->Range(0,0,1,1);
1533 +  canvas->Draw("same");
1534 +  MainPad->Modified();
1535 +  MainCanvas->cd();
1536 +  CoverPad->Draw();
1537 +  CoverPad->cd();
1538 +  CoverPad->Range(0,0,1,1);
1539 +  CoverPad->SetFillColor(kWhite);
1540 +  CoverPad->SetBorderSize(0);
1541 +  CoverPad->SetFrameFillColor(0);
1542 +  CoverPad->Modified();
1543 +  MainCanvas->cd();
1544 +  BottomPad->SetTopMargin(SysRatiotopmargin);
1545 +  BottomPad->SetBottomMargin(SysRatiobottommargin);
1546 +  BottomPad->Draw();
1547 +  BottomPad->cd();
1548 +  BottomPad->Range(0,0,1,1);
1549 +  BottomPad->SetFillColor(kWhite);
1550 +  TH1F *SysRatio = (TH1F*)nominator->Clone(GetNumericHistoName().c_str());
1551 +  SysRatio->Divide(denominator);
1552 +
1553 +
1554 +
1555 +  SysRatio->SetTitle("");
1556 +  SysRatio->GetYaxis()->SetRangeUser(0.0,2.0);
1557 +  SysRatio->GetXaxis()->SetTitle(nominator->GetXaxis()->GetTitle());
1558 +  SysRatio->GetXaxis()->CenterTitle();
1559 +  SysRatio->GetYaxis()->SetTitle(yaxistitle.c_str());
1560 +  SysRatio->GetYaxis()->SetTitleOffset(0.4);
1561 +  SysRatio->GetYaxis()->CenterTitle();
1562 +  SysRatio->SetStats(0);
1563 +  SysRatio->GetXaxis()->SetLabelSize(xstretchfactor*SysRatio->GetXaxis()->GetLabelSize());
1564 +  SysRatio->GetYaxis()->SetLabelSize(xstretchfactor*SysRatio->GetYaxis()->GetLabelSize());
1565 +  SysRatio->GetXaxis()->SetTitleSize(xstretchfactor*gStyle->GetTitleSize());
1566 +  SysRatio->GetYaxis()->SetTitleSize(xstretchfactor*gStyle->GetTitleSize());
1567 +  SysRatio->GetYaxis()->SetNdivisions(502,false);
1568 +  SysRatio->SetFillColor(TColor::GetColor("#58D3F7"));
1569 +  TBox *sysbox = new TBox(SysRatio->GetXaxis()->GetBinLowEdge(1),1-systematic,SysRatio->GetXaxis()->GetBinLowEdge(SysRatio->GetNbinsX())+SysRatio->GetXaxis()->GetBinWidth(SysRatio->GetNbinsX()),1+systematic);
1570 +  sysbox->SetFillColor(TColor::GetColor("#82FA58")); // light green
1571 +  
1572 +  SysRatio->Draw("e1");
1573 +  sysbox->Draw();
1574 +  SysRatio->Draw("e1,same");
1575 +  SysRatio->Draw("e1,axis,same");
1576 +  
1577 +  TLine *oneline = new TLine(SysRatio->GetXaxis()->GetBinLowEdge(1),1,SysRatio->GetXaxis()->GetBinLowEdge(SysRatio->GetNbinsX())+SysRatio->GetXaxis()->GetBinWidth(SysRatio->GetNbinsX()),1);
1578 +  oneline->SetLineStyle(2);
1579 +  oneline->SetLineColor(kBlue);
1580 +  oneline->Draw("same");
1581 +
1582 +  MainCanvas->cd();
1583 +  MainCanvas->Modified();
1584 +  MainCanvas->cd();
1585 +  MainCanvas->SetSelected(MainCanvas);
1586 +  
1587 +  CompleteSave(MainCanvas,savemeas+"_withSYSSysRatio");
1588 +  delete SysRatio;
1589 +  delete MainCanvas;
1590 + }
1591  
1592 < TH1F* CollapseStack(THStack stack) {
1592 > TH1F* CollapseStack(THStack stack,TString hname="base") {
1593     TH1F *bhist = ((TH1F*)((stack.GetHists())->At(0)));
1594 <   TH1F *basehisto = (TH1F*)bhist->Clone("base");
1594 >   TH1F *basehisto = (TH1F*)bhist->Clone(hname);
1595     TIter next(stack.GetHists());
1596     TH1F *h;
1597     int counter=0;
# Line 1749 | Line 1840 | void bug_tracker(string function, int li
1840   //TODO: Write a bug summary at the end.
1841  
1842   float pSTAR(float mglu, float mlsp, float mchi2) {
1843 <        float mz=91.2;
1843 >        float mz=91.0;
1844          float res=((mchi2*mchi2)-(mlsp+mz)*(mlsp+mz));
1845          res*=((mchi2*mchi2)-(mlsp-mz)*(mlsp-mz));
1846          res=TMath::Sqrt(res)/(2*mchi2);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines