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

Constructor & Destructor Documentation

◆ __init__()

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

2848  def __init__(self, name, possibleDirs, plotFolder, fallbackNames=[], fallbackDqmSubFolders=[]):
2849  """ Constructor
2850 
2851  Arguments:
2852  name -- Name of the folder (is used in the output directory naming)
2853  possibleDirs -- List of strings for possible directories of histograms in TFiles
2854  plotFolder -- PlotFolder object
2855 
2856  Keyword arguments
2857  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.
2858  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.
2859  """
2860  self._name = name
2861  self._possibleDirs = possibleDirs
2862  self._plotFolder = plotFolder
2863  self._fallbackNames = fallbackNames
2864  self._fallbackDqmSubFolders = fallbackDqmSubFolders
2865  self._tableCreators = []
2866 

Member Function Documentation

◆ appendTableCreator()

def plotting.PlotterItem.appendTableCreator (   self,
  tc 
)

Definition at line 2873 of file plotting.py.

2873  def appendTableCreator(self, tc):
2874  self._tableCreators.append(tc)
2875 

References plotting.PlotterFolder._tableCreators, plotting.PlotterItem._tableCreators, and mps_setup.append.

◆ getName()

def plotting.PlotterItem.getName (   self)

◆ getPlotFolder()

def plotting.PlotterItem.getPlotFolder (   self)

Definition at line 2870 of file plotting.py.

2870  def getPlotFolder(self):
2871  return self._plotFolder
2872 

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

◆ readDirs()

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

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

References plotting.PlotterFolder._fallbackDqmSubFolders, plotting.PlotterItem._fallbackDqmSubFolders, plotting.PlotterFolder._fallbackNames, plotting.PlotterItem._fallbackNames, TrackerHitsObject._name, FP420HitsObject._name, PGeometricDet::Item._name, TrackingRecHitAlgorithm._name, Logger._name, hcaldqm::DQModule._name, citk::IsolationConeDefinitionBase._name, DrellYanValidation._name, WValidation._name, hcaldqm::flag::Flag._name, hcaldqm::quantity::Quantity._name, GeometricDetExtra._name, GeometricTimingDetExtra._name, HistoParams< T >._name, CutApplicatorBase._name, HistoParams< TH2F >._name, HistoParams< TProfile2D >._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, plotting.PlotterItem._tableCreators, and hgcalPlots.loopSubFolders.

Member Data Documentation

◆ _fallbackDqmSubFolders

plotting.PlotterItem._fallbackDqmSubFolders
private

Definition at line 2864 of file plotting.py.

Referenced by plotting.PlotterItem.readDirs().

◆ _fallbackNames

plotting.PlotterItem._fallbackNames
private

Definition at line 2863 of file plotting.py.

Referenced by plotting.PlotterItem.readDirs().

◆ _name

plotting.PlotterItem._name
private

◆ _plotFolder

plotting.PlotterItem._plotFolder
private

◆ _possibleDirs

plotting.PlotterItem._possibleDirs
private

◆ _tableCreators

plotting.PlotterItem._tableCreators
private
getName
TString getName(TString structure, int layer, TString geometry)
Definition: DMRtrends.cc:235
mps_setup.append
append
Definition: mps_setup.py:85
hgcalPlots.loopSubFolders
loopSubFolders
Definition: hgcalPlots.py:1785