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