ROOT
6.07/01
Reference Guide
|
A TTree object has a header with a name and a title.
It consists of a list of independent branches (TBranch). Each branch has its own definition and list of buffers. Branch buffers may be automatically written to disk or kept in memory until the Tree attribute fMaxVirtualSize
is reached. Variables of one branch are written to the same buffer. A branch buffer is automatically compressed if the file compression attribute is set (default).
Branches may be written to different files (see TBranch::SetFile).
The ROOT user can decide to make one single branch and serialize one object into one single I/O buffer or to make several branches. Making one single branch and one single buffer can be the right choice when one wants to process only a subset of all entries in the tree. (you know for example the list of entry numbers you want to process). Making several branches is particularly interesting in the data analysis phase, when one wants to histogram some attributes of an object (entry) without reading all the attributes.
Creates a Tree with name and title.
Various kinds of branches can be added to a tree:
tree->Branch(branchname, &value);
Note: The pointer whose address is passed to TTree::Branch must not be destroyed (i.e. go out of scope) until the TTree is deleted or TTree::ResetBranchAddress is called.
Note: The pointer p_object must be initialized before calling TTree::Branch
Note: The 2nd parameter must be the address of a valid object. The object must not be destroyed (i.e. be deleted) until the TTree is deleted or TTree::ResetBranchAddress is called.
The TClonesArray is a direct access list of objects of the same class. For example, if the TClonesArray is an array of TTrack objects, this function will create one subbranch for each data member of the object TTrack.
STLcollection is the address of a pointer to std::vector, std::list, std::deque, std::set or std::multiset containing pointers to objects. If the splitlevel is a value bigger than 100 (TTree::kSplitCollectionOfPointers) then the collection will be written in split mode, e.g. if it contains objects of any types deriving from TTrack this function will sort the objects based on their type and store them in separate branches in split mode.
In case of dynamic structures changing with each entry for example, one must redefine the branch address before filling the branch again. This is done via the TBranch::SetAddress member function.
loops on all defined branches and for each branch invokes the Fill function.
See also the class TNtuple (a simple Tree with branches of floats) and the class TNtupleD (a simple Tree with branches of doubles)
You may want to add a branch to an existing tree. For example, if one variable in the tree was computed with a certain algorithm, you may want to try another algorithm and compare the results. One solution is to add a new branch, fill it, and save the tree. The code below adds a simple branch to an existing tree. Note the kOverwrite option in the Write method, it overwrites the existing tree. If it is not specified, two copies of the tree headers are saved.
Adding a branch is often not possible because the tree is in a read-only file and you do not have permission to save the modified tree with the new branch. Even if you do have the permission, you risk losing the original tree with an unsuccessful attempt to save the modification. Since trees are usually large, adding a branch could extend it over the 2GB limit. In this case, the attempt to write the tree fails, and the original data is erased. In addition, adding a branch to a tree enlarges the tree and increases the amount of memory needed to read an entry, and therefore decreases the performance.
For these reasons, ROOT offers the concept of friends for trees (and chains). We encourage you to use TTree::AddFriend rather than adding a branch manually.
Classes | |
class | TClusterIterator |
Helper class to iterate over cluster of baskets. More... | |
class | TFriendLock |
Helper class to prevent infinite recursion in the usage of TTree Friends. More... | |
Public Types | |
enum | ESetBranchAddressStatus { kMissingBranch = -5, kInternalError = -4, kMissingCompiledCollectionProxy = -3, kMismatch = -2, kClassMismatch = -1, kMatch = 0, kMatchConversion = 1, kMatchConversionCollection = 2, kMakeClass = 3, kVoidPtr = 4, kNoCheck = 5 } |
enum | { kForceRead = BIT(11), kCircular = BIT(12) } |
enum | { kSplitCollectionOfPointers = 100 } |
Public Types inherited from TObject | |
enum | EStatusBits { kCanDelete = BIT(0), kMustCleanup = BIT(3), kObjInCanvas = BIT(3), kIsReferenced = BIT(4), kHasUUID = BIT(5), kCannotPick = BIT(6), kNoContextMenu = BIT(8), kInvalidObject = BIT(13) } |
enum | { kIsOnHeap = 0x01000000, kNotDeleted = 0x02000000, kZombie = 0x04000000, kBitMask = 0x00ffffff } |
enum | { kSingleKey = BIT(0), kOverwrite = BIT(1), kWriteDelete = BIT(2) } |
Public Member Functions | |
TTree () | |
Default constructor and I/O constructor. More... | |
TTree (const char *name, const char *title, Int_t splitlevel=99) | |
Normal tree constructor. More... | |
virtual | ~TTree () |
Destructor. More... | |
virtual Int_t | AddBranchToCache (const char *bname, Bool_t subbranches=kFALSE) |
Add branch with name bname to the Tree cache. More... | |
virtual Int_t | AddBranchToCache (TBranch *branch, Bool_t subbranches=kFALSE) |
Add branch b to the Tree cache. More... | |
virtual Int_t | DropBranchFromCache (const char *bname, Bool_t subbranches=kFALSE) |
Remove the branch with name 'bname' from the Tree cache. More... | |
virtual Int_t | DropBranchFromCache (TBranch *branch, Bool_t subbranches=kFALSE) |
Remove the branch b from the Tree cache. More... | |
virtual TFriendElement * | AddFriend (const char *treename, const char *filename="") |
Add a TFriendElement to the list of friends. More... | |
virtual TFriendElement * | AddFriend (const char *treename, TFile *file) |
Add a TFriendElement to the list of friends. More... | |
virtual TFriendElement * | AddFriend (TTree *tree, const char *alias="", Bool_t warn=kFALSE) |
Add a TFriendElement to the list of friends. More... | |
virtual void | AddTotBytes (Int_t tot) |
virtual void | AddZipBytes (Int_t zip) |
virtual Long64_t | AutoSave (Option_t *option="") |
AutoSave tree header every fAutoSave bytes. More... | |
virtual Int_t | Branch (TCollection *list, Int_t bufsize=32000, Int_t splitlevel=99, const char *name="") |
Create one branch for each element in the collection. More... | |
virtual Int_t | Branch (TList *list, Int_t bufsize=32000, Int_t splitlevel=99) |
Deprecated function. Use next function instead. More... | |
virtual Int_t | Branch (const char *folder, Int_t bufsize=32000, Int_t splitlevel=99) |
Create one branch for each element in the folder. More... | |
virtual TBranch * | Branch (const char *name, void *address, const char *leaflist, Int_t bufsize=32000) |
Create a new TTree Branch. More... | |
TBranch * | Branch (const char *name, char *address, const char *leaflist, Int_t bufsize=32000) |
TBranch * | Branch (const char *name, Long_t address, const char *leaflist, Int_t bufsize=32000) |
TBranch * | Branch (const char *name, int address, const char *leaflist, Int_t bufsize=32000) |
virtual TBranch * | Branch (const char *name, const char *classname, void *addobj, Int_t bufsize=32000, Int_t splitlevel=99) |
Create a new branch with the object of class classname at address addobj. More... | |
template<class T > | |
TBranch * | Branch (const char *name, const char *classname, T *obj, Int_t bufsize=32000, Int_t splitlevel=99) |
template<class T > | |
TBranch * | Branch (const char *name, const char *classname, T **addobj, Int_t bufsize=32000, Int_t splitlevel=99) |
template<class T > | |
TBranch * | Branch (const char *name, T **addobj, Int_t bufsize=32000, Int_t splitlevel=99) |
template<class T > | |
TBranch * | Branch (const char *name, T *obj, Int_t bufsize=32000, Int_t splitlevel=99) |
virtual TBranch * | Bronch (const char *name, const char *classname, void *addobj, Int_t bufsize=32000, Int_t splitlevel=99) |
Create a new TTree BranchElement. More... | |
virtual TBranch * | BranchOld (const char *name, const char *classname, void *addobj, Int_t bufsize=32000, Int_t splitlevel=1) |
Create a new TTree BranchObject. More... | |
virtual TBranch * | BranchRef () |
Build the optional branch supporting the TRefTable. More... | |
virtual void | Browse (TBrowser *) |
Browse content of the TTree. More... | |
virtual Int_t | BuildIndex (const char *majorname, const char *minorname="0") |
Build a Tree Index (default is TTreeIndex). More... | |
TStreamerInfo * | BuildStreamerInfo (TClass *cl, void *pointer=0, Bool_t canOptimize=kTRUE) |
Build StreamerInfo for class cl. More... | |
virtual TFile * | ChangeFile (TFile *file) |
Called by TTree::Fill() when file has reached its maximum fgMaxTreeSize. More... | |
virtual TTree * | CloneTree (Long64_t nentries=-1, Option_t *option="") |
Create a clone of this tree and copy nentries. More... | |
virtual void | CopyAddresses (TTree *, Bool_t undo=kFALSE) |
Set branch addresses of passed tree equal to ours. More... | |
virtual Long64_t | CopyEntries (TTree *tree, Long64_t nentries=-1, Option_t *option="") |
Copy nentries from given tree to this tree. More... | |
virtual TTree * | CopyTree (const char *selection, Option_t *option="", Long64_t nentries=kMaxEntries, Long64_t firstentry=0) |
Copy a tree with selection. More... | |
virtual TBasket * | CreateBasket (TBranch *) |
Create a basket for this tree and given branch. More... | |
virtual void | DirectoryAutoAdd (TDirectory *) |
Called by TKey and TObject::Clone to automatically add us to a directory when we are read from a file. More... | |
Int_t | Debug () const |
virtual void | Delete (Option_t *option="") |
Delete this tree from memory or/and disk. More... | |
virtual void | Draw (Option_t *opt) |
Default Draw method for all objects. More... | |
virtual Long64_t | Draw (const char *varexp, const TCut &selection, Option_t *option="", Long64_t nentries=kMaxEntries, Long64_t firstentry=0) |
Draw expression varexp for specified entries. More... | |
virtual Long64_t | Draw (const char *varexp, const char *selection, Option_t *option="", Long64_t nentries=kMaxEntries, Long64_t firstentry=0) |
Draw expression varexp for specified entries. More... | |
virtual void | DropBaskets () |
Remove some baskets from memory. More... | |
virtual void | DropBuffers (Int_t nbytes) |
Drop branch buffers to accommodate nbytes below MaxVirtualsize. More... | |
virtual Int_t | Fill () |
Fill all branches. More... | |
virtual TBranch * | FindBranch (const char *name) |
Return the branch that correspond to the path 'branchname', which can include the name of the tree or the omitted name of the parent branches. More... | |
virtual TLeaf * | FindLeaf (const char *name) |
Find leaf.. More... | |
virtual Int_t | Fit (const char *funcname, const char *varexp, const char *selection="", Option_t *option="", Option_t *goption="", Long64_t nentries=kMaxEntries, Long64_t firstentry=0) |
Fit a projected item(s) from a tree. More... | |
virtual Int_t | FlushBaskets () const |
Write to disk all the basket that have not yet been individually written. More... | |
virtual const char * | GetAlias (const char *aliasName) const |
Returns the expanded value of the alias. Search in the friends if any. More... | |
virtual Long64_t | GetAutoFlush () const |
virtual Long64_t | GetAutoSave () const |
virtual TBranch * | GetBranch (const char *name) |
Return pointer to the branch with the given name in this tree or its friends. More... | |
virtual TBranchRef * | GetBranchRef () const |
virtual Bool_t | GetBranchStatus (const char *branchname) const |
Return status of branch with name branchname. More... | |
virtual Long64_t | GetCacheSize () const |
virtual TClusterIterator | GetClusterIterator (Long64_t firstentry) |
Return an iterator over the cluster of baskets starting at firstentry. More... | |
virtual Long64_t | GetChainEntryNumber (Long64_t entry) const |
virtual Long64_t | GetChainOffset () const |
TFile * | GetCurrentFile () const |
Return pointer to the current file. More... | |
Int_t | GetDefaultEntryOffsetLen () const |
Long64_t | GetDebugMax () const |
Long64_t | GetDebugMin () const |
TDirectory * | GetDirectory () const |
virtual Long64_t | GetEntries () const |
virtual Long64_t | GetEntries (const char *selection) |
Return the number of entries matching the selection. More... | |
virtual Long64_t | GetEntriesFast () const |
virtual Long64_t | GetEntriesFriend () const |
Return pointer to the 1st Leaf named name in any Branch of this Tree or any branch in the list of friend trees. More... | |
virtual Long64_t | GetEstimate () const |
virtual Int_t | GetEntry (Long64_t entry=0, Int_t getall=0) |
Read all branches of entry and return total number of bytes read. More... | |
Int_t | GetEvent (Long64_t entry=0, Int_t getall=0) |
virtual Int_t | GetEntryWithIndex (Int_t major, Int_t minor=0) |
Read entry corresponding to major and minor number. More... | |
virtual Long64_t | GetEntryNumberWithBestIndex (Long64_t major, Long64_t minor=0) const |
Return entry number corresponding to major and minor number. More... | |
virtual Long64_t | GetEntryNumberWithIndex (Long64_t major, Long64_t minor=0) const |
Return entry number corresponding to major and minor number. More... | |
TEventList * | GetEventList () const |
virtual TEntryList * | GetEntryList () |
Returns the entry list, set to this tree. More... | |
virtual Long64_t | GetEntryNumber (Long64_t entry) const |
Return entry number corresponding to entry. More... | |
virtual Int_t | GetFileNumber () const |
virtual TTree * | GetFriend (const char *) const |
Return a pointer to the TTree friend whose name or alias is 'friendname. More... | |
virtual const char * | GetFriendAlias (TTree *) const |
If the 'tree' is a friend, this method returns its alias name. More... | |
TH1 * | GetHistogram () |
virtual Int_t * | GetIndex () |
virtual Double_t * | GetIndexValues () |
virtual TIterator * | GetIteratorOnAllLeaves (Bool_t dir=kIterForward) |
Creates a new iterator that will go through all the leaves on the tree itself and its friend. More... | |
virtual TLeaf * | GetLeaf (const char *branchname, const char *leafname) |
Return pointer to the 1st Leaf named name in any Branch of this Tree or any branch in the list of friend trees. More... | |
virtual TLeaf * | GetLeaf (const char *name) |
Return pointer to the 1st Leaf named name in any Branch of this Tree or any branch in the list of friend trees. More... | |
virtual TList * | GetListOfClones () |
virtual TObjArray * | GetListOfBranches () |
virtual TObjArray * | GetListOfLeaves () |
virtual TList * | GetListOfFriends () const |
virtual TList * | GetListOfAliases () const |
Int_t | GetMakeClass () const |
virtual Long64_t | GetMaxEntryLoop () const |
virtual Double_t | GetMaximum (const char *columname) |
Return maximum of column with name columname. More... | |
virtual Long64_t | GetMaxVirtualSize () const |
virtual Double_t | GetMinimum (const char *columname) |
Return minimum of column with name columname. More... | |
virtual Int_t | GetNbranches () |
TObject * | GetNotify () const |
TVirtualTreePlayer * | GetPlayer () |
Load the TTreePlayer (if not already done). More... | |
virtual Int_t | GetPacketSize () const |
virtual TVirtualPerfStats * | GetPerfStats () const |
virtual Long64_t | GetReadEntry () const |
virtual Long64_t | GetReadEvent () const |
virtual Int_t | GetScanField () const |
TTreeFormula * | GetSelect () |
virtual Long64_t | GetSelectedRows () |
virtual Int_t | GetTimerInterval () const |
TBuffer * | GetTransientBuffer (Int_t size) |
Returns the transient buffer currently used by this TTree for reading/writing baskets. More... | |
virtual Long64_t | GetTotBytes () const |
virtual TTree * | GetTree () const |
virtual TVirtualIndex * | GetTreeIndex () const |
virtual Int_t | GetTreeNumber () const |
virtual Int_t | GetUpdate () const |
virtual TList * | GetUserInfo () |
Return a pointer to the list containing user objects associated to this tree. More... | |
TTreeFormula * | GetVar (Int_t i) |
TTreeFormula * | GetVar1 () |
TTreeFormula * | GetVar2 () |
TTreeFormula * | GetVar3 () |
TTreeFormula * | GetVar4 () |
virtual Double_t * | GetVal (Int_t i) |
virtual Double_t * | GetV1 () |
virtual Double_t * | GetV2 () |
virtual Double_t * | GetV3 () |
virtual Double_t * | GetV4 () |
virtual Double_t * | GetW () |
virtual Double_t | GetWeight () const |
virtual Long64_t | GetZipBytes () const |
virtual void | IncrementTotalBuffers (Int_t nbytes) |
Bool_t | IsFolder () const |
Returns kTRUE in case object contains browsable objects (like containers or lists of other objects). More... | |
virtual Int_t | LoadBaskets (Long64_t maxmemory=2000000000) |
Read in memory all baskets from all branches up to the limit of maxmemory bytes. More... | |
virtual Long64_t | LoadTree (Long64_t entry) |
Set current entry. More... | |
virtual Long64_t | LoadTreeFriend (Long64_t entry, TTree *T) |
Load entry on behalf of our master tree, we may use an index. More... | |
virtual Int_t | MakeClass (const char *classname=0, Option_t *option="") |
Generate a skeleton analysis class for this tree. More... | |
virtual Int_t | MakeCode (const char *filename=0) |
Generate a skeleton function for this tree. More... | |
virtual Int_t | MakeProxy (const char *classname, const char *macrofilename=0, const char *cutfilename=0, const char *option=0, Int_t maxUnrolling=3) |
Generate a skeleton analysis class for this Tree using TBranchProxy. More... | |
virtual Int_t | MakeSelector (const char *selector=0, Option_t *option="") |
Generate skeleton selector class for this tree. More... | |
Bool_t | MemoryFull (Int_t nbytes) |
Check if adding nbytes to memory we are still below MaxVirtualsize. More... | |
virtual Long64_t | Merge (TCollection *list, Option_t *option="") |
Merge the trees in the TList into this tree. More... | |
virtual Long64_t | Merge (TCollection *list, TFileMergeInfo *info) |
Merge the trees in the TList into this tree. More... | |
virtual Bool_t | Notify () |
Function called when loading a new class library. More... | |
virtual void | OptimizeBaskets (ULong64_t maxMemory=10000000, Float_t minComp=1.1, Option_t *option="") |
This function may be called after having filled some entries in a Tree Using the information in the existing branch buffers, it will reassign new branch buffer sizes to optimize time and memory. More... | |
TPrincipal * | Principal (const char *varexp="", const char *selection="", Option_t *option="np", Long64_t nentries=kMaxEntries, Long64_t firstentry=0) |
Interface to the Principal Components Analysis class. More... | |
virtual void | Print (Option_t *option="") const |
Print a summary of the tree contents. More... | |
virtual void | PrintCacheStats (Option_t *option="") const |
print statistics about the TreeCache for this tree, like
Reading 73921562 bytes in 716 transactions
Average transaction = 103.242405 Kbytes
if option = "a" the list of blocks in the cache is printed More... | |
virtual Long64_t | Process (const char *filename, Option_t *option="", Long64_t nentries=kMaxEntries, Long64_t firstentry=0) |
Process this tree executing the TSelector code in the specified filename. More... | |
virtual Long64_t | Process (TSelector *selector, Option_t *option="", Long64_t nentries=kMaxEntries, Long64_t firstentry=0) |
Process this tree executing the code in the specified selector. More... | |
virtual Long64_t | Project (const char *hname, const char *varexp, const char *selection="", Option_t *option="", Long64_t nentries=kMaxEntries, Long64_t firstentry=0) |
Make a projection of a tree using selections. More... | |
virtual TSQLResult * | Query (const char *varexp="", const char *selection="", Option_t *option="", Long64_t nentries=kMaxEntries, Long64_t firstentry=0) |
Loop over entries and return a TSQLResult object containing entries following selection. More... | |
virtual Long64_t | ReadFile (const char *filename, const char *branchDescriptor="", char delimiter= ' ') |
Create or simply read branches from filename. More... | |
virtual Long64_t | ReadStream (std::istream &inputStream, const char *branchDescriptor="", char delimiter= ' ') |
Create or simply read branches from an input stream. More... | |
virtual void | Refresh () |
Refresh contents of this tree and its branches from the current status on disk. More... | |
virtual void | RecursiveRemove (TObject *obj) |
Make sure that obj (which is being deleted or will soon be) is no longer referenced by this TTree. More... | |
virtual void | RemoveFriend (TTree *) |
Remove a friend from the list of friends. More... | |
virtual void | Reset (Option_t *option="") |
Reset baskets, buffers and entries count in all branches and leaves. More... | |
virtual void | ResetAfterMerge (TFileMergeInfo *) |
Resets the state of this TTree after a merge (keep the customization but forget the data). More... | |
virtual void | ResetBranchAddress (TBranch *) |
Tell all of our branches to set their addresses to zero. More... | |
virtual void | ResetBranchAddresses () |
Tell all of our branches to drop their current objects and allocate new ones. More... | |
virtual Long64_t | Scan (const char *varexp="", const char *selection="", Option_t *option="", Long64_t nentries=kMaxEntries, Long64_t firstentry=0) |
Loop over tree entries and print entries passing selection. More... | |
virtual Bool_t | SetAlias (const char *aliasName, const char *aliasFormula) |
Set a tree variable alias. More... | |
virtual void | SetAutoSave (Long64_t autos=-300000000) |
This function may be called at the start of a program to change the default value for fAutoSave (and for SetAutoSave) is -300000000, ie 300 MBytes When filling the Tree the branch buffers as well as the Tree header will be flushed to disk when the watermark is reached. More... | |
virtual void | SetAutoFlush (Long64_t autof=-30000000) |
This function may be called at the start of a program to change the default value for fAutoFlush. More... | |
virtual void | SetBasketSize (const char *bname, Int_t buffsize=16000) |
Set a branch's basket size. More... | |
virtual Int_t | SetBranchAddress (const char *bname, void *add, TBranch **ptr=0) |
Change branch address, dealing with clone trees properly. More... | |
virtual Int_t | SetBranchAddress (const char *bname, void *add, TClass *realClass, EDataType datatype, Bool_t isptr) |
Verify the validity of the type of addr before calling SetBranchAddress. More... | |
virtual Int_t | SetBranchAddress (const char *bname, void *add, TBranch **ptr, TClass *realClass, EDataType datatype, Bool_t isptr) |
Verify the validity of the type of addr before calling SetBranchAddress. More... | |
template<class T > | |
Int_t | SetBranchAddress (const char *bname, T **add, TBranch **ptr=0) |
template<class T > | |
Int_t | SetBranchAddress (const char *bname, T *add, TBranch **ptr=0) |
virtual void | SetBranchStatus (const char *bname, Bool_t status=1, UInt_t *found=0) |
Set branch status to Process or DoNotProcess. More... | |
virtual Int_t | SetCacheSize (Long64_t cachesize=-1) |
Set maximum size of the file cache . More... | |
virtual Int_t | SetCacheEntryRange (Long64_t first, Long64_t last) |
interface to TTreeCache to set the cache entry range More... | |
virtual void | SetCacheLearnEntries (Int_t n=10) |
Interface to TTreeCache to set the number of entries for the learning phase. More... | |
virtual void | SetChainOffset (Long64_t offset=0) |
virtual void | SetCircular (Long64_t maxEntries) |
Enable/Disable circularity for this tree. More... | |
virtual void | SetDebug (Int_t level=1, Long64_t min=0, Long64_t max=9999999) |
Set the debug level and the debug range. More... | |
virtual void | SetDefaultEntryOffsetLen (Int_t newdefault, Bool_t updateExisting=kFALSE) |
Update the default value for the branch's fEntryOffsetLen. More... | |
virtual void | SetDirectory (TDirectory *dir) |
Change the tree's directory. More... | |
virtual Long64_t | SetEntries (Long64_t n=-1) |
Change number of entries in the tree. More... | |
virtual void | SetEstimate (Long64_t nentries=1000000) |
Set number of entries to estimate variable limits. More... | |
virtual void | SetFileNumber (Int_t number=0) |
Set fFileNumber to number. More... | |
virtual void | SetEventList (TEventList *list) |
This function transfroms the given TEventList into a TEntryList The new TEntryList is owned by the TTree and gets deleted when the tree is deleted. More... | |
virtual void | SetEntryList (TEntryList *list, Option_t *opt="") |
Set an EntryList. More... | |
virtual void | SetMakeClass (Int_t make) |
Set all the branches in this TTree to be in decomposed object mode (also known as MakeClass mode). More... | |
virtual void | SetMaxEntryLoop (Long64_t maxev=kMaxEntries) |
virtual void | SetMaxVirtualSize (Long64_t size=0) |
virtual void | SetName (const char *name) |
Change the name of this tree. More... | |
virtual void | SetNotify (TObject *obj) |
virtual void | SetObject (const char *name, const char *title) |
Change the name and title of this tree. More... | |
virtual void | SetParallelUnzip (Bool_t opt=kTRUE, Float_t RelSize=-1) |
Enable or disable parallel unzipping of Tree buffers. More... | |
virtual void | SetPerfStats (TVirtualPerfStats *perf) |
Set perf stats. More... | |
virtual void | SetScanField (Int_t n=50) |
virtual void | SetTimerInterval (Int_t msec=333) |
virtual void | SetTreeIndex (TVirtualIndex *index) |
The current TreeIndex is replaced by the new index. More... | |
virtual void | SetWeight (Double_t w=1, Option_t *option="") |
Set tree weight. More... | |
virtual void | SetUpdate (Int_t freq=0) |
virtual void | Show (Long64_t entry=-1, Int_t lenmax=20) |
Print values of all active leaves for entry. More... | |
virtual void | StartViewer () |
Start the TTreeViewer on this tree. More... | |
virtual Int_t | StopCacheLearningPhase () |
Stop the cache learning phase. More... | |
virtual Int_t | UnbinnedFit (const char *funcname, const char *varexp, const char *selection="", Option_t *option="", Long64_t nentries=kMaxEntries, Long64_t firstentry=0) |
Unbinned fit of one or more variable(s) from a tree. More... | |
void | UseCurrentStyle () |
Replace current attributes by current style. More... | |
virtual Int_t | Write (const char *name=0, Int_t option=0, Int_t bufsize=0) |
Write this object to the current directory. More... | |
virtual Int_t | Write (const char *name=0, Int_t option=0, Int_t bufsize=0) const |
Write this object to the current directory. More... | |
Public Member Functions inherited from TNamed | |
TNamed () | |
TNamed (const char *name, const char *title) | |
TNamed (const TString &name, const TString &title) | |
TNamed (const TNamed &named) | |
TNamed & | operator= (const TNamed &rhs) |
TNamed assignment operator. More... | |
virtual | ~TNamed () |
virtual void | Clear (Option_t *option="") |
Set name and title to empty strings (""). More... | |
virtual TObject * | Clone (const char *newname="") const |
Make a clone of an object using the Streamer facility. More... | |
virtual Int_t | Compare (const TObject *obj) const |
Compare two TNamed objects. More... | |
virtual void | Copy (TObject &named) const |
Copy this to obj. More... | |
virtual void | FillBuffer (char *&buffer) |
Encode TNamed into output buffer. More... | |
virtual const char * | GetName () const |
Returns name of object. More... | |
virtual const char * | GetTitle () const |
Returns title of object. More... | |
virtual ULong_t | Hash () const |
Return hash value for this object. More... | |
virtual Bool_t | IsSortable () const |
virtual void | SetNameTitle (const char *name, const char *title) |
Change (i.e. set) all the TNamed parameters (name and title). More... | |
virtual void | SetTitle (const char *title="") |
Change (i.e. set) the title of the TNamed. More... | |
virtual void | ls (Option_t *option="") const |
List TNamed name and title. More... | |
virtual Int_t | Sizeof () const |
Return size of the TNamed part of the TObject. More... | |
Public Member Functions inherited from TObject | |
TObject () | |
TObject (const TObject &object) | |
TObject copy ctor. More... | |
TObject & | operator= (const TObject &rhs) |
TObject assignment operator. More... | |
virtual | ~TObject () |
TObject destructor. More... | |
virtual void | AppendPad (Option_t *option="") |
Append graphics object to current pad. More... | |
virtual const char * | ClassName () const |
Returns name of class to which the object belongs. More... | |
virtual Int_t | DistancetoPrimitive (Int_t px, Int_t py) |
Computes distance from point (px,py) to the object. More... | |
virtual void | DrawClass () const |
Draw class inheritance tree of the class to which this object belongs. More... | |
virtual TObject * | DrawClone (Option_t *option="") const |
Draw a clone of this object in the current pad. More... | |
virtual void | Dump () const |
Dump contents of object on stdout. More... | |
virtual void | Execute (const char *method, const char *params, Int_t *error=0) |
Execute method on this object with the given parameter string, e.g. More... | |
virtual void | Execute (TMethod *method, TObjArray *params, Int_t *error=0) |
Execute method on this object with parameters stored in the TObjArray. More... | |
virtual void | ExecuteEvent (Int_t event, Int_t px, Int_t py) |
Execute action corresponding to an event at (px,py). More... | |
virtual TObject * | FindObject (const char *name) const |
Must be redefined in derived classes. More... | |
virtual TObject * | FindObject (const TObject *obj) const |
Must be redefined in derived classes. More... | |
virtual Option_t * | GetDrawOption () const |
Get option used by the graphics system to draw this object. More... | |
virtual UInt_t | GetUniqueID () const |
Return the unique object id. More... | |
virtual const char * | GetIconName () const |
Returns mime type name of object. More... | |
virtual Option_t * | GetOption () const |
virtual char * | GetObjectInfo (Int_t px, Int_t py) const |
Returns string containing info about the object at position (px,py). More... | |
virtual Bool_t | HandleTimer (TTimer *timer) |
Execute action in response of a timer timing out. More... | |
virtual Bool_t | InheritsFrom (const char *classname) const |
Returns kTRUE if object inherits from class "classname". More... | |
virtual Bool_t | InheritsFrom (const TClass *cl) const |
Returns kTRUE if object inherits from TClass cl. More... | |
virtual void | Inspect () const |
Dump contents of this object in a graphics canvas. More... | |
virtual Bool_t | IsEqual (const TObject *obj) const |
Default equal comparison (objects are equal if they have the same address in memory). More... | |
Bool_t | IsOnHeap () const |
Bool_t | IsZombie () const |
virtual void | Paint (Option_t *option="") |
This method must be overridden if a class wants to paint itself. More... | |
virtual void | Pop () |
Pop on object drawn in a pad to the top of the display list. More... | |
virtual Int_t | Read (const char *name) |
Read contents of object with specified name from the current directory. More... | |
virtual void | SaveAs (const char *filename="", Option_t *option="") const |
Save this object in the file specified by filename. More... | |
virtual void | SavePrimitive (std::ostream &out, Option_t *option="") |
Save a primitive as a C++ statement(s) on output stream "out". More... | |
virtual void | SetDrawOption (Option_t *option="") |
Set drawing option for object. More... | |
virtual void | SetUniqueID (UInt_t uid) |
Set the unique object id. More... | |
void * | operator new (size_t sz) |
void * | operator new[] (size_t sz) |
void * | operator new (size_t sz, void *vp) |
void * | operator new[] (size_t sz, void *vp) |
void | operator delete (void *ptr) |
Operator delete. More... | |
void | operator delete[] (void *ptr) |
Operator delete []. More... | |
void | SetBit (UInt_t f, Bool_t set) |
Set or unset the user status bits as specified in f. More... | |
void | SetBit (UInt_t f) |
void | ResetBit (UInt_t f) |
Bool_t | TestBit (UInt_t f) const |
Int_t | TestBits (UInt_t f) const |
void | InvertBit (UInt_t f) |
virtual void | Info (const char *method, const char *msgfmt,...) const |
Issue info message. More... | |
virtual void | Warning (const char *method, const char *msgfmt,...) const |
Issue warning message. More... | |
virtual void | Error (const char *method, const char *msgfmt,...) const |
Issue error message. More... | |
virtual void | SysError (const char *method, const char *msgfmt,...) const |
Issue system error message. More... | |
virtual void | Fatal (const char *method, const char *msgfmt,...) const |
Issue fatal error message. More... | |
void | AbstractMethod (const char *method) const |
Use this method to implement an "abstract" method that you don't want to leave purely abstract. More... | |
void | MayNotUse (const char *method) const |
Use this method to signal that a method (defined in a base class) may not be called in a derived class (in principle against good design since a child class should not provide less functionality than its parent, however, sometimes it is necessary). More... | |
void | Obsolete (const char *method, const char *asOfVers, const char *removedFromVers) const |
Use this method to declare a method obsolete. More... | |
Public Member Functions inherited from TAttLine | |
TAttLine () | |
AttLine default constructor. More... | |
TAttLine (Color_t lcolor, Style_t lstyle, Width_t lwidth) | |
AttLine normal constructor. More... | |
virtual | ~TAttLine () |
AttLine destructor. More... | |
void | Copy (TAttLine &attline) const |
Copy this line attributes to a new TAttLine. More... | |
Int_t | DistancetoLine (Int_t px, Int_t py, Double_t xp1, Double_t yp1, Double_t xp2, Double_t yp2) |
Compute distance from point px,py to a line. More... | |
virtual Color_t | GetLineColor () const |
virtual Style_t | GetLineStyle () const |
virtual Width_t | GetLineWidth () const |
virtual void | Modify () |
Change current line attributes if necessary. More... | |
virtual void | ResetAttLine (Option_t *option="") |
Reset this line attributes to default values. More... | |
virtual void | SaveLineAttributes (std::ostream &out, const char *name, Int_t coldef=1, Int_t stydef=1, Int_t widdef=1) |
Save line attributes as C++ statement(s) on output stream out. More... | |
virtual void | SetLineAttributes () |
Invoke the DialogCanvas Line attributes. More... | |
virtual void | SetLineColor (Color_t lcolor) |
virtual void | SetLineColorAlpha (Color_t lcolor, Float_t lalpha) |
Set a transparent line color. More... | |
virtual void | SetLineStyle (Style_t lstyle) |
virtual void | SetLineWidth (Width_t lwidth) |
ClassDef (TAttLine, 2) | |
Public Member Functions inherited from TAttFill | |
TAttFill () | |
TAttFill (Color_t fcolor, Style_t fstyle) | |
AttFill normal constructor. More... | |
virtual | ~TAttFill () |
AttFill destructor. More... | |
void | Copy (TAttFill &attfill) const |
Copy this fill attributes to a new TAttFill. More... | |
virtual Color_t | GetFillColor () const |
virtual Style_t | GetFillStyle () const |
virtual Bool_t | IsTransparent () const |
virtual void | Modify () |
Change current fill area attributes if necessary. More... | |
virtual void | ResetAttFill (Option_t *option="") |
Reset this fill attributes to default values. More... | |
virtual void | SaveFillAttributes (std::ostream &out, const char *name, Int_t coldef=1, Int_t stydef=1001) |
Save fill attributes as C++ statement(s) on output stream out. More... | |
virtual void | SetFillAttributes () |
Invoke the DialogCanvas Fill attributes. More... | |
virtual void | SetFillColor (Color_t fcolor) |
virtual void | SetFillColorAlpha (Color_t fcolor, Float_t falpha) |
Set a transparent fill color. More... | |
virtual void | SetFillStyle (Style_t fstyle) |
Public Member Functions inherited from TAttMarker | |
TAttMarker () | |
TAttMarker (Color_t color, Style_t style, Size_t msize) | |
TAttMarker normal constructor. More... | |
virtual | ~TAttMarker () |
TAttMarker destructor. More... | |
void | Copy (TAttMarker &attmarker) const |
Copy this marker attributes to a new TAttMarker. More... | |
virtual Color_t | GetMarkerColor () const |
virtual Style_t | GetMarkerStyle () const |
virtual Size_t | GetMarkerSize () const |
virtual void | Modify () |
Change current marker attributes if necessary. More... | |
virtual void | ResetAttMarker (Option_t *toption="") |
Reset this marker attributes to the default values. More... | |
virtual void | SaveMarkerAttributes (std::ostream &out, const char *name, Int_t coldef=1, Int_t stydef=1, Int_t sizdef=1) |
Save line attributes as C++ statement(s) on output stream out. More... | |
virtual void | SetMarkerAttributes () |
Invoke the DialogCanvas Marker attributes. More... | |
virtual void | SetMarkerColor (Color_t mcolor=1) |
virtual void | SetMarkerColorAlpha (Color_t mcolor, Float_t malpha) |
Set a transparent marker color. More... | |
virtual void | SetMarkerStyle (Style_t mstyle=1) |
virtual void | SetMarkerSize (Size_t msize=1) |
ClassDef (TAttMarker, 2) | |
Static Public Member Functions | |
static Int_t | GetBranchStyle () |
Static function returning the current branch style. More... | |
static Long64_t | GetMaxTreeSize () |
Static function which returns the tree file size limit in bytes. More... | |
static TTree * | MergeTrees (TList *list, Option_t *option="") |
Static function merging the trees in the TList into a new tree. More... | |
static void | SetBranchStyle (Int_t style=1) |
Set the current branch style. More... | |
static void | SetMaxTreeSize (Long64_t maxsize=1900000000) |
Set the maximum size in bytes of a Tree file (static function). More... | |
Static Public Member Functions inherited from TObject | |
static Long_t | GetDtorOnly () |
Return destructor only flag. More... | |
static void | SetDtorOnly (void *obj) |
Set destructor only flag. More... | |
static Bool_t | GetObjectStat () |
Get status of object stat flag. More... | |
static void | SetObjectStat (Bool_t stat) |
Turn on/off tracking of objects in the TObjectTable. More... | |
Static Public Attributes | |
static constexpr Long64_t | kMaxEntries = TVirtualTreePlayer::kMaxEntries |
Protected Types | |
enum | ELockStatusBits { kFindBranch = BIT(0), kFindLeaf = BIT(1), kGetAlias = BIT(2), kGetBranch = BIT(3), kGetEntry = BIT(4), kGetEntryWithIndex = BIT(5), kGetFriend = BIT(6), kGetFriendAlias = BIT(7), kGetLeaf = BIT(8), kLoadTree = BIT(9), kPrint = BIT(10), kRemoveFriend = BIT(11), kSetBranchStatus = BIT(12) } |
Protected Member Functions | |
void | AddClone (TTree *) |
Add a cloned tree to our list of trees to be notified whenever we change our branch addresses or when we are deleted. More... | |
virtual void | KeepCircular () |
Keep a maximum of fMaxEntries in memory. More... | |
virtual TBranch * | BranchImp (const char *branchname, const char *classname, TClass *ptrClass, void *addobj, Int_t bufsize, Int_t splitlevel) |
Same as TTree::Branch() with added check that addobj matches className. More... | |
virtual TBranch * | BranchImp (const char *branchname, TClass *ptrClass, void *addobj, Int_t bufsize, Int_t splitlevel) |
Same as TTree::Branch but automatic detection of the class name. More... | |
virtual TBranch * | BranchImpRef (const char *branchname, const char *classname, TClass *ptrClass, void *addobj, Int_t bufsize, Int_t splitlevel) |
Same as TTree::Branch but automatic detection of the class name. More... | |
virtual TBranch * | BranchImpRef (const char *branchname, TClass *ptrClass, EDataType datatype, void *addobj, Int_t bufsize, Int_t splitlevel) |
Same as TTree::Branch but automatic detection of the class name. More... | |
virtual Int_t | CheckBranchAddressType (TBranch *branch, TClass *ptrClass, EDataType datatype, Bool_t ptr) |
Check whether or not the address described by the last 3 parameters matches the content of the branch. More... | |
virtual TBranch * | BronchExec (const char *name, const char *classname, void *addobj, Bool_t isptrptr, Int_t bufsize, Int_t splitlevel) |
Helper function implementing TTree::Bronch and TTree::Branch(const char *name, T &obj);. More... | |
Int_t | SetBranchAddressImp (TBranch *branch, void *addr, TBranch **ptr) |
Change branch address, dealing with clone trees properly. More... | |
virtual TLeaf * | GetLeafImpl (const char *branchname, const char *leafname) |
Return pointer to the 1st Leaf named name in any Branch of this Tree or any branch in the list of friend trees. More... | |
Long64_t | GetCacheAutoSize (Bool_t withDefault=kFALSE) const |
Used for automatic sizing of the cache. More... | |
char | GetNewlineValue (std::istream &inputStream) |
Determine which newline this file is using. More... | |
TTreeCache * | GetReadCache (TFile *file, Bool_t create=kFALSE) |
Find and return the TTreeCache registered with the file and which may contain branches for us. More... | |
void | ImportClusterRanges (TTree *fromtree) |
Appends the cluster range information stored in 'fromtree' to this tree, including the value of fAutoFlush. More... | |
void | MoveReadCache (TFile *src, TDirectory *dir) |
Move a cache from a file to the current file in dir. More... | |
Int_t | SetCacheSizeAux (Bool_t autocache=kTRUE, Long64_t cacheSize=0) |
Set the size of the file cache and create it if possible. More... | |
Protected Member Functions inherited from TObject | |
void | MakeZombie () |
virtual void | DoError (int level, const char *location, const char *fmt, va_list va) const |
Interface to ErrorHandler (protected). More... | |
Static Protected Attributes | |
static Int_t | fgBranchStyle = 1 |
true if the cache setting was explicitly given by user More... | |
static Long64_t | fgMaxTreeSize = 100000000000LL |
Private Member Functions | |
TTree (const TTree &tt) | |
TTree & | operator= (const TTree &tt) |
Friends | |
class | TFriendLock |
class | TTreeIndex |
class | TChainIndex |
class | TTreeCloner |
TBranch * | TTreeBranchImpRef (TTree *tree, const char *branchname, TClass *ptrClass, EDataType datatype, void *addobj, Int_t bufsize, Int_t splitlevel) |
#include <TTree.h>
|
protected |
|
private |
TTree::TTree | ( | ) |
TTree::TTree | ( | const char * | name, |
const char * | title, | ||
Int_t | splitlevel = 99 |
||
) |
Normal tree constructor.
The tree is created in the current directory. Use the various functions Branch below to add branches to this tree.
If the first character of title is a "/", the function assumes a folder name. In this case, it creates automatically branches following the folder hierarchy. splitlevel may be used in this case to control the split level.
Add branch with name bname to the Tree cache.
If bname="*" all branches are added to the cache. if subbranches is true all the branches of the subbranches are also put to the cache.
Returns:
Definition at line 911 of file TTree.cxx.
Referenced by AddBranchToCache().
Add a cloned tree to our list of trees to be notified whenever we change our branch addresses or when we are deleted.
Definition at line 1071 of file TTree.cxx.
Referenced by CloneTree(), and TChain::InvalidateCurrentTree().
|
virtual |
Add a TFriendElement to the list of friends.
This function:
A TFriendElement TF describes a TTree object TF in a file. When a TFriendElement TF is added to the the list of friends of an existing TTree T, any variable from TF can be referenced in a query to T.
A tree keeps a list of friends. In the context of a tree (or a chain), friendship means unrestricted access to the friends data. In this way it is much like adding another branch to the tree without taking the risk of damaging it. To add a friend to the list, you can use the TTree::AddFriend method. The tree in the diagram below has two friends (friend_tree1 and friend_tree2) and now has access to the variables a,b,c,i,j,k,l and m.
The AddFriend method has two parameters, the first is the tree name and the second is the name of the ROOT file where the friend tree is saved. AddFriend automatically opens the friend file. If no file name is given, the tree called ft1 is assumed to be in the same file as the original tree.
tree.AddFriend("ft1","friendfile1.root"); If the friend tree has the same name as the original tree, you can give it an alias in the context of the friendship:
tree.AddFriend("tree1 = tree","friendfile1.root"); Once the tree has friends, we can use TTree::Draw as if the friend's variables were in the original tree. To specify which tree to use in the Draw method, use the syntax:
If the variablename is enough to uniquely identify the variable, you can leave out the tree and/or branch name. For example, these commands generate a 3-d scatter plot of variable "var" in the TTree tree versus variable v1 in TTree ft1 versus variable v2 in TTree ft2.
The picture illustrates the access of the tree and its friends with a Draw command. When AddFriend is called, the ROOT file is automatically opened and the friend tree (ft1) is read into memory. The new friend (ft1) is added to the list of friends of tree. The number of entries in the friend must be equal or greater to the number of entries of the original tree. If the friend tree has fewer entries a warning is given and the missing entries are not included in the histogram. To retrieve the list of friends from a tree use TTree::GetListOfFriends. When the tree is written to file (TTree::Write), the friends list is saved with it. And when the tree is retrieved, the trees on the friends list are also retrieved and the friendship restored. When a tree is deleted, the elements of the friend list are also deleted. It is possible to declare a friend tree that has the same internal structure (same branches and leaves) as the original tree, and compare the same values by specifying the tree.
Reimplemented in TChain.
Definition at line 1156 of file TTree.cxx.
Referenced by TEventIterTree::GetTrees(), and TChain::LoadTree().
|
virtual |
Add a TFriendElement to the list of friends.
The TFile is managed by the user (e.g. the user must delete the file). For complete description see AddFriend(const char *, const char *). This function:
Reimplemented in TChain.
|
virtual |
Add a TFriendElement to the list of friends.
The TTree is managed by the user (e.g., the user must delete the file). For a complete description see AddFriend(const char *, const char *).
Reimplemented in TChain.
Definition at line 300 of file TTree.h.
Referenced by TBranch::AddBasket(), and TBranch::WriteBasket().
Definition at line 301 of file TTree.h.
Referenced by TBranch::AddBasket(), and TBranch::WriteBasket().
AutoSave tree header every fAutoSave bytes.
When large Trees are produced, it is safe to activate the AutoSave procedure. Some branches may have buffers holding many entries. If fAutoSave is negative, AutoSave is automatically called by TTree::Fill when the number of bytes generated since the previous AutoSave is greater than -fAutoSave bytes. If fAutoSave is positive, AutoSave is automatically called by TTree::Fill every N entries. This function may also be invoked by the user. Each AutoSave generates a new key on the file. Once the key with the tree header has been written, the previous cycle (if any) is deleted.
Note that calling TTree::AutoSave too frequently (or similarly calling TTree::SetAutoSave with a small value) is an expensive operation. You should make tests for your own application to find a compromise between speed and the quantity of information you may loose in case of a job crash.
In case your program crashes before closing the file holding this tree, the file will be automatically recovered when you will connect the file in UPDATE mode. The Tree will be recovered at the status corresponding to the last AutoSave.
if option contains "SaveSelf", gDirectory->SaveSelf() is called. This allows another process to analyze the Tree while the Tree is being filled.
if option contains "FlushBaskets", TTree::FlushBaskets is called and all the current basket are closed-out and written to disk individually.
By default the previous header is deleted after having written the new header. if option contains "Overwrite", the previous Tree header is deleted before written the new header. This option is slightly faster, but the default option is safer in case of a problem (disk quota exceeded) when writing the new header.
The function returns the number of bytes written to the file. if the number of bytes is null, an error has occurred while writing the header to the file.
The following two scripts illustrate how to do this. The script treew.C is executed by process1, treer.C by process2
script treew.C:
script treer.C:
Definition at line 1308 of file TTree.cxx.
Referenced by ChangeFile(), Memstat::TMemStatMng::Close(), Fill(), and TSelEventGen::GenerateFiles().
|
virtual |
Create one branch for each element in the collection.
Each entry in the collection becomes a top level branch if the corresponding class is not a collection. If it is a collection, the entry in the collection becomes in turn top level branches, etc. The splitlevel is decreased by 1 every time a new collection is found. For example if list is a TObjArray*
In case a collection element is a TClonesArray, the special Tree constructor for TClonesArray is called. The collection itself cannot be a TClonesArray.
The function returns the total number of branches created.
If name is given, all branch names will be prefixed with name_.
IMPORTANT NOTE1: This function should not be called with splitlevel < 1.
IMPORTANT NOTE2: The branches created by this function will have names corresponding to the collection or object names. It is important to give names to collections to avoid misleading branch names or identical branch names. By default collections have a name equal to the corresponding class name, e.g. the default name for a TList is "TList".
And in general in any cases two or more master branches contain subbranches with identical names, one must add a "." (dot) character at the end of the master branch name. This will force the name of the subbranch to be master.subbranch instead of simply subbranch. This situation happens when the top level object (say event) has two or more members referencing the same class. For example, if a Tree has two branches B1 and B2 corresponding to objects of the same class MyClass, one can do:
if MyClass has 3 members a,b,c, the two instructions above will generate subbranches called B1.a, B1.b ,B1.c, B2.a, B2.b, B2.c
Example:
Reimplemented in TTreeSQL.
Definition at line 1623 of file TTree.cxx.
Referenced by TMVA::ApplicationCreateCombinedTree(), RooAbsString::attachToTree(), RooAbsCategory::attachToTree(), RooAbsReal::attachToTree(), TTreeSQL::Branch(), Branch(), BranchImp(), BranchImpRef(), TGeoChecker::CheckBoundaryErrors(), ClassImp(), create_3Bumps(), create_array_with_different_lengths(), create_circ(), create_fullcirc(), create_lin(), create_lin_Nvar(), create_lin_Nvar_Arr(), create_lin_Nvar_categories(), create_lin_Nvar_discrete(), create_lin_Nvar_double(), create_lin_Nvar_weighted(), create_lin_Nvar_withFriend(), create_lin_NvarObsolete(), create_ManyVars(), create_multiclassdata(), create_schachbrett(), create_schachbrett_2D(), create_schachbrett_3D(), create_schachbrett_4D(), create_schachbrett_5D(), TEveVSD::CreateBranches(), TTreeSQL::CreateBranches(), TMVA::Factory::CreateEventAssignTrees(), createOnionData(), fillTree(), TMLPAnalyzer::GatherInformations(), TSelEventGen::GenerateFiles(), TMVA::DataSet::GetTree(), Memstat::TMemStatMng::Init(), TMVA::RuleFit::MakeDebugHists(), makeTree_circ(), makeTree_lin_Nvar(), mlpHiggs(), parallelMergeClient(), parallelMergeTest(), TMVA::MethodTMlpANN::ReadWeightsFromStream(), TMVA::MethodTMlpANN::ReadWeightsFromXML(), TRecorderRecording::StartRecording(), testLargeTreeFit(), testLargeTreeRooFit(), testNdimFit(), testTreeFit(), TNtuple::TNtuple(), TNtupleD::TNtupleD(), TMVA::MethodTMlpANN::Train(), treeClient(), TTree(), tv3Write(), writeCArray(), Roo2DKeysPdf::writeNTupleToFile(), writeTMatrix(), writeTMatrixSym(), writeTrackD(), writeTrackD32(), and TMVA::MethodKNN::WriteWeightsToStream().
|
virtual |
Create a new TTree Branch.
This Branch constructor is provided to support non-objects in a Tree. The variables described in leaflist may be simple variables or structures. // See the two following constructors for writing objects in a Tree.
By default the branch buffers are stored in the same file as the Tree. use TBranch::SetFile to specify a different file
leaflist is the concatenation of all the variable names and types separated by a colon character : The variable name and the variable type are separated by a slash (/). The variable type may be 0,1 or 2 characters. If no type is given, the type of the variable is assumed to be the same as the previous variable. If the first variable does not have a type, it is assumed of type F by default. The list of currently supported types is given below:
Arrays of values are supported with the following syntax:
Any of other form is not supported.
Note that the TTree will assume that all the item are contiguous in memory. On some platform, this is not always true of the member of a struct or a class, due to padding and alignment. Sorting your data member in order of decreasing sizeof usually leads to their being contiguous in memory.
Reimplemented in TTreeSQL.
|
virtual |
Create a new branch with the object of class classname at address addobj.
WARNING:
Starting with Root version 3.01, the Branch function uses the new style branches (TBranchElement). To get the old behaviour, you can:
Note that with the new style, classname does not need to derive from TObject. It must derived from TObject if the branch style has been set to 0 (old)
Note: See the comments in TBranchElement::SetAddress() for a more detailed discussion of the meaning of the addobj parameter in the case of new-style branches.
Use splitlevel < 0 instead of splitlevel=0 when the class has a custom Streamer
Note: if the split level is set to the default (99), TTree::Branch will not issue a warning if the class can not be split.
Reimplemented in TTreeSQL.
|
protectedvirtual |
Same as TTree::Branch() with added check that addobj matches className.
See TTree::Branch() for other details.
Reimplemented in TTreeSQL.
Definition at line 1362 of file TTree.cxx.
Referenced by Branch().
|
protectedvirtual |
Same as TTree::Branch but automatic detection of the class name.
See TTree::Branch for other details.
Reimplemented in TTreeSQL.
|
protectedvirtual |
Same as TTree::Branch but automatic detection of the class name.
See TTree::Branch for other details.
Definition at line 1443 of file TTree.cxx.
Referenced by Branch().
|
protectedvirtual |
Same as TTree::Branch but automatic detection of the class name.
See TTree::Branch for other details.
|
virtual |
Create a new TTree BranchObject.
Build a TBranchObject for an object of class classname. addobj is the address of a pointer to an object of class classname. IMPORTANT: classname must derive from TObject. The class dictionary must be available (ClassDef in class header).
This option requires access to the library where the corresponding class is defined. Accessing one single data member in the object implies reading the full object. See the next Branch constructor for a more efficient storage in case the entry consists of arrays of identical objects.
By default the branch buffers are stored in the same file as the Tree. use TBranch::SetFile to specify a different file
IMPORTANT NOTE about branch names:
In case two or more master branches contain subbranches with identical names, one must add a "." (dot) character at the end of the master branch name. This will force the name of the subbranch to be master.subbranch instead of simply subbranch. This situation happens when the top level object (say event) has two or more members referencing the same class. For example, if a Tree has two branches B1 and B2 corresponding to objects of the same class MyClass, one can do:
if MyClass has 3 members a,b,c, the two instructions above will generate subbranches called B1.a, B1.b ,B1.c, B2.a, B2.b, B2.c
bufsize is the buffer size in bytes for this branch The default value is 32000 bytes and should be ok for most cases. You can specify a larger value (e.g. 256000) if your Tree is not split and each entry is large (Megabytes) A small value for bufsize is optimum if you intend to access the entries in the Tree randomly and your Tree is in split mode.
Reimplemented in TTreeSQL.
Definition at line 1856 of file TTree.cxx.
Referenced by Branch().
|
virtual |
Build the optional branch supporting the TRefTable.
This branch will keep all the information to find the branches containing referenced objects.
At each Tree::Fill, the branch numbers containing the referenced objects are saved to the TBranchRef basket. When the Tree header is saved (via TTree::Write), the branch is saved keeping the information with the pointers to the branches having referenced objects.
Definition at line 2110 of file TTree.cxx.
Referenced by TTreeCloner::CollectBranches().
|
virtual |
Create a new TTree BranchElement.
This function is designed to replace the internal implementation of the old TTree::Branch (whose implementation has been moved to BranchOld).
NOTE: The 'Bronch' method supports only one possible calls signature (where the object type has to be specified explicitly and the address must be the address of a pointer). For more flexibility use 'Branch'. Use Bronch only in (rare) cases (likely to be legacy cases) where both the new and old implementation of Branch needs to be used at the same time.
This function is far more powerful than the old Branch function. It supports the full C++, including STL and has the same behaviour in split or non-split mode. classname does not have to derive from TObject. The function is based on the new TStreamerInfo.
Build a TBranchElement for an object of class classname.
addr is the address of a pointer to an object of class classname. The class dictionary must be available (ClassDef in class header).
Note: See the comments in TBranchElement::SetAddress() for a more detailed discussion of the meaning of the addr parameter.
This option requires access to the library where the corresponding class is defined. Accessing one single data member in the object implies reading the full object.
By default the branch buffers are stored in the same file as the Tree. use TBranch::SetFile to specify a different file
IMPORTANT NOTE about branch names:
In case two or more master branches contain subbranches with identical names, one must add a "." (dot) character at the end of the master branch name. This will force the name of the subbranch to be master.subbranch instead of simply subbranch. This situation happens when the top level object (say event) has two or more members referencing the same class. For example, if a Tree has two branches B1 and B2 corresponding to objects of the same class MyClass, one can do:
if MyClass has 3 members a,b,c, the two instructions above will generate subbranches called B1.a, B1.b ,B1.c, B2.a, B2.b, B2.c
bufsize is the buffer size in bytes for this branch The default value is 32000 bytes and should be ok for most cases. You can specify a larger value (e.g. 256000) if your Tree is not split and each entry is large (Megabytes) A small value for bufsize is optimum if you intend to access the entries in the Tree randomly and your Tree is in split mode.
Use splitlevel < 0 instead of splitlevel=0 when the class has a custom Streamer
Note: if the split level is set to the default (99), TTree::Branch will not issue a warning if the class can not be split.
Reimplemented in TTreeSQL.
Definition at line 2186 of file TTree.cxx.
Referenced by Branch(), and TPerfStats::TPerfStats().
|
protectedvirtual |
Helper function implementing TTree::Bronch and TTree::Branch(const char *name, T &obj);.
Definition at line 2194 of file TTree.cxx.
Referenced by BranchImpRef(), and Bronch().
Browse content of the TTree.
Reimplemented from TObject.
Reimplemented in TChain, TProofChain, TNtuple, and TNtupleD.
Definition at line 2483 of file TTree.cxx.
Referenced by TChain::Browse().
|
virtual |
Build a Tree Index (default is TTreeIndex).
See a description of the parameters and functionality in TTreeIndex::TTreeIndex().
The return value is the number of entries in the Index (< 0 indicates failure).
A TTreeIndex object pointed by fTreeIndex is created. This object will be automatically deleted by the TTree destructor. See also comments in TTree::SetTreeIndex().
Definition at line 2508 of file TTree.cxx.
Referenced by TChainIndex::TChainIndex().
TStreamerInfo * TTree::BuildStreamerInfo | ( | TClass * | cl, |
void * | pointer = 0 , |
||
Bool_t | canOptimize = kTRUE |
||
) |
Build StreamerInfo for class cl.
pointer is an optional argument that may contain a pointer to an object of cl.
Definition at line 2523 of file TTree.cxx.
Referenced by BranchOld(), BronchExec(), TBranchObject::Init(), TBranchClones::Init(), and TBranchElement::Unroll().
Called by TTree::Fill() when file has reached its maximum fgMaxTreeSize.
Create a new file. If the original file is named "myfile.root", subsequent files are named "myfile_1.root", "myfile_2.root", etc.
Returns a pointer to the new file.
Currently, the automatic change of file is restricted to the case where the tree is in the top level directory. The file should not contain sub-directories.
Before switching to a new file, the tree header is written to the current file, then the current file is closed.
To process the multiple files created by ChangeFile, one must use a TChain.
The new file name has a suffix "_N" where N is equal to fFileNumber+1. By default a Root session starts with fFileNumber=0. One can set fFileNumber to a different value via TTree::SetFileNumber. In case a file named "_N" already exists, the function will try a file named "__N", then "___N", etc.
fgMaxTreeSize can be set via the static function TTree::SetMaxTreeSize. The default value of fgMaxTreeSize is 100 Gigabytes.
If the current file contains other objects like TH1 and TTree, these objects are automatically moved to the new file.
IMPORTANT NOTE:
Be careful when writing the final Tree header to the file!
Don't do:
but do the following:
Definition at line 2598 of file TTree.cxx.
Referenced by CopyEntries(), and Fill().
|
protectedvirtual |
Check whether or not the address described by the last 3 parameters matches the content of the branch.
If a Data Model Evolution conversion is involved, reset the fInfo of the branch. The return values are: - kMissingBranch (-5) : Missing branch
Definition at line 2711 of file TTree.cxx.
Referenced by TChain::SetBranchAddress(), and SetBranchAddress().
Create a clone of this tree and copy nentries.
By default copy all entries. The compression level of the cloned tree is set to the destination file's compression level.
NOTE: Only active branches are copied. NOTE: If the TTree is a TChain, the structure of the first TTree is used for the copy.
IMPORTANT: The cloned tree stays connected with this tree until this tree is deleted. In particular, any changes in branch addresses in this tree are forwarded to the clone trees, unless a branch in a clone tree has had its address changed, in which case that change stays in effect. When this tree is deleted, all the addresses of the cloned tree are reset to their default values.
If 'option' contains the word 'fast' and nentries is -1, the cloning will be done without unzipping or unstreaming the baskets (i.e., a direct copy of the raw bytes on disk).
When 'fast' is specified, 'option' can also contain a sorting order for the baskets in the output file.
There are currently 3 supported sorting order:
When using SortBasketsByOffset the baskets are written in the output file in the same order as in the original file (i.e. the baskets are sorted by their offset in the original file; Usually this also means that the baskets are sorted by the index/number of the last entry they contain)
When using SortBasketsByBranch all the baskets of each individual branches are stored contiguously. This tends to optimize reading speed when reading a small number (1->5) of branches, since all their baskets will be clustered together instead of being spread across the file. However it might decrease the performance when reading more branches (or the full entry).
When using SortBasketsByEntry the baskets with the lowest starting entry are written first. (i.e. the baskets are sorted by the index/number of the first entry they contain). This means that on the file the baskets will be in the order in which they will be needed when reading the whole tree sequentially.
For examples of CloneTree, see tutorials:
Reimplemented in TNtuple.
Definition at line 2960 of file TTree.cxx.
Referenced by TNtuple::CloneTree(), TTreePlayer::CopyTree(), RooTreeDataStore::loadValues(), TChain::Merge(), Merge(), and MergeTrees().
Set branch addresses of passed tree equal to ours.
If undo is true, reset the branch address instead of copying them. This insures 'separation' of a cloned tree from its original
Definition at line 3115 of file TTree.cxx.
Referenced by CloneTree(), TChain::LoadTree(), Merge(), MergeTrees(), and ~TTree().
|
virtual |
Copy nentries from given tree to this tree.
This routines assumes that the branches that intended to be copied are already connected. The typical case is that this tree was created using tree->CloneTree(0).
By default copy all entries.
Returns number of bytes copied to this tree.
If 'option' contains the word 'fast' and nentries is -1, the cloning will be done without unzipping or unstreaming the baskets (i.e., a direct copy of the raw bytes on disk).
When 'fast' is specified, 'option' can also contains a sorting order for the baskets in the output file.
There are currently 3 supported sorting order:
See TTree::CloneTree for a detailed explanation of the semantics of these 3 options.
If the tree or any of the underlying tree of the chain has an index, that index and any index in the subsequent underlying TTree objects will be merged.
There are currently three 'options' to control this merging:
Definition at line 3322 of file TTree.cxx.
Referenced by CloneTree(), TChain::Merge(), Merge(), MergeTrees(), and RooTreeDataStore::RooTreeDataStore().
|
virtual |
Copy a tree with selection.
IMPORTANT:
The returned copied tree stays connected with the original tree until the original tree is deleted. In particular, any changes to the branch addresses in the original tree are also made to the copied tree. Any changes made to the branch addresses of the copied tree are overridden anytime the original tree changes its branch addresses. When the original tree is deleted, all the branch addresses of the copied tree are set to zero.
For examples of CopyTree, see the tutorials:
Definition at line 3472 of file TTree.cxx.
Referenced by TMVA::DataInputHandler::AddTree().
Create a basket for this tree and given branch.
Reimplemented in TTreeSQL.
Definition at line 3484 of file TTree.cxx.
Referenced by TBranch::Fill(), and TBranch::GetFreshBasket().
|
inline |
Definition at line 358 of file TTree.h.
Referenced by TBranchElement::Fill(), and TBranchElement::GetEntry().
Delete this tree from memory or/and disk.
Reimplemented from TObject.
Definition at line 3500 of file TTree.cxx.
Referenced by TSelEventGen::GenerateFiles().
|
virtual |
Called by TKey and TObject::Clone to automatically add us to a directory when we are read from a file.
Reimplemented in TChain.
Default Draw method for all objects.
Reimplemented from TObject.
Reimplemented in TChain, and TProofChain.
Definition at line 360 of file TTree.h.
Referenced by TParallelCoord::AddVariable(), TParallelCoord::ApplySelectionToTree(), TVirtualBranchBrowsable::Browse(), TLeaf::Browse(), TBranch::Browse(), TCollectionPropertyBrowsable::Browse(), TBranchElement::Browse(), canvas_write(), TMLPAnalyzer::CheckNetwork(), ClassImp(), TFitEditor::DoFit(), TChain::Draw(), RooTreeDataStore::Draw(), Draw(), TMLPAnalyzer::DrawDInput(), TMLPAnalyzer::DrawDInputs(), TMLPAnalyzer::DrawNetwork(), TFileDrawMap::DrawObject(), TTreePlayer::DrawSelect(), TMLPAnalyzer::DrawTruthDeviation(), TMLPAnalyzer::DrawTruthDeviationInOut(), FillUnBinData(), TMLPAnalyzer::GatherInformations(), TParallelCoord::GetTree(), hsimpleProxyDriver(), memstatExample(), mlpRegression(), TMVA::paracoor(), parallelcoord(), plot(), Project(), TParallelCoord::ResetTree(), rs101_limitexample(), TMultiLayerPerceptron::SetTestDataSet(), TMultiLayerPerceptron::SetTrainingDataSet(), TMemStatShow::Show(), TGeoChecker::TestOverlaps(), TMultiLayerPerceptron::TMultiLayerPerceptron(), and TNeuron::UseBranch().
|
virtual |
Draw expression varexp for specified entries.
Returns -1 in case of error or number of selected events in case of success.
This function accepts TCut objects as arguments. Useful to use the string operator +
Example:
ntuple.Draw("x",cut1+cut2+cut3);
Reimplemented in TChain, and TProofChain.
|
virtual |
Draw expression varexp for specified entries.
Returns -1 in case of error or number of selected events in case of success.
varexp is an expression of the general form
Example:
Note that the variables e1, e2 or e3 may contain a selection. example, if e1= x*(y<0), the value histogrammed will be x if y<0 and will be 0 otherwise.
The expressions can use all the operations and build-in functions supported by TFormula (See TFormula::Analyze), including free standing function taking numerical arguments (TMath::Bessel). In addition, you can call member functions taking numerical arguments. For example:
Note: You can only pass expression that depend on the TTree's data to static functions and you can only call non-static member function with 'fixed' parameters.
selection is an expression with a combination of the columns. In a selection all the C++ operators are authorized. The value corresponding to the selection expression is used as a weight to fill the histogram. If the expression includes only boolean operations, the result is 0 or 1. If the result is 0, the histogram is not filled. In general, the expression may be of the form:
if boolean expression is true, the histogram is filled with a weight = value
.
Examples:
option is the drawing option.
nentries
is the number of entries to process (default is all) first is the first entry to process (default is 0)
This function returns the number of selected entries. It returns -1 if an error occurs.
Let assumes, a leaf fMatrix, on the branch fEvent, which is a 3 by 3 array, or a TClonesArray. In a TTree::Draw expression you can now access fMatrix using the following syntaxes:
String passed | What is used for each entry of the tree |
---|---|
fMatrix | the 9 elements of fMatrix |
fMatrix[][] | the 9 elements of fMatrix |
fMatrix[2][2] | only the elements fMatrix[2][2] |
fMatrix[1] | the 3 elements fMatrix[1][0], fMatrix[1][1] and fMatrix[1][2] |
fMatrix[1][] | the 3 elements fMatrix[1][0], fMatrix[1][1] and fMatrix[1][2] |
fMatrix[][0] | the 3 elements fMatrix[0][0], fMatrix[1][0] and fMatrix[2][0] |
"fEvent.fMatrix...." same as "fMatrix..." (unless there is more than one leaf named fMatrix!).
In summary, if a specific index is not specified for a dimension, TTree::Draw will loop through all the indices along this dimension. Leaving off the last (right most) dimension of specifying then with the two characters '[]' is equivalent. For variable size arrays (and TClonesArray) the range of the first dimension is recalculated for each entry of the tree. You can also specify the index as an expression of any other variables from the tree.
TTree::Draw also now properly handling operations involving 2 or more arrays.
Let assume a second matrix fResults[5][2], here are a sample of some of the possible combinations, the number of elements they produce and the loop used:
expression | element(s) | Loop |
---|---|---|
fMatrix[2][1] - fResults[5][2] | one | no loop |
fMatrix[2][] - fResults[5][2] | three | on 2nd dim fMatrix |
fMatrix[2][] - fResults[5][] | two | on both 2nd dimensions |
fMatrix[][2] - fResults[][1] | three | on both 1st dimensions |
fMatrix[][2] - fResults[][] | six | on both 1st and 2nd dimensions of fResults |
fMatrix[][2] - fResults[3][] | two | on 1st dim of fMatrix and 2nd of fResults (at the same time) |
fMatrix[][] - fResults[][] | six | on 1st dim then on 2nd dim |
fMatrix[][fResult[][]] | 30 | on 1st dim of fMatrix then on both dimensions of fResults. The value if fResults[j][k] is used as the second index of fMatrix. |
In summary, TTree::Draw loops through all unspecified dimensions. To figure out the range of each loop, we match each unspecified dimension from left to right (ignoring ALL dimensions for which an index has been specified), in the equivalent loop matched dimensions use the same index and are restricted to the smallest range (of only the matched dimensions). When involving variable arrays, the range can of course be different for each entry of the tree.
So the loop equivalent to "fMatrix[][2] - fResults[3][]" is:
So the loop equivalent to "fMatrix[][2] - fResults[][]" is:
So the loop equivalent to "fMatrix[][] - fResults[][]" is:
So the loop equivalent to "fMatrix[][fResults[][]]" is:
By default the temporary histogram created is called "htemp", but only in the one dimensional Draw("e1") it contains the TTree's data points. For a two dimensional Draw, the data is filled into a TGraph which is named "Graph". They can be retrieved by calling
For a three and four dimensional Draw the TPolyMarker3D is unnamed, and cannot be retrieved.
gPad always contains a TH1 derived object called "htemp" which allows to access the axes:
If varexp0 contains >>hnew (following the variable(s) name(s), the new histogram created is called hnew and it is kept in the current directory (and also the current pad). This works for all dimensions.
Example:
will draw sqrt(x)
and save the histogram as "hsqrt" in the current directory. To retrieve it do:
The binning information is taken from the environment variables
In addition, the name of the histogram can be followed by up to 9 numbers between '(' and ')', where the numbers describe the following:
When a new binning is used the new value will become the default. Values can be skipped.
Example:
By default, the specified histogram is reset. To continue to append data to an existing histogram, use "+" in front of the histogram name.
A '+' in front of the histogram name is ignored, when the name is followed by binning information as described in the previous paragraph.
will not reset hsqrt
, but will continue filling. This works for 1-D, 2-D and 3-D histograms.
TTree::Draw default's handling of collections is to assume that any request on a collection pertain to it content. For example, if fTracks is a collection of Track objects, the following:
will plot the value of fPx for each Track objects inside the collection. Also
would plot the result of the member function Track::size() for each Track object inside the collection. To access information about the collection itself, TTree::Draw support the '@' notation. If a variable which points to a collection is prefixed or postfixed with '@', the next part of the expression will pertain to the collection object. For example:
will plot the size of the collection referred to by fTracks
(i.e the number of Track objects).
When a class has a member function named AsDouble or AsString, requesting to directly draw the object will imply a call to one of the 2 functions. If both AsDouble and AsString are present, AsDouble will be used. AsString can return either a char*, a std::string or a TString.s For example, the following
will draw the same histogram as
In addition, when the object is a type TString or std::string, TTree::Draw will call respectively TString::Data
and std::string::c_str()
If the object is a TBits, the histogram will contain the index of the bit that are turned on.
You can refer to the tree (or chain) containing the data by using the string 'This'. You can then could any TTree methods. For example:
will display the local entry numbers be read.
will display the name of the first 'user info' object.
Entry$
: A TTree::Draw formula can use the special variable Entry$
to access the entry number being read. For example to draw every other entry use:
Entry$
: return the current entry number (== TTree::GetReadEntry()
)LocalEntry$
: return the current entry number in the current tree of a chain (== GetTree()->GetReadEntry()
)Entries$
: return the total number of entries (== TTree::GetEntries())Length$
: return the total number of element of this formula for this entry (==TTreeFormula::GetNdata()
)Iteration$
: return the current iteration over this formula for this entry (i.e. varies from 0 to Length$
).Length$(formula )
: return the total number of element of the formula given as a parameter.Sum$(formula )
: return the sum of the value of the elements of the formula given as a parameter. For example the mean for all the elements in one entry can be calculated with: Sum$(formula )/Length$(formula )
Min$(formula )
: return the minimun (within one TTree entry) of the value of the elements of the formula given as a parameter.Max$(formula )
: return the maximum (within one TTree entry) of the value of the elements of the formula given as a parameter.MinIf$(formula,condition)
MaxIf$(formula,condition)
: return the minimum (maximum) (within one TTree entry) of the value of the elements of the formula given as a parameter if they match the condition. If no element matches the condition, the result is zero. To avoid the resulting peak at zero, use the pattern: MinIf$
for the entries that have no match for the condition.Alt$(primary,alternate)
: return the value of "primary" if it is available for the current iteration otherwise return the value of "alternate". For example, with arr1[3] and arr2[2] var2<20 ? -99 : var1
, you can use: If the formula contains a file name, TTree::MakeProxy will be used to load and execute this file. In particular it will draw the result of a function with the same name as the file. The function will be executed in a context where the name of the branches can be used as a C++ variable.
For example draw px using the file hsimple.root (generated by the hsimple.C tutorial), we need a file named hsimple.cxx:
MakeProxy can then be used indirectly via the TTree::Draw interface as follow:
A more complete example is available in the tutorials directory: h1analysisProxy.cxx
, h1analysProxy.h
and h1analysisProxyCut.C
which reimplement the selector found in h1analysis.C
The main features of this facility are:
See TTree::MakeProxy for more details.
In case of a 2-Dim expression, one can generate a TProfile histogram instead of a TH2F histogram by specifying option=prof or option=profs or option=profi or option=profg ; the trailing letter select the way the bin error are computed, See TProfile2D::SetErrorOption for details on the differences. The option=prof is automatically selected in case of y:x>>pf where pf is an existing TProfile histogram.
In case of a 3-Dim expression, one can generate a TProfile2D histogram instead of a TH3F histogram by specifying option=prof or option=profs. or option=profi or option=profg ; the trailing letter select the way the bin error are computed, See TProfile2D::SetErrorOption for details on the differences. The option=prof is automatically selected in case of z:y:x>>pf where pf is an existing TProfile2D histogram.
If option GL5D is specified together with 5 variables, a 5D plot is drawn using OpenGL. See $ROOTSYS/tutorials/tree/staff.C as example.
In case of a 2-Dim or more expression with the option=para, one can generate a parallel coordinates plot. With that option, the number of dimensions is arbitrary. Giving more than 4 variables without the option=para or option=candle or option=goff will produce an error.
In case of a 2-Dim or more expression with the option=candle, one can generate a candle sticks chart. With that option, the number of dimensions is arbitrary. Giving more than 4 variables without the option=para or option=candle or option=goff will produce an error.
When option contains "norm" the output histogram is normalized to 1.
TTree::Draw can be used to fill a TEventList object (list of entry numbers) instead of histogramming one variable. If varexp0 has the form >>elist , a TEventList object named "elist" is created in the current directory. elist will contain the list of entry numbers satisfying the current selection. If option "entrylist" is used, a TEntryList object is created If the selection contains arrays, vectors or any container class and option "entrylistarray" is used, a TEntryListArray object is created containing also the subentries satisfying the selection, i.e. the indices of the branches which hold containers classes. Example:
will create a TEventList object named "yplus" in the current directory. In an interactive session, one can type (after TTree::Draw)
to print the list of entry numbers in the list.
will create a TEntryList object names "yplus" in the current directory
will create a TEntryListArray object names "yplus" in the current directory
By default, the specified entry list is reset. To continue to append data to an existing list, use "+" in front of the list name;
will not reset yplus, but will enter the selected entries at the end of the existing list.
Once a TEventList or a TEntryList object has been generated, it can be used as input for TTree::Draw. Use TTree::SetEventList or TTree::SetEntryList to set the current event list
Example 1:
Example 2:
If a TEventList object is used as input, a new TEntryList object is created inside the SetEventList function. In case of a TChain, all tree headers are loaded for this transformation. This new object is owned by the chain and is deleted with it, unless the user extracts it by calling GetEntryList() function. See also comments to SetEventList() function of TTree and TChain.
If arrays are used in the selection criteria and TEntryListArray is not used, all the entries that have at least one element of the array that satisfy the selection are entered in the list.
Example:
will draw the fPy of ALL tracks in event with at least one track with a positive fPy.
To select only the elements that did match the original selection use TEventList::SetReapplyCut or TEntryList::SetReapplyCut.
Example:
will draw the fPy of only the tracks that have a positive fPy.
To draw only the elements that match a selection in case of arrays, you can also use TEntryListArray (faster in case of a more general selection).
Example:
will draw the fPy of only the tracks that have a positive fPy, but without redoing the selection.
Note: Use tree->SetEventList(0) if you do not want use the list as input.
Once TTree::Draw has been called, it is possible to access useful information still stored in the TTree object via the following functions:
where V1,V2,V3 correspond to the expressions in
If the expression has more than 4 component use GetVal(index)
Example:
creates a TGraph object with a number of points corresponding to the number of entries selected by the expression "pz>4", the x points of the graph being the px values of the Tree and the y points the py values.
Important note: By default TTree::Draw creates the arrays obtained with GetW, GetV1, GetV2, GetV3, GetV4, GetVal with a length corresponding to the parameter fEstimate. The content will be the last GetSelectedRows() % GetEstimate()
values calculated. By default fEstimate=1000000 and can be modified via TTree::SetEstimate. To keep in memory all the results (in case where there is only one result per entry), use
You must call SetEstimate if the expected number of selected rows you need to look at is greater than 1000000.
You can use the option "goff" to turn off the graphics output of TTree::Draw in the above example.
A complete graphical interface to this function is implemented in the class TTreeViewer. To start the TTreeViewer, three possibilities:
Reimplemented in TChain, and TProofChain.
|
virtual |
Remove the branch with name 'bname' from the Tree cache.
If bname="*" all branches are removed from the cache. if subbranches is true all the branches of the subbranches are also removed from the cache.
Returns:
Definition at line 994 of file TTree.cxx.
Referenced by DropBranchFromCache().
|
virtual |
Fill all branches.
This function loops on all the branches of this tree. For each branch, it copies to the branch buffer (basket) the current values of the leaves data types. If a leaf is a simple data type, a simple conversion to a machine independent format has to be done.
This machine independent version of the data is copied into a basket (each branch has its own basket). When a basket is full (32k worth of data by default), it is then optionally compressed and written to disk (this operation is also called committing or 'flushing' the basket). The committed baskets are then immediately removed from memory.
The function returns the number of bytes committed to the individual branches.
If a write error occurs, the number of bytes returned is -1.
If no data are written, because, e.g., the branch is disabled, the number of bytes returned is 0.
The baskets are flushed and the Tree header saved at regular intervals
At regular intervals, when the amount of data written so far is greater than fAutoFlush (see SetAutoFlush) all the baskets are flushed to disk. This makes future reading faster as it guarantees that baskets belonging to nearby entries will be on the same disk region. When the first call to flush the baskets happen, we also take this opportunity to optimize the baskets buffers. We also check if the amount of data written is greater than fAutoSave (see SetAutoSave). In this case we also write the Tree header. This makes the Tree recoverable up to this point in case the program writing the Tree crashes. The decisions to FlushBaskets and Auto Save can be made based either on the number of bytes written (fAutoFlush and fAutoSave negative) or on the number of entries written (fAutoFlush and fAutoSave positive). Note that the user can decide to call FlushBaskets and AutoSave in her event loop base on the number of events written instead of the number of bytes written.
Note that calling FlushBaskets too often increases the IO time.
Note that calling AutoSave too often increases the IO time and also the file size.
Reimplemented in TChain, TTreeSQL, TNtuple, and TNtupleD.
Definition at line 4306 of file TTree.cxx.
Referenced by TMVA::ApplicationCreateCombinedTree(), RooTreeDataStore::cacheArgs(), TGeoChecker::CheckBoundaryErrors(), ClassImp(), CopyEntries(), TTreePlayer::CopyTree(), create_3Bumps(), create_array_with_different_lengths(), create_circ(), create_fullcirc(), create_lin(), create_lin_Nvar(), create_lin_Nvar_Arr(), create_lin_Nvar_categories(), create_lin_Nvar_discrete(), create_lin_Nvar_double(), create_lin_Nvar_weighted(), create_lin_Nvar_withFriend(), create_lin_NvarObsolete(), create_ManyVars(), create_multiclassdata(), create_schachbrett(), create_schachbrett_2D(), create_schachbrett_3D(), create_schachbrett_4D(), create_schachbrett_5D(), createOnionData(), TPerfStats::FileEvent(), TPerfStats::FileOpenEvent(), TPerfStats::FileReadEvent(), TNtupleD::Fill(), TNtuple::Fill(), RooTreeDataStore::fill(), TTreeSQL::Fill(), RooTreeDataStore::Fill(), fillTree(), Memstat::TMemStatMng::FillTree(), RooStats::FillTree(), TMLPAnalyzer::GatherInformations(), TSelEventGen::GenerateFiles(), TMVA::DataSet::GetTree(), TMVA::RuleFit::MakeDebugHists(), makeTree_circ(), makeTree_lin_Nvar(), mlpHiggs(), TPerfStats::PacketEvent(), parallelMergeClient(), parallelMergeTest(), TPerfStats::RateEvent(), ReadStream(), TRecorderRecording::RecordCmdEvent(), TRecorderRecording::RecordExtraEvent(), TRecorderRecording::RecordGuiBldEvent(), TRecorderRecording::RecordGuiCNEvent(), TRecorderRecording::RecordGuiEvent(), TRecorderRecording::RegisterWindow(), TPerfStats::SimpleEvent(), TRecorderRecording::Stop(), testLargeTreeFit(), testLargeTreeRooFit(), testNdimFit(), testTreeFit(), TMVA::MethodTMlpANN::Train(), treeClient(), tv3Write(), writeCArray(), Roo2DKeysPdf::writeNTupleToFile(), writeTMatrix(), writeTMatrixSym(), writeTrackD(), writeTrackD32(), and TMVA::MethodKNN::WriteWeightsToStream().
|
virtual |
Return the branch that correspond to the path 'branchname', which can include the name of the tree or the omitted name of the parent branches.
In case of ambiguity, returns the first match.
Reimplemented in TChain, and TProofChain.
Definition at line 4492 of file TTree.cxx.
Referenced by TProofChain::FindBranch(), TChain::FindBranch(), FindBranch(), TTreeFormula::FindLeafForExpression(), and GetLeafImpl().
|
virtual |
Find leaf..
Reimplemented in TChain, and TProofChain.
Definition at line 4564 of file TTree.cxx.
Referenced by TProofChain::FindLeaf(), TChain::FindLeaf(), FindLeaf(), TTreeFormula::FindLeafForExpression(), and TLeaf::GetLeafCounter().
|
virtual |
Fit a projected item(s) from a tree.
funcname is a TF1 function.
See TTree::Draw() for explanations of the other parameters.
By default the temporary histogram created is called htemp. If varexp contains >>hnew , the new histogram created is called hnew and it is kept in the current directory.
The function returns the number of selected entries.
Example:
will fit sqrt(x) and save the histogram as "hsqrt" in the current directory.
See also TTree::UnbinnedFit
The function returns the status of the histogram fit (see TH1::Fit) If no entries were selected, the function returns -1; (i.e. fitResult is null is the fit is OK)
|
virtual |
Write to disk all the basket that have not yet been individually written.
Return the number of bytes written or -1 in case of write error.
Definition at line 4734 of file TTree.cxx.
Referenced by AutoSave(), Fill(), OptimizeBaskets(), and Write().
|
virtual |
Returns the expanded value of the alias. Search in the friends if any.
Reimplemented in TChain.
Definition at line 4762 of file TTree.cxx.
Referenced by TTreeFormula::DefinedVariable(), TTreeFormula::FindLeafForExpression(), TChain::GetAlias(), GetAlias(), and PyROOT::TTreeGetAttr().
|
inlinevirtual |
Definition at line 371 of file TTree.h.
Referenced by TTreeCache::FillBuffer(), ImportClusterRanges(), and TTree::TClusterIterator::TClusterIterator().
|
inlinevirtual |
Definition at line 372 of file TTree.h.
Referenced by ImportClusterRanges().
|
virtual |
Return pointer to the branch with the given name in this tree or its friends.
Reimplemented in TChain, and TProofChain.
Definition at line 4803 of file TTree.cxx.
Referenced by TTreeCache::AddBranch(), TFileDrawMap::AnimateTree(), RooAbsString::attachToTree(), RooAbsCategory::attachToTree(), RooAbsReal::attachToTree(), RooTreeDataStore::changeObservableName(), ClassImp(), CopyAddresses(), ROOT::Internal::TTreeReaderValueBase::CreateProxy(), TTreeCache::DropBranch(), RooAbsString::fillTreeBranch(), RooAbsCategory::fillTreeBranch(), RooAbsReal::fillTreeBranch(), FillUnBinData(), TProofChain::GetBranch(), TChain::GetBranch(), GetBranch(), GetBranchStatus(), ROOT::Internal::TTreeReaderValueBase::GetLeaf(), TBranchElement::Init(), TChain::LoadTree(), TTreePlayer::MakeClass(), ROOT::Internal::TTreeReaderGenerator::ParseOptions(), TTreeViewer::ProcessMessage(), TBranchElement::ReadLeavesMakeClass(), Refresh(), TChain::SetBranchAddress(), SetBranchAddress(), SetBranchAddressImp(), SetBranchStatus(), RooAbsString::setTreeBranchStatus(), RooAbsCategory::setTreeBranchStatus(), RooAbsReal::setTreeBranchStatus(), StockReturn(), PyROOT::TTreeGetAttr(), tv3Read2(), and TTreeCache::UpdateBranches().
|
inlinevirtual |
Definition at line 374 of file TTree.h.
Referenced by ChangeFile(), TTreeCloner::CollectBranches(), TBranchElement::Fill(), TBranchElement::GetEntry(), and TBranchRef::Notify().
|
virtual |
Return status of branch with name branchname.
Reimplemented in TChain, and TProofChain.
Definition at line 4899 of file TTree.cxx.
Referenced by TProofChain::GetBranchStatus(), and TChain::GetBranchStatus().
|
static |
Used for automatic sizing of the cache.
Estimates a suitable size for the tree cache based on AutoFlush. A cache sizing factor is taken from the configuration. If this yields zero and withDefault is true the historical algorithm for default size is used.
Definition at line 4926 of file TTree.cxx.
Referenced by SetCacheSizeAux().
|
inlinevirtual |
Reimplemented in TChain.
Definition at line 377 of file TTree.h.
Referenced by TTreePerfStats::Finish(), TChain::GetCacheSize(), TEventIterTree::GetTrees(), and TTreePlayer::Process().
|
inlinevirtual |
Definition at line 380 of file TTree.h.
Referenced by TSelectorDraw::TakeAction().
|
virtual |
Return an iterator over the cluster of baskets starting at firstentry.
This iterator is not yet supported for TChain object.
Reimplemented in TChain.
Definition at line 4976 of file TTree.cxx.
Referenced by TTreeCache::FillBuffer(), TTreeCacheUnzip::FillBuffer(), and TChain::GetClusterIterator().
TFile * TTree::GetCurrentFile | ( | ) | const |
Return pointer to the current file.
Definition at line 4987 of file TTree.cxx.
Referenced by AddBranchToCache(), TMVA::DataSetFactory::BuildEventVector(), Delete(), DropBranchFromCache(), TSelEventGen::GenerateFiles(), TEventIterTree::GetNextEvent(), TEventIterTree::GetNextPacket(), TBranch::GetRealFileName(), TEventIterTree::GetTrees(), TTreePlayer::MakeClass(), TTreePlayer::MakeCode(), TChain::Merge(), Merge(), h1analysisTreeReader::Notify(), h1analysis::Notify(), PrintCacheStats(), TTreePlayer::Process(), SetCacheEntryRange(), SetCacheSizeAux(), TBranch::SetFile(), SetName(), SetObject(), TEntryList::SetTree(), StopCacheLearningPhase(), TChainIndex::TChainIndex(), TParallelCoord::TParallelCoord(), TTreeCloner::TTreeCloner(), TTreePerfStats::TTreePerfStats(), and TBranch::UpdateFile().
|
inline |
Definition at line 384 of file TTree.h.
Referenced by TBranchElement::Fill(), and TBranchElement::GetEntry().
|
inline |
Definition at line 382 of file TTree.h.
Referenced by TBranchElement::Init().
|
inline |
Definition at line 385 of file TTree.h.
Referenced by TMVA::DataSetFactory::BuildEventVector(), CloneTree(), CopyEntries(), TTreeCloner::CopyProcessIds(), TTreeCloner::CopyStreamerInfos(), TFriendElement::GetFile(), ROOT::Internal::TTreeGeneratorBase::GetStreamerInfo(), TBranchObject::Init(), TBranchClones::Init(), TBranch::Init(), TBranchElement::Init(), TTreePlayer::MakeClass(), TTreePlayer::MakeCode(), OptimizeBaskets(), TProofPlayer::SavePartialResults(), TEntryList::SetTree(), TBranchRef::TBranchRef(), TBranchSTL::TBranchSTL(), TFriendElement::TFriendElement(), TTreeCloner::TTreeCloner(), TTreeViewer::TTreeViewer(), ROOT::Internal::TTreeProxyGenerator::WriteProxy(), ROOT::Internal::TTreeReaderGenerator::WriteSelector(), and TBranch::~TBranch().
|
inlinevirtual |
Reimplemented in TChain, TTreeSQL, and TProofChain.
Definition at line 386 of file TTree.h.
Referenced by TChain::AddFile(), AddFriend(), TMVA::DataInputHandler::AddTree(), TMVA::Factory::AddTree(), TFileDrawMap::AnimateTree(), TMVA::ApplicationCreateCombinedTree(), TMVA::DataSetFactory::BuildEventVector(), TTreeViewer::BuildInterface(), TGeoChecker::CheckBoundaryReference(), Memstat::TMemStatMng::Close(), TMultiLayerPerceptron::ComputeDEDw(), CopyEntries(), TProofProgressDialog::DoPlotRateGraph(), TTreeViewer::DoRefresh(), TTreePlayer::DrawSelect(), TTreeFormula::EvalInstance(), TTreeCache::FillBuffer(), TTreeCacheUnzip::FillBuffer(), TProofPerfAnalysis::FillFileDist(), TProofPerfAnalysis::FillFileDistOneSrv(), TProofPerfAnalysis::FillFileInfo(), TDataSetManager::FillMetaData(), TProofBenchRunCPU::FillPerfStatPerfPlots(), TProofBenchRunDataRead::FillPerfStatProfiles(), Memstat::TMemStatMng::FillTree(), FillUnBinData(), TProofPerfAnalysis::FillWrkInfo(), TSelEventGen::GenerateFiles(), TProofChain::GetEntries(), TMVA::TreeInfo::GetEntries(), TTreeSQL::GetEntries(), RooTreeDataStore::GetEntries(), TChain::GetEntries(), TDSetElement::GetEntries(), TVirtualPacketizer::GetEntries(), TTreeReader::GetEntries(), TDSet::GetEntries(), TTreeIndex::GetEntryNumberFriend(), TChainIndex::GetEntryNumberFriend(), TMultiLayerPerceptron::GetError(), TEventIterTree::GetNextEvent(), TEventIterTree::GetNextPacket(), TMVA::DataSet::GetTree(), TProofLite::GetTreeHeader(), TProofPerfAnalysis::GetWrkFileList(), TProofPlayerSlave::HandleGetTreeHeader(), TVirtualPacketizer::HandleTimer(), TTreeCloner::ImportClusterRanges(), TTreeFormula::Init(), TRecorderReplaying::Initialize(), TRecorderInactive::ListCmd(), TRecorderInactive::ListGui(), TChain::LoadTree(), RooTreeDataStore::loadValues(), memstatExample(), Merge(), MergeTrees(), mlpHiggs(), RooTreeDataStore::numEntries(), TRecorderReplaying::PrepareNextEvent(), TSelEventGen::Process(), TPoolProcessor< F >::Process(), TTreePlayer::Process(), read(), readSMatrix(), readSMatrixSym(), readTMatrix(), readTMatrixSym(), readTrackD(), readTrackD32(), TMVA::MethodKNN::ReadWeightsFromStream(), TMemStatShow::Show(), StockReturn(), TTreeViewer::SwitchTree(), TMVAClassificationApplication(), TMVAClassificationCategoryApplication(), TMVAMulticlassApplication(), TMVARegressionApplication(), TProofPerfAnalysis::TProofPerfAnalysis(), TTreeCloner::TTreeCloner(), TTreeIndex::TTreeIndex(), tv3Read1(), tv3Read2(), and TTreeCache::UpdateBranches().
|
virtual |
Return the number of entries matching the selection.
Return -1 in case of errors.
If the selection uses any arrays or containers, we return the number of entries where at least one element match the selection. GetEntries is implemented using the selector class TSelectorEntries, which can be used directly (see code in TTreePlayer::GetEntries) for additional option. If SetEventList was used on the TTree or TChain, only that subset of entries will be considered.
Reimplemented in TChain, TTreeSQL, and TProofChain.
|
inlinevirtual |
Reimplemented in TTreeSQL.
Definition at line 388 of file TTree.h.
Referenced by CopyEntries(), and TTreeReader::GetEntries().
|
virtual |
Return pointer to the 1st Leaf named name in any Branch of this Tree or any branch in the list of friend trees.
Definition at line 5020 of file TTree.cxx.
Referenced by TTreePlayer::DrawSelect(), GetEntriesFriend(), TTreePlayer::GetEntriesToProcess(), and TSpider::GetEntriesToProcess().
Read all branches of entry and return total number of bytes read.
getall = 0
: get only active branchesgetall = 1
: get all branchesThe function returns the number of bytes read from the input buffer. If entry does not exist the function returns 0. If an I/O error occurs, the function returns -1.
If the Tree has friends, also read the friends entry.
To activate/deactivate one or more branches, use TBranch::SetBranchStatus For example, if you have a Tree with several hundred branches, and you are interested only by branches named "a" and "b", do
when calling mytree.GetEntry(i); only branches "a" and "b" will be read.
WARNING!! If your Tree has been created in split mode with a parent branch "parent.",
will not activate the sub-branches of "parent". You should do:
Without the trailing dot in the branch creation you have no choice but to call SetBranchStatus explicitly for each of the sub branches.
An alternative is to call directly
By default, GetEntry reuses the space allocated by the previous object for each branch. You can force the previous object to be automatically deleted if you call mybranch.SetAutoDelete(kTRUE) (default is kFALSE).
Example:
Consider the example in $ROOTSYS/test/Event.h The top level branch in the tree T is declared with:
When reading the Tree, one can choose one of these 3 options:
The default (recommended). At the first entry an object of the class Event will be created and pointed by event. At the following entries, event will be overwritten by the new data. All internal members that are TObject* are automatically deleted. It is important that these members be in a valid state when GetEntry is called. Pointers must be correctly initialized. However these internal members will not be deleted if the characters "->" are specified as the first characters in the comment field of the data member declaration.
If "->" is specified, the pointer member is read via pointer->Streamer(buf). In this case, it is assumed that the pointer is never null (case of pointer TClonesArray *fTracks in the Event example). If "->" is not specified, the pointer member is read via buf >> pointer. In this case the pointer may be null. Note that the option with "->" is faster to read or write and it also consumes less space in the file.
The option AutoDelete is set
In this case, at each iteration, the object event is deleted by GetEntry and a new instance of Event is created and filled.
It is strongly recommended to use the default option 1. It has the additional advantage that functions like TTree::Draw (internally calling TTree::GetEntry) will be functional even when the classes in the file are not available.
Note: See the comments in TBranchElement::SetAddress() for the object ownership policy of the underlying (user) data.
Reimplemented in TChain, TTreeSQL, and THbookTree.
Definition at line 5144 of file TTree.cxx.
Referenced by TMVA::ApplicationCreateCombinedTree(), TMVA::DataSetFactory::BuildEventVector(), TGeoChecker::CheckBoundaryReference(), CopyEntries(), TTreePlayer::CopyTree(), TProofProgressDialog::DoPlotRateGraph(), TProofPerfAnalysis::FillFileDist(), TProofPerfAnalysis::FillFileDistOneSrv(), TProofPerfAnalysis::FillFileInfo(), TProofBenchRunCPU::FillPerfStatPerfPlots(), TProofBenchRunDataRead::FillPerfStatProfiles(), FillUnBinData(), TProofPerfAnalysis::FillWrkInfo(), RooProofDriverSelector::GetEntry(), TPySelector::GetEntry(), TSelectorEntries::GetEntry(), TTreeSQL::GetEntry(), TChain::GetEntry(), RooTreeDataStore::GetEntry(), TMultiLayerPerceptron::GetEntry(), GetEntry(), GetEntryWithIndex(), GetEvent(), TProofPerfAnalysis::GetWrkFileList(), TVirtualPacketizer::HandleTimer(), TRecorderInactive::ListCmd(), TRecorderInactive::ListGui(), RooTreeDataStore::loadValues(), mlpHiggs(), TRecorderReplaying::PrepareNextEvent(), TSelEvent::Process(), read(), readSMatrix(), readSMatrixSym(), readTMatrix(), readTMatrixSym(), readTrackD(), readTrackD32(), TMVA::MethodKNN::ReadWeightsFromStream(), TRecorderReplaying::RegisterWindow(), Show(), TMVAClassificationApplication(), TMVAClassificationCategoryApplication(), TMVAMulticlassApplication(), TMVARegressionApplication(), and tv3Read1().
|
virtual |
Returns the entry list, set to this tree.
Definition at line 5194 of file TTree.cxx.
Referenced by TSelectorDraw::Begin(), TTreePlayer::DrawSelect(), TTreePlayer::GetEntriesToProcess(), and TSpider::GetEntriesToProcess().
Return entry number corresponding to entry.
if no TEntryList set returns entry else returns the entry number corresponding to the list index=entry
Reimplemented in TChain.
Definition at line 5205 of file TTree.cxx.
Referenced by TSpider::AddVariable(), TTreePlayer::CopyTree(), GetMaximum(), GetMinimum(), TSpider::InitVariables(), RooTreeDataStore::loadValues(), TTreePlayer::Principal(), TTreePlayer::Process(), TTreePlayer::Query(), TTreePlayer::Scan(), TSpider::SetCurrentEntries(), and TSPlot::SetTreeSelection().
Return entry number corresponding to major and minor number.
Note that this function returns only the entry number, not the data To read the data corresponding to an entry number, use TTree::GetEntryWithIndex the BuildIndex function has created a table of Long64_t* of sorted values corresponding to val = major<<31 + minor; The function performs binary search in this sorted table. If it finds a pair that matches val, it returns directly the index in the table. If an entry corresponding to major and minor is not found, the function returns the index of the major,minor pair immediately lower than the requested value, ie it will return -1 if the pair is lower than the first entry in the index.
See also GetEntryNumberWithIndex
Return entry number corresponding to major and minor number.
Note that this function returns only the entry number, not the data To read the data corresponding to an entry number, use TTree::GetEntryWithIndex the BuildIndex function has created a table of Long64_t* of sorted values corresponding to val = major<<31 + minor; The function performs binary search in this sorted table. If it finds a pair that matches val, it returns directly the index in the table, otherwise it returns -1.
See also GetEntryNumberWithBestIndex
Definition at line 5250 of file TTree.cxx.
Referenced by TTreeIndex::GetEntryNumberFriend(), TChainIndex::GetEntryNumberFriend(), TChain::GetEntryWithIndex(), and GetEntryWithIndex().
Read entry corresponding to major and minor number.
The function returns the total number of bytes read. If the Tree has friend trees, the corresponding entry with the index values (major,minor) is read. Note that the master Tree and its friend may have different entry serial numbers corresponding to (major,minor).
Reimplemented in TChain.
|
inlinevirtual |
Definition at line 390 of file TTree.h.
Referenced by TSelectorDraw::Begin(), TTreePlayer::DrawSelect(), TSelectorDraw::ProcessFill(), TSelectorDraw::ProcessFillMultiple(), TSelectorDraw::ProcessFillObject(), TParallelCoord::TParallelCoord(), and TSpider::TSpider().
|
inline |
Definition at line 396 of file TTree.h.
Referenced by TSelectorDraw::Begin(), TMLPAnalyzer::DrawNetwork(), TTreePlayer::DrawSelect(), TTreeCache::FillBuffer(), and TTreeCacheUnzip::FillBuffer().
|
inlinevirtual |
Definition at line 399 of file TTree.h.
Referenced by TChain::Merge().
|
virtual |
Return a pointer to the TTree friend whose name or alias is 'friendname.
Definition at line 5314 of file TTree.cxx.
Referenced by GetFriend(), TFormLeafInfoTTree::TFormLeafInfoTTree(), and TFormLeafInfoTTree::Update().
|
virtual |
If the 'tree' is a friend, this method returns its alias name.
This alias is an alternate name for the tree.
It can be used in conjunction with a branch or leaf name in a TTreeFormula, to specify in which particular tree the branch or leaf can be found if the friend trees have branches or leaves with the same name as the master tree.
It can also be used in conjunction with an alias created using TTree::SetAlias in a TTreeFormula, e.g.:
where fPx is a branch of the friend tree aliased as 'treealias' and 'myAlias' was created using TTree::SetAlias on the friend tree.
However, note that 'treealias.myAlias' will be expanded literally, without remembering that it comes from the aliased friend and thus the branch name might not be disambiguated properly, which means that you may not be able to take advantage of this feature.
Definition at line 5371 of file TTree.cxx.
Referenced by GetFriendAlias(), and TTreeFormula::ParseWithLeaf().
|
inline |
Definition at line 402 of file TTree.h.
Referenced by TTreeViewer::ExecuteDraw().
|
virtual |
Creates a new iterator that will go through all the leaves on the tree itself and its friend.
Definition at line 5414 of file TTree.cxx.
Referenced by TTreeFormula::FindLeafForExpression(), and TTreeFormula::GetLeafWithDatamember().
|
virtual |
Return pointer to the 1st Leaf named name in any Branch of this Tree or any branch in the list of friend trees.
The leaf name can contain the name of a friend tree with the syntax: friend_dir_and_tree.full_leaf_name the friend_dir_and_tree can be of the form:
TDirectoryName/TreeName
Reimplemented in TChain.
Definition at line 5520 of file TTree.cxx.
Referenced by TChain::GetLeaf(), GetLeafImpl(), GetMaximum(), GetMinimum(), and PyROOT::TTreeGetAttr().
|
virtual |
|
protectedvirtual |
Return pointer to the 1st Leaf named name in any Branch of this Tree or any branch in the list of friend trees.
The leaf name can contain the name of a friend tree with the syntax: friend_dir_and_tree.full_leaf_name the friend_dir_and_tree can be of the form:
Definition at line 5430 of file TTree.cxx.
Referenced by GetLeaf().
|
inlinevirtual |
Reimplemented in TProofChain.
Definition at line 412 of file TTree.h.
Referenced by TProofChain::AddAliases().
|
inlinevirtual |
Reimplemented in TChain, and TProofChain.
Definition at line 409 of file TTree.h.
Referenced by ROOT::Internal::TTreeProxyGenerator::AnalyzeTree(), ROOT::Internal::TTreeReaderGenerator::AnalyzeTree(), Branch(), ChangeFile(), CloneTree(), TTreeCloner::CollectBranches(), THbookFile::ConvertCWN(), THbookFile::ConvertRWN(), CopyAddresses(), TTreePlayer::CopyTree(), DirectoryAutoAdd(), FindBranch(), TTreeFormula::FindLeafForExpression(), FlushBaskets(), TProofChain::GetListOfBranches(), TChain::GetListOfBranches(), TBranch::GetMother(), TTreeViewer::MapTree(), TChain::Merge(), TMVA::mvaweights(), Print(), ResetBranchAddresses(), SetDefaultEntryOffsetLen(), SetDirectory(), THbookTree::SetEntries(), and SetEntries().
|
inlinevirtual |
Reimplemented in TProofChain.
Definition at line 408 of file TTree.h.
Referenced by TChain::InvalidateCurrentTree(), and MergeTrees().
|
inlinevirtual |
Reimplemented in TProofChain.
Definition at line 411 of file TTree.h.
Referenced by TTreeCache::AddBranch(), ROOT::Internal::TTreeProxyGenerator::AnalyzeTree(), TTreeCache::DropBranch(), TEventIterTree::GetTrees(), TChain::LoadTree(), TTreeViewer::MapTree(), TTreeFriendLeafIter::Next(), TBranchRef::Notify(), TDSet::TDSet(), ROOT::Internal::TFriendProxy::TFriendProxy(), and ROOT::Internal::TFriendProxy::Update().
|
inlinevirtual |
Reimplemented in TChain, and TProofChain.
Definition at line 410 of file TTree.h.
Referenced by TTreeCache::AddBranch(), CloneTree(), CopyAddresses(), Delete(), TTreeCache::DropBranch(), FindLeaf(), GetBranch(), TLeaf::GetLeafCounter(), GetLeafImpl(), TProofChain::GetListOfLeaves(), TChain::GetListOfLeaves(), TFileDrawMap::GetObjectInfoDir(), TBranchObject::Init(), TBranch::Init(), TBranchElement::Init(), LoadBaskets(), TTreePlayer::MakeClass(), TTreePlayer::MakeCode(), TTreeFriendLeafIter::Next(), Notify(), OptimizeBaskets(), TFileDrawMap::PaintDir(), TMVA::paracoor(), TTreePlayer::Principal(), Print(), TTreeViewer::ProcessMessage(), TTreePlayer::Query(), TTreePlayer::Scan(), TSPlot::SetTreeSelection(), TTreeTableInterface::SetVariablesExpression(), TSpider::SetVariablesExpression(), Show(), TTreeCache::TTreeCache(), TTreePerfStats::TTreePerfStats(), TBranch::~TBranch(), and TLeaf::~TLeaf().
|
inline |
Definition at line 416 of file TTree.h.
Referenced by CheckBranchAddressType(), TBranchElement::GetEntry(), TFormLeafInfo::GetObjectAddress(), TBranchElement::GetTypedValue(), TBranchElement::GetValuePointer(), TBranchElement::PrintValue(), TBranchElement::SetAddress(), TBranchElement::SetFillLeavesPtr(), TBranchElement::SetupAddresses(), and TBranchElement::ValidateAddress().
|
inlinevirtual |
Definition at line 418 of file TTree.h.
Referenced by TTreePlayer::DrawSelect(), and TProofChain::GetEntries().
|
virtual |
Return maximum of column with name columname.
if the Tree has an associated TEventList or TEntryList, the maximum is computed for the entries in this list.
Reimplemented in TChain.
Definition at line 5566 of file TTree.cxx.
Referenced by TChain::GetMaximum(), TMVA::mvaweights(), TMVA::paracoor(), and plot().
|
static |
Static function which returns the tree file size limit in bytes.
Definition at line 5595 of file TTree.cxx.
Referenced by CopyEntries().
|
inlinevirtual |
|
virtual |
Return minimum of column with name columname.
if the Tree has an associated TEventList or TEntryList, the minimum is computed for the entries in this list.
Reimplemented in TChain.
Definition at line 5605 of file TTree.cxx.
Referenced by TChain::GetMinimum(), TMVA::mvaweights(), TMVA::paracoor(), and plot().
|
inlinevirtual |
Reimplemented in TChain.
Definition at line 423 of file TTree.h.
Referenced by TChain::GetNbranches().
|
protected |
Determine which newline this file is using.
Return '\r' for Windows '\r\n' as that already terminates.
Definition at line 6820 of file TTree.cxx.
Referenced by ReadStream().
|
inlinevirtual |
Definition at line 426 of file TTree.h.
Referenced by TChain::AddFile().
|
inlinevirtual |
Definition at line 427 of file TTree.h.
Referenced by TBasket::LoadBasketBuffers(), and TBasket::ReadBasketBuffers().
TVirtualTreePlayer * TTree::GetPlayer | ( | ) |
Load the TTreePlayer (if not already done).
Definition at line 5634 of file TTree.cxx.
Referenced by TParallelCoord::ApplySelectionToTree(), BuildIndex(), CopyTree(), TFitEditor::DoFit(), TChain::Draw(), Draw(), TTreeViewer::ExecuteDraw(), Fit(), GetEntries(), GetHistogram(), TProofChain::GetPlayer(), GetSelect(), GetSelectedRows(), TParallelCoord::GetTree(), GetV1(), GetV2(), GetV3(), GetV4(), GetVal(), GetVar(), GetVar1(), GetVar2(), GetVar3(), GetVar4(), GetW(), THbookTree::InitBranches(), TChain::Loop(), MakeClass(), MakeCode(), MakeProxy(), MakeSelector(), TSessionQueryFrame::OnBtnFinalize(), TSessionQueryFrame::OnBtnRetrieve(), TSessionViewer::OnListTreeClicked(), Principal(), Process(), Query(), TParallelCoord::ResetTree(), Scan(), SetEstimate(), TTreeViewer::SetScanFileName(), TSPlot::SetTreeSelection(), StartViewer(), and UnbinnedFit().
|
protected |
Find and return the TTreeCache registered with the file and which may contain branches for us.
If create is true and there is no cache a new cache is created with default size.
Definition at line 5648 of file TTree.cxx.
Referenced by AddBranchToCache(), DropBranchFromCache(), MoveReadCache(), SetCacheEntryRange(), SetCacheSizeAux(), SetName(), SetObject(), and StopCacheLearningPhase().
|
inlinevirtual |
Reimplemented in TChain, and TProofChain.
Definition at line 428 of file TTree.h.
Referenced by TTreeCache::AddBranch(), ROOT::Internal::TTreeProxyGenerator::AnalyzeElement(), TTreeCache::DropBranch(), TTreeFormula::EvalInstance(), TTreeFormula::EvalObject(), TTreeFormula::EvalStringInstance(), TTreePerfStats::FileReadEvent(), TTreeCache::FillBuffer(), TTreeCacheUnzip::FillBuffer(), TTreeFormula::FindLeafForExpression(), ROOT::Internal::TTreeGeneratorBase::GetContainedClassName(), GetEntry(), TTreeIndex::GetEntryNumberFriend(), TChainIndex::GetEntryNumberFriend(), TChain::GetReadEntry(), TBranchElement::GetTypedValue(), TBranchElement::GetValuePointer(), TTreeViewer::HandleTimer(), TTreeFormula::Init(), TBranchElement::IsMissingCollection(), TTreeFormula::LoadBranches(), TTreeFormula::LoadCurrentDim(), TTreeFormula::ParseWithLeaf(), TTreeFormula::PrintValue(), ROOT::Internal::TFriendProxy::ResetReadEntry(), ROOT::Detail::TBranchProxy::Setup(), TSelectorDraw::TakeAction(), and TTreeIndex::TTreeIndex().
|
inlinevirtual |
|
inlinevirtual |
Definition at line 430 of file TTree.h.
Referenced by TSpider::GotoFollowing(), TSpider::GotoNext(), TSpider::GotoPrevious(), TTreePlayer::Scan(), and TSpider::SetCurrentEntries().
|
inline |
Definition at line 431 of file TTree.h.
Referenced by THbookTree::InitBranches().
|
inlinevirtual |
Definition at line 432 of file TTree.h.
Referenced by TMemStatShow::EventInfo1(), FillUnBinData(), and TGL5DDataSet::TGL5DDataSet().
|
inlinevirtual |
Definition at line 433 of file TTree.h.
Referenced by TTreePlayer::Process().
|
inlinevirtual |
Definition at line 435 of file TTree.h.
Referenced by CopyEntries(), TDataSetManager::FillMetaData(), OptimizeBaskets(), and TTreePerfStats::TTreePerfStats().
Returns the transient buffer currently used by this TTree for reading/writing baskets.
Definition at line 889 of file TTree.cxx.
Referenced by TBasket::TBasket().
|
inlinevirtual |
Reimplemented in TChain.
Definition at line 436 of file TTree.h.
Referenced by TTreeCache::AddBranch(), AddBranchToCache(), TMVA::DataSetFactory::BuildEventVector(), TMVA::DataSetFactory::ChangeToNewTree(), CloneTree(), TEntryListArray::Contains(), TEntryList::Contains(), CopyEntries(), TChainIndex::DeleteIndices(), TTreeCache::DropBranch(), DropBranchFromCache(), TEntryListArray::Enter(), TEntryList::Enter(), TTreeFormula::EvalInstance(), TTreeFormula::FindLeafForExpression(), RooProofDriverSelector::GetEntry(), TPySelector::GetEntry(), TSelectorEntries::GetEntry(), GetFriendAlias(), ROOT::Internal::TTreeReaderValueBase::GetLeaf(), TEntryListArray::GetSubListForEntry(), TChainIndex::GetSubTreeIndex(), TTreeCloner::ImportClusterRanges(), TTreeFormula::LoadCurrentDim(), TChain::LoadTree(), TTreeViewer::MapTree(), TTreeFormula::ParseWithLeaf(), TSelEvent::Process(), TTreePlayer::Process(), TSelectorDraw::ProcessFillMultiple(), TChainIndex::ReleaseSubTreeIndex(), TEntryListArray::Remove(), TEntryList::Remove(), TEntryListArray::RemoveSubList(), TEntryListArray::RemoveSubListForEntry(), TTreeFormula::ResetDimensions(), ROOT::Internal::TFriendProxy::ResetReadEntry(), SetCacheEntryRange(), SetCacheSizeAux(), TEntryListArray::SetEntry(), TTreeReader::SetEntryBase(), TEntryList::SetTree(), StopCacheLearningPhase(), and TSelectorDraw::TakeAction().
|
inlinevirtual |
Definition at line 437 of file TTree.h.
Referenced by AddFriend(), CopyEntries(), TChainIndex::DeleteIndices(), TChainIndex::GetSubTreeIndex(), TTreeFormula::LoadCurrentDim(), TChain::LoadTree(), MergeTrees(), TTreeFormula::ParseWithLeaf(), TChainIndex::ReleaseSubTreeIndex(), TTreeFormula::ResetDimensions(), TChainIndex::TChainIndex(), TChainIndex::~TChainIndex(), and TTreeIndex::~TTreeIndex().
|
inlinevirtual |
Reimplemented in TChain.
Definition at line 438 of file TTree.h.
Referenced by TSpider::AddVariable(), CopyEntries(), TTreePlayer::CopyTree(), TMultiLayerPerceptron::GetEntry(), TTreeFormula::Init(), TTreeTableInterface::InitEntries(), TSpider::InitVariables(), ROOT::Detail::TBranchProxy::IsInitialized(), TChain::LoadTree(), LoadTree(), TTreePlayer::Principal(), TTreePlayer::Query(), TTreePlayer::Scan(), TSpider::SetCurrentEntries(), TTreeReader::SetEntryBase(), TSPlot::SetTreeSelection(), and TTreeIndex::TTreeIndex().
|
inlinevirtual |
Definition at line 439 of file TTree.h.
Referenced by TSelectorDraw::TakeAction().
|
virtual |
Return a pointer to the list containing user objects associated to this tree.
The list is automatically created if it does not exist.
WARNING: By default the TTree destructor will delete all objects added to this list. If you do not want these objects to be deleted, call:
mytree->GetUserInfo()->Clear();
before deleting the tree.
Definition at line 5673 of file TTree.cxx.
Referenced by Memstat::TMemStatMng::Close(), EventInfo(), TMemStatShow::FillBTString(), Memstat::TMemStatMng::Init(), memstatExample(), and TMemStatShow::Show().
|
inlinevirtual |
Definition at line 454 of file TTree.h.
Referenced by TParallelCoord::AddVariable(), FillUnBinData(), memstatExample(), and TMemStatShow::Show().
|
inlinevirtual |
Definition at line 456 of file TTree.h.
Referenced by FillUnBinData(), memstatExample(), and TMemStatShow::Show().
|
inlinevirtual |
Definition at line 458 of file TTree.h.
Referenced by memstatExample(), and TMemStatShow::Show().
|
inlinevirtual |
Definition at line 460 of file TTree.h.
Referenced by memstatExample(), and TMemStatShow::Show().
Definition at line 452 of file TTree.h.
Referenced by TGL5DDataSet::TGL5DDataSet().
|
inline |
Definition at line 442 of file TTree.h.
Referenced by TGL5DDataSet::TGL5DDataSet().
|
inline |
Definition at line 444 of file TTree.h.
Referenced by THbookTree::InitBranches().
|
inline |
Definition at line 446 of file TTree.h.
Referenced by THbookTree::InitBranches().
|
inline |
Definition at line 448 of file TTree.h.
Referenced by THbookTree::InitBranches().
|
inline |
|
inlinevirtual |
Reimplemented in TChain.
Definition at line 462 of file TTree.h.
Referenced by TSelectorDraw::Begin(), TMultiLayerPerceptron::GetEntry(), TChain::GetWeight(), and TSelectorDraw::Notify().
|
inlinevirtual |
Definition at line 463 of file TTree.h.
Referenced by TDataSetManager::FillMetaData(), and TTreePerfStats::TTreePerfStats().
Appends the cluster range information stored in 'fromtree' to this tree, including the value of fAutoFlush.
This is used when doing a fast cloning (by TTreeCloner). See also fAutoFlush and fAutoSave if needed.
Definition at line 5689 of file TTree.cxx.
Referenced by TTreeCloner::ImportClusterRanges(), and Refresh().
Definition at line 464 of file TTree.h.
Referenced by TBranch::AddBasket(), TBasket::AdjustSize(), TBasketSQL::CreateBuffer(), TBasket::DropBuffers(), TBasket::ReadBasketBuffers(), TBasket::ReadBasketBuffersUncompressedCase(), TBasket::TBasket(), TBasketSQL::TBasketSQL(), and TBranch__SetTree().
|
inlinevirtual |
|
protectedvirtual |
Read in memory all baskets from all branches up to the limit of maxmemory bytes.
If maxmemory is non null and positive SetMaxVirtualSize is called with this value. Default for maxmemory is 2000000000 (2 Gigabytes). The function returns the total number of baskets read into memory if negative an error occurred while loading the branches. This method may be called to force branch baskets in memory when random access to branch entries is required. If random access to only a few branches is required, you should call directly TBranch::LoadBaskets.
Reimplemented in TChain.
Set current entry.
Returns -2 if entry does not exist (just as TChain::LoadTree()).
Note: This function is overloaded in TChain.
Reimplemented in TChain, and TTreeSQL.
Definition at line 5785 of file TTree.cxx.
Referenced by AddBranchToCache(), TSpider::AddVariable(), TMVA::DataSetFactory::BuildEventVector(), CloneTree(), TEntryListArray::Contains(), TEntryList::Contains(), CopyEntries(), TTreePlayer::CopyTree(), TSpider::Draw(), DropBranchFromCache(), TEntryListArray::Enter(), TEntryList::Enter(), TTreeFormula::FindLeafForExpression(), TEntryListArray::GetSubListForEntry(), TTreeTableInterface::GetValue(), TTreeTableInterface::GetValueAsString(), TTreeFormula::Init(), TTreeTableInterface::InitEntries(), TSpider::InitVariables(), TChain::LoadTree(), LoadTreeFriend(), TEventIterTree::PreProcessEvent(), TTreePlayer::Principal(), TTreePlayer::Process(), TTreePlayer::Query(), TEntryListArray::Remove(), TEntryList::Remove(), TEntryListArray::RemoveSubListForEntry(), TTreePlayer::Scan(), SetCacheEntryRange(), TSpider::SetCurrentEntries(), TSpider::SetDisplayAverage(), TEntryListArray::SetEntry(), TTreeReader::SetEntryBase(), TSpider::SetNx(), TSpider::SetNy(), TSpider::SetSegmentDisplay(), TSPlot::SetTreeSelection(), Show(), StopCacheLearningPhase(), TTreeIndex::TTreeIndex(), and TSpider::UpdateView().
Load entry on behalf of our master tree, we may use an index.
Called by LoadTree() when the masterTree looks for the entry number in a friend tree (us) corresponding to the passed entry number in the masterTree.
If we have no index, our entry number and the masterTree entry number are the same.
If we do have an index, we must find the (major, minor) value pair in masterTree to locate our corresponding entry.
Definition at line 5877 of file TTree.cxx.
Referenced by GetEntry(), TChain::LoadTree(), and LoadTree().
Generate a skeleton analysis class for this tree.
The following files are produced: classname.h and classname.C. If classname is 0, classname will be called "nameoftree".
The generated code in classname.h includes the following:
The generated code in classname.C includes only the main analysis function Loop.
To use this function:
where T is the name of the TTree in file myfile.root, and MyClass.h, MyClass.C the name of the files created by this function. In a ROOT session, you can do:
NOTE: Do not use the code generated for a single TTree which is part of a TChain to process that entire TChain. The maximum dimensions calculated for arrays on the basis of a single TTree from the TChain might be (will be!) too small when processing all of the TTrees in the TChain. You must use myChain.MakeClass() to generate the code, not myTree.MakeClass(...).
Definition at line 5927 of file TTree.cxx.
Referenced by MakeSelector().
|
virtual |
Generate a skeleton function for this tree.
The function code is written on filename. If filename is 0, filename will be called nameoftree.C
The generated code includes the following:
To use this function:
where T is the name of the TTree in file myfile.root and MyAnalysis.C the name of the file created by this function.
NOTE: Since the implementation of this function, a new and better function TTree::MakeClass() has been developed.
|
virtual |
Generate a skeleton analysis class for this Tree using TBranchProxy.
TBranchProxy is the base of a class hierarchy implementing an indirect access to the content of the branches of a TTree.
"proxyClassname" is expected to be of the form:
The skeleton will then be generated in the file:
located in the current directory or in 'path/' if it is specified. The class generated will be named 'fileprefix'
"macrofilename" and optionally "cutfilename" are expected to point to source files which will be included by the generated skeleton. Method of the same name as the file(minus the extension and path) will be called by the generated skeleton's Process method as follow:
"option" can be used select some of the optional features during the code generation. The possible options are:
'maxUnrolling' controls how deep in the class hierarchy does the system 'unroll' classes that are not split. Unrolling a class allows direct access to its data members (this emulates the behavior of TTreeFormula).
The main features of this skeleton are:
For example with Event.root, if
is executed by one of the method of the skeleton, somePx will updated with the current value of fPx of the 3rd track.
Both macrofilename and the optional cutfilename are expected to be the name of source files which contain at least a free standing function with the signature:
and
x_t and y_t needs to be types that can convert respectively to a double and a bool (because the skeleton uses:
if (cutfilename()) htemp->Fill(macrofilename());
These two functions are run in a context such that the branch names are available as local variables of the correct (read-only) type.
Note that if you use the same 'variable' twice, it is more efficient to 'cache' the value. For example:
is more efficient than
Also, optionally, the generated selector will also call methods named macrofilename_methodname in each of 6 main selector methods if the method macrofilename_methodname exist (Where macrofilename is stripped of its extension).
Concretely, with the script named h1analysisProxy.C,
If a file name macrofilename.h (or .hh, .hpp, .hxx, .hPP, .hXX) exist it is included before the declaration of the proxy class. This can be used in particular to insure that the include files needed by the macro file are properly loaded.
The default histogram is accessible via the variable named 'htemp'.
If the library of the classes describing the data in the branch is loaded, the skeleton will add the needed #include statements and give the ability to access the object stored in the branches.
To draw px using the file hsimple.root (generated by the hsimple.C tutorial), we need a file named hsimple.cxx:
MakeProxy can then be used indirectly via the TTree::Draw interface as follow:
A more complete example is available in the tutorials directory: h1analysisProxy.cxx , h1analysProxy.h and h1analysisProxyCut.C which reimplement the selector found in h1analysis.C
Generate skeleton selector class for this tree.
The following files are produced: selector.h and selector.C. If selector is 0, the selector will be called "nameoftree". The option can be used to specify the branches that will have a data member.
The generated code in selector.h includes the following:
The class selector derives from TSelector. The generated code in selector.C includes empty functions defined above.
To use this function:
TFile f("myfile.root");
)T->MakeSelector("myselect");
where T is the name of the Tree in file myfile.root and myselect.h, myselect.C the name of the files created by this function. In a ROOT session, you can do:
Definition at line 6142 of file TTree.cxx.
Referenced by TTreeViewer::MakeSelector().
|
virtual |
|
virtual |
Merge the trees in the TList into this tree.
If info->fIsFirst is true, first we clone this TTree info the directory info->fOutputDirectory and then overlay the new TTree information onto this TTree object (so that this TTree object is now the appropriate to use for further merging).
Returns the total number of entries in the merged tree.
Reimplemented in TChain.
|
protected |
Move a cache from a file to the current file in dir.
if src is null no operation is done, if dir is null or there is no current file the cache is deleted.
Definition at line 6304 of file TTree.cxx.
Referenced by Delete(), DirectoryAutoAdd(), SetDirectory(), and ~TTree().
|
virtual |
|
virtual |
This function may be called after having filled some entries in a Tree Using the information in the existing branch buffers, it will reassign new branch buffer sizes to optimize time and memory.
The function computes the best values for branch buffer sizes such that the total buffer sizes is less than maxMemory and nearby entries written at the same time. In case the branch compression factor for the data written so far is less than compMin, the compression is disabled.
if option ="d" an analysis report is printed.
Definition at line 6350 of file TTree.cxx.
Referenced by Fill().
TPrincipal * TTree::Principal | ( | const char * | varexp = "" , |
const char * | selection = "" , |
||
Option_t * | option = "np" , |
||
Long64_t | nentries = kMaxEntries , |
||
Long64_t | firstentry = 0 |
||
) |
Interface to the Principal Components Analysis class.
Create an instance of TPrincipal
Fill it with the selected variables
see TTree::Draw for explanation of the other parameters.
The created object is named "principal" and a reference to it is added to the list of specials Root objects. you can retrieve a pointer to the created object via:
Print a summary of the tree contents.
Wildcarding can be used to print only a subset of the branches, e.g., T.Print("Elec*")
will print all branches with name starting with "Elec".
Reimplemented from TNamed.
Reimplemented in TChain, and THbookTree.
Definition at line 6495 of file TTree.cxx.
Referenced by THbookTree::Print(), TChain::Print(), Print(), tv3Write(), writeCArray(), writeTMatrix(), writeTMatrixSym(), writeTrackD(), and writeTrackD32().
print statistics about the TreeCache for this tree, like
if option = "a" the list of blocks in the cache is printed
|
virtual |
Process this tree executing the TSelector code in the specified filename.
The return value is -1 in case of error and TSelector::GetStatus() in in case of success.
The code in filename is loaded (interpreted or compiled, see below), filename must contain a valid class implementation derived from TSelector, where TSelector has the following member functions:
Begin()
: called every time a loop on the tree starts, a convenient place to create your histograms.SlaveBegin()
: called after Begin(), when on PROOF called only on the slave servers.Process()
: called for each event, in this function you decide what to read and fill your histograms.SlaveTerminate
: called at the end of the loop on the tree, when on PROOF called only on the slave servers.Terminate()
: called at the end of the loop on the tree, a convenient place to draw/fit your histograms.If filename is of the form file.C, the file will be interpreted.
If filename is of the form file.C++, the file file.C will be compiled and dynamically loaded.
If filename is of the form file.C+, the file file.C will be compiled and dynamically loaded. At next call, if file.C is older than file.o and file.so, the file.C is not compiled, only file.so is loaded.
It may be more interesting to invoke directly the other Process function accepting a TSelector* as argument.eg
One should not call this function twice with the same selector file in the same script. If this is required, proceed as indicated in NOTE1, by getting a pointer to the corresponding TSelector,eg
or use ACLIC to compile the selector
Reimplemented in TChain, and TProofChain.
Definition at line 6687 of file TTree.cxx.
Referenced by TTreePlayer::DrawScript(), TTreePlayer::GetEntries(), TChain::Process(), TTreeViewer::Process(), and TEvePointSelector::Select().
|
virtual |
Process this tree executing the code in the specified selector.
The return value is -1 in case of error and TSelector::GetStatus() in in case of success.
The TSelector class has the following member functions:
Begin()
: called every time a loop on the tree starts, a convenient place to create your histograms.SlaveBegin()
: called after Begin(), when on PROOF called only on the slave servers.Process()
: called for each event, in this function you decide what to read and fill your histograms.SlaveTerminate
: called at the end of the loop on the tree, when on PROOF called only on the slave servers.Terminate()
: called at the end of the loop on the tree, a convenient place to draw/fit your histograms.
If the Tree (Chain) has an associated EventList, the loop is on the nentries of the EventList, starting at firstentry, otherwise the loop is on the specified Tree entries.
Reimplemented in TChain, and TProofChain.
|
virtual |
Make a projection of a tree using selections.
Depending on the value of varexp (described in Draw) a 1-D, 2-D, etc., projection of the tree will be filled in histogram hname. Note that the dimension of hname must match with the dimension of varexp.
Definition at line 6735 of file TTree.cxx.
Referenced by TMVA::mvaweights(), and TMVA::Tools::projNormTH1F().
|
virtual |
Loop over entries and return a TSQLResult object containing entries following selection.
|
virtual |
Create or simply read branches from filename.
if branchDescriptor = "" (default), it is assumed that the Tree descriptor is given in the first line of the file with a syntax like
otherwise branchDescriptor must be specified with the above syntax.
x:y:z
(all variables are assumed of type "F"x/D:y:z
(all variables are of type "D"x:y/D:z
(x is type "F", y and z of type "D"delimiter allows for the use of another delimiter besides whitespace. This provides support for direct import of common data file formats like csv. If delimiter != ' ' and branchDescriptor == "", then the branch description is taken from the first line in the file, but delimiter is used for the branch names tokenization rather than ':'. Note however that if the values in the first line do not use the /[type] syntax, all variables are assumed to be of type "F". If the filename ends with extensions .csv or .CSV and a delimiter is not specified (besides ' '), the delimiter is automatically set to ','.
Lines in the input file starting with "#" are ignored. Leading whitespace for each column data is skipped. Empty lines are skipped.
A TBranch object is created for each variable in the expression. The total number of rows read from the file is returned.
To fill a TTree with multiple input text files, proceed as indicated above for the first input file and omit the second argument for subsequent calls
Definition at line 6801 of file TTree.cxx.
Referenced by TMVA::Factory::AddBackgroundTree(), TMVA::Factory::AddSignalTree(), and TMVA::DataInputHandler::ReadInputTree().
|
virtual |
Create or simply read branches from an input stream.
See reference information for TTree::ReadFile
Reimplemented in TNtuple, and TNtupleD.
Definition at line 6847 of file TTree.cxx.
Referenced by ReadFile().
|
virtual |
Refresh contents of this tree and its branches from the current status on disk.
One can call this function in case the tree file is being updated by another process.
Reimplemented in TTreeSQL.
Definition at line 7129 of file TTree.cxx.
Referenced by TTreeViewer::DoRefresh().
Remove a friend from the list of friends.
Reimplemented in TChain.
Definition at line 7168 of file TTree.cxx.
Referenced by TChain::LoadTree(), and TChain::RemoveFriend().
Reset baskets, buffers and entries count in all branches and leaves.
Reimplemented in TChain.
Definition at line 7194 of file TTree.cxx.
Referenced by ChangeFile(), CloneTree(), RooTreeDataStore::Reset(), TChain::Reset(), and TProofProgressDialog::ResetProgressDialog().
|
virtual |
Resets the state of this TTree after a merge (keep the customization but forget the data).
Reimplemented in TChain.
Definition at line 7225 of file TTree.cxx.
Referenced by TChain::ResetAfterMerge().
Tell all of our branches to set their addresses to zero.
Note: If any of our branches own any objects, they are deleted.
Reimplemented in TChain, TNtuple, and TNtupleD.
Definition at line 7256 of file TTree.cxx.
Referenced by CopyAddresses(), and TChain::ResetBranchAddress().
|
virtual |
Tell all of our branches to drop their current objects and allocate new ones.
Reimplemented in TChain, TNtuple, and TNtupleD.
Definition at line 7266 of file TTree.cxx.
Referenced by TMVA::DataSetFactory::BuildEventVector(), CopyAddresses(), fillTree(), FillUnBinData(), TMLPAnalyzer::GatherInformations(), Merge(), MergeTrees(), and TChain::ResetBranchAddresses().
|
virtual |
Loop over tree entries and print entries passing selection.
Otherwise a columns selection can be made using "var1:var2:var3". See TTreePlayer::Scan for more information
Reimplemented in TChain.
Definition at line 7285 of file TTree.cxx.
Referenced by TChain::Scan().
|
virtual |
Set a tree variable alias.
Set an alias for an expression/formula based on the tree 'variables'.
The content of 'aliasName' can be used in TTreeFormula (i.e. TTree::Draw, TTree::Scan, TTreeViewer) and will be evaluated as the content of 'aliasFormula'.
If the content of 'aliasFormula' only contains symbol names, periods and array index specification (for example event.fTracks[3]), then the content of 'aliasName' can be used as the start of symbol.
If the alias 'aliasName' already existed, it is replaced by the new value.
When being used, the alias can be preceded by an eventual 'Friend Alias' (see TTree::GetFriendAlias)
Return true if it was added properly.
For example:
This function may be called at the start of a program to change the default value for fAutoFlush.
autof is the number of consecutive entries after which TTree::Fill will flush all branch buffers to disk.
When filling the Tree the branch buffers will be flushed to disk when more than autof bytes have been written to the file. At the first FlushBaskets TTree::Fill will replace fAutoFlush by the current value of fEntries.
Calling this function with autof<0 is interesting when it is hard to estimate the size of one entry. This value is also independent of the Tree.
The Tree is initialized with fAutoFlush=-30000000, ie that, by default, the first AutoFlush will be done when 30 MBytes of data are written to the file.
The AutoFlush mechanism is disabled.
Flushing the buffers at regular intervals optimize the location of consecutive entries on the disk by creating clusters of baskets.
A cluster of baskets is a set of baskets that contains all the data for a (consecutive) set of entries and that is stored consecutively on the disk. When reading all the branches, this is the minimum set of baskets that the TTreeCache will read.
Definition at line 7382 of file TTree.cxx.
Referenced by ImportClusterRanges(), parallelMergeClient(), parallelMergeTest(), TProofPlayer::SavePartialResults(), and treeClient().
This function may be called at the start of a program to change the default value for fAutoSave (and for SetAutoSave) is -300000000, ie 300 MBytes When filling the Tree the branch buffers as well as the Tree header will be flushed to disk when the watermark is reached.
If fAutoSave is positive the watermark is reached when a multiple of fAutoSave entries have been written. If fAutoSave is negative the watermark is reached when -fAutoSave bytes have been written to the file. In case of a program crash, it will be possible to recover the data in the Tree up to the last AutoSave point.
Definition at line 7467 of file TTree.cxx.
Referenced by ImportClusterRanges(), Memstat::TMemStatMng::Init(), TChain::Merge(), and Roo2DKeysPdf::writeNTupleToFile().
Change branch address, dealing with clone trees properly.
See TTree::CheckBranchAddressType for the semantic of the return value.
Note: See the comments in TBranchElement::SetAddress() for the meaning of the addr parameter and the object ownership policy.
Reimplemented in TChain.
Definition at line 7510 of file TTree.cxx.
Referenced by TMVA::ApplicationCreateCombinedTree(), RooAbsString::attachToTree(), RooAbsCategory::attachToTree(), RooAbsReal::attachToTree(), TGeoChecker::CheckBoundaryReference(), CopyAddresses(), TPerfStats::FileEvent(), TPerfStats::FileOpenEvent(), TPerfStats::FileReadEvent(), TProofPerfAnalysis::FillFileDist(), TProofPerfAnalysis::FillFileDistOneSrv(), TProofPerfAnalysis::FillFileInfo(), TProofBenchRunCPU::FillPerfStatPerfPlots(), TProofBenchRunDataRead::FillPerfStatProfiles(), TProofPerfAnalysis::FillWrkInfo(), TProofPerfAnalysis::GetWrkFileList(), h1analysis::Init(), TRecorderReplaying::Initialize(), TRecorderInactive::ListCmd(), TRecorderInactive::ListGui(), mlpHiggs(), TPerfStats::PacketEvent(), TPerfStats::RateEvent(), read(), readSMatrix(), readSMatrixSym(), readTMatrix(), readTMatrixSym(), readTrackD(), readTrackD32(), TMVA::MethodKNN::ReadWeightsFromStream(), SetBranchAddress(), TEveVSD::SetBranchAddresses(), TPerfStats::SimpleEvent(), StockReturn(), TMVAClassificationApplication(), TMVAClassificationCategoryApplication(), TMVAMulticlassApplication(), TMVARegressionApplication(), tv3Read1(), and tv3Read2().
|
virtual |
Verify the validity of the type of addr before calling SetBranchAddress.
See TTree::CheckBranchAddressType for the semantic of the return value.
Note: See the comments in TBranchElement::SetAddress() for the meaning of the addr parameter and the object ownership policy.
Reimplemented in TChain.
|
virtual |
Verify the validity of the type of addr before calling SetBranchAddress.
See TTree::CheckBranchAddressType for the semantic of the return value.
Note: See the comments in TBranchElement::SetAddress() for the meaning of the addr parameter and the object ownership policy.
Reimplemented in TChain.
Change branch address, dealing with clone trees properly.
See TTree::CheckBranchAddressType for the semantic of the return value.
Note: See the comments in TBranchElement::SetAddress() for the meaning of the addr parameter and the object ownership policy.
Definition at line 7567 of file TTree.cxx.
Referenced by SetBranchAddress().
Set branch status to Process or DoNotProcess.
When reading a Tree, by default, all branches are read. One can speed up considerably the analysis phase by activating only the branches that hold variables involved in a query.
bname is the name of a branch.
see TRegexp for wildcarding options
Example:
Assume a tree T with sub-branches a,b,c,d,e,f,g,etc.. when doing T.GetEntry(i) all branches are read for entry i. to read only the branches c and e, one can do
bname is interpreted as a wildcarded TRegexp (see TRegexp::MakeWildcard). Thus, "a*b" or "a.*b" matches branches starting with "a" and ending with "b", but not any other branch with an "a" followed at some point by a "b". For this second behavior, use "*a*b*". Note that TRegExp does not support '|', and so you cannot select, e.g. track and shower branches with "track|shower".
WARNING! WARNING! WARNING!
SetBranchStatus is matching the branch based on match of the branch 'name' and not on the branch hierarchy! In order to be able to selectively enable a top level object that is 'split' you need to make sure the name of the top level branch is prefixed to the sub-branches' name (by adding a dot ('.') at the end of the Branch creation and use the corresponding bname.
I.e If your Tree has been created in split mode with a parent branch "parent." (note the trailing dot).
will not activate the sub-branches of "parent". You should do:
Without the trailing dot in the branch creation you have no choice but to call SetBranchStatus explicitly for each of the sub branches.
An alternative to this function is to read directly and only the interesting branches. Example:
If found is not 0, the number of branch(es) found matching the regular expression is returned in *found AND the error message 'unknown branch' is suppressed.
Reimplemented in TChain.
Definition at line 7656 of file TTree.cxx.
Referenced by TMVA::DataSetFactory::ChangeToNewTree(), TChain::LoadTree(), TChain::SetBranchStatus(), SetBranchStatus(), RooAbsString::setTreeBranchStatus(), RooAbsCategory::setTreeBranchStatus(), and RooAbsReal::setTreeBranchStatus().
interface to TTreeCache to set the cache entry range
Returns:
Definition at line 7929 of file TTree.cxx.
Referenced by SetCacheEntryRange().
Interface to TTreeCache to set the number of entries for the learning phase.
Set maximum size of the file cache .
Returns:
Reimplemented in TChain.
Definition at line 7786 of file TTree.cxx.
Referenced by TEventIterTree::GetTrees(), TTreePlayer::Process(), and TChain::SetCacheSize().
Set the size of the file cache and create it if possible.
If autocache is true: this may be an autocreated cache, possibly enlarging an existing autocreated cache. The size is calculated. The value passed in cacheSize:
If autocache is false: this is a user requested cache. cacheSize is used to size the cache. This cache should never be automatically adjusted.
Returns:
Definition at line 7812 of file TTree.cxx.
Referenced by Fill(), GetClusterIterator(), GetEntry(), GetEntryWithIndex(), GetMaximum(), GetMinimum(), GetReadCache(), and SetCacheSize().
Definition at line 532 of file TTree.h.
Referenced by TChain::LoadTree().
Enable/Disable circularity for this tree.
if maxEntries > 0 a maximum of maxEntries is kept in one buffer/basket per branch in memory. Note that when this function is called (maxEntries>0) the Tree must be empty or having only one basket per branch. if maxEntries <= 0 the tree circularity is disabled.
Circular Trees are interesting in online real time environments to store the results of the last maxEntries events.
Calling SetCircular with maxEntries <= 0 is necessary before merging circular Trees that have been saved on files.
SetCircular with maxEntries <= 0 is automatically called by TChain::Merge
A circular Tree can still be saved in a file. When read back, it is still a circular Tree and can be filled again.
Definition at line 7990 of file TTree.cxx.
Referenced by TChain::Merge().
Set the debug level and the debug range.
For entries in the debug range, the functions TBranchElement::Fill and TBranchElement::GetEntry will print the number of bytes filled or read for each branch.
Reimplemented in TProofChain.
Definition at line 8026 of file TTree.cxx.
Referenced by TProofChain::SetDebug().
|
virtual |
Change the tree's directory.
Remove reference to this tree from current directory and add reference to new directory dir. The dir parameter can be 0 in which case the tree does not belong to any directory.
Reimplemented in TChain.
Definition at line 8064 of file TTree.cxx.
Referenced by ChangeFile(), TMVA::Factory::CreateEventAssignTrees(), RooTreeDataStore::createTree(), DetachRes(), TMLPAnalyzer::GatherInformations(), TSelEventGen::GenerateFiles(), TProfileHelper::LabelsDeflate(), TProfileHelper::LabelsInflate(), RooTreeDataStore::loadValues(), TMVA::DataInputHandler::ReadInputTree(), TProofBenchRunCPU::Run(), TProofBenchRunDataRead::Run(), TProofPlayer::SavePartialResults(), TPerfStats::TPerfStats(), and TMVA::MethodKNN::WriteWeightsToStream().
Change number of entries in the tree.
If n >= 0, set number of entries in the tree = n.
If n < 0, set number of entries in the tree to match the number of entries in each branch. (default for n is -1)
This function should be called only when one fills each branch independently via TBranch::Fill without calling TTree::Fill. Calling TTree::SetEntries() make sense only if the number of entries in each branch is identical, a warning is issued otherwise. The function returns the number of entries.
Reimplemented in THbookTree.
Definition at line 8109 of file TTree.cxx.
Referenced by CopyEntries(), and TTreeCloner::ImportClusterRanges().
|
virtual |
Set an EntryList.
Reimplemented in TChain.
Definition at line 8141 of file TTree.cxx.
Referenced by TParallelCoord::AddVariable(), TParallelCoord::ApplySelectionToTree(), TSelectorDraw::Begin(), TTreePlayer::DrawSelect(), TParallelCoord::GetTree(), h1analysisTreeReader::Notify(), h1analysis::Notify(), TParallelCoord::ResetTree(), TTreeTableInterface::SetEntryList(), and TTreeTableInterface::~TTreeTableInterface().
Set number of entries to estimate variable limits.
If n is -1, the estimate is set to be the current maximum for the tree (i.e. GetEntries() + 1) If n is less than -1, the behavior is undefined.
Definition at line 8205 of file TTree.cxx.
Referenced by TSelectorDraw::Begin(), TTreePlayer::DrawSelect(), FillUnBinData(), memstatExample(), and TMemStatShow::Show().
|
virtual |
This function transfroms the given TEventList into a TEntryList The new TEntryList is owned by the TTree and gets deleted when the tree is deleted.
This TEntryList can be returned by GetEntryList() function.
Reimplemented in TChain, and TProofChain.
Definition at line 8164 of file TTree.cxx.
Referenced by TMLPAnalyzer::DrawNetwork(), TTreeViewer::ExecuteDraw(), and TTreeViewer::ExecuteSpider().
Set fFileNumber to number.
fFileNumber is used by TTree::Fill to set the file name for a new file to be created when the current file exceeds fgTreeMaxSize. (see TTree::ChangeFile) if fFileNumber=10, the new file name will have a suffix "_11", ie, fFileNumber is incremented before setting the file name
Set all the branches in this TTree to be in decomposed object mode (also known as MakeClass mode).
Reimplemented in TChain.
Definition at line 8241 of file TTree.cxx.
Referenced by CloneTree(), TChain::LoadTree(), Merge(), and TChain::SetMakeClass().
|
inlinevirtual |
Set the maximum size in bytes of a Tree file (static function).
The default size is 100000000000LL, ie 100 Gigabytes.
In TTree::Fill, when the file has a size > fgMaxTreeSize, the function closes the current file and starts writing into a new file with a name of the style "file_1.root" if the original requested file name was "file.root".
Definition at line 545 of file TTree.h.
Referenced by LoadBaskets(), and TChain::LoadTree().
|
virtual |
Change the name of this tree.
Reimplemented from TNamed.
Reimplemented in TProofChain.
Definition at line 8269 of file TTree.cxx.
Referenced by TMVA::DataInputHandler::AddBackgroundTree(), TMVA::DataInputHandler::AddSignalTree(), TMVA::DataInputHandler::AddTree(), TChain::Merge(), TProofBenchRunCPU::Run(), TProofBenchRunDataRead::Run(), and TProofChain::SetName().
Definition at line 547 of file TTree.h.
Referenced by TTreePlayer::DrawScript(), TTreePlayer::GetEntries(), and TTreePlayer::Process().
|
virtual |
|
virtual |
Set perf stats.
Definition at line 8343 of file TTree.cxx.
Referenced by TTreePerfStats::TTreePerfStats().
Definition at line 551 of file TTree.h.
Referenced by TTreePlayer::Scan(), TSpider::SetNx(), TSpider::SetNy(), and TSpider::TSpider().
Definition at line 552 of file TTree.h.
Referenced by TTreeViewer::ExecuteDraw().
|
virtual |
The current TreeIndex is replaced by the new index.
Note that this function does not delete the previous index. This gives the possibility to play with more than one index, e.g.,
Definition at line 8360 of file TTree.cxx.
Referenced by TChainIndex::DeleteIndices(), TChainIndex::GetSubTreeIndex(), TChainIndex::ReleaseSubTreeIndex(), TChainIndex::TChainIndex(), TChainIndex::~TChainIndex(), and TTreeIndex::~TTreeIndex().
Set tree weight.
The weight is used by TTree::Draw to automatically weight each selected entry in the resulting histogram.
For example the equivalent of:
is:
This function is redefined by TChain::SetWeight. In case of a TChain, an option "global" may be specified to set the same weight for all trees in the TChain instead of the default behaviour using the weights of each tree in the chain (see TChain::SetWeight).
Reimplemented in TChain.
Print values of all active leaves for entry.
Definition at line 8399 of file TTree.cxx.
Referenced by create_3Bumps(), create_array_with_different_lengths(), create_circ(), create_lin(), create_lin_Nvar(), create_lin_Nvar_2(), create_lin_Nvar_Arr(), create_lin_Nvar_categories(), create_lin_Nvar_discrete(), create_lin_Nvar_double(), create_lin_Nvar_weighted(), create_lin_Nvar_withFriend(), create_lin_NvarObsolete(), create_ManyVars(), create_schachbrett(), create_schachbrett_2D(), create_schachbrett_3D(), create_schachbrett_4D(), create_schachbrett_5D(), TFileDrawMap::DumpObject(), makeTree_circ(), and makeTree_lin_Nvar().
|
virtual |
Start the TTreeViewer on this tree.
Definition at line 8473 of file TTree.cxx.
Referenced by ClassImp().
|
virtual |
Stop the cache learning phase.
Returns:
Definition at line 8488 of file TTree.cxx.
Referenced by StopCacheLearningPhase().
|
virtual |
Unbinned fit of one or more variable(s) from a tree.
funcname is a TF1 function.
See TTree::Draw for explanations of the other parameters.
Fit the variable varexp using the function funcname using the selection cuts given by selection.
The list of fit options is given in parameter option.
You can specify boundary limits for some or all parameters via
if parmin>=parmax, the parameter is fixed
Note that you are not forced to fix the limits for all parameters. For example, if you fit a function with 6 parameters, you can do:
With this setup:
For the fit to be meaningful, the function must be self-normalized.
i.e. It must have the same integral regardless of the parameter settings. Otherwise the fit will effectively just maximize the area.
It is mandatory to have a normalization variable which is fixed for the fit. e.g.
1, 2 and 3 Dimensional fits are supported. See also TTree::Fit
Return status:
Definition at line 8731 of file TTree.cxx.
Referenced by FitUsingTTreeFit().
|
virtual |
Write this object to the current directory.
For more see TObject::Write If option & kFlushBasket, call FlushBasket before writing the tree.
Reimplemented from TObject.
Definition at line 8780 of file TTree.cxx.
Referenced by ChangeFile(), TGeoChecker::CheckBoundaryErrors(), create_3Bumps(), create_array_with_different_lengths(), create_circ(), create_lin(), create_lin_Nvar(), create_lin_Nvar_2(), create_lin_Nvar_Arr(), create_lin_Nvar_categories(), create_lin_Nvar_discrete(), create_lin_Nvar_double(), create_lin_Nvar_weighted(), create_lin_Nvar_withFriend(), create_lin_NvarObsolete(), create_ManyVars(), create_MultipleBackground(), create_schachbrett(), create_schachbrett_2D(), create_schachbrett_3D(), create_schachbrett_4D(), create_schachbrett_5D(), TSelEventGen::GenerateFiles(), TMVA::RuleFit::MakeDebugHists(), TChain::Merge(), Merge(), TProofBenchRunCPU::Run(), TProofBenchRunDataRead::Run(), TParallelCoord::SaveTree(), and tv3Write().
Write this object to the current directory.
For more see TObject::Write Write calls TTree::FlushBaskets before writing the tree.
Reimplemented from TObject.
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
protected |
Definition at line 136 of file TTree.h.
Referenced by GetAlias(), GetListOfAliases(), RecursiveRemove(), SetAlias(), and ~TTree().
|
protected |
Definition at line 117 of file TTree.h.
Referenced by Fill(), GetAutoFlush(), GetCacheAutoSize(), ImportClusterRanges(), Print(), SetAutoFlush(), and TTree::TClusterIterator::TClusterIterator().
|
protected |
Definition at line 116 of file TTree.h.
Referenced by Fill(), GetAutoSave(), Merge(), Refresh(), and SetAutoSave().
|
protected |
Pointer to directory holding this tree.
Definition at line 134 of file TTree.h.
Referenced by TTreeSQL::Branch(), Branch(), BranchOld(), BronchExec(), Browse(), TNtuple::CloneTree(), TTreeSQL::CreateTable(), DropBaskets(), TTreeSQL::Fill(), Fill(), GetBranch(), GetEntry(), GetEntryWithIndex(), GetListOfBranches(), GetNbranches(), KeepCircular(), ReadStream(), Reset(), ResetAfterMerge(), TNtupleD::ResetBranchAddress(), TNtuple::ResetBranchAddress(), TNtupleD::ResetBranchAddresses(), TNtuple::ResetBranchAddresses(), SetCircular(), SetMakeClass(), TTree(), and ~TTree().
|
protected |
List of cloned trees which share our addresses.
Definition at line 147 of file TTree.h.
Referenced by BranchRef(), DirectoryAutoAdd(), Fill(), GetBranchRef(), Print(), Reset(), ResetAfterMerge(), SetDefaultEntryOffsetLen(), SetDirectory(), and ~TTree().
|
protected |
Pointer to the current transient buffer.
Definition at line 150 of file TTree.h.
Referenced by Fill(), GetClusterIterator(), GetEntry(), GetEntryWithIndex(), GetMaximum(), GetMinimum(), GetReadCache(), and SetCacheSizeAux().
|
protected |
Definition at line 121 of file TTree.h.
Referenced by TChain::GetCacheSize(), GetCacheSize(), TChain::LoadTree(), TChain::SetCacheSize(), and SetCacheSizeAux().
|
protected |
true if cache auto creation or resize check is needed
Definition at line 151 of file TTree.h.
Referenced by TChain::LoadTree(), TChain::SetCacheSize(), SetCacheSize(), and SetCacheSizeAux().
|
protected |
Maximum size of file buffers.
Definition at line 122 of file TTree.h.
Referenced by GetChainOffset(), Reset(), ResetAfterMerge(), and SetChainOffset().
|
protected |
Pointer to current Tree player.
Definition at line 146 of file TTree.h.
Referenced by AddClone(), GetListOfClones(), TChain::LoadTree(), TChain::SetBranchAddress(), SetBranchAddressImp(), and ~TTree().
|
protected |
Definition at line 119 of file TTree.h.
Referenced by Fill(), ImportClusterRanges(), KeepCircular(), Print(), SetAutoFlush(), TTree::TClusterIterator::TClusterIterator(), and ~TTree().
|
protected |
Definition at line 120 of file TTree.h.
Referenced by ImportClusterRanges(), Print(), SetAutoFlush(), TTree::TClusterIterator::TClusterIterator(), and ~TTree().
|
protected |
Local for EntryLoop.
Definition at line 127 of file TTree.h.
Referenced by TProofChain::Debug(), Debug(), and SetDebug().
|
protected |
First entry number to debug.
Definition at line 129 of file TTree.h.
Referenced by GetDebugMax(), and SetDebug().
|
protected |
|
protected |
Definition at line 110 of file TTree.h.
Referenced by GetDefaultEntryOffsetLen(), and SetDefaultEntryOffsetLen().
|
protected |
Object to be notified when loading a Tree.
Definition at line 133 of file TTree.h.
Referenced by AutoSave(), BuildStreamerInfo(), Delete(), DirectoryAutoAdd(), Fill(), FlushBaskets(), GetCurrentFile(), GetDirectory(), TChain::LoadTree(), Print(), TChain::RecursiveRemove(), Refresh(), TChain::Reset(), SetCircular(), TChain::SetDirectory(), SetDirectory(), SetName(), SetObject(), TChain::TChain(), TProofChain::TProofChain(), TTree(), TChain::~TChain(), TProofChain::~TProofChain(), and ~TTree().
|
protected |
Definition at line 101 of file TTree.h.
Referenced by TChain::Add(), TChain::AddFile(), AddFriend(), CloneTree(), TTreeSQL::CreateBranches(), TTreeSQL::Fill(), Fill(), GetCacheAutoSize(), TTreeSQL::GetEntries(), TChain::GetEntries(), GetEntries(), TTreeSQL::GetEntriesFast(), GetEntriesFast(), GetEntriesFriend(), GetEntry(), GetMaximum(), GetMinimum(), ImportClusterRanges(), KeepCircular(), TChain::LoadTree(), LoadTree(), TChain::Loop(), TTreeSQL::PrepEntry(), Print(), Refresh(), Reset(), ResetAfterMerge(), SetAutoFlush(), THbookTree::SetEntries(), SetEntries(), and SetEstimate().
|
protected |
Pointer to event selection list (if one)
Definition at line 138 of file TTree.h.
Referenced by TProofChain::Draw(), TChain::Draw(), GetEntryList(), TChain::GetEntryNumber(), GetEntryNumber(), TProofChain::Process(), TChain::Process(), RecursiveRemove(), TProofChain::SetEntryList(), TChain::SetEntryList(), SetEntryList(), TChain::SetEntryListFile(), TChain::SetEventList(), SetEventList(), and ~TTree().
|
protected |
Definition at line 118 of file TTree.h.
Referenced by GetEstimate(), and SetEstimate().
|
protected |
Definition at line 137 of file TTree.h.
Referenced by TProofChain::Draw(), TChain::Draw(), GetEventList(), TProofChain::Process(), TChain::Process(), RecursiveRemove(), TChain::SetEntryList(), SetEntryList(), TChain::SetEntryListFile(), TProofChain::SetEventList(), TChain::SetEventList(), and SetEventList().
|
protected |
not zero when processing code generated by MakeClass
Definition at line 131 of file TTree.h.
Referenced by ChangeFile(), GetFileNumber(), and SetFileNumber().
|
protected |
Definition at line 105 of file TTree.h.
Referenced by Fill(), Reset(), ResetAfterMerge(), and SetAutoFlush().
|
protected |
Definition at line 148 of file TTree.h.
Referenced by FindBranch(), FindLeaf(), GetAlias(), GetBranch(), GetEntry(), GetEntryWithIndex(), GetFriend(), GetFriendAlias(), GetLeaf(), TChain::LoadTree(), LoadTree(), Print(), RemoveFriend(), SetBranchStatus(), and TTree::TFriendLock::TFriendLock().
|
protected |
Definition at line 142 of file TTree.h.
Referenced by TChain::AddFriend(), AddFriend(), FindBranch(), FindLeaf(), GetAlias(), GetBranch(), GetEntriesFriend(), GetEntry(), GetEntryWithIndex(), GetFriend(), GetFriendAlias(), GetLeafImpl(), GetListOfFriends(), TChain::LoadTree(), LoadTree(), Print(), RecursiveRemove(), TChain::RemoveFriend(), RemoveFriend(), SetBranchStatus(), and ~TTree().
|
staticprotected |
true if the cache setting was explicitly given by user
Definition at line 153 of file TTree.h.
Referenced by Branch(), BranchOld(), GetBranchStyle(), and SetBranchStyle().
|
staticprotected |
Definition at line 154 of file TTree.h.
Referenced by Fill(), GetMaxTreeSize(), and SetMaxTreeSize().
|
protected |
Definition at line 140 of file TTree.h.
Referenced by GetIndex().
|
protected |
Pointer to event selection list (if one)
Definition at line 139 of file TTree.h.
Referenced by GetIndexValues().
|
protected |
Definition at line 135 of file TTree.h.
Referenced by TNtuple::Browse(), TNtupleD::Browse(), DropBuffers(), GetListOfLeaves(), Refresh(), SetBasketSize(), SetBranchStatus(), and ~TTree().
|
protected |
Last entry number to debug.
Definition at line 130 of file TTree.h.
Referenced by CloneTree(), TProofChain::GetMakeClass(), GetMakeClass(), TChain::LoadTree(), Merge(), and SetMakeClass().
|
protected |
Definition at line 112 of file TTree.h.
Referenced by ImportClusterRanges(), and SetAutoFlush().
|
protected |
Memory allocated for the cluster range.
Definition at line 113 of file TTree.h.
Referenced by Fill(), KeepCircular(), SetCircular(), and TTree().
|
protected |
Definition at line 114 of file TTree.h.
Referenced by GetMaxEntryLoop(), SetMaxEntryLoop(), and TTree().
|
protected |
Definition at line 115 of file TTree.h.
Referenced by DropBuffers(), GetMaxVirtualSize(), TChain::LoadTree(), MemoryFull(), and SetMaxVirtualSize().
|
protected |
Definition at line 111 of file TTree.h.
Referenced by Fill(), ImportClusterRanges(), KeepCircular(), Print(), Refresh(), Reset(), ResetAfterMerge(), SetAutoFlush(), and TTree::TClusterIterator::TClusterIterator().
|
protected |
|
protected |
current file number (if file extensions)
Definition at line 132 of file TTree.h.
Referenced by GetNotify(), TChain::LoadTree(), LoadTree(), Reset(), and SetNotify().
|
protected |
Total number of bytes in branch buffers.
Definition at line 125 of file TTree.h.
Referenced by GetPacketSize(), and TChain::SetPacketSize().
|
protected |
Definition at line 143 of file TTree.h.
Referenced by GetPerfStats(), and SetPerfStats().
|
protected |
Definition at line 145 of file TTree.h.
Referenced by CopyTree(), Draw(), Fit(), GetEntries(), GetPlayer(), TChain::LoadTree(), LoadTree(), MakeClass(), MakeCode(), MakeProxy(), MakeSelector(), Principal(), Process(), Query(), RecursiveRemove(), Scan(), SetEstimate(), StartViewer(), UnbinnedFit(), and ~TTree().
|
protected |
Offset of 1st entry of this Tree in a TChain.
Definition at line 123 of file TTree.h.
Referenced by TProofChain::Draw(), THbookTree::GetEntry(), GetEntry(), GetEntryWithIndex(), TProofChain::GetReadEntry(), GetReadEntry(), GetReadEvent(), KeepCircular(), TTreeSQL::LoadTree(), TChain::LoadTree(), LoadTree(), TTreeSQL::PrepEntry(), TProofChain::Progress(), Reset(), ResetAfterMerge(), and Show().
|
protected |
Definition at line 104 of file TTree.h.
Referenced by AutoSave(), Fill(), Refresh(), Reset(), and ResetAfterMerge().
|
protected |
Definition at line 108 of file TTree.h.
Referenced by GetScanField(), and SetScanField().
|
protected |
Definition at line 107 of file TTree.h.
Referenced by GetTimerInterval(), and SetTimerInterval().
|
protected |
Number of the entry being processed.
Definition at line 124 of file TTree.h.
Referenced by DropBuffers(), IncrementTotalBuffers(), MemoryFull(), Refresh(), Reset(), and ResetAfterMerge().
|
protected |
Definition at line 102 of file TTree.h.
Referenced by AddTotBytes(), AutoSave(), Fill(), GetTotBytes(), Print(), Refresh(), Reset(), and ResetAfterMerge().
|
protected |
Record which method is locking the friend recursion.
Definition at line 149 of file TTree.h.
Referenced by GetTransientBuffer(), and ~TTree().
|
protected |
Definition at line 141 of file TTree.h.
Referenced by BuildIndex(), GetEntryNumberWithBestIndex(), GetEntryNumberWithIndex(), GetTreeIndex(), LoadTreeFriend(), RecursiveRemove(), Reset(), ResetAfterMerge(), SetTreeIndex(), and ~TTree().
|
protected |
Definition at line 109 of file TTree.h.
Referenced by GetUpdate(), and SetUpdate().
|
protected |
pointer to the current perf stats object
Definition at line 144 of file TTree.h.
Referenced by Browse(), GetUserInfo(), RecursiveRemove(), and ~TTree().
|
protected |
Definition at line 106 of file TTree.h.
Referenced by TChain::GetWeight(), GetWeight(), TChain::SetWeight(), and SetWeight().
|
protected |
Definition at line 103 of file TTree.h.
Referenced by AddZipBytes(), AutoSave(), Fill(), GetCacheAutoSize(), GetZipBytes(), Print(), Refresh(), Reset(), and ResetAfterMerge().
|
static |
Definition at line 221 of file TTree.h.
Referenced by TChain::Add(), TChain::AddFile(), TProofChain::Draw(), TChain::Draw(), Draw(), TEntryListFromFile::GetEntries(), TChain::GetEntries(), TEntryListFromFile::GetEntry(), TChain::GetEntryNumber(), TChain::LoadTree(), TChainElement::ls(), TChain::SetEventList(), TDSet::TDSet(), and TEntryListFromFile::TEntryListFromFile().