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 67 of file plot_material.py.

Constructor & Destructor Documentation

◆ __init__()

def plot_material.HistManager.__init__ (   self)

Definition at line 68 of file plot_material.py.

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

Member Function Documentation

◆ _key()

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

Definition at line 72 of file plot_material.py.

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

◆ addHist2D()

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

Definition at line 78 of file plot_material.py.

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

◆ fillHist2D()

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

Definition at line 97 of file plot_material.py.

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

◆ hist2D()

def plot_material.HistManager.hist2D (   self,
  name 
)

Definition at line 104 of file plot_material.py.

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

◆ hist2DExists()

def plot_material.HistManager.hist2DExists (   self,
  name 
)

Definition at line 93 of file plot_material.py.

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

◆ hist2Diter()

def plot_material.HistManager.hist2Diter (   self)

Definition at line 108 of file plot_material.py.

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

Member Data Documentation

◆ _hist2D

plot_material.HistManager._hist2D
private

Definition at line 69 of file plot_material.py.

◆ _hist2D_count

plot_material.HistManager._hist2D_count
private

Definition at line 70 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
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:79
python.processes.powheg.ZZ.ZZ.__init__
def __init__(self, base_directory, **kwargs)
Constructor: all process options are set here.
Definition: ZZ.py:18
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
str
Definition: BTagTrackIpAccessor.cxx:11