Jpp  17.1.1
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | Public Attributes | Static Public Attributes | Protected Attributes | Private Member Functions | Private Attributes | List of all members
JACOUSTICS::JKatoomba< JGandalf > Struct Template Reference

Template specialisation of fit function of acoustic model based on JGandalf minimiser. More...

#include <JKatoomba.hh>

Inheritance diagram for JACOUSTICS::JKatoomba< JGandalf >:
JACOUSTICS::JKatoomba_t JACOUSTICS::JGEOMETRY::JDetector JTOOLS::JHashMap< JKey_t, JValue_t, JEvaluator_t > JTOOLS::JHashCollection< std::pair< JKey_t, JValue_t >, JHashMapEvaluator< JEvaluator_t > > JTOOLS::JMappableCollection< JKey_t, JValue_t > std::vector< std::pair< JKey_t, JValue_t > >

Public Types

typedef double result_type
 
typedef JKey_t key_type
 
typedef JValue_t mapped_type
 
typedef std::pair< JKey_t,
JValue_t > 
value_type
 
typedef JHashMapEvaluator
< JEvaluator_t > 
evaluator_type
 
typedef JHashCollection
< value_type, evaluator_type
collection_type
 
typedef
collection_type::container_type 
container_type
 
typedef
container_type::const_iterator 
const_iterator
 
typedef
container_type::const_reverse_iterator 
const_reverse_iterator
 
typedef container_type::iterator iterator
 
typedef
container_type::reverse_iterator 
reverse_iterator
 

Public Member Functions

 JKatoomba (const JDetector &detector, const JSoundVelocity &velocity, const int option)
 Constructor. More...
 
template<class T >
result_type operator() (T __begin, T __end)
 Fit. More...
 
template<class JPDF_t >
double getToA (const JModel &model, const JHit< JPDF_t > &hit) const
 Get estimated time-of-arrival for given hit. More...
 
bool hasString (int string) const
 Check if this detector has given string. More...
 
bool hasLocation (const JLocation &location) const
 Check if this detector has given location. More...
 
virtual void clear () override
 Clear. More...
 
virtual mapped_typeget (typename JClass< key_type >::argument_type key) override
 Get mapped value. More...
 
virtual const mapped_typeget (typename JClass< key_type >::argument_type key) const override
 Get mapped value. More...
 
value_typeget (const T &value)
 Get element with given value. More...
 
const value_typeget (const T &value) const
 Get element with given value. More...
 
void swap (JHashCollection &collection)
 Swap hash collection. More...
 
const_iterator find (const T &value) const
 Find element with given value. More...
 
iterator find (const T &value)
 Find element with given value. More...
 
virtual bool insert (const value_type &element)
 Insert element. More...
 
void insert (T __begin, T __end)
 Insert values. More...
 
void erase (iterator pos)
 Erase element at given position. More...
 
void erase (iterator __begin, iterator __end)
 Erase elements in given range. More...
 
bool erase (const T &value)
 Erase element with given value. More...
 
bool has (const T &value) const
 Test whether given value is present. More...
 
int getIndex (const T &value) const
 Get index of given value. More...
 
const mapped_typeoperator[] (typename JClass< key_type >::argument_type key) const
 Get mapped value. More...
 
mapped_typeoperator[] (typename JClass< key_type >::argument_type key)
 Get mapped value. More...
 
void put (typename JClass< key_type >::argument_type key, typename JClass< mapped_type >::argument_type value)
 Put pair-wise element (key,value) into collection. More...
 

Public Attributes

double lambda
 
JModel value
 
int numberOfIterations
 
JMATH::JMatrixNS V
 
const JDetectordetector
 detector More...
 
JSoundVelocity velocity
 sound velocity More...
 
int option
 fit option More...
 
JLANG::JSharedPointer
< JMEstimator
estimator
 M-Estimator function. More...
 
JHashMapEvaluator< JEvaluator_t > getValue
 Function object for evaluation of element. More...
 

Static Public Attributes

static int debug = 0
 debug level More...
 
static int MAXIMUM_ITERATIONS = 1000
 maximal number of iterations More...
 
