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