9#include "analysis/OrcaKinFit/RecoilMassConstraint.h"
10#include "analysis/OrcaKinFit/ParticleFitObject.h"
23 namespace OrcaKinFit {
27 : m_recoilMass(recoilmass), m_beamPx(beampx), m_beamPy(beampy), m_beamPz(beampz), m_beamE(beampe)
48 totpx += pfo->getPx();
49 totpy += pfo->getPy();
50 totpz += pfo->getPz();
53 const double recoilE = (m_beamE - totE);
54 const double recoilE2 = recoilE * recoilE;
55 const double recoilpx = (m_beamPx - totpx);
56 const double recoilpx2 = recoilpx * recoilpx;
57 const double recoilpy = (m_beamPy - totpy);
58 const double recoilpy2 = recoilpy * recoilpy;
59 const double recoilpz = (m_beamPz - totpz);
60 const double recoilpz2 = recoilpz * recoilpz;
61 const double recoil2 = recoilE2 - recoilpx2 - recoilpy2 - recoilpz2;
62 const double result = recoil2 - m_recoilMass * m_recoilMass;
84 totpx += pfo->getPx();
85 totpy += pfo->getPy();
86 totpz += pfo->getPz();
89 const double recoilE = (m_beamE - totE);
90 const double recoilpx = (m_beamPx - totpx);
91 const double recoilpy = (m_beamPy - totpy);
92 const double recoilpz = (m_beamPz - totpz);
95 for (
int ilocal = 0; ilocal < fitobject->getNPar(); ilocal++) {
96 if (!fitobject->isParamFixed(ilocal)) {
97 int iglobal = fitobject->getGlobalParNum(ilocal);
98 assert(iglobal >= 0 && iglobal < idim);
102 der[iglobal] = - recoilE * pfo->getDE(ilocal)
103 + recoilpx * pfo->getDPx(ilocal)
104 + recoilpy * pfo->getDPy(ilocal)
105 + recoilpz * pfo->getDPz(ilocal);
124 totpx += pfo->getPx();
125 totpy += pfo->getPy();
126 totpz += pfo->getPz();
129 const double recoilE = (m_beamE - totE);
130 const double recoilE2 = recoilE * recoilE;
131 const double recoilpx = (m_beamPx - totpx);
132 const double recoilpx2 = recoilpx * recoilpx;
133 const double recoilpy = (m_beamPy - totpy);
134 const double recoilpy2 = recoilpy * recoilpy;
135 const double recoilpz = (m_beamPz - totpz);
136 const double recoilpz2 = recoilpz * recoilpz;
137 const double recoil2 = recoilE2 - recoilpx2 - recoilpy2 - recoilpz2;
138 const double recoil = std::sqrt(std::fabs(recoil2));
145 m_recoilMass = recoilmass_;
153 assert(dderivatives);
154 for (
int k = 0; k < 16; ++k) dderivatives[k] = 0;
157 dderivatives[4 * 0 + 0] = 2;
158 dderivatives[4 * 0 + 1] = 0;
159 dderivatives[4 * 0 + 2] = 0;
160 dderivatives[4 * 0 + 3] = 0;
161 dderivatives[4 * 1 + 1] = -2;
162 dderivatives[4 * 1 + 2] = 0;
163 dderivatives[4 * 1 + 3] = 0;
164 dderivatives[4 * 2 + 2] = -2;
165 dderivatives[4 * 2 + 3] = 0;
166 dderivatives[4 * 3 + 3] = -2;
185 totpx += pfo->getPx();
186 totpy += pfo->getPy();
187 totpz += pfo->getPz();
190 const double recoilE = (m_beamE - totE);
191 const double recoilpx = (m_beamPx - totpx);
192 const double recoilpy = (m_beamPy - totpy);
193 const double recoilpz = (m_beamPz - totpz);
195 dderivatives[0] = -2 * recoilE;
196 dderivatives[1] = 2 * recoilpx;
197 dderivatives[2] = 2 * recoilpy;
198 dderivatives[3] = 2 * recoilpz;
203 int RecoilMassConstraint::getVarBasis()
const
FitObjectContainer fitobjects
The FitObjectContainer.
virtual void setRecoilMass(double recoilmass)
Sets the target recoil mass of the constraint.
virtual void getDerivatives(int idim, double der[]) const override
Get first order derivatives.
virtual double getRecoilMass()
Get the actual recoil mass of the fit objects.
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...
RecoilMassConstraint(double recoilmass=0., double beampx=0., double beampy=0., double beampz=0, double beampe=0.)
Constructor.
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 ~RecoilMassConstraint()
Virtual destructor.
Abstract base class for different kinds of events.