84 JParser<> zap(
"Auxiliary program to print detector from database.");
90 zap[
'D'] =
make_field(
id,
"detector identifier") =
"";
92 zap[
't'] =
make_field(tcalset,
"tcal: t0 (time offsets) calibration set from DB") =
"";
93 zap[
'p'] =
make_field(pcalset,
"pcal: position (x,y,z) calibration set from DB") =
"";
94 zap[
'q'] =
make_field(rcalset,
"rcal: orientation (quaterions) calibration set from DB") =
"";
97 zap[
'W'] =
make_field(wizzard,
"-W add base modules; -WW set time offsets of acoustic sensors");
102 catch(
const exception &error) {
103 FATAL(error.what() << endl);
107 const int file = ((detectorFile !=
"" ? 1 : 0));
108 const int calset = ((tcalset.empty() ? 0 : 1) +
109 (pcalset.empty() ? 0 : 1) +
110 (rcalset.empty() ? 0 : 1));
111 const int daq = ((run != -1 ? 1 : 0));
113 if (
file != 0 && (
file != 1)) {
FATAL(
"Inconsistent specificaton of detector file."); }
114 if (calset != 0 && (calset != 3 ||
id ==
"")) {
FATAL(
"Inconsistent specificaton of detector identifier, tcal, pcal and rcal calibration sets."); }
115 if (daq != 0 && (daq != 1 ||
id ==
"")) {
FATAL(
"Inconsistent specificaton of detector identifier and run number."); }
119 if (
file == 1) { ++np; }
120 if (calset == 3) { ++np; }
121 if (daq == 1) { ++np; }
123 if (np != 1) {
FATAL(
"Specify detector file; OR detector identifier, tcal, pcal and rcal calibration set; OR detector identifier and run number."); }
129 catch(
const exception& error) {
130 FATAL(error.what() << endl);
139 else if (calset == 3)
140 *(
JDB::get()->DetX)(
id.c_str(), tcalset.c_str(), pcalset.c_str(), rcalset.c_str()) >>
detector;
144 catch(
const exception& error) {
145 FATAL(error.what() << endl);
150 if (
detector.setToLatestVersion()) {
151 NOTICE(
"Set detector version to " <<
detector.getVersion() << endl);
162 selector.
add(&JCLBMap::FLOORID, 0);
164 ResultSet& rs =
getResultSet(getTable<JCLBMap>(), selector);
170 catch(
const exception& error) {
171 FATAL(error.what() << endl);
176 for (JDetector::const_iterator module =
detector.begin(); module !=
detector.end(); ++module) {
177 zmap[module->getString()][module->getFloor()] = module->getPosition();
182 if (i->FLOORID == 0) {
190 module.setPosition(
JPosition3D(zmap[i->DUID].begin()->second.getX(),
191 zmap[i->DUID].begin()->second.getY(),
196 NOTICE(
"Adding module " << module << endl);
208 NOTICE(
"Setting time offsets of acoustic sensors... " << flush);
212 ResultSet& rs =
getResultSet(getTable<JDetectorIntegration_t>());
214 if (! (rs >> detector_t)) {
218 detector_t.
configure(getDetector<string>(
id));
228 const JLocation_t location = router.getLocation(i->first);
230 JDetector::iterator p = find_if(
detector.begin(),
237 p->setCalibration(
getAverage(
make_array(p->begin(), p->end(), &JModule::getT0), 0.0) - getDelayTime(i->first));
239 FATAL(
"No module for UPI " << i->first << endl);
245 catch(
const exception& error) {
246 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.
JPredicate< JResult_t T::*, JComparison::eq > make_predicate(JResult_t T::*member, const JResult_t value)
Helper method to create predicate for data member.
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].
then set_variable PMT_FILE set_variable DAQ_FILE set_variable OUTPUT_FILE set_variable DETECTOR else fatal Wrong number of arguments fi set_variable RUNBYRUN file
bool isARCADetector(const JDetectorHeader &header)
Check if given detector header is compatible with tat of ARCA.
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
T get(const JHead &header)
Get object from header.
std::iterator_traits< T >::value_type getAverage(T __begin, T __end)
Get average.
Auxiliary class for specifying selection of database data.
JDetectorsHelper & getDetector()
Auxiliary function for helper object initialisation.
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
Logical location of module.
Auxiliary data structure for location of product in detector.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
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.
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 class to map UPI to location in detector.
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.
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.
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.