37 LogDebug(
"Muon|RecoMuon|TevMuonProducer") <<
"constructor called" << endl;
41 glbMuonsToken = consumes<reco::TrackCollection>(theGLBCollectionLabel);
42 glbMuonsTrajToken = consumes<std::vector<Trajectory> >(theGLBCollectionLabel.label());
48 theService = std::make_unique<MuonServiceProxy>(serviceParameters, consumesCollector());
53 theRefitter = std::make_unique<GlobalMuonRefitter>(refitterParameters, theService.get(), iC);
57 theTrackLoader = std::make_unique<MuonTrackLoader>(trackLoaderParameters, iC, theService.get());
62 for (
unsigned int ww = 0; ww < theRefits.size(); ww++) {
63 LogDebug(
"Muon|RecoMuon|TevMuonProducer") <<
"Refit " << theRefits[ww];
64 produces<reco::TrackCollection>(theRefits[ww]);
65 produces<TrackingRecHitCollection>(theRefits[ww]);
66 produces<reco::TrackExtraCollection>(theRefits[ww]);
67 produces<vector<Trajectory> >(theRefits[ww]);
68 produces<TrajTrackAssociationCollection>(theRefits[ww]);
69 produces<reco::TrackToTrackMap>(theRefits[ww]);
71 produces<DYTestimators>(
"dytInfo");
83 const string metname =
"Muon|RecoMuon|TevMuonProducer";
88 theService->update(eventSetup);
90 theRefitter->setEvent(
event);
92 theRefitter->setServices(theService->eventSetup());
101 event.getByToken(glbMuonsToken, glbMuons);
103 auto dytInfo = std::make_unique<DYTestimators>();
105 size_t GLBmuonSize = glbMuons->size();
106 vector<DYTInfo> dytTmp(GLBmuonSize);
110 LogTrace(
metname) <<
"Taking " << glbMuons->size() <<
" Global Muons " << theGLBCollectionLabel << endl;
112 vector<MuonTrajectoryBuilder::TrackCand> glbTrackCands;
114 event.getByToken(glbMuonsTrajToken, glbMuonsTraj);
118 for (
unsigned int ww = 0; ww < theRefits.size(); ww++) {
120 std::vector<std::pair<Trajectory*, reco::TrackRef> > miniMap;
124 for (reco::TrackCollection::const_iterator
track = glbTracks->begin();
track != glbTracks->end();
125 track++, ++trackIndex) {
128 vector<Trajectory> refitted = theRefitter->refit(*
track, theRefitIndex[ww], tTopo);
130 if (theRefits[ww] ==
"dyt")
131 dytTmp[glbCounter] = *theRefitter->getDYTInfo();
134 if (!refitted.empty()) {
135 auto refit = std::make_unique<Trajectory>(refitted.front());
137 std::pair<Trajectory*, reco::TrackRef> thisPair(refit.get(), glbRef);
138 miniMap.push_back(thisPair);
142 theTrackLoader->loadTracks(
trajectories,
event, miniMap, glbMuons, *tTopo, theRefits[ww]);
145 filler.insert(glbMuons, dytTmp.begin(), dytTmp.end());
147 event.put(
std::move(dytInfo),
"dytInfo");