Jpp  master_rocky-43-ge265d140c
the software that should make you happy
Public Member Functions | Static Public Member Functions | Protected Attributes | Friends | List of all members
JDETECTOR::JModule Class Reference

Data structure for a composite optical module. More...

#include <JModule.hh>

Inheritance diagram for JDETECTOR::JModule:
JLANG::JObjectID JDETECTOR::JLocation JGEOMETRY3D::JPosition3D JGEOMETRY3D::JQuaternion3D JDETECTOR::JCalibration JEEP::JStatus std::vector< JPMT > JLANG::JEquals< JFirst_t, JSecond_t > JLANG::JEquals< JFirst_t, JSecond_t > JMATH::JMath< JFirst_t, JSecond_t > JMATH::JMath< JFirst_t, JSecond_t > JMATH::JMath< JFirst_t, JSecond_t > JMATH::JMath< JFirst_t, JSecond_t > JGEOMETRY3D::JVector3D JLANG::JComparable< JFirst_t, JSecond_t > JLANG::JComparable< JObjectID, int > JLANG::JComparable< JObjectID > JCALIBRATE::JModel JMONITOR::JClusterBuilder

Public Member Functions

 JModule ()
 Default constructor. More...
 
 JModule (const int id, const JLocation &location)
 Constructor. More...
 
const JPMTgetPMT (const int index) const
 Get PMT. More...
 
JPMTgetPMT (const int index)
 Get PMT. More...
 
void setPMT (const int index, const JPMT &pmt)
 Set PMT. More...
 
JVector3D getCenter () const
 Get center of module based on crossing point of PMT axes. More...
 
void compile ()
 Compile module data. More...
 
void rotate (const JRotation3D &R)
 Rotate module. More...
 
void rotate_back (const JRotation3D &R)
 Rotate back module. More...
 
void transform (const JRotation3D &R, const JVector3D &pos)
 Transformation of geometry (see method JGEOMETRY3D::JPosition3D::transform(const JRotation3D&, const JVector3D&)). More...
 
void transform (const JTransformation3D &T)
 Transformation of geometry. More...
 
void rotate (const JQuaternion3D &Q)
 Rotate module. More...
 
void rotate_back (const JQuaternion3D &Q)
 Rotate back module. More...
 
JModuleset (const JVector3D &pos)
 Set position. More...
 
JModuleadd (const JVector3D &pos)
 Add position. More...
 
JModulesub (const JVector3D &pos)
 Subtract position. More...
 
JModuleset (const double t0)
 Set time offset. More...
 
JModuleadd (const double t0)
 Add time offset. More...
 
JModulesub (const double t0)
 Subtract time offset. More...
 
JModuleoperator+= (const JVector3D &pos)
 Add position. More...
 
JModuleoperator-= (const JVector3D &pos)
 Subtract position. More...
 
bool has (const int bit) const
 Test PMT status. More...
 
void set (const int bit)
 Set PMT status. More...
 
void reset (const int bit)
 Reset PMT status. More...
 
int getID () const
 Get identifier. More...
 
int & getID ()
 Get identifier. More...
 
void setID (const int id)
 Set identifier. More...
 
bool less (const JObjectID &object) const
 Less than method. More...
 
bool less (const int id) const
 Less than method. More...
 
bool more (const int id) const
 More than method. More...
 
const JLocationgetLocation () const
 Get location. More...
 
JLocationgetLocation ()
 Get location. More...
 
void setLocation (const JLocation &location)
 Set location. More...
 
std::string toString () const
 Convert module location to string. More...
 
std::string toString (const std::string &fmt, const std::string target="%") const
 Convert module loation to string. More...
 
int getString () const
 Get string number. More...
 
int getFloor () const
 Get floor number. More...
 
bool less (const JLocation &location) const
 Less than method. More...
 
const JPosition3DgetPosition () const
 Get position. More...
 
JPosition3DgetPosition ()
 Get position. More...
 
void setPosition (const JVector3D &pos)
 Set position. More...
 
 operator JAngle3D () const
 Type conversion operator. More...
 
 operator JVersor3D () const
 Type conversion operator. More...
 
JPosition3Drotate (const JRotation3X &R)
 Rotate around X-axis. More...
 
JPosition3Drotate (const JRotation3Y &R)
 Rotate around Y-axis. More...
 
JPosition3Drotate (const JRotation3Z &R)
 Rotate around Z-axis. More...
 
JPosition3Drotate_back (const JRotation3X &R)
 Rotate back around X-axis. More...
 
JPosition3Drotate_back (const JRotation3Y &R)
 Rotate back around Y-axis. More...
 
JPosition3Drotate_back (const JRotation3Z &R)
 Rotate back around Z-axis. More...
 
JVector3Dtransform (const JMatrix3D &T)
 Transform. More...
 
JVector3Dtransform (const JMatrix3D &T)
 Transform. More...
 
void transform_back (const JRotation3D &R, const JVector3D &pos)
 Transform back position. More...
 
double getDot (const JAngle3D &angle) const
 Get dot product. More...
 
double getDot (const JVersor3D &dir) const
 Get dot product. More...
 
double getDot (const JVersor3Z &dir) const
 Get dot product. More...
 
double getDot (const JVector3D &vector) const
 Get dot product. More...
 
double getDot (const JVector3D &vector) const
 Get dot product. More...
 
 operator JVector2D () const
 Type conversion operator. More...
 
double getX () const
 Get x position. More...
 
double getY () const
 Get y position. More...
 
double getZ () const
 Get z position. More...
 
JVector3Dnegate ()
 Negate vector. More...
 
JVector3Dmul (const double factor)
 Scale vector. More...
 
JFirst_t & mul (const JSecond_t &object)
 Multiply with object. More...
 
JVector3Ddiv (const double factor)
 Scale vector. More...
 
bool equals (const JVector3D &vector, const double precision=std::numeric_limits< double >::min()) const
 Check equality. More...
 
double getLengthSquared () const
 Get length squared. More...
 
double getLength () const
 Get length. More...
 
double getDistanceSquared (const JVector3D &pos) const
 Get squared of distance to point. More...
 
double getDistance (const JVector3D &pos) const
 Get distance to point. More...
 
JVector3DgetCross (const JVector3D &first, const JVector3D &second)
 Get cross product. More...
 
const JQuaternion3DgetQuaternion () const
 Get quaternion. More...
 
JQuaternion3DgetQuaternion ()
 Get quaternion. More...
 
void setQuaternion (const JQuaternion3D &quaternion)
 Set quaternion. More...
 
 operator JVector3D () const
 Type conversion operator. More...
 
 operator JVersor3D () const
 Type conversion operator. More...
 
double getAngle () const
 Get rotation angle. More...
 
double getA () const
 Get a value. More...
 
double getB () const
 Get b value. More...
 
double getC () const
 Get c value. More...
 
double getD () const
 Get d value. More...
 
JQuaternion3DsetIdentity ()
 Set to identity quaternion. More...
 
JQuaternion3Dconjugate ()
 Conjugate quaternion. More...
 
JQuaternion3Dnegate ()
 Negate quaternion. More...
 
JQuaternion3Dadd (const JQuaternion3D &quaternion)
 Add quaternion. More...
 
JQuaternion3Dsub (const JQuaternion3D &quaternion)
 Subtract quaternion. More...
 
JQuaternion3Dmul (const double factor)
 Scale quaternion. More...
 
JQuaternion3Dmul (const JQuaternion3D &first, const JQuaternion3X &second)
 Quaternion multiplication. More...
 
JQuaternion3Dmul (const JQuaternion3D &first, const JQuaternion3Y &second)
 Quaternion multiplication. More...
 
JQuaternion3Dmul (const JQuaternion3D &first, const JQuaternion3Z &second)
 Quaternion multiplication. More...
 
JQuaternion3Dmul (const JQuaternion3D &first, const JQuaternion3D &second)
 Quaternion multiplication. More...
 
JQuaternion3Dmul (const JQuaternion3X &qx, const JQuaternion3Y &qy, const JQuaternion3Z &qz)
 Quaternion multiplication. More...
 
JFirst_t & mul (const JSecond_t &object)
 Multiply with object. More...
 
JQuaternion3Ddiv (const double factor)
 Scale quaternion. More...
 
void rotate (double &__x, double &__y, double &__z) const
 Rotate. More...
 
void rotate_back (double &__x, double &__y, double &__z) const
 Rotate back. More...
 
bool equals (const JQuaternion3D &quaternion, const double precision=std::numeric_limits< double >::min()) const
 Check equality. More...
 
bool isIdentity (const double precision=std::numeric_limits< double >::min()) const
 Test identity. More...
 
double getLengthSquared () const
 Get length squared. More...
 
double getLength () const
 Get length. More...
 
double getDistanceSquared (const JQuaternion3D &quaternion) const
 Get squared of distance to quaternion. More...
 
double getDistance (const JQuaternion3D &quaternion) const
 Get distance to quaternion. More...
 
double getDot (const JQuaternion3D &quaternion) const
 Get dot product. More...
 
JQuaternion3D getConjugate () const
 Get conjugate of this quaternion. More...
 
