CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions
RecHitComparatorByPosition Class Reference

#include <RecHitComparatorByPosition.h>

Public Member Functions

bool equals (const TrackingRecHit *a, const TrackingRecHit *b) const
 
bool operator() (const TrackingRecHit *a, const TrackingRecHit *b) const
 

Detailed Description

Definition at line 4 of file RecHitComparatorByPosition.h.

Member Function Documentation

bool RecHitComparatorByPosition::equals ( const TrackingRecHit a,
const TrackingRecHit b 
) const

Definition at line 11 of file RecHitComparatorByPosition.cc.

References TrackingRecHit::geographicalId(), TrackingRecHit::isValid(), TrackingRecHit::localPosition(), PV3DBase< T, PVType, FrameType >::x(), and PV3DBase< T, PVType, FrameType >::y().

Referenced by SeedCleanerByHitPosition::good(), and CachingSeedCleanerByHitPosition::good().

11  {
12  float xcut = 0.01;
13  float ycut = 0.2;
14  if (a->geographicalId() != b->geographicalId()) return false;
15  if (a->isValid() && b->isValid()) {
16  if (fabs(a->localPosition().x() - b->localPosition().x()) >= xcut) return false;
17  return (fabs(a->localPosition().y() - b->localPosition().y()) < ycut);
18  } else if (!a->isValid() && !b->isValid()) {
19  return true;
20  } else return false;
21 }
T y() const
Definition: PV3DBase.h:62
bool isValid() const
DetId geographicalId() const
T x() const
Definition: PV3DBase.h:61
virtual LocalPoint localPosition() const =0
bool RecHitComparatorByPosition::operator() ( const TrackingRecHit a,
const TrackingRecHit b 
) const

Definition at line 2 of file RecHitComparatorByPosition.cc.

References TrackingRecHit::geographicalId(), TrackingRecHit::localPosition(), PV3DBase< T, PVType, FrameType >::x(), and PV3DBase< T, PVType, FrameType >::y().

2  {
3  float xcut = 0.01;
4  float ycut = 0.2;
5  if (a->geographicalId()<b->geographicalId()) return true;
6  if (b->geographicalId()<a->geographicalId()) return false;
7  if (a->localPosition().x() < b->localPosition().x() - xcut) return true;
8  if (b->localPosition().x() < a->localPosition().x() - xcut) return false;
9  return (a->localPosition().y() < b->localPosition().y() - ycut );
10  }
T y() const
Definition: PV3DBase.h:62
DetId geographicalId() const
T x() const
Definition: PV3DBase.h:61
virtual LocalPoint localPosition() const =0