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 Member Functions | Private Attributes
ntuplePrintersDiff._TrackAssociation Class Reference
Inheritance diagram for ntuplePrintersDiff._TrackAssociation:

Public Member Functions

def __init__
 
def __str__
 
def extend
 
def extendTrks1
 
def extendTrks1OutsideList
 
def extendTrks2
 
def extendTrks2OutsideList
 
def hasCommonTrackingParticle
 
def merge
 
def minEta
 
def trks1
 
def trks1OutsideList
 
def trks2
 
def trks2OutsideList
 

Private Member Functions

def _extend
 

Private Attributes

 _trks1
 
 _trks1Ind
 
 _trks1OutsideList
 
 _trks1OutsideListInd
 
 _trks2
 
 _trks2Ind
 
 _trks2OutsideList
 
 _trks2OutsideListInd
 

Detailed Description

Definition at line 285 of file ntuplePrintersDiff.py.

Constructor & Destructor Documentation

def ntuplePrintersDiff._TrackAssociation.__init__ (   self)

Member Function Documentation

def ntuplePrintersDiff._TrackAssociation.__str__ (   self)

Definition at line 367 of file ntuplePrintersDiff.py.

References ntuplePrintersDiff._TrackAssociation._trks1, ntuplePrintersDiff._TrackAssociation._trks1OutsideList, ntuplePrintersDiff._TrackAssociation._trks2, ntuplePrintersDiff._TrackAssociation._trks2OutsideList, alignCSCRings.s, and str.

368  def __str__(self):
369  s = lambda l: str([t.index() for t in l])
370  return s(self._trks1)+" "+s(self._trks2)+" "+s(self._trks1OutsideList)+" "+s(self._trks2OutsideList)
#define str(s)
def ntuplePrintersDiff._TrackAssociation._extend (   self,
  trks,
  name 
)
private

Definition at line 298 of file ntuplePrintersDiff.py.

Referenced by ntuplePrintersDiff._TrackAssociation.extendTrks1(), ntuplePrintersDiff._TrackAssociation.extendTrks1OutsideList(), ntuplePrintersDiff._TrackAssociation.extendTrks2(), and ntuplePrintersDiff._TrackAssociation.extendTrks2OutsideList().

299  def _extend(self, trks, name):
300  lst = getattr(self, name)
301  ind = getattr(self, name+"Ind")
302  for t in trks:
303  if not t.index() in ind:
304  lst.append(t)
305  ind.add(t.index())
def ntuplePrintersDiff._TrackAssociation.extend (   self,
  trks1 = [],
  trks2 = [],
  trks1OutsideList = [],
  trks2OutsideList = [] 
)

Definition at line 306 of file ntuplePrintersDiff.py.

References ntuplePrintersDiff._TrackAssociation.extendTrks1(), ntuplePrintersDiff._TrackAssociation.extendTrks1OutsideList(), ntuplePrintersDiff._TrackAssociation.extendTrks2(), and ntuplePrintersDiff._TrackAssociation.extendTrks2OutsideList().

Referenced by MatrixUtil.WF.__init__().

307  def extend(self, trks1=[], trks2=[], trks1OutsideList=[], trks2OutsideList=[]):
308  self.extendTrks1(trks1)
309  self.extendTrks2(trks2)
310  self.extendTrks1OutsideList(trks1OutsideList)
311  self.extendTrks2OutsideList(trks2OutsideList)
def ntuplePrintersDiff._TrackAssociation.extendTrks1 (   self,
  trks 
)

Definition at line 312 of file ntuplePrintersDiff.py.

References ntuplePrintersDiff._TrackAssociation._extend().

Referenced by ntuplePrintersDiff._TrackAssociation.extend(), and ntuplePrintersDiff._TrackAssociation.merge().

313  def extendTrks1(self, trks):
314  self._extend(trks, "_trks1")
def ntuplePrintersDiff._TrackAssociation.extendTrks1OutsideList (   self,
  trks 
)

Definition at line 318 of file ntuplePrintersDiff.py.

References ntuplePrintersDiff._TrackAssociation._extend().

Referenced by ntuplePrintersDiff._TrackAssociation.extend(), and ntuplePrintersDiff._TrackAssociation.merge().

319  def extendTrks1OutsideList(self, trks):
320  self._extend(trks, "_trks1OutsideList")
def ntuplePrintersDiff._TrackAssociation.extendTrks2 (   self,
  trks 
)

Definition at line 315 of file ntuplePrintersDiff.py.

References ntuplePrintersDiff._TrackAssociation._extend().

Referenced by ntuplePrintersDiff._TrackAssociation.extend(), and ntuplePrintersDiff._TrackAssociation.merge().

316  def extendTrks2(self, trks):
317  self._extend(trks, "_trks2")
def ntuplePrintersDiff._TrackAssociation.extendTrks2OutsideList (   self,
  trks 
)

Definition at line 321 of file ntuplePrintersDiff.py.

References ntuplePrintersDiff._TrackAssociation._extend().

Referenced by ntuplePrintersDiff._TrackAssociation.extend(), and ntuplePrintersDiff._TrackAssociation.merge().

322  def extendTrks2OutsideList(self, trks):
323  self._extend(trks, "_trks2OutsideList")
def ntuplePrintersDiff._TrackAssociation.hasCommonTrackingParticle (   self)

