CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
plotting.Transform Class Reference

Public Member Functions

def __init__
 
def __str__
 
def create
 

Private Attributes

 _func
 
 _histo
 
 _name
 
 _title
 

Detailed Description

Class to transform bin contents in an arbitrary way.

Definition at line 640 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 642 of file plotting.py.

643  def __init__(self, name, histo, func, title=""):
644  """Constructor.
645 
646  Argument:
647  name -- String for name of the resulting histogram
648  histo -- String for a source histogram (needs to be cumulative)
649  func -- Function to operate on the bin content
650  """
651  self._name = name
652  self._histo = histo
653  self._func = func
654  self._title = title

Member Function Documentation

def plotting.Transform.__str__ (   self)
String representation, returns the name

Definition at line 655 of file plotting.py.

References 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, GeometricDetExtra._name, ElectronMVAEstimatorRun2Spring15Trig._name, ElectronMVAEstimatorRun2Spring15NonTrig._name, HistoParams< TH2F >._name, HistoParams< TProfile2D >._name, Vispa.Views.PropertyView.Property._name, SequenceTypes.SequencePlaceholder._name, plotting.Subtract._name, and plotting.Transform._name.

656  def __str__(self):
657  """String representation, returns the name"""
658  return self._name
def plotting.Transform.create (   self,
  tdirectory 
)
Create and return the transformed histogram from a TDirectory

Definition at line 659 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.

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

Member Data Documentation

plotting.Transform._func
private

Definition at line 652 of file plotting.py.

Referenced by plotting.Transform.create().

plotting.Transform._histo
private

Definition at line 651 of file plotting.py.

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

plotting.Transform._name
private

Definition at line 650 of file plotting.py.

Referenced by plotting.Transform.__str__(), plotting.FakeDuplicate.__str__(), plotting.CutEfficiency.__str__(), plotting.AggregateBins.__str__(), plotting.AggregateHistos.__str__(), plotting.ROC.__str__(), trackingPlots.TimePerTrackPlot.__str__(), plotting.PlotGroup._drawSeparate(), plotting.PlotGroup._save(), plotting.Transform.create(), plotting.FakeDuplicate.create(), plotting.CutEfficiency.create(), plotting.AggregateBins.create(), plotting.AggregateHistos.create(), trackingPlots.TimePerTrackPlot.create(), plotting.Plot.create(), plotting.PlotGroup.draw(), plotting.Plot.getName(), plotting.PlotGroup.getName(), plotting.PlotterFolder.getName(), plotting.PlotterItem.getName(), plotting.PlotterFolder.getSelectionNameIterator(), validation.SimpleSample.name(), trackingPlots.Iteration.name(), plotting.PlotterItem.readDirs(), and plotting.PlotGroup.remove().

plotting.Transform._title
private

Definition at line 653 of file plotting.py.

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