Jpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | Protected Attributes | Private Attributes | List of all members
JDYNAMICS::JDynamics::JPosition Struct Reference

Dynamic position calibration. More...

#include <JDynamics.hh>

Public Types

enum  { NUMBER_OF_POINTS = 7, NUMBER_OF_DEGREES = 2 }
 
typedef JACOUSTICS::JGeometry JGeometry
 
typedef JTOOLS::JElement2D
< double,
JACOUSTICS::JMODEL::JString
element_type
 
typedef
JTOOLS::JPolfitFunction1D
< NUMBER_OF_POINTS,
NUMBER_OF_DEGREES,
element_type,
JTOOLS::JCollection
function_type
 
typedef JTOOLS::JHashMap< int,
function_type
data_type
 
typedef data_type::const_iterator const_iterator
 
typedef
data_type::const_reverse_iterator 
const_reverse_iterator
 

Public Member Functions

 JPosition (const JDetector &detector, const double Tmax_s)
 Constructor. More...
 
void load (JObjectIterator< JACOUSTICS::JEvt > &input)
 Load calibration data. More...
 
bool empty () const
 empty More...
 
const_iterator begin () const
 begin of calibration data More...
 
const_iterator end () const
 end of calibration data More...
 
const_reverse_iterator rbegin () const
 begin of reverse of calibration data More...
 
const_reverse_iterator rend () const
 begin of reverse of calibration data More...
 
double getTmax () const
 Get applicability period. More...
 
void setTmax (const double Tmax_s)
 Set applicability period. More...
 
double getCoverage (const JDetector &detector, const double t1_s) const
 Get coverage. More...
 
const JGeometrygetGeometry () const
 Get detector geometry. More...
 
void update (JDetector &detector, const double t1_s)
 Calibrate given detector at given time. More...
 
double getXmin () const
 Get minimal abscissa. More...
 
double getXmax () const
 Get maximal abscissa. More...
 

Protected Attributes

JGeometry geometry
 
data_type calibration
 
double Tmax_s
 

Private Attributes

double t0_s
 

Detailed Description

Dynamic position calibration.

Definition at line 314 of file JDynamics.hh.

Member Typedef Documentation

Definition at line 321 of file JDynamics.hh.

Definition at line 323 of file JDynamics.hh.

Definition at line 326 of file JDynamics.hh.

Definition at line 328 of file JDynamics.hh.

Definition at line 330 of file JDynamics.hh.

Definition at line 331 of file JDynamics.hh.

Member Enumeration Documentation

anonymous enum
Enumerator
NUMBER_OF_POINTS 

number of points for interpolation

NUMBER_OF_DEGREES 

number of degrees for interpolation

Definition at line 316 of file JDynamics.hh.

316  {
317  NUMBER_OF_POINTS = 7, //!< number of points for interpolation
318  NUMBER_OF_DEGREES = 2 //!< number of degrees for interpolation
319  };
number of degrees for interpolation
Definition: JDynamics.hh:318
number of points for interpolation
Definition: JDynamics.hh:317

Constructor & Destructor Documentation

JDYNAMICS::JDynamics::JPosition::JPosition ( const JDetector detector,
const double  Tmax_s 
)
inline

Constructor.

Parameters
detectordetector
Tmax_sapplicability period of calibration [s]

Definition at line 340 of file JDynamics.hh.

341  :
342  geometry(detector),
343  Tmax_s(Tmax_s),
344  t0_s(std::numeric_limits<double>::lowest())
345  {}

Member Function Documentation

void JDYNAMICS::JDynamics::JPosition::load ( JObjectIterator< JACOUSTICS::JEvt > &  input)
inline

Load calibration data.

Parameters
inputcalibration data

Definition at line 353 of file JDynamics.hh.

354  {
355  using namespace JPP;
356 
357  t0_s = std::numeric_limits<double>::lowest();
358 
359  while (input.hasNext()) {
360 
361  const JACOUSTICS::JEvt* evt = input.next();
362  const double t1_s = 0.5 * (evt->UNIXTimeStart + evt->UNIXTimeStop);
363 
364  for (JACOUSTICS::JEvt::const_iterator i = evt->begin(); i != evt->end(); ++i) {
365  calibration[i->id][t1_s] = JMODEL::JString(i->tx, i->ty);
366  }
367  }
368 
369  for (data_type::iterator i = calibration.begin(); i != calibration.end(); ++i) {
370  i->second.compile();
371  }
372  }
double UNIXTimeStop
stop time
virtual const pointer_type & next()=0
Get next element.
Acoustic event fit.
virtual bool hasNext()=0
Check availability of next element.
double UNIXTimeStart
start time
container_type::iterator iterator
Definition: JHashMap.hh:87
bool JDYNAMICS::JDynamics::JPosition::empty ( ) const
inline

empty

Definition at line 375 of file JDynamics.hh.

const_iterator JDYNAMICS::JDynamics::JPosition::begin ( ) const
inline

begin of calibration data

Definition at line 376 of file JDynamics.hh.

const_iterator JDYNAMICS::JDynamics::JPosition::end ( ) const
inline

end of calibration data

Definition at line 377 of file JDynamics.hh.

