CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
plotting.PlotterItem Class Reference

Public Member Functions

def __init__ (self, name, possibleDirs, plotFolder, fallbackNames=[], fallbackDqmSubFolders=[])
 
def appendTableCreator (self, tc)
 
def getName (self)
 
def getPlotFolder (self)
 
def readDirs (self, files)
 

Private Attributes

 _fallbackDqmSubFolders
 
 _fallbackNames
 
 _name
 
 _plotFolder
 
 _possibleDirs
 
 _tableCreators
 

Detailed Description

Definition at line 2843 of file plotting.py.

Constructor & Destructor Documentation

def plotting.PlotterItem.__init__ (   self,
  name,
  possibleDirs,
  plotFolder,
  fallbackNames = [],
  fallbackDqmSubFolders = [] 
)
Constructor

Arguments:
name          -- Name of the folder (is used in the output directory naming)
possibleDirs  -- List of strings for possible directories of histograms in TFiles
plotFolder    -- PlotFolder object

Keyword arguments
fallbackNames -- Optional list of names for backward compatibility. These are used only by validation.Validation (class responsible of the release validation workflow) in case the reference file pointed by 'name' does not exist.
fallbackDqmSubFolders -- Optional list of functions for (string->string) mapping the subfolder names found in the first file to another names (function should return None for no mapping). Use case is comparing files that have different iteration naming convention.

Definition at line 2844 of file plotting.py.

2844  def __init__(self, name, possibleDirs, plotFolder, fallbackNames=[], fallbackDqmSubFolders=[]):
2845  """ Constructor
2846 
2847  Arguments:
2848  name -- Name of the folder (is used in the output directory naming)
2849  possibleDirs -- List of strings for possible directories of histograms in TFiles
2850  plotFolder -- PlotFolder object
2851 
2852  Keyword arguments
2853  fallbackNames -- Optional list of names for backward compatibility. These are used only by validation.Validation (class responsible of the release validation workflow) in case the reference file pointed by 'name' does not exist.
2854  fallbackDqmSubFolders -- Optional list of functions for (string->string) mapping the subfolder names found in the first file to another names (function should return None for no mapping). Use case is comparing files that have different iteration naming convention.
2855  """
2856  self._name = name
2857  self._possibleDirs = possibleDirs
2858  self._plotFolder = plotFolder
2859  self._fallbackNames = fallbackNames
2860  self._fallbackDqmSubFolders = fallbackDqmSubFolders
2861  self._tableCreators = []
2862 
def __init__(self, name, possibleDirs, plotFolder, fallbackNames=[], fallbackDqmSubFolders=[])
Definition: plotting.py:2844

Member Function Documentation

def plotting.PlotterItem.appendTableCreator (   self,
  tc 
)

Definition at line 2869 of file plotting.py.

2869  def appendTableCreator(self, tc):
2870  self._tableCreators.append(tc)
2871 
def appendTableCreator(self, tc)
Definition: plotting.py:2869
def plotting.PlotterItem.getName (   self)
def plotting.PlotterItem.getPlotFolder (   self)

Definition at line 2866 of file plotting.py.

References plotting.PlotterFolder._plotFolder, and plotting.PlotterItem._plotFolder.

2866  def getPlotFolder(self):
2867  return self._plotFolder
2868 
def getPlotFolder(self)
Definition: plotting.py:2866
def plotting.PlotterItem.readDirs (   self,
  files 
)
Read available subfolders from the files

Arguments:
files -- List of strings for paths to files, or list of TFiles

For each file, loop over 'possibleDirs', and read the
subfolders of first one that exists.

Returns a PlotterFolder if at least one file for which one of
'possibleDirs' exists. Otherwise, return None to signal that
there is nothing available for this PlotFolder.

Definition at line 2872 of file plotting.py.

References plotting.PlotterFolder._fallbackDqmSubFolders, plotting.PlotterItem._fallbackDqmSubFolders, plotting.PlotterFolder._fallbackNames, plotting.PlotterItem._fallbackNames, TrackerHitsObject._name, FP420HitsObject._name, PGeometricDet::Item._name, LikelihoodSpecies._name, TrackingRecHitAlgorithm._name, LikelihoodPdfProduct._name, Logger._name, hcaldqm::DQModule._name, LikelihoodPdf._name, citk::IsolationConeDefinitionBase._name, DrellYanValidation._name, WValidation._name, hcaldqm::flag::Flag._name, hcaldqm::quantity::Quantity._name, HistoParams< T >._name, GeometricTimingDetExtra._name, CutApplicatorBase._name, GeometricDetExtra._name, HistoParams< TH2F >._name, HistoParams< TProfile2D >._name, Vispa.Views.PropertyView.Property._name, SequenceTypes.SequencePlaceholder._name, plotting.Subtract._name, plotting.Transform._name, plotting.FakeDuplicate._name, plotting.CutEfficiency._name, plotting.AggregateBins._name, plotting.AggregateHistos._name, plotting.ROC._name, SequenceTypes.TaskPlaceholder._name, plotting.Plot._name, plotting.PlotGroup._name, plotting.PlotterFolder._name, plotting.PlotterItem._name, plotting.PlotterFolder._plotFolder, plotting.PlotterItem._plotFolder, plotting.PlotterItem._possibleDirs, plotting.PlotterFolder._tableCreators, and plotting.PlotterItem._tableCreators.

2872  def readDirs(self, files):
2873  """Read available subfolders from the files
2874 
2875  Arguments:
2876  files -- List of strings for paths to files, or list of TFiles
2877 
2878  For each file, loop over 'possibleDirs', and read the
2879  subfolders of first one that exists.
2880 
2881  Returns a PlotterFolder if at least one file for which one of
2882  'possibleDirs' exists. Otherwise, return None to signal that
2883  there is nothing available for this PlotFolder.
2884  """
2885  subFolders = None
2886  if self._plotFolder.loopSubFolders():
2887  subFolders = []
2888  possibleDirFound = False
2889  for fname in files:
2890  if fname is None:
2891  continue
2892 
2893  isOpenFile = isinstance(fname, ROOT.TFile)
2894  if isOpenFile:
2895  tfile = fname
2896  else:
2897  tfile = ROOT.TFile.Open(fname)
2898  for pd in self._possibleDirs:
2899  d = tfile.Get(pd)
2900  if d:
2901  possibleDirFound = True
2902  if subFolders is not None:
2903  subf = []
2904  for key in d.GetListOfKeys():
2905  if isinstance(key.ReadObj(), ROOT.TDirectory):
2906  subf.append(key.GetName())
2907  subFolders.append(subf)
2908  break
2909 
2910  if not isOpenFile:
2911  tfile.Close()
2912 
2913  if not possibleDirFound:
2914  return None
2915 
2916  return PlotterFolder(self._name, self._possibleDirs, subFolders, self._plotFolder, self._fallbackNames, self._fallbackDqmSubFolders, self._tableCreators)
2917 
def readDirs(self, files)
Definition: plotting.py:2872

Member Data Documentation

plotting.PlotterItem._fallbackDqmSubFolders
private

Definition at line 2860 of file plotting.py.

Referenced by plotting.PlotterItem.readDirs().

plotting.PlotterItem._fallbackNames
private

Definition at line 2859 of file plotting.py.

Referenced by plotting.PlotterItem.readDirs().

plotting.PlotterItem._name
private
plotting.PlotterItem._plotFolder
private
plotting.PlotterItem._possibleDirs
private
plotting.PlotterItem._tableCreators
private

Definition at line 2861 of file plotting.py.

Referenced by plotting.PlotterItem.readDirs().