CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
plotting.PlotFolder Class Reference
Inheritance diagram for plotting.PlotFolder:
trackingPlots.TrackingPlotFolder

Public Member Functions

def __init__ (self, *plotGroups, **kwargs)
 
def append (self, plotGroup)
 
def create (self, dirsNEvents, labels, isPileupSample=True, requireAllHistograms=False)
 
def draw (self, prefix=None, separate=False, saveFormat=".pdf", ratio=True, directory="")
 
def getNumberOfEventsHistogram (self)
 
def getPage (self)
 
def getPlotGroup (self, name)
 
def getPlotGroups (self)
 
def getPurpose (self)
 
def getSection (self)
 
def iterSelectionName (self, plotFolderName, translatedDqmSubFolder)
 
def limitSubFolder (self, limitOnlyTo, translatedDqmSubFolder)
 
def loopSubFolders (self)
 
def onlyForBHadron (self)
 
def onlyForConversion (self)
 
def onlyForElectron (self)
 
def onlyForPileup (self)
 
def set (self, plotGroups)
 
def translateSubFolder (self, dqmSubFolderName)
 

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

Constructor & Destructor Documentation

◆ __init__()

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".

Reimplemented in trackingPlots.TrackingPlotFolder.

Definition at line 2548 of file plotting.py.

2548  def __init__(self, *plotGroups, **kwargs):
2549  """Constructor.
2550 
2551  Arguments:
2552  plotGroups -- List of PlotGroup objects
2553 
2554  Keyword arguments
2555  loopSubFolders -- Should the subfolders be looped over? (default: True)
2556  onlyForPileup -- Plots this folder only for pileup samples
2557  onlyForElectron -- Plots this folder only for electron samples
2558  onlyForConversion -- Plots this folder only for conversion samples
2559  onlyForBHadron -- Plots this folder only for B-hadron samples
2560  purpose -- html.PlotPurpose member class for the purpose of the folder, used for grouping of the plots to the HTML pages
2561  page -- Optional string for the page in HTML generatin
2562  section -- Optional string for the section within a page in HTML generation
2563  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".
2564  """
2565  self._plotGroups = list(plotGroups)
2566  self._loopSubFolders = kwargs.pop("loopSubFolders", True)
2567  self._onlyForPileup = kwargs.pop("onlyForPileup", False)
2568  self._onlyForElectron = kwargs.pop("onlyForElectron", False)
2569  self._onlyForConversion = kwargs.pop("onlyForConversion", False)
2570  self._onlyForBHadron = kwargs.pop("onlyForBHadron", False)
2571  self._purpose = kwargs.pop("purpose", None)
2572  self._page = kwargs.pop("page", None)
2573  self._section = kwargs.pop("section", None)
2574  self._numberOfEventsHistogram = kwargs.pop("numberOfEventsHistogram", None)
2575  if len(kwargs) > 0:
2576  raise Exception("Got unexpected keyword arguments: "+ ",".join(kwargs.keys()))
2577 

Member Function Documentation

◆ append()

def plotting.PlotFolder.append (   self,
  plotGroup 
)

Definition at line 2607 of file plotting.py.

2607  def append(self, plotGroup):
2608  self._plotGroups.append(plotGroup)
2609 

References plotting.PlotFolder._plotGroups.

Referenced by diclist.diclist.add().

◆ create()

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

2622  def create(self, dirsNEvents, labels, isPileupSample=True, requireAllHistograms=False):
2623  """Create histograms from a list of TFiles.
2624 
2625  Arguments:
2626  dirsNEvents -- List of (TDirectory, nevents) pairs
2627  labels -- List of strings for legend labels corresponding the files
2628  isPileupSample -- Is sample pileup (some PlotGroups may limit themselves to pileup)
2629  requireAllHistograms -- If True, a plot is produced if histograms from all files are present (default: False)
2630  """
2631 
2632  if len(dirsNEvents) != len(labels):
2633  raise Exception("len(dirsNEvents) should be len(labels), now they are %d and %d" % (len(dirsNEvents), len(labels)))
2634 
2635  self._labels = labels
2636 
2637  for pg in self._plotGroups:
2638  if pg.onlyForPileup() and not isPileupSample:
2639  continue
2640  pg.create(dirsNEvents, requireAllHistograms)
2641 

◆ draw()

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

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

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

◆ getNumberOfEventsHistogram()

def plotting.PlotFolder.getNumberOfEventsHistogram (   self)

Definition at line 2604 of file plotting.py.

2604  def getNumberOfEventsHistogram(self):
2605  return self._numberOfEventsHistogram
2606 

References plotting.PlotFolder._numberOfEventsHistogram.

◆ getPage()

def plotting.PlotFolder.getPage (   self)

Definition at line 2598 of file plotting.py.

2598  def getPage(self):
2599  return self._page
2600 

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

◆ getPlotGroup()

def plotting.PlotFolder.getPlotGroup (   self,
  name 
)

Definition at line 2616 of file plotting.py.

2616  def getPlotGroup(self, name):
2617  for pg in self._plotGroups:
2618  if pg.getName() == name:
2619  return pg
2620  raise Exception("No PlotGroup named '%s'" % name)
2621 

References plotting.PlotFolder._plotGroups.

◆ getPlotGroups()

def plotting.PlotFolder.getPlotGroups (   self)

Definition at line 2613 of file plotting.py.

2613  def getPlotGroups(self):
2614  return self._plotGroups
2615 

References plotting.PlotFolder._plotGroups.

◆ getPurpose()

def plotting.PlotFolder.getPurpose (   self)

Definition at line 2595 of file plotting.py.

2595  def getPurpose(self):
2596  return self._purpose
2597 

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

◆ getSection()

def plotting.PlotFolder.getSection (   self)

Definition at line 2601 of file plotting.py.

2601  def getSection(self):
2602  return self._section
2603 

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

◆ iterSelectionName()

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

Reimplemented in trackingPlots.TrackingPlotFolder.

Definition at line 2670 of file plotting.py.

2670  def iterSelectionName(self, plotFolderName, translatedDqmSubFolder):
2671  """Iterate over possible selections name (used in output directory name and legend) from the name of PlotterFolder, and a return value of translateSubFolder"""
2672  ret = ""
2673  if plotFolderName != "":
2674  ret += "_"+plotFolderName
2675  if translatedDqmSubFolder is not None:
2676  ret += "_"+translatedDqmSubFolder
2677  yield ret
2678 

◆ limitSubFolder()

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

Reimplemented in trackingPlots.TrackingPlotFolder.

Definition at line 2679 of file plotting.py.

2679  def limitSubFolder(self, limitOnlyTo, translatedDqmSubFolder):
2680  """Return True if this subfolder should be processed
2681 
2682  Arguments:
2683  limitOnlyTo -- List/set/similar containing the translatedDqmSubFolder
2684  translatedDqmSubFolder -- Return value of translateSubFolder
2685  """
2686  return translatedDqmSubFolder in limitOnlyTo
2687 

◆ loopSubFolders()

def plotting.PlotFolder.loopSubFolders (   self)
Return True if the PlotGroups of this folder should be applied to the all subfolders

Definition at line 2578 of file plotting.py.

2578  def loopSubFolders(self):
2579  """Return True if the PlotGroups of this folder should be applied to the all subfolders"""
2580  return self._loopSubFolders
2581 

References plotting.PlotFolder._loopSubFolders.

◆ onlyForBHadron()

def plotting.PlotFolder.onlyForBHadron (   self)

Definition at line 2592 of file plotting.py.

2592  def onlyForBHadron(self):
2593  return self._onlyForBHadron
2594 

References plotting.PlotFolder._onlyForBHadron.

◆ onlyForConversion()

def plotting.PlotFolder.onlyForConversion (   self)

Definition at line 2589 of file plotting.py.

2589  def onlyForConversion(self):
2590  return self._onlyForConversion
2591 

References plotting.PlotFolder._onlyForConversion.

◆ onlyForElectron()

def plotting.PlotFolder.onlyForElectron (   self)

Definition at line 2586 of file plotting.py.

2586  def onlyForElectron(self):
2587  return self._onlyForElectron
2588 

References plotting.PlotFolder._onlyForElectron.

◆ onlyForPileup()

def plotting.PlotFolder.onlyForPileup (   self)
Return True if the folder is intended only for pileup samples

Definition at line 2582 of file plotting.py.

2582  def onlyForPileup(self):
2583  """Return True if the folder is intended only for pileup samples"""
2584  return self._onlyForPileup
2585 

References plotting.PlotFolder._onlyForPileup.

◆ set()

def plotting.PlotFolder.set (   self,
  plotGroups 
)

Definition at line 2610 of file plotting.py.

2610  def set(self, plotGroups):
2611  self._plotGroups = plotGroups
2612 

References plotting.PlotFolder._plotGroups.

◆ translateSubFolder()

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)

Reimplemented in trackingPlots.TrackingPlotFolder.

Definition at line 2660 of file plotting.py.

2660  def translateSubFolder(self, dqmSubFolderName):
2661  """Method called to (possibly) translate a subfolder name to more 'readable' form
2662 
2663  The implementation in this (base) class just returns the
2664  argument. The idea is that a deriving class might want to do
2665  something more complex (like trackingPlots.TrackingPlotFolder
2666  does)
2667  """
2668  return dqmSubFolderName
2669 

Member Data Documentation

◆ _labels

plotting.PlotFolder._labels
private

◆ _loopSubFolders

plotting.PlotFolder._loopSubFolders
private

Definition at line 2566 of file plotting.py.

Referenced by plotting.PlotFolder.loopSubFolders().

◆ _numberOfEventsHistogram

plotting.PlotFolder._numberOfEventsHistogram
private

Definition at line 2574 of file plotting.py.

Referenced by plotting.PlotFolder.getNumberOfEventsHistogram().

◆ _onlyForBHadron

plotting.PlotFolder._onlyForBHadron
private

Definition at line 2570 of file plotting.py.

Referenced by plotting.PlotFolder.onlyForBHadron().

◆ _onlyForConversion

plotting.PlotFolder._onlyForConversion
private

Definition at line 2569 of file plotting.py.

Referenced by plotting.PlotFolder.onlyForConversion().

◆ _onlyForElectron

plotting.PlotFolder._onlyForElectron
private

Definition at line 2568 of file plotting.py.

Referenced by plotting.PlotFolder.onlyForElectron().

◆ _onlyForPileup

plotting.PlotFolder._onlyForPileup
private

◆ _page

plotting.PlotFolder._page
private

◆ _plotGroups

plotting.PlotFolder._plotGroups
private

◆ _purpose

plotting.PlotFolder._purpose
private

◆ _section

plotting.PlotFolder._section
private
join
static std::string join(char **cmd)
Definition: RemoteFile.cc:17
ntuplePlotting.draw
def draw(name, histos, styles=_defaultStyles, legendLabels=[], **kwargs)
Definition: ntuplePlotting.py:25
beamerCreator.create
def create(alignables, pedeDump, additionalData, outputFile, config)
Definition: beamerCreator.py:44
Exception
mps_setup.append
append
Definition: mps_setup.py:85
trackingPlots.onlyForPileup
onlyForPileup
Definition: trackingPlots.py:310
hgcalPlots.loopSubFolders
loopSubFolders
Definition: hgcalPlots.py:2048