From d29d6e0a3be382c05459d3546db14292753cbb5f Mon Sep 17 00:00:00 2001 From: Hangyi Wu Date: Tue, 21 Jan 2025 22:31:33 +0100 Subject: [PATCH 1/2] fix!: fix incorrect assignment to firstStrip in cacheInfo --- Detector/UT/include/Detector/UT/DeUTSensor.h | 6 ++++++ Detector/UT/src/DeUT.cpp | 6 ++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Detector/UT/include/Detector/UT/DeUTSensor.h b/Detector/UT/include/Detector/UT/DeUTSensor.h index 3cece986b7..7b39215c98 100644 --- a/Detector/UT/include/Detector/UT/DeUTSensor.h +++ b/Detector/UT/include/Detector/UT/DeUTSensor.h @@ -97,6 +97,12 @@ namespace LHCb::Detector::UT { return ( strip >= firstStrip() ) && strip < nStrip() + firstStrip(); } LineTraj trajectory( unsigned int strip, double offset ) const { + if ( !isStrip( strip ) ) { + throw std::out_of_range( + fmt::format( "DeUTSector::createTraj: strip out of range, given {strip}, expect [{first}, {last}]", + fmt::arg( "strip", strip ), fmt::arg( "first", firstStrip() ), + fmt::arg( "last", firstStrip() + nStrip() - 1 ) ) ); + } const double arclen = ( ( xInverted() && getStripflip() ) ? ( nStrip() - offset - strip - ( firstStrip() + 1 ) % 2 ) : ( offset + strip - firstStrip() ) ) * diff --git a/Detector/UT/src/DeUT.cpp b/Detector/UT/src/DeUT.cpp index be7037d6ab..ee13c70f9b 100644 --- a/Detector/UT/src/DeUT.cpp +++ b/Detector/UT/src/DeUT.cpp @@ -236,10 +236,8 @@ LHCb::Detector::UT::detail::DeUTSectorObject::DeUTSectorObject( const dd4hep::De { // cacheInfo auto thisSector = DeUTSector{this}; - auto firstTraj = thisSector.createTraj( thisSector.firstStrip(), 0 ); - // if ( m_stripflip && xInverted() ) firstTraj = createTraj( m_nStrip, 0 ); - if ( thisSector.stripflip() && thisSector.xInverted() ) - firstTraj = thisSector.createTraj( thisSector.nStrip() + thisSector.firstStrip(), 0 ); + auto firstTraj = thisSector.trajectoryFirstStrip(); + if ( thisSector.stripflip() && thisSector.xInverted() ) firstTraj = thisSector.trajectoryLastStrip(); // get the start and end point. for piecewise trajectories, we // effectively make an approximation by a straight line. -- GitLab From 6e42262425a5c874b7e2afa35a9faf9eb081eb00 Mon Sep 17 00:00:00 2001 From: Hangyi Wu Date: Fri, 28 Feb 2025 20:20:20 +0100 Subject: [PATCH 2/2] fix: allow 2024-v00.00 to use old wrong p0 parameter --- Detector/UT/include/Detector/UT/DeUTSensor.h | 2 +- Detector/UT/src/DeUT.cpp | 12 +++++++++++- compact/components/UT/2024-v00.00/parameters.xml | 4 ++++ compact/components/UT/trunk/parameters.xml | 4 ++++ 4 files changed, 20 insertions(+), 2 deletions(-) diff --git a/Detector/UT/include/Detector/UT/DeUTSensor.h b/Detector/UT/include/Detector/UT/DeUTSensor.h index 7b39215c98..c270a565c5 100644 --- a/Detector/UT/include/Detector/UT/DeUTSensor.h +++ b/Detector/UT/include/Detector/UT/DeUTSensor.h @@ -97,7 +97,7 @@ namespace LHCb::Detector::UT { return ( strip >= firstStrip() ) && strip < nStrip() + firstStrip(); } LineTraj trajectory( unsigned int strip, double offset ) const { - if ( !isStrip( strip ) ) { + if ( dd4hep::_toInt( "WithCorrectedP0Parameter" ) && !isStrip( strip ) ) { throw std::out_of_range( fmt::format( "DeUTSector::createTraj: strip out of range, given {strip}, expect [{first}, {last}]", fmt::arg( "strip", strip ), fmt::arg( "first", firstStrip() ), diff --git a/Detector/UT/src/DeUT.cpp b/Detector/UT/src/DeUT.cpp index ee13c70f9b..a460f89de2 100644 --- a/Detector/UT/src/DeUT.cpp +++ b/Detector/UT/src/DeUT.cpp @@ -237,7 +237,17 @@ LHCb::Detector::UT::detail::DeUTSectorObject::DeUTSectorObject( const dd4hep::De { // cacheInfo auto thisSector = DeUTSector{this}; auto firstTraj = thisSector.trajectoryFirstStrip(); - if ( thisSector.stripflip() && thisSector.xInverted() ) firstTraj = thisSector.trajectoryLastStrip(); + if ( thisSector.stripflip() && thisSector.xInverted() ) { + if ( dd4hep::_toInt( "WithCorrectedP0Parameter" ) ) { + // use CORRECT p0 parameter since 2025 data taking (>2024-v00.00) + dd4hep::printout( dd4hep::DEBUG, "UT::cacheInfo", "With correct p0 parameter" ); + firstTraj = thisSector.trajectoryLastStrip(); + } else { + // use WRONG p0 parameter before 2025 data taking (<=2024-v00.00) + dd4hep::printout( dd4hep::DEBUG, "UT::cacheInfo", "With wrong p0 parameter" ); + firstTraj = thisSector.createTraj( thisSector.nStrip() + thisSector.firstStrip(), 0 ); + } + } // get the start and end point. for piecewise trajectories, we // effectively make an approximation by a straight line. diff --git a/compact/components/UT/2024-v00.00/parameters.xml b/compact/components/UT/2024-v00.00/parameters.xml index 3c30e6ccb3..975c1670eb 100644 --- a/compact/components/UT/2024-v00.00/parameters.xml +++ b/compact/components/UT/2024-v00.00/parameters.xml @@ -17,6 +17,10 @@ + + + + diff --git a/compact/components/UT/trunk/parameters.xml b/compact/components/UT/trunk/parameters.xml index 3c30e6ccb3..647c67deba 100644 --- a/compact/components/UT/trunk/parameters.xml +++ b/compact/components/UT/trunk/parameters.xml @@ -17,6 +17,10 @@ + + + + -- GitLab