1 #ifndef __JDETECTOR__JMODULE__
2 #define __JDETECTOR__JMODULE__
33 namespace JDETECTOR {}
34 namespace JPP {
using namespace JDETECTOR; }
149 const double precision = 1.0e-3)
151 if (first.size() == second.size()) {
153 for (
size_t i = 0; i != first.size(); ++i) {
199 if (index >= (
int) size()) {
203 (*this)[index] = pmt;
219 if (this->size() > 1
u) {
227 for (const_iterator pmt = this->begin(); pmt != this->end(); ++pmt) {
229 const double xx = 1.0 - pmt->getDX() * pmt->getDX();
230 const double yy = 1.0 - pmt->getDY() * pmt->getDY();
231 const double zz = 1.0 - pmt->getDZ() * pmt->getDZ();
233 const double xy = -pmt->getDX() * pmt->getDY();
234 const double xz = -pmt->getDX() * pmt->getDZ();
235 const double yz = -pmt->getDY() * pmt->getDZ();
246 x += xx * pmt->getX() + xy * pmt->getY() + xz * pmt->getZ();
247 y += xy * pmt->getX() + yy * pmt->getY() + yz * pmt->getZ();
248 z += xz * pmt->getX() + yz * pmt->getY() + zz * pmt->getZ();
257 return JVector3D(V.a00 * x + V.a01 * y + V.a02 * z,
258 V.a10 * x + V.a11 * y + V.a12 * z,
259 V.a20 * x + V.a21 * y + V.a22 * z);
286 if (!this->empty()) {
293 catch(
const exception&) {
297 for (
iterator i = this->begin(); i != this->end(); ++i) {
298 pos.
add(i->getPosition());
323 for (
iterator i = this->begin(); i != this->end(); ++i) {
338 for (
iterator i = this->begin(); i != this->end(); ++i) {
355 for (
iterator i = this->begin(); i != this->end(); ++i) {
356 i->transform(R, pos);
370 for (
iterator i = this->begin(); i != this->end(); ++i) {
385 for (
iterator i = this->begin(); i != this->end(); ++i) {
400 for (
iterator i = this->begin(); i != this->end(); ++i) {
426 for (
iterator i = begin(); i != end(); ++i) {
444 for (
iterator i = begin(); i != end(); ++i) {
462 for (
iterator i = begin(); i != end(); ++i) {
478 for (
iterator i = begin(); i != end(); ++i) {
494 for (
iterator i = begin(); i != end(); ++i) {
510 return this->
add(pos);
522 return this->
sub(pos);
547 in >>
static_cast<JStatus&
> (module);
554 for (
JPMT pmt; n != 0 && in >> pmt; --
n) {
555 module.push_back(pmt);
578 out << static_cast<const JModuleIdentifier&>(module);
580 out << static_cast<const JLocation&> (module);
584 out << static_cast<const JPosition3D&> (module);
586 out << static_cast<const JQuaternion3D&>(module);
588 out << static_cast<const JCalibration&> (module);
593 out << static_cast<const JStatus&> (module);
596 out <<
' ' << module.size() << endl;
598 for (const_iterator i = module.begin(); i != module.end(); ++i) {
599 out <<
' ' << *i << endl;;
627 in >>
static_cast<JStatus&
> (module);
634 for (
JPMT pmt; n != 0; --
n) {
638 module.push_back(pmt);
658 out << static_cast<const JModuleIdentifier&>(module);
659 out << static_cast<const JLocation&> (module);
662 out << static_cast<const JPosition3D&> (module);
663 out << static_cast<const JQuaternion3D&>(module);
664 out << static_cast<const JCalibration&> (module);
668 out << static_cast<const JStatus&> (module);
671 int n = module.size();
675 for (const_iterator i = module.begin(); i != module.end(); ++i) {
friend JReader & operator>>(JReader &in, JModule &module)
Read module from input.
Interface for binary output.
Q(UTCMax_s-UTCMin_s)-livetime_s
static void setVersion(const JVersion &version)
Set detector version.
int getFloor() const
Get floor number.
Data structure for a composite optical module.
static const double HYDROPHONE_DELAYTIME_US
Hydrophone delay time [us].
JPosition3D & rotate_back(const JRotation3D &R)
Rotate back.
JModule & operator-=(const JVector3D &pos)
Subtract position.
JModule & add(const double t0)
Add time offset.
std::iterator_traits< T >::value_type getAverage(T __begin, T __end)
Get average.
void subT0(const double t0)
Subtract time offset.
void reset(const int bit)
Reset PMT status.
Data structure for time calibration.
double getDot(const JAngle3D &angle) const
Get dot product.
void transform(const JRotation3D &R, const JVector3D &pos)
Transform position.
friend JWriter & operator<<(JWriter &out, const JModule &module)
Write module to output.
void rotate(const JQuaternion3D &Q)
Rotate module.
JModule()
Default constructor.
then echo The file $DIR KM3NeT_00000001_00000000 root already please rename or remove it first
JModule & sub(const JVector3D &pos)
Subtract position.
JVector3D & sub(const JVector3D &vector)
Subtract vector.
void transform(const JTransformation3D &T)
Transformation of geometry.
JDirection3D getDirection(const Vec &dir)
Get direction.
static const double PIEZO_DELAYTIME_US
Piezo delay time [us].
Data structure for vector in three dimensions.
Version with quaternion and time offset per module.
JModule & sub(const double t0)
Subtract time offset.
Logical location of module.
bool has(const int bit) const
Test PMT status.
void set(const int bit)
Set PMT status.
const array_type< JValue_t > & make_array(const JValue_t(&array)[N])
Method to create array of values.
do set_variable OUTPUT_DIRECTORY $WORKDIR T
Auxiliary class for handling status.
Data structure for PMT geometry, calibration and status.
void compile()
Compile module data.
Data structure for detector version.
void rotate_back(const JQuaternion3D &Q)
Rotate back module.
JModule(const int id, const JLocation &location)
Constructor.
void setPMT(const int index, const JPMT &pmt)
Set PMT.
void rotate_back(const JRotation3D &R)
Rotate back module.
JVector3D getCenter() const
Get center of module based on crossing point of PMT axes.
Interface for binary input.
const JPosition3D & getPosition() const
Get position.
const JPMT & getPMT(const int index) const
Get PMT.
void rotate(const JRotation3D &R)
Rotate module.
then usage $script[distance] fi case set_variable R
JModule & operator+=(const JVector3D &pos)
Add position.
Logical location of module.
static const JGetDetectorVersion getDetectorVersion
Function object to map detector version to numerical value.
const JRotation3D & getRotation() const
Get rotation.
Data structure for unit quaternion in three dimensions.
static JDetectorVersion & getVersion()
Get detector version.
friend std::ostream & operator<<(std::ostream &out, const JModule &module)
Write module to output.
friend std::istream & operator>>(std::istream &in, JModule &module)
Read module from input.
void setT0(const double t0)
Set time offset.
Data structure for PMT geometry and calibration.
Auxiliary class for object identification.
JPosition3D()
Default constructor.
void setCalibration(const JCalibration &cal)
Set calibration.
void transform(const JRotation3D &R, const JVector3D &pos)
Transformation of geometry (see method JGEOMETRY3D::JPosition3D::transform(const JRotation3D&, const JVector3D&)).
JModule & set(const double t0)
Set time offset.
JPMT & getPMT(const int index)
Get PMT.
Base class for data structures with artithmetic capabilities.
void addT0(const double t0)
Add time offset.
Data structure for position in three dimensions.
Exception for accessing a value in a collection that is outside of its range.
JVector3D & div(const double factor)
Scale vector.
Data structure for normalised vector in three dimensions.
Version with module status field.
Auxiliary class for version identifier.
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable INPUT_FILE $argv[2] eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY source JAcoustics sh $DETECTOR_ID CHECK_EXIT_CODE typeset A TRIPODS get_tripods $WORKDIR tripod txt TRIPODS for EMITTER in
JPosition3D & rotate(const JRotation3D &R)
Rotate.
JModule & set(const JVector3D &pos)
Set position.
static bool compare(const JModule &first, const JModule &second, const double precision=1.0e-3)
Compare modules.
JVector3D & add(const JVector3D &vector)
Add vector.
JModule & add(const JVector3D &pos)
Add position.
JVector3D()
Default constructor.
double getT0() const
Get time offset.