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 TBranchElement;
72class TBranchRef;
73class TBasket;
74class TStreamerInfo;
75class TTree;
76class TTreeCache;
77class TTreeCloner;
78class TFileMergeInfo;
80
82void TBranch__SetTree(TTree *tree, TObjArray &branches);
83
84TBranch *CallBranchImpRef(TTree &tree, const char *branchname, TClass *ptrClass, EDataType datatype, void *addobj,
85 Int_t bufsize = 32000, Int_t splitlevel = 99);
86TBranch *CallBranchImp(TTree &tree, const char *branchname, TClass *ptrClass, void *addobj, Int_t bufsize = 32000,
87 Int_t splitlevel = 99);
88
89// For the Python bindings, which see the char* that TBranch::GetAddress() and
90// TBranchElement::GetObject() return as a string.
93}
94
95class TTree : public TNamed, public TAttLine, public TAttFill, public TAttMarker {
96
98
99protected:
100 Long64_t fEntries; ///< Number of entries
101// NOTE: cannot use std::atomic for these counters as it cannot be serialized.
102 Long64_t fTotBytes; ///< Total number of bytes in all branches before compression
103 Long64_t fZipBytes; ///< Total number of bytes in all branches after compression
104 Long64_t fSavedBytes; ///< Number of autosaved bytes
105 Long64_t fFlushedBytes; ///< Number of auto-flushed bytes
106 Double_t fWeight; ///< Tree weight (see TTree::SetWeight)
107 Int_t fTimerInterval; ///< Timer interval in milliseconds
108 Int_t fScanField; ///< Number of runs before prompting in Scan
109 Int_t fUpdate; ///< Update frequency for EntryLoop
110 Int_t fDefaultEntryOffsetLen; ///< Initial Length of fEntryOffset table in the basket buffers
111 Int_t fNClusterRange; ///< Number of Cluster range in addition to the one defined by 'AutoFlush'
112 Int_t fMaxClusterRange; ///<! Memory allocated for the cluster range.
113 Long64_t fMaxEntries; ///< Maximum number of entries in case of circular buffers
114 Long64_t fMaxEntryLoop; ///< Maximum number of entries to process
115 Long64_t fMaxVirtualSize; ///< Maximum total size of buffers kept in memory
116 Long64_t fAutoSave; ///< Autosave tree when fAutoSave entries written or -fAutoSave (compressed) bytes produced
117 Long64_t fAutoFlush; ///< Auto-flush tree when fAutoFlush entries written or -fAutoFlush (compressed) bytes produced
118 Long64_t fEstimate; ///< Number of entries to estimate histogram limits
119 Long64_t *fClusterRangeEnd; ///<[fNClusterRange] Last entry of a cluster range.
120 Long64_t *fClusterSize; ///<[fNClusterRange] Number of entries in each cluster for a given range.
121 Long64_t fCacheSize; ///<! Maximum size of file buffers
122 Long64_t fChainOffset; ///<! Offset of 1st entry of this Tree in a TChain
123 Long64_t fReadEntry; ///<! Number of the entry being processed
124 std::atomic<Long64_t> fTotalBuffers; ///<! Total number of bytes in branch buffers
125 Int_t fPacketSize; ///<! Number of entries in one packet for parallel root
126 Int_t fNfill; ///<! Local for EntryLoop
127 Int_t fDebug; ///<! Debug level
128 Long64_t fDebugMin; ///<! First entry number to debug
129 Long64_t fDebugMax; ///<! Last entry number to debug
130 TIOFeatures fIOFeatures{0}; ///< IO features to define for newly-written baskets and branches.
131 Int_t fMakeClass; ///<! not zero when processing code generated by MakeClass
132 Int_t fFileNumber; ///<! current file number (if file extensions)
133 /// Object to be notified when loading a Tree.
134 /// TTree::LoadTree() and TChain::LoadTree() will call fNotify->Notify().
135 /// Usually points to a TNotifyLink if this is a TChain.
137 TDirectory *fDirectory; ///<! Pointer to directory holding this tree
138 TObjArray fBranches; ///< List of Branches
139 TObjArray fLeaves; ///< Direct pointers to individual branch leaves
140 TList *fAliases; ///< List of aliases for expressions based on the tree branches.
141 TEventList *fEventList; ///<! Pointer to event selection list (if one)
142 TEntryList *fEntryList; ///<! Pointer to event selection list (if one)
143 TArrayD fIndexValues; ///< Sorted index values
144 TArrayI fIndex; ///< Index of sorted values
145 TVirtualIndex *fTreeIndex; ///< Pointer to the tree Index (if any)
146 TList *fFriends; ///< pointer to list of friend elements
147 TList *fExternalFriends; ///<! List of TFriendsElement pointing to us and need to be notified of LoadTree. Content not owned.
148 TVirtualPerfStats *fPerfStats; ///<! pointer to the current perf stats object
149 TList *fUserInfo; ///< pointer to a list of user objects associated to this Tree
150 TVirtualTreePlayer *fPlayer; ///<! Pointer to current Tree player
151 TList *fClones; ///<! List of cloned trees which share our addresses
152 TBranchRef *fBranchRef; ///< Branch supporting the TRefTable (if any)
153 UInt_t fFriendLockStatus; ///<! Record which method is locking the friend recursion
154 TBuffer *fTransientBuffer; ///<! Pointer to the current transient buffer.
155 bool fCacheDoAutoInit; ///<! true if cache auto creation or resize check is needed
156 bool fCacheDoClusterPrefetch;///<! true if cache is prefetching whole clusters
157 bool fCacheUserSet; ///<! true if the cache setting was explicitly given by user
158 bool fIMTEnabled; ///<! true if implicit multi-threading is enabled for this tree
159 UInt_t fNEntriesSinceSorting; ///<! Number of entries processed since the last re-sorting of branches
160 std::vector<std::pair<Long64_t,TBranch*>> fSortedBranches; ///<! Branches to be processed in parallel when IMT is on, sorted by average task time
161 std::vector<TBranch*> fSeqBranches; ///<! Branches to be processed sequentially when IMT is on
162 Float_t fTargetMemoryRatio{1.1f}; ///<! Ratio for memory usage in uncompressed buffers versus actual occupancy. 1.0
163 /// indicates basket should be resized to exact memory usage, but causes significant
164/// memory churn.
165#ifdef R__TRACK_BASKET_ALLOC_TIME
166 mutable std::atomic<ULong64_t> fAllocationTime{0}; ///<! Time spent reallocating basket memory buffers, in microseconds.
167#endif
168 mutable std::atomic<UInt_t> fAllocationCount{0}; ///<! Number of reallocations basket memory buffers.
169
170 static Int_t fgBranchStyle; ///< Old/New branch style
171 static Long64_t fgMaxTreeSize; ///< Maximum size of a file containing a Tree
172
173private:
174 // For simplicity, although fIMTFlush is always disabled in non-IMT builds, we don't #ifdef it out.
175 mutable bool fIMTFlush{false}; ///<! True if we are doing a multithreaded flush.
176 mutable std::atomic<Long64_t> fIMTTotBytes; ///<! Total bytes for the IMT flush baskets
177 mutable std::atomic<Long64_t> fIMTZipBytes; ///<! Zip bytes for the IMT flush baskets.
178
179 std::unordered_map<std::string, TBranch *>
180 fNamesToBranches; ///<! maps names to their branches, useful when retrieving branches by name
181
182 void InitializeBranchLists(bool checkLeafCount);
183 void SortBranchesByTime();
184 Int_t FlushBasketsImpl() const;
185 void MarkEventCluster();
187
188 void RegisterBranchFullName(std::pair<std::string, TBranch *> &&kv) { fNamesToBranches.insert(kv); }
190
191 Int_t
192 SetBranchAddressImp(const char *bname, void *add, TBranch **ptr, TClass *realClass, EDataType datatype, bool isptr);
193
194 // Helper method to factorize the processing logic for GetMinium, GetMaximum
195 double ComputeExtremum(const char *columname, double errVal, bool (*cmp)(double, double));
196
197protected:
198 friend TBranch *ROOT::Internal::TreeUtils::CallBranchImpRef(TTree &tree, const char *branchname, TClass *ptrClass,
199 EDataType datatype, void *addobj, Int_t bufsize,
200 Int_t splitlevel);
201 friend TBranch *ROOT::Internal::TreeUtils::CallBranchImp(TTree &tree, const char *branchname, TClass *ptrClass,
202 void *addobj, Int_t bufsize, Int_t splitlevel);
203 virtual void KeepCircular();
204 virtual TBranch *BranchImp(const char* branchname, const char* classname, TClass* ptrClass, void* addobj, Int_t bufsize, Int_t splitlevel);
205 virtual TBranch *BranchImp(const char* branchname, TClass* ptrClass, void* addobj, Int_t bufsize, Int_t splitlevel);
206 virtual TBranch *BranchImpRef(const char* branchname, const char* classname, TClass* ptrClass, void* addobj, Int_t bufsize, Int_t splitlevel);
207 virtual TBranch *BranchImpRef(const char* branchname, TClass* ptrClass, EDataType datatype, void* addobj, Int_t bufsize, Int_t splitlevel);
208 virtual TBranch *BranchImpArr(const char* branchname, EDataType datatype, std::size_t N, void* addobj, Int_t bufsize, Int_t splitlevel);
209 virtual Int_t CheckBranchAddressType(TBranch* branch, TClass* ptrClass, EDataType datatype, bool ptr);
210 virtual TBranch *BronchExec(const char* name, const char* classname, void* addobj, bool isptrptr, Int_t bufsize, Int_t splitlevel);
211 friend TBranch *TTreeBranchImpRef(TTree *tree, const char* branchname, TClass* ptrClass, EDataType datatype, void* addobj, Int_t bufsize, Int_t splitlevel);
212 Int_t SetBranchAddressImp(TBranch *branch, void *addr, TBranch **ptr);
213
214 Long64_t GetCacheAutoSize(bool withDefault = false);
215 char GetNewlineValue(std::istream &inputStream);
216 void ImportClusterRanges(TTree *fromtree);
217 void MoveReadCache(TFile *src, TDirectory *dir);
218 Int_t SetCacheSizeAux(bool autocache = true, Long64_t cacheSize = 0);
219
220 TBranch *GetBranchFromSelf(const char *branchName);
221 TBranch *GetBranchFromFriends(const char *branchName);
222 // This overload is used when setting the branch address of friends of this tree. When registering the branches
223 // to be found later, we can't know a priori which friend will have branch 'bname'. TTree and TChain have different
224 // ways to deal with the fact that we should not print spurious error messages that a branch cannot be found
225 // if it is not in one particular friend but in another
226 virtual Int_t SetBranchAddress(const char *bname, void *add, TBranch **ptr, TClass *realClass, EDataType datatype,
227 bool isptr, bool suppressMissingBranchError);
228
229 // Group of methods to help better separating logic used in GetLeaf
230 TBranch *FindBranchFromSelf(const char *branchName);
231 TBranch *FindBranchFromFriends(const char *branchName);
232 TLeaf *SearchLeafInListOfLeaves(const char *branchName, const char *leafName);
233 TLeaf *SearchLeafInListOfFriends(const char *branchName, const char *leafName);
234
236 // Helper class to prevent infinite recursion in the
237 // usage of TTree Friends. Implemented in TTree.cxx.
238 TTree *fTree; // Pointer to the locked tree
239 UInt_t fMethodBit; // BIT for the locked method
240 bool fPrevious; // Previous value of the BIT.
241
242 protected:
243 TFriendLock(const TFriendLock&);
245
246 public:
247 TFriendLock(TTree* tree, UInt_t methodbit);
248 ~TFriendLock();
249 };
250 friend class TFriendLock;
251 // So that the index class can use TFriendLock:
252 friend class TTreeIndex;
253 friend class TChainIndex;
254 // So that the TTreeCloner can access the protected interfaces
255 friend class TTreeCloner;
256
257 // use to update fFriendLockStatus
269// clang++ <v20 (-Wshadow) complains about shadowing TError.h global variable kPrint. Let's silence warning:
270#if defined(__clang__) && __clang_major__ < 20
271#pragma clang diagnostic push
272#pragma clang diagnostic ignored "-Wshadow"
273#endif
274 kPrint = BIT(10),
275#if defined(__clang__) && __clang_major__ < 20
276#pragma clang diagnostic pop
277#endif
281 };
282
283public:
284 /// Used as the max value for any TTree range operation.
285 /// The maximum number of entries allowed in a TTree is strictly smaller than this value
286 /// (`maxTreeEntries<= kMaxEntries-1`), ie the last entry index is at maximum `kMaxEntries-2`.
288
289 // SetBranchAddress return values
306
307 // TTree status bits
311 /// If set, the branch's buffers will grow until an event cluster boundary is hit,
312 /// guaranteeing a basket per cluster. This mode does not provide any guarantee on the
313 /// memory bounds in the case of extremely large events.
315 /// If set, signals that this TTree is the output of the processing of another TTree, and
316 /// the entries are reshuffled w.r.t. to the original TTree. As a safety measure, a TTree
317 /// with this bit set cannot add friends nor can be added as a friend. If you know what
318 /// you are doing, you can manually unset this bit with `ResetBit(EStatusBits::kEntriesReshuffled)`.
319 kEntriesReshuffled = BIT(19) // bits 15-18 are used by TChain
320 };
321
322 // Split level modifier
323 enum {
325 };
326
328 {
329 private:
330 TTree *fTree; // TTree upon which we are iterating.
331 Int_t fClusterRange; // Which cluster range are we looking at.
332 Long64_t fStartEntry; // Where does the cluster start.
333 Long64_t fNextEntry; // Where does the cluster end (exclusive).
334 Long64_t fEstimatedSize; // If positive, the calculated estimated tree size.
335
337
338 protected:
339 friend class TTree;
340 TClusterIterator(TTree *tree, Long64_t firstEntry);
341
342 public:
343 // Intentionally used the default copy constructor and default destructor
344 // as the TClusterIterator does not own the TTree.
345 // TClusterIterator(const TClusterIterator&);
346 // ~TClusterIterator();
347
348 // No public constructors, the iterator must be
349 // created via TTree::GetClusterIterator
350
351 // Move on to the next cluster and return the starting entry
352 // of this next cluster
353 Long64_t Next();
354
355 // Move on to the previous cluster and return the starting entry
356 // of this previous cluster
358
359 // Return the start entry of the current cluster.
361 return fStartEntry;
362 }
363
364 // Return the first entry of the next cluster.
366 return fNextEntry;
367 }
368
369 Long64_t operator()() { return Next(); }
370 };
371
372 TTree();
373 TTree(const char* name, const char* title, Int_t splitlevel = 99, TDirectory* dir = gDirectory);
374 ~TTree() override;
375
376 TTree(const TTree& tt) = delete;
377 TTree& operator=(const TTree& tt) = delete;
378
379 virtual Int_t AddBranchToCache(const char *bname, bool subbranches = false);
380 virtual Int_t AddBranchToCache(TBranch *branch, bool subbranches = false);
381 virtual Int_t DropBranchFromCache(const char *bname, bool subbranches = false);
382 virtual Int_t DropBranchFromCache(TBranch *branch, bool subbranches = false);
383 void AddClone(TTree*);
384 virtual TFriendElement *AddFriend(const char* treename, const char* filename = "");
385 virtual TFriendElement *AddFriend(const char* treename, TFile* file);
386 virtual TFriendElement *AddFriend(TTree* tree, const char* alias = "", bool warn = false);
387 // As the TBasket invokes Add{Tot,Zip}Bytes on its parent tree, we must do these updates in a thread-safe
388 // manner only when we are flushing multiple baskets in parallel.
389 virtual void AddTotBytes(Int_t tot) { if (fIMTFlush) { fIMTTotBytes += tot; } else { fTotBytes += tot; } }
390 virtual void AddZipBytes(Int_t zip) { if (fIMTFlush) { fIMTZipBytes += zip; } else { fZipBytes += zip; } }
391// NOTE: these counters aren't thread safe like the ones above.
392#ifdef R__TRACK_BASKET_ALLOC_TIME
393 void AddAllocationTime(ULong64_t time) { fAllocationTime += time; }
394#endif
396 virtual Long64_t AutoSave(Option_t* option = "");
397
398 /// Add a new branch, and infer the data type from the type of `obj` being passed.
399 ///
400 /// \note This and the next overload should cover most cases for creating a branch. Try to use these two whenever
401 /// possible, unless e.g. type conversions are needed.
402 ///
403 /// \param[in] name Name of the branch to be created.
404 /// \param[in] obj Address of the object to be added. Make sure to pass a pointer to the actual type/class that
405 /// should be stored in the tree (no pointers to base classes). When calling Fill(), the current value of the type/object will be saved.
406 /// \param[in] bufsize The buffer size in bytes for this branch. When the buffer is full, it is compressed and written to disc.
407 /// 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).
408 /// A small value for bufsize is beneficial if entries in the Tree are accessed randomly and the Tree is in split mode.
409 /// \param[in] splitlevel If T is a class or struct and splitlevel > 0, the members of the object are serialised as separate branches.
410 /// \return Pointer to the TBranch that was created. The branch is owned by the tree.
411 template <class T> TBranch *Branch(const char* name, T* obj, Int_t bufsize = 32000, Int_t splitlevel = 99)
412 {
413 return BranchImpRef(name, TClass::GetClass<T>(), TDataType::GetType(typeid(T)), obj, bufsize, splitlevel);
414 }
415
416 /// Add a new branch, and infer the data type from the array `addobj` being passed.
417 ///
418 /// \note This and the previous overload should cover most cases for creating a branch. Try to use these two whenever
419 /// possible, unless e.g. type conversions are needed.
420 ///
421 /// \param[in] name Name of the branch to be created.
422 /// \param[in] addobj Array of the objects to be added. When calling Fill(), the current value of the type/object will be saved.
423 /// \param[in] bufsize he buffer size in bytes for this branch. When the buffer is full, it is compressed and written to disc.
424 /// 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).
425 /// A small value for bufsize is beneficial if entries in the Tree are accessed randomly and the Tree is in split mode.
426 /// \param[in] splitlevel If T is a class or struct and splitlevel > 0, the members of the object are serialised as separate branches.
427 /// \return Pointer to the TBranch that was created. The branch is owned by the tree.
428 template <class T> TBranch *Branch(const char* name, T** addobj, Int_t bufsize = 32000, Int_t splitlevel = 99)
429 {
430 return BranchImp(name, TClass::GetClass<T>(), addobj, bufsize, splitlevel);
431 }
432
433 virtual Int_t Branch(TCollection* list, Int_t bufsize = 32000, Int_t splitlevel = 99, const char* name = "");
434 virtual Int_t Branch(TList* list, Int_t bufsize = 32000, Int_t splitlevel = 99);
435 virtual Int_t Branch(const char* folder, Int_t bufsize = 32000, Int_t splitlevel = 99);
436 virtual TBranch *Branch(const char* name, void* address, const char* leaflist, Int_t bufsize = 32000);
437 TBranch *Branch(const char* name, char* address, const char* leaflist, Int_t bufsize = 32000)
438 {
439 // Overload to avoid confusion between this signature and the template instance.
440 return Branch(name,(void*)address,leaflist,bufsize);
441 }
442 TBranch *Branch(const char* name, Longptr_t address, const char* leaflist, Int_t bufsize = 32000)
443 {
444 // Overload to avoid confusion between this signature and the template instance.
445 return Branch(name,(void*)address,leaflist,bufsize);
446 }
447 TBranch *Branch(const char* name, int address, const char* leaflist, Int_t bufsize = 32000)
448 {
449 // Overload to avoid confusion between this signature and the template instance.
450 return Branch(name,(void*)(Longptr_t)address,leaflist,bufsize);
451 }
452 virtual TBranch *Branch(const char* name, const char* classname, void* addobj, Int_t bufsize = 32000, Int_t splitlevel = 99);
453 template <class T> TBranch *Branch(const char* name, const char* classname, T* obj, Int_t bufsize = 32000, Int_t splitlevel = 99)
454 {
455 // See BranchImpRed for details. Here we __ignore
456 return BranchImpRef(name, classname, TClass::GetClass<T>(), obj, bufsize, splitlevel);
457 }
458 template <class T> TBranch *Branch(const char* name, const char* classname, T** addobj, Int_t bufsize = 32000, Int_t splitlevel = 99)
459 {
460 // See BranchImp for details
461 return BranchImp(name, classname, TClass::GetClass<T>(), addobj, bufsize, splitlevel);
462 }
463 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)
464 {
465 TClass *cl = TClass::GetClass<T>();
466 if (cl) {
467 TClass *arrCl = TClass::GetClass<std::array<T, N>>();
468 Error("Branch","std::array of objects not yet supported as top level branch object (the class is %s)",
469 arrCl ? arrCl->GetName() : cl->GetName());
470 return nullptr;
471 }
472 return BranchImpArr(name, TDataType::GetType(typeid(T)), N, obj, bufsize, splitlevel);
473 }
474 virtual TBranch *Bronch(const char* name, const char* classname, void* addobj, Int_t bufsize = 32000, Int_t splitlevel = 99);
475 virtual TBranch *BranchOld(const char* name, const char* classname, void* addobj, Int_t bufsize = 32000, Int_t splitlevel = 1);
476 virtual TBranch *BranchRef();
477 void Browse(TBrowser*) override;
478 virtual Int_t BuildIndex(const char *majorname, const char *minorname = "0", bool long64major = false, bool long64minor = false);
479 /// Build index with only a major formula. Minor formula will be set to "0" ie skip.
480 /// \see TTree::BuildIndex(const char *, const char *, bool, bool)
481 Int_t BuildIndex(const char *majorname, bool long64major) { return BuildIndex(majorname, "0", long64major, false); }
482 TStreamerInfo *BuildStreamerInfo(TClass* cl, void *pointer = nullptr, bool canOptimize = true);
483 virtual TFile *ChangeFile(TFile* file);
484 virtual TTree *CloneTree(Long64_t nentries = -1, Option_t* option = "");
485 virtual void CopyAddresses(TTree*,bool undo = false);
486 virtual Long64_t CopyEntries(TTree* tree, Long64_t nentries = -1, Option_t *option = "", bool needCopyAddresses = false);
487 virtual TTree *CopyTree(const char* selection, Option_t* option = "", Long64_t nentries = kMaxEntries, Long64_t firstentry = 0);
488 virtual TBasket *CreateBasket(TBranch*);
489 virtual void DirectoryAutoAdd(TDirectory *);
490 Int_t Debug() const { return fDebug; }
491 void Delete(Option_t* option = "") override; // *MENU*
492 void Draw(Option_t* opt) override { Draw(opt, "", "", kMaxEntries, 0); }
493 virtual Long64_t Draw(const char* varexp, const TCut& selection, Option_t* option = "", Long64_t nentries = kMaxEntries, Long64_t firstentry = 0);
494 virtual Long64_t Draw(const char* varexp, const char* selection, Option_t* option = "", Long64_t nentries = kMaxEntries, Long64_t firstentry = 0); // *MENU*
495 virtual void DropBaskets();
496 virtual void DropBuffers(Int_t nbytes);
497 bool EnableCache();
498 virtual Int_t Fill();
499 virtual TBranch *FindBranch(const char* name);
500 virtual TLeaf *FindLeaf(const char* name);
501 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*
502 virtual Int_t FlushBaskets(bool create_cluster = true) const;
503 virtual const char *GetAlias(const char* aliasName) const;
505#ifdef R__TRACK_BASKET_ALLOC_TIME
506 ULong64_t GetAllocationTime() const { return fAllocationTime; }
507#endif
508 virtual Long64_t GetAutoFlush() const {return fAutoFlush;}
509 virtual Long64_t GetAutoSave() const {return fAutoSave;}
510 virtual TBranch *GetBranch(const char* name);
511 virtual TBranchRef *GetBranchRef() const { return fBranchRef; };
512 virtual bool GetBranchStatus(const char* branchname) const;
513 static Int_t GetBranchStyle();
514 virtual Long64_t GetCacheSize() const { return fCacheSize; }
515 virtual TClusterIterator GetClusterIterator(Long64_t firstentry);
516 virtual Long64_t GetChainEntryNumber(Long64_t entry) const { return entry; }
517 virtual Long64_t GetChainOffset() const { return fChainOffset; }
518 virtual bool GetClusterPrefetch() const { return fCacheDoClusterPrefetch; }
519 TFile *GetCurrentFile() const;
521 Long64_t GetDebugMax() const { return fDebugMax; }
522 Long64_t GetDebugMin() const { return fDebugMin; }
523 TDirectory *GetDirectory() const { return fDirectory; }
524 virtual Long64_t GetEntries() const { return fEntries; }
525 virtual Long64_t GetEntries(const char *selection);
526 /// Return a number greater or equal to the total number of entries in the
527 /// dataset.
528 ///
529 /// \note If you are interested in the total number of entries in a TChain,
530 /// this function will give that number once the last file of the chain
531 /// is opened. In general, using this instead of GetEntries will avoid
532 /// opening all files in the chain which could be very costly for very
533 /// large number of files stored at a remote location.
534 ///
535 /// The logic depends on whether the dataset is a TTree or a TChain. In the
536 /// first case, it simply returns the total number of entries in the tree. In
537 /// the latter case, it depends on which point of the processing of the chain
538 /// this function is called. During most of the chain processing, this
539 /// function will return TTree::kMaxEntries. When the chain arrives at the
540 /// last file, then the function will return the accumulated total number of
541 /// entries in the whole chain. A notable use case where this function
542 /// becomes quite useful is when writing the following for loop to traverse
543 /// the entries in the dataset:
544 ///
545 /// \code{.cpp}
546 /// for(Long64_t ievent = 0; ievent < dataset.GetEntriesFast(); ievent++) {
547 /// // Do something with the event in the dataset
548 /// }
549 /// \endcode
550 ///
551 /// In the example above, independently on whether the dataset is a TTree or
552 /// a TChain, the GetEntriesFast call will provide the correct stopping
553 /// condition for the loop (i.e. the total number of entries). In the TChain
554 /// case, calling GetEntries instead would open all the files in the chain
555 /// upfront which could be costly.
556 ///
557 /// The functionality offered by this method can also be seen when used in
558 /// conjunction with LoadTree. For a call like <tt> LoadTree(ievent) </tt>,
559 /// the condition <tt> ievent < dataset.GetEntriesFast() </tt> is only
560 /// satisfied if \p ievent is strictly smaller than the total number of
561 /// entries in the dataset. In fact, even when the dataset is a TChain, the
562 /// first time LoadTree is called with an entry number that belongs to the
563 /// last file of the chain, this will update the internal data member of the
564 /// class so that the next call to GetEntriesFast returns the total number
565 /// of entries in the dataset.
566 virtual Long64_t GetEntriesFast() const { return fEntries; }
567 virtual Long64_t GetEntriesFriend() const;
568 virtual Long64_t GetEstimate() const { return fEstimate; }
569 virtual Int_t GetEntry(Long64_t entry, Int_t getall = 0);
570 Int_t GetEvent(Long64_t entry, Int_t getall = 0) { return GetEntry(entry, getall); }
571 virtual Int_t GetEntryWithIndex(Long64_t major, Long64_t minor = 0);
572 virtual Long64_t GetEntryNumberWithBestIndex(Long64_t major, Long64_t minor = 0) const;
573 virtual Long64_t GetEntryNumberWithIndex(Long64_t major, Long64_t minor = 0) const;
574 TEventList *GetEventList() const { return fEventList; }
575 virtual TEntryList *GetEntryList();
576 virtual Long64_t GetEntryNumber(Long64_t entry) const;
577 virtual Int_t GetFileNumber() const { return fFileNumber; }
578 virtual TTree *GetFriend(const char*) const;
579 virtual const char *GetFriendAlias(TTree*) const;
581 virtual bool GetImplicitMT() { return fIMTEnabled; }
582 virtual Int_t *GetIndex() { return &fIndex.fArray[0]; }
583 virtual Double_t *GetIndexValues() { return &fIndexValues.fArray[0]; }
585 virtual TIterator *GetIteratorOnAllLeaves(bool dir = kIterForward);
586 virtual TLeaf *GetLeaf(const char* branchname, const char* leafname);
587 virtual TLeaf *GetLeaf(const char* name);
588 virtual TList *GetListOfClones() { return fClones; }
589 virtual TObjArray *GetListOfBranches() { return &fBranches; }
590 virtual TObjArray *GetListOfLeaves() { return &fLeaves; }
591 virtual TList *GetListOfFriends() const { return fFriends; }
592 virtual TList *GetListOfAliases() const { return fAliases; }
593
594 // GetMakeClass is left non-virtual for efficiency reason.
595 // Making it virtual affects the performance of the I/O
596 Int_t GetMakeClass() const { return fMakeClass; }
597
598 virtual Long64_t GetMaxEntryLoop() const { return fMaxEntryLoop; }
599 virtual Double_t GetMaximum(const char* columname);
600 static Long64_t GetMaxTreeSize();
601 virtual Long64_t GetMaxVirtualSize() const { return fMaxVirtualSize; }
602 virtual Double_t GetMinimum(const char* columname);
604 TObject *GetNotify() const { return fNotify; }
606 virtual Int_t GetPacketSize() const { return fPacketSize; }
607 virtual TVirtualPerfStats *GetPerfStats() const { return fPerfStats; }
608 TTreeCache *GetReadCache(TFile *file) const;
609 TTreeCache *GetReadCache(TFile *file, bool create);
610 virtual Long64_t GetReadEntry() const { return fReadEntry; }
611 virtual Long64_t GetReadEvent() const { return fReadEntry; }
612 virtual Int_t GetScanField() const { return fScanField; }
615 virtual Int_t GetTimerInterval() const { return fTimerInterval; }
617 virtual Long64_t GetTotBytes() const { return fTotBytes; }
618 virtual TTree *GetTree() const { return const_cast<TTree*>(this); }
619 virtual TVirtualIndex *GetTreeIndex() const { return fTreeIndex; }
620 virtual Int_t GetTreeNumber() const { return 0; }
622 virtual Int_t GetUpdate() const { return fUpdate; }
623 virtual TList *GetUserInfo();
624 // See TSelectorDraw::GetVar
626 // See TSelectorDraw::GetVar
628 // See TSelectorDraw::GetVar
630 // See TSelectorDraw::GetVar
632 // See TSelectorDraw::GetVar
634 // See TSelectorDraw::GetVal
635 virtual Double_t *GetVal(Int_t i) { return GetPlayer()->GetVal(i); }
636 // See TSelectorDraw::GetVal
637 virtual Double_t *GetV1() { return GetPlayer()->GetV1(); }
638 // See TSelectorDraw::GetVal
639 virtual Double_t *GetV2() { return GetPlayer()->GetV2(); }
640 // See TSelectorDraw::GetVal
641 virtual Double_t *GetV3() { return GetPlayer()->GetV3(); }
642 // See TSelectorDraw::GetVal
643 virtual Double_t *GetV4() { return GetPlayer()->GetV4(); }
644 virtual Double_t *GetW() { return GetPlayer()->GetW(); }
645 virtual Double_t GetWeight() const { return fWeight; }
646 virtual Long64_t GetZipBytes() const { return fZipBytes; }
647 virtual void IncrementTotalBuffers(Int_t nbytes) { fTotalBuffers += nbytes; }
648 bool IsFolder() const override { return true; }
649 virtual bool InPlaceClone(TDirectory *newdirectory, const char *options = "");
650 virtual Int_t LoadBaskets(Long64_t maxmemory = 2000000000);
651 virtual Long64_t LoadTree(Long64_t entry);
652 virtual Long64_t LoadTreeFriend(Long64_t entry, TTree* T);
653 virtual Int_t MakeClass(const char *classname = nullptr, Option_t* option = "");
654 virtual Int_t MakeCode(const char *filename = nullptr);
655 virtual Int_t MakeProxy(const char* classname, const char* macrofilename = nullptr, const char* cutfilename = nullptr, const char* option = nullptr, Int_t maxUnrolling = 3);
656 virtual Int_t MakeSelector(const char *selector = nullptr, Option_t *option = "");
657 bool MemoryFull(Int_t nbytes);
658 virtual Long64_t Merge(TCollection* list, Option_t* option = "");
659 virtual Long64_t Merge(TCollection* list, TFileMergeInfo *info);
660 static TTree *MergeTrees(TList* list, Option_t* option = "");
661 bool Notify() override;
662 virtual void OptimizeBaskets(ULong64_t maxMemory=10000000, Float_t minComp=1.1, Option_t *option="");
663 TPrincipal *Principal(const char* varexp = "", const char* selection = "", Option_t* option = "np", Long64_t nentries = kMaxEntries, Long64_t firstentry = 0);
664 void Print(Option_t* option = "") const override; // *MENU*
665 virtual void PrintCacheStats(Option_t* option = "") const;
666 virtual Long64_t Process(const char* filename, Option_t* option = "", Long64_t nentries = kMaxEntries, Long64_t firstentry = 0); // *MENU*
667 virtual Long64_t Process(TSelector* selector, Option_t* option = "", Long64_t nentries = kMaxEntries, Long64_t firstentry = 0);
668 virtual Long64_t Project(const char* hname, const char* varexp, const char* selection = "", Option_t* option = "", Long64_t nentries = kMaxEntries, Long64_t firstentry = 0);
669 virtual TSQLResult *Query(const char* varexp = "", const char* selection = "", Option_t* option = "", Long64_t nentries = kMaxEntries, Long64_t firstentry = 0);
670 virtual Long64_t ReadFile(const char* filename, const char* branchDescriptor = "", char delimiter = ' ');
671 virtual Long64_t ReadStream(std::istream& inputStream, const char* branchDescriptor = "", char delimiter = ' ');
672 virtual void Refresh();
674 virtual void RemoveExternalFriend(TFriendElement *);
675 virtual void RemoveFriend(TTree*);
676 void RecursiveRemove(TObject *obj) override;
677 virtual void Reset(Option_t* option = "");
678 virtual void ResetAfterMerge(TFileMergeInfo *);
679 virtual void ResetBranchAddress(TBranch *);
680 virtual void ResetBranchAddresses();
681 virtual Long64_t Scan(const char* varexp = "", const char* selection = "", Option_t* option = "", Long64_t nentries = kMaxEntries, Long64_t firstentry = 0); // *MENU*
682 virtual bool SetAlias(const char* aliasName, const char* aliasFormula);
683 virtual void SetAutoSave(Long64_t autos = -300000000);
684 virtual void SetAutoFlush(Long64_t autof = -30000000);
685 virtual void SetBasketSize(const char* bname, Int_t buffsize = 16000);
686 virtual Int_t SetBranchAddress(const char *bname,void *add, TBranch **ptr = nullptr);
687 virtual Int_t SetBranchAddress(const char *bname,void *add, TClass *realClass, EDataType datatype, bool isptr);
688 virtual Int_t SetBranchAddress(const char *bname,void *add, TBranch **ptr, TClass *realClass, EDataType datatype, bool isptr);
689 template <class T> Int_t SetBranchAddress(const char *bname, T **add, TBranch **ptr = nullptr) {
690 TClass *cl = TClass::GetClass<T>();
692 if (!cl) type = TDataType::GetType(typeid(T));
693 return SetBranchAddress(bname,add,ptr,cl,type,true);
694 }
695#ifndef R__NO_CLASS_TEMPLATE_SPECIALIZATION
696 // This can only be used when the template overload resolution can distinguish between
697 // T* and T**
698 template <class T> Int_t SetBranchAddress(const char *bname, T *add, TBranch **ptr = nullptr) {
699 TClass *cl = TClass::GetClass<T>();
701 if (!cl) type = TDataType::GetType(typeid(T));
702 return SetBranchAddress(bname,add,ptr,cl,type,false);
703 }
704#endif
705 virtual void SetBranchStatus(const char* bname, bool status = true, UInt_t* found = nullptr);
706 static void SetBranchStyle(Int_t style = 1); //style=0 for old branch, =1 for new branch style
707 virtual Int_t SetCacheSize(Long64_t cachesize = -1);
708 virtual Int_t SetCacheEntryRange(Long64_t first, Long64_t last);
709 virtual void SetCacheLearnEntries(Int_t n=10);
711 virtual void SetCircular(Long64_t maxEntries);
712 /// Enables (or disables) the early decompression of the baskets of the current cluster
713 /// (whose compressed data is already in memory if used in conjunction with the TTreeCache).
714 /// This affects performance only in conjunction with non-sequential use/load/read of the entries, ie
715 /// within a cluster you can have cheap random access to the entries (instead of having to decompress again and again).
716 /// \note This setting is totally different from SetCacheSize and from TFile.AsyncPrefetching, which save read calls
717 virtual void SetClusterPrefetch(bool enabled) { fCacheDoClusterPrefetch = enabled; }
718 virtual void SetDebug(Int_t level = 1, Long64_t min = 0, Long64_t max = 9999999); // *MENU*
719 virtual void SetDefaultEntryOffsetLen(Int_t newdefault, bool updateExisting = false);
720 virtual void SetDirectory(TDirectory* dir);
721 virtual Long64_t SetEntries(Long64_t n = -1);
722 virtual void SetEstimate(Long64_t nentries = 1000000);
724 virtual void SetFileNumber(Int_t number = 0);
725 virtual void SetEventList(TEventList* list);
726 virtual void SetEntryList(TEntryList* list, Option_t *opt="");
727 virtual void SetImplicitMT(bool enabled) { fIMTEnabled = enabled; }
728 virtual void SetMakeClass(Int_t make);
729 virtual void SetMaxEntryLoop(Long64_t maxev = kMaxEntries) { fMaxEntryLoop = maxev; } // *MENU*
730 static void SetMaxTreeSize(Long64_t maxsize = 100000000000LL);
731 virtual void SetMaxVirtualSize(Long64_t size = 0) { fMaxVirtualSize = size; } // *MENU*
732 void SetName(const char* name) override; // *MENU*
733
734 /**
735 * @brief Sets the address of the object to be notified when the tree is loaded.
736 *
737 * The method TObject::Notify is called for the given object when the tree
738 * is loaded. Specifically this occurs in the TTree::LoadTree method. To
739 * remove the notification call this method with nullptr:
740 * @code tree->SetNotify(nullptr); @endcode
741 *
742 * If this is a TChain, `obj` is most often going to be a TNotifyLink.
743 *
744 * @param[in] obj Pointer to a TObject to be notified.
745 */
746 virtual void SetNotify(TObject* obj);
747
748 virtual void SetObject(const char* name, const char* title);
749 virtual void SetParallelUnzip(bool opt=true, Float_t RelSize=-1);
750 virtual void SetPerfStats(TVirtualPerfStats* perf);
751 /**
752 * \brief Sets the default maximum number of lines to be shown before `<CR>` when calling Scan().
753 * \param n the maximum number of lines. Default=50, if 0, all entries of the Tree are shown
754 * and there is no need to press `<CR>` or `q` to exit the function.
755 * \note See TTreePlayer::Scan for more details on how to redirect the output to an ASCII file
756 */
757 virtual void SetScanField(Int_t n = 50) { fScanField = n; } // *MENU*
759 virtual void SetTimerInterval(Int_t msec = 333) { fTimerInterval=msec; }
760 virtual void SetTreeIndex(TVirtualIndex* index);
761 virtual void SetWeight(Double_t w = 1, Option_t* option = "");
762 virtual void SetUpdate(Int_t freq = 0) { fUpdate = freq; }
763 virtual void Show(Long64_t entry = -1, Int_t lenmax = 20);
764 virtual void StartViewer(); // *MENU*
766 virtual Int_t UnbinnedFit(const char* funcname, const char* varexp, const char* selection = "", Option_t* option = "", Long64_t nentries = kMaxEntries, Long64_t firstentry = 0);
767 void UseCurrentStyle() override;
768 Int_t Write(const char *name=nullptr, Int_t option=0, Int_t bufsize=0) override;
769 Int_t Write(const char *name=nullptr, Int_t option=0, Int_t bufsize=0) const override;
770
771 ClassDefOverride(TTree, 20) // Tree descriptor (the main ROOT I/O class)
772};
773
775/// For the Python bindings: call the TTree::Branch() overload that takes the
776/// address of a pointer, with that address worked out by cppyy from a T**.
777template <class T>
778TBranch *BranchPtrToPtr(TTree &tree, const char *name, const char *className, T **obj, Int_t bufsize = 32000,
779 Int_t splitlevel = 99)
780{
781 return tree.Branch(name, className, reinterpret_cast<void **>(obj), bufsize, splitlevel);
782}
783} // namespace ROOT::Internal::TreeUtils
784
785//////////////////////////////////////////////////////////////////////////
786// //
787// TTreeFriendLeafIter //
788// //
789// Iterator on all the leaves in a TTree and its friend //
790// //
791//////////////////////////////////////////////////////////////////////////
792
794
795protected:
796 TTree *fTree; ///< tree being iterated
797 TIterator *fLeafIter; ///< current leaf sub-iterator.
798 TIterator *fTreeIter; ///< current tree sub-iterator.
799 bool fDirection; ///< iteration direction
800
801 TTreeFriendLeafIter() : fTree(nullptr), fLeafIter(nullptr), fTreeIter(nullptr),
802 fDirection(false) { }
803
804public:
805 TTreeFriendLeafIter(const TTree* t, bool dir = kIterForward);
808 TIterator &operator=(const TIterator &rhs) override;
810
811 const TCollection *GetCollection() const override { return nullptr; }
812 Option_t *GetOption() const override;
813 TObject *Next() override;
815 bool operator !=(const TIterator&) const override {
816 // TODO: Implement me
817 return false;
818 }
819 bool operator !=(const TTreeFriendLeafIter&) const {
820 // TODO: Implement me
821 return false;
822 }
823 TObject *operator*() const override {
824 // TODO: Implement me
825 return nullptr;
826 }
827 ClassDefOverride(TTreeFriendLeafIter,0) //Linked list iterator
828 };
829
830
831#endif
#define SafeDelete(p)
Definition RConfig.hxx:507
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
int Int_t
Signed integer 4 bytes (int)
Definition RtypesCore.h:60
long Longptr_t
Integer large enough to hold a pointer (platform-dependent)
Definition RtypesCore.h:90
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int)
Definition RtypesCore.h:61
float Float_t
Float 4 bytes (float)
Definition RtypesCore.h:72
double Double_t
Double 8 bytes.
Definition RtypesCore.h:74
long long Long64_t
Portable signed long integer 8 bytes.
Definition RtypesCore.h:84
unsigned long long ULong64_t
Portable unsigned long integer 8 bytes.
Definition RtypesCore.h:85
const char Option_t
Option string (const char)
Definition RtypesCore.h:81
#define BIT(n)
Definition Rtypes.h:90
#define ClassDefOverride(name, id)
Definition Rtypes.h:347
const Bool_t kIterForward
Definition TCollection.h:42
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:142
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:21
Line Attributes class.
Definition TAttLine.h:21
Marker Attributes class.
Definition TAttMarker.h:22
Manages buffers for branches of a Tree.
Definition TBasket.h:34
A Branch for the case of an object.
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:71
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 file, usually with extension .root, that stores data and code in the form of serialized objects in ...
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:1096
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:793
bool operator!=(const TIterator &) const override
Compare two iterator objects.
Definition TTree.h:815
const TCollection * GetCollection() const override
Definition TTree.h:811
TTree * fTree
tree being iterated
Definition TTree.h:796
TObject * operator*() const override
Return current object or nullptr.
Definition TTree.h:823
void Reset() override
Definition TTree.h:814
TIterator & operator=(const TIterator &rhs) override
Overridden assignment operator. Does NOT copy the 'cursor' location!
Definition TTree.cxx:10219
~TTreeFriendLeafIter() override
Definition TTree.h:807
TObject * Next() override
Go the next friend element.
Definition TTree.cxx:10242
TIterator * fLeafIter
current leaf sub-iterator.
Definition TTree.h:797
Option_t * GetOption() const override
Returns the object option stored in the list.
Definition TTree.cxx:10281
TIterator * fTreeIter
current tree sub-iterator.
Definition TTree.h:798
bool fDirection
iteration direction
Definition TTree.h:799
A Tree Index with majorname and minorname.
Definition TTreeIndex.h:29
Helper class to iterate over cluster of baskets.
Definition TTree.h:328
Long64_t GetEstimatedClusterSize()
Estimate the cluster size.
Definition TTree.cxx:639
Long64_t Previous()
Move on to the previous cluster and return the starting entry of this previous cluster.
Definition TTree.cxx:722
Long64_t GetStartEntry()
Definition TTree.h:360
Long64_t operator()()
Definition TTree.h:369
Long64_t Next()
Move on to the next cluster and return the starting entry of this next cluster.
Definition TTree.cxx:678
Long64_t GetNextEntry()
Definition TTree.h:365
Long64_t fEstimatedSize
Definition TTree.h:334
TClusterIterator(TTree *tree, Long64_t firstEntry)
Regular constructor.
Definition TTree.cxx:588
Helper class to prevent infinite recursion in the usage of TTree Friends.
Definition TTree.h:235
TFriendLock & operator=(const TFriendLock &)
Assignment operator.
Definition TTree.cxx:554
UInt_t fMethodBit
Definition TTree.h:239
TTree * fTree
Definition TTree.h:238
~TFriendLock()
Restore the state of tree the same as before we set the lock.
Definition TTree.cxx:567
A TTree represents a columnar dataset.
Definition TTree.h:95
virtual Int_t Fill()
Fill all branches.
Definition TTree.cxx:4676
virtual TFriendElement * AddFriend(const char *treename, const char *filename="")
Add a TFriendElement to the list of friends.
Definition TTree.cxx:1360
double ComputeExtremum(const char *columname, double errVal, bool(*cmp)(double, double))
Computes the extremum (minimum or maximum) for the input column name.
Definition TTree.cxx:6458
TBranchRef * fBranchRef
Branch supporting the TRefTable (if any)
Definition TTree.h:152
TStreamerInfo * BuildStreamerInfo(TClass *cl, void *pointer=nullptr, bool canOptimize=true)
Build StreamerInfo for class cl.
Definition TTree.cxx:2683
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:5407
virtual Int_t SetBranchAddress(const char *bname, void *add, TBranch **ptr, TClass *realClass, EDataType datatype, bool isptr, bool suppressMissingBranchError)
Definition TTree.cxx:8835
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:4971
virtual TVirtualPerfStats * GetPerfStats() const
Definition TTree.h:607
virtual void SetTimerInterval(Int_t msec=333)
Definition TTree.h:759
virtual void SetBranchStatus(const char *bname, bool status=true, UInt_t *found=nullptr)
Set branch status to Process or DoNotProcess.
Definition TTree.cxx:8939
TTreeFormula * GetSelect()
Definition TTree.h:613
bool EnableCache()
Enable the TTreeCache unless explicitly disabled for this TTree by a prior call to SetCacheSize(0).
Definition TTree.cxx:2716
virtual TBranch * GetBranch(const char *name)
Return pointer to the branch with the given name in this tree or its friends.
Definition TTree.cxx:5459
virtual Int_t GetScanField() const
Definition TTree.h:612
static Int_t GetBranchStyle()
Static function returning the current branch style.
Definition TTree.cxx:5500
TList * fFriends
pointer to list of friend elements
Definition TTree.h:146
bool fIMTEnabled
! true if implicit multi-threading is enabled for this tree
Definition TTree.h:158
virtual Long64_t GetChainEntryNumber(Long64_t entry) const
Definition TTree.h:516
virtual bool GetBranchStatus(const char *branchname) const
Return status of branch with name branchname.
Definition TTree.cxx:5485
UInt_t fFriendLockStatus
! Record which method is locking the friend recursion
Definition TTree.h:153
Long64_t fTotBytes
Total number of bytes in all branches before compression.
Definition TTree.h:102
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:5207
Int_t GetDefaultEntryOffsetLen() const
Definition TTree.h:520
Int_t fMaxClusterRange
! Memory allocated for the cluster range.
Definition TTree.h:112
virtual void Show(Long64_t entry=-1, Int_t lenmax=20)
Print values of all active leaves for entry.
Definition TTree.cxx:9810
TEventList * fEventList
! Pointer to event selection list (if one)
Definition TTree.h:141
virtual Long64_t GetAutoSave() const
Definition TTree.h:509
virtual Int_t StopCacheLearningPhase()
Stop the cache learning phase.
Definition TTree.cxx:9899
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:5747
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:160
virtual void SetCircular(Long64_t maxEntries)
Enable/Disable circularity for this tree.
Definition TTree.cxx:9306
virtual Long64_t GetEstimate() const
Definition TTree.h:568
Long64_t GetDebugMax() const
Definition TTree.h:521
Long64_t fSavedBytes
Number of autosaved bytes.
Definition TTree.h:104
virtual Int_t AddBranchToCache(const char *bname, bool subbranches=false)
Add branch with name bname to the Tree cache.
Definition TTree.cxx:1087
Long64_t GetMedianClusterSize()
Estimate the median cluster size for the TTree.
Definition TTree.cxx:8649
virtual TClusterIterator GetClusterIterator(Long64_t firstentry)
Return an iterator over the cluster of baskets starting at firstentry.
Definition TTree.cxx:5572
virtual void ResetBranchAddress(TBranch *)
Tell a branch to set its address to zero.
Definition TTree.cxx:8403
bool fCacheUserSet
! true if the cache setting was explicitly given by user
Definition TTree.h:157
char GetNewlineValue(std::istream &inputStream)
Determine which newline this file is using.
Definition TTree.cxx:7926
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:428
TIOFeatures fIOFeatures
IO features to define for newly-written baskets and branches.
Definition TTree.h:130
virtual Long64_t GetSelectedRows()
Definition TTree.h:614
void AddAllocationCount(UInt_t count)
Definition TTree.h:395
virtual void SetMaxEntryLoop(Long64_t maxev=kMaxEntries)
Definition TTree.h:729
virtual Long64_t GetEntryNumberWithIndex(Long64_t major, Long64_t minor=0) const
Return entry number corresponding to major and minor number.
Definition TTree.cxx:6019
Long64_t fDebugMin
! First entry number to debug
Definition TTree.h:128
virtual Long64_t SetEntries(Long64_t n=-1)
Change number of entries in the tree.
Definition TTree.cxx:9425
virtual TObjArray * GetListOfLeaves()
Definition TTree.h:590
TLeaf * SearchLeafInListOfLeaves(const char *branchName, const char *leafName)
Definition TTree.cxx:6227
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:2105
virtual Int_t GetEntryWithIndex(Long64_t major, Long64_t minor=0)
Read entry corresponding to major and minor number.
Definition TTree.cxx:6037
Long64_t GetCacheAutoSize(bool withDefault=false)
Used for automatic sizing of the cache.
Definition TTree.cxx:5512
virtual TBranch * BranchRef()
Build the optional branch supporting the TRefTable.
Definition TTree.cxx:2359
TFile * GetCurrentFile() const
Return pointer to the current file.
Definition TTree.cxx:5584
TObject * GetNotify() const
Definition TTree.h:604
TList * fAliases
List of aliases for expressions based on the tree branches.
Definition TTree.h:140
TBranch * Branch(const char *name, Longptr_t address, const char *leaflist, Int_t bufsize=32000)
Definition TTree.h:442
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:3760
virtual Int_t DropBranchFromCache(const char *bname, bool subbranches=false)
Remove the branch with name 'bname' from the Tree cache.
Definition TTree.cxx:1170
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:5157
Long64_t * fClusterRangeEnd
[fNClusterRange] Last entry of a cluster range.
Definition TTree.h:119
std::atomic< Long64_t > fIMTZipBytes
! Zip bytes for the IMT flush baskets.
Definition TTree.h:177
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:8219
TVirtualTreePlayer * GetPlayer()
Load the TTreePlayer (if not already done).
Definition TTree.cxx:6561
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:7032
Float_t fTargetMemoryRatio
! Ratio for memory usage in uncompressed buffers versus actual occupancy.
Definition TTree.h:162
virtual Double_t * GetIndexValues()
Definition TTree.h:583
virtual TList * GetListOfAliases() const
Definition TTree.h:592
virtual Long64_t ReadStream(std::istream &inputStream, const char *branchDescriptor="", char delimiter=' ')
Create or simply read branches from an input stream.
Definition TTree.cxx:7953
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:9342
Int_t fScanField
Number of runs before prompting in Scan.
Definition TTree.h:108
virtual Double_t GetWeight() const
Definition TTree.h:645
void Draw(Option_t *opt) override
Default Draw method for all objects.
Definition TTree.h:492
virtual TTree * GetFriend(const char *) const
Return a pointer to the TTree friend whose name or alias is friendname.
Definition TTree.cxx:6085
TTreeFormula * GetVar(Int_t i)
Definition TTree.h:625
virtual void SetNotify(TObject *obj)
Sets the address of the object to be notified when the tree is loaded.
Definition TTree.cxx:9656
virtual Double_t GetMaximum(const char *columname)
Return maximum of column with name columname.
Definition TTree.cxx:6535
virtual Long64_t GetEntryNumberWithBestIndex(Long64_t major, Long64_t minor=0) const
Return entry number corresponding to major and minor number.
Definition TTree.cxx:5999
static void SetMaxTreeSize(Long64_t maxsize=100000000000LL)
Set the maximum size in bytes of a Tree file (static function).
Definition TTree.cxx:9622
void Print(Option_t *option="") const override
Print a summary of the tree contents.
Definition TTree.cxx:7559
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:10130
Int_t fNClusterRange
Number of Cluster range in addition to the one defined by 'AutoFlush'.
Definition TTree.h:111
virtual void PrintCacheStats(Option_t *option="") const
Print statistics about the TreeCache for this tree.
Definition TTree.cxx:7711
TVirtualTreePlayer * fPlayer
! Pointer to current Tree player
Definition TTree.h:150
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:6222
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:9602
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:7352
virtual void IncrementTotalBuffers(Int_t nbytes)
Definition TTree.h:647
TObjArray fBranches
List of Branches.
Definition TTree.h:138
TDirectory * GetDirectory() const
Definition TTree.h:523
bool fCacheDoAutoInit
! true if cache auto creation or resize check is needed
Definition TTree.h:155
TTreeCache * GetReadCache(TFile *file) const
Find and return the TTreeCache registered with the file and which may contain branches for us.
Definition TTree.cxx:6574
Long64_t fEntries
Number of entries.
Definition TTree.h:100
virtual TFile * ChangeFile(TFile *file)
Called by TTree::Fill() when file has reached its maximum fgMaxTreeSize.
Definition TTree.cxx:2780
virtual TEntryList * GetEntryList()
Returns the entry list assigned to this tree.
Definition TTree.cxx:5963
virtual void SetWeight(Double_t w=1, Option_t *option="")
Set tree weight.
Definition TTree.cxx:9799
void InitializeBranchLists(bool checkLeafCount)
Divides the top-level branches into two vectors: (i) branches to be processed sequentially and (ii) b...
Definition TTree.cxx:5890
Long64_t * fClusterSize
[fNClusterRange] Number of entries in each cluster for a given range.
Definition TTree.h:120
Long64_t fFlushedBytes
Number of auto-flushed bytes.
Definition TTree.h:105
virtual void SetPerfStats(TVirtualPerfStats *perf)
Set perf stats.
Definition TTree.cxx:9754
TTreeFormula * GetVar2()
Definition TTree.h:629
std::atomic< Long64_t > fIMTTotBytes
! Total bytes for the IMT flush baskets
Definition TTree.h:176
virtual void SetCacheLearnEntries(Int_t n=10)
Interface to TTreeCache to set the number of entries for the learning phase.
Definition TTree.cxx:9279
Int_t SetBranchAddress(const char *bname, T *add, TBranch **ptr=nullptr)
Definition TTree.h:698
void SetTargetMemoryRatio(Float_t ratio)
Definition TTree.h:758
TEntryList * fEntryList
! Pointer to event selection list (if one)
Definition TTree.h:142
TBranch * FindBranchFromFriends(const char *branchName)
Definition TTree.cxx:4927
virtual TVirtualIndex * GetTreeIndex() const
Definition TTree.h:619
Int_t Debug() const
Definition TTree.h:490
TList * fExternalFriends
! List of TFriendsElement pointing to us and need to be notified of LoadTree. Content not owned.
Definition TTree.h:147
virtual Long64_t Merge(TCollection *list, Option_t *option="")
Merge the trees in the TList into this tree.
Definition TTree.cxx:7166
virtual void SetMaxVirtualSize(Long64_t size=0)
Definition TTree.h:731
virtual void DropBaskets()
Remove some baskets from memory.
Definition TTree.cxx:4591
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:8694
virtual bool GetClusterPrefetch() const
Definition TTree.h:518
TBranch * Branch(const char *name, const char *classname, T **addobj, Int_t bufsize=32000, Int_t splitlevel=99)
Definition TTree.h:458
Long64_t fMaxEntryLoop
Maximum number of entries to process.
Definition TTree.h:114
Int_t BuildIndex(const char *majorname, bool long64major)
Build index with only a major formula.
Definition TTree.h:481
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:621
virtual void SetParallelUnzip(bool opt=true, Float_t RelSize=-1)
Enable or disable parallel unzipping of Tree buffers.
Definition TTree.cxx:9716
virtual void SetDirectory(TDirectory *dir)
Change the tree's directory.
Definition TTree.cxx:9380
void SortBranchesByTime()
Sorts top-level branches by the last average task time recorded per branch.
Definition TTree.cxx:5943
void Delete(Option_t *option="") override
Delete this tree from memory or/and disk.
Definition TTree.cxx:3788
virtual Int_t * GetIndex()
Definition TTree.h:582
virtual TBranchRef * GetBranchRef() const
Definition TTree.h:511
virtual Double_t * GetV3()
Definition TTree.h:641
TLeaf * SearchLeafInListOfFriends(const char *branchName, const char *leafName)
Definition TTree.cxx:6276
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:7789
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:1663
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:9483
TBranch * Branch(const char *name, int address, const char *leaflist, Int_t bufsize=32000)
Definition TTree.h:447
void MoveReadCache(TFile *src, TDirectory *dir)
Move a cache from a file to the current file in dir.
Definition TTree.cxx:7323
TTree & operator=(const TTree &tt)=delete
Long64_t fAutoFlush
Auto-flush tree when fAutoFlush entries written or -fAutoFlush (compressed) bytes produced.
Definition TTree.h:117
Int_t fUpdate
Update frequency for EntryLoop.
Definition TTree.h:109
virtual void ResetAfterMerge(TFileMergeInfo *)
Resets the state of this TTree after a merge (keep the customization but forget the data).
Definition TTree.cxx:8372
TBranch * Branch(const char *name, std::array< T, N > *obj, Int_t bufsize=32000, Int_t splitlevel=99)
Definition TTree.h:463
@ kSplitCollectionOfPointers
Definition TTree.h:324
virtual Long64_t GetEntries() const
Definition TTree.h:524
virtual void SetEstimate(Long64_t nentries=1000000)
Set number of entries to estimate variable limits.
Definition TTree.cxx:9524
Int_t fTimerInterval
Timer interval in milliseconds.
Definition TTree.h:107
Int_t fDebug
! Debug level
Definition TTree.h:127
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:9125
virtual Long64_t AutoSave(Option_t *option="")
AutoSave tree header every fAutoSave bytes.
Definition TTree.cxx:1528
virtual Long64_t GetEntryNumber(Long64_t entry) const
Return entry number corresponding to entry.
Definition TTree.cxx:5974
virtual TTree * CloneTree(Long64_t nentries=-1, Option_t *option="")
Create a clone of this tree and copy nentries.
Definition TTree.cxx:3174
virtual bool GetImplicitMT()
Definition TTree.h:581
Int_t fFileNumber
! current file number (if file extensions)
Definition TTree.h:132
virtual TLeaf * GetLeaf(const char *branchname, const char *leafname)
Searches in this tree and any of its friends for a leaf named leafname in branch branchname ,...
Definition TTree.cxx:6327
virtual Long64_t GetZipBytes() const
Definition TTree.h:646
TObjArray fLeaves
Direct pointers to individual branch leaves.
Definition TTree.h:139
virtual void Reset(Option_t *option="")
Reset baskets, buffers and entries count in all branches and leaves.
Definition TTree.cxx:8341
virtual void SetImplicitMT(bool enabled)
Definition TTree.h:727
virtual void KeepCircular()
Keep a maximum of fMaxEntries in memory.
Definition TTree.cxx:6671
virtual void SetDefaultEntryOffsetLen(Int_t newdefault, bool updateExisting=false)
Update the default value for the branch's fEntryOffsetLen.
Definition TTree.cxx:9354
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:3860
Long64_t fMaxVirtualSize
Maximum total size of buffers kept in memory.
Definition TTree.h:115
virtual Long64_t GetTotBytes() const
Definition TTree.h:617
virtual Int_t MakeSelector(const char *selector=nullptr, Option_t *option="")
Generate skeleton selector class for this tree.
Definition TTree.cxx:7086
virtual void SetObject(const char *name, const char *title)
Change the name and title of this tree.
Definition TTree.cxx:9685
TVirtualPerfStats * fPerfStats
! pointer to the current perf stats object
Definition TTree.h:148
Double_t fWeight
Tree weight (see TTree::SetWeight)
Definition TTree.h:106
virtual void SetUpdate(Int_t freq=0)
Definition TTree.h:762
std::vector< TBranch * > fSeqBranches
! Branches to be processed sequentially when IMT is on
Definition TTree.h:161
Long64_t fDebugMax
! Last entry number to debug
Definition TTree.h:129
Int_t fDefaultEntryOffsetLen
Initial Length of fEntryOffset table in the basket buffers.
Definition TTree.h:110
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:5371
TTree()
Default constructor and I/O constructor.
Definition TTree.cxx:765
Long64_t fAutoSave
Autosave tree when fAutoSave entries written or -fAutoSave (compressed) bytes produced.
Definition TTree.h:116
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:411
std::atomic< UInt_t > fAllocationCount
indicates basket should be resized to exact memory usage, but causes significant
Definition TTree.h:168
static TTree * MergeTrees(TList *list, Option_t *option="")
Static function merging the trees in the TList into a new tree.
Definition TTree.cxx:7117
bool MemoryFull(Int_t nbytes)
Check if adding nbytes to memory we are still below MaxVirtualsize.
Definition TTree.cxx:7101
TTreeFormula * GetVar4()
Definition TTree.h:633
virtual Long64_t GetReadEntry() const
Definition TTree.h:610
virtual TObjArray * GetListOfBranches()
Definition TTree.h:589
Long64_t fZipBytes
Total number of bytes in all branches after compression.
Definition TTree.h:103
virtual TTree * GetTree() const
Definition TTree.h:618
TBuffer * fTransientBuffer
! Pointer to the current transient buffer.
Definition TTree.h:154
virtual Double_t * GetVal(Int_t i)
Definition TTree.h:635
virtual void SetEntryList(TEntryList *list, Option_t *opt="")
Set an EntryList.
Definition TTree.cxx:9460
bool Notify() override
Function called when loading a new class library.
Definition TTree.cxx:7373
virtual void AddZipBytes(Int_t zip)
Definition TTree.h:390
virtual Long64_t LoadTree(Long64_t entry)
Set current entry.
Definition TTree.cxx:6729
virtual Long64_t ReadFile(const char *filename, const char *branchDescriptor="", char delimiter=' ')
Create or simply read branches from filename.
Definition TTree.cxx:7902
virtual const char * GetAlias(const char *aliasName) const
Returns the expanded value of the alias. Search in the friends if any.
Definition TTree.cxx:5304
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:9544
friend class TFriendLock
Definition TTree.h:250
virtual TBasket * CreateBasket(TBranch *)
Create a basket for this tree and given branch.
Definition TTree.cxx:3772
TList * fUserInfo
pointer to a list of user objects associated to this Tree
Definition TTree.h:149
virtual Double_t GetMinimum(const char *columname)
Return minimum of column with name columname.
Definition TTree.cxx:6553
virtual void RemoveFriend(TTree *)
Remove a friend from the list of friends.
Definition TTree.cxx:8315
virtual Long64_t GetEntriesFast() const
Return a number greater or equal to the total number of entries in the dataset.
Definition TTree.h:566
void Browse(TBrowser *) override
Browse content of the TTree.
Definition TTree.cxx:2640
virtual Double_t * GetV1()
Definition TTree.h:637
virtual TList * GetUserInfo()
Return a pointer to the list containing user objects associated to this tree.
Definition TTree.cxx:6612
void RegisterBranchFullName(std::pair< std::string, TBranch * > &&kv)
Definition TTree.h:188
TEventList * GetEventList() const
Definition TTree.h:574
Long64_t fChainOffset
! Offset of 1st entry of this Tree in a TChain
Definition TTree.h:122
EStatusBits
Definition TTree.h:308
@ kOnlyFlushAtCluster
If set, the branch's buffers will grow until an event cluster boundary is hit, guaranteeing a basket ...
Definition TTree.h:314
@ kEntriesReshuffled
If set, signals that this TTree is the output of the processing of another TTree, and the entries are...
Definition TTree.h:319
@ kCircular
Definition TTree.h:310
@ kForceRead
Definition TTree.h:309
virtual Long64_t GetEntriesFriend() const
Returns a number corresponding to:
Definition TTree.cxx:5619
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:7850
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:2435
virtual void SetBasketSize(const char *bname, Int_t buffsize=16000)
Set a branch's basket size.
Definition TTree.cxx:8710
static void SetBranchStyle(Int_t style=1)
Set the current branch style.
Definition TTree.cxx:9070
virtual Long64_t GetReadEvent() const
Definition TTree.h:611
~TTree() override
Destructor.
Definition TTree.cxx:948
bool IsFolder() const override
Returns kTRUE in case object contains browsable objects (like containers or lists of other objects).
Definition TTree.h:648
void ImportClusterRanges(TTree *fromtree)
Appends the cluster range information stored in 'fromtree' to this tree, including the value of fAuto...
Definition TTree.cxx:6628
Long64_t fEstimate
Number of entries to estimate histogram limits.
Definition TTree.h:118
TH1 * GetHistogram()
Definition TTree.h:580
UInt_t GetAllocationCount() const
Definition TTree.h:504
Int_t FlushBasketsImpl() const
Internal implementation of the FlushBaskets algorithm.
Definition TTree.cxx:5224
Long64_t GetDebugMin() const
Definition TTree.h:522
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:6821
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:10181
TVirtualIndex * fTreeIndex
Pointer to the tree Index (if any)
Definition TTree.h:145
void UseCurrentStyle() override
Replace current attributes by current style.
Definition TTree.cxx:10142
virtual Int_t GetTreeNumber() const
Definition TTree.h:620
Int_t GetEvent(Long64_t entry, Int_t getall=0)
Definition TTree.h:570
TObject * fNotify
Object to be notified when loading a Tree.
Definition TTree.h:136
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:1582
virtual TList * GetListOfClones()
Definition TTree.h:588
Long64_t fCacheSize
! Maximum size of file buffers
Definition TTree.h:121
TList * fClones
! List of cloned trees which share our addresses
Definition TTree.h:151
std::atomic< Long64_t > fTotalBuffers
! Total number of bytes in branch buffers
Definition TTree.h:124
ELockStatusBits
Definition TTree.h:258
@ kFindBranch
Definition TTree.h:259
@ kResetBranchAddresses
Definition TTree.h:280
@ kFindLeaf
Definition TTree.h:260
@ kGetEntryWithIndex
Definition TTree.h:264
@ kPrint
Definition TTree.h:274
@ kGetFriend
Definition TTree.h:265
@ kGetBranch
Definition TTree.h:262
@ kSetBranchStatus
Definition TTree.h:279
@ kLoadTree
Definition TTree.h:268
@ kGetEntry
Definition TTree.h:263
@ kGetLeaf
Definition TTree.h:267
@ kRemoveFriend
Definition TTree.h:278
@ kGetFriendAlias
Definition TTree.h:266
@ kGetAlias
Definition TTree.h:261
virtual Double_t * GetV4()
Definition TTree.h:643
TBranch * Branch(const char *name, const char *classname, T *obj, Int_t bufsize=32000, Int_t splitlevel=99)
Definition TTree.h:453
TTreeFormula * GetVar3()
Definition TTree.h:631
virtual void SetTreeIndex(TVirtualIndex *index)
The current TreeIndex is replaced by the new index.
Definition TTree.cxx:9771
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:7397
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:7835
virtual Int_t SetCacheEntryRange(Long64_t first, Long64_t last)
interface to TTreeCache to set the cache entry range
Definition TTree.cxx:9245
static Long64_t GetMaxTreeSize()
Static function which returns the tree file size limit in bytes.
Definition TTree.cxx:6543
bool fCacheDoClusterPrefetch
! true if cache is prefetching whole clusters
Definition TTree.h:156
virtual bool SetAlias(const char *aliasName, const char *aliasFormula)
Set a tree variable alias.
Definition TTree.cxx:8493
virtual Int_t GetTimerInterval() const
Definition TTree.h:615
virtual void CopyAddresses(TTree *, bool undo=false)
Set branch addresses of passed tree equal to ours.
Definition TTree.cxx:3340
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:757
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:2668
TTree(const TTree &tt)=delete
Long64_t fMaxEntries
Maximum number of entries in case of circular buffers.
Definition TTree.h:113
Int_t SetBranchAddress(const char *bname, T **add, TBranch **ptr=nullptr)
Definition TTree.h:689
TBranch * Branch(const char *name, char *address, const char *leaflist, Int_t bufsize=32000)
Definition TTree.h:437
virtual void DropBuffers(Int_t nbytes)
Drop branch buffers to accommodate nbytes below MaxVirtualsize.
Definition TTree.cxx:4604
virtual TList * GetListOfFriends() const
Definition TTree.h:591
virtual void Refresh()
Refresh contents of this tree and its branches from the current status on disk.
Definition TTree.cxx:8254
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:8548
static Long64_t fgMaxTreeSize
Maximum size of a file containing a Tree.
Definition TTree.h:171
Long64_t fReadEntry
! Number of the entry being processed
Definition TTree.h:123
TArrayD fIndexValues
Sorted index values.
Definition TTree.h:143
void MarkEventCluster()
Mark the previous event as being at the end of the event cluster.
Definition TTree.cxx:8610
virtual Int_t GetNbranches()
Definition TTree.h:603
TBranch * FindBranchFromSelf(const char *branchName)
Definition TTree.cxx:4907
UInt_t fNEntriesSinceSorting
! Number of entries processed since the last re-sorting of branches
Definition TTree.h:159
virtual void SetClusterPrefetch(bool enabled)
Enables (or disables) the early decompression of the baskets of the current cluster (whose compressed...
Definition TTree.h:717
virtual void SetFileNumber(Int_t number=0)
Set fFileNumber to number.
Definition TTree.cxx:9567
virtual TLeaf * FindLeaf(const char *name)
Find first leaf containing searchname.
Definition TTree.cxx:4994
virtual void StartViewer()
Start the TTreeViewer on this tree.
Definition TTree.cxx:9884
Int_t GetMakeClass() const
Definition TTree.h:596
virtual Int_t MakeCode(const char *filename=nullptr)
Generate a skeleton function for this tree.
Definition TTree.cxx:6904
bool fIMTFlush
! True if we are doing a multithreaded flush.
Definition TTree.h:175
TDirectory * fDirectory
! Pointer to directory holding this tree
Definition TTree.h:137
ESetBranchAddressStatus
Definition TTree.h:290
@ kNeedEnableDecomposedObj
Definition TTree.h:302
@ kClassMismatch
Definition TTree.h:295
@ kNeedDisableDecomposedObj
Definition TTree.h:303
@ kVoidPtr
Definition TTree.h:300
@ kNoCheck
Definition TTree.h:301
@ kMatchConversionCollection
Definition TTree.h:298
@ kMissingCompiledCollectionProxy
Definition TTree.h:293
@ kMismatch
Definition TTree.h:294
@ kMatchConversion
Definition TTree.h:297
@ kInternalError
Definition TTree.h:292
@ kDecomposedObjMask
Definition TTree.h:304
@ kMatch
Definition TTree.h:296
@ kMissingBranch
Definition TTree.h:291
@ kMakeClass
Definition TTree.h:299
static Int_t fgBranchStyle
Old/New branch style.
Definition TTree.h:170
virtual void ResetBranchAddresses()
Tell all of our branches to drop their current objects and allocate new ones.
Definition TTree.cxx:8413
Int_t fNfill
! Local for EntryLoop
Definition TTree.h:126
void SetName(const char *name) override
Change the name of this tree.
Definition TTree.cxx:9630
virtual Long64_t GetCacheSize() const
Definition TTree.h:514
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:8295
TArrayI fIndex
Index of sorted values.
Definition TTree.h:144
Int_t SetBranchAddressImp(const char *bname, void *add, TBranch **ptr, TClass *realClass, EDataType datatype, bool isptr)
Definition TTree.cxx:8760
virtual Int_t GetPacketSize() const
Definition TTree.h:606
virtual Int_t SetCacheSize(Long64_t cachesize=-1)
Set maximum size of the file cache (TTreeCache) in bytes.
Definition TTree.cxx:9092
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:1247
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:2902
TBuffer * GetTransientBuffer(Int_t size)
Returns the transient buffer currently used by this TTree for reading/writing baskets.
Definition TTree.cxx:1065
ROOT::TIOFeatures GetIOFeatures() const
Returns the current set of IO settings.
Definition TTree.cxx:6214
virtual Int_t MakeClass(const char *classname=nullptr, Option_t *option="")
Generate a skeleton analysis class for this tree.
Definition TTree.cxx:6871
virtual Int_t GetFileNumber() const
Definition TTree.h:577
virtual const char * GetFriendAlias(TTree *) const
If the 'tree' is a friend, this method returns its alias name.
Definition TTree.cxx:6142
virtual void SetChainOffset(Long64_t offset=0)
Definition TTree.h:710
virtual void RemoveExternalFriend(TFriendElement *)
Removes external friend.
Definition TTree.cxx:8306
virtual Double_t * GetW()
Definition TTree.h:644
TTreeFormula * GetVar1()
Definition TTree.h:627
virtual Double_t * GetV2()
Definition TTree.h:639
Int_t fPacketSize
! Number of entries in one packet for parallel root
Definition TTree.h:125
virtual Int_t GetUpdate() const
Definition TTree.h:622
virtual Long64_t GetChainOffset() const
Definition TTree.h:517
virtual TBranch * BranchImpArr(const char *branchname, EDataType datatype, std::size_t N, void *addobj, Int_t bufsize, Int_t splitlevel)
Definition TTree.cxx:1759
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:8451
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:2443
virtual Long64_t GetMaxEntryLoop() const
Definition TTree.h:598
virtual void AddTotBytes(Int_t tot)
Definition TTree.h:389
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:3575
Int_t fMakeClass
! not zero when processing code generated by MakeClass
Definition TTree.h:131
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:6707
static constexpr Long64_t kMaxEntries
Used as the max value for any TTree range operation.
Definition TTree.h:287
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:7540
std::unordered_map< std::string, TBranch * > fNamesToBranches
! maps names to their branches, useful when retrieving branches by name
Definition TTree.h:180
virtual Long64_t GetAutoFlush() const
Definition TTree.h:508
virtual Long64_t GetMaxVirtualSize() const
Definition TTree.h:601
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:48
TBranch * CallBranchImp(TTree &tree, const char *branchname, TClass *ptrClass, void *addobj, Int_t bufsize=32000, Int_t splitlevel=99)
Definition TTree.cxx:10293
Longptr_t GetBranchElementObject(TBranchElement *branch)
Definition TTree.cxx:10304
TBranch * BranchPtrToPtr(TTree &tree, const char *name, const char *className, T **obj, Int_t bufsize=32000, Int_t splitlevel=99)
For the Python bindings: call the TTree::Branch() overload that takes the address of a pointer,...
Definition TTree.h:778
Longptr_t GetBranchAddress(TBranch *branch)
Definition TTree.cxx:10299
TBranch * CallBranchImpRef(TTree &tree, const char *branchname, TClass *ptrClass, EDataType datatype, void *addobj, Int_t bufsize=32000, Int_t splitlevel=99)
Definition TTree.cxx:10287
void TBranch__SetTree(TTree *tree, TObjArray &branches)
Set the fTree member for all branches and sub branches.
Definition TTree.cxx:9933
th1 Draw()
auto * tt
Definition textangle.C:16