test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
validation.SimpleValidation Class Reference

Public Member Functions

def __init__
 
def createHtmlReport
 
def doPlots
 

Private Member Functions

def _doPlots
 

Private Attributes

 _files
 
 _labels
 
 _newdir
 
 _openFiles
 
 _plotterDrawArgs
 
 _subdirprefix
 

Detailed Description

Definition at line 818 of file validation.py.

Constructor & Destructor Documentation

def validation.SimpleValidation.__init__ (   self,
  files,
  labels,
  newdir 
)

Definition at line 819 of file validation.py.

820  def __init__(self, files, labels, newdir):
821  self._files = files
822  self._labels = labels
823  self._newdir = newdir

Member Function Documentation

def validation.SimpleValidation._doPlots (   self,
  plotterFolder,
  dqmSubFolder,
  htmlReport 
)
private

Definition at line 855 of file validation.py.

References DigiInvestigatorHistogramMaker._labels, SeedMultiplicityAnalyzer._labels, hitfit::Constraint_Intermed_Labels._labels, validation.SimpleValidation._labels, plotting.PlotFolder._labels, validation.SimpleValidation._newdir, validation.SimpleValidation._openFiles, validation.Validation._plotterDrawArgs, validation.SimpleValidation._plotterDrawArgs, and validation.SimpleValidation._subdirprefix.

856  def _doPlots(self, plotterFolder, dqmSubFolder, htmlReport):
857  plotterFolder.create(self._openFiles, self._labels, dqmSubFolder)
858  fileList = plotterFolder.draw(**self._plotterDrawArgs)
859 
860  for tableCreator in plotterFolder.getTableCreators():
861  htmlReport.addTable(tableCreator.create(self._openFiles, self._labels, dqmSubFolder))
862 
863  newsubdir = self._subdirprefix+plotterFolder.getSelectionName(dqmSubFolder)
864  newdir = os.path.join(self._newdir, newsubdir)
865 
866  if len(fileList) == 0:
867  return fileList
868 
869  print "Moving plots to %s" % newdir
870  if not os.path.exists(newdir):
871  os.makedirs(newdir)
872  for f in fileList:
873  shutil.move(f, os.path.join(newdir, f))
874  return map(lambda n: os.path.join(newsubdir, n), fileList)
def validation.SimpleValidation.createHtmlReport (   self,
  validationName = "" 
)

Definition at line 824 of file validation.py.

References validation.SimpleValidation._newdir.

825  def createHtmlReport(self, validationName=""):
826  return html.HtmlReport(validationName, self._newdir)
def validation.SimpleValidation.doPlots (   self,
  plotter,
  subdirprefix = None,
  sample = None,
  plotterDrawArgs = {},
  limitSubFoldersOnlyTo = None,
  htmlReport = html.HtmlReportDummy() 
)

Definition at line 827 of file validation.py.

828  def doPlots(self, plotter, subdirprefix=None, sample=None, plotterDrawArgs={}, limitSubFoldersOnlyTo=None, htmlReport=html.HtmlReportDummy()):
829  if subdirprefix is None and sample is None:
830  raise Exception("Need either 'subdirprefix' or 'sample'")
831  if subdirprefix is not None and sample is not None:
832  raise Exception("May give only one of 'subdirprefix' or 'sample', got both")
834  self._subdirprefix = sample.label() if sample is not None else subdirprefix
835  self._plotterDrawArgs = plotterDrawArgs
837  self._openFiles = []
838  for f in self._files:
839  if not os.path.exists(f):
840  print "File %s not found" % f
841  sys.exit(1)
842  self._openFiles.append(ROOT.TFile.Open(f))
843 
844  plotterInstance = plotter.readDirs(*self._openFiles)
845  for plotterFolder, dqmSubFolder in plotterInstance.iterFolders(limitSubFoldersOnlyTo=limitSubFoldersOnlyTo):
846  if sample is not None and plotterFolder.onlyForPileup() and not sample.hasPileup():
847  continue
848  plotFiles = self._doPlots(plotterFolder, dqmSubFolder, htmlReport)
849  if len(plotFiles) > 0:
850  htmlReport.addPlots(plotterFolder, dqmSubFolder, plotFiles)
851 
852  for tf in self._openFiles:
853  tf.Close()
854  self._openFiles = []

Member Data Documentation

validation.SimpleValidation._files
private

Definition at line 820 of file validation.py.

validation.SimpleValidation._labels
private

Definition at line 821 of file validation.py.

Referenced by validation.SimpleValidation._doPlots().

validation.SimpleValidation._newdir
private

Definition at line 822 of file validation.py.

Referenced by validation.SimpleValidation._doPlots(), and validation.SimpleValidation.createHtmlReport().

validation.SimpleValidation._openFiles
private

Definition at line 836 of file validation.py.

Referenced by validation.SimpleValidation._doPlots().

validation.SimpleValidation._plotterDrawArgs
private

Definition at line 834 of file validation.py.

Referenced by validation.SimpleValidation._doPlots().

validation.SimpleValidation._subdirprefix
private

Definition at line 833 of file validation.py.

Referenced by validation.SimpleValidation._doPlots().