CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Functions
ROOTData Namespace Reference

Functions

def literal2root
 
def tfile_cd
 

Function Documentation

def ROOTData.literal2root (   literal,
  rootType,
  tstreamerinfo = None 
)
Convert an hexadecimal string into a root-object. The correct TStreamerInfo
is passed in order to avoid inconsistencies.

Definition at line 24 of file ROOTData.py.

Referenced by dqm_interfaces.DQMcommunicator.get_root_objects(), dqm_interfaces.DQMcommunicator.get_root_objects_list(), dqm_interfaces.DQMcommunicator.get_root_objects_list_recursive(), dqm_interfaces.DQMcommunicator.get_root_objects_recursive(), and dqm_interfaces.DirWalkerDB.run().

24 
25 def literal2root (literal,rootType,tstreamerinfo=None):
26  """
27  Convert an hexadecimal string into a root-object. The correct TStreamerInfo
28  is passed in order to avoid inconsistencies.
29  """
30  bitsarray = array('B')
31  bitsarray.fromstring(literal.decode('hex'))
32 
33  tbuffer = TBufferFile(TBufferFile.kRead)
34  if tstreamerinfo:
35  tbuffer.IncrementLevel(tstreamerinfo)
36  tbuffer.SetBuffer(bitsarray,len(bitsarray),False)
37 
38  # replace a couple of shortcuts with the real root class name
39  if rootType == 'TPROF':
40  rootType = 'TProfile'
41  if rootType == 'TPROF2D':
42  rootType = 'TProfile2D'
43 
44  root_class=eval(rootType+'.Class()')
45 
46  return tbuffer.ReadObject(root_class)
47 
def literal2root
Definition: ROOTData.py:24
def ROOTData.tfile_cd (   dirname,
  tfile,
  debug = False 
)
Safely re-build and navigate the directory structure.

Definition at line 5 of file ROOTData.py.

5 
6 def tfile_cd(dirname,tfile,debug=False):
7  """
8  Safely re-build and navigate the directory structure.
9  """
10 
11  if not tfile.GetDirectory(dirname):
12  gDirectory.cd("/")
13  path=""
14  for component in dirname.split('/'):
15  path+="/%s" %component
16  if not tfile.GetDirectory(path):
17  gDirectory.mkdir(component)
18  gDirectory.cd(component)
19 
20  if debug:
21  print "Current dir"
22  gDirectory.pwd()
23 
#-------------------------------------------------------------------------------
def tfile_cd
Definition: ROOTData.py:5