28 : muonSource_(consumes<std::
vector<pat::
Muon> >(iConfig.getParameter<edm::
InputTag>(
"muonSource"))),
29 vertexSource_(consumes<std::
vector<
reco::Vertex> >(iConfig.getParameter<edm::
InputTag>(
"vertexSource"))),
30 maxDZ_(iConfig.getParameter<double>(
"maxDZ")) {
31 produces<std::vector<pat::Muon> >();
41 std::vector<pat::Muon>*
selectedMuons(
new std::vector<pat::Muon>);
43 if (!vertices->empty()) {
44 for (
unsigned iMuon = 0; iMuon < muons->size(); ++iMuon) {
45 if (std::fabs(muons->at(iMuon).vertex().z() - vertices->at(0).z()) <
maxDZ_) {
46 selectedMuons->push_back(muons->at(iMuon));
51 std::unique_ptr<std::vector<pat::Muon> > selectedMuonsPtr(selectedMuons);
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
~MuonSelectorVertex() override
void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) override
edm::EDGetTokenT< std::vector< reco::Vertex > > vertexSource_
edm::EDGetTokenT< std::vector< pat::Muon > > muonSource_
MuonSelectorVertex(const edm::ParameterSet &iConfig)