Jpp master_rocky-44-g75b7c4f75
the software that should make you happy
Loading...
Searching...
No Matches
JACOUSTICS::JSydney Struct Reference

Main class for pre-calibration using acoustics data. More...

Classes

struct  detector_type
 Auxiliary data structure for detector with decomposed strings. More...
 
struct  fits_t
 Auxiliary data structure for group of lists of identifiers of to-be-fitted objects. More...
 
struct  ids_t
 List of object identifiers. More...
 
struct  JAnchorEditor
 Auxiliary class to edit orientation of anchor. More...
 
struct  JDyneemaEditor
 Auxiliary class to edit length of Dyneema ropes. More...
 
struct  JModuleEditor
 Auxiliary class to edit (z) position of module. More...
 
struct  JParameters_t
 Extended data structure for parameters of stage. More...
 
struct  JStringEditor
 Auxiliary class to edit (x,y,z) position of string. More...
 
struct  JTripodEditor
 Auxiliary class to edit (x,y,z) position of tripod. More...
 
struct  string_type
 Auxiliary data structure for decomposed string. More...
 

Public Types

typedef std::vector< JEventinput_type
 

Public Member Functions

 JSydney (const JFilenames &filenames, const JSoundVelocity &V, const size_t threads, const int debug)
 Constructor.
 
void stage_0 (const JParameters_t &parameters)
 Fit procedure to determine the positions of tripods and transmitters using strings that are fixed.
 
void stage_a (const JParameters_t &parameters)
 Fit procedure to determine the positions of the strings and tripods.
 
void stage_b (const JParameters_t &parameters)
 Fit procedure to determine the stretching and z-positions of individual strings.
 
void stage_c (const JParameters_t &parameters)
 Fit procedure to determine the z-positions of the modules.
 
void stage_d (const JParameters_t &parameters)
 Fit procedure to determine the z-positions of anchors.
 
void stage_x (const JParameters_t &parameters)
 Fit procedure to determine the (x,y,z) positions of the modules.
 
double operator() (const int option) const
 Get chi2.
 
void run (const std::string &script)
 Run.
 
void store (const std::string &dir=".")
 Store data in given directory.
 
ids_t getReceivers () const
 Get list of identifiers of receivers.
 
ids_t getEmitters () const
 Get list of identifiers of emitters.
 

Public Attributes

JFilenames filenames
 
JSoundVelocity V
 
size_t threads
 
int debug
 
JSetup setup
 
fits_t fits
 
JTOOLS::JHashMap< int, JLocationreceivers
 
std::unique_ptr< JLocationRouterrouter
 
std::vector< input_typeinput
 

Static Public Attributes

static constexpr double RADIUS_M = 1.0
 maximal horizontal distance between T-bar and emitter/hydrophone
 

Private Attributes

std::vector< JSuperEvtoutput
 
JDetector detector
 PMTs.
 
JFitParameters parameters
 

Detailed Description

Main class for pre-calibration using acoustics data.

Definition at line 134 of file JSydney.cc.

Member Typedef Documentation

◆ input_type

Constructor & Destructor Documentation

◆ JSydney()

JACOUSTICS::JSydney::JSydney ( const JFilenames & filenames,
const JSoundVelocity & V,
const size_t threads,
const int debug )
inline

Constructor.

Parameters
filenamesfile names
Vsound velocity
threadsthreads
debugdebug

Definition at line 583 of file JSydney.cc.

