Logo ROOT  
Reference Guide
Tree Library

In order to store columnar datasets, ROOT provides the TTree, TChain, TNtuple and TNtupleD classes.

The TTree class represents a columnar dataset. Any C++ type can be stored in the columns. The TTree has allowed to store about 1 EB of data coming from the LHC alone: it is demonstrated to scale and it's battle tested. It has been optimized during the years to reduce dataset sizes on disk and to deliver excellent runtime performance. It allows to access only part of the columns of the datasets, too. The TNtuple and TNtupleD classes are specialisations of the TTree class which can only hold single precision and double precision floating-point numbers respectively; The TChain is a collection of TTrees, which can be located also in different files.

Files

file  InternalTreeUtils.hxx
 

Namespaces

 ROOT::Internal::TreeUtils
 Namespace hosting functions and classes to retrieve tree information for internal use.
 

Classes

struct  ROOT::Internal::TreeUtils::RFriendInfo
 Information about friend trees of a certain TTree or TChain object. More...
 
class  TBasket
 Manages buffers for branches of a Tree. More...
 
class  TBasketSQL
 Implement TBasket for a SQL backend. More...
 
class  TBranch
 A TTree is a list of TBranches. More...
 
class  TBranchClones
 A Branch for the case of an array of clone objects. More...
 
class  TBranchElement
 A Branch for the case of an object. More...
 
class  TBranchObject
 A Branch for the case of an object. More...
 
class  TBranchRef
 A branch containing and managing a TRefTable for TRef autoloading. More...
 
class  TBranchSTL
 A Branch handling STL collection of pointers (vectors, lists, queues, sets and multisets) while storing them in split mode. More...
 
class  TBufferSQL
 Implement TBuffer for a SQL backend. More...
 
class  TChain
 A chain is a collection of files containing TTree objects. More...
 
class  TChainElement
 A TChainElement describes a component of a TChain. More...
 
class  TCollectionMethodBrowsable
 TCollectionMethodBrowsable extends TCollectionPropertyBrowsable by showing all methods of the collection itself. More...
 
class  TCollectionPropertyBrowsable
 A tiny browser helper object (and its generator) for adding a virtual (as in "not actually part of the class", not in C++ virtual) "@size()" method to a collection. More...
 
class  TCut
 A specialized string object used for TTree selections. More...
 
class  TEntryList
 A List of entry numbers in a TTree or TChain. More...
 
class  TEntryListArray
 A list of entries and subentries in a TTree or TChain. More...
 
class  TEntryListBlock
 Used by TEntryList to store the entry numbers. More...
 
class  TEntryListFromFile
 Manages entry lists from different files, when they are not loaded in memory at the same time. More...
 
class  TEventList
 A TEventList object is a list of selected events (entries) in a TTree. More...
 
class  TFriendElement
 A TFriendElement TF describes a TTree object TF in a file. More...
 
class  ROOT::TIOFeatures
 TIOFeatures provides the end-user with the ability to change the IO behavior of data written via a TTree. More...
 
class  TLeaf
 A TLeaf describes individual elements of a TBranch See TBranch structure in TTree. More...
 
class  TLeafB
 A TLeaf for an 8 bit Integer data type. More...
 
class  TLeafC
 A TLeaf for a variable length string. More...
 
class  TLeafD
 A TLeaf for a 64 bit floating point data type. More...
 
class  TLeafD32
 A TLeaf for a 24 bit truncated floating point data type. More...
 
