1#ifndef __JFIT__JFITTOOLKIT__
2#define __JFIT__JFITTOOLKIT__
26namespace JPP {
using namespace JFIT; }
41 inline double getP(
const double expval,
bool hit)
44 return -expm1(-expval);
69 inline double getChi2(
const double expval,
bool hit)
72 return -log1p(-exp(-expval));
92 template<
class JModel_t,
class JHit_t>
93 inline double getChi2(
const JModel_t&
model,
const JHit_t& hit,
const double sigma)
95 const double ds = (hit.getT() -
model.getT(hit)) / sigma;
117 template<
class JModel_t,
class T>
118 inline double getChi2(
const JModel_t&
model, T __begin, T __end,
const double sigma)
122 for (T hit = __begin; hit != __end; ++hit) {
159 const JVectorNZ Y(track, __begin, __end);
176 inline double getChi2(
const JLine1Z& track, T __begin, T __end,
const double alpha,
const double sigma)
178 JMatrixNZ V(track, __begin, __end, alpha, sigma);
182 return getChi2(track, __begin, __end, V);
200 for (
size_t j = 0; j != V.
size(); ++j) {
201 chi2 += V(i,j) * Y[j];
204 return chi2*chi2 / V(i,i);
226 template<
class JModel_t,
class JFit_t,
class T>
227 inline double getChi2(
const JModel_t&
model,
const JFit_t& fit, T __begin, T __end)
231 for (T hit = __begin; hit != __end; ++hit) {
232 chi2 += fit(
model, *hit);
256 return (M == 0 ? 1.0 : 0.0);
259 const double T = T_ns * 1.0e-9;
Auxiliary methods for mathematics.
Base class for data structures with artithmetic capabilities.
Data structure for fit of straight line paralel to z-axis.
Determination of the co-variance matrix of hits for a track along z-axis (JFIT::JLine1Z).
static double getDot(const variance &first, const variance &second)
Get dot product.
Determination of the time residual vector of hits for a track along z-axis (JFIT::JLine1Z).
Auxiliary classes and methods for linear and iterative data regression.
double getProbability(const size_t N, const size_t M, const JK40Rates &R_Hz, const double T_ns)
Get probability due to random background.
double getChi2(const double P)
Get chi2 corresponding to given probability.
double getP(const double expval, bool hit)
Get Poisson probability to observe a hit or not for given expectation value for the number of hits.
void model(JModel_t &value)
Auxiliary function to constrain model during fit.
size_t multiplicity_type
Type definition of multiplicity.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
size_t size() const
Get dimension of matrix.
void invert()
Invert matrix according LDU decomposition.
Auxiliary class for K40 rates.
double getSinglesRate() const
Get singles rate.
double getMultiplesRate(const multiplicity_type M) const
Get multiples rate at given multiplicity.
multiplicity_type getLowerL1Multiplicity() const
Get lower multiplicty.
multiplicity_type getUpperL1Multiplicity() const
Get upper multiplicty.