Jpp
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::JModuleLocation JGEOMETRY3D::JPosition3D std::vector< JPMT > JLANG::JComparable< JObjectID > JLANG::JComparable< JObjectID, int > JLANG::JComparable< JFirst_t, JSecond_t > JGEOMETRY3D::JVector3D JMATH::JMath< JVector3D > JCALIBRATE::JFitK40 JMONITOR::JClusterBuilder

Public Member Functions

 JModule ()
 Default constructor. More...
 
 JModule (const int id, const JModuleLocation &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...
 
void compile ()
 Compile position of module from the positions of the PMTs. 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...
 
int getID () const
 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 JModuleLocationgetLocation () const
 Get location. More...
 
JModuleLocationgetLocation ()
 Get location. More...
 
void setLocation (const JModuleLocation &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 JModuleLocation &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...
 
JVector3Dmul (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...
 
JVector3Dcross (const JVector3D &first, const JVector3D &second)
 Get cross product. More...
 

Static Public Member Functions

static const JModulegetInstance ()
 Get reference to unique instance of this class object. More...
 
static bool compare (const JModule &first, const JModule &second, const double precision=1.0e-3)
 Compare modules. More...
 

Protected Attributes

int __id
 
int string
 
int floor
 
double __x
 
double __y
 
double __z
 

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 JPMT objects. The index of the PMT object in the module container corresponds to the readout channel (TDC). The positions of the PMTs are absolute in space (i.e. not relative to the position of the module). The position of the module is not subject to I/O but derived from the positions of the PMTs using method compile().

Definition at line 49 of file JModule.hh.

Constructor & Destructor Documentation

◆ JModule() [1/2]

JDETECTOR::JModule::JModule ( )
inline

Default constructor.

Definition at line 59 of file JModule.hh.

59  :
62  JPosition3D(),
64  {}

◆ JModule() [2/2]

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

Constructor.

Parameters
ididentifier
locationlocation

Definition at line 73 of file JModule.hh.

74  :
76  JModuleLocation(location),
77  JPosition3D(),
79  {}

Member Function Documentation

◆ getInstance()

static const JModule& JDETECTOR::JModule::getInstance ( )
inlinestatic

Get reference to unique instance of this class object.

This method returns a module with the standard configuration of PMTs.

Returns
reference to this class object

Definition at line 89 of file JModule.hh.

90  {
91  static JModule module;
92 
93  if (module.empty()) {
94 
95  module.push_back(JPMT( 1, JAxis3D(JVector3D(+0.000, +0.000, -0.200), JVersor3D(+0.000, +0.000, -1.000))));
96 
97  module.push_back(JPMT( 2, JAxis3D(JVector3D(+0.000, +0.105, -0.170), JVersor3D(+0.000, +0.527, -0.850))));
98  module.push_back(JPMT( 3, JAxis3D(JVector3D(+0.091, +0.053, -0.170), JVersor3D(+0.456, +0.263, -0.850))));
99  module.push_back(JPMT( 4, JAxis3D(JVector3D(+0.091, -0.053, -0.170), JVersor3D(+0.456, -0.263, -0.850))));
100  module.push_back(JPMT( 5, JAxis3D(JVector3D(+0.000, -0.105, -0.170), JVersor3D(+0.000, -0.527, -0.850))));
101  module.push_back(JPMT( 6, JAxis3D(JVector3D(-0.091, -0.053, -0.170), JVersor3D(-0.456, -0.263, -0.850))));
102  module.push_back(JPMT( 7, JAxis3D(JVector3D(-0.091, +0.053, -0.170), JVersor3D(-0.456, +0.263, -0.850))));
103 
104  module.push_back(JPMT( 8, JAxis3D(JVector3D(+0.083, +0.144, -0.111), JVersor3D(+0.416, +0.720, -0.555))));
105  module.push_back(JPMT( 9, JAxis3D(JVector3D(+0.166, +0.000, -0.111), JVersor3D(+0.832, +0.000, -0.555))));
106  module.push_back(JPMT(10, JAxis3D(JVector3D(+0.083, -0.144, -0.111), JVersor3D(+0.416, -0.720, -0.555))));
107  module.push_back(JPMT(11, JAxis3D(JVector3D(-0.083, -0.144, -0.111), JVersor3D(-0.416, -0.720, -0.555))));
108  module.push_back(JPMT(12, JAxis3D(JVector3D(-0.166, +0.000, -0.111), JVersor3D(-0.832, +0.000, -0.555))));
109  module.push_back(JPMT(13, JAxis3D(JVector3D(-0.083, +0.144, -0.111), JVersor3D(-0.416, +0.720, -0.555))));
110 
111  module.push_back(JPMT(14, JAxis3D(JVector3D(+0.000, +0.191, -0.059), JVersor3D(+0.000, +0.955, -0.295))));
112  module.push_back(JPMT(15, JAxis3D(JVector3D(+0.165, +0.096, -0.059), JVersor3D(+0.827, +0.478, -0.295))));
113  module.push_back(JPMT(16, JAxis3D(JVector3D(+0.165, -0.096, -0.059), JVersor3D(+0.827, -0.478, -0.295))));
114  module.push_back(JPMT(17, JAxis3D(JVector3D(+0.000, -0.191, -0.059), JVersor3D(+0.000, -0.955, -0.295))));
115  module.push_back(JPMT(18, JAxis3D(JVector3D(-0.165, -0.096, -0.059), JVersor3D(-0.827, -0.478, -0.295))));
116  module.push_back(JPMT(19, JAxis3D(JVector3D(-0.165, +0.096, -0.059), JVersor3D(-0.827, +0.478, -0.295))));
117 
118  module.push_back(JPMT(20, JAxis3D(JVector3D(+0.096, +0.165, +0.059), JVersor3D(+0.478, +0.827, +0.295))));
119  module.push_back(JPMT(21, JAxis3D(JVector3D(+0.191, +0.000, +0.059), JVersor3D(+0.955, +0.000, +0.295))));
120  module.push_back(JPMT(22, JAxis3D(JVector3D(+0.096, -0.165, +0.059), JVersor3D(+0.478, -0.827, +0.295))));
121  module.push_back(JPMT(23, JAxis3D(JVector3D(-0.096, -0.165, +0.059), JVersor3D(-0.478, -0.827, +0.295))));
122  module.push_back(JPMT(24, JAxis3D(JVector3D(-0.191, +0.000, +0.059), JVersor3D(-0.955, +0.000, +0.295))));
123  module.push_back(JPMT(25, JAxis3D(JVector3D(-0.096, +0.165, +0.059), JVersor3D(-0.478, +0.827, +0.295))));
124 
125  module.push_back(JPMT(26, JAxis3D(JVector3D(+0.000, +0.166, +0.111), JVersor3D(+0.000, +0.832, +0.555))));
126  module.push_back(JPMT(27, JAxis3D(JVector3D(+0.144, +0.083, +0.111), JVersor3D(+0.720, +0.416, +0.555))));
127  module.push_back(JPMT(28, JAxis3D(JVector3D(+0.144, -0.083, +0.111), JVersor3D(+0.720, -0.416, +0.555))));
128  module.push_back(JPMT(29, JAxis3D(JVector3D(+0.000, -0.166, +0.111), JVersor3D(+0.000, -0.832, +0.555))));
129  module.push_back(JPMT(30, JAxis3D(JVector3D(-0.144, -0.083, +0.111), JVersor3D(-0.720, -0.416, +0.555))));
130  module.push_back(JPMT(31, JAxis3D(JVector3D(-0.144, +0.083, +0.111), JVersor3D(-0.720, +0.416, +0.555))));
131  }
132 
133  return module;
134  }

◆ 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 147 of file JModule.hh.

150  {
151  if (first.size() == second.size()) {
152 
153  for (size_t i = 0; i != first.size(); ++i) {
154  if (first[i].getDirection().getDot(second[i].getDirection()) < 1.0 - precision) {
155  return false;
156  }
157  }
158 
159  return true;
160  }
161 
162  return false;
163  }

◆ 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 173 of file JModule.hh.

174  {
175  return at(index);
176  }

◆ 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 185 of file JModule.hh.

186  {
187  return at(index);
188  }

◆ setPMT()

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

Set PMT.

Parameters
indexreadout channel (TDC)
pmtPMT

Definition at line 197 of file JModule.hh.

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

◆ compile()

void JDETECTOR::JModule::compile ( )
inline

Compile position of module from the positions of the PMTs.

Definition at line 210 of file JModule.hh.

211  {
212  if (!empty()) {
213 
214  JPosition3D pos;
215 
216  for (iterator i = begin(); i != end(); ++i) {
217  pos.add(i->getPosition());
218  }
219 
220  static_cast<JPosition3D&>(*this) = pos.div(size());
221  }
222  }

◆ rotate() [1/5]

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

Rotate module.

Parameters
Rrotation matrix

Definition at line 230 of file JModule.hh.

231  {
232  static_cast<JPosition3D&>(*this).rotate(R);
233 
234  for (iterator i = this->begin(); i != this->end(); ++i) {
235  i->rotate(R);
236  }
237  }

◆ rotate_back() [1/5]

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

Rotate back module.

Parameters
Rrotation matrix

Definition at line 245 of file JModule.hh.

246  {
247  static_cast<JPosition3D&>(*this).rotate_back(R);
248 
249  for (iterator i = this->begin(); i != this->end(); ++i) {
250  i->rotate_back(R);
251  }
252  }

◆ 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 261 of file JModule.hh.

263  {
264  static_cast<JPosition3D&>(*this).transform(R, pos);
265 
266  for (iterator i = this->begin(); i != this->end(); ++i) {
267  i->transform(R, pos);
268  }
269  }

◆ transform() [2/4]

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

Transformation of geometry.

Parameters
Ttransformation

Definition at line 277 of file JModule.hh.

278  {
279  static_cast<JPosition3D&>(*this).transform(T.getRotation(), T.getPosition());
280 
281  for (iterator i = this->begin(); i != this->end(); ++i) {
282  i->transform(T);
283  }
284  }

◆ rotate() [2/5]

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

Rotate module.

Parameters
Qquaternion

Definition at line 292 of file JModule.hh.

293  {
294  static_cast<JPosition3D&>(*this).rotate(Q);
295 
296  for (iterator i = this->begin(); i != this->end(); ++i) {
297  i->rotate(Q);
298  }
299  }

◆ rotate_back() [2/5]

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

Rotate back module.

Parameters
Qquaternion

Definition at line 307 of file JModule.hh.

308  {
309  static_cast<JPosition3D&>(*this).rotate_back(Q);
310 
311  for (iterator i = this->begin(); i != this->end(); ++i) {
312  i->rotate_back(Q);
313  }
314  }

◆ set() [1/2]

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

Set position.

Parameters
posposition
Returns
this module

Definition at line 323 of file JModule.hh.

324  {
325  return add(pos - static_cast<JPosition3D&>(*this));
326  }

◆ add() [1/2]

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

Add position.

Parameters
posposition
Returns
this module

Definition at line 335 of file JModule.hh.

336  {
337  for (iterator i = begin(); i != end(); ++i) {
338  i->add(pos);
339  }
340 
341  JVector3D::add(pos);
342 
343  return *this;
344  }

◆ sub() [1/2]

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

Subtract position.

Parameters
posposition
Returns
this module

Definition at line 353 of file JModule.hh.

354  {
355  for (iterator i = begin(); i != end(); ++i) {
356  i->sub(pos);
357  }
358 
359  JVector3D::sub(pos);
360 
361  return *this;
362  }

◆ set() [2/2]

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

Set time offset.

Parameters
t0time offset [ns]
Returns
this module

Definition at line 371 of file JModule.hh.

372  {
373  for (iterator i = begin(); i != end(); ++i) {
374  i->setT0(t0);
375  }
376 
377  return *this;
378  }

◆ add() [2/2]

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

Add time offset.

Parameters
t0time offset [ns]
Returns
this module

Definition at line 387 of file JModule.hh.

388  {
389  for (iterator i = begin(); i != end(); ++i) {
390  i->addT0(t0);
391  }
392 
393  return *this;
394  }

◆ sub() [2/2]

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

Subtract time offset.

Parameters
t0time offset [ns]
Returns
this module

Definition at line 403 of file JModule.hh.

404  {
405  for (iterator i = begin(); i != end(); ++i) {
406  i->subT0(t0);
407  }
408 
409  return *this;
410  }

◆ operator+=()

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

Add position.

Parameters
posposition
Returns
this module

Definition at line 419 of file JModule.hh.

420  {
421  return this->add(pos);
422  }

◆ operator-=()

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

Subtract position.

Parameters
posposition
Returns
this module

Definition at line 431 of file JModule.hh.

432  {
433  return this->sub(pos);
434  }

◆ getID()

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

Get identifier.

Returns
identifier

Definition at line 55 of file JObjectID.hh.

56  {
57  return __id;
58  }

◆ setID()

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

Set identifier.

Parameters
ididentifier

Definition at line 66 of file JObjectID.hh.

67  {
68  this->__id = id;
69  }

◆ 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 78 of file JObjectID.hh.

79  {
80  return this->getID() < object.getID();
81  }

◆ 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 90 of file JObjectID.hh.

91  {
92  return this->getID() < id;
93  }

◆ 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 102 of file JObjectID.hh.

103  {
104  return this->getID() > id;
105  }

◆ getLocation() [1/2]

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

Get location.

Returns
location

Definition at line 68 of file JModuleLocation.hh.

69  {
70  return static_cast<const JModuleLocation&>(*this);
71  }

◆ getLocation() [2/2]

JModuleLocation& JDETECTOR::JModuleLocation::getLocation ( )
inlineinherited

Get location.

Returns
location

Definition at line 79 of file JModuleLocation.hh.

80  {
81  return static_cast<JModuleLocation&>(*this);
82  }

◆ setLocation()

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

Set location.

Parameters
locationlocation

Definition at line 90 of file JModuleLocation.hh.

91  {
92  static_cast<JModuleLocation&>(*this) = location;
93  }

◆ toString() [1/2]

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

Convert module location to string.

Returns
string

Definition at line 101 of file JModuleLocation.hh.

102  {
103  return toString("% %");
104  }

◆ toString() [2/2]

std::string JDETECTOR::JModuleLocation::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 117 of file JModuleLocation.hh.

118  {
119  JLANG::JString buffer(fmt);
120 
121  buffer.replace(target, string, 1);
122  buffer.replace(target, floor, 1);
123 
124  return buffer;
125  }

◆ getString()

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

Get string number.

Returns
string number

Definition at line 133 of file JModuleLocation.hh.

134  {
135  return string;
136  }

◆ getFloor()

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

Get floor number.

Returns
floor number

Definition at line 144 of file JModuleLocation.hh.

145  {
146  return floor;
147  }

◆ less() [3/3]

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

Less than method.

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

Definition at line 156 of file JModuleLocation.hh.

157  {
158  if (this->getString() == location.getString())
159  return this->getFloor() < location.getFloor();
160  else
161  return this->getString() < location.getString();
162  }

◆ getPosition() [1/2]

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

Get position.

Returns
position

Definition at line 129 of file JPosition3D.hh.

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

◆ getPosition() [2/2]

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

Get position.

Returns
position

Definition at line 140 of file JPosition3D.hh.

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

◆ setPosition()

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

Set position.

Parameters
posposition

Definition at line 151 of file JPosition3D.hh.

152  {
153  static_cast<JVector3D&>(*this) = pos;
154  }

◆ operator JAngle3D()

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

Type conversion operator.

Returns
angle

Definition at line 162 of file JPosition3D.hh.

163  {
164  return JAngle3D(getX(), getY(), getZ());
165  }

◆ operator JVersor3D()

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

Type conversion operator.

Returns
direction

Definition at line 173 of file JPosition3D.hh.

174  {
175  return JVersor3D(getX(), getY(), getZ());
176  }

◆ rotate() [3/5]

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

Rotate around X-axis.

Parameters
Rrotation matrix
Returns
this position

Definition at line 213 of file JPosition3D.hh.

214  {
215  R.rotate(__y, __z);
216 
217  return *this;
218  }

◆ rotate() [4/5]

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

Rotate around Y-axis.

Parameters
Rrotation matrix
Returns
this position

Definition at line 241 of file JPosition3D.hh.

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

◆ rotate() [5/5]

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

Rotate around Z-axis.

Parameters
Rrotation matrix
Returns
this position

Definition at line 269 of file JPosition3D.hh.

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

◆ rotate_back() [3/5]

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

Rotate back around X-axis.

Parameters
Rrotation matrix
Returns
this position

Definition at line 227 of file JPosition3D.hh.

228  {
229  R.rotate_back(__y, __z);
230 
231  return *this;
232  }

◆ rotate_back() [4/5]

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

Rotate back around Y-axis.

Parameters
Rrotation matrix
Returns
this position

Definition at line 255 of file JPosition3D.hh.

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

◆ rotate_back() [5/5]

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

Rotate back around Z-axis.

Parameters
Rrotation matrix
Returns
this position

Definition at line 283 of file JPosition3D.hh.

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

◆ transform() [3/4]

JVector3D& JGEOMETRY3D::JVector3D::transform
inlineinherited

Transform.

Parameters
Tmatrix
Returns
this vector

Definition at line 205 of file JVector3D.hh.

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

◆ transform() [4/4]

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

Transform.

Parameters
Tmatrix
Returns
this vector

Definition at line 205 of file JVector3D.hh.

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

◆ 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 358 of file JPosition3D.hh.

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

◆ getDot() [1/5]

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

Get dot product.

Parameters
angleangle
Returns
dot product

Definition at line 377 of file JPosition3D.hh.

378  {
379  return
380  getX() * angle.getDX() +
381  getY() * angle.getDY() +
382  getZ() * angle.getDZ();
383  }

◆ getDot() [2/5]

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

Get dot product.

Parameters
dirdirection
Returns
dot product

Definition at line 392 of file JPosition3D.hh.

393  {
394  return
395  getX() * dir.getDX() +
396  getY() * dir.getDY() +
397  getZ() * dir.getDZ();
398  }

◆ getDot() [3/5]

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

Get dot product.

Parameters
dirdirection
Returns
dot product

Definition at line 407 of file JPosition3D.hh.

408  {
409  return
410  getX() * dir.getDX() +
411  getY() * dir.getDY() +
412  getZ() * dir.getDZ();
413  }

◆ getDot() [4/5]

double JGEOMETRY3D::JVector3D::getDot
inlineinherited

Get dot product.

Parameters
vectorvector
Returns
dot product

Definition at line 281 of file JVector3D.hh.

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

◆ getDot() [5/5]

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

Get dot product.

Parameters
vectorvector
Returns
dot product

Definition at line 281 of file JVector3D.hh.

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

◆ operator JVector2D()

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

Type conversion operator.

Returns
JVector2D

Definition at line 82 of file JVector3D.hh.

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

◆ getX()

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

Get x position.

Returns
x position

Definition at line 93 of file JVector3D.hh.

94  {
95  return __x;
96  }

◆ getY()

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

Get y position.

Returns
y position

Definition at line 103 of file JVector3D.hh.

104  {
105  return __y;
106  }

◆ getZ()

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

Get z position.

Returns
z position

Definition at line 114 of file JVector3D.hh.

115  {
116  return __z;
117  }

◆ negate()

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

Negate vector.

Returns
this vector

Definition at line 125 of file JVector3D.hh.

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

◆ mul() [1/2]

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

Scale vector.

Parameters
factormultiplication factor
Returns
this vector

Definition at line 173 of file JVector3D.hh.

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

◆ mul() [2/2]

JVector3D & JMATH::JMath< JVector3D , JSecond_t >::mul ( const JSecond_t &  object)
inlineinherited

Multiply with object.

Parameters
objectobject
Returns
result object

Definition at line 273 of file JMath.hh.

274  {
275  return static_cast<JFirst_t&>(*this) = JCalculator<JFirst_t>::calculator.mul(static_cast<const JFirst_t&>(*this), object);
276  }

◆ div()

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

Scale vector.

Parameters
factordivision factor
Returns
this vector

Definition at line 189 of file JVector3D.hh.

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

◆ equals()

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 220 of file JVector3D.hh.

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

◆ getLengthSquared()

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

Get length squared.

Returns
square of length

Definition at line 234 of file JVector3D.hh.

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

◆ getLength()

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

Get length.

Returns
length

Definition at line 245 of file JVector3D.hh.

246  {
247  return sqrt(getLengthSquared());
248  }

◆ getDistanceSquared()

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

Get squared of distance to point.

Parameters
posposition
Returns
square of distance

Definition at line 257 of file JVector3D.hh.

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

◆ getDistance()

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

Get distance to point.

Parameters
posposition
Returns
distance

Definition at line 269 of file JVector3D.hh.

270  {
271  return sqrt(getDistanceSquared(pos));
272  }

◆ cross()

JVector3D& JGEOMETRY3D::JVector3D::cross ( 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 298 of file JVector3D.hh.

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

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 444 of file JModule.hh.

445  {
446  module.clear();
447 
448  in >> static_cast<JModuleIdentifier&>(module);
449  in >> static_cast<JModuleLocation&> (module);
450 
451  unsigned int n;
452 
453  in >> n;
454 
455  for (JPMT pmt; n != 0 && in >> pmt; --n) {
456  module.push_back(pmt);
457  }
458 
459  module.compile();
460 
461  return in;
462  }

◆ 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 472 of file JModule.hh.

473  {
474  using namespace std;
475 
476  out << static_cast<const JModuleIdentifier&>(module);
477  out << ' ';
478  out << static_cast<const JModuleLocation&> (module);
479 
480  out << ' ' << module.size() << endl;
481 
482  for (const_iterator i = module.begin(); i != module.end(); ++i) {
483  out << ' ' << *i << endl;;
484  }
485 
486  return out;
487  }

◆ operator>> [2/2]

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

Read module from input.

Parameters
inreader
modulemodule
Returns
rrreader

Definition at line 497 of file JModule.hh.

498  {
499  module.clear();
500 
501  in >> static_cast<JModuleIdentifier&>(module);
502  in >> static_cast<JModuleLocation&> (module);
503 
504  int n;
505 
506  in >> n;
507 
508  for (JPMT pmt; n != 0; --n) {
509 
510  in >> pmt;
511 
512  module.push_back(pmt);
513  }
514 
515  module.compile();
516 
517  return in;
518  }

◆ operator<< [2/2]

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

Write module to output.

Parameters
outwriter
modulemodule
Returns
writer

Definition at line 528 of file JModule.hh.

529  {
530  out << static_cast<const JModuleIdentifier&>(module);
531  out << static_cast<const JModuleLocation&> (module);
532 
533  int n = module.size();
534 
535  out << n;
536 
537  for (const_iterator i = module.begin(); i != module.end(); ++i) {
538  out << *i;
539  }
540 
541  return out;
542  }

Member Data Documentation

◆ __id

int JLANG::JObjectID::__id
protectedinherited

Definition at line 160 of file JObjectID.hh.

◆ string

int JDETECTOR::JModuleLocation::string
protectedinherited

Definition at line 233 of file JModuleLocation.hh.

◆ floor

int JDETECTOR::JModuleLocation::floor
protectedinherited

Definition at line 234 of file JModuleLocation.hh.

◆ __x

double JGEOMETRY3D::JVector3D::__x
protectedinherited

Definition at line 309 of file JVector3D.hh.

◆ __y

double JGEOMETRY3D::JVector3D::__y
protectedinherited

Definition at line 310 of file JVector3D.hh.

◆ __z

double JGEOMETRY3D::JVector3D::__z
protectedinherited

Definition at line 311 of file JVector3D.hh.


The documentation for this class was generated from the following file:
JGEOMETRY3D::JVersor3D::getDZ
double getDZ() const
Get z direction.
Definition: JVersor3D.hh:114
JGEOMETRY2D::JRotation2D::rotate_back
void rotate_back(double &__x, double &__y) const
Rotate back.
Definition: JRotation2D.hh:112
std::iterator
Definition: JSTDTypes.hh:18
JDETECTOR::JModule::sub
JModule & sub(const JVector3D &pos)
Subtract position.
Definition: JModule.hh:353
JGEOMETRY3D::JVector3D::JVector3D
JVector3D()
Default constructor.
Definition: JVector3D.hh:40
JGEOMETRY3D::JVector3D::__y
double __y
Definition: JVector3D.hh:310
JGEOMETRY3D::JVector3D::getLengthSquared
double getLengthSquared() const
Get length squared.
Definition: JVector3D.hh:234
JDETECTOR::JModuleLocation::floor
int floor
Definition: JModuleLocation.hh:234
JGEOMETRY3D::JVector3D::getZ
double getZ() const
Get z position.
Definition: JVector3D.hh:114
JDETECTOR::JModuleIdentifier
JLANG::JObjectID JModuleIdentifier
Definition: JModuleIdentifier.hh:16
JTOOLS::n
const int n
Definition: JPolint.hh:628
JGEOMETRY3D::JDirection3D::getDot
double getDot(const JAngle3D &angle) const
Get dot product.
Definition: JDirection3D.hh:333
std::vector< JPMT >
JGEOMETRY3D::JPosition3D::JPosition3D
JPosition3D()
Default constructor.
Definition: JPosition3D.hh:47
JGEOMETRY3D::JVersor3D
Data structure for normalised vector in three dimensions.
Definition: JVersor3D.hh:23
JGEOMETRY2D::JRotation2D::rotate
void rotate(double &__x, double &__y) const
Rotate.
Definition: JRotation2D.hh:96
JDETECTOR::JModuleLocation::string
int string
Definition: JModuleLocation.hh:233
JLANG::JString
Wrapper class around STL string class.
Definition: JString.hh:28
JLANG::JObjectID::getID
int getID() const
Get identifier.
Definition: JObjectID.hh:55
JGEOMETRY3D::JPosition3D::rotate_back
JPosition3D & rotate_back(const JRotation3D &R)
Rotate back.
Definition: JPosition3D.hh:199
JGEOMETRY3D::JAngle3D::getDX
double getDX() const
Get x direction.
Definition: JAngle3D.hh:106
JGEOMETRY3D::JVersor3D::getDX
double getDX() const
Get x direction.
Definition: JVersor3D.hh:92
JDETECTOR::JModule
Data structure for a composite optical module.
Definition: JModule.hh:49
JGEOMETRY3D::JVersor3D::getDY
double getDY() const
Get y direction.
Definition: JVersor3D.hh:103
JDETECTOR::JPMT
Data structure for PMT geometry and calibration.
Definition: JPMT.hh:53
JDETECTOR::JModuleLocation::toString
std::string toString() const
Convert module location to string.
Definition: JModuleLocation.hh:101
JAANET::getDirection
JDirection3D getDirection(const Vec &v)
Get direction.
Definition: JAAnetToolkit.hh:221
JGEOMETRY3D::JAngle3D
Data structure for angles in three dimensions.
Definition: JAngle3D.hh:31
JGEOMETRY3D::JAngle3D::getDZ
double getDZ() const
Get z direction.
Definition: JAngle3D.hh:128
JLANG::JObjectID::__id
int __id
Definition: JObjectID.hh:160
JGEOMETRY3D::JVector3D::getDistanceSquared
double getDistanceSquared(const JVector3D &pos) const
Get squared of distance to point.
Definition: JVector3D.hh:257
JDETECTOR::JModuleLocation::JModuleLocation
JModuleLocation()
Default constructor.
Definition: JModuleLocation.hh:43
std
Definition: jaanetDictionary.h:36
JGEOMETRY3D::JVector3D::getY
double getY() const
Get y position.
Definition: JVector3D.hh:103
JGEOMETRY3D::JAngle3D::getDY
double getDY() const
Get y direction.
Definition: JAngle3D.hh:117
JDETECTOR::JModule::add
JModule & add(const JVector3D &pos)
Add position.
Definition: JModule.hh:335
JGEOMETRY3D::JVersor3Z::getDY
double getDY() const
Get y direction.
Definition: JVersor3Z.hh:156
JGEOMETRY3D::JVector3D::__z
double __z
Definition: JVector3D.hh:311
JMATH::JCalculator
Auxiliary class for arithmetic operations on objects.
Definition: JCalculator.hh:18
JGEOMETRY3D::JVector3D::__x
double __x
Definition: JVector3D.hh:309
JGEOMETRY3D::JVector3D::add
JVector3D & add(const JVector3D &vector)
Add vector.
Definition: JVector3D.hh:141
JGEOMETRY3D::JVector3D::getX
double getX() const
Get x position.
Definition: JVector3D.hh:93
JDETECTOR::JModuleLocation::getFloor
int getFloor() const
Get floor number.
Definition: JModuleLocation.hh:144
JGEOMETRY3D::JVersor3Z::getDZ
double getDZ() const
Get z direction.
Definition: JVersor3Z.hh:167
JDETECTOR::JModule::compile
void compile()
Compile position of module from the positions of the PMTs.
Definition: JModule.hh:210
JGEOMETRY3D::JVector3D::sub
JVector3D & sub(const JVector3D &vector)
Subtract vector.
Definition: JVector3D.hh:157
JDETECTOR::JModuleLocation::getString
int getString() const
Get string number.
Definition: JModuleLocation.hh:133
JGEOMETRY3D::JVersor3Z::getDX
double getDX() const
Get x direction.
Definition: JVersor3Z.hh:145