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

283  def __init__(self, name, assoc, dup, reco, title=""):
284  """Constructor.
285 
286  Arguments:
287  name -- String for the name of the resulting efficiency histogram
288  assoc -- String for the name of the "associated" histogram
289  dup -- String for the name of the "duplicates" histogram
290  reco -- String for the name of the "reco" (denominator) histogram
291 
292  Keyword arguments:
293  title -- String for a title of the resulting histogram (default "")
294 
295  The result is calculated as 1 - (assoc - dup) / reco
296  """
297  self._name = name
298  self._assoc = assoc
299  self._dup = dup
300  self._reco = reco
301  self._title = title

Member Function Documentation

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

Definition at line 302 of file plotting.py.

References FP420HitsObject._name, TrackerHitsObject._name, PGeometricDet::Item._name, LikelihoodSpecies._name, L1TMuon::PtAssignmentUnit._name, L1TMuon::PtRefinementUnit._name, LikelihoodPdfProduct._name, LikelihoodPdf._name, hcaldqm::Container._name, citk::IsolationConeDefinitionBase._name, hcaldqm::DQModule._name, Logger._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, HistoParams< TProfile2D >._name, plotting.Subtract._name, plotting.FakeDuplicate._name, Vispa.Views.PropertyView.Property._name, and SequenceTypes.SequencePlaceholder._name.

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

Definition at line 306 of file plotting.py.

References ECALClusterImporter._assoc, plotting.FakeDuplicate._assoc, plotting.FakeDuplicate._dup, plotting._getObject(), FP420HitsObject._name, TrackerHitsObject._name, PGeometricDet::Item._name, LikelihoodSpecies._name, L1TMuon::PtAssignmentUnit._name, L1TMuon::PtRefinementUnit._name, LikelihoodPdfProduct._name, LikelihoodPdf._name, hcaldqm::Container._name, citk::IsolationConeDefinitionBase._name, hcaldqm::DQModule._name, Logger._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, HistoParams< TProfile2D >._name, plotting.Subtract._name, plotting.FakeDuplicate._name, Vispa.Views.PropertyView.Property._name, SequenceTypes.SequencePlaceholder._name, plotting.FakeDuplicate._reco, HistoParams< T >._title, hcaldqm::axis::Axis._title, HistoParams< TH2F >._title, HistoParams< TProfile2D >._title, plotting.Subtract._title, plotting.FakeDuplicate._title, html.PageSet._title, and html.HtmlReport._title.

307  def create(self, tdirectory):
308  """Create and return the fake+duplicate histogram from a TDirectory"""
309  # Get the numerator/denominator histograms
310  hassoc = _getObject(tdirectory, self._assoc)
311  hdup = _getObject(tdirectory, self._dup)
312  hreco = _getObject(tdirectory, self._reco)
313 
314  # Skip if any of them does not exist
315  if not hassoc or not hdup or not hreco:
316  return None
317 
318  hfakedup = hreco.Clone(self._name)
319  hfakedup.SetTitle(self._title)
320 
321  for i in xrange(1, hassoc.GetNbinsX()+1):
322  numerVal = hassoc.GetBinContent(i) - hdup.GetBinContent(i)
323  denomVal = hreco.GetBinContent(i)
324 
325  fakedupVal = (1 - numerVal / denomVal) if denomVal != 0.0 else 0.0
326  errVal = math.sqrt(fakedupVal*(1-fakedupVal)/denomVal) if (denomVal != 0.0 and fakedupVal <= 1) else 0.0
327 
328  hfakedup.SetBinContent(i, fakedupVal)
329  hfakedup.SetBinError(i, errVal)
330 
331  return hfakedup
def _getObject
Definition: plotting.py:14

Member Data Documentation

plotting.FakeDuplicate._assoc
private

Definition at line 297 of file plotting.py.

Referenced by plotting.FakeDuplicate.create().

plotting.FakeDuplicate._dup
private

Definition at line 298 of file plotting.py.

Referenced by plotting.FakeDuplicate.create().

plotting.FakeDuplicate._name
private

Definition at line 296 of file plotting.py.

Referenced by plotting.FakeDuplicate.__str__(), plotting.AggregateBins.__str__(), plotting.AggregateHistos.__str__(), plotting.ROC.__str__(), plotting.PlotGroup._drawSeparate(), plotting.PlotGroup._save(), plotting.FakeDuplicate.create(), plotting.AggregateBins.create(), plotting.AggregateHistos.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.FakeDuplicate._reco
private

Definition at line 299 of file plotting.py.

Referenced by plotting.FakeDuplicate.create().

plotting.FakeDuplicate._title
private

Definition at line 300 of file plotting.py.

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