The Gaudi Framework  master (34daa81a)
Loading...
Searching...
No Matches
BranchWrapper.h
Go to the documentation of this file.
1/***********************************************************************************\
2* (c) Copyright 2024-2026 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
19namespace Gaudi {
20 namespace details {
26
27 private:
28 void const* m_dataBuffer = nullptr; // Data buffer for branch creation
29 TBranch* m_branch = nullptr; // TBranch object
30 bool m_ownsBuffer = false; // Whether we own the auto-allocated object in m_dataBuffer
31 std::string m_className; // Class name of the data
32 std::string m_location; // Location of the data in the data store
33 void ( *setBranchAddress )( gsl::not_null<TBranch*>,
34 const void** ); // Function pointer for the method used to set the address of the data
35 // buffer
36
37 public:
38 BranchWrapper( const gsl::not_null<TTree*> tree, const std::string& className, const std::string& branchName,
39 const std::string& location, const std::string& algName, unsigned int bufferSize = 32000,
40 unsigned int splitLevel = 99 );
42 BranchWrapper( BranchWrapper&& other ) noexcept;
43 BranchWrapper& operator=( BranchWrapper&& other ) noexcept;
44 BranchWrapper( const BranchWrapper& ) = delete;
46
47 void setDataPtr( void const* dataPtr );
48 void setBranchData( const gsl::not_null<DataObject*> pObj );
49 const std::string& getLocation() const { return m_location; }
50 const std::string& getClassName() const { return m_className; }
51 void setBufferSize( unsigned int size ) { m_branch->SetBasketSize( size ); }
52
54 unsigned int computeOptimalBufferSize( unsigned int minBufferSize, unsigned int maxBufferSize,
55 unsigned int approxEventsPerBasket, unsigned int splitLevel );
57 void padEntries();
58 };
59
60 } // namespace details
61} // namespace Gaudi
This file provides a Grammar for the type Gaudi::Accumulators::Axis It allows to use that type from p...
Definition __init__.py:1
unsigned int computeOptimalBufferSize(unsigned int minBufferSize, unsigned int maxBufferSize, unsigned int approxEventsPerBasket, unsigned int splitLevel)
compute optimal buffer size to fit given number of element per basket, respecting given min and max
void setBufferSize(unsigned int size)
void padEntries()
pad the number of item in the branch to the one of the Tree in which it leaves by adding empty entrie...
BranchWrapper & operator=(const BranchWrapper &)=delete
void(* setBranchAddress)(gsl::not_null< TBranch * >, const void **)
const std::string & getClassName() const
void setDataPtr(void const *dataPtr)
BranchWrapper(const gsl::not_null< TTree * > tree, const std::string &className, const std::string &branchName, const std::string &location, const std::string &algName, unsigned int bufferSize=32000, unsigned int splitLevel=99)
BranchWrapper & operator=(BranchWrapper &&other) noexcept
BranchWrapper(const BranchWrapper &)=delete
const std::string & getLocation() const
void setBranchData(const gsl::not_null< DataObject * > pObj)