|  | ATLAS Offline Software
    | 
 
 
 
Athena Algorithm Tool that provides conversion from ITkStrips RDO to ROD format Bytestream.  
 More...
#include <ITkStripsRodEncoder.h>
|  | 
| void | encodeData (const std::vector< uint16_t > &clusters, const uint16_t ichannel, std::vector< uint8_t > &data_encode, int typ, uint8_t l0tag, uint8_t bc_count) const | 
|  | 
| void | packFragments (std::vector< uint8_t > &vec8Words, std::vector< uint32_t > &vec32Words) const | 
|  | Method to pack vector of 8 bit words intto a vector of 32 bit words.  More... 
 | 
|  | 
| std::vector< uint16_t > | clusterFinder (const std::bitset< 256 > &inputData, const uint8_t maxCluster=63) const | 
|  | @breif Method to set pairs of 8 bit words to a 32 bit word.  More... 
 | 
|  | 
| uint16_t | clusterFinder_sub (uint64_t &hits_high64, uint64_t &hits_low64, bool isSecondRow) const | 
|  | 
| uint32_t | set32Bits (const unsigned short int *arr8Words, const unsigned short int *position, const unsigned short int &numWords) const | 
|  | 
| bool | getBit_128b (uint8_t bit_addr, uint64_t data_high64, uint64_t data_low64) const | 
|  | 
| void | setBit_128b (uint8_t bit_addr, bool value, uint64_t &data_high64, uint64_t &data_low64) const | 
|  | 
| bool | getParity_8bits (uint8_t val) const | 
|  | 
| int | getBarrelEC (const SCT_RDORawData *rdo) const | 
|  | Get the barrel/endcape info from the RDO.  More... 
 | 
|  | 
| int | getDiskLayer (const SCT_RDORawData *rdo) const | 
|  | Get disk/layer info from the RDO.  More... 
 | 
|  | 
| int | getPhiModule (const SCT_RDORawData *rdo) const | 
|  | Get the phi value info from the RDO.  More... 
 | 
|  | 
| int | getEtaModule (const SCT_RDORawData *rdo) const | 
|  | Get the eta value info from the RDO.  More... 
 | 
|  | 
| int | getStripMax (const SCT_RDORawData *rdo) const | 
|  | Get the maxumum strip value info from the RDO.  More... 
 | 
|  | 
| int | side (const SCT_RDORawData *rdo) const | 
|  | Get the side info from the RDO.  More... 
 | 
|  | 
| int | getTimeBin (const SCT_RDORawData *rdo) const | 
|  | Get the time bin info from the RDO.  More... 
 | 
|  | 
| int | getStrip (const SCT_RDORawData *rdo) const | 
|  | Get the strip number info from the RDO.  More... 
 | 
|  | 
| Identifier | offlineID (const SCT_RDORawData *rdo) const | 
|  | Get the offline Identifier from the RDO.  More... 
 | 
|  | 
| uint32_t | onlineID (const SCT_RDORawData *rdo) const | 
|  | Get the online Identifier from the RDO.  More... 
 | 
|  | 
| int | getRODLink (const SCT_RDORawData *rdo) const | 
|  | Get the ROD link number info in the RDO header data.  More... 
 | 
|  | 
| uint16_t | getHeaderPhysicsPacket (int typ, uint8_t l0tag, uint8_t bc_count) const | 
|  | Get the 16-bit word for a header with Type (PR or LP), L0Tag event and BCID.  More... 
 | 
|  | 
| uint16_t | getHeaderUsingRDO (const SCT_RDORawData *rdo) const | 
|  | Get the 16-bit word for a header for a hit.  More... 
 | 
|  | 
| uint16_t | getHeaderUsingHash (const IdentifierHash &linkHash, const int &errorWord) const | 
|  | Get the 16-bit word for a header for a link with a ByteStream error.  More... 
 | 
|  | 
| uint16_t | getTrailer (const int &errorWord) const | 
|  | Get the 16-bit word for a trailer, with or without ByteStream errors.  More... 
 | 
