64 static const char*
const NOPIEZO =
"NOPIEZO";
95 JParser<> zap(
"Auxiliary program to download or update detector from database.");
111 zap[
'W'] =
make_field(
wizzard,
"-W add base modules; -WW set time offsets of acoustic sensors");
117 catch(
const exception &error) {
127 FATAL(
"Invalid calibration set \"" << i->getKey() <<
"\"" <<
endl);
135 FATAL(
"Inconsistent specificaton of calibration sets, either {}, {t,p,r}cal or {t,p,r,a,c,s}cal.");
151 const bool daq = (run != -1);
153 if (file &&
id !=
"") {
FATAL(
"Inconsistent specificaton of detector file and detector identifier."); }
154 if (file &&
tpr) {
FATAL(
"Inconsistent specificaton of detector file and {t,p,r}cal calibration sets."); }
155 if (file &&
tpracs) {
FATAL(
"Inconsistent specificaton of detector file and {t,p,r,a,c,s}cal calibration sets."); }
156 if (file && daq) {
FATAL(
"Inconsistent specificaton of detector file and run number."); }
158 if (
tpr &&
id ==
"") {
FATAL(
"Inconsistent specificaton of {t,p,r}cal calibration sets and no detector identifier."); }
159 if (
tpr && variant !=
"") {
FATAL(
"Inconsistent specificaton of {t,p,r}cal calibration sets and variant."); }
160 if (
tpr && daq) {
FATAL(
"Inconsistent specificaton of {t,p,r}cal calibration sets and run number."); }
162 if (
tpracs &&
id ==
"") {
FATAL(
"Inconsistent specificaton of {t,p,r,a,c,s}cal calibration sets and no detector identifier."); }
163 if (
tpracs && variant ==
"") {
FATAL(
"Inconsistent specificaton of {t,p,r,a,c,s}cal calibration sets and no variant."); }
164 if (
tpracs && daq) {
FATAL(
"Inconsistent specificaton of {t,p,r,a,c,s}cal calibration sets and run number."); }
166 if (daq &&
id ==
"") {
FATAL(
"Inconsistent specificaton of run number and no detector identifier."); }
171 FATAL(
"Inconsistent detector variant and option -W.");
177 catch(
const exception& error) {
188 *(JDB::get()->DetX)(
id.c_str(),
193 *(JDB::get()->DetX)(
id.c_str(),
201 else if (daq && variant ==
"")
202 *(JDB::get()->DetX)(
id.c_str(), run) >>
detector;
203 else if (daq && variant !=
"")
206 FATAL(
"Invalid options.");
208 catch(
const exception& error) {
215 if (
detector.setToLatestVersion()) {
236 catch(
const exception& error) {
243 zmap[
module->getString()][module->getFloor()] = module->getPosition();
248 if (i->FLOORID == 0) {
254 if (zmap[i->DUID].count(1) != 0) {
258 module.setPosition(JPosition3D(zmap[i->DUID][1].getX(),
259 zmap[i->DUID][1].getY(),
260 isARCADetector(detector) ? ARCA_TBARZ_M :
261 isORCADetector(detector) ? ORCA_TBARZ_M :
273 }
else if (zmap[i->DUID].count(1) != 0) {
275 if (fabs(p->getX() - zmap[i->DUID][1].getX()) > precision ||
276 fabs(p->getY() - zmap[i->DUID][1].getY()) > precision) {
278 NOTICE(
"Offset module " <<
getLabel(p->getLocation()) <<
" (x,y) position "
279 <<
SCIENTIFIC(12,3) << (p->getX() - zmap[i->DUID][1].getX()) <<
' '
280 <<
SCIENTIFIC(12,3) << (p->getY() - zmap[i->DUID][1].getY()) <<
endl);
282 p->setPosition(
JPosition3D(zmap[i->DUID][1].getX(),
283 zmap[i->DUID][1].getY(),
289 ERROR(
"Missing floor in string " <<
setw(4) << i->DUID <<
endl);
331 if (t0 != p->getT0()) {
333 NOTICE(
"Set module time calibration " <<
getLabel(p->getLocation()) <<
' ' <<
setw(10) << p->getID() <<
' ' <<
setw(28) << left << i->first << right <<
' ' <<
FIXED(12,3) << t0 <<
endl);
335 p->setCalibration(t0);
338 catch(
const exception& error) {
339 if (i->first.getVariant() !=
NOPIEZO) {
340 ERROR(location <<
' ' << error.what() <<
endl);
346 ERROR(
"No module for UPI " << i->first <<
" at " << location <<
endl);
351 catch(
const exception& error) {
int main(int argc, char **argv)
Data structure for detector geometry and calibration.
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
General purpose messaging.
Utility class to parse command line options.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
I/O formatting auxiliaries.
JSon definitions and auxiliaries.
Auxiliary methods to convert data members or return values of member methods of a set of objects to a...
Auxiliary class for specifying selection of database data.
JSelector & add(const JSelector &selection)
Add selection.
double getT0() const
Get time offset.
Logical location of module.
const JLocation & getLocation() const
Get location.
Data structure for a composite optical module.
Data structure for position in three dimensions.
int getID() const
Get identifier.
Exception for accessing a value in a collection that is outside of its range.
Template definition of a multi-dimensional oscillation probability interpolation table.
static const JPBS_t HYDROPHONE(4, 5)
PBS of hydrophone
static const JPBS_t ACOUSTIC_SENSOR(3, 4, 3, 6, 2)
PBS of piezo sensor
ResultSet & getResultSet(const std::string &query)
Get result set.
static JGetPBSSequences getPBSSequences
Function object to get PBS sequences as a function of PBS.
JDetectorsHelper & getDetector()
Auxiliary function for helper object initialisation.
std::vector< JServer > getServernames()
Get list of names of available database servers.
static const double PIEZO_V2_DELAYTIME_US
Piezo delay time [us].
std::string getLabel(const JLocation &location)
Get module label for monitoring and other applications.
static const double PIEZO_V1_DELAYTIME_US
Piezo delay time [us].
static const JGetDetectorVersion getDetectorVersion
Function object to map detector version to numerical value.
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
static const double HYDROPHONE_DELAYTIME_US
Hydrophone delay time [us].
void store(const std::string &file_name, const JDetector &detector)
Store detector to output file.
static const double PIEZO_V3_DELAYTIME_US
Piezo delay time [us].
const array_type< JValue_t > & make_array(const JValue_t(&array)[N])
Method to create array of values.
std::iterator_traits< T >::value_type getAverage(T __begin, T __end)
Get average.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
static const std::string TCAL
PMT time offsets.
static const std::string PCAL
(optical|base) module positions
static const std::string SCAL
(module|PMT) status
static const std::string RCAL
optical module orientations
static const std::string ACAL
acoustic time offsets (piezo sensor or hydrophone)
static const std::string CCAL
compass alignment (a.k.a. quaternion calibration)
Auxiliary data structure for sequence of same character.
Auxiliary data structure for floating point format specification.
map_type::const_iterator range_const_iterator
Auxiliary data structure for location of product in detector.
int string
position in detector
int floor
position in string
Product breakdown structure (PBS).
Auxiliary class to map UPI to location in detector.
JLocation_t getLocation(const JUPI_t &upi) const
Get location of product with given UPI.
Wrapper class for server name.
Universal product identifier (UPI).
@ V4
Version with quaternion and time offset per module.
Auxiliary data structure for streaming of STL containers.
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
std::string nick_name
nick name (e.g. "xcal")
Auxiliary data structure for correspondence between nick and full name of calibration types.
bool hasNickname(const std::string &type) const
Has calibration type.
Auxiliary data structure for floating point format specification.