36 LogDebug(
"Muon|RecoMuon|TevMuonProducer") <<
"constructor called" << endl;
40 glbMuonsToken = consumes<reco::TrackCollection>(theGLBCollectionLabel);
41 glbMuonsTrajToken = consumes<std::vector<Trajectory> >(theGLBCollectionLabel.label());
56 theTrackLoader =
new MuonTrackLoader(trackLoaderParameters, iC, theService);
58 theRefits = parameterSet.
getParameter<std::vector<std::string> >(
"Refits");
59 theRefitIndex = parameterSet.
getParameter<std::vector<int> >(
"RefitIndex");
61 for (
unsigned int ww = 0; ww < theRefits.size(); ww++) {
62 LogDebug(
"Muon|RecoMuon|TevMuonProducer") <<
"Refit " << theRefits[ww];
63 produces<reco::TrackCollection>(theRefits[ww]);
64 produces<TrackingRecHitCollection>(theRefits[ww]);
65 produces<reco::TrackExtraCollection>(theRefits[ww]);
66 produces<vector<Trajectory> >(theRefits[ww]);
67 produces<TrajTrackAssociationCollection>(theRefits[ww]);
68 produces<reco::TrackToTrackMap>(theRefits[ww]);
70 produces<DYTestimators>(
"dytInfo");
77 LogTrace(
"Muon|RecoMuon|TevMuonProducer") <<
"destructor called" << endl;
83 delete theTrackLoader;
90 const string metname =
"Muon|RecoMuon|TevMuonProducer";
92 LogTrace(metname) <<
"TeV Muon Reconstruction started" << endl;
95 theService->update(eventSetup);
97 theRefitter->setEvent(event);
99 theRefitter->setServices(theService->eventSetup());
108 event.getByToken(glbMuonsToken, glbMuons);
110 auto dytInfo = std::make_unique<DYTestimators>();
112 size_t GLBmuonSize = glbMuons->size();
113 vector<DYTInfo> dytTmp(GLBmuonSize);
117 LogTrace(metname) <<
"Taking " << glbMuons->size() <<
" Global Muons " << theGLBCollectionLabel << endl;
119 vector<MuonTrajectoryBuilder::TrackCand> glbTrackCands;
121 event.getByToken(glbMuonsTrajToken, glbMuonsTraj);
125 for (
unsigned int ww = 0; ww < theRefits.size(); ww++) {
126 LogDebug(metname) <<
"TeVRefit for Refit: " << theRefitIndex[ww];
127 std::vector<std::pair<Trajectory*, reco::TrackRef> > miniMap;
131 for (reco::TrackCollection::const_iterator
track = glbTracks->begin();
track != glbTracks->end();
132 track++, ++trackIndex) {
135 vector<Trajectory> refitted = theRefitter->refit(*
track, theRefitIndex[ww], tTopo);
137 if (theRefits[ww] ==
"dyt")
138 dytTmp[glbCounter] = *theRefitter->getDYTInfo();
141 if (!refitted.empty()) {
143 LogDebug(metname) <<
"TeVTrackLoader for Refit: " << theRefits[ww];
144 trajectories.push_back(refit);
145 std::pair<Trajectory*, reco::TrackRef> thisPair(refit, glbRef);
146 miniMap.push_back(thisPair);
149 theTrackLoader->loadTracks(trajectories, event, miniMap, glbMuons, *tTopo, theRefits[ww]);
152 filler.insert(glbMuons, dytTmp.begin(), dytTmp.end());
154 event.put(
std::move(dytInfo),
"dytInfo");
156 LogTrace(metname) <<
"Done." << endl;
T getParameter(std::string const &) const
std::remove_cv< typename std::remove_reference< argument_type >::type >::type key_type
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
~TevMuonProducer() override
destructor
T const * product() const
T const * product() const
ParameterSet const & parameterSet(Provenance const &provenance)