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.CutEfficiency Class Reference

Public Member Functions

def __init__
 
def __str__
 
def create
 

Private Attributes

 _histo
 
 _name
 
 _title
 

Detailed Description

Class for making a cut efficiency histograms.

      N after cut
eff = -----------
        N total

Definition at line 729 of file plotting.py.

Constructor & Destructor Documentation

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

Arguments:
name  -- String for name of the resulting histogram
histo -- String for a source histogram (needs to be cumulative)

Definition at line 736 of file plotting.py.

737  def __init__(self, name, histo, title=""):
738  """Constructor
739 
740  Arguments:
741  name -- String for name of the resulting histogram
742  histo -- String for a source histogram (needs to be cumulative)
743  """
744  self._name = name
745  self._histo = histo
746  self._title = title

Member Function Documentation

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

Definition at line 747 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, 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, plotting.FakeDuplicate._name, and plotting.CutEfficiency._name.

748  def __str__(self):
749  """String representation, returns the name"""
750  return self._name
def plotting.CutEfficiency.create (   self,
  tdirectory 
)
Create and return the cut efficiency histogram from a TDirectory

Definition at line 751 of file plotting.py.

References plotting._getOrCreateObject(), plotting.Transform._histo, plotting.CutEfficiency._histo, 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.Transform._name, plotting.FakeDuplicate._name, plotting.CutEfficiency._name, HistoParams< T >._title, SiStripHitEffFromCalibTree._title, HistoParams< TH2F >._title, HistoParams< TProfile2D >._title, html.PageSet._title, plotting.Subtract._title, plotting.Transform._title, html.HtmlReport._title, plotting.FakeDuplicate._title, and plotting.CutEfficiency._title.

752  def create(self, tdirectory):
753  """Create and return the cut efficiency histogram from a TDirectory"""
754  histo = _getOrCreateObject(tdirectory, self._histo)
755  if not histo:
756  return None
757 
758  # infer cumulative direction from the under/overflow bins
759  ascending = histo.GetBinContent(0) < histo.GetBinContent(histo.GetNbinsX())
760  if ascending:
761  n_tot = histo.GetBinContent(histo.GetNbinsX())
762  else:
763  n_tot = histo.GetBinContent(0)
764 
765  if n_tot == 0:
766  return histo
767 
768  ret = histo.Clone(self._name)
769  ret.SetTitle(self._title)
770 
771  # calculate efficiency
772  for i in xrange(1, histo.GetNbinsX()+1):
773  n = histo.GetBinContent(i)
774  val = n/n_tot
775  errVal = math.sqrt(val*(1-val)/n_tot)
776  ret.SetBinContent(i, val)
777  ret.SetBinError(i, errVal)
778  return ret
def _getOrCreateObject
Definition: plotting.py:53

Member Data Documentation

plotting.CutEfficiency._histo
private

Definition at line 744 of file plotting.py.

Referenced by plotting.CutEfficiency.create().

plotting.CutEfficiency._name
private

Definition at line 743 of file plotting.py.

Referenced by plotting.CutEfficiency.__str__(), plotting.AggregateBins.__str__(), plotting.AggregateHistos.__str__(), plotting.ROC.__str__(), trackingPlots.TimePerTrackPlot.__str__(), plotting.PlotGroup._drawSeparate(), plotting.PlotGroup._save(), 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.CutEfficiency._title
private

Definition at line 745 of file plotting.py.

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