CMS 3D CMS Logo

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

Public Member Functions

def __init__ (self, name, possibleDqmFolders, dqmSubFolders, plotFolder, fallbackNames, fallbackDqmSubFolders, tableCreators)
 
def create (self, files, labels, dqmSubFolder, isPileupSample=True, requireAllHistograms=False)
 
def draw (self, args, kwargs)
 
def getDQMSubFolders (self, limitOnlyTo=None)
 
def getName (self)
 
def getPage (self)
 
def getPossibleDQMFolders (self)
 
def getPurpose (self)
 
def getSection (self)
 
def getSelectionName (self, dqmSubFolder)
 
def getSelectionNameIterator (self, dqmSubFolder)
 
def getTableCreators (self)
 
def onlyForBHadron (self)
 
def onlyForConversion (self)
 
def onlyForElectron (self)
 
def onlyForPileup (self)
 

Private Attributes

 _dqmSubFolders
 
 _fallbackDqmSubFolders
 
 _fallbackNames
 
 _name
 
 _plotFolder
 
 _possibleDqmFolders
 
 _tableCreators
 

Detailed Description

Plotter for one DQM folder.

This class is supposed to be instantiated by the Plotter class (or
PlotterItem, to be more specific), and not used directly by the
user.

Definition at line 2682 of file plotting.py.

Constructor & Destructor Documentation

◆ __init__()

def plotting.PlotterFolder.__init__ (   self,
  name,
  possibleDqmFolders,
  dqmSubFolders,
  plotFolder,
  fallbackNames,
  fallbackDqmSubFolders,
  tableCreators 
)
Constructor

Arguments:
name               -- Name of the folder (is used in the output directory naming)
possibleDqmFolders -- List of strings for possible directories of histograms in TFiles
dqmSubFolders      -- List of lists of strings for list of subfolders per input file, or None if no subfolders
plotFolder         -- PlotFolder object
fallbackNames      -- List of names for backward compatibility (can be empty). 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 -- List of dicts of (string->string) for mapping the subfolder names found in the first file to another names. Use case is comparing files that have different iteration naming convention.
tableCreators      -- List of PlotterTableItem objects for tables to be created from this folder

Definition at line 2689 of file plotting.py.

2689  def __init__(self, name, possibleDqmFolders, dqmSubFolders, plotFolder, fallbackNames, fallbackDqmSubFolders, tableCreators):
2690  """
2691  Constructor
2692 
2693  Arguments:
2694  name -- Name of the folder (is used in the output directory naming)
2695  possibleDqmFolders -- List of strings for possible directories of histograms in TFiles
2696  dqmSubFolders -- List of lists of strings for list of subfolders per input file, or None if no subfolders
2697  plotFolder -- PlotFolder object
2698  fallbackNames -- List of names for backward compatibility (can be empty). 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.
2699  fallbackDqmSubFolders -- List of dicts of (string->string) for mapping the subfolder names found in the first file to another names. Use case is comparing files that have different iteration naming convention.
2700  tableCreators -- List of PlotterTableItem objects for tables to be created from this folder
2701  """
2702  self._name = name
2703  self._possibleDqmFolders = possibleDqmFolders
2704  self._plotFolder = plotFolder
2705  #self._dqmSubFolders = [map(lambda sf: DQMSubFolder(sf, self._plotFolder.translateSubFolder(sf)), lst) for lst in dqmSubFolders]
2706  if dqmSubFolders is None:
2707  self._dqmSubFolders = None
2708  else:
2709  # Match the subfolders between files in case the lists differ
2710  # equality is by the 'translated' name
2711  subfolders = {}
2712  for sf_list in dqmSubFolders:
2713  for sf in sf_list:
2714  sf_translated = self._plotFolder.translateSubFolder(sf)
2715  if sf_translated is not None and not sf_translated in subfolders:
2716  subfolders[sf_translated] = DQMSubFolder(sf, sf_translated)
2717 
2718  self._dqmSubFolders = sorted(subfolders.values(), key=lambda sf: sf.subfolder)
2719 
2720  self._fallbackNames = fallbackNames
2721  self._fallbackDqmSubFolders = fallbackDqmSubFolders
2722  self._tableCreators = tableCreators
2723 
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

◆ create()

def plotting.PlotterFolder.create (   self,
  files,
  labels,
  dqmSubFolder,
  isPileupSample = True,
  requireAllHistograms = False 
)
Create histograms from a list of TFiles.
Arguments:
files  -- List of TFiles
labels -- List of strings for legend labels corresponding the files
dqmSubFolder -- DQMSubFolder object for a subfolder (or None for no subfolder)
isPileupSample -- Is sample pileup (some PlotGroups may limit themselves to pileup)
requireAllHistograms -- If True, a plot is produced if histograms from all files are present (default: False)

