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

192  def __init__(self, name, assoc, dup, reco, title=""):
193  """Constructor.
194 
195  Arguments:
196  name -- String for the name of the resulting efficiency histogram
197  assoc -- String for the name of the "associated" histogram
198  dup -- String for the name of the "duplicates" histogram
199  reco -- String for the name of the "reco" (denominator) histogram
200 
201  Keyword arguments:
202  title -- String for a title of the resulting histogram (default "")
203 
204  The result is calculated as 1 - (assoc - dup) / reco
205  """
206  self._name = name
207  self._assoc = assoc
208  self._dup = dup
209  self._reco = reco
210  self._title = title

Member Function Documentation

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

Definition at line 211 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, GeometricDetExtra._name, ElectronMVAEstimatorRun2Spring15Trig._name, ElectronMVAEstimatorRun2Spring15NonTrig._name, HistoParams< TH2F >._name, plotting.Subtract._name, HistoParams< TProfile2D >._name, plotting.FakeDuplicate._name, Vispa.Views.PropertyView.Property._name, and SequenceTypes.SequencePlaceholder._name.

212  def __str__(self):
213  """String representation, returns the name"""
214  return self._name
def plotting.FakeDuplicate.create (   self,
  tdirectory 
)
Create and return the fake+duplicate histogram from a TDirectory

Definition at line 215 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, ElectronMVAEstimatorRun2Spring15Trig._name, GeometricDetExtra._name, ElectronMVAEstimatorRun2Spring15NonTrig._name, HistoParams< TH2F >._name, plotting.Subtract._name, HistoParams< TProfile2D >._name, plotting.FakeDuplicate._name, Vispa.Views.PropertyView.Property._name, SequenceTypes.SequencePlaceholder._name, plotting.FakeDuplicate._reco, HistoParams< T >._title, HistoParams< TH2F >._title, plotting.Subtract._title, HistoParams< TProfile2D >._title, plotting.FakeDuplicate._title, html.PageSet._title, and html.HtmlReport._title.

216  def create(self, tdirectory):
217  """Create and return the fake+duplicate histogram from a TDirectory"""
218  # Get the numerator/denominator histograms
219  hassoc = _getObject(tdirectory, self._assoc)
220  hdup = _getObject(tdirectory, self._dup)
221  hreco = _getObject(tdirectory, self._reco)
222 
223  # Skip if any of them does not exist
224  if not hassoc or not hdup or not hreco:
225  return None
226 
227  hfakedup = hreco.Clone(self._name)
228  hfakedup.SetTitle(self._title)
229 
230  for i in xrange(1, hassoc.GetNbinsX()+1):
231  numerVal = hassoc.GetBinContent(i) - hdup.GetBinContent(i)
232  denomVal = hreco.GetBinContent(i)
233 
234  fakedupVal = (1 - numerVal / denomVal) if denomVal != 0.0 else 0.0
235  errVal = math.sqrt(fakedupVal*(1-fakedupVal)/denomVal) if (denomVal != 0.0 and fakedupVal <= 1) else 0.0
236 
237  hfakedup.SetBinContent(i, fakedupVal)
238  hfakedup.SetBinError(i, errVal)
239 
240  return hfakedup
def _getObject
Definition: plotting.py:9

Member Data Documentation

plotting.FakeDuplicate._assoc
private

Definition at line 206 of file plotting.py.

Referenced by plotting.FakeDuplicate.create().

plotting.FakeDuplicate._dup
private

Definition at line 207 of file plotting.py.

Referenced by plotting.FakeDuplicate.create().

plotting.FakeDuplicate._name
private

Definition at line 205 of file plotting.py.

Referenced by plotting.FakeDuplicate.__str__(), plotting.AggregateBins.__str__(), plotting.AggregateHistos.__str__(), plotting.ROC.__str__(), plotting.Plot._createOne(), plotting.PlotGroup._drawSeparate(), plotting.PlotGroup._save(), plotting.FakeDuplicate.create(), plotting.AggregateBins.create(), plotting.AggregateHistos.create(), plotting.PlotGroup.draw(), plotting.Plot.getName(), plotting.PlotterFolder.getName(), plotting.PlotterFolder.getSelectionNameIterator(), validation.SimpleSample.name(), and plotting.PlotterItem.readDirs().

plotting.FakeDuplicate._reco
private

Definition at line 208 of file plotting.py.

Referenced by plotting.FakeDuplicate.create().

plotting.FakeDuplicate._title
private

Definition at line 209 of file plotting.py.

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