40 static const char category[] =
"Muon|RecoMuon|L3MuonCandidateProducer";
48 trackToken_ = consumes<reco::TrackCollection>(theL3CollectionLabel);
54 linkToken_ = consumes<reco::MuonTrackLinksCollection>(theL3LinksLabel);
55 if (theL3LinksLabel.label().empty()
or theL3LinksLabel.label() ==
"unused")
63 if (muon_track_for_momentum ==
std::string(
"Tracker"))
65 else if (muon_track_for_momentum ==
std::string(
"Standalone"))
67 else if (muon_track_for_momentum ==
std::string(
"Global"))
68 theType = CombinedTrack;
70 LogError(
category) <<
"invalid value for MuonPtOption, please choose among 'Tracker', 'Standalone', 'Global'";
71 theType = CombinedTrack;
74 produces<RecoChargedCandidateCollection>();
85 LogTrace(
category) <<
" Taking the L3/GLB muons: " << theL3CollectionLabel.label();
87 event.getByToken(trackToken_,
tracks);
91 event.getByToken(linkToken_,
links);
95 auto candidates = std::make_unique<RecoChargedCandidateCollection>();
97 for (
unsigned int i = 0;
i <
tracks->size();
i++) {
102 for (reco::MuonTrackLinksCollection::const_iterator
link =
links->begin();
link !=
links->end(); ++
link) {
105 if (not
link->trackerTrack().isNull())
107 if (not
link->standAloneTrack().isNull())
109 if (not
link->globalTrack().isNull())
114 if (
link->globalTrack().isNull()) {
120 float dR =
deltaR(inRef->eta(), inRef->phi(),
link->globalTrack()->eta(),
link->globalTrack()->phi());
121 float dPt =
abs(inRef->pt() -
link->globalTrack()->pt()) / inRef->pt();
122 if (
dR < 0.02 and dPt < 0.001) {
126 tkRef =
link->trackerTrack();
129 tkRef =
link->standAloneTrack();
132 tkRef =
link->globalTrack();
135 tkRef =
link->globalTrack();
148 LogDebug(
category) <<
"tkRef Used For Momentum pt " << tkRef->pt() <<
" inRef from the input collection pt "
157 pid =
q < 0 ? 13 : -13;
164 cand.setTrack(inRef);
171 <<
"================================";