artdaq_demo_hdf5  v1_01_04
FragmentNtuple.hh
1 #ifndef artdaq_demo_hdf5_ArtModules_detail_FragmentNtuple
2 #define artdaq_demo_hdf5_ArtModules_detail_FragmentNtuple 1
3 
4 #include "artdaq-core/Data/Fragment.hh"
5 #include "artdaq-core/Data/RawEvent.hh"
6 
7 #pragma GCC diagnostic push
8 #pragma GCC diagnostic ignored "-Wmissing-braces"
9 #include "hep_hpc/hdf5/Column.hpp"
10 #include "hep_hpc/hdf5/Ntuple.hpp"
11 #pragma GCC diagnostic pop
12 
13 #include "artdaq-demo-hdf5/HDF5/FragmentDataset.hh"
14 
15 namespace artdaq {
16 namespace hdf5 {
17 
18 typedef hep_hpc::hdf5::Column<uint8_t, 1> uint8Column;
19 typedef hep_hpc::hdf5::Column<uint16_t, 1> uint16Column;
20 typedef hep_hpc::hdf5::Column<uint32_t, 1> uint32Column;
21 typedef hep_hpc::hdf5::Column<uint64_t, 1> uint64Column;
22 typedef hep_hpc::hdf5::Column<artdaq::RawDataType, 1> dataColumn;
23 
30 {
31 public:
41  FragmentNtuple(fhicl::ParameterSet const& ps, hep_hpc::hdf5::File const& file);
42 
52  FragmentNtuple(fhicl::ParameterSet const& ps);
53 
57  virtual ~FragmentNtuple();
58 
63  void insertOne(artdaq::Fragment const& frag) override;
64 
69  void insertHeader(artdaq::detail::RawEventHeader const& hdr) override;
70 
77  std::unordered_map<artdaq::Fragment::type_t, std::unique_ptr<artdaq::Fragments>> readNextEvent() override
78  {
79  TLOG(TLVL_ERROR) << "FragmentNtuple is not capable of reading!";
80  return std::unordered_map<artdaq::Fragment::type_t, std::unique_ptr<artdaq::Fragments>>();
81  }
82 
89  std::unique_ptr<artdaq::detail::RawEventHeader> getEventHeader(artdaq::Fragment::sequence_id_t const&) override
90  {
91  TLOG(TLVL_ERROR) << "FragmentNtuple is not capable of reading!";
92  return nullptr;
93  }
94 
95 private:
96  size_t nWordsPerRow_;
97  hep_hpc::hdf5::Ntuple<uint64Column, uint16Column, uint64Column, uint8Column, uint64Column, uint64Column, dataColumn> fragments_;
98  hep_hpc::hdf5::Ntuple<uint32Column, uint32Column, uint32Column, uint64Column, uint8Column> eventHeaders_;
99 };
100 } // namespace hdf5
101 } // namespace artdaq
102 #endif //artdaq_demo_hdf5_ArtModules_detail_FragmentNtuple
void insertOne(artdaq::Fragment const &frag) override
Insert a Fragment into the Fragment Ntuple Dataset (write it to the HDF5 file)
Implemementation of FragmentDataset using hep_hpc Ntuples.
virtual ~FragmentNtuple()
FragmentNtuple Destructor.
std::unordered_map< artdaq::Fragment::type_t, std::unique_ptr< artdaq::Fragments > > readNextEvent() override
Read the next event from the Dataset (HDF5 file)
FragmentNtuple(fhicl::ParameterSet const &ps, hep_hpc::hdf5::File const &file)
FragmentNtuple Constructor with input hep_hpc::hdf5::File.
void insertHeader(artdaq::detail::RawEventHeader const &hdr) override
Insert a RawEventHeader into the Event Header Ntuple Dataset (write it to the HDF5 file) ...
Base class that defines methods for reading and writing to HDF5 files via various implementation plug...
std::unique_ptr< artdaq::detail::RawEventHeader > getEventHeader(artdaq::Fragment::sequence_id_t const &) override
Read a RawEventHeader from the Dataset (HDF5 file)