Constructor.
Note that the positions of the base modules correspond to the reference position of the string.
As a consequence, a base module (i.e. floor = 0) is required for each string.
Missing base modules should therefore be added beforehand (e.g. using application JDetectorDB.cc).
Note that if the position of a hydrophone is not available, it is assumed that there is no hydrophone on that string.
If the position of the hydrophone is manually set, the corresponding parameter JString::has_hydrophone should be set to true.
526 {
527 using namespace std;
529
530 map<int, vector<module_type> > buffer;
531
532 for (JDETECTOR::JDetector::const_iterator module = detector.begin(); module != detector.end(); ++module) {
533 buffer[module->getString()].push_back(module_type(module->getLocation(), module->getPosition()));
534 }
535
536 for (map<int, vector<module_type> >::iterator i = buffer.begin(); i != buffer.end(); ++i) {
537
538 sort(i->second.begin(), i->second.end(), make_comparator(&module_type::getFloor));
539
540 if (i->second[0].getFloor() == 0) {
541
542 JString& string = (*this)[i->first];
543
544 vector<module_type>::iterator p = i->second.begin();
545
546 ++p;
547
549
550 try {
551
552 string.hydrophone =
getPosition(hydrophones.begin(),
553 hydrophones.end(),
554 make_predicate(&JHydrophone::getString, i->first));
555
556 string.has_hydrophone = true;
557 }
558 catch(const exception&) {
559 string.has_hydrophone = false;
560 }
561
562 } else {
563
564 THROW(JNoValue, "No floor 0 in string " << i->first << "; use e.g. JDetectorDB -W.");
565 }
566 }
567 }
JVector3D getPosition(T __begin, T __end, const JPredicate< JTypename_t, JComparator_t > &predicate)
Get position from element in data which corresponds to given predicate.
static JDetectorMechanics getMechanics
Function object to get string mechanics.