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
ntupleDataFormat.TrackingParticle Class Reference
Inheritance diagram for ntupleDataFormat.TrackingParticle:
ntupleDataFormat._Object

Public Member Functions

def __init__
 
def bestMatchingTrack
 
def decayVertices
 
def isLooper
 
def matchedSeedInfos
 
def matchedTrackInfos
 
def nMatchedSeeds
 
def nMatchedTracks
 
def nSimHits
 
def parentVertex
 
def simHits
 
- Public Member Functions inherited from ntupleDataFormat._Object
def __getattr__
 
def __init__
 
def index
 
def isValid
 

Private Member Functions

def _nMatchedSeeds
 
def _nMatchedTracks
 

Detailed Description

Class representing a TrackingParticle.

Definition at line 971 of file ntupleDataFormat.py.

Constructor & Destructor Documentation

def ntupleDataFormat.TrackingParticle.__init__ (   self,
  tree,
  index 
)
Constructor.

Arguments:
tree  -- TTree object
index -- Index of the TrackingParticle

Definition at line 973 of file ntupleDataFormat.py.

974  def __init__(self, tree, index):
975  """Constructor.
976 
977  Arguments:
978  tree -- TTree object
979  index -- Index of the TrackingParticle
980  """
981  super(TrackingParticle, self).__init__(tree, index, "sim")

Member Function Documentation

def ntupleDataFormat.TrackingParticle._nMatchedSeeds (   self)
private
Internal function to get the number of matched seeds.

Definition at line 1029 of file ntupleDataFormat.py.

References SeedingNode< DATA >._index, lhef::H5Handler._index, RPCMuonExtraStruct._index, ntupleDataFormat._Object._index, python.cmstools.EventTree._index, python.cmstools.EventBranch._index, html.HtmlReport._index, and findQualityFiles.size.

Referenced by ntupleDataFormat.TrackingParticle.matchedSeedInfos(), and ntupleDataFormat.TrackingParticle.nMatchedSeeds().

1030  def _nMatchedSeeds(self):
1031  """Internal function to get the number of matched seeds."""
1032  return self._tree.sim_seedIdx[self._index].size()
tuple size
Write out results.
def ntupleDataFormat.TrackingParticle._nMatchedTracks (   self)
private
Internal function to get the number of matched tracks.

Definition at line 982 of file ntupleDataFormat.py.

References SeedingNode< DATA >._index, lhef::H5Handler._index, RPCMuonExtraStruct._index, ntupleDataFormat._Object._index, python.cmstools.EventTree._index, python.cmstools.EventBranch._index, html.HtmlReport._index, and findQualityFiles.size.

Referenced by ntupleDataFormat.TrackingParticle.bestMatchingTrack(), ntupleDataFormat.TrackingParticle.matchedTrackInfos(), and ntupleDataFormat.TrackingParticle.nMatchedTracks().

983  def _nMatchedTracks(self):
984  """Internal function to get the number of matched tracks."""
985  return self._tree.sim_trkIdx[self._index].size()
tuple size
Write out results.
def ntupleDataFormat.TrackingParticle.bestMatchingTrack (   self)
Returns best-matching track, even for non-reconstructed TrackingParticles, or None, if there is no best-matching track.

Best-matching is defined as the one with largest number of
hits matched to the hits of a TrackingParticle (>= 3). If
there are many fulfilling the same number of hits, the one
inducing the innermost hit of the TrackingParticle is chosen.

Definition at line 1000 of file ntupleDataFormat.py.

References ntupleDataFormat._Object._checkIsValid(), ntupleDataFormat.TrackingParticle._nMatchedTracks(), ntupleDataFormat._Collection._tree, ntupleDataFormat._Object._tree, python.cmstools.EventTree._tree, ntupleDataFormat.TrackingParticle.matchedTrackInfos(), GetRecoTauVFromDQM_MC_cff.next, MuonTruth.simHits(), MuonSimHitMatcher.simHits(), PHcalTB06Info.simHits(), EdgeProperty.simHits, Phase2TrackerValidateDigi.simHits, ntupleDataFormat.TrackingParticle.simHits(), and HLT_FULL_cff.track.

1001  def bestMatchingTrack(self):
1002  """Returns best-matching track, even for non-reconstructed TrackingParticles, or None, if there is no best-matching track.
1003 
1004  Best-matching is defined as the one with largest number of
1005  hits matched to the hits of a TrackingParticle (>= 3). If
1006  there are many fulfilling the same number of hits, the one
1007  inducing the innermost hit of the TrackingParticle is chosen.
1008  """
1009  self._checkIsValid()
1010  if self._nMatchedTracks() == 1:
1011  return next(self.matchedTrackInfos()).track()
1012 
1013  tracks = collections.OrderedDict()
1014  for hit in self.simHits():
1015  for recHit in hit.hits():
1016  for track in recHit.tracks():
1017  if track.index() in tracks:
1018  tracks[track.index()] += 1
1019  else:
1020  tracks[track.index()] = 1
1021 
1022  best = (None, 2)
1023  for trackIndex, nhits in tracks.items():
1024  if nhits > best[1]:
1025  best = (trackIndex, nhits)
1026  if best[0] is None:
1027  return None
1028  return Tracks(self._tree)[best[0]]
def ntupleDataFormat.TrackingParticle.decayVertices (   self)
Returns a generator for decay vertices.

The generator returns TrackingVertex objects.

Definition at line 1062 of file ntupleDataFormat.py.

References ntupleDataFormat._Object._checkIsValid(), SeedingNode< DATA >._index, lhef::H5Handler._index, RPCMuonExtraStruct._index, ntupleDataFormat._Object._index, python.cmstools.EventTree._index, python.cmstools.EventBranch._index, html.HtmlReport._index, ntupleDataFormat._Collection._tree, ntupleDataFormat._Object._tree, and python.cmstools.EventTree._tree.

1063  def decayVertices(self):
1064  """Returns a generator for decay vertices.
1065 
1066  The generator returns TrackingVertex objects.
1067  """
1068  self._checkIsValid()
1069  for ivtx in self._tree.sim_decayVtxIdx[self._index]:
1070  yield TrackingVertex(self._tree, ivtx)
def ntupleDataFormat.TrackingParticle.isLooper (   self)
Returns True if this TrackingParticle is a looper.

Note that the check involves looping over the SimHits, so it is not too cheap.

Definition at line 1071 of file ntupleDataFormat.py.

References ntupleDataFormat._Object._checkIsValid(), ntupleDataFormat._Collection._tree, ntupleDataFormat._Object._tree, python.cmstools.EventTree._tree, TrackingNtuple::TPHitIndex.simHitIdx, hit.x, and hit.y.

1072  def isLooper(self):
1073  """Returns True if this TrackingParticle is a looper.
1074 
1075  Note that the check involves looping over the SimHits, so it is not too cheap."""
1076  self._checkIsValid()
1077  prevr = 0
1078  for ihit in self.simHitIdx():
1079  hit = SimHit(self._tree, ihit)
1080  r = hit.x()**2 + hit.y()**2
1081  if r < prevr:
1082  return True
1083  prevr = r
1084  return False
1085 
def ntupleDataFormat.TrackingParticle.matchedSeedInfos (   self)
Returns a generator for matched tracks.

The generator returns SeedMatchInfo objects.

Definition at line 1038 of file ntupleDataFormat.py.

References ntupleDataFormat._Object._checkIsValid(), SeedingNode< DATA >._index, lhef::H5Handler._index, RPCMuonExtraStruct._index, ntupleDataFormat._Object._index, python.cmstools.EventTree._index, python.cmstools.EventBranch._index, html.HtmlReport._index, ntupleDataFormat.TrackingParticle._nMatchedSeeds(), CommonAnalyzer._prefix, ntupleDataFormat._Object._prefix, html.PageSet._prefix, ntupleDataFormat._Collection._tree, ntupleDataFormat._Object._tree, python.cmstools.EventTree._tree, and sistrip::SpyUtilities.range().

1039  def matchedSeedInfos(self):
1040  """Returns a generator for matched tracks.
1041 
1042  The generator returns SeedMatchInfo objects.
1043  """
1044  self._checkIsValid()
1045  for imatch in range(self._nMatchedSeeds()):
1046  yield SeedMatchInfo(self._tree, self._index, imatch, self._prefix)
const uint16_t range(const Frame &aFrame)
def ntupleDataFormat.TrackingParticle.matchedTrackInfos (   self)
Returns a generator for matched tracks.

