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

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

1718  def __call__(self, tdirectory, labels):
1719  ret = range(0, len(labels))
1720  f = tdirectory.GetFile()
1721  if not f:
1722  return ret
1723 
1724  if not f.GetName() in self._cache:
1725  r = self._findOrder(f)
1726  if r is None:
1727  return ret
1728  self._cache[f.GetName()] = r
1729  order = self._cache[f.GetName()]
1730 
1731  # O(N^2) I know, but we're talking about O(10) elements...
1732  orderIndices = []
1733  for l in order:
1734  try:
1735  orderIndices.append(labels.index(l))
1736  except ValueError:
1737  pass
1738  ret = []
1739  for i, l in enumerate(labels):
1740  if l in order:
1741  try:
1742  found = orderIndices.index(i)
1743  if found == 0:
1744  ret.append(i)
1745  else:
1746  ret.append(orderIndices[0])
1747  except ValueError:
1748  ret.append(orderIndices[0])
1749  orderIndices.pop(0)
1750  else:
1751  ret.append(i)
1752  return ret
1753 
def __call__(self, tdirectory, labels)
def trackingPlots.TrackingIterationOrder._findOrder (   self,
  f 
)
private

Definition at line 1707 of file trackingPlots.py.

References python.rootplot.root2matplotlib.replace().

Referenced by trackingPlots.TrackingIterationOrder.__call__().

1707  def _findOrder(self, f):
1708  h = f.Get(_trackingIterationOrderHistogram)
1709  if not h:
1710  return None
1711  xaxis = h.GetXaxis()
1712  def _edit(s):
1713  # remove "Tracks" from the track producer name to get the iteration name
1714  # muonSeeded iterations do not have "Step" in the producer name, so add it here
1715  return s.replace("Tracks", "").replace("muonSeeded", "muonSeededStep")
1716  return [_edit(xaxis.GetBinLabel(i)) for i in xrange(1, h.GetNbinsX()+1)]
1717 
def replace(string, replacements)

Member Data Documentation

trackingPlots.TrackingIterationOrder._cache
private

Definition at line 1705 of file trackingPlots.py.

Referenced by trackingPlots.TrackingIterationOrder.__call__().