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!
1 file
+ 14
10
Compare changes
  • Side-by-side
  • Inline
@@ -124,12 +124,12 @@ namespace LHCb::Detector {
unsigned int channelInModule )
: 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,
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 * half + ( dataLink / 4 ) ) |
: 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
@@ -216,24 +216,28 @@ namespace LHCb::Detector {
[[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 mat() / FTConstants::nHalfRobs; }
[[nodiscard]] constexpr unsigned int halfRob() const { return mat().to_unsigned() / 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; }
[[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 ); }
[[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 {
[[nodiscard]] constexpr unsigned int pacificChannel() const {
auto ch = channel() % FTConstants::nChannelsInDie;
return ( FTConstants::nChannelsInDie / 2 ) * ( 1 - ch % 2 ) + ( ch / 2 );
return ( FTConstants::nChannelsInDie / 2 ) * ( 1 - ch % 2 ) + ( ch / 2 );
}
/// Retrieve how many modules there are in that quarter
Loading