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

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

Member Function Documentation

◆ appendTableCreator()

def plotting.PlotterItem.appendTableCreator (   self,
  tc 
)

Definition at line 2875 of file plotting.py.

2875  def appendTableCreator(self, tc):
2876  self._tableCreators.append(tc)
2877 

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

2872  def getPlotFolder(self):
2873  return self._plotFolder
2874 

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

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

References plotting.PlotterFolder._fallbackDqmSubFolders, plotting.PlotterItem._fallbackDqmSubFolders, plotting.PlotterFolder._fallbackNames, plotting.PlotterItem._fallbackNames, FP420HitsObject._name, TrackerHitsObject._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, 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 2866 of file plotting.py.

Referenced by plotting.PlotterItem.readDirs().

◆ _fallbackNames

plotting.PlotterItem._fallbackNames
private

Definition at line 2865 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:2048