Tutorial for the binfit package developed for template fits in Belle II analyses.
As of now this is simply an annoted version of the notebook that comes with
binfit in the examples
directory. To get started with the tutorial, just open the
notebook or click here.
binfit
is a python package for performing template fits in pure python
developed and maintained by William
Sutcliffe.
Its code is based in large parts on Maximillian
Welsch's TemplateFitter
package, which is also
openly available on github.
Another fork of the TemplateFitter
package is being actively developed by
Felix Metzner, also on
github. As far as I understand
he extends it generalizes the template fitter, e.g. with support for arbitrary
dimensions, adaptive binning.
The common features of the binfit
an TemplateFitter
/ packages are (adapted from this
TemplateFitter
talk):
- no reliance on ROOT: evaluation of the (log-)likelihood function relies on numpy operations
- supports minimization with both scipy.optimize (LLSQ method) or iminuit (standalone Minuit implementation in python).
- template likelihood fits (simultaneous in different channels)
- fix, create bounds or profile parameters
- different Toy MC study methods available
binfit
-specific:
The distinguishing feature of binfit
from the other TemplateFitter
packages,
is that it gets rid of for-loops over the decay-channels in the fit by using
numpy matrix operations only. These are more performant, because numpy performs
the loops in performant C in the background.
An already existing example notebook can be found in the binfit/examples/ directory of the packages. It requires you to clone binfit (see Installation section below). I will take inspiration from that.
If you want to understand the theory of template fitting, I recommend Maximillian Welsch's talk. at the October 2019 B2GM. For uncertainty handling, I recommend Markus Prim's talk at the physics performance meeting: Template Fitting Including Systematics (youtube).
If you want to try out Max' TemplateFitter
, e.g. to compare it to binfit
,
TemplateFitter also has good jupyter notebook
tutorials.