CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Attributes
PixelTrackCleanerBySharedHits Class Referencefinal

#include <PixelTrackCleanerBySharedHits.h>

Inheritance diagram for PixelTrackCleanerBySharedHits:
PixelTrackCleaner

Public Types

using TracksWithTTRHs = pixeltrackfitting::TracksWithTTRHs
 
using TrackWithTTRHs = pixeltrackfitting::TrackWithTTRHs
 
- Public Types inherited from PixelTrackCleaner
using Record = TrajectoryFilter::Record
 
typedef pixeltrackfitting::TracksWithRecHits TracksWithRecHits
 
using TracksWithTTRHs = pixeltrackfitting::TracksWithTTRHs
 

Public Member Functions

void cleanTracks (TracksWithTTRHs &tracksWithRecHits) const override
 
 PixelTrackCleanerBySharedHits (bool useQuadrupletAlgo)
 
 ~PixelTrackCleanerBySharedHits () override
 
- Public Member Functions inherited from PixelTrackCleaner
virtual TracksWithRecHits cleanTracks (const TracksWithRecHits &tracksWithRecHits) const
 
bool fast () const
 
virtual ~PixelTrackCleaner ()
 

Private Attributes

const bool useQuadrupletAlgo_
 

Additional Inherited Members

- Protected Member Functions inherited from PixelTrackCleaner
 PixelTrackCleaner (bool fast=false)
 

Detailed Description

Definition at line 17 of file PixelTrackCleanerBySharedHits.h.

Member Typedef Documentation

Definition at line 25 of file PixelTrackCleanerBySharedHits.h.

Definition at line 24 of file PixelTrackCleanerBySharedHits.h.

Constructor & Destructor Documentation

PixelTrackCleanerBySharedHits::PixelTrackCleanerBySharedHits ( bool  useQuadrupletAlgo)

Definition at line 12 of file PixelTrackCleanerBySharedHits.cc.

12  :
13  PixelTrackCleaner(true), // to mark this as fast algo
14  useQuadrupletAlgo_(useQuadrupletAlgo)
15 {}
PixelTrackCleaner(bool fast=false)
PixelTrackCleanerBySharedHits::~PixelTrackCleanerBySharedHits ( )
override

Definition at line 17 of file PixelTrackCleanerBySharedHits.cc.

18 {}

Member Function Documentation

void PixelTrackCleanerBySharedHits::cleanTracks ( TracksWithTTRHs tracksWithRecHits) const
overridevirtual

Reimplemented from PixelTrackCleaner.

Definition at line 21 of file PixelTrackCleanerBySharedHits.cc.

References connectstrParser::f2, mps_fire::i, LogDebug, indexGen::s2, findQualityFiles::size, mitigatedMETSequence_cff::U, useQuadrupletAlgo_, and findQualityFiles::v.

22 {
23 
24  LogDebug("PixelTrackCleanerBySharedHits") << "Cleanering tracks" << "\n";
25  unsigned int size = trackHitPairs.size();
26  if (size <= 1) return;
27 
28  auto kill = [&](unsigned int i) { delete trackHitPairs[i].first; trackHitPairs[i].first=nullptr;};
29 
30  for (auto iTrack1 = 0U; iTrack1 < size; iTrack1++) {
31 
32  auto track1 = trackHitPairs[iTrack1].first;
33  if (!track1) continue;
34 
35  auto const & recHits1 = trackHitPairs[iTrack1].second;
36  auto s1 = recHits1.size();
37  for (auto iTrack2 = iTrack1 + 1U; iTrack2 < size; iTrack2++)
38  {
39  auto track2 = trackHitPairs[iTrack2].first;
40  if (!track2) continue;
41  auto const & recHits2 = trackHitPairs[iTrack2].second;
42  auto s2 = recHits2.size();
43  auto f2=0U;
44  auto commonRecHits = 0U;
45  for (auto iRecHit1 = 0U; iRecHit1 < s1; ++iRecHit1) {
46  for (auto iRecHit2 = f2; iRecHit2 < s2; ++iRecHit2) {
47  if (recHits1[iRecHit1] == recHits2[iRecHit2]) { ++commonRecHits; f2=iRecHit2+1; break;} // if a hit is common, no other can be the same!
48  }
49  if (commonRecHits > 1) break;
50  }
51 
52  auto cleanTrack = [&](){
53  if (track1->pt() > track2->pt()) { kill(iTrack2); return false; }
54  kill(iTrack1);
55  return true;
56  };
57 
58  if(useQuadrupletAlgo_) {
59  if(commonRecHits >= 1) {
60  if (s1 > s2) kill(iTrack2);
61  else if(s1 < s2) { kill(iTrack1); break;}
62  else if(s1 == 3) { if(cleanTrack()) break; } // same number of hits
63  else if(commonRecHits > 1) { if(cleanTrack()) break; }// same number of hits, size != 3 (i.e. == 4)
64  }
65  }
66  else if (commonRecHits > 1) {
67  if(cleanTrack()) break;
68  }
69  }
70  }
71 
72  trackHitPairs.erase(std::remove_if(trackHitPairs.begin(),trackHitPairs.end(),[&](TrackWithTTRHs & v){ return nullptr==v.first;}),trackHitPairs.end());
73 }
#define LogDebug(id)
size
Write out results.
std::pair< reco::Track *, SeedingHitSet > TrackWithTTRHs

Member Data Documentation

const bool PixelTrackCleanerBySharedHits::useQuadrupletAlgo_
private

Definition at line 29 of file PixelTrackCleanerBySharedHits.h.

Referenced by cleanTracks().