ATLAS Offline Software
Loading...
Searching...
No Matches
InDetDD::SolidStateDetectorElementBase Class Referenceabstract

Class to hold geometrical description of a solid state detector element. More...

#include <SolidStateDetectorElementBase.h>

Inheritance diagram for InDetDD::SolidStateDetectorElementBase:
Collaboration diagram for InDetDD::SolidStateDetectorElementBase:

Classes

struct  AxisDir
struct  CachedVals

Public Member Functions

 SolidStateDetectorElementBase (const Identifier &id, const DetectorDesign *design, const GeoVFullPhysVol *geophysvol, const SiCommonItems *commonItems, const GeoAlignmentStore *geoAlignStore=nullptr)
 Constructor with parameters.
virtual ~SolidStateDetectorElementBase ()
 Destructor.
 SolidStateDetectorElementBase ()=delete
 Don't allow no-argument constructor.
 SolidStateDetectorElementBase (const SolidStateDetectorElementBase &)=delete
 Don't allow copy constructor.
SolidStateDetectorElementBaseoperator= (const SolidStateDetectorElementBase &)=delete
 Don't allow assignment operator.
 SolidStateDetectorElementBase (SolidStateDetectorElementBase &&)=delete
 Don't allow move constructor.
SolidStateDetectorElementBaseoperator= (SolidStateDetectorElementBase &&)=delete
 Don't allow move assignment operator.
std::string detectorTypeString () const
 Returns a string of the Detector element type.
Cache handling

Methods to handle invalidating and updating caches.

The cached values include values that are affected by alignment

void invalidate ()
 Signal that cached values are no longer valid.
Common items

Inline method

const SiCommonItemsgetCommonItems () const
Identification

Methods to identify the element and identifier manipulation.

virtual Identifier identify () const override final
 identifier of this detector element (inline)
virtual IdentifierHash identifyHash () const override final
 identifier hash (inline)
const AtlasDetectorIDgetIdHelper () const
 Returns the id helper (inline)
virtual Identifier identifierFromCellId (const SiCellId &cellId) const =0
 Identifier <-> SiCellId (ie strip number or pixel eta_index,phi_index) Identifier from SiCellId (ie strip number or pixel eta_index,phi_index)
virtual SiCellId cellIdFromIdentifier (const Identifier &identifier) const =0
 SiCellId from Identifier.
Surface
Trk::Surfacesurface ()
 Element Surface.
virtual const Trk::Surfacesurface () const override final
 Return surface associated with this detector element.
virtual const Trk::Surfacesurface (const Identifier &) const override final
 TrkDetElementBase interface (inline)
Transformation
const GeoTrf::Transform3D & transformHit () const
 Local (simulation/hit frame) to global transform.
const HepGeom::Transform3D & transformCLHEP () const
 Local (reconstruction frame) to global transform.
virtual const Amg::Transform3Dtransform () const override final
 Return local to global transform.
virtual const Amg::Transform3Dtransform (const Identifier &) const override final
 TrkDetElementBase interface (inline)
const HepGeom::Transform3D defTransformCLHEP () const
 Default Local (reconstruction frame) to global transform ie with no misalignment.
const Amg::Transform3D defTransform () const
const HepGeom::Transform3D recoToHitTransform () const
 Transform to go from local reconstruction frame to local hit frame.
Orientation
double hitDepthDirection () const
 Directions of hit depth,phi,eta axes relative to reconstruction local position axes (LocalPosition).
double hitPhiDirection () const
 See previous method.
double hitEtaDirection () const
 See previous method.
const HepGeom::Vector3D< double > & phiAxisCLHEP () const
 To determine if readout direction between online and offline needs swapping, see methods swapPhiReadoutDirection() and swapEtaReadoutDirection() below in "Readout Cell id" section.
const Amg::Vector3DphiAxis () const
const HepGeom::Vector3D< double > & etaAxisCLHEP () const
 Get reconstruction local eta axes in global frame.
const Amg::Vector3DetaAxis () const
virtual const Amg::Vector3Dnormal () const override final
 Get reconstruction local normal axes in global frame.
virtual const Amg::Vector3Dnormal (const Identifier &) const override final
 TrkDetElementBase interface (inline)
Position
virtual const Amg::Vector3Dcenter () const override final
 Center in global coordinates.
virtual const Amg::Vector3Dcenter (const Identifier &) const override final
 TrkDetElementBase interface (inline)
virtual Trk::DetectorElemType detectorType () const override
 TrkDetElementBase interface detectorType.
HepGeom::Point3D< double > globalPositionHit (const HepGeom::Point3D< double > &simulationLocalPos) const
 transform a hit local position into a global position (inline):
Amg::Vector3D globalPositionHit (const Amg::Vector3D &simulationLocalPos) const
HepGeom::Point3D< double > globalPosition (const HepGeom::Point3D< double > &localPos) const
 transform a reconstruction local position into a global position (inline):
Amg::Vector3D globalPosition (const Amg::Vector3D &localPos) const
Amg::Vector3D globalPosition (const Amg::Vector2D &localPos) const
 as in previous method but for 2D local position (inline)
Amg::Vector2D hitLocalToLocal (double xEta, double xPhi) const
 Simulation/Hit local frame to reconstruction local frame.
HepGeom::Point3D< double > hitLocalToLocal3D (const HepGeom::Point3D< double > &hitPosition) const
 Same as previuos method but 3D.
Amg::Vector2D localPosition (const HepGeom::Point3D< double > &globalPosition) const
 transform a global position into a 2D local position (reconstruction frame) (inline)
Amg::Vector2D localPosition (const Amg::Vector3D &globalPosition) const
Element Extent

Inline methods to get extent of element in r,phi and z.

double rMin () const
double rMax () const
double zMin () const
double zMax () const
double phiMin () const
double phiMax () const
void getEtaPhiRegion (double deltaZ, double &etaMin, double &etaMax, double &phiMin, double &phiMax, double &rz) const
 Method for building up region of interest table.
virtual double get_rz () const =0
Design methods
virtual const DetectorDesigndesign () const
 access to the local description (inline):
virtual const Trk::SurfaceBoundsbounds () const override final
 Return the boundaries of the element.
virtual const Trk::SurfaceBoundsbounds (const Identifier &) const override final
 TrkDetElementBase interface (inline)
double width () const
 Methods from design (inline)
double minWidth () const
 Min width.
double maxWidth () const
 Max width.
double length () const
 Length in eta direction (z - barrel, r - endcap)
double thickness () const
double etaPitch () const
 Pitch (inline methods)
double phiPitch () const
InDetDD::CarrierType carrierType () const
 carrier type for readout.
bool swapPhiReadoutDirection () const
 Determine if readout direction between online and offline needs swapping.
bool swapEtaReadoutDirection () const
 For eta_index (only relevant for pixel) (inline)
Intersection Tests
SiIntersect inDetector (const Amg::Vector2D &localPosition, double phiTol, double etaTol) const
 Test that it is in the active region.
SiIntersect inDetector (const Amg::Vector3D &globalPosition, double phiTol, double etaTol) const
Readout cell id

Cell id's are the strip number in SCT and phi_index,eta_index in the pixel as defined in the offline identifier.

Their direction runs in the distPhi, distEta direction in the Reconstruction local frame.

For methods taking a SiCellId (basically phi,eta index for pixel or strip for SCT) you can do the following fro example:

  • For pixel
    localPositionOfCell(SiCellId(phi_index,eta_index));
  • For SCT
    localPositionOfCell(SiCellId(strip));
