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 doPlots
 

Private Member Functions

def _doPlots
 

Private Attributes

 _algoDirMap
 
 _files
 
 _labels
 
 _newdir
 
 _newdirFunc
 
 _plotter
 
 _plotterDrawArgs
 

Detailed Description

Definition at line 652 of file validation.py.

Constructor & Destructor Documentation

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

Definition at line 653 of file validation.py.

654  def __init__(self, files, labels, newdir):
655  self._files = files
656  self._labels = labels
657  self._newdir = newdir

Member Function Documentation

def validation.SimpleValidation._doPlots (   self,
  algo,
  quality 
)
private

Definition at line 673 of file validation.py.

References validation.SimpleValidation._algoDirMap, validation.SimpleValidation._files, DigiInvestigatorHistogramMaker._labels, SeedMultiplicityAnalyzer._labels, hitfit::Constraint_Intermed_Labels._labels, validation.SimpleValidation._labels, plotting.Plotter._labels, validation.SimpleValidation._newdir, validation.SimpleValidation._newdirFunc, validation.Validation._plotterDrawArgs, and validation.SimpleValidation._plotterDrawArgs.

674  def _doPlots(self, algo, quality):
675  openFiles = []
676  for f in self._files:
677  if not os.path.exists(f):
678  print "File %s not found" % f
679  sys.exit(1)
680  openFiles.append(ROOT.TFile.Open(f))
681 
682  # dirs = []
683  # for tf in openFiles:
684  # theDir = None
685  # for pd in self._plotter.getPossibleDirectoryNames():
686  # theDir = tf.GetDirectory(pd)
687  # if theDir:
688  # break
689  # if not theDir:
690  # print "Did not find any of %s directories from file %s" % (",".join(self._plotter.getPossibleDirectoryNames()), tf.GetName())
691  # sys.exit(1)
692  # if self._algoDirMap is not None:
693  # d = theDir.Get(self._algoDirMap[quality][algo])
694  # if not theDir:
695  # print "Did not find dir %s from %s" % (self._algoDirMap[quality][algo], theDir.GetPath())
696  # sys.exit(1)
697  # theDir = d
698  # dirs.append(theDir)
699 
700  subdir = None
701  if self._algoDirMap is not None:
702  subdir = self._algoDirMap[quality][algo]
703  self._plotter.create(openFiles, self._labels, subdir=subdir)
704  fileList = self._plotter.draw(algo, **self._plotterDrawArgs)
705 
706  for tf in openFiles:
707  tf.Close()
708 
709  newdir = self._newdir
710  if self._newdirFunc is not None:
711  newdir = os.path.join(newdir, self._newdirFunc(algo, quality))
712 
713  print "Moving plots to %s" % newdir
714  if not os.path.exists(newdir):
715  os.makedirs(newdir)
716  for f in fileList:
717  shutil.move(f, os.path.join(newdir, f))
def validation.SimpleValidation.doPlots (   self,
  algos,
  qualities,
  plotter,
  algoDirMap = None,
  newdirFunc = None,
  plotterDrawArgs = {} 
)

Definition at line 658 of file validation.py.

659  def doPlots(self, algos, qualities, plotter, algoDirMap=None, newdirFunc=None, plotterDrawArgs={}):
660  self._plotter = plotter
661  self._algoDirMap = algoDirMap
662  self._newdirFunc = newdirFunc
663  self._plotterDrawArgs = plotterDrawArgs
664 
665  if qualities is None:
666  qualities = [None]
667  if algos is None:
668  algos = [None]
669 
670  for q in qualities:
671  for a in algos:
672  self._doPlots(a, q)

Member Data Documentation

validation.SimpleValidation._algoDirMap
private

Definition at line 660 of file validation.py.

Referenced by validation.SimpleValidation._doPlots().

validation.SimpleValidation._files
private

Definition at line 654 of file validation.py.

Referenced by validation.SimpleValidation._doPlots().

validation.SimpleValidation._labels
private

Definition at line 655 of file validation.py.

Referenced by validation.SimpleValidation._doPlots().

validation.SimpleValidation._newdir
private

Definition at line 656 of file validation.py.

Referenced by validation.SimpleValidation._doPlots().

validation.SimpleValidation._newdirFunc
private

Definition at line 661 of file validation.py.

Referenced by validation.SimpleValidation._doPlots().

validation.SimpleValidation._plotter
private

Definition at line 659 of file validation.py.

validation.SimpleValidation._plotterDrawArgs
private

Definition at line 662 of file validation.py.

Referenced by validation.SimpleValidation._doPlots().