Number of generated signal

Is there a way to access the number of events from a given PDF sub-shape in a generated dataset?

For example, if I do:

ws.factory(
    'SUM::model('
    'nsig[50, 0, 100]*SUM::sig(f1[0.74, 0, 1] * Gaussian::g1(x, mg[0, -10, 10], o1[3, 0, 5]), Gaussian::g2(x, mg, o2[3, 0, 5])),'
    'nbkg[10, 0, 100]*Chebychev::bkg(x, {c11[-0.33, -1, 1], c12[-0.33, -1, 0]}),'
    ')'
)
data = ws.pdf('model').generate(
    ROOT.RooArgSet(ws.var('x')), 
    ROOT.RooFit.Extended(),
)

I will get a dataset with ~50 signal and ~10 background:

but what if I want to know the exact values of nsig and nbkg in my dataset, e.g., when doing a RooMCStudy?

There’s no way, unfortunately. For an MC study, you can only use the relative fractions, and use the fact that the random distribution used to select the PDF to generate from is uniform.

You might, however, generate two datasets from the components, and merge them by appending one to the other. In this way, you can select the number of events in each dataset.

Ah, thank you for the clarification. I would like to suggest the inclusion of such info in the RooMCStudy class–it is potentially very useful.

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