CMS 3D CMS Logo

Public Member Functions | Private Member Functions

HitComparator Class Reference

List of all members.

Public Member Functions

bool operator() (const TrackingRecHit *a, const TrackingRecHit *b) const
bool operator() (const TransientTrackingRecHit *ta, const TransientTrackingRecHit *tb) const

Private Member Functions

int getId (const TrackingRecHit *a) const
bool less (const SiStripMatchedRecHit2D *a, const SiStripMatchedRecHit2D *b) const
bool less (const SiStripRecHit2D *a, const SiStripRecHit2D *b) const
bool less (const SiPixelRecHit *a, const SiPixelRecHit *b) const

Detailed Description

Definition at line 58 of file TrackCleaner.cc.


Member Function Documentation

int HitComparator::getId ( const TrackingRecHit a) const [inline, private]

Definition at line 95 of file TrajectoryCleanerMerger.cc.

    {
      if(dynamic_cast<const SiPixelRecHit*>(a)            != 0) return 0;
      if(dynamic_cast<const SiStripRecHit2D*>(a)          != 0) return 1;
      if(dynamic_cast<const SiStripMatchedRecHit2D*>(a)   != 0) return 2;
      if(dynamic_cast<const ProjectedSiStripRecHit2D*>(a) != 0) return 3;
      return -1;
    }
bool HitComparator::less ( const SiPixelRecHit a,
const SiPixelRecHit b 
) const [inline, private]

Definition at line 104 of file TrajectoryCleanerMerger.cc.

    {
//std::cerr << " comp pixel" << std::endl;
      return a->cluster() < b->cluster();
    }
bool HitComparator::less ( const SiStripRecHit2D *  a,
const SiStripRecHit2D *  b 
) const [inline, private]

Definition at line 111 of file TrajectoryCleanerMerger.cc.

    {
//std::cerr << " comp strip" << std::endl;
      return a->cluster() < b->cluster();
    }
bool HitComparator::less ( const SiStripMatchedRecHit2D *  a,
const SiStripMatchedRecHit2D *  b 
) const [inline, private]

Definition at line 118 of file TrajectoryCleanerMerger.cc.

    {
//std::cerr << " comp matched strip" << std::endl;
      if(a->monoClusterRef() < b->monoClusterRef()) return true;
      if(b->monoClusterRef() < a->monoClusterRef()) return false;
      if(a->stereoClusterRef() < b->stereoClusterRef()) return true;
      return false;
    }
bool HitComparator::operator() ( const TransientTrackingRecHit ta,
const TransientTrackingRecHit tb 
) const [inline]

Definition at line 33 of file TrajectoryCleanerMerger.cc.

References a, b, TrackingRecHit::geographicalId(), getId(), TransientTrackingRecHit::hit(), and ProjectedSiStripRecHit2D::originalHit().

    {
      const TrackingRecHit* a = ta->hit();
      const TrackingRecHit* b = tb->hit();

      if(getId(a) < getId(b)) return true;
      if(getId(b) < getId(a)) return false;

      if(a->geographicalId() < b->geographicalId()) return true;
      if(b->geographicalId() < a->geographicalId()) return false;

      const SiPixelRecHit* a_ = dynamic_cast<const SiPixelRecHit*>(a);
      if(a_ != 0)
      {
        const SiPixelRecHit* b_ = dynamic_cast<const SiPixelRecHit*>(b);
        return less(a_, b_);
      }
      else
      {
        const SiStripMatchedRecHit2D* a_ =
          dynamic_cast<const SiStripMatchedRecHit2D*>(a);

        if(a_ != 0)
        {
          const SiStripMatchedRecHit2D* b_ =
            dynamic_cast<const SiStripMatchedRecHit2D*>(b);
          return less(a_, b_);
        }
        else
        {
          const SiStripRecHit2D* a_ =
            dynamic_cast<const SiStripRecHit2D*>(a);

          if(a_ != 0)
          {
            const SiStripRecHit2D* b_ =
              dynamic_cast<const SiStripRecHit2D*>(b);
            return less(a_, b_);
          }
          else 
          {
            const ProjectedSiStripRecHit2D* a_ =
              dynamic_cast<const ProjectedSiStripRecHit2D*>(a); 

//std::cerr << " comp proj" << std::endl;

            if(a_ != 0)
            {
              const ProjectedSiStripRecHit2D* b_ =
                dynamic_cast<const ProjectedSiStripRecHit2D*>(b);

              return less(&(a_->originalHit()), &(b_->originalHit()));
            }
            else
              return false;
          }
        }
      }
    }
bool HitComparator::operator() ( const TrackingRecHit a,
const TrackingRecHit b 
) const [inline]

Definition at line 61 of file TrackCleaner.cc.

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

  {
    if(a->geographicalId() < b->geographicalId()) return true;
    if(b->geographicalId() < a->geographicalId()) return false;

    if(a->localPosition().x() < b->localPosition().x() - 1e-5) return true;
    if(b->localPosition().x() < a->localPosition().x() - 1e-5) return false;

    if(a->localPosition().y() < b->localPosition().y() - 1e-5) return true;
    if(b->localPosition().y() < a->localPosition().y() - 1e-5) return false;

    return false;
  }