Jpp 19.3.0-rc.1
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 150 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 599 of file JSydney.cc.

602 :
604 V(V),
606 debug(debug)
607 {
609
611
612 if (filenames.hydrophone != "") { setup.hydrophones .load(filenames.hydrophone .c_str()); }
614
615 for (JDetector::const_iterator i = setup.detector.begin(); i != setup.detector.end(); ++i) {
616 receivers[i->getID()] = i->getLocation();
617 }
618
619 // detach PMTs
620
622
623 for (JDetector::iterator module = setup.detector.begin(); module != setup.detector.end(); ++module) {
624 module->clear();
625 }
626
628
630
631 this->V.set(setup.detector.getUTMZ()); // sound velocity at detector depth
632
635
637
638 ROOT::EnableThreadSafety();
639 }
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:117
std::string detector
detector
Definition JSydney.cc:114
std::string hydrophone
hydrophone
Definition JSydney.cc:116
std::string tripod
tripod
Definition JSydney.cc:115
Template definition of fit function of acoustic model.
tripods_container tripods
tripods
Definition JSydney.cc:126
hydrophones
hydrophones
transmitters_container transmitters
transmitters
Definition JSydney.cc:143
JDetector detector
detector
Definition JSydney.cc:125
JSoundVelocity & set(const double z0)
Set depth.
void initialise(const JSetup &setup)
Initialise.
Definition JSydney.cc:262
JFilenames filenames
Definition JSydney.cc:1245
std::unique_ptr< JLocationRouter > router
Definition JSydney.cc:1253
JTOOLS::JHashMap< int, JLocation > receivers
Definition JSydney.cc:1252
JSoundVelocity V
Definition JSydney.cc:1246
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 688 of file JSydney.cc.

689 {
690 using namespace std;
691 using namespace JPP;
692
693 this->parameters = parameters;
694
695 JDetector A; // old strings
696 detector_type B; // new strings with transmitter -> fit only base module
697 JDetector C; // new strings w/o transmitter -> discard completely from fit
698
699 for (JDetector::iterator module = setup.detector.begin(); module != setup.detector.end(); ++module) {
700
701 if (fits.strings .count(module->getString()) == 0)
702 A.push_back(*module);
703 else if (fits.transmitters.count(module->getString()) != 0)
704 B.push_back(*module);
705 else
706 C.push_back(*module);
707 }
708
709 setup.detector.swap(A);
710
711 for (const auto& element : B) {
712 setup.detector.push_back(element.second.base);
713 }
714
716
717 JGradient fit(parameters.Nmax, parameters.Nextra, parameters.epsilon, parameters.debug);
718
719 for (const int i : fits.tripods) {
720 fit.push_back(JModifier_t(MAKE_STRING(LEFT(16) << "tripod.x: " << RIGHT(4) << i), new JTripodEditor(setup, i, JVector3X_t), parameters.steps[0]));
721 fit.push_back(JModifier_t(MAKE_STRING(LEFT(16) << "tripod.y: " << RIGHT(4) << i), new JTripodEditor(setup, i, JVector3Y_t), parameters.steps[0]));
722 fit.push_back(JModifier_t(MAKE_STRING(LEFT(16) << "tripod.z: " << RIGHT(4) << i), new JTripodEditor(setup, i, JVector3Z_t), parameters.steps[0]));
723 }
724
725 for (const int i : fits.transmitters) {
726 fit.push_back(JModifier_t(MAKE_STRING(LEFT(16) << "transmitter.x: " << RIGHT(4) << i), new JStringEditor(setup, i, JVector3X_t, true), parameters.steps[0]));
727 fit.push_back(JModifier_t(MAKE_STRING(LEFT(16) << "transmitter.y: " << RIGHT(4) << i), new JStringEditor(setup, i, JVector3Y_t, true), parameters.steps[0]));
728 fit.push_back(JModifier_t(MAKE_STRING(LEFT(16) << "transmitter.z: " << RIGHT(4) << i), new JStringEditor(setup, i, JVector3Z_t, true), parameters.steps[0]));
729 }
730
731 const double chi2 = fit(*this);
732
733 for (auto& element : B) {
734
735 const JModule& base = setup.detector.getModule(router->getAddress(JLocation(element.second.base.getString(),0)));
736 const JVector3D pos = base.getPosition() - element.second.base.getPosition();
737
738 for (string_type::iterator module = element.second.begin(); module != element.second.end(); ++module) {
739
740 module->add(pos);
741
742 setup.detector.push_back(*module);
743 }
744 }
745
746 copy(C.begin(), C.end(), back_inserter(setup.detector));
747
748 sort(setup.detector.begin(), setup.detector.end(), make_comparator(&JModule::getLocation));
749
751
752 STATUS("detector: " << FIXED(9,4) << chi2 << endl);
753 }
#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:163
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:275
ids_t tripods
identifiers of tripods
Definition JSydney.cc:273
ids_t strings
identifiers of strings
Definition JSydney.cc:272
JFitParameters parameters
Definition JSydney.cc:1262
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 761 of file JSydney.cc.

