 |
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
99 if (std::abs(tubeRot.determinant()- 1.) > std::numeric_limits<float>::epsilon()){
100 ATH_MSG_FATAL(__FILE__<<
":"<<__LINE__<<
" Transformation matrix is not a pure rotation for "<<
103 return StatusCode::FAILURE;
110 const double dR = std::abs((tubePos - (*prevTubePos)).
z());
111 if (std::abs(dR -
tubePitch()) > pitchTolerance) {
112 ATH_MSG_FATAL(__FILE__<<
":"<<__LINE__<<
" Detected irregular tube in "<<
114 <<
". Expected tube pitch: "<<
tubePitch()<<
" measured tube pitch: "
117 return StatusCode::FAILURE;
120 if (prevLayPos &&
tube == 1) {
121 const double dR = (tubePos - (*prevLayPos)).
mag();
122 if (std::abs(dR -
tubePitch()) > pitchTolerance) {
123 ATH_MSG_FATAL(__FILE__<<
":"<<__LINE__<<
" Detected irregular layer pitch in "<<
125 <<
". Expected tube pitch: "<<
tubePitch()<<
" measured tube pitch: "
131 prevLayPos = std::make_optional<Amg::Vector3D>(tubePos);
133 prevTubePos = std::make_optional<Amg::Vector3D>(tubePos);
136 #ifndef SIMULATIONBASE
139 return StatusCode::SUCCESS;
143 const IdentifierHash&
hash)
const {
151 const IdentifierHash&
hash)
const {
156 const IdentifierHash&
hash)
const {
163 return zeroT.layerTransform();
169 return zeroT.tubeTransform(
tube);
175 return 2. * zeroT.tubeHalfLength(
tube);
181 return 2.*zeroT.uncutHalfLength(
tube);
190 const IdentifierHash& measHash,
211 getMaterialGeom()->getParent()->getX() *
212 getMaterialGeom()->getX();
220 return refEle->
asBuiltRefFrame()*(-0.5*( refEle->moduleThickness() *Amg::Vector3D::UnitX() +
221 (
stationEta() >0 || !
isBarrel() ? 1. : -1.)*refEle->moduleHeight() * Amg::Vector3D::UnitZ()));
223 #ifndef SIMULATIONBASE
225 const IdentifierHash& tubeHash,
235 const multilayer_t ml = (
multilayer() == 1) ? multilayer_t::ML1 : multilayer_t::ML2;
253 const int layer_delta = ml == multilayer_t::ML1 ?
numLayers() - tubeLayer : tubeLayer +1;
257 const double zpitch =
params.zpitch(ml,
side);
258 const double ypitch =
params.ypitch(ml,
side);
269 const double offset_stagg = 0.5 * zpitch * stagg * ( (layer_delta-1) % 2);
271 tube* zpitch + offset_stagg,
272 (layer_delta-1) * ypitch};
276 ATH_MSG_VERBOSE(
"Off set staggering "<<offset_stagg<<
", layer_delta: "<<layer_delta<<
", zpitch: "<<zpitch<<
", ypitch: "<<ypitch
277 <<
", xshift: "<<xshift);
280 reference_point.y() +
z0 + endPlug.y(),
281 reference_point.z() + y0 + endPlug.z());
297 const double chamberThickness)
const {
324 <<
moduleWidthL() <<
", height: "<<chamberHeight<<
", thickness: " <<chamberThickness <<
"." );
327 double s0mdt = localTubeEndPoint.x();
328 if (std::abs(fixedPoint.x()) > 0.01) {
329 s0mdt = localTubeEndPoint.x() - fixedPoint.x();
331 double z0mdt = localTubeEndPoint.y();
335 if (std::abs(fixedPoint.y()) > 0.01) {
336 z0mdt = localTubeEndPoint.y() - fixedPoint.y();
338 double t0mdt = localTubeEndPoint.z();
339 if (std::abs(fixedPoint.z()) > 0.01) {
340 t0mdt = localTubeEndPoint.z() - fixedPoint.z();
342 if (z0mdt < 0 || t0mdt < 0) {
343 ATH_MSG_WARNING(
""<<__func__<<
": correcting the local position of a point outside the mdt station (2 multilayers) volume -- RE "
345 <<
" fixedPoint " <<
Amg::toString(fixedPoint)<<
", z0mdt: "<<z0mdt<<
", t0mdt"<<t0mdt);
347 ATH_MSG_VERBOSE(
"** In "<<__func__<<
" - correct for offset of B-line fixed point " << s0mdt <<
" " << z0mdt <<
" " << t0mdt);
351 const double s_rel = s0mdt / (width_actual / 2.);
352 const double z_rel = (z0mdt - chamberHeight / 2.) / (chamberHeight / 2.);
353 const double t_rel = (t0mdt - chamberThickness / 2.) / (chamberThickness / 2.);
355 ATH_MSG_VERBOSE(
"** In "<<__func__<<
" - width_actual: "<<width_actual<<
", s_rel: "<<s_rel<<
", z_rel: "<<z_rel
356 <<
", t_rel:" << t_rel );
357 double ds{0.},dz{0.},
dt{0.};
361 double ztmp = z_rel * z_rel - 1;
369 dz += bline.
getParameter(Parameter::tw) * s_rel * t_rel * chamberThickness / chamberHeight;
389 const double ep = bline.
getParameter(Parameter::ep) * expansionScale;
391 const double phi = 0.5 * (ep +
en) * s_rel * s_rel + 0.5 * (ep -
en) * s_rel;
392 const double localDt = phi * (t0mdt - chamberThickness / 2.);
393 const double localDz = phi * (z0mdt - chamberHeight / 2.);
399 deformedPos[0] = localTubeEndPoint[0] +
ds;
400 deformedPos[1] = localTubeEndPoint[1] + dz;
401 deformedPos[2] = localTubeEndPoint[2] +
dt;
407 #ifdef SIMULATIONBASE
409 <<
"store address to make the compiler happy: "<<
store);
410 return Amg::Transform3D::Identity();
415 return Amg::Transform3D::Identity();
423 return Amg::Transform3D::Identity();
435 const double relSign = (
multilayer() == 1 ? -1. : 1.);
440 const double thickness = relSign*( (toAMDB* (modHalfThick*Amg::Vector3D::UnitX())) -
451 if (distortPars.asBuilt) {
457 if (distortPars.bLine) {
466 <<
", thickness: "<<
thickness<<
", height: "<<height);
470 positiveEnd = fromAMDB * positiveEnd;
471 negativeEnd = fromAMDB * negativeEnd;
472 positiveEndBline = fromAMDB * positiveEndBline;
473 negativeEndBline = fromAMDB * negativeEndBline;
483 const Amg::Vector3D new_direction = (positiveEndBline - negativeEndBline).
unit();
484 const Amg::Vector3D rotation_vector = old_direction.cross(new_direction);
487 if (rotation_vector.mag() > 10. * std::numeric_limits<double>::epsilon()) {
488 const Amg::AngleAxis3D wire_rotation(std::asin(rotation_vector.mag()), rotation_vector.unit());
489 deformedTransform = from_center * wire_rotation * to_center;
491 deformedTransform = from_center * to_center;
496 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.
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
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