37 JParser<> zap(
"Auxiliary program to merge detector files.");
41 zap[
't'] =
make_field(tcalset,
"tcal: t0 (time offsets) calibration set from file") =
"";
42 zap[
'p'] =
make_field(pcalset,
"pcal: position (x,y,z) calibration set from file") =
"";
43 zap[
'q'] =
make_field(rcalset,
"rcal: orientation (quaterions) calibration set from file") =
"";
48 catch(
const exception &error) {
49 FATAL(error.what() << endl);
69 copy(buffer.begin(), buffer.end(), back_inserter(
detector));
77 load(tcalset, buffer);
85 for (
const auto& module : buffer) {
86 for (
const auto& pmt : module) {
87 if (router.hasPMT(pmt.getID()))
88 detector.getPMT(router.getAddress(pmt.getID())).setCalibration(pmt.getCalibration());
90 FATAL(
"Missing PMT " << pmt.getID() << endl);
100 load(pcalset, buffer);
108 for (
const auto& module : buffer) {
109 if (router.hasModule(module.getID())) {
111 if (module.getFloor() != 0)
112 detector.getModule(router.getAddress(module.getID())).set(module.getCenter());
114 detector.getModule(router.getAddress(module.getID())).set(module.getPosition());
117 FATAL(
"Missing module " << module.getID() << endl);
126 load(rcalset, buffer);
134 for (
const auto& module : buffer) {
135 if (router.hasModule(module.getID())) {
137 if (module.getFloor() != 0) {
138 detector.getModule(router.getAddress(module.getID())).rotate(
getRotation(
detector.getModule(router.getAddress(module.getID())),module));
142 FATAL(
"Missing module " << module.getID() << endl);
Router for direct addressing of PMT data in detector data structure.
Utility class to parse command line options.
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.
#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.
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
void copy(const Head &from, JHead &to)
Copy header from from to to.
do set_variable DETECTOR_TXT $WORKDIR detector