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 2661 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 2662 of file plotting.py.

2662  def __init__(self, name, possibleDirs, plotFolder, fallbackNames=[], fallbackDqmSubFolders=[]):
2663  """ Constructor
2664 
2665  Arguments:
2666  name -- Name of the folder (is used in the output directory naming)
2667  possibleDirs -- List of strings for possible directories of histograms in TFiles
2668  plotFolder -- PlotFolder object
2669 
2670  Keyword arguments
2671  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.
2672  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.
2673  """
2674  self._name = name
2675  self._possibleDirs = possibleDirs
2676  self._plotFolder = plotFolder
2677  self._fallbackNames = fallbackNames
2678  self._fallbackDqmSubFolders = fallbackDqmSubFolders
2679  self._tableCreators = []
2680 
def __init__(self, name, possibleDirs, plotFolder, fallbackNames=[], fallbackDqmSubFolders=[])
Definition: plotting.py:2662

Member Function Documentation

def plotting.PlotterItem.appendTableCreator (   self,
  tc 
)

Definition at line 2687 of file plotting.py.

2687  def appendTableCreator(self, tc):
2688  self._tableCreators.append(tc)
2689 
def appendTableCreator(self, tc)
Definition: plotting.py:2687
def plotting.PlotterItem.getName (   self)
def plotting.PlotterItem.getPlotFolder (   self)

Definition at line 2684 of file plotting.py.

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

2684  def getPlotFolder(self):
2685  return self._plotFolder
2686 
def getPlotFolder(self)
Definition: plotting.py:2684
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 2690 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.

2690  def readDirs(self, files):
2691  """Read available subfolders from the files
2692 
2693  Arguments:
2694  files -- List of strings for paths to files, or list of TFiles
2695 
2696  For each file, loop over 'possibleDirs', and read the
2697  subfolders of first one that exists.
2698 
2699  Returns a PlotterFolder if at least one file for which one of
2700  'possibleDirs' exists. Otherwise, return None to signal that
2701  there is nothing available for this PlotFolder.
2702  """
2703  subFolders = None
2704  if self._plotFolder.loopSubFolders():
2705  subFolders = []
2706  possibleDirFound = False
2707  for fname in files:
2708  if fname is None:
2709  continue
2710 
2711  isOpenFile = isinstance(fname, ROOT.TFile)
2712  if isOpenFile:
2713  tfile = fname
2714  else:
2715  tfile = ROOT.TFile.Open(fname)
2716  for pd in self._possibleDirs:
2717  d = tfile.Get(pd)
2718  if d:
2719  possibleDirFound = True
2720  if subFolders is not None:
2721  subf = []
2722  for key in d.GetListOfKeys():
2723  if isinstance(key.ReadObj(), ROOT.TDirectory):
2724  subf.append(key.GetName())
2725  subFolders.append(subf)
2726  break
2727 
2728  if not isOpenFile:
2729  tfile.Close()
2730 
2731  if not possibleDirFound:
2732  return None
2733 
2734  return PlotterFolder(self._name, self._possibleDirs, subFolders, self._plotFolder, self._fallbackNames, self._fallbackDqmSubFolders, self._tableCreators)
2735 
def readDirs(self, files)
Definition: plotting.py:2690

Member Data Documentation

plotting.PlotterItem._fallbackDqmSubFolders
private

Definition at line 2678 of file plotting.py.

Referenced by plotting.PlotterItem.readDirs().

plotting.PlotterItem._fallbackNames
private

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

Referenced by plotting.PlotterItem.readDirs().