CMS 3D CMS Logo

Public Member Functions

HitComparatorByRadius Class Reference

List of all members.

Public Member Functions

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

Detailed Description

Definition at line 17 of file TrackCleaner.cc.


Member Function Documentation

bool HitComparatorByRadius::operator() ( const TrackingRecHit a,
const TrackingRecHit b 
) const [inline]

Definition at line 20 of file TrackCleaner.cc.

References PXFDetId::disk(), TrackingRecHit::geographicalId(), PXBDetId::ladder(), PXBDetId::layer(), p1, p2, PXFDetId::panel(), PixelSubdetector::PixelBarrel, diffTwoXMLs::r1, diffTwoXMLs::r2, and DetId::subdetId().

  {
    DetId i1 = a->geographicalId();
    DetId i2 = b->geographicalId();

    bool isBarrel = (i1.subdetId() == int(PixelSubdetector::PixelBarrel));

    if(i1.subdetId() != i2.subdetId())
    {
      return isBarrel;
    }
    else
    {
      if(isBarrel)
      {
        PXBDetId p1(i1);
        PXBDetId p2(i2);

        int r1 = (p1.layer() - 1)*2 + (p1.ladder() - 1)%2;
        int r2 = (p2.layer() - 1)*2 + (p2.ladder() - 1)%2;

        return (r1 < r2);
      }
      else
      {
        PXFDetId p1(i1);
        PXFDetId p2(i2);

        int r1 = (p1.disk() - 1)*2 + (p1.panel() - 1)%2;
        int r2 = (p2.disk() - 1)*2 + (p2.panel() - 1)%2;

        return (r1 < r2);
      }
    }
  }