Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TTree.h
Go to the documentation of this file.
1// @(#)root/tree:$Id$
2// Author: Rene Brun 12/01/96
3
4/*************************************************************************
5 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12#ifndef ROOT_TTree
13#define ROOT_TTree
14
15//////////////////////////////////////////////////////////////////////////
16// //
17// TTree //
18// //
19// A TTree object is a list of TBranch. //
20// To Create a TTree object one must: //
21// - Create the TTree header via the TTree constructor //
22// - Call the TBranch constructor for every branch. //
23// //
24// To Fill this object, use member function Fill with no parameters. //
25// The Fill function loops on all defined TBranch. //
26// //
27//////////////////////////////////////////////////////////////////////////
28
29#include "Compression.h"
30#include "ROOT/TIOFeatures.hxx"
31#include "TArrayD.h"
32#include "TArrayI.h"
33#include "TAttFill.h"
34#include "TAttLine.h"
35#include "TAttMarker.h"
36#include "TClass.h"
37#include "TDataType.h"
38#include "TDirectory.h"
39#include "TObjArray.h"
40#include "TVirtualTreePlayer.h"
41
42#ifdef R__LESS_INCLUDES
43class TBranch;
44class TList;
45#else
46#include "TBranch.h"
47// #include "TBuffer.h"
48#include "TList.h"
49#endif
50
51#include <array>
52#include <atomic>
53#include <vector>
54#include <utility>
55
56class TBuffer;
57class TBrowser;
58class TFile;
59class TLeaf;
60class TH1;
61class TTreeFormula;
62class TPolyMarker;
63class TEventList;
64class TEntryList;
65class TSQLResult;
66class TSelector;
67class TPrincipal;
68class TFriendElement;
69class TCut;
70class TVirtualIndex;
71class TBranchRef;
72class TBasket;
73class TStreamerInfo;
74class TTree;
75class TTreeCache;
76class TTreeCloner;
77class TFileMergeInfo;
79
82
84 Int_t bufsize = 32000, Int_t splitlevel = 99);
85TBranch *CallBranchImp(TTree &tree, const char *branchname, TClass *ptrClass, void *addobj, Int_t bufsize = 32000,
86 Int_t splitlevel = 99);
87}
88
89class TTree : public TNamed, public TAttLine, public TAttFill, public TAttMarker {
90
92
93protected:
94 Long64_t fEntries; ///< Number of entries
95// NOTE: cannot use std::atomic for these counters as it cannot be serialized.
96 Long64_t fTotBytes; ///< Total number of bytes in all branches before compression
97 Long64_t fZipBytes; ///< Total number of bytes in all branches after compression
98 Long64_t fSavedBytes; ///< Number of autosaved bytes
99 Long64_t fFlushedBytes; ///< Number of auto-flushed bytes
100 Double_t fWeight; ///< Tree weight (see TTree::SetWeight)
101 Int_t fTimerInterval; ///< Timer interval in milliseconds
102 Int_t fScanField; ///< Number of runs before prompting in Scan
103 Int_t fUpdate; ///< Update frequency for EntryLoop
104 Int_t fDefaultEntryOffsetLen; ///< Initial Length of fEntryOffset table in the basket buffers
105 Int_t fNClusterRange; ///< Number of Cluster range in addition to the one defined by 'AutoFlush'
106 Int_t fMaxClusterRange; ///<! Memory allocated for the cluster range.
107 Long64_t fMaxEntries; ///< Maximum number of entries in case of circular buffers
108 Long64_t fMaxEntryLoop; ///< Maximum number of entries to process
109 Long64_t fMaxVirtualSize; ///< Maximum total size of buffers kept in memory
110 Long64_t fAutoSave; ///< Autosave tree when fAutoSave entries written or -fAutoSave (compressed) bytes produced
111 Long64_t fAutoFlush; ///< Auto-flush tree when fAutoFlush entries written or -fAutoFlush (compressed) bytes produced
112 Long64_t fEstimate; ///< Number of entries to estimate histogram limits
113 Long64_t *fClusterRangeEnd; ///<[fNClusterRange] Last entry of a cluster range.
114 Long64_t *fClusterSize; ///<[fNClusterRange] Number of entries in each cluster for a given range.
115 Long64_t fCacheSize; ///<! Maximum size of file buffers
116 Long64_t fChainOffset; ///<! Offset of 1st entry of this Tree in a TChain
117 Long64_t fReadEntry; ///<! Number of the entry being processed
118 std::atomic<Long64_t> fTotalBuffers; ///<! Total number of bytes in branch buffers
119 Int_t fPacketSize; ///<! Number of entries in one packet for parallel root
120 Int_t fNfill; ///<! Local for EntryLoop
121 Int_t fDebug; ///<! Debug level
122 Long64_t fDebugMin; ///<! First entry number to debug
123 Long64_t fDebugMax; ///<! Last entry number to debug
124 TIOFeatures fIOFeatures{0}; ///< IO features to define for newly-written baskets and branches.
125 Int_t fMakeClass; ///<! not zero when processing code generated by MakeClass
126 Int_t fFileNumber; ///<! current file number (if file extensions)
127 /// Object to be notified when loading a Tree.
128 /// TTree::LoadTree() and TChain::LoadTree() will call fNotify->Notify().
129 /// Usually points to a TNotifyLink if this is a TChain.
131 TDirectory *fDirectory; ///<! Pointer to directory holding this tree
132 TObjArray fBranches; ///< List of Branches
133 TObjArray fLeaves; ///< Direct pointers to individual branch leaves
134 TList *fAliases; ///< List of aliases for expressions based on the tree branches.
135 TEventList *fEventList; ///<! Pointer to event selection list (if one)
136 TEntryList *fEntryList; ///<! Pointer to event selection list (if one)
137 TArrayD fIndexValues; ///< Sorted index values
138 TArrayI fIndex; ///< Index of sorted values
139 TVirtualIndex *fTreeIndex; ///< Pointer to the tree Index (if any)
140 TList *fFriends; ///< pointer to list of friend elements
141 TList *fExternalFriends; ///<! List of TFriendsElement pointing to us and need to be notified of LoadTree. Content not owned.
142 TVirtualPerfStats *fPerfStats; ///<! pointer to the current perf stats object
143 TList *fUserInfo; ///< pointer to a list of user objects associated to this Tree
144 TVirtualTreePlayer *fPlayer; ///<! Pointer to current Tree player
145 TList *fClones; ///<! List of cloned trees which share our addresses
146 TBranchRef *fBranchRef; ///< Branch supporting the TRefTable (if any)
147 UInt_t fFriendLockStatus; ///<! Record which method is locking the friend recursion
148 TBuffer *fTransientBuffer; ///<! Pointer to the current transient buffer.
149 bool fCacheDoAutoInit; ///<! true if cache auto creation or resize check is needed
150 bool fCacheDoClusterPrefetch;///<! true if cache is prefetching whole clusters
151 bool fCacheUserSet; ///<! true if the cache setting was explicitly given by user
152 bool fIMTEnabled; ///<! true if implicit multi-threading is enabled for this tree
153 UInt_t fNEntriesSinceSorting; ///<! Number of entries processed since the last re-sorting of branches
154 std::vector<std::pair<Long64_t,TBranch*>> fSortedBranches; ///<! Branches to be processed in parallel when IMT is on, sorted by average task time
155 std::vector<TBranch*> fSeqBranches; ///<! Branches to be processed sequentially when IMT is on
156 Float_t fTargetMemoryRatio{1.1f}; ///<! Ratio for memory usage in uncompressed buffers versus actual occupancy. 1.0
157 /// indicates basket should be resized to exact memory usage, but causes significant
158/// memory churn.
159#ifdef R__TRACK_BASKET_ALLOC_TIME
160 mutable std::atomic<ULong64_t> fAllocationTime{0}; ///<! Time spent reallocating basket memory buffers, in microseconds.
161#endif
162 mutable std::atomic<UInt_t> fAllocationCount{0}; ///<! Number of reallocations basket memory buffers.
163
164 static Int_t fgBranchStyle; ///< Old/New branch style
165 static Long64_t fgMaxTreeSize; ///< Maximum size of a file containing a Tree
166
167private:
168 // For simplicity, although fIMTFlush is always disabled in non-IMT builds, we don't #ifdef it out.
169 mutable bool fIMTFlush{false}; ///<! True if we are doing a multithreaded flush.
170 mutable std::atomic<Long64_t> fIMTTotBytes; ///<! Total bytes for the IMT flush baskets
171 mutable std::atomic<Long64_t> fIMTZipBytes; ///<! Zip bytes for the IMT flush baskets.
172
173 std::unordered_map<std::string, TBranch *>
174 fNamesToBranches; ///<! maps names to their branches, useful when retrieving branches by name
175
177 void SortBranchesByTime();
178 Int_t FlushBasketsImpl() const;
179 void MarkEventCluster();
181
182 void RegisterBranchFullName(std::pair<std::string, TBranch *> &&kv) { fNamesToBranches.insert(kv); }
184
185 Int_t
186 SetBranchAddressImp(const char *bname, void *add, TBranch **ptr, TClass *realClass, EDataType datatype, bool isptr);
187
188protected:
194 virtual void KeepCircular();
195 virtual TBranch *BranchImp(const char* branchname, const char* classname, TClass* ptrClass, void* addobj, Int_t bufsize, Int_t splitlevel);
197 virtual TBranch *BranchImpRef(const char* branchname, const char* classname, TClass* ptrClass, void* addobj, Int_t bufsize, Int_t splitlevel);
199 virtual TBranch *BranchImpArr(const char* branchname, EDataType datatype, std::size_t N, void* addobj, Int_t bufsize, Int_t splitlevel);
201 virtual TBranch *BronchExec(const char* name, const char* classname, void* addobj, bool isptrptr, Int_t bufsize, Int_t splitlevel);
204 virtual TLeaf *GetLeafImpl(const char* branchname, const char* leafname);
205
207 char GetNewlineValue(std::istream &inputStream);
209 void MoveReadCache(TFile *src, TDirectory *dir);
210 Int_t SetCacheSizeAux(bool autocache = true, Long64_t cacheSize = 0);
211
212 TBranch *GetBranchFromSelf(const char *branchName);
213 TBranch *GetBranchFromFriends(const char *branchName);
214 // This overload is used when setting the branch address of friends of this tree. When registering the branches
215 // to be found later, we can't know a priori which friend will have branch 'bname'. TTree and TChain have different
216 // ways to deal with the fact that we should not print spurious error messages that a branch cannot be found
217 // if it is not in one particular friend but in another
218 virtual Int_t SetBranchAddress(const char *bname, void *add, TBranch **ptr, TClass *realClass, EDataType datatype,
220
222 // Helper class to prevent infinite recursion in the
223 // usage of TTree Friends. Implemented in TTree.cxx.
224 TTree *fTree; // Pointer to the locked tree
225 UInt_t fMethodBit; // BIT for the locked method
226 bool fPrevious; // Previous value of the BIT.
227
228 protected:
229 TFriendLock(const TFriendLock&);
231
232 public:
234 ~TFriendLock();
235 };
236 friend class TFriendLock;
237 // So that the index class can use TFriendLock:
238 friend class TTreeIndex;
239 friend class TChainIndex;
240 // So that the TTreeCloner can access the protected interfaces
241 friend class TTreeCloner;
242
243 // use to update fFriendLockStatus
255// clang++ <v20 (-Wshadow) complains about shadowing TError.h global variable kPrint. Let's silence warning:
256#if defined(__clang__) && __clang_major__ < 20
257#pragma clang diagnostic push
258#pragma clang diagnostic ignored "-Wshadow"
259#endif
260 kPrint = BIT(10),
261#if defined(__clang__) && __clang_major__ < 20
262#pragma clang diagnostic pop
263#endif
267 };
268
269public:
270 /// Used as the max value for any TTree range operation.
271 /// The maximum number of entries allowed in a TTree is strictly smaller than this value
272 /// (`maxTreeEntries<= kMaxEntries-1`), ie the last entry index is at maximum `kMaxEntries-2`.
274
275 // SetBranchAddress return values
292
293 // TTree status bits
297 /// If set, the branch's buffers will grow until an event cluster boundary is hit,
298 /// guaranteeing a basket per cluster. This mode does not provide any guarantee on the
299 /// memory bounds in the case of extremely large events.
301 /// If set, signals that this TTree is the output of the processing of another TTree, and
302 /// the entries are reshuffled w.r.t. to the original TTree. As a safety measure, a TTree
303 /// with this bit set cannot add friends nor can be added as a friend. If you know what
304 /// you are doing, you can manually unset this bit with `ResetBit(EStatusBits::kEntriesReshuffled)`.
305 kEntriesReshuffled = BIT(19) // bits 15-18 are used by TChain
306 };
307
308 // Split level modifier
309 enum {
311 };
312
314 {
315 private:
316 TTree *fTree; // TTree upon which we are iterating.
317 Int_t fClusterRange; // Which cluster range are we looking at.
318 Long64_t fStartEntry; // Where does the cluster start.
319 Long64_t fNextEntry; // Where does the cluster end (exclusive).
320 Long64_t fEstimatedSize; // If positive, the calculated estimated tree size.
321
323
324 protected:
325 friend class TTree;
327
328 public:
329 // Intentionally used the default copy constructor and default destructor
330 // as the TClusterIterator does not own the TTree.
331 // TClusterIterator(const TClusterIterator&);
332 // ~TClusterIterator();
333
334 // No public constructors, the iterator must be
335 // created via TTree::GetClusterIterator
336
337 // Move on to the next cluster and return the starting entry
338 // of this next cluster
339 Long64_t Next();
340
341 // Move on to the previous cluster and return the starting entry
342 // of this previous cluster
344
345 // Return the start entry of the current cluster.
347 return fStartEntry;
348 }
349
350 // Return the first entry of the next cluster.
352 return fNextEntry;
353 }
354
355 Long64_t operator()() { return Next(); }
356 };
357
358 TTree();
359 TTree(const char* name, const char* title, Int_t splitlevel = 99, TDirectory* dir = gDirectory);
360 ~TTree() override;
361
362 TTree(const TTree& tt) = delete;
363 TTree& operator=(const TTree& tt) = delete;
364
365 virtual Int_t AddBranchToCache(const char *bname, bool subbranches = false);
366 virtual Int_t AddBranchToCache(TBranch *branch, bool subbranches = false);
367 virtual Int_t DropBranchFromCache(const char *bname, bool subbranches = false);
368 virtual Int_t DropBranchFromCache(TBranch *branch, bool subbranches = false);
369 void AddClone(TTree*);
370 virtual TFriendElement *AddFriend(const char* treename, const char* filename = "");
371 virtual TFriendElement *AddFriend(const char* treename, TFile* file);
372 virtual TFriendElement *AddFriend(TTree* tree, const char* alias = "", bool warn = false);
373 // As the TBasket invokes Add{Tot,Zip}Bytes on its parent tree, we must do these updates in a thread-safe
374 // manner only when we are flushing multiple baskets in parallel.
375 virtual void AddTotBytes(Int_t tot) { if (fIMTFlush) { fIMTTotBytes += tot; } else { fTotBytes += tot; } }
376 virtual void AddZipBytes(Int_t zip) { if (fIMTFlush) { fIMTZipBytes += zip; } else { fZipBytes += zip; } }
377// NOTE: these counters aren't thread safe like the ones above.
378#ifdef R__TRACK_BASKET_ALLOC_TIME
379 void AddAllocationTime(ULong64_t time) { fAllocationTime += time; }
380#endif
382 virtual Long64_t AutoSave(Option_t* option = "");
383
384 /// Add a new branch, and infer the data type from the type of `obj` being passed.
385 ///
386 /// \note This and the next overload should cover most cases for creating a branch. Try to use these two whenever
387 /// possible, unless e.g. type conversions are needed.
388 ///
389 /// \param[in] name Name of the branch to be created.
390 /// \param[in] obj Address of the object to be added. Make sure to pass a pointer to the actual type/class that
391 /// should be stored in the tree (no pointers to base classes). When calling Fill(), the current value of the type/object will be saved.
392 /// \param[in] bufsize The buffer size in bytes for this branch. When the buffer is full, it is compressed and written to disc.
393 /// The default value of 32000 bytes and should be ok for most simple types. Larger buffers (e.g. 256000) if your Tree is not split and each entry is large (Megabytes).
394 /// A small value for bufsize is beneficial if entries in the Tree are accessed randomly and the Tree is in split mode.
395 /// \param[in] splitlevel If T is a class or struct and splitlevel > 0, the members of the object are serialised as separate branches.
396 /// \return Pointer to the TBranch that was created. The branch is owned by the tree.
397 template <class T> TBranch *Branch(const char* name, T* obj, Int_t bufsize = 32000, Int_t splitlevel = 99)
398 {
399 return BranchImpRef(name, TClass::GetClass<T>(), TDataType::GetType(typeid(T)), obj, bufsize, splitlevel);
400 }
401
402 /// Add a new branch, and infer the data type from the array `addobj` being passed.
403 ///
404 /// \note This and the previous overload should cover most cases for creating a branch. Try to use these two whenever
405 /// possible, unless e.g. type conversions are needed.
406 ///
407 /// \param[in] name Name of the branch to be created.
408 /// \param[in] addobj Array of the objects to be added. When calling Fill(), the current value of the type/object will be saved.
409 /// \param[in] bufsize he buffer size in bytes for this branch. When the buffer is full, it is compressed and written to disc.
410 /// The default value of 32000 bytes and should be ok for most simple types. Larger buffers (e.g. 256000) if your Tree is not split and each entry is large (Megabytes).
411 /// A small value for bufsize is beneficial if entries in the Tree are accessed randomly and the Tree is in split mode.
412 /// \param[in] splitlevel If T is a class or struct and splitlevel > 0, the members of the object are serialised as separate branches.
413 /// \return Pointer to the TBranch that was created. The branch is owned by the tree.
414 template <class T> TBranch *Branch(const char* name, T** addobj, Int_t bufsize = 32000, Int_t splitlevel = 99)
415 {
416 return BranchImp(name, TClass::GetClass<T>(), addobj, bufsize, splitlevel);
417 }
418
419 virtual Int_t Branch(TCollection* list, Int_t bufsize = 32000, Int_t splitlevel = 99, const char* name = "");
420 virtual Int_t Branch(TList* list, Int_t bufsize = 32000, Int_t splitlevel = 99);
421 virtual Int_t Branch(const char* folder, Int_t bufsize = 32000, Int_t splitlevel = 99);
422 virtual TBranch *Branch(const char* name, void* address, const char* leaflist, Int_t bufsize = 32000);
423 TBranch *Branch(const char* name, char* address, const char* leaflist, Int_t bufsize = 32000)
424 {
425 // Overload to avoid confusion between this signature and the template instance.
426 return Branch(name,(void*)address,leaflist,bufsize);
427 }
428 TBranch *Branch(const char* name, Longptr_t address, const char* leaflist, Int_t bufsize = 32000)
429 {
430 // Overload to avoid confusion between this signature and the template instance.
431 return Branch(name,(void*)address,leaflist,bufsize);
432 }
433 TBranch *Branch(const char* name, int address, const char* leaflist, Int_t bufsize = 32000)
434 {
435 // Overload to avoid confusion between this signature and the template instance.
436 return Branch(name,(void*)(Longptr_t)address,leaflist,bufsize);
437 }
438 virtual TBranch *Branch(const char* name, const char* classname, void* addobj, Int_t bufsize = 32000, Int_t splitlevel = 99);
439 template <class T> TBranch *Branch(const char* name, const char* classname, T* obj, Int_t bufsize = 32000, Int_t splitlevel = 99)
440 {
441 // See BranchImpRed for details. Here we __ignore
442 return BranchImpRef(name, classname, TClass::GetClass<T>(), obj, bufsize, splitlevel);
443 }
444 template <class T> TBranch *Branch(const char* name, const char* classname, T** addobj, Int_t bufsize = 32000, Int_t splitlevel = 99)
445 {
446 // See BranchImp for details
447 return BranchImp(name, classname, TClass::GetClass<T>(), addobj, bufsize, splitlevel);
448 }
449 template <typename T, std::size_t N> TBranch *Branch(const char* name, std::array<T, N> *obj, Int_t bufsize = 32000, Int_t splitlevel = 99)
450 {
451 TClass *cl = TClass::GetClass<T>();
452 if (cl) {
453 TClass *arrCl = TClass::GetClass<std::array<T, N>>();
454 Error("Branch","std::array of objects not yet supported as top level branch object (the class is %s)",
455 arrCl ? arrCl->GetName() : cl->GetName());
456 return nullptr;
457 }
458 return BranchImpArr(name, TDataType::GetType(typeid(T)), N, obj, bufsize, splitlevel);
459 }
460 virtual TBranch *Bronch(const char* name, const char* classname, void* addobj, Int_t bufsize = 32000, Int_t splitlevel = 99);
461 virtual TBranch *BranchOld(const char* name, const char* classname, void* addobj, Int_t bufsize = 32000, Int_t splitlevel = 1);
462 virtual TBranch *BranchRef();
463 void Browse(TBrowser*) override;
464 virtual Int_t BuildIndex(const char *majorname, const char *minorname = "0", bool long64major = false, bool long64minor = false);
465 /// Build index with only a major formula. Minor formula will be set to "0" ie skip.
466 /// \see TTree::BuildIndex(const char *, const char *, bool, bool)
467 Int_t BuildIndex(const char *majorname, bool long64major) { return BuildIndex(majorname, "0", long64major, false); }
468 TStreamerInfo *BuildStreamerInfo(TClass* cl, void *pointer = nullptr, bool canOptimize = true);
469 virtual TFile *ChangeFile(TFile* file);
470 virtual TTree *CloneTree(Long64_t nentries = -1, Option_t* option = "");
471 virtual void CopyAddresses(TTree*,bool undo = false);
472 virtual Long64_t CopyEntries(TTree* tree, Long64_t nentries = -1, Option_t *option = "", bool needCopyAddresses = false);
474 virtual TBasket *CreateBasket(TBranch*);
475 virtual void DirectoryAutoAdd(TDirectory *);
476 Int_t Debug() const { return fDebug; }
477 void Delete(Option_t* option = "") override; // *MENU*
478 void Draw(Option_t* opt) override { Draw(opt, "", "", kMaxEntries, 0); }
479 virtual Long64_t Draw(const char* varexp, const TCut& selection, Option_t* option = "", Long64_t nentries = kMaxEntries, Long64_t firstentry = 0);
480 virtual Long64_t Draw(const char* varexp, const char* selection, Option_t* option = "", Long64_t nentries = kMaxEntries, Long64_t firstentry = 0); // *MENU*
481 virtual void DropBaskets();
482 virtual void DropBuffers(Int_t nbytes);
483 bool EnableCache();
484 virtual Int_t Fill();
485 virtual TBranch *FindBranch(const char* name);
486 virtual TLeaf *FindLeaf(const char* name);
487 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); // *MENU*
488 virtual Int_t FlushBaskets(bool create_cluster = true) const;
489 virtual const char *GetAlias(const char* aliasName) const;
491#ifdef R__TRACK_BASKET_ALLOC_TIME
493#endif
494 virtual Long64_t GetAutoFlush() const {return fAutoFlush;}
495 virtual Long64_t GetAutoSave() const {return fAutoSave;}
496 virtual TBranch *GetBranch(const char* name);
497 virtual TBranchRef *GetBranchRef() const { return fBranchRef; };
498 virtual bool GetBranchStatus(const char* branchname) const;
499 static Int_t GetBranchStyle();
500 virtual Long64_t GetCacheSize() const { return fCacheSize; }
501 virtual TClusterIterator GetClusterIterator(Long64_t firstentry);
503 virtual Long64_t GetChainOffset() const { return fChainOffset; }
504 virtual bool GetClusterPrefetch() const { return fCacheDoClusterPrefetch; }
505 TFile *GetCurrentFile() const;
507 Long64_t GetDebugMax() const { return fDebugMax; }
508 Long64_t GetDebugMin() const { return fDebugMin; }
509 TDirectory *GetDirectory() const { return fDirectory; }
510 virtual Long64_t GetEntries() const { return fEntries; }
511 virtual Long64_t GetEntries(const char *selection);
512 /// Return a number greater or equal to the total number of entries in the
513 /// dataset.
514 ///
515 /// \note If you are interested in the total number of entries in a TChain,
516 /// this function will give that number once the last file of the chain
517 /// is opened. In general, using this instead of GetEntries will avoid
518 /// opening all files in the chain which could be very costly for very
519 /// large number of files stored at a remote location.
520 ///
521 /// The logic depends on whether the dataset is a TTree or a TChain. In the
522 /// first case, it simply returns the total number of entries in the tree. In
523 /// the latter case, it depends on which point of the processing of the chain
524 /// this function is called. During most of the chain processing, this
525 /// function will return TTree::kMaxEntries. When the chain arrives at the
526 /// last file, then the function will return the accumulated total number of
527 /// entries in the whole chain. A notable use case where this function
528 /// becomes quite useful is when writing the following for loop to traverse
529 /// the entries in the dataset:
530 ///
531 /// \code{.cpp}
532 /// for(Long64_t ievent = 0; ievent < dataset.GetEntriesFast(); ievent++) {
533 /// // Do something with the event in the dataset
534 /// }
535 /// \endcode
536 ///
537 /// In the example above, independently on whether the dataset is a TTree or
538 /// a TChain, the GetEntriesFast call will provide the correct stopping
539 /// condition for the loop (i.e. the total number of entries). In the TChain
540 /// case, calling GetEntries instead would open all the files in the chain
541 /// upfront which could be costly.
542 ///
543 /// The functionality offered by this method can also be seen when used in
544 /// conjunction with LoadTree. For a call like <tt> LoadTree(ievent) </tt>,
545 /// the condition <tt> ievent < dataset.GetEntriesFast() </tt> is only
546 /// satisfied if \p ievent is strictly smaller than the total number of
547 /// entries in the dataset. In fact, even when the dataset is a TChain, the
548 /// first time LoadTree is called with an entry number that belongs to the
549 /// last file of the chain, this will update the internal data member of the
550 /// class so that the next call to GetEntriesFast returns the total number
551 /// of entries in the dataset.
552 virtual Long64_t GetEntriesFast() const { return fEntries; }
553 virtual Long64_t GetEntriesFriend() const;
554 virtual Long64_t GetEstimate() const { return fEstimate; }
555 virtual Int_t GetEntry(Long64_t entry, Int_t getall = 0);
560 TEventList *GetEventList() const { return fEventList; }
561 virtual TEntryList *GetEntryList();
562 virtual Long64_t GetEntryNumber(Long64_t entry) const;
563 virtual Int_t GetFileNumber() const { return fFileNumber; }
564 virtual TTree *GetFriend(const char*) const;
565 virtual const char *GetFriendAlias(TTree*) const;
567 virtual bool GetImplicitMT() { return fIMTEnabled; }
568 virtual Int_t *GetIndex() { return &fIndex.fArray[0]; }
569 virtual Double_t *GetIndexValues() { return &fIndexValues.fArray[0]; }
571 virtual TIterator *GetIteratorOnAllLeaves(bool dir = kIterForward);
572 virtual TLeaf *GetLeaf(const char* branchname, const char* leafname);
573 virtual TLeaf *GetLeaf(const char* name);
574 virtual TList *GetListOfClones() { return fClones; }
575 virtual TObjArray *GetListOfBranches() { return &fBranches; }
576 virtual TObjArray *GetListOfLeaves() { return &fLeaves; }
577 virtual TList *GetListOfFriends() const { return fFriends; }
578 virtual TList *GetListOfAliases() const { return fAliases; }
579
580 // GetMakeClass is left non-virtual for efficiency reason.
581 // Making it virtual affects the performance of the I/O
582 Int_t GetMakeClass() const { return fMakeClass; }
583
584 virtual Long64_t GetMaxEntryLoop() const { return fMaxEntryLoop; }
585 virtual Double_t GetMaximum(const char* columname);
586 static Long64_t GetMaxTreeSize();
587 virtual Long64_t GetMaxVirtualSize() const { return fMaxVirtualSize; }
588 virtual Double_t GetMinimum(const char* columname);
590 TObject *GetNotify() const { return fNotify; }
592 virtual Int_t GetPacketSize() const { return fPacketSize; }
593 virtual TVirtualPerfStats *GetPerfStats() const { return fPerfStats; }
594 TTreeCache *GetReadCache(TFile *file) const;
595 TTreeCache *GetReadCache(TFile *file, bool create);
596 virtual Long64_t GetReadEntry() const { return fReadEntry; }
597 virtual Long64_t GetReadEvent() const { return fReadEntry; }
598 virtual Int_t GetScanField() const { return fScanField; }
601 virtual Int_t GetTimerInterval() const { return fTimerInterval; }
603 virtual Long64_t GetTotBytes() const { return fTotBytes; }
604 virtual TTree *GetTree() const { return const_cast<TTree*>(this); }
605 virtual TVirtualIndex *GetTreeIndex() const { return fTreeIndex; }
606 virtual Int_t GetTreeNumber() const { return 0; }
608 virtual Int_t GetUpdate() const { return fUpdate; }
609 virtual TList *GetUserInfo();
610 // See TSelectorDraw::GetVar
612 // See TSelectorDraw::GetVar
614 // See TSelectorDraw::GetVar
616 // See TSelectorDraw::GetVar
618 // See TSelectorDraw::GetVar
620 // See TSelectorDraw::GetVal
621 virtual Double_t *GetVal(Int_t i) { return GetPlayer()->GetVal(i); }
622 // See TSelectorDraw::GetVal
623 virtual Double_t *GetV1() { return GetPlayer()->GetV1(); }
624 // See TSelectorDraw::GetVal
625 virtual Double_t *GetV2() { return GetPlayer()->GetV2(); }
626 // See TSelectorDraw::GetVal
627 virtual Double_t *GetV3() { return GetPlayer()->GetV3(); }
628 // See TSelectorDraw::GetVal
629 virtual Double_t *GetV4() { return GetPlayer()->GetV4(); }
630 virtual Double_t *GetW() { return GetPlayer()->GetW(); }
631 virtual Double_t GetWeight() const { return fWeight; }
632 virtual Long64_t GetZipBytes() const { return fZipBytes; }
634 bool IsFolder() const override { return true; }
635 virtual bool InPlaceClone(TDirectory *newdirectory, const char *options = "");
636 virtual Int_t LoadBaskets(Long64_t maxmemory = 2000000000);
639 virtual Int_t MakeClass(const char *classname = nullptr, Option_t* option = "");
640 virtual Int_t MakeCode(const char *filename = nullptr);
641 virtual Int_t MakeProxy(const char* classname, const char* macrofilename = nullptr, const char* cutfilename = nullptr, const char* option = nullptr, Int_t maxUnrolling = 3);
642 virtual Int_t MakeSelector(const char *selector = nullptr, Option_t *option = "");
643 bool MemoryFull(Int_t nbytes);
644 virtual Long64_t Merge(TCollection* list, Option_t* option = "");
646 static TTree *MergeTrees(TList* list, Option_t* option = "");
647 bool Notify() override;
648 virtual void OptimizeBaskets(ULong64_t maxMemory=10000000, Float_t minComp=1.1, Option_t *option="");
649 TPrincipal *Principal(const char* varexp = "", const char* selection = "", Option_t* option = "np", Long64_t nentries = kMaxEntries, Long64_t firstentry = 0);
650 void Print(Option_t* option = "") const override; // *MENU*
651 virtual void PrintCacheStats(Option_t* option = "") const;
652 virtual Long64_t Process(const char* filename, Option_t* option = "", Long64_t nentries = kMaxEntries, Long64_t firstentry = 0); // *MENU*
654 virtual Long64_t Project(const char* hname, const char* varexp, const char* selection = "", Option_t* option = "", Long64_t nentries = kMaxEntries, Long64_t firstentry = 0);
655 virtual TSQLResult *Query(const char* varexp = "", const char* selection = "", Option_t* option = "", Long64_t nentries = kMaxEntries, Long64_t firstentry = 0);
656 virtual Long64_t ReadFile(const char* filename, const char* branchDescriptor = "", char delimiter = ' ');
657 virtual Long64_t ReadStream(std::istream& inputStream, const char* branchDescriptor = "", char delimiter = ' ');
658 virtual void Refresh();
660 virtual void RemoveExternalFriend(TFriendElement *);
661 virtual void RemoveFriend(TTree*);
662 void RecursiveRemove(TObject *obj) override;
663 virtual void Reset(Option_t* option = "");
664 virtual void ResetAfterMerge(TFileMergeInfo *);
665 virtual void ResetBranchAddress(TBranch *);
666 virtual void ResetBranchAddresses();
667 virtual Long64_t Scan(const char* varexp = "", const char* selection = "", Option_t* option = "", Long64_t nentries = kMaxEntries, Long64_t firstentry = 0); // *MENU*
668 virtual bool SetAlias(const char* aliasName, const char* aliasFormula);
669 virtual void SetAutoSave(Long64_t autos = -300000000);
670 virtual void SetAutoFlush(Long64_t autof = -30000000);
671 virtual void SetBasketSize(const char* bname, Int_t buffsize = 16000);
672 virtual Int_t SetBranchAddress(const char *bname,void *add, TBranch **ptr = nullptr);
673 virtual Int_t SetBranchAddress(const char *bname,void *add, TClass *realClass, EDataType datatype, bool isptr);
674 virtual Int_t SetBranchAddress(const char *bname,void *add, TBranch **ptr, TClass *realClass, EDataType datatype, bool isptr);
675 template <class T> Int_t SetBranchAddress(const char *bname, T **add, TBranch **ptr = nullptr) {
676 TClass *cl = TClass::GetClass<T>();
678 if (!cl) type = TDataType::GetType(typeid(T));
679 return SetBranchAddress(bname,add,ptr,cl,type,true);
680 }
681#ifndef R__NO_CLASS_TEMPLATE_SPECIALIZATION
682 // This can only be used when the template overload resolution can distinguish between
683 // T* and T**
684 template <class T> Int_t SetBranchAddress(const char *bname, T *add, TBranch **ptr = nullptr) {
685 TClass *cl = TClass::GetClass<T>();
687 if (!cl) type = TDataType::GetType(typeid(T));
688 return SetBranchAddress(bname,add,ptr,cl,type,false);
689 }
690#endif
691 virtual void SetBranchStatus(const char* bname, bool status = true, UInt_t* found = nullptr);
692 static void SetBranchStyle(Int_t style = 1); //style=0 for old branch, =1 for new branch style
693 virtual Int_t SetCacheSize(Long64_t cachesize = -1);
694 virtual Int_t SetCacheEntryRange(Long64_t first, Long64_t last);
695 virtual void SetCacheLearnEntries(Int_t n=10);
697 virtual void SetCircular(Long64_t maxEntries);
698 /// Enables (or disables) the early decompression of the baskets of the current cluster
699 /// (whose compressed data is already in memory if used in conjunction with the TTreeCache).
700 /// This affects performance only in conjunction with non-sequential use/load/read of the entries, ie
701 /// within a cluster you can have cheap random access to the entries (instead of having to decompress again and again).
702 /// \note This setting is totally different from SetCacheSize and from TFile.AsyncPrefetching, which save read calls
704 virtual void SetDebug(Int_t level = 1, Long64_t min = 0, Long64_t max = 9999999); // *MENU*
705 virtual void SetDefaultEntryOffsetLen(Int_t newdefault, bool updateExisting = false);
706 virtual void SetDirectory(TDirectory* dir);
707 virtual Long64_t SetEntries(Long64_t n = -1);
708 virtual void SetEstimate(Long64_t nentries = 1000000);
710 virtual void SetFileNumber(Int_t number = 0);
711 virtual void SetEventList(TEventList* list);
712 virtual void SetEntryList(TEntryList* list, Option_t *opt="");
713 virtual void SetImplicitMT(bool enabled) { fIMTEnabled = enabled; }
714 virtual void SetMakeClass(Int_t make);
716 static void SetMaxTreeSize(Long64_t maxsize = 100000000000LL);
717 virtual void SetMaxVirtualSize(Long64_t size = 0) { fMaxVirtualSize = size; } // *MENU*
718 void SetName(const char* name) override; // *MENU*
719
720 /**
721 * @brief Sets the address of the object to be notified when the tree is loaded.
722 *
723 * The method TObject::Notify is called for the given object when the tree
724 * is loaded. Specifically this occurs in the TTree::LoadTree method. To
725 * remove the notification call this method with nullptr:
726 * @code tree->SetNotify(nullptr); @endcode
727 *
728 * If this is a TChain, `obj` is most often going to be a TNotifyLink.
729 *
730 * @param[in] obj Pointer to a TObject to be notified.
731 */
732 virtual void SetNotify(TObject* obj);
733
734 virtual void SetObject(const char* name, const char* title);
735 virtual void SetParallelUnzip(bool opt=true, Float_t RelSize=-1);
736 virtual void SetPerfStats(TVirtualPerfStats* perf);
737 /**
738 * \brief Sets the default maximum number of lines to be shown before `<CR>` when calling Scan().
739 * \param n the maximum number of lines. Default=50, if 0, all entries of the Tree are shown
740 * and there is no need to press `<CR>` or `q` to exit the function.
741 * \note See TTreePlayer::Scan for more details on how to redirect the output to an ASCII file
742 */
743 virtual void SetScanField(Int_t n = 50) { fScanField = n; } // *MENU*
746 virtual void SetTreeIndex(TVirtualIndex* index);
747 virtual void SetWeight(Double_t w = 1, Option_t* option = "");
748 virtual void SetUpdate(Int_t freq = 0) { fUpdate = freq; }
749 virtual void Show(Long64_t entry = -1, Int_t lenmax = 20);
750 virtual void StartViewer(); // *MENU*
752 virtual Int_t UnbinnedFit(const char* funcname, const char* varexp, const char* selection = "", Option_t* option = "", Long64_t nentries = kMaxEntries, Long64_t firstentry = 0);
753 void UseCurrentStyle() override;
754 Int_t Write(const char *name=nullptr, Int_t option=0, Int_t bufsize=0) override;
755 Int_t Write(const char *name=nullptr, Int_t option=0, Int_t bufsize=0) const override;
756
757 ClassDefOverride(TTree, 20) // Tree descriptor (the main ROOT I/O class)
758};
759
760//////////////////////////////////////////////////////////////////////////
761// //
762// TTreeFriendLeafIter //
763// //
764// Iterator on all the leaves in a TTree and its friend //
765// //
766//////////////////////////////////////////////////////////////////////////
767
769
770protected:
771 TTree *fTree; ///< tree being iterated
772 TIterator *fLeafIter; ///< current leaf sub-iterator.
773 TIterator *fTreeIter; ///< current tree sub-iterator.
774 bool fDirection; ///< iteration direction
775
776 TTreeFriendLeafIter() : fTree(nullptr), fLeafIter(nullptr), fTreeIter(nullptr),
777 fDirection(false) { }
778
779public:
780 TTreeFriendLeafIter(const TTree* t, bool dir = kIterForward);
783 TIterator &operator=(const TIterator &rhs) override;
785
786 const TCollection *GetCollection() const override { return nullptr; }
787 Option_t *GetOption() const override;
788 TObject *Next() override;
790 bool operator !=(const TIterator&) const override {
791 // TODO: Implement me
792 return false;
793 }
794 bool operator !=(const TTreeFriendLeafIter&) const {
795 // TODO: Implement me
796 return false;
797 }
798 TObject *operator*() const override {
799 // TODO: Implement me
800 return nullptr;
801 }
802 ClassDefOverride(TTreeFriendLeafIter,0) //Linked list iterator
803 };
804
805
806#endif
#define SafeDelete(p)
Definition RConfig.hxx:531
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
int Int_t
Signed integer 4 bytes (int)
Definition RtypesCore.h:59
long Longptr_t
Integer large enough to hold a pointer (platform-dependent)
Definition RtypesCore.h:89
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int)
Definition RtypesCore.h:60
float Float_t
Float 4 bytes (float)
Definition RtypesCore.h:71
double Double_t
Double 8 bytes.
Definition RtypesCore.h:73
long long Long64_t
Portable signed long integer 8 bytes.
Definition RtypesCore.h:83
unsigned long long ULong64_t
Portable unsigned long integer 8 bytes.
Definition RtypesCore.h:84
const char Option_t
Option string (const char)
Definition RtypesCore.h:80
#define BIT(n)
Definition Rtypes.h:91
#define ClassDefOverride(name, id)
Definition Rtypes.h:348
const Bool_t kIterForward
Definition TCollection.h:42
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
EDataType
Definition TDataType.h:28
@ kOther_t
Definition TDataType.h:32
#define gDirectory
Definition TDirectory.h:385
#define N
Option_t Option_t option
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char filename
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h offset
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t index
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t src
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
Option_t Option_t style
char name[80]
Definition TGX11.cxx:110
int nentries
TIOFeatures provides the end-user with the ability to change the IO behavior of data written via a TT...
Array of doubles (64 bits per element).
Definition TArrayD.h:27
Double_t * fArray
Definition TArrayD.h:30
Array of integers (32 bits per element).
Definition TArrayI.h:27
Int_t * fArray
Definition TArrayI.h:30
Fill Area Attributes class.
Definition TAttFill.h:20
Line Attributes class.
Definition TAttLine.h:20
Marker Attributes class.
Definition TAttMarker.h:20
Manages buffers for branches of a Tree.
Definition TBasket.h:34
A branch containing and managing a TRefTable for TRef autoloading.
Definition TBranchRef.h:34
A TTree is a list of TBranches.
Definition TBranch.h:93
Using a TBrowser one can browse all ROOT objects.
Definition TBrowser.h:37
Buffer base class used for serializing objects.
Definition TBuffer.h:43
A Chain Index.
Definition TChainIndex.h:40
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition TClass.h:84
Collection abstract base class.
Definition TCollection.h:65
A specialized string object used for TTree selections.
Definition TCut.h:25
Int_t GetType() const
Definition TDataType.h:68
Describe directory structure in memory.
Definition TDirectory.h:45
A List of entry numbers in a TTree or TChain.
Definition TEntryList.h:26
<div class="legacybox"><h2>Legacy Code</h2> TEventList is a legacy interface: there will be no bug fi...
Definition TEventList.h:31
A class to pass information from the TFileMerger to the objects being merged.
A ROOT file is an on-disk file, usually with extension .root, that stores objects in a file-system-li...
Definition TFile.h:130
A TFriendElement TF describes a TTree object TF in a file.
TH1 is the base class of all histogram classes in ROOT.
Definition TH1.h:109
Iterator abstract base class.
Definition TIterator.h:30
A TLeaf describes individual elements of a TBranch See TBranch structure in TTree.
Definition TLeaf.h:57
A doubly linked list.
Definition TList.h:38
The TNamed class is the base class for all named ROOT classes.
Definition TNamed.h:29
const char * GetName() const override
Returns name of object.
Definition TNamed.h:49
An array of TObjects.
Definition TObjArray.h:31
Int_t GetEntriesFast() const
Definition TObjArray.h:58
Mother of all ROOT objects.
Definition TObject.h:42
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition TObject.cxx:1089
A PolyMarker is defined by an array on N points in a 2-D space.
Definition TPolyMarker.h:31
Principal Components Analysis (PCA)
Definition TPrincipal.h:21
A TSelector object is used by the TTree::Draw, TTree::Scan, TTree::Process to navigate in a TTree and...
Definition TSelector.h:31
Describes a persistent version of a class.
A cache to speed-up the reading of ROOT datasets.
Definition TTreeCache.h:32
Class implementing or helping the various TTree cloning method.
Definition TTreeCloner.h:31
Used to pass a selection expression to the Tree drawing routine.
Iterator on all the leaves in a TTree and its friend.
Definition TTree.h:768
bool operator!=(const TIterator &) const override
Compare two iterator objects.
Definition TTree.h:790
const TCollection * GetCollection() const override
Definition TTree.h:786
TTree * fTree
tree being iterated
Definition TTree.h:771
TObject * operator*() const override
Return current object or nullptr.
Definition TTree.h:798
void Reset() override
Definition TTree.h:789
TIterator & operator=(const TIterator &rhs) override
Overridden assignment operator. Does NOT copy the 'cursor' location!
Definition TTree.cxx:10059
~TTreeFriendLeafIter() override
Definition TTree.h:782
TObject * Next() override
Go the next friend element.
Definition TTree.cxx:10082
TIterator * fLeafIter
current leaf sub-iterator.
Definition TTree.h:772
Option_t * GetOption() const override
Returns the object option stored in the list.
Definition TTree.cxx:10121
TIterator * fTreeIter
current tree sub-iterator.
Definition TTree.h:773
bool fDirection
iteration direction
Definition TTree.h:774
A Tree Index with majorname and minorname.
Definition TTreeIndex.h:29
Helper class to iterate over cluster of baskets.
Definition TTree.h:314
Long64_t GetEstimatedClusterSize()
Estimate the cluster size.
Definition TTree.cxx:638
Long64_t Previous()
Move on to the previous cluster and return the starting entry of this previous cluster.
Definition TTree.cxx:721
Long64_t GetStartEntry()
Definition TTree.h:346
Long64_t operator()()
Definition TTree.h:355
Long64_t Next()
Move on to the next cluster and return the starting entry of this next cluster.
Definition TTree.cxx:677
Long64_t GetNextEntry()
Definition TTree.h:351
Long64_t fEstimatedSize
Definition TTree.h:320
TClusterIterator(TTree *tree, Long64_t firstEntry)
Regular constructor.
Definition TTree.cxx:587
Helper class to prevent infinite recursion in the usage of TTree Friends.
Definition TTree.h:221
TFriendLock & operator=(const TFriendLock &)
Assignment operator.
Definition TTree.cxx:553
UInt_t fMethodBit
Definition TTree.h:225
TTree * fTree
Definition TTree.h:224
~TFriendLock()
Restore the state of tree the same as before we set the lock.
Definition TTree.cxx:566
A TTree represents a columnar dataset.
Definition TTree.h:89
virtual Int_t Fill()
Fill all branches.
Definition TTree.cxx:4653
virtual TFriendElement * AddFriend(const char *treename, const char *filename="")
Add a TFriendElement to the list of friends.
Definition TTree.cxx:1359
TBranchRef * fBranchRef
Branch supporting the TRefTable (if any)
Definition TTree.h:146
TStreamerInfo * BuildStreamerInfo(TClass *cl, void *pointer=nullptr, bool canOptimize=true)
Build StreamerInfo for class cl.
Definition TTree.cxx:2682
TBranch * GetBranchFromFriends(const char *branchName)
Returns a pointer to the branch with the given name, if it can be found in the list of friends of thi...
Definition TTree.cxx:5378
virtual Int_t SetBranchAddress(const char *bname, void *add, TBranch **ptr, TClass *realClass, EDataType datatype, bool isptr, bool suppressMissingBranchError)
Definition TTree.cxx:8675
virtual TBranch * FindBranch(const char *name)
Return the branch that correspond to the path 'branchname', which can include the name of the tree or...
Definition TTree.cxx:4890
virtual TVirtualPerfStats * GetPerfStats() const
Definition TTree.h:593
virtual void SetTimerInterval(Int_t msec=333)
Definition TTree.h:745
virtual void SetBranchStatus(const char *bname, bool status=true, UInt_t *found=nullptr)
Set branch status to Process or DoNotProcess.
Definition TTree.cxx:8779
TTreeFormula * GetSelect()
Definition TTree.h:599
bool EnableCache()
Enable the TTreeCache unless explicitly disabled for this TTree by a prior call to SetCacheSize(0).
Definition TTree.cxx:2715
virtual TBranch * GetBranch(const char *name)
Return pointer to the branch with the given name in this tree or its friends.
Definition TTree.cxx:5430
virtual Int_t GetScanField() const
Definition TTree.h:598
static Int_t GetBranchStyle()
Static function returning the current branch style.
Definition TTree.cxx:5471
TList * fFriends
pointer to list of friend elements
Definition TTree.h:140
bool fIMTEnabled
! true if implicit multi-threading is enabled for this tree
Definition TTree.h:152
virtual Long64_t GetChainEntryNumber(Long64_t entry) const
Definition TTree.h:502
virtual bool GetBranchStatus(const char *branchname) const
Return status of branch with name branchname.
Definition TTree.cxx:5456
UInt_t fFriendLockStatus
! Record which method is locking the friend recursion
Definition TTree.h:147
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 fri...
Definition TTree.cxx:6209
Long64_t fTotBytes
Total number of bytes in all branches before compression.
Definition TTree.h:96
virtual Int_t FlushBaskets(bool create_cluster=true) const
Write to disk all the basket that have not yet been individually written and create an event cluster ...
Definition TTree.cxx:5178
Int_t GetDefaultEntryOffsetLen() const
Definition TTree.h:506
Int_t fMaxClusterRange
! Memory allocated for the cluster range.
Definition TTree.h:106
virtual void Show(Long64_t entry=-1, Int_t lenmax=20)
Print values of all active leaves for entry.
Definition TTree.cxx:9650
TEventList * fEventList
! Pointer to event selection list (if one)
Definition TTree.h:135
virtual Long64_t GetAutoSave() const
Definition TTree.h:495
virtual Int_t StopCacheLearningPhase()
Stop the cache learning phase.
Definition TTree.cxx:9739
virtual Int_t GetEntry(Long64_t entry, Int_t getall=0)
Read all branches of entry and return total number of bytes read.
Definition TTree.cxx:5718
std::vector< std::pair< Long64_t, TBranch * > > fSortedBranches
! Branches to be processed in parallel when IMT is on, sorted by average task time
Definition TTree.h:154
virtual void SetCircular(Long64_t maxEntries)
Enable/Disable circularity for this tree.
Definition TTree.cxx:9146
virtual Long64_t GetEstimate() const
Definition TTree.h:554
Long64_t GetDebugMax() const
Definition TTree.h:507
Long64_t fSavedBytes
Number of autosaved bytes.
Definition TTree.h:98
virtual Int_t AddBranchToCache(const char *bname, bool subbranches=false)
Add branch with name bname to the Tree cache.
Definition TTree.cxx:1086
Long64_t GetMedianClusterSize()
Estimate the median cluster size for the TTree.
Definition TTree.cxx:8504
virtual TClusterIterator GetClusterIterator(Long64_t firstentry)
Return an iterator over the cluster of baskets starting at firstentry.
Definition TTree.cxx:5543
virtual void ResetBranchAddress(TBranch *)
Tell a branch to set its address to zero.
Definition TTree.cxx:8258
bool fCacheUserSet
! true if the cache setting was explicitly given by user
Definition TTree.h:151
char GetNewlineValue(std::istream &inputStream)
Determine which newline this file is using.
Definition TTree.cxx:7781
TBranch * Branch(const char *name, T **addobj, Int_t bufsize=32000, Int_t splitlevel=99)
Add a new branch, and infer the data type from the array addobj being passed.
Definition TTree.h:414
TIOFeatures fIOFeatures
IO features to define for newly-written baskets and branches.
Definition TTree.h:124
virtual Long64_t GetSelectedRows()
Definition TTree.h:600
void AddAllocationCount(UInt_t count)
Definition TTree.h:381
virtual void SetMaxEntryLoop(Long64_t maxev=kMaxEntries)
Definition TTree.h:715
virtual Long64_t GetEntryNumberWithIndex(Long64_t major, Long64_t minor=0) const
Return entry number corresponding to major and minor number.
Definition TTree.cxx:5990
Long64_t fDebugMin
! First entry number to debug
Definition TTree.h:122
virtual Long64_t SetEntries(Long64_t n=-1)
Change number of entries in the tree.
Definition TTree.cxx:9265
virtual TObjArray * GetListOfLeaves()
Definition TTree.h:576
virtual TBranch * BranchOld(const char *name, const char *classname, void *addobj, Int_t bufsize=32000, Int_t splitlevel=1)
Create a new TTree BranchObject.
Definition TTree.cxx:2104
virtual Int_t GetEntryWithIndex(Long64_t major, Long64_t minor=0)
Read entry corresponding to major and minor number.
Definition TTree.cxx:6008
Long64_t GetCacheAutoSize(bool withDefault=false)
Used for automatic sizing of the cache.
Definition TTree.cxx:5483
virtual TBranch * BranchRef()
Build the optional branch supporting the TRefTable.
Definition TTree.cxx:2358
TFile * GetCurrentFile() const
Return pointer to the current file.
Definition TTree.cxx:5555
TObject * GetNotify() const
Definition TTree.h:590
TList * fAliases
List of aliases for expressions based on the tree branches.
Definition TTree.h:134
TBranch * Branch(const char *name, Longptr_t address, const char *leaflist, Int_t bufsize=32000)
Definition TTree.h:428
virtual TTree * CopyTree(const char *selection, Option_t *option="", Long64_t nentries=kMaxEntries, Long64_t firstentry=0)
Copy a tree with selection.
Definition TTree.cxx:3759
virtual Int_t DropBranchFromCache(const char *bname, bool subbranches=false)
Remove the branch with name 'bname' from the Tree cache.
Definition TTree.cxx:1169
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.
Definition TTree.cxx:5128
Long64_t * fClusterRangeEnd
[fNClusterRange] Last entry of a cluster range.
Definition TTree.h:113
std::atomic< Long64_t > fIMTZipBytes
! Zip bytes for the IMT flush baskets.
Definition TTree.h:171
void RecursiveRemove(TObject *obj) override
Make sure that obj (which is being deleted or will soon be) is no longer referenced by this TTree.
Definition TTree.cxx:8074
TVirtualTreePlayer * GetPlayer()
Load the TTreePlayer (if not already done).
Definition TTree.cxx:6416
virtual Int_t MakeProxy(const char *classname, const char *macrofilename=nullptr, const char *cutfilename=nullptr, const char *option=nullptr, Int_t maxUnrolling=3)
Generate a skeleton analysis class for this Tree using TBranchProxy.
Definition TTree.cxx:6887
Float_t fTargetMemoryRatio
! Ratio for memory usage in uncompressed buffers versus actual occupancy.
Definition TTree.h:156
virtual Double_t * GetIndexValues()
Definition TTree.h:569
virtual TList * GetListOfAliases() const
Definition TTree.h:578
virtual Long64_t ReadStream(std::istream &inputStream, const char *branchDescriptor="", char delimiter=' ')
Create or simply read branches from an input stream.
Definition TTree.cxx:7808
virtual void SetDebug(Int_t level=1, Long64_t min=0, Long64_t max=9999999)
Set the debug level and the debug range.
Definition TTree.cxx:9182
Int_t fScanField
Number of runs before prompting in Scan.
Definition TTree.h:102
virtual Double_t GetWeight() const
Definition TTree.h:631
void Draw(Option_t *opt) override
Default Draw method for all objects.
Definition TTree.h:478
virtual TTree * GetFriend(const char *) const
Return a pointer to the TTree friend whose name or alias is friendname.
Definition TTree.cxx:6056
TTreeFormula * GetVar(Int_t i)
Definition TTree.h:611
virtual void SetNotify(TObject *obj)
Sets the address of the object to be notified when the tree is loaded.
Definition TTree.cxx:9496
virtual Double_t GetMaximum(const char *columname)
Return maximum of column with name columname.
Definition TTree.cxx:6346
virtual Long64_t GetEntryNumberWithBestIndex(Long64_t major, Long64_t minor=0) const
Return entry number corresponding to major and minor number.
Definition TTree.cxx:5970
static void SetMaxTreeSize(Long64_t maxsize=100000000000LL)
Set the maximum size in bytes of a Tree file (static function).
Definition TTree.cxx:9462
void Print(Option_t *option="") const override
Print a summary of the tree contents.
Definition TTree.cxx:7414
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.
Definition TTree.cxx:9970
Int_t fNClusterRange
Number of Cluster range in addition to the one defined by 'AutoFlush'.
Definition TTree.h:105
virtual void PrintCacheStats(Option_t *option="") const
Print statistics about the TreeCache for this tree.
Definition TTree.cxx:7566
TVirtualTreePlayer * fPlayer
! Pointer to current Tree player
Definition TTree.h:144
virtual TIterator * GetIteratorOnAllLeaves(bool dir=kIterForward)
Creates a new iterator that will go through all the leaves on the tree itself and its friend.
Definition TTree.cxx:6193
virtual void SetMakeClass(Int_t make)
Set all the branches in this TTree to be in decomposed object mode (also known as MakeClass mode).
Definition TTree.cxx:9442
virtual bool InPlaceClone(TDirectory *newdirectory, const char *options="")
Copy the content to a new new file, update this TTree with the new location information and attach th...
Definition TTree.cxx:7207
virtual void IncrementTotalBuffers(Int_t nbytes)
Definition TTree.h:633
TObjArray fBranches
List of Branches.
Definition TTree.h:132
TDirectory * GetDirectory() const
Definition TTree.h:509
bool fCacheDoAutoInit
! true if cache auto creation or resize check is needed
Definition TTree.h:149
TTreeCache * GetReadCache(TFile *file) const
Find and return the TTreeCache registered with the file and which may contain branches for us.
Definition TTree.cxx:6429
Long64_t fEntries
Number of entries.
Definition TTree.h:94
virtual TFile * ChangeFile(TFile *file)
Called by TTree::Fill() when file has reached its maximum fgMaxTreeSize.
Definition TTree.cxx:2779
virtual TEntryList * GetEntryList()
Returns the entry list assigned to this tree.
Definition TTree.cxx:5934
virtual void SetWeight(Double_t w=1, Option_t *option="")
Set tree weight.
Definition TTree.cxx:9639
void InitializeBranchLists(bool checkLeafCount)
Divides the top-level branches into two vectors: (i) branches to be processed sequentially and (ii) b...
Definition TTree.cxx:5861
Long64_t * fClusterSize
[fNClusterRange] Number of entries in each cluster for a given range.
Definition TTree.h:114
Long64_t fFlushedBytes
Number of auto-flushed bytes.
Definition TTree.h:99
virtual void SetPerfStats(TVirtualPerfStats *perf)
Set perf stats.
Definition TTree.cxx:9594
TTreeFormula * GetVar2()
Definition TTree.h:615
std::atomic< Long64_t > fIMTTotBytes
! Total bytes for the IMT flush baskets
Definition TTree.h:170
virtual void SetCacheLearnEntries(Int_t n=10)
Interface to TTreeCache to set the number of entries for the learning phase.
Definition TTree.cxx:9119
Int_t SetBranchAddress(const char *bname, T *add, TBranch **ptr=nullptr)
Definition TTree.h:684
void SetTargetMemoryRatio(Float_t ratio)
Definition TTree.h:744
TEntryList * fEntryList
! Pointer to event selection list (if one)
Definition TTree.h:136
@ kSplitCollectionOfPointers
Definition TTree.h:310
virtual TVirtualIndex * GetTreeIndex() const
Definition TTree.h:605
Int_t Debug() const
Definition TTree.h:476
TList * fExternalFriends
! List of TFriendsElement pointing to us and need to be notified of LoadTree. Content not owned.
Definition TTree.h:141
virtual Long64_t Merge(TCollection *list, Option_t *option="")
Merge the trees in the TList into this tree.
Definition TTree.cxx:7021
virtual void SetMaxVirtualSize(Long64_t size=0)
Definition TTree.h:717
virtual void DropBaskets()
Remove some baskets from memory.
Definition TTree.cxx:4568
virtual void SetAutoSave(Long64_t autos=-300000000)
In case of a program crash, it will be possible to recover the data in the tree up to the last AutoSa...
Definition TTree.cxx:8549
virtual bool GetClusterPrefetch() const
Definition TTree.h:504
TBranch * Branch(const char *name, const char *classname, T **addobj, Int_t bufsize=32000, Int_t splitlevel=99)
Definition TTree.h:444
Long64_t fMaxEntryLoop
Maximum number of entries to process.
Definition TTree.h:108
Int_t BuildIndex(const char *majorname, bool long64major)
Build index with only a major formula.
Definition TTree.h:467
friend TBranch * TTreeBranchImpRef(TTree *tree, const char *branchname, TClass *ptrClass, EDataType datatype, void *addobj, Int_t bufsize, Int_t splitlevel)
Float_t GetTargetMemoryRatio() const
Definition TTree.h:607
virtual void SetParallelUnzip(bool opt=true, Float_t RelSize=-1)
Enable or disable parallel unzipping of Tree buffers.
Definition TTree.cxx:9556
virtual void SetDirectory(TDirectory *dir)
Change the tree's directory.
Definition TTree.cxx:9220
void SortBranchesByTime()
Sorts top-level branches by the last average task time recorded per branch.
Definition TTree.cxx:5914
void Delete(Option_t *option="") override
Delete this tree from memory or/and disk.
Definition TTree.cxx:3787
virtual Int_t * GetIndex()
Definition TTree.h:568
virtual TBranchRef * GetBranchRef() const
Definition TTree.h:497
virtual Double_t * GetV3()
Definition TTree.h:627
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.
Definition TTree.cxx:7644
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.
Definition TTree.cxx:1662
virtual void SetEventList(TEventList *list)
This function transfroms the given TEventList into a TEntryList The new TEntryList is owned by the TT...
Definition TTree.cxx:9323
TBranch * Branch(const char *name, int address, const char *leaflist, Int_t bufsize=32000)
Definition TTree.h:433
void MoveReadCache(TFile *src, TDirectory *dir)
Move a cache from a file to the current file in dir.
Definition TTree.cxx:7178
TTree & operator=(const TTree &tt)=delete
Long64_t fAutoFlush
Auto-flush tree when fAutoFlush entries written or -fAutoFlush (compressed) bytes produced.
Definition TTree.h:111
Int_t fUpdate
Update frequency for EntryLoop.
Definition TTree.h:103
virtual void ResetAfterMerge(TFileMergeInfo *)
Resets the state of this TTree after a merge (keep the customization but forget the data).
Definition TTree.cxx:8227
TBranch * Branch(const char *name, std::array< T, N > *obj, Int_t bufsize=32000, Int_t splitlevel=99)
Definition TTree.h:449
virtual Long64_t GetEntries() const
Definition TTree.h:510
virtual void SetEstimate(Long64_t nentries=1000000)
Set number of entries to estimate variable limits.
Definition TTree.cxx:9364
Int_t fTimerInterval
Timer interval in milliseconds.
Definition TTree.h:101
Int_t fDebug
! Debug level
Definition TTree.h:121
Int_t SetCacheSizeAux(bool autocache=true, Long64_t cacheSize=0)
Set the maximum size of the file cache (TTreeCache) in bytes and create it if possible.
Definition TTree.cxx:8965
virtual Long64_t AutoSave(Option_t *option="")
AutoSave tree header every fAutoSave bytes.
Definition TTree.cxx:1527
virtual Long64_t GetEntryNumber(Long64_t entry) const
Return entry number corresponding to entry.
Definition TTree.cxx:5945
virtual TTree * CloneTree(Long64_t nentries=-1, Option_t *option="")
Create a clone of this tree and copy nentries.
Definition TTree.cxx:3173
virtual bool GetImplicitMT()
Definition TTree.h:567
Int_t fFileNumber
! current file number (if file extensions)
Definition TTree.h:126
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 fri...
Definition TTree.cxx:6306
virtual Long64_t GetZipBytes() const
Definition TTree.h:632
TObjArray fLeaves
Direct pointers to individual branch leaves.
Definition TTree.h:133
virtual void Reset(Option_t *option="")
Reset baskets, buffers and entries count in all branches and leaves.
Definition TTree.cxx:8196
virtual void SetImplicitMT(bool enabled)
Definition TTree.h:713
virtual void KeepCircular()
Keep a maximum of fMaxEntries in memory.
Definition TTree.cxx:6526
virtual void SetDefaultEntryOffsetLen(Int_t newdefault, bool updateExisting=false)
Update the default value for the branch's fEntryOffsetLen.
Definition TTree.cxx:9194
virtual void DirectoryAutoAdd(TDirectory *)
Called by TKey and TObject::Clone to automatically add us to a directory when we are read from a file...
Definition TTree.cxx:3859
Long64_t fMaxVirtualSize
Maximum total size of buffers kept in memory.
Definition TTree.h:109
virtual Long64_t GetTotBytes() const
Definition TTree.h:603
virtual Int_t MakeSelector(const char *selector=nullptr, Option_t *option="")
Generate skeleton selector class for this tree.
Definition TTree.cxx:6941
virtual void SetObject(const char *name, const char *title)
Change the name and title of this tree.
Definition TTree.cxx:9525
TVirtualPerfStats * fPerfStats
! pointer to the current perf stats object
Definition TTree.h:142
Double_t fWeight
Tree weight (see TTree::SetWeight)
Definition TTree.h:100
virtual void SetUpdate(Int_t freq=0)
Definition TTree.h:748
std::vector< TBranch * > fSeqBranches
! Branches to be processed sequentially when IMT is on
Definition TTree.h:155
Long64_t fDebugMax
! Last entry number to debug
Definition TTree.h:123
Int_t fDefaultEntryOffsetLen
Initial Length of fEntryOffset table in the basket buffers.
Definition TTree.h:104
TBranch * GetBranchFromSelf(const char *branchName)
Returns a pointer to the branch with the given name, if it can be found in this tree.
Definition TTree.cxx:5342
TTree()
Default constructor and I/O constructor.
Definition TTree.cxx:764
Long64_t fAutoSave
Autosave tree when fAutoSave entries written or -fAutoSave (compressed) bytes produced.
Definition TTree.h:110
TBranch * Branch(const char *name, T *obj, Int_t bufsize=32000, Int_t splitlevel=99)
Add a new branch, and infer the data type from the type of obj being passed.
Definition TTree.h:397
std::atomic< UInt_t > fAllocationCount
indicates basket should be resized to exact memory usage, but causes significant
Definition TTree.h:162
static TTree * MergeTrees(TList *list, Option_t *option="")
Static function merging the trees in the TList into a new tree.
Definition TTree.cxx:6972
bool MemoryFull(Int_t nbytes)
Check if adding nbytes to memory we are still below MaxVirtualsize.
Definition TTree.cxx:6956
TTreeFormula * GetVar4()
Definition TTree.h:619
virtual Long64_t GetReadEntry() const
Definition TTree.h:596
virtual TObjArray * GetListOfBranches()
Definition TTree.h:575
Long64_t fZipBytes
Total number of bytes in all branches after compression.
Definition TTree.h:97
virtual TTree * GetTree() const
Definition TTree.h:604
TBuffer * fTransientBuffer
! Pointer to the current transient buffer.
Definition TTree.h:148
virtual Double_t * GetVal(Int_t i)
Definition TTree.h:621
virtual void SetEntryList(TEntryList *list, Option_t *opt="")
Set an EntryList.
Definition TTree.cxx:9300
bool Notify() override
Function called when loading a new class library.
Definition TTree.cxx:7228
virtual void AddZipBytes(Int_t zip)
Definition TTree.h:376
virtual Long64_t LoadTree(Long64_t entry)
Set current entry.
Definition TTree.cxx:6584
virtual Long64_t ReadFile(const char *filename, const char *branchDescriptor="", char delimiter=' ')
Create or simply read branches from filename.
Definition TTree.cxx:7757
virtual const char * GetAlias(const char *aliasName) const
Returns the expanded value of the alias. Search in the friends if any.
Definition TTree.cxx:5275
ROOT::TIOFeatures SetIOFeatures(const ROOT::TIOFeatures &)
Provide the end-user with the ability to enable/disable various experimental IO features for this TTr...
Definition TTree.cxx:9384
friend class TFriendLock
Definition TTree.h:236
virtual TBasket * CreateBasket(TBranch *)
Create a basket for this tree and given branch.
Definition TTree.cxx:3771
TList * fUserInfo
pointer to a list of user objects associated to this Tree
Definition TTree.h:143
virtual Double_t GetMinimum(const char *columname)
Return minimum of column with name columname.
Definition TTree.cxx:6386
virtual void RemoveFriend(TTree *)
Remove a friend from the list of friends.
Definition TTree.cxx:8170
virtual Long64_t GetEntriesFast() const
Return a number greater or equal to the total number of entries in the dataset.
Definition TTree.h:552
void Browse(TBrowser *) override
Browse content of the TTree.
Definition TTree.cxx:2639
virtual Double_t * GetV1()
Definition TTree.h:623
virtual TList * GetUserInfo()
Return a pointer to the list containing user objects associated to this tree.
Definition TTree.cxx:6467
void RegisterBranchFullName(std::pair< std::string, TBranch * > &&kv)
Definition TTree.h:182
TEventList * GetEventList() const
Definition TTree.h:560
Long64_t fChainOffset
! Offset of 1st entry of this Tree in a TChain
Definition TTree.h:116
EStatusBits
Definition TTree.h:294
@ kOnlyFlushAtCluster
If set, the branch's buffers will grow until an event cluster boundary is hit, guaranteeing a basket ...
Definition TTree.h:300
@ kEntriesReshuffled
If set, signals that this TTree is the output of the processing of another TTree, and the entries are...
Definition TTree.h:305
@ kCircular
Definition TTree.h:296
@ kForceRead
Definition TTree.h:295
virtual Long64_t GetEntriesFriend() const
Returns a number corresponding to:
Definition TTree.cxx:5590
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.
Definition TTree.cxx:7705
virtual TBranch * Bronch(const char *name, const char *classname, void *addobj, Int_t bufsize=32000, Int_t splitlevel=99)
Create a new TTree BranchElement.
Definition TTree.cxx:2434
virtual void SetBasketSize(const char *bname, Int_t buffsize=16000)
Set a branch's basket size.
Definition TTree.cxx:8565
static void SetBranchStyle(Int_t style=1)
Set the current branch style.
Definition TTree.cxx:8910
virtual Long64_t GetReadEvent() const
Definition TTree.h:597
~TTree() override
Destructor.
Definition TTree.cxx:947
bool IsFolder() const override
Returns kTRUE in case object contains browsable objects (like containers or lists of other objects).
Definition TTree.h:634
void ImportClusterRanges(TTree *fromtree)
Appends the cluster range information stored in 'fromtree' to this tree, including the value of fAuto...
Definition TTree.cxx:6483
Long64_t fEstimate
Number of entries to estimate histogram limits.
Definition TTree.h:112
TH1 * GetHistogram()
Definition TTree.h:566
UInt_t GetAllocationCount() const
Definition TTree.h:490
Int_t FlushBasketsImpl() const
Internal implementation of the FlushBaskets algorithm.
Definition TTree.cxx:5195
Long64_t GetDebugMin() const
Definition TTree.h:508
virtual Long64_t LoadTreeFriend(Long64_t entry, TTree *T)
Load entry on behalf of our master tree, we may use an index.
Definition TTree.cxx:6676
Int_t Write(const char *name=nullptr, Int_t option=0, Int_t bufsize=0) override
Write this object to the current directory.
Definition TTree.cxx:10021
TVirtualIndex * fTreeIndex
Pointer to the tree Index (if any)
Definition TTree.h:139
void UseCurrentStyle() override
Replace current attributes by current style.
Definition TTree.cxx:9982
virtual Int_t GetTreeNumber() const
Definition TTree.h:606
Int_t GetEvent(Long64_t entry, Int_t getall=0)
Definition TTree.h:556
TObject * fNotify
Object to be notified when loading a Tree.
Definition TTree.h:130
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.
Definition TTree.cxx:1581
virtual TList * GetListOfClones()
Definition TTree.h:574
Long64_t fCacheSize
! Maximum size of file buffers
Definition TTree.h:115
TList * fClones
! List of cloned trees which share our addresses
Definition TTree.h:145
std::atomic< Long64_t > fTotalBuffers
! Total number of bytes in branch buffers
Definition TTree.h:118
ELockStatusBits
Definition TTree.h:244
@ kFindBranch
Definition TTree.h:245
@ kResetBranchAddresses
Definition TTree.h:266
@ kFindLeaf
Definition TTree.h:246
@ kGetEntryWithIndex
Definition TTree.h:250
@ kPrint
Definition TTree.h:260
@ kGetFriend
Definition TTree.h:251
@ kGetBranch
Definition TTree.h:248
@ kSetBranchStatus
Definition TTree.h:265
@ kLoadTree
Definition TTree.h:254
@ kGetEntry
Definition TTree.h:249
@ kGetLeaf
Definition TTree.h:253
@ kRemoveFriend
Definition TTree.h:264
@ kGetFriendAlias
Definition TTree.h:252
@ kGetAlias
Definition TTree.h:247
virtual Double_t * GetV4()
Definition TTree.h:629
TBranch * Branch(const char *name, const char *classname, T *obj, Int_t bufsize=32000, Int_t splitlevel=99)
Definition TTree.h:439
TTreeFormula * GetVar3()
Definition TTree.h:617
virtual void SetTreeIndex(TVirtualIndex *index)
The current TreeIndex is replaced by the new index.
Definition TTree.cxx:9611
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.
Definition TTree.cxx:7252
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.
Definition TTree.cxx:7690
virtual Int_t SetCacheEntryRange(Long64_t first, Long64_t last)
interface to TTreeCache to set the cache entry range
Definition TTree.cxx:9085
static Long64_t GetMaxTreeSize()
Static function which returns the tree file size limit in bytes.
Definition TTree.cxx:6376
bool fCacheDoClusterPrefetch
! true if cache is prefetching whole clusters
Definition TTree.h:150
virtual bool SetAlias(const char *aliasName, const char *aliasFormula)
Set a tree variable alias.
Definition TTree.cxx:8348
virtual Int_t GetTimerInterval() const
Definition TTree.h:601
virtual void CopyAddresses(TTree *, bool undo=false)
Set branch addresses of passed tree equal to ours.
Definition TTree.cxx:3339
virtual void SetScanField(Int_t n=50)
Sets the default maximum number of lines to be shown before <CR> when calling Scan().
Definition TTree.h:743
virtual Int_t BuildIndex(const char *majorname, const char *minorname="0", bool long64major=false, bool long64minor=false)
Build a Tree Index (default is TTreeIndex).
Definition TTree.cxx:2667
TTree(const TTree &tt)=delete
Long64_t fMaxEntries
Maximum number of entries in case of circular buffers.
Definition TTree.h:107
Int_t SetBranchAddress(const char *bname, T **add, TBranch **ptr=nullptr)
Definition TTree.h:675
TBranch * Branch(const char *name, char *address, const char *leaflist, Int_t bufsize=32000)
Definition TTree.h:423
virtual void DropBuffers(Int_t nbytes)
Drop branch buffers to accommodate nbytes below MaxVirtualsize.
Definition TTree.cxx:4581
virtual TList * GetListOfFriends() const
Definition TTree.h:577
virtual void Refresh()
Refresh contents of this tree and its branches from the current status on disk.
Definition TTree.cxx:8109
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.
Definition TTree.cxx:8403
static Long64_t fgMaxTreeSize
Maximum size of a file containing a Tree.
Definition TTree.h:165
Long64_t fReadEntry
! Number of the entry being processed
Definition TTree.h:117
TArrayD fIndexValues
Sorted index values.
Definition TTree.h:137
void MarkEventCluster()
Mark the previous event as being at the end of the event cluster.
Definition TTree.cxx:8465
virtual Int_t GetNbranches()
Definition TTree.h:589
UInt_t fNEntriesSinceSorting
! Number of entries processed since the last re-sorting of branches
Definition TTree.h:153
virtual void SetClusterPrefetch(bool enabled)
Enables (or disables) the early decompression of the baskets of the current cluster (whose compressed...
Definition TTree.h:703
virtual void SetFileNumber(Int_t number=0)
Set fFileNumber to number.
Definition TTree.cxx:9407
virtual TLeaf * FindLeaf(const char *name)
Find first leaf containing searchname.
Definition TTree.cxx:4965
virtual void StartViewer()
Start the TTreeViewer on this tree.
Definition TTree.cxx:9724
Int_t GetMakeClass() const
Definition TTree.h:582
virtual Int_t MakeCode(const char *filename=nullptr)
Generate a skeleton function for this tree.
Definition TTree.cxx:6759
bool fIMTFlush
! True if we are doing a multithreaded flush.
Definition TTree.h:169
TDirectory * fDirectory
! Pointer to directory holding this tree
Definition TTree.h:131
ESetBranchAddressStatus
Definition TTree.h:276
@ kNeedEnableDecomposedObj
Definition TTree.h:288
@ kClassMismatch
Definition TTree.h:281
@ kNeedDisableDecomposedObj
Definition TTree.h:289
@ kVoidPtr
Definition TTree.h:286
@ kNoCheck
Definition TTree.h:287
@ kMatchConversionCollection
Definition TTree.h:284
@ kMissingCompiledCollectionProxy
Definition TTree.h:279
@ kMismatch
Definition TTree.h:280
@ kMatchConversion
Definition TTree.h:283
@ kInternalError
Definition TTree.h:278
@ kDecomposedObjMask
Definition TTree.h:290
@ kMatch
Definition TTree.h:282
@ kMissingBranch
Definition TTree.h:277
@ kMakeClass
Definition TTree.h:285
static Int_t fgBranchStyle
Old/New branch style.
Definition TTree.h:164
virtual void ResetBranchAddresses()
Tell all of our branches to drop their current objects and allocate new ones.
Definition TTree.cxx:8268
Int_t fNfill
! Local for EntryLoop
Definition TTree.h:120
void SetName(const char *name) override
Change the name of this tree.
Definition TTree.cxx:9470
virtual Long64_t GetCacheSize() const
Definition TTree.h:500
virtual void RegisterExternalFriend(TFriendElement *)
Record a TFriendElement that we need to warn when the chain switches to a new file (typically this is...
Definition TTree.cxx:8150
TArrayI fIndex
Index of sorted values.
Definition TTree.h:138
Int_t SetBranchAddressImp(const char *bname, void *add, TBranch **ptr, TClass *realClass, EDataType datatype, bool isptr)
Definition TTree.cxx:8615
virtual Int_t GetPacketSize() const
Definition TTree.h:592
virtual Int_t SetCacheSize(Long64_t cachesize=-1)
Set maximum size of the file cache (TTreeCache) in bytes.
Definition TTree.cxx:8932
void AddClone(TTree *)
Add a cloned tree to our list of trees to be notified whenever we change our branch addresses or when...
Definition TTree.cxx:1246
virtual Int_t CheckBranchAddressType(TBranch *branch, TClass *ptrClass, EDataType datatype, bool ptr)
Check whether or not the address described by the last 3 parameters matches the content of the branch...
Definition TTree.cxx:2901
TBuffer * GetTransientBuffer(Int_t size)
Returns the transient buffer currently used by this TTree for reading/writing baskets.
Definition TTree.cxx:1064
ROOT::TIOFeatures GetIOFeatures() const
Returns the current set of IO settings.
Definition TTree.cxx:6185
virtual Int_t MakeClass(const char *classname=nullptr, Option_t *option="")
Generate a skeleton analysis class for this tree.
Definition TTree.cxx:6726
virtual Int_t GetFileNumber() const
Definition TTree.h:563
virtual const char * GetFriendAlias(TTree *) const
If the 'tree' is a friend, this method returns its alias name.
Definition TTree.cxx:6113
virtual void SetChainOffset(Long64_t offset=0)
Definition TTree.h:696
virtual void RemoveExternalFriend(TFriendElement *)
Removes external friend.
Definition TTree.cxx:8161
virtual Double_t * GetW()
Definition TTree.h:630
TTreeFormula * GetVar1()
Definition TTree.h:613
virtual Double_t * GetV2()
Definition TTree.h:625
Int_t fPacketSize
! Number of entries in one packet for parallel root
Definition TTree.h:119
virtual Int_t GetUpdate() const
Definition TTree.h:608
virtual Long64_t GetChainOffset() const
Definition TTree.h:503
virtual TBranch * BranchImpArr(const char *branchname, EDataType datatype, std::size_t N, void *addobj, Int_t bufsize, Int_t splitlevel)
Definition TTree.cxx:1758
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.
Definition TTree.cxx:8306
virtual TBranch * BronchExec(const char *name, const char *classname, void *addobj, bool isptrptr, Int_t bufsize, Int_t splitlevel)
Helper function implementing TTree::Bronch and TTree::Branch(const char *name, T &obj);.
Definition TTree.cxx:2442
virtual Long64_t GetMaxEntryLoop() const
Definition TTree.h:584
virtual void AddTotBytes(Int_t tot)
Definition TTree.h:375
virtual Long64_t CopyEntries(TTree *tree, Long64_t nentries=-1, Option_t *option="", bool needCopyAddresses=false)
Copy nentries from given tree to this tree.
Definition TTree.cxx:3574
Int_t fMakeClass
! not zero when processing code generated by MakeClass
Definition TTree.h:125
virtual Int_t LoadBaskets(Long64_t maxmemory=2000000000)
Read in memory all baskets from all branches up to the limit of maxmemory bytes.
Definition TTree.cxx:6562
static constexpr Long64_t kMaxEntries
Used as the max value for any TTree range operation.
Definition TTree.h:273
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.
Definition TTree.cxx:7395
std::unordered_map< std::string, TBranch * > fNamesToBranches
! maps names to their branches, useful when retrieving branches by name
Definition TTree.h:174
virtual Long64_t GetAutoFlush() const
Definition TTree.h:494
virtual Long64_t GetMaxVirtualSize() const
Definition TTree.h:587
Abstract interface for Tree Index.
Provides the interface for the an internal performance measurement and event tracing.
Abstract base class defining the interface for the plugins that implement Draw, Scan,...
virtual TTreeFormula * GetVar1() const =0
virtual Double_t * GetV4() const =0
virtual Double_t * GetW() const =0
virtual TTreeFormula * GetVar4() const =0
virtual TTreeFormula * GetVar(Int_t) const =0
virtual Double_t * GetVal(Int_t) const =0
virtual TTreeFormula * GetVar2() const =0
virtual Double_t * GetV1() const =0
static constexpr Long64_t kMaxEntries
virtual TTreeFormula * GetVar3() const =0
virtual Double_t * GetV2() const =0
virtual TTreeFormula * GetSelect() const =0
virtual TH1 * GetHistogram() const =0
virtual Long64_t GetSelectedRows() const =0
virtual Double_t * GetV3() const =0
const Int_t n
Definition legend1.C:16
Namespace hosting functions and classes to retrieve tree information for internal use.
Definition RTTreeDS.hxx:49
TBranch * CallBranchImp(TTree &tree, const char *branchname, TClass *ptrClass, void *addobj, Int_t bufsize=32000, Int_t splitlevel=99)
Definition TTree.cxx:10133
TBranch * CallBranchImpRef(TTree &tree, const char *branchname, TClass *ptrClass, EDataType datatype, void *addobj, Int_t bufsize=32000, Int_t splitlevel=99)
Definition TTree.cxx:10127
void TBranch__SetTree(TTree *tree, TObjArray &branches)
Set the fTree member for all branches and sub branches.
Definition TTree.cxx:9773
th1 Draw()
auto * tt
Definition textangle.C:16