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 DistanceToCell &)
 
 DistanceToCell (const CaloSubdetectorGeometry *det, const DetId &cell)
 
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::DistanceToCell ( )

Definition at line 7 of file DistanceToCell.cc.

7 :det_(nullptr) {;}
const CaloSubdetectorGeometry * det_
DistanceToCell::DistanceToCell ( const DistanceToCell dist)

Definition at line 9 of file DistanceToCell.cc.

References det_, pivot_, and pivotPosition_.

10 {
11  det_= dist.det_;
13  pivot_= dist.pivot_;
14 }
GlobalPoint pivotPosition_
const CaloSubdetectorGeometry * det_
DistanceToCell::DistanceToCell ( const CaloSubdetectorGeometry det,
const DetId cell 
)

Definition at line 16 of file DistanceToCell.cc.

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

16  :det_(det),pivot_(cell)
17 {
18  pivotPosition_ = (cell.det() == DetId::Hcal) ?
19  (static_cast<const HcalGeometry*>(det_))->getPosition(cell) :
20  det_->getGeometry(pivot_)->getPosition();
21 }
GlobalPoint pivotPosition_
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_
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:39
DistanceToCell::~DistanceToCell ( )
inline

Definition at line 17 of file DistanceToCell.h.

References alignmentValidation::c1, and operator()().

17 {;}

Member Function Documentation

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

Definition at line 23 of file DistanceToCell.cc.

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

Referenced by ~DistanceToCell().

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 }
T mag2() const
The vector magnitude squared. Equivalent to vec.dot(vec)
GlobalPoint pivotPosition_
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_
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:39

Member Data Documentation

const CaloSubdetectorGeometry* DistanceToCell::det_
private

Definition at line 21 of file DistanceToCell.h.

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

DetId DistanceToCell::pivot_
private

Definition at line 22 of file DistanceToCell.h.

Referenced by DistanceToCell().

GlobalPoint DistanceToCell::pivotPosition_
private

Definition at line 23 of file DistanceToCell.h.

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