Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RooSimWSTool Class Reference

The RooSimWSTool is a tool operating on RooWorkspace objects that can clone PDFs into a series of variations that are joined together into a RooSimultanous PDF.

Splitting a single PDF

The simplest use case is to take a workspace PDF as prototype and "split" a parameter of that PDF into two specialized parameters depending on a category in the dataset.

For example, given a Gaussian PDF \( G(x \,|\, m,s) \) we want to construct a \( G_a(x \,|\, m_a,s) \) and a \( G_b(x \,|\, m_b,s) \) with different mean parameters to be fit to a dataset with observables \( (x,c) \) where \( c \) is a category with states 'a' and 'b'.

Using RooSimWSTool, one can create a simultaneous PDF from \( G_a \) and \( G_b \) from \( G \) with the following commands:

RooSimWSTool wst(wspace);
wst.build("G_sim", "G", SplitParam("m","c"));
The RooSimWSTool is a tool operating on RooWorkspace objects that can clone PDFs into a series of var...

Splitting using a product category

From this simple example one can go to builds of arbitrary complexity by specifying multiple SplitParam arguments on multiple parameters involving multiple splitting categories. Splits can also be performed in the product of multiple categories, i.e.,

wst.build("G_sim", "G", SplitParam("m","c,d"));

splits the parameter \( m \) in the product of the states of \( c \) and \( d \).

Constrained split

Another possibility is the "constrained" split, which clones the parameter for all but one state and inserts a formula specialization in a chosen state that evaluates to \( 1 - \sum_i(a_i) \) where \( a_i \) are all other specializations. For example, given a category \( c \) with the states "A","B","C","D", the specification

SplitParamConstrained("m","c","D")

will create the parameters \( m_A,m_B,m_C \) and a formula expression \( m_D \) that evaluates to \( (1-(m_A+m_B+m_C)) \). Constrained splits can also be specified in the product of categories. In that case, the name of the remainder state follows the syntax "{State1;State2}", where State1 and State2 are the state names of the two spitting categories.

Splitting multiple PDFs

The examples so far deal with a single prototype PDF. It is also possible to build with multiple prototype PDFs by specifying a mapping between the prototype to use and the names of states of a "master" splitting category. To specify these configurations, an intermediate MultiBuildConfig must be composed with all the necessary specifications. This, for example,

mbc.addPdf("I","G",SplitParam("m,s","c"));
mbc.addPdf("II,III","F",SplitParam("a","c,d"));

configures a build with two prototype PDFs \( G \) and \( F \). Prototype \( G \) is used for state "I" of the master split category mc and prototype \( F \) is used for states "II" and "III" of the master split category mc. Furthermore, the parameters \( m,s \) of prototype \( G \) are split in category \( c \) while the parameter \( a \) of prototype \( F \) is split in the product of the categories \( c \) and \( d \). The actual build is then performed by passing the build configuration to RooSimWSTool, e.g.,

wst.build("MASTER", mbc);

By default, a specialisation is built for each permutation of states of the splitting categories that are used. It is possible to restrict the building of specialised PDFs to a subset of states by adding a restriction on the number of states to build as follows:

mbc.restrictBuild("c","A,B");

The restrictBuild method can be called multiple times, but at most once for each splitting category in use. For simple builds with a single prototype, restriction can be specified with a Restrict() argument on the build command line.

PyROOT

Some member functions of RooSimWSTool that take a RooCmdArg as argument also support keyword arguments. So far, this applies to RooSimWSTool::build. For example, the following code is equivalent in PyROOT:

# Directly passing a RooCmdArg:
sct.build("model_sim2", "model", ROOT.RooFit.SplitParam("p0", "c,d"))
# With keyword arguments:
sct.build("model_sim2", "model", SplitParam=("p0", "c,d"))

Definition at line 38 of file RooSimWSTool.h.

Classes

class  BuildConfig
 
class  MultiBuildConfig
 
class  ObjBuildConfig
 
class  ObjSplitRule
 
class  SplitRule
 

Public Member Functions

 RooSimWSTool (RooWorkspace &ws)
 Constructor of SimWSTool on given workspace.
 
 ~RooSimWSTool ()
 Destructor.
 
RooSimultaneousbuild (const char *simPdfName, BuildConfig &bc, bool verbose=true)
 Build a RooSimultaneous PDF with name simPdfName from cloning specializations of protytpe PDF protoPdfName.
 
RooSimultaneousbuild (const char *simPdfName, const char *protoPdfName, const RooCmdArg &arg1=RooCmdArg::none(), const RooCmdArg &arg2=RooCmdArg::none(), const RooCmdArg &arg3=RooCmdArg::none(), const RooCmdArg &arg4=RooCmdArg::none(), const RooCmdArg &arg5=RooCmdArg::none(), const RooCmdArg &arg6=RooCmdArg::none())
 Build a RooSimultaneous PDF with name simPdfName from cloning specializations of protytpe PDF protoPdfName.
 

Protected Member Functions

 RooSimWSTool (const RooSimWSTool &)
 
RooSimultaneousexecuteBuild (const char *simPdfName, ObjBuildConfig &obc, bool verbose=true)
 Internal build driver from validation ObjBuildConfig.
 
std::string makeSplitName (const RooArgSet &splitCatSet)
 Construct name of composite split.
 
std::unique_ptr< ObjBuildConfigvalidateConfig (BuildConfig &bc)
 Validate build configuration.
 

Protected Attributes

RooWorkspace_ws
 

#include <RooSimWSTool.h>

Constructor & Destructor Documentation

◆ RooSimWSTool() [1/2]

RooSimWSTool::RooSimWSTool ( RooWorkspace ws)

Constructor of SimWSTool on given workspace.

All input is taken from the workspace All output is stored in the workspace

Definition at line 147 of file RooSimWSTool.cxx.

◆ ~RooSimWSTool()

RooSimWSTool::~RooSimWSTool ( )

Destructor.

Definition at line 156 of file RooSimWSTool.cxx.

◆ RooSimWSTool() [2/2]

RooSimWSTool::RooSimWSTool ( const RooSimWSTool )
protected

Member Function Documentation

◆ build() [1/2]

RooSimultaneous * RooSimWSTool::build ( const char *  simPdfName,
BuildConfig bc,
bool  verbose = true 
)

Build a RooSimultaneous PDF with name simPdfName from cloning specializations of protytpe PDF protoPdfName.

Use the provided BuildConfig or MultiBuildConfig object to configure the build

Definition at line 187 of file RooSimWSTool.cxx.

◆ build() [2/2]

RooSimWSTool::build ( const char *  simPdfName,
const char *  protoPdfName,
const RooCmdArg arg1 = RooCmdArg::none(),
const RooCmdArg arg2 = RooCmdArg::none(),
const RooCmdArg arg3 = RooCmdArg::none(),
const RooCmdArg arg4 = RooCmdArg::none(),
const RooCmdArg arg5 = RooCmdArg::none(),
const RooCmdArg arg6 = RooCmdArg::none() 
)

Build a RooSimultaneous PDF with name simPdfName from cloning specializations of protytpe PDF protoPdfName.

Optional Arguments Effect
SplitParam(varname, catname) Split parameter(s) with given name(s) in category(s) with given names
SplitParam(var, cat) Split given parameter(s) in givem category(s)
SplitParamConstrained(vname, cname, remainder) Make constrained split in parameter(s) with given name(s) in category(s) with given names putting remainder fraction formula in state with name "remainder"
SplitParamConstrained(var,cat,remainder) Make constrained split in parameter(s) with given name(s) in category(s) with given names putting remainder fraction formula in state with name "remainder"
Restrict(catName,stateNameList)

Restrict build by only considered listed state names of category with given name

PyROOT

The RooSimWSTool::build() function is pythonized with the command argument pythonization. The keywords must correspond to the CmdArgs of the function.

Definition at line 174 of file RooSimWSTool.cxx.

◆ executeBuild()

RooSimultaneous * RooSimWSTool::executeBuild ( const char *  simPdfName,
ObjBuildConfig obc,
bool  verbose = true 
)
protected

Internal build driver from validation ObjBuildConfig.

Definition at line 379 of file RooSimWSTool.cxx.

◆ makeSplitName()

std::string RooSimWSTool::makeSplitName ( const RooArgSet splitCatSet)
protected

Construct name of composite split.

Definition at line 615 of file RooSimWSTool.cxx.

◆ validateConfig()

std::unique_ptr< RooSimWSTool::ObjBuildConfig > RooSimWSTool::validateConfig ( BuildConfig bc)
protected

Validate build configuration.

If not syntax errors or missing objects are found, return an ObjBuildConfig in which all names are replaced with object pointers.

Definition at line 207 of file RooSimWSTool.cxx.

Member Data Documentation

◆ _ws

RooWorkspace* RooSimWSTool::_ws
protected

Definition at line 69 of file RooSimWSTool.h.

Libraries for RooSimWSTool:
[legend]

The documentation for this class was generated from the following files: