81 using namespace dunedaq::detdataformats::ssp;
84 std::unique_ptr<std::vector<raw::OpDetWaveform>> output_wfs
85 = std::make_unique<std::vector<raw::OpDetWaveform>>();
86 std::unique_ptr<std::vector<recob::OpHit>> output_hits
87 = std::make_unique<std::vector<recob::OpHit>>();
91 const std::string & group_name = infoHandle->GetEventGroupName();
93 hid_t file_id = infoHandle->GetHDF5FileHandle();
101 fHDFFile = H5Fopen(file_name.data(), H5F_ACC_RDONLY, H5P_DEFAULT);
111 std::cout <<
"Got " << region_names.size() <<
" regions" <<
std::endl;
112 for (
const auto &
n : region_names) {
116 std::cout <<
"Got " << element_names.size() <<
" elements" <<
std::endl;
117 for (
const auto & element_name : element_names) {
120 hid_t dataset = H5Dopen(region_group, element_name.data(), H5P_DEFAULT);
121 hsize_t ds_size = H5Dget_storage_size(dataset);
124 std::vector<char> ds_data(ds_size);
125 H5Dread(dataset, H5T_STD_I8LE, H5S_ALL, H5S_ALL, H5P_DEFAULT,
129 Fragment frag(&ds_data[0], Fragment::BufferAdoptionMode::kReadOnlyMode);
131 std::cout <<
"\tMade fragment" <<
std::endl;
132 std::cout <<
"\t" << frag.get_header() <<
std::endl;
136 uint8_t * data_ptr =
reinterpret_cast<uint8_t*
>(frag.get_data());
140 while (data_pos < (frag.get_header().size -
sizeof(FragmentHeader))) {
141 EventHeader * event_header
142 =
reinterpret_cast<EventHeader*
>(data_ptr + data_pos);
144 std::cout <<
"\tEvent header " << event_header->length <<
std::endl;
149 output_wfs->emplace_back(wf_hit.first);
150 output_hits->emplace_back(wf_hit.second);
153 data_pos += event_header->length;
157 std::cout <<
"Iterated through " << iP <<
" packets " <<
std::endl;
159 H5Gclose(region_group);
Handle< PROD > getHandle(SelectorBase const &) const
std::string fFileInfoLabel
std::list< std::string > getMidLevelGroupNames(hid_t grp)
ProductID put(std::unique_ptr< PROD > &&edp, std::string const &instance={})
std::pair< raw::OpDetWaveform, recob::OpHit > MakeWaveformAndHit(const dunedaq::detdataformats::ssp::EventHeader *event_header, size_t data_pos, uint8_t *data_ptr)
hid_t getGroupFromPath(HDFFileInfoPtr &hdfFileInfoPtr, const std::string &path)
QTextStream & endl(QTextStream &s)
std::string fOutputDataLabel