Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes to help avoid warning messages when tardy TPs arrive at the TPStreamWriter #96

Merged
merged 4 commits into from
Jul 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions include/hdf5libs/HDF5FileLayout.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,11 @@ class HDF5FileLayout
*/
std::vector<std::string> get_path_elements(const daqdataformats::FragmentHeader& fh) const;

/**
* @brief get the path for the TimeSliceHeader as a single string (e.g. /a/b/c)
*/
std::string get_path_string(const daqdataformats::TimeSliceHeader& tsh) const;

/**
* @brief extract Fragment GeoID given path elements
*/
Expand Down
2 changes: 2 additions & 0 deletions include/hdf5libs/HDF5RawDataFile.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ ERS_DECLARE_ISSUE(hdf5libs, InvalidHDF5Attribute, "Attribute " << name << " not

ERS_DECLARE_ISSUE(hdf5libs, HDF5AttributeExists, "Attribute " << name << " already exists.", ((std::string)name))

ERS_DECLARE_ISSUE(hdf5libs, TimeSliceAlreadyExists, "The TimeSlice record for " << name << " already exists.", ((std::string)name))

namespace hdf5libs {

/**
Expand Down
13 changes: 13 additions & 0 deletions src/HDF5FileLayout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,19 @@ HDF5FileLayout::get_path_elements(const daqdataformats::FragmentHeader& fh) cons
return path_elements;
}

/**
* @brief get the path for the TimeSliceHeader as a single string
*/
std::string
HDF5FileLayout::get_path_string(const daqdataformats::TimeSliceHeader& tsh) const
{
std::ostringstream path_string;
path_string << "/" << get_timeslice_number_string(tsh.timeslice_number)
<< "/" << m_conf_params.raw_data_group_name
<< "/" << tsh.element_id.to_string() << "_" << m_conf_params.record_header_dataset_name;
return path_string.str();
}

/**
* @brief get the full path for a record header dataset based on trig/seq number
*/
Expand Down
3 changes: 3 additions & 0 deletions src/HDF5RawDataFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,9 @@ HDF5RawDataFile::write(const daqdataformats::TriggerRecord& tr)
void
HDF5RawDataFile::write(const daqdataformats::TimeSlice& ts)
{
std::string tsh_path = m_file_layout_ptr->get_path_string(ts.get_header());
if (m_file_ptr->exist(tsh_path)) {throw TimeSliceAlreadyExists(ERS_HERE, tsh_path);}

// the source_id_path map that we will build up as we write the TR header
// and fragments (and then write the map into the HDF5 TR_record Group)
HDF5SourceIDHandler::source_id_path_map_t source_id_path_map;
Expand Down
1 change: 1 addition & 0 deletions test/apps/HDF5LIBS_TestDumpRecord.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ main(int argc, char** argv)
uint16_t link_id = (geo_id >> 48) & 0xffff;
ss << "\n\t\t\t"
<< "subdetector " << DetID::subdetector_to_string(static_cast<DetID::Subdetector>(det_id))
<< " (" << det_id << ")"
<< ", crate " << crate_id << ", slot " << slot_id << ", link " << link_id;
}
}
Expand Down