CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
plotting.Subtract Class Reference

Public Member Functions

def __init__ (self, name, nameA, nameB, title="")
 
def __str__ (self)
 
def create (self, tdirectory)
 

Private Attributes

 _name
 
 _nameA
 
 _nameB
 
 _title
 

Detailed Description

Class for subtracting two histograms

Definition at line 761 of file plotting.py.

Constructor & Destructor Documentation

◆ __init__()

def plotting.Subtract.__init__ (   self,
  name,
  nameA,
  nameB,
  title = "" 
)
Constructor

Arguments:
name  -- String for name of the resulting histogram (A-B)
nameA -- String for A histogram
nameB -- String for B histogram

Keyword arguments:
title -- String for a title of the resulting histogram (default "")

Uncertainties are calculated with the assumption that B is a
subset of A, and the histograms contain event counts.

Definition at line 763 of file plotting.py.

763  def __init__(self, name, nameA, nameB, title=""):
764  """Constructor
765 
766  Arguments:
767  name -- String for name of the resulting histogram (A-B)
768  nameA -- String for A histogram
769  nameB -- String for B histogram
770 
771  Keyword arguments:
772  title -- String for a title of the resulting histogram (default "")
773 
774  Uncertainties are calculated with the assumption that B is a
775  subset of A, and the histograms contain event counts.
776  """
777  self._name = name
778  self._nameA = nameA
779  self._nameB = nameB
780  self._title = title
781 
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

◆ __str__()

def plotting.Subtract.__str__ (   self)

◆ create()

def plotting.Subtract.create (   self,
  tdirectory 
)
Create and return the fake+duplicate histogram from a TDirectory

Definition at line 786 of file plotting.py.

References plotting._getObject(), 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, SequenceTypes._TaskBasePlaceholder._name, plotting.Subtract._nameA, plotting.Subtract._nameB, HistoParams< T >._title, HistoParams< TH2F >._title, HistoParams< TProfile2D >._title, html.PageSet._title, plotting.Subtract._title, html.HtmlReport._title, and FastTimerService_cff.range.

786  def create(self, tdirectory):
787  """Create and return the fake+duplicate histogram from a TDirectory"""
788  histoA = _getObject(tdirectory, self._nameA)
789  histoB = _getObject(tdirectory, self._nameB)
790 
791  if not histoA or not histoB:
792  return None
793 
794  ret = histoA.Clone(self._name)
795  ret.SetTitle(self._title)
796 
797  # Disable canExtend if it is set, otherwise setting the
798  # overflow bin will extend instead, possibly causing weird
799  # effects downstream
800  ret.SetCanExtend(False)
801 
802  for i in range(0, histoA.GetNbinsX()+2): # include under- and overflow too
803  val = histoA.GetBinContent(i)-histoB.GetBinContent(i)
804  ret.SetBinContent(i, val)
805  ret.SetBinError(i, math.sqrt(val))
806 
807  return ret
808 
def create(alignables, pedeDump, additionalData, outputFile, config)
def _getObject(tdirectory, name)
Definition: plotting.py:49

Member Data Documentation

◆ _name

plotting.Subtract._name
private

◆ _nameA

plotting.Subtract._nameA
private

Definition at line 778 of file plotting.py.

Referenced by plotting.Subtract.create().

◆ _nameB

plotting.Subtract._nameB
private

Definition at line 779 of file plotting.py.

Referenced by plotting.Subtract.create().

◆ _title

plotting.Subtract._title
private