38 LogDebug(
"Muon|RecoMuon|TevMuonProducer") <<
"constructor called" << endl;
42 glbMuonsToken=consumes<reco::TrackCollection>(theGLBCollectionLabel);
43 glbMuonsTrajToken=consumes<std::vector<Trajectory> >(theGLBCollectionLabel.label());
58 theTrackLoader =
new MuonTrackLoader(trackLoaderParameters,iC,theService);
60 theRefits = parameterSet.
getParameter< std::vector<std::string> >(
"Refits");
61 theRefitIndex = parameterSet.
getParameter< std::vector<int> >(
"RefitIndex");
63 for(
unsigned int ww=0;ww<theRefits.size();ww++){
64 LogDebug(
"Muon|RecoMuon|TevMuonProducer") <<
"Refit " << theRefits[ww];
65 produces<reco::TrackCollection>(theRefits[ww]);
66 produces<TrackingRecHitCollection>(theRefits[ww]);
67 produces<reco::TrackExtraCollection>(theRefits[ww]);
68 produces<vector<Trajectory> >(theRefits[ww]) ;
69 produces<TrajTrackAssociationCollection>(theRefits[ww]);
70 produces<reco::TrackToTrackMap>(theRefits[ww]);
72 produces<DYTestimators> (
"dytInfo");
81 LogTrace(
"Muon|RecoMuon|TevMuonProducer") <<
"destructor called" << endl;
82 if (theService)
delete theService;
83 if (theRefitter)
delete theRefitter;
84 if (theTrackLoader)
delete theTrackLoader;
93 const string metname =
"Muon|RecoMuon|TevMuonProducer";
95 LogTrace(metname)<<
"TeV Muon Reconstruction started" << endl;
98 theService->update(eventSetup);
100 theRefitter->setEvent(event);
102 theRefitter->setServices(theService->eventSetup());
112 event.getByToken(glbMuonsToken,glbMuons);
114 auto dytInfo = std::make_unique<DYTestimators>();
116 size_t GLBmuonSize = glbMuons->size();
117 vector<DYTInfo> dytTmp(GLBmuonSize);
121 LogTrace(metname)<<
"Taking " << glbMuons->size() <<
" Global Muons "<<theGLBCollectionLabel<<endl;
123 vector<MuonTrajectoryBuilder::TrackCand> glbTrackCands;
125 event.getByToken(glbMuonsTrajToken, glbMuonsTraj);
129 for(
unsigned int ww=0;ww<theRefits.size();ww++) {
130 LogDebug(metname)<<
"TeVRefit for Refit: " <<theRefitIndex[ww];
131 std::vector<std::pair<Trajectory*,reco::TrackRef> > miniMap;
135 for (reco::TrackCollection::const_iterator
track = glbTracks->begin();
track!=glbTracks->end();
track++ , ++trackIndex) {
138 vector<Trajectory> refitted=theRefitter->refit(*
track,theRefitIndex[ww],tTopo);
140 if (theRefits[ww] ==
"dyt") dytTmp[glbCounter] = *theRefitter->getDYTInfo();
143 if (refitted.size()>0) {
145 LogDebug(metname)<<
"TeVTrackLoader for Refit: " <<theRefits[ww];
146 trajectories.push_back(refit);
147 std::pair<Trajectory*,reco::TrackRef> thisPair(refit,glbRef);
148 miniMap.push_back(thisPair);
151 theTrackLoader->loadTracks(trajectories,event,miniMap,glbMuons, *tTopo, theRefits[ww]);
154 filler.insert(glbMuons, dytTmp.begin(), dytTmp.end());
156 event.put(
std::move(dytInfo),
"dytInfo");
158 LogTrace(metname) <<
"Done." << endl;
T getParameter(std::string const &) const
virtual void produce(edm::Event &, const edm::EventSetup &) override
reconstruct muons
const std::string metname
std::vector< Track > TrackCollection
collection of Tracks
TevMuonProducer(const edm::ParameterSet &)
constructor with config
T const * product() const
virtual ~TevMuonProducer()
destructor
T const * product() const
ParameterSet const & parameterSet(Provenance const &provenance)
boost::remove_cv< typename boost::remove_reference< argument_type >::type >::type key_type