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 readDirs
 

Private Attributes

 _fallbackNames
 
 _name
 
 _plotFolder
 
 _possibleDirs
 

Detailed Description

Definition at line 1856 of file plotting.py.

Constructor & Destructor Documentation

def plotting.PlotterItem.__init__ (   self,
  name,
  possibleDirs,
  plotFolder,
  fallbackNames = [] 
)
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.

Definition at line 1857 of file plotting.py.

1858  def __init__(self, name, possibleDirs, plotFolder, fallbackNames=[]):
1859  """ Constructor
1860 
1861  Arguments:
1862  name -- Name of the folder (is used in the output directory naming)
1863  possibleDirs -- List of strings for possible directories of histograms in TFiles
1864  plotFolder -- PlotFolder object
1865 
1866  Keyword arguments
1867  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.
1868  """
1869  self._name = name
1870  self._possibleDirs = possibleDirs
1871  self._plotFolder = plotFolder
1872  self._fallbackNames = fallbackNames

Member Function Documentation

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

References plotting.PlotterFolder._fallbackNames, plotting.PlotterItem._fallbackNames, FP420HitsObject._name, TrackerHitsObject._name, PGeometricDet::Item._name, LikelihoodSpecies._name, LikelihoodPdfProduct._name, LikelihoodPdf._name, citk::IsolationConeDefinitionBase._name, DrellYanValidation._name, WValidation._name, HistoParams< T >._name, CutApplicatorBase._name, ElectronMVAEstimatorRun2Phys14NonTrig._name, PhotonMVAEstimatorRun2Spring15NonTrig._name, PhotonMVAEstimatorRun2Phys14NonTrig._name, GeometricDetExtra._name, ElectronMVAEstimatorRun2Spring15Trig._name, ElectronMVAEstimatorRun2Spring15NonTrig._name, HistoParams< TH2F >._name, plotting.Subtract._name, HistoParams< TProfile2D >._name, plotting.FakeDuplicate._name, plotting.AggregateBins._name, plotting.AggregateHistos._name, plotting.ROC._name, Vispa.Views.PropertyView.Property._name, SequenceTypes.SequencePlaceholder._name, plotting.Plot._name, plotting.PlotGroup._name, plotting.PlotterFolder._name, plotting.PlotterItem._name, plotting.PlotterFolder._plotFolder, plotting.PlotterItem._plotFolder, and plotting.PlotterItem._possibleDirs.

1874  def readDirs(self, files):
1875  """Read available subfolders from the files
1876 
1877  Arguments:
1878  files -- List of strings for paths to files, or list of TFiles
1879 
1880  For each file, loop over 'possibleDirs', and read the
1881  subfolders of first one that exists.
1882 
1883  Returns a PlotterFolder if at least one file for which one of
1884  'possibleDirs' exists. Otherwise, return None to signal that
1885  there is nothing available for this PlotFolder.
1886  """
1887  subFolders = None
1888  if self._plotFolder.loopSubFolders():
1889  subFolders = []
1890  possibleDirFound = False
1891  for fname in files:
1892  isOpenFile = isinstance(fname, ROOT.TFile)
1893  if isOpenFile:
1894  tfile = fname
1895  else:
1896  tfile = ROOT.TFile.Open(fname)
1897  for pd in self._possibleDirs:
1898  d = tfile.Get(pd)
1899  if d:
1900  possibleDirFound = True
1901  if subFolders is not None:
1902  subf = []
1903  for key in d.GetListOfKeys():
1904  if isinstance(key.ReadObj(), ROOT.TDirectory):
1905  subf.append(key.GetName())
1906  subFolders.append(subf)
1907  break
1908 
1909  if not isOpenFile:
1910  tfile.Close()
1911 
1912  if not possibleDirFound:
1913  return None
1914 
1915  return PlotterFolder(self._name, self._possibleDirs, subFolders, self._plotFolder, self._fallbackNames)

Member Data Documentation

plotting.PlotterItem._fallbackNames
private

Definition at line 1871 of file plotting.py.

Referenced by plotting.PlotterItem.readDirs().

plotting.PlotterItem._name
private

Definition at line 1868 of file plotting.py.

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

plotting.PlotterItem._plotFolder
private

Definition at line 1870 of file plotting.py.

Referenced by plotting.PlotterItem.readDirs().

plotting.PlotterItem._possibleDirs
private

Definition at line 1869 of file plotting.py.

Referenced by plotting.PlotterItem.readDirs().