1#ifndef __JACOUSTICS__JGEOMETRY__
2#define __JACOUSTICS__JGEOMETRY__
184 const size_t MAXIMUM_NUMBER_OF_ITERATIONS = 10;
190 for (
size_t i = 0; i != MAXIMUM_NUMBER_OF_ITERATIONS; ++i) {
194 if (fabs(
ls) <= precision) {
200 z -=
ls / (1.0 + 0.5*T2 * vs*vs);
219 const double h1 = height * (1.0 + parameters.
vs);
223 parameters.
ty * z1 + parameters.
ty2 * h1*h1,
283 for (T i = __begin; i != __end; ++i) {
286 i->getY() - this->getY()));
321 if (floor >= this->size()) {
322 this->resize(floor + 1);
340 return (floor < this->size());
359 return (*
this)[floor].getHeight();
371 const size_t floor)
const
413 const size_t floor)
const
429 const size_t floor)
const
435 }
else if (floor < this->size()) {
438 const double height = (*this)[floor].getHeight();
439 const double h1 = height * (1.0 + parameters.
vs);
442 const double tx = parameters.
tx;
443 const double ty = parameters.
ty;
444 const double tz = sqrt(1.0 - tx*tx - ty*ty);
446 const double dx = pos.
getX() - position.
getX();
447 const double dy = pos.
getY() - position.
getY();
448 const double dz = pos.
getZ() - position.
getZ();
450 const double D = sqrt(dx*dx + dy*dy + dz*dz);
455 z1 * dy / D - height * (ty / tz) * dz / D,
458 height * vw * (tx * dx + ty * dy) / D + h1 * (dz / vs) / D);
478 for (
size_t i = 0; i !=
string.size(); ++i) {
480 out << setw(2) << i <<
' '
481 <<
FIXED(7,3) <<
string[i] <<
" | "
482 <<
string.getPosition(i) <<
' '
483 <<
string.mechanics << endl;
545 for (JDETECTOR::JDetector::const_iterator module =
detector.begin(); module !=
detector.end(); ++module) {
546 buffer[module->getString()].push_back(
module_type(module->getLocation(), module->getPosition()));
553 if (i->second[0].getFloor() == 0) {
555 JString&
string = (*this)[i->first];
561 string =
JGEOMETRY::JString(i->second[0].getPosition(), mechanics(i->first), p, i->second.end());
565 string.hydrophone =
getPosition(hydrophones.begin(),
569 string.has_hydrophone =
true;
571 catch(
const exception&) {
572 string.has_hydrophone =
false;
577 THROW(
JNoValue,
"No floor 0 in string " << i->first <<
"; use e.g. JDetectorDB -W.");
590 for (
iterator i = this->begin(); i != this->end(); ++i) {
591 i->second.setMechanics(mechanics(i->first));
604 return this->
has(
string);
632 out << setw(4) << i->first << endl << i->second;
Model for fit to acoutsics data.
Data structure for detector geometry and calibration.
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
General purpose class for hash map of unique elements.
Data structure for hydrophone.
Logical location of module.
Mechanical modelling of string.
Logical location of module.
int getFloor() const
Get floor number.
int getString() const
Get string number.
Data structure for vector in two dimensions.
Data structure for position in three dimensions.
JPosition3D()
Default constructor.
const JPosition3D & getPosition() const
Get position.
Data structure for vector in three dimensions.
double getY() const
Get y position.
double getLength() const
Get length.
double getDistance(const JVector3D &pos) const
Get distance to point.
double getZ() const
Get z position.
double getX() const
Get x position.
Exception for missing value.
Exception for accessing a value in a collection that is outside of its range.
Auxiliary classes and methods for acoustic position calibration.
JVector3D getPosition(T __begin, T __end, const JPredicate< JTypename_t, JComparator_t > &predicate)
Get position from element in data which corresponds to given predicate.
JGEOMETRY::JDetector JGeometry
Type definition of detector geometry.
JPosition3D getPiezoPosition()
Get relative position of piezo in optical module.
JComparator< JResult_t T::*, JComparison::lt > make_comparator(JResult_t T::*member)
Helper method to create comparator between values of data member.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Auxiliary data structure for floating point format specification.
Auxiliary data structure for mechanical model parameters of strings in a given detector.
Auxiliary data structure for module location and position.
module_type(const JLocation &location, const JPosition3D &position)
Constructor.
bool hasLocation(const JLocation &location) const
Check if this detector has given location.
bool hasString(int string) const
Check if this detector has given string.
void setMechanics(const JDetectorMechanics_t &mechanics)
Set mechanical model parameters.
JDetector(const JDETECTOR::JDetector &detector, const JDetectorMechanics_t &mechanics, const std::vector< JHydrophone > &hydrophones=std::vector< JHydrophone >())
Constructor.
friend std::ostream & operator<<(std::ostream &out, const JDetector &detector)
Write detector parameters to output stream.
JDetector()
Default constructor.
friend std::ostream & operator<<(std::ostream &out, const JFloor &floor)
Write floor parameters to output stream.
JFloor()
Default constructor.
double getHeight() const
Get height of this floor.
JFloor(const double height, const JVector2D &position=JVector2D())
Constructor.
const JVector3D & getPosition() const
Get position of this floor.
JPosition3D hydrophone
Hydrophone.
static double getHeight(const JMODEL::JString ¶meters, const JMechanics &mechanics, const double length, const double precision=PRECISION_M)
Get approximate height of string.
double getDistance(const JMODEL::JString ¶meters, const JVector3D &position, const size_t floor) const
Get distance between given position and floor according to given string model parameters.
JMODEL::JString getGradient(const JMODEL::JString ¶meters, const JVector3D &position, const size_t floor) const
Get model gradient of distance between given position and floor according to given string model param...
static JPosition3D getPosition(const JMODEL::JString ¶meters, const JMechanics &mechanics, const double height)
Get position at given height according to given string model parameters and mechanics.
double getHeight(const size_t floor) const
Get height of receiver at given floor with respect to reference position.
JFloor & operator[](size_t floor)
Get floor data.
void setMechanics(const JMechanics &mechanics)
Set mechanical model parameters.
JString()
Default constructor.
const JMechanics & getMechanics() const
Get mechanical model parameters.
JString(const JVector3D &position, const JMechanics &mechanics)
Constructor.
bool hasFloor(size_t floor) const
Check if this string has receiver at given floor.
JPosition3D getPosition(const JMODEL::JString ¶meters, const size_t floor) const
Get position of receiver at given floor according to given string model parameters.
friend std::ostream & operator<<(std::ostream &out, const JString &string)
Write string parameters to output stream.
static constexpr double PRECISION_M
precision of height evaluation [m]
JMechanics mechanics
Mechanical data.
JString(const JVector3D &position, const JMechanics &mechanics, T __begin, T __end)
Constructor.
static double getLength(const JMODEL::JString ¶meters, const JMechanics &mechanics, const double height)
Get approximate length of string.
const JPosition3D & getPosition() const
Get position.
JPosition3D getPosition(const size_t floor) const
Get position of receiver at given floor.
double getLengthSquared() const
Get length squared.
Auxiliary data structure for parameters of mechanical model.
double a
0 <= a < (maximal height)⁻1; [m^-1]
double getHeight(const double height) const
Get effective height for given actual height.
Type definition of hydrophone.
Auxiliary data structure to list files in directory.