The generator returns TrackMatchInfo objects.

Definition at line 991 of file ntupleDataFormat.py.

References ntupleDataFormat._Object._checkIsValid(), SeedingNode< DATA >._index, lhef::H5Handler._index, RPCMuonExtraStruct._index, ntupleDataFormat._Object._index, python.cmstools.EventTree._index, python.cmstools.EventBranch._index, html.HtmlReport._index, ntupleDataFormat.TrackingParticle._nMatchedTracks(), CommonAnalyzer._prefix, ntupleDataFormat._Object._prefix, html.PageSet._prefix, ntupleDataFormat._Collection._tree, ntupleDataFormat._Object._tree, python.cmstools.EventTree._tree, and sistrip::SpyUtilities.range().

Referenced by ntupleDataFormat.TrackingParticle.bestMatchingTrack().

992  def matchedTrackInfos(self):
993  """Returns a generator for matched tracks.
994 
995  The generator returns TrackMatchInfo objects.
996  """
997  self._checkIsValid()
998  for imatch in range(self._nMatchedTracks()):
999  yield TrackMatchInfo(self._tree, self._index, imatch, self._prefix)
const uint16_t range(const Frame &aFrame)
def ntupleDataFormat.TrackingParticle.nMatchedSeeds (   self)
Returns the number of matched seeds.

Definition at line 1033 of file ntupleDataFormat.py.

References ntupleDataFormat._Object._checkIsValid(), and ntupleDataFormat.TrackingParticle._nMatchedSeeds().

1034  def nMatchedSeeds(self):
1035  """Returns the number of matched seeds."""
1036  self._checkIsValid()
1037  return self._nMatchedSeeds()
def ntupleDataFormat.TrackingParticle.nMatchedTracks (   self)
Returns the number of matched tracks.

Definition at line 986 of file ntupleDataFormat.py.

References ntupleDataFormat._Object._checkIsValid(), and ntupleDataFormat.TrackingParticle._nMatchedTracks().

987  def nMatchedTracks(self):
988  """Returns the number of matched tracks."""
989  self._checkIsValid()
990  return self._nMatchedTracks()
def ntupleDataFormat.TrackingParticle.nSimHits (   self)

Definition at line 1047 of file ntupleDataFormat.py.

References ntupleDataFormat._Object._checkIsValid(), TrackingNtuple::TPHitIndex.simHitIdx, and findQualityFiles.size.

1048  def nSimHits(self):
1049  self._checkIsValid()
1050  return self.simHitIdx().size()
tuple size
Write out results.
def ntupleDataFormat.TrackingParticle.parentVertex (   self)
Returns the parent TrackingVertex.

Definition at line 1057 of file ntupleDataFormat.py.

References ntupleDataFormat._Object._checkIsValid(), SeedingNode< DATA >._index, lhef::H5Handler._index, RPCMuonExtraStruct._index, ntupleDataFormat._Object._index, python.cmstools.EventTree._index, python.cmstools.EventBranch._index, html.HtmlReport._index, ntupleDataFormat._Collection._tree, ntupleDataFormat._Object._tree, and python.cmstools.EventTree._tree.

1058  def parentVertex(self):
1059  """Returns the parent TrackingVertex."""
1060  self._checkIsValid()
1061  return TrackingVertex(self._tree, self._tree.sim_parentVtxIdx[self._index])
def ntupleDataFormat.TrackingParticle.simHits (   self)
Returns generator for SimHits.

Definition at line 1051 of file ntupleDataFormat.py.

References ntupleDataFormat._Object._checkIsValid(), ntupleDataFormat._Collection._tree, ntupleDataFormat._Object._tree, python.cmstools.EventTree._tree, and TrackingNtuple::TPHitIndex.simHitIdx.

Referenced by ntupleDataFormat.TrackingParticle.bestMatchingTrack().

1052  def simHits(self):
1053  """Returns generator for SimHits."""
1054  self._checkIsValid()
1055  for ihit in self.simHitIdx():
1056  yield SimHit(self._tree, ihit)