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

Constructor & Destructor Documentation

◆ __init__()

def trackingPlots.TrackingIterationOrder.__init__ (   self)

Definition at line 1762 of file trackingPlots.py.

1762  def __init__(self):
1763  self._cache = {}
1764 
def __init__(self, dataset, job_number, job_id, job_name, isDA, isMC, applyBOWS, applyEXTRACOND, extraconditions, runboundary, lumilist, intlumi, maxevents, gt, allFromGT, alignmentDB, alignmentTAG, apeDB, apeTAG, bowDB, bowTAG, vertextype, tracktype, refittertype, ttrhtype, applyruncontrol, ptcut, CMSSW_dir, the_dir)

Member Function Documentation

◆ __call__()

def trackingPlots.TrackingIterationOrder.__call__ (   self,
  tdirectory,
  labels 
)

Definition at line 1776 of file trackingPlots.py.

References DTCache< T, Coll >._cache, tkal_create_file_lists.FileListCreator._cache, L1MuDTTrackFinder._cache, datamodel.Collection._cache, L1MuBMTrackFinder._cache, DTTrig._cache, trackingPlots.TimePerEventPlot._cache, trackingPlots.TrackingIterationOrder._cache, trackingPlots.TrackingIterationOrder._findOrder(), and isotrackApplyRegressor.range.

1776  def __call__(self, tdirectory, labels):
1777  ret = list(range(0, len(labels)))
1778  f = tdirectory.GetFile()
1779  if not f:
1780  return ret
1781 
1782  if not f.GetName() in self._cache:
1783  r = self._findOrder(f)
1784  if r is None:
1785  return ret
1786  self._cache[f.GetName()] = r
1787  order = self._cache[f.GetName()]
1788 
1789  # O(N^2) I know, but we're talking about O(10) elements...
1790  orderIndices = []
1791  for l in order:
1792  try:
1793  orderIndices.append(labels.index(l))
1794  except ValueError:
1795  pass
1796  ret = []
1797  for i, l in enumerate(labels):
1798  if l in order:
1799  try:
1800  found = orderIndices.index(i)
1801  if found == 0:
1802  ret.append(i)
1803  else:
1804  ret.append(orderIndices[0])
1805  except ValueError:
1806  ret.append(orderIndices[0])
1807  orderIndices.pop(0)
1808  else:
1809  ret.append(i)
1810  return ret
1811 

◆ _findOrder()

def trackingPlots.TrackingIterationOrder._findOrder (   self,
  f 
)
private

Definition at line 1765 of file trackingPlots.py.

References isotrackApplyRegressor.range, and python.rootplot.root2matplotlib.replace().

Referenced by trackingPlots.TrackingIterationOrder.__call__().

1765  def _findOrder(self, f):
1766  h = f.Get(_trackingIterationOrderHistogram)
1767  if not h:
1768  return None
1769  xaxis = h.GetXaxis()
1770  def _edit(s):
1771  # remove "Tracks" from the track producer name to get the iteration name
1772  # muonSeeded iterations do not have "Step" in the producer name, so add it here
1773  return s.replace("Tracks", "").replace("muonSeeded", "muonSeededStep")
1774  return [_edit(xaxis.GetBinLabel(i)) for i in range(1, h.GetNbinsX()+1)]
1775 
def replace(string, replacements)

Member Data Documentation

◆ _cache

trackingPlots.TrackingIterationOrder._cache
private

Definition at line 1763 of file trackingPlots.py.

Referenced by trackingPlots.TrackingIterationOrder.__call__().