1 #ifndef UtilAlgos_PhysObjectMatcher_h 2 #define UtilAlgos_PhysObjectMatcher_h 29 template <
typename D,
typename C1,
typename C2>
34 bool operator()(
const std::pair<size_t, size_t>&
p1,
const std::pair<size_t, size_t>&
p2)
const {
53 template <
typename C1,
84 template <
typename C1,
typename C2,
typename S,
typename D,
typename Q>
89 resolveAmbiguities_(
cfg.
template getParameter<
bool>(
"resolveAmbiguities")),
90 resolveByMatchQuality_(
cfg.
template getParameter<
bool>(
"resolveByMatchQuality")),
99 template <
typename C1,
typename C2,
typename S,
typename D,
typename Q>
102 template <
typename C1,
typename C2,
typename S,
typename D,
typename Q>
106 typedef std::pair<size_t, size_t>
IndexPair;
124 vector<bool> mLock(
matched->size(),
false);
127 for (
size_t c = 0;
c !=
size; ++
c) {
130 if (!resolveByMatchQuality_)
133 for (
size_t m = 0;
m !=
matched->size(); ++
m) {
134 const T2& match = (*matched)[
m];
143 matchPairs.push_back(make_pair(
c,
m));
147 if (!matchPairs.empty() && !resolveByMatchQuality_) {
151 size_t index = min_element(matchPairs.begin(), matchPairs.end(), comparator)->
second;
155 if (resolveAmbiguities_)
166 if (resolveByMatchQuality_) {
168 sort(matchPairs.begin(), matchPairs.end(), comparator);
169 vector<bool> cLock(
master.size(),
false);
171 for (MatchContainer::const_iterator
i = matchPairs.begin();
i != matchPairs.end(); ++
i) {
172 size_t c = (*i).first;
173 size_t m = (*i).second;
176 if (mLock[
m] || cLock[
c])
std::vector< IndexPair > MatchContainer
~PhysObjectMatcher() override
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
edm::EDGetTokenT< C2 > matchedToken_
edm::ParameterSet config_
S make(const edm::ParameterSet &cfg)
edm::EDGetTokenT< C1 > srcToken_
Default class for ranking matches: sorting by smaller distance.
bool getByToken(EDGetToken token, Handle< PROD > &result) const
void produce(edm::Event &, const edm::EventSetup &) override
edm::Association< C2 > MatchMap
U second(std::pair< T, U > const &p)
PhysObjectMatcher(const edm::ParameterSet &cfg)
bool select(const T1 &c1, const T2 &c2) const
Container::value_type value_type
bool resolveByMatchQuality_
LessByMatchDistance(const edm::ParameterSet &cfg, const C1 &c1, const C2 &c2)
def template(fileName, svg, replaceme="REPLACEME")
std::pair< size_t, size_t > IndexPair
DecomposeProduct< arg, typename Div::arg > D
bool operator()(const std::pair< size_t, size_t > &p1, const std::pair< size_t, size_t > &p2) const