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

Refactor the RNTupleWriter internals and reduce some code duplication #614

Merged
merged 11 commits into from
Jun 11, 2024

Conversation

tmadlener
Copy link
Collaborator

BEGINRELEASENOTES

  • Refactor the RNTupleWriter internals a bit and reduce some code duplication between the RNTupleWriter and the ROOTWriter
  • Add getKeys and getValues methods to GenericParameters
  • Remove the CollectionBranches.h header and move all root related helpers into utilities/RootHelpers.h

ENDRELEASENOTES

In more detail:

  • Rename the internal RNTupleWriter::CollectionInfo struct to RNTupleWriter::CategoryInfo and group the members that are used to store and write the GenericParameters data into that, such that all data belonging to a category are grouped together
  • Introduce ParamStorage to more easily refer to a pair of keys and values (vectors). This is done in preparation for another PR that is in the works for addressing GenericParameters should be stored the same way for TTree and RNTuple backends #590.
  • Move some of the typdefs that have been present in the ROOTWriter and the RNTupleWriter into the newly created utilities/RootHelpers.h header

Copy link
Collaborator Author

@tmadlener tmadlener left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merging this to unblock #615 later today unless there are comments.

@tmadlener tmadlener force-pushed the refactor-rntuple-writer branch from 35713a9 to ba9f090 Compare June 11, 2024 12:21
Copy link
Collaborator

@hegner hegner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Looks like boring, but important refactoring.
I would like to see some more documentation as mentioned in a comment

{
auto& mtx = getMutex<T>();
const auto& map = getMap<T>();
std::lock_guard lock{mtx};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whenever locks are being used one should document where why and when they are needed

TBranch* data{nullptr};
std::vector<TBranch*> refs{};
std::vector<TBranch*> vecs{};
std::vector<std::string> refNames{}; ///< The names of the relation branches
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in principle one could do indices instead of strings here, but for the sake of simplicity we stay with this.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indices would be harder to work with here IMHO, because we don't maintain a list of all TBranches that we have (let alone their order). We simply use this to group the pointers that we get from the TTree and let that do all the management.

@tmadlener tmadlener merged commit ab6b2a4 into AIDASoft:master Jun 11, 2024
18 checks passed
@tmadlener tmadlener deleted the refactor-rntuple-writer branch June 11, 2024 18:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants