Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DTSegmentCand: Fix ambiguous-reversed-operator warning by using const operator #45491

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions RecoLocalMuon/DTSegment/src/DTSegmentCand.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ DTSegmentCand::DTSegmentCand(const AssPointCont& hits,
DTSegmentCand::~DTSegmentCand() {}

/* Operations */
bool DTSegmentCand::operator==(const DTSegmentCand& seg) {
bool DTSegmentCand::operator==(const DTSegmentCand& seg) const {
static const double epsilon = 0.00001;
if (nHits() != seg.nHits())
return false;
Expand All @@ -49,7 +49,7 @@ bool DTSegmentCand::operator==(const DTSegmentCand& seg) {
return true;
}

bool DTSegmentCand::operator<(const DTSegmentCand& seg) {
bool DTSegmentCand::operator<(const DTSegmentCand& seg) const {
if (nHits() == seg.nHits())
return (chi2() > seg.chi2());
return (nHits() < seg.nHits());
Expand Down
4 changes: 2 additions & 2 deletions RecoLocalMuon/DTSegment/src/DTSegmentCand.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ class DTSegmentCand {
virtual double t0() const { return thet0; }

/// equality operator based on position, direction, chi2 and nHits
virtual bool operator==(const DTSegmentCand& seg);
virtual bool operator==(const DTSegmentCand& seg) const;

/// less operator based on nHits and chi2
virtual bool operator<(const DTSegmentCand& seg);
virtual bool operator<(const DTSegmentCand& seg) const;

/// the super layer on which relies
const DTSuperLayer* superLayer() const { return theSL; }
Expand Down