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

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

Member Function Documentation

◆ appendTableCreator()

def plotting.PlotterItem.appendTableCreator (   self,
  tc 
)

Definition at line 2881 of file plotting.py.

2881  def appendTableCreator(self, tc):
2882  self._tableCreators.append(tc)
2883 

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

2878  def getPlotFolder(self):
2879  return self._plotFolder
2880 

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

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

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

Referenced by plotting.PlotterItem.readDirs().

◆ _fallbackNames

plotting.PlotterItem._fallbackNames
private

Definition at line 2871 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:2669