36 int main(
int argc,
char **argv)
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()))
112 FATAL(
"Missing PMT " << pmt.getID() << endl);
118 if (calibration.count(
PCAL)) {
131 for (
const auto& module : buffer) {
134 if (module.getFloor() != 0)
140 FATAL(
"Missing module " << module.getID() << endl);
145 if (calibration.count(
RCAL)) {
158 for (
const auto& module : buffer) {
161 if (module.getFloor() != 0) {
174 FATAL(
"Missing module " << module.getID() << endl);
179 if (calibration.count(
ACAL)) {
192 for (
const auto& module : buffer) {
198 FATAL(
"Missing module " << module.getID() << endl);
203 if (calibration.count(
CCAL)) {
216 for (
const auto& module : buffer) {
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()))
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.
int main(int argc, char *argv[])
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.
bool hasPMT(const JObjectID &id) const
Has PMT.
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Data structure for detector geometry and calibration.
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.
Direct access to PMT in detector data structure.
Auxiliary data structure for streaming of STL containers.
static const std::string RCAL
(optical|base) module orientations
General purpose messaging.
Direct access to module in detector data structure.
then JCookie sh JDataQuality D $DETECTOR_ID R
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
Utility class to parse command line options.
static const std::string SCAL
(module|PMT) status
const JModuleAddress & getAddress(const JObjectID &id) const
Get address of module.
bool hasModule(const JObjectID &id) const
Has module.
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
const JPMTAddress & getAddress(const JObjectID &id) const
Get address of PMT.
JVector3D & add(const JVector3D &vector)
Add vector.