static double EPSILON = 1.0e-3
 maximal distance to minimum More...
 
static double LAMBDA_MIN = 0.01
 minimal value control parameter More...
 
static double LAMBDA_MAX = 100.0
 maximal value control parameter More...
 
static double LAMBDA_UP = 9.0
 multiplication factor control parameter More...
 
static double LAMBDA_DOWN = 11.0
 multiplication factor control parameter More...
 
static double PIVOT = 1.0e-3
 minimal value diagonal element of matrix More...
 

Protected Attributes

JTOOLS::JHashCollection::router_type router
 

Private Member Functions

template<class T >
void evaluate (T __begin, T __end)
 Evaluation of fit. More...
 

Private Attributes

std::vector< double > Y
 
result_type successor
 
JModel previous
 
std::vector< double > h
 

Detailed Description

template<>
struct JACOUSTICS::JKatoomba< JGandalf >

Template specialisation of fit function of acoustic model based on JGandalf minimiser.

Definition at line 457 of file JKatoomba.hh.

Member Typedef Documentation

Definition at line 460 of file JKatoomba.hh.

template<class JKey_t, class JValue_t, class JEvaluator_t = JHashEvaluator>
typedef JKey_t JTOOLS::JHashMap< JKey_t, JValue_t, JEvaluator_t >::key_type
inherited

Definition at line 78 of file JHashMap.hh.

template<class JKey_t, class JValue_t, class JEvaluator_t = JHashEvaluator>
typedef JValue_t JTOOLS::JHashMap< JKey_t, JValue_t, JEvaluator_t >::mapped_type
inherited

Definition at line 79 of file JHashMap.hh.

template<class JKey_t, class JValue_t, class JEvaluator_t = JHashEvaluator>
typedef std::pair<JKey_t, JValue_t> JTOOLS::JHashMap< JKey_t, JValue_t, JEvaluator_t >::value_type
inherited

Definition at line 80 of file JHashMap.hh.

template<class JKey_t, class JValue_t, class JEvaluator_t = JHashEvaluator>
typedef JHashMapEvaluator<JEvaluator_t> JTOOLS::JHashMap< JKey_t, JValue_t, JEvaluator_t >::evaluator_type
inherited

Definition at line 81 of file JHashMap.hh.

template<class JKey_t, class JValue_t, class JEvaluator_t = JHashEvaluator>
typedef JHashCollection<value_type, evaluator_type> JTOOLS::JHashMap< JKey_t, JValue_t, JEvaluator_t >::collection_type
inherited

Definition at line 83 of file JHashMap.hh.

template<class JKey_t, class JValue_t, class JEvaluator_t = JHashEvaluator>
typedef collection_type::container_type JTOOLS::JHashMap< JKey_t, JValue_t, JEvaluator_t >::container_type
inherited

Definition at line 84 of file JHashMap.hh.

template<class JKey_t, class JValue_t, class JEvaluator_t = JHashEvaluator>
typedef container_type::const_iterator JTOOLS::JHashMap< JKey_t, JValue_t, JEvaluator_t >::const_iterator
inherited

Definition at line 86 of file JHashMap.hh.

template<class JKey_t, class JValue_t, class JEvaluator_t = JHashEvaluator>
typedef container_type::const_reverse_iterator JTOOLS::JHashMap< JKey_t, JValue_t, JEvaluator_t >::const_reverse_iterator
inherited

Definition at line 87 of file JHashMap.hh.

template<class JKey_t, class JValue_t, class JEvaluator_t = JHashEvaluator>
typedef container_type::iterator JTOOLS::JHashMap< JKey_t, JValue_t, JEvaluator_t >::iterator
inherited

Definition at line 88 of file JHashMap.hh.

template<class JKey_t, class JValue_t, class JEvaluator_t = JHashEvaluator>
typedef container_type::reverse_iterator JTOOLS::JHashMap< JKey_t, JValue_t, JEvaluator_t >::reverse_iterator
inherited

Definition at line 89 of file JHashMap.hh.

Constructor & Destructor Documentation

