CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_9_patch3/src/TrackingTools/TransientTrackingRecHit/src/RecHitComparatorByPosition.cc

Go to the documentation of this file.
00001 #include "TrackingTools/TransientTrackingRecHit/interface/RecHitComparatorByPosition.h"
00002 bool RecHitComparatorByPosition::operator() (const  TrackingRecHit* a, const TrackingRecHit* b) const  {
00003     float xcut = 0.01;
00004     float ycut = 0.2;
00005     if (a->geographicalId()<b->geographicalId()) return true;  
00006     if (b->geographicalId()<a->geographicalId()) return false;  
00007     if (a->localPosition().x() < b->localPosition().x() - xcut)  return true;
00008     if (b->localPosition().x() < a->localPosition().x() - xcut) return false;
00009     return (a->localPosition().y() < b->localPosition().y() - ycut );
00010   }
00011 bool RecHitComparatorByPosition::equals(const  TrackingRecHit* a, const TrackingRecHit* b) const  {
00012     float xcut = 0.01;
00013     float ycut = 0.2;
00014     if (a->geographicalId() != b->geographicalId()) return false; 
00015     if (a->isValid() && b->isValid()) {
00016         if (fabs(a->localPosition().x() - b->localPosition().x()) >=  xcut)  return false;
00017         return (fabs(a->localPosition().y() - b->localPosition().y()) <  ycut);
00018     } else if (!a->isValid() && !b->isValid()) {
00019         return true;
00020     } else return false;
00021 }