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

Public Member Functions

def __init__
 
def __str__
 
def create
 

Private Attributes

 _assoc
 
 _dup
 
 _name
 
 _reco
 
 _title
 

Detailed Description

Class to calculate the fake+duplicate rate

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

95 
96  def __init__(self, name, assoc, dup, reco, title=""):
97  """Constructor.
98 
99  Arguments:
100  name -- String for the name of the resulting efficiency histogram
101  assoc -- String for the name of the "associated" histogram
102  dup -- String for the name of the "duplicates" histogram
103  reco -- String for the name of the "reco" (denominator) histogram
104 
105  Keyword arguments:
106  title -- String for a title of the resulting histogram (default "")
107 
108  The result is calculated as 1 - (assoc - dup) / reco
109  """
110  self._name = name
111  self._assoc = assoc
112  self._dup = dup
113  self._reco = reco
114  self._title = title

Member Function Documentation

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

Definition at line 115 of file plotting.py.

References FP420HitsObject._name, TrackerHitsObject._name, PGeometricDet::Item._name, LikelihoodSpecies._name, LikelihoodPdfProduct._name, LikelihoodPdf._name, citk::IsolationConeDefinitionBase._name, DrellYanValidation._name, WValidation._name, HistoParams< T >._name, CutApplicatorBase._name, ElectronMVAEstimatorRun2Phys14NonTrig._name, PhotonMVAEstimatorRun2Spring15NonTrig._name, PhotonMVAEstimatorRun2Phys14NonTrig._name, plotting.FakeDuplicate._name, GeometricDetExtra._name, ElectronMVAEstimatorRun2Spring15NonTrig._name, HistoParams< TH2F >._name, HistoParams< TProfile2D >._name, Vispa.Views.PropertyView.Property._name, and SequenceTypes.SequencePlaceholder._name.

116  def __str__(self):
117  """String representation, returns the name"""
118  return self._name
def plotting.FakeDuplicate.create (   self,
  tdirectory 
)
Create and return the efficiency histogram from a TDirectory

Definition at line 119 of file plotting.py.

References ECALClusterImporter._assoc, plotting.FakeDuplicate._assoc, plotting.FakeDuplicate._dup, plotting._getObject(), FP420HitsObject._name, TrackerHitsObject._name, PGeometricDet::Item._name, LikelihoodSpecies._name, LikelihoodPdfProduct._name, LikelihoodPdf._name, citk::IsolationConeDefinitionBase._name, DrellYanValidation._name, WValidation._name, HistoParams< T >._name, CutApplicatorBase._name, ElectronMVAEstimatorRun2Phys14NonTrig._name, PhotonMVAEstimatorRun2Spring15NonTrig._name, PhotonMVAEstimatorRun2Phys14NonTrig._name, plotting.FakeDuplicate._name, GeometricDetExtra._name, ElectronMVAEstimatorRun2Spring15NonTrig._name, HistoParams< TH2F >._name, HistoParams< TProfile2D >._name, Vispa.Views.PropertyView.Property._name, SequenceTypes.SequencePlaceholder._name, plotting.FakeDuplicate._reco, HistoParams< T >._title, plotting.FakeDuplicate._title, HistoParams< TH2F >._title, and HistoParams< TProfile2D >._title.

120  def create(self, tdirectory):
121  """Create and return the efficiency histogram from a TDirectory"""
122  # Get the numerator/denominator histograms
123  hassoc = _getObject(tdirectory, self._assoc)
124  hdup = _getObject(tdirectory, self._dup)
125  hreco = _getObject(tdirectory, self._reco)
126 
127  # Skip if any of them does not exist
128  if not hassoc or not hdup or not hreco:
129  return None
130 
131  hfakedup = hreco.Clone(self._name)
132  hfakedup.SetTitle(self._title)
133 
134  for i in xrange(1, hassoc.GetNbinsX()+1):
135  numerVal = hassoc.GetBinContent(i) - hdup.GetBinContent(i)
136  denomVal = hreco.GetBinContent(i)
137 
138  fakedupVal = (1 - numerVal / denomVal) if denomVal != 0.0 else 0.0
139  errVal = math.sqrt(fakedupVal*(1-fakedupVal)/denomVal) if (denomVal != 0.0 and fakedupVal <= 1) else 0.0
140 
141  hfakedup.SetBinContent(i, fakedupVal)
142  hfakedup.SetBinError(i, errVal)
143 
144  return hfakedup
def _getObject
Definition: plotting.py:32

Member Data Documentation

plotting.FakeDuplicate._assoc
private

Definition at line 110 of file plotting.py.

Referenced by plotting.FakeDuplicate.create().

plotting.FakeDuplicate._dup
private

Definition at line 111 of file plotting.py.

Referenced by plotting.FakeDuplicate.create().

plotting.FakeDuplicate._name
private

Definition at line 109 of file plotting.py.

Referenced by plotting.FakeDuplicate.__str__(), plotting.AggregateBins.__str__(), plotting.AggregateHistos.__str__(), plotting.Plot._createOne(), plotting.PlotGroup._save(), plotting.FakeDuplicate.create(), plotting.AggregateBins.create(), plotting.AggregateHistos.create(), plotting.Plot.draw(), and plotting.Plot.getName().

plotting.FakeDuplicate._reco
private

Definition at line 112 of file plotting.py.

Referenced by plotting.FakeDuplicate.create().

plotting.FakeDuplicate._title
private

Definition at line 113 of file plotting.py.

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