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

2655  def __init__(self, name, possibleDirs, plotFolder, fallbackNames=[], fallbackDqmSubFolders=[]):
2656  """ Constructor
2657 
2658  Arguments:
2659  name -- Name of the folder (is used in the output directory naming)
2660  possibleDirs -- List of strings for possible directories of histograms in TFiles
2661  plotFolder -- PlotFolder object
2662 
2663  Keyword arguments
2664  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.
2665  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.
2666  """
2667  self._name = name
2668  self._possibleDirs = possibleDirs
2669  self._plotFolder = plotFolder
2670  self._fallbackNames = fallbackNames
2671  self._fallbackDqmSubFolders = fallbackDqmSubFolders
2672  self._tableCreators = []

Member Function Documentation

def plotting.PlotterItem.appendTableCreator (   self,
  tc 
)

Definition at line 2679 of file plotting.py.

2680  def appendTableCreator(self, tc):
2681  self._tableCreators.append(tc)
def plotting.PlotterItem.getName (   self)

Definition at line 2673 of file plotting.py.

References FP420HitsObject._name, TrackerHitsObject._name, PGeometricDet::Item._name, TrackingRecHitAlgorithm._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, Vispa.Views.PropertyView.Property._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, plotting.Plot._name, plotting.PlotGroup._name, plotting.PlotterFolder._name, and plotting.PlotterItem._name.

2674  def getName(self):
2675  return self._name
def plotting.PlotterItem.getPlotFolder (   self)

Definition at line 2676 of file plotting.py.

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

2677  def getPlotFolder(self):
2678  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 2682 of file plotting.py.

References plotting.PlotterFolder._fallbackDqmSubFolders, plotting.PlotterItem._fallbackDqmSubFolders, plotting.PlotterFolder._fallbackNames, plotting.PlotterItem._fallbackNames, FP420HitsObject._name, TrackerHitsObject._name, PGeometricDet::Item._name, TrackingRecHitAlgorithm._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, Vispa.Views.PropertyView.Property._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, 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.

2683  def readDirs(self, files):
2684  """Read available subfolders from the files
2685 
2686  Arguments:
2687  files -- List of strings for paths to files, or list of TFiles
2688 
2689  For each file, loop over 'possibleDirs', and read the
2690  subfolders of first one that exists.
2691 
2692  Returns a PlotterFolder if at least one file for which one of
2693  'possibleDirs' exists. Otherwise, return None to signal that
2694  there is nothing available for this PlotFolder.
2695  """
2696  subFolders = None
2697  if self._plotFolder.loopSubFolders():
2698  subFolders = []
2699  possibleDirFound = False
2700  for fname in files:
2701  if fname is None:
2702  continue
2703 
2704  isOpenFile = isinstance(fname, ROOT.TFile)
2705  if isOpenFile:
2706  tfile = fname
2707  else:
2708  tfile = ROOT.TFile.Open(fname)
2709  for pd in self._possibleDirs:
2710  d = tfile.Get(pd)
2711  if d:
2712  possibleDirFound = True
2713  if subFolders is not None:
2714  subf = []
2715  for key in d.GetListOfKeys():
2716  if isinstance(key.ReadObj(), ROOT.TDirectory):
2717  subf.append(key.GetName())
2718  subFolders.append(subf)
2719  break
2720 
2721  if not isOpenFile:
2722  tfile.Close()
2723 
2724  if not possibleDirFound:
2725  return None
2726 
2727  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 2670 of file plotting.py.

Referenced by plotting.PlotterItem.readDirs().

plotting.PlotterItem._fallbackNames
private

Definition at line 2669 of file plotting.py.

Referenced by plotting.PlotterItem.readDirs().

plotting.PlotterItem._name
private

Definition at line 2666 of file plotting.py.

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

plotting.PlotterItem._plotFolder
private

Definition at line 2668 of file plotting.py.

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

plotting.PlotterItem._possibleDirs
private

Definition at line 2667 of file plotting.py.

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

plotting.PlotterItem._tableCreators
private

Definition at line 2671 of file plotting.py.

Referenced by plotting.PlotterItem.readDirs().