CMS 3D CMS Logo

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__ (self, tree, index)
 
def bestMatchingTrack (self)
 
def decayVertices (self)
 
def isLooper (self)
 
def matchedSeedInfos (self)
 
def matchedTrackInfos (self)
 
def nMatchedSeeds (self)
 
def nMatchedTracks (self)
 
def nSimHits (self)
 
def parentVertex (self)
 
def simHits (self)
 
- Public Member Functions inherited from ntupleDataFormat._Object
def __getattr__ (self, attr)
 
def __init__ (self, tree, index, prefix)
 
def index (self)
 
def isValid (self)
 

Private Member Functions

def _nMatchedSeeds (self)
 
def _nMatchedTracks (self)
 

Detailed Description

Class representing a TrackingParticle.

Definition at line 972 of file ntupleDataFormat.py.

Constructor & Destructor Documentation

◆ __init__()

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

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

Definition at line 974 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")
982 

Member Function Documentation

◆ _nMatchedSeeds()

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

Definition at line 1030 of file ntupleDataFormat.py.

1030  def _nMatchedSeeds(self):
1031  """Internal function to get the number of matched seeds."""
1032  return self._tree.sim_seedIdx[self._index].size()
1033 

References 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, python.cmstools.EventTree._tree, and findQualityFiles.size.

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

◆ _nMatchedTracks()

def ntupleDataFormat.TrackingParticle._nMatchedTracks (   self)
private

◆ bestMatchingTrack()

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 1001 of file ntupleDataFormat.py.

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 six.iteritems(tracks):
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]]
1029 

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.

◆ decayVertices()

def ntupleDataFormat.TrackingParticle.decayVertices (   self)
Returns a generator for decay vertices.

The generator returns TrackingVertex objects.

Definition at line 1063 of file ntupleDataFormat.py.

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)
1071 

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.

◆ isLooper()

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 1072 of file ntupleDataFormat.py.

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 
1086 

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

◆ matchedSeedInfos()

def ntupleDataFormat.TrackingParticle.matchedSeedInfos (   self)
Returns a generator for matched tracks.

The generator returns SeedMatchInfo objects.

Definition at line 1039 of file ntupleDataFormat.py.

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)
1047 

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 FastTimerService_cff.range.

◆ matchedTrackInfos()

def ntupleDataFormat.TrackingParticle.matchedTrackInfos (   self)
Returns a generator for matched tracks.

The generator returns TrackMatchInfo objects.

Definition at line 992 of file ntupleDataFormat.py.

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)
1000 

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 FastTimerService_cff.range.

Referenced by ntupleDataFormat.TrackingParticle.bestMatchingTrack().

◆ nMatchedSeeds()

def ntupleDataFormat.TrackingParticle.nMatchedSeeds (   self)
Returns the number of matched seeds.

Definition at line 1034 of file ntupleDataFormat.py.

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

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

◆ nMatchedTracks()

def ntupleDataFormat.TrackingParticle.nMatchedTracks (   self)
Returns the number of matched tracks.

Definition at line 987 of file ntupleDataFormat.py.

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

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

◆ nSimHits()

def ntupleDataFormat.TrackingParticle.nSimHits (   self)

Definition at line 1048 of file ntupleDataFormat.py.

1048  def nSimHits(self):
1049  self._checkIsValid()
1050  return self.simHitIdx().size()
1051 

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

◆ parentVertex()

def ntupleDataFormat.TrackingParticle.parentVertex (   self)
Returns the parent TrackingVertex.

Definition at line 1058 of file ntupleDataFormat.py.

1058  def parentVertex(self):
1059  """Returns the parent TrackingVertex."""
1060  self._checkIsValid()
1061  return TrackingVertex(self._tree, self._tree.sim_parentVtxIdx[self._index])
1062 

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.

◆ simHits()

def ntupleDataFormat.TrackingParticle.simHits (   self)
Returns generator for SimHits.

Definition at line 1052 of file ntupleDataFormat.py.

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

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

Referenced by ntupleDataFormat.TrackingParticle.bestMatchingTrack().

FastTimerService_cff.range
range
Definition: FastTimerService_cff.py:34
HLT_FULL_cff.track
track
Definition: HLT_FULL_cff.py:11779
hit::y
double y
Definition: SiStripHitEffFromCalibTree.cc:90
FastTrackerRecHitCombiner_cfi.simHits
simHits
Definition: FastTrackerRecHitCombiner_cfi.py:5
hit::x
double x
Definition: SiStripHitEffFromCalibTree.cc:89
TrackingVertex
Definition: TrackingVertex.h:22
gather_cfg.Tracks
Tracks
Definition: gather_cfg.py:251
GetRecoTauVFromDQM_MC_cff.next
next
Definition: GetRecoTauVFromDQM_MC_cff.py:31
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443