JACOUSTICS::JKatoomba< JGandalf >::JKatoomba ( const JDetector detector,
const JSoundVelocity velocity,
const int  option 
)
inline

Constructor.

Parameters
detectordetector
velocitysound velocity
optionoption

Definition at line 470 of file JKatoomba.hh.

472  :
473  JKatoomba_t(detector, velocity, option)
474  {};
int option
fit option
Definition: JKatoomba.hh:98
JKatoomba_t(const JDetector &detector, const JSoundVelocity &velocity, const int option)
Constructor.
Definition: JKatoomba.hh:66

Member Function Documentation

template<class T >
result_type JACOUSTICS::JKatoomba< JGandalf >::operator() ( T  __begin,
T  __end 
)
inline

Fit.

Parameters
__beginbegin of hits
__endend of hits
Returns
chi2 and gradient

Definition at line 485 of file JKatoomba.hh.

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 
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  }
size_t getN() const
Get number of fit parameters.
General exception.
Definition: JException.hh:23
void setOption(const int)
Set fit option.
static double LAMBDA_UP
multiplication factor control parameter
Definition: JKatoomba.hh:599
int option
fit option
Definition: JKatoomba.hh:98
then JShowerPostfit f $INPUT_FILE o $OUTPUT_FILE N
Auxiliary data structure for floating point format specification.
Definition: JManip.hh:446
void resize(const size_t size)
Resize matrix.
Definition: JMatrixND.hh:410
static double EPSILON
maximal distance to minimum
Definition: JKatoomba.hh:596
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
#define ERROR(A)
Definition: JMessage.hh:66
static double LAMBDA_MAX
maximal value control parameter
Definition: JKatoomba.hh:598
static int MAXIMUM_ITERATIONS
maximal number of iterations
Definition: JKatoomba.hh:595
std::vector< double > h
Definition: JKatoomba.hh:719
void invert()
Invert matrix according LDU decomposition.
Definition: JMatrixNS.hh:80
virtual const char * what() const override
Get error message.
Definition: JException.hh:48
static double LAMBDA_DOWN
multiplication factor control parameter
Definition: JKatoomba.hh:600
static double PIVOT
minimal value diagonal element of matrix
Definition: JKatoomba.hh:601
int j
Definition: JPolint.hh:703
#define DEBUG(A)
Message macros.
Definition: JMessage.hh:62
std::vector< double > Y
Definition: JKatoomba.hh:716
template<class T >
void JACOUSTICS::JKatoomba< JGandalf >::evaluate ( T  __begin,
T  __end 
)
inlineprivate

Evaluation of fit.

Parameters
__beginbegin of data
__endend of data

Definition at line 616 of file JKatoomba.hh.

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  }
fit times of emission of emitters and tilt angles of strings with second order correction and stretch...
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
JMatrixND & reset()
Set matrix to the null matrix.
Definition: JMatrixND.hh:423
fit times of emission of emitters and tilt angles of strings
Detector file.
Definition: JHead.hh:226
JLANG::JSharedPointer< JMEstimator > estimator
M-Estimator function.
Definition: JKatoomba.hh:99
virtual double getInverseVelocity(const double D_m, const double z1, const double z2) const override
Get inverse velocity of sound.
do set_variable OUTPUT_DIRECTORY $WORKDIR T
const JPosition3D & getPosition() const
Get position.
Definition: JPosition3D.hh:130
fit times of emission of emitters and tilt angles of strings with second order correction ...
size_t getIndex(int id, double JString::*p) const
Get index of fit parameter for given string.
JOption_t getOption()
Get fit option.
JACOUSTICS::JModel::string_type string
JACOUSTICS::JModel::emitter_type emitter
Data structure for position in three dimensions.
Definition: JPosition3D.hh:36
double u[N+1]
Definition: JPolint.hh:776
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
std::vector< double > Y
Definition: JKatoomba.hh:716
template<class JPDF_t >
double JACOUSTICS::JKatoomba_t::getToA ( const JModel model,
const JHit< JPDF_t > &  hit 
) const
inlineinherited

Get estimated time-of-arrival for given hit.