762 {
763 using namespace std;
764 using namespace JPP;
765
766 this->parameters = parameters;
767
768 JGradient fit(parameters.Nmax, parameters.Nextra, parameters.epsilon, parameters.debug);
769
770 for (const int i : fits.strings) {
771 fit.push_back(JModifier_t(MAKE_STRING(LEFT(16) << "string.x: " << RIGHT(4) << i), new JStringEditor(setup, i, JVector3X_t, true), parameters.steps[0]));
772 fit.push_back(JModifier_t(MAKE_STRING(LEFT(16) << "string.y: " << RIGHT(4) << i), new JStringEditor(setup, i, JVector3Y_t, true), parameters.steps[0]));
773 fit.push_back(JModifier_t(MAKE_STRING(LEFT(16) << "string.z: " << RIGHT(4) << i), new JStringEditor(setup, i, JVector3Z_t, false), parameters.steps[0]));
774 }
775
776 for (const int i : fits.tripods) {
777 fit.push_back(JModifier_t(MAKE_STRING(LEFT(16) << "tripod.x: " << RIGHT(4) << i), new JTripodEditor(setup, i, JVector3X_t), parameters.steps[1]));
778 fit.push_back(JModifier_t(MAKE_STRING(LEFT(16) << "tripod.y: " << RIGHT(4) << i), new JTripodEditor(setup, i, JVector3Y_t), parameters.steps[1]));
779 fit.push_back(JModifier_t(MAKE_STRING(LEFT(16) << "tripod.z: " << RIGHT(4) << i), new JTripodEditor(setup, i, JVector3Z_t), parameters.steps[1]));
780 }
781
782 for (const int i : ids_t(fits.hydrophones, fits.transmitters)) {
783 fit.push_back(JModifier_t(MAKE_STRING(LEFT(16) << "anchor.R: " << RIGHT(4) << i), new JAnchorEditor(setup, i), parameters.steps[0] / RADIUS_M));
784 }
785
786 for (const int i : fits.transmitters) {
787
788 JModule& module = setup.detector.getModule(router->getAddress(JLocation(i,0)));
789
790 fit.push_back(JModifier_t(MAKE_STRING(LEFT(16) << "anchor.R: " << RIGHT(4) << i), new JAnchorEditor(setup, i), parameters.steps[0] / RADIUS_M));
791 fit.push_back(JModifier_t(MAKE_STRING(LEFT(16) << "anchor.z: " << RIGHT(4) << i), new JModuleEditor(module), parameters.steps[0]));
792 }
793
794 const double chi2 = fit(*this);
795
796 STATUS("detector: " << FIXED(9,4) << chi2 << endl);
797 }
ids_t hydrophones
identifiers of strings with hydrophone
Definition JSydney.cc:274
static constexpr double RADIUS_M
maximal horizontal distance between T-bar and emitter/hydrophone
Definition JSydney.cc:152

◆ 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 805 of file JSydney.cc.

806 {
807 using namespace std;
808 using namespace JPP;
809
810 this->parameters = parameters;
811
812 map<int, JDetector> buffer;
813
814 double z0 = 0.0;
815
816 for (JDetector::iterator module = setup.detector.begin(); module != setup.detector.end(); ++module) {
817
818 buffer[module->getString()].push_back(*module);
819
820 if (module->getZ() > z0) {
821 z0 = module->getZ();
822 }
823 }
824
825 JDetector tx;
826
827 for (transmitters_container::iterator i = setup.transmitters.begin(); i != setup.transmitters.end(); ++i) {
828 try {
829 tx.push_back(router->getModule(i->getLocation()));
830 }
831 catch(const exception&) {}
832 }
833
834 for (const int i : fits.strings) {
835
836 setup.detector.swap(buffer[i]);
837
838 copy(tx.begin(), tx.end(), back_inserter(setup.detector));
839
841
842 JGradient fit(parameters.Nmax, parameters.Nextra, parameters.epsilon, parameters.debug);
843
844 fit.push_back(JModifier_t(MAKE_STRING(LEFT(16) << "string.M: " << RIGHT(4) << i), new JDyneemaEditor(setup, i, z0), parameters.steps[0]));
845 fit.push_back(JModifier_t(MAKE_STRING(LEFT(16) << "string.z: " << RIGHT(4) << i), new JStringEditor (setup, i, JVector3Z_t, false), parameters.steps[1]));
846
847 const double chi2 = fit(*this);
848
849 STATUS("string: " << setw(4) << i << ' ' << FIXED(9,4) << chi2 << endl);
850
851 buffer[i].clear();
852
853 copy_if(setup.detector.begin(), setup.detector.end(), back_inserter(buffer[i]), make_predicate(&JModule::getString, i));
854 }
855
856 setup.detector.clear();
857
858 for (const auto& element : buffer) {
859 copy(element.second.begin(), element.second.end(), back_inserter(setup.detector));
860 }
861
863 }
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 871 of file JSydney.cc.

