Logo ROOT  
Reference Guide
Loading...
Searching...
No Matches
ROOT::Internal::TTreeReaderOpaqueValue Class Referencefinal

Read a value in a branch without knowledge of its type.

This class is helpful in situations where the actual contents of the branch at the current entry are not relevant and one only wants to know whether the entry can be read.

Definition at line 166 of file TTreeReaderValue.h.

Public Types

typedef bool(ROOT::Detail::TBranchProxy::* BranchProxyRead_t) ()
enum  EReadStatus { kReadSuccess = 0 , kReadNothingYet , kReadError }
enum  ESetupStatus {
  kSetupMatchButEntryBeyondEnd , kSetupMakeClassModeMismatch = -9 , kSetupTreeDestructed = -8 , kSetupNotSetup = -7 ,
  kSetupMissingCounterBranch = -6 , kSetupMissingBranch = -5 , kSetupInternalError = -4 , kSetupMissingDictionary = -3 ,
  kSetupMismatch = -2 , kSetupNotACollection = -1 , kSetupMatch , kSetupNoCheck = 5 ,
  kSetupMatchLeaf = 6 , kSetupMatchBranch
}
 Status flags, 0 is good. More...

Public Member Functions

 TTreeReaderOpaqueValue (TTreeReader &tr, const char *branchname)
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 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

virtual void CreateProxy ()
 Create the proxy object for our branch.
void ErrorAboutMissingProxyIfNeeded ()
const char * GetDerivedTypeName () const final
Detail::TBranchProxyGetProxy () const
void MarkTreeReaderUnavailable ()
void NotifyNewTree (TTree *newTree)
 The TTreeReader has switched to a new TTree. Update the leaf.
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
bool fOpaqueRead {false}
 If true, the reader will not do any type-checking against the actual type held by the branch.
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 <TTreeReaderValue.h>

Inheritance diagram for ROOT::Internal::TTreeReaderOpaqueValue:
ROOT::Internal::TTreeReaderValueBase

Member Typedef Documentation

◆ BranchProxyRead_t

typedef bool(ROOT::Detail::TBranchProxy::* ROOT::Internal::TTreeReaderValueBase::BranchProxyRead_t) ()
inherited

Definition at line 84 of file TTreeReaderValue.h.

◆ Read_t

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

Definition at line 143 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 74 of file TTreeReaderValue.h.

◆ ESetupStatus

Status flags, 0 is good.

Enumerator
kSetupMatchButEntryBeyondEnd 

This branch has been setup, branch data type and reader template type match, but nothing can be read because we have already reached the end of the tree.

kSetupMakeClassModeMismatch 

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

kSetupTreeDestructed 

The TTreeReader has been destructed / not set.

kSetupNotSetup 

No initialization has happened yet.

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.

kSetupNoCheck 
kSetupMatchLeaf 

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

kSetupMatchBranch 

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

Definition at line 48 of file TTreeReaderValue.h.

Constructor & Destructor Documentation

◆ TTreeReaderOpaqueValue()

ROOT::Internal::TTreeReaderOpaqueValue::TTreeReaderOpaqueValue ( TTreeReader & tr,
const char * branchname )
inline

Definition at line 168 of file TTreeReaderValue.h.

Member Function Documentation

◆ CreateProxy()

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

Create the proxy object for our branch.

Reimplemented in ROOT::Internal::TTreeReaderArrayBase.

Definition at line 462 of file TTreeReaderValue.cxx.

◆ ErrorAboutMissingProxyIfNeeded()

void ROOT::Internal::TTreeReaderValueBase::ErrorAboutMissingProxyIfNeeded ( )
protectedinherited

Definition at line 842 of file TTreeReaderValue.cxx.

◆ GetAddress()

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

Returns the memory address of the object being read.

Definition at line 266 of file TTreeReaderValue.cxx.

◆ GetBranchDataType()

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

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 713 of file TTreeReaderValue.cxx.

◆ GetBranchName()

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

Definition at line 101 of file TTreeReaderValue.h.

◆ GetDerivedTypeName()

const char * ROOT::Internal::TTreeReaderOpaqueValue::GetDerivedTypeName ( ) const
inlinefinalprotectedvirtual

Implements ROOT::Internal::TTreeReaderValueBase.

Definition at line 174 of file TTreeReaderValue.h.

