CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
DistanceToCell Class Reference

#include <DistanceToCell.h>

Public Member Functions

 DistanceToCell ()
 
 DistanceToCell (const CaloSubdetectorGeometry *det, const DetId &cell)
 
 DistanceToCell (const DistanceToCell &)
 
bool operator() (const DetId &c1, const DetId &c2)
 
 ~DistanceToCell ()
 

Private Attributes

const CaloSubdetectorGeometrydet_
 
DetId pivot_
 
GlobalPoint pivotPosition_
 

Detailed Description

Definition at line 11 of file DistanceToCell.h.

Constructor & Destructor Documentation

◆ DistanceToCell() [1/3]

DistanceToCell::DistanceToCell ( )

Definition at line 7 of file DistanceToCell.cc.

7 : det_(nullptr) { ; }

◆ DistanceToCell() [2/3]

DistanceToCell::DistanceToCell ( const DistanceToCell dist)

Definition at line 9 of file DistanceToCell.cc.

9  {
10  det_ = dist.det_;
12  pivot_ = dist.pivot_;
13 }

References det_, pivot_, and pivotPosition_.

◆ DistanceToCell() [3/3]

DistanceToCell::DistanceToCell ( const CaloSubdetectorGeometry det,
const DetId cell 
)

Definition at line 15 of file DistanceToCell.cc.

15  : det_(det), pivot_(cell) {
16  pivotPosition_ = (cell.det() == DetId::Hcal) ? (static_cast<const HcalGeometry*>(det_))->getPosition(cell)
17  : det_->getGeometry(pivot_)->getPosition();
18 }

References DetId::det(), det_, CaloSubdetectorGeometry::getGeometry(), DetId::Hcal, pivot_, and pivotPosition_.

◆ ~DistanceToCell()

DistanceToCell::~DistanceToCell ( )
inline

Definition at line 16 of file DistanceToCell.h.

16 { ; }

Member Function Documentation

◆ operator()()

bool DistanceToCell::operator() ( const DetId c1,
const DetId c2 
)

Definition at line 20 of file DistanceToCell.cc.

20  {
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 }

References alignmentValidation::c1, det_, CaloSubdetectorGeometry::getGeometry(), DetId::Hcal, mag2(), convertSQLiteXML::ok, and pivotPosition_.

Member Data Documentation

◆ det_

const CaloSubdetectorGeometry* DistanceToCell::det_
private

Definition at line 20 of file DistanceToCell.h.

Referenced by DistanceToCell(), and operator()().

◆ pivot_

DetId DistanceToCell::pivot_
private

Definition at line 21 of file DistanceToCell.h.

Referenced by DistanceToCell().

◆ pivotPosition_

GlobalPoint DistanceToCell::pivotPosition_
private

Definition at line 22 of file DistanceToCell.h.

Referenced by DistanceToCell(), and operator()().

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
convertSQLiteXML.ok
bool ok
Definition: convertSQLiteXML.py:98
DistanceToCell::pivotPosition_
GlobalPoint pivotPosition_
Definition: DistanceToCell.h:22
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
DistanceToCell::det_
const CaloSubdetectorGeometry * det_
Definition: DistanceToCell.h:20