CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Private Attributes
ntuplePrintersDiff._TracksByHitsMatcher Class Reference
Inheritance diagram for ntuplePrintersDiff._TracksByHitsMatcher:

Public Member Functions

def __init__
 
def match
 

Private Attributes

 _hitsToTracks
 

Detailed Description

Definition at line 54 of file ntuplePrintersDiff.py.

Constructor & Destructor Documentation

def ntuplePrintersDiff._TracksByHitsMatcher.__init__ (   self,
  trklist 
)

Definition at line 55 of file ntuplePrintersDiff.py.

55 
56  def __init__(self, trklist):
57  super(_TracksByHitsMatcher, self).__init__()
58  self._hitsToTracks = collections.defaultdict(list)
59  for trk in trklist:
60  for hit in trk.hits():
61  if hit.isValidHit():
62  self._hitsToTracks[ (type(hit), hit.index()) ].append(trk)
boost::dynamic_bitset append(const boost::dynamic_bitset<> &bs1, const boost::dynamic_bitset<> &bs2)
this method takes two bitsets bs1 and bs2 and returns result of bs2 appended to the end of bs1 ...

Member Function Documentation

def ntuplePrintersDiff._TracksByHitsMatcher.match (   self,
  trk 
)

Definition at line 63 of file ntuplePrintersDiff.py.

References ntuplePrintersDiff._TracksByHitsMatcher._hitsToTracks.

63 
64  def match(self, trk):
65  tracks = collections.defaultdict(int)
66 
67  for hit in trk.hits():
68  if not hit.isValidHit(): continue
69 
70  idx = (type(hit), hit.index())
71  try:
72  otherTracks = self._hitsToTracks[idx]
73  except KeyError:
74  continue
75 
76  for ot in otherTracks:
77  tracks[ot] += 1
78 
79  best = (None, 0)
80  for t, ncommon in tracks.items():
81  if ncommon > best[1]:
82  best = (t, ncommon)
83  return best
84 
85 
# Common diff helpers, used in the printout helpers

Member Data Documentation

ntuplePrintersDiff._TracksByHitsMatcher._hitsToTracks
private

Definition at line 57 of file ntuplePrintersDiff.py.

Referenced by ntuplePrintersDiff._TracksByHitsMatcher.match().