Skip to content
Snippets Groups Projects
Commit 45e8d194 authored by Hangyi Wu's avatar Hangyi Wu
Browse files

fixes MChits shift by one strip issue

parent 70e43eb7
No related branches found
No related tags found
No related merge requests found
Pipeline #5998764 passed
......@@ -34,6 +34,7 @@ namespace LHCb::Detector::UT {
unsigned int m_firstStrip = 0u;
unsigned int m_version = 2;
ChannelID m_channelID;
char m_sensorType;
float m_uMaxLocal = 0.0;
float m_uMinLocal = 0.0;
......@@ -70,6 +71,7 @@ namespace LHCb::Detector::UT {
unsigned int id() const { return this->access()->m_id; };
void setID( const unsigned int id ) { this->access()->m_id = id; }
float pitch() const { return this->access()->m_pitch; }
char sensorType() const { return this->access()->m_sensorType; }
unsigned int nStrip() const { return this->access()->m_nStrip; }
float uMaxLocal() const { return this->access()->m_uMaxLocal; }
float uMinLocal() const { return this->access()->m_uMinLocal; }
......@@ -91,7 +93,9 @@ namespace LHCb::Detector::UT {
bool contains( const ChannelID aChannel ) const { return ( aChannel == channelID() ); }
bool isStrip( const unsigned int strip ) const { return strip < nStrip(); }
bool isStrip( const unsigned int strip ) const {
return ( strip >= firstStrip() ) && strip < nStrip() + firstStrip();
}
LineTraj<double> trajectory( unsigned int strip, double offset ) const {
const double arclen =
( ( xInverted() && getStripflip() ) ? ( nStrip() - offset - strip - ( firstStrip() + 1 ) % 2 )
......@@ -110,7 +114,7 @@ namespace LHCb::Detector::UT {
}
double localU( const unsigned int strip, const double offset = 0.0 ) const {
// strip to local
double tStrip = strip + offset;
double tStrip = strip + offset + ( firstStrip() + 1 ) % 2;
if ( !getStripflip() && xInverted() ) {
return uMaxLocal() + pitch() * ( 0.5 - tStrip );
} else {
......@@ -120,8 +124,10 @@ namespace LHCb::Detector::UT {
unsigned int localUToStrip( const double u ) const {
// convert local u to a strip
unsigned int strip = ( ( !getStripflip() && xInverted() )
? static_cast<unsigned int>( floor( ( ( uMaxLocal() - u ) / pitch() ) + 0.5 ) )
: static_cast<unsigned int>( floor( ( ( u - uMinLocal() ) / pitch() ) + 0.5 ) ) );
? static_cast<unsigned int>( floor( ( ( uMaxLocal() - u ) / pitch() ) + 0.5 ) ) -
( firstStrip() + 1 ) % 2
: static_cast<unsigned int>( floor( ( ( u - uMinLocal() ) / pitch() ) + 0.5 ) ) ) -
( firstStrip() + 1 ) % 2;
return isStrip( strip ) ? strip : 0u;
}
bool localInBondGap( float v, float tol ) const {
......
......@@ -329,11 +329,14 @@ LHCb::Detector::UT::detail::DeUTSensorObject::DeUTSensorObject( const dd4hep::De
// get pitch size
auto nameString = de.placement().volume().name();
std::string m_type( nameString + 8, nameString + std::strlen( nameString ) );
if ( m_type == "Norm" ) {
m_pitch = dd4hep::_toDouble( "UTSensorAPitch" );
m_pitch = dd4hep::_toDouble( "UTSensorAPitch" );
m_sensorType = 'A';
} else {
m_pitch = dd4hep::_toDouble( "UTSensorBCDPitch" );
if ( m_type == "Dual" ) m_sensorType = 'B';
if ( m_type == "Quad" ) m_sensorType = 'C';
if ( m_type == "Hole" ) m_sensorType = 'D';
}
m_uMaxLocal = 0.5f * ( m_pitch * m_nStrip );
......
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