586 :
588 V(V),
590 debug(debug)
591 {
593
595
596 if (filenames.hydrophone != "") { setup.hydrophones .load(filenames.hydrophone .c_str()); }
598
599 for (JDetector::const_iterator i = setup.detector.begin(); i != setup.detector.end(); ++i) {
600 receivers[i->getID()] = i->getLocation();
601 }
602
603 // detach PMTs
604
606
607 for (JDetector::iterator module = setup.detector.begin(); module != setup.detector.end(); ++module) {
608 module->clear();
609 }
610
612
614
615 this->V.set(setup.detector.getUTMZ()); // sound velocity at detector depth
616
619
621
622 ROOT::EnableThreadSafety();
623 }
Router for direct addressing of location data in detector data structure.
double getUTMZ() const
Get UTM Z.
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
Detector file.
Definition JHead.hh:227
std::string transmitter
transmitter
Definition JSydney.cc:101
std::string detector
detector
Definition JSydney.cc:98
std::string hydrophone
hydrophone
Definition JSydney.cc:100
std::string tripod
tripod
Definition JSydney.cc:99
Template definition of fit function of acoustic model.
tripods_container tripods
tripods
Definition JSydney.cc:110
hydrophones
hydrophones
transmitters_container transmitters
transmitters
Definition JSydney.cc:127
JDetector detector
detector
Definition JSydney.cc:109
JSoundVelocity & set(const double z0)
Set depth.
void initialise(const JSetup &setup)
Initialise.
Definition JSydney.cc:246
JFilenames filenames
Definition JSydney.cc:1229
std::unique_ptr< JLocationRouter > router
Definition JSydney.cc:1237
JTOOLS::JHashMap< int, JLocation > receivers
Definition JSydney.cc:1236
JSoundVelocity V
Definition JSydney.cc:1230
void load(const char *file_name)
Load from input file.

Member Function Documentation

◆ stage_0()

void JACOUSTICS::JSydney::stage_0 ( const JParameters_t & parameters)
inline

Fit procedure to determine the positions of tripods and transmitters using strings that are fixed.

Parameters
parametersparameters

Definition at line 672 of file JSydney.cc.

673 {
674 using namespace std;
675 using namespace JPP;
676
677 this->parameters = parameters;
678
679 JDetector A; // old strings
680 detector_type B; // new strings with transmitter -> fit only base module
681 JDetector C; // new strings w/o transmitter -> discard completely from fit
682
683 for (JDetector::iterator module = setup.detector.begin(); module != setup.detector.end(); ++module) {
684
685 if (fits.strings .count(module->getString()) == 0)
686 A.push_back(*module);
687 else if (fits.transmitters.count(module->getString()) != 0)
688 B.push_back(*module);
689 else
690 C.push_back(*module);
691 }
692
693 setup.detector.swap(A);
694
695 for (const auto& element : B) {
696 setup.detector.push_back(element.second.base);
697 }
698
700
701 JGradient fit(parameters.Nmax, parameters.Nextra, parameters.epsilon, parameters.debug);
702
703 for (const int i : fits.tripods) {
704 fit.push_back(JModifier_t(MAKE_STRING(LEFT(16) << "tripod.x: " << RIGHT(4) << i), new JTripodEditor(setup, i, JVector3X_t), parameters.steps[0]));
705 fit.push_back(JModifier_t(MAKE_STRING(LEFT(16) << "tripod.y: " << RIGHT(4) << i), new JTripodEditor(setup, i, JVector3Y_t), parameters.steps[0]));
706 fit.push_back(JModifier_t(MAKE_STRING(LEFT(16) << "tripod.z: " << RIGHT(4) << i), new JTripodEditor(setup, i, JVector3Z_t), parameters.steps[0]));
707 }
708
709 for (const int i : fits.transmitters) {
710 fit.push_back(JModifier_t(MAKE_STRING(LEFT(16) << "transmitter.x: " << RIGHT(4) << i), new JStringEditor(setup, i, JVector3X_t, true), parameters.steps[0]));
711 fit.push_back(JModifier_t(MAKE_STRING(LEFT(16) << "transmitter.y: " << RIGHT(4) << i), new JStringEditor(setup, i, JVector3Y_t, true), parameters.steps[0]));
712 fit.push_back(JModifier_t(MAKE_STRING(LEFT(16) << "transmitter.z: " << RIGHT(4) << i), new JStringEditor(setup, i, JVector3Z_t, true), parameters.steps[0]));
713 }
714
715 const double chi2 = fit(*this);
716
717 for (auto& element : B) {
718
719 const JModule& base = setup.detector.getModule(router->getAddress(JLocation(element.second.base.getString(),0)));
720 const JVector3D pos = base.getPosition() - element.second.base.getPosition();
721
722 for (string_type::iterator module = element.second.begin(); module != element.second.end(); ++module) {
723
724 module->add(pos);
725
726 setup.detector.push_back(*module);
727 }
728 }
729
730 copy(C.begin(), C.end(), back_inserter(setup.detector));
731
732 sort(setup.detector.begin(), setup.detector.end(), make_comparator(&JModule::getLocation));
733
735
736 STATUS("detector: " << FIXED(9,4) << chi2 << endl);
737 }
#define STATUS(A)
Definition JMessage.hh:63
#define MAKE_STRING(A)
Make string.
Definition JPrint.hh:63
Detector data structure.
Definition JDetector.hh:96
const JModule & getModule(const JModuleAddress &address) const
Get module parameters.
Definition JDetector.hh:270
Logical location of module.
Definition JLocation.hh:40
Data structure for a composite optical module.
Definition JModule.hh:75
const JPosition3D & getPosition() const
Get position.
Data structure for vector in three dimensions.
Definition JVector3D.hh:36
void copy(const Head &from, JHead &to)
Copy header from from to to.
Definition JHead.cc:162
static const JVector3D JVector3X_t(1, 0, 0)
unit x-vector
static const JVector3D JVector3Y_t(0, 1, 0)
unit y-vector
static const JVector3D JVector3Z_t(0, 0, 1)
unit z-vector
JComparator< JResult_t T::*, JComparison::lt > make_comparator(JResult_t T::*member)
Helper method to create comparator between values of data member.
@ LEFT
Definition JTwosome.hh:18
@ RIGHT
Definition JTwosome.hh:18
static const double C
Physics constants.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Auxiliary data structure for floating point format specification.
Definition JManip.hh:448
ids_t transmitters
identifiers of strings with transmitter
Definition JSydney.cc:259
ids_t tripods
identifiers of tripods
Definition JSydney.cc:257
ids_t strings
identifiers of strings
Definition JSydney.cc:256
JFitParameters parameters
Definition JSydney.cc:1246
Conjugate gradient fit.
Definition JGradient.hh:75
Auxiliary data structure for editable parameter.
Definition JGradient.hh:49

◆ stage_a()

void JACOUSTICS::JSydney::stage_a ( const JParameters_t & parameters)
inline

Fit procedure to determine the positions of the strings and tripods.

Parameters
parametersparameters

Definition at line 745 of file JSydney.cc.

746 {
747 using namespace std;
748 using namespace JPP;
749
750 this->parameters = parameters;
751
752 JGradient fit(parameters.Nmax, parameters.Nextra, parameters.epsilon, parameters.debug);
753
754 for (const int i : fits.strings) {
755 fit.push_back(JModifier_t(MAKE_STRING(LEFT(16) << "string.x: " << RIGHT(4) << i), new JStringEditor(setup, i, JVector3X_t, true), parameters.steps[0]));
756 fit.push_back(JModifier_t(MAKE_STRING(LEFT(16) << "string.y: " << RIGHT(4) << i), new JStringEditor(setup, i, JVector3Y_t, true), parameters.steps[0]));
757 fit.push_back(JModifier_t(MAKE_STRING(LEFT(16) << "string.z: " << RIGHT(4) << i), new JStringEditor(setup, i, JVector3Z_t, false), parameters.steps[0]));
758 }
759
760 for (const int i : fits.tripods) {
761 fit.push_back(JModifier_t(MAKE_STRING(LEFT(16) << "tripod.x: " << RIGHT(4) << i), new JTripodEditor(setup, i, JVector3X_t), parameters.steps[1]));
762 fit.push_back(JModifier_t(MAKE_STRING(LEFT(16) << "tripod.y: " << RIGHT(4) << i), new JTripodEditor(setup, i, JVector3Y_t), parameters.steps[1]));
763 fit.push_back(JModifier_t(MAKE_STRING(LEFT(16) << "tripod.z: " << RIGHT(4) << i), new JTripodEditor(setup, i, JVector3Z_t), parameters.steps[1]));
764 }
765
766 for (const int i : ids_t(fits.hydrophones, fits.transmitters)) {
767 fit.push_back(JModifier_t(MAKE_STRING(LEFT(16) << "anchor.R: " << RIGHT(4) << i), new JAnchorEditor(setup, i), parameters.steps[0] / RADIUS_M));
768 }
769
770 for (const int i : fits.transmitters) {
771
772 JModule& module = setup.detector.getModule(router->getAddress(JLocation(i,0)));
773
774 fit.push_back(JModifier_t(MAKE_STRING(LEFT(16) << "anchor.R: " << RIGHT(4) << i), new JAnchorEditor(setup, i), parameters.steps[0] / RADIUS_M));
775 fit.push_back(JModifier_t(MAKE_STRING(LEFT(16) << "anchor.z: " << RIGHT(4) << i), new JModuleEditor(module), parameters.steps[0]));
776 }
777
778 const double chi2 = fit(*this);
779
780 STATUS("detector: " << FIXED(9,4) << chi2 << endl);
781 }
ids_t hydrophones
identifiers of strings with hydrophone
Definition JSydney.cc:258
static constexpr double RADIUS_M
maximal horizontal distance between T-bar and emitter/hydrophone
Definition JSydney.cc:136

