RooFit notes etc

Roofit info Roofit tutorial, 2008

RooStats twiki RooStats Users Guide RooStats tutorial

RooFit Users Manual

29 Sep 2011

Setting up ROOFITSYS for Zprime studies. With CMSSW_4_2_3 get ROOT definitions:
echo $ROOTSYS
/afs/cern.ch/cms/slc5_amd64_gcc434/lcg/root/5.27.06b-cms16/
echo $ROOFITSYS
/afs/cern.ch/cms/slc5_amd64_gcc434/lcg/roofit/5.28.00a-cms5/

>setenv ROOT_INCLUDE ${ROOTSYS}/include
>setenv ROOFIT_INCLUDE ${ROOFITSYS}/include 

//and in rootlogon.C file):
gSystem -> SetIncludePath( "-I$ROOT_INCLUDE -I$ROOFIT_INCLUDE" ) 
Then can do 'ls $ROOFITSYS/include/' to see the folder with all the ROOFITSYS header files.

RooNotes

RooDataSet unbinned data
  ie TTree* tree = (TTree*) gDirectory->Get(“atree”) ;
  RooRealVar x(“x”,”x”,-10,10) ;
  RooDataSet data(“data”,”dataset with x”,tree,x) ;
  Generate a dataset, ie RooDataSet* data = gauss.generate(x,10000) ;
  Fit with gauss.fitTo(data) ;
  print values, ie mean.Print(); gives RooRealVar::mean: -0.940910 +/- 0.030400
RooRealVar a class to express a variable
  Each variable can be initialized with several properties: a name, a title, optionally an initial value,a range.
  ie RooRealVar x(“x”,”x”,-10,10) ;
  RooRealVar mean(“mean”,”Mean of Gaussian”,0,-10,10) ;
  RooRealVar sigma(“sigma”,”Width of Gaussian”,3,-10,10) ;
  +more properties, ie an (a)symmetric error associated with variable, a flag if variable constant or floating in a fit.
RooAbsReal base class to express a function
  even the simplest mathematical functions consists of multiple objects, i.e. the function itself and its variables
RooAbsPdf a base class to express a probability density function
  RooAbsPdf objects do not have a unique return value, it depends on the local definition of observables.
 
RooGaussian ie RooGaussian gauss(“gauss”,”gauss(x,mean,sigma)”,x,mean,sigma) ;
  Get values, Double_t gauss_pdfM = gauss.getVal(mean)
  an implementation of the abstract base class RooAbsPdf
RooDataHist binned data is represented by the RooDataHist class
  ie RooDataHist data(“data”,”dataset with x”,x,hh) ;
  where x is RooRealVar x(“x”,”x”,-10,10) ;
  hh is a histo, TH1* hh = (TH1*) gDirectory->Get(“ahisto”) ;
  Added value of RooDataHist ,over plain histogram, it associates contents of histogram with one or more RooFit variable objects of type RooRealVar.

RooWorkspace

RooWorkspace::RooWorkspace(const char* name, const char* title) : Construct empty workspace with given name and title
RooWorkspace::RooWorkspace(const char* name, Bool_t doCINTExport) Construct empty workspace with given name and option to export reference to all workspace contents to a CINT namespace with the same name
Bool_t RooWorkspace::import(const char* fileSpec, const RooCmdArg& arg1, const RooCmdArg& arg2, const RooCmdArg& arg3) Import a RooAbsArg or RooAbsData set from a workspace in a file.
import(const RooArgSet& args, const RooCmdArg& arg1, const RooCmdArg& arg2, const RooCmdArg& arg3) Import multiple RooAbsArg objects into workspace. See single import
import(const RooAbsArg& inArg, const RooCmdArg& arg1, const RooCmdArg& arg2, const RooCmdArg& arg3) Import a RooAbsArg object, e.g. function, p.d.f or variable into the workspace.
import(RooAbsData& inData, const RooCmdArg& arg1, const RooCmdArg& arg2, const RooCmdArg& arg3 Import a dataset (RooDataSet or RooDataHist) into the work space.
Bool_t RooWorkspace::defineSet(const char* name, const RooArgSet& aset, Bool_t importMissing) Define a named RooArgSet with given constituents.
defineSet(const char* name, const char* contentList) Define a named set in the work space through a comma separated list of names of objects already in the workspace
extendSet(const char* name, const char* newContents) Define a named set in the work space through a comma separated list of names of objects already in the workspace
const RooArgSet* RooWorkspace::set(const char* name) Return pointer to previously defined named set with given name
renameSet(const char* name, const char* newName) Rename set to a new name
removeSet(const char* name) Remove a named set from the workspace
RooWorkspace::pdf(const char* name) const Retrieve p.d.f (RooAbsPdf) with given name. A null pointer is returned if not found
RooAbsReal* RooWorkspace::function(const char* name) const Retrieve function (RooAbsReal) with given name. Note that all RooAbsPdfs are also RooAbsReals. A null pointer is returned if not found.
RooRealVar* RooWorkspace::var(const char* name) const Retrieve real-valued variable (RooRealVar) with given name.
RooCategory* RooWorkspace::cat(const char* name) const Retrieve discrete variable (RooCategory) with given name.
RooAbsCategory* RooWorkspace::catfunc(const char* name) const Retrieve discrete function (RooAbsCategory) with given name.
RooAbsArg* RooWorkspace::arg(const char* name) const Return RooAbsArg with given name.
RooArgSet RooWorkspace::argSet(const char* nameList) const Return set of RooAbsArgs matching to given list of names
RooAbsData* RooWorkspace::data(const char* name) const Retrieve dataset (binned or unbinned) with given name.
   
   
RooArgSet RooWorkspace::allVars() const Return set with all variable objects
RooArgSet RooWorkspace::allFunctions() const Return set with all function objects
RooArgSet RooWorkspace::allPdfs() const Return set with all probability density function objects
list<RooAbsData*> RooWorkspace::allData() const Return list of all dataset in the workspace
list<TObject*> RooWorkspace::allGenericObjects() const Return list of all generic objects in the workspace
Bool_t RooWorkspace::import(TObject& object, Bool_t replaceExisting) Import a clone of a generic TObject into workspace generic object container. Imported object can be retrieved by name through the obj() method.
Bool_t RooWorkspace::import(TObject& object, const char* aliasName, Bool_t replaceExisting) Import a clone of a generic TObject into workspace generic object container.
TObject* RooWorkspace::obj(const char* name) const Return any type of object (RooAbsArg, RooAbsData or generic object) with given name
TObject* RooWorkspace::genobj(const char* name) const Return generic object with given name
Bool_t RooWorkspace::writeToFile(const char* fileName, Bool_t recreate) Save this current workspace into given file
RooAbsArg* RooWorkspace::factory(const char* expr) Short-hand function for factory()->process(expr)
void RooWorkspace::Print(Option_t* opts) const Print contents of the workspace

-- DavidCockerill - 2016-09-23

Edit | Attach | Watch | Print version | History: r1 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r1 - 2016-09-23 - DavidCockerill
 
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    Main All webs login

This site is powered by the TWiki collaboration platform Powered by PerlCopyright &© 2008-2019 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback