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

Public Member Functions

def __init__
 
def __str__
 
def create
 

Private Attributes

 _name
 
 _nameA
 
 _nameB
 
 _title
 

Detailed Description

Class for subtracting two histograms

Definition at line 146 of file plotting.py.

Constructor & Destructor Documentation

def plotting.Subtract.__init__ (   self,
  name,
  nameA,
  nameB,
  title = "" 
)
Constructor

Arguments:
name  -- String for name of the resulting histogram (A-B)
nameA -- String for A histogram
nameB -- String for B histogram

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

Uncertainties are calculated with the assumption that B is a
subset of A, and the histograms contain event counts.

Definition at line 148 of file plotting.py.

149  def __init__(self, name, nameA, nameB, title=""):
150  """Constructor
151 
152  Arguments:
153  name -- String for name of the resulting histogram (A-B)
154  nameA -- String for A histogram
155  nameB -- String for B histogram
156 
157  Keyword arguments:
158  title -- String for a title of the resulting histogram (default "")
159 
160  Uncertainties are calculated with the assumption that B is a
161  subset of A, and the histograms contain event counts.
162  """
163  self._name = name
164  self._nameA = nameA
165  self._nameB = nameB
166  self._title = title

Member Function Documentation

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

Definition at line 167 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, Vispa.Views.PropertyView.Property._name, and SequenceTypes.SequencePlaceholder._name.

168  def __str__(self):
169  """String representation, returns the name"""
170  return self._name
def plotting.Subtract.create (   self,
  tdirectory 
)
Create and return the fake+duplicate histogram from a TDirectory

Definition at line 171 of file plotting.py.

References 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, Vispa.Views.PropertyView.Property._name, SequenceTypes.SequencePlaceholder._name, plotting.Subtract._nameA, plotting.Subtract._nameB, HistoParams< T >._title, HistoParams< TH2F >._title, plotting.Subtract._title, HistoParams< TProfile2D >._title, html.PageSet._title, and html.HtmlReport._title.

172  def create(self, tdirectory):
173  """Create and return the fake+duplicate histogram from a TDirectory"""
174  histoA = _getObject(tdirectory, self._nameA)
175  histoB = _getObject(tdirectory, self._nameB)
176 
177  if not histoA or not histoB:
178  return None
179 
180  ret = histoA.Clone(self._name)
181  ret.SetTitle(self._title)
182 
183  for i in xrange(1, histoA.GetNbinsX()+1):
184  val = histoA.GetBinContent(i)-histoB.GetBinContent(i)
185  ret.SetBinContent(i, val)
186  ret.SetBinError(i, math.sqrt(val))
187 
188  return ret
def _getObject
Definition: plotting.py:9

Member Data Documentation

plotting.Subtract._name
private

Definition at line 162 of file plotting.py.

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

Definition at line 163 of file plotting.py.

Referenced by plotting.Subtract.create().

plotting.Subtract._nameB
private

Definition at line 164 of file plotting.py.

Referenced by plotting.Subtract.create().

plotting.Subtract._title
private

Definition at line 165 of file plotting.py.

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