Identifier identifierOfPosition (const Amg::Vector2D &localPos) const
 Full identifier of the cell for a given position: assumes a raw local position (no Lorentz shift)
SiCellId cellIdOfPosition (const Amg::Vector2D &localPos) const
 As in previous method but returns SiCellId.
Amg::Vector2D rawLocalPositionOfCell (const SiCellId &cellId) const
 Returns position (center) of cell.
Amg::Vector2D rawLocalPositionOfCell (const Identifier &id) const
 As above.
int numberOfConnectedCells (const SiCellId cellId) const
 Test if readout cell has more than one diode associated with it.
SiCellId connectedCell (const SiCellId cellId, int number) const
 Get the cell ids sharing the readout for this cell.
virtual void updateCache () const
 Recalculate cached values.
bool depthDirection () const
 Return information on orientation.
bool etaDirection () const
bool phiDirection () const
double depthAngle () const
double etaAngle () const
double phiAngle () const

Protected Attributes

Variables set by constructor

Protected data:

Identifier m_id {}
 identifier of this detector element
const DetectorDesignm_design {nullptr}
 local description of this detector element
const SiCommonItemsm_commonItems {nullptr}
std::unique_ptr< Trk::Surfacem_surface
const GeoAlignmentStorem_geoAlignStore {}
DetectorDesign::Axis m_hitEta
 Axes.
DetectorDesign::Axis m_hitPhi
DetectorDesign::Axis m_hitDepth
Variables set by commonConstructor
IdentifierHash m_idHash {}
 hash id of this detector element
Variables set by updateCache and not invalidated.

Directions of axes.

These are true if the hit/simulation and reconstruction local frames are in the same direction and false if they are opposite.

CxxUtils::CachedValue< AxisDirm_axisDir
Variables set by updateCache
CxxUtils::CachedValue< CachedValsm_cache

Private Member Functions

Private Methods

Do not use locks.

void commonConstructor ()
 Common code for constructors.
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.
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.
MsgStream & msg (MSG::Level lvl) const
 Declaring the Message method for further use (inline)
bool msgLvl (MSG::Level lvl) const
 Declaring the Method providing Verbosity Level (inline)

Detailed Description

Class to hold geometrical description of a solid state detector element.

This base class is shared between the InnerDetetector/ITk/HGTD since there is a lot of commonality.

Coordinate Frames.

The following coordinate frames are used in these elements.

  • Global frame:
    Currently global frame in G4/GeoModel. Probably eventually will be global frame most suitable for reconstruction (eg solenoid axis).
  • Local hit frame:
    Local frame for hits. It is the same as local frame in G4 and GeoModel. I also refer to this as the local simulation frame. By convention elements are orientated such that:
  • hitDepth = local x
  • hitPhi = local y
  • hitEta = local z

Directions of these correspond to the physical wafer. Consequently hitDepth and hitPhi axes go in different directions depending on the orientation of the module. The readout side is determined from design()->readoutSide().

  • Local reconstruction frame:
  • distPhi = local x
  • distEta = local y
  • distDepth = local z

The directions of the axes are defined as

  • distPhi in direction of increasing phi
  • distEta in direction of increasing z in barrel and increasing r in endcap.
  • distDepth (normal) choosen to give right-handed coordinate. => away from intersection point for barrel, decreasing z for endcap
Overview of Methods

Methods are grouped into the the following categories

  • Identification
  • Navigation
  • Transformation/Orientation
  • Module Frame
  • Element Extent
  • Design methods
  • Intersection Tests
  • Lorentz Correction
  • Readout cell id
  • Miscellaneous
  • Cache handling.
Author
Grant Gorfine
  • modified & maintained: Nick Styles, Andreas Salzburger
  • modified Nigel Hessey: get directions from the design instead of hard-wiring them
Some notes on Thread safety for AthenaMT

The method updateCache of is of particular interest as it set all cache values.

The const methods call updateCache() when they need to perform lazy initialization

if (!m_cache.isValid()) updateCache();
virtual void updateCache() const
Recalculate cached values.

So as concurrent const operations are valid and do not race with each other.

The non-const methods can set the state of the cache or the cache itself (invalidate)

Note: Synchronisation of creating SiDetElements for different events and accessing for each events can be done via write/read handles or similar EventContext aware framework machinery.

Definition at line 132 of file SolidStateDetectorElementBase.h.

Constructor & Destructor Documentation

◆ SolidStateDetectorElementBase() [1/4]

InDetDD::SolidStateDetectorElementBase::SolidStateDetectorElementBase ( const Identifier & id,
const DetectorDesign * design,
const GeoVFullPhysVol * geophysvol,
const SiCommonItems * commonItems,
const GeoAlignmentStore * geoAlignStore = nullptr )

Constructor with parameters.

Definition at line 20 of file SolidStateDetectorElementBase.cxx.

24 :
25 TrkDetElementBase(geophysvol),
26 m_id(id),
28 m_commonItems(commonItems),
29 m_surface(),
30 m_geoAlignStore(geoAlignStore)
31 {
32 m_hitEta = m_design->etaAxis();
33 m_hitPhi = m_design->phiAxis();
34 m_hitDepth = m_design->depthAxis();
35
37 }
virtual const DetectorDesign & design() const
access to the local description (inline):
const DetectorDesign * m_design
local description of this detector element
void commonConstructor()
Common code for constructors.
Identifier m_id
identifier of this detector element
TrkDetElementBase(const GeoVFullPhysVol *fullPhysVol)
Constructor from GeoVFullPhysVolume.

◆ ~SolidStateDetectorElementBase()

InDetDD::SolidStateDetectorElementBase::~SolidStateDetectorElementBase ( )
virtualdefault

Destructor.

◆ SolidStateDetectorElementBase() [2/4]

InDetDD::SolidStateDetectorElementBase::SolidStateDetectorElementBase ( )
delete

Don't allow no-argument constructor.

◆ SolidStateDetectorElementBase() [3/4]

InDetDD::SolidStateDetectorElementBase::SolidStateDetectorElementBase ( const SolidStateDetectorElementBase & )
delete

Don't allow copy constructor.

◆ SolidStateDetectorElementBase() [4/4]

InDetDD::SolidStateDetectorElementBase::SolidStateDetectorElementBase ( SolidStateDetectorElementBase && )
delete

Don't allow move constructor.

Member Function Documentation

◆ bounds() [1/2]

const Trk::SurfaceBounds & InDetDD::SolidStateDetectorElementBase::bounds ( ) const
finaloverridevirtual

Return the boundaries of the element.

Implements Trk::TrkDetElementBase.

Definition at line 198 of file SolidStateDetectorElementBase.cxx.

199 {
200 return m_design->bounds();
201 }

◆ bounds() [2/2]

virtual const Trk::SurfaceBounds & InDetDD::SolidStateDetectorElementBase::bounds ( const Identifier & ) const
finaloverridevirtual

TrkDetElementBase interface (inline)

Implements Trk::TrkDetElementBase.

◆ carrierType()

InDetDD::CarrierType InDetDD::SolidStateDetectorElementBase::carrierType ( ) const

carrier type for readout.

ie holes for SCT and electrons for pixels. inline

◆ cellIdFromIdentifier()

virtual SiCellId InDetDD::SolidStateDetectorElementBase::cellIdFromIdentifier ( const Identifier & identifier) const
pure virtual

◆ cellIdOfPosition()

SiCellId InDetDD::SolidStateDetectorElementBase::cellIdOfPosition ( const Amg::Vector2D & localPos) const

As in previous method but returns SiCellId.

Definition at line 224 of file SolidStateDetectorElementBase.cxx.

225 {
226 return m_design->cellIdOfPosition(localPosition);
227 }
Amg::Vector2D localPosition(const HepGeom::Point3D< double > &globalPosition) const
transform a global position into a 2D local position (reconstruction frame) (inline)

◆ center() [1/2]

virtual const Amg::Vector3D & InDetDD::SolidStateDetectorElementBase::center ( ) const
finaloverridevirtual

Center in global coordinates.

Implements Trk::TrkDetElementBase.

◆ center() [2/2]

virtual const Amg::Vector3D & InDetDD::SolidStateDetectorElementBase::center ( const Identifier & ) const
finaloverridevirtual

TrkDetElementBase interface (inline)

Implements Trk::TrkDetElementBase.

◆ commonConstructor()

void InDetDD::SolidStateDetectorElementBase::commonConstructor ( )
private

Common code for constructors.

Definition at line 257 of file SolidStateDetectorElementBase.cxx.

258 {
259 //Do we need this at all in base class, or just in derived?
260 if (!m_id.is_valid()) throw std::runtime_error("SolidStateDetectorElementBase: Invalid identifier");
261
262 // Set surface
263 m_surface = std::make_unique<Trk::PlaneSurface>(*this);
264 }

◆ connectedCell()

SiCellId InDetDD::SolidStateDetectorElementBase::connectedCell ( const SiCellId cellId,
int number ) const

Get the cell ids sharing the readout for this cell.

number = 0 will return the primary readout cell id.

Definition at line 250 of file SolidStateDetectorElementBase.cxx.

251 {
252 SiReadoutCellId readoutId = m_design->readoutIdOfCell(cellId);
253 return m_design->connectedCell(readoutId, number);
254 }
std::string number(const double &d, const std::string &s)
Definition utils.cxx:186

◆ defTransform()

const Amg::Transform3D InDetDD::SolidStateDetectorElementBase::defTransform ( ) const

Definition at line 60 of file SolidStateDetectorElementBase.cxx.

61 {
62 HepGeom::Transform3D tmpTransform = defTransformCLHEP();
63 return Amg::CLHEPTransformToEigen(tmpTransform);
64 }
const HepGeom::Transform3D defTransformCLHEP() const
Default Local (reconstruction frame) to global transform ie with no misalignment.
Amg::Transform3D CLHEPTransformToEigen(const HepGeom::Transform3D &CLHEPtransf)
Converts a CLHEP-based HepGeom::Transform3D into an Eigen Amg::Transform3D.

◆ defTransformCLHEP()

const HepGeom::Transform3D InDetDD::SolidStateDetectorElementBase::defTransformCLHEP ( ) const

Default Local (reconstruction frame) to global transform ie with no misalignment.

Definition at line 50 of file SolidStateDetectorElementBase.cxx.

51 {
52 if (m_geoAlignStore) {
53 const GeoTrf::Transform3D* ptrXf = m_geoAlignStore->getDefAbsPosition(getMaterialGeom());
54 if (ptrXf) return Amg::EigenTransformToCLHEP(*ptrXf) * recoToHitTransform();
55 }
56 return Amg::EigenTransformToCLHEP(getMaterialGeom()->getDefAbsoluteTransform()) * recoToHitTransform();
57 }
const HepGeom::Transform3D recoToHitTransform() const
Transform to go from local reconstruction frame to local hit frame.
HepGeom::Transform3D EigenTransformToCLHEP(const Amg::Transform3D &eigenTransf)
Converts an Eigen-based Amg::Transform3D into a CLHEP-based HepGeom::Transform3D.

◆ depthAngle()

double InDetDD::SolidStateDetectorElementBase::depthAngle ( ) const

◆ depthDirection()

bool InDetDD::SolidStateDetectorElementBase::depthDirection ( ) const

Return information on orientation.

◆ design()

virtual const DetectorDesign & InDetDD::SolidStateDetectorElementBase::design ( ) const
virtual

access to the local description (inline):

Reimplemented in HGTD_DetectorElement, InDetDD::HGTD_DetectorElement, InDetDD::SiDetectorElement, and SiDetectorElement.

◆ detectorType()

virtual Trk::DetectorElemType InDetDD::SolidStateDetectorElementBase::detectorType ( ) const
overridevirtual

TrkDetElementBase interface detectorType.

Implements Trk::TrkDetElementBase.

Reimplemented in InDetDD::SiDetectorElement, and SiDetectorElement.

◆ detectorTypeString()

std::string Trk::TrkDetElementBase::detectorTypeString ( ) const
inherited

Returns a string of the Detector element type.

Definition at line 10 of file TrkDetElementBase.cxx.

10 {
11 auto type = detectorType();
13 return "SolidState";
14 else if (type == Trk::DetectorElemType::Silicon)
15 return "Silicon";
16 else if (type == Trk::DetectorElemType::TRT)
17 return "TRT";
18 else if (type == Trk::DetectorElemType::Csc)
19 return "Csc";
20 else if (type == Trk::DetectorElemType::Mdt)
21 return "Mdt";
22 else if (type == Trk::DetectorElemType::Rpc)
23 return "Rpc";
24 else if (type == Trk::DetectorElemType::Tgc)
25 return "Tgc";
26 else if (type == Trk::DetectorElemType::sTgc)
27 return "sTgc";
28 else if (type == Trk::DetectorElemType::MM)
29 return "Mm";
30 return "Unknown";
31}
virtual DetectorElemType detectorType() const =0
Return the Detector element type.

◆ etaAngle()

double InDetDD::SolidStateDetectorElementBase::etaAngle ( ) const

◆ etaAxis()

const Amg::Vector3D & InDetDD::SolidStateDetectorElementBase::etaAxis ( ) const

Definition at line 88 of file SolidStateDetectorElementBase.cxx.

89 {
90 if (!m_cache.isValid()) updateCache();
91 return m_cache.ptr()->m_etaAxis;
92 }

◆ etaAxisCLHEP()

const HepGeom::Vector3D< double > & InDetDD::SolidStateDetectorElementBase::etaAxisCLHEP ( ) const

Get reconstruction local eta axes in global frame.

In direction of increasing z in the barrel and increasing r in the endcap.

Definition at line 81 of file SolidStateDetectorElementBase.cxx.

82 {
83 if (!m_cache.isValid()) updateCache();
84 return m_cache.ptr()->m_etaAxisCLHEP;
85 }

◆ etaDirection()

bool InDetDD::SolidStateDetectorElementBase::etaDirection ( ) const

◆ etaPitch()

double InDetDD::SolidStateDetectorElementBase::etaPitch ( ) const

Pitch (inline methods)

NOTE: phiPitch is ambiguous for the Forward SCT where it varies along the strip.
etaPitch is ambiguous for the pixel which has long pixels between FE chips.
For these cases:

phiPitch: For SCT Forward returns pitch at center.
etaPitch: For pixel returns average pitch. (Active_length/number_of_cells)
All return pitch in distance units.

◆ get_rz()

virtual double InDetDD::SolidStateDetectorElementBase::get_rz ( ) const
pure virtual

◆ getCommonItems()

const SiCommonItems * InDetDD::SolidStateDetectorElementBase::getCommonItems ( ) const

◆ getCorners()

void InDetDD::SolidStateDetectorElementBase::getCorners ( HepGeom::Point3D< double > * corners) const
private

