File indexing completed on 2025-08-06 08:17:53
0001
0002
0003
0004
0005
0006 #include "MicromegasDefs.h"
0007
0008 namespace
0009 {
0010
0011 template<class T>
0012 using underlying_type_t = typename std::underlying_type<T>::type;
0013
0014
0015 template<class T>
0016 constexpr underlying_type_t<T>
0017 to_underlying_type(T value) noexcept
0018 { return static_cast<underlying_type_t<T>>(value);}
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028 static constexpr unsigned int kBitShiftSegmentation = 8;
0029 static constexpr unsigned int kBitShiftTileId = 0;
0030
0031
0032 static constexpr unsigned int kBitShiftStrip = 0;
0033
0034 }
0035
0036 namespace MicromegasDefs
0037 {
0038
0039
0040 TrkrDefs::hitsetkey genHitSetKey(uint8_t layer, SegmentationType type, uint8_t tile )
0041 {
0042 TrkrDefs::hitsetkey key = TrkrDefs::genHitSetKey(TrkrDefs::TrkrId::micromegasId, layer);
0043
0044 TrkrDefs::hitsetkey tmp = to_underlying_type(type);
0045 key |= (tmp << kBitShiftSegmentation);
0046
0047 tmp = tile;
0048 key |= (tmp << kBitShiftTileId);
0049
0050 return key;
0051 }
0052
0053
0054 SegmentationType getSegmentationType(TrkrDefs::hitsetkey key)
0055 {
0056 TrkrDefs::hitsetkey tmp = (key >> kBitShiftSegmentation);
0057 return static_cast<SegmentationType>(tmp);
0058 }
0059
0060
0061 uint8_t getTileId(TrkrDefs::hitsetkey key)
0062 {
0063 TrkrDefs::hitsetkey tmp = (key >> kBitShiftTileId);
0064 return tmp;
0065 }
0066
0067
0068 TrkrDefs::hitkey genHitKey(uint16_t strip)
0069 {
0070 TrkrDefs::hitkey key = strip << kBitShiftStrip;
0071 return key;
0072 }
0073
0074
0075 uint16_t getStrip( TrkrDefs::hitkey key )
0076 {
0077 TrkrDefs::hitkey tmp = (key >> kBitShiftStrip);
0078 return tmp;
0079 }
0080
0081
0082 SegmentationType getSegmentationType(TrkrDefs::cluskey key)
0083 {
0084 const TrkrDefs::hitsetkey tmp = TrkrDefs::getHitSetKeyFromClusKey(key);
0085 return getSegmentationType( tmp );
0086 }
0087
0088
0089 uint8_t getTileId(TrkrDefs::cluskey key)
0090 {
0091 const TrkrDefs::hitsetkey tmp = TrkrDefs::getHitSetKeyFromClusKey(key);
0092 return getTileId( tmp );
0093 }
0094
0095 }