2#include "Packing/SingleSubsystemUnpacker.h"
4#include "Packing/LDMXRoRHeader.h"
5#include "Packing/RogueFrameHeader.h"
10 auto dat_file{ps.
get<std::string>(
"dat_file")};
13 EXCEPTION_RAISE(
"FileNotFound",
14 "SingleSubsystemUnpacker could not open '" + dat_file +
15 "'. Check the path and that it is mounted inside the "
16 "container (denv_mounts in .denv/config).");
18 auto subsystem_name{ps.
get<std::string>(
"subsystem_name")};
19 if (subsystem_name.empty()) {
25 EXCEPTION_RAISE(
"BadName",
26 "Subsystem name '" + subsystem_name +
27 "' not 'ts', 'tdaq', 'tracker', 'ecal', 'hcal'.");
46 const auto frame_end =
47 reader_.
tell() +
static_cast<std::streamoff
>(frame_header.size());
49 if (frame_header.probablyYaml()) {
57 if (!ror_header.valid() or ror_header.subsystem() !=
subsystem_) {
79 std::vector<uint8_t> buff;
83 "MalForm",
"Raw file provided was unable to read entire data frame.");
91 event.getEventHeader().setIntParameter(
"RoR Timestamp LSB",
92 static_cast<int>(ts & 0xFFFFFFFFU));
93 event.getEventHeader().setIntParameter(
"RoR Timestamp MSB",
94 static_cast<int>(ts >> 32));
#define DECLARE_PRODUCER(CLASS)
Macro which allows the framework to construct a producer given its name during configuration.
void abortEvent()
Abort the event immediately.
Implements an event buffer system for storing event data.
Class encapsulating parameters for configuring a processor.
const T & get(const std::string &name) const
Retrieve the parameter of the given name.
This producer unpacks the data from the a single subsystem into a single buffer for a downstream proc...
utility::Reader reader_
raw data file we are reading
int subsystem_
subsystem ID to filter for
int frame_offset_
number of frames to skip before sending data
std::string output_name_
destination object name
void produce(framework::Event &event) override
Actually do the unpacking/decoding.
int contributor_
contributor ID to filter for
void configure(framework::config::Parameters &ps) override
Configure the unpacker and open the raw data file for IO.
int frame_count_
frame count from beginning of file for frame_offset_
std::streampos tell()
Tell us where the reader is.
void open(const std::string &file_name)
Open a file with this reader.
bool eof()
check if file is done
void seek(std::streampos off, std::ios_base::seekdir dir=std::ios::beg)
Go ("seek") a specific position in the file.
Reader & read(WordType *w, std::size_t count)
Read the next 'count' words into the input handle.