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

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

Member Function Documentation

◆ appendTableCreator()

def plotting.PlotterItem.appendTableCreator (   self,
  tc 
)

Definition at line 2879 of file plotting.py.

2879  def appendTableCreator(self, tc):
2880  self._tableCreators.append(tc)
2881 

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

2876  def getPlotFolder(self):
2877  return self._plotFolder
2878 

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

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

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, 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, hgcalPlots.loopSubFolders, and print().

Member Data Documentation

◆ _fallbackDqmSubFolders

plotting.PlotterItem._fallbackDqmSubFolders
private

Definition at line 2870 of file plotting.py.

Referenced by plotting.PlotterItem.readDirs().

◆ _fallbackNames

plotting.PlotterItem._fallbackNames
private

Definition at line 2869 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
print
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:46
mps_setup.append
append
Definition: mps_setup.py:85
hgcalPlots.loopSubFolders
loopSubFolders
Definition: hgcalPlots.py:2678