58 std::string input_filename;
59 std::string output_filename;
60 uint64_t run_start_time = 0;
61 int timeslice_duration = 100;
62 unsigned int detector_id = 0;
64 po::options_description desc(
"Options");
66 (
"help,h",
"Print this help and exit.")
68 po::value<std::string>(&input_filename)->required(),
69 "Set the name of the dump data file.")
71 po::value<std::string>(&output_filename)->required(),
72 "Set the name of the output DAQ file.")
74 po::value<uint64_t>(&run_start_time)->default_value(run_start_time),
75 "Set the run start time.")
77 po::value<int>(×lice_duration)->default_value(timeslice_duration),
78 "Set the value of the time slice duration in milliseconds.")
80 po::value<unsigned int>(&detector_id)->default_value(detector_id),
81 "Set the detector id.");
86 po::command_line_parser(argc, argv).
options(desc).run(),
89 if (vm.count(
"help")) {
90 std::cout << desc << std::endl;
95 }
catch (
const po::error& e) {
96 std::cerr <<
"RawDataConverter: Error: " << e.what() <<
'\n'
99 }
catch (
const std::runtime_error& e) {
100 std::cerr <<
"RawDataConverter: Error: " << e.what() <<
'\n'
101 << desc << std::endl;
107 assert(df.size() &&
"It seems that the file that you provided is empty");
122 all_data.push_back(*it);
125 std::cout << all_data.size() <<
" datagrams found\n";
127 std::ofstream outfile(output_filename.c_str());
129 int const print_suppression_factor = all_data.size() > 50 ? all_data.size() / 50 : 1;
146 dg = std::find(dg, all_data.end(), id);
148 if (dg == all_data.end()) {
169 if (seq_num.second) {
183 <<
"Datagram timestamp before the start of the run:\n"
187 all_data.erase(dg++);
190 if (all_data.size() % print_suppression_factor == 0)
191 std::cout << std::setfill(
' ')
193 << 100 -
static_cast<int>(all_data.size() * 100. / df.size())
194 <<
"%\r" << std::flush;
198 if (frame.size() && frame.
getNItems()) outfile.write(frame.data(), frame.size());
int64_t abs_time(Packet const &p)
Program name: RawDataConverter.
bool insert(CLBDataGram *datagram)
void setDetectorId(unsigned int detector_id)
then print u2 $script< option > print u2 Possible options
unsigned int getNItems() const
void setDataType(unsigned int datatype)
void store(const std::string &file_name, const JDetector &detector)
Store detector to output file.
void setFrameIndex(frame_idx_t frame_idx)
CLBDataGram * getEmptyDataGram()
static InBufferCollector & getCollector()
CLBCommonHeader const * CLBHeader() const
Template Frame for ARS data.
void getFrame(Frame &frame)
void setSeqNumber(unsigned int seqnumber)