Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MuonAnalysis/MuonAssociators: getByToken in TriggerObjectFilterByCollection #12299

Merged
merged 1 commit into from Nov 9, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -24,6 +24,7 @@
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/Utilities/interface/InputTag.h"
#include "FWCore/Utilities/interface/EDGetToken.h"
#include "DataFormats/PatCandidates/interface/TriggerObjectStandAlone.h"


Expand All @@ -35,12 +36,12 @@ class TriggerObjectFilterByCollection : public edm::EDProducer {
virtual void produce(edm::Event & iEvent, const edm::EventSetup & iSetup);

private:
edm::InputTag src_;
edm::EDGetTokenT<std::vector<pat::TriggerObjectStandAlone>> src_;
std::vector<std::string> collections_;
};

TriggerObjectFilterByCollection::TriggerObjectFilterByCollection(const edm::ParameterSet & iConfig) :
src_(iConfig.getParameter<edm::InputTag>("src")),
src_(consumes<std::vector<pat::TriggerObjectStandAlone>>(iConfig.getParameter<edm::InputTag>("src"))),
collections_(iConfig.getParameter<std::vector<std::string> >("collections"))
{
produces<std::vector<pat::TriggerObjectStandAlone> >();
Expand All @@ -57,7 +58,7 @@ TriggerObjectFilterByCollection::produce(edm::Event & iEvent, const edm::EventSe
using namespace edm;

Handle<std::vector<pat::TriggerObjectStandAlone> > src;
iEvent.getByLabel(src_, src);
iEvent.getByToken(src_, src);

std::auto_ptr<std::vector<pat::TriggerObjectStandAlone> > out(new std::vector<pat::TriggerObjectStandAlone>());
out->reserve(src->size());
Expand Down