Jpp  17.3.0-rc.2
the software that should make you happy
 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
JACOUSTICS::JNarrabri Struct Reference

Dynamic position calibration. More...

#include <JNarrabri.hh>

Public Types

enum  { NUMBER_OF_POINTS = 7, NUMBER_OF_DEGREES = 2 }
 
typedef JTOOLS::JElement2D
< double, 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

 JNarrabri (const JDetector &detector, const double Tmax_s)
 Constructor. More...
 
void load (JObjectIterator< JEvt > &input)
 Load calibration data. More...
 
bool is_valid () const
 Check validity of calibration. More...
 
double getXmin () const
 Get minimal abscissa. More...
 
double getXmax () const
 Get maximal abscissa. 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...
 
const JDetectoroperator() (const double t1_s)
 Get detector calibrated at given time. More...
 

Protected Attributes

data_type calibration
 
JDetector detector
 
JGeometry geometry
 
double Tmax_s
 

Private Attributes

double t0_s
 

Detailed Description

Dynamic position calibration.

Definition at line 42 of file JNarrabri.hh.

Member Typedef Documentation

Definition at line 49 of file JNarrabri.hh.

Definition at line 52 of file JNarrabri.hh.

Definition at line 54 of file JNarrabri.hh.

Definition at line 56 of file JNarrabri.hh.

Definition at line 57 of file JNarrabri.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 44 of file JNarrabri.hh.

44  {
45  NUMBER_OF_POINTS = 7, //!< number of points for interpolation
46  NUMBER_OF_DEGREES = 2 //!< number of degrees for interpolation
47  };
number of degrees for interpolation
Definition: JNarrabri.hh:46
number of points for interpolation
Definition: JNarrabri.hh:45

Constructor & Destructor Documentation

JACOUSTICS::JNarrabri::JNarrabri ( const JDetector detector,
const double  Tmax_s 
)
inline

Constructor.

Parameters
detectordetector
Tmax_sapplicability period [s]

Definition at line 66 of file JNarrabri.hh.

67  :
68  detector(detector),
69  geometry(detector),
70  Tmax_s(Tmax_s),
71  t0_s(std::numeric_limits<double>::lowest())
72  {}

Member Function Documentation

void JACOUSTICS::JNarrabri::load ( JObjectIterator< JEvt > &  input)
inline

Load calibration data.

Parameters
inputdetector calibration data

Definition at line 80 of file JNarrabri.hh.

81  {
82  t0_s = std::numeric_limits<double>::lowest();
83 
84  while (input.hasNext()) {
85 
86  const JEvt* evt = input.next();
87  const double t1_s = 0.5 * (evt->UNIXTimeStart + evt->UNIXTimeStop);
88 
89  for (JEvt::const_iterator i = evt->begin(); i != evt->end(); ++i) {
90  calibration[i->id][t1_s] = JMODEL::JString(i->tx, i->ty);
91  }
92  }
93 
94  for (data_type::iterator i = calibration.begin(); i != calibration.end(); ++i) {
95  i->second.compile();
96  }
97  }
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:88
bool JACOUSTICS::JNarrabri::is_valid ( ) const
inline

Check validity of calibration.

Returns
true if valid; else false

Definition at line 105 of file JNarrabri.hh.

106  {
107  for (JDetector::const_iterator module = detector.begin(); module != detector.end(); ++module) {
108  if (!calibration.has(module->getString())) {
109  return false;
110  }
111  }
112 
113  return true;
114  }
Detector file.
Definition: JHead.hh:226
bool has(const T &value) const
Test whether given value is present.
double JACOUSTICS::JNarrabri::getXmin ( ) const
inline

Get minimal abscissa.

Returns
minimal abscissa

Definition at line 122 of file JNarrabri.hh.

123  {
124  double xmin = std::numeric_limits<double>::max();
125 
126  for (const_iterator i = this->begin(); i != this->end(); ++i) {
127  if (!i->second.empty() && i->second.getXmin() < xmin) {
128  xmin = i->second.getXmin();
129  }
130  }
131 
132  return xmin;
133  }
const_iterator end() const
end of calibration data
Definition: JNarrabri.hh:156
const_iterator begin() const
begin of calibration data
Definition: JNarrabri.hh:155
data_type::const_iterator const_iterator
Definition: JNarrabri.hh:56
const double xmin
Definition: JQuadrature.cc:23
double JACOUSTICS::JNarrabri::getXmax ( ) const
inline

Get maximal abscissa.

Returns
maximal abscissa

Definition at line 141 of file JNarrabri.hh.

142  {
143  double xmax = std::numeric_limits<double>::lowest();
144 
145  for (const_iterator i = this->begin(); i != this->end(); ++i) {
146  if (!i->second.empty() && i->second.getXmax() > xmax) {
147  xmax = i->second.getXmax();
148  }
149  }
150 
151  return xmax;
152  }
const double xmax
Definition: JQuadrature.cc:24
const_iterator end() const
end of calibration data
Definition: JNarrabri.hh:156
const_iterator begin() const
begin of calibration data
Definition: JNarrabri.hh:155
data_type::const_iterator const_iterator
Definition: JNarrabri.hh:56
const_iterator JACOUSTICS::JNarrabri::begin ( ) const
inline

begin of calibration data

Definition at line 155 of file JNarrabri.hh.

const_iterator JACOUSTICS::JNarrabri::end ( ) const
inline

end of calibration data

Definition at line 156 of file JNarrabri.hh.

const_reverse_iterator JACOUSTICS::JNarrabri::rbegin ( ) const
inline

begin of reverse of calibration data

Definition at line 157 of file JNarrabri.hh.

const_reverse_iterator JACOUSTICS::JNarrabri::rend ( ) const
inline

begin of reverse of calibration data

Definition at line 158 of file JNarrabri.hh.

const JDetector& JACOUSTICS::JNarrabri::operator() ( const double  t1_s)
inline

Get detector calibrated at given time.

Parameters
t1_stime [s]
Returns
detector

Definition at line 167 of file JNarrabri.hh.

168  {
169  using namespace std;
170  using namespace JPP;
171 
172  if (!calibration.empty()) {
173 
174  if (fabs(t1_s - t0_s) > Tmax_s) {
175 
177 
178  for (JDetector::iterator module = detector.begin(); module != detector.end(); ++module) {
179 
180  if (!buffer.has(module->getString())) {
181  if (calibration.has(module->getString())) {
182  buffer[module->getString()] = calibration[module->getString()](t1_s);
183  }
184  }
185 
186  if (buffer.has(module->getString())) {
187  module->set(geometry[module->getString()].getPosition(buffer[module->getString()], module->getFloor()) - getPiezoPosition());
188  }
189  }
190 
191  t0_s = t1_s;
192  }
193  }
194 
195  return detector;
196  }
General purpose class for hash map of unique keys.
Definition: JHashMap.hh:72
Detector file.
Definition: JHead.hh:226
void set(const JHashMap &source, const mapped_type &value)
Set values corresponding to keys in given source.
Definition: JHashMap.hh:130
JPosition3D getPiezoPosition()
Get relative position of piezo in optical module.
bool has(const T &value) const
Test whether given value is present.

Member Data Documentation

data_type JACOUSTICS::JNarrabri::calibration
protected

Definition at line 200 of file JNarrabri.hh.

JDetector JACOUSTICS::JNarrabri::detector
protected

Definition at line 201 of file JNarrabri.hh.

JGeometry JACOUSTICS::JNarrabri::geometry
protected

Definition at line 202 of file JNarrabri.hh.

double JACOUSTICS::JNarrabri::Tmax_s
protected

Definition at line 203 of file JNarrabri.hh.

double JACOUSTICS::JNarrabri::t0_s
private

Definition at line 206 of file JNarrabri.hh.


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