#include <GenericOverlapFinder.h>
Public Member Functions | |
template<typename Collection , typename OtherCollection > | |
std::auto_ptr< OverlapList > | find (const Collection &items, const OtherCollection &other) const |
GenericOverlapFinder () | |
GenericOverlapFinder (const Distance &dist) | |
Private Attributes | |
Distance | distance_ |
Definition at line 51 of file GenericOverlapFinder.h.
pat::GenericOverlapFinder< Distance >::GenericOverlapFinder | ( | ) | [inline] |
Definition at line 55 of file GenericOverlapFinder.h.
{}
pat::GenericOverlapFinder< Distance >::GenericOverlapFinder | ( | const Distance & | dist | ) | [inline] |
Definition at line 56 of file GenericOverlapFinder.h.
: distance_(dist) {}
std::auto_ptr< pat::OverlapList > pat::GenericOverlapFinder< Distance >::find | ( | const Collection & | items, |
const OtherCollection & | other | ||
) | const |
Indices of overlapped items, and of the nearest item on they overlap with Items are considered to overlap if distance(x1,x2) < 1 both Collections can be vectors, Views, or anything with the same interface
Definition at line 74 of file GenericOverlapFinder.h.
References dmin, match(), run_regression::ret, and findQualityFiles::size.
Referenced by pat::DuplicatedPhotonRemover::electronsBySeed(), and pat::DuplicatedPhotonRemover::electronsBySuperCluster().
{ size_t size = items.size(), size2 = other.size(); std::auto_ptr< OverlapList > ret(new OverlapList()); for (size_t ie = 0; ie < size; ++ie) { double dmin = 1.0; size_t match = 0; for (size_t je = 0; je < size2; ++je) { double dist = distance_(items[ie], other[je]); if (dist < dmin) { match = je; dmin = dist; } } if (dmin < 1.0) { ret->push_back(std::make_pair(ie,match)); } } return ret; }
Distance pat::GenericOverlapFinder< Distance >::distance_ [private] |
Definition at line 66 of file GenericOverlapFinder.h.