Encapsulates a branch within a ROOT TTree, managing the data and interaction with the TTree.
More...
#include </builds/gaudi/Gaudi/GaudiUtils/include/Gaudi/details/BranchWrapper.h>
|
| BranchWrapper (const gsl::not_null< TTree * > tree, const std::string &className, const std::string &branchName, const std::string &location, const std::string &algName) |
|
void | setDataPtr (void const *dataPtr) |
|
void | setBranchData (const gsl::not_null< DataObject * > pObj) |
|
const std::string & | getLocation () const |
|
const std::string & | getClassName () const |
|
Encapsulates a branch within a ROOT TTree, managing the data and interaction with the TTree.
Definition at line 25 of file BranchWrapper.h.
◆ BranchWrapper()
Gaudi::details::BranchWrapper::BranchWrapper |
( |
const gsl::not_null< TTree * > | tree, |
|
|
const std::string & | className, |
|
|
const std::string & | branchName, |
|
|
const std::string & | location, |
|
|
const std::string & | algName ) |
Definition at line 35 of file BranchWrapper.cpp.
38 auto leafListTag = getLeafListForType(
m_className );
39 if ( leafListTag ) {
40
42 ( fmt::format(
"{}/{}",
m_className, leafListTag.value() ) ).c_str() );
43 setBranchAddress = []( gsl::not_null<TBranch*> br,
const void** wrappedDataPtr ) {
44 br->SetAddress( const_cast<void*>( *wrappedDataPtr ) );
45 };
46
47 }
else if ( TClass::GetClass(
m_className.c_str() ) ) {
48
50 setBranchAddress = []( gsl::not_null<TBranch*> br,
const void** wrappedDataPtr ) {
51 br->SetAddress( wrappedDataPtr );
52 };
53
54 } else {
55 throw GaudiException( fmt::format( "Cannot create branch {} for unknown class: {}. Provide a dictionary please.",
58 }
59
63 }
64 }
constexpr static const auto FAILURE
void(* setBranchAddress)(gsl::not_null< TBranch * >, const void **)
void const * m_dataBuffer
◆ getClassName()
const std::string & Gaudi::details::BranchWrapper::getClassName |
( |
| ) |
const |
◆ getLocation()
const std::string & Gaudi::details::BranchWrapper::getLocation |
( |
| ) |
const |
◆ setBranchData()
void Gaudi::details::BranchWrapper::setBranchData |
( |
const gsl::not_null< DataObject * > | pObj | ) |
|
Definition at line 75 of file BranchWrapper.cpp.
75 {
76 auto baseWrapper = dynamic_cast<AnyDataWrapperBase*>( pObj.get() );
77 m_dataBuffer = baseWrapper ? baseWrapper->payload() : pObj.get();
79 }
◆ setDataPtr()
void Gaudi::details::BranchWrapper::setDataPtr |
( |
void const * | dataPtr | ) |
|
◆ m_algName
std::string Gaudi::details::BranchWrapper::m_algName |
|
private |
◆ m_branch
TBranch* Gaudi::details::BranchWrapper::m_branch = nullptr |
|
private |
◆ m_branchName
std::string Gaudi::details::BranchWrapper::m_branchName |
|
private |
◆ m_className
std::string Gaudi::details::BranchWrapper::m_className |
|
private |
◆ m_dataBuffer
void const* Gaudi::details::BranchWrapper::m_dataBuffer = nullptr |
|
private |
◆ m_location
std::string Gaudi::details::BranchWrapper::m_location |
|
private |
◆ setBranchAddress
void(* Gaudi::details::BranchWrapper::setBranchAddress) (gsl::not_null< TBranch * >, const void **) |
|
private |
The documentation for this struct was generated from the following files: