CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes | Private Member Functions
dqm_interfaces.DQMRootFile Class Reference
Inheritance diagram for dqm_interfaces.DQMRootFile:

Public Member Functions

def __init__ (self, rootfilename)
 
def cd (self, directory_name)
 
def getObj (self, objname)
 
def ls (self, directory_name="")
 

Public Attributes

 rootfile
 
 rootfileprevpwd
 
 rootfilepwd
 

Private Member Functions

def __is_null (self, directory, name)
 

Detailed Description

Class acting as interface between the user and the harvested DQMRootFile.  
It skips the directories created by the DQM infrastructure so to provide an
interface as similar as possible to a real direcory structure and to the 
directory structure provided by the db interface.

Definition at line 470 of file dqm_interfaces.py.

Constructor & Destructor Documentation

def dqm_interfaces.DQMRootFile.__init__ (   self,
  rootfilename 
)

Definition at line 476 of file dqm_interfaces.py.

476  def __init__(self,rootfilename):
477  dqmdatadir="DQMData"
478  self.rootfile=TFile(rootfilename)
479  self.rootfilepwd=self.rootfile.GetDirectory(dqmdatadir)
480  self.rootfileprevpwd=self.rootfile.GetDirectory(dqmdatadir)
481  if self.rootfilepwd == None:
482  print "Directory %s does not exist: skipping. Is this a custom rootfile?" %dqmdatadir
483  self.rootfilepwd=self.rootfile
484  self.rootfileprevpwd=self.rootfile
485 
def __init__(self, rootfilename)

Member Function Documentation

def dqm_interfaces.DQMRootFile.__is_null (   self,
  directory,
  name 
)
private

Definition at line 486 of file dqm_interfaces.py.

Referenced by dqm_interfaces.DQMRootFile.cd(), dqm_interfaces.DQMRootFile.getObj(), and dqm_interfaces.DQMRootFile.ls().

486  def __is_null(self,directory,name):
487  is_null = not directory
488  if is_null:
489  print >> stderr, "Directory %s does not exist!" %name
490  return is_null
491 
def __is_null(self, directory, name)
def dqm_interfaces.DQMRootFile.cd (   self,
  directory_name 
)
Change the current TDirectoryFile. The familiar "-" and ".." directories 
can be accessed as well.

Definition at line 506 of file dqm_interfaces.py.

References dqm_interfaces.DQMRootFile.__is_null(), dqm_interfaces.DQMRootFile.rootfileprevpwd, and dqm_interfaces.DQMRootFile.rootfilepwd.

Referenced by dqm_interfaces.DirWalkerFile.walk().

506  def cd(self,directory_name):
507  """Change the current TDirectoryFile. The familiar "-" and ".." directories
508  can be accessed as well.
509  """
510  if directory_name=="-":
511  tmp=self.rootfilepwd
512  self.rootfilepwd=self.rootfileprevpwd
513  self.rootfileprevpwd=tmp
514  if directory_name=="..":
515  #print "Setting prevpwd"
516  self.rootfileprevpwd=self.rootfilepwd
517  #print "The mom"
518  mom=self.rootfilepwd.GetMotherDir()
519  #print "In directory +%s+" %self.rootfilepwd
520  #print "Deleting the TFileDir"
521  if "Run " not in self.rootfilepwd.GetName():
522  self.rootfilepwd.Delete()
523  #print "Setting pwd to mom"
524  self.rootfilepwd=mom
525  else:
526  new_directory=self.rootfilepwd.GetDirectory(directory_name)
527  if not self.__is_null(new_directory,directory_name):
528  self.rootfileprevpwd=self.rootfilepwd
529  self.rootfilepwd=new_directory
530 
def __is_null(self, directory, name)
def cd(self, directory_name)
def dqm_interfaces.DQMRootFile.getObj (   self,
  objname 
)
Get a TObject from the rootfile.

Definition at line 531 of file dqm_interfaces.py.

References dqm_interfaces.DQMRootFile.__is_null().

531  def getObj(self,objname):
532  """Get a TObject from the rootfile.
533  """
534  obj=self.rootfilepwd.Get(objname)
535  if not self.__is_null(obj,objname):
536  return obj
537 
538 #-------------------------------------------------------------------------------
539 
def __is_null(self, directory, name)
def getObj(self, objname)
def dqm_interfaces.DQMRootFile.ls (   self,
  directory_name = "" 
)

Definition at line 492 of file dqm_interfaces.py.

References dqm_interfaces.DQMRootFile.__is_null(), and dqm_interfaces.DQMRootFile.rootfilepwd.

Referenced by dqm_interfaces.DirWalkerFile.walk().

492  def ls(self,directory_name=""):
493  contents={}
494  directory=None
495  if len(directory_name)==0:
496  directory=self.rootfilepwd
497 
498  directory=self.rootfilepwd.GetDirectory(directory_name)
499  if self.__is_null(directory,directory_name):
500  return contents
501 
502  for key in directory.GetListOfKeys():
503  contents[key.GetName()]=key.GetClassName()
504  return contents
505 
def __is_null(self, directory, name)
def ls(self, directory_name="")

Member Data Documentation

dqm_interfaces.DQMRootFile.rootfile

Definition at line 478 of file dqm_interfaces.py.

dqm_interfaces.DQMRootFile.rootfileprevpwd

Definition at line 480 of file dqm_interfaces.py.

Referenced by dqm_interfaces.DQMRootFile.cd().

dqm_interfaces.DQMRootFile.rootfilepwd