The Gaudi Framework  master (37c0b60a)
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  TBranch* m_branch = nullptr; // TBranch object
30  std::string m_className; // Class name of the data
31  std::string m_branchName; // Branch name in the TTree
32  std::string m_location; // Location of the data in the data store
33  std::string m_algName; // Reference to the Gaudi algorithm using this wrapper
34  void ( *setBranchAddress )( gsl::not_null<TBranch*>,
35  const void** ); // Function pointer for the method used to set the address of the data
36  // buffer
37 
38  public:
39  BranchWrapper( const gsl::not_null<TTree*> tree, const std::string& className, const std::string& branchName,
40  const std::string& location, const std::string& algName );
41 
42  void setDataPtr( void const* dataPtr );
43 
44  void setBranchData( const gsl::not_null<DataObject*> pObj );
45 
46  const std::string& getLocation() const;
47 
48  const std::string& getClassName() const;
49  };
50 
51  } // namespace details
52 } // namespace Gaudi
std::string
STL class.
Gaudi::details::BranchWrapper::m_algName
std::string m_algName
Definition: BranchWrapper.h:33
Gaudi::details::BranchWrapper::m_location
std::string m_location
Definition: BranchWrapper.h:32
Gaudi::details::BranchWrapper::getClassName
const std::string & getClassName() const
Definition: BranchWrapper.cpp:83
Gaudi::details::BranchWrapper::m_branch
TBranch * m_branch
Definition: BranchWrapper.h:29
Gaudi::details::BranchWrapper::setBranchData
void setBranchData(const gsl::not_null< DataObject * > pObj)
Definition: BranchWrapper.cpp:75
Gaudi::details::BranchWrapper::m_branchName
std::string m_branchName
Definition: BranchWrapper.h:31
Gaudi::details::BranchWrapper::m_className
std::string m_className
Definition: BranchWrapper.h:30
details
Definition: AnyDataWrapper.h:19
Gaudi::details::BranchWrapper::getLocation
const std::string & getLocation() const
Definition: BranchWrapper.cpp:81
Gaudi::details::BranchWrapper::m_dataBuffer
void const * m_dataBuffer
Definition: BranchWrapper.h:28
Algorithm.h
Gaudi
This file provides a Grammar for the type Gaudi::Accumulators::Axis It allows to use that type from p...
Definition: __init__.py:1
Gaudi::details::BranchWrapper::setDataPtr
void setDataPtr(void const *dataPtr)
Definition: BranchWrapper.cpp:68
Gaudi::details::BranchWrapper::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: 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:34
DataObjectHandle.h