test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TrajectoryCleanerBySharedSeeds.cc
Go to the documentation of this file.
5 
7 
8 #include <map>
9 #include <vector>
10 
11 using namespace std;
12 
13 /*****************************************************************************/
15 {
16  if(s1.nHits()==0 && s2.nHits()==0) return false;
17  if(s1.nHits() != s2.nHits()) return false;
18 
21 
22  TrajectorySeed::const_iterator h1 = r1.first;
23  TrajectorySeed::const_iterator h2 = r2.first;
24 
25  do
26  {
27  if(!(h1->sharesInput(&(*h2),TrackingRecHit::all)))
28  return false;
29 
30  h1++; h2++;
31  }
32  while(h1 != s1.recHits().second &&
33  h2 != s2.recHits().second);
34 
35  return true;
36 }
37 
38 /*****************************************************************************/
40 {
41 }
42 
43 /*****************************************************************************/
45  (std::vector<Trajectory> & trajs) const
46 {
47  if(trajs.size() == 0) return;
48 
49  // Best track
50  unsigned int best = 0;
51 
52  // Track are assumed to come in seed blocks
53  for(unsigned int actual = 1; actual < trajs.size(); actual++)
54  {
55  if(sameSeed(trajs[best].seed(), trajs[actual].seed()))
56  {
57  // Track to remove
58  unsigned int remove;
59 
60  // remove track with lower number of found hits, higher chi2
61  if(trajs[best].foundHits() != trajs[actual].foundHits())
62  {
63  if(trajs[best].foundHits() > trajs[actual].foundHits())
64  remove = actual;
65  else { remove = best; best = actual; }
66  }
67  else
68  {
69  if(trajs[best].chiSquared() < trajs[actual].chiSquared())
70  remove = actual;
71  else { remove = best; best = actual; }
72  }
73 
74  trajs[remove].invalidate();
75  }
76  }
77 
78  LogTrace("TrajectoryCleanerBySharedSeeds") << " [TrajecCleaner] cleaned trajs : 1/" << trajs.size()
79  << " (with " << trajs[best].measurements().size() << " hits)" << std::endl;
80 }
81 
tuple s2
Definition: indexGen.py:106
std::vector< Trajectory * > TrajectoryPointerContainer
recHitContainer::const_iterator const_iterator
std::pair< const_iterator, const_iterator > range
#define LogTrace(id)
virtual void clean(TrajectoryPointerContainer &) const
range recHits() const
bool sameSeed(const TrajectorySeed &s1, const TrajectorySeed &s2) const
unsigned int nHits() const