Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 77174
b: "refs/heads/CMSSW_7_1_X"
c: 35ad8cc
h: "refs/heads/CMSSW_7_1_X"
v: v3
  • Loading branch information
Giovanni Petrucciani committed Nov 5, 2009
1 parent f3f4783 commit a7af813
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
---
refs/heads/gh-pages: 09c786f70121f131b3715aaf3464996502bbeb7e
"refs/heads/CMSSW_7_1_X": 0f50de63a488818c809c7b0136721e4baaa6ee9e
"refs/heads/CMSSW_7_1_X": 35ad8cc855dad57602628ff6c03e05a445b60527
23 changes: 15 additions & 8 deletions trunk/MuonAnalysis/MuonAssociators/plugins/MatcherByPulls.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
//
// Original Author: Giovanni Petrucciani (SNS Pisa and CERN PH-CMG)
// Created: Sun Nov 16 16:14:09 CET 2008
// $Id: MatcherByPulls.cc,v 1.1 2009/05/29 09:44:13 gpetrucc Exp $
// $Id: MatcherByPulls.cc,v 1.2 2009/09/23 12:32:27 gpetrucc Exp $
//


Expand Down Expand Up @@ -45,6 +45,7 @@
* \____|_|\__,_|___/___/ \__,_|\___|\___|_|\__,_|_| \__,_|\__|_|\___/|_| |_|
*/
namespace pat {
template<typename T>
class MatcherByPulls : public edm::EDProducer {
public:
explicit MatcherByPulls(const edm::ParameterSet&);
Expand All @@ -66,16 +67,15 @@ namespace pat {
};
}

using pat::MatcherByPulls;

/* ____ _ _
* / ___|___ _ __ ___| |_ _ __ _ _ ___| |_ ___ _ __
* | | / _ \| '_ \/ __| __| '__| | | |/ __| __/ _ \| '__|
* | |__| (_) | | | \__ \ |_| | | |_| | (__| || (_) | |
* \____\___/|_| |_|___/\__|_| \__,_|\___|\__\___/|_|
*
*/
MatcherByPulls::MatcherByPulls(const edm::ParameterSet &iConfig) :
template<typename T>
pat::MatcherByPulls<T>::MatcherByPulls(const edm::ParameterSet &iConfig) :
src_(iConfig.getParameter<edm::InputTag>("src")),
matched_(iConfig.getParameter<edm::InputTag>("matched")),
mcSel_(iConfig.getParameter<std::string>("matchedSelector")),
Expand All @@ -85,7 +85,8 @@ MatcherByPulls::MatcherByPulls(const edm::ParameterSet &iConfig) :
produces<edm::ValueMap<float> >("pulls");
}

MatcherByPulls::~MatcherByPulls()
template<typename T>
pat::MatcherByPulls<T>::~MatcherByPulls()
{
}

Expand All @@ -96,11 +97,13 @@ MatcherByPulls::~MatcherByPulls()
* |_| |_| \___/ \__,_|\__,_|\___\___|
*
*/

template<typename T>
void
MatcherByPulls::produce(edm::Event& iEvent, const edm::EventSetup& iSetup)
pat::MatcherByPulls<T>::produce(edm::Event& iEvent, const edm::EventSetup& iSetup)
{
typedef std::vector<reco::GenParticle> MCColl;
edm::Handle<edm::View<reco::RecoCandidate> > src;
edm::Handle<edm::View<T> > src;
edm::Handle<MCColl> cands;
iEvent.getByLabel(src_, src);
iEvent.getByLabel(matched_, cands);
Expand All @@ -111,7 +114,7 @@ MatcherByPulls::produce(edm::Event& iEvent, const edm::EventSetup& iSetup)
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 reco::RecoCandidate &tk = (*src)[i];
const T &tk = (*src)[i];
std::pair<int,float> m = algo_.match(tk, *cands, candGood);
matches[i] = m.first;
pulls[i] = m.second;
Expand All @@ -132,4 +135,8 @@ MatcherByPulls::produce(edm::Event& iEvent, const edm::EventSetup& iSetup)
}

//define this as a plug-in

typedef pat::MatcherByPulls<reco::RecoCandidate> MatcherByPulls;
typedef pat::MatcherByPulls<reco::Track> TrackMatcherByPulls;
DEFINE_FWK_MODULE(MatcherByPulls);
DEFINE_FWK_MODULE(TrackMatcherByPulls);

0 comments on commit a7af813

Please sign in to comment.