17#include "analysis/OrcaKinFit/MomentumConstraint.h"
18#include "analysis/OrcaKinFit/ParticleFitObject.h"
19#include <framework/logging/Logger.h>
32 namespace OrcaKinFit {
35 double pzfact_,
double value_)
46 MomentumConstraint::~MomentumConstraint() =
default;
60 if (pxfact != 0) totpx += foi->
getPx();
61 if (pyfact != 0) totpy += foi->
getPy();
62 if (pzfact != 0) totpz += foi->
getPz();
63 if (efact != 0) totE += foi->
getE();
65 return pxfact * totpx + pyfact * totpy + pzfact * totpz + efact * totE - value;
76 for (
int ilocal = 0; ilocal < fitobject->getNPar(); ilocal++) {
77 if (!fitobject->isParamFixed(ilocal)) {
78 int iglobal = fitobject->getGlobalParNum(ilocal);
79 assert(iglobal >= 0 && iglobal < idim);
83 if (pxfact != 0) d += pxfact * foi->
getDPx(ilocal);
84 if (pyfact != 0) d += pyfact * foi->
getDPy(ilocal);
85 if (pzfact != 0) d += pzfact * foi->
getDPz(ilocal);
86 if (efact != 0) d += efact * foi->
getDE(ilocal);
98 void MomentumConstraint::updateCache()
const
102 for (
int ilocal = 0; ilocal < fitobject->getNPar(); ilocal++) {
103 int iglobal = fitobject->getGlobalParNum(ilocal);
104 if (!fitobject->isParamFixed(ilocal)) {
105 assert(iglobal >= 0);
124 dderivatives[0] = efact;
125 dderivatives[1] = pxfact;
126 dderivatives[2] = pyfact;
127 dderivatives[3] = pzfact;
131 int MomentumConstraint::getVarBasis()
const
FitObjectContainer fitobjects
The FitObjectContainer.
virtual void getDerivatives(int idim, double der[]) const override
Get first order derivatives.
MomentumConstraint(double efact_=0, double pxfact_=0, double pyfact_=0, double pzfact_=0, double value_=0)
virtual double getValue() const override
Returns the value of the constraint.
virtual bool secondDerivatives(int i, int j, double *derivatives) const override
Second derivatives with respect to the 4-vectors of Fit objects i and j; result false if all derivati...
virtual bool firstDerivatives(int i, double *derivatives) const override
First derivatives with respect to the 4-vector of Fit objects i; result false if all derivatives are ...
virtual void invalidateCache() const override
Invalidates any cached values for the next event.
virtual double getPx() const
Return px.
virtual double getPz() const
Return pz.
virtual double getDE(int ilocal) const =0
Return d E / d par_ilocal (derivative of E w.r.t. local parameter ilocal)
virtual double getPy() const
Return py.
virtual double getDPx(int ilocal) const =0
Return d p_x / d par_ilocal (derivative of px w.r.t. local parameter ilocal)
virtual double getDPz(int ilocal) const =0
Return d p_z / d par_ilocal (derivative of pz w.r.t. local parameter ilocal)
virtual double getE() const
Return E.
virtual double getDPy(int ilocal) const =0
Return d p_y / d par_ilocal (derivative of py w.r.t. local parameter ilocal)
Abstract base class for different kinds of events.