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 1689 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 1704 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().

1704  def __call__(self, tdirectory, labels):
1705  ret = range(0, len(labels))
1706  f = tdirectory.GetFile()
1707  if not f:
1708  return ret
1709 
1710  if not f.GetName() in self._cache:
1711  r = self._findOrder(f)
1712  if r is None:
1713  return ret
1714  self._cache[f.GetName()] = r
1715  order = self._cache[f.GetName()]
1716 
1717  # O(N^2) I know, but we're talking about O(10) elements...
1718  orderIndices = []
1719  for l in order:
1720  try:
1721  orderIndices.append(labels.index(l))
1722  except ValueError:
1723  pass
1724  ret = []
1725  for i, l in enumerate(labels):
1726  if l in order:
1727  try:
1728  found = orderIndices.index(i)
1729  if found == 0:
1730  ret.append(i)
1731  else:
1732  ret.append(orderIndices[0])
1733  except ValueError:
1734  ret.append(orderIndices[0])
1735  orderIndices.pop(0)
1736  else:
1737  ret.append(i)
1738  return ret
1739 
def __call__(self, tdirectory, labels)
def trackingPlots.TrackingIterationOrder._findOrder (   self,
  f 
)
private

Definition at line 1693 of file trackingPlots.py.

References python.rootplot.root2matplotlib.replace().

Referenced by trackingPlots.TrackingIterationOrder.__call__().

1693  def _findOrder(self, f):
1694  h = f.Get(_trackingIterationOrderHistogram)
1695  if not h:
1696  return None
1697  xaxis = h.GetXaxis()
1698  def _edit(s):
1699  # remove "Tracks" from the track producer name to get the iteration name
1700  # muonSeeded iterations do not have "Step" in the producer name, so add it here
1701  return s.replace("Tracks", "").replace("muonSeeded", "muonSeededStep")
1702  return [_edit(xaxis.GetBinLabel(i)) for i in xrange(1, h.GetNbinsX()+1)]
1703 
def replace(string, replacements)

Member Data Documentation

trackingPlots.TrackingIterationOrder._cache
private

Definition at line 1691 of file trackingPlots.py.

Referenced by trackingPlots.TrackingIterationOrder.__call__().