Parameters
modelmodel
hithit
Returns
time-of-arrival

Definition at line 83 of file JKatoomba.hh.

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  }
int getFloor() const
Get floor number.
Definition: JLocation.hh:145
*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
JEKey getEKey() const
Get emitter hash key of this hit.
double getDistance(const JVector3D &pos) const
Get distance to point.
Definition: JVector3D.hh:270
Detector file.
Definition: JHead.hh:226
virtual double getInverseVelocity(const double D_m, const double z1, const double z2) const override
Get inverse velocity of sound.
const JPosition3D & getPosition() const
Get position.
Definition: JPosition3D.hh:130
JACOUSTICS::JModel::string_type string
JACOUSTICS::JModel::emitter_type emitter
int getString() const
Get string number.
Definition: JLocation.hh:134
Data structure for position in three dimensions.
Definition: JPosition3D.hh:36
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
bool JACOUSTICS::JGEOMETRY::JDetector::hasString ( int  string) const
inlineinherited

Check if this detector has given string.

Parameters
stringstring
Returns
true if string present; else false

Definition at line 517 of file JGeometry.hh.

518  {
519  return this->has(string);
520  }
bool has(const T &value) const
Test whether given value is present.
bool JACOUSTICS::JGEOMETRY::JDetector::hasLocation ( const JLocation location) const
inlineinherited

Check if this detector has given location.

Parameters
locationlocation
Returns
true if location present; else false

Definition at line 529 of file JGeometry.hh.

530  {
531  return this->hasString(location.getString()) && (*this)[location.getString()].hasFloor(location.getFloor());
532  }
int getFloor() const
Get floor number.
Definition: JLocation.hh:145
bool hasString(int string) const
Check if this detector has given string.
Definition: JGeometry.hh:517
int getString() const
Get string number.
Definition: JLocation.hh:134
template<class JKey_t, class JValue_t, class JEvaluator_t = JHashEvaluator>
virtual void JTOOLS::JHashMap< JKey_t, JValue_t, JEvaluator_t >::clear ( )
inlineoverridevirtualinherited

Clear.

Implements JTOOLS::JMappableCollection< JKey_t, JValue_t >.

Definition at line 107 of file JHashMap.hh.

108  {
110  }
template<class JKey_t, class JValue_t, class JEvaluator_t = JHashEvaluator>
virtual mapped_type& JTOOLS::JHashMap< JKey_t, JValue_t, JEvaluator_t >::get ( typename JClass< key_type >::argument_type  key)
inlineoverridevirtualinherited

Get mapped value.

Parameters
keykey
Returns
mapped value

Implements JTOOLS::JMappableCollection< JKey_t, JValue_t >.

Definition at line 119 of file JHashMap.hh.

120  {
121  const int ival = this->getValue(key);
122 
123  if (!this->router.has(ival)) {
125  }
126 
127  return container_type::operator[](this->router.get(ival)).second;
128  }
JValue_t mapped_type
Definition: JHashMap.hh:79
virtual bool insert(const value_type &element)
Insert element.
std::pair< JKey_t, JValue_t > value_type
Definition: JHashMap.hh:80
JHashMapEvaluator< JEvaluator_t > getValue
Function object for evaluation of element.
template<class JKey_t, class JValue_t, class JEvaluator_t = JHashEvaluator>
virtual const mapped_type& JTOOLS::JHashMap< JKey_t, JValue_t, JEvaluator_t >::get ( typename JClass< key_type >::argument_type  key) const
inlineoverridevirtualinherited

Get mapped value.

This method will throw an exception if given key is not present following the prerequisite of constness.

Parameters
keykey
Returns
mapped value

Implements JTOOLS::JMappableCollection< JKey_t, JValue_t >.

Definition at line 139 of file JHashMap.hh.