Return the four corners of an element in local coordinates.

Pass it an array of length 4. This function is used by getEtaPhiRegion()

Definition at line 551 of file SolidStateDetectorElementBase.cxx.

552 {
553 // This makes the assumption that the forward SCT detectors are orientated such that
554 // the positive etaAxis corresponds to the top of the detector where the width is largest.
555 // This is currently always the case.
556 // For the SCT barrel and pixel detectors minWidth and maxWidth are the same and so should
557 // work for all orientations.
558
559 double tmpMinWidth = minWidth();
560 double tmpMaxWidth = maxWidth();
561 double tmpLength = length();
562
563 // Lower left
564 corners[0][distPhi] = -0.5 * tmpMinWidth;
565 corners[0][distEta] = -0.5 * tmpLength;
566 corners[0][distDepth] = 0.;
567
568 // Lower right
569 corners[1][distPhi] = 0.5 * tmpMinWidth;
570 corners[1][distEta] = -0.5 * tmpLength;
571 corners[1][distDepth] = 0.;
572
573 // Upper Right
574 corners[2][distPhi] = 0.5 * tmpMaxWidth;
575 corners[2][distEta] = 0.5 * tmpLength;
576 corners[2][distDepth] = 0.;
577
578 // Upper left
579 corners[3][distPhi] = -0.5 * tmpMaxWidth;
580 corners[3][distEta] = 0.5 * tmpLength;
581 corners[3][distDepth] = 0.;
582 }
double length() const
Length in eta direction (z - barrel, r - endcap)
double maxWidth() const
Max width.
double minWidth() const
Min width.
@ distEta
readout for silicon
Definition ParamDefs.h:51
@ distPhi
Definition ParamDefs.h:50

◆ getEtaPhiPoint()

void InDetDD::SolidStateDetectorElementBase::getEtaPhiPoint ( const HepGeom::Point3D< double > & point,
double deltaZ,
double & etaMin,
double & etaMax,
double & phi ) const
private

Get eta and phi coresponding to a point in local coordinates.

Requires as input the vertex spread. Returns etaMin, etaMax, and phi. This function is used by getEtaPhiRegion()

Definition at line 589 of file SolidStateDetectorElementBase.cxx.

591 {
592 // Get the point in global coordinates.
593 HepGeom::Point3D<double> globalPoint = globalPosition(point);
594
595 double r = globalPoint.perp();
596 double z = globalPoint.z();
597
598 double thetaMin = std::atan2(r,(z + deltaZ));
599 etaMax = -std::log(tan(0.5 * thetaMin));
600 double thetaMax = std::atan2(r,(z - deltaZ));
601 etaMin = -std::log(tan(0.5 * thetaMax));
602
603 phi = globalPoint.phi();
604 }
Scalar phi() const
phi method
#define z
HepGeom::Point3D< double > globalPosition(const HepGeom::Point3D< double > &localPos) const
transform a reconstruction local position into a global position (inline):
int r
Definition globals.cxx:22

◆ getEtaPhiRegion()

void InDetDD::SolidStateDetectorElementBase::getEtaPhiRegion ( double deltaZ,
double & etaMin,
double & etaMax,
double & phiMin,
double & phiMax,
double & rz ) const

Method for building up region of interest table.

Get eta/phi extent for the element. Returns min/max eta and phi and r (for barrel) or z (for endcap) Takes as input the vertex spread in z (-deltaZ to +deltaZ)

Definition at line 140 of file SolidStateDetectorElementBase.cxx.

142 {
143 HepGeom::Point3D<double> corners[4];
144 getCorners(corners);
145
146 bool first = true;
147
148 double phiOffset = 0.;
149
150 for (auto & corner : corners) {
151 double etaMinPoint = 0.;
152 double etaMaxPoint = 0.;
153 double phiPoint = 0.;
154
155 // Get the eta phi value for this corner.
156 getEtaPhiPoint(corner, deltaZ, etaMinPoint, etaMaxPoint, phiPoint);
157
158 if (first) { // Use the first point to initialize the min/max values.
159
160 // Put phi in a range so that we are not near -180/+180 division.
161 // Do this by adding an offset if phi > 90 CLHEP::deg or < -90 CLHEP::deg.
162 // This offset is later removed.
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;
167 }
168 phiMin = phiMax = phiPoint - phiOffset;
169 etaMin = etaMinPoint;
170 etaMax = etaMaxPoint;
171 } else {
172 phiPoint -= phiOffset;
173 // put phi back in -M_PI < phi < +M_PI range
174 if (phiPoint < -M_PI) phiPoint += 2. * M_PI;
175 if (phiPoint > M_PI) phiPoint -= 2. * M_PI;
176 phiMin = std::min(phiMin, phiPoint);
177 phiMax = std::max(phiMax, phiPoint);
178 etaMin = std::min(etaMin, etaMinPoint);
179 etaMax = std::max(etaMax, etaMaxPoint);
180 }
181 first = false;
182 }
183
184 // put phi back in -M_PI < phi < +M_PI range
185 phiMin += phiOffset;
186 phiMax += phiOffset;
187 if (phiMin < -M_PI) phiMin += 2. * M_PI;
188 if (phiMin > M_PI) phiMin -= 2. * M_PI;
189 if (phiMax < -M_PI) phiMax += 2. * M_PI;
190 if (phiMax > M_PI) phiMax -= 2. * M_PI;
191 //does it make sense having this if the below is pure virtual for this base class?
192 //Should this just be postponed to the derived classes?
193 rz = get_rz();
194
195 }
#define M_PI
void getCorners(HepGeom::Point3D< double > *corners) const
Return the four corners of an element in local coordinates.
virtual double get_rz() const =0
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.
bool first
Definition DeMoScan.py:534

◆ getExtent()

void InDetDD::SolidStateDetectorElementBase::getExtent ( CachedVals & cache) const
private

Calculate extent in r,z and phi.

The values are cached and there are rMin(), rMax etc methods. It is only used from updateCache

Definition at line 483 of file SolidStateDetectorElementBase.cxx.

484 {
485 Amg::Vector3D sensorCenter = m_design->sensorCenter();
486 double radialShift = sensorCenter[0];//in sensor frame, x is radius
487
488 HepGeom::Point3D<double> corners[4];
489 getCorners(corners);
490
491 bool first = true;
492
493 double phiOffset = 0.;
494
495
496 const HepGeom::Transform3D rShift = HepGeom::TranslateY3D(radialShift);//in local frame, radius is y=distEta
497
498 for (auto & corner : corners) {
499
500 corner.transform(rShift);
501
502 // m_tranform is already there as part of the cache construction
503 // This method seems to be used only as a helper for updateCache
504 HepGeom::Point3D<double> globalPoint = cache.m_transformCLHEP * corner;
505
506 double rPoint = globalPoint.perp();
507 double zPoint = globalPoint.z();
508 double phiPoint = globalPoint.phi();
509
510 // Use first point to initializa min/max values.
511 if (first) {
512
513 // Put phi in a range so that we are not near -180/+180 division.
514 // Do this by adding an offset if phi > 90 CLHEP::deg or < -90 CLHEP::deg.
515 // This offset is later removed.
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;
520 }
521 cache.m_minPhi = cache.m_maxPhi = phiPoint - phiOffset;
522 cache.m_minR = cache.m_maxR = rPoint;
523 cache.m_minZ = cache.m_maxZ = zPoint;
524
525 } else {
526 phiPoint -= phiOffset;
527 // put phi back in -M_PI < phi < +M_PI range
528 if (phiPoint < -M_PI) phiPoint += 2. * M_PI;
529 if (phiPoint > M_PI) phiPoint -= 2. * M_PI;
530 cache.m_minPhi = std::min(cache.m_minPhi, phiPoint);
531 cache.m_maxPhi = std::max(cache.m_maxPhi, phiPoint);
532 cache.m_minR = std::min(cache.m_minR, rPoint);
533 cache.m_maxR = std::max(cache.m_maxR, rPoint);
534 cache.m_minZ = std::min(cache.m_minZ, zPoint);
535 cache.m_maxZ = std::max(cache.m_maxZ, zPoint);
536 }
537 first = false;
538 }
539
540 // put phi back in -M_PI < phi < +M_PI range
541 cache.m_minPhi += phiOffset;
542 cache.m_maxPhi += phiOffset;
543 if (cache.m_minPhi < -M_PI) cache.m_minPhi += 2. * M_PI;
544 if (cache.m_minPhi > M_PI) cache.m_minPhi -= 2. * M_PI;
545 if (cache.m_maxPhi < -M_PI) cache.m_maxPhi += 2. * M_PI;
546 if (cache.m_maxPhi > M_PI) cache.m_maxPhi -= 2. * M_PI;
547
548 }
Eigen::Matrix< double, 3, 1 > Vector3D

