ATLAS Offline Software
MmReadoutElement.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
8 #include <GaudiKernel/SystemOfUnits.h>
9 #include <optional>
10 
11 #ifndef SIMULATIONBASE
12 # include "Acts/Surfaces/TrapezoidBounds.hpp"
13 #endif
14 
15 using namespace ActsTrk;
16 
17 namespace MuonGMR4 {
19 std::ostream& operator<<(std::ostream& ostr, const parameterBook& pars) {
20  ostr<<"chamber shortWidth/longWidth/length [mm]: "<<(2.*pars.halfShortWidth)<<"/";
21  ostr<<(2.*pars.halfLongWidth)<<"/"<<(2.*pars.halfHeight)<<std::endl;
22  return ostr;
23 }
24 
25 MmReadoutElement::MmReadoutElement(defineArgs&& args):
26  MuonReadoutElement(std::move(args)),
27  m_pars{std::move(args)} {
28 }
29 
31 
33  ATH_MSG_DEBUG("Parameter book "<<parameterBook());
35 
36  if (m_pars.layers.empty()) {
37  ATH_MSG_FATAL("The readout element "<<idHelperSvc()->toStringDetEl(identify())<<" doesn't have any layers defined");
38  return StatusCode::FAILURE;
39  }
40 #ifndef SIMULATIONBASE
44  90.*Gaudi::Units::deg)));
45 #endif
46  for (unsigned int layer = 0; layer < m_pars.layers.size(); ++layer) {
47  IdentifierHash layHash{layer};
48  if (m_pars.layers[layer]->hash() != layHash) {
49  ATH_MSG_FATAL("Layer "<<m_pars.layers[layer]<<" has a very strange hash. Expect "<<layer);
50  return StatusCode::FAILURE;
51  }
52  ATH_CHECK(insertTransform<MmReadoutElement>(layHash));
53 #ifndef SIMULATIONBASE
54  const StripDesign& design{m_pars.layers[layer]->design()};
55 
56  ATH_CHECK(planeSurfaceFactory(layHash, m_pars.layerBounds->make_bounds(design.shortHalfHeight(),
57  design.longHalfHeight(),
58  design.halfWidth(),
59  90.*Gaudi::Units::deg - design.stereoAngle())));
60 #endif
61  }
62 #ifndef SIMULATIONBASE
63  m_pars.layerBounds.reset();
64 #endif
65  return StatusCode::SUCCESS;
66 }
67 
68 Amg::Transform3D MmReadoutElement::fromGapToChamOrigin(const IdentifierHash& layHash) const {
69  return stripLayer(layHash).toOrigin();
70 }
71 
72 
73 Amg::Vector3D MmReadoutElement::stripPosition(const ActsGeometryContext& ctx, const IdentifierHash& measHash) const {
74  const IdentifierHash lHash = layerHash(measHash);
75  if (static_cast<unsigned int>(lHash) < m_pars.layers.size()) {
76  return localToGlobalTrans(ctx, lHash) * stripLayer(lHash).localStripPos(stripNumber(measHash));
77  }
78  ATH_MSG_WARNING(__FILE__<<":"<<__LINE__<<" The layer hash "<<static_cast<unsigned int>(lHash)
79  <<" is out of range. Maximum range "<<m_pars.layers.size());
80  return Amg::Vector3D::Zero();
81 }
82 
83 
84 Amg::Vector3D MmReadoutElement::leftStripEdge(const ActsGeometryContext& ctx, const IdentifierHash& measHash) const {
85  const IdentifierHash lHash = layerHash(measHash);
86  if (static_cast<unsigned int>(lHash) < m_pars.layers.size()) {
87  return localToGlobalTrans(ctx, lHash) * stripLayer(lHash).localStripLeftEdge(stripNumber(measHash));
88  }
89  ATH_MSG_WARNING(__FILE__<<":"<<__LINE__<<" The layer hash "<<static_cast<unsigned int>(lHash)
90  <<" is out of range. Maximum range "<<m_pars.layers.size());
91  return Amg::Vector3D::Zero();
92 }
93 
94 Amg::Vector3D MmReadoutElement::rightStripEdge(const ActsGeometryContext& ctx, const IdentifierHash& measHash) const{
95  const IdentifierHash lHash = layerHash(measHash);
96  if (static_cast<unsigned int>(lHash) < m_pars.layers.size()) {
97  return localToGlobalTrans(ctx, lHash) * stripLayer(lHash).localStripRightEdge(stripNumber(measHash));
98  }
99  ATH_MSG_WARNING(__FILE__<<":"<<__LINE__<<" The layer hash "<<static_cast<unsigned int>(lHash)
100  <<" is out of range. Maximum range "<<m_pars.layers.size());
101  return Amg::Vector3D::Zero();
102 }
103 
104 #ifndef SIMULATIONBASE
105 std::map<Identifier, std::shared_ptr<Acts::Surface>> MmReadoutElement::getSurfaces() const {
106  std::map<Identifier, std::shared_ptr<Acts::Surface>> surfaces{};
107  for (unsigned int gasGap = 1; gasGap<= nGasGaps(); ++gasGap) {
108  const IdentifierHash measHash = createHash(gasGap, 1);
109  surfaces[measurementId(measHash)] = surfacePtr(layerHash(measHash));
110  }
111  return surfaces;
112 }
113 #endif
114 
115 
116 }
make_hlt_rep.pars
pars
Definition: make_hlt_rep.py:90
MuonGMR4::parameterBook
MmReadoutElement::parameterBook parameterBook
Definition: MmReadoutElement.cxx:18
dumpTgcDigiDeadChambers.gasGap
list gasGap
Definition: dumpTgcDigiDeadChambers.py:33
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
MuonGMR4::MmReadoutElement::fromGapToChamOrigin
Amg::Transform3D fromGapToChamOrigin(const IdentifierHash &layerHash) const
Definition: MmReadoutElement.cxx:68
MuonGMR4::StripDesign
Definition: StripDesign.h:30
MuonGMR4::MmReadoutElement::createHash
static IdentifierHash createHash(const int gasGap, const int strip)
MuonGMR4::MmReadoutElement::nGasGaps
unsigned int nGasGaps() const
Returns the number of gas gaps.
AthCheckMacros.h
MuonGMR4::MmReadoutElement::parameterBook
Set of parameters to describe a RPC chamber.
Definition: MmReadoutElement.h:23
MuonGMR4::StripLayer::toOrigin
const Amg::Transform3D & toOrigin() const
Returns the transformation to go from the strip layer center to the origin of the Strip chamber.
MuonGMR4::MuonReadoutElement
The MuonReadoutElement is an abstract class representing the geometry representing the muon detector.
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/MuonReadoutElement.h:38
deg
#define deg
Definition: SbPolyhedron.cxx:17
MuonGMR4::MuonReadoutElement::createGeoTransform
StatusCode createGeoTransform()
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/MuonReadoutElement.cxx:31
MuonGMR4::MmReadoutElement::getSurfaces
std::map< Identifier, std::shared_ptr< Acts::Surface > > getSurfaces() const override final
Returns all surfaces that are associated with the active readout planes.
Definition: MmReadoutElement.cxx:105
MuonGMR4::MmReadoutElement::parameterBook::halfShortWidth
double halfShortWidth
width of the lower edge
Definition: MmReadoutElement.h:28
MuonGMR4
A muon chamber is a collection of readout elements belonging to the same station.
Definition: ChamberAssembleTool.h:16
MuonGMR4::MmReadoutElement::m_pars
parameterBook m_pars
Definition: MmReadoutElement.h:132
EventPrimitivesToStringConverter.h
MuonGMR4::MmReadoutElement::stripPosition
Amg::Vector3D stripPosition(const ActsGeometryContext &ctx, const Identifier &measId) const
Returns the position of the strip center.
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
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
TRT::Hit::layer
@ layer
Definition: HitInfo.h:79
MuonGMR4::MmReadoutElement::stripNumber
static unsigned int stripNumber(const IdentifierHash &measHash)
MuonGMR4::MmReadoutElement::parameterBook::halfHeight
double halfHeight
length in the radial direction
Definition: MmReadoutElement.h:32
Amg::Transform3D
Eigen::Affine3d Transform3D
Definition: GeoPrimitives.h:46
MuonGMR4::MmReadoutElement::measurementId
Identifier measurementId(const IdentifierHash &measHash) const override final
Converts the measurement hash back to the full Identifier.
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
ActsTrk::operator<<
MsgStream & operator<<(MsgStream &out, const ActsUtils::Stat &stat)
Definition: TrackToTruthAssociationAlg.cxx:25
MuonGMR4::MmReadoutElement::parameterBook::halfLongWidth
double halfLongWidth
width of the upper edge
Definition: MmReadoutElement.h:30
ActsGeometryContext
Include the GeoPrimitives which need to be put first.
Definition: ActsGeometryContext.h:28
MuonGMR4::MmReadoutElement::parameterBook::layers
std::vector< StripLayerPtr > layers
Pointers to the strip layers.
Definition: MmReadoutElement.h:38
MuonGMR4::MmReadoutElement::leftStripEdge
Amg::Vector3D leftStripEdge(const ActsGeometryContext &ctx, const Identifier &measId) const
Returns the global position of the strip edge.
MuonGMR4::MmReadoutElement::stripLayer
const StripLayer & stripLayer(const Identifier &measId) const
MuonGMR4::MmReadoutElement::getParameters
const parameterBook & getParameters() const
Definition: MmReadoutElement.cxx:30
MuonGMR4::StripLayer::localStripPos
Amg::Vector3D localStripPos(unsigned int stripum) const
Returns the position of the strip expressed in the local frame.
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:39
MuonGMR4::MuonReadoutElement::identify
Identifier identify() const override final
Return the athena identifier.
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
MuonGMR4::MuonReadoutElement::planeSurfaceFactory
StatusCode planeSurfaceFactory(const IdentifierHash &hash, std::shared_ptr< Acts::PlanarBounds > pBounds)
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/MuonReadoutElement.cxx:120
MuonGMR4::MuonReadoutElement::surfacePtr
std::shared_ptr< Acts::Surface > surfacePtr(const IdentifierHash &hash) const
Returns the pointer associated to a certain wire / plane.
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/MuonReadoutElement.cxx:84
MuonGMR4::MmReadoutElement::layerHash
IdentifierHash layerHash(const Identifier &measId) const override final
MuonGMR4::MmReadoutElement::parameterBook::layerBounds
ActsTrk::SurfaceBoundSetPtr< Acts::TrapezoidBounds > layerBounds
Definition: MmReadoutElement.h:41
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
GeoPrimitivesHelpers.h
MuonGMR4::MmReadoutElement::rightStripEdge
Amg::Vector3D rightStripEdge(const ActsGeometryContext &ctx, const Identifier &measId) const
Returns the global position of the strip edge.
MuonGMR4::MmReadoutElement::initElement
StatusCode initElement() override final
Element initialization.
Definition: MmReadoutElement.cxx:32
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:76
MuonGMR4::StripLayer::localStripLeftEdge
Amg::Vector3D localStripLeftEdge(unsigned int stripNum) const
Returns the position of the left strip edge (positive local y) expressed in the local frame.
ActsTrk
The AlignStoreProviderAlg loads the rigid alignment corrections and pipes them through the readout ge...
Definition: MuonDetectorBuilderTool.cxx:34
MuonGMR4::StripLayer::localStripRightEdge
Amg::Vector3D localStripRightEdge(unsigned int stripNum) const
Returns the position of the right strip edge (negative local y) exoressed in the local frame.
python.CaloScaleNoiseConfig.args
args
Definition: CaloScaleNoiseConfig.py:80
MuonGMR4::MmReadoutElement::defineArgs
Definition: MmReadoutElement.h:48
MmReadoutElement.h
generate::Zero
void Zero(TH1D *hin)
Definition: generate.cxx:32