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 1662 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 1677 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().

1677  def __call__(self, tdirectory, labels):
1678  ret = range(0, len(labels))
1679  f = tdirectory.GetFile()
1680  if not f:
1681  return ret
1682 
1683  if not f.GetName() in self._cache:
1684  r = self._findOrder(f)
1685  if r is None:
1686  return ret
1687  self._cache[f.GetName()] = r
1688  order = self._cache[f.GetName()]
1689 
1690  # O(N^2) I know, but we're talking about O(10) elements...
1691  orderIndices = []
1692  for l in order:
1693  try:
1694  orderIndices.append(labels.index(l))
1695  except ValueError:
1696  pass
1697  ret = []
1698  for i, l in enumerate(labels):
1699  if l in order:
1700  try:
1701  found = orderIndices.index(i)
1702  if found == 0:
1703  ret.append(i)
1704  else:
1705  ret.append(orderIndices[0])
1706  except ValueError:
1707  ret.append(orderIndices[0])
1708  orderIndices.pop(0)
1709  else:
1710  ret.append(i)
1711  return ret
1712 
def __call__(self, tdirectory, labels)
def trackingPlots.TrackingIterationOrder._findOrder (   self,
  f 
)
private

Definition at line 1666 of file trackingPlots.py.

References python.rootplot.root2matplotlib.replace().

Referenced by trackingPlots.TrackingIterationOrder.__call__().

1666  def _findOrder(self, f):
1667  h = f.Get(_trackingIterationOrderHistogram)
1668  if not h:
1669  return None
1670  xaxis = h.GetXaxis()
1671  def _edit(s):
1672  # remove "Tracks" from the track producer name to get the iteration name
1673  # muonSeeded iterations do not have "Step" in the producer name, so add it here
1674  return s.replace("Tracks", "").replace("muonSeeded", "muonSeededStep")
1675  return [_edit(xaxis.GetBinLabel(i)) for i in xrange(1, h.GetNbinsX()+1)]
1676 
def replace(string, replacements)

Member Data Documentation

trackingPlots.TrackingIterationOrder._cache
private

Definition at line 1664 of file trackingPlots.py.

Referenced by trackingPlots.TrackingIterationOrder.__call__().