7#include "G4ThreeVector.hh"
9#include "G4Geantino.hh"
10#include "G4ChargedGeantino.hh"
17#include "GeoModelKernel/throwExcept.h"
18#include "GaudiKernel/SystemOfUnits.h"
26 constexpr double tolerance = 10. * Gaudi::Units::micrometer;
39 const G4TouchableHistory* touchHist =
static_cast<const G4TouchableHistory*
>(aStep->GetPreStepPoint()->GetTouchable());
43 ATH_MSG_VERBOSE(
" Track is inside volume "<< touchHist->GetHistory()->GetTopVolume()->GetName()
61 for (
unsigned int gap = 1; gap <= readOutEle->
nGasGaps(); ++gap){
64 <<
" in "<<
m_detMgr->idHelperSvc()->toStringDetEl(readOutEle->
identify())<<
" dZ: "
65 <<std::abs(gapCentre.z() - hitAtGapPlane.z()));
66 if (std::abs(gapCentre.z() - hitAtGapPlane.z()) <
tolerance) {
68 <<
m_detMgr->idHelperSvc()->toStringDetEl(readOutEle->
identify())<<
" gasGap: "<<gap);
77 const G4TouchableHistory* touchHist)
const {
79 const std::string& stationVolume = touchHist->GetVolume(4)->GetName();
81 const std::vector<std::string> volumeTokens =
tokenize(stationVolume.substr(stationVolume.rfind(
"NSW") + 4),
"_");
83 if (volumeTokens.size() != 4) {
84 THROW_EXCEPTION(
" Cannot deduce the station name from "<<stationVolume);
87 const std::string stName = volumeTokens[0][0] ==
'S' ?
"MMS" :
"MML";
88 const int stationEta =
atoi(volumeTokens[2]);
89 const int stationPhi =
atoi(volumeTokens[3]);
96 if (!readOutElemMl1 || !readOutElemMl2) {
98 <<
m_detMgr->idHelperSvc()->toStringDetEl(detElIdMl1)<<
" "<<stationVolume);
106 return std::abs(centerMl2.z()) -
tolerance <= std::abs(transformCenter.z()) ? readOutElemMl2 : readOutElemMl1;
#define ATH_MSG_VERBOSE(x)
bool is_valid() const
Check if id is in a valid state.
Identifier channelID(int stationName, int stationEta, int stationPhi, int multilayer, int gasGap, int channel) const
Identifier multilayerID(const Identifier &channeldID) const
const MuonGMR4::MmReadoutElement * getReadoutElement(const ActsTrk::GeometryContext &gctx, const G4TouchableHistory *touchHist) const
Retrieves the matching readout element to a G4 hit.
virtual G4bool ProcessHits(G4Step *aStep, G4TouchableHistory *ROhist) override final
member functions
Identifier getIdentifier(const ActsTrk::GeometryContext &gctx, const MuonGMR4::MmReadoutElement *readOutEle, const Amg::Vector3D &hitAtGapPlane) const
Identify the gasGap layer of the hit.
const MuonGMR4::MuonDetectorManager * m_detMgr
Pointer to the underlying detector manager.
xAOD::MuonSimHit * propagateAndSaveStrip(const Identifier &hitId, const Amg::Transform3D &toGasGap, const G4Step *hitStep)
bool processStep(const G4Step *step) const
Checks whether the current step shall be processed at all.
ActsTrk::GeometryContext getGeoContext() const
Returns the current geometry context in the event.
unsigned int nGasGaps() const
Returns the number of gas gaps.
Identifier measurementId(const IdentifierHash &measHash) const override final
Converts the measurement hash back to the full Identifier.
static IdentifierHash createHash(const int gasGap, const int strip)
Amg::Vector3D center(const ActsTrk::GeometryContext &ctx) const
Returns the detector center (Which is the same as the detector center of the first measurement layer)
Identifier identify() const override final
Return the athena identifier.
Amg::Transform3D globalToLocalTrans(const ActsTrk::GeometryContext &ctx) const
Transformations to translate between local <-> global coordinates.
int stationNameIndex(const std::string &name) const
The AlignStoreProviderAlg loads the rigid alignment corrections and pipes them through the readout ge...
std::string toString(const Translation3D &translation, int precision=4)
GeoPrimitvesToStringConverter.
Eigen::Affine3d Transform3D
Eigen::Matrix< double, 3, 1 > Vector3D
std::vector< std::string > tokenize(const std::string &the_str, std::string_view delimiters)
Splits the string into smaller substrings.
int atoi(std::string_view str)
Helper functions to unpack numbers decoded in string into integers and doubles The strings are requir...
Include the common definitions from the MuonReadoutGeometry.
Amg::Transform3D getTransform(const G4VTouchable *history, unsigned int level)
Extracts the local -> global transformation from a TouchableHistory at a given level.
The ReadoutGeomCnvAlg converts the Run4 Readout geometry build from the GeoModelXML into the legacy M...
#define THROW_EXCEPTION(MESSAGE)