 |
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, 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 161 of file ITkStripsRodEncoder.cxx.
172 while (d0l or d0h or d1l or d1h){
173 if (
clusters.size() > maxCluster)
break;
176 if (cluster1 != 0x3ff)
179 if (
clusters.size() > maxCluster)
break;
182 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 214 of file ITkStripsRodEncoder.cxx.
219 hit_addr = __builtin_ctzll(hits_low64);
220 }
else if (hits_high64){
221 hit_addr = __builtin_ctzll(hits_high64) + 64;
224 hitpat_next3 =
getBit_128b(hit_addr+1, hits_high64, hits_low64) << 2
225 |
getBit_128b(hit_addr+2, hits_high64, hits_low64) << 1
226 |
getBit_128b(hit_addr+3, hits_high64, hits_low64);
228 for (
int i=0;
i<4; ++
i)
231 if (hit_addr == 128) {
234 hit_addr += isSecondRow<<7;
235 return hit_addr << 3 | hitpat_next3;
◆ encodeData()
void ITkStripsRodEncoder::encodeData |
( |
const std::vector< uint16_t > & |
clusters, |
|
|
std::vector< uint8_t > & |
data_encode, |
|
|
int |
typ, |
|
|
uint8_t |
l0tag, |
|
|
uint8_t |
bc_count |
|
) |
| const |
|
private |
Definition at line 130 of file ITkStripsRodEncoder.cxx.
135 data_encode.push_back((
header>>8) & 0xff);
136 data_encode.push_back(
header & 0xff);
138 size_t cluster_count = 0;
140 if (cluster_count == 4){
145 uint16_t clusterbits = cluster & 0x7ff;
146 data_encode.push_back((clusterbits>>8) & 0xff);
147 data_encode.push_back(clusterbits & 0xff);
151 while (cluster_count < 4) {
152 data_encode.push_back(0x7F);
153 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;
108 vec8Data.reserve(10);
111 for (
const auto& [
key, StripData] : allStripData) {
113 for (
size_t i = 0;
i < StripData.size(); ++
i) {
114 if (StripData[
i].any()) {
115 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 196 of file ITkStripsRodEncoder.cxx.
197 if (bit_addr > 127)
return false;
199 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 356 of file ITkStripsRodEncoder.cxx.
357 uint8_t bcid_low = bc_cout & 0x7;
360 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 240 of file ITkStripsRodEncoder.cxx.
241 int num8Words{
static_cast<int>(vec8Words.size())};
242 if (num8Words % 4 != 0) {
244 while (num8Words % 4 != 0) {
245 vec8Words.push_back(0x40);
250 const unsigned short int numWords{4};
251 const unsigned short int position[numWords]{0, 8, 16, 24};
252 unsigned short int arr8Words[numWords]{0, 0, 0, 0};
254 for (
int i{0};
i<num8Words;
i += numWords) {
255 for (
int j{0}; j<numWords; j++) {
256 arr8Words[j] = vec8Words[
i + j];
259 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 152 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 162 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.
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.
void encodeData(const std::vector< uint16_t > &clusters, std::vector< uint8_t > &data_encode, int typ, uint8_t l0tag, uint8_t bc_count) const
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.