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

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

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

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

◆ getName()

def plotting.PlotterItem.getName (   self)

◆ getPlotFolder()

def plotting.PlotterItem.getPlotFolder (   self)

Definition at line 2877 of file plotting.py.

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

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

◆ 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 2883 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().

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

Referenced by plotting.PlotterItem.readDirs().

◆ _fallbackNames

plotting.PlotterItem._fallbackNames
private

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