3 #include "dam/HeaderFragmentUnpack.hh" 4 #include "dam/TpcStreamUnpack.hh" 6 #include "artdaq-core/Data/ContainerFragment.hh" 25 HeaderFragmentUnpack
const header (
_data_ptr);
26 if ( header.isData() )
32 _tpc_fragment = std::make_unique<TpcFragmentUnpack>(*_data_fragment);
47 TpcStreamUnpack
const *
58 for (
int i = 0; i < n_words; ++i)
67 size_t bytes = (header >> 8) & 0xffffff;
68 bytes *=
sizeof(uint64_t);
70 std::ofstream b_stream(filepath.c_str(),
71 std::fstream::out | std::fstream::binary);
73 char const*
data =
reinterpret_cast<decltype(data)
>(
_data_ptr);
74 b_stream.write(data, bytes);
83 for (
auto const& frag: frags)
85 artdaq::ContainerFragment cfrag(frag);
86 for (
size_t ii = 0 ; ii < cfrag.block_count(); ++ii)
88 auto* data_ptr = (uint8_t*) (cfrag.dataBegin());
89 data_ptr += cfrag.fragmentIndex(ii);
91 size_t afrag_size = 16;
92 artdaq::Fragment afrag;
93 afrag.resizeBytes(afrag_size);
94 memcpy(afrag.headerAddress(), data_ptr, afrag_size);
96 int afrag_header_bytes = afrag.dataBeginBytes()
97 - afrag.headerBeginBytes();
99 data_ptr += afrag_header_bytes;
std::unique_ptr< DataFragmentUnpack > _data_fragment
TpcStreamUnpack const * get_stream(int i) const
QTextStream & hex(QTextStream &s)
const uint64_t * _data_ptr
void hexdump(std::ostream &out, int n_words=10) const
std::vector< dune::RceFragment > RceFragments
std::unique_ptr< TpcFragmentUnpack > _tpc_fragment
RceFragment(artdaq::Fragment const &fragment)
static RceFragments from_container_frags(const artdaq::Fragments &frags)
QTextStream & dec(QTextStream &s)
void save(const std::string &filepath) const
byte bytes
Alias for common language habits.
std::vector< Fragment > Fragments
QTextStream & endl(QTextStream &s)