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

2833  def __init__(self, name, possibleDirs, plotFolder, fallbackNames=[], fallbackDqmSubFolders=[]):
2834  """ Constructor
2835 
2836  Arguments:
2837  name -- Name of the folder (is used in the output directory naming)
2838  possibleDirs -- List of strings for possible directories of histograms in TFiles
2839  plotFolder -- PlotFolder object
2840 
2841  Keyword arguments
2842  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.
2843  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.
2844  """
2845  self._name = name
2846  self._possibleDirs = possibleDirs
2847  self._plotFolder = plotFolder
2848  self._fallbackNames = fallbackNames
2849  self._fallbackDqmSubFolders = fallbackDqmSubFolders
2850  self._tableCreators = []
2851 
def __init__(self, dataset, job_number, job_id, job_name, isDA, isMC, applyBOWS, applyEXTRACOND, extraconditions, runboundary, lumilist, intlumi, maxevents, gt, allFromGT, alignmentDB, alignmentTAG, apeDB, apeTAG, bowDB, bowTAG, vertextype, tracktype, refittertype, ttrhtype, applyruncontrol, ptcut, CMSSW_dir, the_dir)

Member Function Documentation

◆ appendTableCreator()

def plotting.PlotterItem.appendTableCreator (   self,
  tc 
)

Definition at line 2858 of file plotting.py.

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

2858  def appendTableCreator(self, tc):
2859  self._tableCreators.append(tc)
2860 

◆ getName()

def plotting.PlotterItem.getName (   self)

◆ getPlotFolder()

def plotting.PlotterItem.getPlotFolder (   self)

Definition at line 2855 of file plotting.py.

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

2855  def getPlotFolder(self):
2856  return self._plotFolder
2857 

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

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, WValidation._name, DrellYanValidation._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._TaskBasePlaceholder._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().

2861  def readDirs(self, files):
2862  """Read available subfolders from the files
2863 
2864  Arguments:
2865  files -- List of strings for paths to files, or list of TFiles
2866 
2867  For each file, loop over 'possibleDirs', and read the
2868  subfolders of first one that exists.
2869 
2870  Returns a PlotterFolder if at least one file for which one of
2871  'possibleDirs' exists. Otherwise, return None to signal that
2872  there is nothing available for this PlotFolder.
2873  """
2874  subFolders = None
2875  if self._plotFolder.loopSubFolders():
2876  subFolders = []
2877  possibleDirFound = False
2878  for fname in files:
2879  if fname is None:
2880  continue
2881 
2882  isOpenFile = isinstance(fname, ROOT.TFile)
2883  if isOpenFile:
2884  tfile = fname
2885  else:
2886  tfile = ROOT.TFile.Open(fname)
2887  for pd in self._possibleDirs:
2888  d = tfile.Get(pd)
2889  if d:
2890  possibleDirFound = True
2891  if subFolders is not None:
2892  subf = []
2893  for key in d.GetListOfKeys():
2894  if isinstance(key.ReadObj(), ROOT.TDirectory):
2895  subf.append(key.GetName())
2896  subFolders.append(subf)
2897  break
2898  else:
2899  print("Did not find directory '%s' from file %s" % (pd, tfile.GetName()))
2900 
2901  if not isOpenFile:
2902  tfile.Close()
2903 
2904  if not possibleDirFound:
2905  return None
2906 
2907  return PlotterFolder(self._name, self._possibleDirs, subFolders, self._plotFolder, self._fallbackNames, self._fallbackDqmSubFolders, self._tableCreators)
2908 
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47

Member Data Documentation

◆ _fallbackDqmSubFolders

plotting.PlotterItem._fallbackDqmSubFolders
private

Definition at line 2849 of file plotting.py.

Referenced by plotting.PlotterItem.readDirs().

◆ _fallbackNames

plotting.PlotterItem._fallbackNames
private

Definition at line 2848 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