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,
57 bool select(
const T1&
c1,
const T2& c2)
const override {
return select_(c1, c2); }
66 bool operator()(
const MatchPair&
p1,
const MatchPair&
p2)
const {
return p1.second < p2.second; }
70 template <
typename C1,
typename C2,
typename M>
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) {
101 v.push_back(make_pair(
m, dist));
106 typedef typename MatchMap::key_type key_type;
107 typedef typename MatchMap::data_type data_type;
helper::MatcherGetRef< C >::ref_type getRef(const Handle< C > &c, size_t k)
bool select(const T1 &c1, const T2 &c2) const override
double matchDistance(const T1 &c1, const T2 &c2) const override
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Matcher(const edm::ParameterSet &cfg)
S make(const edm::ParameterSet &cfg)
edm::EDGetTokenT< C1 > srcToken_
virtual double matchDistance(const T1 &, const T2 &) const =0
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
Container::value_type value_type
MatcherBase< C1, C2, M >::T2 T2
def template(fileName, svg, replaceme="REPLACEME")
DecomposeProduct< arg, typename Div::arg > D
MatcherBase< C1, C2, M >::T1 T1
void produce(edm::Event &, const edm::EventSetup &) override
double S(const TLorentzVector &, const TLorentzVector &)
std::pair< size_t, double > MatchPair
edm::EDGetTokenT< C2 > matchedToken_
bool operator()(const MatchPair &p1, const MatchPair &p2) const
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
MatcherBase< C1, C2, M >::MatchMap MatchMap
virtual bool select(const T1 &, const T2 &) const =0
MatcherBase(const edm::ParameterSet &)