Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TTreeReaderArray< T > Class Template Referencefinal

template<typename T>
class TTreeReaderArray< T >

An interface for reading collections stored in ROOT columnar datasets.

The TTreeReaderArray is a type-safe tool to be used in association with a TTreeReader to access the collections stored in TTree, TNtuple and TChain datasets. In order to access values which are not collections, the TTreeReaderValue class can be used.

See the documentation of TTreeReader for more details and examples.

Definition at line 75 of file TTreeReaderArray.h.

Classes

class  Iterator_t
 Random access iterator to the elements of a TTreeReaderArray. More...
 

Public Types

using const_iterator = Iterator_t< const TTreeReaderArray< T > >
 
using iterator = Iterator_t< TTreeReaderArray< T > >
 
- Public Types inherited from ROOT::Internal::TTreeReaderValueBase
typedef Bool_t(ROOT::Detail::TBranchProxy::* BranchProxyRead_t) ()
 
enum  EReadStatus { kReadSuccess = 0 , kReadNothingYet , kReadError }
 
enum  ESetupStatus {
  kSetupNotSetup = -7 , kSetupTreeDestructed = -8 , kSetupMakeClassModeMismatch = -9 , kSetupMissingCounterBranch = -6 ,
  kSetupMissingBranch = -5 , kSetupInternalError = -4 , kSetupMissingDictionary = -3 , kSetupMismatch = -2 ,
  kSetupNotACollection = -1 , kSetupMatch = 0 , kSetupMatchBranch = 7 , kSetupNoCheck = 5 ,
  kSetupMatchLeaf = 6
}
 Status flags, 0 is good. More...
 

Public Member Functions

 TTreeReaderArray (TTreeReader &tr, const char *branchname)
 Create an array reader of branch "branchname" for TTreeReader "tr".
 
T & At (std::size_t idx)
 
const T & At (std::size_t idx) const
 
iterator begin ()
 
const_iterator begin () const
 
const_iterator cbegin () const
 
const_iterator cend () const
 
iterator end ()
 
const_iterator end () const
 
T & operator[] (std::size_t idx)
 
const T & operator[] (std::size_t idx) const
 
- Public Member Functions inherited from ROOT::Internal::TTreeReaderArrayBase
 TTreeReaderArrayBase (TTreeReader *reader, const char *branchname, TDictionary *dict)
 
EReadStatus GetReadStatus () const override
 
std::size_t GetSize () const
 
Bool_t IsEmpty () const
 
- Public Member Functions inherited from ROOT::Internal::TTreeReaderValueBase
virtual ~TTreeReaderValueBase ()
 Unregister from tree reader, cleanup.
 
void * GetAddress ()
 Returns the memory address of the object being read.
 
const char * GetBranchName () const
 
TLeafGetLeaf ()
 If we are reading a leaf, return the corresponding TLeaf.
 
ESetupStatus GetSetupStatus () const
 Return this TTreeReaderValue's setup status.
 
Bool_t IsValid () const
 Return true if the branch was setup and read correctly.
 
EReadStatus ProxyRead ()
 
EReadStatus ProxyReadDefaultImpl ()
 
template<BranchProxyRead_t Func>
ROOT::Internal::TTreeReaderValueBase::EReadStatus ProxyReadTemplate ()
 Try to read the value from the TBranchProxy, returns the status of the read.
 

Protected Member Functions

const char * GetDerivedTypeName () const override
 
- Protected Member Functions inherited from ROOT::Internal::TTreeReaderArrayBase
void CreateProxy () override
 Create the proxy object for our branch.
 
bool GetBranchAndLeaf (TBranch *&branch, TLeaf *&myLeaf, TDictionary *&branchActualType)
 Determine the branch / leaf and its type; reset fProxy / fSetupStatus on error.
 
const char * GetBranchContentDataType (TBranch *branch, TString &contentTypeName, TDictionary *&dict)
 Access a branch's collection content (not the collection itself) through a proxy.
 
void SetImpl (TBranch *branch, TLeaf *myLeaf)
 Create the TVirtualCollectionReader object for our branch.
 
void * UntypedAt (std::size_t idx) const
 
- Protected Member Functions inherited from ROOT::Internal::TTreeReaderValueBase
 TTreeReaderValueBase (const TTreeReaderValueBase &)
 Copy-construct.
 
 TTreeReaderValueBase (TTreeReader *reader, const char *branchname, TDictionary *dict)
 Construct a tree value reader and register it with the reader object.
 
Detail::TBranchProxyGetProxy () const
 
void MarkTreeReaderUnavailable ()
 
void NotifyNewTree (TTree *newTree)
 The TTreeReader has switched to a new TTree. Update the leaf.
 
TTreeReaderValueBaseoperator= (const TTreeReaderValueBase &)
 Copy-assign.
 
void RegisterWithTreeReader ()
 Register with tree reader.
 
