CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch12/src/FastSimulation/CaloGeometryTools/src/DistanceToCell.cc

Go to the documentation of this file.
00001 #include "FastSimulation/CaloGeometryTools/interface/DistanceToCell.h"
00002 
00003 #include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h"
00004 #include "Geometry/CaloGeometry/interface/CaloCellGeometry.h"
00005 
00006 DistanceToCell::DistanceToCell():det_(0) {;}
00007 
00008 DistanceToCell::DistanceToCell(const DistanceToCell& dist)
00009 {
00010   det_= dist.det_;
00011   pivotPosition_ = dist.pivotPosition_;
00012   pivot_= dist.pivot_;
00013 }
00014 
00015 DistanceToCell::DistanceToCell(const CaloSubdetectorGeometry * det,const  DetId& cell):det_(det),pivot_(cell)
00016 {
00017   pivotPosition_ = det_->getGeometry(pivot_)->getPosition();
00018 }
00019 
00020 bool DistanceToCell::operator() (const DetId & c1, const DetId & c2)
00021 {
00022   return ((det_->getGeometry(c1)->getPosition()-pivotPosition_).mag2()<
00023           (det_->getGeometry(c2)->getPosition()-pivotPosition_).mag2());
00024 }