-
Notifications
You must be signed in to change notification settings - Fork 60
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
Make the TTree based ROOT backend store the GenericParameters the same way as the RNTuple based one #615
Merged
hegner
merged 17 commits into
AIDASoft:master
from
tmadlener:uniform-generic-param-storage
Jun 11, 2024
Merged
Make the TTree based ROOT backend store the GenericParameters the same way as the RNTuple based one #615
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
024c0b1
Refactor root utilities and reduce code duplication
tmadlener 2af5336
Rename CollectionInfo to CategoryInfo to better convey intention
tmadlener 283be1d
Remove unnecessary member variables
tmadlener 3450586
Add functionality to get all values for a type to GenericParameters
tmadlener 80d267a
Move some global state into category state
tmadlener a882b51
Avoid unnecessary copy
tmadlener 10d1b3b
Fix include guards to conform to style guide
tmadlener c4b48d4
Make sure to take lock long enough
tmadlener 8fd6811
Switch to tuple for consistency
tmadlener ba9f090
Remove obsolete reset
tmadlener d1642aa
Make the ROOTWriter write split GenericParameters
tmadlener 39e04bf
Make the ROOTReader read the files again
tmadlener 9a6ea9e
Add tests to make sure that v00-99 files stay readable
tmadlener 7184f7d
Make older compilers happy with in place construction
tmadlener 866710d
Make sure to only run SIO legacy tests when input data is available
tmadlener 7398cf3
Make tests work by hiding forward declaration from CLING
tmadlener fb175e1
Add comment for reasoning about excluding forward decl for CLING
tmadlener File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
#ifndef PODIO_UTILITIES_ROOTHELPERS_H | ||
#define PODIO_UTILITIES_ROOTHELPERS_H | ||
|
||
#include "TBranch.h" | ||
|
||
#include <string> | ||
#include <tuple> | ||
#include <vector> | ||
|
||
namespace podio { | ||
class CollectionBase; | ||
|
||
namespace root_utils { | ||
|
||
// A collection of additional information that describes the collection: the | ||
// collectionID, the collection (data) type, whether it is a subset | ||
// collection, and its schema version | ||
using CollectionWriteInfoT = std::tuple<uint32_t, std::string, bool, unsigned int>; | ||
// for backwards compatibility | ||
using CollectionInfoWithoutSchemaT = std::tuple<int, std::string, bool>; | ||
|
||
/// A collection name and a base pointer grouped together for writing | ||
using StoreCollection = std::tuple<const std::string&, podio::CollectionBase*>; | ||
|
||
/// Small helper struct to collect all branches that are necessary to read or | ||
/// write a collection. Needed to cache the branch pointers and avoid having to | ||
/// get them from a TTree/TChain for every event. | ||
struct CollectionBranches { | ||
CollectionBranches() = default; | ||
~CollectionBranches() = default; | ||
CollectionBranches(const CollectionBranches&) = delete; | ||
CollectionBranches& operator=(const CollectionBranches&) = delete; | ||
CollectionBranches(CollectionBranches&&) = default; | ||
CollectionBranches& operator=(CollectionBranches&&) = default; | ||
|
||
CollectionBranches(TBranch* dataBranch) : data(dataBranch) { | ||
} | ||
|
||
TBranch* data{nullptr}; | ||
std::vector<TBranch*> refs{}; | ||
std::vector<TBranch*> vecs{}; | ||
std::vector<std::string> refNames{}; ///< The names of the relation branches | ||
std::vector<std::string> vecNames{}; ///< The names of the vector member branches | ||
}; | ||
|
||
/// Pair of keys and values for one type of the ones that can be stored in | ||
/// GenericParameters | ||
template <typename T> | ||
struct ParamStorage { | ||
ParamStorage() = default; | ||
~ParamStorage() = default; | ||
ParamStorage(const ParamStorage&) = delete; | ||
ParamStorage& operator=(const ParamStorage&) = delete; | ||
ParamStorage(ParamStorage&&) = default; | ||
ParamStorage& operator=(ParamStorage&&) = default; | ||
|
||
ParamStorage(const std::vector<std::string>& ks, const std::vector<std::vector<T>>& vs) : keys(ks), values(vs) { | ||
} | ||
|
||
auto keysPtr() { | ||
m_keysPtr = &keys; | ||
return &m_keysPtr; | ||
} | ||
|
||
auto valuesPtr() { | ||
m_valuesPtr = &values; | ||
return &m_valuesPtr; | ||
} | ||
|
||
std::vector<std::string> keys{}; | ||
std::vector<std::vector<T>> values{}; | ||
|
||
private: | ||
std::vector<std::string>* m_keysPtr{nullptr}; | ||
std::vector<std::vector<T>>* m_valuesPtr{nullptr}; | ||
}; | ||
|
||
} // namespace root_utils | ||
} // namespace podio | ||
|
||
#endif // PODIO_UTILITIES_ROOTHELPERS_H |
This file contains 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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one line of documentation why that is the case - if possible to explain