◆ stage_b()

void JACOUSTICS::JSydney::stage_b ( const JParameters_t & parameters)
inline

Fit procedure to determine the stretching and z-positions of individual strings.

Parameters
parametersparameters

Definition at line 789 of file JSydney.cc.

790 {
791 using namespace std;
792 using namespace JPP;
793
794 this->parameters = parameters;
795
796 map<int, JDetector> buffer;
797
798 double z0 = 0.0;
799
800 for (JDetector::iterator module = setup.detector.begin(); module != setup.detector.end(); ++module) {
801
802 buffer[module->getString()].push_back(*module);
803
804 if (module->getZ() > z0) {
805 z0 = module->getZ();
806 }
807 }
808
809 JDetector tx;
810
811 for (transmitters_container::iterator i = setup.transmitters.begin(); i != setup.transmitters.end(); ++i) {
812 try {
813 tx.push_back(router->getModule(i->getLocation()));
814 }
815 catch(const exception&) {}
816 }
817
818 for (const int i : fits.strings) {
819
820 setup.detector.swap(buffer[i]);
821
822 copy(tx.begin(), tx.end(), back_inserter(setup.detector));
823
825
826 JGradient fit(parameters.Nmax, parameters.Nextra, parameters.epsilon, parameters.debug);
827
828 fit.push_back(JModifier_t(MAKE_STRING(LEFT(16) << "string.M: " << RIGHT(4) << i), new JDyneemaEditor(setup, i, z0), parameters.steps[0]));
829 fit.push_back(JModifier_t(MAKE_STRING(LEFT(16) << "string.z: " << RIGHT(4) << i), new JStringEditor (setup, i, JVector3Z_t, false), parameters.steps[1]));
830
831 const double chi2 = fit(*this);
832
833 STATUS("string: " << setw(4) << i << ' ' << FIXED(9,4) << chi2 << endl);
834
835 buffer[i].clear();
836
837 copy_if(setup.detector.begin(), setup.detector.end(), back_inserter(buffer[i]), make_predicate(&JModule::getString, i));
838 }
839
840 setup.detector.clear();
841
842 for (const auto& element : buffer) {
843 copy(element.second.begin(), element.second.end(), back_inserter(setup.detector));
844 }
845
847 }
JPredicate< JResult_t T::*, JComparison::eq > make_predicate(JResult_t T::*member, const JResult_t value)
Helper method to create predicate for data member.

◆ stage_c()

void JACOUSTICS::JSydney::stage_c ( const JParameters_t & parameters)
inline

Fit procedure to determine the z-positions of the modules.

Parameters
parametersparameters

Definition at line 855 of file JSydney.cc.

856 {
857 using namespace std;
858 using namespace JPP;
859
860 this->parameters = parameters;
861
862 JGradient fit(parameters.Nmax, parameters.Nextra, parameters.epsilon, parameters.debug);
863
864 for (JDetector::iterator module = setup.detector.begin(); module != setup.detector.end(); ++module) {
865 if (fits.strings.count(module->getString()) != 0 && module->getFloor() != 0) {
866 fit.push_back(JModifier_t(MAKE_STRING(LEFT(16) << "module.z: " << right << module->getLocation()), new JModuleEditor(*module), parameters.steps[0]));
867 }
868 }
869
870 const double chi2 = fit(*this);
871
872 STATUS("detector: " << FIXED(9,4) << chi2 << endl);
873 }