JQuaternion3Dnormalise ()
 Normalise quaternion. More...
 
JQuaternion3Dpow (const double y)
 Raise quaternion to given power. More...
 
JQuaternion3Dinterpolate (const JQuaternion3D &object, const double alpha)
 Interpolation between quaternions. More...
 
const JCalibrationgetCalibration () const
 Get calibration. More...
 
JCalibrationgetCalibration ()
 Get calibration. More...
 
void setCalibration (const JCalibration &cal)
 Set calibration. More...
 
double getT0 () const
 Get time offset. More...
 
void setT0 (const double t0)
 Set time offset. More...
 
void addT0 (const double t0)
 Add time offset. More...
 
void subT0 (const double t0)
 Subtract time offset. More...
 
int getStatus () const
 Get status. More...
 
JStatusgetStatus ()
 Get status. More...
 
int getStatus (const int mask) const
 Get status. More...
 
void setStatus (const JStatus &status)
 Set status. More...
 
bool equals (const JStatus &status) const
 Equal method. More...
 
bool has (const int bit) const
 Test PMT status. More...
 
void set (const int bit)
 Set PMT status. More...
 
void reset (const int bit)
 Reset PMT status. More...
 

Static Public Member Functions

static JDetectorVersiongetVersion ()
 Get detector version. More...
 
static void setVersion (const JVersion &version)
 Set detector version. More...
 
static bool compare (const JModule &first, const JModule &second, const double precision=1.0e-3)
 Compare modules. More...
 
static const JQuaternion3DgetIdentity ()
 Get identity quaternion. More...
 

Protected Attributes

int __id
 
int string
 
int floor
 
double __x
 
double __y
 
double __z
 
double __a
 
double __b
 
double __c
 
double __d
 
double t0
 
int status
 

Friends

std::istream & operator>> (std::istream &in, JModule &module)
 Read module from input. More...
 
std::ostream & operator<< (std::ostream &out, const JModule &module)
 Write module to output. More...
 
JReaderoperator>> (JReader &in, JModule &module)
 Read module from input. More...
 
JWriteroperator<< (JWriter &out, const JModule &module)
 Write module to output. More...
 

Detailed Description

Data structure for a composite optical module.

A module consists of a set of PMTs. A JPMT object is used for each PMT.
The index of the PMT in the module corresponds to the readout channel (TDC).
The quaternion data and time offset correspond to the calibration of the compass and piezo sensor inside the module, respectively.
There are no PMTs and piezo sensor in the base module. The time offset then corresponds to the hydrophone. Note that the positions of the PMTs are absolute in space (i.e. not relative to the position of the module).

The I/O of the position, quaternion data and time offset of the module depends on the detector version.
The member method JModule::compile is used to set the position, quaternion data and time offset for detector versions for which these are not defined.
In this, the position of the module is determined from the intersection point of the PMT axes.

Note finally that the positions of the reference modules may not exactly be at the origin due to the finite accuracy of the PMT axes.

Definition at line 67 of file JModule.hh.

Constructor & Destructor Documentation

◆ JModule() [1/2]

JDETECTOR::JModule::JModule ( )
inline

Default constructor.

Definition at line 85 of file JModule.hh.

85  :
87  JLocation(),
88  JPosition3D(),
89  JQuaternion3D(),
90  JCalibration(),
91  JStatus(),
93  {}
JCalibration()
Default constructor.
JLocation()
Default constructor.
Definition: JLocation.hh:45
JPosition3D()
Default constructor.
Definition: JPosition3D.hh:48
JQuaternion3D()
Default constructor.
JLANG::JObjectID JModuleIdentifier
JStatus()
Default constructor.
Definition: JStatus.hh:43

◆ JModule() [2/2]

JDETECTOR::JModule::JModule ( const int  id,
const JLocation location 
)
inline

Constructor.

Parameters
ididentifier
locationlocation

Definition at line 102 of file JModule.hh.

103  :
104  JModuleIdentifier(id),
105  JLocation(location),
106  JPosition3D(),
107  JQuaternion3D(),
108  JCalibration(),
109  JStatus(),
111  {}

Member Function Documentation

◆ getVersion()

static JDetectorVersion& JDETECTOR::JModule::getVersion ( )
inlinestatic

Get detector version.

Definition at line 117 of file JModule.hh.

118  {
119  static JDetectorVersion version;
120 
121  return version;
122  }

◆ setVersion()

static void JDETECTOR::JModule::setVersion ( const JVersion version)
inlinestatic

Set detector version.

Parameters
versionversion

Definition at line 130 of file JModule.hh.

131  {
132  getVersion() = JDetectorVersion(version);
133  }
static JDetectorVersion & getVersion()
Get detector version.
Definition: JModule.hh:117

◆ compare()

static bool JDETECTOR::JModule::compare ( const JModule first,
const JModule second,
const double  precision = 1.0e-3 
)
inlinestatic

Compare modules.

The comparison only covers the orientations of the modules.

Parameters
firstfirst module
secondsecond module
precisionprecision
Returns
true if two modules are equal; else false

Definition at line 146 of file JModule.hh.

149  {
150  if (first.size() == second.size()) {
151 
152  for (size_t i = 0; i != first.size(); ++i) {
153  if (first[i].getDirection().getDot(second[i].getDirection()) < 1.0 - precision) {
154  return false;
155  }
156  }
157 
158  return true;
159  }
160 
161  return false;
162  }
double getDot(const JVector3D &vector) const
Get dot product.
Definition: JVector3D.hh:282
JDirection3D getDirection(const Vec &dir)
Get direction.

◆ getPMT() [1/2]

const JPMT& JDETECTOR::JModule::getPMT ( const int  index) const
inline

Get PMT.

Parameters
indexreadout channel (TDC)
Returns
PMT at given index

Definition at line 172 of file JModule.hh.

173  {
174  return at(index);
175  }

◆ getPMT() [2/2]

JPMT& JDETECTOR::JModule::getPMT ( const int  index)
inline

Get PMT.

Parameters
indexreadout channel (TDC)
Returns
PMT at given index

Definition at line 184 of file JModule.hh.

185  {
186  return at(index);
187  }

◆ setPMT()

void JDETECTOR::JModule::setPMT ( const int  index,
const JPMT pmt 
)
inline

Set PMT.

Parameters
indexreadout channel (TDC)
pmtPMT

Definition at line 196 of file JModule.hh.

197  {
198  if (index >= (int) size()) {
199  resize(index + 1);
200  }
201 
202  (*this)[index] = pmt;
203  }

◆ getCenter()

JVector3D JDETECTOR::JModule::getCenter ( ) const
inline

Get center of module based on crossing point of PMT axes.

This method perform a fit of the crossing point of the PMT axes.
A general purpose implementation of such a fit is available in JFIT::JEstimator<JPoint3D>.

Returns
center

Definition at line 214 of file JModule.hh.

215  {
216  using namespace JPP;
217 
218  if (this->size() > 1u) {
219 
220  double x = 0;
221  double y = 0;
222  double z = 0;
223 
224  JMatrix3S V;
225 
226  for (const_iterator pmt = this->begin(); pmt != this->end(); ++pmt) {
227 
228  const double xx = 1.0 - pmt->getDX() * pmt->getDX();
229  const double yy = 1.0 - pmt->getDY() * pmt->getDY();
230  const double zz = 1.0 - pmt->getDZ() * pmt->getDZ();
231 
232  const double xy = -pmt->getDX() * pmt->getDY();
233  const double xz = -pmt->getDX() * pmt->getDZ();
234  const double yz = -pmt->getDY() * pmt->getDZ();
235 
236  V.a00 += xx;
237  V.a01 += xy;
238  V.a02 += xz;
239 
240  V.a11 += yy;
241  V.a12 += yz;
242 
243  V.a22 += zz;
244 
245  x += xx * pmt->getX() + xy * pmt->getY() + xz * pmt->getZ();
246  y += xy * pmt->getX() + yy * pmt->getY() + yz * pmt->getZ();
247  z += xz * pmt->getX() + yz * pmt->getY() + zz * pmt->getZ();
248  }
249 
250  V.a10 = V.a01;
251  V.a20 = V.a02;
252  V.a21 = V.a12;
253 
254  V.invert();
255 
256  return JVector3D(V.a00 * x + V.a01 * y + V.a02 * z,
257  V.a10 * x + V.a11 * y + V.a12 * z,
258  V.a20 * x + V.a21 * y + V.a22 * z);
259 
260  } else {
261  throw JValueOutOfRange("JModule::getCenter(): Not enough PMTs.");
262  }
263  }
JVector3D()
Default constructor.
Definition: JVector3D.hh:41
Exception for accessing a value in a collection that is outside of its range.
Definition: JException.hh:180
3 x 3 symmetric matrix
Definition: JMatrix3S.hh:31
void invert()
Invert matrix.
Definition: JMatrix3S.hh:80
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).

◆ compile()

void JDETECTOR::JModule::compile ( )
inline

Compile module data.

