1 #ifndef __JFIT__JFITTOOLKIT__
2 #define __JFIT__JFITTOOLKIT__
24 namespace JPP {
using namespace JFIT; }
36 inline double getP(
const double expval,
bool hit)
39 return -expm1(-expval);
54 inline double getP(
const double expval,
const unsigned int numberOfHits,
const double precision = 1.0e-5)
58 for (
int i = numberOfHits; ; ++i) {
60 const double p = TMath::PoissonI(i, expval);
64 if ((
double) i > expval && p < precision) {
92 inline double getChi2(
const double expval,
bool hit)
95 return -log1p(-
exp(-expval));
115 template<
class JModel_t,
class JHit_t>
116 inline double getChi2(
const JModel_t& model,
const JHit_t& hit,
const double sigma)
118 const double ds = (hit.getT() - model.getT(hit)) / sigma;
140 template<
class JModel_t,
class T>
141 inline double getChi2(
const JModel_t& model,
T __begin,
T __end,
const double sigma)
145 for (
T hit = __begin; hit != __end; ++hit) {
146 chi2 +=
getChi2(model, *hit, sigma);
182 const JVectorNZ Y(track, __begin, __end);
199 inline double getChi2(
const JLine1Z& track,
T __begin,
T __end,
const double alpha,
const double sigma)
201 JMatrixNZ V(track, __begin, __end, alpha, sigma);
205 return getChi2(track, __begin, __end, V);
223 for (
size_t j = 0;
j != V.
size(); ++
j) {
224 chi2 += V(i,
j) * Y[
j];
227 return chi2*chi2 / V(i,i);
249 template<
class JModel_t,
class JFit_t,
class T>
250 inline double getChi2(
const JModel_t& model,
const JFit_t& fit,
T __begin,
T __end)
254 for (
T hit = __begin; hit != __end; ++hit) {
255 chi2 += fit(model, *hit);
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).
Determination of the co-variance matrix of hits for a track along z-axis (JFIT::JLine1Z).
do set_variable OUTPUT_DIRECTORY $WORKDIR T
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 invert()
Invert matrix according LDU decomposition.
size_t size() const
Get dimension of matrix.
Data structure for fit of straight line paralel to z-axis.
Base class for data structures with artithmetic capabilities.
double getChi2(const double P)
Get chi2 corresponding to given probability.
then set_variable FORMULA *[0] exp(-0.5 *(x-[1])*(x-[1])/([2]*[2]))" set_variable OUTPUT_FILE histogram.root JHistogram1D -o $WORKDIR/$OUTPUT_FILE -F "$FORMULA" -