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
JCOMPASS::JBallarat Struct Reference

Dynamic orientation calibration. More...

#include <JBallarat.hh>

Public Types

enum  { NUMBER_OF_POINTS = 20, NUMBER_OF_DEGREES = 1 }
 
typedef JTOOLS::JElement2D
< double,
JGEOMETRY3D::JQuaternion3D
element_type
 
typedef
JTOOLS::JPolfitFunction1D
< NUMBER_OF_POINTS,
NUMBER_OF_DEGREES,
element_type,
JTOOLS::JCollection
function_type
 
typedef
function_type::collection_type::container_type 
container_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

 JBallarat (const JDetector &detector, const double Tmax_s)
 Constructor. More...
 
void load (JObjectIterator< JCOMPASS::JOrientation > &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
 
double Tmax_s
 

Private Attributes

double t0_s
 

Detailed Description

Dynamic orientation calibration.

Note that the quaternion data of the internal detector are used to track the consecutive rotations.

Definition at line 39 of file JBallarat.hh.

Member Typedef Documentation

Definition at line 46 of file JBallarat.hh.

Definition at line 49 of file JBallarat.hh.

typedef function_type::collection_type::container_type JCOMPASS::JBallarat::container_type

Definition at line 50 of file JBallarat.hh.

Definition at line 52 of file JBallarat.hh.

Definition at line 54 of file JBallarat.hh.

Definition at line 55 of file JBallarat.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 41 of file JBallarat.hh.

41  {
42  NUMBER_OF_POINTS = 20, //!< number of points for interpolation
43  NUMBER_OF_DEGREES = 1 //!< number of degrees for interpolation
44  };
number of points for interpolation
Definition: JBallarat.hh:42
number of degrees for interpolation
Definition: JBallarat.hh:43

Constructor & Destructor Documentation

JCOMPASS::JBallarat::JBallarat ( const JDetector detector,
const double  Tmax_s 
)
inline

Constructor.

Parameters
detectordetector
Tmax_sapplicability period [s]

Definition at line 64 of file JBallarat.hh.

65  :
66  detector(detector),
67  Tmax_s(Tmax_s),
68  t0_s(std::numeric_limits<double>::lowest())
69  {
70  using namespace JPP;
71 
72  if (hasDetectorAddressMap(this->detector.getID())) {
73 
74  const JDetectorAddressMap& demo = getDetectorAddressMap(detector.getID());
75 
76  for (JDetector::iterator module = this->detector.begin(); module != this->detector.end(); ++module) {
77  module->setQuaternion(getRotation(getModule(demo.get(module->getID())), *module));
78  }
79 
80  } else {
81 
82  THROW(JValueOutOfRange, "No detector address map for detector identier " << detector.getID());
83  }
84  }
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition: JException.hh:670
bool hasDetectorAddressMap(const int id)
Check if detector address map is available.
static JRotation getRotation
Function object to get rotation matrix to go from first to second module.
Lookup table for PMT addresses in detector.
JDetector detector
Definition: JBallarat.hh:218
const JModuleAddressMap & get(const int id) const
Get module address map.
int getID() const
Get identifier.
Definition: JObjectID.hh:50
JDetectorAddressMap & getDetectorAddressMap()
Get detector address map.
Exception for accessing a value in a collection that is outside of its range.
Definition: JException.hh:162
const JModule & getModule(const JDetector &detector, const JModuleLocation &location)
find module with a given string and floor number

Member Function Documentation

void JCOMPASS::JBallarat::load ( JObjectIterator< JCOMPASS::JOrientation > &  input)
inline

Load calibration data.

Parameters
inputdetector calibration data

Definition at line 92 of file JBallarat.hh.

93  {
94  using namespace JPP;
95 
96  t0_s = std::numeric_limits<double>::lowest();
97 
98  while (input.hasNext()) {
99 
100  const JOrientation* orientation = input.next();
101 
102  static_cast<container_type&>(calibration[orientation->id]).push_back(element_type(orientation->t, getQuaternion(*orientation)));
103  }
104 
105  for (data_type::iterator i = calibration.begin(); i != calibration.end(); ++i) {
106  i->second.sort();
107  i->second.compile();
108  }
109  }
JTOOLS::JElement2D< double, JGEOMETRY3D::JQuaternion3D > element_type
Definition: JBallarat.hh:46
int id
module identifier
JQuaternion3D getQuaternion(const JQuaternion &Q)
Get quaternion.
function_type::collection_type::container_type container_type
Definition: JBallarat.hh:50
data_type calibration
Definition: JBallarat.hh:217
virtual const pointer_type & next()=0
Get next element.
virtual bool hasNext()=0
Check availability of next element.
Orientation of module.
container_type::iterator iterator
Definition: JHashMap.hh:87
bool JCOMPASS::JBallarat::is_valid ( ) const
inline

Check validity of calibration.

Returns
true if valid; else false

Definition at line 117 of file JBallarat.hh.

118  {
119  for (JDetector::const_iterator module = detector.begin(); module != detector.end(); ++module) {
120  if (!calibration.has(module->getID())) {
121  return false;
122  }
123  }
124 
125  return true;
126  }
data_type calibration
Definition: JBallarat.hh:217
Detector file.
Definition: JHead.hh:196
bool has(const T &value) const
Test whether given value is present.
double JCOMPASS::JBallarat::getXmin ( ) const
inline

Get minimal abscissa.

Returns
minimal abscissa

Definition at line 134 of file JBallarat.hh.

135  {
136  double xmin = std::numeric_limits<double>::max();
137 
138  for (const_iterator i = this->begin(); i != this->end(); ++i) {
139  if (!i->second.empty() && i->second.getXmin() < xmin) {
140  xmin = i->second.getXmin();
141  }
142  }
143 
144  return xmin;
145  }
const_iterator end() const
end of calibration data
Definition: JBallarat.hh:168
data_type::const_iterator const_iterator
Definition: JBallarat.hh:54
const_iterator begin() const
begin of calibration data
Definition: JBallarat.hh:167
double JCOMPASS::JBallarat::getXmax ( ) const
inline

Get maximal abscissa.

Returns
maximal abscissa

Definition at line 153 of file JBallarat.hh.

154  {
155  double xmax = std::numeric_limits<double>::lowest();
156 
157  for (const_iterator i = this->begin(); i != this->end(); ++i) {
158  if (!i->second.empty() && i->second.getXmax() > xmax) {
159  xmax = i->second.getXmax();
160  }
161  }
162 
163  return xmax;
164  }
const_iterator end() const
end of calibration data
Definition: JBallarat.hh:168
data_type::const_iterator const_iterator
Definition: JBallarat.hh:54
const_iterator begin() const
begin of calibration data
Definition: JBallarat.hh:167
const_iterator JCOMPASS::JBallarat::begin ( ) const
inline

begin of calibration data

Definition at line 167 of file JBallarat.hh.

const_iterator JCOMPASS::JBallarat::end ( ) const
inline

end of calibration data

Definition at line 168 of file JBallarat.hh.

const_reverse_iterator JCOMPASS::JBallarat::rbegin ( ) const
inline

begin of reverse of calibration data

Definition at line 169 of file JBallarat.hh.

const_reverse_iterator JCOMPASS::JBallarat::rend ( ) const
inline

begin of reverse of calibration data

Definition at line 170 of file JBallarat.hh.

const JDetector& JCOMPASS::JBallarat::operator() ( const double  t1_s)
inline

Get detector calibrated at given time.

Parameters
t1_stime [s]
Returns
detector

Definition at line 179 of file JBallarat.hh.

180  {
181  using namespace std;
182  using namespace JPP;
183 
184  if (!calibration.empty()) {
185 
186  if (fabs(t1_s - t0_s) > Tmax_s) {
187 
188  for (JDetector::iterator module = detector.begin(); module != detector.end(); ++module) {
189 
190  if (calibration.has(module->getID())) {
191 
192  const function_type& f1 = calibration.get(module->getID());
193 
194  if (!f1.empty()) {
195 
196  if (t1_s >= f1.getXmin() && t1_s <= f1.getXmax()) {
197 
198  JQuaternion3D Q0 = module->getQuaternion();
199  JQuaternion3D Q1 = f1(t1_s);
200 
201  module->rotate(Q1 * Q0.conjugate());
202  module->setQuaternion(Q1);
203  }
204  }
205  }
206  }
207 
208  t0_s = t1_s;
209  }
210  }
211 
212  return detector;
213  }
JDetector detector
Definition: JBallarat.hh:218
const JQuaternion3D & getQuaternion() const
Get quaternion.
data_type calibration
Definition: JBallarat.hh:217
virtual mapped_type & get(typename JClass< key_type >::argument_type key) override
Get mapped value.
Definition: JHashMap.hh:118
Detector file.
Definition: JHead.hh:196
Data structure for unit quaternion in three dimensions.
JTOOLS::JPolfitFunction1D< NUMBER_OF_POINTS, NUMBER_OF_DEGREES, element_type, JTOOLS::JCollection > function_type
Definition: JBallarat.hh:49
bool has(const T &value) const
Test whether given value is present.
JQuaternion3D & conjugate()
Conjugate quaternion.

Member Data Documentation

data_type JCOMPASS::JBallarat::calibration
protected

Definition at line 217 of file JBallarat.hh.

JDetector JCOMPASS::JBallarat::detector
protected

Definition at line 218 of file JBallarat.hh.

double JCOMPASS::JBallarat::Tmax_s
protected

Definition at line 219 of file JBallarat.hh.

double JCOMPASS::JBallarat::t0_s
private

Definition at line 222 of file JBallarat.hh.


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