Request for help with simultaneous fits

Hi,

I’m having many issues with getting all this newfangled RooWorkspace/RooSimWSTool working. It doesn’t help that there’s basically no documentation and the bulk of the tutorials that deal with these things don’t actually do anything practical like generate/plot/fit.

/***********************************************************/

First, I want to say that the tutorial rf512_wsfactory_oper.C crashes.

/***********************************************************/

Now let’s take tutorial rf504_simwstool.C.
Let’s say I want to generate events that include the RooCategory c.

Here’s are some examples of things I tried (and corresponding errors) to get it to work:

RooDataSet data = model_sim->generate(RooArgSet(x),100);
Roo1DTable
stable = data->table© ;
stable->Print(“v”) ;

[#0] ERROR:Plotting – RooTreeData::Table(model_run2Data): Argument c is not in dataset and is also not dependent on data set

RooDataSet data = model_sim->generate(RooArgSet(x,c),100);
Roo1DTable
stable = data->table© ;
stable->Print(“v”) ;

[#0] ERROR:Generation – RooSimGenContext::ctor(model_sim) ERROR: Need either extended mode or prototype data to calculate number of events per category
[#0] ERROR:Generation – RooAbsPdf::generate(model_sim) cannot create a valid context

/***********************************************************/

Same issue with rf513_wsfactory_tools.C. I can’t figure out what to actually DO with SIMCLONE::model_sim.

OK. I have lots more questions, but I think this enough for one post.

Thanks!

Ada

Hello,

Personally, I would usually generate with either:

  1. if c is constant for the events generated:
    c->setIndex(…)
    RooDataSet *data = model_sim->generate(RooArgSet(x),100);
    and then data->addColumn©

  2. if c varies within the events generated:
    RooDataSet *data = model_sim->generate(RooArgSet(x,c),100);

But as the error message says RooFit doesn’t know how many events to generate you you need to make an extended PDF if it is not already; you can use RooExtendPdf

Unfortunately, I am not knowledgeable on the Roo1DTable. Providing your ROOT version might also help Wouter to give a more complete answer.

Regards,

– Gregory

setIndex()?

Never saw that. Can’t find any examples of how to use it.

Looks promising.

Hi Ada,

The workspace and factory are a new way to create pdfs. Once a
pdf exists, they can be used the same way as before, and functionality
that is demonstrated in the tutorial macros still applies in the same way.

Concerning the crash of rf512, what ROOT release are you using?
These should work fine in 5.26.

macro rf504 demonstrates a tool to create simultaneous pdfs
that care clones of each other, e.g you can take an existing

Gauss(x,mean,sigma)

and turn it e.g. into

SIMUL(idx, Gauss_a(x,mean_a,sigma)
Gauss_b(x,mean_b,sigma))

which turns Gauss_a if idx==a and Gauss_b if idx==b, so this
is now a pdf of 2 observables: x and idx

The point to keep in mind with simultaneous pdfs (regardless of
how they are made) is thay they don’t make a prediction of the distribution of idx, this is a feature. You should see it as a conditional pdf F(x|idx).

Therefore you can also not request that it generates a distribution
in idx (or x and idx) as that information is not contained in the pdf.
What is possible is

  • Generate the distribution in x for a given value of idx

    idx.setLabel(“a”) ;
    sim_pdf.generate(x,1000) ;

  • Generate the distribution of (x,idx) given an external input
    for the distribution of idx (in the form of a dataset D(idx))

    sim_pdf.generate(x,ProtoData(D)) ;

Some more use examples of simultaneous pdfs are given in rf501

Concerning your question on rf513: you can do with model_sim what
you can do with any simultaneous pdf: fitting, plotting event generation
(with the above mentioned restrictions). Macro rf501 demonstrates
some of this functionality.

Wouter