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 <<
"================================";
T getParameter(std::string const &) const
static const char category[]
L3MuonCandidateProducer(const edm::ParameterSet &)
constructor with config
~L3MuonCandidateProducer() override
destructor
bool existsAs(std::string const ¶meterName, bool trackiness=true) const
checks if a parameter exists as a given type
Log< level::Error, false > LogError
ParameterSet const & parameterSet(StableProvenance const &provenance, ProcessHistory const &history)
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Abs< T >::type abs(const T &t)
bool isNull() const
Checks for null.
auto const & tracks
cannot be loose
edm::Ref< TrackCollection > TrackRef
persistent reference to a Track
Log< level::Warning, false > LogWarning
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
produce candidates
math::PtEtaPhiELorentzVectorF LorentzVector