CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes
histograms.Histograms Class Reference
Inheritance diagram for histograms.Histograms:

Public Member Functions

def __init__ (self, name)
 
def FormatHistos (self, style)
 
def Write (self, dir)
 

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

◆ __init__()

def histograms.Histograms.__init__ (   self,
  name 
)

Definition at line 11 of file histograms.py.

11  def __init__(self, name):
12  self.name = name
13  self.hists = []
14  self.named = []
15  # attributes inheriting from TH1 and TNamed
16  # are kept track of automagically, even if they are in
17  # child classes
18  # setting StatOverflows True for all histograms
19  for var in vars( self ).values():
20  try:
21  if var.InheritsFrom('TNamed'):
22  self.named.append(var)
23  if var.InheritsFrom('TH1'):
24  var.StatOverflows(True)
25  self.hists.append(var)
26  except:
27  pass
28  # print 'TH1 list:', self.hists
29  # print 'TNamed list:', self.named
30 
def __init__(self, dataset, job_number, job_id, job_name, isDA, isMC, applyBOWS, applyEXTRACOND, extraconditions, runboundary, lumilist, intlumi, maxevents, gt, allFromGT, alignmentDB, alignmentTAG, apeDB, apeTAG, bowDB, bowTAG, vertextype, tracktype, refittertype, ttrhtype, applyruncontrol, ptcut, CMSSW_dir, the_dir)

Member Function Documentation

◆ FormatHistos()

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

Definition at line 31 of file histograms.py.

References histograms.Histograms.hists, and SiPixelLorentzAnglePCLHarvester.hists.

31  def FormatHistos(self, style ):
32  '''Apply a style to all histograms.'''
33  for hist in self.hists:
34  style.FormatHisto( hist )
35 

◆ Write()

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  def Write(self, dir ):
37  '''Writes all histograms to a subdirectory of dir called self.name.'''
38  self.dir = dir.mkdir( self.name )
39  self.dir.cd()
40  for hist in self.hists:
41  hist.Write()
42  dir.cd()
43 
44 

Member Data Documentation

◆ dir

histograms.Histograms.dir

Definition at line 38 of file histograms.py.

Referenced by Inspector.Inspector.Loop().

◆ hists

◆ name

◆ named

histograms.Histograms.named

Definition at line 14 of file histograms.py.