Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
ROOT::Internal::TTreeReaderValueBase Class Referenceabstract

Base class of TTreeReaderValue.

Definition at line 44 of file TTreeReaderValue.h.

Public Types

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

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.
 
virtual EReadStatus GetReadStatus () const
 
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 Types

typedef EReadStatus(TTreeReaderValueBase::* Read_t) ()
 

Protected Member Functions

 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.
 
virtual void CreateProxy ()
 Create the proxy object for our branch.
 
virtual const char * GetDerivedTypeName () const =0
 
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 ".".
 

Static Protected Member Functions

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

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.
 

Friends

class ::TTreeReader
 

#include <TTreeReaderValue.h>

Inheritance diagram for ROOT::Internal::TTreeReaderValueBase:
[legend]

Member Typedef Documentation

◆ BranchProxyRead_t

typedef Bool_t(ROOT::Detail::TBranchProxy::* ROOT::Internal::TTreeReaderValueBase::BranchProxyRead_t) ()

Definition at line 77 of file TTreeReaderValue.h.

◆ Read_t

typedef EReadStatus(TTreeReaderValueBase::* ROOT::Internal::TTreeReaderValueBase::Read_t) ()
protected

Definition at line 132 of file TTreeReaderValue.h.

Member Enumeration Documentation

◆ EReadStatus

Enumerator
kReadSuccess 

Data read okay.

kReadNothingYet 

Data now yet accessed.

kReadError 

Problem reading data.

Definition at line 67 of file TTreeReaderValue.h.

◆ ESetupStatus

Status flags, 0 is good.

Enumerator
kSetupNotSetup 

No initialization has happened yet.

kSetupTreeDestructed 

The TTreeReader has been destructed / not set.

kSetupMakeClassModeMismatch 

readers disagree on whether TTree::SetMakeBranch() should be on

kSetupMissingCounterBranch 

The array cannot find its counter branch: Array[CounterBranch].

kSetupMissingBranch 

The specified branch cannot be found.

kSetupInternalError 

Some other error - hopefully the error message helps.

kSetupMissingDictionary 

To read this branch, we need a dictionary.

kSetupMismatch 

Mismatch of branch type and reader template type.

kSetupNotACollection 

The branch class type is not a collection.

kSetupMatch 

This branch has been set up, branch data type and reader template type match, reading should succeed.

kSetupMatchBranch 

This branch has been set up, branch data type and reader template type match, reading should succeed.

kSetupNoCheck 
kSetupMatchLeaf 

This branch (or TLeaf, really) has been set up, reading should succeed.

Definition at line 48 of file TTreeReaderValue.h.

Constructor & Destructor Documentation

◆ ~TTreeReaderValueBase()

ROOT::Internal::TTreeReaderValueBase::~TTreeReaderValueBase ( )
virtual

Unregister from tree reader, cleanup.

Definition at line 116 of file TTreeReaderValue.cxx.

◆ TTreeReaderValueBase() [1/2]

ROOT::Internal::TTreeReaderValueBase::TTreeReaderValueBase ( TTreeReader reader,
const char *  branchname,
TDictionary dict 
)
protected

Construct a tree value reader and register it with the reader object.

Definition at line 55 of file TTreeReaderValue.cxx.

◆ TTreeReaderValueBase() [2/2]

ROOT::Internal::TTreeReaderValueBase::TTreeReaderValueBase ( const TTreeReaderValueBase rhs)
protected

Copy-construct.

Definition at line 71 of file TTreeReaderValue.cxx.

Member Function Documentation

◆ CreateProxy()

void ROOT::Internal::TTreeReaderValueBase::CreateProxy ( )
protectedvirtual

Create the proxy object for our branch.

Reimplemented in ROOT::Internal::TTreeReaderArrayBase.

Definition at line 440 of file TTreeReaderValue.cxx.

◆ GetAddress()

void * ROOT::Internal::TTreeReaderValueBase::GetAddress ( )

Returns the memory address of the object being read.

Definition at line 253 of file TTreeReaderValue.cxx.

