1 #ifndef RecoBTag_Analysis_Matching_h 2 #define RecoBTag_Analysis_Matching_h 12 template<
typename Delta>
17 template<
typename V1,
typename V2,
class Separation>
18 Matching(
const V1 &v1,
const V2 &v2, Separation separation) :
24 for(
typename V1::const_iterator iter1 = v1.begin();
25 iter1 != v1.end(); ++iter1, ++
i) {
27 for(
typename V2::const_iterator iter2 = v2.begin();
28 iter2 != v2.end(); ++iter2, ++j)
29 matrix(i, j) = separation(*iter1, *iter2);
37 inline Match(index_type i1, index_type i2) :
44 {
return matrix(index1, index2); }
50 template<
class SortComparator>
55 SortComparator &sort) :
56 matrix(matrix), sort(sort) {}
58 inline bool operator () (index_type i1, index_type i2)
const 66 inline bool operator () (Delta
dummy) {
return true; }
70 template<
class SortComparator,
class CutCriterion>
72 SortComparator sortComparator = SortComparator(),
73 CutCriterion cutCriterion = CutCriterion())
83 result.reserve(
std::min(matrix.rows(), matrix.cols()));
84 for(
typename std::vector<index_type>::const_iterator iter =
87 index_type row = matrix.row(*iter);
88 index_type
col = matrix.col(*iter);
92 if (!cutCriterion(matrix[*iter]))
97 result.push_back(
Match(row, col));
103 template<
class SortComparator>
105 {
return match<SortComparator, AlwaysTrue>(); }
108 {
return match<std::less<Delta>,
AlwaysTrue>(); }
120 #endif // GeneratorEvent_Analysis_Matching_h
Matching::index_type index_type
Match(index_type i1, index_type i2)
Comparator(const SimpleMatrix< Delta > &matrix, SortComparator &sort)
Matching(const V1 &v1, const V2 &v2, Separation separation)
Delta delta(index_type index1, index_type index2) const
Matching::index_type index_type
std::vector< Match > match()
SimpleMatrix< Delta > matrix
Delta delta(Match match) const
bool isMatched2nd(index_type index)
bool isMatched1st(index_type index)
std::vector< bool > matched1
const SimpleMatrix< Delta > & matrix
std::vector< Match > match(SortComparator sortComparator=SortComparator(), CutCriterion cutCriterion=CutCriterion())
SimpleMatrix< Delta >::size_type index_type
std::vector< bool > matched2
std::vector< Match > match()