|
ATLAS Offline Software
|
Go to the documentation of this file.
8 #include <GeoModelHelpers/TransformToStringConverter.h>
11 #include <GaudiKernel/SystemOfUnits.h>
16 #ifndef SIMULATIONBASE
18 # include "Acts/Surfaces/TrapezoidBounds.hpp"
19 # include "Acts/Surfaces/LineBounds.hpp"
20 # include "Acts/Surfaces/Surface.hpp"
28 ostr <<
" // Chamber half- length (min/max): "<<
pars.shortHalfX<<
"/"<<
pars.longHalfX
29 <<
", half-width "<<
pars.halfY<<
", height: "<<
pars.halfHeight;
30 ostr <<
" // Number of tube layers " <<
pars.tubeLayers.size()<< std::endl;
31 ostr <<
" // Tube pitch: " <<
pars.tubePitch
32 <<
" wall thickness: " <<
pars.tubeWall
33 <<
" inner radius: " <<
pars.tubeInnerRad
34 <<
" endplug: "<<
pars.endPlugLength
35 <<
" deadlength: "<<
pars.deadLength<< std::endl;
37 ostr <<
" // **** "<<
Amg::toString(
layer->tubeTransform(0).translation(), 2)<<std::endl;
41 MdtReadoutElement::~MdtReadoutElement() =
default;
44 m_pars{std::move(
args)} {
57 return StatusCode::FAILURE;
61 return StatusCode::FAILURE;
63 #ifndef SIMULATIONBASE
72 std::optional<Amg::Vector3D> prevLayPos{std::nullopt};
74 for (
unsigned int lay =1 ; lay <=
numLayers() ; ++lay) {
77 ATH_CHECK(insertTransform<MdtReadoutElement>(layHash));
78 #ifdef SIMULATIONBASE_REMOVEPLANESURFACE
83 std::optional<Amg::Vector3D> prevTubePos{std::nullopt};
90 prevTubePos = std::nullopt;
93 ATH_CHECK(insertTransform<MdtReadoutElement>(idHash));
94 #ifndef SIMULATIONBASE
100 if (std::abs(tubeRot.determinant()- 1.) > std::numeric_limits<float>::epsilon()){
101 ATH_MSG_FATAL(__FILE__<<
":"<<__LINE__<<
" Transformation matrix is not a pure rotation for "<<
104 return StatusCode::FAILURE;
111 const double dR = std::abs((tubePos - (*prevTubePos)).
z());
112 if (std::abs(dR -
tubePitch()) > pitchTolerance) {
113 ATH_MSG_FATAL(__FILE__<<
":"<<__LINE__<<
" Detected irregular tube in "<<
115 <<
". Expected tube pitch: "<<
tubePitch()<<
" measured tube pitch: "
118 return StatusCode::FAILURE;
121 if (prevLayPos &&
tube == 1) {
122 const double dR = (tubePos - (*prevLayPos)).
mag();
123 if (std::abs(dR -
tubePitch()) > pitchTolerance) {
124 ATH_MSG_FATAL(__FILE__<<
":"<<__LINE__<<
" Detected irregular layer pitch in "<<
126 <<
". Expected tube pitch: "<<
tubePitch()<<
" measured tube pitch: "
132 prevLayPos = std::make_optional<Amg::Vector3D>(tubePos);
134 prevTubePos = std::make_optional<Amg::Vector3D>(tubePos);
137 #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,
213 getMaterialGeom()->getParent()->getX() *
214 getMaterialGeom()->getX();
222 return refEle->
asBuiltRefFrame()*(-0.5*( refEle->moduleThickness() *Amg::Vector3D::UnitX() +
223 (
stationEta() >0 || !
isBarrel() ? 1. : -1.)*refEle->moduleHeight() * Amg::Vector3D::UnitZ()));
225 #ifndef SIMULATIONBASE
227 const IdentifierHash& tubeHash,
237 const multilayer_t ml = (
multilayer() == 1) ? multilayer_t::ML1 : multilayer_t::ML2;
255 const int layer_delta = ml == multilayer_t::ML1 ?
numLayers() - tubeLayer : tubeLayer +1;
259 const double zpitch =
params.zpitch(ml,
side);
260 const double ypitch =
params.ypitch(ml,
side);
271 const double offset_stagg = 0.5 * zpitch * stagg * ( (layer_delta-1) % 2);
273 tube* zpitch + offset_stagg,
274 (layer_delta-1) * ypitch};
278 ATH_MSG_VERBOSE(
"Off set staggering "<<offset_stagg<<
", layer_delta: "<<layer_delta<<
", zpitch: "<<zpitch<<
", ypitch: "<<ypitch
279 <<
", xshift: "<<xshift);
282 reference_point.y() +
z0 + endPlug.y(),
283 reference_point.z() + y0 + endPlug.z());
299 const double chamberThickness)
const {
325 double s0 = deformedPos.x();
326 double z0 = deformedPos.y();
327 double t0 = deformedPos.z();
329 <<
" " << chamberHeight <<
" " << chamberThickness <<
" " );
333 if (std::abs(fixedPoint.x()) > 0.01) s0mdt = s0 - fixedPoint.x();
337 if (std::abs(fixedPoint.y()) > 0.01) z0mdt =
z0 - fixedPoint.y();
339 if (std::abs(fixedPoint.z()) > 0.01) t0mdt = t0 - fixedPoint.z();
340 if (z0mdt < 0 || t0mdt < 0) {
341 ATH_MSG_WARNING(
""<<__func__<<
": correcting the local position of a point outside the mdt station (2 multilayers) volume -- RE "
345 ATH_MSG_VERBOSE(
"** In "<<__func__<<
" - correct for offset of B-line fixed point " << s0mdt <<
" " << z0mdt <<
" " << t0mdt);
348 const double s_rel = s0mdt / (width_actual / 2.);
349 const double z_rel = (z0mdt - chamberHeight / 2.) / (chamberHeight / 2.);
350 const double t_rel = (t0mdt - chamberThickness / 2.) / (chamberThickness / 2.);
352 ATH_MSG_VERBOSE(
"** In "<<__func__<<
" - width_actual, s_rel, z_rel, t_rel " << width_actual <<
" " << s_rel <<
" "
353 << z_rel <<
" " << t_rel );
354 double ds{0.},dz{0.},
dt{0.};
358 double ztmp = z_rel * z_rel - 1;
366 dz += bline.
getParameter(Parameter::tw) * s_rel * t_rel * chamberThickness / chamberHeight;
386 const double ep = bline.
getParameter(Parameter::ep) * expansionScale;
388 const double phi = 0.5 * (ep +
en) * s_rel * s_rel + 0.5 * (ep -
en) * s_rel;
389 const double localDt = phi * (t0mdt - chamberThickness / 2.);
390 const double localDz = phi * (z0mdt - chamberHeight / 2.);
396 deformedPos[0] = s0 +
ds;
397 deformedPos[1] =
z0 + dz;
398 deformedPos[2] = t0 +
dt;
411 return Amg::Transform3D::Identity();
413 #ifdef SIMULATIONBASE
414 return Amg::Transform3D::Identity();
422 return Amg::Transform3D::Identity();
434 const double relSign = (
multilayer() == 1 ? -1. : 1.);
438 const double thickness = relSign*( (toAMDB* (modHalfThick*Amg::Vector3D::UnitX())) -
449 if (distortPars.asBuilt) {
455 if (distortPars.bLine) {
464 <<
", thickness: "<<
thickness<<
", height: "<<height);
468 positiveEnd = fromAMDB * positiveEnd;
469 negativeEnd = fromAMDB * negativeEnd;
470 positiveEndBline = fromAMDB * positiveEndBline;
471 negativeEndBline = fromAMDB * negativeEndBline;
481 const Amg::Vector3D new_direction = (positiveEndBline - negativeEndBline).
unit();
482 const Amg::Vector3D rotation_vector = old_direction.cross(new_direction);
485 if (rotation_vector.mag() > 10. * std::numeric_limits<double>::epsilon()) {
486 const Amg::AngleAxis3D wire_rotation(std::asin(rotation_vector.mag()), rotation_vector.unit());
487 deformedTransform = from_center * wire_rotation * to_center;
489 deformedTransform = from_center * to_center;
494 return deformedTransform;
The TransientConstSharedPtr allows non-const access if the pointer itself is non-const but in the con...
ActsTrk::SurfaceBoundSetPtr< Acts::LineBounds > tubeBounds
Sets of surface bounds which is shared amongst all readout elements used to assign the same bound obj...
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.
const MdtReadoutElement * m_reOtherMl
Complementary readout element.
ActsTrk::SurfaceBoundSetPtr< Acts::TrapezoidBounds > layerBounds
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
Amg::Vector3D readOutPos(const ActsGeometryContext &ctx, const Identifier &measId) const
Returns the global position of the readout card.
multilayer_t
MDT multi-layer index.
StatusCode createGeoTransform()
Helper struct to retrieve the tube lengths and the tube centers directly from the GeoModel tree.
Amg::Transform3D globalToLocalTrans(const ActsGeometryContext &ctx) const
Transformations to translate between local <-> global coordinates.
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)
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)
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
MsgStream & operator<<(MsgStream &out, const ActsUtils::Stat &stat)
Include the GeoPrimitives which need to be put first.
double innerTubeRadius() const
Returns the inner tube radius.
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
double distanceToReadout(const ActsGeometryContext &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...
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.
const PlainObject unit() const
This is a plugin that makes Eigen look like CLHEP & defines some convenience methods.
const Amg::Transform3D & localToGlobalTrans(const ActsGeometryContext &ctx) const
Returns the local to global transformation into the ATLAS coordinate system.
Amg::Vector3D globalTubePos(const ActsGeometryContext &ctx, const Identifier &measId) const
Returns the global position of the tube center.
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-...
Amg::Vector3D highVoltPos(const ActsGeometryContext &ctx, const Identifier &measId) const
Returns the global position of the High Voltage connectors.
double moduleWidthL() const
Returns the length of the top edge of the chamber (top width)
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