#include #include #include #include "TRandom3.h" #include "JDetector/JDetector.hh" #include "JDetector/JDetectorToolkit.hh" #include "Jeep/JParser.hh" #include "Jeep/JMessage.hh" /** * \file * * Auxiliary program to decalibrate detector. * \author mdejong */ int main(int argc, char **argv) { using namespace std; string inputFile; string outputFile; Double_t TMax_ns; UInt_t seed; int debug; try { JParser<> zap("Auxiliary program to decalibrate detector."); zap['f'] = make_field(inputFile); zap['o'] = make_field(outputFile); zap['T'] = make_field(TMax_ns) = 2.0; // [ns] zap['S'] = make_field(seed) = 0; zap['d'] = make_field(debug) = 1; zap(argc, argv); } catch(const exception &error) { FATAL(error.what() << endl); } gRandom->SetSeed(seed); using namespace JPP; 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) { for (JModule::iterator pmt = module->begin(); pmt != module->end(); ++pmt) { pmt->setCalibration(pmt->getT0() + gRandom->Uniform(-TMax_ns, +TMax_ns)); } } try { store(outputFile, detector); } catch(const JException& error) { FATAL(error); } }