A concrete TrajectoryCleaner that considers two trajectories to be mutually exclusive if they share more than some fraction of their hits. The "best" trajectory of each set of mutually exclusive ones is kept, the others are eliminated. The goodness of a track is defined in terms of Chi^2, number of reconstructed hits, and number of lost hits.
Definition at line 16 of file TrajectoryCleanerBySharedHits.h.
Implements TrajectoryCleaner.
Definition at line 41 of file TrajectoryCleanerBySharedHits.cc.
References conversionTrackCandidates_cfi::allowSharedFirstHit, alongMomentum, gather_cfg::cout, DEBUG_PRINT, TrackingRecHit::geographicalId(), TrackingRecHit::hit(), Trajectory::invalidate(), min(), rpcPointValidation_cfi::recHit, offlineSlimmedPrimaryVertices_cfi::score, TrackingRecHit::sharesInput(), TrackingRecHit::some, and protons_cff::t.
Referenced by InOutConversionTrackFinder::tracks(), OutInConversionTrackFinder::tracks(), and ~TrajectoryCleanerBySharedHits().
43 if (tc.size() <= 1)
return;
45 auto & theRecHitMap = theMaps.theRecHitMap;
47 theRecHitMap.clear(10*tc.size());
51 for (
auto const & it : tc) {
52 DEBUG_PRINT(
std::cout <<
" Processing trajectory " << it <<
" (" << it->foundHits() <<
" valid hits)" << std::endl);
53 auto const & pd = it->measurements();
54 for (
auto const & im : pd) {
55 auto theRecHit = &(*im.recHit());
56 if (theRecHit->isValid()) {
58 theRecHitMap.insert(theRecHit, it);
66 auto & theTrajMap = theMaps.theTrajMap;
67 for (
auto const & itt : tc) {
69 DEBUG_PRINT(
std::cout <<
" Processing trajectory " << itt <<
" (" << itt->foundHits() <<
" valid hits)" << std::endl);
72 for (
auto const & im : pd) {
73 auto theRecHit = &(*im.recHit());
74 if (theRecHit->isValid()) {
75 DEBUG_PRINT(
std::cout <<
" Searching for overlaps on hit " << theRecHit <<
" for trajectory " << itt << std::endl);
76 for (RecHitMap::value_iterator ivec = theRecHitMap.values(theRecHit);
77 ivec.good(); ++ivec) {
79 if ((*ivec)->isValid()){
98 if(!theTrajMap.empty() > 0){
99 for(
auto const & imapp : theTrajMap) {
100 if(imapp.second > 0 ){
104 itt->firstMeasurement() : itt->lastMeasurement();
107 imapp.first->firstMeasurement() : imapp.first->lastMeasurement();
114 int nhit1 = itt->foundHits();
115 int nhit2 = imapp.first->foundHits();
116 if( (imapp.second - innerHit) >= ( (
min(nhit1, nhit2)-innerHit) *
theFraction) ){
118 auto score1 =
score(*itt);
119 auto score2 =
score(*imapp.first);
120 badtraj = (score1 > score2) ? imapp.first : itt;
void invalidate()
Method to invalidate a trajectory. Useful during ambiguity resolution.
virtual bool sharesInput(const TrackingRecHit *other, SharedInputType what) const
std::vector< TrajectoryMeasurement > DataContainer
virtual TrackingRecHit const * hit() const
DetId geographicalId() const