CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_3/src/RecoMuon/MuonIdentification/plugins/MuonLinksProducer.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 // Package:    MuonIdentification
00004 // Class:      MuonLinksProducer
00005 // 
00006 //
00007 // Original Author:  Dmytro Kovalskyi
00008 // $Id: MuonLinksProducer.cc,v 1.2 2008/08/07 02:27:43 dmytro Exp $
00009 //
00010 //
00011 
00012 
00013 // system include files
00014 #include <memory>
00015 
00016 // user include files
00017 #include "FWCore/Framework/interface/Frameworkfwd.h"
00018 #include "FWCore/Framework/interface/EDProducer.h"
00019 
00020 #include "FWCore/Framework/interface/Event.h"
00021 #include "FWCore/Framework/interface/EventSetup.h"
00022 
00023 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00024 
00025 #include "DataFormats/Common/interface/Handle.h"
00026 #include "DataFormats/TrackReco/interface/Track.h"
00027 #include "DataFormats/MuonReco/interface/MuonFwd.h"
00028 #include "DataFormats/MuonReco/interface/Muon.h"
00029 #include "DataFormats/MuonReco/interface/MuonTrackLinks.h"
00030 #include "RecoMuon/MuonIdentification/plugins/MuonLinksProducer.h"
00031 
00032 #include <algorithm>
00033 
00034 MuonLinksProducer::MuonLinksProducer(const edm::ParameterSet& iConfig)
00035 {
00036    produces<reco::MuonTrackLinksCollection>();
00037    m_inputCollection = iConfig.getParameter<edm::InputTag>("inputCollection");
00038 }
00039 
00040 MuonLinksProducer::~MuonLinksProducer()
00041 {
00042 }
00043 
00044 void MuonLinksProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup)
00045 {
00046    std::auto_ptr<reco::MuonTrackLinksCollection> output(new reco::MuonTrackLinksCollection());
00047    edm::Handle<reco::MuonCollection> muons; 
00048    iEvent.getByLabel(m_inputCollection, muons);
00049    
00050    for ( reco::MuonCollection::const_iterator muon = muons->begin(); 
00051          muon != muons->end(); ++muon )
00052      {
00053         if ( ! muon->isGlobalMuon() ) continue;
00054         output->push_back( reco::MuonTrackLinks( muon->track(), muon->standAloneMuon(), muon->combinedMuon() ) );
00055      }
00056    iEvent.put( output );
00057 }