◆ getIdHelper()

const AtlasDetectorID * InDetDD::SolidStateDetectorElementBase::getIdHelper ( ) const

Returns the id helper (inline)

◆ globalPosition() [1/3]

Amg::Vector3D InDetDD::SolidStateDetectorElementBase::globalPosition ( const Amg::Vector2D & localPos) const

as in previous method but for 2D local position (inline)

◆ globalPosition() [2/3]

Amg::Vector3D InDetDD::SolidStateDetectorElementBase::globalPosition ( const Amg::Vector3D & localPos) const

◆ globalPosition() [3/3]

HepGeom::Point3D< double > InDetDD::SolidStateDetectorElementBase::globalPosition ( const HepGeom::Point3D< double > & localPos) const

transform a reconstruction local position into a global position (inline):

◆ globalPositionHit() [1/2]

Amg::Vector3D InDetDD::SolidStateDetectorElementBase::globalPositionHit ( const Amg::Vector3D & simulationLocalPos) const

◆ globalPositionHit() [2/2]

HepGeom::Point3D< double > InDetDD::SolidStateDetectorElementBase::globalPositionHit ( const HepGeom::Point3D< double > & simulationLocalPos) const

transform a hit local position into a global position (inline):

◆ hitDepthDirection()

double InDetDD::SolidStateDetectorElementBase::hitDepthDirection ( ) const

Directions of hit depth,phi,eta axes relative to reconstruction local position axes (LocalPosition).

Returns +/-1. inline

◆ hitEtaDirection()

double InDetDD::SolidStateDetectorElementBase::hitEtaDirection ( ) const

See previous method.

inline

◆ hitLocalToLocal()

Amg::Vector2D InDetDD::SolidStateDetectorElementBase::hitLocalToLocal ( double xEta,
double xPhi ) const

Simulation/Hit local frame to reconstruction local frame.

2D. TODO: Will change order of parameters at some point.

Definition at line 95 of file SolidStateDetectorElementBase.cxx.

96 { // due to whether module is centred on
97 if (!m_axisDir.isValid()) updateCache(); // z or y axes
98 const AxisDir& dir = *m_axisDir.ptr();
99
100 if (!dir.m_etaDirection) xEta = -xEta;
101 if (!dir.m_phiDirection) xPhi = -xPhi;
102 auto result = Amg::Vector2D(xPhi, xEta);
103
104 if (m_design->shape() == InDetDD::PolarAnnulus) { // Do conversion to polar co-ords as well
105 double y = result.x(); // Co-ordinate flip from cartesian needs to be temporarily un-done to
106 double x = result.y(); // allow atan2 to work in conversion
107
108 double r = std::hypot(x,y);
109 double phi = std::atan2(y,x);
110 result = Amg::Vector2D(phi,r); // now flip again
111 }
112
113 return result;
114 }
#define y
#define x
Eigen::Matrix< double, 2, 1 > Vector2D

◆ hitLocalToLocal3D()

HepGeom::Point3D< double > InDetDD::SolidStateDetectorElementBase::hitLocalToLocal3D ( const HepGeom::Point3D< double > & hitPosition) const

Same as previuos method but 3D.

Definition at line 117 of file SolidStateDetectorElementBase.cxx.

118 {
119 // Equiv to transform().inverse * transformHit() * hitPosition
120 if (!m_axisDir.isValid()) updateCache();
121 const AxisDir& dir = *m_axisDir.ptr();
122
123 double xDepth = hitPosition[m_hitDepth];
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};
130 }

◆ hitPhiDirection()

double InDetDD::SolidStateDetectorElementBase::hitPhiDirection ( ) const

See previous method.

inline

◆ identifierFromCellId()

virtual Identifier InDetDD::SolidStateDetectorElementBase::identifierFromCellId ( const SiCellId & cellId) const
pure virtual

Identifier <-> SiCellId (ie strip number or pixel eta_index,phi_index) Identifier from SiCellId (ie strip number or pixel eta_index,phi_index)

Implemented in InDetDD::HGTD_DetectorElement, InDetDD::SiDetectorElement, and SiDetectorElement.

◆ identifierOfPosition()

Identifier InDetDD::SolidStateDetectorElementBase::identifierOfPosition ( const Amg::Vector2D & localPos) const

Full identifier of the cell for a given position: assumes a raw local position (no Lorentz shift)

Definition at line 217 of file SolidStateDetectorElementBase.cxx.

