#include <MuonAnalysis/MuonAssociators/src/MatcherByPulls.cc>
Public Member Functions | |
MatcherByPulls (const edm::ParameterSet &) | |
~MatcherByPulls () | |
Private Member Functions | |
virtual void | produce (edm::Event &, const edm::EventSetup &) |
Private Attributes | |
MatcherByPullsAlgorithm | algo_ |
edm::InputTag | matched_ |
The MC objects to match against. | |
StringCutObjectSelector < reco::GenParticle > | mcSel_ |
Preselection cut on MC objects. | |
edm::InputTag | src_ |
The RECO objects. |
Description: Matches RecoCandidates to (Gen)Particles by looking at the pulls fo the track parameters. Produces as output an edm::Association to GenParticles, and a ValueMap with the pull values.
Implementation: uses MatcherByPullsAlgorithm the module is in the pat namespace, but it doesn't have any PAT dependency.
Definition at line 49 of file MatcherByPulls.cc.
pat::MatcherByPulls< T >::MatcherByPulls | ( | const edm::ParameterSet & | iConfig | ) | [explicit] |
Definition at line 78 of file MatcherByPulls.cc.
: src_(iConfig.getParameter<edm::InputTag>("src")), matched_(iConfig.getParameter<edm::InputTag>("matched")), mcSel_(iConfig.getParameter<std::string>("matchedSelector")), algo_(iConfig) { produces<edm::Association<std::vector<reco::GenParticle> > >(); produces<edm::ValueMap<float> >("pulls"); }
pat::MatcherByPulls< T >::~MatcherByPulls | ( | ) |
Definition at line 89 of file MatcherByPulls.cc.
{ }
void pat::MatcherByPulls< T >::produce | ( | edm::Event & | iEvent, |
const edm::EventSetup & | iSetup | ||
) | [private, virtual] |
Implements edm::EDProducer.
Definition at line 103 of file MatcherByPulls.cc.
References edm::helper::Filler< Map >::fill(), edm::Event::getByLabel(), i, edm::helper::Filler< Map >::insert(), m, n, edm::Event::put(), and alcazmumu_cfi::src.
{ typedef std::vector<reco::GenParticle> MCColl; edm::Handle<edm::View<T> > src; edm::Handle<MCColl> cands; iEvent.getByLabel(src_, src); iEvent.getByLabel(matched_, cands); std::vector<uint8_t> candGood(cands->size(),1); std::transform(cands->begin(), cands->end(), candGood.begin(), mcSel_); std::vector<int> matches(src->size(),-1); std::vector<float> pulls(src->size(), 1e39); for (size_t i = 0, n = src->size(); i < n; ++i) { const T &tk = (*src)[i]; std::pair<int,float> m = algo_.match(tk, *cands, candGood); matches[i] = m.first; pulls[i] = m.second; } typedef edm::Association<MCColl> MCAsso; std::auto_ptr<MCAsso> matchesMap(new MCAsso(edm::RefProd<MCColl>(cands))); MCAsso::Filler matchesFiller(*matchesMap); matchesFiller.insert(src, matches.begin(), matches.end()); matchesFiller.fill(); iEvent.put(matchesMap); std::auto_ptr<edm::ValueMap<float> > pullsMap(new edm::ValueMap<float>()); edm::ValueMap<float>::Filler pullsFiller(*pullsMap); pullsFiller.insert(src, pulls.begin(), pulls.end()); pullsFiller.fill(); iEvent.put(pullsMap, "pulls"); }
MatcherByPullsAlgorithm pat::MatcherByPulls< T >::algo_ [private] |
Definition at line 66 of file MatcherByPulls.cc.
edm::InputTag pat::MatcherByPulls< T >::matched_ [private] |
The MC objects to match against.
Definition at line 61 of file MatcherByPulls.cc.
StringCutObjectSelector<reco::GenParticle> pat::MatcherByPulls< T >::mcSel_ [private] |
Preselection cut on MC objects.
Definition at line 64 of file MatcherByPulls.cc.
edm::InputTag pat::MatcherByPulls< T >::src_ [private] |
The RECO objects.
Definition at line 58 of file MatcherByPulls.cc.