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

Constructor & Destructor Documentation

◆ __init__()

def trackingPlots.TrackingIterationOrder.__init__ (   self)

Definition at line 1744 of file trackingPlots.py.

1744  def __init__(self):
1745  self._cache = {}
1746 

Member Function Documentation

◆ __call__()

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

Definition at line 1758 of file trackingPlots.py.

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

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

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

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