7#include "G4ThreeVector.hh"
9#include "G4Geantino.hh"
10#include "G4ChargedGeantino.hh"
17#include "GaudiKernel/SystemOfUnits.h"
18#include "GeoModelKernel/throwExcept.h"
33 const G4TouchableHistory* touchHist =
static_cast<const G4TouchableHistory*
>(aStep->GetPreStepPoint()->GetTouchable());
43 <<touchHist->GetHistory()->GetTopVolume()->GetName()
51 const std::optional<double> lambda =
Amg::intersect<3>(locPreStep, locStepDir, Amg::Vector3D::UnitX(), 0.);
52 Amg::Vector3D gapCentreCross = localToGlobal * ( (lambda ? 1. : 0.) *locPreStep + lambda.value_or(0.) * locStepDir);
80 <<
" gap width: "<<gapHalfWidth
81 <<
" gap length: "<<gapHalfLength);
82 const int doubletPhi = std::abs(locHitPos.y()) > gapHalfWidth ? readOutEle->
doubletPhiMax() :
84 const int gasGap = std::round(std::abs(locHitPos.z()) / readOutEle->
gasGapPitch()) + 1;
88 doubletPhi, gasGap, phiGap, 1);
92 const std::string stationVolume = touchHist->GetVolume(3)->GetName();
94 const std::vector<std::string> volumeTokens =
tokenize(stationVolume,
"_");
96 if (volumeTokens.size() != 7) {
97 THROW_EXCEPTION(
" Cannot deduce the station name from "<<stationVolume);
101 const std::string stName = volumeTokens[0].substr(0,3);
102 const int stationEta =
atoi(volumeTokens[2]);
103 const int stationPhi =
atoi(volumeTokens[3]);
104 const int doubletR =
atoi(volumeTokens[4]);
105 const int doubletPhi =
atoi(volumeTokens[5]);
106 const int doubletZ =
atoi(volumeTokens[6]);
110 stationEta, stationPhi, doubletR, doubletZ, doubletPhi);
114 <<
m_detMgr->idHelperSvc()->toStringDetEl(detElId)<<
" "<<stationVolume);
const PlainObject unit() const
This is a plugin that makes Eigen look like CLHEP & defines some convenience methods.
#define ATH_MSG_VERBOSE(x)
bool is_valid() const
Check if id is in a valid state.
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.
const MuonGMR4::RpcReadoutElement * getReadoutElement(const G4TouchableHistory *touchHist) const
Retrieves the matching readout element to a G4 hit.
G4bool ProcessHits(G4Step *aStep, G4TouchableHistory *ROhist) override final
Identifier getIdentifier(const ActsTrk::GeometryContext &gctx, const MuonGMR4::RpcReadoutElement *readOutEle, const Amg::Vector3D &hitAtGapPlane, bool phiGap) const
Extracts the gasGap Identifier of the hit expressed at the origin of the local gasGap system.
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 doubletZ() const
Returns the doublet Z field of the MuonReadoutElement identifier.
int doubletPhi() const
Returns the doublet Phi field of the MuonReadoutElement identifier.
double stripPhiLength() const
Returns the length of a phi strip.
int doubletPhiMax() const
Returns the maximum phi panel.
double stripEtaLength() const
Returns the length of an eta strip.
double gasGapPitch() const
Returns the thickness of a RPC gasgap.
int stationNameIndex(const std::string &name) const
Identifier padID(const Identifier &elementID, int doubletZ, int doubletPhi) const
Identifier channelID(int stationName, int stationEta, int stationPhi, int doubletR, int doubletZ, int doubletPhi, int gasGap, int measuresPhi, int strip) const
The AlignStoreProviderAlg loads the rigid alignment corrections and pipes them through the readout ge...
std::optional< double > intersect(const AmgVector(N)&posA, const AmgVector(N)&dirA, const AmgVector(N)&posB, const AmgVector(N)&dirB)
Calculates the point B' along the line B that's closest to a second line A.
std::string toString(const Translation3D &translation, int precision=4)
GeoPrimitvesToStringConverter.
Amg::Vector3D Hep3VectorToEigen(const CLHEP::Hep3Vector &CLHEPvector)
Converts a CLHEP-based CLHEP::Hep3Vector into an Eigen-based Amg::Vector3D.
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)