From 8d6e9454c4641c77f37c9ca70d530924d952851e Mon Sep 17 00:00:00 2001 From: Felix Schlepper Date: Tue, 27 May 2025 09:38:08 +0200 Subject: [PATCH 1/3] Geo: optional print out alignment matrices Signed-off-by: Felix Schlepper --- .../DetectorsCommonDataFormats/AlignParam.h | 2 +- DataFormats/Detectors/Common/src/AlignParam.cxx | 16 +++++++++++++--- .../include/DetectorsBase/GeometryManagerParam.h | 2 ++ Detectors/Base/src/GeometryManager.cxx | 3 ++- 4 files changed, 18 insertions(+), 5 deletions(-) diff --git a/DataFormats/Detectors/Common/include/DetectorsCommonDataFormats/AlignParam.h b/DataFormats/Detectors/Common/include/DetectorsCommonDataFormats/AlignParam.h index a93a37c1e36ab..5a0d2d64b0ff5 100644 --- a/DataFormats/Detectors/Common/include/DetectorsCommonDataFormats/AlignParam.h +++ b/DataFormats/Detectors/Common/include/DetectorsCommonDataFormats/AlignParam.h @@ -55,7 +55,7 @@ class AlignParam double getZ() const { return mZ; } /// apply object to geoemetry - bool applyToGeometry() const; + bool applyToGeometry(int printLevel = -1) const; /// extract global delta matrix TGeoHMatrix createMatrix() const; diff --git a/DataFormats/Detectors/Common/src/AlignParam.cxx b/DataFormats/Detectors/Common/src/AlignParam.cxx index f20cf3dac4971..1e1716ce17ff5 100644 --- a/DataFormats/Detectors/Common/src/AlignParam.cxx +++ b/DataFormats/Detectors/Common/src/AlignParam.cxx @@ -12,12 +12,12 @@ /// \file AlignParam.cxx /// \brief Implementation of the base alignment parameters class -#include #include #include #include #include +#include "Framework/Logger.h" #include "DetectorsCommonDataFormats/AlignParam.h" using namespace o2::detectors; @@ -261,7 +261,7 @@ bool AlignParam::createLocalMatrix(TGeoHMatrix& m) const } //_____________________________________________________________________________ -bool AlignParam::applyToGeometry() const +bool AlignParam::applyToGeometry(int printLevel) const { /// Apply the current alignment object to the TGeo geometry /// This method returns FALSE if the symname of the object was not @@ -311,10 +311,20 @@ bool AlignParam::applyToGeometry() const TGeoHMatrix* g = node->GetMatrix(node->GetLevel() - 1); align->MultiplyLeft(node->GetMatrix(node->GetLevel() - 1)->Inverse()); } - LOG(debug) << "Aligning volume " << symname; node->Align(align); + if (getLevel() <= printLevel) { + LOGP(info, "{:*^100}", symname); + LOGP(info, " - Alignment parameter:"); + print(); + LOGP(info, " - Alignment matrix:"); + align->Print(); + LOGP(info, " - Node:"); + node->Print(); + LOGP(info, "{:~^100}", symname); + } + return true; } diff --git a/Detectors/Base/include/DetectorsBase/GeometryManagerParam.h b/Detectors/Base/include/DetectorsBase/GeometryManagerParam.h index c41d41e25e233..b82d526344646 100644 --- a/Detectors/Base/include/DetectorsBase/GeometryManagerParam.h +++ b/Detectors/Base/include/DetectorsBase/GeometryManagerParam.h @@ -23,6 +23,8 @@ struct GeometryManagerParam : public o2::conf::ConfigurableParamHelper #include "DetectorsBase/GeometryManager.h" +#include "DetectorsBase/GeometryManagerParam.h" #include "DetectorsCommonDataFormats/AlignParam.h" #include "CommonUtils/NameConf.h" #include "DetectorsBase/Aligner.h" @@ -256,7 +257,7 @@ bool GeometryManager::applyAlignment(const std::vector Date: Tue, 27 May 2025 09:38:46 +0200 Subject: [PATCH 2/3] Align: print delta frame and level Signed-off-by: Felix Schlepper --- DataFormats/Detectors/Common/src/AlignParam.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/DataFormats/Detectors/Common/src/AlignParam.cxx b/DataFormats/Detectors/Common/src/AlignParam.cxx index 1e1716ce17ff5..11bfa10dab087 100644 --- a/DataFormats/Detectors/Common/src/AlignParam.cxx +++ b/DataFormats/Detectors/Common/src/AlignParam.cxx @@ -357,8 +357,8 @@ int AlignParam::getLevel() const void AlignParam::print() const { // print parameters - printf("%s : %6d | X: %+e Y: %+e Z: %+e | pitch: %+e roll: %+e yaw: %e\n", getSymName().c_str(), getAlignableID(), getX(), - getY(), getZ(), getPsi(), getTheta(), getPhi()); + printf("%s (Lvl:%2d): %6d | %s | tra: X: %+e Y: %+e Z: %+e | pitch: %+e roll: %+e yaw: %e\n", getSymName().c_str(), getLevel(), getAlignableID(), (mIsGlobal) ? "G" : "L", + getX(), getY(), getZ(), getPsi(), getTheta(), getPhi()); } //_____________________________________________________________________________ From 3f4ff11e220fe7cc5aafd9d724251a49c364669d Mon Sep 17 00:00:00 2001 From: Felix Schlepper Date: Fri, 15 Aug 2025 10:44:02 +0200 Subject: [PATCH 3/3] Align: Fix using local delta matrix Signed-off-by: Felix Schlepper --- DataFormats/Detectors/Common/src/AlignParam.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/DataFormats/Detectors/Common/src/AlignParam.cxx b/DataFormats/Detectors/Common/src/AlignParam.cxx index 11bfa10dab087..2061726a29c66 100644 --- a/DataFormats/Detectors/Common/src/AlignParam.cxx +++ b/DataFormats/Detectors/Common/src/AlignParam.cxx @@ -308,8 +308,9 @@ bool AlignParam::applyToGeometry(int printLevel) const TGeoHMatrix* align = new TGeoHMatrix(createMatrix()); if (mIsGlobal) { align->Multiply(node->GetMatrix()); - TGeoHMatrix* g = node->GetMatrix(node->GetLevel() - 1); align->MultiplyLeft(node->GetMatrix(node->GetLevel() - 1)->Inverse()); + } else { + align->MultiplyLeft(node->GetOriginalMatrix()); } node->Align(align);