RooSimPdfBuilder constraints in category splitting

Dear experts,
I am trying to construct a simultaneous model containing four types of PDFs for four corresponding decay channels using the extremely useful RooSimPdfBuilder.
The config look something like this:

physModels = decay_mode : modeA=pdfA modeB=pdfB modeC=pdfC modeD=pdfD
splitCats = myCategory
pdfA = myCategory : parA, parB, parC
pdfB = myCategory : parA, parB, parC
pdfC = myCategory : parA, parB, parC
pdfD = myCategory : parA, parB, parC

Lets suppose, that myCategory can take on four different values 1, 2, 3 and 4 and the PDF for the decay mode “B” is only allowed to be fitted in two of the four subsets. But I still need to fit it simultaneously because it shares parameters with the other decay pdfs in the allowed categories.

Is there a way to constrain the parameter splitting for a PDF? Something like this,

physModels = decay_mode : modeA=pdfA modeB=pdfB modeC=pdfC modeD=pdfD
splitCats = myCategory
pdfA = myCategory : parA, parB, parC
pdfB = myCategory(value1,value2) : parA, parB, parC
pdfC = myCategory : parA, parB, parC
pdfD = myCategory : parA, parB, parC

like the partial splitting of splitCats would be useful.
I could not find anything of that sort in the documentation.
Thanks a lot for your help!

@StephanH can you help here please?

Thank you in advance,

Hi @VukanJ,

I am not familiar with the SimPdfBuilder. With a quick look, I found that it’s apparently superseded by the RooSimWSTool. That reminded me of a different thread where RooCustomizer was the solution.

Check out my last answer in this post:

Maybe this is what you were looking for.

Thank you @oshadura and @StephanH. I have never heard of that class, but if the RooSimWSTool is newer, it must be more powerful as well :slight_smile: I will just need to try to find some documentation before I rewrite my fitter

Is the RooSimWSTool documented somewhere? It seems that is too complex to guess its functionality by trial and error.

Hi VukanJ,
the documentation is unfortunately broken. I fixed it, but it will take at least a day to regenerate it. I will just copy&paste the fixed documentation below.

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 Ga(x|ma,s) and a Gb(x|mb,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 Ga and Gb from G with the following commands:

RooSimWSTool wst(wspace);“G_sim”, “G”, SplitParam)(“m”,“c”));

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. ,“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−∑i(ai) where ai are all other specializations. For example, given a category c with the states "A","B","C","D" , the specification


will create the parameters mA,mB,mC and a formula expression mD that evaluates to (1−(mA+mB+mC)). 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,

RooSimWSTool::MultiBuildConfig mbc(“mc”);



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. ,“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:


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.

Great! Constrained splitting (possibly with multiple pdfs) sound exactly like the thing that I need. Thanks a lot, @StephanH !

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.