CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
KFSplittingFitter.cc
Go to the documentation of this file.
6 
7 std::vector<Trajectory> KFSplittingFitter::fit(const Trajectory& aTraj) const {
8 
10 
11  if(aTraj.empty()) return std::vector<Trajectory>();
12 
13  TM firstTM = aTraj.firstMeasurement();
14  TSOS firstTsos =
16 
17  RecHitContainer hits = aTraj.recHits();
18  RecHitContainer result;
19  result.reserve(hits.size());
20  for(RecHitContainer::iterator ihit = hits.begin(); ihit != hits.end();
21  ihit++) {
22  if(!(**ihit).isValid()) result.push_back(*ihit);
23  else if((**ihit).transientHits().size() == 1) result.push_back(*ihit);
24  else {
25  RecHitContainer splitted = RecHitSplitter().split((**ihit).transientHits());
26  RecHitContainer sorted =
27  RecHitSorter().sortHits(splitted, aTraj.direction());
28  for (RecHitContainer::iterator srt = sorted.begin(); srt != sorted.end(); srt++) {
29  result.push_back(*srt);
30  // result.insert(result.end(), sorted.begin(), sorted.end());
31  }
32  }
33  }
34 
35 
36  return KFTrajectoryFitter::fit(aTraj.seed(), result, firstTsos);
37 
38 }
39 
40 std::vector<Trajectory> KFSplittingFitter::fit(const TrajectorySeed& aSeed,
41  const RecHitContainer& hits,
42  const TSOS& firstPredTsos) const {
43 
45  result.reserve(hits.size());
46  for(RecHitContainer::const_iterator ihit = hits.begin(); ihit != hits.end();
47  ihit++) {
48  if(!(**ihit).isValid()) result.push_back(*ihit);
49  else if((**ihit).transientHits().size() == 1) result.push_back(*ihit);
50  else {
51  RecHitContainer splitted = RecHitSplitter().split((**ihit).transientHits());
52  RecHitContainer sorted =
53  RecHitSorter().sortHits(splitted, aSeed.direction());
54  for (RecHitContainer::iterator srt = sorted.begin(); srt != sorted.end(); srt++) {
55  result.push_back(*srt);
56  // result.insert(result.end(), sorted.begin(), sorted.end());
57  }
58  }
59  }
60 
61  return KFTrajectoryFitter::fit(aSeed, result, firstPredTsos);
62 
63 }
64 
PropagationDirection direction() const
bool empty() const
True if trajectory has no measurements.
Definition: Trajectory.h:234
TransientTrackingRecHit::ConstRecHitContainer RecHitContainer
TrajectorySeed const & seed() const
Access to the seed used to reconstruct the Trajectory.
Definition: Trajectory.h:265
virtual std::vector< Trajectory > fit(const Trajectory &aTraj) const
RecHitContainer sortHits(const RecHitContainer &hits, const PropagationDirection &dir) const
Definition: RecHitSorter.cc:6
ConstRecHitContainer recHits(bool splitting=false) const
Definition: Trajectory.cc:67
PropagationDirection const & direction() const
Definition: Trajectory.cc:195
virtual std::vector< Trajectory > fit(const Trajectory &aTraj) const
tuple result
Definition: query.py:137
RecHitContainer split(const RecHitContainer &hits) const
TrajectoryStateOnSurface predictedState() const
TrajectoryMeasurement const & firstMeasurement() const
Definition: Trajectory.h:194
Trajectory::RecHitContainer RecHitContainer