File indexing completed on 2024-04-06 12:31:42
0001 #include "TrackingTools/TransientTrackingRecHit/interface/RecHitComparatorByPosition.h"
0002 bool RecHitComparatorByPosition::operator()(const TrackingRecHit* a, const TrackingRecHit* b) const {
0003 float xcut = 0.01;
0004 float ycut = 0.2;
0005 if (a->geographicalId() < b->geographicalId())
0006 return true;
0007 if (b->geographicalId() < a->geographicalId())
0008 return false;
0009 if (a->localPosition().x() < b->localPosition().x() - xcut)
0010 return true;
0011 if (b->localPosition().x() < a->localPosition().x() - xcut)
0012 return false;
0013 return (a->localPosition().y() < b->localPosition().y() - ycut);
0014 }
0015 bool RecHitComparatorByPosition::equals(const TrackingRecHit* a, const TrackingRecHit* b) const {
0016 float xcut = 0.01;
0017 float ycut = 0.2;
0018 if (a->geographicalId() != b->geographicalId())
0019 return false;
0020 if (a->isValid() && b->isValid()) {
0021 if (fabs(a->localPosition().x() - b->localPosition().x()) >= xcut)
0022 return false;
0023 return (fabs(a->localPosition().y() - b->localPosition().y()) < ycut);
0024 } else if (!a->isValid() && !b->isValid()) {
0025 return true;
0026 } else
0027 return false;
0028 }