|
ATLAS Offline Software
|
Go to the documentation of this file.
10 #include "CLHEP/Geometry/Vector3D.h"
11 #include "CLHEP/Units/SystemOfUnits.h"
12 #include "CLHEP/Vector/ThreeVector.h"
22 const GeoVFullPhysVol* geophysvol,
25 TrkDetElementBase(geophysvol),
28 m_commonItems(commonItems),
30 m_geoAlignStore(geoAlignStore)
46 return m_cache.ptr()->m_transformCLHEP;
66 const HepGeom::Vector3D<double>&
70 return m_cache.ptr()->m_phiAxisCLHEP;
77 return m_cache.ptr()->m_phiAxis;
80 const HepGeom::Vector3D<double>&
84 return m_cache.ptr()->m_etaAxisCLHEP;
91 return m_cache.ptr()->m_etaAxis;
97 if (!m_axisDir.isValid()) updateCache();
100 if (!
dir.m_etaDirection) xEta = -xEta;
101 if (!
dir.m_phiDirection) xPhi = -xPhi;
108 double r = std::hypot(
x,
y);
109 double phi = std::atan2(
y,
x);
116 HepGeom::Point3D<double>
124 double xPhi = hitPosition[
m_hitPhi];
125 double xEta = hitPosition[
m_hitEta];
126 if (!
dir.m_depthDirection) xDepth = -xDepth;
127 if (!
dir.m_phiDirection) xPhi = -xPhi;
128 if (!
dir.m_etaDirection) xEta = -xEta;
129 return {xPhi, xEta, xDepth};
141 double& phiMax,
double& rz)
const
143 HepGeom::Point3D<double> corners[4];
148 double phiOffset = 0.;
150 for (
auto & corner : corners) {
151 double etaMinPoint = 0.;
152 double etaMaxPoint = 0.;
153 double phiPoint = 0.;
163 if (phiPoint < -0.5 *
M_PI) {
164 phiOffset = -0.5 *
M_PI;
165 }
else if (phiPoint > 0.5 *
M_PI) {
166 phiOffset = 0.5 *
M_PI;
172 phiPoint -= phiOffset;
174 if (phiPoint < -
M_PI) phiPoint += 2. *
M_PI;
175 if (phiPoint >
M_PI) phiPoint -= 2. *
M_PI;
205 double phiTol,
double etaTol)
const
260 if (!
m_id.
is_valid())
throw std::runtime_error(
"SolidStateDetectorElementBase: Invalid identifier");
263 m_surface = std::make_unique<Trk::PlaneSurface>(*
this);
291 geotrf.setIdentity();
310 cache.
m_origin = geoTransform * centerGeoModel;
334 bool setAxisDir =
false;
344 Amg::Vector3D globalDepthAxis(geoTransform.linear() * geoModelDepthAxis);
345 Amg::Vector3D globalPhiAxis(geoTransform.linear() * geoModelPhiAxis);
346 Amg::Vector3D globalEtaAxis(geoTransform.linear() * geoModelEtaAxis);
363 dir.m_barrelLike =
true;
365 if (std::abs(globalEtaAxis.dot(
nominalEta)) < 0.5) {
366 dir.m_barrelLike =
false;
369 if (
dir.m_barrelLike) {
371 nominalNormal = unitR;
373 nominalNormal(2) = -1.0;
382 dir.m_depthAngle = globalDepthAxis.dot(nominalNormal);
383 dir.m_depthDirection =
true;
384 if (
dir.m_depthAngle < 0) {
386 dir.m_depthDirection =
false;
392 ATH_MSG_ERROR(
"Orientation of local depth axis does not follow correct convention.");
393 dir.m_depthDirection =
true;
406 dir.m_phiAngle = globalPhiAxis.dot(nominalPhi);
407 dir.m_phiDirection =
true;
408 if (
dir.m_phiAngle < 0) {
410 dir.m_phiDirection =
false;
415 if (not isHGTD and std::abs(
dir.m_phiAngle) < 0.5) {
416 ATH_MSG_ERROR(
"Orientation of local xPhi axis does not follow correct convention.");
417 dir.m_phiDirection =
true;
424 dir.m_etaDirection =
true;
425 if (
dir.m_etaAngle < 0) {
427 dir.m_etaDirection =
false;
432 if (not isHGTD and std::abs(
dir.m_etaAngle) < 0.5) {
433 ATH_MSG_ERROR(
"Orientation of local xEta axis does not follow correct convention.");
434 dir.m_etaDirection =
true;
452 double det =
t(0,0) * (
t(1,1)*
t(2,2) -
t(1,2)*
t(2,1)) -
453 t(0,1) * (
t(1,0)*
t(2,2) -
t(1,2)*
t(2,0)) +
454 t(0,2) * (
t(1,0)*
t(2,1) -
t(1,1)*
t(2,0));
456 ATH_MSG_DEBUG(
"Local frame is left-handed. (hitEtaDirection, hitPhiDirection, hitDepthDirection) = ("
457 <<
dir.m_etaDirection <<
", "
458 <<
dir.m_phiDirection <<
", "
459 <<
dir.m_depthDirection <<
")");
476 m_cache.set (std::move (cache));
486 double radialShift = sensorCenter[0];
488 HepGeom::Point3D<double> corners[4];
493 double phiOffset = 0.;
498 for (
auto & corner : corners) {
500 corner.transform(rShift);
506 double rPoint = globalPoint.perp();
507 double zPoint = globalPoint.z();
508 double phiPoint = globalPoint.phi();
516 if (phiPoint < -0.5 *
M_PI) {
517 phiOffset = -0.5 *
M_PI;
518 }
else if (phiPoint > 0.5 *
M_PI) {
519 phiOffset = 0.5 *
M_PI;
526 phiPoint -= phiOffset;
528 if (phiPoint < -
M_PI) phiPoint += 2. *
M_PI;
529 if (phiPoint >
M_PI) phiPoint -= 2. *
M_PI;
561 double tmpLength =
length();
564 corners[0][
distPhi] = -0.5 * tmpMinWidth;
565 corners[0][
distEta] = -0.5 * tmpLength;
569 corners[1][
distPhi] = 0.5 * tmpMinWidth;
570 corners[1][
distEta] = -0.5 * tmpLength;
574 corners[2][
distPhi] = 0.5 * tmpMaxWidth;
575 corners[2][
distEta] = 0.5 * tmpLength;
579 corners[3][
distPhi] = -0.5 * tmpMaxWidth;
580 corners[3][
distEta] = 0.5 * tmpLength;
595 double r = globalPoint.perp();
596 double z = globalPoint.z();
598 double thetaMin = std::atan2(
r,(
z +
deltaZ));
600 double thetaMax = std::atan2(
r,(
z -
deltaZ));
603 phi = globalPoint.phi();
623 static const HepGeom::Vector3D<double> localAxes[3] = {
624 HepGeom::Vector3D<double>(1., 0., 0.),
625 HepGeom::Vector3D<double>(0., 1., 0.),
626 HepGeom::Vector3D<double>(0., 0., 1.)
630 int signPhi =
dir.m_phiDirection? +1:-1;
631 int signEta =
dir.m_etaDirection? +1:-1;
636 HepGeom::Point3D<double>(0., 0., 0.),
HepGeom::Point3D< double > hitLocalToLocal3D(const HepGeom::Point3D< double > &hitPosition) const
Same as previuos method but 3D.
Identifier identifierOfPosition(const Amg::Vector2D &localPos) const
Full identifier of the cell for a given position: assumes a raw local position (no Lorentz shift)
Ensure that the extensions for the Vector3D are properly loaded.
const HepGeom::Transform3D & transformCLHEP() const
Local (reconstruction frame) to global transform.
virtual ~SolidStateDetectorElementBase()
Destructor.
bool depthSymmetric() const
SiCellId connectedCell(const SiCellId cellId, int number) const
Get the cell ids sharing the readout for this cell.
SiCellId cellIdOfPosition(const Amg::Vector2D &localPos) const
As in previous method but returns SiCellId.
bool etaSymmetric() const
void getExtent(CachedVals &cache) const
Calculate extent in r,z and phi.
void getCorners(HepGeom::Point3D< double > *corners) const
Return the four corners of an element in local coordinates.
virtual const Amg::Transform3D moduleShift() const
virtual Amg::Vector3D sensorCenter() const
Return the centre of a sensor in the local reference frame.
SiIntersect inDetector(const Amg::Vector2D &localPosition, double phiTol, double etaTol) const
Test that it is in the active region.
Eigen::Matrix< double, 2, 1 > Vector2D
const HepGeom::Vector3D< double > & phiAxisCLHEP() const
To determine if readout direction between online and offline needs swapping, see methods swapPhiReado...
virtual SiLocalPosition localPositionOfCell(const SiCellId &cellId) const =0
readout or diode id -> position.
const Amg::Vector3D & etaAxis() const
SolidStateDetectorElementBase()=delete
Don't allow no-argument constructor.
const GeoAlignmentStore * m_geoAlignStore
virtual SiCellId connectedCell(const SiReadoutCellId &readoutId, int number) const =0
readout id -> id of connected diodes.
virtual const GeoTrf::Transform3D * getDefAbsPosition(const GeoNodePositioning *fullPhysVol) const override final
: Returns the nominal position of the full phyiscal volume.
void getEtaPhiRegion(double deltaZ, double &etaMin, double &etaMax, double &phiMin, double &phiMax, double &rz) const
Method for building up region of interest table.
bool is_valid() const
Check if id is in a valid state.
virtual int numberOfConnectedCells(const SiReadoutCellId &readoutId) const =0
number of connected cells.
const AtlasDetectorID * getIdHelper() const
Returns the id helper (inline)
Axis depthAxis() const
local axis corresponding to depth direction:
CxxUtils::CachedValue< CachedVals > m_cache
std::unique_ptr< Trk::Surface > m_surface
virtual SiReadoutCellId readoutIdOfCell(const SiCellId &cellId) const =0
diode id -> readout id NB assignment of a SiReadoutCellId to a SiCellId is allowed so you are can pas...
virtual Identifier identifierFromCellId(const SiCellId &cellId) const =0
Identifier <-> SiCellId (ie strip number or pixel eta_index,phi_index) Identifier from SiCellId (ie s...
void getEtaPhiPoint(const HepGeom::Point3D< double > &point, double deltaZ, double &etaMin, double &etaMax, double &phi) const
Get eta and phi coresponding to a point in local coordinates.
const DetectorDesign * m_design
local description of this detector element
const Amg::Transform3D defTransform() const
const HepGeom::Transform3D recoToHitTransform() const
Transform to go from local reconstruction frame to local hit frame.
int numberOfConnectedCells(const SiCellId cellId) const
Test if readout cell has more than one diode associated with it.
virtual SiIntersect inDetector(const SiLocalPosition &localPosition, double phiTol, double etaTol) const
Test if point is in the active part of the detector with specified tolerances.
@ distEta
readout for silicon
void commonConstructor()
Common code for constructors.
virtual double get_rz() const =0
virtual void updateCache() const
Recalculate cached values.
Eigen::Affine3d Transform3D
HepGeom::Vector3D< double > m_phiAxisCLHEP
virtual DetectorType type() const
Type of element.
virtual const Trk::SurfaceBounds & bounds() const override final
Return the boundaries of the element.
Amg::Vector2D hitLocalToLocal(double xEta, double xPhi) const
Simulation/Hit local frame to reconstruction local frame.
HepGeom::Vector3D< double > m_centerCLHEP
HepGeom::Transform3D m_transformCLHEP
virtual const Trk::SurfaceBounds & bounds() const =0
Element boundary.
Axis phiAxis() const
local axis corresponding to phi direction:
DetectorDesign::Axis m_hitDepth
DetectorDesign::Axis m_hitEta
Axes.
DetectorDesign::Axis m_hitPhi
Eigen::Matrix< double, 3, 1 > Vector3D
HepGeom::Vector3D< double > m_etaAxisCLHEP
virtual SiCellId cellIdOfPosition(const SiLocalPosition &localPos) const =0
position -> id
Identifier m_id
identifier of this detector element
Amg::Vector2D rawLocalPositionOfCell(const SiCellId &cellId) const
Returns position (center) of cell.
Amg::Transform3D m_transform
double minWidth() const
Min width.
Amg::Transform3D CLHEPTransformToEigen(const HepGeom::Transform3D &CLHEPtransf)
Converts a CLHEP-based HepGeom::Transform3D into an Eigen Amg::Transform3D.
HepGeom::Point3D< double > globalPosition(const HepGeom::Point3D< double > &localPos) const
transform a reconstruction local position into a global position (inline):
const HepGeom::Transform3D defTransformCLHEP() const
Default Local (reconstruction frame) to global transform ie with no misalignment.
const Amg::Vector3D & phiAxis() const
bool phiSymmetric() const
HepGeom::Transform3D EigenTransformToCLHEP(const Amg::Transform3D &eigenTransf)
Converts an Eigen-based Amg::Transform3D into a CLHEP-based HepGeom::Transform3D.
const HepGeom::Vector3D< double > & etaAxisCLHEP() const
Get reconstruction local eta axes in global frame.
Amg::Vector2D localPosition(const HepGeom::Point3D< double > &globalPosition) const
transform a global position into a 2D local position (reconstruction frame) (inline)
double length() const
Length in eta direction (z - barrel, r - endcap)
Axis etaAxis() const
local axis corresponding to eta direction:
virtual const GeoTrf::Transform3D * getAbsPosition(const GeoNodePositioning *fullPhysVol) const override final
: Returns the aligned transform associated with the full physical volume.
virtual SiCellId cellIdFromIdentifier(const Identifier &identifier) const =0
SiCellId from Identifier.
bool is_hgtd(Identifier id) const
CxxUtils::CachedValue< AxisDir > m_axisDir
Amg::Transform3D m_transformHit
double maxWidth() const
Max width.