#include <NewMatcher.h>
Public Member Functions | |
Matcher (const edm::ParameterSet &cfg) | |
~Matcher () | |
Private Types | |
typedef edm::Association< C2 > | MatchMap |
typedef C1::value_type | T1 |
typedef C2::value_type | T2 |
Private Member Functions | |
double | matchDistance (const T1 &c1, const T2 &c2) const |
void | produce (edm::Event &, const edm::EventSetup &) |
bool | select (const T1 &c1, const T2 &c2) const |
Private Attributes | |
D | distance_ |
double | distMin_ |
edm::InputTag | matched_ |
S | select_ |
edm::InputTag | src_ |
Definition at line 24 of file NewMatcher.h.
typedef edm::Association<C2> reco::modulesNew::Matcher< C1, C2, S, D >::MatchMap [private] |
Definition at line 31 of file NewMatcher.h.
typedef C1::value_type reco::modulesNew::Matcher< C1, C2, S, D >::T1 [private] |
Definition at line 29 of file NewMatcher.h.
typedef C2::value_type reco::modulesNew::Matcher< C1, C2, S, D >::T2 [private] |
Definition at line 30 of file NewMatcher.h.
reco::modulesNew::Matcher< C1, C2, S, D >::Matcher | ( | const edm::ParameterSet & | cfg | ) |
Definition at line 57 of file NewMatcher.h.
reco::modulesNew::Matcher< C1, C2, S, D >::~Matcher | ( | ) |
Definition at line 67 of file NewMatcher.h.
{ }
double reco::modulesNew::Matcher< C1, C2, S, D >::matchDistance | ( | const T1 & | c1, |
const T2 & | c2 | ||
) | const [inline, private] |
Definition at line 36 of file NewMatcher.h.
References reco::modulesNew::Matcher< C1, C2, S, D >::distance_.
void reco::modulesNew::Matcher< C1, C2, S, D >::produce | ( | edm::Event & | evt, |
const edm::EventSetup & | |||
) | [private, virtual] |
Implements edm::EDProducer.
Definition at line 70 of file NewMatcher.h.
References trackerHits::c, edm::helper::Filler< Map >::fill(), first, edm::Event::getByLabel(), UserOptions_cff::idx, edm::helper::Filler< Map >::insert(), m, funct::master(), match(), edm::Event::put(), benchmark_cfg::select, findQualityFiles::size, and v.
{ using namespace edm; using namespace std; Handle<C2> matched; evt.getByLabel(matched_, matched); Handle<C1> cands; evt.getByLabel(src_, cands); auto_ptr<MatchMap> matchMap(new MatchMap(matched)); size_t size = cands->size(); if( size != 0 ) { typename MatchMap::Filler filler(*matchMap); ::helper::MasterCollection<C1> master(cands); std::vector<int> indices(master.size(), -1); for(size_t c = 0; c != size; ++ c) { const T1 & cand = (*cands)[c]; vector<helper::MatchPair> v; for(size_t m = 0; m != matched->size(); ++m) { const T2 & match = (* matched)[m]; if (select(cand, match)) { double dist = matchDistance(cand, match); if (dist < distMin_) v.push_back(make_pair(m, dist)); } } if(v.size() > 0) { size_t idx = master.index(c); assert(idx < indices.size()); indices[idx] = min_element(v.begin(), v.end(), helper::SortBySecond())->first; } } filler.insert(master.get(), indices.begin(), indices.end()); filler.fill(); } evt.put(matchMap); }
bool reco::modulesNew::Matcher< C1, C2, S, D >::select | ( | const T1 & | c1, |
const T2 & | c2 | ||
) | const [inline, private] |
Definition at line 39 of file NewMatcher.h.
References reco::modulesNew::Matcher< C1, C2, S, D >::select_.
D reco::modulesNew::Matcher< C1, C2, S, D >::distance_ [private] |
Definition at line 43 of file NewMatcher.h.
Referenced by reco::modulesNew::Matcher< C1, C2, S, D >::matchDistance().
double reco::modulesNew::Matcher< C1, C2, S, D >::distMin_ [private] |
Definition at line 35 of file NewMatcher.h.
edm::InputTag reco::modulesNew::Matcher< C1, C2, S, D >::matched_ [private] |
Definition at line 34 of file NewMatcher.h.
S reco::modulesNew::Matcher< C1, C2, S, D >::select_ [private] |
Definition at line 42 of file NewMatcher.h.
Referenced by reco::modulesNew::Matcher< C1, C2, S, D >::select().
edm::InputTag reco::modulesNew::Matcher< C1, C2, S, D >::src_ [private] |
Definition at line 33 of file NewMatcher.h.