ROOT  6.06/09
Reference Guide
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 "TClass.h"
22 #include "TClonesArray.h"
23 #include "TDataMember.h"
24 #include "TDataType.h"
25 #include "TFile.h"
26 #include "TLeafObject.h"
27 #include "TRealData.h"
28 #include "TStreamerInfo.h"
29 #include "TTree.h"
30 #include "TVirtualPad.h"
31 
33 
34 ////////////////////////////////////////////////////////////////////////////////
35 /// Default constructor for BranchObject.
36 
38 : TBranch()
39 {
40  fNleaves = 1;
41  fOldObject = 0;
42 }
43 
44 ////////////////////////////////////////////////////////////////////////////////
45 /// Create a BranchObject.
46 
47 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 */)
48 : TBranch()
49 {
50  Init(tree,0,name,classname,addobj,basketsize,splitlevel,compress,isptrptr);
51 }
52 
53 ////////////////////////////////////////////////////////////////////////////////
54 /// Create a BranchObject.
55 
56 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 */)
57 : TBranch()
58 {
59  Init(0,parent,name,classname,addobj,basketsize,splitlevel,compress,isptrptr);
60 }
61 
62 ////////////////////////////////////////////////////////////////////////////////
63 /// Initialization routine (run from the constructor so do not make this function virtual)
64 
65 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)
66 {
67  if (tree==0 && parent!=0) tree = parent->GetTree();
68  fTree = tree;
69  fMother = parent ? parent->GetMother() : this;
70  fParent = parent;
71 
72  TClass* cl = TClass::GetClass(classname);
73 
74  if (!cl) {
75  Error("TBranchObject", "Cannot find class:%s", classname);
76  return;
77  }
78 
79  if (!isptrptr) {
80  fOldObject = (TObject*)addobj;
81  addobj = &fOldObject;
82  } else {
83  fOldObject = 0;
84  }
85 
86  char** apointer = (char**) addobj;
87  TObject* obj = (TObject*) (*apointer);
88 
89  Bool_t delobj = kFALSE;
90  if (!obj) {
91  obj = (TObject*) cl->New();
92  delobj = kTRUE;
93  }
94 
95  tree->BuildStreamerInfo(cl, obj);
96 
97  if (delobj) {
98  cl->Destructor(obj);
99  }
100 
101  SetName(name);
102  SetTitle(name);
103 
104  fCompress = compress;
105  if ((compress == -1) && tree->GetDirectory()) {
106  TFile* bfile = tree->GetDirectory()->GetFile();
107  if (bfile) {
109  }
110  }
111  if (basketsize < 100) {
112  basketsize = 100;
113  }
114  fBasketSize = basketsize;
115  fAddress = (char*) addobj;
116  fClassName = classname;
120 
121  for (Int_t i = 0; i < fMaxBaskets; ++i) {
122  fBasketBytes[i] = 0;
123  fBasketEntry[i] = 0;
124  fBasketSeek[i] = 0;
125  }
126 
127  TLeaf* leaf = new TLeafObject(this, name, classname);
128  leaf->SetAddress(addobj);
129  fNleaves = 1;
130  fLeaves.Add(leaf);
131  tree->GetListOfLeaves()->Add(leaf);
132 
133  // Set the bit kAutoDelete to specify that when reading
134  // in TLeafObject::ReadBasket, the object should be deleted
135  // before calling Streamer.
136  // It is foreseen to not set this bit in a future version.
137  if (isptrptr) SetAutoDelete(kTRUE);
138 
140  fFileName = "";
141 
142 }
143 
144 ////////////////////////////////////////////////////////////////////////////////
145 /// Destructor for a BranchObject.
146 
148 {
149  fBranches.Delete();
150 }
151 
152 ////////////////////////////////////////////////////////////////////////////////
153 /// Browse the branch content.
154 
156 {
157  Int_t nbranches = fBranches.GetEntriesFast();
158  if (nbranches > 1) {
159  fBranches.Browse(b);
160  }
161  if (GetBrowsables() && GetBrowsables()->GetSize()) {
162  GetBrowsables()->Browse(b);
163  }
164 }
165 
166 ////////////////////////////////////////////////////////////////////////////////
167 /// Loop on all leaves of this branch to fill Basket buffer.
168 
170 {
171  Int_t nbytes = 0;
172  Int_t nbranches = fBranches.GetEntriesFast();
173  if (nbranches) {
174  ++fEntries;
175  UpdateAddress();
176  for (Int_t i = 0; i < nbranches; ++i) {
177  TBranch* branch = (TBranch*) fBranches[i];
178  if (!branch->TestBit(kDoNotProcess)) {
179  Int_t bc = branch->Fill();
180  nbytes += bc;
181  }
182  }
183  } else {
184  if (!TestBit(kDoNotProcess)) {
185  Int_t bc = TBranch::Fill();
186  nbytes += bc;
187  }
188  }
189  return nbytes;
190 }
191 
192 ////////////////////////////////////////////////////////////////////////////////
193 /// Read all branches of a BranchObject and return total number of bytes.
194 ///
195 /// - If entry = 0 take current entry number + 1
196 /// - If entry < 0 reset entry number to 0
197 ///
198 /// The function returns the number of bytes read from the input buffer.
199 ///
200 /// - If entry does not exist the function returns 0.
201 /// - If an I/O error occurs, the function returns -1.
202 
204 {
205  if (TestBit(kDoNotProcess) && !getall) {
206  return 0;
207  }
208  Int_t nbytes;
209  Int_t nbranches = fBranches.GetEntriesFast();
210 
211  if (nbranches) {
212  if (fAddress == 0) {
213  SetupAddresses();
214  }
215  nbytes = 0;
216  Int_t nb;
217  for (Int_t i = 0; i < nbranches; ++i) {
218  TBranch* branch = (TBranch*) fBranches[i];
219  if (branch) {
220  nb = branch->GetEntry(entry, getall);
221  if (nb < 0) {
222  return nb;
223  }
224  nbytes += nb;
225  }
226  }
227  } else {
228  nbytes = TBranch::GetEntry(entry, getall);
229  }
230  return nbytes;
231 }
232 
233 ////////////////////////////////////////////////////////////////////////////////
234 /// Fill expectedClass and expectedType with information on the data type of the
235 /// object/values contained in this branch (and thus the type of pointers
236 /// expected to be passed to Set[Branch]Address
237 /// return 0 in case of success and > 0 in case of failure.
238 
239 Int_t TBranchObject::GetExpectedType(TClass *&expectedClass,EDataType &expectedType)
240 {
241  expectedClass = 0;
242  expectedType = kOther_t;
243  TLeafObject* lobj = (TLeafObject*) GetListOfLeaves()->At(0);
244  if (!lobj) {
245  Error("GetExpectedType", "Did not find any leaves in %s",GetName());
246  return 1;
247  }
248  expectedClass = lobj->GetClass();
249  return 0;
250 }
251 
252 ////////////////////////////////////////////////////////////////////////////////
253 /// Return TRUE if more than one leaf or if fBrowsables, FALSE otherwise.
254 
256 {
257  Int_t nbranches = fBranches.GetEntriesFast();
258 
259  if (nbranches >= 1) {
260  return kTRUE;
261  }
262 
263  TList* browsables = const_cast<TBranchObject*>(this)->GetBrowsables();
264 
265  return browsables && browsables->GetSize();
266 }
267 
268 ////////////////////////////////////////////////////////////////////////////////
269 /// Print TBranch parameters.
270 
271 void TBranchObject::Print(Option_t* option) const
272 {
273  Int_t nbranches = fBranches.GetEntriesFast();
274  if (nbranches) {
275  Printf("*Branch :%-9s : %-54s *", GetName(), GetTitle());
276  Printf("*Entries : %8d : BranchObject (see below) *", Int_t(fEntries));
277  Printf("*............................................................................*");
278  for (Int_t i = 0; i < nbranches; ++i) {
279  TBranch* branch = (TBranch*) fBranches.At(i);
280  if (branch) {
281  branch->Print(option);
282  }
283  }
284  } else {
285  TBranch::Print(option);
286  }
287 }
288 
289 ////////////////////////////////////////////////////////////////////////////////
290 /// Reset a branch.
291 ///
292 /// - Existing buffers are deleted.
293 /// - Entries, max and min are reset.
294 
296 {
297  TBranch::Reset(option);
298 
299  Int_t nbranches = fBranches.GetEntriesFast();
300  for (Int_t i = 0; i < nbranches; ++i) {
301  TBranch* branch = (TBranch*) fBranches[i];
302  branch->Reset(option);
303  }
304 }
305 
306 ///______________________________________________________________________________
308 {
309  // Reset a Branch after a Merge operation (drop data but keep customizations)
310  //
311 
313 
314  Int_t nbranches = fBranches.GetEntriesFast();
315  for (Int_t i = 0; i < nbranches; ++i) {
316  TBranch* branch = (TBranch*) fBranches[i];
317  branch->ResetAfterMerge(info);
318  }
319 }
320 
321 ////////////////////////////////////////////////////////////////////////////////
322 /// Set address of this branch.
323 
325 {
326  if (TestBit(kDoNotProcess)) {
327  return;
328  }
329 
330  // Special case when called from code generated by TTree::MakeClass.
331  if (Long_t(add) == -1) {
332  SetBit(kWarn);
333  return;
334  }
335 
336  fReadEntry = -1;
337  Int_t nbranches = fBranches.GetEntriesFast();
338 
339  TLeaf* leaf = (TLeaf*) fLeaves.UncheckedAt(0);
340  if (leaf) {
341  leaf->SetAddress(add);
342  }
343 
344  fAddress = (char*) add;
345  char** ppointer = (char**) add;
346 
347  char* obj = 0;
348  if (ppointer) {
349  obj = *ppointer;
350  }
351 
353 
354  if (!cl) {
355  for (Int_t i = 0; i < nbranches; ++i) {
356  TBranch* br = (TBranch*) fBranches[i];
357  br->SetAddress(obj);
358  }
359  return;
360  }
361 
362  if (ppointer && !obj) {
363  obj = (char*) cl->New();
364  *ppointer = obj;
365  }
366 
367  if (!cl->GetListOfRealData()) {
368  cl->BuildRealData(obj);
369  }
370 
371  if (cl->InheritsFrom(TClonesArray::Class())) {
372  if (ppointer) {
373  TClonesArray* clones = (TClonesArray*) *ppointer;
374  if (!clones) {
375  Error("SetAddress", "Pointer to TClonesArray is null");
376  return;
377  }
378  TClass* clm = clones->GetClass();
379  if (clm) {
380  clm->BuildRealData(); //just in case clm derives from an abstract class
381  clm->GetStreamerInfo();
382  }
383  }
384  }
385 
386  //
387  // Loop over our data members looking
388  // for sub-branches for them. If we
389  // find one, set its address.
390  //
391 
392  char* fullname = new char[200];
393 
394  const char* bname = GetName();
395 
396  Int_t isDot = 0;
397  if (bname[strlen(bname)-1] == '.') {
398  isDot = 1;
399  }
400 
401  char* pointer = 0;
402  TRealData* rd = 0;
404  while ((rd = (TRealData*) next())) {
405  if (rd->TestBit(TRealData::kTransient)) continue;
406 
407  TDataMember* dm = rd->GetDataMember();
408  if (!dm || !dm->IsPersistent()) {
409  continue;
410  }
411  const char* rdname = rd->GetName();
412  TDataType* dtype = dm->GetDataType();
413  Int_t code = 0;
414  if (dtype) {
415  code = dm->GetDataType()->GetType();
416  }
417  Int_t offset = rd->GetThisOffset();
418  if (ppointer) {
419  pointer = obj + offset;
420  }
421  TBranch* branch = 0;
422  if (dm->IsaPointer()) {
423  TClass* clobj = 0;
424  if (!dm->IsBasic()) {
425  clobj = TClass::GetClass(dm->GetTypeName());
426  }
427  if (clobj && clobj->InheritsFrom(TClonesArray::Class())) {
428  if (isDot) {
429  snprintf(fullname,200, "%s%s", bname, &rdname[1]);
430  } else {
431  snprintf(fullname,200, "%s", &rdname[1]);
432  }
433  branch = (TBranch*) fBranches.FindObject(fullname);
434  } else {
435  if (!clobj) {
436  // this is a basic type we can handle only if
437  // it has a dimension:
438  const char* index = dm->GetArrayIndex();
439  if (!index[0]) {
440  if (code == 1) {
441  // Case of a string ... we do not need the size
442  if (isDot) {
443  snprintf(fullname,200, "%s%s", bname, &rdname[0]);
444  } else {
445  snprintf(fullname,200, "%s", &rdname[0]);
446  }
447  } else {
448  continue;
449  }
450  }
451  if (isDot) {
452  snprintf(fullname,200, "%s%s", bname, &rdname[0]);
453  } else {
454  snprintf(fullname,200, "%s", &rdname[0]);
455  }
456  // let's remove the stars!
457  UInt_t cursor;
458  UInt_t pos;
459  for (cursor = 0, pos = 0; cursor < strlen(fullname); ++cursor) {
460  if (fullname[cursor] != '*') {
461  fullname[pos++] = fullname[cursor];
462  }
463  }
464  fullname[pos] = '\0';
465  branch = (TBranch*) fBranches.FindObject(fullname);
466  } else {
467  if (!clobj->IsTObject()) {
468  continue;
469  }
470  if (isDot) {
471  snprintf(fullname,200, "%s%s", bname, &rdname[1]);
472  } else {
473  snprintf(fullname,200, "%s", &rdname[1]);
474  }
475  branch = (TBranch*) fBranches.FindObject(fullname);
476  }
477  }
478  } else {
479  if (dm->IsBasic()) {
480  if (isDot) {
481  snprintf(fullname,200, "%s%s", bname, &rdname[0]);
482  } else {
483  snprintf(fullname,200, "%s", &rdname[0]);
484  }
485  branch = (TBranch*) fBranches.FindObject(fullname);
486  }
487  }
488  if (branch) {
489  branch->SetAddress(pointer);
490  }
491  }
492 
493  delete[] fullname;
494 }
495 
496 ////////////////////////////////////////////////////////////////////////////////
497 /// Set the AutoDelete bit.
498 ///
499 /// This function can be used to instruct Root in TBranchObject::ReadBasket
500 /// to not delete the object referenced by a branchobject before reading a
501 /// new entry. By default, the object is deleted.
502 /// - If autodel is kTRUE, this existing object will be deleted, a new object
503 /// created by the default constructor, then object->Streamer called.
504 /// - If autodel is kFALSE, the existing object is not deleted. Root assumes
505 /// that the user is taking care of deleting any internal object or array
506 /// This can be done in Streamer itself.
507 /// - If this branch has sub-branches, the function sets autodel for these
508 /// branches as well.
509 /// We STRONGLY suggest to activate this option by default when you create
510 /// the top level branch. This will make the read phase more efficient
511 /// because it minimizes the numbers of new/delete operations.
512 /// Once this option has been set and the Tree is written to a file, it is
513 /// not necessary to specify the option again when reading, unless you
514 /// want to set the opposite mode.
515 
517 {
518  TBranch::SetAutoDelete(autodel);
519 
520  Int_t nbranches = fBranches.GetEntriesFast();
521  for (Int_t i=0;i<nbranches;i++) {
522  TBranch *branch = (TBranch*)fBranches[i];
523  branch->SetAutoDelete(autodel);
524  }
525 }
526 
527 ////////////////////////////////////////////////////////////////////////////////
528 /// Reset basket size for all subbranches of this branch.
529 
531 {
532  TBranch::SetBasketSize(buffsize);
533 
534  Int_t nbranches = fBranches.GetEntriesFast();
535  for (Int_t i = 0; i < nbranches; ++i) {
536  TBranch* branch = (TBranch*) fBranches[i];
537  branch->SetBasketSize(fBasketSize);
538  }
539 }
540 
541 ////////////////////////////////////////////////////////////////////////////////
542 /// Stream an object of class TBranchObject.
543 
544 void TBranchObject::Streamer(TBuffer& R__b)
545 {
546  if (R__b.IsReading()) {
548  } else {
549  TDirectory* dirsav = fDirectory;
550  fDirectory = 0; // to avoid recursive calls
551 
553 
554  // make sure that all TStreamerInfo objects referenced by
555  // this class are written to the file
556  R__b.ForceWriteInfo(TClass::GetClass(fClassName.Data())->GetStreamerInfo(), kTRUE);
557 
558  // if branch is in a separate file save this branch
559  // as an independent key
560  if (!dirsav) {
561  return;
562  }
563  if (!dirsav->IsWritable()) {
564  fDirectory = dirsav;
565  return;
566  }
567  TDirectory* pdirectory = fTree->GetDirectory();
568  if (!pdirectory) {
569  fDirectory = dirsav;
570  return;
571  }
572  const char* treeFileName = pdirectory->GetFile()->GetName();
573  TBranch* mother = GetMother();
574  const char* motherFileName = treeFileName;
575  if (mother && (mother != this)) {
576  motherFileName = mother->GetFileName();
577  }
578  if ((fFileName.Length() > 0) && strcmp(motherFileName, fFileName.Data())) {
579  dirsav->WriteTObject(this);
580  }
581  fDirectory = dirsav;
582  }
583 }
584 
585 ////////////////////////////////////////////////////////////////////////////////
586 /// -- If the branch address is not set, we set all addresses starting with
587 /// the top level parent branch. This is required to be done in order for
588 /// GetOffset to be correct and for GetEntry to run.
589 
591 {
592  if (fAddress == 0) {
593  // try to create object
594  if (!TestBit(kWarn)) {
596  if (cl) {
597  TObject** voidobj = (TObject**) new Long_t[1];
598  *voidobj = (TObject*) cl->New();
599  SetAddress(voidobj);
600  } else {
601  Warning("GetEntry", "Cannot get class: %s", fClassName.Data());
602  SetBit(kWarn);
603  }
604  }
605  }
606 }
607 
608 ////////////////////////////////////////////////////////////////////////////////
609 /// Update branch addresses if a new object was created.
610 
612 {
613  void** ppointer = (void**) fAddress;
614  if (!ppointer) {
615  return;
616  }
617  TObject* obj = (TObject*) (*ppointer);
618  if (obj != fOldObject) {
619  fOldObject = obj;
621  }
622 }
623 
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:2524
virtual Int_t WriteClassBuffer(const TClass *cl, void *pointer)=0
virtual void SetAddress(void *add)
Set address of this branch.
Definition: TBranch.cxx:2048
long long Long64_t
Definition: RtypesCore.h:69
Bool_t IsReading() const
Definition: TBuffer.h:81
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:328
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:5552
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:1726
Buffer base class used for serializing objects.
Definition: TBuffer.h:40
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:1153
TList * GetListOfRealData() const
Definition: TClass.h:405
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:395
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:4683
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:1964
virtual TFile * GetFile() const
Definition: TDirectory.h:152
virtual Int_t Fill()
Loop on all leaves of this branch to fill Basket buffer.
Definition: TBranch.cxx:723
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:1937
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:4337
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:381
void Destructor(void *obj, Bool_t dtorOnly=kFALSE)
Explicitly call destructor for object.
Definition: TClass.cxx:5040
TBranch * GetMother() const
Get our top-level parent branch in the tree.
Definition: TBranch.cxx:1532
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:1198
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:2095
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
virtual Int_t GetSize() const
Definition: TCollection.h:95
TClass * GetClass() const
Definition: TClonesArray.h:57
Describe directory structure in memory.
Definition: TDirectory.h:41
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:2881
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:1923
virtual Bool_t IsWritable() const
Definition: TDirectory.h:168
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:94
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:4579
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:406
virtual void SetAutoDelete(Bool_t autodel=kTRUE)
Set the automatic delete bit.
Definition: TBranch.cxx:2082
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