Newer
Older
STAging / include / basicRooFitTools.h
/** basicRooFitTools.h
 *  Header file implementing some basic RooFit tools for everyday's use
 *  Author:   Christian Elsasser (elsasser@cern.ch)
 *  Date:     2013-03-21 (last modified: 2012-06-22)
 *  Version:  v1.0
 *  Tested:   No (last tested version: none)
 */

#ifndef BASICROOFITTOOLS_H
#define BASICROOFITTOOLS_H


#include "TString.h"

#include "RooPlot.h"




//////////
// Decoration tools
//////////

// Change units on x-axis from (..) to [..]
void SwapParenthesis(RooPlot* p){
  TString label(p->GetXaxis()->GetTitle());
  label.Replace(label.Last('('),1,"[");
  label.Replace(label.Last(')'),1,"]");
  p->GetXaxis()->SetTitle(label.Data());
}


// Replace substrings in axis label
void ReplaceSubstring(RooPlot* p,
                      std::string toRepl="Events",
                      std::string repl="Candidates"){
  TString label(p->GetYaxis()->GetTitle());
  label.ReplaceAll(toRepl.c_str(),repl.c_str());
  p->GetYaxis()->SetTitle(label.Data());
}

#endif