CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
trackingPlots.TrackingIterationOrder Class Reference

Public Member Functions

def __call__
 
def __init__
 

Private Member Functions

def _findOrder
 

Private Attributes

 _cache
 

Detailed Description

Definition at line 1743 of file trackingPlots.py.

Constructor & Destructor Documentation

def trackingPlots.TrackingIterationOrder.__init__ (   self)

Member Function Documentation

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

Definition at line 1758 of file trackingPlots.py.

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 sistrip::SpyUtilities.range().

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

Definition at line 1747 of file trackingPlots.py.

References sistrip::SpyUtilities.range(), and python.rootplot.root2matplotlib.replace().

Referenced by trackingPlots.TrackingIterationOrder.__call__().

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

Member Data Documentation

trackingPlots.TrackingIterationOrder._cache
private

Definition at line 1745 of file trackingPlots.py.

Referenced by trackingPlots.TrackingIterationOrder.__call__().