Jpp  16.0.0-rc.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 | Static Public Member Functions | Public Attributes | Static Public Attributes | Static Protected Member Functions | Protected Attributes | List of all members
JACOUSTICS::JKatoomba< JSimplex > Struct Template Reference

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

#include <JKatoomba.hh>

Inheritance diagram for JACOUSTICS::JKatoomba< JSimplex >:
JFIT::JSimplex< JModel_t > JACOUSTICS::JKatoomba_t JEEP::JMessage< 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)
 Constructor. More...
 
template<class JPDF_t >
double operator() (const JModel &model, const JHit< JPDF_t > &hit) const
 Fit function. More...
 
template<class T >
double operator() (T __begin, T __end)
 Fit. More...
 
template<class JFunction_t , class T >
double operator() (const JFunction_t &fit, T __begin, T __end)
 Multi-dimensional fit. More...
 
template<class JFunction_t , class T >
double operator() (const JFunction_t &fit, T __begin, T __end, const JModel_t &step)
 1D 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...
 

Static Public Member Functions

static bool getOption ()
 Get fit option. More...
 
static void setOption (const bool option)
 Set fit option. More...
 

Public Attributes

JModel_t value
 
std::vector< JModel_t > step
 
int numberOfIterations
 
const JDetectordetector
 
JSoundVelocity velocity
 
JLANG::JSharedPointer
< JMEstimator
estimator
 M-Estimator function. More...
 
JHashMapEvaluator< JEvaluator_t > getValue
 Function object for evaluation of element. More...
 

Static Public Attributes

static int MAXIMUM_ITERATIONS = 1000
 maximal number of iterations More...
 
static double EPSILON = 1.0e-4
 maximal distance to minimum More...
 
static int debug = 0
 debug level (default is off). More...
 

Static Protected Member Functions

static bool & get_option ()
 Get reference to fit option. More...
 

Protected Attributes

JTOOLS::JHashCollection::router_type router
 

Detailed Description

template<>
struct JACOUSTICS::JKatoomba< JSimplex >

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

Definition at line 385 of file JKatoomba.hh.

Member Typedef Documentation

template<class JModel_t>
typedef double JFIT::JSimplex< JModel_t >::result_type
inherited

Definition at line 47 of file JSimplex.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< JSimplex >::JKatoomba ( const JDetector detector,
const JSoundVelocity velocity 
)
inline

Constructor.

Parameters
detectordetector
velocitysound velocity

Definition at line 395 of file JKatoomba.hh.

396  :
397  JKatoomba_t(detector, velocity)
398  {};
JKatoomba_t(const JDetector &detector, const JSoundVelocity &velocity)
Constructor.
Definition: JKatoomba.hh:63

Member Function Documentation

template<class JPDF_t >
double JACOUSTICS::JKatoomba< JSimplex >::operator() ( const JModel model,
const JHit< JPDF_t > &  hit 
) const
inline

Fit function.


This method is used to determine the chi2 of given hit with respect to actual model.

Parameters
modelmodel
hithit
Returns
chi2

Definition at line 410 of file JKatoomba.hh.

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  }
JLANG::JSharedPointer< JMEstimator > estimator
M-Estimator function.
Definition: JKatoomba.hh:94
double getToA(const JModel &model, const JHit< JPDF_t > &hit) const
Get estimated time-of-arrival for given hit.
Definition: JKatoomba.hh:78
double u[N+1]
Definition: JPolint.hh:755
template<class T >
double JACOUSTICS::JKatoomba< JSimplex >::operator() ( T  __begin,
T  __end 
)
inline

Fit.

Parameters
__beginbegin of hits
__endend of hits
Returns
chi2

Definition at line 427 of file JKatoomba.hh.

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  }
Model for fit to acoustics data.
JModel_t value
Definition: JSimplex.hh:240
double operator()(const JFunction_t &fit, T __begin, T __end)
Multi-dimensional fit.
Definition: JSimplex.hh:71
JACOUSTICS::JModel::string_type string
JACOUSTICS::JModel::emitter_type emitter
container_type::const_iterator const_iterator
Definition: JHashMap.hh:86
std::vector< JModel_t > step
Definition: JSimplex.hh:241
template<class JModel_t>
template<class JFunction_t , class T >
double JFIT::JSimplex< JModel_t >::operator() ( const JFunction_t &  fit,
T  __begin,
T  __end 
)
inlineinherited

Multi-dimensional fit.

The given fit function should return the equivalent of chi2 for the current value of the given model and a given data point.

Parameters
fitfit function
__beginbegin of data
__endend of data
Returns
chi2

