Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:25:43

0001 #include "RecoMuon/CosmicMuonProducer/src/CosmicMuonProducer.h"
0002 
0003 /**\class CosmicMuonProducer
0004  *
0005  * Description: CosmicMuonProducer for muons from cosmic rays
0006  *
0007  * Implementation:
0008  *
0009  * Original Author:  Chang Liu
0010  *        Created:  Tue Jun 13 02:46:17 CEST 2006
0011 **/
0012 
0013 // system include files
0014 #include <memory>
0015 
0016 // user include files
0017 #include "FWCore/Framework/interface/ConsumesCollector.h"
0018 #include "FWCore/Framework/interface/Frameworkfwd.h"
0019 
0020 #include "FWCore/Framework/interface/Event.h"
0021 #include "FWCore/Framework/interface/MakerMacros.h"
0022 
0023 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0024 
0025 #include "FWCore/Framework/interface/EventSetup.h"
0026 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0027 
0028 #include "DataFormats/TrackReco/interface/Track.h"
0029 
0030 #include "RecoMuon/CosmicMuonProducer/interface/CosmicMuonTrajectoryBuilder.h"
0031 #include "RecoMuon/TrackingTools/interface/MuonTrackFinder.h"
0032 #include "RecoMuon/TrackingTools/interface/MuonTrackLoader.h"
0033 #include "RecoMuon/TrackingTools/interface/MuonServiceProxy.h"
0034 
0035 #include "TrackingTools/PatternTools/interface/TrajTrackAssociation.h"
0036 
0037 using namespace edm;
0038 
0039 //
0040 // constructors and destructor
0041 //
0042 CosmicMuonProducer::CosmicMuonProducer(const ParameterSet& iConfig) {
0043   ParameterSet tbpar = iConfig.getParameter<ParameterSet>("TrajectoryBuilderParameters");
0044 
0045   theSeedCollectionToken =
0046       consumes<edm::View<TrajectorySeed> >(iConfig.getParameter<std::string>("MuonSeedCollectionLabel"));
0047 
0048   // service parameters
0049   ParameterSet serviceParameters = iConfig.getParameter<ParameterSet>("ServiceParameters");
0050 
0051   // TrackLoader parameters
0052   ParameterSet trackLoaderParameters = iConfig.getParameter<ParameterSet>("TrackLoaderParameters");
0053 
0054   // the services
0055 
0056   edm::ConsumesCollector iC = consumesCollector();
0057 
0058   theService = std::make_unique<MuonServiceProxy>(serviceParameters, consumesCollector());
0059   theTrackFinder =
0060       std::make_unique<MuonTrackFinder>(std::make_unique<CosmicMuonTrajectoryBuilder>(tbpar, theService.get(), iC),
0061                                         std::make_unique<MuonTrackLoader>(trackLoaderParameters, iC, theService.get()),
0062                                         iC);
0063 
0064   produces<reco::TrackCollection>();
0065   produces<TrackingRecHitCollection>();
0066   produces<reco::TrackExtraCollection>();
0067   produces<std::vector<Trajectory> >();
0068   produces<TrajTrackAssociationCollection>();
0069 }
0070 
0071 CosmicMuonProducer::~CosmicMuonProducer() {}
0072 
0073 // ------------ method called to produce the data  ------------
0074 void CosmicMuonProducer::produce(Event& iEvent, const EventSetup& iSetup) {
0075   LogInfo("CosmicMuonProducer") << "Analyzing event number: " << iEvent.id();
0076 
0077   Handle<View<TrajectorySeed> > seeds;
0078   iEvent.getByToken(theSeedCollectionToken, seeds);
0079 
0080   // Update the services
0081   theService->update(iSetup);
0082   theTrackFinder->reconstruct(seeds, iEvent, iSetup);
0083 }