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 104 of file TTreeReaderArray.h.
Classes | |
| class | Iterator_t |
| Random access iterator to the elements of a TTreeReaderArray. More... | |
Public Types | |
| typedef bool(ROOT::Detail::TBranchProxy::* | BranchProxyRead_t) () |
| using | const_iterator = Iterator_t<const TTreeReaderArray<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... | |
| using | iterator = Iterator_t<TTreeReaderArray<T>> |
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 |
| void * | GetAddress () |
| Returns the memory address of the object being read. | |
| const char * | GetBranchName () const |
| TLeaf * | GetLeaf () |
| If we are reading a leaf, return the corresponding TLeaf. | |
| EReadStatus | GetReadStatus () const override |
| ESetupStatus | GetSetupStatus () const |
| Return this TTreeReaderValue's setup status. | |
| std::size_t | GetSize () const |
| std::size_t | GetValueSize () const |
| Returns the sizeof of the collection value type. Returns 0 in case the value size could not be retrieved. | |
| bool | IsContiguous () const |
| bool | IsEmpty () const |
| bool | IsValid () const |
| Return true if the branch was setup and read correctly. | |
| T & | operator[] (std::size_t idx) |
| const T & | operator[] (std::size_t idx) const |
| 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 | |
| void | CreateProxy () override |
| Create the proxy object for our branch. | |
| void | ErrorAboutMissingProxyIfNeeded () |
| bool | GetBranchAndLeaf (TBranch *&branch, TLeaf *&myLeaf, TDictionary *&branchActualType, bool suppressErrorsForMissingBranch=false) |
| Determine the branch / leaf and its type; reset fProxy / fSetupStatus on error. | |
| const char * | GetBranchContentDataType (TBranch *branch, TString &contentTypeName, TDictionary *&dict, StreamerElementArrayInfo &arrInfo) |
| Access a branch's collection content (not the collection itself) through a proxy. | |
| const char * | GetDerivedTypeName () const override |
| Detail::TBranchProxy * | GetProxy () const |
| void | MarkTreeReaderUnavailable () |
| void | NotifyNewTree (TTree *newTree) |
| The TTreeReader has switched to a new TTree. Update the leaf. | |
| void | RegisterWithTreeReader () |
| Register with tree reader. | |
| TBranch * | SearchBranchWithCompositeName (TLeaf *&myleaf, TDictionary *&branchActualType, std::string &err) |
| Search a branch the name of which contains a ".". | |
| void | SetImpl (TBranch *branch, TLeaf *myLeaf) |
| Create the TVirtualCollectionReader object for our branch. | |
| void * | UntypedAt (std::size_t idx) const |
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. | |
| TDictionary * | fDict |
| Type that the branch should contain. | |
| bool | fHaveLeaf: 1 |
| Whether the data is in a leaf. | |
| bool | fHaveStaticClassOffsets: 1 |
| Whether !fStaticClassOffsets.empty(). | |
| std::unique_ptr< TVirtualCollectionReader > | fImpl |
| TLeaf * | fLeaf = 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::TBranchProxy * | fProxy = 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_t > | fStaticClassOffsets |
| TTreeReader * | fTreeReader |
| Tree reader we belong to. | |
Private Member Functions | |
| StreamerElementArrayInfo | FillStreamerElementArrayInfo (TStreamerElement *elem) |
#include <TTreeReaderArray.h>
|
inherited |
Definition at line 84 of file TTreeReaderValue.h.
| using TTreeReaderArray< T >::const_iterator = Iterator_t<const TTreeReaderArray<T>> |
Definition at line 230 of file TTreeReaderArray.h.
| using TTreeReaderArray< T >::iterator = Iterator_t<TTreeReaderArray<T>> |
Definition at line 229 of file TTreeReaderArray.h.
|
protectedinherited |
Definition at line 143 of file TTreeReaderValue.h.
|
inherited |
| Enumerator | |
|---|---|
| kReadSuccess | Data read okay. |
| kReadNothingYet | Data now yet accessed. |
| kReadError | Problem reading data. |
Definition at line 74 of file TTreeReaderValue.h.
|
inherited |
Status flags, 0 is good.
Definition at line 48 of file TTreeReaderValue.h.
|
inline |
Create an array reader of branch "branchname" for TTreeReader "tr".
Definition at line 233 of file TTreeReaderArray.h.
|
inline |
Definition at line 238 of file TTreeReaderArray.h.
|
inline |
Definition at line 239 of file TTreeReaderArray.h.
|
inline |
Definition at line 243 of file TTreeReaderArray.h.
|
inline |
Definition at line 245 of file TTreeReaderArray.h.
|
inline |
Definition at line 247 of file TTreeReaderArray.h.
|
inline |
Definition at line 248 of file TTreeReaderArray.h.
|
overrideprotectedvirtualinherited |
Create the proxy object for our branch.
Reimplemented from ROOT::Internal::TTreeReaderValueBase.
Definition at line 534 of file TTreeReaderArray.cxx.
|
inline |
Definition at line 244 of file TTreeReaderArray.h.
|
inline |
Definition at line 246 of file TTreeReaderArray.h.
|
protectedinherited |
Definition at line 842 of file TTreeReaderValue.cxx.
|
privateinherited |
Definition at line 989 of file TTreeReaderArray.cxx.
|
inherited |
Returns the memory address of the object being read.
Definition at line 266 of file TTreeReaderValue.cxx.
|
protectedinherited |
Determine the branch / leaf and its type; reset fProxy / fSetupStatus on error.
Definition at line 790 of file TTreeReaderArray.cxx.
|
protectedinherited |
Access a branch's collection content (not the collection itself) through a proxy.
Retrieve the type of data contained in the collection stored by branch; put its dictionary into dict, If there is no dictionary, put its type name into contentTypeName. The contentTypeName is set to NULL if the branch does not contain a collection; in that case, the type of the branch is returned. In all other cases, NULL is returned.
Definition at line 1016 of file TTreeReaderArray.cxx.
|
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.
|
inlineinherited |
Definition at line 101 of file TTreeReaderValue.h.
|
inlineoverrideprotectedvirtual |
Implements ROOT::Internal::TTreeReaderValueBase.
Definition at line 252 of file TTreeReaderArray.h.
|
staticprotectedinherited |
Stringify the template argument.
Definition at line 226 of file TTreeReaderValue.cxx.
|
inlineinherited |
If we are reading a leaf, return the corresponding TLeaf.
Definition at line 97 of file TTreeReaderValue.h.
|
inlineprotectedinherited |
Definition at line 119 of file TTreeReaderValue.h.
|
inlineoverridevirtualinherited |
Reimplemented from ROOT::Internal::TTreeReaderValueBase.
Definition at line 47 of file TTreeReaderArray.h.
|
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.
|
inlineinherited |
Definition at line 44 of file TTreeReaderArray.h.
|
inlineinherited |
Returns the sizeof of the collection value type. Returns 0 in case the value size could not be retrieved.
Definition at line 52 of file TTreeReaderArray.h.
|
inlineinherited |
Definition at line 49 of file TTreeReaderArray.h.
|
inlineinherited |
Definition at line 45 of file TTreeReaderArray.h.
|
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.
|
inlineprotectedinherited |
Definition at line 121 of file TTreeReaderValue.h.
|
protectedinherited |
The TTreeReader has switched to a new TTree. Update the leaf.
Definition at line 238 of file TTreeReaderValue.cxx.
|
inline |
Definition at line 240 of file TTreeReaderArray.h.
|
inline |
Definition at line 241 of file TTreeReaderArray.h.
|
inlineinherited |
Definition at line 80 of file TTreeReaderValue.h.
|
inherited |
Definition at line 158 of file TTreeReaderValue.cxx.
|
inherited |
Try to read the value from the TBranchProxy, returns the status of the read.
Definition at line 148 of file TTreeReaderValue.cxx.
|
protectedinherited |
Register with tree reader.
Definition at line 134 of file TTreeReaderValue.cxx.
|
protectedinherited |
Search a branch the name of which contains a ".".
| [out] | myLeaf | The leaf identified by the name if found (can be untouched). |
| [out] | branchActualType | Dictionary associated to the type of the leaf (can be untouched). |
| [out] | errMsg | The error message (can be untouched). |
Definition at line 315 of file TTreeReaderValue.cxx.
|
protectedinherited |
Create the TVirtualCollectionReader object for our branch.
Definition at line 868 of file TTreeReaderArray.cxx.
|
inlineprotectedinherited |
Definition at line 55 of file TTreeReaderArray.h.
|
protectedinherited |
Name of the branch to read data from.
Definition at line 136 of file TTreeReaderValue.h.
|
protectedinherited |
Type that the branch should contain.
Definition at line 139 of file TTreeReaderValue.h.
|
protectedinherited |
Whether the data is in a leaf.
Definition at line 132 of file TTreeReaderValue.h.
|
protectedinherited |
Whether !fStaticClassOffsets.empty().
Definition at line 133 of file TTreeReaderValue.h.
|
protectedinherited |
Definition at line 63 of file TTreeReaderArray.h.
|
protectedinherited |
Definition at line 141 of file TTreeReaderValue.h.
|
protectedinherited |
Definition at line 137 of file TTreeReaderValue.h.
|
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.
Definition at line 151 of file TTreeReaderValue.h.
|
protectedinherited |
Proxy for this branch, owned by TTreeReader.
Definition at line 140 of file TTreeReaderValue.h.
|
protectedinherited |
! Pointer to the Read implementation to use.
Definition at line 144 of file TTreeReaderValue.h.
|
protectedinherited |
Read status of this data access.
Definition at line 134 of file TTreeReaderValue.h.
|
protectedinherited |
Setup status of this data access.
Definition at line 135 of file TTreeReaderValue.h.
|
protectedinherited |
Definition at line 142 of file TTreeReaderValue.h.
|
protectedinherited |
Tree reader we belong to.
Definition at line 138 of file TTreeReaderValue.h.