From 747ab56ffbe1e2718b5885e323847130948da5af Mon Sep 17 00:00:00 2001 From: Felix Schlepper Date: Tue, 19 Nov 2024 08:29:10 +0100 Subject: [PATCH] DO NOT MERGE LOGGING! --- Detectors/Align/src/AlignableDetector.cxx | 1 + Detectors/Align/src/AlignableVolume.cxx | 28 +++++++++++++++++++++-- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/Detectors/Align/src/AlignableDetector.cxx b/Detectors/Align/src/AlignableDetector.cxx index b4c0e1a5db7c2..425c9663e8923 100644 --- a/Detectors/Align/src/AlignableDetector.cxx +++ b/Detectors/Align/src/AlignableDetector.cxx @@ -444,6 +444,7 @@ void AlignableDetector::writeAlignmentResults() const AlignableVolume* vol = getVolume(iv); // call only for top level objects, they will take care of children if (!vol->getParent()) { + LOGP(info, "++++ Creating alignment objects for {}", getName()); vol->createAlignmentObjects(arr); } } diff --git a/Detectors/Align/src/AlignableVolume.cxx b/Detectors/Align/src/AlignableVolume.cxx index 73d888dc1559b..6ed74beba9127 100644 --- a/Detectors/Align/src/AlignableVolume.cxx +++ b/Detectors/Align/src/AlignableVolume.cxx @@ -552,8 +552,9 @@ void AlignableVolume::writeLabeledPedeResults(FILE* parOut) const { // write parameters with labels for (int i = 0; i < mNDOFs; i++) { - fprintf(parOut, "%9d %+e %+e\t! %s %d:%s vol:%d %s %s\n", getParLab(i), -getParVal(i), getParErr(i), GetName(), i, sDOFName[i], getVolID(), - isFreeDOF(i) ? " " : "FXU", isZeroAbs(getParVal(i)) ? "FXP" : " "); + auto a = fprintf(parOut, "%9d %+e %+e\t! %s %d:%s vol:%d %s %s\n", getParLab(i), -getParVal(i), getParErr(i), GetName(), i, sDOFName[i], getVolID(), + isFreeDOF(i) ? " " : "FXU", + isZeroAbs(getParVal(i)) ? "FXP" : " "); } // children volume int nch = getNChildren(); @@ -690,13 +691,17 @@ bool AlignableVolume::createLocDeltaMatrix(TGeoHMatrix& deltaM) const auto pars = getParVals(); double corr[kNDOFGeom] = {0.}; int nonZero = 0; + LOGP(info, "Applying parameters to create LocDeltaMatrix"); for (int i = kNDOFGeom; i--;) { if (pars[i] != 0.) { nonZero++; corr[i] = pars[i]; + LOGP(info, " - PAR {}: {}", i, pars[i]); } } // we need doubles delta2Matrix(deltaM, corr); + LOGP(info, "Before deltaM:"); + deltaM.Print(); if (isFrameTRA() && nonZero) { // we need corrections in local frame! // l' = T2L * delta_t * t = T2L * delta_t * T2L^-1 * l = delta_l * l // -> delta_l = T2L * delta_t * T2L^-1 @@ -705,6 +710,8 @@ bool AlignableVolume::createLocDeltaMatrix(TGeoHMatrix& deltaM) const deltaM.Multiply(&t2li); deltaM.MultiplyLeft(&t2l); } + LOGP(info, "After isFrameTRA={}; nonZero={} deltaM:", isFrameTRA(), nonZero); + deltaM.Print(); return nonZero; } @@ -727,6 +734,7 @@ void AlignableVolume::createAlignmenMatrix(TGeoHMatrix& alg, const TGeoHMatrix* const AlignableVolume* par = getParent(); bool nonTrivial = createGloDeltaMatrix(alg); + LOGP(info, "~ Has {} parent; nonTrivial={}; envelopeDelta={}", par != nullptr, nonTrivial, envelopeDelta != nullptr); if (envelopeDelta) { if (nonTrivial) { alg.MultiplyLeft(envelopeDelta); @@ -741,13 +749,23 @@ void AlignableVolume::createAlignmenMatrix(TGeoHMatrix& alg, const TGeoHMatrix* // if envelopeDelta is provided, then there should be TGeoHMatrix dchain; while (par) { + LOGP(info, " attaching parent {} to chain", par->getSymName()); dchain.MultiplyLeft(&par->getGlobalDeltaRef()); par = par->getParent(); } const TGeoHMatrix& dchaini = dchain.Inverse(); alg.Multiply(&dchain); alg.MultiplyLeft(&dchaini); + } else { + if (!nonTrivial) { + LOGP(info, "TRIVIAL!"); + } + if (par && par->isDummyEnvelope()) { + LOGP(info, "parent is a dummy enevelope"); + } } + LOGP(info, "GlobalDeltaRef is:"); + getGlobalDeltaRef().Print(); alg *= getGlobalDeltaRef(); /* // bad precision ? @@ -799,6 +817,7 @@ void AlignableVolume::createAlignmentObjects(std::vectorPrint(); } + LOGP(info, " global delta:"); + algM.Print(); + int nch = getNChildren(); for (int ich = 0; ich < nch; ich++) { getChild(ich)->createAlignmentObjects(arr, nonTrivial ? envelopeDelta : nullptr);