 |
ATLAS Offline Software
|
Go to the documentation of this file.
7 #include <GeoModelHelpers/TransformToStringConverter.h>
10 #include <GaudiKernel/SystemOfUnits.h>
15 #ifndef SIMULATIONBASE
17 # include "Acts/Surfaces/TrapezoidBounds.hpp"
18 # include "Acts/Surfaces/LineBounds.hpp"
19 # include "Acts/Surfaces/Surface.hpp"
27 ostr <<
" // Chamber half- length (min/max): "<<
pars.shortHalfX<<
"/"<<
pars.longHalfX
28 <<
", half-width "<<
pars.halfY<<
", height: "<<
pars.halfHeight;
29 ostr <<
" // Number of tube layers " <<
pars.tubeLayers.size()<< std::endl;
30 ostr <<
" // Tube pitch: " <<
pars.tubePitch
31 <<
" wall thickness: " <<
pars.tubeWall
32 <<
" inner radius: " <<
pars.tubeInnerRad
33 <<
" endplug: "<<
pars.endPlugLength
34 <<
" deadlength: "<<
pars.deadLength<< std::endl;
36 ostr <<
" // **** "<<
Amg::toString(
layer->tubeTransform(0).translation(), 2)<<std::endl;
40 MdtReadoutElement::~MdtReadoutElement() =
default;
43 m_pars{std::move(
args)} {
56 return StatusCode::FAILURE;
60 return StatusCode::FAILURE;
62 #ifndef SIMULATIONBASE
71 std::optional<Amg::Vector3D> prevLayPos{std::nullopt};
73 for (
unsigned int lay =1 ; lay <=
numLayers() ; ++lay) {
76 ATH_CHECK(insertTransform<MdtReadoutElement>(layHash));
77 #ifdef SIMULATIONBASE_REMOVEPLANESURFACE
82 std::optional<Amg::Vector3D> prevTubePos{std::nullopt};
89 prevTubePos = std::nullopt;
92 ATH_CHECK(insertTransform<MdtReadoutElement>(idHash));
93 #ifndef SIMULATIONBASE
102 ATH_MSG_FATAL(__FILE__<<
":"<<__LINE__<<
" Transformation matrix is not a pure rotation for "<<
105 return StatusCode::FAILURE;
112 const double dR = std::abs((tubePos - (*prevTubePos)).
z());
113 if (std::abs(dR -
tubePitch()) > pitchTolerance) {
114 ATH_MSG_FATAL(__FILE__<<
":"<<__LINE__<<
" Detected irregular tube in "<<
116 <<
". Expected tube pitch: "<<
tubePitch()<<
" measured tube pitch: "
119 return StatusCode::FAILURE;
122 if (prevLayPos &&
tube == 1) {
123 const double dR = (tubePos - (*prevLayPos)).
mag();
124 if (std::abs(dR -
tubePitch()) > pitchTolerance) {
125 ATH_MSG_FATAL(__FILE__<<
":"<<__LINE__<<
" Detected irregular layer pitch in "<<
127 <<
". Expected tube pitch: "<<
tubePitch()<<
" measured tube pitch: "
133 prevLayPos = std::make_optional<Amg::Vector3D>(tubePos);
135 prevTubePos = std::make_optional<Amg::Vector3D>(tubePos);
138 #ifndef SIMULATIONBASE
141 return StatusCode::SUCCESS;
145 const IdentifierHash&
hash)
const {
153 const IdentifierHash&
hash)
const {
158 const IdentifierHash&
hash)
const {
165 return zeroT.layerTransform();
171 return zeroT.tubeTransform(
tube);
177 return 2. * zeroT.tubeHalfLength(
tube);
183 return 2.*zeroT.uncutHalfLength(
tube);
192 const IdentifierHash& measHash,
221 getMaterialGeom()->getParent()->getX() *
222 getMaterialGeom()->getX();
238 return refEle->
asBuiltRefFrame()*(-0.5*( refEle->moduleThickness() *Amg::Vector3D::UnitX() +
239 (
stationEta() >0 || !
isBarrel() ? 1. : -1.)*refEle->moduleHeight() * Amg::Vector3D::UnitZ()));
241 #ifndef SIMULATIONBASE
251 const IdentifierHash& tubeHash,
261 const multilayer_t ml = (
multilayer() == 1) ? multilayer_t::ML1 : multilayer_t::ML2;
279 const int layer_delta = ml == multilayer_t::ML1 ?
numLayers() - tubeLayer : tubeLayer +1;
283 const double zpitch =
params.zpitch(ml,
side);
284 const double ypitch =
params.ypitch(ml,
side);
295 const double offset_stagg = 0.5 * zpitch * stagg * ( (layer_delta-1) % 2);
297 tube* zpitch + offset_stagg,
298 (layer_delta-1) * ypitch};
302 ATH_MSG_VERBOSE(
"Off set staggering "<<offset_stagg<<
", layer_delta: "<<layer_delta<<
", zpitch: "<<zpitch<<
", ypitch: "<<ypitch
303 <<
", xshift: "<<xshift);
306 reference_point.y() +
z0 + endPlug.y(),
307 reference_point.z() + y0 + endPlug.z());
323 const double chamberThickness)
const {
350 <<
moduleWidthL() <<
", height: "<<chamberHeight<<
", thickness: " <<chamberThickness <<
"." );
353 double s0mdt = localTubeEndPoint.x();
354 if (std::abs(fixedPoint.x()) > 0.01) {
355 s0mdt = localTubeEndPoint.x() - fixedPoint.x();
357 double z0mdt = localTubeEndPoint.y();
361 if (std::abs(fixedPoint.y()) > 0.01) {
362 z0mdt = localTubeEndPoint.y() - fixedPoint.y();
364 double t0mdt = localTubeEndPoint.z();
365 if (std::abs(fixedPoint.z()) > 0.01) {
366 t0mdt = localTubeEndPoint.z() - fixedPoint.z();
368 if (z0mdt < 0 || t0mdt < 0) {
369 ATH_MSG_WARNING(
""<<__func__<<
": correcting the local position of a point outside the mdt station (2 multilayers) volume -- RE "
371 <<
" fixedPoint " <<
Amg::toString(fixedPoint)<<
", z0mdt: "<<z0mdt<<
", t0mdt"<<t0mdt);
373 ATH_MSG_VERBOSE(
"** In "<<__func__<<
" - correct for offset of B-line fixed point " << s0mdt <<
" " << z0mdt <<
" " << t0mdt);
377 const double s_rel = s0mdt / (width_actual / 2.);
378 const double z_rel = (z0mdt - chamberHeight / 2.) / (chamberHeight / 2.);
379 const double t_rel = (t0mdt - chamberThickness / 2.) / (chamberThickness / 2.);
381 ATH_MSG_VERBOSE(
"** In "<<__func__<<
" - width_actual: "<<width_actual<<
", s_rel: "<<s_rel<<
", z_rel: "<<z_rel
382 <<
", t_rel:" << t_rel );
383 double ds{0.},dz{0.},
dt{0.};
387 double ztmp = z_rel * z_rel - 1;
395 dz += bline.
getParameter(Parameter::tw) * s_rel * t_rel * chamberThickness / chamberHeight;
415 const double ep = bline.
getParameter(Parameter::ep) * expansionScale;
417 const double phi = 0.5 * (ep +
en) * s_rel * s_rel + 0.5 * (ep -
en) * s_rel;
418 const double localDt =
phi * (t0mdt - chamberThickness / 2.);
419 const double localDz =
phi * (z0mdt - chamberHeight / 2.);
425 deformedPos[0] = localTubeEndPoint[0] +
ds;
426 deformedPos[1] = localTubeEndPoint[1] + dz;
427 deformedPos[2] = localTubeEndPoint[2] +
dt;
442 #ifdef SIMULATIONBASE
444 <<
"store address to make the compiler happy: "<<
store);
445 return Amg::Transform3D::Identity();
450 return Amg::Transform3D::Identity();
458 return Amg::Transform3D::Identity();
470 const double relSign = (
multilayer() == 1 ? -1. : 1.);
475 const double thickness = relSign*( (toAMDB* (modHalfThick*Amg::Vector3D::UnitX())) -
486 if (distortPars.asBuilt) {
492 if (distortPars.bLine) {
501 <<
", thickness: "<<
thickness<<
", height: "<<height);
505 positiveEnd = fromAMDB * positiveEnd;
506 negativeEnd = fromAMDB * negativeEnd;
507 positiveEndBline = fromAMDB * positiveEndBline;
508 negativeEndBline = fromAMDB * negativeEndBline;
518 const Amg::Vector3D new_direction = (positiveEndBline - negativeEndBline).
unit();
519 const Amg::Vector3D rotation_vector = old_direction.cross(new_direction);
523 const Amg::AngleAxis3D wire_rotation(std::asin(rotation_vector.mag()), rotation_vector.unit());
524 deformedTransform = from_center * wire_rotation * to_center;
526 deformedTransform = from_center * to_center;
531 return deformedTransform;
std::shared_ptr< Acts::SurfaceBoundFactory > boundFactory
Sets of surface bounds which is shared amongst all readout elements used to assign the same bound obj...
The TransientConstSharedPtr allows non-const access if the pointer itself is non-const but in the con...
Amg::Transform3D asBuiltRefFrame() const
Returns the transformation to go into the reference frame of the as-buit & b-line model starting from...
Amg::Vector3D localTubePos(const IdentifierHash &hash) const
Returns the tube position in the chamber coordinate frame (Not applying the B-line corrections)
std::set< IdentifierHash > removedTubes
List of tube places without tubes.
unsigned int numTubesInLay() const
Returns the number of tubes per layer.
Scalar phi() const
phi method
Amg::Vector3D readOutPos(const ActsTrk::GeometryContext &ctx, const Identifier &measId) const
Returns the global position of the readout card.
const MdtReadoutElement * m_reOtherMl
Complementary readout element.
std::vector< MdtTubeLayerPtr > tubeLayers
Vector defining the position of all tubes in each tube layer.
double tubeLength(const IdentifierHash &hash) const
bool isBarrel() const
States whether the chamber is built into the barrel or not.
double moduleThickness() const
Returns the thickness of the chamber.
static IdentifierHash measurementHash(unsigned int layerNumber, unsigned int tubeNumber)
Transform the layer and tube number to the measurementHash.
Amg::Transform3D toChamberLayer(const IdentifierHash &hash) const
Returns the transformation into the rest frame of the tube x-axis: Pointing towards the next layer y-...
The MuonReadoutElement is an abstract class representing the geometry representing the muon detector.
double activeTubeLength(const IdentifierHash &hash) const
multilayer_t
MDT multi-layer index.
StatusCode createGeoTransform()
Helper struct to retrieve the tube lengths and the tube centers directly from the GeoModel tree.
float getParameter(const Parameter p) const
Returns a given parameter.
StatusCode initElement() override final
Element initialization.
#define ATH_MSG_VERBOSE(x)
#define AmgSymMatrix(dim)
double tubeRadius() const
Adds the thickness of the tube wall onto the radius.
double readoutSide
Is the readout chip at positive or negative Z?
Identifier measurementId(const IdentifierHash &measHash) const override final
Converts the measurement hash back to the full Identifier.
unsigned int multilayer() const
Returns the multi layer of the MdtReadoutElement.
Helper struct to cache simulatenously the As-built and the BLine corrections of the Mdts for fast acc...
double wireLength(const IdentifierHash &hash) const
static unsigned int layerNumber(const IdentifierHash &hash)
Transforms the identifier hash into a layer number ranging from (0-numLayers()-1)
Amg::Vector3D globalTubePos(const ActsTrk::GeometryContext &ctx, const Identifier &measId) const
Returns the global position of the tube center.
double halfY
Length ~ number of tubes.
Amg::Transform3D getRotateX3D(double angle)
get a rotation transformation around X-axis
double uncutTubeLength(const IdentifierHash &tubeHash) const
Returns the uncut tube length.
Helper struct to store the pointer to the Mdt distrotion parameters, namely the As-built and the BLin...
static constexpr double expansionScale
std::string toString(const Translation3D &translation, int precision=4)
GeoPrimitvesToStringConverter.
The ReadoutGeomCnvAlg converts the Run4 Readout geometry build from the GeoModelXML into the legacy M...
parameterBook m_pars
defining parameter set
double moduleWidthS() const
Returns the length of the bottom edge of the chamber (short width)
Amg::Vector3D highVoltPos(const ActsTrk::GeometryContext &ctx, const Identifier &measId) const
Returns the global position of the High Voltage connectors.
Set of parameters to describe a MDT chamber.
const Muon::IMuonIdHelperSvc * idHelperSvc() const
Returns the pointer to the muonIdHelperSvc.
::StatusCode StatusCode
StatusCode definition for legacy code.
unsigned int numLayers() const
Returns the number of tube layer.
Eigen::Affine3d Transform3D
const Amg::Transform3D & localToGlobalTrans(const ActsTrk::GeometryContext &ctx) const
Returns the local to global transformation into the ATLAS coordinate system.
MsgStream & operator<<(MsgStream &out, const ActsUtils::Stat &stat)
double moduleHeight() const
Returns the height of the chamber (Distance bottom - topWidth)
Identifier channelID(int stationName, int stationEta, int stationPhi, int multilayer, int tubeLayer, int tube) const
static IdentifierHash geoTransformHash()
Returns the hash that is associated with the surface cache holding the transformation that is placing...
const GeoAlignableTransform * alignableTransform() const
Returnsthe alignable transform of the readout element.
StatusCode strawSurfaceFactory(const IdentifierHash &hash, std::shared_ptr< Acts::LineBounds > lBounds)
Identifier identify() const override final
Return the athena identifier.
double tubePitch() const
Returns the pitch between 2 tubes in a layer.
Eigen::Matrix< double, 3, 1 > Vector3D
double tubePitch
Distance between 2 tubes in the layer.
double thickness() const override final
Overload from the Acts::DetectorElement (2 * halfheight)
static unsigned int tubeNumber(const IdentifierHash &hash)
Transforms the idenfier hash into a tube number ranging from (0- numTubesInLay()-1)
Amg::Vector3D bLineReferencePoint() const
Returns the fixed point of the B-line & as-bult defromation model expressed in the as-built frame.
double endPlugLength
Depth of the endplug into the active tube volume.
const MdtIdHelper & m_idHelper
Detector identifier helper to quickly extract the ID fields.
double shortHalfX
The chambers have either a rectangular or a trapezoidal shape to first approximation.
Container classifier the MDT as-built parameters See parameter description in http://atlas-muon-align...
StatusCode planeSurfaceFactory(const IdentifierHash &hash, std::shared_ptr< Acts::PlanarBounds > pBounds)
#define ATH_MSG_WARNING(x)
Amg::Transform3D fromIdealToDeformed(const IdentifierHash &tubeHash, const ActsTrk::DetectorAlignStore *store) const
Applies the B & as-built parameters.
void setComplementaryReadoutEle(const MdtReadoutElement *other)
Set the link to the second readout element inside the muon station.
double distanceToReadout(const ActsTrk::GeometryContext &ctx, const Identifier &measId, const Amg::Vector3D &globPoint) const
Returns the distance along the wire from the readout card The distance is given as the delta z of the...
const PlainObject unit() const
This is a plugin that makes Eigen look like CLHEP & defines some convenience methods.
Eigen::AngleAxisd AngleAxis3D
The AlignStoreProviderAlg loads the rigid alignment corrections and pipes them through the readout ge...
int stationEta() const
Returns the stationEta (positive A site, negative O site)
const parameterBook & getParameters() const
Amg::Transform3D toTubeFrame(const IdentifierHash &hash) const
Returns the transformation into the rest frame of the tube x-axis: Pointing towards the next layer y-...
double moduleWidthL() const
Returns the length of the top edge of the chamber (top width)
Amg::Transform3D globalToLocalTrans(const ActsTrk::GeometryContext &ctx) const
Transformations to translate between local <-> global coordinates.
Amg::Vector3D applyBlineCorrections(const BLinePar &bline, const Amg::Vector3D &localTubeEndPoint, const Amg::Vector3D &fixedPoint, const double thickness) const
Apply the B-line model correction to a tube endpoint.
Scalar mag() const
mag method
Amg::Vector3D wireEndpointAsBuilt(const MdtAsBuiltPar &asBuilt, const IdentifierHash &tubeHash, const Amg::Vector3D &nominalEnd, const tubeSide_t side) const
Amg::Transform3D getTranslate3D(const double X, const double Y, const double Z)
: Returns a shift transformation along an arbitrary axis