CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
MuonLinksProducer.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: MuonIdentification
4 // Class: MuonLinksProducer
5 //
6 //
7 // Original Author: Dmytro Kovalskyi
8 //
9 //
10 
11 // system include files
12 #include <memory>
13 
14 // user include files
16 //#include "FWCore/Framework/interface/EDProducer.h"
17 
20 
22 
27 
28 #include <algorithm>
29 
31  produces<reco::MuonTrackLinksCollection>();
32  m_inputCollection = iConfig.getParameter<edm::InputTag>("inputCollection");
33  muonToken_ = consumes<reco::MuonCollection>(m_inputCollection);
34 }
35 
37 
39  auto output = std::make_unique<reco::MuonTrackLinksCollection>();
41  iEvent.getByToken(muonToken_, muons);
42 
43  for (reco::MuonCollection::const_iterator muon = muons->begin(); muon != muons->end(); ++muon) {
44  if (!muon->isGlobalMuon())
45  continue;
46  output->push_back(reco::MuonTrackLinks(muon->track(), muon->standAloneMuon(), muon->combinedMuon()));
47  }
48  iEvent.put(std::move(output));
49 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
edm::EDGetTokenT< reco::MuonCollection > muonToken_
int iEvent
Definition: GenABIO.cc:224
def move
Definition: eostools.py:511
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
~MuonLinksProducer() override
tuple muons
Definition: patZpeak.py:39
edm::InputTag m_inputCollection
MuonLinksProducer(const edm::ParameterSet &)