218 {
219 SiCellId cellId = m_design->cellIdOfPosition(localPosition);
220 return identifierFromCellId(cellId);
221 }
virtual Identifier identifierFromCellId(const SiCellId &cellId) const =0
Identifier <-> SiCellId (ie strip number or pixel eta_index,phi_index) Identifier from SiCellId (ie s...

◆ identify()

virtual Identifier InDetDD::SolidStateDetectorElementBase::identify ( ) const
finaloverridevirtual

identifier of this detector element (inline)

Implements Trk::TrkDetElementBase.

◆ identifyHash()

virtual IdentifierHash InDetDD::SolidStateDetectorElementBase::identifyHash ( ) const
finaloverridevirtual

identifier hash (inline)

Implements Trk::TrkDetElementBase.

◆ inDetector() [1/2]

SiIntersect InDetDD::SolidStateDetectorElementBase::inDetector ( const Amg::Vector2D & localPosition,
double phiTol,
double etaTol ) const

Test that it is in the active region.

Intersect has 3 states bool SiIntersect::in() const // definitely in
bool SiIntersect::out() const // definitely out
bool SiIntersect::nearBoundary() const // near a boundary within the tolerances
bool SiIntersect::mayIntersect() const // in() OR nearBoundary()

Definition at line 204 of file SolidStateDetectorElementBase.cxx.

206 {
207 return m_design->inDetector(localPosition, phiTol, etaTol);
208 }

◆ inDetector() [2/2]

SiIntersect InDetDD::SolidStateDetectorElementBase::inDetector ( const Amg::Vector3D & globalPosition,
double phiTol,
double etaTol ) const

Definition at line 211 of file SolidStateDetectorElementBase.cxx.

212 {
213 return m_design->inDetector(localPosition(globalPosition), phiTol, etaTol);
214 }

◆ invalidate()

void InDetDD::SolidStateDetectorElementBase::invalidate ( )

Signal that cached values are no longer valid.

Invalidate general cache (inline)

◆ length()

double InDetDD::SolidStateDetectorElementBase::length ( ) const

Length in eta direction (z - barrel, r - endcap)

◆ localPosition() [1/2]

Amg::Vector2D InDetDD::SolidStateDetectorElementBase::localPosition ( const Amg::Vector3D & globalPosition) const

◆ localPosition() [2/2]

Amg::Vector2D InDetDD::SolidStateDetectorElementBase::localPosition ( const HepGeom::Point3D< double > & globalPosition) const

transform a global position into a 2D local position (reconstruction frame) (inline)

◆ maxWidth()

double InDetDD::SolidStateDetectorElementBase::maxWidth ( ) const

Max width.

Needed for the SCT endcap.

◆ minWidth()

double InDetDD::SolidStateDetectorElementBase::minWidth ( ) const

Min width.

Needed for the SCT endcap.

◆ msg()

MsgStream & InDetDD::SolidStateDetectorElementBase::msg ( MSG::Level lvl) const
private

Declaring the Message method for further use (inline)

◆ msgLvl()

bool InDetDD::SolidStateDetectorElementBase::msgLvl ( MSG::Level lvl) const
private

Declaring the Method providing Verbosity Level (inline)

◆ normal() [1/2]

virtual const Amg::Vector3D & InDetDD::SolidStateDetectorElementBase::normal ( ) const
finaloverridevirtual

Get reconstruction local normal axes in global frame.

Choosen to give right-handed coordinate frame.

Implements Trk::TrkDetElementBase.

◆ normal() [2/2]

virtual const Amg::Vector3D & InDetDD::SolidStateDetectorElementBase::normal ( const Identifier & ) const
finaloverridevirtual

TrkDetElementBase interface (inline)

Implements Trk::TrkDetElementBase.

◆ numberOfConnectedCells()

int InDetDD::SolidStateDetectorElementBase::numberOfConnectedCells ( const SiCellId cellId) const

Test if readout cell has more than one diode associated with it.

Number of cells sharing the same readout as this cell. ie generally 1 except for ganged pixels which will be 2.

Definition at line 243 of file SolidStateDetectorElementBase.cxx.

244 {
245 SiReadoutCellId readoutId = m_design->readoutIdOfCell(cellId);
246 return m_design->numberOfConnectedCells(readoutId);
247 }

◆ operator=() [1/2]

SolidStateDetectorElementBase & InDetDD::SolidStateDetectorElementBase::operator= ( const SolidStateDetectorElementBase & )
delete

Don't allow assignment operator.

◆ operator=() [2/2]

SolidStateDetectorElementBase & InDetDD::SolidStateDetectorElementBase::operator= ( SolidStateDetectorElementBase && )
delete

Don't allow move assignment operator.

◆ phiAngle()

double InDetDD::SolidStateDetectorElementBase::phiAngle ( ) const

◆ phiAxis()

const Amg::Vector3D & InDetDD::SolidStateDetectorElementBase::phiAxis ( ) const

Definition at line 74 of file SolidStateDetectorElementBase.cxx.

75 {
76 if (!m_cache.isValid()) updateCache();
77 return m_cache.ptr()->m_phiAxis;
78 }

◆ phiAxisCLHEP()

const HepGeom::Vector3D< double > & InDetDD::SolidStateDetectorElementBase::phiAxisCLHEP ( ) const

To determine if readout direction between online and offline needs swapping, see methods swapPhiReadoutDirection() and swapEtaReadoutDirection() below in "Readout Cell id" section.

Orientation. Directions.

  • phiAxis in same direction as increasing phi and identifier phi_index/strip. NB. This requires some flipping of axes with repsect to the hits.
  • etaAxis in direction of increasing z in the barrel and increasing r in the endcap.
  • normal choosen to give right-handed coordinate frame (x=normal,y=phiAxis,z=etaAxis) NB. This requires some flipping of axes with repsect to the hits.

Get reconstruction local phi axes in global frame. In same direction as increasing phi and identifier phi_index/strip.

Definition at line 67 of file SolidStateDetectorElementBase.cxx.

68 {
69 if (!m_cache.isValid()) updateCache();
70 return m_cache.ptr()->m_phiAxisCLHEP;
71 }

◆ phiDirection()

bool InDetDD::SolidStateDetectorElementBase::phiDirection ( ) const

◆ phiMax()

double InDetDD::SolidStateDetectorElementBase::phiMax ( ) const

◆ phiMin()

double InDetDD::SolidStateDetectorElementBase::phiMin ( ) const

◆ phiPitch()

double InDetDD::SolidStateDetectorElementBase::phiPitch ( ) const

◆ rawLocalPositionOfCell() [1/2]

Amg::Vector2D InDetDD::SolidStateDetectorElementBase::rawLocalPositionOfCell ( const Identifier & id) const

As above.

Definition at line 236 of file SolidStateDetectorElementBase.cxx.

237 {
238 SiCellId cellId = cellIdFromIdentifier(id);
239 return m_design->localPositionOfCell(cellId);
240 }
virtual SiCellId cellIdFromIdentifier(const Identifier &identifier) const =0
SiCellId from Identifier.

◆ rawLocalPositionOfCell() [2/2]

Amg::Vector2D InDetDD::SolidStateDetectorElementBase::rawLocalPositionOfCell ( const SiCellId & cellId) const

Returns position (center) of cell.

These are the raw positions NOT corrected for the Lorentz shift

Definition at line 230 of file SolidStateDetectorElementBase.cxx.

231 {
232 return m_design->localPositionOfCell(cellId);
233 }

◆ recoToHitTransform()

const HepGeom::Transform3D InDetDD::SolidStateDetectorElementBase::recoToHitTransform ( ) const

Transform to go from local reconstruction frame to local hit frame.

Definition at line 607 of file SolidStateDetectorElementBase.cxx.

608 {
609 if (!m_axisDir.isValid()) updateCache();
610 const AxisDir& dir = *m_axisDir.ptr();
611
612 // = transfromHit * hitLocal
613 // = transformHit * recoToHitTransform * recoLocal
614 // recoToHitTransform takes recoLocal to hitLocal
615 // x,y,z -> y,z,x
616 // equiv to a rotation around Y of 90 deg followed by a rotation around X of 90deg
617 //
618 // recoToHit is static as it needs to be calculated once only.
619 // We use the HepGeom::Transform3D constructor which takes one coordinates system to another where the
620 // coordinate system is defined by it center and two axes.
621 // distPhi, distEta are the reco local axes and hitPhi and hitEta are the hit local axes.
622 // It assume phi, eta, depth makes a right handed system which is the case.
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.)
627 };
628
629 //correct phi and eta as necessary - do not change depth, this will be defined by the transform based on the other two
630 int signPhi = dir.m_phiDirection? +1:-1;
631 int signEta = dir.m_etaDirection? +1:-1;
632
633 const HepGeom::Transform3D recoToHit(HepGeom::Point3D<double>(0., 0., 0.),
634 signPhi * localAxes[distPhi],
635 signEta *localAxes[distEta],
636 HepGeom::Point3D<double>(0., 0., 0.),
637 localAxes[m_hitPhi],
638 localAxes[m_hitEta]);
639
640 return recoToHit ;
641
642 }

◆ rMax()

double InDetDD::SolidStateDetectorElementBase::rMax ( ) const

◆ rMin()

