Fix behaviour when fitting toy experiments with a model containing constraints
Summary:
As described in T45, when a model contains external constraints, these
constraints should also be fluctuated when generating and fitting toy
experiments.
This revision implements the necessary variation of the constraints when
fitting toy datasets, and hence closes T45.
Details of implementation:
- Refactor handling of Gaussian constraints on LauAbsRValue types:
- Move calculation of penalty term from fit models into parameter classes
- Add new function and variable to allow generation of new mean of constraint
- Refactor handling of multi-dimensional Gaussian constraints
- Make n-dimensional constraint into a class and move the calculation of the penalty term from the fit models into that class
- Add new function and variable to allow generation of new means
- Few small modernisations and improvements to handling of formula-based constraints
- Have the constraint means regenerated before each fit
- Added a flag that indicates whether the data being fitted is toy to enable this behaviour - prints warnings if this flag value does not appear correct given the number of experiments and first experiment number
- Rename functions that add constraints
- Avoid aborting execution when parameters included in multiple constraints, just print warnings
Test Plan:
Have generated and fitted toys with the various types of constraints (single
fit parameter, formula-based combination of fit parameters, multi-dimensional
Gaussian constraint on fit parameters) and verified sensible pull distributions
are obtained with this implementation, while previously they were too narrow.
Reviewers: mwhitehe, jback
Reviewed By: mwhitehe, jback
Maniphest Tasks: T45
Differential Revision: https://phab.hepforge.org/D95