Skip to content
Snippets Groups Projects
Commit 6abfdf22 authored by Johannes Elmsheuser's avatar Johannes Elmsheuser
Browse files

Merge branch 'tubeTransformSpeedup.MuonReadoutGeometryR4-20240507' into 'main'

MuonReadoutGeometryR4: Speed up handling of tube transforms.

See merge request !71223
parents 8eb8b3c0 c82a101b
No related branches found
No related tags found
30 merge requests!78241Draft: FPGATrackSim: GenScan code refactor,!78236Draft: Switching Streams https://its.cern.ch/jira/browse/ATR-27417,!78056AFP monitoring: new synchronization and cleaning,!78041AFP monitoring: new synchronization and cleaning,!77990Updating TRT chip masks for L1TRT trigger simulation - ATR-28372,!77733Draft: add new HLT NN JVT, augmented with additional tracking information,!77731Draft: Updates to ZDC reconstruction,!77728Draft: updates to ZDC reconstruction,!77522Draft: sTGC Pad Trigger Emulator,!76725ZdcNtuple: Fix cppcheck warning.,!76611L1CaloFEXByteStream: Fix out-of-bounds array accesses.,!76475Punchthrough AF3 implementation in FastG4,!76474Punchthrough AF3 implementation in FastG4,!76343Draft: MooTrackBuilder: Recalibrate NSW hits in refine method,!75729New implementation of ZDC nonlinear FADC correction.,!75703Draft: Update to HI han config for HLT jets,!75184Draft: Update file heavyions_run.config,!74430Draft: Fixing upper bound for Delayed Jet Triggers,!73963Changing the path of the histograms to "Expert" area,!73875updating ID ART reference plots,!73874AtlasCLHEP_RandomGenerators: Fix cppcheck warnings.,!73449Add muon detectors to DarkJetPEBTLA partial event building,!73343Draft: [TrigEgamma] Add photon ringer chains on bootstrap mechanism,!72336Fixed TRT calibration crash,!72176Draft: Improving L1TopoOnline chain that now gets no-empty plots. Activating it by default,!72012Draft: Separate JiveXMLConfig.py into Config files,!71876Fix MET trigger name in MissingETMonitoring,!71820Draft: Adding new TLA End-Of-Fill (EOF) chains and removing obsolete DIPZ chains,!71279Draft: ATR-29330: Move L1_4J15 and the HLT chains seeded by it in the MC Menu,!71223MuonReadoutGeometryR4: Speed up handling of tube transforms.
......@@ -7,6 +7,7 @@
#include <MuonReadoutGeometryR4/MuonDetectorDefs.h>
#include <GeoModelKernel/GeoVPhysVol.h>
#include <GeoModelKernel/GeoTransform.h>
#include <GeoModelKernel/GeoVolumeCursor.h>
#include <GeoModelUtilities/TransientConstSharedPtr.h>
#include <set>
......@@ -40,6 +41,8 @@ namespace MuonGMR4{
unsigned int nTubes() const;
///@brief: Returns the transformation from the layer to the muon station
const Amg::Transform3D& layerTransform() const;
///@brief Return a cursor object over the tubes in the layer.
GeoVolumeCursor tubeCursor() const;
///@brief Returns the transformation of the tube to the muon station
/// Index counting [0 - nTubes()-1]
const Amg::Transform3D tubeTransform(const unsigned int tube) const;
......@@ -55,4 +58,4 @@ namespace MuonGMR4{
};
}
#endif
\ No newline at end of file
#endif
......@@ -70,7 +70,11 @@ StatusCode MdtReadoutElement::initElement() {
#endif
/// Cache the transformations to the tube layers
std::optional<Amg::Vector3D> prevTubePos{std::nullopt};
for (unsigned int tube = 1; tube <= numTubesInLay(); ++ tube) {
MdtTubeLayer& layer = *m_pars.tubeLayers[lay-1];
GeoVolumeCursor tubeCursor = layer.tubeCursor();
GeoTrf::Transform3D layerTransform = layer.layerTransform();
for (unsigned int tube = 1; tube <= numTubesInLay(); ++ tube, tubeCursor.next()) {
assert (!tubeCursor.atEnd());
const IdentifierHash idHash = measurementHash(lay,tube);
if (m_pars.removedTubes.count(idHash)) {
prevTubePos = std::nullopt;
......@@ -81,15 +85,16 @@ StatusCode MdtReadoutElement::initElement() {
ATH_CHECK(strawSurfaceFactory(idHash, m_pars.tubeBounds->make_bounds(innerTubeRadius(), 0.5*tubeLength(idHash))));
#endif
///Ensure that all linear transformations are rotations
const AmgSymMatrix(3) tubeRot = toTubeFrame(idHash).linear();
GeoTrf::Transform3D tubeFrame = layerTransform*tubeCursor.getDefTransform();
const AmgSymMatrix(3) tubeRot = tubeFrame.linear();
if (std::abs(tubeRot.determinant()- 1.) > std::numeric_limits<float>::epsilon()){
ATH_MSG_FATAL(__FILE__<<":"<<__LINE__<<" Transformation matrix is not a pure rotation for "<<
idHelperSvc()->toStringDetEl(identify())<<" in layer: "<<lay<<", tube: "<<tube
<<Amg::toString(toTubeFrame(idHash)));
<<Amg::toString(tubeFrame));
return StatusCode::FAILURE;
}
/// Ensure that all tubes have the same pitch
const Amg::Vector3D tubePos = toTubeFrame(idHash).translation();
const Amg::Vector3D tubePos = tubeFrame.translation();
constexpr double pitchTolerance = 20. * Gaudi::Units::micrometer;
if (prevTubePos) {
......@@ -112,6 +117,8 @@ StatusCode MdtReadoutElement::initElement() {
<<dR<<" tube position: "<<Amg::toString(tubePos,2)
<<" previous:"<<Amg::toString((*prevLayPos), 2));
}
}
if (tube == 1) {
prevLayPos = std::make_optional<Amg::Vector3D>(tubePos);
}
prevTubePos = std::make_optional<Amg::Vector3D>(tubePos);
......
......@@ -56,6 +56,9 @@ const Amg::Transform3D MdtTubeLayer::tubeTransform(const unsigned int tube) cons
m_layerNode->exec(&volAcc);
return layerTransform() * volAcc.getDefTransform();
}
GeoVolumeCursor MdtTubeLayer::tubeCursor() const {
return GeoVolumeCursor(m_layerNode);
}
const Amg::Vector3D MdtTubeLayer::tubePosInLayer(const unsigned int tube) const {
return layerTransform().inverse() * tubeTransform(tube).translation();
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment