Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-04-26 09:01:09

0001 /***********************************************************************************\
0002 * (c) Copyright 2024 CERN for the benefit of the LHCb and ATLAS collaborations      *
0003 *                                                                                   *
0004 * This software is distributed under the terms of the Apache version 2 licence,     *
0005 * copied verbatim in the file "LICENSE".                                            *
0006 *                                                                                   *
0007 * In applying this licence, CERN does not waive the privileges and immunities       *
0008 * granted to it by virtue of its status as an Intergovernmental Organization        *
0009 * or submit itself to any jurisdiction.                                             *
0010 \***********************************************************************************/
0011 #pragma once
0012 
0013 #include <Gaudi/Algorithm.h>
0014 #include <GaudiKernel/DataObjectHandle.h>
0015 #include <TTree.h>
0016 #include <gsl/pointers>
0017 #include <string>
0018 
0019 namespace Gaudi {
0020   namespace details {
0021     /**
0022      * @struct BranchWrapper
0023      * @brief Encapsulates a branch within a ROOT TTree, managing the data and interaction with the TTree.
0024      */
0025     struct BranchWrapper {
0026 
0027     private:
0028       void const*             m_dataBuffer = nullptr; // Data buffer for branch creation
0029       TBranch*                m_branch     = nullptr; // TBranch object
0030       std::string             m_className;            // Class name of the data
0031       std::string             m_branchName;           // Branch name in the TTree
0032       std::string             m_location;             // Location of the data in the data store
0033       const Gaudi::Algorithm& m_algRef;               // Reference to the Gaudi algorithm using this wrapper
0034       void ( *setBranchAddress )( gsl::not_null<TBranch*>,
0035                                   const void** ); // Function pointer for the method used to set the address of the data
0036                                                   // buffer
0037 
0038     public:
0039       BranchWrapper( const gsl::not_null<TTree*> tree, const std::string& className, const std::string& branchName,
0040                      const std::string& location, const Gaudi::Algorithm& algRef );
0041 
0042       void setDataPtr( void const* dataPtr );
0043 
0044       void setBranchData( const gsl::not_null<DataObject*> pObj );
0045 
0046       std::string getLocation() const;
0047 
0048       std::string getClassName() const;
0049     };
0050 
0051   } // namespace details
0052 } // namespace Gaudi