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.
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:
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.,
splits the parameter \( m \) in the product of the states of \( c \) and \( d \).
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
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.
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,
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.,
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:
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.
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:
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. | |
RooSimultaneous * | build (const char *simPdfName, BuildConfig &bc, bool verbose=true) |
Build a RooSimultaneous PDF with name simPdfName from cloning specializations of protytpe PDF protoPdfName. | |
RooSimultaneous * | 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. | |
Protected Member Functions | |
RooSimWSTool (const RooSimWSTool &) | |
RooSimultaneous * | executeBuild (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< ObjBuildConfig > | validateConfig (BuildConfig &bc) |
Validate build configuration. | |
Protected Attributes | |
RooWorkspace * | _ws |
#include <RooSimWSTool.h>
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 | ( | ) |
Destructor.
Definition at line 156 of file RooSimWSTool.cxx.
|
protected |
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.
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
|
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.
|
protected |
Internal build driver from validation ObjBuildConfig.
Definition at line 379 of file RooSimWSTool.cxx.
|
protected |
Construct name of composite split.
Definition at line 615 of file RooSimWSTool.cxx.
|
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.
|
protected |
Definition at line 69 of file RooSimWSTool.h.