Definition at line 2778 of file plotting.py.

References plotting.PlotterFolder._fallbackDqmSubFolders, plotting._getDirectoryDetailed(), plotting._getObject(), plotting.PlotterFolder._plotFolder, and plotting.PlotterFolder._possibleDqmFolders.

2778  def create(self, files, labels, dqmSubFolder, isPileupSample=True, requireAllHistograms=False):
2779  """Create histograms from a list of TFiles.
2780  Arguments:
2781  files -- List of TFiles
2782  labels -- List of strings for legend labels corresponding the files
2783  dqmSubFolder -- DQMSubFolder object for a subfolder (or None for no subfolder)
2784  isPileupSample -- Is sample pileup (some PlotGroups may limit themselves to pileup)
2785  requireAllHistograms -- If True, a plot is produced if histograms from all files are present (default: False)
2786  """
2787 
2788  subfolder = dqmSubFolder.subfolder if dqmSubFolder is not None else None
2789  neventsHisto = self._plotFolder.getNumberOfEventsHistogram()
2790  dirsNEvents = []
2791 
2792  for tfile in files:
2793  ret = _getDirectoryDetailed(tfile, self._possibleDqmFolders, subfolder)
2794  # If file and any of possibleDqmFolders exist but subfolder does not, try the fallbacks
2795  if ret is GetDirectoryCode.SubDirNotExist:
2796  for fallbackFunc in self._fallbackDqmSubFolders:
2797  fallback = fallbackFunc(subfolder)
2798  if fallback is not None:
2799  ret = _getDirectoryDetailed(tfile, self._possibleDqmFolders, fallback)
2800  if ret is not GetDirectoryCode.SubDirNotExist:
2801  break
2802  d = GetDirectoryCode.codesToNone(ret)
2803  nev = None
2804  if neventsHisto is not None and tfile is not None:
2805  hnev = _getObject(tfile, neventsHisto)
2806  if hnev is not None:
2807  nev = hnev.GetEntries()
2808  dirsNEvents.append( (d, nev) )
2809 
2810  self._plotFolder.create(dirsNEvents, labels, isPileupSample, requireAllHistograms)
2811 
def create(alignables, pedeDump, additionalData, outputFile, config)
def _getDirectoryDetailed(tfile, possibleDirs, subDir=None)
Definition: plotting.py:73
def _getObject(tdirectory, name)
Definition: plotting.py:49

◆ draw()

def plotting.PlotterFolder.draw (   self,
  args,
  kwargs 
)
Draw and save all plots using settings of a given algorithm.

Definition at line 2812 of file plotting.py.

References plotting.PlotterFolder._plotFolder.

2812  def draw(self, *args, **kwargs):
2813  """Draw and save all plots using settings of a given algorithm."""
2814  return self._plotFolder.draw(*args, **kwargs)
2815 
2816 
def draw(name, histos, styles=_defaultStyles, legendLabels=[], kwargs)

◆ getDQMSubFolders()

def plotting.PlotterFolder.getDQMSubFolders (   self,
  limitOnlyTo = None 
)
Get list of subfolders, possibly limiting to some of them.

Keyword arguments:
limitOnlyTo -- Object depending on the PlotFolder type for limiting the set of subfolders to be processed

Definition at line 2751 of file plotting.py.

References plotting.PlotterFolder._dqmSubFolders, and plotting.PlotterFolder._plotFolder.

2751  def getDQMSubFolders(self, limitOnlyTo=None):
2752  """Get list of subfolders, possibly limiting to some of them.
2753 
2754  Keyword arguments:
2755  limitOnlyTo -- Object depending on the PlotFolder type for limiting the set of subfolders to be processed
2756  """
2757 
2758  if self._dqmSubFolders is None:
2759  return [None]
2760 
2761  if limitOnlyTo is None:
2762  return self._dqmSubFolders
2763 
2764  return [s for s in self._dqmSubFolders if self._plotFolder.limitSubFolder(limitOnlyTo, s.translated)]
2765 

◆ getName()

def plotting.PlotterFolder.getName (   self)

◆ getPage()

def plotting.PlotterFolder.getPage (   self)

Definition at line 2730 of file plotting.py.

References plotting.PlotterFolder._plotFolder.

2730  def getPage(self):
2731  return self._plotFolder.getPage()
2732 

◆ getPossibleDQMFolders()

def plotting.PlotterFolder.getPossibleDQMFolders (   self)

Definition at line 2748 of file plotting.py.

References plotting.PlotterFolder._possibleDqmFolders.

2748  def getPossibleDQMFolders(self):
2749  return self._possibleDqmFolders
2750 

◆ getPurpose()

def plotting.PlotterFolder.getPurpose (   self)

Definition at line 2727 of file plotting.py.

References plotting.PlotterFolder._plotFolder.

2727  def getPurpose(self):
2728  return self._plotFolder.getPurpose()
2729 

◆ getSection()

def plotting.PlotterFolder.getSection (   self)

Definition at line 2733 of file plotting.py.

References plotting.PlotterFolder._plotFolder.

2733  def getSection(self):
2734  return self._plotFolder.getSection()
2735 

◆ getSelectionName()

def plotting.PlotterFolder.getSelectionName (   self,
  dqmSubFolder 
)

Definition at line 2775 of file plotting.py.

References plotting.PlotterFolder.getSelectionNameIterator(), and GetRecoTauVFromDQM_MC_cff.next.

2775  def getSelectionName(self, dqmSubFolder):
2776  return next(self.getSelectionNameIterator(dqmSubFolder))
2777 

◆ getSelectionNameIterator()

def plotting.PlotterFolder.getSelectionNameIterator (   self,
  dqmSubFolder 
)
Get a generator for the 'selection name', looping over the name and fallbackNames

Definition at line 2769 of file plotting.py.

References plotting.PlotterFolder._fallbackNames, ModulesProxy._ModuleProxy._name, FP420HitsObject._name, TrackerHitsObject._name, PGeometricDet::Item._name, TrackingRecHitAlgorithm._name, Logger._name, hcaldqm::DQModule._name, citk::IsolationConeDefinitionBase._name, condhdf5tohdf5.H5DataProduct._name, WValidation._name, DrellYanValidation._name, hcaldqm::flag::Flag._name, hcaldqm::quantity::Quantity._name, HistoParams< T >._name, condhdf5tohdf5.H5Tag._name, CutApplicatorBase._name, condhdf5tohdf5.H5GlobalTag._name, HistoParams< TH2F >._name, HistoParams< TProfile2D >._name, conddb2hdf5.DBGlobalTag._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, and plotting.PlotterFolder._plotFolder.

Referenced by plotting.PlotterFolder.getSelectionName().

2769  def getSelectionNameIterator(self, dqmSubFolder):
2770  """Get a generator for the 'selection name', looping over the name and fallbackNames"""
2771  for name in [self._name]+self._fallbackNames:
2772  for selname in self._plotFolder.iterSelectionName(name, dqmSubFolder.translated if dqmSubFolder is not None else None):
2773  yield selname
2774 

◆ getTableCreators()

def plotting.PlotterFolder.getTableCreators (   self)

Definition at line 2766 of file plotting.py.

References plotting.PlotterFolder._tableCreators.

2766  def getTableCreators(self):
2767  return self._tableCreators
2768 

◆ onlyForBHadron()

def plotting.PlotterFolder.onlyForBHadron (   self)

Definition at line 2745 of file plotting.py.

References plotting.PlotterFolder._plotFolder.

2745  def onlyForBHadron(self):
2746  return self._plotFolder.onlyForBHadron()
2747 

◆ onlyForConversion()

def plotting.PlotterFolder.onlyForConversion (   self)

Definition at line 2742 of file plotting.py.

References plotting.PlotterFolder._plotFolder.

2742  def onlyForConversion(self):
2743  return self._plotFolder.onlyForConversion()
2744 

◆ onlyForElectron()

def plotting.PlotterFolder.onlyForElectron (   self)

Definition at line 2739 of file plotting.py.

References plotting.PlotterFolder._plotFolder.

2739  def onlyForElectron(self):
2740  return self._plotFolder.onlyForElectron()
2741 

◆ onlyForPileup()

def plotting.PlotterFolder.onlyForPileup (   self)

Definition at line 2736 of file plotting.py.

References plotting.PlotterFolder._plotFolder.

2736  def onlyForPileup(self):
2737  return self._plotFolder.onlyForPileup()
2738 

Member Data Documentation

◆ _dqmSubFolders

plotting.PlotterFolder._dqmSubFolders
private

Definition at line 2707 of file plotting.py.

Referenced by plotting.PlotterFolder.getDQMSubFolders().

◆ _fallbackDqmSubFolders

plotting.PlotterFolder._fallbackDqmSubFolders
private

Definition at line 2721 of file plotting.py.

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

◆ _fallbackNames

plotting.PlotterFolder._fallbackNames
private

◆ _name

plotting.PlotterFolder._name
private

◆ _plotFolder

plotting.PlotterFolder._plotFolder
private

◆ _possibleDqmFolders

plotting.PlotterFolder._possibleDqmFolders
private

◆ _tableCreators

plotting.PlotterFolder._tableCreators
private