Jpp  16.0.2
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JKatoomba.hh
Go to the documentation of this file.
1 #ifndef __JACOUSTICS__JKATOOMBA__
2 #define __JACOUSTICS__JKATOOMBA__
3 
4 #include <vector>
5 
6 #include "JFit/JEstimator.hh"
7 #include "JFit/JRegressor.hh"
8 #include "JFit/JSimplex.hh"
9 #include "JFit/JMEstimator.hh"
10 #include "JMath/JMatrixNS.hh"
11 #include "JLang/JSharedPointer.hh"
12 
13 #include "JMath/JMatrixNS.hh"
14 #include "Jeep/JMessage.hh"
15 
17 #include "JAcoustics/JEKey.hh"
18 #include "JAcoustics/JGeometry.hh"
19 #include "JAcoustics/JModel.hh"
20 #include "JAcoustics/JHit.hh"
21 
22 
23 /**
24  * \file
25  *
26  * Fit functions of acoustic model.
27  * \author mdejong
28  */
29 namespace JACOUSTICS {}
30 namespace JPP { using namespace JACOUSTICS; }
31 
32 namespace JACOUSTICS {
33 
34  using JMATH::JMath;
35  using JFIT::JEstimator;
37  using JFIT::JSimplex;
38  using JFIT::JMEstimator;
39 
40 
41  /**
42  * Enumeration for fit algorithms.
43  */
44  enum JFit_t {
45  linear_t = 0, //!< Linear fit
46  simplex_t, //!< Simplex fit
47  gandalf_t //!< Gandalf fit
48  };
49 
50 
51  /**
52  * Auxiliary base class for fit function of acoustic model.
53  */
54  struct JKatoomba_t :
55  public JGeometry
56  {
57  /**
58  * Constructor
59  *
60  * \param detector detector
61  * \param velocity sound velocity
62  */
64  const JSoundVelocity& velocity) :
65  detector(detector),
66  velocity(velocity)
67  {};
68 
69 
70  /**
71  * Get estimated time-of-arrival for given hit.
72  *
73  * \param model model
74  * \param hit hit
75  * \return time-of-arrival
76  */
77  template<class JPDF_t>
78  double getToA(const JModel& model, const JHit<JPDF_t>& hit) const
79  {
80  const JGEOMETRY::JString& string = detector[hit.getString()];
81  const JMODEL ::JString& parameters = model.string[hit.getString()];
82  const JPosition3D position = string.getPosition(parameters, hit.getFloor());
83 
84  const double D = hit.getDistance(position);
85  const double Vi = velocity.getInverseVelocity(D, hit.getZ(), position.getZ());
86 
87  return model.emitter[hit.getEKey()].t1 + D * Vi;
88  }
89 
90 
93 
94  JLANG::JSharedPointer<JMEstimator> estimator; //!< M-Estimator function
95 
96 
97  /**
98  * Get fit option.
99  *
100  * \return option
101  */
102  static bool getOption()
103  {
104  return get_option();
105  }
106 
107 
108  /**
109  * Set fit option.
110  *
111  * \param option option
112  */
113  static void setOption(const bool option)
114  {
115  get_option() = option;
116  }
117 
118  protected:
119  /**
120  * Get reference to fit option.
121  *
122  * \return option
123  */
124  static bool& get_option()
125  {
126  static bool option = true;
127 
128  return option;
129  }
130 
131 
132  /**
133  * H-equation as per hit.
134  */
135  struct H_t :
136  public JMODEL::JEmitter,
137  public JMODEL::JString,
138  public JMath<H_t>
139  {
140  /**
141  * Default constructor.
142  */
143  H_t() :
144  JMODEL::JEmitter(),
145  JMODEL::JString ()
146  {}
147 
148 
149  /**
150  * Constructor.
151  *
152  * \param emitter emitter
153  * \param string string
154  */
155  H_t(const JMODEL::JEmitter& emitter,
156  const JMODEL::JString& string) :
157  JMODEL::JEmitter(emitter),
158  JMODEL::JString (string)
159  {}
160 
161 
162  /**
163  * Scale H-equation.
164  *
165  * \param factor multiplication factor
166  * \return this H-equation
167  */
168  H_t& mul(const double factor)
169  {
170  static_cast<JMODEL::JEmitter&>(*this).mul(factor);
171  static_cast<JMODEL::JString&> (*this).mul(factor);
172 
173  return *this;
174  }
175  };
176 
177  /**
178  * Indices of H-equation in global model.
179  */
180  struct I_t
181  {
182  /**
183  * Default constructor.
184  */
185  I_t() :
186  t1(0),
187  tx(0),
188  ty(0)
189  {}
190 
191 
192  /**
193  * Constructor.
194  *
195  * \param t1 index t1
196  * \param tx index tx
197  * \param ty index ty
198  */
199  I_t(const int t1,
200  const int tx,
201  const int ty) :
202  t1(t1),
203  tx(tx),
204  ty(ty)
205  {}
206 
207  int t1;
208  int tx;
209  int ty;
210  };
211  };
212 
213 
214  /**
215  * Template definition of fit function of acoustic model.
216  */
217  template<template<class T> class JMinimiser_t>
218  struct JKatoomba;
219 
220 
221  /**
222  * Template specialisation of fit function of acoustic model based on JAbstractMinimiser minimiser.\n
223  * This class can be used to evaluate the chi2.
224  */
225  template<>
227  public JAbstractMinimiser<JModel>,
228  public JKatoomba_t
229  {
230  typedef double result_type;
231 
232 
233  /**
234  * Constructor
235  *
236  * \param detector detector
237  * \param velocity sound velocity
238  */
240  const JSoundVelocity& velocity) :
241  JKatoomba_t(detector, velocity)
242  {};
243 
244 
245  /**
246  * Fit function.\n
247  * This method is used to determine the chi2 of given hit with respect to actual model.
248  *
249  * \param model model
250  * \param hit hit
251  * \return chi2 and gradient
252  */
253  template<class JPDF_t>
254  result_type operator()(const JModel& model, const JHit<JPDF_t>& hit) const
255  {
256  const double toa_s = this->getToA(model, hit);
257  const double u = (toa_s - hit.getValue()) / hit.sigma;
258 
259  return estimator->getRho(u);
260  }
261 
262 
263  /**
264  * Fit.
265  *
266  * \param model model
267  * \param __begin begin of hits
268  * \param __end end of hits
269  * \return chi2
270  */
271  template<class T>
272  result_type operator()(const JModel& model, T __begin, T __end)
273  {
274  this->value = model;
275 
276  return JAbstractMinimiser<JModel>::operator()(*this, __begin, __end);
277  }
278  };
279 
280 
281  /**
282  * Template specialisation of fit function of acoustic model based on linear approximation.
283  */
284  template<>
286  public JKatoomba_t
287  {
288  /**
289  * Constructor
290  *
291  * \param detector detector
292  * \param velocity sound velocity
293  */
295  const JSoundVelocity& velocity) :
296  JKatoomba_t(detector, velocity)
297  {};
298 
299 
300  /**
301  * Get start values of string parameters.\n
302  * Note that this method may throw an exception.
303  *
304  * \param __begin begin of hits
305  * \param __end end of hits
306  * \return model
307  */
308  template<class T>
309  const JModel& operator()(T __begin, T __end) const
310  {
311  using namespace std;
312  using namespace JPP;
313  using namespace JGEOMETRY;
314 
315  value = JModel(__begin, __end); // set up global model according data
316 
317  H_t H; // H-equation as per hit
318  I_t i; // indices of H-equation in global model
319 
320  const size_t N = (getOption() ? value.getN() : value.emitter.getN());
321 
322  JMatrixNS V(N); // V = H^T x H
323  vector<double> Y(N, 0.0); // Y = H^T x y
324 
325 
326  for (T hit = __begin; hit != __end; ++hit) {
327 
328  const JString& string = detector[hit->getString()];
329  const JPosition3D position = string.getPosition(hit->getFloor());
330  const double Vi = velocity.getInverseVelocity(hit->getDistance(position), hit->getZ(), position.getZ());
331 
332  const double h1 = string.getHeight(hit->getFloor());
333  const JPosition3D p1 = string.getPosition() - hit->getPosition();
334  const double ds = sqrt(p1.getLengthSquared() + h1*h1 + 2.0*p1.getZ()*h1);
335  const double y = hit->getValue() - Vi*ds;
336  const double W = sqrt(hit->getWeight());
337 
338  H.t1 = W * 1.0;
339  H.tx = W * Vi * p1.getX() * h1 / ds;
340  H.ty = W * Vi * p1.getY() * h1 / ds;
341 
342  i.t1 = value.getIndex(hit->getEKey(), &H_t::t1);
343  i.tx = value.getIndex(hit->getString(), &H_t::tx);
344  i.ty = value.getIndex(hit->getString(), &H_t::ty);
345 
346  V(i.t1, i.t1) += H.t1 * H.t1;
347 
348  Y[i.t1] += W * H.t1 * y;
349 
350  if (getOption()) {
351 
352  V(i.t1, i.tx) += H.t1 * H.tx; V(i.t1, i.ty) += H.t1 * H.ty;
353  V(i.tx, i.t1) += H.tx * H.t1; V(i.ty, i.t1) += H.ty * H.t1;
354 
355  V(i.tx, i.tx) += H.tx * H.tx; V(i.tx, i.ty) += H.tx * H.ty;
356  V(i.ty, i.tx) += H.ty * H.tx; V(i.ty, i.ty) += H.ty * H.ty;
357 
358  Y[i.tx] += W * H.tx * y;
359  Y[i.ty] += W * H.ty * y;
360  }
361  }
362 
363  // evaluate (H^T x H)^-1 x H^T x y
364 
365  V.invert();
366 
367  for (size_t row = 0; row != N; ++row) {
368  for (size_t col = 0; col != N; ++col) {
369  value[row] += V(row,col) * Y[col];
370  }
371  }
372 
373  return value;
374  }
375 
376  private:
377  mutable JModel value;
378  };
379 
380 
381  /**
382  * Template specialisation of fit function of acoustic model based on JSimplex minimiser.
383  */
384  template<>
385  struct JKatoomba<JSimplex> :
386  public JSimplex<JModel>,
387  public JKatoomba_t
388  {
389  /**
390  * Constructor
391  *
392  * \param detector detector
393  * \param velocity sound velocity
394  */
396  const JSoundVelocity& velocity) :
397  JKatoomba_t(detector, velocity)
398  {};
399 
400 
401  /**
402  * Fit function.\n
403  * This method is used to determine the chi2 of given hit with respect to actual model.
404  *
405  * \param model model
406  * \param hit hit
407  * \return chi2
408  */
409  template<class JPDF_t>
410  double operator()(const JModel& model, const JHit<JPDF_t>& hit) const
411  {
412  const double toa_s = this->getToA(model, hit);
413  const double u = (toa_s - hit.getValue()) / hit.sigma;
414 
415  return estimator->getRho(u);
416  }
417 
418 
419  /**
420  * Fit.
421  *
422  * \param __begin begin of hits
423  * \param __end end of hits
424  * \return chi2
425  */
426  template<class T>
427  double operator()(T __begin, T __end)
428  {
429  this->step.clear();
430 
431  for (JModel::string_type::const_iterator i = this->value.string.begin(); i != this->value.string.end(); ++i) {
432 
433  JModel model;
434 
435  model.string[i->first] = JMODEL::JString(1.0e-3, 0.0);
436 
437  this->step.push_back(model);
438 
439  model.string[i->first] = JMODEL::JString(0.0, 1.0e-3);
440 
441  this->step.push_back(model);
442  }
443 
444  for (JModel::emitter_type::const_iterator i = this->value.emitter.begin(); i != this->value.emitter.end(); ++i) {
445 
446  JModel model;
447 
448  model.emitter[i->first] = JMODEL::JEmitter(5.0e-5);
449 
450  this->step.push_back(model);
451  }
452 
453  return JSimplex<JModel>::operator()(*this, __begin, __end);
454  }
455  };
456 
457 
458  template<class T>
459  class JGandalf {};
460 
461 
462  /**
463  * Template specialisation of fit function of acoustic model based on JGandalf minimiser.
464  */
465  template<>
466  struct JKatoomba<JGandalf> :
467  public JKatoomba_t
468  {
469  typedef double result_type;
470 
471 
472  /**
473  * Constructor
474  *
475  * \param detector detector
476  * \param velocity sound velocity
477  */
479  const JSoundVelocity& velocity) :
480  JKatoomba_t(detector, velocity)
481  {};
482 
483 
484  /**
485  * Fit.
486  *
487  * \param __begin begin of hits
488  * \param __end end of hits
489  * \return chi2 and gradient
490  */
491  template<class T>
492  result_type operator()(T __begin, T __end)
493  {
494  using namespace std;
495  using namespace JPP;
496 
497  const int N = (getOption() ? value.getN() : value.emitter.getN());
498 
499  V.resize(N);
500  Y.resize(N);
501  h.resize(N);
502 
503  lambda = LAMBDA_MIN;
504 
505  result_type precessor = numeric_limits<double>::max();
506 
507  for (numberOfIterations = 0; numberOfIterations != MAXIMUM_ITERATIONS; ++numberOfIterations) {
508 
509  DEBUG("step: " << numberOfIterations << endl);
510 
511  evaluate(__begin, __end);
512 
513  DEBUG("lambda: " << FIXED(12,5) << lambda << endl);
514  DEBUG("chi2: " << FIXED(12,5) << successor << endl);
515 
516  if (successor < precessor) {
517 
518  if (numberOfIterations != 0) {
519 
520  if (fabs(precessor - successor) < EPSILON*fabs(precessor)) {
521  return successor;
522  }
523 
524  if (lambda > LAMBDA_MIN) {
525  lambda /= LAMBDA_DOWN;
526  }
527  }
528 
529  precessor = successor;
530  previous = value;
531 
532  } else {
533 
534  value = previous;
535  lambda *= LAMBDA_UP;
536 
537  if (lambda > LAMBDA_MAX) {
538  return precessor; // no improvement found
539  }
540 
541  evaluate(__begin, __end);
542  }
543 
544 
545  // force definite positiveness
546 
547  for (int i = 0; i != N; ++i) {
548 
549  if (V(i,i) < PIVOT) {
550  V(i,i) = PIVOT;
551  }
552 
553  h[i] = 1.0 / sqrt(V(i,i));
554  }
555 
556 
557  // normalisation
558 
559  for (int i = 0; i != N; ++i) {
560  for (int j = 0; j != i; ++j) {
561  V(j,i) *= h[i] * h[j];
562  V(i,j) = V(j,i);
563  }
564  }
565 
566  for (int i = 0; i != N; ++i) {
567  V(i,i) = 1.0 + lambda;
568  }
569 
570 
571  try {
572  V.invert();
573  }
574  catch (const JException& error) {
575  ERROR("JKatoomb<JGandalf>: " << error.what() << endl);
576  return precessor;
577  }
578 
579 
580  for (int i = 0; i != N; ++i) {
581 
582  DEBUG("u[" << noshowpos << i << "] = " << showpos << FIXED(15,5) << value[i]);
583 
584  double y = 0.0;
585 
586  for (int j = 0; j != N; ++j) {
587  y += V(i,j) * Y[j] * h[i] * h[j];
588  }
589 
590  value[i] -= y;
591 
592  DEBUG(' ' << FIXED(15,5) << y << noshowpos << endl);
593  }
594  }
595 
596  return 0.0;
597  }
598 
599  static int debug; //!< debug level
600  static int MAXIMUM_ITERATIONS; //!< maximal number of iterations
601  static double EPSILON; //!< maximal distance to minimum
602  static double LAMBDA_MIN; //!< minimal value control parameter
603  static double LAMBDA_MAX; //!< maximal value control parameter
604  static double LAMBDA_UP; //!< multiplication factor control parameter
605  static double LAMBDA_DOWN; //!< multiplication factor control parameter
606  static double PIVOT; //!< minimal value diagonal element of matrix
607 
608  double lambda;
612 
613  private:
614  /**
615  * Evaluation of fit.
616  *
617  * \param __begin begin of data
618  * \param __end end of data
619  */
620  template<class T>
621  inline void evaluate(T __begin, T __end)
622  {
623  using namespace std;
624  using namespace JPP;
625 
626  successor = 0.0;
627 
628  V.reset();
629 
630  for (std::vector<double>::iterator i = Y.begin(); i != Y.end(); ++i) {
631  *i = 0.0;
632  }
633 
634  for (T hit = __begin; hit != __end; ++hit) {
635 
636  const JGEOMETRY::JString& string = detector[hit->getString()];
637  const JMODEL ::JString& parameters = value.string[hit->getString()];
638  const JPosition3D position = string.getPosition(parameters, hit->getFloor());
639 
640  const double D = hit->getDistance(position);
641  const double Vi = velocity.getInverseVelocity(D, hit->getZ(), position.getZ());
642  const double toa_s = value.emitter[hit->getEKey()].t1 + D * Vi;
643 
644  const double u = (toa_s - hit->getValue()) / hit->sigma;
645  const double W = sqrt(hit->getWeight());
646 
647  successor += (W*W) * estimator->getRho(u);
648 
649  H_t H(1.0, string.getGradient(parameters, hit->getPosition(), hit->getFloor()) * Vi);
650 
651  H *= W * estimator->getPsi(u) / hit->sigma;
652 
653  I_t i;
654 
655  i.t1 = value.getIndex(hit->getEKey(), &H_t::t1);
656  i.tx = value.getIndex(hit->getString(), &H_t::tx);
657  i.ty = value.getIndex(hit->getString(), &H_t::ty);
658 
659  V(i.t1, i.t1) += H.t1 * H.t1;
660 
661  Y[i.t1] += W * H.t1;
662 
663  if (getOption()) {
664 
665  V(i.t1, i.tx) += H.t1 * H.tx; V(i.t1, i.ty) += H.t1 * H.ty;
666  V(i.tx, i.t1) += H.tx * H.t1; V(i.ty, i.t1) += H.ty * H.t1;
667 
668  V(i.tx, i.tx) += H.tx * H.tx; V(i.tx, i.ty) += H.tx * H.ty;
669  V(i.ty, i.tx) += H.ty * H.tx; V(i.ty, i.ty) += H.ty * H.ty;
670 
671  Y[i.tx] += W * H.tx;
672  Y[i.ty] += W * H.ty;
673  }
674  }
675  }
676 
677 
678  std::vector<double> Y; // gradient
681  std::vector<double> h; // normalisation vector
682  };
683 
684 
685  /**
686  * debug level.
687  */
689 
690 
691  /**
692  * maximal number of iterations.
693  */
695 
696 
697  /**
698  * maximal distance to minimum.
699  */
700  double JKatoomba<JGandalf>::EPSILON = 1.0e-3;
701 
702 
703  /**
704  * minimal value control parameter
705  */
706  double JKatoomba<JGandalf>::LAMBDA_MIN = 0.01;
707 
708 
709  /**
710  * maximal value control parameter
711  */
712  double JKatoomba<JGandalf>::LAMBDA_MAX = 100.0;
713 
714 
715  /**
716  * multiplication factor control parameter
717  */
718  double JKatoomba<JGandalf>::LAMBDA_UP = 9.0;
719 
720 
721  /**
722  * multiplication factor control parameter
723  */
724  double JKatoomba<JGandalf>::LAMBDA_DOWN = 11.0;
725 
726 
727  /**
728  * minimal value diagonal element of matrix
729  */
730  double JKatoomba<JGandalf>::PIVOT = 1.0e-3;
731 }
732 
733 #endif
Auxiliary base class for fit function of acoustic model.
Definition: JKatoomba.hh:54
JKatoomba(const JDetector &detector, const JSoundVelocity &velocity)
Constructor.
Definition: JKatoomba.hh:395
Linear fit methods.
Acoustic hit.
JKatoomba(const JDetector &detector, const JSoundVelocity &velocity)
Constructor.
Definition: JKatoomba.hh:239
JFit_t
Enumeration for fit algorithms.
Definition: JKatoomba.hh:44
General exception.
Definition: JException.hh:23
General purpose data regression method.
JString & mul(const double factor)
Scale string.
Wrapper class around STL string class.
Definition: JString.hh:27
Auxiliary base class for aritmetic operations of derived class types.
Definition: JMath.hh:110
TPaveText * p1
Sound velocity.
int getFloor() const
Get floor number.
Definition: JLocation.hh:145
static double LAMBDA_UP
multiplication factor control parameter
Definition: JKatoomba.hh:604
Interface for maximum likelihood estimator (M-estimator).
Definition: JMEstimator.hh:20
Detector data structure.
Definition: JDetector.hh:89
result_type operator()(const JFunction_t &fit, T __begin, T __end)
Get chi2.
Definition: JRegressor.hh:46
JParserTemplateElement< bool > getOption(bool &object, const std::string &name, const std::string &help="")
Auxiliary method for creation of template parser element object.
Definition: JParser.hh:1882
I_t(const int t1, const int tx, const int ty)
Constructor.
Definition: JKatoomba.hh:199
Acoustic geometries.
then JShowerPostfit f $INPUT_FILE o $OUTPUT_FILE N
Indices of H-equation in global model.
Definition: JKatoomba.hh:180
static const double H
Planck constant [eV s].
*fatal Wrong number of arguments esac JCookie sh typeset Z DETECTOR typeset Z SOURCE_RUN typeset Z TARGET_RUN set_variable PARAMETERS_FILE $WORKDIR parameters
Definition: diff-Tuna.sh:38
JEmitter & mul(const double factor)
Scale emitter.
then for HISTOGRAM in h0 h1
Definition: JMatrixNZ.sh:71
double operator()(const JModel &model, const JHit< JPDF_t > &hit) const
Fit function.
Definition: JKatoomba.hh:410
I_t()
Default constructor.
Definition: JKatoomba.hh:185
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
Auxiliary data structure for floating point format specification.
Definition: JManip.hh:446
JEKey getEKey() const
Get emitter hash key of this hit.
Abstract minimiser.
Definition: JRegressor.hh:25
Template definition of linear fit.
Definition: JEstimator.hh:25
V(JDAQEvent-JTriggerReprocessor)*1.0/(JDAQEvent+1.0e-10)
double getDistance(const JVector3D &pos) const
Get distance to point.
Definition: JVector3D.hh:270
Acoustics hit.
Linear fit.
Definition: JKatoomba.hh:45
Model for fit to acoustics data.
H_t(const JMODEL::JEmitter &emitter, const JMODEL::JString &string)
Constructor.
Definition: JKatoomba.hh:155
static double EPSILON
maximal distance to minimum
Definition: JKatoomba.hh:601
Detector file.
Definition: JHead.hh:224
The template JSharedPointer class can be used to share a pointer to an object.
result_type operator()(T __begin, T __end)
Fit.
Definition: JKatoomba.hh:492
Acoustic emitter.
Definition: JEmitter.hh:27
JLANG::JSharedPointer< JMEstimator > estimator
M-Estimator function.
Definition: JKatoomba.hh:94
JKatoomba_t(const JDetector &detector, const JSoundVelocity &velocity)
Constructor.
Definition: JKatoomba.hh:63
static double LAMBDA_MIN
minimal value control parameter
Definition: JKatoomba.hh:602
void evaluate(T __begin, T __end)
Evaluation of fit.
Definition: JKatoomba.hh:621
JKatoomba(const JDetector &detector, const JSoundVelocity &velocity)
Constructor.
Definition: JKatoomba.hh:478
virtual double getInverseVelocity(const double D_m, const double z1, const double z2) const override
Get inverse velocity of sound.
static int debug
debug level
Definition: JKatoomba.hh:599
do set_variable OUTPUT_DIRECTORY $WORKDIR T
double operator()(T __begin, T __end)
Fit.
Definition: JKatoomba.hh:427
#define ERROR(A)
Definition: JMessage.hh:66
result_type operator()(const JModel &model, const JHit< JPDF_t > &hit) const
Fit function.
Definition: JKatoomba.hh:254
double getY() const
Get y position.
Definition: JVector3D.hh:104
const JPosition3D & getPosition() const
Get position.
Definition: JPosition3D.hh:130
static bool & get_option()
Get reference to fit option.
Definition: JKatoomba.hh:124
N x N symmetric matrix.
Definition: JMatrixNS.hh:27
double getLengthSquared() const
Get length squared.
Definition: JVector3D.hh:235
General purpose messaging.
Implementation for depth dependend velocity of sound.
static double LAMBDA_MAX
maximal value control parameter
Definition: JKatoomba.hh:603
static int MAXIMUM_ITERATIONS
maximal number of iterations
Definition: JKatoomba.hh:600
std::vector< double > h
Definition: JKatoomba.hh:681
double operator()(const JFunction_t &fit, T __begin, T __end)
Multi-dimensional fit.
Definition: JSimplex.hh:71
void invert()
Invert matrix according LDU decomposition.
Definition: JMatrixNS.hh:80
Emitter hash key.
JACOUSTICS::JModel::string_type string
JACOUSTICS::JModel::emitter_type emitter
int getString() const
Get string number.
Definition: JLocation.hh:134
virtual const char * what() const override
Get error message.
Definition: JException.hh:48
const JModel & operator()(T __begin, T __end) const
Get start values of string parameters.
Definition: JKatoomba.hh:309
static double LAMBDA_DOWN
multiplication factor control parameter
Definition: JKatoomba.hh:605
Simple fit method based on Powell&#39;s algorithm, see reference: Numerical Recipes in C++...
Definition: JSimplex.hh:42
result_type operator()(const JModel &model, T __begin, T __end)
Fit.
Definition: JKatoomba.hh:272
H_t()
Default constructor.
Definition: JKatoomba.hh:143
then usage $script< input_file >< detector_file > fi set_variable OUTPUT_DIR set_variable SELECTOR JDAQTimesliceL1 set_variable DEBUG case set_variable DEBUG
static double PIVOT
minimal value diagonal element of matrix
Definition: JKatoomba.hh:606
double getToA(const JModel &model, const JHit< JPDF_t > &hit) const
Get estimated time-of-arrival for given hit.
Definition: JKatoomba.hh:78
double getX() const
Get x position.
Definition: JVector3D.hh:94
H_t & mul(const double factor)
Scale H-equation.
Definition: JKatoomba.hh:168
static void setOption(const bool option)
Set fit option.
Definition: JKatoomba.hh:113
int j
Definition: JPolint.hh:682
Data structure for position in three dimensions.
Definition: JPosition3D.hh:36
const JDetector & detector
Definition: JKatoomba.hh:91
container_type::const_iterator const_iterator
Definition: JHashMap.hh:86
double u[N+1]
Definition: JPolint.hh:755
Model for fit to acoutsics data.
H-equation as per hit.
Definition: JKatoomba.hh:135
static bool getOption()
Get fit option.
Definition: JKatoomba.hh:102
JSoundVelocity velocity
Definition: JKatoomba.hh:92
do echo Generating $dir eval D
Definition: JDrawLED.sh:53
double getZ() const
Get z position.
Definition: JVector3D.hh:115
Maximum likelihood estimator (M-estimators).
Simplex fit.
Definition: JKatoomba.hh:46
JKatoomba(const JDetector &detector, const JSoundVelocity &velocity)
Constructor.
Definition: JKatoomba.hh:294
Template definition of fit function of acoustic model.
Definition: JKatoomba.hh:218
Gandalf fit.
Definition: JKatoomba.hh:47
std::vector< double > Y
Definition: JKatoomba.hh:678