17#include "analysis/OrcaKinFit/NeutrinoFitObject.h"
18#include <framework/logging/Logger.h>
35 namespace OrcaKinFit {
38 NeutrinoFitObject::NeutrinoFitObject(
double E,
double theta,
double phi,
39 double DE,
double Dtheta,
double Dphi)
40 : ctheta(0), stheta(0), cphi(0), sphi(0), pt(0), px(0), py(0), pz(0), dptdE(0),
41 dpxdE(0), dpydE(0), dpxdtheta(0), dpydtheta(0), chi2(0)
44 assert(
int(NPAR) <=
int(BaseDefs::MAXPAR));
47 setParam(0,
E,
false);
48 setParam(1, theta,
false);
49 setParam(2, phi,
false);
57 NeutrinoFitObject::~NeutrinoFitObject() =
default;
60 :
ParticleFitObject(rhs), ctheta(0), stheta(0), cphi(0), sphi(0), pt(0), px(0), py(0), pz(0), dptdE(0),
61 dpxdE(0), dpydE(0), dpxdtheta(0), dpydtheta(0), chi2(0)
82 if (psource !=
this) {
96 case 1:
return "theta";
111 assert(iE >= 0 && iE < idim);
112 assert(ith >= 0 && ith < idim);
113 assert(iph >= 0 && iph < idim);
123 if (th < 0 || th > M_PI) {
128 bool result = (e -
par[0]) * (e -
par[0]) > eps2 *
cov[0][0] ||
129 (th -
par[1]) * (th -
par[1]) > eps2 *
cov[1][1] ||
130 (ph -
par[2]) * (ph -
par[2]) > eps2 *
cov[2][2];
132 par[1] = (th >= 0 && th < M_PI) ?
133 th : std::acos(std::cos(th));
134 if (std::abs(ph) > M_PI) ph = atan2(sin(ph), cos(ph));
145 assert(ilocal >= 0 && ilocal < NPAR);
148 case 0:
return dpxdE;
149 case 1:
return dpxdtheta;
157 assert(ilocal >= 0 && ilocal < NPAR);
160 case 0:
return dpydE;
161 case 1:
return dpydtheta;
169 assert(ilocal >= 0 && ilocal < NPAR);
172 case 0:
return ctheta;
181 assert(ilocal >= 0 && ilocal < NPAR);
190 double NeutrinoFitObject::getFirstDerivative_Meta_Local(
int iMeta,
int ilocal,
int metaSet)
const
196 assert(metaSet == 0);
200 return getDE(ilocal);
218 double NeutrinoFitObject::getSecondDerivative_Meta_Local(
int iMeta,
int ilocal,
int jlocal,
int metaSet)
const
220 assert(metaSet == 0);
223 if (jlocal < ilocal) {
236 if (ilocal == 0 && jlocal == 1)
return ctheta * cphi;
237 else if (ilocal == 0 && jlocal == 2)
return -dpydE;
238 else if (ilocal == 1 && jlocal == 1)
return -px;
239 else if (ilocal == 1 && jlocal == 2)
return -dpydtheta;
240 else if (ilocal == 2 && jlocal == 2)
return -px;
244 if (ilocal == 0 && jlocal == 1)
return ctheta * sphi;
245 else if (ilocal == 0 && jlocal == 2)
return dpxdE;
246 else if (ilocal == 1 && jlocal == 1)
return -py;
247 else if (ilocal == 1 && jlocal == 2)
return dpxdtheta;
248 else if (ilocal == 2 && jlocal == 2)
return -py;
252 if (ilocal == 0 && jlocal == 1)
return -stheta;
253 else if (ilocal == 1 && jlocal == 1)
return -pz;
263 void NeutrinoFitObject::updateCache()
const
266 double theta =
par[1];
280 fourMomentum.setValues(e, px, py, pz);
282 dpxdE = stheta * cphi;
283 dpydE = stheta * sphi;
284 dpxdtheta = pz * cphi;
285 dpydtheta = pz * sphi;
bool cachevalid
flag for valid cache
virtual int getGlobalParNum(int ilocal) const
Get global parameter number of parameter ilocal.
double par[BaseDefs::MAXPAR]
fit parameters
void invalidateCache() const
invalidate any cached quantities
double cov[BaseDefs::MAXPAR][BaseDefs::MAXPAR]
local covariance matrix
virtual double getDPx(int ilocal) const override
Return d p_x / d par_ilocal (derivative of px w.r.t. local parameter ilocal)
virtual double getDPy(int ilocal) const override
Return d p_y / d par_ilocal (derivative of py w.r.t. local parameter ilocal)
NeutrinoFitObject & operator=(const NeutrinoFitObject &rhs)
Assignment.
virtual double getDE(int ilocal) const override
Return d E / d par_ilocal (derivative of E w.r.t. local parameter ilocal)
virtual NeutrinoFitObject & assign(const BaseFitObject &source) override
Assign from anther object, if of same type.
virtual const char * getParamName(int ilocal) const override
Get name of parameter ilocal.
virtual double getDPz(int ilocal) const override
Return d p_z / d par_ilocal (derivative of pz w.r.t. local parameter ilocal)
virtual bool updateParams(double p[], int idim) override
Read values from global vector, readjust vector; return: significant change.
virtual NeutrinoFitObject * copy() const override
Return a new copy of itself.
virtual ParticleFitObject & assign(const BaseFitObject &source) override
Assign from anther object, if of same type.
Abstract base class for different kinds of events.