Skip to content
Snippets Groups Projects

Add SciFi hardware ID conversion from FTChannelID

Merged Lukas Witola requested to merge luwitola_ftchannelid into master
All threads resolved!
Files
2
@@ -125,6 +125,13 @@ namespace LHCb::Detector {
: FTChannelID{shift<Mask::station>( station ) | shift<Mask::layer>( layer ) | shift<Mask::quarter>( quarter ) |
shift<Mask::module>( module ) | shift<Mask::channelInModule>( channelInModule )} {}
// Explicit constructor from the hardware IDs
constexpr FTChannelID( StationID station, LayerID layer, QuarterID quarter, ModuleID module, unsigned int halfRob,
unsigned int dataLink, unsigned int channel )
: FTChannelID{shift<Mask::station>( station ) | shift<Mask::layer>( layer ) | shift<Mask::quarter>( quarter ) |
shift<Mask::module>( module ) | shift<Mask::mat>( 2 * halfRob + ( dataLink / 4 ) ) |
shift<Mask::sipm>( dataLink % 4 ) | shift<Mask::channel>( channel )} {}
/// Operator overload, to cast channel ID to unsigned int. Used by linkers where the key (channel id) is an int
constexpr operator unsigned int() const { return m_channelID; }
@@ -196,9 +203,6 @@ namespace LHCb::Detector {
/// Retrieve ID of the mat in the module
[[nodiscard]] constexpr MatID mat() const { return MatID{extract<Mask::mat>( m_channelID )}; }
/// Retrieve data link in module
[[nodiscard]] constexpr unsigned int dataLink() const { return ( to_unsigned( mat() ) << 2 | sipm() ); } // TO TEST
/// Retrieve Module id (0 - 5 or 0 - 6)
[[nodiscard]] constexpr ModuleID module() const { return ModuleID{extract<Mask::module>( m_channelID )}; }
@@ -211,6 +215,31 @@ namespace LHCb::Detector {
/// Retrieve Station id
[[nodiscard]] constexpr StationID station() const { return StationID{extract<Mask::station>( m_channelID )}; }
/// Retrieve HalfRob ID within module [0, 1]
[[nodiscard]] constexpr unsigned int halfRob() const { return to_unsigned( mat() ) / FTConstants::nHalfRobs; }
/// Retrieve data link ID within HalfRob [0..7]
[[nodiscard]] constexpr unsigned int dataLink() const { return ( FTConstants::nSiPM * halfRob() + sipm() ); }
/// Retrieve ClusterBoard ID within HalfRob [0..3]
[[nodiscard]] constexpr unsigned int clusterBoard() const {
return dataLink() / FTConstants::nLinksPerClusterBoard;
}
/// Retrieve PacificBoard ID within HalfRob [0..3]
[[nodiscard]] constexpr unsigned int pacificBoard() const { return clusterBoard(); }
/// Retrieve Pacific ID within PacificBoard [0, 1]
[[nodiscard]] constexpr unsigned int pacific() const {
return ( channel() / FTConstants::nChannelsInDie ) + 2 * ( dataLink() % 2 );
}
/// Retrieve Pacific channel ID within Pacific [0..63]
[[nodiscard]] constexpr unsigned int pacificChannel() const {
auto ch = channel() % FTConstants::nChannelsInDie;
return ( FTConstants::nChannelsInDie / 2 ) * ( 1 - ch % 2 ) + ( ch / 2 );
}
/// Retrieve how many modules there are in that quarter
[[nodiscard]] constexpr unsigned int nModulesInQuarter() const { return ( to_unsigned( station() ) == 3 ) ? 6 : 5; }
Loading