Go to the documentation of this file.00001
00013
00014 #include "FastSimulation/Muons/plugins/FastL3MuonProducer.h"
00015
00016 #include "RecoMuon/L3TrackFinder/interface/L3MuonTrajectoryBuilder.h"
00017
00018 #include "RecoMuon/TrackingTools/interface/MuonTrackFinder.h"
00019 #include "RecoMuon/TrackingTools/interface/MuonTrackLoader.h"
00020 #include "RecoMuon/TrackingTools/interface/MuonServiceProxy.h"
00021
00022
00023 #include "DataFormats/TrackReco/interface/Track.h"
00024 #include "DataFormats/TrackReco/interface/TrackToTrackMap.h"
00025
00026 #include "TrackingTools/PatternTools/interface/TrajTrackAssociation.h"
00027
00028 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00029
00030
00031
00032
00033 FastL3MuonProducer::FastL3MuonProducer(const edm::ParameterSet& parameterSet) {
00034
00035 LogTrace("FastL3MuonProducer") << "constructor called" << std::endl;
00036
00037
00038 edm::ParameterSet trajectoryBuilderParameters =
00039 parameterSet.getParameter<edm::ParameterSet>("L3TrajBuilderParameters");
00040
00041
00042 theL2CollectionLabel =
00043 parameterSet.getParameter<edm::InputTag>("MuonCollectionLabel");
00044 updatedAtVtx = (theL2CollectionLabel.instance() == "UpdatedAtVtx");
00045
00046
00047 edm::ParameterSet serviceParameters =
00048 parameterSet.getParameter<edm::ParameterSet>("ServiceParameters");
00049
00050
00051 edm::ParameterSet trackLoaderParameters =
00052 parameterSet.getParameter<edm::ParameterSet>("TrackLoaderParameters");
00053
00054
00055 theService = new MuonServiceProxy(serviceParameters);
00056
00057
00058 MuonTrackLoader* mtl = new MuonTrackLoader(trackLoaderParameters,theService);
00059
00060 l3mtb = new L3MuonTrajectoryBuilder(trajectoryBuilderParameters, theService);
00061
00062 theTrackFinder = new MuonTrackFinder(l3mtb, mtl);
00063
00064 theL2SeededTkLabel = trackLoaderParameters.getUntrackedParameter<std::string>("MuonSeededTracksInstance",std::string());
00065
00066 produces<reco::TrackCollection>(theL2SeededTkLabel);
00067 produces<TrackingRecHitCollection>(theL2SeededTkLabel);
00068 produces<reco::TrackExtraCollection>(theL2SeededTkLabel);
00069 produces<std::vector<Trajectory> >(theL2SeededTkLabel) ;
00070 produces<TrajTrackAssociationCollection>(theL2SeededTkLabel);
00071
00072 produces<reco::TrackCollection>();
00073 produces<TrackingRecHitCollection>();
00074 produces<reco::TrackExtraCollection>();
00075 produces<std::vector<Trajectory> >() ;
00076 produces<TrajTrackAssociationCollection>();
00077
00078 produces<reco::MuonTrackLinksCollection>();
00079
00080 }
00081
00082
00083
00084
00085
00086 FastL3MuonProducer::~FastL3MuonProducer() {
00087
00088 LogTrace("FastL3MuonProducer") << "destructor called" << std::endl;
00089 if (theService) delete theService;
00090 if (theTrackFinder) delete theTrackFinder;
00091
00092 }
00093
00094
00095
00096
00097
00098 void FastL3MuonProducer::produce(edm::Event& event, const edm::EventSetup& eventSetup) {
00099
00100
00101
00102
00103 typedef std::vector<Trajectory> TrajColl;
00104
00105
00106 theService->update(eventSetup);
00107
00108
00109
00110
00111 edm::Handle<reco::TrackCollection> L2Muons;
00112 event.getByLabel(theL2CollectionLabel,L2Muons);
00113
00114 edm::Handle<std::vector<Trajectory> > L2MuonsTraj;
00115 std::vector<MuonTrajectoryBuilder::TrackCand> L2TrackCands;
00116
00117 event.getByLabel(theL2CollectionLabel.label(), L2MuonsTraj);
00118
00119 edm::Handle<TrajTrackAssociationCollection> L2AssoMap;
00120 event.getByLabel(theL2CollectionLabel.label(),L2AssoMap);
00121
00122 edm::Handle<reco::TrackToTrackMap> updatedL2AssoMap;
00123 event.getByLabel(theL2CollectionLabel.label(),updatedL2AssoMap);
00124
00125 TrajTrackAssociationCollection::const_iterator it = L2AssoMap->begin();
00126 TrajTrackAssociationCollection::const_iterator lt = L2AssoMap->end();
00127
00128 for( ; it!=lt; ++it){
00129
00130 const edm::Ref<std::vector<Trajectory> > traj = it->key;
00131 const reco::TrackRef tk
00132 = updatedAtVtx && updatedL2AssoMap->find(it->val) != updatedL2AssoMap->end() ?
00133 (*updatedL2AssoMap)[it->val] : it->val;
00134 MuonTrajectoryBuilder::TrackCand L2Cand = MuonTrajectoryBuilder::TrackCand(0,tk);
00135 if( traj->isValid() ) L2Cand.first = &*traj ;
00136 L2TrackCands.push_back(L2Cand);
00137
00138 }
00139
00140 theTrackFinder->reconstruct(L2TrackCands, event);
00141
00142
00143
00144
00145
00146
00147
00148 }