const_reverse_iterator JDYNAMICS::JDynamics::JPosition::rbegin ( ) const
inline

begin of reverse of calibration data

Definition at line 378 of file JDynamics.hh.

const_reverse_iterator JDYNAMICS::JDynamics::JPosition::rend ( ) const
inline

begin of reverse of calibration data

Definition at line 379 of file JDynamics.hh.

double JDYNAMICS::JDynamics::JPosition::getTmax ( ) const
inline

Get applicability period.

Returns
applicability period [s]

Definition at line 387 of file JDynamics.hh.

388  {
389  return Tmax_s;
390  }
void JDYNAMICS::JDynamics::JPosition::setTmax ( const double  Tmax_s)
inline

Set applicability period.

Parameters
Tmax_sapplicability period [s]

Definition at line 398 of file JDynamics.hh.

399  {
400  this->Tmax_s = Tmax_s;
401  }
double JDYNAMICS::JDynamics::JPosition::getCoverage ( const JDetector detector,
const double  t1_s 
) const
inline

Get coverage.

Parameters
detectordetector
t1_stime [s]
Returns
coverage

Definition at line 411 of file JDynamics.hh.

412  {
413  int n0 = 0;
414  int n1 = 0;
415 
416  std::set<int> string;
417 
418  for (JDetector::const_iterator module = detector.begin(); module != detector.end(); ++module) {
419  if (module->getFloor() != 0) {
420  string.insert(module->getString());
421  }
422  }
423 
424  for (std::set<int>::const_iterator i = string.begin(); i != string.end(); ++i) {
425 
426  ++n0;
427 
428  if (calibration.has(*i) && !calibration.get(*i).empty()) {
429  if (calibration[*i].getXmin() <= t1_s &&
430  calibration[*i].getXmax() >= t1_s) {
431  ++n1;
432  }
433  }
434  }
435 
436  return (double) n1 / (double) n0;
437  }
double getXmin() const
Get minimal abscissa.
Definition: JDynamics.hh:495
virtual mapped_type & get(typename JClass< key_type >::argument_type key) override
Get mapped value.
Definition: JHashMap.hh:118
const_iterator begin() const
begin of calibration data
Definition: JDynamics.hh:376
bool has(const T &value) const
Test whether given value is present.
const JGeometry& JDYNAMICS::JDynamics::JPosition::getGeometry ( ) const
inline

Get detector geometry.

Returns
detector geometry

Definition at line 445 of file JDynamics.hh.

446  {
447  return geometry;
448  }
void JDYNAMICS::JDynamics::JPosition::update ( JDetector detector,
const double  t1_s 
)
inline

Calibrate given detector at given time.

Parameters
detectordetector (I/O)
t1_stime [s]

Definition at line 457 of file JDynamics.hh.

458  {
459  using namespace std;
460  using namespace JPP;
461 
462  if (!calibration.empty()) {
463 
464  if (fabs(t1_s - t0_s) > Tmax_s) {
465 
467 
468  for (JDetector::iterator module = detector.begin(); module != detector.end(); ++module) {
469 
470  if (module->getFloor() != 0) {
471 
472  if (!buffer.has(module->getString())) {
473  if (calibration.has(module->getString())) {
474  buffer[module->getString()] = calibration[module->getString()](t1_s);
475  }
476  }
477 
478  if (buffer.has(module->getString())) {
479  module->set(geometry[module->getString()].getPosition(buffer[module->getString()], module->getFloor()) - getPiezoPosition());
480  }
481  }
482  }
483 
484  t0_s = t1_s;
485  }
486  }
487  }
General purpose class for hash map of unique keys.
Definition: JHashMap.hh:71
JPosition3D getPiezoPosition()
Get relative position of piezo in optical module.
bool has(const T &value) const
Test whether given value is present.
double JDYNAMICS::JDynamics::JPosition::getXmin ( ) const
inline

Get minimal abscissa.

Returns
minimal abscissa

Definition at line 495 of file JDynamics.hh.

496  {
497  return JDynamics::getXmin(this->calibration);
498  }
static double getXmin(const JTOOLS::JHashMap< JKey_t, JValue_t, JEvaluator_t > &input)
Get minimal abscissa of mapped function objects.
Definition: JDynamics.hh:61
double JDYNAMICS::JDynamics::JPosition::getXmax ( ) const
inline

Get maximal abscissa.

Returns
maximal abscissa

Definition at line 506 of file JDynamics.hh.

507  {
508  return JDynamics::getXmax(this->calibration);
509  }
static double getXmax(const JTOOLS::JHashMap< JKey_t, JValue_t, JEvaluator_t > &input)
Get maximal abscissa of mapped function objects.
Definition: JDynamics.hh:82

Member Data Documentation

JGeometry JDYNAMICS::JDynamics::JPosition::geometry
protected

Definition at line 512 of file JDynamics.hh.

data_type JDYNAMICS::JDynamics::JPosition::calibration
protected

Definition at line 513 of file JDynamics.hh.

double JDYNAMICS::JDynamics::JPosition::Tmax_s
protected

Definition at line 514 of file JDynamics.hh.

double JDYNAMICS::JDynamics::JPosition::t0_s
private

Definition at line 517 of file JDynamics.hh.


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