CMS 3D CMS Logo

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

Public Member Functions

def __init__ (self, name, histo, func, title="")
 
def __str__ (self)
 
def create (self, tdirectory)
 

Private Attributes

 _func
 
 _histo
 
 _name
 
 _title
 

Detailed Description

Class to transform bin contents in an arbitrary way.

Definition at line 808 of file plotting.py.

Constructor & Destructor Documentation

def plotting.Transform.__init__ (   self,
  name,
  histo,
  func,
  title = "" 
)
Constructor.

Argument:
name  -- String for name of the resulting histogram
histo -- String for a source histogram (needs to be cumulative)
func  -- Function to operate on the bin content

Definition at line 810 of file plotting.py.

810  def __init__(self, name, histo, func, title=""):
811  """Constructor.
812 
813  Argument:
814  name -- String for name of the resulting histogram
815  histo -- String for a source histogram (needs to be cumulative)
816  func -- Function to operate on the bin content
817  """
818  self._name = name
819  self._histo = histo
820  self._func = func
821  self._title = title
822 
def __init__(self, name, histo, func, title="")
Definition: plotting.py:810

Member Function Documentation

def plotting.Transform.__str__ (   self)
def plotting.Transform.create (   self,
  tdirectory 
)
Create and return the transformed histogram from a TDirectory

Definition at line 827 of file plotting.py.

References plotting.Transform._func, plotting._getOrCreateObject(), plotting.Transform._histo, TrackerHitsObject._name, FP420HitsObject._name, PGeometricDet::Item._name, LikelihoodSpecies._name, TrackingRecHitAlgorithm._name, LikelihoodPdfProduct._name, Logger._name, hcaldqm::DQModule._name, LikelihoodPdf._name, citk::IsolationConeDefinitionBase._name, DrellYanValidation._name, WValidation._name, hcaldqm::flag::Flag._name, hcaldqm::quantity::Quantity._name, HistoParams< T >._name, GeometricTimingDetExtra._name, CutApplicatorBase._name, GeometricDetExtra._name, HistoParams< TH2F >._name, HistoParams< TProfile2D >._name, Vispa.Views.PropertyView.Property._name, SequenceTypes.SequencePlaceholder._name, plotting.Subtract._name, plotting.Transform._name, SequenceTypes.TaskPlaceholder._name, HistoParams< T >._title, HistoParams< TH2F >._title, SiStripHitEffFromCalibTree._title, HistoParams< TProfile2D >._title, html.PageSet._title, html.HtmlReport._title, plotting.Subtract._title, and plotting.Transform._title.

827  def create(self, tdirectory):
828  """Create and return the transformed histogram from a TDirectory"""
829  histo = _getOrCreateObject(tdirectory, self._histo)
830  if not histo:
831  return None
832 
833  ret = histo.Clone(self._name)
834  ret.SetTitle(self._title)
835 
836  # Disable canExtend if it is set, otherwise setting the
837  # overflow bin will extend instead, possibly causing weird
838  # effects downstream
839  ret.SetCanExtend(False)
840 
841  for i in range(0, histo.GetNbinsX()+2):
842  ret.SetBinContent(i, self._func(histo.GetBinContent(i)))
843  return ret
844 
def _getOrCreateObject(tdirectory, nameOrCreator)
Definition: plotting.py:58
def create(self, tdirectory)
Definition: plotting.py:827

Member Data Documentation

plotting.Transform._func
private

Definition at line 820 of file plotting.py.

Referenced by plotting.Transform.create().

plotting.Transform._histo
private

Definition at line 819 of file plotting.py.

Referenced by plotting.Transform.create(), and plotting.CutEfficiency.create().

plotting.Transform._name
private
plotting.Transform._title
private