23 int main(
int argc,
char **argv)
38 JParser<> zap(
"Auxiliary program to merge the time offsets of two detector files."\
39 "\nThe TDC constraints correspond to those used in conjuction with the detector file.");
41 zap[
'a'] =
make_field(detectorFile_a,
"<detector file> <TDC file>");
42 zap[
'b'] =
make_field(detectorFile_b,
"<detector file> <TDC file>");
49 catch(
const exception &error) {
50 FATAL(error.what() << endl);
58 load(detectorFile_a.first, detector_a);
59 load(detectorFile_b.first, detector_b);
61 catch(
const std::exception& error) {
65 if (detector_a.getID() != detector_b.getID()) {
66 FATAL(
"Detector identifier " << detector_a.getID() <<
" != " << detector_b.getID() << endl);
69 const JModuleRouter router(detector_b);
71 for (JDetector::iterator module = detector_a.begin(); module != detector_a.end(); ++module) {
73 if (!router.hasModule(module->getID())) {
74 FATAL(
"Missing module " << module->getID() <<
" in " << detectorFile_b.first << endl);
77 for (
size_t pmt = 0; pmt != module->size(); ++pmt) {
79 if (detectorFile_a.second.has(module->getID(), pmt)) {
81 if (detectorFile_b.second.has(module->getID(), pmt))
82 ASSERT(fabs((*module)[pmt].getT0() - router.getModule(module->getID())[pmt].getT0()) <= precision,
83 "PMT " << setw(10) << module->getID() <<
'.' <<
FILL(2,
'0') << pmt <<
FILL() <<
" constraint.");
85 (*module)[pmt].setCalibration(router.getModule(module->getID())[pmt].
getCalibration());
92 detector_a.comment.add(JMeta(argc, argv));
Utility class to parse command line options.
JCombinatorics::pair_type pair_type
int main(int argc, char *argv[])
JCalibration getCalibration(const JCalibration &first, const JCalibration &second)
Get calibration to go from first to second calibration.
Data structure for detector geometry and calibration.
#define ASSERT(A,...)
Assert macro.
#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.
General purpose messaging.
Auxiliary data structure for sequence of same character.
Direct access to module in detector data structure.
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
Utility class to parse command line options.
General methods for loading and storing a single object from and to a file, respectively.