CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_7/src/RecoMuon/CosmicMuonProducer/src/CosmicMuonProducer.cc

Go to the documentation of this file.
00001 #include "RecoMuon/CosmicMuonProducer/src/CosmicMuonProducer.h"
00002 
00015 // system include files
00016 #include <memory>
00017 
00018 // user include files
00019 #include "FWCore/Framework/interface/Frameworkfwd.h"
00020 
00021 #include "FWCore/Framework/interface/Event.h"
00022 #include "FWCore/Framework/interface/MakerMacros.h"
00023 
00024 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00025 
00026 #include "FWCore/Framework/interface/EventSetup.h"
00027 #include "FWCore/Framework/interface/ESHandle.h"
00028 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00029 
00030 #include "DataFormats/TrajectorySeed/interface/TrajectorySeedCollection.h"
00031 #include "DataFormats/TrackReco/interface/Track.h"
00032 
00033 #include "RecoMuon/CosmicMuonProducer/interface/CosmicMuonTrajectoryBuilder.h"
00034 #include "RecoMuon/TrackingTools/interface/MuonTrackFinder.h"
00035 #include "RecoMuon/TrackingTools/interface/MuonTrackLoader.h"
00036 #include "RecoMuon/TrackingTools/interface/MuonServiceProxy.h"
00037 
00038 #include "TrackingTools/PatternTools/interface/TrajTrackAssociation.h"
00039 
00040 using namespace edm;
00041 
00042 //
00043 // constructors and destructor
00044 //
00045 CosmicMuonProducer::CosmicMuonProducer(const ParameterSet& iConfig)
00046 {
00047   ParameterSet tbpar = iConfig.getParameter<ParameterSet>("TrajectoryBuilderParameters");
00048   theSeedCollectionLabel = iConfig.getParameter<std::string>("MuonSeedCollectionLabel");
00049 
00050   // service parameters
00051   ParameterSet serviceParameters = iConfig.getParameter<ParameterSet>("ServiceParameters");
00052   
00053   // TrackLoader parameters
00054   ParameterSet trackLoaderParameters = iConfig.getParameter<ParameterSet>("TrackLoaderParameters");
00055   
00056   // the services
00057   theService = new MuonServiceProxy(serviceParameters);
00058 
00059   theTrackFinder = new MuonTrackFinder(new CosmicMuonTrajectoryBuilder(tbpar,theService),
00060                                        new MuonTrackLoader(trackLoaderParameters, theService));
00061 
00062   produces<reco::TrackCollection>();
00063   produces<TrackingRecHitCollection>();
00064   produces<reco::TrackExtraCollection>();
00065   produces<std::vector<Trajectory> >();
00066   produces<TrajTrackAssociationCollection>();
00067 
00068 }
00069 
00070 
00071 CosmicMuonProducer::~CosmicMuonProducer()
00072 {
00073   if (theService) delete theService;
00074   if (theTrackFinder) delete theTrackFinder;
00075 }
00076 
00077 
00078 // ------------ method called to produce the data  ------------
00079 void
00080 CosmicMuonProducer::produce(Event& iEvent, const EventSetup& iSetup)
00081 {
00082   LogInfo("CosmicMuonProducer") << "Analyzing event number: " << iEvent.id();
00083 
00084   Handle<View<TrajectorySeed> > seeds; 
00085   iEvent.getByLabel(theSeedCollectionLabel,seeds);
00086   
00087   // Update the services
00088   theService->update(iSetup);
00089   theTrackFinder->reconstruct(seeds,iEvent);
00090 }