For detector versions before JDetectorVersion::V4, the position, quaternion data and time offset of the module should be set.
The position is set to the intersection point of the PMT axes (or their average position if this is not possible).
The quaternion data are maintained.
For an optical module (i.e. floor > 0), the time offset is set to the average time offset of the PMTs and for a base module (i.e. floor = 0), the time offset is set to zero.
These time offsets should be corrected for delay in the piezo sensor and hydrophone, respectively.

Definition at line 281 of file JModule.hh.

282  {
283  using namespace std;
284  using namespace JPP;
285 
286  if (!this->empty()) {
287 
288  JPosition3D& pos = this->getPosition();
289 
290  try {
291  pos = this->getCenter();
292  }
293  catch(const exception&) {
294 
295  pos = JPosition3D(0.0, 0.0, 0.0);
296 
297  for (iterator i = this->begin(); i != this->end(); ++i) {
298  pos.add(i->getPosition());
299  }
300 
301  pos.div(size());
302  }
303  }
304 
305  this->setCalibration(getAverage(make_array(this->begin(), this->end(), &JModule::getT0), 0.0));
306  }
double getT0() const
Get time offset.
void setCalibration(const JCalibration &cal)
Set calibration.
JVector3D getCenter() const
Get center of module based on crossing point of PMT axes.
Definition: JModule.hh:214
Data structure for position in three dimensions.
Definition: JPosition3D.hh:38
const JPosition3D & getPosition() const
Get position.
Definition: JPosition3D.hh:130
JVector3D & add(const JVector3D &vector)
Add vector.
Definition: JVector3D.hh:142
JVector3D & div(const double factor)
Scale vector.
Definition: JVector3D.hh:190
const array_type< JValue_t > & make_array(const JValue_t(&array)[N])
Method to create array of values.
Definition: JVectorize.hh:54
std::iterator_traits< T >::value_type getAverage(T __begin, T __end)
Get average.
Definition: JMath.hh:494
Definition: JSTDTypes.hh:14

◆ rotate() [1/6]

void JDETECTOR::JModule::rotate ( const JRotation3D R)
inline

Rotate module.

Parameters
Rrotation matrix

Definition at line 314 of file JModule.hh.

315  {
317 
318  for (iterator i = this->begin(); i != this->end(); ++i) {
319  i->rotate(R);
320  }
321  }
JPosition3D & rotate(const JRotation3D &R)
Rotate.
Definition: JPosition3D.hh:186

◆ rotate_back() [1/6]

void JDETECTOR::JModule::rotate_back ( const JRotation3D R)
inline

Rotate back module.

Parameters
Rrotation matrix

Definition at line 329 of file JModule.hh.

330  {
332 
333  for (iterator i = this->begin(); i != this->end(); ++i) {
334  i->rotate_back(R);
335  }
336  }
JPosition3D & rotate_back(const JRotation3D &R)
Rotate back.
Definition: JPosition3D.hh:200

◆ transform() [1/4]

void JDETECTOR::JModule::transform ( const JRotation3D R,
const JVector3D pos 
)
inline

Transformation of geometry (see method JGEOMETRY3D::JPosition3D::transform(const JRotation3D&, const JVector3D&)).

Parameters
Rrotation matrix
posposition of origin (after rotation)

Definition at line 345 of file JModule.hh.

347  {
348  JPosition3D::transform(R, pos);
349 
350  for (iterator i = this->begin(); i != this->end(); ++i) {
351  i->transform(R, pos);
352  }
353  }
JVector3D & transform(const JMatrix3D &T)
Transform.
Definition: JVector3D.hh:206

◆ transform() [2/4]

void JDETECTOR::JModule::transform ( const JTransformation3D T)
inline

Transformation of geometry.

Parameters
Ttransformation

Definition at line 361 of file JModule.hh.

362  {
364 
365  for (iterator i = this->begin(); i != this->end(); ++i) {
366  i->transform(T);
367  }
368  }
const JRotation3D & getRotation() const
Get rotation.
Definition: JRotation3D.hh:272

◆ rotate() [2/6]

void JDETECTOR::JModule::rotate ( const JQuaternion3D Q)
inline

Rotate module.

Parameters
Qquaternion

Definition at line 376 of file JModule.hh.

377  {
379 
380  for (iterator i = this->begin(); i != this->end(); ++i) {
381  i->rotate(Q);
382  }
383  }

◆ rotate_back() [2/6]

void JDETECTOR::JModule::rotate_back ( const JQuaternion3D Q)
inline

Rotate back module.

Parameters
Qquaternion

Definition at line 391 of file JModule.hh.

392  {
394 
395  for (iterator i = this->begin(); i != this->end(); ++i) {
396  i->rotate_back(Q);
397  }
398  }

◆ set() [1/4]

JModule& JDETECTOR::JModule::set ( const JVector3D pos)
inline

Set position.

Parameters
posposition
Returns
this module

Definition at line 407 of file JModule.hh.

408  {
409  return add(pos - this->getPosition());
410  }
JModule & add(const JVector3D &pos)
Add position.
Definition: JModule.hh:419

◆ add() [1/3]

JModule& JDETECTOR::JModule::add ( const JVector3D pos)
inline

Add position.

Parameters
posposition
Returns
this module

Definition at line 419 of file JModule.hh.

420  {
421  for (iterator i = begin(); i != end(); ++i) {
422  i->add(pos);
423  }
424 
425  JPosition3D::add(pos);
426 
427  return *this;
428  }

◆ sub() [1/3]

JModule& JDETECTOR::JModule::sub ( const JVector3D pos)
inline

Subtract position.

Parameters
posposition
Returns
this module

Definition at line 437 of file JModule.hh.

438  {
439  for (iterator i = begin(); i != end(); ++i) {
440  i->sub(pos);
441  }
442 
443  JPosition3D::sub(pos);
444 
445  return *this;
446  }
JVector3D & sub(const JVector3D &vector)
Subtract vector.
Definition: JVector3D.hh:158

◆ set() [2/4]

JModule& JDETECTOR::JModule::set ( const double  t0)
inline

Set time offset.

Parameters
t0time offset [ns]
Returns
this module

Definition at line 455 of file JModule.hh.

456  {
457  for (iterator i = begin(); i != end(); ++i) {
458  i->setT0(t0);
459  }
460 
461  return *this;
462  }

◆ add() [2/3]

JModule& JDETECTOR::JModule::add ( const double  t0)
inline

Add time offset.

Parameters
t0time offset [ns]
Returns
this module

Definition at line 471 of file JModule.hh.

472  {
473  for (iterator i = begin(); i != end(); ++i) {
474  i->addT0(t0);
475  }
476 
477  return *this;
478  }

◆ sub() [2/3]

JModule& JDETECTOR::JModule::sub ( const double  t0)
inline

Subtract time offset.

Parameters
t0time offset [ns]
Returns
this module

Definition at line 487 of file JModule.hh.

488  {
489  for (iterator i = begin(); i != end(); ++i) {
490  i->subT0(t0);
491  }
492 
493  return *this;
494  }

◆ operator+=()

JModule& JDETECTOR::JModule::operator+= ( const JVector3D pos)
inline

Add position.

Parameters
posposition
Returns
this module

Definition at line 503 of file JModule.hh.

504  {
505  return this->add(pos);
506  }

◆ operator-=()

JModule& JDETECTOR::JModule::operator-= ( const JVector3D pos)
inline

Subtract position.

Parameters
posposition
Returns
this module

Definition at line 515 of file JModule.hh.

516  {
517  return this->sub(pos);
518  }
JModule & sub(const JVector3D &pos)
Subtract position.
Definition: JModule.hh:437

◆ has() [1/2]

bool JEEP::JStatus::has
inline

Test PMT status.

Parameters
bitbit

Definition at line 120 of file JStatus.hh.

121  {
122  return (this->status & (1<<bit)) != 0;
123  }

◆ set() [3/4]

void JEEP::JStatus::set
inline

Set PMT status.

Parameters
bitbit

Definition at line 131 of file JStatus.hh.

132  {
133  this->status |= (1<<bit);
134  }

◆ reset() [1/2]

void JEEP::JStatus::reset
inline

Reset PMT status.

Parameters
bitbit

Definition at line 142 of file JStatus.hh.

143  {
144  this->status &= ~(1<<bit);
145  }

◆ getID() [1/2]

int JLANG::JObjectID::getID ( ) const
inlineinherited

Get identifier.

Returns
identifier

Definition at line 50 of file JObjectID.hh.

51  {
52  return __id;
53  }

◆ getID() [2/2]

int& JLANG::JObjectID::getID ( )
inlineinherited

Get identifier.

Returns
identifier

Definition at line 61 of file JObjectID.hh.

62  {
63  return __id;
64  }

◆ setID()

void JLANG::JObjectID::setID ( const int  id)
inlineinherited

Set identifier.

Parameters
ididentifier

Definition at line 72 of file JObjectID.hh.

73  {
74  this->__id = id;
75  }

◆ less() [1/3]

bool JLANG::JObjectID::less ( const JObjectID object) const
inlineinherited

Less than method.

Parameters
objectobject identifier
Returns
true if this identifier less than given identifier; else false

Definition at line 84 of file JObjectID.hh.

