ATLAS Offline Software
MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/TgcReadoutElement.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
7 #include <GaudiKernel/SystemOfUnits.h>
8 #include <optional>
9 using namespace ActsTrk;
10 
11 namespace MuonGMR4 {
13 std::ostream& operator<<(std::ostream& ostr, const parameterBook& pars) {
14  ostr<<"chamber dimensions --- ";
15  ostr<<"thickness: "<<pars.halfThickness<<" ";
16  ostr<<"height: "<<pars.halfHeight<<" ";
17  ostr<<"shortWidth: "<<pars.halfWidthShort<<" ";
18  ostr<<"longWidth: "<<pars.halfWidthLong<<" --- ";
19  return ostr;
20 }
21 
22 TgcReadoutElement::TgcReadoutElement(defineArgs&& args)
23  : MuonReadoutElement(std::move(args)),
24  m_pars{std::move(args)} {
25 }
26 
29 
32  bool hasSensor{false};
33  for (size_t s = 0; s < m_pars.sensorLayouts.size(); ++s) {
34  const StripLayerPtr& layPtr{m_pars.sensorLayouts[s]};
35  if (!layPtr) continue;
36  if (layPtr->hash() != s) {
37  ATH_MSG_FATAL("Layer "<<(*layPtr)<<" has an unexpected hash "<<s);
38  return StatusCode::FAILURE;
39  }
40  ATH_MSG_VERBOSE(idHelperSvc()->toStringDetEl(identify())<<" gasGap: "<<gasGapNumber(layPtr->hash())
41  <<" isStrip: "<<isStrip(layPtr->hash())<<" hash: "<<s);
42  hasSensor = true;
43  }
44  if (!hasSensor) {
45  ATH_MSG_FATAL("No active layer is defined for "<<idHelperSvc()->toStringDetEl(identify()));
46  return StatusCode::FAILURE;
47  }
48 #ifndef SIMULATIONBASE
52  m_pars.halfHeight)));
53 #endif
54  for (unsigned int gap = 1; gap <= nGasGaps(); ++gap) {
55  if (numWireGangs(gap)) {
56  const IdentifierHash layHash{constructHash(0, gap, false)};
57  ATH_CHECK(insertTransform<TgcReadoutElement>(layHash));
58 #ifndef SIMULATIONBASE
59  const StripDesign& layout{wireGangLayout(gap)};
60  ATH_CHECK(planeSurfaceFactory(layHash, m_pars.layerBounds->make_bounds(layout.shortHalfHeight(),
61  layout.longHalfHeight(),
62  layout.halfWidth(),
63  90.* Gaudi::Units::deg)));
64 #endif
65  }
66  if (numStrips(gap)) {
67  const IdentifierHash layHash{constructHash(0, gap, true)};
68  ATH_CHECK(insertTransform<TgcReadoutElement>(layHash));
69 #ifndef SIMULATIONBASE
70  const StripDesign& layout{stripLayout(gap)};
72  ATH_CHECK(planeSurfaceFactory(layHash, m_pars.layerBounds->make_bounds(layout.shortHalfHeight(),
73  layout.longHalfHeight(),
74  layout.halfWidth())));
75 #endif
76  }
77  }
78 #ifndef SIMULATIONBASE
79  m_pars.layerBounds.reset();
80 #endif
81  const IdentifierHash firstLay = constructHash(0, 1, false);
82  const IdentifierHash secondLay = constructHash(0, 2, false);
83  ActsGeometryContext gctx{};
84  m_gasThickness =(center(gctx, firstLay) - center(gctx, secondLay)).mag();
85  return StatusCode::SUCCESS;
86 }
87 
88 Amg::Transform3D TgcReadoutElement::fromGapToChamOrigin(const IdentifierHash& layHash) const {
89  const unsigned layIdx{static_cast<unsigned>(layHash)};
90  return m_pars.sensorLayouts[layIdx]->toOrigin();
91 }
92 Amg::Vector3D TgcReadoutElement::channelPosition(const ActsGeometryContext& ctx, const IdentifierHash& measHash) const {
93  const StripLayerPtr& layDesign{sensorLayout(measHash)};
94  if (!layDesign) {
95  ATH_MSG_WARNING("The gasGap "<<gasGapNumber(measHash)<<" & strip:"<<isStrip(measHash)<<" is unknown");
96  return Amg::Vector3D::Zero();
97  }
98  return localToGlobalTrans(ctx, layerHash(measHash)) * layDesign->localStripPos(channelNumber(measHash));
99 }
100 #ifndef SIMULATIONBASE
101 std::map<Identifier, std::shared_ptr<Acts::Surface>> TgcReadoutElement::getSurfaces() const {
102  std::map<Identifier, std::shared_ptr<Acts::Surface>> surfaces{};
103  for (unsigned int gasGap = 1; gasGap <= nGasGaps(); ++gasGap) {
104  for (bool measPhi: {false, true}) {
105  const IdentifierHash hash = constructHash(1, gasGap, measPhi);
106  if ( (measPhi && numStrips(gasGap)) ||
107  (!measPhi && numWireGangs(gasGap)) ) {
108  surfaces[measurementId(hash)] = surfacePtr(layerHash(hash));
109  }
110  }
111  }
112  return surfaces;
113 }
114 #endif
115 }
make_hlt_rep.pars
pars
Definition: make_hlt_rep.py:90
MuonGMR4::TgcReadoutElement::numWireGangs
unsigned int numWireGangs(unsigned int gasGap) const
Returns the number of wire gangs for a given gasGap [1-3].
GeoModel::TransientConstSharedPtr
The TransientConstSharedPtr allows non-const access if the pointer itself is non-const but in the con...
Definition: TransientConstSharedPtr.h:13
MuonGMR4::parameterBook
MmReadoutElement::parameterBook parameterBook
Definition: MmReadoutElement.cxx:18
dumpTgcDigiDeadChambers.gasGap
list gasGap
Definition: dumpTgcDigiDeadChambers.py:33
MuonGMR4::TgcReadoutElement::wireGangLayout
const WireGroupDesign & wireGangLayout(unsigned int gasGap) const
Returns access to the wire group design of the given gasGap [1-3] If the gap does not have a wires an...
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
MuonGMR4::StripDesign
Definition: StripDesign.h:30
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
MuonGMR4::TgcReadoutElement::fromGapToChamOrigin
Amg::Transform3D fromGapToChamOrigin(const IdentifierHash &layerHash) const
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/TgcReadoutElement.cxx:88
AthCheckMacros.h
MuonGMR4::TgcReadoutElement::gasGapNumber
static unsigned int gasGapNumber(const IdentifierHash &measHash)
MuonGMR4::TgcReadoutElement::nGasGaps
unsigned int nGasGaps() const
Returns the number of gasgaps described by this ReadOutElement (usally 2 or 3)
MuonGMR4::TgcReadoutElement::channelPosition
Amg::Vector3D channelPosition(const ActsGeometryContext &ctx, const Identifier &measId) const
Returns the center of the measurement channel eta measurement: wire gang center phi measurement: stri...
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
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
CaloSwCorrections.gap
def gap(flags, cells_name, *args, **kw)
Definition: CaloSwCorrections.py:212
MuonGMR4::TgcReadoutElement::constructHash
static IdentifierHash constructHash(unsigned int measCh, unsigned int gasGap, const bool isStrip)
Constructs the Hash out of the Identifier fields (channel, gasGap, isStrip)
MuonGMR4::TgcReadoutElement::isStrip
static bool isStrip(const IdentifierHash &measHash)
MuonGMR4::TgcReadoutElement::initElement
StatusCode initElement() override final
Element initialization.
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/TgcReadoutElement.cxx:28
MuonGMR4::TgcReadoutElement::numStrips
unsigned int numStrips(unsigned int gasGap) const
Returns the number of strips for a given gasGap [1-3].
MuonGMR4::TgcReadoutElement::stripLayout
const RadialStripDesign & stripLayout(unsigned int gasGap) const
Returns access to the strip design of the given gasGap [1-3] If the gap does not have strips an excep...
MuonGMR4
A muon chamber is a collection of readout elements belonging to the same station.
Definition: ChamberAssembleTool.h:16
MuonGMR4::TgcReadoutElement::getParameters
const parameterBook & getParameters() const
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/TgcReadoutElement.cxx:27
MuonGMR4::TgcReadoutElement::m_pars
parameterBook m_pars
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/TgcReadoutElement.h:106
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
Amg::Transform3D
Eigen::Affine3d Transform3D
Definition: GeoPrimitives.h:46
MuonGMR4::TgcReadoutElement::parameterBook::halfWidthLong
double halfWidthLong
Half length of the chamber long edge (Top)
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/TgcReadoutElement.h:30
MuonGMR4::TgcReadoutElement::parameterBook
Set of parameters to describe a Tgc chamber.
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/TgcReadoutElement.h:21
MuonGMR4::TgcReadoutElement::parameterBook::layerBounds
ActsTrk::SurfaceBoundSetPtr< Acts::TrapezoidBounds > layerBounds
Set of surface boundaries.
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/TgcReadoutElement.h:37
MuonGMR4::TgcReadoutElement::measurementId
Identifier measurementId(const IdentifierHash &measHash) const override final
Converts the measurement hash back to the full Identifier.
MuonGMR4::MuonReadoutElement::center
Amg::Vector3D center(const ActsGeometryContext &ctx) const
Returns the detector center (Which is the same as the detector center of the first measurement layer)
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
ActsTrk::operator<<
MsgStream & operator<<(MsgStream &out, const ActsUtils::Stat &stat)
Definition: TrackToTruthAssociationAlg.cxx:25
MuonGMR4::TgcReadoutElement::parameterBook::halfWidthShort
double halfWidthShort
Half length of the chamber short edge (Bottom)
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/TgcReadoutElement.h:28
ActsGeometryContext
Include the GeoPrimitives which need to be put first.
Definition: ActsGeometryContext.h:28
MuonGMR4::TgcReadoutElement::defineArgs
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/TgcReadoutElement.h:42
MuonGMR4::TgcReadoutElement::layerHash
IdentifierHash layerHash(const Identifier &measId) const override final
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::TgcReadoutElement::sensorLayout
const StripLayerPtr & sensorLayout(const IdentifierHash &hash) const
Returns the pointer to the strip layer associated with the gas gap.
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::TgcReadoutElement::m_gasThickness
double m_gasThickness
Distance between 2 gas gaps (Z - direction)
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/TgcReadoutElement.h:109
MuonGMR4::TgcReadoutElement::parameterBook::halfHeight
double halfHeight
Half height of the chamber (Top - botom edge)
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/TgcReadoutElement.h:26
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: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
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
MuonGMR4::TgcReadoutElement::parameterBook::sensorLayouts
std::array< StripLayerPtr, 6 > sensorLayouts
We have maximum 3 gasgaps times eta / phi measurement.
Definition: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/MuonReadoutGeometryR4/TgcReadoutElement.h:34
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::TgcReadoutElement::channelNumber
static unsigned int channelNumber(const IdentifierHash &measHash)
ActsTrk
The AlignStoreProviderAlg loads the rigid alignment corrections and pipes them through the readout ge...
Definition: MuonDetectorBuilderTool.cxx:34
TgcReadoutElement.h
MuonGMR4::TgcReadoutElement::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: MuonPhaseII/MuonDetDescr/MuonReadoutGeometryR4/src/TgcReadoutElement.cxx:101
mag
Scalar mag() const
mag method
Definition: AmgMatrixBasePlugin.h:25
python.CaloScaleNoiseConfig.args
args
Definition: CaloScaleNoiseConfig.py:80
generate::Zero
void Zero(TH1D *hin)
Definition: generate.cxx:32