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

Public Member Functions

def __init__
 
def __str__
 
def create
 

Private Attributes

 _mapping
 
 _name
 
 _normalizeTo
 

Detailed Description

Definition at line 193 of file plotting.py.

Constructor & Destructor Documentation

def plotting.AggregateHistos.__init__ (   self,
  name,
  mapping,
  normalizeTo = None 
)

Definition at line 194 of file plotting.py.

195  def __init__(self, name, mapping, normalizeTo=None):
196  self._name = name
197  self._mapping = mapping
198  self._normalizeTo = normalizeTo

Member Function Documentation

def plotting.AggregateHistos.__str__ (   self)

Definition at line 199 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, plotting.FakeDuplicate._name, GeometricDetExtra._name, HistoParams< TH2F >._name, plotting.AggregateBins._name, plotting.AggregateHistos._name, HistoParams< TProfile2D >._name, Vispa.Views.PropertyView.Property._name, and SequenceTypes.SequencePlaceholder._name.

200  def __str__(self):
201  return self._name
def plotting.AggregateHistos.create (   self,
  tdirectory 
)

Definition at line 202 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, plotting.FakeDuplicate._name, GeometricDetExtra._name, HistoParams< TH2F >._name, plotting.AggregateBins._name, plotting.AggregateHistos._name, HistoParams< TProfile2D >._name, Vispa.Views.PropertyView.Property._name, SequenceTypes.SequencePlaceholder._name, plotting.AggregateBins._normalizeTo, and plotting.AggregateHistos._normalizeTo.

203  def create(self, tdirectory):
204  result = []
205  for key, histoName in self._mapping.iteritems():
206  th1 = _getObject(tdirectory, histoName)
207  if th1 is None:
208  continue
209  result.append( (key, th1.Integral(0, th1.GetNbinsX()+1)) ) # include under- and overflow bins
210  if len(result) == 0:
211  return None
212 
213  res = ROOT.TH1F(self._name, self._name, len(result), 0, len(result))
214 
215  for i, (name, count) in enumerate(result):
216  res.SetBinContent(i+1, count)
217  res.GetXaxis().SetBinLabel(i+1, name)
218 
219  if self._normalizeTo is not None:
220  th1 = _getObject(tdirectory, self._normalizeTo)
221  if th1 is None:
222  return None
223  scale = th1.Integral(0, th1.GetNbinsX()+1)
224  res.Scale(1/scale)
225 
226  return res
227 
# Plot styles
def _getObject
Definition: plotting.py:32

Member Data Documentation

plotting.AggregateHistos._mapping
private

Definition at line 196 of file plotting.py.

plotting.AggregateHistos._name
private

Definition at line 195 of file plotting.py.

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

plotting.AggregateHistos._normalizeTo
private

Definition at line 197 of file plotting.py.

Referenced by plotting.AggregateHistos.create().