85  {
86  return this->getID() < object.getID();
87  }
int getID() const
Get identifier.
Definition: JObjectID.hh:50

◆ less() [2/3]

bool JLANG::JObjectID::less ( const int  id) const
inlineinherited

Less than method.

Parameters
ididentifier
Returns
true if this identifier less than given identifier; else false

Definition at line 96 of file JObjectID.hh.

97  {
98  return this->getID() < id;
99  }

◆ more()

bool JLANG::JObjectID::more ( const int  id) const
inlineinherited

More than method.

Parameters
ididentifier
Returns
true if this identifier greater than given identifier; else false

Definition at line 108 of file JObjectID.hh.

109  {
110  return this->getID() > id;
111  }

◆ getLocation() [1/2]

const JLocation& JDETECTOR::JLocation::getLocation ( ) const
inlineinherited

Get location.

Returns
location

Definition at line 70 of file JLocation.hh.

71  {
72  return static_cast<const JLocation&>(*this);
73  }
Logical location of module.
Definition: JLocation.hh:40

◆ getLocation() [2/2]

JLocation& JDETECTOR::JLocation::getLocation ( )
inlineinherited

Get location.

Returns
location

Definition at line 81 of file JLocation.hh.

82  {
83  return static_cast<JLocation&>(*this);
84  }

◆ setLocation()

void JDETECTOR::JLocation::setLocation ( const JLocation location)
inlineinherited

Set location.

Parameters
locationlocation

Definition at line 92 of file JLocation.hh.

93  {
94  static_cast<JLocation&>(*this) = location;
95  }

◆ toString() [1/2]

std::string JDETECTOR::JLocation::toString ( ) const
inlineinherited

Convert module location to string.

Returns
string

Definition at line 103 of file JLocation.hh.

104  {
105  return toString("% %");
106  }
std::string toString() const
Convert module location to string.
Definition: JLocation.hh:103

◆ toString() [2/2]

std::string JDETECTOR::JLocation::toString ( const std::string &  fmt,
const std::string  target = "%" 
) const
inlineinherited

Convert module loation to string.

The targets target in the format string fmt are consecutively replaced by floor and string.

Parameters
fmtformat
targettarget
Returns
string

Definition at line 119 of file JLocation.hh.

120  {
121  JLANG::JString buffer(fmt);
122 
123  buffer.replace(target, string, 1);
124  buffer.replace(target, floor, 1);
125 
126  return buffer;
127  }
Wrapper class around STL string class.
Definition: JString.hh:29
Target.
Definition: JHead.hh:300

◆ getString()

int JDETECTOR::JLocation::getString ( ) const
inlineinherited

Get string number.

Returns
string number

Definition at line 135 of file JLocation.hh.

136  {
137  return string;
138  }

◆ getFloor()

int JDETECTOR::JLocation::getFloor ( ) const
inlineinherited

Get floor number.

Returns
floor number

Definition at line 146 of file JLocation.hh.

147  {
148  return floor;
149  }

◆ less() [3/3]

bool JDETECTOR::JLocation::less ( const JLocation location) const
inlineinherited

Less than method.

Parameters
locationmodule location
Returns
true if first location before second location; else false

Definition at line 158 of file JLocation.hh.

159  {
160  if (this->getString() == location.getString())
161  return this->getFloor() < location.getFloor();
162  else
163  return this->getString() < location.getString();
164  }
int getFloor() const
Get floor number.
Definition: JLocation.hh:146
int getString() const
Get string number.
Definition: JLocation.hh:135

◆ getPosition() [1/2]

const JPosition3D& JGEOMETRY3D::JPosition3D::getPosition ( ) const
inlineinherited

Get position.

Returns
position

Definition at line 130 of file JPosition3D.hh.

131  {
132  return static_cast<const JPosition3D&>(*this);
133  }

◆ getPosition() [2/2]

JPosition3D& JGEOMETRY3D::JPosition3D::getPosition ( )
inlineinherited

Get position.

Returns
position

Definition at line 141 of file JPosition3D.hh.

142  {
143  return static_cast<JPosition3D&>(*this);
144  }

◆ setPosition()

void JGEOMETRY3D::JPosition3D::setPosition ( const JVector3D pos)
inlineinherited

Set position.

Parameters
posposition

Definition at line 152 of file JPosition3D.hh.

153  {
154  static_cast<JVector3D&>(*this) = pos;
155  }
Data structure for vector in three dimensions.
Definition: JVector3D.hh:36

◆ operator JAngle3D()

JGEOMETRY3D::JPosition3D::operator JAngle3D ( ) const
inlineinherited

Type conversion operator.

Returns
angle

Definition at line 163 of file JPosition3D.hh.

164  {
165  return JAngle3D(getX(), getY(), getZ());
166  }
Data structure for angles in three dimensions.
Definition: JAngle3D.hh:35
double getY() const
Get y position.
Definition: JVector3D.hh:104
double getZ() const
Get z position.
Definition: JVector3D.hh:115
double getX() const
Get x position.
Definition: JVector3D.hh:94

◆ operator JVersor3D() [1/2]

JGEOMETRY3D::JPosition3D::operator JVersor3D ( ) const
inlineinherited

Type conversion operator.

Returns
direction

Definition at line 174 of file JPosition3D.hh.

175  {
176  return JVersor3D(getX(), getY(), getZ());
177  }
Data structure for normalised vector in three dimensions.
Definition: JVersor3D.hh:28

◆ rotate() [3/6]

JPosition3D& JGEOMETRY3D::JPosition3D::rotate ( const JRotation3X R)
inlineinherited

Rotate around X-axis.

Parameters
Rrotation matrix
Returns
this position

Definition at line 214 of file JPosition3D.hh.

215  {
216  R.rotate(__y, __z);
217 
218  return *this;
219  }
void rotate(double &__x, double &__y) const
Rotate.
Definition: JRotation2D.hh:96

◆ rotate() [4/6]

JPosition3D& JGEOMETRY3D::JPosition3D::rotate ( const JRotation3Y R)
inlineinherited

Rotate around Y-axis.

Parameters
Rrotation matrix
Returns
this position

Definition at line 242 of file JPosition3D.hh.

243  {
244  R.rotate(__x, __z);
245 
246  return *this;
247  }

◆ rotate() [5/6]

JPosition3D& JGEOMETRY3D::JPosition3D::rotate ( const JRotation3Z R)
inlineinherited

Rotate around Z-axis.

Parameters
Rrotation matrix
Returns
this position

Definition at line 270 of file JPosition3D.hh.

271  {
272  R.rotate(__x, __y);
273 
274  return *this;
275  }

◆ rotate_back() [3/6]

JPosition3D& JGEOMETRY3D::JPosition3D::rotate_back ( const JRotation3X R)
inlineinherited

Rotate back around X-axis.

Parameters
Rrotation matrix
Returns
this position

Definition at line 228 of file JPosition3D.hh.

229  {
230  R.rotate_back(__y, __z);
231 
232  return *this;
233  }
void rotate_back(double &__x, double &__y) const
Rotate back.
Definition: JRotation2D.hh:112

◆ rotate_back() [4/6]

JPosition3D& JGEOMETRY3D::JPosition3D::rotate_back ( const JRotation3Y R)
inlineinherited

Rotate back around Y-axis.

Parameters
Rrotation matrix
Returns
this position

Definition at line 256 of file JPosition3D.hh.

257  {
258  R.rotate_back(__x, __z);
259 
260  return *this;
261  }

◆ rotate_back() [5/6]

JPosition3D& JGEOMETRY3D::JPosition3D::rotate_back ( const JRotation3Z R)
inlineinherited

Rotate back around Z-axis.

Parameters
Rrotation matrix
Returns
this position

Definition at line 284 of file JPosition3D.hh.

285  {
286  R.rotate_back(__x, __y);
287 
288  return *this;
289  }

◆ transform() [3/4]

JVector3D& JGEOMETRY3D::JVector3D::transform
inlineinherited

Transform.

Parameters
Tmatrix
Returns
this vector

Definition at line 206 of file JVector3D.hh.

207  {
208  T.transform(__x, __y, __z);
209 
210  return *this;
211  }

◆ transform() [4/4]

JVector3D& JGEOMETRY3D::JVector3D::transform ( const JMatrix3D T)
inlineinherited

Transform.

Parameters
Tmatrix
Returns
this vector

Definition at line 206 of file JVector3D.hh.

207  {
208  T.transform(__x, __y, __z);
209 
210  return *this;
211  }

◆ transform_back()

void JGEOMETRY3D::JPosition3D::transform_back ( const JRotation3D R,
const JVector3D pos 
)
inlineinherited

Transform back position.

The final position is obtained as follows:

  1. offset position with position pos;
  2. rotation of postion according matrix R;
Parameters
Rrotation matrix
posposition of origin (before rotation)

Definition at line 359 of file JPosition3D.hh.

361  {
362  // offset with respect to origin
363 
364  add(pos);
365 
366  // rotate back geometry to system with particle direction along z-axis
367 
368  rotate_back(R);
369  }

◆ getDot() [1/6]

double JGEOMETRY3D::JPosition3D::getDot ( const JAngle3D angle) const
inlineinherited

