41 static const char category[] =
"Muon|RecoMuon|L3MuonCandidateProducer";
49 trackToken_ = consumes<reco::TrackCollection>(theL3CollectionLabel);
55 linkToken_ = consumes<reco::MuonTrackLinksCollection>(theL3LinksLabel);
56 if (theL3LinksLabel.label() ==
"" or theL3LinksLabel.label() ==
"unused")
62 if (muon_track_for_momentum ==
std::string(
"Tracker"))
64 else if (muon_track_for_momentum ==
std::string(
"Standalone"))
66 else if (muon_track_for_momentum ==
std::string(
"Global"))
67 theType=CombinedTrack;
69 LogError(
category)<<
"invalid value for MuonPtOption, please choose among 'Tracker', 'Standalone', 'Global'";
70 theType=CombinedTrack;
73 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();
105 if (not link->trackerTrack().isNull())
LogTrace(
category) <<
" link tk pt " << link->trackerTrack()->pt();
106 if (not link->standAloneTrack().isNull())
LogTrace(
category) <<
" sta pt " << link->standAloneTrack()->pt();
107 if (not link->globalTrack().isNull())
LogTrace(
category) <<
" global pt " << link->globalTrack()->pt();
110 if (link->globalTrack().isNull()) {
116 float dR =
deltaR(inRef->eta(),inRef->phi(),link->globalTrack()->eta(),link->globalTrack()->phi());
117 float dPt =
abs(inRef->pt() - link->globalTrack()->pt())/inRef->pt();
118 if (dR < 0.02 and dPt < 0.001) {
121 case InnerTrack: tkRef = link->trackerTrack();
break;
122 case OuterTrack: tkRef = link->standAloneTrack();
break;
123 case CombinedTrack: tkRef = link->globalTrack();
break;
124 default: tkRef = link->globalTrack();
break;
136 LogDebug(
category) <<
"tkRef Used For Momentum pt " << tkRef->pt() <<
" inRef from the input collection pt " << inRef->pt();
138 Particle::Charge
q = tkRef->charge();
143 if(
abs(q)==1) pid = q < 0 ? 13 : -13;
156 <<
"================================";
T getParameter(std::string const &) const
bool existsAs(std::string const ¶meterName, bool trackiness=true) const
checks if a parameter exists as a given type
static const char category[]
L3MuonCandidateProducer(const edm::ParameterSet &)
constructor with config
~L3MuonCandidateProducer() override
destructor
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
produce candidates
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.
double deltaR(double eta1, double eta2, double phi1, double phi2)
edm::Ref< TrackCollection > TrackRef
persistent reference to a Track
void setTrack(const reco::TrackRef &r)
set reference to track
ParameterSet const & parameterSet(Provenance const &provenance)
math::PtEtaPhiELorentzVectorF LorentzVector