Logo ROOT   6.08/07
Reference Guide
TBranchSTL.cxx
Go to the documentation of this file.
1 // @(#)root/tree:$Id$
2 // Author Lukasz Janyst <ljanyst@cern.ch> 23/01/2008
3 
4 /** \class TBranchSTL
5 \ingroup tree
6 
7 A Branch handling STL collection of pointers (vectors, lists, queues,
8 sets and multisets) while storing them in split mode.
9 */
10 
11 #include "TBranchSTL.h"
12 #include "TBuffer.h"
13 #include "TList.h"
14 #include "TBranchElement.h"
15 #include "TBasket.h"
16 #include "TStreamerInfo.h"
17 #include "TStreamerElement.h"
18 #include <string>
19 #include <utility>
20 
21 #include "TError.h"
22 
24 
25 ////////////////////////////////////////////////////////////////////////////////
26 /// Default constructor.
27 
29  fCollProxy( 0 ),
30  fParent( 0 ),
31  fIndArrayCl( 0 ),
32  fClassVersion( 0 ),
33  fClCheckSum( 0 ),
34  fInfo( 0 ),
35  fObject( 0 ),
36  fID( -2 )
37 {
38  fIndArrayCl = TClass::GetClass( "TIndArray" );
39  fBranchVector.reserve( 25 );
40  fNleaves = 0;
41  fReadLeaves = (ReadLeaves_t)&TBranchSTL::ReadLeavesImpl;
42  fFillLeaves = (FillLeaves_t)&TBranchSTL::FillLeavesImpl;
43 }
44 
45 ////////////////////////////////////////////////////////////////////////////////
46 /// Normal constructor, called from TTree.
47 
49  TVirtualCollectionProxy *collProxy,
50  Int_t buffsize, Int_t splitlevel )
51 {
52  fTree = tree;
53  fCollProxy = collProxy;
54  fBasketSize = buffsize;
55  fSplitLevel = splitlevel;
56  fContName = collProxy->GetCollectionClass()->GetName();
57  fClCheckSum = 0;
58  fClassVersion = 1;
59  fID = -2;
60  fInfo = 0;
61  fMother = this;
62  fParent = 0;
64  fFileName = "";
65  SetName( name );
66  fIndArrayCl = TClass::GetClass( "TIndArray" );
67  fBranchVector.reserve( 25 );
68  fNleaves = 0;
71 
72  //---------------------------------------------------------------------------
73  // Allocate and initialize the basket control arrays
74  /////////////////////////////////////////////////////////////////////////////
75 
79 
80  for (Int_t i = 0; i < fMaxBaskets; ++i) {
81  fBasketBytes[i] = 0;
82  fBasketEntry[i] = 0;
83  fBasketSeek[i] = 0;
84  }
85 
86 }
87 
88 ////////////////////////////////////////////////////////////////////////////////
89 /// Normal constructor, called from another branch.
90 
91 TBranchSTL::TBranchSTL( TBranch* parent, const char* name,
92  TVirtualCollectionProxy* collProxy,
93  Int_t buffsize, Int_t splitlevel,
94  TStreamerInfo* info, Int_t id )
95 {
96  fTree = parent->GetTree();
97  fCollProxy = collProxy;
98  fBasketSize = buffsize;
99  fSplitLevel = splitlevel;
100  fContName = collProxy->GetCollectionClass()->GetName();
101  fClassName = info->GetClass()->GetName();
102  fClassVersion = info->GetClassVersion();
103  fClCheckSum = info->GetClass()->GetCheckSum();
104  fInfo = info;
105  fID = id;
106  fMother = parent->GetMother();
107  fParent = parent;
109  fFileName = "";
110  fNleaves = 0;
113 
114  SetName( name );
115  fIndArrayCl = TClass::GetClass( "TIndArray" );
116  fBranchVector.reserve( 25 );
117 
118  //---------------------------------------------------------------------------
119  // Allocate and initialize the basket control arrays
120  /////////////////////////////////////////////////////////////////////////////
121 
125 
126  for (Int_t i = 0; i < fMaxBaskets; ++i) {
127  fBasketBytes[i] = 0;
128  fBasketEntry[i] = 0;
129  fBasketSeek[i] = 0;
130  }
131 
132 }
133 
134 ////////////////////////////////////////////////////////////////////////////////
135 /// Destructor.
136 
138 {
139  BranchMap_t::iterator brIter;
140  for( brIter = fBranchMap.begin(); brIter != fBranchMap.end(); ++brIter ) {
141  (*brIter).second.fPointers->clear();
142  delete (*brIter).second.fPointers;
143  }
144 }
145 
146 ////////////////////////////////////////////////////////////////////////////////
147 /// Browse a STL branch.
148 
150 {
151  Int_t nbranches = fBranches.GetEntriesFast();
152  if (nbranches > 0) {
153  TList persistentBranches;
154  TBranch* branch=0;
155  TIter iB(&fBranches);
156  while( (branch = (TBranch*)iB()) )
157  persistentBranches.Add(branch);
158  persistentBranches.Browse( b );
159  }
160 }
161 
162 ////////////////////////////////////////////////////////////////////////////////
163 /// Cleanup after revious fill.
164 
166 {
167  BranchMap_t::iterator brIter;
168  for( brIter = fBranchMap.begin(); brIter != fBranchMap.end(); ++brIter )
169  (*brIter).second.fPointers->clear();
170 
171  //---------------------------------------------------------------------------
172  // Check if we're dealing with the null pointer here
173  /////////////////////////////////////////////////////////////////////////////
174  ///------------------------------------------------------------------------
175  /// We have received a zero pointer - treat it as an empty collection
176  ///------------------------------------------------------------------------
177 
178  if( fAddress != fObject ) {
179  if( fObject == 0 ) {
180  Int_t bytes = 0;
181  Int_t totalBytes = 0;
182 
183  //---------------------------------------------------------------------
184  // Store the indices
185  ///////////////////////////////////////////////////////////////////////
186 
187  fInd.SetNumItems( 0 );
188  bytes = TBranch::Fill();
189 
190  if( bytes < 0 ) {
191  Error( "Fill", "The IO error while writing the indices!");
192  return -1;
193  }
194  totalBytes += bytes;
195 
196  //---------------------------------------------------------------------
197  // Store the branches
198  ///////////////////////////////////////////////////////////////////////
199 
200  for( Int_t i = 0; i < fBranches.GetEntriesFast(); ++i ) {
201  TBranch *br = (TBranch *)fBranches.UncheckedAt(i);
202  bytes = br->Fill();
203  if( bytes < 0 ) {
204  Error( "Fill", "The IO error while writing the branch %s!", br->GetName() );
205  return -1;
206  }
207  totalBytes += bytes;
208  }
209  return totalBytes;
210  }
211  }
212 
213  //---------------------------------------------------------------------------
214  // Set upt the collection proxy
215  /////////////////////////////////////////////////////////////////////////////
216 
218  UInt_t size = fCollProxy->Size();
219 
220  //---------------------------------------------------------------------------
221  // Set up the container of indices
222  /////////////////////////////////////////////////////////////////////////////
223 
224  if( fInd.GetCapacity() < size )
225  fInd.ClearAndResize( size );
226 
227  fInd.SetNumItems( size );
228 
229  //---------------------------------------------------------------------------
230  // Loop over the elements and create branches as needed
231  /////////////////////////////////////////////////////////////////////////////
232 
234  TClass* actClass = 0;
235  TClass* vectClass = 0;
236  char* element = 0;
237  std::vector<void*>* elPointers = 0;
238  TBranchElement* elBranch = 0;
239  UInt_t elOffset = 0;
240  UChar_t maxID = fBranches.GetEntriesFast()+1;
241  UChar_t elID;
242  ElementBranchHelper_t bHelper;
243  Int_t totalBytes = 0;
244  Int_t bytes = 0;
245  TString brName;
246 
247  for( UInt_t i = 0; i < size; ++i ) {
248  //------------------------------------------------------------------------
249  // Determine the actual class of current element
250  //////////////////////////////////////////////////////////////////////////
251 
252  element = *(char**)fCollProxy->At( i );
253  if( !element ) {
254  fInd.At(i) = 0;
255  continue;
256  }
257 
258  // coverity[dereference] since this is a TBranchSTL by definition the collection contains pointers to objects.
259  actClass = cl->GetActualClass( element );
260  brIter = fBranchMap.find( actClass );
261 
262  //------------------------------------------------------------------------
263  // The branch was not found - create a new one
264  //////////////////////////////////////////////////////////////////////////
265  ///---------------------------------------------------------------------
266  /// Find the dictionary for vector of pointers to this class
267  ///---------------------------------------------------------------------
268 
269  if( brIter == fBranchMap.end() ) {
270  std::string vectClName("vector<");
271  vectClName += actClass->GetName() + std::string("*>");
272  vectClass = TClass::GetClass( vectClName.c_str() );
273  if( !vectClass ) {
274  Warning( "Fill", "Unable to find dictionary for class %s", vectClName.c_str() );
275  continue;
276  }
277 
278  //---------------------------------------------------------------------
279  // Create the vector of pointers to objects of this type and new branch
280  // for it
281  ///////////////////////////////////////////////////////////////////////
282  /// The top level branch already has a trailing dot.
283 
284  elPointers = new std::vector<void*>();//vectClass->GetCollectionProxy()->New();
285  if (fName.Length() && fName[fName.Length()-1]=='.') {
286  brName.Form( "%s%s", GetName(), actClass->GetName() );
287  } else {
288  brName.Form( "%s.%s", GetName(), actClass->GetName() );
289  }
290  elBranch = new TBranchElement( this, brName,
291  vectClass->GetCollectionProxy(),
293  elID = maxID++;
294  elBranch->SetFirstEntry( fEntryNumber );
295 
296  fBranches.Add( elBranch );
297 
298  bHelper.fId = elID;
299  bHelper.fBranch = elBranch;
300  bHelper.fPointers = elPointers;
301  bHelper.fBaseOffset = actClass->GetBaseClassOffset( cl );
302 
303  // This copies the value of fPointes into the vector and transfers
304  // its ownership to the vector. It will be deleted in ~TBranch.
305  brIter = fBranchMap.insert(std::make_pair(actClass, bHelper ) ).first;
306  elBranch->SetAddress( &((*brIter).second.fPointers) );
307  }
308  //------------------------------------------------------------------------
309  // The branch for this type already exists - set up the pointers
310  //////////////////////////////////////////////////////////////////////////
311 
312  else {
313  elPointers = (*brIter).second.fPointers;
314  elBranch = (*brIter).second.fBranch;
315  elID = (*brIter).second.fId;
316  elOffset = (*brIter).second.fBaseOffset;
317  }
318 
319  //-------------------------------------------------------------------------
320  // Add the element to the appropriate vector
321  //////////////////////////////////////////////////////////////////////////
322 
323  elPointers->push_back( element + elOffset );
324  fInd.At(i) = elID;
325  }
326 
327  //----------------------------------------------------------------------------
328  // Store the indices
329  /////////////////////////////////////////////////////////////////////////////
330 
331  bytes = TBranch::Fill();
332  if( bytes < 0 ) {
333  Error( "Fill", "The IO error while writing the indices!");
334  return -1;
335  }
336  totalBytes += bytes;
337 
338  //----------------------------------------------------------------------------
339  // Fill the branches
340  /////////////////////////////////////////////////////////////////////////////
341 
342  for( Int_t i = 0; i < fBranches.GetEntriesFast(); ++i ) {
343  TBranch *br = (TBranch *)fBranches.UncheckedAt(i);
344  bytes = br->Fill();
345  if( bytes < 0 ) {
346  Error( "Fill", "The IO error while writing the branch %s!", br->GetName() );
347  return -1;
348  }
349  totalBytes += bytes;
350  }
351 
352  return totalBytes;
353 }
354 
355 ////////////////////////////////////////////////////////////////////////////////
356 /// Check if we should be doing this at all.
357 
359 {
360  if( TestBit( kDoNotProcess ) && !getall )
361  return 0;
362 
363  if ( (entry < fFirstEntry) || (entry >= fEntryNumber) )
364  return 0;
365 
366  if( !fAddress )
367  return 0;
368 
369  //---------------------------------------------------------------------------
370  // Set up the collection proxy
371  /////////////////////////////////////////////////////////////////////////////
372 
373  if( !fCollProxy ) {
375 
376  if( !cl ) {
377  Error( "GetEntry", "Dictionary class not found for: %s", fContName.Data() );
378  return -1;
379  }
380 
382  if( !fCollProxy ) {
383  Error( "GetEntry", "No collection proxy!" );
384  return -1;
385  }
386  }
387 
388  //---------------------------------------------------------------------------
389  // Get the indices
390  /////////////////////////////////////////////////////////////////////////////
391 
392  Int_t totalBytes = 0;
393  Int_t bytes = TBranch::GetEntry( entry, getall );
394  totalBytes += bytes;
395 
396  if( bytes == 0 )
397  return 0;
398 
399  if( bytes < 0 ) {
400  Error( "GetEntry", "IO error! Unable to get the indices!" );
401  return -1;
402  }
403 
404  Int_t size = fInd.GetNumItems();
405 
406  //---------------------------------------------------------------------------
407  // Set up vector pointers
408  /////////////////////////////////////////////////////////////////////////////
409 
410  UInt_t nBranches = fBranches.GetEntriesFast();
411  TClass* elClass = fCollProxy->GetValueClass();
412  TClass* tmpClass = 0;
413 
414  if( fBranchVector.size() < nBranches )
415  fBranchVector.resize( nBranches );
416 
417  //---------------------------------------------------------------------------
418  // Create the object
419  /////////////////////////////////////////////////////////////////////////////
420 
421  if( fAddress != fObject ) {
422  *((void **)fAddress) = fCollProxy->New();
423  fObject = *(char**)fAddress;
424  }
426  void* env = fCollProxy->Allocate( size, kTRUE );
427 
428  //---------------------------------------------------------------------------
429  // Process entries
430  /////////////////////////////////////////////////////////////////////////////
431 
432  UChar_t index = 0;
433  void** element = 0;
434  std::vector<void*>* elemVect = 0;
435  TBranchElement* elemBranch = 0;
436 
437  for( Int_t i = 0; i < size; ++i ) {
438  element = (void**)fCollProxy->At(i);
439  index = fInd.At(i);
440 
441  //------------------------------------------------------------------------
442  // The case of zero pointers
443  //////////////////////////////////////////////////////////////////////////
444 
445  if( index == 0 ) {
446  *element = 0;
447  continue;
448  }
449 
450  //-------------------------------------------------------------------------
451  // Index out of range!
452  //////////////////////////////////////////////////////////////////////////
453 
454  if( index > nBranches ) {
455  Error( "GetEntry", "Index %d out of range, unable to find the branch, setting pointer to 0",
456  index );
457  *element = 0;
458  continue;
459  }
460 
461  //------------------------------------------------------------------------
462  // Load unloaded branch
463  //////////////////////////////////////////////////////////////////////////
464 
465  index--;
466  elemVect = fBranchVector[index].fPointers;
467  if( !elemVect ) {
468  elemBranch = (TBranchElement *)fBranches.UncheckedAt(index);
469  elemBranch->SetAddress( &(fBranchVector[index].fPointers) );
470 
471  bytes = elemBranch->GetEntry( entry, getall );
472 
473  if( bytes == 0 ) {
474  Error( "GetEntry", "No entry for index %d, setting pointer to 0", index );
475  *element = 0;
476  fBranchVector[index].fPosition++;
477  continue;
478  }
479 
480  if( bytes <= 0 ) {
481  Error( "GetEntry", "I/O error while getting entry for index %d, setting pointer to 0", index );
482  *element = 0;
483  fBranchVector[index].fPosition++;
484  continue;
485  }
486  totalBytes += bytes;
487  elemVect = fBranchVector[index].fPointers;
488 
489  //---------------------------------------------------------------------
490  // Calculate the base class offset
491  ///////////////////////////////////////////////////////////////////////
492 
493  TVirtualCollectionProxy *proxy = elemBranch->GetCollectionProxy();
494  if (!proxy) {
495  proxy = TClass::GetClass(elemBranch->GetClassName())->GetCollectionProxy();
496  }
497  if (proxy) {
498  tmpClass = proxy->GetValueClass();
499  if (tmpClass && elClass) {
500  fBranchVector[index].fBaseOffset = tmpClass->GetBaseClassOffset( elClass );
501  fBranchVector[index].fPosition = 0;
502  } else {
503  Error("GetEntry","Missing TClass for %s (%s)",elemBranch->GetName(),elemBranch->GetClassName());
504  }
505  } else {
506  Error("GetEntry","Missing CollectionProxy for %s (%s)",elemBranch->GetName(),elemBranch->GetClassName());
507  }
508  }
509 
510  //------------------------------------------------------------------------
511  // Set up the element
512  //////////////////////////////////////////////////////////////////////////
513 
514  *element = ((char*)(*elemVect)[fBranchVector[index].fPosition++])
515  - fBranchVector[index].fBaseOffset;
516 
517  }
518 
519  fCollProxy->Commit(env);
520 
521  //---------------------------------------------------------------------------
522  // Cleanup
523  /////////////////////////////////////////////////////////////////////////////
524 
525  for( UInt_t i = 0; i < fBranchVector.size(); ++i ) {
526  delete fBranchVector[i].fPointers;
527  fBranchVector[i].fPointers = 0;
528  }
529 
530  return totalBytes;
531 }
532 
533 ////////////////////////////////////////////////////////////////////////////////
534 /// Fill expectedClass and expectedType with information on the data type of the
535 /// object/values contained in this branch (and thus the type of pointers
536 /// expected to be passed to Set[Branch]Address
537 /// return 0 in case of success and > 0 in case of failure.
538 
539 Int_t TBranchSTL::GetExpectedType(TClass *&expectedClass,EDataType &expectedType)
540 {
541  expectedClass = 0;
542  expectedType = kOther_t;
543 
544  if (fID < 0) {
545  expectedClass = TClass::GetClass( fContName );
546  } else {
547  // Case of an object data member. Here we allow for the
548  // variable name to be ommitted. Eg, for Event.root with split
549  // level 1 or above Draw("GetXaxis") is the same as Draw("fH.GetXaxis()")
550  TStreamerElement* element = GetInfo()->GetElement(fID);
551  if (element) {
552  expectedClass = element->GetClassPointer();
553  if (!expectedClass) {
554  Error("GetExpectedType", "TBranchSTL did not find the TClass for %s", element->GetTypeNameBasic());
555  return 1;
556  }
557  } else {
558  Error("GetExpectedType", "Did not find the type for %s",GetName());
559  return 2;
560  }
561  }
562  return 0;
563 }
564 
565 ////////////////////////////////////////////////////////////////////////////////
566 /// Check if we don't have the streamer info.
567 
569 {
570  if( !fInfo ) {
571  //------------------------------------------------------------------------
572  // Get the class info
573  //////////////////////////////////////////////////////////////////////////
574 
576 
577  //------------------------------------------------------------------------
578  // Get unoptimized streamer info
579  //////////////////////////////////////////////////////////////////////////
580 
582 
583  //------------------------------------------------------------------------
584  // If the checksum is there and we're dealing with the foreign class
585  //////////////////////////////////////////////////////////////////////////
586  ///---------------------------------------------------------------------
587  /// Loop over the infos
588  ///---------------------------------------------------------------------
589 
590  if( fClCheckSum && !cl->IsVersioned() ) {
591  Int_t ninfos = cl->GetStreamerInfos()->GetEntriesFast() - 1;
592  for( Int_t i = -1; i < ninfos; ++i ) {
594  if( !info )
595  continue;
596 
597  //------------------------------------------------------------------
598  // If the checksum matches then retriev the info
599  ////////////////////////////////////////////////////////////////////
600 
601  if( info->GetCheckSum() == fClCheckSum ) {
602  fClassVersion = i;
604  }
605  }
606  }
607  }
608  return fInfo;
609 }
610 
611 ////////////////////////////////////////////////////////////////////////////////
612 /// Branch declared folder if at least one entry.
613 
615 {
616  if( fBranches.GetEntriesFast() >= 1 )
617  return kTRUE;
618  return kFALSE;
619 }
620 
621 ////////////////////////////////////////////////////////////////////////////////
622 /// Print the branch parameters.
623 
624 void TBranchSTL::Print(const char *option) const
625 {
626  if (strncmp(option,"debugAddress",strlen("debugAddress"))==0) {
627  if (strlen(GetName())>24) Printf("%-24s\n%-24s ", GetName(),"");
628  else Printf("%-24s ", GetName());
629 
630  TBranchElement *parent = dynamic_cast<TBranchElement*>(GetMother()->GetSubBranch(this));
631  Int_t ind = parent ? parent->GetListOfBranches()->IndexOf(this) : -1;
632  TVirtualStreamerInfo *info = GetInfo();
633  Int_t *branchOffset = parent ? parent->GetBranchOffset() : 0;
634 
635  Printf("%-16s %2d SplitCollPtr %-16s %-16s %8x %-16s n/a\n",
636  info ? info->GetName() : "StreamerInfo unvailable", fID,
637  GetClassName(), fParent ? fParent->GetName() : "n/a",
638  (branchOffset && parent && ind>=0) ? branchOffset[ind] : 0,
639  fObject);
640  for( Int_t i = 0; i < fBranches.GetEntriesFast(); ++i ) {
641  TBranch *br = (TBranch *)fBranches.UncheckedAt(i);
642  br->Print("debugAddressSub");
643  }
644  } else if (strncmp(option,"debugInfo",strlen("debugInfo"))==0) {
645  Printf("Branch %s uses:\n",GetName());
646  if (fID>=0) {
647  GetInfo()->GetElement(fID)->ls();
648  }
649  for (Int_t i = 0; i < fBranches.GetEntriesFast(); ++i) {
650  TBranchElement* subbranch = (TBranchElement*)fBranches.At(i);
651  subbranch->Print("debugInfoSub");
652  }
653  return;
654  } else {
655  TBranch::Print(option);
656  for( Int_t i = 0; i < fBranches.GetEntriesFast(); ++i ) {
657  TBranch *br = (TBranch *)fBranches.UncheckedAt(i);
658  br->Print(option);
659  }
660  }
661 }
662 
663 ////////////////////////////////////////////////////////////////////////////////
664 /// Read leaves.
665 
667 {
669 }
670 
671 ////////////////////////////////////////////////////////////////////////////////
672 /// Fill leaves.
673 
675 {
677 }
678 
679 ////////////////////////////////////////////////////////////////////////////////
680 /// We are the top level branch.
681 
682 void TBranchSTL::SetAddress( void* addr )
683 {
684  if( fID < 0 ) {
685  fAddress = (char*)addr;
686  fObject = *(char**)addr;
687  }
688  //---------------------------------------------------------------------------
689  // We are a data member of some other class
690  /////////////////////////////////////////////////////////////////////////////
691  ///------------------------------------------------------------------------
692  /// Get the appropriate streamer element
693  ///------------------------------------------------------------------------
694 
695  else {
696  GetInfo();
698 
699  //------------------------------------------------------------------------
700  // Set up the addresses
701  //////////////////////////////////////////////////////////////////////////
702 
703  if( el->IsaPointer() ) {
704  fAddress = (char*)addr+el->GetOffset();
705  fObject = *(char**)fAddress;
706  } else {
707  fAddress = (char*)addr+el->GetOffset();
708  fObject = (char*)addr+el->GetOffset();
709  }
710  }
711 }
Describe Streamer information for one class version.
Definition: TStreamerInfo.h:47
virtual const char * GetName() const
Returns name of object.
Definition: TNamed.h:51
virtual const char * GetClassName() const
Return the name of the user class whose content is stored in this branch, if any. ...
Definition: TBranchSTL.h:36
virtual Int_t GetEntry(Long64_t entry=0, Int_t getall=0)
Check if we should be doing this at all.
Definition: TBranchSTL.cxx:358
TVirtualCollectionProxy * GetCollectionProxy()
Return the collection proxy describing the branch content, if any.
const char * GetTypeNameBasic() const
Return type name of this element in case the type name is not a standard basic type, return the basic type name known to CINT.
virtual void * Allocate(UInt_t n, Bool_t forceDelete)=0
TString fContName
Class name of referenced object.
Definition: TBranchSTL.h:73
virtual Int_t WriteClassBuffer(const TClass *cl, void *pointer)=0
long long Long64_t
Definition: RtypesCore.h:69
UChar_t & At(Int_t ind)
Definition: TIndArray.h:38
virtual TClass * GetValueClass() const =0
ReadLeaves_t fReadLeaves
! Pointer to the ReadLeaves implementation to use.
Definition: TBranch.h:107
TStreamerElement * GetElement(Int_t id) const
Bool_t TestBit(UInt_t f) const
Definition: TObject.h:157
Int_t * GetBranchOffset() const
virtual TClass * GetClassPointer() const
Returns a pointer to the TClass of this element.
virtual void SetName(const char *name)
Set the name of the TNamed.
Definition: TNamed.cxx:131
TBranch * GetSubBranch(const TBranch *br) const
Find the parent branch of child.
Definition: TBranch.cxx:1572
virtual Bool_t IsFolder() const
Branch declared folder if at least one entry.
Definition: TBranchSTL.cxx:614
virtual void SetFirstEntry(Long64_t entry)
set the first entry number (case of TBranchSTL)
Definition: TBranch.cxx:2639
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:4368
virtual void Commit(void *)=0
Buffer base class used for serializing objects.
Definition: TBuffer.h:42
virtual TClass * GetCollectionClass() const
Basic string class.
Definition: TString.h:137
TVirtualCollectionProxy * GetCollectionProxy() const
Return the proxy describing the collection (if any).
Definition: TClass.cxx:2822
virtual void SetAddress(void *addobj)
Point this branch at an object.
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
const Bool_t kFALSE
Definition: Rtypes.h:92
virtual void * New() const
Int_t fNleaves
! Number of leaves
Definition: TBranch.h:78
TStreamerInfo * fInfo
! The streamer info
Definition: TBranchSTL.h:77
Long64_t * fBasketSeek
[fMaxBaskets] Addresses of baskets on file
Definition: TBranch.h:93
TObject * At(Int_t idx) const
Definition: TObjArray.h:167
virtual Int_t GetExpectedType(TClass *&clptr, EDataType &type)
Fill expectedClass and expectedType with information on the data type of the object/values contained ...
Definition: TBranchSTL.cxx:539
void FillLeavesImpl(TBuffer &b)
Fill leaves.
Definition: TBranchSTL.cxx:674
TIndArray fInd
! Indices
Definition: TBranchSTL.h:72
Int_t * fBasketBytes
[fMaxBaskets] Length of baskets on file
Definition: TBranch.h:91
Int_t fClassVersion
Version number of the class.
Definition: TBranchSTL.h:75
Long64_t fEntryNumber
Current entry number (last one filled in this branch)
Definition: TBranch.h:73
virtual TStreamerInfo * GetInfo() const
Check if we don&#39;t have the streamer info.
Definition: TBranchSTL.cxx:568
Int_t fID
Element serial number in the streamer info.
Definition: TBranchSTL.h:79
UInt_t GetCapacity()
Definition: TIndArray.h:35
Int_t GetBaseClassOffset(const TClass *toBase, void *address=0, bool isDerivedObject=true)
Definition: TClass.cxx:2717
virtual void SetAddress(void *addr)
We are the top level branch.
Definition: TBranchSTL.cxx:682
void ClearAndResize(UInt_t size)
Definition: TIndArray.h:27
TClass * fIndArrayCl
! Class of the ind array
Definition: TBranchSTL.h:71
UInt_t fClCheckSum
Class checksum.
Definition: TBranchSTL.h:76
UInt_t GetNumItems()
Definition: TIndArray.h:36
const Int_t kDoNotProcess
Definition: TBranch.h:52
TObjArray * GetListOfBranches()
Definition: TBranch.h:178
Int_t fMaxBaskets
Maximum number of Baskets so far.
Definition: TBranch.h:75
XFontStruct * id
Definition: TGX11.cxx:108
virtual void ls(Option_t *option="") const
Print the content of the element.
virtual Int_t GetEntry(Long64_t entry=0, Int_t getall=0)
Read all branches of a BranchElement and return total number of bytes.
const TObjArray * GetStreamerInfos() const
Definition: TClass.h:447
virtual ~TBranchSTL()
Destructor.
Definition: TBranchSTL.cxx:137
TString fClassName
Name of the parent class, if we&#39;re the data member.
Definition: TBranchSTL.h:74
Int_t fSplitLevel
Branch split level.
Definition: TBranch.h:77
A doubly linked list.
Definition: TList.h:47
virtual Int_t Fill()
Loop on all leaves of this branch to fill Basket buffer.
Definition: TBranch.cxx:737
Using a TBrowser one can browse all ROOT objects.
Definition: TBrowser.h:41
virtual void Print(Option_t *) const
Print the branch parameters.
Definition: TBranchSTL.cxx:624
void(TBranch::* ReadLeaves_t)(TBuffer &b)
Definition: TBranch.h:106
TClass * GetClass() const
Int_t fBasketSize
Initial Size of Basket Buffer.
Definition: TBranch.h:70
TVirtualCollectionProxy * fCollProxy
! Collection proxy
Definition: TBranchSTL.h:69
TBranchSTL()
Default constructor.
Definition: TBranchSTL.cxx:28
TClass * GetActualClass(const void *object) const
Return a pointer the the real class of the object.
Definition: TClass.cxx:2536
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
Definition: TString.cxx:2322
FillLeaves_t fFillLeaves
! Pointer to the FillLeaves implementation to use.
Definition: TBranch.h:109
unsigned int UInt_t
Definition: RtypesCore.h:42
Int_t GetEntriesFast() const
Definition: TObjArray.h:66
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition: TObject.cxx:925
Ssiz_t Length() const
Definition: TString.h:390
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:1217
The ROOT global object gROOT contains a list of all defined classes.
Definition: TClass.h:81
BranchMap_t fBranchMap
! Branch map
Definition: TBranchSTL.h:65
TString fName
Definition: TNamed.h:36
A Branch for the case of an object.
#define Printf
Definition: TGeoToOCC.h:18
virtual Int_t ReadClassBuffer(const TClass *cl, void *pointer, const TClass *onfile_class=0)=0
TObject * UncheckedAt(Int_t i) const
Definition: TObjArray.h:91
#define ClassImp(name)
Definition: Rtypes.h:279
void SetNumItems(UInt_t items)
Definition: TIndArray.h:37
std::vector< void * > * fPointers
Definition: TBranchSTL.h:58
TDirectory * GetDirectory() const
Definition: TTree.h:392
virtual Bool_t IsaPointer() const
virtual const char * GetClassName() const
Return the name of the user class whose content is stored in this branch, if any. ...
Int_t IndexOf(const TObject *obj) const
Definition: TObjArray.cxx:552
EDataType
Definition: TDataType.h:30
virtual void * At(UInt_t idx)=0
char * fObject
! Pointer to object at address or the
Definition: TBranchSTL.h:78
void ReadLeavesImpl(TBuffer &b)
Read leaves.
Definition: TBranchSTL.cxx:666
TTree * fTree
! Pointer to Tree header
Definition: TBranch.h:94
void Browse(TBrowser *b)
Browse this collection (called by TBrowser).
TDirectory * fDirectory
! Pointer to directory where this branch buffers are stored
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:2893
TObjArray * GetElements() const
A Branch handling STL collection of pointers (vectors, lists, queues, sets and multisets) while stori...
Definition: TBranchSTL.h:22
virtual UInt_t Size() const =0
Int_t GetClassVersion() const
TBranch * fParent
! Parent of this branch
Definition: TBranchSTL.h:70
virtual void Print(Option_t *option="") const
Print branch parameters.
Long64_t * fBasketEntry
[fMaxBaskets] Table of first entry in each basket
Definition: TBranch.h:92
virtual void Add(TObject *obj)
Definition: TList.h:81
Bool_t IsVersioned() const
Definition: TClass.h:463
void(TBranch::* FillLeaves_t)(TBuffer &b)
Definition: TBranch.h:108
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:95
TTree * GetTree() const
Definition: TBranch.h:184
std::vector< ElementBranchHelper_t > fBranchVector
! Branch vector
Definition: TBranchSTL.h:66
Definition: tree.py:1
void Add(TObject *obj)
Definition: TObjArray.h:75
A TTree object has a header with a name and a title.
Definition: TTree.h:98
virtual void Browse(TBrowser *b)
Browse a STL branch.
Definition: TBranchSTL.cxx:149
unsigned char UChar_t
Definition: RtypesCore.h:34
virtual Int_t Fill()
Cleanup after revious fill.
Definition: TBranchSTL.cxx:165
TObjArray fBranches
-> List of Branches of this branch
Definition: TBranch.h:88
UInt_t GetCheckSum(ECheckSum code=kCurrentCheckSum) const
Call GetCheckSum with validity check.
Definition: TClass.cxx:6073
A TTree is a list of TBranches.
Definition: TBranch.h:58
Abstract Interface class describing Streamer information for one class.
const Bool_t kTRUE
Definition: Rtypes.h:91
Int_t GetOffset() const
virtual void Print(Option_t *option="") const
Print TBranch parameters.
Definition: TBranch.cxx:1739
TString fFileName
Name of file where buffers are stored ("" if in same file as Tree header)
Definition: TBranch.h:99
Long64_t fFirstEntry
Number of the first entry in this branch.
Definition: TBranch.h:85
TBranch * GetMother() const
Get our top-level parent branch in the tree.
Definition: TBranch.cxx:1551
char name[80]
Definition: TGX11.cxx:109
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
Definition: TObject.cxx:911
virtual UInt_t GetCheckSum() const =0
const char * Data() const
Definition: TString.h:349
char * fAddress
! Address of 1st leaf (variable or object)
Definition: TBranch.h:97