Get dot product.

Parameters
angleangle
Returns
dot product

Definition at line 378 of file JPosition3D.hh.

379  {
380  return
381  getX() * angle.getDX() +
382  getY() * angle.getDY() +
383  getZ() * angle.getDZ();
384  }
double getDY() const
Get y direction.
Definition: JAngle3D.hh:119
double getDZ() const
Get z direction.
Definition: JAngle3D.hh:130
double getDX() const
Get x direction.
Definition: JAngle3D.hh:108

◆ getDot() [2/6]

double JGEOMETRY3D::JPosition3D::getDot ( const JVersor3D dir) const
inlineinherited

Get dot product.

Parameters
dirdirection
Returns
dot product

Definition at line 393 of file JPosition3D.hh.

394  {
395  return
396  getX() * dir.getDX() +
397  getY() * dir.getDY() +
398  getZ() * dir.getDZ();
399  }
double getDY() const
Get y direction.
Definition: JVersor3D.hh:106
double getDX() const
Get x direction.
Definition: JVersor3D.hh:95
double getDZ() const
Get z direction.
Definition: JVersor3D.hh:117

◆ getDot() [3/6]

double JGEOMETRY3D::JPosition3D::getDot ( const JVersor3Z dir) const
inlineinherited

Get dot product.

Parameters
dirdirection
Returns
dot product

Definition at line 408 of file JPosition3D.hh.

409  {
410  return
411  getX() * dir.getDX() +
412  getY() * dir.getDY() +
413  getZ() * dir.getDZ();
414  }
double getDZ() const
Get z direction.
Definition: JVersor3Z.hh:169
double getDY() const
Get y direction.
Definition: JVersor3Z.hh:158
double getDX() const
Get x direction.
Definition: JVersor3Z.hh:147

◆ getDot() [4/6]

double JGEOMETRY3D::JVector3D::getDot
inlineinherited

Get dot product.

Parameters
vectorvector
Returns
dot product

Definition at line 282 of file JVector3D.hh.

283  {
284  return
285  getX() * vector.getX() +
286  getY() * vector.getY() +
287  getZ() * vector.getZ();
288  }

◆ getDot() [5/6]

double JGEOMETRY3D::JVector3D::getDot ( const JVector3D vector) const
inlineinherited

Get dot product.

Parameters
vectorvector
Returns
dot product

Definition at line 282 of file JVector3D.hh.

283  {
284  return
285  getX() * vector.getX() +
286  getY() * vector.getY() +
287  getZ() * vector.getZ();
288  }

◆ operator JVector2D()

JGEOMETRY3D::JVector3D::operator JVector2D ( ) const
inlineinherited

Type conversion operator.

Returns
JVector2D

Definition at line 83 of file JVector3D.hh.

84  {
85  return JVector2D(this->getX(), this->getY());
86  }

◆ getX()

double JGEOMETRY3D::JVector3D::getX ( ) const
inlineinherited

Get x position.

Returns
x position

Definition at line 94 of file JVector3D.hh.

95  {
96  return __x;
97  }

◆ getY()

double JGEOMETRY3D::JVector3D::getY ( ) const
inlineinherited

Get y position.

Returns
y position

Definition at line 104 of file JVector3D.hh.

105  {
106  return __y;
107  }

◆ getZ()

double JGEOMETRY3D::JVector3D::getZ ( ) const
inlineinherited

Get z position.

Returns
z position

Definition at line 115 of file JVector3D.hh.

116  {
117  return __z;
118  }

◆ negate() [1/2]

JVector3D& JGEOMETRY3D::JVector3D::negate ( )
inlineinherited

Negate vector.

Returns
this vector

Definition at line 126 of file JVector3D.hh.

127  {
128  __x = -__x;
129  __y = -__y;
130  __z = -__z;
131 
132  return *this;
133  }

◆ mul() [1/9]

JVector3D& JGEOMETRY3D::JVector3D::mul ( const double  factor)
inlineinherited

Scale vector.

Parameters
factormultiplication factor
Returns
this vector

Definition at line 174 of file JVector3D.hh.

175  {
176  __x *= factor;
177  __y *= factor;
178  __z *= factor;
179 
180  return *this;
181  }

◆ mul() [2/9]

template<class JFirst_t , class JSecond_t >
JFirst_t& JMATH::JMath< JFirst_t, JSecond_t >::mul ( const JSecond_t &  object)
inlineinherited

Multiply with object.

Parameters
objectobject
Returns
result object

Definition at line 354 of file JMath.hh.

355  {
356  return static_cast<JFirst_t&>(*this) = JFirst_t().mul(static_cast<const JFirst_t&>(*this), object);
357  }

◆ div() [1/2]

JVector3D& JGEOMETRY3D::JVector3D::div ( const double  factor)
inlineinherited

Scale vector.

Parameters
factordivision factor
Returns
this vector

Definition at line 190 of file JVector3D.hh.

191  {
192  __x /= factor;
193  __y /= factor;
194  __z /= factor;
195 
196  return *this;
197  }

◆ equals() [1/3]

bool JGEOMETRY3D::JVector3D::equals ( const JVector3D vector,
const double  precision = std::numeric_limits<double>::min() 
) const
inlineinherited

Check equality.

Parameters
vectorvector
precisionprecision
Returns
true if vectors are equal; else false

Definition at line 221 of file JVector3D.hh.

223  {
224  return (fabs(getX() - vector.getX()) <= precision &&
225  fabs(getY() - vector.getY()) <= precision &&
226  fabs(getZ() - vector.getZ()) <= precision);
227  }

◆ getLengthSquared() [1/2]

double JGEOMETRY3D::JVector3D::getLengthSquared ( ) const
inlineinherited

Get length squared.

Returns
square of length

Definition at line 235 of file JVector3D.hh.

236  {
237  return getX()*getX() + getY()*getY() + getZ()*getZ();
238  }

◆ getLength() [1/2]

double JGEOMETRY3D::JVector3D::getLength ( ) const
inlineinherited

Get length.

Returns
length

Definition at line 246 of file JVector3D.hh.

247  {
248  return sqrt(getLengthSquared());
249  }
double getLengthSquared() const
Get length squared.
Definition: JVector3D.hh:235

◆ getDistanceSquared() [1/2]

double JGEOMETRY3D::JVector3D::getDistanceSquared ( const JVector3D pos) const
inlineinherited

Get squared of distance to point.

Parameters
posposition
Returns
square of distance

Definition at line 258 of file JVector3D.hh.

259  {
260  return JVector3D(pos).sub(*this).getLengthSquared();
261  }

◆ getDistance() [1/2]

double JGEOMETRY3D::JVector3D::getDistance ( const JVector3D pos) const
inlineinherited

Get distance to point.

Parameters
posposition
Returns
distance

Definition at line 270 of file JVector3D.hh.

271  {
272  return sqrt(getDistanceSquared(pos));
273  }
double getDistanceSquared(const JVector3D &pos) const
Get squared of distance to point.
Definition: JVector3D.hh:258

◆ getCross()

JVector3D& JGEOMETRY3D::JVector3D::getCross ( const JVector3D first,
const JVector3D second 
)
inlineinherited

Get cross product.

Note that this vector should not overlap with the first or second vector,

Parameters
firstfirst vector
secondsecond vector
Returns
this vector

Definition at line 299 of file JVector3D.hh.

301  {
302  __x = first .getY() * second.getZ() - second.getY() * first .getZ();
303  __y = second.getX() * first .getZ() - first .getX() * second.getZ();
304  __z = first .getX() * second.getY() - second.getX() * first .getY();
305 
306  return *this;
307  }

◆ getIdentity()

static const JQuaternion3D& JGEOMETRY3D::JQuaternion3D::getIdentity ( )
inlinestaticinherited

Get identity quaternion.

Returns
identity quaternion

Definition at line 463 of file JQuaternion3D.hh.

464  {
465  static const JQuaternion3D Q = JQuaternion3D().setIdentity();
466 
467  return Q;
468  }
Data structure for unit quaternion in three dimensions.

◆ getQuaternion() [1/2]

const JQuaternion3D& JGEOMETRY3D::JQuaternion3D::getQuaternion ( ) const
inlineinherited

Get quaternion.

Returns
quaternion

Definition at line 476 of file JQuaternion3D.hh.

477  {
478  return static_cast<const JQuaternion3D&>(*this);
479  }

◆ getQuaternion() [2/2]

JQuaternion3D& JGEOMETRY3D::JQuaternion3D::getQuaternion ( )
inlineinherited

Get quaternion.

Returns
quaternion

Definition at line 487 of file JQuaternion3D.hh.

488  {
489  return static_cast<JQuaternion3D&>(*this);
490  }

◆ setQuaternion()

void JGEOMETRY3D::JQuaternion3D::setQuaternion ( const JQuaternion3D quaternion)
inlineinherited

Set quaternion.

Parameters
quaternionquaternion

Definition at line 498 of file JQuaternion3D.hh.

499  {
500  static_cast<JQuaternion3D&>(*this) = quaternion;
501  }

◆ operator JVector3D()

