24 int main(
int argc,
char **argv)
35 JParser<> zap(
"Program to convert ntuples to detector.");
44 catch(
const exception &error) {
45 FATAL(error.what() << endl);
55 load(detectorFile, detector);
57 catch(
const JException& error) {
62 const JModuleRouter router(detector);
66 JTimer timer(
"module");
68 JFileStreamReader in(ntupleFile.c_str());
70 for (JModuleGeometry geometry; in.load(geometry); ) {
72 DEBUG(geometry << endl);
74 const int id = geometry.getID();
76 if (router.hasModule(
id)) {
80 const JEulerMatrix3D R(geometry.getEulerAngle());
82 JModule master =
getModule(demo.get(
id), id);
85 master.add(geometry.getPosition());
87 JModule& module = detector.getModule(router.getAddress(
id));
89 if (module.size() == master.size()) {
91 for (
int pmt = 0; pmt != (int) master.size(); ++pmt) {
92 module.getPMT(pmt).setAxis(master.getPMT(pmt).getAxis());
99 ERROR(
"Module sizes inconsistent " << module.size() <<
" != " << master.size() << endl);
106 ERROR(
"Missing module " << geometry.getID() << endl);
123 catch(
const JException& error) {
Utility class to parse command line options.
Data structure for detector geometry and calibration.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
void load(const JString &file_name, JDetector &detector)
Load detector from input file.
JDetectorAddressMap & getDetectorAddressMap()
Get detector address map.
General purpose messaging.
Direct access to module in detector data structure.
Utility class to parse command line options.
void store(const JString &file_name, const JDetector &detector)
Store detector to output file.
const JModule & getModule(const JDetector &detector, const JModuleLocation &location)
find module with a given string and floor number
#define DEBUG(A)
Message macros.
int main(int argc, char *argv[])