test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
PixelTrackCleanerBySharedHits.cc
Go to the documentation of this file.
2 
7 
8 using namespace std;
9 using namespace reco;
10 using namespace pixeltrackfitting;
11 
13 {fast=true;}
14 
16 {}
17 
18 
20  const TrackerTopology *tTopo) const
21 {
22 
23  LogDebug("PixelTrackCleanerBySharedHits") << "Cleanering tracks" << "\n";
24  unsigned int size = trackHitPairs.size();
25  if (size <= 1) return;
26 
27  auto kill = [&](unsigned int i) { delete trackHitPairs[i].first; trackHitPairs[i].first=nullptr;};
28 
29  for (auto iTrack1 = 0U; iTrack1 < size; iTrack1++) {
30 
31  auto track1 = trackHitPairs[iTrack1].first;
32  if (!track1) continue;
33 
34  auto const & recHits1 = trackHitPairs[iTrack1].second;
35  auto s1 = recHits1.size();
36  for (auto iTrack2 = iTrack1 + 1U; iTrack2 < size; iTrack2++)
37  {
38  auto track2 = trackHitPairs[iTrack2].first;
39  if (!track2) continue;
40  auto const & recHits2 = trackHitPairs[iTrack2].second;
41  auto s2 = recHits2.size();
42  auto f2=0U;
43  auto commonRecHits = 0U;
44  for (auto iRecHit1 = 0U; iRecHit1 < s1; ++iRecHit1) {
45  for (auto iRecHit2 = f2; iRecHit2 < s2; ++iRecHit2) {
46  if (recHits1[iRecHit1] == recHits2[iRecHit2]) { ++commonRecHits; f2=iRecHit2+1; break;} // if a hit is common, no other can be the same!
47  }
48  if (commonRecHits > 1) break;
49  }
50 
51  if (commonRecHits > 1) {
52  if (track1->pt() > track2->pt()) kill(iTrack2);
53  else { kill(iTrack1); break;}
54  }
55 
56  }
57  }
58 
59  trackHitPairs.erase(std::remove_if(trackHitPairs.begin(),trackHitPairs.end(),[&](TrackWithTTRHs & v){ return nullptr==v.first;}),trackHitPairs.end());
60 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
tuple cfg
Definition: looper.py:293
void cleanTracks(TracksWithTTRHs &tracksWithRecHits, const TrackerTopology *tTopo) const override
PixelTrackCleanerBySharedHits(const edm::ParameterSet &cfg)
tuple s2
Definition: indexGen.py:106
pixeltrackfitting::TrackWithTTRHs TrackWithTTRHs
pixeltrackfitting::TracksWithTTRHs TracksWithTTRHs
tuple size
Write out results.