CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
plotting.PlotterItem Class Reference

Public Member Functions

def __init__
 
def appendTableCreator
 
def getName
 
def getPlotFolder
 
def readDirs
 

Private Attributes

 _fallbackDqmSubFolders
 
 _fallbackNames
 
 _name
 
 _plotFolder
 
 _possibleDirs
 
 _tableCreators
 

Detailed Description

Definition at line 2087 of file plotting.py.

Constructor & Destructor Documentation

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

2089  def __init__(self, name, possibleDirs, plotFolder, fallbackNames=[], fallbackDqmSubFolders=[]):
2090  """ Constructor
2091 
2092  Arguments:
2093  name -- Name of the folder (is used in the output directory naming)
2094  possibleDirs -- List of strings for possible directories of histograms in TFiles
2095  plotFolder -- PlotFolder object
2096 
2097  Keyword arguments
2098  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.
2099  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.
2100  """
2101  self._name = name
2102  self._possibleDirs = possibleDirs
2103  self._plotFolder = plotFolder
2104  self._fallbackNames = fallbackNames
2105  self._fallbackDqmSubFolders = fallbackDqmSubFolders
2106  self._tableCreators = []

Member Function Documentation

def plotting.PlotterItem.appendTableCreator (   self,
  tc 
)

Definition at line 2113 of file plotting.py.

2114  def appendTableCreator(self, tc):
2115  self._tableCreators.append(tc)
def plotting.PlotterItem.getName (   self)

Definition at line 2107 of file plotting.py.

References FP420HitsObject._name, TrackerHitsObject._name, PGeometricDet::Item._name, LikelihoodSpecies._name, L1TMuon::PtAssignmentUnit._name, L1TMuon::PtRefinementUnit._name, LikelihoodPdfProduct._name, LikelihoodPdf._name, citk::IsolationConeDefinitionBase._name, Logger._name, hcaldqm::DQModule._name, DrellYanValidation._name, WValidation._name, HistoParams< T >._name, hcaldqm::flag::Flag._name, hcaldqm::quantity::Quantity._name, CutApplicatorBase._name, ElectronMVAEstimatorRun2Phys14NonTrig._name, PhotonMVAEstimatorRun2Spring15NonTrig._name, PhotonMVAEstimatorRun2Phys14NonTrig._name, GeometricDetExtra._name, ElectronMVAEstimatorRun2Spring15Trig._name, ElectronMVAEstimatorRun2Spring15NonTrig._name, HistoParams< TH2F >._name, HistoParams< TProfile2D >._name, plotting.Subtract._name, plotting.FakeDuplicate._name, plotting.AggregateBins._name, Vispa.Views.PropertyView.Property._name, SequenceTypes.SequencePlaceholder._name, plotting.AggregateHistos._name, plotting.ROC._name, plotting.Plot._name, plotting.PlotGroup._name, plotting.PlotterFolder._name, and plotting.PlotterItem._name.

2108  def getName(self):
2109  return self._name
def plotting.PlotterItem.getPlotFolder (   self)

Definition at line 2110 of file plotting.py.

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

2111  def getPlotFolder(self):
2112  return self._plotFolder
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 2116 of file plotting.py.

References plotting.PlotterFolder._fallbackDqmSubFolders, plotting.PlotterItem._fallbackDqmSubFolders, plotting.PlotterFolder._fallbackNames, plotting.PlotterItem._fallbackNames, FP420HitsObject._name, TrackerHitsObject._name, PGeometricDet::Item._name, LikelihoodSpecies._name, L1TMuon::PtAssignmentUnit._name, L1TMuon::PtRefinementUnit._name, LikelihoodPdfProduct._name, LikelihoodPdf._name, citk::IsolationConeDefinitionBase._name, Logger._name, hcaldqm::DQModule._name, DrellYanValidation._name, WValidation._name, HistoParams< T >._name, hcaldqm::flag::Flag._name, hcaldqm::quantity::Quantity._name, CutApplicatorBase._name, ElectronMVAEstimatorRun2Phys14NonTrig._name, PhotonMVAEstimatorRun2Spring15NonTrig._name, PhotonMVAEstimatorRun2Phys14NonTrig._name, ElectronMVAEstimatorRun2Spring15Trig._name, GeometricDetExtra._name, ElectronMVAEstimatorRun2Spring15NonTrig._name, HistoParams< TH2F >._name, HistoParams< TProfile2D >._name, plotting.Subtract._name, plotting.FakeDuplicate._name, plotting.AggregateBins._name, Vispa.Views.PropertyView.Property._name, SequenceTypes.SequencePlaceholder._name, plotting.AggregateHistos._name, plotting.ROC._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, and plotting.PlotterItem._tableCreators.

2117  def readDirs(self, files):
2118  """Read available subfolders from the files
2119 
2120  Arguments:
2121  files -- List of strings for paths to files, or list of TFiles
2122 
2123  For each file, loop over 'possibleDirs', and read the
2124  subfolders of first one that exists.
2125 
2126  Returns a PlotterFolder if at least one file for which one of
2127  'possibleDirs' exists. Otherwise, return None to signal that
2128  there is nothing available for this PlotFolder.
2129  """
2130  subFolders = None
2131  if self._plotFolder.loopSubFolders():
2132  subFolders = []
2133  possibleDirFound = False
2134  for fname in files:
2135  isOpenFile = isinstance(fname, ROOT.TFile)
2136  if isOpenFile:
2137  tfile = fname
2138  else:
2139  tfile = ROOT.TFile.Open(fname)
2140  for pd in self._possibleDirs:
2141  d = tfile.Get(pd)
2142  if d:
2143  possibleDirFound = True
2144  if subFolders is not None:
2145  subf = []
2146  for key in d.GetListOfKeys():
2147  if isinstance(key.ReadObj(), ROOT.TDirectory):
2148  subf.append(key.GetName())
2149  subFolders.append(subf)
2150  break
2151 
2152  if not isOpenFile:
2153  tfile.Close()
2154 
2155  if not possibleDirFound:
2156  return None
2157 
2158  return PlotterFolder(self._name, self._possibleDirs, subFolders, self._plotFolder, self._fallbackNames, self._fallbackDqmSubFolders, self._tableCreators)

Member Data Documentation

plotting.PlotterItem._fallbackDqmSubFolders
private

Definition at line 2104 of file plotting.py.

Referenced by plotting.PlotterItem.readDirs().

plotting.PlotterItem._fallbackNames
private

Definition at line 2103 of file plotting.py.

Referenced by plotting.PlotterItem.readDirs().

plotting.PlotterItem._name
private

Definition at line 2100 of file plotting.py.

Referenced by plotting.PlotterItem.getName(), validation.SimpleSample.name(), trackingPlots.Iteration.name(), and plotting.PlotterItem.readDirs().

plotting.PlotterItem._plotFolder
private

Definition at line 2102 of file plotting.py.

Referenced by plotting.PlotterItem.getPlotFolder(), and plotting.PlotterItem.readDirs().

plotting.PlotterItem._possibleDirs
private

Definition at line 2101 of file plotting.py.

Referenced by plotting.PlotterTableItem.create(), and plotting.PlotterItem.readDirs().

plotting.PlotterItem._tableCreators
private

Definition at line 2105 of file plotting.py.

Referenced by plotting.PlotterItem.readDirs().