15 embeddedMuonBestTrack_(
false),
16 embeddedTunePMuonBestTrack_(
false),
17 embeddedTrack_(
false),
18 embeddedStandAloneMuon_(
false),
19 embeddedCombinedMuon_(
false),
20 embeddedTCMETMuonCorrs_(
false),
21 embeddedCaloMETMuonCorrs_(
false),
22 embeddedPickyMuon_(
false),
23 embeddedTpfmsMuon_(
false),
24 embeddedDytMuon_(
false),
25 embeddedPFCandidate_(
false),
27 cachedNormChi2_(
false),
29 cachedNumberOfValidHits_(
false),
30 numberOfValidHits_(0),
38 initImpactParameters();
45 embeddedMuonBestTrack_(
false),
46 embeddedTunePMuonBestTrack_(
false),
47 embeddedTrack_(
false),
48 embeddedStandAloneMuon_(
false),
49 embeddedCombinedMuon_(
false),
50 embeddedTCMETMuonCorrs_(
false),
51 embeddedCaloMETMuonCorrs_(
false),
52 embeddedPickyMuon_(
false),
53 embeddedTpfmsMuon_(
false),
54 embeddedDytMuon_(
false),
55 embeddedPFCandidate_(
false),
57 cachedNormChi2_(
false),
59 cachedNumberOfValidHits_(
false),
60 numberOfValidHits_(0),
68 initImpactParameters();
75 embeddedMuonBestTrack_(
false),
76 embeddedTunePMuonBestTrack_(
false),
77 embeddedTrack_(
false),
78 embeddedStandAloneMuon_(
false),
79 embeddedCombinedMuon_(
false),
80 embeddedTCMETMuonCorrs_(
false),
81 embeddedCaloMETMuonCorrs_(
false),
82 embeddedPickyMuon_(
false),
83 embeddedTpfmsMuon_(
false),
84 embeddedDytMuon_(
false),
85 embeddedPFCandidate_(
false),
87 cachedNormChi2_(
false),
89 cachedNumberOfValidHits_(
false),
90 numberOfValidHits_(0),
98 initImpactParameters();
105 embeddedMuonBestTrack_(
false),
106 embeddedTunePMuonBestTrack_(
false),
107 embeddedTrack_(
false),
108 embeddedStandAloneMuon_(
false),
109 embeddedCombinedMuon_(
false),
110 embeddedTCMETMuonCorrs_(
false),
111 embeddedCaloMETMuonCorrs_(
false),
112 embeddedPickyMuon_(
false),
113 embeddedTpfmsMuon_(
false),
114 embeddedDytMuon_(
false),
115 embeddedPFCandidate_(
false),
117 cachedNormChi2_(
false),
119 cachedNumberOfValidHits_(
false),
120 numberOfValidHits_(0),
128 initImpactParameters();
139 out <<
"\tpat::Muon: ";
140 out << std::setiosflags(std::ios::right);
142 out << std::setprecision(3);
143 out <<
" E/pT/eta/phi " <<
obj.energy() <<
"/" <<
obj.pt() <<
"/" <<
obj.eta() <<
"/" <<
obj.phi();
148 void Muon::initImpactParameters() {
155 void Muon::initSimInfo() {
159 simHeaviestMotherFlavour_ = 0;
169 simMatchQuality_ = 0.0;
174 if (embeddedTrack_) {
183 if (embeddedStandAloneMuon_) {
192 if (embeddedCombinedMuon_) {
201 if (embeddedPickyMuon_) {
210 if (embeddedTpfmsMuon_) {
219 if (embeddedDytMuon_) {
228 if (!muonBestTrack_.empty()) {
237 if (!tunePMuonBestTrack_.empty()) {
239 }
else if (muonBestTrackType() == tunePMuonBestTrackType()) {
240 return muonBestTrack();
248 if (embeddedPFCandidate_) {
251 return pfCandidateRef_;
257 if (pfCandidateRef_.isNonnull() &&
i == 0)
259 if (refToOrig_.isNonnull() && pfCandidateRef_.isNonnull() &&
i == 1)
261 if (refToOrig_.isNonnull() && !pfCandidateRef_.isNonnull() &&
i == 0)
268 muonBestTrack_.clear();
269 embeddedMuonBestTrack_ =
false;
270 bool alreadyEmbedded =
false;
272 switch (muonBestTrackType()) {
274 alreadyEmbedded =
true;
278 alreadyEmbedded =
true;
281 if (embeddedStandAloneMuon_)
282 alreadyEmbedded =
true;
285 if (embeddedCombinedMuon_)
286 alreadyEmbedded =
true;
289 if (embeddedTpfmsMuon_)
290 alreadyEmbedded =
true;
293 if (embeddedPickyMuon_)
294 alreadyEmbedded =
true;
297 if (embeddedDytMuon_)
298 alreadyEmbedded =
true;
302 if (
force || !alreadyEmbedded) {
304 embeddedMuonBestTrack_ =
true;
310 tunePMuonBestTrack_.clear();
311 bool alreadyEmbedded =
false;
312 embeddedTunePMuonBestTrack_ =
false;
314 switch (tunePMuonBestTrackType()) {
316 alreadyEmbedded =
true;
320 alreadyEmbedded =
true;
323 if (embeddedStandAloneMuon_)
324 alreadyEmbedded =
true;
327 if (embeddedCombinedMuon_)
328 alreadyEmbedded =
true;
331 if (embeddedTpfmsMuon_)
332 alreadyEmbedded =
true;
335 if (embeddedPickyMuon_)
336 alreadyEmbedded =
true;
339 if (embeddedDytMuon_)
340 alreadyEmbedded =
true;
343 if (muonBestTrackType() == tunePMuonBestTrackType()) {
344 if (embeddedMuonBestTrack_)
345 alreadyEmbedded =
true;
348 if (
force || !alreadyEmbedded) {
350 embeddedTunePMuonBestTrack_ =
true;
359 embeddedTrack_ =
true;
365 standAloneMuon_.clear();
368 embeddedStandAloneMuon_ =
true;
374 combinedMuon_.clear();
377 embeddedCombinedMuon_ =
true;
385 for (
auto const&
assoc : assocs) {
386 if (!
assoc->contains(trackExtra.
id())) {
391 trackExtra = trackExtraOut;
394 track.setExtra(trackExtra);
425 caloMETMuonCorrs_.clear();
426 caloMETMuonCorrs_.push_back(
t);
427 embeddedCaloMETMuonCorrs_ =
true;
432 tcMETMuonCorrs_.clear();
433 tcMETMuonCorrs_.push_back(
t);
434 embeddedTCMETMuonCorrs_ =
true;
442 pickyMuon_.push_back(*tk);
443 embeddedPickyMuon_ =
true;
452 tpfmsMuon_.push_back(*tk);
453 embeddedTpfmsMuon_ =
true;
462 dytMuon_.push_back(*tk);
463 embeddedDytMuon_ =
true;
469 inverseBeta_ =
t.inverseBeta();
470 inverseBetaErr_ =
t.inverseBetaErr();
476 if (pfCandidateRef_.isAvailable() && pfCandidateRef_.isNonnull()) {
478 embeddedPFCandidate_ =
true;
491 double Muon::normChi2()
const {
492 if (cachedNormChi2_) {
496 return t->chi2() /
t->ndof();
505 if (cachedNumberOfValidHits_) {
506 return numberOfValidHits_;
509 return t->numberOfValidHits();
515 double Muon::dB(IpType type_)
const {
517 if (cachedIP_ & (1 <<
int(type_))) {
526 double Muon::edB(IpType type_)
const {
528 if (cachedIP_ & (1 <<
int(type_))) {
ProductID id() const
Accessor for product ID.
Ptr< typename C::value_type > refToPtr(Ref< C, typename C::value_type, refhelper::FindUsingAdvance< C, typename C::value_type > > const &ref)
bool isMediumMuon(const reco::Muon &, bool run2016_hip_mitigation=false)
virtual TrackRef globalTrack() const
reference to Track reconstructed in both tracked and muon detector
reco::CandidatePtr pfCandidate_
virtual TrackRef pickyTrack() const
bool isNonnull() const
Checks for non-null.
CandidatePtr sourceCandidatePtr(size_type i) const override
virtual TrackRef outerTrack() const
reference to Track reconstructed in the muon detector only
virtual TrackRef dytTrack() const
bool isLooseMuon(const reco::Muon &)
SelectionType
Selector type.
Muon()
default constructor
std::ostream & operator<<(std::ostream &, BeamSpot beam)
ArbitrationType
define arbitration schemes
virtual TrackRef tunePMuonBestTrack() const
float segmentCompatibility(const reco::Muon &muon, reco::Muon::ArbitrationType arbitrationType=reco::Muon::SegmentAndTrackArbitration)
virtual TrackRef innerTrack() const
edm::Ref< PFCandidateCollection > PFCandidateRef
persistent reference to a PFCandidate
bool isSoftMuon(const reco::Muon &, const reco::Vertex &, bool run2016_hip_mitigation=false)
bool isGoodMuon(const reco::Muon &muon, SelectionType type, reco::Muon::ArbitrationType arbitrationType=reco::Muon::SegmentAndTrackArbitration)
main GoodMuon wrapper call
embedDytMuon
embed in AOD externally stored TeV-refit TPFMS muon track
virtual TrackRef muonBestTrack() const
bool isHighPtMuon(const reco::Muon &, const reco::Vertex &)
edm::Ptr< Candidate > CandidatePtr
persistent reference to an object in a collection of Candidate objects
SelectionType selectionTypeFromString(const std::string &label)
const reco::Muon::ArbitrationType arbitrationType
edm::Ref< TrackCollection > TrackRef
persistent reference to a Track
embedTunePMuonBestTrack
embed in AOD externally stored muon best track from global pflow
bool isTightMuon(const reco::Muon &, const reco::Vertex &)
Analysis-level muon class.
virtual TrackRef tpfmsTrack() const