#include #include #include #include "JDetector/JDetector.hh" #include "JDetector/JDetectorToolkit.hh" #include "Jeep/JParser.hh" #include "Jeep/JMessage.hh" /** * Auxiliary program to decalibrate detector. */ int main(int argc, char **argv) { using namespace std; string inputFile; string outputFile; double TMax_ns; int debug; try { JParser<> zap; zap['f'] = make_field(inputFile); zap['o'] = make_field(outputFile); zap['T'] = make_field(TMax_ns) = 2.0; // [ns] zap['d'] = make_field(debug) = 1; if (zap.read(argc, argv) != 0) return 1; } catch(const exception &error) { FATAL(error.what() << endl); } using namespace JSIRENE; JDetector detector; try { load(inputFile, detector); } catch(const JException& error) { FATAL(error); } if (detector.empty()) FATAL("Empty detector." << endl); for (JDetector::iterator module = detector.begin(); module != detector.end(); ++module) { int i = 0; for (JModule::iterator pmt = module->begin(); pmt != module->end(); ++pmt, ++i) pmt->setCalibration(pmt->getT0() + (i%2 == 0 ? +TMax_ns : -TMax_ns)); } try { store(outputFile, detector); } catch(const JException& error) { FATAL(error); } }