CMS 3D CMS Logo

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

Public Member Functions

def __init__
 
def append
 
def create
 
def draw
 
def getNumberOfEventsHistogram
 
def getPage
 
def getPlotGroup
 
def getPlotGroups
 
def getPurpose
 
def getSection
 
def iterSelectionName
 
def limitSubFolder
 
def loopSubFolders
 
def onlyForBHadron
 
def onlyForConversion
 
def onlyForElectron
 
def onlyForPileup
 
def set
 
def translateSubFolder
 

Private Attributes

 _labels
 
 _loopSubFolders
 
 _numberOfEventsHistogram
 
 _onlyForBHadron
 
 _onlyForConversion
 
 _onlyForElectron
 
 _onlyForPileup
 
 _page
 
 _plotGroups
 
 _purpose
 
 _section
 

Detailed Description

Represents a collection of PlotGroups, produced from a single folder in a DQM file

Definition at line 2551 of file plotting.py.

Constructor & Destructor Documentation

def plotting.PlotFolder.__init__ (   self,
  plotGroups,
  kwargs 
)
Constructor.

Arguments:
plotGroups     -- List of PlotGroup objects

Keyword arguments
loopSubFolders -- Should the subfolders be looped over? (default: True)
onlyForPileup  -- Plots this folder only for pileup samples
onlyForElectron -- Plots this folder only for electron samples
onlyForConversion -- Plots this folder only for conversion samples
onlyForBHadron -- Plots this folder only for B-hadron samples
purpose        -- html.PlotPurpose member class for the purpose of the folder, used for grouping of the plots to the HTML pages
page           -- Optional string for the page in HTML generatin
section        -- Optional string for the section within a page in HTML generation
numberOfEventsHistogram -- Optional path to histogram filled once per event. Needed if there are any plots normalized by number of events. Path is relative to "possibleDqmFolders".

Definition at line 2554 of file plotting.py.

2555  def __init__(self, *plotGroups, **kwargs):
2556  """Constructor.
2557 
2558  Arguments:
2559  plotGroups -- List of PlotGroup objects
2560 
2561  Keyword arguments
2562  loopSubFolders -- Should the subfolders be looped over? (default: True)
2563  onlyForPileup -- Plots this folder only for pileup samples
2564  onlyForElectron -- Plots this folder only for electron samples
2565  onlyForConversion -- Plots this folder only for conversion samples
2566  onlyForBHadron -- Plots this folder only for B-hadron samples
2567  purpose -- html.PlotPurpose member class for the purpose of the folder, used for grouping of the plots to the HTML pages
2568  page -- Optional string for the page in HTML generatin
2569  section -- Optional string for the section within a page in HTML generation
2570  numberOfEventsHistogram -- Optional path to histogram filled once per event. Needed if there are any plots normalized by number of events. Path is relative to "possibleDqmFolders".
2571  """
2572  self._plotGroups = list(plotGroups)
2573  self._loopSubFolders = kwargs.pop("loopSubFolders", True)
2574  self._onlyForPileup = kwargs.pop("onlyForPileup", False)
2575  self._onlyForElectron = kwargs.pop("onlyForElectron", False)
2576  self._onlyForConversion = kwargs.pop("onlyForConversion", False)
2577  self._onlyForBHadron = kwargs.pop("onlyForBHadron", False)
2578  self._purpose = kwargs.pop("purpose", None)
2579  self._page = kwargs.pop("page", None)
2580  self._section = kwargs.pop("section", None)
2581  self._numberOfEventsHistogram = kwargs.pop("numberOfEventsHistogram", None)
2582  if len(kwargs) > 0:
2583  raise Exception("Got unexpected keyword arguments: "+ ",".join(kwargs.keys()))
static std::string join(char **cmd)
Definition: RemoteFile.cc:19

Member Function Documentation

def plotting.PlotFolder.append (   self,
  plotGroup 
)

Definition at line 2613 of file plotting.py.

Referenced by diclist.diclist.add(), and BeautifulSoup.Tag.setString().

2614  def append(self, plotGroup):
2615  self._plotGroups.append(plotGroup)
def plotting.PlotFolder.create (   self,
  dirsNEvents,
  labels,
  isPileupSample = True,
  requireAllHistograms = False 
)
Create histograms from a list of TFiles.

Arguments:
dirsNEvents   -- List of (TDirectory, nevents) pairs
labels -- List of strings for legend labels corresponding the files
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 2628 of file plotting.py.

