Multiple limits in fitting and toy generation in zfit

129 Views Asked by At

I have a running model with a pdf in zfit from where I want to generate toys from and after also fit the pdf to the toys. However I was wondering how to exclude certain areas in the toy generation as well as in the fitting after. More clear this means using multiple limits so that I have multiple ranges in where my fit and toy generations runs (simultaniosely). Does anyone know how to do this?

1

There are 1 best solutions below

0
On

This can be achieved using multiple limits by adding Spaces, (minus a remark on fitting range, see below)

I assume you define your model and data in a way like

obs = zfit.Space('x', (..,..))

model = zfit.pdf.Foo(obs=obs,...)
data = zfit.Data....(obs=obs,...)

To define a single Space with multiple limits, do

obs1a = zfit.Space('x', (..., ...))
obs1b = zfit.Space('x', (..., ...))
obs = obs1a + obs1b

Note that the observable 'x' is in both cases the same and therefore the Space will be added and not extended to higher dimensions.

"Fitting Range"

Just to clarify, there is actually "no such thing as a fitting range". There are two ranges that matter:

  • the data range which are the cuts applied to the data
  • the normalization range: Integral over it is 1 (by definition)

Often, this two coincide and are named fitting range. Sometimes though the normalization range can be different (e.g. from previous fits to an extended range to the left/right) and "fitting range" is often used equivalently for the "data range" since this defines, which data points are used in the likelihood.