![]() |
Project
|
BranchDef is used to define the mapping between inputs and branches. More...
#include <RootTreeWriter.h>
Public Types | |
using | type = T |
using | key_type = KeyType |
using | key_extractor = KeyExtractor |
using | Fill = std::function< void(TBranch &branch, T const &)> |
using | FillExt = std::function< void(TBranch &branch, T const &, DataRef const &)> |
using | Spectator = std::function< void(T const &)> |
using | SpectatorExt = std::function< void(T const &, DataRef const &)> |
using | BranchCallback = std::variant< std::monostate, Fill, FillExt, Spectator, SpectatorExt > |
Public Member Functions | |
BranchDef (key_type key, std::string _branchName, size_t _nofBranches=1) | |
template<typename... Args> | |
BranchDef (key_type key, std::string _branchName, Args &&... args) | |
template<typename... Args> | |
BranchDef (std::vector< key_type > vec, std::string _branchName, Args &&... args) | |
template<typename Arg , typename... Args> | |
void | init (Arg &&arg, Args &&... args) |
recursively init member variables from parameter pack | |
template<typename Arg > | |
void | assertNoMatchingType (Arg &&arg) |
Public Attributes | |
std::vector< key_type > | keys |
std::string | branchName |
size_t | nofBranches = 1 |
number of branches controlled by this definition for the same type | |
IndexExtractor | getIndex = nullptr |
extractor function for the index for parallel branches | |
BranchNameMapper | getName = nullptr |
get name of branch from base name and index | |
BranchCallback | callback |
BranchDef is used to define the mapping between inputs and branches.
A branch definition is always bound to a particular data type of the object to be written to tree branch. The type must be provided as template parameter.
key
which describes the input binding, i.e. it is used as argument in the input function. The RootTreeWriter uses std::string
as internal key type to store a map of all dranch definitions. An extractor must be defined for the key type provided to BranchDef. In simple cases, defaults RootTreeWriter::key_type and RootTreeWriter::DefaultKeyExtractor can be used directly and are thus default template parameters.getIndex
and getName
. The getIndex
callback may extract the relavent information from the data object e.g. from the header stack and returns an index. The getName
callback must return the branch name for writing based on this index.getIndex
and getName
callbacks need to be providedbranch specification for the RootTreeWriter
Definition at line 182 of file RootTreeWriter.h.
using o2::framework::RootTreeWriter::BranchDef< T, KeyType, KeyExtractor >::BranchCallback = std::variant<std::monostate, Fill, FillExt, Spectator, SpectatorExt> |
Definition at line 199 of file RootTreeWriter.h.
using o2::framework::RootTreeWriter::BranchDef< T, KeyType, KeyExtractor >::Fill = std::function<void(TBranch& branch, T const&)> |
Definition at line 195 of file RootTreeWriter.h.
using o2::framework::RootTreeWriter::BranchDef< T, KeyType, KeyExtractor >::FillExt = std::function<void(TBranch& branch, T const&, DataRef const&)> |
Definition at line 196 of file RootTreeWriter.h.
using o2::framework::RootTreeWriter::BranchDef< T, KeyType, KeyExtractor >::key_extractor = KeyExtractor |
Definition at line 185 of file RootTreeWriter.h.
using o2::framework::RootTreeWriter::BranchDef< T, KeyType, KeyExtractor >::key_type = KeyType |
Definition at line 184 of file RootTreeWriter.h.
using o2::framework::RootTreeWriter::BranchDef< T, KeyType, KeyExtractor >::Spectator = std::function<void(T const&)> |
Definition at line 197 of file RootTreeWriter.h.
using o2::framework::RootTreeWriter::BranchDef< T, KeyType, KeyExtractor >::SpectatorExt = std::function<void(T const&, DataRef const&)> |
Definition at line 198 of file RootTreeWriter.h.
using o2::framework::RootTreeWriter::BranchDef< T, KeyType, KeyExtractor >::type = T |
Definition at line 183 of file RootTreeWriter.h.
|
inline |
simple constructor for single input and one branch the definition is ignored if number of branches is zero
key | input key |
_branchName | name of the target branch |
_nofBranches | number of branches |
Definition at line 207 of file RootTreeWriter.h.
|
inline |
constructor for single input and multiple output branches the definition is ignored if number of branches is zero
key | input key |
_branchName | name of the target branch |
_nofBranches | the number of target branches |
args | parameter pack can contain the following argument types: IndexExtractor: index callback BranchNameMapper: branch name callback Fill: fill handler Spectator: spectator handler |
Definition at line 220 of file RootTreeWriter.h.
|
inline |
constructor for multiple inputs and multiple output branches the definition is ignored if number of branches is zero
key | vector of input keys |
_branchName | name of the target branch |
_nofBranches | the number of target branches |
args | parameter pack can contain the following argument types: IndexExtractor: index callback BranchNameMapper: branch name callback Fill: fill handler Spectator: spectator handler |
Definition at line 236 of file RootTreeWriter.h.
|
inline |
Definition at line 271 of file RootTreeWriter.h.
|
inline |
recursively init member variables from parameter pack
Definition at line 243 of file RootTreeWriter.h.
std::string o2::framework::RootTreeWriter::BranchDef< T, KeyType, KeyExtractor >::branchName |
Definition at line 187 of file RootTreeWriter.h.
BranchCallback o2::framework::RootTreeWriter::BranchDef< T, KeyType, KeyExtractor >::callback |
Definition at line 200 of file RootTreeWriter.h.
IndexExtractor o2::framework::RootTreeWriter::BranchDef< T, KeyType, KeyExtractor >::getIndex = nullptr |
extractor function for the index for parallel branches
Definition at line 191 of file RootTreeWriter.h.
BranchNameMapper o2::framework::RootTreeWriter::BranchDef< T, KeyType, KeyExtractor >::getName = nullptr |
get name of branch from base name and index
Definition at line 193 of file RootTreeWriter.h.
std::vector<key_type> o2::framework::RootTreeWriter::BranchDef< T, KeyType, KeyExtractor >::keys |
Definition at line 186 of file RootTreeWriter.h.
size_t o2::framework::RootTreeWriter::BranchDef< T, KeyType, KeyExtractor >::nofBranches = 1 |
number of branches controlled by this definition for the same type
Definition at line 189 of file RootTreeWriter.h.