Reading streamer attributes

I have a simple ROOT file -

void basettree() {
    TFile *tfile = new TFile("basettree.root", "RECREATE");
    tfile->SetCompressionLevel(0);

    TTree *t = new TTree("t", "Base TTree");

    int i;

    t->Branch("intBranch", &i, 500, 0);
    for (int j=0; j<2; j++) {
        i = j;
        t->Fill();
    }
    t->Write();
    tfile->Close();
}

I can see the streamers like -

root [0] TFile f("basettree.root")
(TFile &) Name: basettree.root Title: 
root [1] f.ShowStreamerInfo();
OBJ: TList	TList	Doubly linked list : 0

StreamerInfo for class: TTree, version=20, checksum=0x7264e07f
  TNamed         BASE            offset=  0 type=67 The basis for a named object (name, title)
  TAttLine       BASE            offset=  0 type= 0 Line attributes     
  TAttFill       BASE            offset=  0 type= 0 Fill area attributes
  TAttMarker     BASE            offset=  0 type= 0 Marker attributes   
  Long64_t       fEntries        offset=  0 type=16 Number of entries   
  Long64_t       fTotBytes       offset=  0 type=16 Total number of bytes in all branches before compression
  Long64_t       fZipBytes       offset=  0 type=16 Total number of bytes in all branches after compression
  Long64_t       fSavedBytes     offset=  0 type=16 Number of autosaved bytes
  Long64_t       fFlushedBytes   offset=  0 type=16 Number of auto-flushed bytes
  double         fWeight         offset=  0 type= 8 Tree weight (see TTree::SetWeight)
  int            fTimerInterval  offset=  0 type= 3 Timer interval in milliseconds
  int            fScanField      offset=  0 type= 3 Number of runs before prompting in Scan
  int            fUpdate         offset=  0 type= 3 Update frequency for EntryLoop
  int            fDefaultEntryOffsetLen offset=  0 type= 3 Initial Length of fEntryOffset table in the basket buffers
  int            fNClusterRange  offset=  0 type= 6 Number of Cluster range in addition to the one defined by 'AutoFlush'
  Long64_t       fMaxEntries     offset=  0 type=16 Maximum number of entries in case of circular buffers
  Long64_t       fMaxEntryLoop   offset=  0 type=16 Maximum number of entries to process
  Long64_t       fMaxVirtualSize offset=  0 type=16 Maximum total size of buffers kept in memory
  Long64_t       fAutoSave       offset=  0 type=16 Autosave tree when fAutoSave entries written or -fAutoSave (compressed) bytes produced
  Long64_t       fAutoFlush      offset=  0 type=16 Auto-flush tree when fAutoFlush entries written or -fAutoFlush (compressed) bytes produced
  Long64_t       fEstimate       offset=  0 type=16 Number of entries to estimate histogram limits
  Long64_t*      fClusterRangeEnd offset=  0 type=56 [fNClusterRange] Last entry of a cluster range.
  Long64_t*      fClusterSize    offset=  0 type=56 [fNClusterRange] Number of entries in each cluster for a given range.
  ROOT::TIOFeatures fIOFeatures     offset=  0 type=62 IO features to define for newly-written baskets and branches.
  TObjArray      fBranches       offset=  0 type=61 List of Branches    
  TObjArray      fLeaves         offset=  0 type=61 Direct pointers to individual branch leaves
  TList*         fAliases        offset=  0 type=64 List of aliases for expressions based on the tree branches.
  TArrayD        fIndexValues    offset=  0 type=62 Sorted index values 
  TArrayI        fIndex          offset=  0 type=62 Index of sorted values
  TVirtualIndex* fTreeIndex      offset=  0 type=64 Pointer to the tree Index (if any)
  TList*         fFriends        offset=  0 type=64 pointer to list of friend elements
  TList*         fUserInfo       offset=  0 type=64 pointer to a list of user objects associated to this Tree
  TBranchRef*    fBranchRef      offset=  0 type=64 Branch supporting the TRefTable (if any)

StreamerInfo for class: TNamed, version=1, checksum=0xdfb74a3c
  TObject        BASE            offset=  0 type=66 Basic ROOT object   
  TString        fName           offset=  0 type=65 object identifier   
  TString        fTitle          offset=  0 type=65 object title        

StreamerInfo for class: TObject, version=1, checksum=0x901bc02d
  unsigned int   fUniqueID       offset=  0 type=13 object unique identifier
  unsigned int   fBits           offset=  0 type=15 bit field status word

StreamerInfo for class: TAttLine, version=2, checksum=0x94074549
  short          fLineColor      offset=  0 type= 2 Line color          
  short          fLineStyle      offset=  0 type= 2 Line style          
  short          fLineWidth      offset=  0 type= 2 Line width          

StreamerInfo for class: TAttFill, version=2, checksum=0xffd92a92
  short          fFillColor      offset=  0 type= 2 Fill area color     
  short          fFillStyle      offset=  0 type= 2 Fill area style     

StreamerInfo for class: TAttMarker, version=2, checksum=0x291d8bec
  short          fMarkerColor    offset=  0 type= 2 Marker color        
  short          fMarkerStyle    offset=  0 type= 2 Marker style        
  float          fMarkerSize     offset=  0 type= 5 Marker size         

StreamerInfo for class: ROOT::TIOFeatures, version=1, checksum=0x1aa12f10
  unsigned char  fIOBits         offset=  0 type=11                     

