30 int main(
int argc,
char **argv)
46 JParser<> zap(
"Auxiliary program to download default detector from database.");
52 zap[
'D'] =
make_field(
id,
"detector identifier");
54 zap[
'V'] =
make_field(variant,
"detector version") = getDetectorVersions<string>();
59 catch(
const exception &error) {
60 FATAL(error.what() << endl);
68 id = getDetector<string>(id);
70 ResultSet& rs =
getResultSet(getTable<JDetCalibrations>(), getSelector<JDetCalibrations>(
id));
74 for (JDetCalibrations buffer; rs >> buffer; ) {
78 if (calibration.count(type) == 0 || calibration[
type].STARTTIME < buffer.STARTTIME) {
79 calibration[
type] = buffer;
87 detector.comment.add(JMeta(argc,argv));
91 if (calibration.count(key) == 0) {
92 FATAL(
"Missing " << key <<
" calibration." << endl);
95 detector.comment.add(
MAKE_STRING(key <<
" = " << calibration[key].OPERATIONID));
98 *(JDB::get()->DetX)(
id.c_str(),
99 calibration[
TCAL].OPERATIONID.c_str(),
100 calibration[
PCAL].OPERATIONID.c_str(),
101 calibration[
RCAL].OPERATIONID.c_str(),
102 calibration[
ACAL].OPERATIONID.c_str(),
103 calibration[
CCAL].OPERATIONID.c_str(),
104 calibration[
SCAL].OPERATIONID.c_str(),
109 catch(
const exception& error) {
110 FATAL(error.what() << endl);
Utility class to parse command line options.
int main(int argc, char *argv[])
static const std::string ACAL
acoustic time offsets (piezo sensor or hydrophone)
static const std::string CCAL
compass alignment (a.k.a. quaternion calibration)
Data structure for detector geometry and calibration.
#define MAKE_STRING(A)
Make string.
then set_variable PMT_FILE set_variable DAQ_FILE set_variable OUTPUT_FILE set_variable DETECTOR else fatal Wrong number of arguments fi JPrintTree f $DAQ_FILE type
static const std::string TCAL
PMT time offsets.
I/O formatting auxiliaries.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
void store(const std::string &file_name, const JDetector &detector)
Store detector to output file.
JSon definitions and auxiliaries.
static const std::string RCAL
optical module orientations
General purpose messaging.
static const JGetDetectorVersion getDetectorVersion
Function object to map detector version to numerical value.
const std::string & getNickname(const std::string &type) const
Get calibration type.
Utility class to parse command line options.
static const std::string SCAL
(module|PMT) status
ResultSet & getResultSet(const std::string &query)
Get result set.
std::vector< JServer > getServernames()
Get list of names of available database servers.
do set_variable DETECTOR_TXT $WORKDIR detector
static const std::string PCAL
(optical|base) module positions
JSON::getCalibrationType getCalibrationType