CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_3/src/RecoMuon/L2MuonProducer/src/L2MuonProducer.cc

Go to the documentation of this file.
00001 //-------------------------------------------------
00002 //
00016 //
00017 //--------------------------------------------------
00018 
00019 #include "RecoMuon/L2MuonProducer/src/L2MuonProducer.h"
00020 
00021 // Framework
00022 #include "FWCore/Framework/interface/Event.h"
00023 #include "FWCore/Framework/interface/EventSetup.h"
00024 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00025 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00026 
00027 // TrackFinder and Specific STA/L2 Trajectory Builder
00028 #include "RecoMuon/StandAloneTrackFinder/interface/StandAloneTrajectoryBuilder.h"
00029 #include "RecoMuon/TrackingTools/interface/MuonTrackFinder.h"
00030 #include "RecoMuon/TrackingTools/interface/MuonTrackLoader.h"
00031 #include "RecoMuon/TrackingTools/interface/MuonTrajectoryCleaner.h"
00032 #include "RecoMuon/TrackingTools/interface/MuonServiceProxy.h"
00033 
00034 #include "TrackingTools/PatternTools/interface/TrajTrackAssociation.h"
00035 #include "TrackingTools/DetLayers/interface/NavigationSetter.h"
00036 
00037 #include "DataFormats/TrajectorySeed/interface/TrajectorySeedCollection.h"
00038 #include "DataFormats/Common/interface/Handle.h"
00039 #include "DataFormats/Common/interface/View.h"
00040 #include "DataFormats/TrackReco/interface/Track.h"
00041 #include "DataFormats/TrackReco/interface/TrackToTrackMap.h"
00042 #include "DataFormats/MuonSeed/interface/L2MuonTrajectorySeedCollection.h"
00043 
00044 #include <string>
00045 
00046 using namespace edm;
00047 using namespace std;
00048 
00050 L2MuonProducer::L2MuonProducer(const ParameterSet& parameterSet){
00051   LogTrace("Muon|RecoMuon|L2MuonProducer")<<"constructor called"<<endl;
00052 
00053   // Parameter set for the Builder
00054   ParameterSet trajectoryBuilderParameters = parameterSet.getParameter<ParameterSet>("L2TrajBuilderParameters");
00055 
00056   // MuonSeed Collection Label
00057   theSeedCollectionLabel = parameterSet.getParameter<InputTag>("InputObjects");
00058 
00059   // service parameters
00060   ParameterSet serviceParameters = parameterSet.getParameter<ParameterSet>("ServiceParameters");
00061 
00062   // TrackLoader parameters
00063   ParameterSet trackLoaderParameters = parameterSet.getParameter<ParameterSet>("TrackLoaderParameters");
00064 
00065   // the services
00066   theService = new MuonServiceProxy(serviceParameters);
00067 
00068   // instantiate the concrete trajectory builder in the Track Finder
00069   theTrackFinder = new MuonTrackFinder(new StandAloneMuonTrajectoryBuilder(trajectoryBuilderParameters, theService),
00070                                        new MuonTrackLoader(trackLoaderParameters, theService),
00071                                        new MuonTrajectoryCleaner(true));
00072   
00073   produces<reco::TrackCollection>();
00074   produces<reco::TrackCollection>("UpdatedAtVtx");
00075   produces<TrackingRecHitCollection>();
00076   produces<reco::TrackExtraCollection>();
00077   produces<reco::TrackToTrackMap>();
00078 
00079   produces<std::vector<Trajectory> >();
00080   produces<TrajTrackAssociationCollection>();
00081 
00082   produces<edm::AssociationMap<edm::OneToMany<std::vector<L2MuonTrajectorySeed>, std::vector<L2MuonTrajectorySeed> > > >();
00083 }
00084   
00086 L2MuonProducer::~L2MuonProducer(){
00087   LogTrace("Muon|RecoMuon|L2eMuonProducer")<<"L2MuonProducer destructor called"<<endl;
00088   delete theService;
00089   delete theTrackFinder;
00090 }
00091 
00092 
00094 void L2MuonProducer::produce(Event& event, const EventSetup& eventSetup){
00095   
00096  const std::string metname = "Muon|RecoMuon|L2MuonProducer";
00097   
00098   LogTrace(metname)<<endl<<endl<<endl;
00099   LogTrace(metname)<<"L2 Muon Reconstruction Started"<<endl;
00100   
00101   // Take the seeds container
00102   LogTrace(metname)<<"Taking the seeds: "<<theSeedCollectionLabel.label()<<endl;
00103   Handle<View<TrajectorySeed> > seeds; 
00104   event.getByLabel(theSeedCollectionLabel,seeds);
00105 
00106   // Update the services
00107   theService->update(eventSetup);
00108   NavigationSetter setter(*theService->muonNavigationSchool());
00109   
00110   // Reconstruct 
00111   LogTrace(metname)<<"Track Reconstruction"<<endl;
00112   theTrackFinder->reconstruct(seeds,event);
00113   
00114   LogTrace(metname)<<"Event loaded"
00115                    <<"================================"
00116                    <<endl<<endl;
00117 }
00118