Also the actual fitting algorithm is exchangable. At the moment, two fitters are available, both based on (Zitat!) and its fortran implementation in the OPAL software.
Fit objects, which correspond tio entities like jets, muons, or neutrinos, store information on their parameters and encapsulate the details of the parametrization. If parameters have been measured, two parameter sets are stored, the measured and the fitted ones, together with their respective covariance matrices.
The fit objects provide information on the number of their internal parameters, whether they are measured or unmeasured, and information on their physical quantities, in particular four vector components, and values of derivatives of the four vector components with respect to the various parameters.
Constraints between fit objects are formulated in terms of the physical quantities, in particular four vector components, of the fit objects. A constraint is a function of the physical quantities of several fit objects, which has to be zero if the constraint is fulfilled. A constraint object is associated with several fit objects, and communicates with them so that it can evaluate the value of the constraint function and its derivatives with respect to the internal parameters of the fit objects. These derivatives are evaulated according to the chain rule, so that the constraint object contains only derivatives with respect to the physical quantities, which are then multiplied by the derivatives with respact to the parameters that are provided by the fit objects.
The fit engine sets up and solves the system of equations of the fitting problem. It maintains lists of constraints and fitting objects.
JetFitObject j1 (47., 0.84 , 0.64, 5.0, 0.1, 0.1, 0.); JetFitObject j2 (45., 2.30 , 2.50, 5.0, 0.1, 0.1, 0.); JetFitObject j3 (46., 0.996, 3.83, 5.0, 0.1, 0.1, 0.); JetFitObject j4 (42., 2.21 , 5.82, 5.0, 0.1, 0.1, 0.);
PxConstraint pxc; // sum(px)=0 PyConstraint pyc; // sum(py)=0 MassConstraint w(0.); // mass(particle set 1)-mass (particle set 2)=0
pxc.addToFOList (j1); pxc.addToFOList (j2); pxc.addToFOList (j3); pxc.addToFOList (j4); w.addToFOList (j1, 1); w.addToFOList (j2, 1); w.addToFOList (j3, 2); w.addToFOList (j4, 2);
WWFitter fitter; fitter.addFitObject (j1); fitter.addFitObject (j2); fitter.addFitObject (j3); fitter.addFitObject (j4); fitter.addConstraint (pxc); fitter.addConstraint (pyc); fitter.addConstraint (w); double prob = fitter.fit();
After the fit, the fit objects have their fitted parameters set to the fit result.
The fit engine has a list of fit objects. First it sets up a global list of measured and unmeasured quantities, and each of the internal parameters of the fit objects gets, in addition to its internal or local number, a global number. These global parameter numbers are stored, for efficiency reason, within the fit objects. Similarly, the constraints are numbered by the fit engine, and tehse global constraint numbers are also stored in the constraint objects. Remember that to each constraint there belongs a new parameter, its Lagrange multiplier. Measured parameters, unmeasured poarameters, and Lagrange multipliers are globally numbered in consequitive order, starting at 0.