Definition at line 329 of file ntuplePrintersDiff.py.

References ntuplePrintersDiff._TrackAssociation._trks1, ntuplePrintersDiff._TrackAssociation._trks2, and GetRecoTauVFromDQM_MC_cff.next.

330  def hasCommonTrackingParticle(self):
331  trkGen = itertools.chain(self._trks1, self._trks2)
332  try:
333  first = next(trkGen)
334  except StopIteration:
335  return False
336  if first.nMatchedTrackingParticles() != 1:
337  return False
338 
339  tpIndex = next(first.matchedTrackingParticleInfos()).trackingParticle().index()
340 
341  for t in trkGen:
342  if t.nMatchedTrackingParticles() != 1:
343  return False
344  if next(t.matchedTrackingParticleInfos()).trackingParticle().index() != tpIndex:
345  return False
346  return True
347 
def ntuplePrintersDiff._TrackAssociation.merge (   self,
  other 
)

Definition at line 348 of file ntuplePrintersDiff.py.

References ntuplePrintersDiff._TrackAssociation.extendTrks1(), ntuplePrintersDiff._TrackAssociation.extendTrks1OutsideList(), ntuplePrintersDiff._TrackAssociation.extendTrks2(), and ntuplePrintersDiff._TrackAssociation.extendTrks2OutsideList().

349  def merge(self, other):
350  self.extendTrks1(other._trks1)
351  self.extendTrks2(other._trks2)
352  self.extendTrks1OutsideList(other._trks1OutsideList)
353  self.extendTrks2OutsideList(other._trks2OutsideList)
def ntuplePrintersDiff._TrackAssociation.minEta (   self)

Definition at line 354 of file ntuplePrintersDiff.py.

References ntuplePrintersDiff._TrackAssociation._trks1, ntuplePrintersDiff._TrackAssociation._trks1OutsideList, ntuplePrintersDiff._TrackAssociation._trks2, ntuplePrintersDiff._TrackAssociation._trks2OutsideList, and min().

355  def minEta(self):
356  _min = lambda lst: min([t.eta() for t in lst])
357 
358  if len(self._trks1) > 0:
359  return _min(self._trks1)
360  if len(self._trks1OutsideList) > 0:
361  return _min(self._trks1OutsideList)
362  if len(self._trks2) > 0:
363  return _min(self._trks2)
364  if len(self._trks2_outsideList) > 0:
365  return _min(self._trks2OutsideList)
366  raise Exception("This _TrackAssociation is empty, minEta() makes no sense")
T min(T a, T b)
Definition: MathUtil.h:58
def ntuplePrintersDiff._TrackAssociation.trks1 (   self)

Definition at line 324 of file ntuplePrintersDiff.py.

def trks1(self): return self._trks1
def ntuplePrintersDiff._TrackAssociation.trks1OutsideList (   self)

Definition at line 326 of file ntuplePrintersDiff.py.

def trks1OutsideList(self): return self._trks1OutsideList
def ntuplePrintersDiff._TrackAssociation.trks2 (   self)

Definition at line 325 of file ntuplePrintersDiff.py.

def trks2(self): return self._trks2
def ntuplePrintersDiff._TrackAssociation.trks2OutsideList (   self)

Definition at line 327 of file ntuplePrintersDiff.py.

328  def trks2OutsideList(self): return self._trks2OutsideList

Member Data Documentation

ntuplePrintersDiff._TrackAssociation._trks1
private

Definition at line 288 of file ntuplePrintersDiff.py.

Referenced by ntuplePrintersDiff._TrackAssociation.__str__(), ntuplePrintersDiff._TrackAssociation.hasCommonTrackingParticle(), and ntuplePrintersDiff._TrackAssociation.minEta().

ntuplePrintersDiff._TrackAssociation._trks1Ind
private

Definition at line 293 of file ntuplePrintersDiff.py.

ntuplePrintersDiff._TrackAssociation._trks1OutsideList
private

Definition at line 290 of file ntuplePrintersDiff.py.

Referenced by ntuplePrintersDiff._TrackAssociation.__str__(), and ntuplePrintersDiff._TrackAssociation.minEta().

ntuplePrintersDiff._TrackAssociation._trks1OutsideListInd
private

Definition at line 295 of file ntuplePrintersDiff.py.

ntuplePrintersDiff._TrackAssociation._trks2
private

Definition at line 289 of file ntuplePrintersDiff.py.

Referenced by ntuplePrintersDiff._TrackAssociation.__str__(), ntuplePrintersDiff._TrackAssociation.hasCommonTrackingParticle(), and ntuplePrintersDiff._TrackAssociation.minEta().

ntuplePrintersDiff._TrackAssociation._trks2Ind
private

Definition at line 294 of file ntuplePrintersDiff.py.

ntuplePrintersDiff._TrackAssociation._trks2OutsideList
private

Definition at line 291 of file ntuplePrintersDiff.py.

Referenced by ntuplePrintersDiff._TrackAssociation.__str__(), and ntuplePrintersDiff._TrackAssociation.minEta().

ntuplePrintersDiff._TrackAssociation._trks2OutsideListInd
private

Definition at line 296 of file ntuplePrintersDiff.py.