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

687  def __init__(self, name, assoc, dup, reco, title=""):
688  """Constructor.
689 
690  Arguments:
691  name -- String for the name of the resulting efficiency histogram
692  assoc -- String for the name of the "associated" histogram
693  dup -- String for the name of the "duplicates" histogram
694  reco -- String for the name of the "reco" (denominator) histogram
695 
696  Keyword arguments:
697  title -- String for a title of the resulting histogram (default "")
698 
699  The result is calculated as 1 - (assoc - dup) / reco
700  """
701  self._name = name
702  self._assoc = assoc
703  self._dup = dup
704  self._reco = reco
705  self._title = title
706 
def __init__(self, name, assoc, dup, reco, title="")
Definition: plotting.py:687

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

References SpecialClusterImporter< T >._assoc, plotting.FakeDuplicate._assoc, plotting.FakeDuplicate._dup, plotting._getObject(), 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, plotting.Transform._name, plotting.FakeDuplicate._name, plotting.FakeDuplicate._reco, HistoParams< T >._title, SiStripHitEffFromCalibTree._title, HistoParams< TH2F >._title, HistoParams< TProfile2D >._title, html.PageSet._title, plotting.Subtract._title, plotting.Transform._title, html.HtmlReport._title, and plotting.FakeDuplicate._title.

711  def create(self, tdirectory):
712  """Create and return the fake+duplicate histogram from a TDirectory"""
713  # Get the numerator/denominator histograms
714  hassoc = _getObject(tdirectory, self._assoc)
715  hdup = _getObject(tdirectory, self._dup)
716  hreco = _getObject(tdirectory, self._reco)
717 
718  # Skip if any of them does not exist
719  if not hassoc or not hdup or not hreco:
720  return None
721 
722  hfakedup = hreco.Clone(self._name)
723  hfakedup.SetTitle(self._title)
724 
725  for i in xrange(1, hassoc.GetNbinsX()+1):
726  numerVal = hassoc.GetBinContent(i) - hdup.GetBinContent(i)
727  denomVal = hreco.GetBinContent(i)
728 
729  fakedupVal = (1 - numerVal / denomVal) if denomVal != 0.0 else 0.0
730  errVal = math.sqrt(fakedupVal*(1-fakedupVal)/denomVal) if (denomVal != 0.0 and fakedupVal <= 1) else 0.0
731 
732  hfakedup.SetBinContent(i, fakedupVal)
733  hfakedup.SetBinError(i, errVal)
734 
735  return hfakedup
736 
def create(self, tdirectory)
Definition: plotting.py:711
def _getObject(tdirectory, name)
Definition: plotting.py:45

Member Data Documentation

plotting.FakeDuplicate._assoc
private

Definition at line 702 of file plotting.py.

Referenced by plotting.FakeDuplicate.create().

plotting.FakeDuplicate._dup
private

Definition at line 703 of file plotting.py.

Referenced by plotting.FakeDuplicate.create().

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

Definition at line 704 of file plotting.py.

Referenced by plotting.FakeDuplicate.create().

plotting.FakeDuplicate._title
private