1 #ifndef __JFIT__JFITTOOLKIT__
2 #define __JFIT__JFITTOOLKIT__
22 namespace JPP {
using namespace JFIT; }
34 inline double getP(
const double expval,
bool hit)
37 return -expm1(-expval);
50 inline double getP(
const double expval,
const size_t numberOfHits)
54 double P =
exp(-expval);
56 for (
size_t i = numberOfHits; i != 0; --i) {
57 P *= expval / (double) i;
83 inline double getChi2(
const double expval,
bool hit)
86 return -log1p(-
exp(-expval));
106 template<
class JModel_t,
class JHit_t>
107 inline double getChi2(
const JModel_t& model,
const JHit_t& hit,
const double sigma)
109 const double ds = (hit.getT() - model.getT(hit)) / sigma;
131 template<
class JModel_t,
class T>
132 inline double getChi2(
const JModel_t& model,
T __begin,
T __end,
const double sigma)
136 for (
T hit = __begin; hit != __end; ++hit) {
137 chi2 +=
getChi2(model, *hit, sigma);
190 inline double getChi2(
const JLine1Z& track,
T __begin,
T __end,
const double alpha,
const double sigma)
192 JMatrixNZ V(track, __begin, __end, alpha, sigma);
196 return getChi2(track, __begin, __end, V);
214 for (
size_t j = 0;
j != V.
size(); ++
j) {
215 chi2 += V(i,
j) * Y[
j];
218 return chi2*chi2 / V(i,i);
240 template<
class JModel_t,
class JFit_t,
class T>
245 for (
T hit = __begin; hit != __end; ++hit) {
246 chi2 += fit(model, *hit);
JFit_t
Enumeration for fit algorithms.
static double getDot(const variance &first, const variance &second)
Get dot product.
then fatal Wrong number of arguments fi set_variable STRING $argv[1] set_variable DETECTORXY_TXT $WORKDIR $DETECTORXY_TXT tail read X Y CHI2 RMS printf optimum n $X $Y $CHI2 $RMS awk v Y
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable STRING $argv[2] set_array QUANTILES set_variable FORMULA *[0] exp(-0.5 *(x-[1])*(x-[1])/([2]*[2]))" set_variable MODULE `getModule -a $DETECTOR -L "$STRING 0"` typeset -Z 4 STRING JOpera1D -f hydrophone.root
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.