1 #ifndef __JFIT__JFITTOOLKIT__
2 #define __JFIT__JFITTOOLKIT__
25 namespace JPP {
using namespace JFIT; }
37 inline double getP(
const double expval,
bool hit)
40 return 1.0 - exp(-expval);
55 inline double getP(
const double expval,
const unsigned int numberOfHits,
const double precision = 1.0e-5)
59 for (
int i = numberOfHits; ; ++i) {
61 const double p = TMath::PoissonI(i, expval);
65 if ((
double) i > expval && p < precision) {
93 inline double getChi2(
const double expval,
bool hit)
96 return -log(1.0 - exp(-expval));
116 template<
class JModel_t,
class JHit_t>
117 inline double getChi2(
const JModel_t& model,
const JHit_t& hit,
const double sigma)
119 const double ds = (hit.getT() - model.getT(hit)) / sigma;
141 template<
class JModel_t,
class T>
142 inline double getChi2(
const JModel_t& model, T __begin, T __end,
const double sigma)
146 for (T hit = __begin; hit != __end; ++hit) {
147 chi2 +=
getChi2(model, *hit, sigma);
183 const JVectorNZ Y(track, __begin, __end);
200 inline double getChi2(
const JLine1Z& track, T __begin, T __end,
const double alpha,
const double sigma)
202 JMatrixNZ V(track, __begin, __end, alpha, sigma);
206 return getChi2(track, __begin, __end, V);
224 for (
size_t j = 0;
j != V.
size(); ++
j) {
225 chi2 += V(i,
j) * Y[
j];
228 return chi2*chi2 / V(i,i);
250 template<
class JModel_t,
class JFit_t,
class T>
251 inline double getChi2(
const JModel_t& model,
const JFit_t& fit, T __begin, T __end)
255 for (T hit = __begin; hit != __end; ++hit) {
256 chi2 += fit(model, *hit);