CMS 3D CMS Logo

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
 
 RecHitComparatorByPosition ()
 

Detailed Description

Definition at line 4 of file RecHitComparatorByPosition.h.

Constructor & Destructor Documentation

RecHitComparatorByPosition::RecHitComparatorByPosition ( )
inline

Definition at line 6 of file RecHitComparatorByPosition.h.

References a, b, equals(), and operator()().

6 {}

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 RecHitComparatorByPosition().

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:63
virtual LocalPoint localPosition() const =0
bool isValid() const
DetId geographicalId() const
T x() const
Definition: PV3DBase.h:62
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().

Referenced by RecHitComparatorByPosition().

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:63
virtual LocalPoint localPosition() const =0
DetId geographicalId() const
T x() const
Definition: PV3DBase.h:62