CMS 3D CMS Logo

Public Member Functions

CSCDetIdSameDetLayerComparator Class Reference

#include <CSCRangeMapAccessor.h>

List of all members.

Public Member Functions

bool operator() (CSCDetId i1, CSCDetId i2) const

Detailed Description

Definition at line 13 of file CSCRangeMapAccessor.h.


Member Function Documentation

bool CSCDetIdSameDetLayerComparator::operator() ( CSCDetId  i1,
CSCDetId  i2 
) const

Definition at line 31 of file CSCRangeMapAccessor.cc.

References abs, delta, CSCDetId::endcap(), CSCDetId::ring(), relativeConstraints::station, and CSCDetId::station().

                                                                              {
  bool station = false;
  if (i1.endcap() == i2.endcap() &&
      i1.station() == i2.station())
    station = true;

  // Same DetLayer for station 2,3 and 4
  if ((station) && (i1.station() != 1))
    return false;
  
  // Same DetLayer for station 1
  if ((station) && (i1.station() == 1)) {
  
    int delta = abs(i1.ring() - i2.ring());
    int sum = i1.ring() + i2.ring();
    
    // Same DetLayer: rings 1,4 or rings 2,3
    if ((delta == 0) || (sum == 5))
      return false;
  }

  return (i1<i2);
}