43   inline double getDelayTime(
const JUPI_t& upi)
 
   73 int main(
int argc, 
char **argv)
 
   93     JParser<> zap(
"Auxiliary program to download detector from database.");
 
   99     zap[
'D'] = 
make_field(
id,            
"detector identifier")                                        = 
"";
 
  100     zap[
'r'] = 
make_field(run,           
"run number")                                                 = -1;
 
  101     zap[
'@'] = 
make_field(calset,        
"calibration sets \"<key> = <value>[; <key> = <value>]\"" << endl
 
  105     zap[
'V'] = 
make_field(variant,       
"detector version")                                           = getDetectorVersions<string>(), 
"";
 
  106     zap[
'W'] = 
make_field(wizzard,       
"-W add base modules; -WW set time offsets of acoustic sensors");
 
  111   catch(
const exception &error) {
 
  112     FATAL(error.what() << endl);
 
  120     if (keys.count(i->getKey()) == 0)
 
  121       FATAL(
"Invalid calibration set \"" << i->getKey() << 
"\"" << endl);
 
  123       calibration[i->getKey()] = i->getValue();
 
  126   if (calibration.size() != 0
u &&
 
  127       calibration.size() != 3
u &&
 
  128       calibration.size() != 6
u) {
 
  129     FATAL(
"Inconsistent specificaton of calibration sets, either {}, {t,p,r}cal or {t,p,r,a,c,s}cal.");
 
  132   const bool file   = (detectorFile != 
"");
 
  133   const bool tpr    = (calibration.count(
TCAL) != 0 &&
 
  134                        calibration.count(
PCAL) != 0 &&
 
  135                        calibration.count(
RCAL) != 0 &&
 
  136                        calibration.count(
ACAL) == 0 &&
 
  137                        calibration.count(
CCAL) == 0 &&
 
  138                        calibration.count(
SCAL) == 0);
 
  139   const bool tpracs = (calibration.count(
TCAL) != 0 &&
 
  140                        calibration.count(
PCAL) != 0 &&
 
  141                        calibration.count(
RCAL) != 0 &&
 
  142                        calibration.count(
ACAL) != 0 &&
 
  143                        calibration.count(
CCAL) != 0 &&
 
  144                        calibration.count(
SCAL) != 0);
 
  145   const bool daq    = (run != -1);
 
  147   if (file   && 
id      != 
"") { 
FATAL(
"Inconsistent specificaton of detector file and detector identifier."); }
 
  148   if (file   && tpr)           { 
FATAL(
"Inconsistent specificaton of detector file and {t,p,r}cal calibration sets."); }
 
  149   if (file   && tpracs)        { 
FATAL(
"Inconsistent specificaton of detector file and {t,p,r,a,c,s}cal calibration sets."); }
 
  150   if (file   && daq)           { 
FATAL(
"Inconsistent specificaton of detector file and run number."); }
 
  152   if (tpr    && 
id      == 
"") { 
FATAL(
"Inconsistent specificaton of {t,p,r}cal calibration sets and no detector identifier."); }
 
  153   if (tpr    && variant != 
"") { 
FATAL(
"Inconsistent specificaton of {t,p,r}cal calibration sets and variant."); }
 
  154   if (tpr    && daq)           { 
FATAL(
"Inconsistent specificaton of {t,p,r}cal calibration sets and run number."); }
 
  156   if (tpracs && 
id      == 
"") { 
FATAL(
"Inconsistent specificaton of {t,p,r,a,c,s}cal calibration sets and no detector identifier."); }
 
  157   if (tpracs && variant == 
"") { 
FATAL(
"Inconsistent specificaton of {t,p,r,a,c,s}cal calibration sets and no variant."); }
 
  158   if (tpracs && daq)           { 
FATAL(
"Inconsistent specificaton of {t,p,r,a,c,s}cal calibration sets and run number."); }
 
  160   if (daq    && 
id      == 
"") { 
FATAL(
"Inconsistent specificaton of run number and no detector identifier."); }
 
  165     FATAL(
"Inconsistent detector variant and option -W.");
 
  171   catch(
const exception& error) {
 
  172     FATAL(error.what() << endl);
 
  183                           calibration[
TCAL].c_str(),
 
  184                           calibration[
PCAL].c_str(),
 
  188                           calibration[
TCAL].c_str(),
 
  189                           calibration[
PCAL].c_str(),
 
  190                           calibration[
RCAL].c_str(),
 
  191                           calibration[
ACAL].c_str(),
 
  192                           calibration[
CCAL].c_str(),
 
  193                           calibration[
SCAL].c_str(),
 
  195     else if (daq && variant == 
"")
 
  197     else if (daq && variant != 
"")
 
  200       FATAL(
"Invalid options.");
 
  202   catch(
const exception& error) {
 
  203     FATAL(error.what() << endl);
 
  209   if (
detector.setToLatestVersion()) {
 
  210     NOTICE(
"Set detector version to " << 
detector.getVersion() << endl);
 
  224       ResultSet& rs  = 
getResultSet(getTable<JCLBMap>(), selector);
 
  230     catch(
const exception& error) {
 
  231       FATAL(error.what() << endl);
 
  236     for (JDetector::const_iterator module = 
detector.begin(); module != 
detector.end(); ++module) {
 
  237       zmap[module->getString()][module->getFloor()] = module->getPosition();
 
  242       if (i->FLOORID == 0) {
 
  251                                          zmap[i->DUID].begin()->second.getY(),
 
  256           NOTICE(
"Adding module " << module << endl);
 
  260         } 
else if (zmap[i->DUID].count(1) != 0) {
 
  262           p->setPosition(
JPosition3D(zmap[i->DUID][1].getX(),
 
  263                                      zmap[i->DUID][1].getY(),
 
  266           NOTICE(
"Setting module " << *p << endl);
 
  276       NOTICE(
"Setting time offsets of acoustic sensors... " << flush);
 
  280       ResultSet& rs  = 
getResultSet(getTable<JDetectorIntegration_t>());
 
  282       if (! (rs >> detector_t)) {
 
  286       detector_t.
configure(getDetector<string>(
id));
 
  298           JDetector::iterator p = find_if(
detector.begin(), 
 
  307             ERROR(
"No module for UPI " << i->first << endl);
 
  313     catch(
const exception& error) {
 
  314       FATAL(error.what() << endl);
 
bool isORCADetector(const JDetectorHeader &header)
Check if given detector header is compatible with that of ORCA. 
 
Utility class to parse command line options. 
 
static const std::string RCAL
(optical|base) module orientations 
 
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 JGetPBSSequences getPBSSequences
Function object to get PBS sequences as a function of PBS. 
 
Data structure for a composite optical module. 
 
static const double ARCA_TBARZ_M
ORCA T-bar position relative to seabed [m]. 
 
const std::string & getVariant() const 
Get variant. 
 
bool isARCADetector(const JDetectorHeader &header)
Check if given detector header is compatible with tat of ARCA. 
 
static const double HYDROPHONE_DELAYTIME_US
Hydrophone delay time [us]. 
 
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message. 
 
std::iterator_traits< T >::value_type getAverage(T __begin, T __end)
Get average. 
 
static const double PIEZO_V3_DELAYTIME_US
Piezo delay time [us]. 
 
static const double PIEZO_V1_DELAYTIME_US
Piezo delay time [us]. 
 
static const std::string TCAL
PMT time offsets. 
 
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
 
Universal product identifier (UPI). 
 
static const std::string CCAL
compass alignment (a.k.a. quaternion calibration) 
 
Auxiliary class for specifying selection of database data. 
 
Data structure for detector geometry and calibration. 
 
static const double PIEZO_V2_DELAYTIME_US
Piezo delay time [us]. 
 
JDetectorsHelper & getDetector()
Auxiliary function for helper object initialisation. 
 
const JPBS_t & getPBS() const 
Get PBS. 
 
static const JPBS_t ACOUSTIC_SENSOR(3, 4, 3, 6, 2)
PBS of piezo sensor 
 
static const double ORCA_TBARZ_M
ORCA T-bar position relative to seabed [m]. 
 
int floor
position in string 
 
map_type::const_iterator range_const_iterator
 
I/O formatting auxiliaries. 
 
Version with quaternion and time offset per module. 
 
Logical location of module. 
 
const JLocation & getLocation() const 
Get location. 
 
Auxiliary data structure for location of product in detector. 
 
static const std::string SCAL
PMT status. 
 
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object 
 
JLocation_t getLocation(const JUPI_t &upi) const 
Get location of product with given UPI. 
 
JSelector & add(const JSelector &selection)
Add selection. 
 
const array_type< JValue_t > & make_array(const JValue_t(&array)[N])
Method to create array of values. 
 
int getID() const 
Get identifier. 
 
static const std::string PCAL
(optical|base) module positions 
 
static const std::string ACAL
acoustic time offsets (piezo sensor or hydrophone) 
 
void store(const std::string &file_name, const JDetector &detector)
Store detector to output file. 
 
range_type find(const JUPI_t &upi) const 
Find range of products with given UPI. 
 
Auxiliary data structure for streaming of STL containers. 
 
Auxiliary class to map UPI to location in detector. 
 
General purpose messaging. 
 
static const JGetDetectorVersion getDetectorVersion
Function object to map detector version to numerical value. 
 
z range($ZMAX-$ZMIN)< $MINIMAL_DZ." fi fi typeset -Z 4 STRING typeset -Z 2 FLOOR JPlot1D -f $
 
void load(const std::string &file_name, JDetector &detector)
Load detector from input file. 
 
Utility class to parse command line options. 
 
static const JPBS_t HYDROPHONE(4, 5)
PBS of hydrophone 
 
ResultSet & getResultSet(const std::string &query)
Get result set. 
 
std::vector< JServer > getServernames()
Get list of names of available database servers. 
 
Wrapper class for server name. 
 
Product breakdown structure (PBS). 
 
Data structure for position in three dimensions. 
 
Exception for accessing a value in a collection that is outside of its range. 
 
do set_variable DETECTOR_TXT $WORKDIR detector
 
int string
position in detector 
 
void configure(const std::string &detid)
Configure detector integration for given detector identifier. 
 
Template definition for getting table specific selector. 
 
void setPosition(const JVector3D &pos)
Set position. 
 
double getT0() const 
Get time offset. 
 
static JDB & get()
Get connection to database.