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 python.rootplot.utilities.HistStack.__getitem__(), python.rootplot.utilities.HistStack.__iter__(), python.rootplot.utilities.HistStack.__len__(), python.rootplot.utilities.HistStack.__setitem__(), python.rootplot.utilities.HistStack.add(), python.rootplot.root2matplotlib.HistStack.bar(), python.rootplot.root2matplotlib.HistStack.bar3d(), python.rootplot.root2matplotlib.HistStack.barcluster(), python.rootplot.root2matplotlib.HistStack.barh(), python.rootplot.root2matplotlib.HistStack.barstack(), python.rootplot.root2matplotlib.HistStack.errorbar(), python.rootplot.root2matplotlib.HistStack.errorbarh(), histograms.Histograms.FormatHistos(), python.rootplot.root2matplotlib.HistStack.hist(), python.rootplot.root2matplotlib.HistStack.histstack(), python.rootplot.utilities.HistStack.max(), python.rootplot.utilities.HistStack.min(), python.rootplot.utilities.HistStack.scale(), python.rootplot.root2matplotlib.HistStack.show_titles(), and python.rootplot.utilities.HistStack.stackmax().

histograms.Histograms.name

Definition at line 12 of file histograms.py.

Referenced by dirstructure.Directory.__create_pie_image(), dqm_interfaces.DirID.__eq__(), dirstructure.Directory.__get_full_path(), dirstructure.Comparison.__get_img_name(), dataset.Dataset.__getDataType(), dataset.Dataset.__getFileInfoList(), cuy.divideElement.__init__(), cuy.plotElement.__init__(), cuy.additionElement.__init__(), cuy.superimposeElement.__init__(), cuy.graphElement.__init__(), dirstructure.Comparison.__make_image(), dirstructure.Directory.__repr__(), dqm_interfaces.DirID.__repr__(), dirstructure.Comparison.__repr__(), config.CFG.__str__(), dirstructure.Directory.calcStats(), python.rootplot.utilities.Hist.divide(), python.rootplot.utilities.Hist.divide_wilson(), utils.StatisticalTest.get_status(), VIDSelectorBase.VIDSelectorBase.initialize(), dirstructure.Directory.print_report(), python.rootplot.utilities.Hist.TGraph(), python.rootplot.utilities.Hist.TH1F(), and Vispa.Views.PropertyView.Property.valueChanged().

histograms.Histograms.named

Definition at line 14 of file histograms.py.