JGEOMETRY3D::JQuaternion3D::operator JVector3D ( ) const
inlineinherited

Type conversion operator.

Returns
position

Definition at line 509 of file JQuaternion3D.hh.

510  {
511  return JVector3D(this->getB(), this->getC(), this->getD());
512  }
double getB() const
Get b value.
double getD() const
Get d value.
double getC() const
Get c value.

◆ operator JVersor3D() [2/2]

JGEOMETRY3D::JQuaternion3D::operator JVersor3D ( ) const
inlineinherited

Type conversion operator.

Returns
direction

Definition at line 520 of file JQuaternion3D.hh.

521  {
522  return JVersor3D(this->getB(), this->getC(), this->getD());
523  }

◆ getAngle()

double JGEOMETRY3D::JQuaternion3D::getAngle ( ) const
inlineinherited

Get rotation angle.

Returns
angle [rad]

Definition at line 531 of file JQuaternion3D.hh.

532  {
533  return atan2(sqrt(this->getB()*this->getB() +
534  this->getC()*this->getC() +
535  this->getD()*this->getD()),
536  this->getA()) * 2.0;
537  }
double getA() const
Get a value.

◆ getA()

double JGEOMETRY3D::JQuaternion3D::getA ( ) const
inlineinherited

Get a value.

Returns
a value

Definition at line 545 of file JQuaternion3D.hh.

546  {
547  return __a;
548  }

◆ getB()

double JGEOMETRY3D::JQuaternion3D::getB ( ) const
inlineinherited

Get b value.

Returns
b value

Definition at line 556 of file JQuaternion3D.hh.

557  {
558  return __b;
559  }

◆ getC()

double JGEOMETRY3D::JQuaternion3D::getC ( ) const
inlineinherited

Get c value.

Returns
c value

Definition at line 567 of file JQuaternion3D.hh.

568  {
569  return __c;
570  }

◆ getD()

double JGEOMETRY3D::JQuaternion3D::getD ( ) const
inlineinherited

Get d value.

Returns
d value

Definition at line 578 of file JQuaternion3D.hh.

579  {
580  return __d;
581  }

◆ setIdentity()

JQuaternion3D& JGEOMETRY3D::JQuaternion3D::setIdentity ( )
inlineinherited

Set to identity quaternion.

Returns
this quaternion

Definition at line 589 of file JQuaternion3D.hh.

590  {
591  __a = 1.0;
592  __b = 0.0;
593  __c = 0.0;
594  __d = 0.0;
595 
596  return *this;
597  }

◆ conjugate()

JQuaternion3D& JGEOMETRY3D::JQuaternion3D::conjugate ( )
inlineinherited

Conjugate quaternion.

Returns
this quaternion

Definition at line 605 of file JQuaternion3D.hh.

606  {
607  __b = -__b;
608  __c = -__c;
609  __d = -__d;
610 
611  return *this;
612  }

◆ negate() [2/2]

JQuaternion3D& JGEOMETRY3D::JQuaternion3D::negate ( )
inlineinherited

Negate quaternion.

Returns
this quaternion

Definition at line 620 of file JQuaternion3D.hh.

621  {
622  __a = -__a;
623  __b = -__b;
624  __c = -__c;
625  __d = -__d;
626 
627  return *this;
628  }

◆ add() [3/3]

JQuaternion3D& JGEOMETRY3D::JQuaternion3D::add ( const JQuaternion3D quaternion)
inlineinherited

Add quaternion.

Parameters
quaternionquaternion
Returns
this quaternion

Definition at line 637 of file JQuaternion3D.hh.

638  {
639  __a += quaternion.getA();
640  __b += quaternion.getB();
641  __c += quaternion.getC();
642  __d += quaternion.getD();
643 
644  return *this;
645  }

◆ sub() [3/3]

JQuaternion3D& JGEOMETRY3D::JQuaternion3D::sub ( const JQuaternion3D quaternion)
inlineinherited

Subtract quaternion.

Parameters
quaternionquaternion
Returns
this quaternion

Definition at line 654 of file JQuaternion3D.hh.

655  {
656  __a -= quaternion.getA();
657  __b -= quaternion.getB();
658  __c -= quaternion.getC();
659  __d -= quaternion.getD();
660 
661  return *this;
662  }

◆ mul() [3/9]

JQuaternion3D& JGEOMETRY3D::JQuaternion3D::mul ( const double  factor)
inlineinherited

Scale quaternion.

Parameters
factormultiplication factor
Returns
this quaternion

Definition at line 671 of file JQuaternion3D.hh.

672  {
673  __a *= factor;
674  __b *= factor;
675  __c *= factor;
676  __d *= factor;
677 
678  return *this;
679  }

◆ mul() [4/9]

JQuaternion3D& JGEOMETRY3D::JQuaternion3D::mul ( const JQuaternion3D first,
const JQuaternion3X second 
)
inlineinherited

Quaternion multiplication.

This method evaluates the Hamilton product (also called cross product).

Parameters
firstfirst quaternion
secondsecond quaternion
Returns
this quaternion

Definition at line 708 of file JQuaternion3D.hh.

709  {
710  __a = first.getA() * second.getA() - first.getB() * second.getB();
711  __b = first.getA() * second.getB() + first.getB() * second.getA();
712  __c = first.getC() * second.getA() + first.getD() * second.getB();
713  __d = -first.getC() * second.getB() + first.getD() * second.getA();
714 
715  return *this;
716  }
double getA() const
Get a value.
double getB() const
Get b value.

◆ mul() [5/9]

JQuaternion3D& JGEOMETRY3D::JQuaternion3D::mul ( const JQuaternion3D first,
const JQuaternion3Y second 
)
inlineinherited

Quaternion multiplication.

This method evaluates the Hamilton product (or cross product).

Parameters
firstfirst quaternion
secondsecond quaternion
Returns
this quaternion

Definition at line 728 of file JQuaternion3D.hh.

730  {
731  __a = first.getA() * second.getA() - first.getC() * second.getC();
732  __b = first.getB() * second.getA() - first.getD() * second.getC();
733  __c = first.getA() * second.getC() + first.getC() * second.getA();
734  __d = first.getB() * second.getC() + first.getD() * second.getA();
735 
736  return *this;
737  }
double getC() const
Get c value.

◆ mul() [6/9]

JQuaternion3D& JGEOMETRY3D::JQuaternion3D::mul ( const JQuaternion3D first,
const JQuaternion3Z second 
)
inlineinherited

Quaternion multiplication.

This method evaluates the Hamilton product (or cross product).

Parameters
firstfirst quaternion
secondsecond quaternion
Returns
this quaternion

Definition at line 749 of file JQuaternion3D.hh.

751  {
752  __a = first.getA() * second.getA() - first.getD() * second.getD();
753  __b = first.getB() * second.getA() + first.getC() * second.getD();
754  __c = -first.getB() * second.getD() + first.getC() * second.getA();
755  __d = first.getA() * second.getD() + first.getD() * second.getA();
756 
757  return *this;
758  }
double getD() const
Get d value.

◆ mul() [7/9]

JQuaternion3D& JGEOMETRY3D::JQuaternion3D::mul ( const JQuaternion3D first,
const JQuaternion3D second 
)
inlineinherited

Quaternion multiplication.

This method evaluates the Hamilton product (or cross product).

Parameters
firstfirst quaternion
secondsecond quaternion
Returns
this quaternion

Definition at line 770 of file JQuaternion3D.hh.

772  {
773  __a = first.getA() * second.getA() - first.getB() * second.getB() - first.getC() * second.getC() - first.getD() * second.getD();
774  __b = first.getA() * second.getB() + first.getB() * second.getA() + first.getC() * second.getD() - first.getD() * second.getC();
775  __c = first.getA() * second.getC() - first.getB() * second.getD() + first.getC() * second.getA() + first.getD() * second.getB();
776  __d = first.getA() * second.getD() + first.getB() * second.getC() - first.getC() * second.getB() + first.getD() * second.getA();
777 
778  return *this;
779  }

◆ mul() [8/9]

JQuaternion3D& JGEOMETRY3D::JQuaternion3D::mul ( const JQuaternion3X qx,
const JQuaternion3Y qy,
const JQuaternion3Z qz 
)
inlineinherited

Quaternion multiplication.

Parameters
qxrotation around x-axis
qyrotation around y-axis
qzrotation around x-axis
Returns
this quaternion

Definition at line 790 of file JQuaternion3D.hh.

793  {
794  return *this = JQuaternion3D().setIdentity().mul(qz).mul(qy).mul(qx);
795  }

◆ mul() [9/9]

template<class JFirst_t , class JSecond_t >
JFirst_t& JMATH::JMath< JFirst_t, JSecond_t >::mul ( const JSecond_t &  object)
inlineinherited

Multiply with object.

Parameters
objectobject
Returns
result object

Definition at line 354 of file JMath.hh.

355  {
356  return static_cast<JFirst_t&>(*this) = JFirst_t().mul(static_cast<const JFirst_t&>(*this), object);
357  }

◆ div() [2/2]

JQuaternion3D& JGEOMETRY3D::JQuaternion3D::div ( const double  factor)
inlineinherited

