61 int main(
int argc, 
char **argv)
 
   73     JParser<> zap(
"Auxiliary program to compose detector from separate calibrations.");
 
   75     zap[
'a'] = 
make_field(detectorFile,  
"detector file");
 
   76     zap[
'f'] = 
make_field(inputFile,     
"detector calibration files in JSON format "\
 
   77                           "(wild card \'" << 
FILENAME_WILDCARD << 
"\' will be replaced by corresponding calibration set)");
 
   83   catch(
const exception &error) {
 
   84     FATAL(error.what() << endl);
 
   98     FATAL(
"No detector address map for detector identier " << 
detector.getID() << endl);
 
  120     operator int()
 const { 
return value; }
 
  122     status_type& operator=(
const int value) 
 
  142   for (
const auto& file_name : inputFile) {
 
  154      buffer = { file_name };
 
  156     for (
const auto& file_name : buffer) {
 
  158       const JSon js(file_name);
 
  160       json::const_iterator 
data;
 
  166         for (
size_t i = 0; i != 
data->size(); ++i) {
 
  180               if (pmtRouter.
hasPMT(element.getID())) {
 
  186                 tcal[pmt.
getID()] = DEFINED;
 
  195               if (moduleRouter.
hasModule(element.getID())) {
 
  199                 module.
set(element.getPosition());
 
  201                 pcal[module.
getID()] = DEFINED;
 
  210               if (moduleRouter.
hasModule(element.getID())) {
 
  214                 module.
set(element.getPosition());
 
  216                 pcal[module.
getID()] = DEFINED;
 
  225               if (moduleRouter.
hasModule(element.getID())) {
 
  231                 if (module.size() != buffer.size()) {
 
  232                   FATAL(
"Module size " << module.size() << 
" != " << buffer.size() << endl);
 
  237                 for (
size_t i = 0; i != module.size(); ++i) {
 
  241                 module.
rotate(element.getQuaternion());
 
  246                 rcal[module.
getID()] = DEFINED;
 
  255               if (moduleRouter.
hasModule(element.getID())) {
 
  261                 acal[module.
getID()] = DEFINED;
 
  270               if (moduleRouter.
hasModule(element.getID())) {
 
  276                 acal[module.
getID()] = DEFINED;
 
  285               if (moduleRouter.
hasModule(element.getID())) {
 
  291                 ccal[module.
getID()] = DEFINED;
 
  300               if (moduleRouter.
hasModule(element.getID())) {
 
  306                 ccal[module.
getID()] = DEFINED;
 
  315               if (pmtRouter.
hasPMT(element.getID())) {
 
  321                 scal[0][pmt.
getID()] = DEFINED;
 
  330               if (moduleRouter.
hasModule(element.getID())) {
 
  336                 scal[1][module.
getID()] = DEFINED;
 
  345               if (moduleRouter.
hasModule(element.getID())) {
 
  351                 scal[1][module.
getID()] = DEFINED;
 
  360   for (JDetector::const_iterator module = 
detector.begin(); module != 
detector.end(); ++module) {
 
  362     if (pcal   [module->getID()] != DEFINED) { 
ERROR(
"Module " << setw(10) << module->getID() << 
' ' << 
getLabel(module->getLocation()) << 
" no position calibration."  << endl); }
 
  363     if (rcal   [module->getID()] != DEFINED &&
 
  364         module->getFloor() != 0)             { 
ERROR(
"Module " << setw(10) << module->getID() << 
' ' << 
getLabel(module->getLocation()) << 
" no rotation calibration."  << endl); }
 
  365     if (acal   [module->getID()] != DEFINED) { 
ERROR(
"Module " << setw(10) << module->getID() << 
' ' << 
getLabel(module->getLocation()) << 
" no acoustics calibration." << endl); }
 
  366     if (ccal   [module->getID()] != DEFINED) { 
ERROR(
"Module " << setw(10) << module->getID() << 
' ' << 
getLabel(module->getLocation()) << 
" no compass calibration."   << endl); }
 
  367     if (scal[1][module->getID()] != DEFINED) { 
ERROR(
"Module " << setw(10) << module->getID() << 
' ' << 
getLabel(module->getLocation()) << 
" no status calibration."    << endl); }
 
  369     for (JModule::const_iterator pmt = module->begin(); pmt != module->end(); ++pmt) {
 
  370       if (tcal   [pmt->getID()] != DEFINED) { 
ERROR(
"PMT " << setw(8) << pmt->getID() << 
" no time calibration."   << endl); }
 
  371       if (scal[0][pmt->getID()] != DEFINED) { 
ERROR(
"PMT " << setw(8) << pmt->getID() << 
" no status calibration." << endl); }
 
int main(int argc, char **argv)
 
Data structure for detector geometry and calibration.
 
General purpose messaging.
 
Direct access to module in detector data structure.
 
Direct access to PMT in detector data structure.
 
Utility class to parse command line options.
 
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
 
I/O formatting auxiliaries.
 
#define MAKE_STRING(A)
Make string.
 
void setCalibration(const JCalibration &cal)
Set calibration.
 
const JLocation & getLocation() const
Get location.
 
Router for direct addressing of module data in detector data structure.
 
const JModuleAddress & getAddress(const JObjectID &id) const
Get address of module.
 
bool hasModule(const JObjectID &id) const
Has module.
 
Data structure for a composite optical module.
 
JVector3D getCenter() const
Get center of module based on crossing point of PMT axes.
 
const JPMT & getPMT(const int index) const
Get PMT.
 
JModule & set(const JVector3D &pos)
Set position.
 
void rotate(const JRotation3D &R)
Rotate module.
 
Router for direct addressing of PMT data in detector data structure.
 
bool hasPMT(const JObjectID &id) const
Has PMT.
 
const JPMTAddress & getAddress(const JObjectID &id) const
Get address of PMT.
 
Data structure for PMT geometry, calibration and status.
 
void setAxis(const JAxis3D &axis)
Set axis.
 
const JAxis3D & getAxis() const
Get axis.
 
Data structure for position in three dimensions.
 
void setPosition(const JVector3D &pos)
Set position.
 
void setQuaternion(const JQuaternion3D &quaternion)
Set quaternion.
 
int getID() const
Get identifier.
 
Utility class to parse command line options.
 
void from_json(const json &js, JDBString &object)
Convert JSon to database string.
 
std::string getLabel(const JLocation &location)
Get module label for monitoring and other applications.
 
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
 
void store(const std::string &file_name, const JDetector &detector)
Store detector to output file.
 
JDetectorBuilder & getDetectorBuilder()
Get detector builder.
 
bool hasDetectorAddressMap(const int id)
Check if detector address map is available.
 
std::string setWildCard(const std::string &file_name, const std::string &value)
Get file name by setting wild card to given value.
 
bool hasWildCard(const std::string &file_name)
Check presence of wild card.
 
static const char FILENAME_WILDCARD
wild card character for file name substitution
 
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
 
static const std::string BasePositions_t
 
static const std::string BaseStatusInfo_t
 
static const std::string BaseAcousticT0_t
 
static const std::string TCAL
PMT time offsets.
 
bool is_valid(const json &js)
Check validity of JSon data.
 
static const std::string ValidThrough_t
 
static const std::string PMTT0s_t
 
static const std::string PCAL
(optical|base) module positions
 
static const std::string DOMPositions_t
 
static const std::string SCAL
(module|PMT) status
 
static const std::string DetID_t
 
static const std::string RCAL
optical module orientations
 
static const std::string BaseCompassRotations_t
 
static const std::string Data_t
 
static const std::string PMTStatusInfo_t
 
static const std::string DOMRotations_t
 
static const std::string ACAL
acoustic time offsets (piezo sensor or hydrophone)
 
static const std::string DOMAcousticT0_t
 
static const std::string CCAL
compass alignment (a.k.a. quaternion calibration)
 
static const std::string DOMStatusInfo_t
 
static const std::string DOMCompassRotations_t
 
static const std::string Comment_t
 
static const std::string ValidFrom_t
 
std::map< int, range_type > map_type
 
Auxiliary interface for building detector.
 
const JModule & getModule(const int id=-1, const JLocation &location=JLocation()) const
Get module.
 
void setStatus(const JStatus &status)
Set status.
 
Auxiliary class to load json data from file.
 
Auxiliary class for date and time.
 
time_t getTime() const
time