2629  def create(self, dirsNEvents, labels, isPileupSample=True, requireAllHistograms=False):
2630  """Create histograms from a list of TFiles.
2631 
2632  Arguments:
2633  dirsNEvents -- List of (TDirectory, nevents) pairs
2634  labels -- List of strings for legend labels corresponding the files
2635  isPileupSample -- Is sample pileup (some PlotGroups may limit themselves to pileup)
2636  requireAllHistograms -- If True, a plot is produced if histograms from all files are present (default: False)
2637  """
2638 
2639  if len(dirsNEvents) != len(labels):
2640  raise Exception("len(dirsNEvents) should be len(labels), now they are %d and %d" % (len(dirsNEvents), len(labels)))
2642  self._labels = labels
2643 
2644  for pg in self._plotGroups:
2645  if pg.onlyForPileup() and not isPileupSample:
2646  continue
2647  pg.create(dirsNEvents, requireAllHistograms)
def plotting.PlotFolder.draw (   self,
  prefix = None,
  separate = False,
  saveFormat = ".pdf",
  ratio = True,
  directory = "" 
)
Draw and save all plots using settings of a given algorithm.

Arguments:
prefix   -- Optional string for file name prefix (default None)
separate -- Save the plots of a group to separate files instead of a file per group (default False)
saveFormat   -- String specifying the plot format (default '.pdf')
ratio    -- Add ratio to the plot (default True)
directory -- Directory where to save the file (default "")

Definition at line 2648 of file plotting.py.

References DigiInvestigatorHistogramMaker._labels, SeedMultiplicityAnalyzer._labels, hitfit::Constraint_Intermed_Labels._labels, Config.ProcessAcceleratorTest._labels, Config.ProcessAcceleratorTest2._labels, plotting.PlotFolder._labels, and plotting.PlotFolder._plotGroups.

2649  def draw(self, prefix=None, separate=False, saveFormat=".pdf", ratio=True, directory=""):
2650  """Draw and save all plots using settings of a given algorithm.
2651 
2652  Arguments:
2653  prefix -- Optional string for file name prefix (default None)
2654  separate -- Save the plots of a group to separate files instead of a file per group (default False)
2655  saveFormat -- String specifying the plot format (default '.pdf')
2656  ratio -- Add ratio to the plot (default True)
2657  directory -- Directory where to save the file (default "")
2658  """
2659  ret = []
2660 
2661  for pg in self._plotGroups:
2662  ret.extend(pg.draw(self._labels, prefix=prefix, separate=separate, saveFormat=saveFormat, ratio=ratio, directory=directory))
2663  return ret
2664 
def plotting.PlotFolder.getNumberOfEventsHistogram (   self)

Definition at line 2610 of file plotting.py.

References plotting.PlotFolder._numberOfEventsHistogram.

2611  def getNumberOfEventsHistogram(self):
2612  return self._numberOfEventsHistogram
def getNumberOfEventsHistogram
Definition: plotting.py:2610
def plotting.PlotFolder.getPage (   self)

Definition at line 2604 of file plotting.py.

References html.Table._page, and plotting.PlotFolder._page.

2605  def getPage(self):
2606  return self._page
def plotting.PlotFolder.getPlotGroup (   self,
  name 
)

Definition at line 2622 of file plotting.py.

References plotting.PlotFolder._plotGroups.

2623  def getPlotGroup(self, name):
2624  for pg in self._plotGroups:
2625  if pg.getName() == name:
2626  return pg
2627  raise Exception("No PlotGroup named '%s'" % name)
def plotting.PlotFolder.getPlotGroups (   self)

Definition at line 2619 of file plotting.py.

References plotting.PlotFolder._plotGroups.

2620  def getPlotGroups(self):
2621  return self._plotGroups
def plotting.PlotFolder.getPurpose (   self)

Definition at line 2601 of file plotting.py.

References html.Table._purpose, and plotting.PlotFolder._purpose.

2602  def getPurpose(self):
2603  return self._purpose
def plotting.PlotFolder.getSection (   self)

Definition at line 2607 of file plotting.py.

References html.Table._section, and plotting.PlotFolder._section.

2608  def getSection(self):
2609  return self._section
def plotting.PlotFolder.iterSelectionName (   self,
  plotFolderName,
  translatedDqmSubFolder 
)
Iterate over possible selections name (used in output directory name and legend) from the name of PlotterFolder, and a return value of translateSubFolder

Definition at line 2676 of file plotting.py.

2677  def iterSelectionName(self, plotFolderName, translatedDqmSubFolder):
2678  """Iterate over possible selections name (used in output directory name and legend) from the name of PlotterFolder, and a return value of translateSubFolder"""
2679  ret = ""
2680  if plotFolderName != "":
2681  ret += "_"+plotFolderName
2682  if translatedDqmSubFolder is not None:
2683  ret += "_"+translatedDqmSubFolder
2684  yield ret
def plotting.PlotFolder.limitSubFolder (   self,
  limitOnlyTo,
  translatedDqmSubFolder 
)
Return True if this subfolder should be processed

Arguments:
limitOnlyTo            -- List/set/similar containing the translatedDqmSubFolder
translatedDqmSubFolder -- Return value of translateSubFolder

Definition at line 2685 of file plotting.py.

2686  def limitSubFolder(self, limitOnlyTo, translatedDqmSubFolder):
2687  """Return True if this subfolder should be processed
2688 
2689  Arguments:
2690  limitOnlyTo -- List/set/similar containing the translatedDqmSubFolder
2691  translatedDqmSubFolder -- Return value of translateSubFolder
2692  """
2693  return translatedDqmSubFolder in limitOnlyTo
def plotting.PlotFolder.loopSubFolders (   self)
Return True if the PlotGroups of this folder should be applied to the all subfolders

Definition at line 2584 of file plotting.py.

References plotting.PlotFolder._loopSubFolders.

2585  def loopSubFolders(self):
2586  """Return True if the PlotGroups of this folder should be applied to the all subfolders"""
2587  return self._loopSubFolders
def plotting.PlotFolder.onlyForBHadron (   self)

Definition at line 2598 of file plotting.py.

References plotting.PlotFolder._onlyForBHadron.

2599  def onlyForBHadron(self):
2600  return self._onlyForBHadron
def plotting.PlotFolder.onlyForConversion (   self)

Definition at line 2595 of file plotting.py.

References plotting.PlotFolder._onlyForConversion.

2596  def onlyForConversion(self):
2597  return self._onlyForConversion
def plotting.PlotFolder.onlyForElectron (   self)

Definition at line 2592 of file plotting.py.

References plotting.PlotFolder._onlyForElectron.

2593  def onlyForElectron(self):
2594  return self._onlyForElectron
def plotting.PlotFolder.onlyForPileup (   self)
Return True if the folder is intended only for pileup samples

Definition at line 2588 of file plotting.py.

References plotting.PlotFolder._onlyForPileup.

2589  def onlyForPileup(self):
2590  """Return True if the folder is intended only for pileup samples"""
2591  return self._onlyForPileup
def plotting.PlotFolder.set (   self,
  plotGroups 
)

Definition at line 2616 of file plotting.py.

References plotting.PlotFolder._plotGroups.

2617  def set(self, plotGroups):
2618  self._plotGroups = plotGroups
def plotting.PlotFolder.translateSubFolder (   self,
  dqmSubFolderName 
)
Method called to (possibly) translate a subfolder name to more 'readable' form

The implementation in this (base) class just returns the
argument. The idea is that a deriving class might want to do
something more complex (like trackingPlots.TrackingPlotFolder
does)

Definition at line 2666 of file plotting.py.

2667  def translateSubFolder(self, dqmSubFolderName):
2668  """Method called to (possibly) translate a subfolder name to more 'readable' form
2669 
2670  The implementation in this (base) class just returns the
2671  argument. The idea is that a deriving class might want to do
2672  something more complex (like trackingPlots.TrackingPlotFolder
2673  does)
2674  """
2675  return dqmSubFolderName

Member Data Documentation

plotting.PlotFolder._labels
private

Definition at line 2641 of file plotting.py.

Referenced by validation.SimpleValidation._doPlots(), validation.SeparateValidation._doPlots(), and plotting.PlotFolder.draw().

plotting.PlotFolder._loopSubFolders
private

Definition at line 2572 of file plotting.py.

Referenced by plotting.PlotFolder.loopSubFolders().

plotting.PlotFolder._numberOfEventsHistogram
private

Definition at line 2580 of file plotting.py.

Referenced by plotting.PlotFolder.getNumberOfEventsHistogram().

plotting.PlotFolder._onlyForBHadron
private

Definition at line 2576 of file plotting.py.

Referenced by plotting.PlotFolder.onlyForBHadron().

plotting.PlotFolder._onlyForConversion
private

Definition at line 2575 of file plotting.py.

Referenced by plotting.PlotFolder.onlyForConversion().

plotting.PlotFolder._onlyForElectron
private

Definition at line 2574 of file plotting.py.

Referenced by plotting.PlotFolder.onlyForElectron().

plotting.PlotFolder._onlyForPileup
private

Definition at line 2573 of file plotting.py.

Referenced by trackingPlots.TrackingSeedingLayerTable.onlyForPileup(), plotting.PlotGroup.onlyForPileup(), and plotting.PlotFolder.onlyForPileup().

plotting.PlotFolder._page
private

Definition at line 2578 of file plotting.py.

Referenced by vertexPlots.VertexSummaryTable.getPage(), trackingPlots.TrackingSummaryTable.getPage(), trackingPlots.TrackingTimingTable.getPage(), and plotting.PlotFolder.getPage().

plotting.PlotFolder._plotGroups
private

Definition at line 2571 of file plotting.py.

Referenced by plotting.PlotFolder.draw(), plotting.PlotFolder.getPlotGroup(), plotting.PlotFolder.getPlotGroups(), and plotting.PlotFolder.set().

plotting.PlotFolder._purpose
private

Definition at line 2577 of file plotting.py.

Referenced by vertexPlots.VertexSummaryTable.getPurpose(), trackingPlots.TrackingSummaryTable.getPurpose(), trackingPlots.TrackingTimingTable.getPurpose(), and plotting.PlotFolder.getPurpose().

plotting.PlotFolder._section
private

Definition at line 2579 of file plotting.py.

Referenced by trackingPlots.TrackingSummaryTable.getSection(), trackingPlots.TrackingTimingTable.getSection(), and plotting.PlotFolder.getSection().