5 #include "dbclient/KM3NeTDBClient.h"
35 static const char*
const RUN_t =
"RUN";
40 struct calibration_type :
53 const_iterator p = find_if(this->begin(), this->end(),
make_predicate(&APIV2::JRunCalibration_t::CalibrationType, type));
56 return p->CalibrationId;
71 int main(
int argc,
char **argv)
90 JParser<> zap(
"Auxiliary program to download official detector.");
98 zap[
'R'] =
make_field(ranking,
"ranking (1 is best)") = 1;
99 zap[
'V'] =
make_field(variant,
"detector version") = getDetectorVersions<string>();
101 zap[
'F'] =
make_field(format,
"column names: "
113 catch(
const exception &error) {
114 FATAL(error.what() << endl);
121 detid = getDetector<string>(detid);
127 DEBUG(setw(2) << js << endl);
130 FATAL(
"JSon error code not okay." << endl);
134 FATAL(
"JSon output does not contain data." << endl);
137 const calibration_type calibration = js[
Data_t].get<calibration_type>();
140 for (
const auto& element : calibration) {
141 cout << setw(24) << left << element.CalibrationType <<
' ' << right << element.CalibrationId << endl;
174 for (
const auto& element : calibration) {
183 ERROR(
"Invalid JSon data " << setw(2) << buffer);
188 if (!format.empty()) {
195 cout <<
' ' << calibration[*
i];
201 catch(
const exception& error) {
202 FATAL(error.what() << endl);
Utility class to parse command line options.
static void reset()
Reset connection to database.
JPredicate< JResult_t T::*, JComparison::eq > make_predicate(JResult_t T::*member, const JResult_t value)
Helper method to create predicate for data member.
int main(int argc, char *argv[])
static const std::string STATUS_CALIBRATION_t
(module|PMT) status
bool is_valid(const json &js)
Check validity of JSon data.
static const std::string DOM_ROTATION_CALIBRATION_t
optical module orientations
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
bool setToLatestVersion()
Set to latest version.
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Auxiliary data structure for correspondence between nick and full name of calibration types...
const std::string & getVersion() const
Get version.
Data structure for detector geometry and calibration.
#define MAKE_STRING(A)
Make string.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
static const std::string PMT_T0_CALIBRATION_t
PMT time offsets.
static const std::string COMPASS_CALIBRATION_t
compass alignment (a.k.a. quaternion calibration)
void store(const std::string &file_name, const JDetector &detector)
Store detector to output file.
JSon definitions and auxiliaries.
General purpose messaging.
static const JGetDetectorVersion getDetectorVersion
Function object to map detector version to numerical value.
static const std::string DOM_POSITION_CALIBRATION_t
(optical|base) module positions
std::string setWildCard(const std::string &file_name, const std::string &value)
Get file name by setting wild card to given value.
const std::string & getNickname(const std::string &type) const
Get calibration type.
static const std::string Data_t
Utility class to parse command line options.
std::vector< JServer > getServernames()
Get list of names of available database servers.
Wrapper class for server name.
static const char FILENAME_WILD_CARD
wild card character for file name substitution
const char * getName()
Get ROOT name of given data type.
do set_variable DETECTOR_TXT $WORKDIR detector
void to_json(json &js, const std::string &query)
Get result set.
static const std::string ACOUSTIC_T0_CALIBRATION_t
acoustic time offsets (piezo sensor or hydrophone)
Template definition for getting table specific selector.
#define DEBUG(A)
Message macros.
bool hasWildCard(const std::string &file_name)
Check presence of wild card.
static JDB & get()
Get connection to database.