CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Public Attributes
histograms.Histograms Class Reference
Inheritance diagram for histograms.Histograms:

Public Member Functions

def __init__
 
def FormatHistos
 
def Write
 

Public Attributes

 dir
 
 hists
 
 name
 
 named
 

Detailed Description

Base class to handle writing and formatting of a set of histograms. 

Subclass it, and simply add your histograms to the subclass.
No need to put them in a list, they will be kept track of automatically
by this base class. 
Then, fill them. Finally, you can call FormatHistos and Write.

Definition at line 4 of file histograms.py.

Constructor & Destructor Documentation

def histograms.Histograms.__init__ (   self,
  name 
)

Definition at line 11 of file histograms.py.

11 
12  def __init__(self, name):
13  self.name = name
14  self.hists = []
15  self.named = []
16  # attributes inheriting from TH1 and TNamed
17  # are kept track of automagically, even if they are in
18  # child classes
19  # setting StatOverflows True for all histograms
20  for var in vars( self ).values():
21  try:
22  if var.InheritsFrom('TNamed'):
23  self.named.append(var)
24  if var.InheritsFrom('TH1'):
25  var.StatOverflows(True)
26  self.hists.append(var)
27  except:
28  pass
29  # print 'TH1 list:', self.hists
30  # print 'TNamed list:', self.named

Member Function Documentation

def histograms.Histograms.FormatHistos (   self,
  style 
)
Apply a style to all histograms.

Definition at line 31 of file histograms.py.

References histograms.Histograms.hists.

31 
32  def FormatHistos(self, style ):
33  '''Apply a style to all histograms.'''
34  for hist in self.hists:
35  style.FormatHisto( hist )
def histograms.Histograms.Write (   self,
  dir 
)
Writes all histograms to a subdirectory of dir called self.name.

Definition at line 36 of file histograms.py.

36 
37  def Write(self, dir ):
38  '''Writes all histograms to a subdirectory of dir called self.name.'''
39  self.dir = dir.mkdir( self.name )
40  self.dir.cd()
41  for hist in self.hists:
42  hist.Write()
43  dir.cd()
44 
45 

Member Data Documentation

histograms.Histograms.dir

Definition at line 38 of file histograms.py.

Referenced by Inspector.Inspector.GetListObjects().

histograms.Histograms.hists

Definition at line 13 of file histograms.py.

Referenced by histograms.Histograms.FormatHistos().

histograms.Histograms.name

Definition at line 12 of file histograms.py.

Referenced by VIDSelectorBase.VIDSelectorBase.initialize().

histograms.Histograms.named

Definition at line 14 of file histograms.py.