diff --git a/Detector/UT/include/Detector/UT/DeUTSector.h b/Detector/UT/include/Detector/UT/DeUTSector.h index 0d0e693a81f9228d1ff131694e61a3200925bbaa..843920214a7f15c778289ffd78391c603d768462 100644 --- a/Detector/UT/include/Detector/UT/DeUTSector.h +++ b/Detector/UT/include/Detector/UT/DeUTSector.h @@ -188,6 +188,7 @@ namespace LHCb::Detector::UT { using DeIOVElement::DeIOVElement; unsigned int firstStrip() const { return this->access()->m_sensor.m_firstStrip; } + unsigned int lastStrip() const { return sensor().lastStrip(); } unsigned int firstBeetle() const { return this->access()->m_firstBeetle; } unsigned int nStrip() const { return this->access()->m_sensor.m_nStrip; } bool stripflip() const { return this->access()->m_sensor.m_stripflip; } @@ -215,7 +216,7 @@ namespace LHCb::Detector::UT { return sensor().trajectory( strip, offset ); } LineTraj trajectoryFirstStrip() const { return createTraj( firstStrip(), 0. ); } - LineTraj trajectoryLastStrip() const { return createTraj( nStrip() - 1u + firstStrip(), 0. ); } + LineTraj trajectoryLastStrip() const { return createTraj( lastStrip(), 0. ); } ROOT::Math::XYZPoint globalCentre() const { return this->toGlobal( ROOT::Math::XYZPoint( 0.0, 0.0, 0.0 ) ); } @@ -575,7 +576,7 @@ namespace LHCb::Detector::UT { void trajectory( unsigned int strip, double offset, double& dxdy, double& dzdy, double& xAtYEq0, double& zAtYEq0, double& ybegin, double& yend ) const { auto i = offset + strip; - auto numstrips = ( ( stripflip() && xInverted() ) ? ( nStrip() - i ) : i ); + auto numstrips = ( ( stripflip() && xInverted() ) ? ( lastStrip() - i ) : i ); dxdy = this->access()->m_dxdy; dzdy = this->access()->m_dzdy; diff --git a/Detector/UT/include/Detector/UT/DeUTSensor.h b/Detector/UT/include/Detector/UT/DeUTSensor.h index 650d700be12d117f2c2468e2c07e0b464a48a1cf..5a93d9759aa7178b62218cd67d5e7fb9761a70e3 100644 --- a/Detector/UT/include/Detector/UT/DeUTSensor.h +++ b/Detector/UT/include/Detector/UT/DeUTSensor.h @@ -89,26 +89,23 @@ namespace LHCb::Detector::UT { float activeHeight() const { return fabs( this->access()->m_vMinLocal - this->access()->m_vMaxLocal ); } bool getStripflip() const { return this->access()->m_stripflip; } unsigned int firstStrip() const { return this->access()->m_firstStrip; }; + unsigned int lastStrip() const { return nStrip() - 1u + firstStrip(); }; unsigned int version() const { return this->access()->m_version; }; using DeIOVElement::DeIOVElement; bool contains( const ChannelID aChannel ) const { return ( aChannel == channelID() ); } - bool isStrip( const unsigned int strip ) const { - return ( strip >= firstStrip() ) && strip < nStrip() + firstStrip(); - } + bool isStrip( const unsigned int strip ) const { return ( strip >= firstStrip() ) && strip <= lastStrip(); } LineTraj trajectory( unsigned int strip, double offset ) const { if ( this->access()->m_useCorrectP0Parameter && !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 ) ) ); + 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", lastStrip() ) ) ); } - const double arclen = - ( ( xInverted() && getStripflip() ) ? ( nStrip() - offset - strip - ( firstStrip() + 1 ) % 2 ) - : ( offset + strip - firstStrip() ) ) * - pitch(); + const double arclen = ( ( xInverted() && getStripflip() ) ? ( lastStrip() - ( offset + strip ) ) + : ( ( offset + strip ) - firstStrip() ) ) * + pitch(); ROOT::Math::XYZPoint midPoint = this->access()->m_midTraj->position( arclen + this->access()->m_midTraj->beginRange() ); return { midPoint, this->access()->m_direction, this->access()->m_range,