Johnfreeman/trgdataformats issue59 review impl - #61
Draft
jcfreeman2 wants to merge 15 commits into
Draft
Conversation
added 15 commits
July 14, 2026 13:21
…caps is reserved for reference to #defines and macros
…equaling the invalid det_id value
* A more systematic approach to dealing with unsigned values when it comes to our linter, including removal of NOLINT directives when the actual type is unsigned but the linter wouldn't be able to determine this * static_assert-ions for the developers benefit meant to remind them to bump the version if they add or remove variables from TriggerCandidateData or TriggerActivityData. Not bulletproof, but much better than nothing. * static declaration of map in get_trigger_candidate_type_names so that it doesn't get constructed every time the function is called * Removal of exception throwing as flow-control mechanism in trigger_candidate_type_to_string; exceptions are costly and should generally just be used for problems which are exceptional and can't be handled locally.
* Make the type of the enums in the structs explicit so we can explicitly reason about their size * Have string_to_trigger_candidate_type return a TriggerCandidateData::Type rather than an int * Add some static_assert checks to TriggerPrimitive to confirm the integrity of its layout * Add a TODO to Types.hpp basically pointing out that we should investigate making trgdataformats depend on daqdataformats
fddetdataformats, add some functions which can be called directly in the implementation of the trigger type adaptor and would allow for templatization
…ggerDataStructures_test"; note that the lack of a default value for detid in the code causes a failure
… comparison functions added to TriggerPrimitive as well as support for what's in Types.hpp
…r declarations to match the header, and add a static_assert meant to alert developers to update bindings when versions are changed
…ateData::Type to a name from an std::map into an std::array so we can perform compile-time checks on it
…tion and give the sentinel enum an even more obvious name so developers won't add enums after it
…lled by the top-level trgdataformats_binding_tests.py script
eflumerf
approved these changes
Aug 7, 2026
eflumerf
left a comment
Member
There was a problem hiding this comment.
Looks good, unit and integration tests pass. Had to add fdreadoutlibs to the required checkout list
Member
|
Can you create and link PRs for those other repos? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This is a PR which engages primarily in refactoring
trgdataformatsas part of the implementation of its code review, discussed in #59 and part of the broader data formats review effort.Right now (8/6/2026) this PR is in draft status. In particular, I need to deal with the
README.mdininclude/trgdataformats. Additionally, GitHub is having problems today so I haven't had the chance to create a test build. But in terms of the changes to the source code itself, I have things basically where I want them, though some changes will be more controversial than others. These changes include:trgdataformats_binding_tests.pyscript which tests the Python bindingsstatic_assertions which do various things. Upholding the integrity of the bit layouts of overlays / prodding developers to remember to bump the version of structs when needed / making it hard to add a newTriggerCandidateData::Typewhile forgetting to account for it instring_to_trigger_candidate_typeandtrigger_candidate_type_to_string.set_inputsfunction toTriggerObjectOverlay. I understand if others think this overkill; originally (as I describe in the Issue) I thought I would pair it withget_inputsfunction but I'm not sureget_inputshas any point at all, really.TriggerPrimitiveout ofTypes.hppand intoTriggerPrimitive.hpp.TriggerPrimitive-operator<,get_timestampandset_timestamp. These are things the type adapter can use.Some things I've observed / been thinking about beyond just the changes in this PR:
trgdataformatsto depend ondaqdataformats, we no longer need to redefine atimestamp_ttype and I believe we could replacedetid_twithSourceID(see Phil Rodrigues's 2021-era comments which I left in the code).TriggerCandidateDataandTriggerActivityDatais laid out, the compiler inserts a lot of padding - e.g., aTriggerActivityDatainstance is 80 bytes, but contains a lot less than 80 bytes worth of information. As I wanted to focus on refactoring for this PR, I didn't play around with the ordering of members, but it's something perhaps worth thinking about.get_timestamp()function") accessible not just tofddetdataformatsbuttrgdataformatsas wellNote also to build this you'll want to check out the branches of the same name in
dfmodules,fdreadoutlibs,hdf5libs,triggerandtriggeralgs; those changes are all quite minor.Type of change
Testing checklist
dbt-build --unittest)pytest -s minimal_system_quick_test.py)dunedaq_integtest_bundle.sh)python -m pytest)pre-commit run --all-files)Comments here on the testing
Further checks
dbt-build --lint, and/or see https://dune-daq-sw.readthedocs.io/en/latest/packages/styleguide/)(Indicate issue here: # (issue))