1 #ifndef __JFIT__JFITTOOLKIT__
2 #define __JFIT__JFITTOOLKIT__
26 namespace 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) {
123 chi2 +=
getChi2(model, *hit, sigma);
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>
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;
JFit_t
Enumeration for fit algorithms.
Auxiliary methods for mathematics.
static double getDot(const variance &first, const variance &second)
Get dot product.
then JShowerPostfit f $INPUT_FILE o $OUTPUT_FILE N
multiplicity_type getLowerL1Multiplicity() const
Get lower multiplicty.
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
V(JDAQEvent-JTriggerReprocessor)*1.0/(JDAQEvent+1.0e-10)
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"` source JAcoustics.sh -- typeset -A TRIPODS get_tripods $WORKDIR/tripod.txt TRIPODS XMEAN
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 getMultiplesRate(const multiplicity_type M) const
Get multiples rate at given multiplicity.
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.
double getSinglesRate() const
Get singles rate.
size_t multiplicity_type
Type definition of multiplicity.
double getProbability(const size_t N, const size_t M, const JK40Rates &R_Hz, const double T_ns)
Get probability due to random background.
Data structure for fit of straight line paralel to z-axis.
double poisson(const size_t n, const double mu)
Poisson probability density distribition.
multiplicity_type getUpperL1Multiplicity() const
Get upper multiplicty.
Base class for data structures with artithmetic capabilities.
double getChi2(const double P)
Get chi2 corresponding to given probability.
Auxiliary class for K40 rates.