◆ GetElementTypeName()

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

Stringify the template argument.

Definition at line 226 of file TTreeReaderValue.cxx.

◆ GetLeaf()

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

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

Definition at line 97 of file TTreeReaderValue.h.

◆ GetProxy()

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

Definition at line 119 of file TTreeReaderValue.h.

◆ GetReadStatus()

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

Reimplemented in ROOT::Internal::TTreeReaderArrayBase.

Definition at line 94 of file TTreeReaderValue.h.

◆ GetSetupStatus()

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

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 93 of file TTreeReaderValue.h.

◆ IsValid()

bool ROOT::Internal::TTreeReaderValueBase::IsValid ( ) const
inlineinherited

Return true if the branch was setup and read correctly.

Use GetSetupStatus() to only check the setup status.

Definition at line 90 of file TTreeReaderValue.h.

◆ MarkTreeReaderUnavailable()

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

Definition at line 121 of file TTreeReaderValue.h.

◆ NotifyNewTree()

void ROOT::Internal::TTreeReaderValueBase::NotifyNewTree ( TTree * newTree)
protectedinherited

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

Definition at line 238 of file TTreeReaderValue.cxx.

◆ ProxyRead()

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

Definition at line 80 of file TTreeReaderValue.h.

◆ ProxyReadDefaultImpl()

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

Definition at line 158 of file TTreeReaderValue.cxx.

◆ ProxyReadTemplate()

ROOT::Internal::TTreeReaderValueBase::EReadStatus ROOT::Internal::TTreeReaderValueBase::ProxyReadTemplate ( )
inherited

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

Definition at line 148 of file TTreeReaderValue.cxx.

◆ RegisterWithTreeReader()

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

Register with tree reader.

Definition at line 134 of file TTreeReaderValue.cxx.

◆ SearchBranchWithCompositeName()

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

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 315 of file TTreeReaderValue.cxx.

Member Data Documentation

◆ fBranchName

TString ROOT::Internal::TTreeReaderValueBase::fBranchName
protectedinherited

Name of the branch to read data from.

Definition at line 136 of file TTreeReaderValue.h.

◆ fDict

TDictionary* ROOT::Internal::TTreeReaderValueBase::fDict
protectedinherited

Type that the branch should contain.

Definition at line 139 of file TTreeReaderValue.h.

◆ fHaveLeaf

bool ROOT::Internal::TTreeReaderValueBase::fHaveLeaf
protectedinherited

Whether the data is in a leaf.

Definition at line 132 of file TTreeReaderValue.h.

◆ fHaveStaticClassOffsets

bool ROOT::Internal::TTreeReaderValueBase::fHaveStaticClassOffsets
protectedinherited

Whether !fStaticClassOffsets.empty().

Definition at line 133 of file TTreeReaderValue.h.

◆ fLeaf

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

Definition at line 141 of file TTreeReaderValue.h.

◆ fLeafName

TString ROOT::Internal::TTreeReaderValueBase::fLeafName
protectedinherited

Definition at line 137 of file TTreeReaderValue.h.

◆ fOpaqueRead

bool ROOT::Internal::TTreeReaderValueBase::fOpaqueRead {false}
protectedinherited

If true, the reader will not do any type-checking against the actual type held by the branch.

Useful to just check if the current entry can be read or not without caring about its value.

Note
Only used by TTreeReaderOpaqueValue.

Definition at line 151 of file TTreeReaderValue.h.

◆ fProxy

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

Proxy for this branch, owned by TTreeReader.

Definition at line 140 of file TTreeReaderValue.h.

◆ fProxyReadFunc

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

! Pointer to the Read implementation to use.

Definition at line 144 of file TTreeReaderValue.h.

◆ fReadStatus

EReadStatus ROOT::Internal::TTreeReaderValueBase::fReadStatus
protectedinherited

Read status of this data access.

Definition at line 134 of file TTreeReaderValue.h.

◆ fSetupStatus

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

Setup status of this data access.

Definition at line 135 of file TTreeReaderValue.h.

◆ fStaticClassOffsets

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

Definition at line 142 of file TTreeReaderValue.h.

◆ fTreeReader

TTreeReader* ROOT::Internal::TTreeReaderValueBase::fTreeReader
protectedinherited

Tree reader we belong to.

Definition at line 138 of file TTreeReaderValue.h.


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