16 embeddedMuonBestTrack_(
false),
17 embeddedTunePMuonBestTrack_(
false),
18 embeddedTrack_(
false),
19 embeddedStandAloneMuon_(
false),
20 embeddedCombinedMuon_(
false),
21 embeddedTCMETMuonCorrs_(
false),
22 embeddedCaloMETMuonCorrs_(
false),
23 embeddedPickyMuon_(
false),
24 embeddedTpfmsMuon_(
false),
25 embeddedDytMuon_(
false),
26 embeddedPFCandidate_(
false),
28 cachedNormChi2_(
false),
30 cachedNumberOfValidHits_(
false),
31 numberOfValidHits_(0),
34 initImpactParameters();
40 embeddedMuonBestTrack_(
false),
41 embeddedTunePMuonBestTrack_(
false),
42 embeddedTrack_(
false),
43 embeddedStandAloneMuon_(
false),
44 embeddedCombinedMuon_(
false),
45 embeddedTCMETMuonCorrs_(
false),
46 embeddedCaloMETMuonCorrs_(
false),
47 embeddedPickyMuon_(
false),
48 embeddedTpfmsMuon_(
false),
49 embeddedDytMuon_(
false),
50 embeddedPFCandidate_(
false),
52 cachedNormChi2_(
false),
54 cachedNumberOfValidHits_(
false),
55 numberOfValidHits_(0),
58 initImpactParameters();
64 embeddedMuonBestTrack_(
false),
65 embeddedTunePMuonBestTrack_(
false),
66 embeddedTrack_(
false),
67 embeddedStandAloneMuon_(
false),
68 embeddedCombinedMuon_(
false),
69 embeddedTCMETMuonCorrs_(
false),
70 embeddedCaloMETMuonCorrs_(
false),
71 embeddedPickyMuon_(
false),
72 embeddedTpfmsMuon_(
false),
73 embeddedDytMuon_(
false),
74 embeddedPFCandidate_(
false),
76 cachedNormChi2_(
false),
78 cachedNumberOfValidHits_(0),
79 numberOfValidHits_(0),
82 initImpactParameters();
88 embeddedMuonBestTrack_(
false),
89 embeddedTunePMuonBestTrack_(
false),
90 embeddedTrack_(
false),
91 embeddedStandAloneMuon_(
false),
92 embeddedCombinedMuon_(
false),
93 embeddedTCMETMuonCorrs_(
false),
94 embeddedCaloMETMuonCorrs_(
false),
95 embeddedPickyMuon_(
false),
96 embeddedTpfmsMuon_(
false),
97 embeddedDytMuon_(
false),
98 embeddedPFCandidate_(
false),
100 cachedNormChi2_(
false),
102 cachedNumberOfValidHits_(0),
103 numberOfValidHits_(0),
106 initImpactParameters();
118 out <<
"\tpat::Muon: ";
119 out << std::setiosflags(std::ios::right);
120 out << std::setiosflags(std::ios::fixed);
121 out << std::setprecision(3);
122 out <<
" E/pT/eta/phi "
131 void Muon::initImpactParameters() {
140 if (embeddedTrack_) {
150 if (embeddedStandAloneMuon_) {
160 if (embeddedCombinedMuon_) {
169 if (embeddedPickyMuon_) {
178 if (embeddedTpfmsMuon_) {
187 if (embeddedDytMuon_) {
196 if (!muonBestTrack_.empty()) {
205 if (!tunePMuonBestTrack_.empty()) {
207 }
else if (muonBestTrackType() == tunePMuonBestTrackType()) {
208 return muonBestTrack();
219 if (embeddedPFCandidate_) {
222 return pfCandidateRef_;
229 if(refToOrig_.isNonnull() && pfCandidateRef_.isNonnull() && i==1 )
return refToOrig_;
230 if(refToOrig_.isNonnull() && ! pfCandidateRef_.isNonnull() && i==0 )
return refToOrig_;
235 void Muon::embedMuonBestTrack(
bool force) {
236 muonBestTrack_.clear();
237 embeddedMuonBestTrack_ =
false;
238 bool alreadyEmbedded =
false;
240 switch (muonBestTrackType()) {
241 case None: alreadyEmbedded =
true;
break;
242 case InnerTrack:
if (embeddedTrack_) alreadyEmbedded =
true;
break;
243 case OuterTrack:
if (embeddedStandAloneMuon_) alreadyEmbedded =
true;
break;
244 case CombinedTrack:
if (embeddedCombinedMuon_) alreadyEmbedded =
true;
break;
245 case TPFMS:
if (embeddedTpfmsMuon_) alreadyEmbedded =
true;
break;
246 case Picky:
if (embeddedPickyMuon_) alreadyEmbedded =
true;
break;
247 case DYT:
if (embeddedDytMuon_) alreadyEmbedded =
true;
break;
250 if (force || !alreadyEmbedded) {
252 embeddedMuonBestTrack_ =
true;
257 void Muon::embedTunePMuonBestTrack(
bool force) {
258 tunePMuonBestTrack_.clear();
259 bool alreadyEmbedded =
false;
260 embeddedTunePMuonBestTrack_ =
false;
262 switch (tunePMuonBestTrackType()) {
263 case None: alreadyEmbedded =
true;
break;
264 case InnerTrack:
if (embeddedTrack_) alreadyEmbedded =
true;
break;
265 case OuterTrack:
if (embeddedStandAloneMuon_) alreadyEmbedded =
true;
break;
266 case CombinedTrack:
if (embeddedCombinedMuon_) alreadyEmbedded =
true;
break;
267 case TPFMS:
if (embeddedTpfmsMuon_) alreadyEmbedded =
true;
break;
268 case Picky:
if (embeddedPickyMuon_) alreadyEmbedded =
true;
break;
269 case DYT:
if (embeddedDytMuon_) alreadyEmbedded =
true;
break;
271 if (muonBestTrackType() == tunePMuonBestTrackType()) {
272 if (embeddedMuonBestTrack_) alreadyEmbedded =
true;
275 if (force || !alreadyEmbedded) {
277 embeddedTunePMuonBestTrack_ =
true;
283 void Muon::embedTrack() {
287 embeddedTrack_ =
true;
293 void Muon::embedStandAloneMuon() {
294 standAloneMuon_.clear();
297 embeddedStandAloneMuon_ =
true;
303 void Muon::embedCombinedMuon() {
304 combinedMuon_.clear();
307 embeddedCombinedMuon_ =
true;
313 caloMETMuonCorrs_.clear();
314 caloMETMuonCorrs_.push_back(t);
315 embeddedCaloMETMuonCorrs_ =
true;
320 tcMETMuonCorrs_.clear();
321 tcMETMuonCorrs_.push_back(t);
322 embeddedTCMETMuonCorrs_ =
true;
326 void Muon::embedPickyMuon() {
330 pickyMuon_.push_back(*tk);
331 embeddedPickyMuon_ =
true;
336 void Muon::embedTpfmsMuon() {
340 tpfmsMuon_.push_back(*tk);
341 embeddedTpfmsMuon_ =
true;
346 void Muon::embedDytMuon() {
350 dytMuon_.push_back(*tk);
351 embeddedDytMuon_ =
true;
356 void Muon::embedPFCandidate() {
358 if ( pfCandidateRef_.isAvailable() && pfCandidateRef_.isNonnull()) {
360 embeddedPFCandidate_ =
true;
374 double Muon::normChi2()
const {
375 if ( cachedNormChi2_ ) {
379 return t->chi2() / t->ndof();
387 unsigned int Muon::numberOfValidHits()
const {
388 if ( cachedNumberOfValidHits_ ) {
389 return numberOfValidHits_;
392 return t->numberOfValidHits();
398 double Muon::dB(IpType type_)
const {
400 if ( cachedIP_ & (1 <<
int(type_))) {
410 double Muon::edB(IpType type_)
const {
412 if ( cachedIP_ & (1 <<
int(type_))) {
bool isNonnull() const
Checks for non-null.
Ptr< typename C::value_type > refToPtr(Ref< C, typename C::value_type, refhelper::FindUsingAdvance< C, typename C::value_type > > const &ref)
virtual TrackRef innerTrack() const
reco::PFCandidatePtr pfCandidate_
virtual TrackRef tpfmsTrack() const
virtual double eta() const
momentum pseudorapidity
virtual double pt() const
transverse momentum
bool isLooseMuon(const reco::Muon &)
SelectionType
Selector type.
bool isSoftMuon(const reco::Muon &, const reco::Vertex &)
virtual double energy() const
energy
virtual TrackRef muonBestTrack() const
Muon()
default constructor
std::ostream & operator<<(std::ostream &, BeamSpot beam)
ArbitrationType
define arbitration schemes
Analysis-level lepton class.
virtual CandidatePtr sourceCandidatePtr(size_type i) const
virtual TrackRef pickyTrack() const
float segmentCompatibility(const reco::Muon &muon, reco::Muon::ArbitrationType arbitrationType=reco::Muon::SegmentAndTrackArbitration)
edm::Ref< PFCandidateCollection > PFCandidateRef
persistent reference to a PFCandidate
virtual TrackRef outerTrack() const
reference to Track reconstructed in the muon detector only
bool isGoodMuon(const reco::Muon &muon, SelectionType type, reco::Muon::ArbitrationType arbitrationType=reco::Muon::SegmentAndTrackArbitration)
main GoodMuon wrapper call
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)
edm::Ref< TrackCollection > TrackRef
persistent reference to a Track
virtual TrackRef dytTrack() const
virtual TrackRef tunePMuonBestTrack() const
volatile std::atomic< bool > shutdown_flag false
bool isTightMuon(const reco::Muon &, const reco::Vertex &)
virtual double phi() const
momentum azimuthal angle
Analysis-level muon class.
virtual TrackRef globalTrack() const
reference to Track reconstructed in both tracked and muon detector