872 {
873 using namespace std;
874 using namespace JPP;
875
876 this->parameters = parameters;
877
878 JGradient fit(parameters.Nmax, parameters.Nextra, parameters.epsilon, parameters.debug);
879
880 for (JDetector::iterator module = setup.detector.begin(); module != setup.detector.end(); ++module) {
881 if (fits.strings.count(module->getString()) != 0 && module->getFloor() != 0) {
882 fit.push_back(JModifier_t(MAKE_STRING(LEFT(16) << "module.z: " << right << module->getLocation()), new JModuleEditor(*module), parameters.steps[0]));
883 }
884 }
885
886 const double chi2 = fit(*this);
887
888 STATUS("detector: " << FIXED(9,4) << chi2 << endl);
889 }

◆ 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 897 of file JSydney.cc.

898 {
899 using namespace std;
900 using namespace JPP;
901
902 this->parameters = parameters;
903
904 JGradient fit(parameters.Nmax, parameters.Nextra, parameters.epsilon, parameters.debug);
905
906 for (JDetector::iterator module = setup.detector.begin(); module != setup.detector.end(); ++module) {
907 if (fits.strings.count(module->getString()) != 0 && module->getFloor() == 0) {
908 fit.push_back(JModifier_t(MAKE_STRING(LEFT(16) << "module.z: " << right << module->getLocation()), new JModuleEditor(*module), parameters.steps[0]));
909 }
910 }
911
912 const double chi2 = fit(*this);
913
914 STATUS("detector: " << FIXED(9,4) << chi2 << endl);
915 }

◆ 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 925 of file JSydney.cc.

926 {
927 using namespace std;
928 using namespace JPP;
929
930 this->parameters = parameters;
931
932 JGradient fit(parameters.Nmax, parameters.Nextra, parameters.epsilon, parameters.debug);
933
934 for (JDetector::iterator module = setup.detector.begin(); module != setup.detector.end(); ++module) {
935 if (fits.strings.count(module->getString()) != 0 && module->getFloor() != 0) {
936 fit.push_back(JModifier_t(MAKE_STRING(LEFT(16) << "module.x: " << right << module->getLocation()), new JModuleEditor(*module, JVector3X_t), parameters.steps[0]));
937 fit.push_back(JModifier_t(MAKE_STRING(LEFT(16) << "module.y: " << right << module->getLocation()), new JModuleEditor(*module, JVector3Y_t), parameters.steps[0]));
938 fit.push_back(JModifier_t(MAKE_STRING(LEFT(16) << "module.z: " << right << module->getLocation()), new JModuleEditor(*module, JVector3Z_t), parameters.steps[0]));
939 }
940 }
941
942 const double chi2 = fit(*this);
943
944 STATUS("detector: " << FIXED(9,4) << chi2 << endl);
945 }

◆ operator()()

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

Get chi2.

Parameters
optionoption
Returns
chi2/NDF

Definition at line 954 of file JSydney.cc.

