CMS 3D CMS Logo

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

Public Member Functions

def __init__ (self, name, assoc, dup, reco, title="")
 
def __str__ (self)
 
def create (self, tdirectory)
 

Private Attributes

 _assoc
 
 _dup
 
 _name
 
 _reco
 
 _title
 

Detailed Description

Class to calculate the fake+duplicate rate

Definition at line 843 of file plotting.py.

Constructor & Destructor Documentation

def plotting.FakeDuplicate.__init__ (   self,
  name,
  assoc,
  dup,
  reco,
  title = "" 
)
Constructor.

Arguments:
name  -- String for the name of the resulting efficiency histogram
assoc -- String for the name of the "associated" histogram
dup   -- String for the name of the "duplicates" histogram
reco  -- String for the name of the "reco" (denominator) histogram

Keyword arguments:
title  -- String for a title of the resulting histogram (default "")

The result is calculated as 1 - (assoc - dup) / reco

Definition at line 845 of file plotting.py.

845  def __init__(self, name, assoc, dup, reco, title=""):
846  """Constructor.
847 
848  Arguments:
849  name -- String for the name of the resulting efficiency histogram
850  assoc -- String for the name of the "associated" histogram
851  dup -- String for the name of the "duplicates" histogram
852  reco -- String for the name of the "reco" (denominator) histogram
853 
854  Keyword arguments:
855  title -- String for a title of the resulting histogram (default "")
856 
857  The result is calculated as 1 - (assoc - dup) / reco
858  """
859  self._name = name
860  self._assoc = assoc
861  self._dup = dup
862  self._reco = reco
863  self._title = title
864 
def __init__(self, name, assoc, dup, reco, title="")
Definition: plotting.py:845

Member Function Documentation

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

Definition at line 869 of file plotting.py.

References SpecialClusterImporter< T >._assoc, plotting.FakeDuplicate._assoc, plotting.FakeDuplicate._dup, plotting._getObject(), FP420HitsObject._name, TrackerHitsObject._name, PGeometricDet::Item._name, LikelihoodSpecies._name, TrackingRecHitAlgorithm._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, GeometricTimingDetExtra._name, CutApplicatorBase._name, DetGeomDesc._name, GeometricDetExtra._name, HistoParams< TH2F >._name, HistoParams< TProfile2D >._name, Vispa.Views.PropertyView.Property._name, SequenceTypes.SequencePlaceholder._name, plotting.Subtract._name, plotting.Transform._name, plotting.FakeDuplicate._name, SequenceTypes.TaskPlaceholder._name, plotting.FakeDuplicate._reco, HistoParams< T >._title, HistoParams< TH2F >._title, SiStripHitEffFromCalibTree._title, HistoParams< TProfile2D >._title, html.PageSet._title, html.HtmlReport._title, plotting.Subtract._title, plotting.Transform._title, and plotting.FakeDuplicate._title.

869  def create(self, tdirectory):
870  """Create and return the fake+duplicate histogram from a TDirectory"""
871  # Get the numerator/denominator histograms
872  hassoc = _getObject(tdirectory, self._assoc)
873  hdup = _getObject(tdirectory, self._dup)
874  hreco = _getObject(tdirectory, self._reco)
875 
876  # Skip if any of them does not exist
877  if not hassoc or not hdup or not hreco:
878  return None
879 
880  hfakedup = hreco.Clone(self._name)
881  hfakedup.SetTitle(self._title)
882 
883  for i in xrange(1, hassoc.GetNbinsX()+1):
884  numerVal = hassoc.GetBinContent(i) - hdup.GetBinContent(i)
885  denomVal = hreco.GetBinContent(i)
886 
887  fakedupVal = (1 - numerVal / denomVal) if denomVal != 0.0 else 0.0
888  errVal = math.sqrt(fakedupVal*(1-fakedupVal)/denomVal) if (denomVal != 0.0 and fakedupVal <= 1) else 0.0
889 
890  hfakedup.SetBinContent(i, fakedupVal)
891  hfakedup.SetBinError(i, errVal)
892 
893  return hfakedup
894 
def create(self, tdirectory)
Definition: plotting.py:869
def _getObject(tdirectory, name)
Definition: plotting.py:48

Member Data Documentation

plotting.FakeDuplicate._assoc
private

Definition at line 860 of file plotting.py.

Referenced by plotting.FakeDuplicate.create().

plotting.FakeDuplicate._dup
private

Definition at line 861 of file plotting.py.

Referenced by plotting.FakeDuplicate.create().

plotting.FakeDuplicate._name
private
plotting.FakeDuplicate._reco
private

Definition at line 862 of file plotting.py.

Referenced by plotting.FakeDuplicate.create().

plotting.FakeDuplicate._title
private