CMS 3D CMS Logo

CMSSW_4_4_3_patch1/src/DataFormats/CSCRecHit/src/CSCRangeMapAccessor.cc

Go to the documentation of this file.
00001 
00007 #include "DataFormats/CSCRecHit/interface/CSCRangeMapAccessor.h"
00008 #include <cstdlib>
00009 
00010 CSCRangeMapAccessor::CSCRangeMapAccessor() {}
00011 
00012 CSCRangeMapAccessor::~CSCRangeMapAccessor() {}
00013 
00014 std::pair<CSCDetId,CSCDetIdSameChamberComparator> CSCRangeMapAccessor::cscChamber(CSCDetId id) {
00015   
00016   return std::make_pair(id, CSCDetIdSameChamberComparator());
00017 }
00018 
00019 std::pair<CSCDetId,CSCDetIdSameDetLayerComparator> CSCRangeMapAccessor::cscDetLayer(CSCDetId id) {
00020   
00021   return std::make_pair(id, CSCDetIdSameDetLayerComparator());
00022 }
00023 
00024 bool CSCDetIdSameChamberComparator::operator()(CSCDetId i1, CSCDetId i2) const {
00025   if (i1.chamberId() == i2.chamberId())
00026     return false;
00027 
00028   return (i1<i2);
00029 }
00030 
00031 bool CSCDetIdSameDetLayerComparator::operator()(CSCDetId i1, CSCDetId i2) const {
00032   bool station = false;
00033   if (i1.endcap() == i2.endcap() &&
00034       i1.station() == i2.station())
00035     station = true;
00036 
00037   // Same DetLayer for station 2,3 and 4
00038   if ((station) && (i1.station() != 1))
00039     return false;
00040   
00041   // Same DetLayer for station 1
00042   if ((station) && (i1.station() == 1)) {
00043   
00044     int delta = abs(i1.ring() - i2.ring());
00045     int sum = i1.ring() + i2.ring();
00046     
00047     // Same DetLayer: rings 1,4 or rings 2,3
00048     if ((delta == 0) || (sum == 5))
00049       return false;
00050   }
00051 
00052   return (i1<i2);
00053 }
00054 
00055 
00056 
00057 
00058 
00059 
00060