double InDetDD::SolidStateDetectorElementBase::rMin ( ) const

◆ surface() [1/3]

Trk::Surface & InDetDD::SolidStateDetectorElementBase::surface ( )

Element Surface.

◆ surface() [2/3]

virtual const Trk::Surface & InDetDD::SolidStateDetectorElementBase::surface ( ) const
finaloverridevirtual

Return surface associated with this detector element.

Implements Trk::TrkDetElementBase.

◆ surface() [3/3]

virtual const Trk::Surface & InDetDD::SolidStateDetectorElementBase::surface ( const Identifier & ) const
finaloverridevirtual

TrkDetElementBase interface (inline)

Implements Trk::TrkDetElementBase.

◆ swapEtaReadoutDirection()

bool InDetDD::SolidStateDetectorElementBase::swapEtaReadoutDirection ( ) const

For eta_index (only relevant for pixel) (inline)

◆ swapPhiReadoutDirection()

bool InDetDD::SolidStateDetectorElementBase::swapPhiReadoutDirection ( ) const

Determine if readout direction between online and offline needs swapping.

Returns true if online and offline numbers run in opposite directions. For strip/phi_index (inline)

◆ thickness()

double InDetDD::SolidStateDetectorElementBase::thickness ( ) const

◆ transform() [1/2]

virtual const Amg::Transform3D & InDetDD::SolidStateDetectorElementBase::transform ( ) const
finaloverridevirtual

Return local to global transform.

Implements Trk::TrkDetElementBase.

◆ transform() [2/2]

virtual const Amg::Transform3D & InDetDD::SolidStateDetectorElementBase::transform ( const Identifier & ) const
finaloverridevirtual

TrkDetElementBase interface (inline)

Implements Trk::TrkDetElementBase.

◆ transformCLHEP()

const HepGeom::Transform3D & InDetDD::SolidStateDetectorElementBase::transformCLHEP ( ) const

Local (reconstruction frame) to global transform.

Definition at line 43 of file SolidStateDetectorElementBase.cxx.

44 {
45 if (!m_cache.isValid()) updateCache();
46 return m_cache.ptr()->m_transformCLHEP;
47 }

◆ transformHit()

const GeoTrf::Transform3D & InDetDD::SolidStateDetectorElementBase::transformHit ( ) const

Local (simulation/hit frame) to global transform.

◆ updateCache()

void InDetDD::SolidStateDetectorElementBase::updateCache ( ) const
virtual

Recalculate cached values.

Definition at line 272 of file SolidStateDetectorElementBase.cxx.

273 {
274 if (m_cache.isValid()) return;
275 CachedVals cache;
276
277 // use aligned transform if available
278 const GeoTrf::Transform3D* ptrXf;
279 GeoTrf::Transform3D geotrf;
280
281 if (m_geoAlignStore){
282 ptrXf = m_geoAlignStore->getAbsPosition(getMaterialGeom());
283 if (ptrXf) {
284 cache.m_transformHit = (*ptrXf);
285 //the below can have an (optional) shift to acccount for transformations
286 //applied when constructing the DetectorElements from the GeoPhysVols
287 //(At the moment, only used for ITkStrip barrel when creating a DetElement per row)
288 geotrf = (*ptrXf) * m_design->moduleShift();
289 }
290 else {
291 geotrf.setIdentity();
292 }
293 }
294 else{
295 cache.m_transformHit = getMaterialGeom()->getAbsoluteTransform();
296 //the below can have an (optional) shift to acccount for transformations
297 //applied when constructing the DetectorElements from the GeoPhysVols
298 //(At the moment, only used for ITkStrip barrel when creating a DetElement per row)
299 geotrf = getMaterialGeom()->getAbsoluteTransform() * m_design->moduleShift();
300 }
301
302 const GeoTrf::Transform3D& geoTransform = geotrf;
303
304 cache.m_center = geoTransform * m_design->sensorCenter();
305
306 //Is this needed outside e.g. ReadSiDetElements? Maybe candidate for future removal?
307 cache.m_centerCLHEP = HepGeom::Point3D<double>(cache.m_center[0],cache.m_center[1],cache.m_center[2]);
308
309 Amg::Vector3D centerGeoModel(0., 0., 0.);
310 cache.m_origin = geoTransform * centerGeoModel;
311
312 //
313 // Determine directions depth, eta and phi axis in reconstruction local frame
314 // ie depth away from interaction point
315 // phi in direction of increasing phi
316 // eta in direction of increasing z in barrel, and increasing r in endcap
317 //
318
319 // depthAxis, phiAxis, and etaAxis are defined to be x,y,z respectively for all detectors for hit local frame.
320 // depthAxis, phiAxis, and etaAxis are defined to be z,x,y respectively for all detectors for reco local frame.
321 static const Amg::Vector3D localAxes[3] = {
322 Amg::Vector3D(1.,0.,0.),
323 Amg::Vector3D(0.,1.,0.),
324 Amg::Vector3D(0.,0.,1.)
325 };
326
327 static const Amg::Vector3D & localRecoPhiAxis = localAxes[distPhi]; // Defined to be same as x axis
328 static const Amg::Vector3D & localRecoEtaAxis = localAxes[distEta]; // Defined to be same as y axis
329 static const Amg::Vector3D & localRecoDepthAxis = localAxes[distDepth]; // Defined to be same as z axis
330
331 // We only need to calculate the rough orientation once.
332 //For it to change would require extreme unrealistic misalignment changes.
333#ifndef NDEBUG
334 bool setAxisDir = false;
335#endif
336 if (!m_axisDir.isValid()) {
337 AxisDir dir{};
338 // Determine the unit vectors in global frame
339
340 const Amg::Vector3D &geoModelPhiAxis = localAxes[m_hitPhi];
341 const Amg::Vector3D &geoModelEtaAxis = localAxes[m_hitEta];
342 const Amg::Vector3D &geoModelDepthAxis = localAxes[m_hitDepth];
343
344 Amg::Vector3D globalDepthAxis(geoTransform.linear() * geoModelDepthAxis);
345 Amg::Vector3D globalPhiAxis(geoTransform.linear() * geoModelPhiAxis);
346 Amg::Vector3D globalEtaAxis(geoTransform.linear() * geoModelEtaAxis);
347
348 // unit radial vector
349 Amg::Vector3D unitR(cache.m_center.x(), cache.m_center.y(), 0.);
350 unitR.normalize();
351
352 Amg::Vector3D nominalEta(0.0,0.0,1.0);
353 Amg::Vector3D nominalNormal(0.0,0.0,0.0);
354 Amg::Vector3D nominalPhi(-unitR.y(), unitR.x(), 0.0);
355
356 // In Barrel like geometry, the etaAxis is along increasing z, and normal is in increasing radial direction.
357 // In Endcap like geometry, the etaAxis is along increasing r, and normal is in decreasing z direction,
358 // We base whether it is barrel like or endcap like by the orientation of the local z axis of the
359 // the element. This allows the use of endcap identifiers in a TB setup.
360
361
362 nominalEta(2) = 1.0;
363 dir.m_barrelLike = true;
364
365 if (std::abs(globalEtaAxis.dot(nominalEta)) < 0.5) { // Check that it is in roughly the right direction. Allowed not to be for ITK inclined/barrel ring modules
366 dir.m_barrelLike = false;
367 }
368
369 if (dir.m_barrelLike) {
370 nominalEta(2) = 1.0;
371 nominalNormal = unitR;
372 } else { // endcap like
373 nominalNormal(2) = -1.0;
374 nominalEta = unitR;
375 }
376
377 // Determine if axes are to have there directions swapped.
378
379 //
380 // Depth axis.
381 //
382 dir.m_depthAngle = globalDepthAxis.dot(nominalNormal);
383 dir.m_depthDirection = true;
384 if (dir.m_depthAngle < 0) {
385 if (m_design->depthSymmetric()) {
386 dir.m_depthDirection = false;
387 } else {
388 ATH_MSG_DEBUG( "Unable to swap local depth axis.");
389 }
390 }
391 if (std::abs(dir.m_depthAngle) < 0.5 && (m_design->type())!=InDetDD::PLR) { // Check that it is in roughly the right direction. Ignore this for the PLR as it gives values as low as 0.489)
392 ATH_MSG_ERROR( "Orientation of local depth axis does not follow correct convention.");
393 dir.m_depthDirection = true; // Don't swap.
394 }
395
396 // for HGTD modules, the check on phi and eta directions don't make sense
397 // as the modules do not respect the conventional position for endcap discs:
398 // - the local eta axis is never parallel to the radial direction
399 // - the local phi axis is never perpendicular to the radial direction
400 // hence, removing errors and allowing swap of the axis when needed
401 bool isHGTD = this->getIdHelper()->is_hgtd(m_id);
402
403 //
404 // Phi axis
405 //
406 dir.m_phiAngle = globalPhiAxis.dot(nominalPhi);
407 dir.m_phiDirection = true;
408 if (dir.m_phiAngle < 0) {
409 if (m_design->phiSymmetric()) {
410 dir.m_phiDirection = false;
411 } else {
412 ATH_MSG_DEBUG("Unable to swap local xPhi axis.");
413 }
414 }
415 if (not isHGTD and std::abs(dir.m_phiAngle) < 0.5) { // Check that it is in roughly the right direction.
416 ATH_MSG_ERROR( "Orientation of local xPhi axis does not follow correct convention.");
417 dir.m_phiDirection = true; // Don't swap.
418 }
419
420 //
421 // Eta axis
422 //
423 dir.m_etaAngle = globalEtaAxis.dot(nominalEta);
424 dir.m_etaDirection = true;
425 if (dir.m_etaAngle < 0) {
426 if (m_design->etaSymmetric()) {
427 dir.m_etaDirection = false;
428 } else {
429 ATH_MSG_DEBUG("Unable to swap local xEta axis.");
430 }
431 }
432 if (not isHGTD and std::abs(dir.m_etaAngle) < 0.5) { // Check that it is in roughly the right direction.
433 ATH_MSG_ERROR( "Orientation of local xEta axis does not follow correct convention.");
434 dir.m_etaDirection = true; // Don't swap
435 }
436
437 m_axisDir.set (dir);
438#ifndef NDEBUG
439 setAxisDir = true;
440#endif
441 } // end if (!m_axisDir.isValid())
442
443 cache.m_transformCLHEP = Amg::EigenTransformToCLHEP(geoTransform) * recoToHitTransform();
444 cache.m_transform = Amg::CLHEPTransformToEigen(cache.m_transformCLHEP);
445
446 #ifndef NDEBUG
447 // Check that local frame is right-handed. (ie transform has no reflection)
448 // This can be done by checking that the determinant is >0.
449 if (setAxisDir) { // Only need to check this once.
450 const AxisDir& dir = *m_axisDir.ptr();
451 HepGeom::Transform3D & t = cache.m_transformCLHEP;
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));
455 if (det < 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 <<")");
460 }
461 }
462 #endif
463
464 // Initialize various cached members, needs to be done here otherwise the necessary transforms are not yet initialized
465 // The unit vectors
466 cache.m_normal = cache.m_transform.linear() * localRecoDepthAxis;
467
468 cache.m_phiAxis = cache.m_transform.linear() * localRecoPhiAxis;
469 cache.m_etaAxis = cache.m_transform.linear() * localRecoEtaAxis;
470
471 //Check where these are actually needed - candidates for removal?
472 cache.m_phiAxisCLHEP = HepGeom::Vector3D<double>(cache.m_phiAxis[0],cache.m_phiAxis[1],cache.m_phiAxis[2]);
473 cache.m_etaAxisCLHEP = HepGeom::Vector3D<double>(cache.m_etaAxis[0],cache.m_etaAxis[1],cache.m_etaAxis[2]);
474
475 getExtent(cache);
476 m_cache.set (std::move (cache));
477 }
#define ATH_MSG_ERROR(x)
#define ATH_MSG_DEBUG(x)
bool is_hgtd(Identifier id) const
void getExtent(CachedVals &cache) const
Calculate extent in r,z and phi.
const AtlasDetectorID * getIdHelper() const
Returns the id helper (inline)

