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 473 of file dqm_interfaces.py.

Constructor & Destructor Documentation

def dqm_interfaces.DQMRootFile.__init__ (   self,
  rootfilename 
)

Definition at line 479 of file dqm_interfaces.py.

479  def __init__(self,rootfilename):
480  dqmdatadir="DQMData"
481  self.rootfile=TFile(rootfilename)
482  self.rootfilepwd=self.rootfile.GetDirectory(dqmdatadir)
483  self.rootfileprevpwd=self.rootfile.GetDirectory(dqmdatadir)
484  if self.rootfilepwd == None:
485  print("Directory %s does not exist: skipping. Is this a custom rootfile?" %dqmdatadir)
486  self.rootfilepwd=self.rootfile
487  self.rootfileprevpwd=self.rootfile
488 
S & print(S &os, JobReport::InputFile const &f)
Definition: JobReport.cc:66
def __init__(self, rootfilename)

Member Function Documentation

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

Definition at line 489 of file dqm_interfaces.py.

References edm.print().

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

489  def __is_null(self,directory,name):
490  is_null = not directory
491  if is_null:
492  print("Directory %s does not exist!" %name, file=stderr)
493  return is_null
494 
S & print(S &os, JobReport::InputFile const &f)
Definition: JobReport.cc:66
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 509 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().

509  def cd(self,directory_name):
510  """Change the current TDirectoryFile. The familiar "-" and ".." directories
511  can be accessed as well.
512  """
513  if directory_name=="-":
514  tmp=self.rootfilepwd
515  self.rootfilepwd=self.rootfileprevpwd
516  self.rootfileprevpwd=tmp
517  if directory_name=="..":
518  #print "Setting prevpwd"
519  self.rootfileprevpwd=self.rootfilepwd
520  #print "The mom"
521  mom=self.rootfilepwd.GetMotherDir()
522  #print "In directory +%s+" %self.rootfilepwd
523  #print "Deleting the TFileDir"
524  if "Run " not in self.rootfilepwd.GetName():
525  self.rootfilepwd.Delete()
526  #print "Setting pwd to mom"
527  self.rootfilepwd=mom
528  else:
529  new_directory=self.rootfilepwd.GetDirectory(directory_name)
530  if not self.__is_null(new_directory,directory_name):
531  self.rootfileprevpwd=self.rootfilepwd
532  self.rootfilepwd=new_directory
533 
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 534 of file dqm_interfaces.py.

References dqm_interfaces.DQMRootFile.__is_null().

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

Definition at line 495 of file dqm_interfaces.py.

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

Referenced by dqm_interfaces.DirWalkerFile.walk().

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

Member Data Documentation

dqm_interfaces.DQMRootFile.rootfile

Definition at line 481 of file dqm_interfaces.py.

dqm_interfaces.DQMRootFile.rootfileprevpwd

Definition at line 483 of file dqm_interfaces.py.

Referenced by dqm_interfaces.DQMRootFile.cd().

dqm_interfaces.DQMRootFile.rootfilepwd