Scale quaternion.

Parameters
factordivision factor
Returns
this quaternion

Definition at line 688 of file JQuaternion3D.hh.

689  {
690  __a /= factor;
691  __b /= factor;
692  __c /= factor;
693  __d /= factor;
694 
695  return *this;
696  }

◆ rotate() [6/6]

void JGEOMETRY3D::JQuaternion3D::rotate ( double &  __x,
double &  __y,
double &  __z 
) const
inlineinherited

Rotate.

Parameters
__xx value
__yy value
__zz value

Definition at line 805 of file JQuaternion3D.hh.

806  {
807  const double qx = 2.0 * (__c*__z - __d*__y);
808  const double qy = 2.0 * (__d*__x - __b*__z);
809  const double qz = 2.0 * (__b*__y - __c*__x);
810 
811  __x = __x + __c*qz - __d*qy + __a*qx;
812  __y = __y - __b*qz + __a*qy + __d*qx;
813  __z = __z + __a*qz + __b*qy - __c*qx;
814  }

◆ rotate_back() [6/6]

void JGEOMETRY3D::JQuaternion3D::rotate_back ( double &  __x,
double &  __y,
double &  __z 
) const
inlineinherited

Rotate back.

Parameters
__xx value
__yy value
__zz value

Definition at line 824 of file JQuaternion3D.hh.

825  {
826  const double qx = 2.0 * (__d*__y - __c*__z);
827  const double qy = 2.0 * (__b*__z - __d*__x);
828  const double qz = 2.0 * (__c*__x - __b*__y);
829 
830  __x = __x - __c*qz + __d*qy + __a*qx;
831  __y = __y + __b*qz + __a*qy - __d*qx;
832  __z = __z + __a*qz - __b*qy + __c*qx;
833  }

◆ equals() [2/3]

bool JGEOMETRY3D::JQuaternion3D::equals ( const JQuaternion3D quaternion,
const double  precision = std::numeric_limits<double>::min() 
) const
inlineinherited

Check equality.

Parameters
quaternionquaternion
precisionnumerical precision
Returns
true if quaternions are equal; else false

Definition at line 843 of file JQuaternion3D.hh.

845  {
846  return (fabs(getA() - quaternion.getA()) <= precision &&
847  fabs(getB() - quaternion.getB()) <= precision &&
848  fabs(getC() - quaternion.getC()) <= precision &&
849  fabs(getD() - quaternion.getD()) <= precision);
850  }

◆ isIdentity()

bool JGEOMETRY3D::JQuaternion3D::isIdentity ( const double  precision = std::numeric_limits<double>::min()) const
inlineinherited

Test identity.

Parameters
precisionprecision
Returns
true if identity quaternion; else false

Definition at line 859 of file JQuaternion3D.hh.

860  {
861  if (fabs(getA()) <= precision) {
862 
863  if (fabs(getB()) <= precision)
864  return ((fabs(getC()) <= precision && fabs(fabs(getD()) - 1.0) <= precision) ||
865  (fabs(fabs(getC()) - 1.0) <= precision && fabs(getD()) <= precision));
866  else
867  return (fabs(fabs(getB()) - 1.0) <= precision &&
868  fabs(getC()) <= precision &&
869  fabs(getD()) <= precision);
870 
871  } else {
872 
873  return (fabs(fabs(getA()) - 1.0) <= precision &&
874  fabs(getB()) <= precision &&
875  fabs(getC()) <= precision &&
876  fabs(getD()) <= precision);
877  }
878  }

◆ getLengthSquared() [2/2]

double JGEOMETRY3D::JQuaternion3D::getLengthSquared ( ) const
inlineinherited

Get length squared.

Returns
square of length

Definition at line 886 of file JQuaternion3D.hh.

887  {
888  return getA()*getA() + getB()*getB() + getC()*getC() + getD()*getD();
889  }

◆ getLength() [2/2]

double JGEOMETRY3D::JQuaternion3D::getLength ( ) const
inlineinherited

Get length.

Returns
length

Definition at line 897 of file JQuaternion3D.hh.

898  {
899  return sqrt(getLengthSquared());
900  }
double getLengthSquared() const
Get length squared.

◆ getDistanceSquared() [2/2]

double JGEOMETRY3D::JQuaternion3D::getDistanceSquared ( const JQuaternion3D quaternion) const
inlineinherited

Get squared of distance to quaternion.

Parameters
quaternionquaternion
Returns
square of distance

Definition at line 909 of file JQuaternion3D.hh.

910  {
911  return JQuaternion3D(quaternion).sub(*this).getLengthSquared();
912  }

◆ getDistance() [2/2]

double JGEOMETRY3D::JQuaternion3D::getDistance ( const JQuaternion3D quaternion) const
inlineinherited

Get distance to quaternion.

Parameters
quaternionquaternion
Returns
distance

Definition at line 921 of file JQuaternion3D.hh.

922  {
923  return sqrt(getDistanceSquared(quaternion));
924  }
double getDistanceSquared(const JQuaternion3D &quaternion) const
Get squared of distance to quaternion.

◆ getDot() [6/6]

double JGEOMETRY3D::JQuaternion3D::getDot ( const JQuaternion3D quaternion) const
inlineinherited

Get dot product.

Parameters
quaternionquaternion
Returns
dot product

Definition at line 933 of file JQuaternion3D.hh.

934  {
935  return
936  getA() * quaternion.getA() -
937  getB() * quaternion.getB() -
938  getC() * quaternion.getC() -
939  getD() * quaternion.getD();
940  }

◆ getConjugate()

JQuaternion3D JGEOMETRY3D::JQuaternion3D::getConjugate ( ) const
inlineinherited

Get conjugate of this quaternion.

Returns
conjugate quaternion

Definition at line 948 of file JQuaternion3D.hh.

949  {
950  return JQuaternion3D(*this).conjugate();
951  }

◆ normalise()

JQuaternion3D& JGEOMETRY3D::JQuaternion3D::normalise ( )
inlineinherited

Normalise quaternion.

Returns
this quaternion

Definition at line 959 of file JQuaternion3D.hh.

960  {
961  const double v = getLength();
962 
963  if (v != 0.0) {
964  mul(1.0 / v);
965  }
966 
967  return *this;
968  }
double getLength() const
Get length.
JQuaternion3D & mul(const double factor)
Scale quaternion.
data_type v[N+1][M+1]
Definition: JPolint.hh:866

◆ pow()

JQuaternion3D& JGEOMETRY3D::JQuaternion3D::pow ( const double  y)
inlineinherited

Raise quaternion to given power.

Parameters
ypower
Returns
this object

Definition at line 977 of file JQuaternion3D.hh.

978  {
979  const double v = sqrt(getB() * getB() +
980  getC() * getC() +
981  getD() * getD());
982 
983  if (v != 0.0) {
984 
985  const JVersor3D u(getB(), getC(), getD());
986 
987  const double theta = atan2(v, getA());
988 
989  *this = JQuaternion3D(2.0 * theta * y, u);
990  }
991 
992  return *this;
993  }
double u[N+1]
Definition: JPolint.hh:865

◆ interpolate()

JQuaternion3D& JGEOMETRY3D::JQuaternion3D::interpolate ( const JQuaternion3D object,
const double  alpha 
)
inlineinherited

Interpolation between quaternions.

The result is equal to *this = (1 - alpha) * (*this) + (alpha) * (object).

Parameters
objectobject
alphainterpolation factor [0, 1]
Returns
this object

Definition at line 1004 of file JQuaternion3D.hh.

1006  {
1007  const double MAXIMAL_DOT_PRODUCT = 0.9995;
1008 
1009  JQuaternion3D v0(*this);
1010  JQuaternion3D v1(object);
1011 
1012  v0.normalise();
1013  v1.normalise();
1014 
1015  double dot = v0.getDot(v1);
1016 
1017  if (dot < 0.0) {
1018  v1 = -v1;
1019  dot = -dot;
1020  }
1021 
1022  double s1 = alpha;
1023  double s0 = 1.0 - alpha;
1024 
1025  if (dot <= MAXIMAL_DOT_PRODUCT) {
1026 
1027  const double theta_0 = acos(dot);
1028  const double theta_1 = theta_0 * alpha;
1029 
1030  s1 = sin(theta_1) / sin(theta_0);
1031  s0 = cos(theta_1) - dot * s1;
1032  }
1033 
1034  *this = (s0 * v0) + (s1 * v1);
1035 
1036  return normalise();
1037  }
JQuaternion3D & normalise()
Normalise quaternion.

◆ getCalibration() [1/2]

const JCalibration& JDETECTOR::JCalibration::getCalibration ( ) const
inlineinherited

Get calibration.

Returns
calibration

Definition at line 67 of file JDetector/JCalibration.hh.

68  {
69  return *this;
70  }

◆ getCalibration() [2/2]

JCalibration& JDETECTOR::JCalibration::getCalibration ( )
inlineinherited

Get calibration.

Returns
calibration

Definition at line 78 of file JDetector/JCalibration.hh.

79  {
80  return *this;
81  }

◆ setCalibration()

void JDETECTOR::JCalibration::setCalibration ( const JCalibration cal)
inlineinherited

Set calibration.

Parameters
calcalibration

Definition at line 89 of file JDetector/JCalibration.hh.

90  {
91  *this = cal;
92  }

◆ getT0()

double JDETECTOR::JCalibration::getT0 ( ) const
inlineinherited

Get time offset.

Returns
time offset [ns]

Definition at line 100 of file JDetector/JCalibration.hh.

101  {
102  return t0;
103  }

◆ setT0()

void JDETECTOR::JCalibration::setT0 ( const double  t0)
inlineinherited

Set time offset.

Parameters
t0time offset [ns]

Definition at line 111 of file JDetector/JCalibration.hh.

112  {
113  this->t0 = t0;
114  }

◆ addT0()

void JDETECTOR::JCalibration::addT0 ( const double  t0)
inlineinherited

Add time offset.

Parameters
t0time offset [ns]

Definition at line 122 of file JDetector/JCalibration.hh.

123  {
124  this->t0 += t0;
125  }

◆ subT0()

void JDETECTOR::JCalibration::subT0 ( const double  t0)
inlineinherited

Subtract time offset.

Parameters
t0time offset [ns]

Definition at line 133 of file JDetector/JCalibration.hh.

134  {
135  this->t0 -= t0;
136  }

◆ getStatus() [1/3]

int JEEP::JStatus::getStatus ( ) const
inlineinherited

Get status.

Returns
status

Definition at line 63 of file JStatus.hh.

64  {
65  return this->status;
66  }

◆ getStatus() [2/3]

JStatus& JEEP::JStatus::getStatus ( )
inlineinherited

Get status.

Returns
status

Definition at line 74 of file JStatus.hh.

75  {
76  return *this;
77  }

◆ getStatus() [3/3]

int JEEP::JStatus::getStatus ( const int  mask) const
inlineinherited

Get status.

Parameters
maskmask
Returns
status

Definition at line 86 of file JStatus.hh.

87  {
88  return (this->status & mask);
89  }

◆ setStatus()

void JEEP::JStatus::setStatus ( const JStatus status)
inlineinherited

Set status.

Parameters
statusstatus

Definition at line 97 of file JStatus.hh.

98  {
99  this->status = status.status;
100  }

◆ equals() [3/3]

bool JEEP::JStatus::equals ( const JStatus status) const
inlineinherited

Equal method.

Parameters
statusstatus
Returns
true if this status equal to given status; else false

Definition at line 109 of file JStatus.hh.

110  {
111  return this->status == status.status;
112  }

◆ has() [2/2]

bool JEEP::JStatus::has ( const int  bit) const
inlineinherited

Test PMT status.

Parameters
bitbit

Definition at line 120 of file JStatus.hh.

121  {
122  return (this->status & (1<<bit)) != 0;
123  }

◆ set() [4/4]

void JEEP::JStatus::set ( const int  bit)
inlineinherited

Set PMT status.

Parameters
bitbit

Definition at line 131 of file JStatus.hh.

132  {
133  this->status |= (1<<bit);
134  }

◆ reset() [2/2]

void JEEP::JStatus::reset ( const int  bit)
inlineinherited

Reset PMT status.

Parameters
bitbit

Definition at line 142 of file JStatus.hh.

143  {
144  this->status &= ~(1<<bit);
145  }

Friends And Related Function Documentation

◆ operator>> [1/2]

std::istream& operator>> ( std::istream &  in,
JModule module 
)
friend

Read module from input.

Parameters
ininput stream
modulemodule
Returns
input stream

Definition at line 528 of file JModule.hh.

529  {
530  module = JModule();
531 
532  in >> static_cast<JModuleIdentifier&>(module);
533  in >> static_cast<JLocation&> (module);
534 
536  in >> static_cast<JPosition3D&> (module);
537  in >> static_cast<JQuaternion3D&>(module);
538  in >> static_cast<JCalibration&> (module);
539  }
540 
542  in >> static_cast<JStatus&> (module);
543  }
544 
545  unsigned int n;
546 
547  in >> n;
548 
549  for (JPMT pmt; n != 0 && in >> pmt; --n) {
550  module.push_back(pmt);
551  }
552 
554  module.compile();
555  }
556 
557  return in;
558  }
Data structure for time calibration.
JModule()
Default constructor.
Definition: JModule.hh:85
void compile()
Compile module data.
Definition: JModule.hh:281
Data structure for PMT geometry, calibration and status.
Definition: JPMT.hh:49
Auxiliary class for object identification.
Definition: JObjectID.hh:25
static const JGetDetectorVersion getDetectorVersion
Function object to map detector version to numerical value.
const int n
Definition: JPolint.hh:786
@ V5
Version with module status field.
@ V4
Version with quaternion and time offset per module.
Auxiliary class for handling status.
Definition: JStatus.hh:39

◆ operator<< [1/2]

std::ostream& operator<< ( std::ostream &  out,
const JModule module 
)
friend

Write module to output.

Parameters
outoutput stream
modulemodule
Returns
output stream

Definition at line 568 of file JModule.hh.

569  {
570  using namespace std;
571 
572  out << setw(10);
573  out << static_cast<const JModuleIdentifier&>(module);
574  out << ' ';
575  out << static_cast<const JLocation&> (module);
576 
578  out << ' ';
579  out << static_cast<const JPosition3D&> (module);
580  out << ' ';
581  out << static_cast<const JQuaternion3D&>(module);
582  out << ' ';
583  out << static_cast<const JCalibration&> (module);
584  }
585 
587  out << ' ';
588  out << static_cast<const JStatus&> (module);
589  }
590 
591  out << ' ' << module.size() << endl;
592 
593  for (const_iterator i = module.begin(); i != module.end(); ++i) {
594  out << ' ' << *i << endl;;
595  }
596 
597  return out;
598  }

◆ operator>> [2/2]

JReader& operator>> ( JReader in,
JModule module 
)
friend

Read module from input.

Parameters
inreader
modulemodule
Returns
rrreader

Definition at line 608 of file JModule.hh.

609  {
610  module = JModule();
611 
612  in >> static_cast<JModuleIdentifier&>(module);
613  in >> static_cast<JLocation&> (module);
614 
616  in >> static_cast<JPosition3D&> (module);
617  in >> static_cast<JQuaternion3D&>(module);
618  in >> static_cast<JCalibration&> (module);
619  }
620 
622  in >> static_cast<JStatus&> (module);
623  }
624 
625  int n;
626 
627  in >> n;
628 
629  module.resize(n);
630 
631  for (JModule::iterator out = module.begin(); n != 0; --n, ++out) {
632  in >> *out;
633  }
634 
636  module.compile();
637  }
638 
639  return in;
640  }

◆ operator<< [2/2]

JWriter& operator<< ( JWriter out,
const JModule module 
)
friend

Write module to output.

Parameters
outwriter
modulemodule
Returns
writer

Definition at line 650 of file JModule.hh.

651  {
652  out << static_cast<const JModuleIdentifier&>(module);
653  out << static_cast<const JLocation&> (module);
654 
656  out << static_cast<const JPosition3D&> (module);
657  out << static_cast<const JQuaternion3D&>(module);
658  out << static_cast<const JCalibration&> (module);
659  }
660 
662  out << static_cast<const JStatus&> (module);
663  }
664 
665  int n = module.size();
666 
667  out << n;
668 
669  for (const_iterator i = module.begin(); i != module.end(); ++i) {
670  out << *i;
671  }
672 
673  return out;
674  }

Member Data Documentation

◆ __id

int JLANG::JObjectID::__id
protectedinherited

Definition at line 140 of file JObjectID.hh.

◆ string

int JDETECTOR::JLocation::string
protectedinherited

Definition at line 235 of file JLocation.hh.

◆ floor

int JDETECTOR::JLocation::floor
protectedinherited

Definition at line 236 of file JLocation.hh.

◆ __x

double JGEOMETRY3D::JVector3D::__x
protectedinherited

Definition at line 310 of file JVector3D.hh.

◆ __y

double JGEOMETRY3D::JVector3D::__y
protectedinherited

Definition at line 311 of file JVector3D.hh.

◆ __z

double JGEOMETRY3D::JVector3D::__z
protectedinherited

Definition at line 312 of file JVector3D.hh.

◆ __a

double JGEOMETRY3D::JQuaternion3D::__a
protectedinherited

Definition at line 1117 of file JQuaternion3D.hh.

◆ __b

double JGEOMETRY3D::JQuaternion3D::__b
protectedinherited

Definition at line 1118 of file JQuaternion3D.hh.

◆ __c

double JGEOMETRY3D::JQuaternion3D::__c
protectedinherited

Definition at line 1119 of file JQuaternion3D.hh.

◆ __d

double JGEOMETRY3D::JQuaternion3D::__d
protectedinherited

Definition at line 1120 of file JQuaternion3D.hh.

◆ t0

double JDETECTOR::JCalibration::t0
protectedinherited

Definition at line 202 of file JDetector/JCalibration.hh.

◆ status

int JEEP::JStatus::status
protectedinherited

Definition at line 200 of file JStatus.hh.


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