Definition at line 71 of file JSimplex.hh.

72  {
73  using namespace std;
74  using namespace JPP;
75 
76  double chi2_old = evaluate(fit, __begin, __end);
77 
78  const int N = step.size();
79 
80  if (N != 0) {
81 
82  p0 = value;
83  p1 = value;
84  wall = value;
85 
86  double chi2[N];
87 
89 
91 
92  DEBUG("old: " << FIXED(12,5) << chi2_old << endl);
93 
94  p0 = value;
95 
96  for (int i = 0; i != N; ++i) {
97 
98  DEBUG("step: " << i << ' ' << setw(5) << numberOfIterations << endl);
99 
100  chi2[i] = (*this)(fit, __begin, __end, step[i]);
101  }
102 
103  // overall step direction of last iteration
104 
105  wall = value;
106  wall -= p0;
107 
108  const double chi2_new = (*this)(fit, __begin, __end, wall);
109 
110  DEBUG("new: " << FIXED(12,5) << chi2_new << endl);
111 
112 
113  if (fabs(chi2_old - chi2_new) < EPSILON*fabs(chi2_old)) {
114  return chi2_new;
115  }
116 
117  // double overall step
118 
119  wall = value;
120  wall -= p0;
121  value += wall;
122 
123  const double fe = evaluate(fit, __begin, __end);
124 
125  value -= wall;
126 
127 
128  for (int i = N-1; i != 0; --i) {
129  chi2[i] = chi2[i-1] - chi2[i];
130  }
131 
132  chi2[0] = chi2_old - chi2[0];
133 
134 
135  double df = 0.0;
136 
137  for (int i = 0; i != N; ++i) {
138  if (chi2[i] > df) {
139  df = chi2[i];
140  }
141  }
142 
143  const double fn = chi2_new;
144  const double f0 = chi2_old;
145  const double ff = f0 - fn - df;
146 
147  // shift step directions
148 
149  if (fe < f0 && 2.0*(f0 - 2.0*fn + fe)*ff*ff < (f0-fe)*(f0-fe)*df) {
150 
151  for (int i = 0; i != N - 1; ++i) {
152  step[i] = step[i+1];
153  }
154 
155  step[N-1] = wall;
156  }
157 
158  chi2_old = chi2_new;
159  }
160  }
161 
162  return chi2_old;
163  }
then JShowerPostfit f $INPUT_FILE o $OUTPUT_FILE N
Auxiliary data structure for floating point format specification.
Definition: JManip.hh:446
JModel_t p1
Definition: JSimplex.hh:265
int numberOfIterations
Definition: JSimplex.hh:242
JModel_t value
Definition: JSimplex.hh:240
JModel_t p0
Definition: JSimplex.hh:264
JModel_t wall
Definition: JSimplex.hh:266
then usage $script< input_file >< detector_file > fi set_variable OUTPUT_DIR set_variable SELECTOR JDAQTimesliceL1 set_variable DEBUG case set_variable DEBUG
double evaluate(const JFunction_t &fit, T __begin, T __end) const
Evaluate chi2 for given data set.
Definition: JSimplex.hh:253
static int MAXIMUM_ITERATIONS
maximal number of iterations
Definition: JSimplex.hh:237
static double EPSILON
maximal distance to minimum
Definition: JSimplex.hh:238
std::vector< JModel_t > step
Definition: JSimplex.hh:241
template<class JModel_t>
template<class JFunction_t , class T >
double JFIT::JSimplex< JModel_t >::operator() ( const JFunction_t &  fit,
T  __begin,
T  __end,
const JModel_t &  step 
)
inlineinherited

1D fit.

The given fit function should return the equivalent of chi2 for the current value of the given model and a given data point.

Parameters
fitfit function
__beginbegin of data
__endend of data
stepstep direction

Definition at line 178 of file JSimplex.hh.

179  {
180  using namespace std;
181  using namespace JPP;
182 
183  double lambda = 0.5; // control parameter
184  double factor = 1.0; // multiplication factor
185 
186  double chi2_old = evaluate(fit, __begin, __end);
187 
188  for (int i = 0; numberOfIterations != MAXIMUM_ITERATIONS; ++numberOfIterations, ++i) {
189 
190  p1 = step;
191  p1 *= lambda;
192  value += p1;
193 
194  const double chi2_new = evaluate(fit, __begin, __end);
195 
196  DEBUG("step: " << setw(3) << i << ' ' << FIXED(12,5) << chi2_old << ' ' << FIXED(12,5) << chi2_new << ' ' << FIXED(5,2) << lambda << endl);
197 
198  if (fabs(chi2_old - chi2_new) < EPSILON*fabs(chi2_old)) {
199 
200  if (chi2_new > chi2_old) {
201 
202  p1 = step;
203  p1 *= lambda;
204  value -= p1; // undo last step
205 
206  return chi2_old;
207 
208  } else {
209 
210  return chi2_new;
211  }
212  }
213 
214  if (chi2_new < chi2_old) {
215 
216  chi2_old = chi2_new;
217 
218  } else {
219 
220  p1 = step;
221  p1 *= lambda;
222  value -= p1; // step back
223  lambda = -lambda; // change direction
224 
225  if (i != 0) {
226  factor = 0.5; // reduce step size
227  }
228  }
229 
230  lambda = factor * lambda;
231  }
232 
233  return chi2_old;
234  }
Auxiliary data structure for floating point format specification.
Definition: JManip.hh:446
JModel_t p1
Definition: JSimplex.hh:265
int numberOfIterations
Definition: JSimplex.hh:242
JModel_t value
Definition: JSimplex.hh:240
then usage $script< input_file >< detector_file > fi set_variable OUTPUT_DIR set_variable SELECTOR JDAQTimesliceL1 set_variable DEBUG case set_variable DEBUG
double evaluate(const JFunction_t &fit, T __begin, T __end) const
Evaluate chi2 for given data set.
Definition: JSimplex.hh:253
static int MAXIMUM_ITERATIONS
maximal number of iterations
Definition: JSimplex.hh:237
static double EPSILON
maximal distance to minimum
Definition: JSimplex.hh:238
std::vector< JModel_t > step
Definition: JSimplex.hh:241
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 78 of file JKatoomba.hh.

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  }
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:224
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
Definition: JKatoomba.hh:92
do echo Generating $dir eval D
Definition: JDrawLED.sh:53
double getZ() const
Get z position.
Definition: JVector3D.hh:115
static bool JACOUSTICS::JKatoomba_t::getOption ( )
inlinestaticinherited

Get fit option.

Returns
option

Definition at line 102 of file JKatoomba.hh.

103  {
104  return get_option();
105  }
static bool & get_option()
Get reference to fit option.
Definition: JKatoomba.hh:124
static void JACOUSTICS::JKatoomba_t::setOption ( const bool  option)
inlinestaticinherited

Set fit option.

Parameters
optionoption

Definition at line 113 of file JKatoomba.hh.

114  {
115  get_option() = option;
116  }
static bool & get_option()
Get reference to fit option.
Definition: JKatoomba.hh:124
static bool& JACOUSTICS::JKatoomba_t::get_option ( )
inlinestaticprotectedinherited

Get reference to fit option.

Returns
option

Definition at line 124 of file JKatoomba.hh.

125  {
126  static bool option = true;
127 
128  return option;
129  }
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 468 of file JGeometry.hh.

469  {
470  return this->has(string);
471  }
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 480 of file JGeometry.hh.

481  {
482  return this->hasString(location.getString()) && (*this)[location.getString()].hasFloor(location.getFloor());
483  }
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:468
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

template<class JModel_t>
int JFIT::JSimplex< JModel_t >::MAXIMUM_ITERATIONS = 1000
staticinherited

maximal number of iterations

maximal number of iterations.

Definition at line 237 of file JSimplex.hh.

template<class JModel_t>
double JFIT::JSimplex< JModel_t >::EPSILON = 1.0e-4
staticinherited

maximal distance to minimum

maximal distance to minimum.

Definition at line 238 of file JSimplex.hh.

template<class JModel_t>
JModel_t JFIT::JSimplex< JModel_t >::value
inherited

Definition at line 240 of file JSimplex.hh.

template<class JModel_t>
std::vector<JModel_t> JFIT::JSimplex< JModel_t >::step
inherited

Definition at line 241 of file JSimplex.hh.

template<class JModel_t>
int JFIT::JSimplex< JModel_t >::numberOfIterations
inherited

Definition at line 242 of file JSimplex.hh.

template<class T>
int JEEP::JMessage< T >::debug = 0
staticinherited

debug level (default is off).

Definition at line 45 of file JMessage.hh.

const JDetector& JACOUSTICS::JKatoomba_t::detector
inherited

Definition at line 91 of file JKatoomba.hh.

JSoundVelocity JACOUSTICS::JKatoomba_t::velocity
inherited

Definition at line 92 of file JKatoomba.hh.

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

M-Estimator function.

Definition at line 94 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: