CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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 
12 // system include files
13 #include <memory>
14 
15 // user include files
18 
21 
23 
28 
29 #include <algorithm>
30 
32 {
33  produces<reco::MuonTrackLinksCollection>();
34  m_inputCollection = iConfig.getParameter<edm::InputTag>("inputCollection");
35  muonToken_ = consumes<reco::MuonCollection>(m_inputCollection);
36 }
37 
39 {
40 }
41 
43 {
44  std::auto_ptr<reco::MuonTrackLinksCollection> output(new reco::MuonTrackLinksCollection());
46  iEvent.getByToken(muonToken_,muons);
47 
48  for ( reco::MuonCollection::const_iterator muon = muons->begin();
49  muon != muons->end(); ++muon )
50  {
51  if ( ! muon->isGlobalMuon() ) continue;
52  output->push_back( reco::MuonTrackLinks( muon->track(), muon->standAloneMuon(), muon->combinedMuon() ) );
53  }
54  iEvent.put( output );
55 }
T getParameter(std::string const &) const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
virtual void produce(edm::Event &, const edm::EventSetup &)
std::vector< MuonTrackLinks > MuonTrackLinksCollection
collection of MuonTrackLinks
Definition: MuonFwd.h:22
virtual ~MuonLinksProducer()
edm::EDGetTokenT< reco::MuonCollection > muonToken_
int iEvent
Definition: GenABIO.cc:230
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116
tuple muons
Definition: patZpeak.py:38
edm::InputTag m_inputCollection
MuonLinksProducer(const edm::ParameterSet &)