ATLAS Offline Software
MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/MdtReadoutElement.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
5 
8 #include <GeoModelHelpers/TransformToStringConverter.h>
11 #include <GaudiKernel/SystemOfUnits.h>
12 
13 #include <optional>
14 
15 
16 #ifndef SIMULATIONBASE
18 # include "Acts/Surfaces/TrapezoidBounds.hpp"
19 # include "Acts/Surfaces/LineBounds.hpp"
20 # include "Acts/Surfaces/Surface.hpp"
21 #endif
22 
23 using namespace ActsTrk;
24 
25 namespace MuonGMR4 {
26 std::ostream& operator<<(std::ostream& ostr, const MuonGMR4::MdtReadoutElement::parameterBook& pars) {
27  ostr << std::endl;
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;
36  for (const MdtTubeLayerPtr& layer : pars.tubeLayers) {
37  ostr << " // **** "<< Amg::toString(layer->tubeTransform(0).translation(), 2)<<std::endl;
38  }
39  return ostr;
40 }
41 MdtReadoutElement::~MdtReadoutElement() = default;
42 MdtReadoutElement::MdtReadoutElement(defineArgs&& args)
44  m_pars{std::move(args)} {
45 }
47 Identifier MdtReadoutElement::measurementId(const IdentifierHash& measHash) const {
49  layerNumber(measHash) + 1,
50  tubeNumber(measHash) + 1);
51 }
55  if (!numLayers() || !numTubesInLay()) {
56  ATH_MSG_FATAL("The readout element "<< idHelperSvc()->toStringDetEl(identify())<<" has no tubes. Please check "<<std::endl<<m_pars);
57  return StatusCode::FAILURE;
58  }
59  if (m_pars.tubePitch<=tubeRadius()) {
60  ATH_MSG_FATAL("The tubes of "<<idHelperSvc()->toStringDetEl(identify())<<" will fall together on a single point. Please check "<<std::endl<<m_pars);
61  return StatusCode::FAILURE;
62  }
63 #ifndef SIMULATIONBASE
67  m_pars.halfY)));
68 #endif
69 
72  std::optional<Amg::Vector3D> prevLayPos{std::nullopt};
73 
74  for (unsigned int lay =1 ; lay <= numLayers() ; ++lay) {
76  const IdentifierHash layHash = measurementHash(lay,0);
77  ATH_CHECK(insertTransform<MdtReadoutElement>(layHash));
78 #ifdef SIMULATIONBASE_REMOVEPLANESURFACE
81  m_pars.halfY)));
82 #endif
83  std::optional<Amg::Vector3D> prevTubePos{std::nullopt};
86 
87  for (unsigned int tube = 1; tube <= numTubesInLay(); ++ tube) {
88  const IdentifierHash idHash = measurementHash(lay,tube);
89  if (m_pars.removedTubes.count(idHash)) {
90  prevTubePos = std::nullopt;
91  continue;
92  }
93  ATH_CHECK(insertTransform<MdtReadoutElement>(idHash));
94 #ifndef SIMULATIONBASE
95  ATH_CHECK(strawSurfaceFactory(idHash, m_pars.tubeBounds->make_bounds(innerTubeRadius(), 0.5*tubeLength(idHash))));
96 #endif
97  GeoTrf::Transform3D tubeFrame = layer.tubeTransform(tubeNumber(idHash));
99  const AmgSymMatrix(3) tubeRot = tubeFrame.linear();
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 "<<
102  idHelperSvc()->toStringDetEl(identify())<<" in layer: "<<lay<<", tube: "<<tube
103  <<Amg::toString(tubeFrame));
104  return StatusCode::FAILURE;
105  }
107  const Amg::Vector3D tubePos = tubeFrame.translation();
108 
109  constexpr double pitchTolerance = 20. * Gaudi::Units::micrometer;
110  if (prevTubePos) {
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 "<<
114  idHelperSvc()->toStringDetEl(identify())<<" in layer: "<<lay<<", tube: "<<tube
115  <<". Expected tube pitch: "<<tubePitch()<<" measured tube pitch: "
116  <<dR<<" tube position: "<<Amg::toString(tubePos,2)
117  <<" previous: "<<Amg::toString((*prevTubePos), 2));
118  return StatusCode::FAILURE;
119  }
120  }
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 "<<
125  idHelperSvc()->toStringDetEl(identify())<<" for layer "<<lay
126  <<". Expected tube pitch: "<<tubePitch()<<" measured tube pitch: "
127  <<dR<<" tube position: "<<Amg::toString(tubePos,2)
128  <<" previous:"<<Amg::toString((*prevLayPos), 2));
129  }
130  }
131  if (tube == 1) {
132  prevLayPos = std::make_optional<Amg::Vector3D>(tubePos);
133  }
134  prevTubePos = std::make_optional<Amg::Vector3D>(tubePos);
135  }
136  }
137 #ifndef SIMULATIONBASE
138  m_pars.tubeBounds.reset();
139  m_pars.layerBounds.reset();
140 #endif
141  return StatusCode::SUCCESS;
142 }
143 
145  const IdentifierHash& hash) const {
146  return localToGlobalTrans(ctx, hash).translation();
147 }
148 
149 Amg::Vector3D MdtReadoutElement::localTubePos(const IdentifierHash& hash) const {
150  return toTubeFrame(hash).translation();
151 }
153  const IdentifierHash& hash) const {
154  return localToGlobalTrans(ctx, hash) *
155  (0.5*activeTubeLength(hash) * m_pars.readoutSide * Amg::Vector3D::UnitZ());
156 }
158  const IdentifierHash& hash) const {
159  return localToGlobalTrans(ctx, hash) *
160  (-0.5*activeTubeLength(hash) * m_pars.readoutSide * Amg::Vector3D::UnitZ());
161 }
163  const unsigned int layer = layerNumber(hash);
164  const MdtTubeLayer& zeroT{*m_pars.tubeLayers[layer]};
165  return zeroT.layerTransform();
166 }
168  const unsigned int layer = layerNumber(hash);
169  const unsigned int tube = tubeNumber(hash);
170  const MdtTubeLayer& zeroT{*m_pars.tubeLayers[layer]};
171  return zeroT.tubeTransform(tube);
172 }
173 double MdtReadoutElement::activeTubeLength(const IdentifierHash& hash) const {
174  const unsigned int layer = layerNumber(hash);
175  const unsigned int tube = tubeNumber(hash);
176  const MdtTubeLayer& zeroT{*m_pars.tubeLayers[layer]};
177  return 2. * zeroT.tubeHalfLength(tube);
178 }
179 double MdtReadoutElement::uncutTubeLength(const IdentifierHash& tubeHash) const {
180  const unsigned int layer = layerNumber(tubeHash);
181  const unsigned int tube = tubeNumber(tubeHash);
182  const MdtTubeLayer& zeroT{*m_pars.tubeLayers[layer]};
183  return 2.*zeroT.uncutHalfLength(tube);
184 }
185 double MdtReadoutElement::tubeLength(const IdentifierHash& hash) const {
186  return activeTubeLength(hash) + 2.*m_pars.deadLength;
187 }
188 double MdtReadoutElement::wireLength(const IdentifierHash& hash) const {
189  return tubeLength(hash) - 2.*m_pars.endPlugLength;
190 }
192  const IdentifierHash& measHash,
193  const Amg::Vector3D& globPoint) const {
194  return distanceToReadout(measHash, globalToLocalTrans(ctx, measHash) * globPoint);
195 
196 }
197 double MdtReadoutElement::distanceToReadout(const IdentifierHash& measHash,
198  const Amg::Vector3D& localPoint) const {
200  const unsigned int layer = layerNumber(measHash);
201  const unsigned int tube = tubeNumber(measHash);
202  const MdtTubeLayer& zeroT{*m_pars.tubeLayers[layer]};
203  const double readOutPos = m_pars.readoutSide * zeroT.tubeHalfLength(tube);
204  return std::abs(readOutPos - localPoint.z());
205 }
206 
208  m_reOtherMl = other;
209 }
210 
212  return alignableTransform()->getDefTransform().inverse()*
213  getMaterialGeom()->getParent()->getX() *
214  getMaterialGeom()->getX();
215 }
216 
218  /* The fix point is the point that's closest to the interaction point.
219  / Recall that the readout element origin is expressed in the geometric centre &
220  the x-axis points upwards. The point is then transformed into the Muon station frame */
221  const MdtReadoutElement* refEle{multilayer() == 1 ? this : m_reOtherMl};
222  return refEle->asBuiltRefFrame()*(-0.5*( refEle->moduleThickness() *Amg::Vector3D::UnitX() +
223  (stationEta() >0 || !isBarrel() ? 1. : -1.)*refEle->moduleHeight() * Amg::Vector3D::UnitZ()));
224 }
225 #ifndef SIMULATIONBASE
227  const IdentifierHash& tubeHash,
228  const Amg::Vector3D& wireEnd,
229  const tubeSide_t side) const {
230 
231 
232  ATH_MSG_VERBOSE( "Applying as-built parameters for chamber " << idHelperSvc()->toString(measurementId(tubeHash)));
233 
234 
236  using multilayer_t = MdtAsBuiltPar::multilayer_t;
237  const multilayer_t ml = (multilayer() == 1) ? multilayer_t::ML1 : multilayer_t::ML2;
238 
239  const IdentifierHash refLayer{measurementHash((ml == multilayer_t::ML1) ? numLayers() : 1, 1)};
240  const Amg::Vector3D refTube{localTubePos(refLayer)};
241 
242 
243  const double sideSign = 0.5*(1.- 2.*(side ==tubeSide_t::NEG));
244  // Compute the reference for the as-built parameters
245  const Amg::Vector3D reference_point = asBuiltRefFrame() *
246  Amg::Vector3D {refTube.x() + (1. - 2.*(ml == multilayer_t::ML2)) * tubeRadius(),
247  sideSign*uncutTubeLength(refLayer),
248  -0.5*moduleHeight()};
249  ATH_MSG_VERBOSE("AMDB transform "<<" "<<idHelperSvc()->toStringDetEl(identify())<<
250  " "<<GeoTrf::toString(asBuiltRefFrame(), true)<<", reference point: "<<Amg::toString(reference_point));
251 
252 
253  const int tubeLayer = layerNumber(tubeHash);
254  const int tube = tubeNumber(tubeHash);
255  const int layer_delta = ml == multilayer_t::ML1 ? numLayers() - tubeLayer : tubeLayer +1;
256 
257 
258  // Get the As-Built parameters for this ML and side of the chamber
259  const double zpitch = params.zpitch(ml, side);
260  const double ypitch = params.ypitch(ml, side);
261  const double stagg = params.stagg(ml, side);
262  const double alpha = params.alpha(ml, side);
263  const double y0 = params.y0(ml, side);
264  const double z0 = params.z0(ml, side);
265 
266  const Amg::Transform3D planeRot{Amg::getRotateX3D(-alpha)};
267  ATH_MSG_VERBOSE("Rotation angle "<<(alpha/Gaudi::Units::deg));
268 
269  // Find the vector from the reference_point to the endplug
270  // 0 for layer 1 and 3, 1 for layer 2 and 4
271  const double offset_stagg = 0.5 * zpitch * stagg * ( (layer_delta-1) % 2);
272  const Amg::Vector3D endPlug = planeRot * Amg::Vector3D{0.,
273  tube* zpitch + offset_stagg,
274  (layer_delta-1) * ypitch};
275 
276  // Calculate x position, which varies for endcap chambers
277  const double xshift = sideSign*(uncutTubeLength(tubeHash) - uncutTubeLength(refLayer));
278  ATH_MSG_VERBOSE("Off set staggering "<<offset_stagg<<", layer_delta: "<<layer_delta<<", zpitch: "<<zpitch<<", ypitch: "<<ypitch
279  <<", xshift: "<<xshift);
280 
281  Amg::Vector3D ret(reference_point.x() + xshift,
282  reference_point.y() + z0 + endPlug.y(),
283  reference_point.z() + y0 + endPlug.z());
284 
285 
286  if ((ret - wireEnd).mag() > 3. * Gaudi::Units::mm) {
287  ATH_MSG_WARNING( "Large as-built correction for chamber " << idHelperSvc()->toString(measurementId(tubeHash))
288  << ", side "<< (side == tubeSide_t::POS ? "positive" : "negative")
289  << ", endpoint "<<Amg::toString(wireEnd)<<", return: "<<Amg::toString(ret));
290  }
291  ATH_MSG_VERBOSE((side == tubeSide_t::POS ? "positive" : "negative")<<" wire end has moved from "
292  <<Amg::toString(wireEnd)<<" to "<<Amg::toString(ret)<<" End plug: "<<Amg::toString(endPlug));
293  return ret;
294 }
295 
297  const Amg::Vector3D& localTubeEndPoint,
298  const Amg::Vector3D& fixedPoint,
299  const double chamberThickness) const {
300 
301  using Parameter = BLinePar::Parameter;
302  Amg::Vector3D deformedPos{localTubeEndPoint};
303  // MDT deformations like tube bow: bz,bp,bn bend the tube while the wire endpoints are not affected
304  // => the wire keeps it's nominal straight line trajectory but it is not concentric to the tube
305  // ==> in this function bz, bp and bn are ignored or set to 0
306  // MDT deformations that extend/contract the wire longitudinally (while keeping it straight):
307  // delta_s from eg and tr are irrelevant for the tube geometry
308  // and for the wire trajectory => set to 0 here
309  // (should be applied as a correction to the
310  // tube lenght => tube surface bounds
311  // =++>>>> effect in tracking just through the gravitational sagging TOTALLY NEGLIGIBLE=> ignore)
312  // pg is irrelevant for tracking purposes and (at least for the endcaps) is applies to the internal bars only, not to the tubes !!!
313  // =++>>>> IGNORE IT
314  // ep,en: bend the tube by moving (differently) the endplugs ===> the wire straight trajectory is moved w.r.t. the nominal one
315  // in addition the tubes keep their nominal position at the center => the wire is not concentric to
316  // the tube delta_s from ep,en must also be considered for the implementation of the realistic tube
317  // trajectory induced by ep,en
318  // tw,sp,sn,pg (for deltaT and deltaZ) are geometrical effects, that impact on tracking and keep the wire straight.
319  const double chamberHeight = std::max(moduleHeight(), m_reOtherMl->moduleHeight());
320 
321 
322  // NOTE s0,z0,t0 are the coord. in the amdb frame of this point: the origin of the frame can be different than the fixed point for
323  // deformations s0mdt,z0mdt,t0mdt
324  // (always equal to the point at lowest t,z and s=0 of the MDT stack)
325  double s0 = deformedPos.x();
326  double z0 = deformedPos.y();
327  double t0 = deformedPos.z();
328  ATH_MSG_VERBOSE( "** In "<<__func__<<" - moduleWidthS, moduleWidthL(), length, thickness, " << moduleWidthS() << " " << moduleWidthL()
329  << " " << chamberHeight << " " << chamberThickness << " " );
330  ATH_MSG_VERBOSE( "** In "<<__func__<<" - going to correct for B-line the position of Point at " << Amg::toString(deformedPos));
331 
332  double s0mdt = s0; // always I think !
333  if (std::abs(fixedPoint.x()) > 0.01) s0mdt = s0 - fixedPoint.x();
334  double z0mdt = z0; // unless in the D section of this station there's a dy diff. from 0 for the innermost MDT multilayer (sometimes
335  // in the barrel)
336  // unless in the D section of this station there's a dz diff. from 0 for the innermost MDT multilayer (often in barrel)
337  if (std::abs(fixedPoint.y()) > 0.01) z0mdt = z0 - fixedPoint.y();
338  double t0mdt = t0;
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 "
342  << idHelperSvc()->toStringDetEl(identify()) << " local point: szt=" << s0 << " " << z0 << " " << t0
343  << " fixedPoint " <<Amg::toString(fixedPoint) );
344  }
345  ATH_MSG_VERBOSE( "** In "<<__func__<<" - correct for offset of B-line fixed point " << s0mdt << " " << z0mdt << " " << t0mdt);
346 
347  const double width_actual = moduleWidthS() + (moduleWidthL() - moduleWidthS()) * (z0mdt / chamberHeight);
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.);
351 
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.};
355 
356  // sp, sn - cross plate sag out of plane
357  if ( bline.getParameter(Parameter::sp) || bline.getParameter(Parameter::sn)) {
358  double ztmp = z_rel * z_rel - 1;
359  dt += 0.5 * (bline.getParameter(Parameter::sp) + bline.getParameter(Parameter::sn)) * ztmp
360  + 0.5 * (bline.getParameter(Parameter::sp) - bline.getParameter(Parameter::sn)) * ztmp * s_rel;
361  }
362 
363  // tw - twist
364  if (bline.getParameter(Parameter::tw)) {
365  dt -= bline.getParameter(Parameter::tw) * s_rel * z_rel;
366  dz += bline.getParameter(Parameter::tw) * s_rel * t_rel * chamberThickness / chamberHeight;
367  ATH_MSG_VERBOSE( "** In "<<__func__<<": tw=" << bline.getParameter(Parameter::tw) << " dt, dz " << dt << " " << dz );
368  }
369 
370  constexpr double expansionScale = BLinePar::expansionScale;
371  // eg - global expansion
372  if (bline.getParameter(Parameter::eg)) {
373  double egppm = bline.getParameter(Parameter::eg) * expansionScale;
374  ds += 0.;
375  dz += z0mdt * egppm;
376  dt += t0mdt * egppm;
377  }
378 
379  // ep, en - local expansion
380  //
381  // Imporant note: the chamber height and length, as they denoted in Christoph's talk,
382  // correspond to thickness and height parameters of this function;
383  //
384 
385  if (bline.getParameter(Parameter::ep) || bline.getParameter(Parameter::en)) {
386  const double ep = bline.getParameter(Parameter::ep) * expansionScale;
387  const double en = bline.getParameter(Parameter::en) * 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.);
391  dt += localDt;
392  dz += localDz;
393  }
394 
395  ATH_MSG_VERBOSE( "posOnDefChamStraighWire: ds,z,t = " << ds << " " << dz << " " << dt );
396  deformedPos[0] = s0 + ds;
397  deformedPos[1] = z0 + dz;
398  deformedPos[2] = t0 + dt;
399 
400 
401  return deformedPos;
402 }
403 #endif
405  const ActsTrk::DetectorAlignStore* store) const {
406 
408  if (!store || !store->internalAlignment) {
409  ATH_MSG_VERBOSE("No deformed transformation available "<<idHelperSvc()->toString(measurementId(tubeHash)));
410 
411  return Amg::Transform3D::Identity();
412  }
413 #ifdef SIMULATIONBASE
414  return Amg::Transform3D::Identity();
415 #else
416  using ChamberDistortions = MdtAlignmentStore::chamberDistortions;
417 
419  const ChamberDistortions distortPars = static_cast<const MdtAlignmentStore&>(*store->internalAlignment).getDistortion(identify());
420  if (!distortPars) {
421  ATH_MSG_VERBOSE("No set of deformation parameters is in the DB for "<<idHelperSvc()->toString(measurementId(tubeHash)));
422  return Amg::Transform3D::Identity();
423  }
424 
425  const Amg::Vector3D fixedPoint{bLineReferencePoint()};
426 
427 
428  const double height = std::max(moduleHeight(), m_reOtherMl->moduleHeight()) -
429  (tubePitch() - 2. * tubeRadius());
430 
431  const Amg::Transform3D toAMDB{asBuiltRefFrame()};
434  const double relSign = (multilayer() == 1 ? -1. : 1.);
435  const double modHalfThick{0.5*relSign*moduleThickness()},
436  modHalTHickO{-0.5*relSign*m_reOtherMl->moduleThickness()};
437 
438  const double thickness = relSign*( (toAMDB* (modHalfThick*Amg::Vector3D::UnitX())) -
439  (m_reOtherMl->asBuiltRefFrame()*(modHalTHickO* Amg::Vector3D::UnitX()))).z();
440 
441 
442  Amg::Vector3D idealTube = localTubePos(tubeHash);
444  idealTube[Amg::y] = 0.;
445 
446  Amg::Vector3D positiveEnd = toAMDB * (idealTube + 0.5 * uncutTubeLength(tubeHash) * Amg::Vector3D::UnitY());
447  Amg::Vector3D negativeEnd = toAMDB * (idealTube - 0.5 * uncutTubeLength(tubeHash) * Amg::Vector3D::UnitY());
449  if (distortPars.asBuilt) {
450  positiveEnd = wireEndpointAsBuilt(*distortPars.asBuilt, tubeHash, positiveEnd, tubeSide_t::POS);
451  negativeEnd = wireEndpointAsBuilt(*distortPars.asBuilt, tubeHash, negativeEnd, tubeSide_t::NEG);
452  }
453  Amg::Vector3D positiveEndBline{positiveEnd};
454  Amg::Vector3D negativeEndBline{negativeEnd};
455  if (distortPars.bLine) {
456  positiveEndBline = applyBlineCorrections(*distortPars.bLine, positiveEndBline, fixedPoint, thickness);
457  negativeEndBline = applyBlineCorrections(*distortPars.bLine, negativeEndBline, fixedPoint, thickness);
458  }
459 
460  ATH_MSG_VERBOSE("Calculate the deformation parameters of "<<idHelperSvc()->toString(measurementId(tubeHash))
461  <<", ideal tube "<<Amg::toString(idealTube)
462  <<", fixed point "<<Amg::toString(fixedPoint)
463  <<"/ "<<Amg::toString(alignableTransform()->getDefTransform() * fixedPoint)
464  <<", thickness: "<<thickness<<", height: "<<height);
465 
466  const Amg::Transform3D fromAMDB{toAMDB.inverse()};
468  positiveEnd = fromAMDB * positiveEnd;
469  negativeEnd = fromAMDB * negativeEnd;
470  positiveEndBline = fromAMDB * positiveEndBline;
471  negativeEndBline = fromAMDB * negativeEndBline;
472 
473  // Calculate deformation. Make sure that the wire length stays the same.
474  // Code in positionOnDeformedChamber does not provide this by default.
475  // Break transformation into translation of the wire center and the rotation of the wire
476  // Move to the coordinate system originated at the wire center, then rotate the wire, then
477  // move wire center to the new position
478  const Amg::Transform3D to_center{Amg::getTranslate3D(-idealTube)};
479  const Amg::Transform3D from_center{Amg::getTranslate3D( 0.5 * (positiveEndBline + negativeEndBline))};
480  const Amg::Vector3D old_direction = (positiveEnd - negativeEnd).unit();
481  const Amg::Vector3D new_direction = (positiveEndBline - negativeEndBline).unit();
482  const Amg::Vector3D rotation_vector = old_direction.cross(new_direction);
483 
484  Amg::Transform3D deformedTransform{Amg::Transform3D::Identity()};
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;
488  } else {
489  deformedTransform = from_center * to_center;
490  }
491  ATH_MSG_VERBOSE("To center "<<GeoTrf::toString(to_center)<<" from: "<<GeoTrf::toString(from_center)<<
492  " -- direction: "<<GeoTrf::toString(old_direction)<<" vs. "<<GeoTrf::toString(new_direction)
493  <<" --> rot: "<<GeoTrf::toString(rotation_vector)<<" ==> "<<GeoTrf::toString(deformedTransform,true));
494  return deformedTransform;
495 #endif
496 }
497 
498 
499 } // namespace MuonGMR4
make_hlt_rep.pars
pars
Definition: make_hlt_rep.py:90
SGTest::store
TestStore store
Definition: TestStore.cxx:23
GeoModel::TransientConstSharedPtr
The TransientConstSharedPtr allows non-const access if the pointer itself is non-const but in the con...
Definition: TransientConstSharedPtr.h:13
checkxAOD.ds
ds
Definition: Tools/PyUtils/bin/checkxAOD.py:260
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
MuonGMR4::MdtReadoutElement::parameterBook::tubeBounds
ActsTrk::SurfaceBoundSetPtr< Acts::LineBounds > tubeBounds
Sets of surface bounds which is shared amongst all readout elements used to assign the same bound obj...
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/MdtReadoutElement.h:69
MuonGMR4::MdtReadoutElement::asBuiltRefFrame
Amg::Transform3D asBuiltRefFrame() const
Returns the transformation to go into the reference frame of the as-buit & b-line model starting from...
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/MdtReadoutElement.cxx:211
MuonGMR4::MdtReadoutElement::localTubePos
Amg::Vector3D localTubePos(const IdentifierHash &hash) const
Returns the tube position in the chamber coordinate frame (Not applying the B-line corrections)
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/MdtReadoutElement.cxx:149
MuonGMR4::MdtReadoutElement::parameterBook::removedTubes
std::set< IdentifierHash > removedTubes
List of tube places without tubes.
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/MdtReadoutElement.h:35
MuonGMR4::MdtReadoutElement::numTubesInLay
unsigned int numTubesInLay() const
Returns the number of tubes per layer.
AthCheckMacros.h
ParticleTest.eg
eg
Definition: ParticleTest.py:29
MuonGMR4::MdtReadoutElement::m_reOtherMl
const MdtReadoutElement * m_reOtherMl
Complementary readout element.
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/MdtReadoutElement.h:250
MuonGMR4::MdtReadoutElement::parameterBook::layerBounds
ActsTrk::SurfaceBoundSetPtr< Acts::TrapezoidBounds > layerBounds
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/MdtReadoutElement.h:70
MuonGMR4::MdtReadoutElement::parameterBook::tubeLayers
std::vector< MdtTubeLayerPtr > tubeLayers
Vector defining the position of all tubes in each tube layer.
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/MdtReadoutElement.h:32
ActsTrk::DetectorAlignStore
Definition: DetectorAlignStore.h:20
MuonGMR4::MdtReadoutElement::tubeLength
double tubeLength(const IdentifierHash &hash) const
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/MdtReadoutElement.cxx:185
MuonGMR4::MdtReadoutElement::isBarrel
bool isBarrel() const
States whether the chamber is built into the barrel or not.
max
constexpr double max()
Definition: ap_fixedTest.cxx:33
MuonGMR4::MdtReadoutElement::moduleThickness
double moduleThickness() const
Returns the thickness of the chamber.
MuonGMR4::MdtReadoutElement::measurementHash
static IdentifierHash measurementHash(unsigned int layerNumber, unsigned int tubeNumber)
Transform the layer and tube number to the measurementHash.
MuonGMR4::MdtReadoutElement::toChamberLayer
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-...
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/MdtReadoutElement.cxx:162
Amg::y
@ y
Definition: GeoPrimitives.h:35
MuonGMR4::MuonReadoutElement
The MuonReadoutElement is an abstract class representing the geometry representing the muon detector.
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/MuonReadoutElement.h:38
MuonGMR4::MdtReadoutElement::activeTubeLength
double activeTubeLength(const IdentifierHash &hash) const
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/MdtReadoutElement.cxx:173
MuonGMR4::MdtReadoutElement::readOutPos
Amg::Vector3D readOutPos(const ActsGeometryContext &ctx, const Identifier &measId) const
Returns the global position of the readout card.
deg
#define deg
Definition: SbPolyhedron.cxx:17
SurfaceBoundSet.h
MdtAsBuiltPar::multilayer_t
multilayer_t
MDT multi-layer index.
Definition: MdtAsBuiltPar.h:28
MuonGMR4::MuonReadoutElement::createGeoTransform
StatusCode createGeoTransform()
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/MuonReadoutElement.cxx:36
MuonGMR4::MdtTubeLayer
Helper struct to retrieve the tube lengths and the tube centers directly from the GeoModel tree.
Definition: MdtTubeLayer.h:28
MuonGMR4::MuonReadoutElement::globalToLocalTrans
Amg::Transform3D globalToLocalTrans(const ActsGeometryContext &ctx) const
Transformations to translate between local <-> global coordinates.
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/MuonReadoutElement.cxx:78
BLinePar::getParameter
float getParameter(const Parameter p) const
Returns a given parameter.
Definition: BLinePar.h:40
MuonGMR4::MdtReadoutElement::initElement
StatusCode initElement() override final
Element initialization.
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/MdtReadoutElement.cxx:52
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
AmgSymMatrix
#define AmgSymMatrix(dim)
Definition: EventPrimitives.h:50
MuonGMR4::MdtReadoutElement::tubeRadius
double tubeRadius() const
Adds the thickness of the tube wall onto the radius.
MuonGMR4::MdtReadoutElement::parameterBook::readoutSide
double readoutSide
Is the readout chip at positive or negative Z?
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/MdtReadoutElement.h:65
TRT::Hit::side
@ side
Definition: HitInfo.h:83
MuonGMR4::MdtReadoutElement::measurementId
Identifier measurementId(const IdentifierHash &measHash) const override final
Converts the measurement hash back to the full Identifier.
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/MdtReadoutElement.cxx:47
MuonGMR4::MdtReadoutElement::multilayer
unsigned int multilayer() const
Returns the multi layer of the MdtReadoutElement.
MdtAlignmentStore
Helper struct to cache simulatenously the As-built and the BLine corrections of the Mdts for fast acc...
Definition: MdtAlignmentStore.h:19
MuonGMR4::MdtReadoutElement::wireLength
double wireLength(const IdentifierHash &hash) const
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/MdtReadoutElement.cxx:188
MuonGMR4::MdtReadoutElement::layerNumber
static unsigned int layerNumber(const IdentifierHash &hash)
Transforms the identifier hash into a layer number ranging from (0-numLayers()-1)
MuonGMR4::MdtReadoutElement::parameterBook::halfY
double halfY
Length ~ number of tubes.
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/MdtReadoutElement.h:61
Amg::getRotateX3D
Amg::Transform3D getRotateX3D(double angle)
get a rotation transformation around X-axis
Definition: GeoPrimitivesHelpers.h:252
MuonGMR4::MdtReadoutElement::uncutTubeLength
double uncutTubeLength(const IdentifierHash &tubeHash) const
Returns the uncut tube length.
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/MdtReadoutElement.cxx:179
MdtAlignmentStore::chamberDistortions
Helper struct to store the pointer to the Mdt distrotion parameters, namely the As-built and the BLin...
Definition: MdtAlignmentStore.h:25
BLinePar::expansionScale
static constexpr double expansionScale
Definition: BLinePar.h:35
Amg::toString
std::string toString(const Translation3D &translation, int precision=4)
GeoPrimitvesToStringConverter.
Definition: GeoPrimitivesToStringConverter.h:40
MuonGMR4
The ReadoutGeomCnvAlg converts the Run4 Readout geometry build from the GeoModelXML into the legacy M...
Definition: MdtCalibInput.h:20
MuonGMR4::MdtReadoutElement::m_pars
parameterBook m_pars
defining parameter set
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/MdtReadoutElement.h:242
MuonGMR4::MdtReadoutElement::moduleWidthS
double moduleWidthS() const
Returns the length of the bottom edge of the chamber (short width)
z
#define z
MuonGMR4::MdtReadoutElement::parameterBook
Set of parameters to describe a MDT chamber.
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/MdtReadoutElement.h:27
MuonGMR4::MuonReadoutElement::idHelperSvc
const Muon::IMuonIdHelperSvc * idHelperSvc() const
Returns the pointer to the muonIdHelperSvc.
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
MdtAlignmentStore.h
CaloNoise_fillDB.dt
dt
Definition: CaloNoise_fillDB.py:58
TRT::Hit::layer
@ layer
Definition: HitInfo.h:79
MuonGMR4::MdtReadoutElement::numLayers
unsigned int numLayers() const
Returns the number of tube layer.
Amg::Transform3D
Eigen::Affine3d Transform3D
Definition: GeoPrimitives.h:46
MdtAsBuiltPar::tubeSide_t::NEG
@ NEG
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
ActsTrk::operator<<
MsgStream & operator<<(MsgStream &out, const ActsUtils::Stat &stat)
Definition: TrackToTruthAssociationAlg.cxx:25
python.SystemOfUnits.micrometer
int micrometer
Definition: SystemOfUnits.py:71
TRT::Track::z0
@ z0
Definition: InnerDetector/InDetCalibEvent/TRT_CalibData/TRT_CalibData/TrackInfo.h:63
BLinePar
Definition: BLinePar.h:14
ActsGeometryContext
Include the GeoPrimitives which need to be put first.
Definition: ActsGeometryContext.h:27
MuonGMR4::MdtReadoutElement::innerTubeRadius
double innerTubeRadius() const
Returns the inner tube radius.
MuonGMR4::MdtReadoutElement::moduleHeight
double moduleHeight() const
Returns the height of the chamber (Distance bottom - topWidth)
MdtAsBuiltPar::tubeSide_t
tubeSide_t
MDT tube side.
Definition: MdtAsBuiltPar.h:33
MuonGMR4::MdtReadoutElement
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/MdtReadoutElement.h:22
MdtIdHelper::channelID
Identifier channelID(int stationName, int stationEta, int stationPhi, int multilayer, int tubeLayer, int tube) const
Definition: MdtIdHelper.cxx:659
MuonGMR4::MdtReadoutElement::distanceToReadout
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...
MuonGMR4::MuonReadoutElement::geoTransformHash
static IdentifierHash geoTransformHash()
Returns the hash that is associated with the surface cache holding the transformation that is placing...
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/MuonReadoutElement.cxx:44
MuonGMR4::MuonReadoutElement::alignableTransform
const GeoAlignableTransform * alignableTransform() const
Returnsthe alignable transform of the readout element.
PlotCalibFromCool.en
en
Definition: PlotCalibFromCool.py:399
MuonGMR4::MuonReadoutElement::strawSurfaceFactory
StatusCode strawSurfaceFactory(const IdentifierHash &hash, std::shared_ptr< Acts::LineBounds > lBounds)
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/MuonReadoutElement.cxx:102
MuonGMR4::MuonReadoutElement::identify
Identifier identify() const override final
Return the athena identifier.
MuonGMR4::MdtReadoutElement::tubePitch
double tubePitch() const
Returns the pitch between 2 tubes in a layer.
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
MuonGMR4::MdtReadoutElement::parameterBook::tubePitch
double tubePitch
Distance between 2 tubes in the layer.
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/MdtReadoutElement.h:42
MuonGMR4::MdtReadoutElement::thickness
double thickness() const override final
Overload from the Acts::DetectorElement (2 * halfheight)
MuonGMR4::MdtReadoutElement::tubeNumber
static unsigned int tubeNumber(const IdentifierHash &hash)
Transforms the idenfier hash into a tube number ranging from (0- numTubesInLay()-1)
MuonGMR4::MdtReadoutElement::bLineReferencePoint
Amg::Vector3D bLineReferencePoint() const
Returns the fixed point of the B-line & as-bult defromation model expressed in the as-built frame.
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/MdtReadoutElement.cxx:217
python.SystemOfUnits.mm
int mm
Definition: SystemOfUnits.py:83
MuonGMR4::MdtReadoutElement::parameterBook::endPlugLength
double endPlugLength
Depth of the endplug into the active tube volume.
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/MdtReadoutElement.h:46
BLinePar::Parameter
Parameter
Definition: BLinePar.h:21
MuonGMR4::MdtReadoutElement::m_idHelper
const MdtIdHelper & m_idHelper
Detector identifier helper to quickly extract the ID fields.
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/MdtReadoutElement.h:244
MuonGMR4::MdtReadoutElement::parameterBook::shortHalfX
double shortHalfX
The chambers have either a rectangular or a trapezoidal shape to first approximation.
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/MdtReadoutElement.h:58
MdtAsBuiltPar
Container classifier the MDT as-built parameters See parameter description in http://atlas-muon-align...
Definition: MdtAsBuiltPar.h:18
InDetDD::other
@ other
Definition: InDetDD_Defs.h:16
CaloCondBlobAlgs_fillNoiseFromASCII.hash
dictionary hash
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:109
MuonGMR4::MuonReadoutElement::planeSurfaceFactory
StatusCode planeSurfaceFactory(const IdentifierHash &hash, std::shared_ptr< Acts::PlanarBounds > pBounds)
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/MuonReadoutElement.cxx:125
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
MuonGMR4::MdtReadoutElement::fromIdealToDeformed
Amg::Transform3D fromIdealToDeformed(const IdentifierHash &tubeHash, const ActsTrk::DetectorAlignStore *store) const
Applies the B & as-built parameters.
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/MdtReadoutElement.cxx:404
MdtReadoutElement.h
MuonGMR4::MdtReadoutElement::setComplementaryReadoutEle
void setComplementaryReadoutEle(const MdtReadoutElement *other)
Set the link to the second readout element inside the muon station.
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/MdtReadoutElement.cxx:207
GeoPrimitivesHelpers.h
unit
const PlainObject unit() const
This is a plugin that makes Eigen look like CLHEP & defines some convenience methods.
Definition: AmgMatrixBasePlugin.h:21
GeoPrimitivesToStringConverter.h
MuonGMR4::MdtReadoutElement::parameterBook::deadLength
double deadLength
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/MdtReadoutElement.h:48
MuonGMR4::MdtReadoutElement::parameterBook::longHalfX
double longHalfX
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/MdtReadoutElement.h:59
MuonGMR4::MuonReadoutElement::localToGlobalTrans
const Amg::Transform3D & localToGlobalTrans(const ActsGeometryContext &ctx) const
Returns the local to global transformation into the ATLAS coordinate system.
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/MuonReadoutElement.cxx:81
MuonGMR4::MdtReadoutElement::globalTubePos
Amg::Vector3D globalTubePos(const ActsGeometryContext &ctx, const Identifier &measId) const
Returns the global position of the tube center.
MdtAsBuiltPar::tubeSide_t::POS
@ POS
Amg::AngleAxis3D
Eigen::AngleAxisd AngleAxis3D
Definition: GeoPrimitives.h:45
ActsTrk
The AlignStoreProviderAlg loads the rigid alignment corrections and pipes them through the readout ge...
Definition: MuonDetectorBuilderTool.cxx:54
MuonGMR4::MuonReadoutElement::stationEta
int stationEta() const
Returns the stationEta (positive A site, negative O site)
MuonGMR4::MdtReadoutElement::getParameters
const parameterBook & getParameters() const
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/MdtReadoutElement.cxx:46
MuonGMR4::MdtReadoutElement::toTubeFrame
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-...
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/MdtReadoutElement.cxx:167
MuonGMR4::MdtReadoutElement::highVoltPos
Amg::Vector3D highVoltPos(const ActsGeometryContext &ctx, const Identifier &measId) const
Returns the global position of the High Voltage connectors.
PowhegControl_ttFCNC_NLO.params
params
Definition: PowhegControl_ttFCNC_NLO.py:226
MuonGMR4::MdtReadoutElement::moduleWidthL
double moduleWidthL() const
Returns the length of the top edge of the chamber (top width)
MuonGMR4::MdtReadoutElement::applyBlineCorrections
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.
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/MdtReadoutElement.cxx:296
mag
Scalar mag() const
mag method
Definition: AmgMatrixBasePlugin.h:26
MuonGMR4::MdtReadoutElement::wireEndpointAsBuilt
Amg::Vector3D wireEndpointAsBuilt(const MdtAsBuiltPar &asBuilt, const IdentifierHash &tubeHash, const Amg::Vector3D &nominalEnd, const tubeSide_t side) const
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/MdtReadoutElement.cxx:226
calibdata.tube
tube
Definition: calibdata.py:31
python.CaloScaleNoiseConfig.args
args
Definition: CaloScaleNoiseConfig.py:80
Amg::getTranslate3D
Amg::Transform3D getTranslate3D(const double X, const double Y, const double Z)
: Returns a shift transformation along an arbitrary axis
Definition: GeoPrimitivesHelpers.h:289
MuonGMR4::MdtReadoutElement::defineArgs
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/MdtReadoutElement.h:76
Identifier
Definition: IdentifierFieldParser.cxx:14