Belle II Software  release-08-01-10
RawRootFile Class Reference

Classes

class  Key
 

Public Member Functions

def __init__ (self, filename)
 
def __del__ (self)
 
def normalize (self, end=None, seekfree=None, nbytesfree=None, nbytesname=None, seekinfo=None)
 
def __iter__ (self)
 
def __next__ (self)
 

Public Attributes

 rootfile
 binary root file
 
 version
 root/file format version
 
 large
 are file location pointers 4 or 8 bits?
 
 wordlen
 size of file location pointers
 
 begin
 pointer to first data record
 
 end
 pointer to first free word at the EOF
 
 seekfree
 pointer to FREE data record
 
 nbytesfree
 number of bytes in FREE data record
 
 nfree
 number of free data records
 
 nbytesname
 number of bytes in TNamed at creation time
 
 units
 number of bytes for file pointers
 
 compress
 compression level and algorithm
 
 seekinfo
 pointer to TStreamerInfo record
 
 nbytesinfo
 number of bytes in TStreamerInfo record
 
 uuid
 universal unique ID
 
 header
 binary header
 
 seekkeys
 pointer to KeysList record
 

Detailed Description

Interface to binary root file content

Definition at line 21 of file b2root.py.

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self,
  filename 
)
Open a root file and read its header

Definition at line 26 of file b2root.py.

26  def __init__(self, filename):
27  """
28  Open a root file and read its header
29  """
30 
31 
32  self.rootfile = open(filename, 'rb')
33  root = self.rootfile.read(4)
34  if root != b'root':
35  raise Exception("%s is not a root file" % filename)
36 
37  self.version = int.from_bytes(self.rootfile.read(4), byteorder)
38 
39  self.large = (self.version >= 1000000)
40 
41  self.wordlen = 8 if self.large else 4
42 
43  self.begin = int.from_bytes(self.rootfile.read(4), byteorder)
44 
45  self.end = int.from_bytes(self.rootfile.read(self.wordlen), byteorder)
46 
47  self.seekfree = int.from_bytes(self.rootfile.read(self.wordlen), byteorder)
48 
49  self.nbytesfree = int.from_bytes(self.rootfile.read(4), byteorder)
50 
51  self.nfree = int.from_bytes(self.rootfile.read(4), byteorder)
52 
53  self.nbytesname = int.from_bytes(self.rootfile.read(4), byteorder)
54 
55  self.units = int.from_bytes(self.rootfile.read(1), byteorder)
56 
57  self.compress = int.from_bytes(self.rootfile.read(4), byteorder)
58 
59  self.seekinfo = int.from_bytes(self.rootfile.read(self.wordlen), byteorder)
60 
61  self.nbytesinfo = int.from_bytes(self.rootfile.read(self.wordlen), byteorder)
62 
63  self.uuid = self.rootfile.read(18)
64  self.rootfile.seek(0)
65 
66  self.header = self.rootfile.read(self.begin)
67  self.rootfile.seek(self.begin)
68 
69  self.seekkeys = 0
70 

◆ __del__()

def __del__ (   self)
Close file

Definition at line 71 of file b2root.py.

Member Function Documentation

◆ __iter__()

def __iter__ (   self)
iterator interface

Definition at line 112 of file b2root.py.

◆ __next__()

def __next__ (   self)
Iterate to next key

Definition at line 210 of file b2root.py.

◆ normalize()

def normalize (   self,
  end = None,
  seekfree = None,
  nbytesfree = None,
  nbytesname = None,
  seekinfo = None 
)
Set UUID to zero and adjust pointers that are given as arguments

Definition at line 79 of file b2root.py.


The documentation for this class was generated from the following file: