57{
   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;
   63 
   64  po::options_description desc("Options");
   65  desc.add_options()
   66      ("help,h",     "Print this help and exit.")
   67      ("input,i",
   68          po::value<std::string>(&input_filename)->required(),
   69          "Set the name of the dump data file.")
   70      ("output,o",
   71           po::value<std::string>(&output_filename)->required(),
   72           "Set the name of the output DAQ file.")
   73      ("runstart,s",
   74            po::value<uint64_t>(&run_start_time)->default_value(run_start_time),
   75           "Set the run start time.")
   76      ("timeslice,t",
   77           po::value<int>(×lice_duration)->default_value(timeslice_duration),
   78           "Set the value of the time slice duration in milliseconds.")
   79      ("detector-id,",
   80           po::value<unsigned int>(&detector_id)->default_value(detector_id),
   81           "Set the detector id.");
   82 
   83  try {
   84    po::variables_map vm;
   85    po::store(
   86      po::command_line_parser(argc, argv).options(desc).run(),
   87      vm);
   88 
   89    if (vm.count("help")) {
   90      std::cout << desc << std::endl;
   91      return EXIT_SUCCESS;
   92    }
   93 
   94    po::notify(vm);
   95  } catch (const po::error& e) {
   96    std::cerr << "RawDataConverter: Error: " << e.what() << '\n'
   97              << desc << std::endl;
   98    return EXIT_FAILURE;
   99  } catch (const std::runtime_error& e) {
  100    std::cerr << "RawDataConverter: Error: " << e.what() << '\n'
  101              << desc << std::endl;
  102    return EXIT_FAILURE;
  103  }
  104 
  106 
  107  assert(df.size() && "It seems that the file that you provided is empty");
  108 
  110 
  113 
  116 
  118 
  120    times.insert(time);
  121 
  122    all_data.push_back(*it);
  123  }
  124 
  125  std::cout << all_data.size() << " datagrams found\n";
  126 
  127  std::ofstream outfile(output_filename.c_str());
  128 
  129  int const print_suppression_factor = all_data.size() > 50 ? all_data.size() / 50 : 1;
  130 
  132 
  134 
  136 
  138    id.abs_time = *tit;
  140      id.domid = *it;
  141 
  143      bool found = false;
  144 
  145      while (true) {
  146        dg = std::find(dg, all_data.end(), id);
  147 
  148        if (dg == all_data.end()) {
  149          break;
  150        }
  151 
  152        found = true;
  154 
  156 
  159 
  162 
  165            run_start_time,
  166            timeslice_duration
  167        );
  168 
  169        if (seq_num.second) {
  171 
  175                  run_start_time,
  176                  timeslice_duration
  177              )
  178          );
  179 
  181        } else {
  182          std::cerr
  183            << "Datagram timestamp before the start of the run:\n"
  185        }
  186 
  187        all_data.erase(dg++);
  188      }
  189 
  190      if (all_data.size() % print_suppression_factor == 0)
  191        std::cout << std::setfill(' ')
  192                  << std::setw(3)
  193                  << 100 - static_cast<int>(all_data.size() * 100. / df.size())
  194                  << "%\r" << std::flush;
  195 
  196      if (found) {
  198        if (frame.size() && frame.
getNItems()) outfile.write(frame.data(), frame.size());
 
  199      }
  201    }
  202  }
  203}
Template Frame for ARS data.
 
unsigned int getNItems() const
 
static InBufferCollector & getCollector()
 
CLBDataGram * getEmptyDataGram()
 
CLBCommonHeader const * CLBHeader() const
 
void setDetectorId(unsigned int detector_id)
 
void setSeqNumber(unsigned int seqnumber)
 
void setFrameIndex(frame_idx_t frame_idx)
 
void getFrame(Frame &frame)
 
bool insert(CLBDataGram *datagram)
 
void setDataType(unsigned int datatype)