140  {
141  const int ival = this->getValue(key);
142 
143  if (this->router.has(ival))
144  return container_type::operator[](this->router.get(ival)).second;
145  else
146  THROW(JIndexOutOfRange, "JHasMap::get(): invalid key " << STREAM("?") << key);
147  }
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition: JException.hh:696
Auxiliary data structure for handling std::ostream.
JHashMapEvaluator< JEvaluator_t > getValue
Function object for evaluation of element.
value_type& JTOOLS::JHashCollection< std::pair< JKey_t, JValue_t > , JHashMapEvaluator< JEvaluator_t > >::get ( const T value)
inlineinherited

Get element with given value.

This method will throw an exception if given value is not present following the prerequisite of constness.

Parameters
valuevalue
Returns
element

Definition at line 176 of file JHashCollection.hh.

177  {
178  const int ival = this->getValue(value);
179 
180  if (!router.has(ival)) {
181  this->insert(value);
182  }
183 
184  return container_type::operator[](router.get(ival)).second;
185  }
JHashMapEvaluator< JEvaluator_t > getValue
Function object for evaluation of element.
const value_type& JTOOLS::JHashCollection< std::pair< JKey_t, JValue_t > , JHashMapEvaluator< JEvaluator_t > >::get ( const T value) const
inlineinherited

Get element with given value.

This method will throw an exception if given value is not present following the prerequisite of constness.

Parameters
valuevalue
Returns
element

Definition at line 197 of file JHashCollection.hh.

198  {
199  const int ival = this->getValue(value);
200 
201  if (router.has(ival)) {
202  return container_type::operator[](router.get(ival)).second;
203  }
204 
205  THROW(JIndexOutOfRange, "JHasCollection::get(): invalid value.");
206  }
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition: JException.hh:696
JHashMapEvaluator< JEvaluator_t > getValue
Function object for evaluation of element.
void JTOOLS::JHashCollection< std::pair< JKey_t, JValue_t > , JHashMapEvaluator< JEvaluator_t > >::swap ( JHashCollection< std::pair< JKey_t, JValue_t >, JHashMapEvaluator< JEvaluator_t > > &  collection)
inlineinherited

Swap hash collection.

Parameters
collectionhash collection

Definition at line 123 of file JHashCollection.hh.

124  {
125  router.swap(collection.router);
126 
127  container_type::swap(collection);
128  }
const_iterator JTOOLS::JHashCollection< std::pair< JKey_t, JValue_t > , JHashMapEvaluator< JEvaluator_t > >::find ( const T value) const
inlineinherited

Find element with given value.

Parameters
valuevalue
Returns
position of element with given value or end()

Definition at line 138 of file JHashCollection.hh.

139  {
140  const int ival = this->getValue(value);
141 
142  if (router.has(ival))
143  return this->begin() + router.get(ival);
144  else
145  return this->end();
146  }
JHashMapEvaluator< JEvaluator_t > getValue
Function object for evaluation of element.
iterator JTOOLS::JHashCollection< std::pair< JKey_t, JValue_t > , JHashMapEvaluator< JEvaluator_t > >::find ( const T value)
inlineinherited

Find element with given value.

Parameters
valuevalue
Returns
position of element with given value or end()

Definition at line 156 of file JHashCollection.hh.

157  {
158  const int ival = this->getValue(value);
159 
160  if (router.has(ival))
161  return this->begin() + router.get(ival);
162  else
163  return this->end();
164  }
JHashMapEvaluator< JEvaluator_t > getValue
Function object for evaluation of element.
virtual bool JTOOLS::JHashCollection< std::pair< JKey_t, JValue_t > , JHashMapEvaluator< JEvaluator_t > >::insert ( const value_type element)
inlinevirtualinherited

Insert element.

Parameters
elementelement
Returns
true if inserted; else false

Definition at line 215 of file JHashCollection.hh.

216  {
217  const int ival = this->getValue(element);
218 
219  if (!router.has(ival)) {
220 
221  container_type::push_back(element);
222 
223  router.put(ival, this->size() - 1);
224 
225  return true;
226  }
227 
228  return false;
229  }
JHashMapEvaluator< JEvaluator_t > getValue
Function object for evaluation of element.
void JTOOLS::JHashCollection< std::pair< JKey_t, JValue_t > , JHashMapEvaluator< JEvaluator_t > >::insert ( T  __begin,
T  __end 
)
inlineinherited

