CMS 3D CMS Logo

DistanceToCell.cc
Go to the documentation of this file.
2 
6 
7 DistanceToCell::DistanceToCell() : det_(nullptr) { ; }
8 
10  det_ = dist.det_;
12  pivot_ = dist.pivot_;
13 }
14 
15 DistanceToCell::DistanceToCell(const CaloSubdetectorGeometry* det, const DetId& cell) : det_(det), pivot_(cell) {
16  pivotPosition_ = (cell.det() == DetId::Hcal) ? (static_cast<const HcalGeometry*>(det_))->getPosition(cell)
17  : det_->getGeometry(pivot_)->getPosition();
18 }
19 
20 bool DistanceToCell::operator()(const DetId& c1, const DetId& c2) {
21  bool ok = (c1.det() == DetId::Hcal)
22  ? (((static_cast<const HcalGeometry*>(det_))->getPosition(c1) - pivotPosition_).mag2() <
23  ((static_cast<const HcalGeometry*>(det_))->getPosition(c2) - pivotPosition_).mag2())
24  : ((det_->getGeometry(c1)->getPosition() - pivotPosition_).mag2() <
25  (det_->getGeometry(c2)->getPosition() - pivotPosition_).mag2());
26  return ok;
27 }
DistanceToCell::pivot_
DetId pivot_
Definition: DistanceToCell.h:21
DetId::det
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:46
DetId::Hcal
Definition: DetId.h:28
DistanceToCell
Definition: DistanceToCell.h:11
convertSQLiteXML.ok
bool ok
Definition: convertSQLiteXML.py:98
HcalGeometry.h
DistanceToCell::pivotPosition_
GlobalPoint pivotPosition_
Definition: DistanceToCell.h:22
DetId
Definition: DetId.h:17
DistanceToCell::DistanceToCell
DistanceToCell()
Definition: DistanceToCell.cc:7
CaloSubdetectorGeometry.h
alignmentValidation.c1
c1
do drawing
Definition: alignmentValidation.py:1025
mag2
T mag2() const
The vector magnitude squared. Equivalent to vec.dot(vec)
Definition: Basic3DVectorLD.h:124
CaloSubdetectorGeometry::getGeometry
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.
Definition: CaloSubdetectorGeometry.cc:36
CaloCellGeometry.h
DistanceToCell::det_
const CaloSubdetectorGeometry * det_
Definition: DistanceToCell.h:20
CaloSubdetectorGeometry
Definition: CaloSubdetectorGeometry.h:22
DistanceToCell::operator()
bool operator()(const DetId &c1, const DetId &c2)
Definition: DistanceToCell.cc:20
DistanceToCell.h