The Gaudi Framework  master (adcf1ca6)
Loading...
Searching...
No Matches
BranchWrapper.h
Go to the documentation of this file.
1/***********************************************************************************\
2* (c) Copyright 2024-2025 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 std::string m_className; // Class name of the data
31 std::string m_location; // Location of the data in the data store
32 void ( *setBranchAddress )( gsl::not_null<TBranch*>,
33 const void** ); // Function pointer for the method used to set the address of the data
34 // buffer
35
36 public:
37 BranchWrapper( const gsl::not_null<TTree*> tree, const std::string& className, const std::string& branchName,
38 const std::string& location, const std::string& algName, unsigned int bufferSize = 32000,
39 unsigned int splitLevel = 99 );
40
41 void setDataPtr( void const* dataPtr );
42 void setBranchData( const gsl::not_null<DataObject*> pObj );
43 const std::string& getLocation() const { return m_location; }
44 const std::string& getClassName() const { return m_className; }
45 void setBufferSize( unsigned int size ) { m_branch->SetBasketSize( size ); }
46
48 unsigned int computeOptimalBufferSize( unsigned int minBufferSize, unsigned int maxBufferSize,
49 unsigned int approxEventsPerBasket, unsigned int splitLevel );
51 void padEntries();
52 };
53
54 } // namespace details
55} // 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...
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)
const std::string & getLocation() const
void setBranchData(const gsl::not_null< DataObject * > pObj)