◆ stage_d()

void JACOUSTICS::JSydney::stage_d ( const JParameters_t & parameters)
inline

Fit procedure to determine the z-positions of anchors.

Parameters
parametersparameters

Definition at line 881 of file JSydney.cc.

882 {
883 using namespace std;
884 using namespace JPP;
885
886 this->parameters = parameters;
887
888 JGradient fit(parameters.Nmax, parameters.Nextra, parameters.epsilon, parameters.debug);
889
890 for (JDetector::iterator module = setup.detector.begin(); module != setup.detector.end(); ++module) {
891 if (fits.strings.count(module->getString()) != 0 && module->getFloor() == 0) {
892 fit.push_back(JModifier_t(MAKE_STRING(LEFT(16) << "module.z: " << right << module->getLocation()), new JModuleEditor(*module), parameters.steps[0]));
893 }
894 }
895
896 const double chi2 = fit(*this);
897
898 STATUS("detector: " << FIXED(9,4) << chi2 << endl);
899 }

◆ stage_x()

void JACOUSTICS::JSydney::stage_x ( const JParameters_t & parameters)
inline

Fit procedure to determine the (x,y,z) positions of the modules.

This procedure should be considered unorthodox - it can be used to modify the detector file in such a way to accommodate anomalies in the shapes of a string (e.g. entanglement of string in D0ORCA018).

Parameters
parametersparameters

Definition at line 909 of file JSydney.cc.

910 {
911 using namespace std;
912 using namespace JPP;
913
914 this->parameters = parameters;
915
916 JGradient fit(parameters.Nmax, parameters.Nextra, parameters.epsilon, parameters.debug);
917
918 for (JDetector::iterator module = setup.detector.begin(); module != setup.detector.end(); ++module) {
919 if (fits.strings.count(module->getString()) != 0 && module->getFloor() != 0) {
920 fit.push_back(JModifier_t(MAKE_STRING(LEFT(16) << "module.x: " << right << module->getLocation()), new JModuleEditor(*module, JVector3X_t), parameters.steps[0]));
921 fit.push_back(JModifier_t(MAKE_STRING(LEFT(16) << "module.y: " << right << module->getLocation()), new JModuleEditor(*module, JVector3Y_t), parameters.steps[0]));
922 fit.push_back(JModifier_t(MAKE_STRING(LEFT(16) << "module.z: " << right << module->getLocation()), new JModuleEditor(*module, JVector3Z_t), parameters.steps[0]));
923 }
924 }
925
926 const double chi2 = fit(*this);
927
928 STATUS("detector: " << FIXED(9,4) << chi2 << endl);
929 }

◆ operator()()

double JACOUSTICS::JSydney::operator() ( const int option) const
inline

Get chi2.

Parameters
optionoption
Returns
chi2/NDF

Definition at line 938 of file JSydney.cc.

939 {
940 using namespace std;
941 using namespace JPP;
942
943 const JGeometry geometry(setup.detector, setup.hydrophones);
944
946
947 for (tripods_container::const_iterator i = setup.tripods.begin(); i != setup.tripods.end(); ++i) {
948 {
949 emitters[i->getID()] = JEmitter(i->getID(), i->getUTMPosition() - setup.detector.getUTMPosition());
950 }
951 }
952
953 for (transmitters_container::const_iterator i = setup.transmitters.begin(); i != setup.transmitters.end(); ++i) {
954 try {
955 emitters[i->getID()] = JEmitter(i->getID(), i->getPosition() + router->getModule(i->getLocation()).getPosition());
956 }
957 catch(const exception&) {} // if no module available, discard transmitter
958 }
959
960 if (option == 0 || // step wise improvement of the chi2
961 option == 1) { // evaluation of the chi2 before the determination of the gradient of the chi2
962
963 this->output.clear();
964
965 JSTDObjectWriter<JSuperEvt> out(this->output); // write data for subsequent use
966
967 JFremantle::output = (option == 1 ? &out : NULL);
968
969 {
970 JFremantle fremantle(geometry, V, parameters, threads, 2 * threads);
971
972 for (const input_type& superevt : input) {
973
974 const JWeight getWeight(superevt.begin(), superevt.end());
975
977
978 for (input_type::const_iterator evt = superevt.begin(); evt != superevt.end(); ++evt) {
979
980 if (emitters.has(evt->getID())) {
981
982 const JEmitter& emitter = emitters [evt->getID()];
983 const double weight = getWeight(evt->getID());
984
985 for (JEvent::const_iterator i = evt->begin(); i != evt->end(); ++i) {
986
987 if (geometry.hasLocation(receivers[i->getID()])) {
988
989 data.push_back(JHit(emitter,
990 distance(superevt.begin(), evt),
991 receivers[i->getID()],
992 i->getToA(),
994 weight));
995 }
996 }
997 }
998 }
999
1000 if (getMinimumNumberOfEmitters(data.begin(), data.end()) >= parameters.Nmin) {
1001 fremantle.enqueue(data);
1002 }
1003 }
1004 }
1005
1006 return JFremantle::Q.getMean(numeric_limits<float>::max());
1007
1008 } else if (option == 2) { // evaluation of the derivative of the chi2 to each fit parameter
1009
1010 {
1012
1013 JPlatypus platypus(geometry, emitters, V, parameters, in, threads);
1014 }
1015
1016 return JPlatypus::Q.getMean(numeric_limits<float>::max());
1017
1018 } else {
1019
1020 return numeric_limits<float>::max();
1021 }
1022 }
std::vector< T >::difference_type distance(typename std::vector< T >::const_iterator first, typename PhysicsEvent::const_iterator< T > second)
Specialisation of STL distance.
Thread pool for global fits.
static output_type * output
optional output
static JMATH::JQuantile_t Q
chi2/NDF
Thread pool for global fits using super events.
static JMATH::JQuantile_t Q
chi2/NDF
Implementation of object output from STD container.
bool has(const T &value) const
Test whether given value is present.
const JUTMPosition & getUTMPosition() const
Get UTM position.
size_t getMinimumNumberOfEmitters(T __begin, T __end)
Get minimum number of emitters for any string in data.
double getWeight(T __begin, T __end)
Get total weight of data points.
Acoustic emitter.
Definition JEmitter.hh:30
size_t Nmin
minimum number of emitters
double sigma_s
time-of-arrival resolution [s]
Acoustics hit.
std::vector< input_type > input
Definition JSydney.cc:1240
std::vector< JSuperEvt > output
Definition JSydney.cc:1243
Auxiliary data structure to unify weights of acoustics data according to the number of pings per emit...
double getMean() const
Get mean value.
General purpose class for hash map of unique keys.
Definition JHashMap.hh:75

◆ run()

void JACOUSTICS::JSydney::run ( const std::string & script)
inline

Run.

Parameters
scriptsteering script

Definition at line 1030 of file JSydney.cc.

