ATLAS Offline Software
Public Member Functions | Private Member Functions | Private Attributes | List of all members
plot_material.HistManager Class Reference
Collaboration diagram for plot_material.HistManager:

Public Member Functions

def __init__ (self)
 
def addHist2D (self, name, binx, xmin, xmax, biny, ymin, ymax, xlab="", ylab="", zlab="", average=False)
 
def hist2DExists (self, name)
 
def fillHist2D (self, name, x, y, *args)
 
def hist2D (self, name)
 
def hist2Diter (self)
 

Private Member Functions

def _key (self, k)
 

Private Attributes

 _hist2D
 
 _hist2D_count
 

Detailed Description

Definition at line 66 of file plot_material.py.

Constructor & Destructor Documentation

◆ __init__()

def plot_material.HistManager.__init__ (   self)

Definition at line 67 of file plot_material.py.

67  def __init__(self):
68  self._hist2D = {}
69  self._hist2D_count = {}
70 

Member Function Documentation

◆ _key()

def plot_material.HistManager._key (   self,
  k 
)
private

Definition at line 71 of file plot_material.py.

71  def _key(self, k):
72  if type(k) == tuple:
73  return "_".join(str(v) for v in k)
74  else:
75  return k
76 

◆ addHist2D()

def plot_material.HistManager.addHist2D (   self,
  name,
  binx,
  xmin,
  xmax,
  biny,
  ymin,
  ymax,
  xlab = "",
  ylab = "",
  zlab = "",
  average = False 
)

Definition at line 77 of file plot_material.py.

77  def addHist2D(self, name, binx, xmin, xmax, biny, ymin, ymax, xlab="", ylab="", zlab="", average=False):
78  key = self._key(name)
79  root_name = os.path.basename(name)
80 
81  assert key not in self._hist2D, "hist2D with key {} exists".format(key)
82  self._hist2D[key] = ROOT.TH2D(root_name, root_name, binx, xmin, xmax, biny, ymin, ymax)
83  self._hist2D[key].GetXaxis().SetTitle(xlab)
84  self._hist2D[key].GetYaxis().SetTitle(ylab)
85  self._hist2D[key].GetZaxis().SetTitle(zlab)
86 
87 
88 
89  if average:
90  self._hist2D_count[key] = ROOT.TH2D(root_name+"_count", root_name+"_count", binx, xmin, xmax, biny, ymin, ymax)
91 

◆ fillHist2D()

def plot_material.HistManager.fillHist2D (   self,
  name,
  x,
  y,
args 
)

Definition at line 96 of file plot_material.py.

96  def fillHist2D(self, name, x, y, *args):
97  key = self._key(name)
98  assert key in self._hist2D, "{} not in histograms".format(key)
99  self._hist2D[key].Fill(x, y, *args)
100  if key in self._hist2D_count:
101  self._hist2D_count[key].Fill(x, y)
102 

◆ hist2D()

def plot_material.HistManager.hist2D (   self,
  name 
)

Definition at line 103 of file plot_material.py.

103  def hist2D(self, name):
104  key = self._key(name)
105  return self._hist2D[key]
106 

◆ hist2DExists()

def plot_material.HistManager.hist2DExists (   self,
  name 
)

Definition at line 92 of file plot_material.py.

92  def hist2DExists(self, name):
93  key = self._key(name)
94  return key in self._hist2D
95 

◆ hist2Diter()

def plot_material.HistManager.hist2Diter (   self)

Definition at line 107 of file plot_material.py.

107  def hist2Diter(self):
108  for name, hist in self._hist2D.items():
109  if name not in self._hist2D_count:
110  yield name, hist
111  else:
112  hist_divided = hist.Clone()
113  hist_divided.Divide(self._hist2D_count[name])
114  yield name, hist_divided

Member Data Documentation

◆ _hist2D

plot_material.HistManager._hist2D
private

Definition at line 68 of file plot_material.py.

◆ _hist2D_count

plot_material.HistManager._hist2D_count
private

Definition at line 69 of file plot_material.py.


The documentation for this class was generated from the following file:
vtune_athena.format
format
Definition: vtune_athena.py:14
python.CaloAddPedShiftConfig.type
type
Definition: CaloAddPedShiftConfig.py:42
TCS::join
std::string join(const std::vector< std::string > &v, const char c=',')
Definition: Trigger/TrigT1/L1Topo/L1TopoCommon/Root/StringUtils.cxx:10
TrigJetMonitorAlgorithm.items
items
Definition: TrigJetMonitorAlgorithm.py:71
python.processes.powheg.ZZ.ZZ.__init__
def __init__(self, base_directory, **kwargs)
Constructor: all process options are set here.
Definition: ZZ.py:18
str
Definition: BTagTrackIpAccessor.cxx:11