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 1690 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 1705 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().

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

Definition at line 1694 of file trackingPlots.py.

References python.rootplot.root2matplotlib.replace().

Referenced by trackingPlots.TrackingIterationOrder.__call__().

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

Member Data Documentation

trackingPlots.TrackingIterationOrder._cache
private

Definition at line 1692 of file trackingPlots.py.

Referenced by trackingPlots.TrackingIterationOrder.__call__().