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 2838 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 2839 of file plotting.py.

2839  def __init__(self, name, possibleDirs, plotFolder, fallbackNames=[], fallbackDqmSubFolders=[]):
2840  """ Constructor
2841 
2842  Arguments:
2843  name -- Name of the folder (is used in the output directory naming)
2844  possibleDirs -- List of strings for possible directories of histograms in TFiles
2845  plotFolder -- PlotFolder object
2846 
2847  Keyword arguments
2848  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.
2849  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.
2850  """
2851  self._name = name
2852  self._possibleDirs = possibleDirs
2853  self._plotFolder = plotFolder
2854  self._fallbackNames = fallbackNames
2855  self._fallbackDqmSubFolders = fallbackDqmSubFolders
2856  self._tableCreators = []
2857 
def __init__(self, name, possibleDirs, plotFolder, fallbackNames=[], fallbackDqmSubFolders=[])
Definition: plotting.py:2839

Member Function Documentation

def plotting.PlotterItem.appendTableCreator (   self,
  tc 
)

Definition at line 2864 of file plotting.py.

2864  def appendTableCreator(self, tc):
2865  self._tableCreators.append(tc)
2866 
def appendTableCreator(self, tc)
Definition: plotting.py:2864
def plotting.PlotterItem.getName (   self)
def plotting.PlotterItem.getPlotFolder (   self)

Definition at line 2861 of file plotting.py.

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

2861  def getPlotFolder(self):
2862  return self._plotFolder
2863 
def getPlotFolder(self)
Definition: plotting.py:2861
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 2867 of file plotting.py.

References plotting.PlotterFolder._fallbackDqmSubFolders, plotting.PlotterItem._fallbackDqmSubFolders, plotting.PlotterFolder._fallbackNames, plotting.PlotterItem._fallbackNames, FP420HitsObject._name, TrackerHitsObject._name, PGeometricDet::Item._name, TrackingRecHitAlgorithm._name, LikelihoodSpecies._name, L1TMuon::PtAssignmentUnit._name, L1TMuon::PtRefinementUnit._name, LikelihoodPdfProduct._name, LikelihoodPdf._name, citk::IsolationConeDefinitionBase._name, Logger._name, hcaldqm::DQModule._name, DrellYanValidation._name, WValidation._name, HistoParams< T >._name, hcaldqm::flag::Flag._name, hcaldqm::quantity::Quantity._name, CutApplicatorBase._name, ElectronMVAEstimatorRun2Phys14NonTrig._name, PhotonMVAEstimatorRun2Spring15NonTrig._name, PhotonMVAEstimatorRun2Phys14NonTrig._name, ElectronMVAEstimatorRun2Spring15Trig._name, GeometricDetExtra._name, ElectronMVAEstimatorRun2Spring15NonTrig._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, 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.

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

Member Data Documentation

plotting.PlotterItem._fallbackDqmSubFolders
private

Definition at line 2855 of file plotting.py.

Referenced by plotting.PlotterItem.readDirs().

plotting.PlotterItem._fallbackNames
private

Definition at line 2854 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 2856 of file plotting.py.

Referenced by plotting.PlotterItem.readDirs().