54 JParser<> zap(
"Auxiliary program to print detector from database.");
59 zap[
'D'] =
make_field(
id,
"detector identifier") =
"";
61 zap[
't'] =
make_field(tcalset,
"tcal: t0 (time offsets) calibration set from DB") =
"";
62 zap[
'p'] =
make_field(pcalset,
"pcal: position (x,y,z) calibration set from DB") =
"";
63 zap[
'q'] =
make_field(rcalset,
"rcal: orientation (quarterions) calibration set from DB") =
"";
71 catch(
const exception &error) {
72 FATAL(error.what() << endl);
76 const int file = ((detectorFile !=
"" ? 1 : 0));
77 const int calset = ((tcalset.empty() ? 0 : 1) +
78 (pcalset.empty() ? 0 : 1) +
79 (rcalset.empty() ? 0 : 1));
80 const int daq = ((run != -1 ? 1 : 0));
82 if (file != 0 && (file != 1)) {
FATAL(
"Inconsistent specificaton of detector file."); }
83 if (calset != 0 && (calset != 3 ||
id ==
"")) {
FATAL(
"Inconsistent specificaton of detector identifier, tcal, pcal and rcal calibration sets."); }
84 if (daq != 0 && (daq != 1 ||
id ==
"")) {
FATAL(
"Inconsistent specificaton of detector identifier and run number."); }
88 if (file == 1) { ++np; }
89 if (calset == 3) { ++np; }
90 if (daq == 1) { ++np; }
92 if (np != 1) {
FATAL(
"Specify detector file; OR detector identifier, tcal, pcal and rcal calibration set; OR detector identifier and run number."); }
98 catch(
const exception& error) {
99 FATAL(error.what() << endl);
108 else if (calset == 3)
109 *(
JDB::get()->DetX)(
id.c_str(), tcalset.c_str(), pcalset.c_str(), rcalset.c_str()) >>
detector;
113 catch(
const exception& error) {
114 FATAL(error.what() << endl);
119 if (
detector.setToLatestVersion()) {
120 NOTICE(
"Set detector version to " <<
detector.getVersion() << endl);
131 selector.
add(&JCLBMap::FLOORID, 0);
133 ResultSet& rs =
getResultSet(getTable<JCLBMap>(), selector);
139 catch(
const exception& error) {
140 FATAL(error.what() << endl);
145 for (JDetector::const_iterator module =
detector.begin(); module !=
detector.end(); ++module) {
146 zmap[module->getString()][module->getFloor()] = module->getPosition();
153 if (i->FLOORID == 0 && p ==
detector.end()) {
157 module.setPosition(
JPosition3D(zmap[i->DUID].begin()->second.getX(),
158 zmap[i->DUID].begin()->second.getY(),
161 const double t0 = 0.0;
165 NOTICE(
"Adding module " << module << endl);
Utility class to parse command line options.
JPredicate< JResult_t T::*, JComparison::eq > make_predicate(JResult_t T::*member, const JResult_t value)
Helper method to create predicate for data member.
Data structure for a composite optical module.
static const double HYDROPHONE_DELAYTIME_US
Hydrophone delay time [us].
static const double TBARZ_M
T-bar position relative to seabed [m].
T get(const JHead &header)
Get object from header.
Auxiliary class for specifying selection of database data.
JDetectorsHelper getDetector
Function object for mapping serial number to object identifier of detector and vice versa...
Logical location of module.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
JSelector & add(const JSelector &selection)
Add selection.
void store(const std::string &file_name, const JDetector &detector)
Store detector to output file.
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
ResultSet & getResultSet(const std::string &query)
Get result set.
Data structure for position in three dimensions.
do set_variable DETECTOR_TXT $WORKDIR detector
Template definition for getting table specific selector.