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 1737 of file trackingPlots.py.

Constructor & Destructor Documentation

◆ __init__()

def trackingPlots.TrackingIterationOrder.__init__ (   self)

Definition at line 1738 of file trackingPlots.py.

1738  def __init__(self):
1739  self._cache = {}
1740 

Member Function Documentation

◆ __call__()

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

Definition at line 1752 of file trackingPlots.py.

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

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 1741 of file trackingPlots.py.

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

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 1739 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