class  TLeafElement
 A TLeaf for the general case when using the branches created via a TStreamerInfo (i.e. More...
 
class  TLeafF
 A TLeaf for a 32 bit floating point data type. More...
 
class  TLeafF16
 A TLeaf for a 24 bit truncated floating point data type. More...
 
class  TLeafG
 A TLeaf for a 64 bit Integer data type. More...
 
class  TLeafI
 A TLeaf for an Integer data type. More...
 
class  TLeafL
 A TLeaf for a 64 bit Integer data type. More...
 
class  TLeafO
 A TLeaf for a bool data type. More...
 
class  TLeafObject
 A TLeaf for a general object derived from TObject. More...
 
class  TLeafS
 A TLeaf for a 16 bit Integer data type. More...
 
class  TMethodBrowsable
 This helper object allows the browsing of methods of objects stored in branches. More...
 
class  TNonSplitBrowsable
 Allows a TBrowser to browse non-split branches as if they were split. More...
 
class  TNtuple
 A simple TTree restricted to a list of float variables only. More...
 
class  TNtupleD
 A simple TTree restricted to a list of double variables only. More...
 
class  TQueryResult
 A container class for query results. More...
 
class  TSelector
 A TSelector object is used by the TTree::Draw, TTree::Scan, TTree::Process to navigate in a TTree and make selections. More...
 
class  TSelectorList
 A TList derived class that makes sure that objects added to it are not linked to the currently open file (like histograms, eventlists and trees). More...
 
class  TSelectorScalar
 Named scalar type, based on Long64_t, streamable, storable and mergeable. More...
 
class  TTree
 A TTree represents a columnar dataset. More...
 
class  TTreeCache
 A cache to speed-up the reading of ROOT datasets. More...
 
class  TTreeCacheUnzip
 A TTreeCache which exploits parallelized decompression of its own content. More...
 
class  TTreeCloner
 Class implementing or helping the various TTree cloning method. More...
 
class  TTreeResult
 Class defining interface to a TTree query result with the same interface as for SQL databases. More...
 
class  TTreeRow
 Class defining interface to a row of a TTree query result. More...
 
class  TTreeSQL
 A TTree object is a list of TBranch. More...
 
class  TVirtualBranchBrowsable
 TVirtualBranchBrowsable is a base class (not really abstract, but useless by itself) for helper objects that extend TBranch's browsing support. More...
 
class  TVirtualIndex
 Abstract interface for Tree Index. More...
 
class  TVirtualTreePlayer
 Abstract base class defining the interface for the plugins that implement Draw, Scan, Process, MakeProxy, etc. More...
 

Functions

std::vector< std::string > ROOT::Internal::TreeUtils::GetFileNamesFromTree (const TTree &tree)
 Get and store the file names associated with the input tree. More...
 
RFriendInfo ROOT::Internal::TreeUtils::GetFriendInfo (const TTree &tree)
 Get and store the names, aliases and file names of the direct friends of the tree. More...
 
std::vector< std::string > ROOT::Internal::TreeUtils::GetTreeFullPaths (const TTree &tree)
 Retrieve the full path(s) to a TTree or the trees in a TChain. More...
 

Function Documentation

◆ GetFileNamesFromTree()

std::vector< std::string > ROOT::Internal::TreeUtils::GetFileNamesFromTree ( const TTree tree)

Get and store the file names associated with the input tree.

Parameters
[in]treeThe tree from which friends information will be gathered.
Exceptions
std::runtime_errorIf no files could be associated with the input tree.

Definition at line 30 of file InternalTreeUtils.cxx.

◆ GetFriendInfo()

RFriendInfo ROOT::Internal::TreeUtils::GetFriendInfo ( const TTree tree)

Get and store the names, aliases and file names of the direct friends of the tree.

Parameters
[in]treeThe tree from which friends information will be gathered.
Exceptions
std::runtime_errorIf the input tree has a list of friends, but any of them could not be associated with any file.

Calls TTree::GetListOfFriends and parses its result for the names, aliases and file names, with different methodologies depending on whether the parameter is a TTree or a TChain.

Note
This function only retrieves information about direct friends of the input tree. It will not recurse through friends of friends and does not take into account circular references in the list of friends of the input tree.
Returns
An RFriendInfo struct, containing the information parsed from the list of friends. The struct will contain three vectors, which elements at position i represent the i-th friend of the input tree. If this friend is a TTree, the i-th element of each of the three vectors will contain respectively:
  • A pair with the name and alias of the tree (the alias might not be present, in which case it will be just an empty string).
  • A vector with a single string representing the path to current file where the tree is stored.
  • An empty vector.
If the i-th friend is a TChain instead, the i-th element of each of the three vectors will contain respectively:
  • A pair with the name and alias of the chain (if present, both might be empty strings).
  • A vector with all the paths to the files contained in the chain.
  • A vector with all the the names of the trees making up the chain, associated with the file names of the previous vector.

Definition at line 97 of file InternalTreeUtils.cxx.

◆ GetTreeFullPaths()

std::vector< std::string > ROOT::Internal::TreeUtils::GetTreeFullPaths ( const TTree tree)

Retrieve the full path(s) to a TTree or the trees in a TChain.

Parameters
[in]treeThe tree or chain from which the paths will be retrieved.
Exceptions
std::runtime_errorIf the input tree is a TChain but no files could be found associated with it.
Returns
If the input argument is a TChain, returns a vector of strings with the name of the tree of each file in the chain. If the input argument is a TTree, returns a vector with a single element that is the full path of the tree in the file (e.g. the name of the tree itself or the path with the directories inside the file). Finally, the function returns a vector with just the name of the tree if it couldn't do any better.

Definition at line 189 of file InternalTreeUtils.cxx.