Definition at line 109 of file PhysObjectMatcher.h.
References EnergyCorrector::c, egammaForCoreTracking_cff::cands, reco::PhysObjectMatcher< C1, C2, S, D, Q >::config_, reco::PhysObjectMatcher< C1, C2, S, D, Q >::distance_, edm::helper::Filler< Map >::fill(), objects.autophobj::filler, helper::MasterCollection< C1 >::get(), edm::Event::getByToken(), mps_fire::i, training_settings::idx, helper::MasterCollection< C1 >::index(), edm::helper::Filler< Map >::insert(), funct::m, funct::master(), match(), electrons_cff::matched, reco::PhysObjectMatcher< C1, C2, S, D, Q >::matchedToken_, eostools::move(), edm::Event::put(), reco::PhysObjectMatcher< C1, C2, S, D, Q >::resolveAmbiguities_, reco::PhysObjectMatcher< C1, C2, S, D, Q >::resolveByMatchQuality_, edm::second(), reco::PhysObjectMatcher< C1, C2, S, D, Q >::select(), helper::MasterCollection< C1 >::size(), findQualityFiles::size, and reco::PhysObjectMatcher< C1, C2, S, D, Q >::srcToken_.
Referenced by JSONExport.JsonExport::export(), HTMLExport.HTMLExport::export(), and HTMLExport.HTMLExportStatic::export().
112 typedef std::pair<size_t, size_t>
IndexPair;
120 unique_ptr<MatchMap> matchMap(
new MatchMap(matched));
121 size_t size = cands->size();
126 Q comparator(
config_,*cands,*matched);
129 vector<int> indices(
master.size(), -1);
130 vector<bool> mLock(matched->size(),
false);
131 MatchContainer matchPairs;
133 for(
size_t c = 0;
c !=
size; ++
c) {
138 for(
size_t m = 0;
m != matched->size(); ++
m) {
141 if ( !mLock[
m] &&
select(cand, match)) {
147 if (
distance_(cand,match) ) matchPairs.push_back(make_pair(
c,
m));
154 assert(idx < indices.size());
155 size_t index = min_element(matchPairs.begin(), matchPairs.end(), comparator)->
second;
171 sort(matchPairs.begin(),matchPairs.end(),comparator);
172 vector<bool> cLock(
master.size(),
false);
174 for ( MatchContainer::const_iterator
i=matchPairs.begin();
175 i!=matchPairs.end(); ++
i ) {
176 size_t c = (*i).first;
177 size_t m = (*i).second;
180 if ( mLock[m] || cLock[c] )
continue;
182 size_t idx =
master.index(c);
183 assert(idx < indices.size());
189 filler.insert(
master.get(), indices.begin(), indices.end());
std::vector< IndexPair > MatchContainer
Master< F > master(const F &f)
bool select(const T1 &c1, const T2 &c2) const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
edm::EDGetTokenT< C2 > matchedToken_
edm::ParameterSet config_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
edm::EDGetTokenT< C1 > srcToken_
edm::Association< C2 > MatchMap
U second(std::pair< T, U > const &p)
bool resolveByMatchQuality_
std::pair< size_t, size_t > IndexPair
helper::Filler< ValueMap< int > > Filler
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.