Insert values.

Parameters
__beginbegin of values
__endend of values

Definition at line 239 of file JHashCollection.hh.

240  {
241  for (T i = __begin; i != __end; ++i) {
242  insert(*i);
243  }
244  }
do set_variable OUTPUT_DIRECTORY $WORKDIR T
void JTOOLS::JHashCollection< std::pair< JKey_t, JValue_t > , JHashMapEvaluator< JEvaluator_t > >::erase ( iterator  pos)
inlineinherited

Erase element at given position.

Parameters
posvalid position

Definition at line 252 of file JHashCollection.hh.

253  {
254  router.put(this->getValue(*pos), router.getDefaultAddress());
255 
256  for (iterator i = container_type::erase(pos); i != this->end(); ++i) {
257  router.put(this->getValue(*i), distance(this->begin(), i));
258  }
259  }
std::vector< T >::difference_type distance(typename std::vector< T >::const_iterator first, typename PhysicsEvent::const_iterator< T > second)
Specialisation of STL distance.
JHashMapEvaluator< JEvaluator_t > getValue
Function object for evaluation of element.
void JTOOLS::JHashCollection< std::pair< JKey_t, JValue_t > , JHashMapEvaluator< JEvaluator_t > >::erase ( iterator  __begin,
iterator  __end 
)
inlineinherited

Erase elements in given range.

Parameters
__beginbegin position (included)
__endend position (excluded)

Definition at line 268 of file JHashCollection.hh.

269  {
270  for (iterator i = __begin; i != __end; ++i) {
271  router.put(this->getValue(*i), router.getDefaultAddress());
272  }
273 
274  for (iterator i = container_type::erase(__begin, __end); i != this->end(); ++i) {
275  router.put(this->getValue(*i), distance(this->begin(), i));
276  }
277  }
std::vector< T >::difference_type distance(typename std::vector< T >::const_iterator first, typename PhysicsEvent::const_iterator< T > second)
Specialisation of STL distance.
JHashMapEvaluator< JEvaluator_t > getValue
Function object for evaluation of element.
bool JTOOLS::JHashCollection< std::pair< JKey_t, JValue_t > , JHashMapEvaluator< JEvaluator_t > >::erase ( const T value)
inlineinherited

Erase element with given value.

Parameters
valuevalue
Returns
true if element has been erased; else false

Definition at line 287 of file JHashCollection.hh.

288  {
289  const int ival = this->getValue(value);
290 
291  if (router.has(ival)) {
292 
293  this->erase(this->begin() + router.get(ival));
294 
295  return true;
296  }
297 
298  return false;
299  }
JHashMapEvaluator< JEvaluator_t > getValue
Function object for evaluation of element.
bool JTOOLS::JHashCollection< std::pair< JKey_t, JValue_t > , JHashMapEvaluator< JEvaluator_t > >::has ( const T value) const
inlineinherited

Test whether given value is present.

Parameters
valuevalue
Returns
true if present; else false

Definition at line 309 of file JHashCollection.hh.

310  {
311  return router.has(this->getValue(value));
312  }
JHashMapEvaluator< JEvaluator_t > getValue
Function object for evaluation of element.
int JTOOLS::JHashCollection< std::pair< JKey_t, JValue_t > , JHashMapEvaluator< JEvaluator_t > >::getIndex ( const T value) const
inlineinherited

Get index of given value.

Parameters
valuevalue
Returns
indecx

Definition at line 322 of file JHashCollection.hh.

323  {
324  return router.get(this->getValue(value));
325  }
JHashMapEvaluator< JEvaluator_t > getValue
Function object for evaluation of element.
template<class JKey_t, class JValue_t>
const mapped_type& JTOOLS::JMappableCollection< JKey_t, JValue_t >::operator[] ( typename JClass< key_type >::argument_type  key) const
inlineinherited

Get mapped value.

Parameters
keykey
Returns
value

Definition at line 73 of file JMappableCollection.hh.

