Jpp 20.0.0-195-g190c9e876
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 JDetectorMechanics_t &mechanics, 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 151 of file JSydney.cc.

Member Typedef Documentation

◆ input_type

Constructor & Destructor Documentation

◆ JSydney()

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

Constructor.

Parameters
filenamesfile names
mechanicsmechanical model parameters
Vsound velocity
threadsthreads
debugdebug

Definition at line 601 of file JSydney.cc.

605 :
607 V(V),
609 debug(debug)
610 {
612
613 setup.mechanics = mechanics;
615
616 if (filenames.hydrophone != "") { setup.hydrophones .load(filenames.hydrophone .c_str()); }
618
619 for (JDetector::const_iterator i = setup.detector.begin(); i != setup.detector.end(); ++i) {
620 receivers[i->getID()] = i->getLocation();
621 }
622
623 // detach PMTs
624
626
627 for (JDetector::iterator module = setup.detector.begin(); module != setup.detector.end(); ++module) {
628 module->clear();
629 }
630
632
634
635 this->V.set(setup.detector.getUTMZ()); // sound velocity at detector depth
636
639
641
642 ROOT::EnableThreadSafety();
643 }
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:127
hydrophones
hydrophones
JDetectorMechanics_t mechanics
mechanical model
Definition JSydney.cc:126
transmitters_container transmitters
transmitters
Definition JSydney.cc:144
JDetector detector
detector
Definition JSydney.cc:125
JSoundVelocity & set(const double z0)
Set depth.
void initialise(const JSetup &setup)
Initialise.
Definition JSydney.cc:263
JFilenames filenames
Definition JSydney.cc:1249
std::unique_ptr< JLocationRouter > router
Definition JSydney.cc:1257
JTOOLS::JHashMap< int, JLocation > receivers
Definition JSydney.cc:1256
JSoundVelocity V
Definition JSydney.cc:1250
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 692 of file JSydney.cc.

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

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

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

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

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

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

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

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

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

◆ operator()()

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

Get chi2.

Parameters
optionoption
Returns
chi2/NDF

Definition at line 958 of file JSydney.cc.

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

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

◆ store()

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

Store data in given directory.

Parameters
dirdirectory

Definition at line 1172 of file JSydney.cc.

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

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

1223 {
1224 using namespace std;
1225
1226 ids_t buffer;
1227
1228 for (tripods_container::const_iterator i = setup.tripods.begin(); i != setup.tripods.end(); ++i) {
1229 buffer.insert(i->getID());
1230 }
1231
1232 for (transmitters_container::const_iterator i = setup.transmitters.begin(); i != setup.transmitters.end(); ++i) {
1233
1234 try {
1235
1236 const JModule& module = router->getModule(i->getLocation());
1237
1238 if (!module.has(TRANSMITTER_DISABLE)) {
1239 buffer.insert(i->getID());
1240 }
1241 }
1242 catch(const exception&) {}
1243 }
1244
1245 return buffer;
1246 }
bool has(const int bit) const
Test PMT status.
Definition JStatus.hh:198
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 153 of file JSydney.cc.

◆ filenames

JFilenames JACOUSTICS::JSydney::filenames

Definition at line 1249 of file JSydney.cc.

◆ V

JSoundVelocity JACOUSTICS::JSydney::V

Definition at line 1250 of file JSydney.cc.

◆ threads

size_t JACOUSTICS::JSydney::threads

Definition at line 1251 of file JSydney.cc.

◆ debug

int JACOUSTICS::JSydney::debug

Definition at line 1252 of file JSydney.cc.

◆ setup

JSetup JACOUSTICS::JSydney::setup

Definition at line 1253 of file JSydney.cc.

◆ fits

fits_t JACOUSTICS::JSydney::fits

Definition at line 1254 of file JSydney.cc.

◆ receivers

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

Definition at line 1256 of file JSydney.cc.

◆ router

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

Definition at line 1257 of file JSydney.cc.

◆ input

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

Definition at line 1260 of file JSydney.cc.

◆ output

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

Definition at line 1263 of file JSydney.cc.

◆ detector

JDetector JACOUSTICS::JSydney::detector
private

PMTs.

Definition at line 1265 of file JSydney.cc.

◆ parameters

JFitParameters JACOUSTICS::JSydney::parameters
private

Definition at line 1266 of file JSydney.cc.


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