TBranchSearchBranchWithCompositeName (TLeaf *&myleaf, TDictionary *&branchActualType, std::string &err)
 Search a branch the name of which contains a ".".
 

Additional Inherited Members

- Protected Types inherited from ROOT::Internal::TTreeReaderValueBase
typedef EReadStatus(TTreeReaderValueBase::* Read_t) ()
 
- Static Protected Member Functions inherited from ROOT::Internal::TTreeReaderValueBase
static const char * GetBranchDataType (TBranch *branch, TDictionary *&dict, TDictionary const *curDict)
 Retrieve the type of data stored by branch; put its dictionary into dict, return its type name.
 
static std::string GetElementTypeName (const std::type_info &ti)
 Stringify the template argument.
 
- Protected Attributes inherited from ROOT::Internal::TTreeReaderArrayBase
std::unique_ptr< TVirtualCollectionReaderfImpl
 
- Protected Attributes inherited from ROOT::Internal::TTreeReaderValueBase
TString fBranchName
 Name of the branch to read data from.
 
TDictionaryfDict
 Type that the branch should contain.
 
bool fHaveLeaf: 1
 Whether the data is in a leaf.
 
bool fHaveStaticClassOffsets: 1
 Whether !fStaticClassOffsets.empty()
 
TLeaffLeaf = nullptr
 
TString fLeafName
 
Detail::TBranchProxyfProxy = nullptr
 Proxy for this branch, owned by TTreeReader.
 
Read_t fProxyReadFunc = &TTreeReaderValueBase::ProxyReadDefaultImpl
 ! Pointer to the Read implementation to use.
 
EReadStatus fReadStatus: 2
 Read status of this data access.
 
ESetupStatus fSetupStatus = kSetupNotSetup
 Setup status of this data access.
 
std::vector< Long64_tfStaticClassOffsets
 
TTreeReaderfTreeReader
 Tree reader we belong to.
 

#include <TTreeReaderArray.h>

Inheritance diagram for TTreeReaderArray< T >:
[legend]

Member Typedef Documentation

◆ const_iterator

template<typename T >
using TTreeReaderArray< T >::const_iterator = Iterator_t<const TTreeReaderArray<T> >

Definition at line 199 of file TTreeReaderArray.h.

◆ iterator

template<typename T >
using TTreeReaderArray< T >::iterator = Iterator_t<TTreeReaderArray<T> >

Definition at line 198 of file TTreeReaderArray.h.

Constructor & Destructor Documentation

◆ TTreeReaderArray()

template<typename T >
TTreeReaderArray< T >::TTreeReaderArray ( TTreeReader tr,
const char *  branchname 
)
inline

Create an array reader of branch "branchname" for TTreeReader "tr".

Definition at line 202 of file TTreeReaderArray.h.

Member Function Documentation

◆ At() [1/2]

template<typename T >
T & TTreeReaderArray< T >::At ( std::size_t  idx)
inline

Definition at line 205 of file TTreeReaderArray.h.

◆ At() [2/2]

template<typename T >
const T & TTreeReaderArray< T >::At ( std::size_t  idx) const
inline

Definition at line 206 of file TTreeReaderArray.h.

◆ begin() [1/2]

template<typename T >
iterator TTreeReaderArray< T >::begin ( )
inline

Definition at line 210 of file TTreeReaderArray.h.

◆ begin() [2/2]

template<typename T >
const_iterator TTreeReaderArray< T >::begin ( ) const
inline

Definition at line 212 of file TTreeReaderArray.h.

◆ cbegin()

template<typename T >
const_iterator TTreeReaderArray< T >::cbegin ( ) const
inline

Definition at line 214 of file TTreeReaderArray.h.

◆ cend()

template<typename T >
const_iterator TTreeReaderArray< T >::cend ( ) const
inline

Definition at line 215 of file TTreeReaderArray.h.

◆ end() [1/2]

template<typename T >
iterator TTreeReaderArray< T >::end ( )
inline

Definition at line 211 of file TTreeReaderArray.h.

◆ end() [2/2]

template<typename T >
const_iterator TTreeReaderArray< T >::end ( ) const
inline

Definition at line 213 of file TTreeReaderArray.h.

◆ GetDerivedTypeName()

template<typename T >
const char * TTreeReaderArray< T >::GetDerivedTypeName ( ) const
inlineoverrideprotectedvirtual

Implements ROOT::Internal::TTreeReaderValueBase.

Definition at line 219 of file TTreeReaderArray.h.

◆ operator[]() [1/2]

template<typename T >
T & TTreeReaderArray< T >::operator[] ( std::size_t  idx)
inline

Definition at line 207 of file TTreeReaderArray.h.

◆ operator[]() [2/2]

template<typename T >
const T & TTreeReaderArray< T >::operator[] ( std::size_t  idx) const
inline

Definition at line 208 of file TTreeReaderArray.h.

  • tree/treeplayer/inc/TTreeReaderArray.h