ROOT  6.07/01
Reference Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
TBranchObject.cxx
Go to the documentation of this file.
1 // @(#)root/tree:$Id$
2 // Author: Rene Brun 11/02/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 /** \class TBranchObject
13 A Branch for the case of an object.
14 */
15 
16 #include "TBranchObject.h"
17 
18 #include "TBasket.h"
19 #include "TBranchClones.h"
20 #include "TBrowser.h"
21 #include "TBuffer.h"
22 #include "TClass.h"
23 #include "TClonesArray.h"
24 #include "TDataMember.h"
25 #include "TDataType.h"
26 #include "TFile.h"
27 #include "TLeafObject.h"
28 #include "TRealData.h"
29 #include "TStreamerInfo.h"
30 #include "TTree.h"
31 #include "TVirtualPad.h"
32 
34 
35 ////////////////////////////////////////////////////////////////////////////////
36 /// Default constructor for BranchObject.
37 
39 : TBranch()
40 {
41  fNleaves = 1;
42  fOldObject = 0;
43 }
44 
45 ////////////////////////////////////////////////////////////////////////////////
46 /// Create a BranchObject.
47 
48 TBranchObject::TBranchObject(TTree *tree, const char* name, const char* classname, void* addobj, Int_t basketsize, Int_t splitlevel, Int_t compress, Bool_t isptrptr /* = kTRUE */)
49 : TBranch()
50 {
51  Init(tree,0,name,classname,addobj,basketsize,splitlevel,compress,isptrptr);
52 }
53 
54 ////////////////////////////////////////////////////////////////////////////////
55 /// Create a BranchObject.
56 
57 TBranchObject::TBranchObject(TBranch *parent, const char* name, const char* classname, void* addobj, Int_t basketsize, Int_t splitlevel, Int_t compress, Bool_t isptrptr /* = kTRUE */)
58 : TBranch()
59 {
60  Init(0,parent,name,classname,addobj,basketsize,splitlevel,compress,isptrptr);
61 }
62 
63 ////////////////////////////////////////////////////////////////////////////////
64 /// Initialization routine (run from the constructor so do not make this function virtual)
65 
66 void TBranchObject::Init(TTree *tree, TBranch *parent, const char* name, const char* classname, void* addobj, Int_t basketsize, Int_t /*splitlevel*/, Int_t compress, Bool_t isptrptr)
67 {
68  if (tree==0 && parent!=0) tree = parent->GetTree();
69  fTree = tree;
70  fMother = parent ? parent->GetMother() : this;
71  fParent = parent;
72 
73  TClass* cl = TClass::GetClass(classname);
74 
75  if (!cl) {
76  Error("TBranchObject", "Cannot find class:%s", classname);
77  return;
78  }
79 
80  if (!isptrptr) {
81  fOldObject = (TObject*)addobj;
82  addobj = &fOldObject;
83  } else {
84  fOldObject = 0;
85  }
86 
87  char** apointer = (char**) addobj;
88  TObject* obj = (TObject*) (*apointer);
89 
90  Bool_t delobj = kFALSE;
91  if (!obj) {
92  obj = (TObject*) cl->New();
93  delobj = kTRUE;
94  }
95 
96  tree->BuildStreamerInfo(cl, obj);
97 
98  if (delobj) {
99  cl->Destructor(obj);
100  }
101 
102  SetName(name);
103  SetTitle(name);
104 
105  fCompress = compress;
106  if ((compress == -1) && tree->GetDirectory()) {
107  TFile* bfile = tree->GetDirectory()->GetFile();
108  if (bfile) {
110  }
111  }
112  if (basketsize < 100) {
113  basketsize = 100;
114  }
115  fBasketSize = basketsize;
116  fAddress = (char*) addobj;
117  fClassName = classname;
121 
122  for (Int_t i = 0; i < fMaxBaskets; ++i) {
123  fBasketBytes[i] = 0;
124  fBasketEntry[i] = 0;
125  fBasketSeek[i] = 0;
126  }
127 
128  TLeaf* leaf = new TLeafObject(this, name, classname);
129  leaf->SetAddress(addobj);
130  fNleaves = 1;
131  fLeaves.Add(leaf);
132  tree->GetListOfLeaves()->Add(leaf);
133 
134  // Set the bit kAutoDelete to specify that when reading
135  // in TLeafObject::ReadBasket, the object should be deleted
136  // before calling Streamer.
137  // It is foreseen to not set this bit in a future version.
138  if (isptrptr) SetAutoDelete(kTRUE);
139 
141  fFileName = "";
142 
143 }
144 
145 ////////////////////////////////////////////////////////////////////////////////
146 /// Destructor for a BranchObject.
147 
149 {
150  fBranches.Delete();
151 }
152 
153 ////////////////////////////////////////////////////////////////////////////////
154 /// Browse the branch content.
155 
157 {
158  Int_t nbranches = fBranches.GetEntriesFast();
159  if (nbranches > 1) {
160  fBranches.Browse(b);
161  }
162  if (GetBrowsables() && GetBrowsables()->GetSize()) {
163  GetBrowsables()->Browse(b);
164  }
165 }
166 
167 ////////////////////////////////////////////////////////////////////////////////
168 /// Loop on all leaves of this branch to fill Basket buffer.
169 
171 {
172  Int_t nbytes = 0;
173  Int_t nbranches = fBranches.GetEntriesFast();
174  if (nbranches) {
175  ++fEntries;
176  UpdateAddress();
177  for (Int_t i = 0; i < nbranches; ++i) {
178  TBranch* branch = (TBranch*) fBranches[i];
179  if (!branch->TestBit(kDoNotProcess)) {
180  Int_t bc = branch->Fill();
181  nbytes += bc;
182  }
183  }
184  } else {
185  if (!TestBit(kDoNotProcess)) {
186  Int_t bc = TBranch::Fill();
187  nbytes += bc;
188  }
189  }
190  return nbytes;
191 }
192 
193 ////////////////////////////////////////////////////////////////////////////////
194 /// Read all branches of a BranchObject and return total number of bytes.
195 ///
196 /// - If entry = 0 take current entry number + 1
197 /// - If entry < 0 reset entry number to 0
198 ///
199 /// The function returns the number of bytes read from the input buffer.
200 ///
201 /// - If entry does not exist the function returns 0.
202 /// - If an I/O error occurs, the function returns -1.
203 
205 {
206  if (TestBit(kDoNotProcess) && !getall) {
207  return 0;
208  }
209  Int_t nbytes;
210  Int_t nbranches = fBranches.GetEntriesFast();
211 
212  if (nbranches) {
213  if (fAddress == 0) {
214  SetupAddresses();
215  }
216  nbytes = 0;
217  Int_t nb;
218  for (Int_t i = 0; i < nbranches; ++i) {
219  TBranch* branch = (TBranch*) fBranches[i];
220  if (branch) {
221  nb = branch->GetEntry(entry, getall);
222  if (nb < 0) {
223  return nb;
224  }
225  nbytes += nb;
226  }
227  }
228  } else {
229  nbytes = TBranch::GetEntry(entry, getall);
230  }
231  return nbytes;
232 }
233 
234 ////////////////////////////////////////////////////////////////////////////////
235 /// Fill expectedClass and expectedType with information on the data type of the
236 /// object/values contained in this branch (and thus the type of pointers
237 /// expected to be passed to Set[Branch]Address
238 /// return 0 in case of success and > 0 in case of failure.
239 
240 Int_t TBranchObject::GetExpectedType(TClass *&expectedClass,EDataType &expectedType)
241 {
242  expectedClass = 0;
243  expectedType = kOther_t;
244  TLeafObject* lobj = (TLeafObject*) GetListOfLeaves()->At(0);
245  if (!lobj) {
246  Error("GetExpectedType", "Did not find any leaves in %s",GetName());
247  return 1;
248  }
249  expectedClass = lobj->GetClass();
250  return 0;
251 }
252 
253 ////////////////////////////////////////////////////////////////////////////////
254 /// Return TRUE if more than one leaf or if fBrowsables, FALSE otherwise.
255 
257 {
258  Int_t nbranches = fBranches.GetEntriesFast();
259 
260  if (nbranches >= 1) {
261  return kTRUE;
262  }
263 
264  TList* browsables = const_cast<TBranchObject*>(this)->GetBrowsables();
265 
266  return browsables && browsables->GetSize();
267 }
268 
269 ////////////////////////////////////////////////////////////////////////////////
270 /// Print TBranch parameters.
271 
272 void TBranchObject::Print(Option_t* option) const
273 {
274  Int_t nbranches = fBranches.GetEntriesFast();
275  if (nbranches) {
276  Printf("*Branch :%-9s : %-54s *", GetName(), GetTitle());
277  Printf("*Entries : %8d : BranchObject (see below) *", Int_t(fEntries));
278  Printf("*............................................................................*");
279  for (Int_t i = 0; i < nbranches; ++i) {
280  TBranch* branch = (TBranch*) fBranches.At(i);
281  if (branch) {
282  branch->Print(option);
283  }
284  }
285  } else {
286  TBranch::Print(option);
287  }
288 }
289 
290 ////////////////////////////////////////////////////////////////////////////////
291 /// Reset a branch.
292 ///
293 /// - Existing buffers are deleted.
294 /// - Entries, max and min are reset.
295 
297 {
298  TBranch::Reset(option);
299 
300  Int_t nbranches = fBranches.GetEntriesFast();
301  for (Int_t i = 0; i < nbranches; ++i) {
302  TBranch* branch = (TBranch*) fBranches[i];
303  branch->Reset(option);
304  }
305 }
306 
307 ///______________________________________________________________________________
309 {
310  // Reset a Branch after a Merge operation (drop data but keep customizations)
311  //
312 
314 
315  Int_t nbranches = fBranches.GetEntriesFast();
316  for (Int_t i = 0; i < nbranches; ++i) {
317  TBranch* branch = (TBranch*) fBranches[i];
318  branch->ResetAfterMerge(info);
319  }
320 }
321 
322 ////////////////////////////////////////////////////////////////////////////////
323 /// Set address of this branch.
324 
326 {
327  if (TestBit(kDoNotProcess)) {
328  return;
329  }
330 
331  // Special case when called from code generated by TTree::MakeClass.
332  if (Long_t(add) == -1) {
333  SetBit(kWarn);
334  return;
335  }
336 
337  fReadEntry = -1;
338  Int_t nbranches = fBranches.GetEntriesFast();
339 
340  TLeaf* leaf = (TLeaf*) fLeaves.UncheckedAt(0);
341  if (leaf) {
342  leaf->SetAddress(add);
343  }
344 
345  fAddress = (char*) add;
346  char** ppointer = (char**) add;
347 
348  char* obj = 0;
349  if (ppointer) {
350  obj = *ppointer;
351  }
352 
354 
355  if (!cl) {
356  for (Int_t i = 0; i < nbranches; ++i) {
357  TBranch* br = (TBranch*) fBranches[i];
358  br->SetAddress(obj);
359  }
360  return;
361  }
362 
363  if (ppointer && !obj) {
364  obj = (char*) cl->New();
365  *ppointer = obj;
366  }
367 
368  if (!cl->GetListOfRealData()) {
369  cl->BuildRealData(obj);
370  }
371 
372  if (cl->InheritsFrom(TClonesArray::Class())) {
373  if (ppointer) {
374  TClonesArray* clones = (TClonesArray*) *ppointer;
375  if (!clones) {
376  Error("SetAddress", "Pointer to TClonesArray is null");
377  return;
378  }
379  TClass* clm = clones->GetClass();
380  if (clm) {
381  clm->BuildRealData(); //just in case clm derives from an abstract class
382  clm->GetStreamerInfo();
383  }
384  }
385  }
386 
387  //
388  // Loop over our data members looking
389  // for sub-branches for them. If we
390  // find one, set its address.
391  //
392 
393  char* fullname = new char[200];
394 
395  const char* bname = GetName();
396 
397  Int_t isDot = 0;
398  if (bname[strlen(bname)-1] == '.') {
399  isDot = 1;
400  }
401 
402  char* pointer = 0;
403  TRealData* rd = 0;
405  while ((rd = (TRealData*) next())) {
406  if (rd->TestBit(TRealData::kTransient)) continue;
407 
408  TDataMember* dm = rd->GetDataMember();
409  if (!dm || !dm->IsPersistent()) {
410  continue;
411  }
412  const char* rdname = rd->GetName();
413  TDataType* dtype = dm->GetDataType();
414  Int_t code = 0;
415  if (dtype) {
416  code = dm->GetDataType()->GetType();
417  }
418  Int_t offset = rd->GetThisOffset();
419  if (ppointer) {
420  pointer = obj + offset;
421  }
422  TBranch* branch = 0;
423  if (dm->IsaPointer()) {
424  TClass* clobj = 0;
425  if (!dm->IsBasic()) {
426  clobj = TClass::GetClass(dm->GetTypeName());
427  }
428  if (clobj && clobj->InheritsFrom(TClonesArray::Class())) {
429  if (isDot) {
430  snprintf(fullname,200, "%s%s", bname, &rdname[1]);
431  } else {
432  snprintf(fullname,200, "%s", &rdname[1]);
433  }
434  branch = (TBranch*) fBranches.FindObject(fullname);
435  } else {
436  if (!clobj) {
437  // this is a basic type we can handle only if
438  // it has a dimension:
439  const char* index = dm->GetArrayIndex();
440  if (!index[0]) {
441  if (code == 1) {
442  // Case of a string ... we do not need the size
443  if (isDot) {
444  snprintf(fullname,200, "%s%s", bname, &rdname[0]);
445  } else {
446  snprintf(fullname,200, "%s", &rdname[0]);
447  }
448  } else {
449  continue;
450  }
451  }
452  if (isDot) {
453  snprintf(fullname,200, "%s%s", bname, &rdname[0]);
454  } else {
455  snprintf(fullname,200, "%s", &rdname[0]);
456  }
457  // let's remove the stars!
458  UInt_t cursor;
459  UInt_t pos;
460  for (cursor = 0, pos = 0; cursor < strlen(fullname); ++cursor) {
461  if (fullname[cursor] != '*') {
462  fullname[pos++] = fullname[cursor];
463  }
464  }
465  fullname[pos] = '\0';
466  branch = (TBranch*) fBranches.FindObject(fullname);
467  } else {
468  if (!clobj->IsTObject()) {
469  continue;
470  }
471  if (isDot) {
472  snprintf(fullname,200, "%s%s", bname, &rdname[1]);
473  } else {
474  snprintf(fullname,200, "%s", &rdname[1]);
475  }
476  branch = (TBranch*) fBranches.FindObject(fullname);
477  }
478  }
479  } else {
480  if (dm->IsBasic()) {
481  if (isDot) {
482  snprintf(fullname,200, "%s%s", bname, &rdname[0]);
483  } else {
484  snprintf(fullname,200, "%s", &rdname[0]);
485  }
486  branch = (TBranch*) fBranches.FindObject(fullname);
487  }
488  }
489  if (branch) {
490  branch->SetAddress(pointer);
491  }
492  }
493 
494  delete[] fullname;
495 }
496 
497 ////////////////////////////////////////////////////////////////////////////////
498 /// Set the AutoDelete bit.
499 ///
500 /// This function can be used to instruct Root in TBranchObject::ReadBasket
501 /// to not delete the object referenced by a branchobject before reading a
502 /// new entry. By default, the object is deleted.
503 /// - If autodel is kTRUE, this existing object will be deleted, a new object
504 /// created by the default constructor, then object->Streamer called.
505 /// - If autodel is kFALSE, the existing object is not deleted. Root assumes
506 /// that the user is taking care of deleting any internal object or array
507 /// This can be done in Streamer itself.
508 /// - If this branch has sub-branches, the function sets autodel for these
509 /// branches as well.
510 /// We STRONGLY suggest to activate this option by default when you create
511 /// the top level branch. This will make the read phase more efficient
512 /// because it minimizes the numbers of new/delete operations.
513 /// Once this option has been set and the Tree is written to a file, it is
514 /// not necessary to specify the option again when reading, unless you
515 /// want to set the opposite mode.
516 
518 {
519  TBranch::SetAutoDelete(autodel);
520 
521  Int_t nbranches = fBranches.GetEntriesFast();
522  for (Int_t i=0;i<nbranches;i++) {
523  TBranch *branch = (TBranch*)fBranches[i];
524  branch->SetAutoDelete(autodel);
525  }
526 }
527 
528 ////////////////////////////////////////////////////////////////////////////////
529 /// Reset basket size for all subbranches of this branch.
530 
532 {
533  TBranch::SetBasketSize(buffsize);
534 
535  Int_t nbranches = fBranches.GetEntriesFast();
536  for (Int_t i = 0; i < nbranches; ++i) {
537  TBranch* branch = (TBranch*) fBranches[i];
538  branch->SetBasketSize(fBasketSize);
539  }
540 }
541 
542 ////////////////////////////////////////////////////////////////////////////////
543 /// Stream an object of class TBranchObject.
544 
545 void TBranchObject::Streamer(TBuffer& R__b)
546 {
547  if (R__b.IsReading()) {
549  } else {
550  TDirectory* dirsav = fDirectory;
551  fDirectory = 0; // to avoid recursive calls
552 
554 
555  // make sure that all TStreamerInfo objects referenced by
556  // this class are written to the file
557  R__b.ForceWriteInfo(TClass::GetClass(fClassName.Data())->GetStreamerInfo(), kTRUE);
558 
559  // if branch is in a separate file save this branch
560  // as an independent key
561  if (!dirsav) {
562  return;
563  }
564  if (!dirsav->IsWritable()) {
565  fDirectory = dirsav;
566  return;
567  }
568  TDirectory* pdirectory = fTree->GetDirectory();
569  if (!pdirectory) {
570  fDirectory = dirsav;
571  return;
572  }
573  const char* treeFileName = pdirectory->GetFile()->GetName();
574  TBranch* mother = GetMother();
575  const char* motherFileName = treeFileName;
576  if (mother && (mother != this)) {
577  motherFileName = mother->GetFileName();
578  }
579  if ((fFileName.Length() > 0) && strcmp(motherFileName, fFileName.Data())) {
580  dirsav->WriteTObject(this);
581  }
582  fDirectory = dirsav;
583  }
584 }
585 
586 ////////////////////////////////////////////////////////////////////////////////
587 /// -- If the branch address is not set, we set all addresses starting with
588 /// the top level parent branch. This is required to be done in order for
589 /// GetOffset to be correct and for GetEntry to run.
590 
592 {
593  if (fAddress == 0) {
594  // try to create object
595  if (!TestBit(kWarn)) {
597  if (cl) {
598  TObject** voidobj = (TObject**) new Long_t[1];
599  *voidobj = (TObject*) cl->New();
600  SetAddress(voidobj);
601  } else {
602  Warning("GetEntry", "Cannot get class: %s", fClassName.Data());
603  SetBit(kWarn);
604  }
605  }
606  }
607 }
608 
609 ////////////////////////////////////////////////////////////////////////////////
610 /// Update branch addresses if a new object was created.
611 
613 {
614  void** ppointer = (void**) fAddress;
615  if (!ppointer) {
616  return;
617  }
618  TObject* obj = (TObject*) (*ppointer);
619  if (obj != fOldObject) {
620  fOldObject = obj;
622  }
623 }
624 
TObject * fOldObject
Definition: TBranchObject.h:34
Bool_t IsFolder() const
Return TRUE if more than one leaf or if fBrowsables, FALSE otherwise.
virtual const char * GetTitle() const
Returns title of object.
Definition: TNamed.h:52
A TLeaf describes individual elements of a TBranch See TBranch structure in TTree.
Definition: TLeaf.h:37
TStreamerInfo * BuildStreamerInfo(TClass *cl, void *pointer=0, Bool_t canOptimize=kTRUE)
Build StreamerInfo for class cl.
Definition: TTree.cxx:2523
virtual Int_t WriteClassBuffer(const TClass *cl, void *pointer)=0
virtual void SetAddress(void *add)
Set address of this branch.
Definition: TBranch.cxx:2049
long long Long64_t
Definition: RtypesCore.h:69
Bool_t IsReading() const
Definition: TBuffer.h:83
Int_t GetType() const
Definition: TDataType.h:70
A Branch for the case of an object.
Definition: TBranchObject.h:28
ClassImp(TSeqCollection) Int_t TSeqCollection TIter next(this)
Return index of object in collection.
virtual Int_t Fill()
Loop on all leaves of this branch to fill Basket buffer.
Ssiz_t Length() const
Definition: TString.h:390
Long64_t fEntries
Pointer to the current basket.
Definition: TBranch.h:84
const char Option_t
Definition: RtypesCore.h:62
virtual void Delete(Option_t *option="")
Remove all objects from the array AND delete all heap based objects.
Definition: TObjArray.cxx:329
tuple offset
Definition: tree.py:93
All ROOT classes may have RTTI (run time type identification) support added.
Definition: TDataMember.h:33
A TLeaf for a general object derived from TObject.
Definition: TLeafObject.h:35
virtual void SetName(const char *name)
Change (i.e.
Definition: TNamed.cxx:128
Bool_t IsTObject() const
Return kTRUE is the class inherits from TObject.
Definition: TClass.cxx:5462
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format...
Definition: TFile.h:45
virtual void Print(Option_t *option="") const
Print TBranch parameters.
Definition: TBranch.cxx:1727
Buffer base class used for serializing objects.
Definition: TBuffer.h:42
Bool_t IsPersistent() const
Definition: TDataMember.h:89
void Init(TTree *tree, TBranch *parent, const char *name, const char *classname, void *addobj, Int_t basketsize, Int_t splitlevel, Int_t compress, Bool_t isptrptr)
Pointer to old object.
virtual Int_t WriteTObject(const TObject *obj, const char *name=0, Option_t *="", Int_t=0)
See TDirectoryFile::WriteTObject for details.
virtual Int_t GetExpectedType(TClass *&clptr, EDataType &type)
Fill expectedClass and expectedType with information on the data type of the object/values contained ...
virtual void Print(Option_t *option="") const
Print TBranch parameters.
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
TDataType * GetDataType() const
Definition: TDataMember.h:74
Bool_t IsaPointer() const
Return true if data member is a pointer.
const Bool_t kFALSE
Definition: Rtypes.h:92
virtual void ForceWriteInfo(TVirtualStreamerInfo *info, Bool_t force)=0
Int_t fNleaves
Definition: TBranch.h:78
TObjArray fLeaves
Definition: TBranch.h:89
Int_t GetEntriesFast() const
Definition: TObjArray.h:66
Long64_t * fBasketSeek
Definition: TBranch.h:93
virtual void Browse(TBrowser *b)
Browse the branch content.
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Definition: TObject.cxx:732
const char * GetArrayIndex() const
If the data member is pointer and has a valid array size in its comments GetArrayIndex returns a stri...
Int_t * fBasketBytes
Definition: TBranch.h:91
virtual TList * GetBrowsables()
Returns (and, if 0, creates) browsable objects for this branch See TVirtualBranchBrowsable::FillListO...
Definition: TBranch.cxx:1154
TList * GetListOfRealData() const
Definition: TClass.h:404
const char * Data() const
Definition: TString.h:349
virtual TObject * FindObject(const char *name) const
Find an object in this collection using its name.
Definition: TObjArray.cxx:396
void Class()
Definition: Class.C:29
virtual void SetupAddresses()
– If the branch address is not set, we set all addresses starting with the top level parent branch...
void * New(ENewType defConstructor=kClassNew, Bool_t quiet=kFALSE) const
Return a pointer to a newly allocated object of this class.
Definition: TClass.cxx:4602
const Int_t kDoNotProcess
Definition: TBranch.h:52
virtual void SetAutoDelete(Bool_t autodel=kTRUE)
Set the AutoDelete bit.
Int_t fMaxBaskets
Definition: TBranch.h:75
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition: TObject.cxx:918
virtual void SetAddress(void *add=0)
Definition: TLeaf.h:124
virtual Int_t GetEntry(Long64_t entry=0, Int_t getall=0)
Read all branches of a BranchObject and return total number of bytes.
A doubly linked list.
Definition: TList.h:47
virtual void ResetAfterMerge(TFileMergeInfo *)
Reset a Branch.
Definition: TBranch.cxx:1965
virtual TFile * GetFile() const
Definition: TDirectory.h:155
virtual Int_t Fill()
Loop on all leaves of this branch to fill Basket buffer.
Definition: TBranch.cxx:724
TObject * UncheckedAt(Int_t i) const
Definition: TObjArray.h:91
void BuildRealData(void *pointer=0, Bool_t isTransient=kFALSE)
Build a full list of persistent data members.
Definition: TClass.cxx:1933
Using a TBrowser one can browse all ROOT objects.
Definition: TBrowser.h:41
virtual void Reset(Option_t *option="")
Reset a branch.
const char * GetTypeName() const
Get type of data member, e,g.: "class TDirectory*" -> "TDirectory".
virtual void SetAddress(void *addobj)
Set address of this branch.
Int_t fBasketSize
Definition: TBranch.h:70
TVirtualStreamerInfo * GetStreamerInfo(Int_t version=0) const
returns a pointer to the TVirtualStreamerInfo object for version If the object does not exist...
Definition: TClass.cxx:4256
virtual void UpdateAddress()
Update branch addresses if a new object was created.
Basic data type descriptor (datatype information is obtained from CINT).
Definition: TDataType.h:46
TDirectory * GetDirectory() const
Definition: TTree.h:385
void Destructor(void *obj, Bool_t dtorOnly=kFALSE)
Explicitly call destructor for object.
Definition: TClass.cxx:4959
TBranch * GetMother() const
Get our top-level parent branch in the tree.
Definition: TBranch.cxx:1533
unsigned int UInt_t
Definition: RtypesCore.h:42
Bool_t TestBit(UInt_t f) const
Definition: TObject.h:173
The TRealData class manages the effective list of all data members for a given class.
Definition: TRealData.h:34
virtual Int_t GetEntry(Long64_t entry=0, Int_t getall=0)
Read all leaves of entry and return total number of bytes read.
Definition: TBranch.cxx:1199
virtual const char * GetName() const
Returns name of object.
Definition: TNamed.h:51
The ROOT global object gROOT contains a list of all defined classes.
Definition: TClass.h:81
Long64_t entry
TTree * GetTree() const
Definition: TBranch.h:183
virtual void SetBasketSize(Int_t buffsize)
Reset basket size for all subbranches of this branch.
#define Printf
Definition: TGeoToOCC.h:18
Int_t GetCompressionSettings() const
Definition: TFile.h:363
virtual void SetBasketSize(Int_t buffsize)
Set the basket size The function makes sure that the basket size is greater than fEntryOffsetlen.
Definition: TBranch.cxx:2096
TString fClassName
Definition: TBranchObject.h:33
long Long_t
Definition: RtypesCore.h:50
virtual Int_t ReadClassBuffer(const TClass *cl, void *pointer, const TClass *onfile_class=0)=0
tuple tree
Definition: tree.py:24
virtual Int_t GetSize() const
Definition: TCollection.h:95
TClass * GetClass() const
Definition: TClonesArray.h:57
Describe directory structure in memory.
Definition: TDirectory.h:44
TClass * GetClass() const
Definition: TLeafObject.h:50
EDataType
Definition: TDataType.h:30
TTree * fTree
Definition: TBranch.h:94
void Browse(TBrowser *b)
Browse this collection (called by TBrowser).
ClassImp(TBranchObject) TBranchObject
Default constructor for BranchObject.
TObjArray * GetListOfLeaves()
Definition: TBranch.h:178
TDirectory * fDirectory
Address of 1st leaf (variable or object)
Definition: TBranch.h:98
static TClass * GetClass(const char *name, Bool_t load=kTRUE, Bool_t silent=kFALSE)
Static method returning pointer to TClass of the specified class name.
Definition: TClass.cxx:2801
const char * GetFileName() const
Definition: TBranch.h:166
#define name(a, b)
Definition: linkTestLib0.cpp:5
Mother of all ROOT objects.
Definition: TObject.h:58
An array of clone (identical) objects.
Definition: TClonesArray.h:32
Long64_t * fBasketEntry
Definition: TBranch.h:92
virtual void Reset(Option_t *option="")
Reset a Branch.
Definition: TBranch.cxx:1924
virtual Bool_t IsWritable() const
Definition: TDirectory.h:171
Long64_t fReadEntry
Current basket number when reading.
Definition: TBranch.h:80
TBranch * fMother
Pointer to Tree header.
Definition: TBranch.h:95
Bool_t IsBasic() const
Return true if data member is a basic type, e.g. char, int, long...
void Add(TObject *obj)
Definition: TObjArray.h:75
A TTree object has a header with a name and a title.
Definition: TTree.h:98
TDataMember * GetDataMember() const
Definition: TRealData.h:57
Bool_t InheritsFrom(const char *cl) const
Return kTRUE if this class inherits from a class with name "classname".
Definition: TClass.cxx:4498
TObjArray fBranches
Definition: TBranch.h:88
TObject * At(Int_t idx) const
Definition: TObjArray.h:167
A TTree is a list of TBranches.
Definition: TBranch.h:58
Int_t fCompress
branch counter
Definition: TBranch.h:69
const Bool_t kTRUE
Definition: Rtypes.h:91
Long_t GetThisOffset() const
Definition: TRealData.h:59
virtual const char * GetName() const
Returns name of object.
Definition: TRealData.h:56
virtual void SetTitle(const char *title="")
Change (i.e. set) the title of the TNamed.
Definition: TNamed.cxx:152
TObject * obj
TString fFileName
Pointer to directory where this branch buffers are stored.
Definition: TBranch.h:99
TBranch * fParent
Pointer to top-level parent branch in the tree.
Definition: TBranch.h:96
virtual void ResetAfterMerge(TFileMergeInfo *)
virtual ~TBranchObject()
Destructor for a BranchObject.
virtual TObjArray * GetListOfLeaves()
Definition: TTree.h:410
virtual void SetAutoDelete(Bool_t autodel=kTRUE)
Set the automatic delete bit.
Definition: TBranch.cxx:2083
char * fAddress
Pointer to parent branch.
Definition: TBranch.h:97
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
Definition: TObject.cxx:904