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";
108 int iE = getGlobalParNum(0);
109 int ith = getGlobalParNum(1);
110 int iph = getGlobalParNum(2);
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);
146 if (!cachevalid) updateCache();
148 case 0:
return dpxdE;
149 case 1:
return dpxdtheta;
157 assert(ilocal >= 0 && ilocal < NPAR);
158 if (!cachevalid) updateCache();
160 case 0:
return dpydE;
161 case 1:
return dpydtheta;
169 assert(ilocal >= 0 && ilocal < NPAR);
170 if (!cachevalid) updateCache();
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);
221 if (!cachevalid) updateCache();
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;