955 {
956 using namespace std;
957 using namespace JPP;
958
959 const JGeometry geometry(setup.detector, setup.hydrophones);
960
962
963 for (tripods_container::const_iterator i = setup.tripods.begin(); i != setup.tripods.end(); ++i) {
964 {
965 emitters[i->getID()] = JEmitter(i->getID(), i->getUTMPosition() - setup.detector.getUTMPosition());
966 }
967 }
968
969 for (transmitters_container::const_iterator i = setup.transmitters.begin(); i != setup.transmitters.end(); ++i) {
970 try {
971 emitters[i->getID()] = JEmitter(i->getID(), i->getPosition() + router->getModule(i->getLocation()).getPosition());
972 }
973 catch(const exception&) {} // if no module available, discard transmitter
974 }
975
976 if (option == 0 || // step wise improvement of the chi2
977 option == 1) { // evaluation of the chi2 before the determination of the gradient of the chi2
978
979 this->output.clear();
980
981 JSTDObjectWriter<JSuperEvt> out(this->output); // write data for subsequent use
982
983 JFremantle::output = (option == 1 ? &out : NULL);
984
985 {
986 JFremantle fremantle(geometry, V, parameters, threads, 2 * threads);
987
988 for (const input_type& superevt : input) {
989
990 const JWeight getWeight(superevt.begin(), superevt.end());
991
993
994 for (input_type::const_iterator evt = superevt.begin(); evt != superevt.end(); ++evt) {
995
996 if (emitters.has(evt->getID())) {
997
998 const JEmitter& emitter = emitters [evt->getID()];
999 const double weight = getWeight(evt->getID());
1000
1001 for (JEvent::const_iterator i = evt->begin(); i != evt->end(); ++i) {
1002
1003 if (geometry.hasLocation(receivers[i->getID()])) {
1004
1005 data.push_back(JHit(emitter,
1006 distance(superevt.begin(), evt),
1007 receivers[i->getID()],
1008 i->getToA(),
1010 weight));
1011 }
1012 }
1013 }
1014 }
1015
1016 if (getMinimumNumberOfEmitters(data.begin(), data.end()) >= parameters.Nmin) {
1017 fremantle.enqueue(data);
1018 }
1019 }
1020 }
1021
1022 return JFremantle::Q.getMean(numeric_limits<float>::max());
1023
1024 } else if (option == 2) { // evaluation of the derivative of the chi2 to each fit parameter
1025
1026 {
1028
1029 JPlatypus platypus(geometry, emitters, V, parameters, in, threads);
1030 }
1031
1032 return JPlatypus::Q.getMean(numeric_limits<float>::max());
1033
1034 } else {
1035
1036 return numeric_limits<float>::max();
1037 }
1038 }
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:1256
std::vector< JSuperEvt > output
Definition JSydney.cc:1259
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 1046 of file JSydney.cc.

1047 {
1048 using namespace std;
1049 using namespace JPP;
1050
1051 ifstream in(script.c_str());
1052
1053 while (in) {
1054
1055 string buffer, key;
1056
1057 if (getline(in, buffer)) {
1058
1059 if (buffer.empty() || buffer[0] == skip_t) {
1060 continue;
1061 }
1062
1063 istringstream is(buffer);
1064
1065 is >> key;
1066
1067 if (key == initialise_t) { // set object identifiers
1068
1070
1071 } else if (key == fix_t) { // fix object identifiers
1072
1073 string type; // type of object
1074 ids_t id; // identifiers
1075
1076 if (is >> type >> id) {
1077 if (type == string_t) {
1078 fits.strings .fix(id);
1079 fits.hydrophones .fix(id);
1080 fits.transmitters.fix(id);
1081 } else if (type == tripod_t) {
1082 fits.tripods .fix(id);
1083 } else {
1084 THROW(JValueOutOfRange, "Invalid type <" << type << ">");
1085 }
1086 }
1087
1088 } else if (key == stage_t) { // stage
1089
1090 string stage;
1091 JParameters_t input;
1092
1093 if (is >> stage >> input) {
1094
1095 STATUS("stage " << setw(3) << stage << " {" << input << "}" << endl);
1096
1097 JTimer timer;
1098
1099 timer.start();
1100
1101 ofstream out(MAKE_CSTRING("stage-" << stage << ".log"));
1102
1103 {
1104 JRedirectStream redirect(cout, out);
1105
1106 switch (stage[stage.size() - 1]) {
1107
1108 case '0':
1109 stage_0(input);
1110 break;
1111
1112 case 'a':
1113 case 'A':
1114 stage_a(input);
1115 break;
1116
1117 case 'b':
1118 case 'B':
1119 stage_b(input);
1120 break;
1121
1122 case 'c':
1123 case 'C':
1124 stage_c(input);
1125 break;
1126
1127 case 'd':
1128 case 'D':
1129 stage_d(input);
1130 break;
1131
1132 case 'x':
1133 case 'X':
1134 stage_x(input);
1135 break;
1136
1137 default:
1138 THROW(JValueOutOfRange, "Invalid stage <" << stage << ">");
1139 break;
1140 }
1141 }
1142
1143 out.close();
1144
1145 store(stage);
1146 store();
1147
1148 timer.stop();
1149
1150 STATUS("Elapsed time " << FIXED(12,3) << timer.usec_wall * 1.0e-6 << " s." << endl);
1151 }
1152
1153 } else {
1154 THROW(JValueOutOfRange, "Invalid key <" << key << ">");
1155 }
1156 }
1157 }
1158
1159 in.close();
1160 }
#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:90
static const std::string tripod_t
tripod
Definition JSydney.cc:91
static const std::string initialise_t
initialise
Definition JSydney.cc:88
static const char skip_t
Script commands.
Definition JSydney.cc:87
static const std::string stage_t
fit stage
Definition JSydney.cc:92
static const std::string fix_t
fix objects
Definition JSydney.cc:89
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:197
void stage_x(const JParameters_t &parameters)
Fit procedure to determine the (x,y,z) positions of the modules.
Definition JSydney.cc:925
void store(const std::string &dir=".")
Store data in given directory.
Definition JSydney.cc:1168
void stage_c(const JParameters_t &parameters)
Fit procedure to determine the z-positions of the modules.
Definition JSydney.cc:871
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:688
void stage_d(const JParameters_t &parameters)
Fit procedure to determine the z-positions of anchors.
Definition JSydney.cc:897
void stage_b(const JParameters_t &parameters)
Fit procedure to determine the stretching and z-positions of individual strings.
Definition JSydney.cc:805
void stage_a(const JParameters_t &parameters)
Fit procedure to determine the positions of the strings and tripods.
Definition JSydney.cc:761