1031 {
1032 using namespace std;
1033 using namespace JPP;
1034
1035 ifstream in(script.c_str());
1036
1037 while (in) {
1038
1039 string buffer, key;
1040
1041 if (getline(in, buffer)) {
1042
1043 if (buffer.empty() || buffer[0] == skip_t) {
1044 continue;
1045 }
1046
1047 istringstream is(buffer);
1048
1049 is >> key;
1050
1051 if (key == initialise_t) { // set object identifiers
1052
1054
1055 } else if (key == fix_t) { // fix object identifiers
1056
1057 string type; // type of object
1058 ids_t id; // identifiers
1059
1060 if (is >> type >> id) {
1061 if (type == string_t) {
1062 fits.strings .fix(id);
1063 fits.hydrophones .fix(id);
1064 fits.transmitters.fix(id);
1065 } else if (type == tripod_t) {
1066 fits.tripods .fix(id);
1067 } else {
1068 THROW(JValueOutOfRange, "Invalid type <" << type << ">");
1069 }
1070 }
1071
1072 } else if (key == stage_t) { // stage
1073
1074 string stage;
1075 JParameters_t input;
1076
1077 if (is >> stage >> input) {
1078
1079 STATUS("stage " << setw(3) << stage << " {" << input << "}" << endl);
1080
1081 JTimer timer;
1082
1083 timer.start();
1084
1085 ofstream out(MAKE_CSTRING("stage-" << stage << ".log"));
1086
1087 {
1088 JRedirectStream redirect(cout, out);
1089
1090 switch (stage[stage.size() - 1]) {
1091
1092 case '0':
1093 stage_0(input);
1094 break;
1095
1096 case 'a':
1097 case 'A':
1098 stage_a(input);
1099 break;
1100
1101 case 'b':
1102 case 'B':
1103 stage_b(input);
1104 break;
1105
1106 case 'c':
1107 case 'C':
1108 stage_c(input);
1109 break;
1110
1111 case 'd':
1112 case 'D':
1113 stage_d(input);
1114 break;
1115
1116 case 'x':
1117 case 'X':
1118 stage_x(input);
1119 break;
1120
1121 default:
1122 THROW(JValueOutOfRange, "Invalid stage <" << stage << ">");
1123 break;
1124 }
1125 }
1126
1127 out.close();
1128
1129 store(stage);
1130 store();
1131
1132 timer.stop();
1133
1134 STATUS("Elapsed time " << FIXED(12,3) << timer.usec_wall * 1.0e-6 << " s." << endl);
1135 }
1136
1137 } else {
1138 THROW(JValueOutOfRange, "Invalid key <" << key << ">");
1139 }
1140 }
1141 }
1142
1143 in.close();
1144 }
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
#define MAKE_CSTRING(A)
Make C-string.
Definition JPrint.hh:72
Auxiliary class for CPU timing and usage.
Definition JTimer.hh:33
unsigned long long usec_wall
Definition JTimer.hh:238
void stop()
Stop timer.
Definition JTimer.hh:127
void start()
Start timer.
Definition JTimer.hh:106
This class can be used to temporarily redirect one output (input) stream to another output (input) st...
Exception for accessing a value in a collection that is outside of its range.
static const std::string string_t
string
Definition JSydney.cc:89
static const std::string tripod_t
tripod
Definition JSydney.cc:90
static const std::string initialise_t
initialise
Definition JSydney.cc:87
static const char skip_t
Script commands.
Definition JSydney.cc:86
static const std::string stage_t
fit stage
Definition JSydney.cc:91
static const std::string fix_t
fix objects
Definition JSydney.cc:88
std::istream & getline(std::istream &in, JString &object)
Read string from input stream until end of line.
Definition JString.hh:478
void fix(const ids_t &B)
Fix.
Definition JSydney.cc:181
void stage_x(const JParameters_t &parameters)
Fit procedure to determine the (x,y,z) positions of the modules.
Definition JSydney.cc:909
void store(const std::string &dir=".")
Store data in given directory.
Definition JSydney.cc:1152
void stage_c(const JParameters_t &parameters)
Fit procedure to determine the z-positions of the modules.
Definition JSydney.cc:855
void stage_0(const JParameters_t &parameters)
Fit procedure to determine the positions of tripods and transmitters using strings that are fixed.
Definition JSydney.cc:672
void stage_d(const JParameters_t &parameters)
Fit procedure to determine the z-positions of anchors.
Definition JSydney.cc:881
void stage_b(const JParameters_t &parameters)
Fit procedure to determine the stretching and z-positions of individual strings.
Definition JSydney.cc:789
void stage_a(const JParameters_t &parameters)
Fit procedure to determine the positions of the strings and tripods.
Definition JSydney.cc:745

◆ store()

void JACOUSTICS::JSydney::store ( const std::string & dir = ".")
inline

Store data in given directory.

Parameters
dirdirectory

Definition at line 1152 of file JSydney.cc.

1153 {
1154 using namespace JPP;
1155
1156 if (getFileStatus(dir.c_str()) || (mkdir(dir.c_str(), S_IRWXU | S_IRWXG) != -1)) {
1157
1158 // attach PMTs
1159
1160 for (JDetector::iterator module = detector.begin(); module != detector.end(); ++module) {
1161 module->set(router->getModule(module->getLocation()).getPosition());
1162 }
1163
1165
1167
1168 if (filenames.hydrophone != "") { setup.hydrophones .store(getFilename(dir, filenames.hydrophone) .c_str()); }
1170
1171 } else {
1172
1173 THROW(JValueOutOfRange, "Invalid directory <" << dir << ">");
1174 }
1175 }
void store(const std::string &file_name, const JDetector &detector)
Store detector to output file.
std::string getFilename(const std::string &file_name)
Get file name part, i.e. part after last JEEP::PATHNAME_SEPARATOR if any.
static JStat getFileStatus
Function object for file status.
Definition JStat.hh:173
void store(const char *file_name) const
Store to output file.

◆ getReceivers()

ids_t JACOUSTICS::JSydney::getReceivers ( ) const
inline

Get list of identifiers of receivers.

Returns
list of identifiers

Definition at line 1183 of file JSydney.cc.

1184 {
1185 ids_t buffer;
1186
1187 for (JDetector::const_iterator i = setup.detector.begin(); i != setup.detector.end(); ++i) {
1188 if ((i->getFloor() != 0 && !i->has(PIEZO_DISABLE)) || (setup.hydrophones.hasString(i->getString()) && !i->has(HYDROPHONE_DISABLE))) {
1189 buffer.insert(i->getID());
1190 }
1191 }
1192
1193 return buffer;
1194 }
static const int HYDROPHONE_DISABLE
Enable (disable) use of hydrophone if this status bit is 0 (1);.
static const int PIEZO_DISABLE
Enable (disable) use of piezo if this status bit is 0 (1);.

◆ getEmitters()

ids_t JACOUSTICS::JSydney::getEmitters ( ) const
inline

Get list of identifiers of emitters.

Returns
list of identifiers

Definition at line 1202 of file JSydney.cc.

1203 {
1204 using namespace std;
1205
1206 ids_t buffer;
1207
1208 for (tripods_container::const_iterator i = setup.tripods.begin(); i != setup.tripods.end(); ++i) {
1209 buffer.insert(i->getID());
1210 }
1211
1212 for (transmitters_container::const_iterator i = setup.transmitters.begin(); i != setup.transmitters.end(); ++i) {
1213
1214 try {
1215
1216 const JModule& module = router->getModule(i->getLocation());
1217
1218 if (!module.has(TRANSMITTER_DISABLE)) {
1219 buffer.insert(i->getID());
1220 }
1221 }
1222 catch(const exception&) {}
1223 }
1224
1225 return buffer;
1226 }
bool has(const int bit) const
Test PMT status.
Definition JStatus.hh:120
static const int TRANSMITTER_DISABLE
Enable (disable) use of transmitter if this status bit is 0 (1);.

Member Data Documentation

◆ RADIUS_M

double JACOUSTICS::JSydney::RADIUS_M = 1.0
staticconstexpr

maximal horizontal distance between T-bar and emitter/hydrophone

Definition at line 136 of file JSydney.cc.

◆ filenames

JFilenames JACOUSTICS::JSydney::filenames

Definition at line 1229 of file JSydney.cc.

◆ V

JSoundVelocity JACOUSTICS::JSydney::V

Definition at line 1230 of file JSydney.cc.

◆ threads

size_t JACOUSTICS::JSydney::threads

Definition at line 1231 of file JSydney.cc.

◆ debug

int JACOUSTICS::JSydney::debug

Definition at line 1232 of file JSydney.cc.

◆ setup

JSetup JACOUSTICS::JSydney::setup

Definition at line 1233 of file JSydney.cc.

◆ fits

fits_t JACOUSTICS::JSydney::fits

Definition at line 1234 of file JSydney.cc.

◆ receivers

JTOOLS::JHashMap<int, JLocation> JACOUSTICS::JSydney::receivers

Definition at line 1236 of file JSydney.cc.

◆ router

std::unique_ptr<JLocationRouter> JACOUSTICS::JSydney::router

Definition at line 1237 of file JSydney.cc.

◆ input

std::vector<input_type> JACOUSTICS::JSydney::input

Definition at line 1240 of file JSydney.cc.

◆ output

std::vector<JSuperEvt> JACOUSTICS::JSydney::output
mutableprivate

Definition at line 1243 of file JSydney.cc.

◆ detector

JDetector JACOUSTICS::JSydney::detector
private

PMTs.

Definition at line 1245 of file JSydney.cc.

◆ parameters

JFitParameters JACOUSTICS::JSydney::parameters
private

Definition at line 1246 of file JSydney.cc.


The documentation for this struct was generated from the following file: