44 unsigned int hit_rate = 10;
46 std::string dq_address;
48 std::string input_filename(
"");
49 std::string configuration_filename(
"");
51 unsigned int deltaTS = 100;
53 unsigned int MTU = 1500;
55 unsigned int run_number = 24;
57 po::options_description desc(
"Options");
59 (
"help,h",
"Print this help and exit.")
61 po::value<int>(&dq_port)->required(),
62 "Set the port to send data trough.")
64 po::value<std::string>(&dq_address)->required(),
65 "Set the IP address to send data to.")
67 po::value<unsigned int>(&deltaTS)->default_value(deltaTS),
68 "Set the value of the time slice duration in milliseconds.")
70 po::value<unsigned int>(&hit_rate)->default_value(hit_rate),
71 "Set the desired hit rate in kHz.")
73 po::value<unsigned int>(&run_number)->default_value(run_number),
74 "Set the run number.")
76 po::value<unsigned int>(&MTU)->default_value(MTU),
77 "Set the Maximum Transfer Unit (MTU), i.e. the maximum UDP packet size.")
79 po::value<std::string>(&configuration_filename)->default_value(configuration_filename),
80 "Provide a file with the set of DOM ID to simulate. It must be in the form \"1 2 3 5 6 11\".");
85 po::command_line_parser(argc, argv).options(desc).run(),
88 if (vm.count(
"help")) {
89 std::cout << desc << std::endl;
94 }
catch (
const po::error& e) {
95 std::cerr <<
"CLBsimu: Error: " << e.what() <<
'\n'
98 }
catch (
const std::runtime_error& e) {
99 std::cerr <<
"CLBsimu: Error: " << e.what() <<
'\n'
100 << desc << std::endl;
107 std::cerr <<
"FATAL: No DOM ID range available. Exiting\n";
111 std::cout <<
"Program UP!\n";
112 std::cout <<
"here is the configuration:\n";
120 std::cout <<
"DOM IDs:\n";
122 for (
unsigned int i = 0; i < range.size(); ++i) {
123 std::cout << range[i] <<
' ';
127 FrameGenerator generator(range, deltaTS, run_number, MTU, hit_rate);
131 boost::asio::io_service service;
133 boost::asio::ip::udp::socket sock(service, boost::asio::ip::udp::udp::v4());
135 boost::asio::ip::udp::udp::resolver resolver(service);
137 boost::asio::ip::udp::udp::resolver::query query(
138 boost::asio::ip::udp::udp::v4(),
140 boost::lexical_cast<std::string>(dq_port));
142 boost::asio::ip::udp::udp::endpoint
const destination = *resolver.resolve(query);
145 for (
unsigned int i = 0; i < range.size(); i++) {
146 generator.getNext(data);
148 sock.send_to(boost::asio::buffer(data), destination);
void store(const JString &file_name, const JDetector &detector)
Store detector to output file.
DOMRange_t createDOMRange(const std::string &filename="")