-
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
Refactor the RNTupleWriter internals and reduce some code duplication #614
Changes from 10 commits
024c0b1
2af5336
283be1d
3450586
80d267a
a882b51
10d1b3b
c4b48d4
8fd6811
ba9f090
c48790b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#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 { | ||
TBranch* data{nullptr}; | ||
std::vector<TBranch*> refs{}; | ||
std::vector<TBranch*> vecs{}; | ||
std::vector<std::string> refNames{}; ///< The names of the relation branches | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
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> | ||
using ParamStorage = std::tuple<std::vector<std::string>, std::vector<std::vector<T>>>; | ||
|
||
} // namespace root_utils | ||
} // namespace podio | ||
|
||
#endif // PODIO_UTILITIES_ROOTHELPERS_H |
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.
Whenever locks are being used one should document where why and when they are needed