◆ store()

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

Store data in given directory.

Parameters
dirdirectory

Definition at line 1168 of file JSydney.cc.

1169 {
1170 using namespace JPP;
1171
1172 if (getFileStatus(dir.c_str()) || (mkdir(dir.c_str(), S_IRWXU | S_IRWXG) != -1)) {
1173
1174 // attach PMTs
1175
1176 for (JDetector::iterator module = detector.begin(); module != detector.end(); ++module) {
1177 module->set(router->getModule(module->getLocation()).getPosition());
1178 }
1179
1181
1183
1184 if (filenames.hydrophone != "") { setup.hydrophones .store(getFilename(dir, filenames.hydrophone) .c_str()); }
1186
1187 } else {
1188
1189 THROW(JValueOutOfRange, "Invalid directory <" << dir << ">");
1190 }
1191 }
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 1199 of file JSydney.cc.

1200 {
1201 ids_t buffer;
1202
1203 for (JDetector::const_iterator i = setup.detector.begin(); i != setup.detector.end(); ++i) {
1204 if ((i->getFloor() != 0 && !i->has(PIEZO_DISABLE)) || (setup.hydrophones.hasString(i->getString()) && !i->has(HYDROPHONE_DISABLE))) {
1205 buffer.insert(i->getID());
1206 }
1207 }
1208
1209 return buffer;
1210 }
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 1218 of file JSydney.cc.

1219 {
1220 using namespace std;
1221
1222 ids_t buffer;
1223
1224 for (tripods_container::const_iterator i = setup.tripods.begin(); i != setup.tripods.end(); ++i) {
1225 buffer.insert(i->getID());
1226 }
1227
1228 for (transmitters_container::const_iterator i = setup.transmitters.begin(); i != setup.transmitters.end(); ++i) {
1229
1230 try {
1231
1232 const JModule& module = router->getModule(i->getLocation());
1233
1234 if (!module.has(TRANSMITTER_DISABLE)) {
1235 buffer.insert(i->getID());
1236 }
1237 }
1238 catch(const exception&) {}
1239 }
1240
1241 return buffer;
1242 }
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 152 of file JSydney.cc.

◆ filenames

JFilenames JACOUSTICS::JSydney::filenames

Definition at line 1245 of file JSydney.cc.

◆ V

JSoundVelocity JACOUSTICS::JSydney::V

Definition at line 1246 of file JSydney.cc.

◆ threads

size_t JACOUSTICS::JSydney::threads

Definition at line 1247 of file JSydney.cc.

◆ debug

int JACOUSTICS::JSydney::debug

Definition at line 1248 of file JSydney.cc.

◆ setup

JSetup JACOUSTICS::JSydney::setup

Definition at line 1249 of file JSydney.cc.

◆ fits

fits_t JACOUSTICS::JSydney::fits

Definition at line 1250 of file JSydney.cc.

◆ receivers

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

Definition at line 1252 of file JSydney.cc.

◆ router

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

Definition at line 1253 of file JSydney.cc.

◆ input

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

Definition at line 1256 of file JSydney.cc.

◆ output

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

Definition at line 1259 of file JSydney.cc.

◆ detector

JDetector JACOUSTICS::JSydney::detector
private

PMTs.

Definition at line 1261 of file JSydney.cc.

◆ parameters

JFitParameters JACOUSTICS::JSydney::parameters
private

Definition at line 1262 of file JSydney.cc.


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