CMS 3D CMS Logo

StandAloneMuonProducer.cc

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

Generated on Tue Jun 9 17:44:31 2009 for CMSSW by  doxygen 1.5.4