|  | 
Athena Algorithm Tool that provides conversion from ITkStrips RDO to ROD format Bytestream. 
Definition at line 29 of file ITkStripsRodEncoder.h.
◆ ~ITkStripsRodEncoder()
  
  | 
        
          | virtual ITkStripsRodEncoder::~ITkStripsRodEncoder | ( |  | ) |  |  | virtualdefault | 
 
 
◆ clusterFinder()
  
  | 
        
          | std::vector< uint16_t > ITkStripsRodEncoder::clusterFinder | ( | const std::bitset< 256 > & | inputData, |  
          |  |  | const uint8_t | maxCluster = 63 |  
          |  | ) |  | const |  | private | 
 
@breif Method to set pairs of 8 bit words to a 32 bit word. 
Function used by the packFragments(...) method.
- Parameters
- 
  
    | arr8Words | Pointer to array containing a pair of 8 bit words. |  | position | Pointer to an array that gives the 32 bit starting positions of the 8 bit words and corresponding to arr8Words. |  | numWords | Number of word to be set to a 32 bit word. |  
 
Definition at line 162 of file ITkStripsRodEncoder.cxx.
  167   std::bitset<128> dataEven;
 
  168   std::bitset<128> dataOdd;
 
  169   for(
int i=0; 
i<128; ++
i){
 
  170     dataEven[
i] = inputData[2*
i];
 
  171     dataOdd[
i] = inputData[2*
i+1];
 
  181   while (d0l or d0h or d1l or d1h){
 
  182     if (
clusters.size() > maxCluster) 
break;
 
  185     if (cluster1 != 0x3ff) 
 
  188     if (
clusters.size() > maxCluster) 
break;
 
  191     if (cluster0 != 0x3ff) 
 
 
 
 
◆ clusterFinder_sub()
  
  | 
        
          | uint16_t ITkStripsRodEncoder::clusterFinder_sub | ( | uint64_t & | hits_high64, |  
          |  |  | uint64_t & | hits_low64, |  
          |  |  | bool | isSecondRow |  
          |  | ) |  | const |  | private | 
 
Definition at line 223 of file ITkStripsRodEncoder.cxx.
  228     hit_addr = __builtin_ctzll(hits_low64);
 
  229   } 
else if (hits_high64){
 
  230     hit_addr = __builtin_ctzll(hits_high64) + 64;
 
  233   hitpat_next3 = 
getBit_128b(hit_addr+1, hits_high64, hits_low64) << 2
 
  234     | 
getBit_128b(hit_addr+2, hits_high64, hits_low64) << 1
 
  235     | 
getBit_128b(hit_addr+3, hits_high64, hits_low64);
 
  237   for (
int i=0; 
i<4; ++
i)
 
  240   if (hit_addr == 128) {
 
  243     hit_addr += isSecondRow<<7;
 
  244     return hit_addr << 3 | hitpat_next3;
 
 
 
 
◆ encodeData()
  
  | 
        
          | void ITkStripsRodEncoder::encodeData | ( | const std::vector< uint16_t > & | clusters, |  
          |  |  | const uint16_t | ichannel, |  
          |  |  | std::vector< uint8_t > & | data_encode, |  
          |  |  | int | typ, |  
          |  |  | uint8_t | l0tag, |  
          |  |  | uint8_t | bc_count |  
          |  | ) |  | const |  | private | 
 
Definition at line 128 of file ITkStripsRodEncoder.cxx.
  131   size_t total_clusters = 
clusters.size();
 
  132   size_t cluster_pos = 0;
 
  134   while (cluster_pos < total_clusters) {
 
  137     data_encode.push_back((
header>>8) & 0xff);
 
  138     data_encode.push_back(
header & 0xff);
 
  140     size_t max_cluster_pp = 0; 
 
  141     for (; max_cluster_pp < 4 && cluster_pos < total_clusters; ++max_cluster_pp, ++cluster_pos) {
 
  145       uint16_t clusterbits = ((ichannel & 0xf) << 11) | (cluster & 0x7ff);
 
  146       data_encode.push_back((clusterbits>>8) & 0xff);
 
  147       data_encode.push_back(clusterbits & 0xff);
 
  150     while (max_cluster_pp < 4) {
 
  151       data_encode.push_back(0x7F); 
 
  152       data_encode.push_back(0xFF);
 
 
 
 
◆ fillROD()
  
  | 
        
          | void ITkStripsRodEncoder::fillROD | ( | std::vector< uint32_t > & | vec32Data, |  
          |  |  | const uint32_t & | robID, |  
          |  |  | const std::vector< const SCT_RDORawData * > & | vecRDOs |  
          |  | ) |  | const |  | overridevirtual | 
 
Main Convert method. 
Converts SCT RDO to a vector of 32 bit words. Starts by retrieving and collecting errors, then loops through RDO's and decode them to 16 bit words, and then finally it packs the 16 bit word into 32 bit words vector.
- Parameters
- 
  
    | vec32Data | Vector of 32 bit words to be filled with encoded RDOs from the SCT. |  | robID | ID of the current readout buffer (ROB). |  | vecRDOs | Vector containing the RDOs to be coverted to vector of 32 bit words. |  
 
Definition at line 67 of file ITkStripsRodEncoder.cxx.
   71   std::unordered_map<uint64_t, std::vector<std::bitset<256>>> allStripData;
 
   73   for (
const auto& rdo : vecRDOs) {
 
   86       eta_group = 
static_cast<int>(std::floor((eta_mod+1) / 2)); 
 
   88       eta_group = 
static_cast<int>(std::floor(eta_mod / 2)); 
 
   91     int chips_per_module = (strip_max + 1) / 128;
 
   93     auto& StripData = allStripData[
key];
 
   95     if (StripData.empty()) {
 
   96       StripData.resize(chips_per_module);
 
  101     int chip = 
static_cast<int>(std::floor(
strip / 128));
 
  102     int strip_position = 
strip % 128;
 
  103     int strip_logical_channel = 2*strip_position + (eta_mod & 1);
 
  104     StripData[chip].set(strip_logical_channel);
 
  107   std::vector<uint8_t> vec8Data;
 
  110   for (
const auto& [
key, StripData] : allStripData) {
 
  112     for (
size_t i = 0; 
i < StripData.size(); ++
i) {
 
  113       std::bitset<256> 
hits = StripData[
i];
 
 
 
 
◆ getBarrelEC()
◆ getBit_128b()
  
  | 
        
          | bool ITkStripsRodEncoder::getBit_128b | ( | uint8_t | bit_addr, |  
          |  |  | uint64_t | data_high64, |  
          |  |  | uint64_t | data_low64 |  
          |  | ) |  | const |  | inlineprivate | 
 
Definition at line 205 of file ITkStripsRodEncoder.cxx.
  206   if (bit_addr > 127) 
return false;
 
  208   return bit_addr<64 ? data_low64>>bit_addr & 1 : data_high64>>(bit_addr-64) & 1;
 
 
 
 
◆ getDiskLayer()
◆ getEtaModule()
◆ getHeaderPhysicsPacket()
  
  | 
        
          | uint16_t ITkStripsRodEncoder::getHeaderPhysicsPacket | ( | int | typ, |  
          |  |  | uint8_t | l0tag, |  
          |  |  | uint8_t | bc_count |  
          |  | ) |  | const |  | private | 
 
Get the 16-bit word for a header with Type (PR or LP), L0Tag event and BCID. 
Definition at line 365 of file ITkStripsRodEncoder.cxx.
  366   uint8_t bcid_low = bc_cout & 0x7; 
 
  369   const uint16_t Header{
static_cast<uint16_t>(((
uint8_t)typ << 12) | (0x1 << 11) | (l0tag & 0x7f) << 4 | (bcid_low) << 1 | bc_parity)};
 
 
 
 
◆ getHeaderUsingHash()
◆ getHeaderUsingRDO()
◆ getParity_8bits()
  
  | 
        
          | bool ITkStripsRodEncoder::getParity_8bits | ( | uint8_t | val | ) | const |  | private | 
 
 
◆ getPhiModule()
◆ getRODLink()
◆ getStrip()
◆ getStripMax()
◆ getTimeBin()
Get the time bin info from the RDO. 
 
 
◆ getTrailer()
  
  | 
        
          | uint16_t ITkStripsRodEncoder::getTrailer | ( | const int & | errorWord | ) | const |  | private | 
 
 
◆ initialize()
  
  | 
        
          | StatusCode ITkStripsRodEncoder::initialize | ( |  | ) |  |  | overridevirtual | 
 
Initialize. 
Definition at line 45 of file ITkStripsRodEncoder.cxx.
   56     if (sctDetElement->swapPhiReadoutDirection()) {
 
   61   return StatusCode::SUCCESS;
 
 
 
 
◆ offlineID()
◆ onlineID()
◆ packFragments()
  
  | 
        
          | void ITkStripsRodEncoder::packFragments | ( | std::vector< uint8_t > & | vec8Words, |  
          |  |  | std::vector< uint32_t > & | vec32Words |  
          |  | ) |  | const |  | private | 
 
Method to pack vector of 8 bit words intto a vector of 32 bit words. 
Method us used by private method encodeData(...).
- Parameters
- 
  
    | vec8Words | Vector containing 8 bit words. |  | vec32Words | Vector for 32 bit words to be packed. |  
 
Definition at line 249 of file ITkStripsRodEncoder.cxx.
  250   int num8Words{
static_cast<int>(vec8Words.size())};
 
  251   if (num8Words % 4 != 0) {
 
  253     while (num8Words % 4 != 0) {
 
  254       vec8Words.push_back(0x40); 
 
  259   const unsigned short int numWords{4};
 
  260   const unsigned short int position[numWords]{0, 8, 16, 24};
 
  261   unsigned short int arr8Words[numWords]{0, 0, 0, 0};
 
  263   for (
int i{0}; 
i<num8Words; 
i += numWords) {
 
  264     for (
int j{0}; j<numWords; j++) {
 
  265       arr8Words[j] = vec8Words[
i + j];
 
  268     vec32Words.push_back(uint32Word);
 
 
 
 
◆ set32Bits()
  
  | 
        
          | uint32_t ITkStripsRodEncoder::set32Bits | ( | const unsigned short int * | arr8Words, |  
          |  |  | const unsigned short int * | position, |  
          |  |  | const unsigned short int & | numWords |  
          |  | ) |  | const |  | private | 
 
 
◆ setBit_128b()
  
  | 
        
          | void ITkStripsRodEncoder::setBit_128b | ( | uint8_t | bit_addr, |  
          |  |  | bool | value, |  
          |  |  | uint64_t & | data_high64, |  
          |  |  | uint64_t & | data_low64 |  
          |  | ) |  | const |  | inlineprivate | 
 
 
◆ side()
◆ m_bcid
  
  | 
        
          | std::atomic<uint8_t> ITkStripsRodEncoder::m_bcid = 0 |  | mutableprivate | 
 
Method to encode RDO data to vector of 16 bin words. 
Methods used by main convert methods fillROD(...).
- Parameters
- 
  
    | vecTimeBins | Vector of time bins for RDOs. |  | vec16Words | Vector of 16 bit words to filled from encoded RDO data. |  | rdo | RDO raw data object to be encoded. |  | groupSize | Group size info from the RDO. |  | strip | Strip number info from the RDO. |  
 
Definition at line 70 of file ITkStripsRodEncoder.h.
 
 
◆ m_cabling
Initial value:{this, 
                                         "ITkStripCablingTool", 
                                         "ITkStripCablingTool", 
                                         "Tool to retrieve ITkStrips Cabling"}
Providing mappings of online and offline identifiers and also serial numbers. 
Definition at line 153 of file ITkStripsRodEncoder.h.
 
 
◆ m_condensed
  
  | 
        
          | BooleanProperty ITkStripsRodEncoder::m_condensed {this, "CondensedMode", false, "Condensed mode (true) or Expanded mode (false)"} |  | private | 
 
Example Boolean used to determine decoding mode, maybe unused finally. 
Definition at line 163 of file ITkStripsRodEncoder.h.
 
 
◆ m_itkStripsID
  
  | 
        
          | const SCT_ID* ITkStripsRodEncoder::m_itkStripsID {nullptr} |  | private | 
 
 
◆ m_l0tag
  
  | 
        
          | std::atomic<uint8_t> ITkStripsRodEncoder::m_l0tag = 0 |  | mutableprivate | 
 
 
◆ m_swapModuleID
  
  | 
        
          | std::set<Identifier> ITkStripsRodEncoder::m_swapModuleID {} |  | private | 
 
 
The documentation for this class was generated from the following files:
 
def retrieve(aClass, aKey=None)
ToolHandle< IITkStripCablingTool > m_cabling
Providing mappings of online and offline identifiers and also serial numbers.
int getDiskLayer(const SCT_RDORawData *rdo) const
Get disk/layer info from the RDO.
std::set< Identifier > m_swapModuleID
Swap Module identifier, set by SCTRawContByteStreamTool.
std::vector< uint16_t > clusterFinder(const std::bitset< 256 > &inputData, const uint8_t maxCluster=63) const
@breif Method to set pairs of 8 bit words to a 32 bit word.
int barrel_ec(const Identifier &id) const
Values of different levels (failure returns 0)
int phi_module(const Identifier &id) const
uint32_t onlineID(const SCT_RDORawData *rdo) const
Get the online Identifier from the RDO.
uint16_t clusterFinder_sub(uint64_t &hits_high64, uint64_t &hits_low64, bool isSecondRow) const
int getPhiModule(const SCT_RDORawData *rdo) const
Get the phi value info from the RDO.
uint32_t set32Bits(const unsigned short int *arr8Words, const unsigned short int *position, const unsigned short int &numWords) const
int getStripMax(const SCT_RDORawData *rdo) const
Get the maxumum strip value info from the RDO.
BooleanProperty m_condensed
Example Boolean used to determine decoding mode, maybe unused finally.
int getRODLink(const SCT_RDORawData *rdo) const
Get the ROD link number info in the RDO header data.
void encodeData(const std::vector< uint16_t > &clusters, const uint16_t ichannel, std::vector< uint8_t > &data_encode, int typ, uint8_t l0tag, uint8_t bc_count) const
Identifier offlineID(const SCT_RDORawData *rdo) const
Get the offline Identifier from the RDO.
IdentifierHash wafer_hash(const Identifier &wafer_id) const
wafer hash from id - optimized
bool getParity_8bits(uint8_t val) const
int getEtaModule(const SCT_RDORawData *rdo) const
Get the eta value info from the RDO.
std::atomic< uint8_t > m_bcid
Method to encode RDO data to vector of 16 bin words.
void setBit_128b(uint8_t bit_addr, bool value, uint64_t &data_high64, uint64_t &data_low64) const
std::atomic< uint8_t > m_l0tag
bool getBit_128b(uint8_t bit_addr, uint64_t data_high64, uint64_t data_low64) const
int layer_disk(const Identifier &id) const
uint16_t getHeaderPhysicsPacket(int typ, uint8_t l0tag, uint8_t bc_count) const
Get the 16-bit word for a header with Type (PR or LP), L0Tag event and BCID.
int getStrip(const SCT_RDORawData *rdo) const
Get the strip number info from the RDO.
int getBarrelEC(const SCT_RDORawData *rdo) const
Get the barrel/endcape info from the RDO.
int strip(const Identifier &id) const
int eta_module(const Identifier &id) const
int strip_max(const Identifier &id) const
int side(const Identifier &id) const
virtual Identifier identify() const override final
Identifier wafer_id(int barrel_ec, int layer_disk, int phi_module, int eta_module, int side) const
For a single side of module.
This is a "hash" representation of an Identifier. This encodes a 32 bit index which can be used to lo...
const SCT_ID * m_itkStripsID
Identifier helper class for the ITkStrips subdetector that creates compact Identifier objects and Ide...
void packFragments(std::vector< uint8_t > &vec8Words, std::vector< uint32_t > &vec32Words) const
Method to pack vector of 8 bit words intto a vector of 32 bit words.