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);
179 return getChi2(Y.begin(), Y.end(), V);
198 const JVectorNZ Y(track, __begin, __end);
215 inline double getChi2(
const JLine1Z& track, T __begin, T __end,
const double alpha,
const double sigma)
217 JMatrixNZ V(track, __begin, __end, alpha, sigma);
221 return getChi2(track, __begin, __end, V);
241 for (
unsigned int j = 0;
j != V.size(); ++
j, ++y) {
242 chi2 += V(i,
j) * (*y);
245 return chi2*chi2 / V(i,i);
261 return getChi2(Y.begin(), Y.end(), V, i);
283 template<
class JModel_t,
class JFit_t,
class T>
284 inline double getChi2(
const JModel_t& model,
const JFit_t& fit, T __begin, T __end)
288 for (T hit = __begin; hit != __end; ++hit) {
289 chi2 += fit(model, *hit);