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

Constructor & Destructor Documentation

def dqm_interfaces.DQMRootFile.__init__ (   self,
  rootfilename 
)

Definition at line 477 of file dqm_interfaces.py.

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

Member Function Documentation

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

Definition at line 487 of file dqm_interfaces.py.

References edm.print().

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

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

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

References dqm_interfaces.DQMRootFile.__is_null().

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

Definition at line 493 of file dqm_interfaces.py.

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

Referenced by dqm_interfaces.DirWalkerFile.walk().

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

Member Data Documentation

dqm_interfaces.DQMRootFile.rootfile

Definition at line 479 of file dqm_interfaces.py.

dqm_interfaces.DQMRootFile.rootfileprevpwd

Definition at line 481 of file dqm_interfaces.py.

Referenced by dqm_interfaces.DQMRootFile.cd().

dqm_interfaces.DQMRootFile.rootfilepwd