CMS 3D CMS Logo

DistanceToCell.cc
Go to the documentation of this file.
2 
6 
8 
10 {
11  det_= dist.det_;
13  pivot_= dist.pivot_;
14 }
15 
17 {
18  pivotPosition_ = (cell.det() == DetId::Hcal) ?
19  (static_cast<const HcalGeometry*>(det_))->getPosition(cell) :
20  det_->getGeometry(pivot_)->getPosition();
21 }
22 
23 bool DistanceToCell::operator() (const DetId & c1, const DetId & c2)
24 {
25  bool ok = (c1.det() == DetId::Hcal) ?
26  (((static_cast<const HcalGeometry*>(det_))->getPosition(c1)-pivotPosition_).mag2()<
27  ((static_cast<const HcalGeometry*>(det_))->getPosition(c2)-pivotPosition_).mag2()) :
28  ((det_->getGeometry(c1)->getPosition()-pivotPosition_).mag2()<
29  (det_->getGeometry(c2)->getPosition()-pivotPosition_).mag2());
30  return ok;
31 }
#define nullptr
T mag2() const
The vector magnitude squared. Equivalent to vec.dot(vec)
GlobalPoint pivotPosition_
Definition: DetId.h:18
virtual std::shared_ptr< const CaloCellGeometry > getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
const CaloSubdetectorGeometry * det_
bool operator()(const DetId &c1, const DetId &c2)
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:39