74  {
75  return get(key);
76  }
template<class JKey_t, class JValue_t>
mapped_type& JTOOLS::JMappableCollection< JKey_t, JValue_t >::operator[] ( typename JClass< key_type >::argument_type  key)
inlineinherited

Get mapped value.

Parameters
keykey
Returns
value

Definition at line 85 of file JMappableCollection.hh.

86  {
87  return get(key);
88  }
template<class JKey_t, class JValue_t>
void JTOOLS::JMappableCollection< JKey_t, JValue_t >::put ( typename JClass< key_type >::argument_type  key,
typename JClass< mapped_type >::argument_type  value 
)
inlineinherited

Put pair-wise element (key,value) into collection.

Parameters
keykey
valuevalue

Definition at line 97 of file JMappableCollection.hh.

99  {
100  get(key) = value;
101  }

Member Data Documentation

int JACOUSTICS::JKatoomba< JGandalf >::debug = 0
static

debug level

debug level.

Definition at line 594 of file JKatoomba.hh.

int JACOUSTICS::JKatoomba< JGandalf >::MAXIMUM_ITERATIONS = 1000
static

maximal number of iterations

maximal number of iterations.

Definition at line 595 of file JKatoomba.hh.

double JACOUSTICS::JKatoomba< JGandalf >::EPSILON = 1.0e-3
static

maximal distance to minimum

maximal distance to minimum.

Definition at line 596 of file JKatoomba.hh.

double JACOUSTICS::JKatoomba< JGandalf >::LAMBDA_MIN = 0.01
static

minimal value control parameter

Definition at line 597 of file JKatoomba.hh.

double JACOUSTICS::JKatoomba< JGandalf >::LAMBDA_MAX = 100.0
static

maximal value control parameter

Definition at line 598 of file JKatoomba.hh.

double JACOUSTICS::JKatoomba< JGandalf >::LAMBDA_UP = 9.0
static

multiplication factor control parameter

Definition at line 599 of file JKatoomba.hh.

double JACOUSTICS::JKatoomba< JGandalf >::LAMBDA_DOWN = 11.0
static

multiplication factor control parameter

Definition at line 600 of file JKatoomba.hh.

double JACOUSTICS::JKatoomba< JGandalf >::PIVOT = 1.0e-3
static

minimal value diagonal element of matrix

Definition at line 601 of file JKatoomba.hh.

double JACOUSTICS::JKatoomba< JGandalf >::lambda

Definition at line 603 of file JKatoomba.hh.

Definition at line 604 of file JKatoomba.hh.

int JACOUSTICS::JKatoomba< JGandalf >::numberOfIterations

Definition at line 605 of file JKatoomba.hh.

Definition at line 606 of file JKatoomba.hh.

Definition at line 716 of file JKatoomba.hh.

Definition at line 717 of file JKatoomba.hh.

JModel JACOUSTICS::JKatoomba< JGandalf >::previous
private

Definition at line 718 of file JKatoomba.hh.

Definition at line 719 of file JKatoomba.hh.

const JDetector& JACOUSTICS::JKatoomba_t::detector
inherited

detector

Definition at line 96 of file JKatoomba.hh.

JSoundVelocity JACOUSTICS::JKatoomba_t::velocity
inherited

sound velocity

Definition at line 97 of file JKatoomba.hh.

int JACOUSTICS::JKatoomba_t::option
inherited

fit option

Definition at line 98 of file JKatoomba.hh.

JLANG::JSharedPointer<JMEstimator> JACOUSTICS::JKatoomba_t::estimator
inherited

M-Estimator function.

Definition at line 99 of file JKatoomba.hh.

JHashMapEvaluator< JEvaluator_t > JTOOLS::JHashCollection< std::pair< JKey_t, JValue_t > , JHashMapEvaluator< JEvaluator_t > >::getValue
inherited

Function object for evaluation of element.

Definition at line 331 of file JHashCollection.hh.

JTOOLS::JHashCollection::router_type JTOOLS::JHashCollection< std::pair< JKey_t, JValue_t > , JHashMapEvaluator< JEvaluator_t > >::router
protectedinherited

The documentation for this struct was generated from the following file: