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

650  def __init__(self, name, histo, func, title=""):
651  """Constructor.
652 
653  Argument:
654  name -- String for name of the resulting histogram
655  histo -- String for a source histogram (needs to be cumulative)
656  func -- Function to operate on the bin content
657  """
658  self._name = name
659  self._histo = histo
660  self._func = func
661  self._title = title
662 
def __init__(self, name, histo, func, title="")
Definition: plotting.py:650

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

References plotting.Transform._func, plotting._getOrCreateObject(), plotting.Transform._histo, FP420HitsObject._name, TrackerHitsObject._name, PGeometricDet::Item._name, TrackingRecHitAlgorithm._name, LikelihoodSpecies._name, L1TMuon::PtRefinementUnit._name, L1TMuon::PtAssignmentUnit._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.Transform._name, HistoParams< T >._title, HistoParams< TH2F >._title, SiStripHitEffFromCalibTree._title, HistoParams< TProfile2D >._title, html.PageSet._title, plotting.Subtract._title, plotting.Transform._title, and html.HtmlReport._title.

667  def create(self, tdirectory):
668  """Create and return the transformed histogram from a TDirectory"""
669  histo = _getOrCreateObject(tdirectory, self._histo)
670  if not histo:
671  return None
672 
673  ret = histo.Clone(self._name)
674  ret.SetTitle(self._title)
675 
676  # Disable canExtend if it is set, otherwise setting the
677  # overflow bin will extend instead, possibly causing weird
678  # effects downstream
679  ret.SetCanExtend(False)
680 
681  for i in xrange(0, histo.GetNbinsX()+2):
682  ret.SetBinContent(i, self._func(histo.GetBinContent(i)))
683  return ret
684 
def _getOrCreateObject(tdirectory, nameOrCreator)
Definition: plotting.py:53
def create(self, tdirectory)
Definition: plotting.py:667

Member Data Documentation

plotting.Transform._func
private

Definition at line 660 of file plotting.py.

Referenced by plotting.Transform.create().

plotting.Transform._histo
private

Definition at line 659 of file plotting.py.

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

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