1 #ifndef UtilAlgos_Matcher_h 2 #define UtilAlgos_Matcher_h 20 template <
typename C1,
typename C2,
typename M = edm::AssociationMap<edm::OneToOne<C1, C2> > >
37 virtual bool select(
const T1&,
const T2&)
const = 0;
40 template <
typename C1,
70 template <
typename C1,
typename C2,
typename M>
74 distMin_(
cfg.
template getParameter<double>(
"distMin")) {
78 template <
typename C1,
typename C2,
typename M>
81 template <
typename C1,
typename C2,
typename M>
89 typedef typename MatchMap::ref_type ref_type;
90 typedef typename ref_type::key_type key_ref_type;
92 unique_ptr<MatchMap> matchMap(
new MatchMap(ref_type(key_ref_type(
cands), value_ref_type(
matched))));
93 for (
size_t c = 0;
c !=
cands->size(); ++
c) {
95 vector<helper::MatchPair>
v;
96 for (
size_t m = 0;
m !=
matched->size(); ++
m) {
97 const T2& match = (*matched)[
m];
99 double dist = matchDistance(
cand, match);
101 v.push_back(make_pair(
m, dist));
106 typedef typename MatchMap::key_type key_type;
helper::MatcherGetRef< C >::ref_type getRef(const Handle< C > &c, size_t k)
virtual bool select(const T1 &, const T2 &) const =0
::ecal::reco::ComputationScalarType data_type
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Matcher(const edm::ParameterSet &cfg)
S make(const edm::ParameterSet &cfg)
bool operator()(const MatchPair &p1, const MatchPair &p2) const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
edm::EDGetTokenT< C1 > srcToken_
Container::value_type value_type
MatcherBase< C1, C2, M >::T2 T2
virtual double matchDistance(const T1 &, const T2 &) const =0
def template(fileName, svg, replaceme="REPLACEME")
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
DecomposeProduct< arg, typename Div::arg > D
MatcherBase< C1, C2, M >::T1 T1
std::pair< size_t, double > MatchPair
edm::EDGetTokenT< C2 > matchedToken_
bool select(const T1 &c1, const T2 &c2) const override
MatcherBase< C1, C2, M >::MatchMap MatchMap
double matchDistance(const T1 &c1, const T2 &c2) const override
MatcherBase(const edm::ParameterSet &)