1 #ifndef __JACOUSTICS__JGEOMETRY__
2 #define __JACOUSTICS__JGEOMETRY__
37 namespace JACOUSTICS {}
38 namespace JPP {
using namespace JACOUSTICS; }
40 namespace JACOUSTICS {
145 return 0.5*t2*mechanics.
b *
log(1.0 - mechanics.
a*height) + sqrt(1.0 + t2) * height;
163 const size_t MAXIMUM_NUMBER_OF_ITERATIONS = 10;
169 for (
size_t i = 0; i != MAXIMUM_NUMBER_OF_ITERATIONS; ++i) {
171 const double ls =
getLength(parameters, mechanics, z);
173 if (fabs(ls - length) <= precision) {
177 z -= (ls - length) / (1.0 + ts * (1.0 - mechanics.
a*mechanics.
b / (1.0 - mechanics.
a*z)));
195 const double h1 = height * (1.0 + parameters.
vs);
196 const double z1 = mechanics.
getHeight(h1);
199 parameters.
ty * z1 + parameters.
ty2 * h1*h1,
256 for (
T i = __begin; i != __end; ++i) {
270 if (floor >= this->size()) {
271 this->resize(floor + 1);
289 return (floor < this->size());
307 }
else if (floor < this->size()) {
309 return (*
this)[floor].getHeight();
324 const size_t floor)
const
332 }
else if (floor < this->size()) {
363 const size_t floor)
const
379 const size_t floor)
const
385 }
else if (floor < this->size()) {
388 const double height = (*this)[floor].getHeight();
389 const double h1 = height * (1.0 + parameters.
vs);
392 const double tx = parameters.
tx;
393 const double ty = parameters.
ty;
394 const double tz = sqrt(1.0 - tx*tx - ty*ty);
396 const double dx = pos.
getX() - position.
getX();
397 const double dy = pos.
getY() - position.
getY();
398 const double dz = pos.
getZ() - position.
getZ();
400 const double D = sqrt(dx*dx + dy*dy + dz*dz);
405 z1 * dy / D - height * (ty / tz) * dz / D,
408 height * vw * (tx * dx + ty * dy) / D + h1 * (dz / vs) / D);
428 for (
size_t i = 0; i !=
string.size(); ++i) {
430 out << setw(2) << i <<
' '
431 <<
FIXED(7,3) <<
string[i] <<
" | "
432 <<
string.getPosition(i) <<
' '
433 <<
string.mechanics << endl;
492 for (JDETECTOR::JDetector::const_iterator module = detector.begin(); module != detector.end(); ++module) {
493 buffer[module->getString()].push_back(
module_type(module->getLocation(), module->getPosition()));
498 sort(i->second.begin(), i->second.end(),
make_comparator(&module_type::getFloor));
500 if (i->second[0].getFloor() == 0) {
514 (*this)[i->first].has_hydrophone =
true;
516 catch(
const exception&) {
517 (*this)[i->first].has_hydrophone =
false;
522 THROW(
JNoValue,
"No floor 0 in string " << i->first <<
"; use e.g. JDetectorDB -W.");
536 return this->has(
string);
564 out << setw(4) << i->first << endl << i->second;
static double getHeight(const JMODEL::JString ¶meters, const JMechanics &mechanics, const double length, const double precision=PRECISION_M)
Get approximate height of string.
Mechanical modelling of string.
JPredicate< JResult_t T::*, JComparison::eq > make_predicate(JResult_t T::*member, const JResult_t value)
Helper method to create predicate for data member.
JComparator< JResult_t T::*, JComparison::lt > make_comparator(JResult_t T::*member)
Helper method to create comparator between values of data member.
int getFloor() const
Get floor number.
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.
static JDetectorMechanics getMechanics
Function object to get string mechanics.
friend std::ostream & operator<<(std::ostream &out, const JFloor &floor)
Write floor parameters to output stream.
General purpose class for hash map of unique elements.
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
double getHeight(const size_t floor) const
Get height of given floor.
JString(const JVector3D &position, T __begin, T __end, const JMechanics &mechanics)
Constructor.
*fatal Wrong number of arguments esac JCookie sh typeset Z DETECTOR typeset Z SOURCE_RUN typeset Z TARGET_RUN set_variable PARAMETERS_FILE $WORKDIR parameters
JString()
Default constructor.
Auxiliary data structure for floating point format specification.
double getDistance(const JVector3D &pos) const
Get distance to point.
JFloor()
Default constructor.
JString(const JVector3D &position)
Constructor.
Data structure for detector geometry and calibration.
JPosition3D getPosition(const size_t floor) const
Get position of given floor according to default string model parameters.
Auxiliary data structure for module location and position.
static constexpr double PRECISION_M
precision of height evaluation [m]
then echo The file $DIR KM3NeT_00000001_00000000 root already please rename or remove it first
Data structure for hydrophone.
JFloor(const double height)
Constructor.
friend std::ostream & operator<<(std::ostream &out, const JString &string)
Write string parameters to output stream.
bool hasString(int string) const
Check if this detector has given string.
JGEOMETRY::JDetector JGeometry
Type definition of detector geometry.
Exception for missing value.
module_type(const JLocation &location, const JPosition3D &position)
Constructor.
Data structure for vector in three dimensions.
Logical location of module.
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.
JPosition3D getPosition(const JMODEL::JString ¶meters, const size_t floor) const
Get position of given 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...
do set_variable OUTPUT_DIRECTORY $WORKDIR T
static double getLength(const JMODEL::JString ¶meters, const JMechanics &mechanics, const double height)
Get approximate length of string.
double a
0 <= a < (maximal height)⁻1; [m^-1]
double getHeight(const double height) const
Get effective height for given actual height.
double getLengthSquared() const
Get length squared.
double getY() const
Get y position.
const JPosition3D & getPosition() const
Get position.
double getLength() const
Get length.
Logical location of module.
JDetector(const JDETECTOR::JDetector &detector, const std::vector< JDETECTOR::JHydrophone > &hydrophones=std::vector< JDETECTOR::JHydrophone >())
Constructor.
JFloor & operator[](size_t floor)
Get floor data.
bool hasFloor(size_t floor) const
Check if this string has given floor.
int getString() const
Get string number.
friend std::ostream & operator<<(std::ostream &out, const JDetector &detector)
Write detector parameters to output stream.
JPosition3D hydrophone
Hydrophone.
JMechanics mechanics
Mechanical data.
JPosition3D getPiezoPosition()
Get relative position of piezo in optical module.
JPosition3D()
Default constructor.
friend bool operator<(const module_type &first, const module_type &second)
Less-than operator.
JDetector()
Default constructor.
double getX() const
Get x position.
bool hasLocation(const JLocation &location) const
Check if this detector has given location.
Auxiliary data structure to list files in directory.
Data structure for position in three dimensions.
double getHeight() const
Get height of this floor.
Exception for accessing a value in a collection that is outside of its range.
then cat $TRIPOD_INITIAL<< EOF1 256877.5 4743716.7-2438.42 256815.5 4743395.0-2435.53 257096.2 4743636.0-2439.5EOFfiif[[!-f $DETECTOR]];then JEditDetector-a $DETECTOR_INITIAL-s"-1 addz -6.9"-o $DETECTOR--!eval`JPrintDetector-a $DETECTOR-O SUMMARY`for STRING in ${STRINGS[*]};do set_variable MODULE`getModule-a $DETECTOR-L"$STRING 0"`JEditDetector-a $DETECTOR-M"$MODULE setz -2.9"-o $DETECTOR--!donefiif[[!-f $TRIPOD]];then cp-p $TRIPOD_INITIAL $TRIPODfiJAcoustics.sh $DETECTOR_IDcat > acoustics_trigger_parameters txt<< EOFQ=0.0;TMax_s=0.020;numberOfHits=90;EOFJAcousticsEventBuilder.sh $DETECTOR $RUNS[*]INPUT_FILES=(`ls KM3NeT_ ${(l:8::0::0:) DETECTOR_ID}_0 *${^RUNS}_event.root`) cd $WORKDIRif[!$HOMEDIR-ef $WORKDIR];then cp-p $HOMEDIR/$DETECTOR $WORKDIR cp-p $HOMEDIR/${^ACOUSTICS_KEYS}.txt $WORKDIR cp-p $HOMEDIR/${^INPUT_FILES}$WORKDIRfisource $JPP_DIR/examples/JAcoustics/acoustics-fit-toolkit.shtimer_startinitialise stage_b 1 0 100.0e-6 0.002 0.1 0 > &stage log
Model for fit to acoutsics data.
do echo Generating $dir eval D
double getZ() const
Get z position.
Auxiliary data structure for parameters of mechanical model.