◆ width()

double InDetDD::SolidStateDetectorElementBase::width ( ) const

Methods from design (inline)

Width in phi direction. For the SCT endcap it returns the average width.

◆ zMax()

double InDetDD::SolidStateDetectorElementBase::zMax ( ) const

◆ zMin()

double InDetDD::SolidStateDetectorElementBase::zMin ( ) const

Member Data Documentation

◆ m_axisDir

CxxUtils::CachedValue<AxisDir> InDetDD::SolidStateDetectorElementBase::m_axisDir
protected

Definition at line 675 of file SolidStateDetectorElementBase.h.

◆ m_cache

CxxUtils::CachedValue<CachedVals> InDetDD::SolidStateDetectorElementBase::m_cache
protected

Definition at line 702 of file SolidStateDetectorElementBase.h.

◆ m_commonItems

const SiCommonItems* InDetDD::SolidStateDetectorElementBase::m_commonItems {nullptr}
protected

Definition at line 624 of file SolidStateDetectorElementBase.h.

624{nullptr};

◆ m_design

const DetectorDesign* InDetDD::SolidStateDetectorElementBase::m_design {nullptr}
protected

local description of this detector element

Definition at line 622 of file SolidStateDetectorElementBase.h.

622{nullptr};

◆ m_geoAlignStore

const GeoAlignmentStore* InDetDD::SolidStateDetectorElementBase::m_geoAlignStore {}
protected

Definition at line 626 of file SolidStateDetectorElementBase.h.

626{};

◆ m_hitDepth

DetectorDesign::Axis InDetDD::SolidStateDetectorElementBase::m_hitDepth
protected

Definition at line 633 of file SolidStateDetectorElementBase.h.

◆ m_hitEta

DetectorDesign::Axis InDetDD::SolidStateDetectorElementBase::m_hitEta
protected

Axes.

Definition at line 631 of file SolidStateDetectorElementBase.h.

◆ m_hitPhi

DetectorDesign::Axis InDetDD::SolidStateDetectorElementBase::m_hitPhi
protected

Definition at line 632 of file SolidStateDetectorElementBase.h.

◆ m_id

Identifier InDetDD::SolidStateDetectorElementBase::m_id {}
protected

identifier of this detector element

Definition at line 617 of file SolidStateDetectorElementBase.h.

617{};

◆ m_idHash

IdentifierHash InDetDD::SolidStateDetectorElementBase::m_idHash {}
protected

hash id of this detector element

Definition at line 643 of file SolidStateDetectorElementBase.h.

643{};

◆ m_surface

std::unique_ptr<Trk::Surface> InDetDD::SolidStateDetectorElementBase::m_surface
protected

Definition at line 625 of file SolidStateDetectorElementBase.h.


The documentation for this class was generated from the following files: