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_(0),
36 initImpactParameters();
42 embeddedMuonBestTrack_(
false),
43 embeddedTunePMuonBestTrack_(
false),
44 embeddedTrack_(
false),
45 embeddedStandAloneMuon_(
false),
46 embeddedCombinedMuon_(
false),
47 embeddedTCMETMuonCorrs_(
false),
48 embeddedCaloMETMuonCorrs_(
false),
49 embeddedPickyMuon_(
false),
50 embeddedTpfmsMuon_(
false),
51 embeddedDytMuon_(
false),
52 embeddedPFCandidate_(
false),
54 cachedNormChi2_(
false),
56 cachedNumberOfValidHits_(0),
62 initImpactParameters();
68 embeddedMuonBestTrack_(
false),
69 embeddedTunePMuonBestTrack_(
false),
70 embeddedTrack_(
false),
71 embeddedStandAloneMuon_(
false),
72 embeddedCombinedMuon_(
false),
73 embeddedTCMETMuonCorrs_(
false),
74 embeddedCaloMETMuonCorrs_(
false),
75 embeddedPickyMuon_(
false),
76 embeddedTpfmsMuon_(
false),
77 embeddedDytMuon_(
false),
78 embeddedPFCandidate_(
false),
80 cachedNormChi2_(
false),
82 cachedNumberOfValidHits_(0),
88 initImpactParameters();
94 embeddedMuonBestTrack_(
false),
95 embeddedTunePMuonBestTrack_(
false),
96 embeddedTrack_(
false),
97 embeddedStandAloneMuon_(
false),
98 embeddedCombinedMuon_(
false),
99 embeddedTCMETMuonCorrs_(
false),
100 embeddedCaloMETMuonCorrs_(
false),
101 embeddedPickyMuon_(
false),
102 embeddedTpfmsMuon_(
false),
103 embeddedDytMuon_(
false),
104 embeddedPFCandidate_(
false),
106 cachedNormChi2_(
false),
108 cachedNumberOfValidHits_(0),
112 numberOfValidHits_(0)
114 initImpactParameters();
126 out <<
"\tpat::Muon: ";
127 out << std::setiosflags(std::ios::right);
128 out << std::setiosflags(std::ios::fixed);
129 out << std::setprecision(3);
130 out <<
" E/pT/eta/phi "
139 void Muon::initImpactParameters() {
140 for (
int i_ = 0; i_<5; ++i_){
143 cachedIP_.push_back(
false);
150 if (embeddedTrack_) {
160 if (embeddedStandAloneMuon_) {
170 if (embeddedCombinedMuon_) {
179 if (embeddedPickyMuon_) {
188 if (embeddedTpfmsMuon_) {
197 if (embeddedDytMuon_) {
206 if (!muonBestTrack_.empty()) {
215 if (!tunePMuonBestTrack_.empty()) {
217 }
else if (muonBestTrackType() == tunePMuonBestTrackType()) {
218 return muonBestTrack();
229 if (embeddedPFCandidate_) {
232 return pfCandidateRef_;
239 if(refToOrig_.isNonnull() && pfCandidateRef_.isNonnull() && i==1 )
return refToOrig_;
240 if(refToOrig_.isNonnull() && ! pfCandidateRef_.isNonnull() && i==0 )
return refToOrig_;
245 void Muon::embedMuonBestTrack(
bool force) {
246 muonBestTrack_.clear();
247 embeddedMuonBestTrack_ =
false;
248 bool alreadyEmbedded = force;
250 switch (muonBestTrackType()) {
251 case None: alreadyEmbedded =
true;
break;
252 case InnerTrack:
if (embeddedTrack_) alreadyEmbedded =
true;
break;
253 case OuterTrack:
if (embeddedStandAloneMuon_) alreadyEmbedded =
true;
break;
254 case CombinedTrack:
if (embeddedCombinedMuon_) alreadyEmbedded =
true;
break;
255 case TPFMS:
if (embeddedTpfmsMuon_) alreadyEmbedded =
true;
break;
256 case Picky:
if (embeddedPickyMuon_) alreadyEmbedded =
true;
break;
257 case DYT:
if (embeddedDytMuon_) alreadyEmbedded =
true;
break;
260 if (!alreadyEmbedded) {
262 embeddedMuonBestTrack_ =
true;
267 void Muon::embedTunePMuonBestTrack(
bool force) {
268 tunePMuonBestTrack_.clear();
269 bool alreadyEmbedded = force;
270 embeddedTunePMuonBestTrack_ =
false;
272 switch (muonBestTrackType()) {
273 case None: alreadyEmbedded =
true;
break;
274 case InnerTrack:
if (embeddedTrack_) alreadyEmbedded =
true;
break;
275 case OuterTrack:
if (embeddedStandAloneMuon_) alreadyEmbedded =
true;
break;
276 case CombinedTrack:
if (embeddedCombinedMuon_) alreadyEmbedded =
true;
break;
277 case TPFMS:
if (embeddedTpfmsMuon_) alreadyEmbedded =
true;
break;
278 case Picky:
if (embeddedPickyMuon_) alreadyEmbedded =
true;
break;
279 case DYT:
if (embeddedDytMuon_) alreadyEmbedded =
true;
break;
281 if (muonBestTrackType() == tunePMuonBestTrackType()) {
282 if (embeddedMuonBestTrack_) alreadyEmbedded =
true;
285 if (!alreadyEmbedded) {
287 embeddedTunePMuonBestTrack_ =
true;
293 void Muon::embedTrack() {
297 embeddedTrack_ =
true;
303 void Muon::embedStandAloneMuon() {
304 standAloneMuon_.clear();
307 embeddedStandAloneMuon_ =
true;
313 void Muon::embedCombinedMuon() {
314 combinedMuon_.clear();
317 embeddedCombinedMuon_ =
true;
323 caloMETMuonCorrs_.clear();
324 caloMETMuonCorrs_.push_back(t);
325 embeddedCaloMETMuonCorrs_ =
true;
330 tcMETMuonCorrs_.clear();
331 tcMETMuonCorrs_.push_back(t);
332 embeddedTCMETMuonCorrs_ =
true;
336 void Muon::embedPickyMuon() {
340 pickyMuon_.push_back(*tk);
341 embeddedPickyMuon_ =
true;
346 void Muon::embedTpfmsMuon() {
350 tpfmsMuon_.push_back(*tk);
351 embeddedTpfmsMuon_ =
true;
356 void Muon::embedDytMuon() {
360 dytMuon_.push_back(*tk);
361 embeddedDytMuon_ =
true;
366 void Muon::embedPFCandidate() {
368 if ( pfCandidateRef_.isAvailable() && pfCandidateRef_.isNonnull()) {
370 embeddedPFCandidate_ =
true;
384 double Muon::normChi2()
const {
385 if ( cachedNormChi2_ ) {
389 return t->chi2() / t->ndof();
397 unsigned int Muon::numberOfValidHits()
const {
398 if ( cachedNumberOfValidHits_ ) {
399 return numberOfValidHits_;
402 return t->numberOfValidHits();
410 double Muon::dB(IpType type_)
const {
423 else if ( cachedIP_[type_] ) {
435 double Muon::edB(IpType type_)
const {
448 else if ( cachedIP_[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 float pt() const
transverse momentum
virtual TrackRef innerTrack() const
virtual float phi() const
momentum azimuthal angle
reco::PFCandidatePtr pfCandidate_
virtual TrackRef tpfmsTrack() const
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)
virtual float eta() const
momentum pseudorapidity
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 &)
Analysis-level muon class.
virtual TrackRef globalTrack() const
reference to Track reconstructed in both tracked and muon detector