◆ GetBranchDataType()

const char * ROOT::Internal::TTreeReaderValueBase::GetBranchDataType ( TBranch branch,
TDictionary *&  dict,
TDictionary const *  curDict 
)
staticprotected

Retrieve the type of data stored by branch; put its dictionary into dict, return its type name.

If no dictionary is available, at least its type name should be returned.

Definition at line 675 of file TTreeReaderValue.cxx.

◆ GetBranchName()

const char * ROOT::Internal::TTreeReaderValueBase::GetBranchName ( ) const
inline

Definition at line 94 of file TTreeReaderValue.h.

◆ GetDerivedTypeName()

virtual const char * ROOT::Internal::TTreeReaderValueBase::GetDerivedTypeName ( ) const
protectedpure virtual

◆ GetElementTypeName()

std::string ROOT::Internal::TTreeReaderValueBase::GetElementTypeName ( const std::type_info &  ti)
staticprotected

Stringify the template argument.

Definition at line 215 of file TTreeReaderValue.cxx.

◆ GetLeaf()

TLeaf * ROOT::Internal::TTreeReaderValueBase::GetLeaf ( )
inline

If we are reading a leaf, return the corresponding TLeaf.

Definition at line 90 of file TTreeReaderValue.h.

◆ GetProxy()

Detail::TBranchProxy * ROOT::Internal::TTreeReaderValueBase::GetProxy ( ) const
inlineprotected

Definition at line 114 of file TTreeReaderValue.h.

◆ GetReadStatus()

virtual EReadStatus ROOT::Internal::TTreeReaderValueBase::GetReadStatus ( ) const
inlinevirtual

Reimplemented in ROOT::Internal::TTreeReaderArrayBase.

Definition at line 87 of file TTreeReaderValue.h.

◆ GetSetupStatus()

ESetupStatus ROOT::Internal::TTreeReaderValueBase::GetSetupStatus ( ) const
inline

Return this TTreeReaderValue's setup status.

Use this method to check e.g. whether the TTreeReaderValue is correctly setup and ready for reading.

Definition at line 86 of file TTreeReaderValue.h.

◆ IsValid()

Bool_t ROOT::Internal::TTreeReaderValueBase::IsValid ( ) const
inline

Return true if the branch was setup and read correctly.

Use GetSetupStatus() to only check the setup status.

Definition at line 83 of file TTreeReaderValue.h.

◆ MarkTreeReaderUnavailable()

void ROOT::Internal::TTreeReaderValueBase::MarkTreeReaderUnavailable ( )
inlineprotected

Definition at line 116 of file TTreeReaderValue.h.

◆ NotifyNewTree()

void ROOT::Internal::TTreeReaderValueBase::NotifyNewTree ( TTree newTree)
protected

The TTreeReader has switched to a new TTree. Update the leaf.

Definition at line 226 of file TTreeReaderValue.cxx.

◆ operator=()

ROOT::Internal::TTreeReaderValueBase & ROOT::Internal::TTreeReaderValueBase::operator= ( const TTreeReaderValueBase rhs)
protected

Copy-assign.

Definition at line 91 of file TTreeReaderValue.cxx.

◆ ProxyRead()

EReadStatus ROOT::Internal::TTreeReaderValueBase::ProxyRead ( )
inline

Definition at line 73 of file TTreeReaderValue.h.

◆ ProxyReadDefaultImpl()

ROOT::Internal::TTreeReaderValueBase::EReadStatus ROOT::Internal::TTreeReaderValueBase::ProxyReadDefaultImpl ( )

Definition at line 154 of file TTreeReaderValue.cxx.

◆ ProxyReadTemplate()

ROOT::Internal::TTreeReaderValueBase::EReadStatus ROOT::Internal::TTreeReaderValueBase::ProxyReadTemplate

Try to read the value from the TBranchProxy, returns the status of the read.

Definition at line 143 of file TTreeReaderValue.cxx.

◆ RegisterWithTreeReader()

