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

Definition at line 2532 of file plotting.py.

2532  def __init__(self, *plotGroups, **kwargs):
2533  """Constructor.
2534 
2535  Arguments:
2536  plotGroups -- List of PlotGroup objects
2537 
2538  Keyword arguments
2539  loopSubFolders -- Should the subfolders be looped over? (default: True)
2540  onlyForPileup -- Plots this folder only for pileup samples
2541  onlyForElectron -- Plots this folder only for electron samples
2542  onlyForConversion -- Plots this folder only for conversion samples
2543  onlyForBHadron -- Plots this folder only for B-hadron samples
2544  purpose -- html.PlotPurpose member class for the purpose of the folder, used for grouping of the plots to the HTML pages
2545  page -- Optional string for the page in HTML generatin
2546  section -- Optional string for the section within a page in HTML generation
2547  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".
2548  """
2549  self._plotGroups = list(plotGroups)
2550  self._loopSubFolders = kwargs.pop("loopSubFolders", True)
2551  self._onlyForPileup = kwargs.pop("onlyForPileup", False)
2552  self._onlyForElectron = kwargs.pop("onlyForElectron", False)
2553  self._onlyForConversion = kwargs.pop("onlyForConversion", False)
2554  self._onlyForBHadron = kwargs.pop("onlyForBHadron", False)
2555  self._purpose = kwargs.pop("purpose", None)
2556  self._page = kwargs.pop("page", None)
2557  self._section = kwargs.pop("section", None)
2558  self._numberOfEventsHistogram = kwargs.pop("numberOfEventsHistogram", None)
2559  if len(kwargs) > 0:
2560  raise Exception("Got unexpected keyword arguments: "+ ",".join(kwargs.keys()))
2561 
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)
static std::string join(char **cmd)
Definition: RemoteFile.cc:19

Member Function Documentation

◆ append()

def plotting.PlotFolder.append (   self,
  plotGroup 
)

Definition at line 2591 of file plotting.py.

References plotting.PlotFolder._plotGroups.

Referenced by diclist.diclist.add().

2591  def append(self, plotGroup):
2592  self._plotGroups.append(plotGroup)
2593 

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

2606  def create(self, dirsNEvents, labels, isPileupSample=True, requireAllHistograms=False):
2607  """Create histograms from a list of TFiles.
2608 
2609  Arguments:
2610  dirsNEvents -- List of (TDirectory, nevents) pairs
2611  labels -- List of strings for legend labels corresponding the files
2612  isPileupSample -- Is sample pileup (some PlotGroups may limit themselves to pileup)
2613  requireAllHistograms -- If True, a plot is produced if histograms from all files are present (default: False)
2614  """
2615 
2616  if len(dirsNEvents) != len(labels):
2617  raise Exception("len(dirsNEvents) should be len(labels), now they are %d and %d" % (len(dirsNEvents), len(labels)))
2618 
2619  self._labels = labels
2620 
2621  for pg in self._plotGroups:
2622  if pg.onlyForPileup() and not isPileupSample:
2623  continue
2624  pg.create(dirsNEvents, requireAllHistograms)
2625 
def create(alignables, pedeDump, additionalData, outputFile, config)

◆ 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 2626 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.

2626  def draw(self, prefix=None, separate=False, saveFormat=".pdf", ratio=True, directory=""):
2627  """Draw and save all plots using settings of a given algorithm.
2628 
2629  Arguments:
2630  prefix -- Optional string for file name prefix (default None)
2631  separate -- Save the plots of a group to separate files instead of a file per group (default False)
2632  saveFormat -- String specifying the plot format (default '.pdf')
2633  ratio -- Add ratio to the plot (default True)
2634  directory -- Directory where to save the file (default "")
2635  """
2636  ret = []
2637 
2638  for pg in self._plotGroups:
2639  ret.extend(pg.draw(self._labels, prefix=prefix, separate=separate, saveFormat=saveFormat, ratio=ratio, directory=directory))
2640  return ret
2641 
2642 
def draw(name, histos, styles=_defaultStyles, legendLabels=[], kwargs)

◆ getNumberOfEventsHistogram()

def plotting.PlotFolder.getNumberOfEventsHistogram (   self)

Definition at line 2588 of file plotting.py.

References plotting.PlotFolder._numberOfEventsHistogram.

2588  def getNumberOfEventsHistogram(self):
2589  return self._numberOfEventsHistogram
2590 

◆ getPage()

def plotting.PlotFolder.getPage (   self)

Definition at line 2582 of file plotting.py.

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

2582  def getPage(self):
2583  return self._page
2584 

◆ getPlotGroup()

def plotting.PlotFolder.getPlotGroup (   self,
  name 
)

Definition at line 2600 of file plotting.py.

References plotting.PlotFolder._plotGroups.

2600  def getPlotGroup(self, name):
2601  for pg in self._plotGroups:
2602  if pg.getName() == name:
2603  return pg
2604  raise Exception("No PlotGroup named '%s'" % name)
2605 

◆ getPlotGroups()

def plotting.PlotFolder.getPlotGroups (   self)

Definition at line 2597 of file plotting.py.

References plotting.PlotFolder._plotGroups.

2597  def getPlotGroups(self):
2598  return self._plotGroups
2599 

◆ getPurpose()

def plotting.PlotFolder.getPurpose (   self)

Definition at line 2579 of file plotting.py.

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

2579  def getPurpose(self):
2580  return self._purpose
2581 

◆ getSection()

def plotting.PlotFolder.getSection (   self)

Definition at line 2585 of file plotting.py.

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

2585  def getSection(self):
2586  return self._section
2587 

◆ 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

Definition at line 2654 of file plotting.py.

2654  def iterSelectionName(self, plotFolderName, translatedDqmSubFolder):
2655  """Iterate over possible selections name (used in output directory name and legend) from the name of PlotterFolder, and a return value of translateSubFolder"""
2656  ret = ""
2657  if plotFolderName != "":
2658  ret += "_"+plotFolderName
2659  if translatedDqmSubFolder is not None:
2660  ret += "_"+translatedDqmSubFolder
2661  yield ret
2662 

◆ 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

Definition at line 2663 of file plotting.py.

2663  def limitSubFolder(self, limitOnlyTo, translatedDqmSubFolder):
2664  """Return True if this subfolder should be processed
2665 
2666  Arguments:
2667  limitOnlyTo -- List/set/similar containing the translatedDqmSubFolder
2668  translatedDqmSubFolder -- Return value of translateSubFolder
2669  """
2670  return translatedDqmSubFolder in limitOnlyTo
2671 

◆ loopSubFolders()

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

Definition at line 2562 of file plotting.py.

References plotting.PlotFolder._loopSubFolders.

2562  def loopSubFolders(self):
2563  """Return True if the PlotGroups of this folder should be applied to the all subfolders"""
2564  return self._loopSubFolders
2565 

◆ onlyForBHadron()

def plotting.PlotFolder.onlyForBHadron (   self)

Definition at line 2576 of file plotting.py.

References plotting.PlotFolder._onlyForBHadron.

2576  def onlyForBHadron(self):
2577  return self._onlyForBHadron
2578 

◆ onlyForConversion()

def plotting.PlotFolder.onlyForConversion (   self)

Definition at line 2573 of file plotting.py.

References plotting.PlotFolder._onlyForConversion.

2573  def onlyForConversion(self):
2574  return self._onlyForConversion
2575 

◆ onlyForElectron()

def plotting.PlotFolder.onlyForElectron (   self)

Definition at line 2570 of file plotting.py.

References plotting.PlotFolder._onlyForElectron.

2570  def onlyForElectron(self):
2571  return self._onlyForElectron
2572 

◆ onlyForPileup()

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

Definition at line 2566 of file plotting.py.

References plotting.PlotFolder._onlyForPileup.

2566  def onlyForPileup(self):
2567  """Return True if the folder is intended only for pileup samples"""
2568  return self._onlyForPileup
2569 

◆ set()

def plotting.PlotFolder.set (   self,
  plotGroups 
)

Definition at line 2594 of file plotting.py.

References plotting.PlotFolder._plotGroups.

2594  def set(self, plotGroups):
2595  self._plotGroups = plotGroups
2596 

◆ 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)

Definition at line 2644 of file plotting.py.

2644  def translateSubFolder(self, dqmSubFolderName):
2645  """Method called to (possibly) translate a subfolder name to more 'readable' form
2646 
2647  The implementation in this (base) class just returns the
2648  argument. The idea is that a deriving class might want to do
2649  something more complex (like trackingPlots.TrackingPlotFolder
2650  does)
2651  """
2652  return dqmSubFolderName
2653 

Member Data Documentation

◆ _labels

plotting.PlotFolder._labels
private

◆ _loopSubFolders

plotting.PlotFolder._loopSubFolders
private

Definition at line 2550 of file plotting.py.

Referenced by plotting.PlotFolder.loopSubFolders().

◆ _numberOfEventsHistogram

plotting.PlotFolder._numberOfEventsHistogram
private

Definition at line 2558 of file plotting.py.

Referenced by plotting.PlotFolder.getNumberOfEventsHistogram().

◆ _onlyForBHadron

plotting.PlotFolder._onlyForBHadron
private

Definition at line 2554 of file plotting.py.

Referenced by plotting.PlotFolder.onlyForBHadron().

◆ _onlyForConversion

plotting.PlotFolder._onlyForConversion
private

Definition at line 2553 of file plotting.py.

Referenced by plotting.PlotFolder.onlyForConversion().

◆ _onlyForElectron

plotting.PlotFolder._onlyForElectron
private

Definition at line 2552 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