57 std::string input_filename;
58 std::string output_filename;
59 uint64_t run_start_time = 0;
60 int timeslice_duration = 100;
61 unsigned int detector_id = 0;
63 po::options_description desc(
"Options");
65 (
"help,h",
"Print this help and exit.")
67 po::value<std::string>(&input_filename)->required(),
68 "Set the name of the dump data file.")
70 po::value<std::string>(&output_filename)->required(),
71 "Set the name of the output DAQ file.")
73 po::value<uint64_t>(&run_start_time)->default_value(run_start_time),
74 "Set the run start time.")
76 po::value<int>(×lice_duration)->default_value(timeslice_duration),
77 "Set the value of the time slice duration in milliseconds.")
79 po::value<unsigned int>(&detector_id)->default_value(detector_id),
80 "Set the detector id.");
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 <<
"RawDataConverter: Error: " << e.what() <<
'\n'
98 }
catch (
const std::runtime_error& e) {
99 std::cerr <<
"RawDataConverter: Error: " << e.what() <<
'\n'
100 << desc << std::endl;
106 assert(df.size() &&
"It seems that the file that you provided is empty");
121 all_data.push_back(*it);
124 std::cout << all_data.size() <<
" datagrams found\n";
126 std::ofstream outfile(output_filename.c_str());
128 int const print_suppression_factor = all_data.size() > 50 ? all_data.size() / 50 : 1;
145 dg = std::find(dg, all_data.end(), id);
147 if (dg == all_data.end()) {
180 all_data.erase(dg++);
183 if (all_data.size() % print_suppression_factor == 0)
184 std::cout << std::setfill(
' ')
186 << 100 -
static_cast<int>(all_data.size() * 100. / df.size())
187 <<
"%\r" << std::flush;
191 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)
unsigned int getNItems() const
void setDataType(unsigned int datatype)
void setFrameIndex(frame_idx_t frame_idx)
CLBDataGram * getEmptyDataGram()
static InBufferCollector & getCollector()
CLBCommonHeader const * CLBHeader() const
void getFrame(Frame &frame)
void store(const JString &file_name, const JDetector &detector)
Store detector to output file.
void setSeqNumber(unsigned int seqnumber)