void ROOT::Internal::TTreeReaderValueBase::RegisterWithTreeReader ( )
protected

Register with tree reader.

Definition at line 128 of file TTreeReaderValue.cxx.

◆ SearchBranchWithCompositeName()

TBranch * ROOT::Internal::TTreeReaderValueBase::SearchBranchWithCompositeName ( TLeaf *&  myLeaf,
TDictionary *&  branchActualType,
std::string &  errMsg 
)
protected

Search a branch the name of which contains a ".".

Parameters
[out]myLeafThe leaf identified by the name if found (can be untouched).
[out]branchActualTypeDictionary associated to the type of the leaf (can be untouched).
[out]errMsgThe error message (can be untouched).
Returns
The address of the branch if found, nullptr otherwise This method allows to efficiently search for branches which have names which contain "dots", for example "w.v.a" or "v.a". Therefore, it allows to support names such as v.a where the branch was created with this syntax:
myTree->Branch("v", &v, "a/I:b:/I")
The method has some side effects, namely it can modify fSetupStatus, fProxy and fStaticClassOffsets/fHaveStaticClassOffsets.

Definition at line 293 of file TTreeReaderValue.cxx.

Friends And Related Symbol Documentation

◆ ::TTreeReader

friend class ::TTreeReader
friend

Definition at line 138 of file TTreeReaderValue.h.

Member Data Documentation

◆ fBranchName

TString ROOT::Internal::TTreeReaderValueBase::fBranchName
protected

Name of the branch to read data from.

Definition at line 125 of file TTreeReaderValue.h.

◆ fDict

TDictionary* ROOT::Internal::TTreeReaderValueBase::fDict
protected

Type that the branch should contain.

Definition at line 128 of file TTreeReaderValue.h.

◆ fHaveLeaf

bool ROOT::Internal::TTreeReaderValueBase::fHaveLeaf
protected

Whether the data is in a leaf.

Definition at line 121 of file TTreeReaderValue.h.

◆ fHaveStaticClassOffsets

bool ROOT::Internal::TTreeReaderValueBase::fHaveStaticClassOffsets
protected

Whether !fStaticClassOffsets.empty()

Definition at line 122 of file TTreeReaderValue.h.

◆ fLeaf

TLeaf* ROOT::Internal::TTreeReaderValueBase::fLeaf = nullptr
protected

Definition at line 130 of file TTreeReaderValue.h.

◆ fLeafName

TString ROOT::Internal::TTreeReaderValueBase::fLeafName
protected

Definition at line 126 of file TTreeReaderValue.h.

◆ fProxy

Detail::TBranchProxy* ROOT::Internal::TTreeReaderValueBase::fProxy = nullptr
protected

Proxy for this branch, owned by TTreeReader.

Definition at line 129 of file TTreeReaderValue.h.

◆ fProxyReadFunc

Read_t ROOT::Internal::TTreeReaderValueBase::fProxyReadFunc = &TTreeReaderValueBase::ProxyReadDefaultImpl
protected

! Pointer to the Read implementation to use.

Definition at line 133 of file TTreeReaderValue.h.

◆ fReadStatus

EReadStatus ROOT::Internal::TTreeReaderValueBase::fReadStatus
protected

Read status of this data access.

Definition at line 123 of file TTreeReaderValue.h.

◆ fSetupStatus

ESetupStatus ROOT::Internal::TTreeReaderValueBase::fSetupStatus = kSetupNotSetup
protected

Setup status of this data access.

Definition at line 124 of file TTreeReaderValue.h.

◆ fStaticClassOffsets

std::vector<Long64_t> ROOT::Internal::TTreeReaderValueBase::fStaticClassOffsets
protected

Definition at line 131 of file TTreeReaderValue.h.

◆ fTreeReader

TTreeReader* ROOT::Internal::TTreeReaderValueBase::fTreeReader
protected

Tree reader we belong to.

Definition at line 127 of file TTreeReaderValue.h.

Libraries for ROOT::Internal::TTreeReaderValueBase:

The documentation for this class was generated from the following files: