48 JParser<> zap(
"Auxiliary program to merge detector files.");
52 zap[
'@'] =
make_field(calset,
"import calibration sets \"<key> = <file name>[; <key> = <file name>]\"" << endl
58 catch(
const exception &error) {
59 FATAL(error.what() << endl);
67 if (keys.count(i->getKey()) == 0)
68 FATAL(
"Invalid calibration set \"" << i->getKey() <<
"\"" << endl);
70 calibration[i->getKey()] =
trim(i->getValue());
90 copy(buffer.begin(), buffer.end(), back_inserter(
detector));
94 if (calibration.count(
TCAL)) {
107 for (
const auto& module : buffer) {
108 for (
const auto& pmt : module) {
109 if (router.hasPMT(pmt.getID()))
110 detector.getPMT(router.getAddress(pmt.getID())).setCalibration(pmt.getCalibration());
112 FATAL(
"Missing PMT " << pmt.getID() << endl);
118 if (calibration.count(
PCAL)) {
131 for (
const auto& module : buffer) {
132 if (router.hasModule(module.getID())) {
134 if (module.getFloor() != 0)
135 detector.getModule(router.getAddress(module.getID())).set(module.getCenter());
137 detector.getModule(router.getAddress(module.getID())).set(module.getPosition());
140 FATAL(
"Missing module " << module.getID() << endl);
145 if (calibration.count(
RCAL)) {
158 for (
const auto& module : buffer) {
159 if (router.hasModule(module.getID())) {
161 if (module.getFloor() != 0) {
163 JModule&
object =
detector.getModule(router.getAddress(module.getID()));
174 FATAL(
"Missing module " << module.getID() << endl);
179 if (calibration.count(
ACAL)) {
192 for (
const auto& module : buffer) {
193 if (router.hasModule(module.getID())) {
195 detector.getModule(router.getAddress(module.getID())).setT0(module.getT0());
198 FATAL(
"Missing module " << module.getID() << endl);
203 if (calibration.count(
CCAL)) {
216 for (
const auto& module : buffer) {
217 if (router.hasModule(module.getID())) {
219 detector.getModule(router.getAddress(module.getID())).setQuaternion(module.getQuaternion());
222 FATAL(
"Missing module " << module.getID() << endl);
227 if (calibration.count(
SCAL)) {
240 for (
const auto& module : buffer) {
241 for (
const auto& pmt : module) {
242 if (router.hasPMT(pmt.getID()))
243 detector.getPMT(router.getAddress(pmt.getID())).setStatus(pmt.getStatus());
245 FATAL(
"Missing PMT " << pmt.getID() << endl);
Router for direct addressing of PMT data in detector data structure.
Utility class to parse command line options.
Data structure for a composite optical module.
static const std::string ACAL
acoustic time offsets (piezo sensor or hydrophone)
static const std::string CCAL
compass alignment (a.k.a. quaternion calibration)
Router for direct addressing of module data in detector data structure.
static JRotation getRotation
Function object to get rotation matrix to go from first to second module.
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
std::string trim(const std::string &buffer)
Trim string.
static const std::string TCAL
PMT time offsets.
JVector3D & sub(const JVector3D &vector)
Subtract vector.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
void store(const std::string &file_name, const JDetector &detector)
Store detector to output file.
Auxiliary data structure for streaming of STL containers.
static const std::string RCAL
(optical|base) module orientations
then JCookie sh JDataQuality D $DETECTOR_ID R
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
static const std::string SCAL
(module|PMT) status
void copy(const Head &from, JHead &to)
Copy header from from to to.
Data structure for position in three dimensions.
do set_variable DETECTOR_TXT $WORKDIR detector
static const std::string PCAL
(optical|base) module positions
JVector3D & add(const JVector3D &vector)
Add vector.