The Gaudi Framework  v38r3 (c3fc9673)
BranchWrapper.h
Go to the documentation of this file.
1 /***********************************************************************************\
2 * (c) Copyright 2024 CERN for the benefit of the LHCb and ATLAS collaborations *
3 * *
4 * This software is distributed under the terms of the Apache version 2 licence, *
5 * copied verbatim in the file "LICENSE". *
6 * *
7 * In applying this licence, CERN does not waive the privileges and immunities *
8 * granted to it by virtue of its status as an Intergovernmental Organization *
9 * or submit itself to any jurisdiction. *
10 \***********************************************************************************/
11 #pragma once
12 
13 #include <Gaudi/Algorithm.h>
15 #include <TTree.h>
16 #include <gsl/pointers>
17 #include <string>
18 
19 namespace Gaudi {
20  namespace details {
25  struct BranchWrapper {
26 
27  private:
28  void const* m_dataBuffer = nullptr; // Data buffer for branch creation
29  AnyDataWrapperBase* baseWrapper = nullptr; // Pointer to the base wrapper for type-safe access to data
30  TBranch* m_branch = nullptr; // TBranch object
31  std::string m_className; // Class name of the data
32  std::string m_branchName; // Branch name in the TTree
33  std::string m_location; // Location of the data in the data store
34  const Gaudi::Algorithm& m_algRef; // Reference to the Gaudi algorithm using this wrapper
35  void ( *setBranchAddress )( gsl::not_null<TBranch*>,
36  const void** ); // Function pointer for the method used to set the address of the data
37  // buffer
38 
39  public:
40  BranchWrapper( const gsl::not_null<TTree*> tree, const std::string& className, const std::string& branchName,
41  const std::string& location, const Gaudi::Algorithm& algRef );
42 
43  void setDataPtr( void const* dataPtr );
44 
45  void setBranchData( const gsl::not_null<DataObject*> pObj );
46 
47  std::string getLocation() const;
48 
49  std::string getClassName() const;
50  };
51 
52  } // namespace details
53 } // namespace Gaudi
std::string
STL class.
Gaudi::details::BranchWrapper::m_location
std::string m_location
Definition: BranchWrapper.h:33
GaudiAlg.HistoUtils.location
location
Definition: HistoUtils.py:964
Gaudi::details::BranchWrapper::baseWrapper
AnyDataWrapperBase * baseWrapper
Definition: BranchWrapper.h:29
Gaudi::details::BranchWrapper::getClassName
std::string getClassName() const
Definition: BranchWrapper.cpp:89
Gaudi::details::BranchWrapper::m_branch
TBranch * m_branch
Definition: BranchWrapper.h:30
Gaudi::details::BranchWrapper::setBranchData
void setBranchData(const gsl::not_null< DataObject * > pObj)
Definition: BranchWrapper.cpp:76
Gaudi::details::BranchWrapper::getLocation
std::string getLocation() const
Definition: BranchWrapper.cpp:87
AnyDataWrapperBase
Definition: AnyDataWrapper.h:30
Gaudi::details::BranchWrapper::m_branchName
std::string m_branchName
Definition: BranchWrapper.h:32
Gaudi::details::BranchWrapper::m_className
std::string m_className
Definition: BranchWrapper.h:31
details
Definition: AnyDataWrapper.h:19
Gaudi::details::BranchWrapper::m_dataBuffer
void const * m_dataBuffer
Definition: BranchWrapper.h:28
Gaudi::Algorithm
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:90
Algorithm.h
Gaudi
Header file for std:chrono::duration-based Counters.
Definition: __init__.py:1
Gaudi::details::BranchWrapper::setDataPtr
void setDataPtr(void const *dataPtr)
Definition: BranchWrapper.cpp:69
Gaudi::details::BranchWrapper::m_algRef
const Gaudi::Algorithm & m_algRef
Definition: BranchWrapper.h:34
Gaudi::details::BranchWrapper::BranchWrapper
BranchWrapper(const gsl::not_null< TTree * > tree, const std::string &className, const std::string &branchName, const std::string &location, const Gaudi::Algorithm &algRef)
Definition: BranchWrapper.cpp:35
Gaudi::details::BranchWrapper
Encapsulates a branch within a ROOT TTree, managing the data and interaction with the TTree.
Definition: BranchWrapper.h:25
Gaudi::details::BranchWrapper::setBranchAddress
void(* setBranchAddress)(gsl::not_null< TBranch * >, const void **)
Definition: BranchWrapper.h:35
DataObjectHandle.h