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