StreamerInfo for class: TBranch, version=13, checksum=0x10978aac
  TNamed         BASE            offset=  0 type=67 The basis for a named object (name, title)
  TAttFill       BASE            offset=  0 type= 0 Fill area attributes
  int            fCompress       offset=  0 type= 3 Compression level and algorithm
  int            fBasketSize     offset=  0 type= 3 Initial Size of  Basket Buffer
  int            fEntryOffsetLen offset=  0 type= 3 Initial Length of fEntryOffset table in the basket buffers
  int            fWriteBasket    offset=  0 type= 3 Last basket number written
  Long64_t       fEntryNumber    offset=  0 type=16 Current entry number (last one filled in this branch)
  ROOT::TIOFeatures fIOFeatures     offset=  0 type=62 IO features for newly-created baskets.
  int            fOffset         offset=  0 type= 3 Offset of this branch
  int            fMaxBaskets     offset=  0 type= 6 Maximum number of Baskets so far
  int            fSplitLevel     offset=  0 type= 3 Branch split level  
  Long64_t       fEntries        offset=  0 type=16 Number of entries   
  Long64_t       fFirstEntry     offset=  0 type=16 Number of the first entry in this branch
  Long64_t       fTotBytes       offset=  0 type=16 Total number of bytes in all leaves before compression
  Long64_t       fZipBytes       offset=  0 type=16 Total number of bytes in all leaves after compression
  TObjArray      fBranches       offset=  0 type=61 -> List of Branches of this branch
  TObjArray      fLeaves         offset=  0 type=61 -> List of leaves of this branch
  TObjArray      fBaskets        offset=  0 type=61 -> List of baskets of this branch
  int*           fBasketBytes    offset=  0 type=43 [fMaxBaskets] Length of baskets on file
  Long64_t*      fBasketEntry    offset=  0 type=56 [fMaxBaskets] Table of first entry in each basket
  Long64_t*      fBasketSeek     offset=  0 type=56 [fMaxBaskets] Addresses of baskets on file
  TString        fFileName       offset=  0 type=65 Name of file where buffers are stored ("" if in same file as Tree header)

StreamerInfo for class: TLeafI, version=1, checksum=0x7e6aae19
  TLeaf          BASE            offset=  0 type= 0 Leaf: description of a Branch data type
  int            fMinimum        offset=  0 type= 3 Minimum value if leaf range is specified
  int            fMaximum        offset=  0 type= 3 Maximum value if leaf range is specified

StreamerInfo for class: TLeaf, version=2, checksum=0x6d1e8152
  TNamed         BASE            offset=  0 type=67 The basis for a named object (name, title)
  int            fLen            offset=  0 type= 3 Number of fixed length elements in the leaf's data.
  int            fLenType        offset=  0 type= 3 Number of bytes for this data type
  int            fOffset         offset=  0 type= 3 Offset in ClonesArray object (if one)
  bool           fIsRange        offset=  0 type=18 (=kTRUE if leaf has a range, kFALSE otherwise)
  bool           fIsUnsigned     offset=  0 type=18 (=kTRUE if unsigned, kFALSE otherwise)
  TLeaf*         fLeafCount      offset=  0 type=64 Pointer to Leaf count if variable length (we do not own the counter)

StreamerInfo for class: TList, version=5, checksum=0x69c5c3bb
  TSeqCollection BASE            offset=  0 type= 0 Sequenceable collection ABC

StreamerInfo for class: TSeqCollection, version=0, checksum=0xfc6c3bc6
  TCollection    BASE            offset=  0 type= 0 Collection abstract base class

StreamerInfo for class: TCollection, version=3, checksum=0x57e3cb9c
  TObject        BASE            offset=  0 type=66 Basic ROOT object   
  TString        fName           offset=  0 type=65 name of the collection
  int            fSize           offset=  0 type= 3 number of elements in collection

StreamerInfo for class: TString, version=2, checksum=0x17419

StreamerInfo for class: TBranchRef, version=1, checksum=0x2360b3fd
  TBranch        BASE            offset=  0 type= 0 Branch descriptor   
  TRefTable*     fRefTable       offset=  0 type=64 pointer to the TRefTable

StreamerInfo for class: TRefTable, version=3, checksum=0x8c895b85
  TObject        BASE            offset=  0 type=66 Basic ROOT object   
  int            fSize           offset=  0 type= 3 dummy for backward compatibility
  TObjArray*     fParents        offset=  0 type=64 array of Parent objects  (eg TTree branch) holding the referenced objects
  TObject*       fOwner          offset=  0 type=64 Object owning this TRefTable
  vector<string> fProcessGUIDs   offset=  0 type=300 ,stl=1, ctype=61, UUIDs of TProcessIDs used in fParentIDs

StreamerInfo for class: TObjArray, version=3, checksum=0xa99e6552
  TSeqCollection BASE            offset=  0 type= 0 Sequenceable collection ABC
  int            fLowerBound     offset=  0 type= 3 Lower bound of the array
  int            fLast           offset=  0 type= 3 Last element in array containing an object
 OBJ: TList	listOfRules	Doubly linked list : 0
  OBJ: TObjString	type=read sourceClass="TTree" targetClass="TTree" version="[-16]" source="" target="fDefaultEntryOffsetLen" code="{ fDefaultEntryOffsetLen = 1000; }" 	Collectable string class : 0 at: 0x556b093dd510
  OBJ: TObjString	type=read sourceClass="TTree" targetClass="TTree" version="[-18]" source="" target="fNClusterRange" code="{ fNClusterRange = 0; }" 	Collectable string class : 0 at: 0x556b093dd5a0

Is there a way to check the values of specific streamer attributes? For eg. - I want to check the value of fBaskets of the TBranch intBranch.

Hi @Reik ,

Our I/O expert @pcanal will be back on Monday, I suggest that we wait for his answer.

Is there a way to check the values of specific streamer attributes?

What are you trying to accomplish? I.e. what is the higher level task/question you are trying to accomplish/answer?

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.