7#include <GaudiKernel/SystemOfUnits.h>
10# include "Acts/Surfaces/TrapezoidBounds.hpp"
11# include "Acts/Surfaces/Surface.hpp"
19 if (
pars.stripDesign) ostr<<
"Strips: "<<(*
pars.stripDesign)<<std::endl;
20 if (
pars.wireGroupDesign) ostr<<
"Wire Groups: "<<(*
pars.wireGroupDesign)<<std::endl;
21 if (
pars.padDesign) ostr<<
"Pads: "<<(*
pars.padDesign)<<std::endl;
39 m_pars.layerBounds->makeBounds<Acts::TrapezoidBounds>(
m_pars.sHalfChamberLength,
41 m_pars.halfChamberHeight)));
44 if (
m_pars.stripLayers.empty() ||
m_pars.wireGroupLayers.empty()) {
46 return StatusCode::FAILURE;
48 for (
unsigned int layer = 0; layer <
m_pars.stripLayers.size(); ++layer) {
51 ATH_MSG_FATAL(
"Layer "<<
m_pars.stripLayers[layer]<<
" has a very strange hash. Expect "<<layer);
52 return StatusCode::FAILURE;
62 90.*Gaudi::Units::deg)));
66 for (
unsigned int layer = 0; layer <
m_pars.wireGroupLayers.size(); ++layer) {
69 ATH_MSG_FATAL(
"Layer "<<
m_pars.wireGroupLayers[layer]<<
" has a very strange hash. Expect "<<layer);
70 return StatusCode::FAILURE;
81 for (
unsigned int layer = 0; layer <
m_pars.padLayers.size(); ++layer) {
84 ATH_MSG_FATAL(
"Layer "<<
m_pars.padLayers[layer]<<
" has a very strange hash. Expect "<<layer);
85 return StatusCode::FAILURE;
100 return StatusCode::SUCCESS;
113 std::optional<Amg::Vector2D> stripCenterOpt = design.
center(ch);
114 if (!stripCenterOpt) {
115 ATH_MSG_WARNING(__FILE__<<
":"<<__LINE__<<
" The strip " << ch <<
" doesn't intersect with the edges of the trapezoid.");
120 stripCenter = std::move(*stripCenterOpt);
122 stripCenter.x() += 0.25 * design.
stripWidth();
125 stripCenter.x() -= 0.25 * design.
stripWidth();
132 std::optional<Amg::Vector2D> wireGroupCenterOpt = design.
center(ch);
133 if (!wireGroupCenterOpt) {
134 ATH_MSG_WARNING(__FILE__<<
":"<<__LINE__<<
" The wireGroup" << ch <<
"doesn't intersect with the edges of the trapezoid.");
135 return wireGroupCenter;
137 wireGroupCenter = std::move(*wireGroupCenterOpt);
147 wireGroupCenter.x() = 0.5 * (wireGroupCenter.x() - design.
longHalfHeight());
149 ATH_MSG_VERBOSE(
"The actual center of the last wire group is: " << wireGroupCenter.x());
152 ATH_MSG_VERBOSE(
"The last wire of the last second group is at: " << wireGroupCenter.x());
155 wireGroupCenter.x() = 0.5 * (wireGroupCenter.x() + design.
longHalfHeight());
159 return wireGroupCenter;
168 padCenter = std::move(*padCenterOpt);
173 return Amg::Vector2D::Zero();
179 unsigned int layIdx =
static_cast<unsigned int>(lHash);
183 <<
"with the layer hash "<<layIdx<<
" is invalid. Maximum range "<<
m_pars.stripLayers.size());
184 return Amg::Vector3D::Zero();
188 channelPos.block<2,1>(0,0) = std::move(localChannel);
196 unsigned int layIdx =
static_cast<unsigned int>(lHash);
201 for (
unsigned int corner = 0; corner < lPadCorners.size(); ++corner) {
202 gPadCorners[corner].block<2,1>(0,0) = std::move(lPadCorners[corner]);
208 <<
" is out of range. Maximum range "<<
m_pars.padLayers.size());
214 unsigned int layIdx =
static_cast<unsigned int>(lHash);
215 if (layIdx <
m_pars.stripLayers.size()) {
217 return layout.toOrigin() * layout.localStripPosition(
channelNumber(measHash));
220 <<
" is out of range. Maximum range "<<
m_pars.stripLayers.size());
221 return Amg::Vector3D::Zero();
236 unsigned int layIdx =
static_cast<unsigned int>(lHash);
239 if(gasGap >
m_pars.stripLayers.size()){
241 <<
" is out of range. Maximum range "<<
m_pars.stripLayers.size());
242 return Amg::Vector3D::Zero();
247 localstripleftEdge = std::move(*stripleftEdgeOpt);
248 stripleftEdge.block<2,1>(0,0) = std::move(localstripleftEdge);
253 if(gasGap >
m_pars.wireGroupLayers.size()){
255 <<
" is out of range. Maximum range "<<
m_pars.wireGroupLayers.size());
256 return Amg::Vector3D::Zero();
263 localwireleftEdge = std::move(*wireleftedgeOpt);
264 wireleftEdge.block<2,1>(0,0) = std::move(localwireleftEdge);
270 ATH_MSG_FATAL(__FILE__<<
":"<<__LINE__<<
" The layer hash "<<layIdx
271 <<
" is not valid Type "<<
chType(measHash));
272 return Amg::Vector3D::Zero();
280 unsigned int layIdx =
static_cast<unsigned int>(lHash);
283 if(gasGap >
m_pars.stripLayers.size()){
285 <<
" is out of range. Maximum range "<<
m_pars.stripLayers.size());
286 return Amg::Vector3D::Zero();
291 localstriprightEdge = std::move(*striprightEdgeOpt);
292 striprightEdge.block<2,1>(0,0) = std::move(localstriprightEdge);
297 if(gasGap >
m_pars.wireGroupLayers.size()){
299 <<
" is out of range. Maximum range "<<
m_pars.wireGroupLayers.size());
300 return Amg::Vector3D::Zero();
307 localwirerightEdge = std::move(*wirerightedgeOpt);
308 wirerightEdge.block<2,1>(0,0) = std::move(localwirerightEdge);
314 ATH_MSG_FATAL(__FILE__<<
":"<<__LINE__<<
" The layer hash "<<layIdx
315 <<
" is not valid Type "<<
chType(measHash));
316 return Amg::Vector3D::Zero();
Scalar mag() const
mag method
constexpr std::array< T, N > make_array(const T &def_val)
Helper function to initialize in-place arrays with non-zero values.
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
sTgcIdHelper::sTgcChannelTypes chType
This is a "hash" representation of an Identifier.
Amg::Vector3D center(const ActsTrk::GeometryContext &ctx) const
Returns the detector center (Which is the same as the detector center of the first measurement layer)
const Amg::Transform3D & localToGlobalTrans(const ActsTrk::GeometryContext &ctx) const
Returns the local to global transformation into the ATLAS coordinate system.
StatusCode planeSurfaceFactory(const IdentifierHash &hash, std::shared_ptr< const Acts::PlanarBounds > pBounds)
Identifier identify() const override final
Return the athena identifier.
const Muon::IMuonIdHelperSvc * idHelperSvc() const
Returns the pointer to the muonIdHelperSvc.
StatusCode createGeoTransform()
StatusCode insertTransform(const IdentifierHash &hash)
Inserts a transfomration for caching.
MuonReadoutElement(const defineArgs &args)
static IdentifierHash geoTransformHash()
Returns the hash that is associated with the surface cache holding the transformation that is placing...
std::pair< int, int > channelNumber(const Amg::Vector2D &hitPos) const
Function to retrieve the pad eta and phi given a local position coordinate.
Amg::Vector2D stripPosition(int stripNum) const override final
Override from stripDesign. This function will give the center of the pad by taking the sequential cha...
double halfWidth() const
Returns the half height of the strip panel.
CheckVector2D center(int stripNumb) const
Returns the bisector of the strip (Global numbering scheme)
CheckVector2D leftEdge(int stripNumb) const
Returns the left edge of the strip (Global numbering scheme)
const Amg::Vector2D & firstStripPos() const
Vector indicating the first strip position.
double stripPitch() const
Distance between two adjacent strips.
double stripWidth() const
Width of a strip.
double shortHalfHeight() const
Returns the shorter half height of the panel.
CheckVector2D rightEdge(int stripNumb) const
Returns the right edge of the strip (Global numbering scheme)
double longHalfHeight() const
Returns the longer half height of the panel.
virtual int numStrips() const
Number of strips on the panel.
The StripLayer interfaces the 2D description of the strip plane layout with the 3D description of the...
const Amg::Transform3D & toOrigin() const
Returns the transformation to go from the strip layer center to the origin of the Strip chamber.
unsigned int numWiresInGroup(unsigned int groupNum) const
Returns the number of wires in a given group.
double wireCutout() const
Extract the wireCutout for a wireGroup layer.
Amg::Vector2D localChannelPosition(const Identifier &measId) const
Returns the local pad/strip/wireGroup position.
Amg::Vector3D globalChannelPosition(const ActsTrk::GeometryContext &ctx, const Identifier &measId) const
Returns the global pad/strip/wireGroup position.
IdentifierHash measurementHash(const Identifier &measId) const override final
Constructs the identifier hash from the full measurement Identifier.
localCornerArray localPadCorners(const Identifier &measId) const
Amg::Vector3D leftStripEdge(const ActsTrk::GeometryContext &ctx, const IdentifierHash &measHash) const
const StripLayer & stripLayer(const Identifier &measId) const
const WireGroupDesign & wireDesign(const Identifier &measId) const
Retrieves the readoutElement Layer given the Identifier/Hash.
double firstStripPitch(const Identifier &measId) const
Gas Gaps.
static IdentifierHash createHash(const unsigned int gasGap, const unsigned int channelType, const unsigned int channel, const unsigned int wireInGrp=0)
Create a measurement hash from the Identifier fields.
const PadDesign & padDesign(const Identifier &measId) const
Retrieves the readoutElement Layer given the Identifier/Hash.
globalCornerArray globalPadCorners(const ActsTrk::GeometryContext &ctx, const Identifier &measId) const
unsigned int padPhi(const Identifier &measId) const
Returns the Phi index of the pad for the given pad identifier.
int multilayer() const
Returns the multilayer of the sTgcReadoutElement.
static unsigned int gasGapNumber(const IdentifierHash &measHash)
Returns the gasGap (0 to 3) for a given identifierHash.
StatusCode initElement() override final
Element initialization.
virtual ~sTgcReadoutElement()
std::array< Amg::Vector3D, 4 > globalCornerArray
Returns an array of four 3D vectors representing corner positions of the pads.
sTgcReadoutElement(defineArgs &&args)
std::array< Amg::Vector2D, 4 > localCornerArray
Returns an array of four 2D vectors representing corner positions of the pads.
static unsigned int channelNumber(const IdentifierHash &measHash)
Returns channel position for a given identifierHash.
Identifier measurementId(const IdentifierHash &measHash) const override final
Converts the measurement hash back to the full Identifier.
const StripDesign & stripDesign(const Identifier &measId) const
Retrieves the readoutElement Layer given the Identifier/Hash.
const sTgcIdHelper & m_idHelper
Amg::Vector3D rightStripEdge(const ActsTrk::GeometryContext &ctx, const IdentifierHash &measHash) const
Amg::Vector3D chamberStripPos(const IdentifierHash &measHash) const
bool isEtaZero(const IdentifierHash &measurementHash, const Amg::Vector2D &localPosition) const
int padNumber(const Amg::Vector2D &hitPos, const Identifier &measId) const
Returns the pad Number given local position of hit and Identifier/Hash.
IdentifierHash layerHash(const Identifier &measId) const override final
Transforms the Identifier into a layer hash.
unsigned int padEta(const Identifier &measId) const
Returns the Eta index of the pad for the given pad identifier.
const parameterBook & getParameters() const
Amg::Transform3D fromGapToChamOrigin(const IdentifierHash &layerHash) const
The AlignStoreProviderAlg loads the rigid alignment corrections and pipes them through the readout ge...
std::string toString(const Translation3D &translation, int precision=4)
GeoPrimitvesToStringConverter.
Eigen::Affine3d Transform3D
Eigen::Matrix< double, 2, 1 > Vector2D
Eigen::Matrix< double, 3, 1 > Vector3D
The ReadoutGeomCnvAlg converts the Run4 Readout geometry build from the GeoModelXML into the legacy M...
std::ostream & operator<<(std::ostream &ostr, const Chamber::defineArgs &args)
std::string toString(const MuonGMR4::MuonReadoutElement *re)
std::array< Amg::Vector2D, 4 > localCornerArray
std::array< Amg::Vector3D, 4 > globalCornerArray
MmReadoutElement::parameterBook parameterBook
Set of parameters to describe an sTGC chamber.