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 1700 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 1715 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().

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

Definition at line 1704 of file trackingPlots.py.

References python.rootplot.root2matplotlib.replace().

Referenced by trackingPlots.TrackingIterationOrder.__call__().

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

Member Data Documentation

trackingPlots.TrackingIterationOrder._cache
private

Definition at line 1702 of file trackingPlots.py.

Referenced by trackingPlots.TrackingIterationOrder.__call__().