CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
trackingPlots.TrackingIterationOrder Class Reference

Public Member Functions

def __call__ (self, tdirectory, labels)
 
def __init__ (self)
 

Private Member Functions

def _findOrder (self, f)
 

Private Attributes

 _cache
 

Detailed Description

Definition at line 1734 of file trackingPlots.py.

Constructor & Destructor Documentation

◆ __init__()

def trackingPlots.TrackingIterationOrder.__init__ (   self)

Definition at line 1735 of file trackingPlots.py.

1735  def __init__(self):
1736  self._cache = {}
1737 

Member Function Documentation

◆ __call__()

def trackingPlots.TrackingIterationOrder.__call__ (   self,
  tdirectory,
  labels 
)

Definition at line 1749 of file trackingPlots.py.

1749  def __call__(self, tdirectory, labels):
1750  ret = list(range(0, len(labels)))
1751  f = tdirectory.GetFile()
1752  if not f:
1753  return ret
1754 
1755  if not f.GetName() in self._cache:
1756  r = self._findOrder(f)
1757  if r is None:
1758  return ret
1759  self._cache[f.GetName()] = r
1760  order = self._cache[f.GetName()]
1761 
1762  # O(N^2) I know, but we're talking about O(10) elements...
1763  orderIndices = []
1764  for l in order:
1765  try:
1766  orderIndices.append(labels.index(l))
1767  except ValueError:
1768  pass
1769  ret = []
1770  for i, l in enumerate(labels):
1771  if l in order:
1772  try:
1773  found = orderIndices.index(i)
1774  if found == 0:
1775  ret.append(i)
1776  else:
1777  ret.append(orderIndices[0])
1778  except ValueError:
1779  ret.append(orderIndices[0])
1780  orderIndices.pop(0)
1781  else:
1782  ret.append(i)
1783  return ret
1784 

References DTCache< T, Coll >._cache, tkal_create_file_lists.FileListCreator._cache, L1MuDTTrackFinder._cache, L1MuBMTrackFinder._cache, DTTrig._cache, trackingPlots.TimePerEventPlot._cache, trackingPlots.TrackingIterationOrder._cache, trackingPlots.TrackingIterationOrder._findOrder(), and FastTimerService_cff.range.

◆ _findOrder()

def trackingPlots.TrackingIterationOrder._findOrder (   self,
  f 
)
private

Definition at line 1738 of file trackingPlots.py.

1738  def _findOrder(self, f):
1739  h = f.Get(_trackingIterationOrderHistogram)
1740  if not h:
1741  return None
1742  xaxis = h.GetXaxis()
1743  def _edit(s):
1744  # remove "Tracks" from the track producer name to get the iteration name
1745  # muonSeeded iterations do not have "Step" in the producer name, so add it here
1746  return s.replace("Tracks", "").replace("muonSeeded", "muonSeededStep")
1747  return [_edit(xaxis.GetBinLabel(i)) for i in range(1, h.GetNbinsX()+1)]
1748 

References FastTimerService_cff.range, and python.rootplot.root2matplotlib.replace().

Referenced by trackingPlots.TrackingIterationOrder.__call__().

Member Data Documentation

◆ _cache

trackingPlots.TrackingIterationOrder._cache
private

Definition at line 1736 of file trackingPlots.py.

Referenced by trackingPlots.TrackingIterationOrder.__call__().

FastTimerService_cff.range
range
Definition: FastTimerService_cff.py:34
python.rootplot.root2matplotlib.replace
def replace(string, replacements)
Definition: root2matplotlib.py:444