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)
21 for (
typename V1::const_iterator iter1 = v1.begin(); iter1 != v1.end(); ++iter1, ++
i) {
23 for (
typename V2::const_iterator iter2 = v2.begin(); iter2 != v2.end(); ++iter2, ++
j)
24 matrix(i, j) = separation(*iter1, *iter2);
41 template <
class SortComparator>
58 template <
class SortComparator,
class CutCriterion>
59 std::vector<Match>
match(SortComparator sortComparator = SortComparator(),
60 CutCriterion cutCriterion = CutCriterion()) {
61 std::vector<index_type> matches(
matrix.
size());
68 result.reserve(
std::min(matrix.rows(), matrix.cols()));
69 for (
typename std::vector<index_type>::const_iterator iter = matches.begin(); iter != matches.end(); ++iter) {
75 if (!cutCriterion(matrix[*iter]))
80 result.push_back(
Match(row, col));
86 template <
class SortComparator>
87 inline std::vector<Match>
match() {
88 return match<SortComparator, AlwaysTrue>();
91 inline std::vector<Match>
match() {
return match<std::less<Delta>,
AlwaysTrue>(); }
103 #endif // GeneratorEvent_Analysis_Matching_h
Matching::index_type index_type
Match(index_type i1, index_type i2)
Comparator(const SimpleMatrix< Delta > &matrix, SortComparator &sort)
bool operator()(index_type i1, index_type i2) const
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
bool operator()(Delta dummy)
std::vector< bool > matched2
std::vector< Match > match()
tuple size
Write out results.