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

Constructor & Destructor Documentation

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

759  def __init__(self, name, nameA, nameB, title=""):
760  """Constructor
761 
762  Arguments:
763  name -- String for name of the resulting histogram (A-B)
764  nameA -- String for A histogram
765  nameB -- String for B histogram
766 
767  Keyword arguments:
768  title -- String for a title of the resulting histogram (default "")
769 
770  Uncertainties are calculated with the assumption that B is a
771  subset of A, and the histograms contain event counts.
772  """
773  self._name = name
774  self._nameA = nameA
775  self._nameB = nameB
776  self._title = title
777 
def __init__(self, name, nameA, nameB, title="")
Definition: plotting.py:759

Member Function Documentation

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

Definition at line 782 of file plotting.py.

References plotting._getObject(), FP420HitsObject._name, TrackerHitsObject._name, PGeometricDet::Item._name, TrackingRecHitAlgorithm._name, LikelihoodSpecies._name, L1TMuon::PtAssignmentUnit._name, L1TMuon::PtRefinementUnit._name, LikelihoodPdfProduct._name, LikelihoodPdf._name, citk::IsolationConeDefinitionBase._name, Logger._name, hcaldqm::DQModule._name, DrellYanValidation._name, WValidation._name, HistoParams< T >._name, hcaldqm::flag::Flag._name, hcaldqm::quantity::Quantity._name, CutApplicatorBase._name, ElectronMVAEstimatorRun2Phys14NonTrig._name, PhotonMVAEstimatorRun2Spring15NonTrig._name, PhotonMVAEstimatorRun2Phys14NonTrig._name, ElectronMVAEstimatorRun2Spring15Trig._name, GeometricDetExtra._name, ElectronMVAEstimatorRun2Spring15NonTrig._name, HistoParams< TH2F >._name, HistoParams< TProfile2D >._name, Vispa.Views.PropertyView.Property._name, SequenceTypes.SequencePlaceholder._name, plotting.Subtract._name, plotting.Subtract._nameA, plotting.Subtract._nameB, HistoParams< T >._title, HistoParams< TH2F >._title, SiStripHitEffFromCalibTree._title, HistoParams< TProfile2D >._title, html.PageSet._title, html.HtmlReport._title, and plotting.Subtract._title.

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

Member Data Documentation

plotting.Subtract._name
private
plotting.Subtract._nameA
private

Definition at line 774 of file plotting.py.

Referenced by plotting.Subtract.create().

plotting.Subtract._nameB
private

Definition at line 775 of file plotting.py.

Referenced by plotting.Subtract.create().

plotting.Subtract._title
private