CMS 3D CMS Logo

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
17 //#include "FWCore/Framework/interface/EDProducer.h"
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  auto output = std::make_unique<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(std::move(output));
55 }
T getParameter(std::string const &) const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:136
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:519
edm::EDGetTokenT< reco::MuonCollection > muonToken_
int iEvent
Definition: GenABIO.cc:230
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
~MuonLinksProducer() override
edm::InputTag m_inputCollection
MuonLinksProducer(const edm::ParameterSet &)
def move(src, dest)
Definition: eostools.py:510