ATLAS Offline Software
Loading...
Searching...
No Matches
ITkStripsRodEncoder Class Reference

Athena Algorithm Tool that provides conversion from ITkStrips RDO to ROD format Bytestream. More...

#include <ITkStripsRodEncoder.h>

Inheritance diagram for ITkStripsRodEncoder:
Collaboration diagram for ITkStripsRodEncoder:

Public Member Functions

virtual ~ITkStripsRodEncoder ()=default
 Destructor.
virtual StatusCode initialize () override
 Initialize.
virtual void fillROD (std::vector< uint32_t > &vec32Data, const uint32_t &robID, const std::vector< const SCT_RDORawData * > &vecRDOs) const override
 Main Convert method.

Private Member Functions

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, uint32_t hccKey, uint16_t &size) 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.
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.
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.
uint8_t getDiskLayer (const SCT_RDORawData *rdo) const
 Get disk/layer info from the RDO.
uint8_t getPhiModule (const SCT_RDORawData *rdo) const
 Get the phi value info from the RDO.
int getEtaModule (const SCT_RDORawData *rdo) const
 Get the eta value info from the RDO.
uint16_t getStripMax (const SCT_RDORawData *rdo) const
 Get the maxumum strip value info from the RDO.
int getSide (const SCT_RDORawData *rdo) const
 Get the side info from the RDO.
int getTimeBin (const SCT_RDORawData *rdo) const
 Get the time bin info from the RDO.
int getStrip (const SCT_RDORawData *rdo) const
 Get the strip number info from the RDO.
Identifier offlineID (const SCT_RDORawData *rdo) const
 Get the offline Identifier from the RDO.
uint32_t onlineID (const SCT_RDORawData *rdo) const
 Get the online Identifier from the RDO.
int getRODLink (const SCT_RDORawData *rdo) const
 Get the ROD link number info in the RDO header data.
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.
uint16_t getHeaderUsingRDO (const SCT_RDORawData *rdo) const
 Get the 16-bit word for a header for a hit.
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.
uint16_t getTrailer (const int &errorWord) const
 Get the 16-bit word for a trailer, with or without ByteStream errors.

Private Attributes

std::atomic< uint8_t > m_bcid = 0
 Method to encode RDO data to vector of 16 bin words.
std::atomic< uint8_t > m_l0tag = 0
ToolHandle< IITkStripCablingToolm_cabling
 Providing mappings of online and offline identifiers and also serial numbers.
const SCT_IDm_itkStripsID {nullptr}
 Identifier helper class for the ITkStrips subdetector that creates compact Identifier objects and IdentifierHash or hash IDs.
BooleanProperty m_condensed {this, "CondensedMode", false, "Condensed mode (true) or Expanded mode (false)"}
 Example Boolean used to determine decoding mode, maybe unused finally.
std::set< Identifierm_swapModuleID {}
 Swap Module identifier, set by SCTRawContByteStreamTool.

Detailed Description

Athena Algorithm Tool that provides conversion from ITkStrips RDO to ROD format Bytestream.

Definition at line 29 of file ITkStripsRodEncoder.h.

Constructor & Destructor Documentation

◆ ~ITkStripsRodEncoder()

virtual ITkStripsRodEncoder::~ITkStripsRodEncoder ( )
virtualdefault

Destructor.

Member Function Documentation

◆ 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
arr8WordsPointer to array containing a pair of 8 bit words.
positionPointer to an array that gives the 32 bit starting positions of the 8 bit words and corresponding to arr8Words.
numWordsNumber of word to be set to a 32 bit word.

Definition at line 292 of file ITkStripsRodEncoder.cxx.

292 {
293
294 std::vector<uint16_t> clusters;
295
296 // Split into far (odd) and near (even) strips
297 std::bitset<128> dataEven;
298 std::bitset<128> dataOdd;
299 for(int i=0; i<128; ++i){
300 dataEven[i] = inputData[2*i];
301 dataOdd[i] = inputData[2*i+1];
302 }
303
304 // Split the 128-bit Even and Odd data into four 64-bit chunks for processing
305 uint64_t d0l = chunk<0>(dataEven);
306 uint64_t d0h = chunk<1>(dataEven);
307
308 uint64_t d1l = chunk<0>(dataOdd);
309 uint64_t d1h = chunk<1>(dataOdd);
310
311 while (d0l or d0h or d1l or d1h){
312 if (clusters.size() > maxCluster) break;
313
314 uint16_t cluster1 = clusterFinder_sub(d1h, d1l, true);
315 if (cluster1 != 0x3ff) // No cluster was found
316 clusters.push_back(cluster1);
317
318 if (clusters.size() > maxCluster) break;
319
320 uint16_t cluster0 = clusterFinder_sub(d0h, d0l, false);
321 if (cluster0 != 0x3ff) // No cluster was found
322 clusters.push_back(cluster0);
323 }
324
325 if (clusters.empty()) {
326 clusters.push_back(0x3fe);
327 } else {
328 clusters.back() |=1 << 11;
329 }
330
331 return clusters;
332}
uint16_t clusterFinder_sub(uint64_t &hits_high64, uint64_t &hits_low64, bool isSecondRow) const
setWord1 uint16_t

◆ clusterFinder_sub()

uint16_t ITkStripsRodEncoder::clusterFinder_sub ( uint64_t & hits_high64,
uint64_t & hits_low64,
bool isSecondRow ) const
private

Definition at line 353 of file ITkStripsRodEncoder.cxx.

353 {
354 uint8_t hit_addr = 128;
355 uint8_t hit_mask = 0;
356
357 if (hits_low64){
358 hit_addr = __builtin_ctzll(hits_low64);
359 } else if (hits_high64){
360 hit_addr = __builtin_ctzll(hits_high64) + 64;
361 }
362
363 hit_mask = getBit_128b(hit_addr+1, hits_high64, hits_low64) << 2
364 | getBit_128b(hit_addr+2, hits_high64, hits_low64) << 1
365 | getBit_128b(hit_addr+3, hits_high64, hits_low64);
366
367 for (int i=0; i<4; ++i)
368 setBit_128b(hit_addr+i, 0, hits_high64, hits_low64);
369
370 if (hit_addr == 128) {
371 return 0x3ff;
372 } else {
373 hit_addr += isSecondRow<<7;
374 return hit_addr << 3 | hit_mask;
375 }
376}
void setBit_128b(uint8_t bit_addr, bool value, uint64_t &data_high64, uint64_t &data_low64) const
bool getBit_128b(uint8_t bit_addr, uint64_t data_high64, uint64_t data_low64) const

◆ 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,
uint32_t hccKey,
uint16_t & size ) const
private

Definition at line 252 of file ITkStripsRodEncoder.cxx.

253 {
254
255
256 if(hccKey!=0){
257 ATH_MSG_DEBUG("hccKey: " << std::bitset<32>(hccKey));
258 ATH_MSG_DEBUG("hccKey 8-bit word-4: "<<std::bitset<8>(hccKey));
259 ATH_MSG_DEBUG("hccKey 8-bit word-3: "<<std::bitset<8>(hccKey>>24));
260 ATH_MSG_DEBUG("hccKey 8-bit word-2: "<<std::bitset<8>(hccKey>>16));
261 ATH_MSG_DEBUG("hccKey 8-bit word-1: "<<std::bitset<8>(hccKey>>8));
262
263 data_encode.push_back(hccKey);
264 data_encode.push_back(hccKey>>24);
265 data_encode.push_back(hccKey>>16);
266 data_encode.push_back(hccKey>>8);
267
268 uint16_t header = getHeaderPhysicsPacket(ptyp, l0tag, bc_count);
269 ATH_MSG_DEBUG("header: " << std::bitset<16>(header));
270 data_encode.push_back((header>>8) & 0xff);
271 data_encode.push_back(header & 0xff);
272 }
273
274 for(size_t idx=0;auto &cluster : clusters){
275 if(cluster == 0x3fe) continue;
276 if(idx!=0) size++;
277
278 // cluster bits:
279 // "0" + 4-bit channel number + 11-bit cluster dropping the last cluster bit
280 uint16_t clusterbits = ((ichannel & 0xf) << 11) | (cluster & 0x7ff);
281 ATH_MSG_DEBUG("Clusters: " << idx << ": " << std::bitset<16>(clusterbits) << " size: " << size << " ichannel: " << ichannel);
282 data_encode.push_back((clusterbits>>8) & 0xff);
283 data_encode.push_back(clusterbits & 0xff);
284 idx++;
285 }
286
287 return;
288}
#define ATH_MSG_DEBUG(x)
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.

◆ 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
vec32DataVector of 32 bit words to be filled with encoded RDOs from the SCT.
robIDID of the current readout buffer (ROB).
vecRDOsVector containing the RDOs to be coverted to vector of 32 bit words.

Definition at line 117 of file ITkStripsRodEncoder.cxx.

118 {
119 //code to be filled here
120
121 std::unordered_map<uint32_t, std::vector<std::bitset<256>>> allStripData;
122
123 for (const auto& rdo : vecRDOs) {
124 int barrelEC = getBarrelEC(rdo);
125 int eta_mod = getEtaModule(rdo);
126 uint8_t side = getSide(rdo);
127 uint8_t disk = getDiskLayer(rdo);
128 uint8_t phi_mod = getPhiModule(rdo);
129 uint16_t strip_max = getStripMax(rdo);
130
131 if (strip_max == 0xFFFF){
132 //To do: Implement workaround
133 const Identifier rdoID{rdo->identify()};
134 ATH_MSG_WARNING("Negative maximum number of strips found " << m_itkStripsID->strip_max(rdoID));
135 continue;
136 }
137
138 uint8_t sideAC = 0;
139 if((barrelEC == 0 && eta_mod > 0) || barrelEC > 0) sideAC = 1;
140
141 uint8_t eta_group=0;
142
143 if (barrelEC == 0) {
144 if(disk < 2){
145 eta_group = static_cast<uint8_t>(std::floor((std::abs(eta_mod)-1) / 4));
146 }else{
147 eta_group = static_cast<uint8_t>(std::floor((std::abs(eta_mod)-1) / 2));
148 }
149 }else {
150 if(eta_mod>=0 && eta_mod<=9) eta_group = static_cast<uint8_t>(std::floor(eta_mod / 4));
151 else if(eta_mod>=10 && eta_mod<=13) eta_group = static_cast<uint8_t>(std::floor((eta_mod+2)/4));
152 else if(eta_mod>13) eta_group = static_cast<uint8_t>(std::floor((eta_mod-6)/2));
153 }
154
155
156 uint8_t chips_per_module = (strip_max + 1) / 128;
157 uint32_t key = hccKey(barrelEC, side, disk, phi_mod, eta_mod, eta_group);
158
159 ATH_MSG_DEBUG("barrel: "<< barrelEC<<" sideAC: " << (uint32_t)sideAC << " disk: "<<(uint32_t)disk << " side: " << (uint32_t)side <<" phi_mod: "<<(uint32_t)phi_mod << " eta_mod: " << eta_mod << " eta group: "<<(uint32_t)eta_group << " chips per module: " << (uint32_t)chips_per_module);
160
161 ATH_MSG_DEBUG("key: " << std::bitset<32>(key));
162 auto& StripData = allStripData[key];
163
164 if (StripData.empty()) {
165 StripData.resize(chips_per_module);
166 }
167
168 //Populate the bitset for each chip with active strips
169 int strip = getStrip(rdo);
170 int chip = static_cast<int>(std::floor(strip / 128));
171 int strip_position = strip % 128;
172 int strip_logical_channel = 2*strip_position + (eta_mod & 1);
173
174 ATH_MSG_DEBUG("strip N: "<< strip << " chip n: " << chip << " Strip position: " << strip_position << " Strip position logical: " << strip_logical_channel);
175 StripData[chip].set(strip_logical_channel);
176 }
177
178 std::vector<uint8_t> vec8Data;
179 uint32_t vectorSize = 0;
180 std::vector<uint16_t> clusters;
181
182 ATH_MSG_DEBUG("All strip data size: " << allStripData.size());
183
184 //Iterate over processed strip data and find clusters
185 for (const auto& [key, StripData] : allStripData) {
186
187 uint16_t ichannel = 0;
188 uint16_t size = 1;
189 int ptype = 1;
190 bool keyRecorded = false;
191 clusters.clear();
192
193 ATH_MSG_DEBUG("key is: " << std::bitset<32>(key) << " StripData size: " << StripData.size());
194
195 for (size_t i = 0; i < StripData.size(); ++i) {
196
197 std::bitset<256> hits = StripData[i];
198
199 if(hits==0){
200 ++ichannel;
201 continue;
202 }
203
204 //Use clusterFinder to extract clusters from the bitset
205 clusters = clusterFinder(hits);
206
207 if(clusters.empty()){
208 ++ichannel;
209 continue;
210 }
211 uint32_t hccKey = (keyRecorded) ? 0 : key;
212 encodeData(clusters, ichannel, vec8Data, ptype, m_l0tag , m_bcid, hccKey, size);
213 keyRecorded = true;
214 ++ichannel;++size;
215 }
216 vec8Data.push_back(0xed);
217 vec8Data.push_back(0x6f);
218 ATH_MSG_DEBUG("Add 16-0s: " << size % 2 << " " << vec8Data.size());
219
220 if(size % 2 == 0){
221 vec8Data.push_back(0);
222 vec8Data.push_back(0);
223 }
224 uint32_t packetLenght = (vec8Data.size()-vectorSize)+4;
225 ATH_MSG_DEBUG("Packet Lenght: " << (uint32_t)packetLenght << " " << std::bitset<32>(packetLenght));
226
227 std::vector<uint8_t> pktlenght = split32bitWord(packetLenght);
228
229 ATH_MSG_DEBUG("PktLenght: " << pktlenght.size() << " vec8Data size: " << vec8Data.size());
230
231 uint32_t offset = vectorSize + 4;
232 vec8Data.insert(vec8Data.begin()+offset, pktlenght.begin(), pktlenght.end());
233 vectorSize = vec8Data.size();
234
235 ATH_MSG_DEBUG("vec8Data size: " << vec8Data.size() << " size: " << size-1);
236 }
237
238 //Update BCID and L0Tag counters
239 m_bcid = (m_bcid + 1) & 0x7F;
240 m_l0tag = (m_l0tag + 1) & 0x7F;
241
242 ATH_MSG_DEBUG("vec8Data size: " << vec8Data.size());
243
244 packFragments(vec8Data,vec32Data);
245 for(auto &word: vec32Data){
246 ATH_MSG_DEBUG("32-bit word: " << std::bitset<32>(word));
247 }
248 return;
249}
#define ATH_MSG_WARNING(x)
const SCT_ID * m_itkStripsID
Identifier helper class for the ITkStrips subdetector that creates compact Identifier objects and Ide...
uint16_t getStripMax(const SCT_RDORawData *rdo) const
Get the maxumum strip value info from the RDO.
int getBarrelEC(const SCT_RDORawData *rdo) const
Get the barrel/endcape info from the RDO.
std::atomic< uint8_t > m_l0tag
int getEtaModule(const SCT_RDORawData *rdo) const
Get the eta value info from the RDO.
int getSide(const SCT_RDORawData *rdo) const
Get the side info from the RDO.
int getStrip(const SCT_RDORawData *rdo) const
Get the strip number info from the RDO.
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.
uint8_t getPhiModule(const SCT_RDORawData *rdo) const
Get the phi value info from the RDO.
uint8_t getDiskLayer(const SCT_RDORawData *rdo) const
Get disk/layer info from the RDO.
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, uint32_t hccKey, uint16_t &size) 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.
std::atomic< uint8_t > m_bcid
Method to encode RDO data to vector of 16 bin words.
BySideTypeMod sideAC(0)
setEventNumber uint32_t

◆ getBarrelEC()

int ITkStripsRodEncoder::getBarrelEC ( const SCT_RDORawData * rdo) const
private

Get the barrel/endcape info from the RDO.

Definition at line 452 of file ITkStripsRodEncoder.cxx.

452 {
453 const Identifier rdoID{rdo->identify()};
454 return m_itkStripsID->barrel_ec(rdoID);
455}
virtual Identifier identify() const override final

◆ getBit_128b()

bool ITkStripsRodEncoder::getBit_128b ( uint8_t bit_addr,
uint64_t data_high64,
uint64_t data_low64 ) const
inlineprivate

Definition at line 335 of file ITkStripsRodEncoder.cxx.

335 {
336 if (bit_addr > 127) return false;
337
338 return bit_addr<64 ? data_low64>>bit_addr & 1 : data_high64>>(bit_addr-64) & 1;
339}

◆ getDiskLayer()

uint8_t ITkStripsRodEncoder::getDiskLayer ( const SCT_RDORawData * rdo) const
private

Get disk/layer info from the RDO.

Definition at line 458 of file ITkStripsRodEncoder.cxx.

458 {
459 const Identifier rdoID{rdo->identify()};
460 return m_itkStripsID->layer_disk(rdoID);
461}

◆ getEtaModule()

int ITkStripsRodEncoder::getEtaModule ( const SCT_RDORawData * rdo) const
private

Get the eta value info from the RDO.

Definition at line 470 of file ITkStripsRodEncoder.cxx.

470 {
471 const Identifier rdoID{rdo->identify()};
472 return m_itkStripsID->eta_module(rdoID);
473}

◆ 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 491 of file ITkStripsRodEncoder.cxx.

491 {
492 uint8_t bcid_low = bc_cout & 0x7; // BCID[2:0]
493 bool bc_parity = getParity_8bits(bc_cout);
494 //TYPE (4 bits) + FlagBit (1 bit) + L0tag (7 bits) + BCID (3 bits) + Parity (1 bit)
495 const uint16_t Header{static_cast<uint16_t>(((uint8_t)typ << 12) | (0x1 << 11) | (l0tag & 0x7f) << 4 | (bcid_low) << 1 | bc_parity)};
496 return Header;
497
498}
bool getParity_8bits(uint8_t val) const

◆ getHeaderUsingHash()

uint16_t ITkStripsRodEncoder::getHeaderUsingHash ( const IdentifierHash & linkHash,
const int & errorWord ) const
private

Get the 16-bit word for a header for a link with a ByteStream error.

Definition at line 510 of file ITkStripsRodEncoder.cxx.

510 {
511 const int rodLink{rodLinkFromOnlineID(m_cabling->getOnlineIdFromHash(linkHash))};
512 const uint16_t linkHeader{static_cast<uint16_t>(0x2000 | errorWord | (m_condensed.value() << 8) | rodLink)};
513 return linkHeader;
514}
ToolHandle< IITkStripCablingTool > m_cabling
Providing mappings of online and offline identifiers and also serial numbers.
BooleanProperty m_condensed
Example Boolean used to determine decoding mode, maybe unused finally.

◆ getHeaderUsingRDO()

uint16_t ITkStripsRodEncoder::getHeaderUsingRDO ( const SCT_RDORawData * rdo) const
private

Get the 16-bit word for a header for a hit.

Definition at line 503 of file ITkStripsRodEncoder.cxx.

503 {
504 const int rodLink{getRODLink(rdo)};
505 const uint16_t linkHeader{static_cast<uint16_t>(0x2000 | (m_condensed.value() << 8) | rodLink)};
506 return linkHeader;
507}
int getRODLink(const SCT_RDORawData *rdo) const
Get the ROD link number info in the RDO header data.

◆ getParity_8bits()

bool ITkStripsRodEncoder::getParity_8bits ( uint8_t val) const
private

Definition at line 483 of file ITkStripsRodEncoder.cxx.

483 {
484 val ^= val >> 4;
485 val ^= val >> 2;
486 val ^= val >> 1;
487 return val&1;
488}

◆ getPhiModule()

uint8_t ITkStripsRodEncoder::getPhiModule ( const SCT_RDORawData * rdo) const
private

Get the phi value info from the RDO.

Definition at line 464 of file ITkStripsRodEncoder.cxx.

464 {
465 const Identifier rdoID{rdo->identify()};
466 return m_itkStripsID->phi_module(rdoID);
467}

◆ getRODLink()

int ITkStripsRodEncoder::getRODLink ( const SCT_RDORawData * rdo) const
private

Get the ROD link number info in the RDO header data.

Definition at line 440 of file ITkStripsRodEncoder.cxx.

440 {
441 return rodLinkFromOnlineID(onlineID(rdo));
442}
uint32_t onlineID(const SCT_RDORawData *rdo) const
Get the online Identifier from the RDO.

◆ getSide()

int ITkStripsRodEncoder::getSide ( const SCT_RDORawData * rdo) const
private

Get the side info from the RDO.

Definition at line 445 of file ITkStripsRodEncoder.cxx.

445 {
446 const Identifier rdoID{rdo->identify()};
447 int itkSide{m_itkStripsID->side(rdoID)};
448 return itkSide;
449}

◆ getStrip()

int ITkStripsRodEncoder::getStrip ( const SCT_RDORawData * rdo) const
private

Get the strip number info from the RDO.

Definition at line 421 of file ITkStripsRodEncoder.cxx.

421 {
422 const Identifier rdoID{rdo->identify()};
423 return m_itkStripsID->strip(rdoID);
424}

◆ getStripMax()

uint16_t ITkStripsRodEncoder::getStripMax ( const SCT_RDORawData * rdo) const
private

Get the maxumum strip value info from the RDO.

Definition at line 476 of file ITkStripsRodEncoder.cxx.

476 {
477 const Identifier rdoID{rdo->identify()};
478 if(m_itkStripsID->strip_max(rdoID)<0) return 0xFFFF;
479 return m_itkStripsID->strip_max(rdoID);
480}

◆ getTimeBin()

int ITkStripsRodEncoder::getTimeBin ( const SCT_RDORawData * rdo) const
private

Get the time bin info from the RDO.

◆ getTrailer()

uint16_t ITkStripsRodEncoder::getTrailer ( const int & errorWord) const
private

Get the 16-bit word for a trailer, with or without ByteStream errors.

Definition at line 517 of file ITkStripsRodEncoder.cxx.

517 {
518 const uint16_t linkTrailer{static_cast<uint16_t>(0x4000 | errorWord)};
519 return linkTrailer;
520}

◆ initialize()

StatusCode ITkStripsRodEncoder::initialize ( )
overridevirtual

Initialize.

Definition at line 95 of file ITkStripsRodEncoder.cxx.

95 {
96 ATH_MSG_DEBUG("ITkStripsRodEncoder::initialize()");
97
98 // Retrieve cabling tool
99 ATH_CHECK(m_cabling.retrieve());
100 ATH_MSG_DEBUG("Retrieved tool " << m_cabling);
102 const InDetDD::SCT_DetectorManager* itkStripsDetManager{nullptr};
103 ATH_CHECK(detStore()->retrieve(itkStripsDetManager, "ITkStrip"));
104 const InDetDD::SiDetectorElementCollection* sctDetElementColl{itkStripsDetManager->getDetectorElementCollection()};
105 for (const InDetDD::SiDetectorElement* sctDetElement : *sctDetElementColl) {
106 if (sctDetElement->swapPhiReadoutDirection()) {
107 m_swapModuleID.insert(sctDetElement->identify());
108 }
109 }
110 ATH_MSG_DEBUG("Initialization was successful");
111 return StatusCode::SUCCESS;
112}
#define ATH_CHECK
Evaluate an expression and check for errors.
std::set< Identifier > m_swapModuleID
Swap Module identifier, set by SCTRawContByteStreamTool.
virtual const SiDetectorElementCollection * getDetectorElementCollection() const override
access to whole collectiom
retrieve(aClass, aKey=None)
Definition PyKernel.py:110

◆ offlineID()

Identifier ITkStripsRodEncoder::offlineID ( const SCT_RDORawData * rdo) const
private

Get the offline Identifier from the RDO.

Definition at line 427 of file ITkStripsRodEncoder.cxx.

427 {
428 const Identifier rdoId{rdo->identify()};
429 return m_itkStripsID->wafer_id(rdoId);
430}

◆ onlineID()

uint32_t ITkStripsRodEncoder::onlineID ( const SCT_RDORawData * rdo) const
private

Get the online Identifier from the RDO.

Definition at line 433 of file ITkStripsRodEncoder.cxx.

433 {
434 const Identifier waferID{offlineID(rdo)};
435 const IdentifierHash offlineIDHash{m_itkStripsID->wafer_hash(waferID)};
436 return static_cast<uint32_t>(m_cabling->getOnlineIdFromHash(offlineIDHash));
437}
Identifier offlineID(const SCT_RDORawData *rdo) const
Get the offline Identifier from the RDO.

◆ 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
vec8WordsVector containing 8 bit words.
vec32WordsVector for 32 bit words to be packed.

Definition at line 379 of file ITkStripsRodEncoder.cxx.

379 {
380 int num8Words{static_cast<int>(vec8Words.size())};
381 if (num8Words % 4 != 0) {
382 // Just add additional 8-bit words to make the size a multiple of 4
383 while (num8Words % 4 != 0) {
384 vec8Words.push_back(0x40); // Padding byte
385 num8Words++;
386 }
387 }
388 // Now merge 4 consecutive 8-bit words into 32-bit words
389 const unsigned short int numWords{4};
390 const unsigned short int position[numWords]{0, 8, 16, 24};
391 unsigned short int arr8Words[numWords]{0, 0, 0, 0};
392
393 for (int i{0}; i<num8Words; i += numWords) {
394 for (int j{0}; j<numWords; j++) {
395 arr8Words[j] = vec8Words[i + j];
396 }
397 const uint32_t uint32Word{set32Bits(arr8Words, position, numWords)};
398 vec32Words.push_back(uint32Word);
399 }
400 return;
401}
uint32_t set32Bits(const unsigned short int *arr8Words, const unsigned short int *position, const unsigned short int &numWords) const

◆ set32Bits()

uint32_t ITkStripsRodEncoder::set32Bits ( const unsigned short int * arr8Words,
const unsigned short int * position,
const unsigned short int & numWords ) const
private

Definition at line 405 of file ITkStripsRodEncoder.cxx.

406{
407 uint32_t uint32Word{0};
408 uint32_t pos{0};
409 uint32_t uint8Word{0};
410 for (uint16_t i{0}; i<numWords; i++) {
411 uint8Word = static_cast<uint32_t>(*(arr8Words + i));
412 pos = static_cast<uint32_t>(*(position + i));
413 uint32Word |= (uint8Word << pos); // Shift the 8-bit word to its correct position and merge
414 }
415 return uint32Word;
416}

◆ setBit_128b()

void ITkStripsRodEncoder::setBit_128b ( uint8_t bit_addr,
bool value,
uint64_t & data_high64,
uint64_t & data_low64 ) const
inlineprivate

Definition at line 342 of file ITkStripsRodEncoder.cxx.

342 {
343 if (bit_addr < 64) {
344 data_low64 = (data_low64 & ~(1ULL << bit_addr)) | ((uint64_t)value << bit_addr);
345 } else if (bit_addr < 128) {
346 data_high64 =
347 (data_high64 & ~(1ULL << (bit_addr-64))) | ((uint64_t)value << (bit_addr-64));
348 }
349}

Member Data Documentation

◆ 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
vecTimeBinsVector of time bins for RDOs.
vec16WordsVector of 16 bit words to filled from encoded RDO data.
rdoRDO raw data object to be encoded.
groupSizeGroup size info from the RDO.
stripStrip number info from the RDO.

Definition at line 70 of file ITkStripsRodEncoder.h.

◆ m_cabling

ToolHandle<IITkStripCablingTool> ITkStripsRodEncoder::m_cabling
private
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.

153 {this,
154 "ITkStripCablingTool",
155 "ITkStripCablingTool",
156 "Tool to retrieve ITkStrips Cabling"};

◆ 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.

163{this, "CondensedMode", false, "Condensed mode (true) or Expanded mode (false)"};

◆ m_itkStripsID

const SCT_ID* ITkStripsRodEncoder::m_itkStripsID {nullptr}
private

Identifier helper class for the ITkStrips subdetector that creates compact Identifier objects and IdentifierHash or hash IDs.

Also allows decoding of these IDs.

Definition at line 160 of file ITkStripsRodEncoder.h.

160{nullptr};

◆ m_l0tag

std::atomic<uint8_t> ITkStripsRodEncoder::m_l0tag = 0
mutableprivate

Definition at line 71 of file ITkStripsRodEncoder.h.

◆ m_swapModuleID

std::set<Identifier> ITkStripsRodEncoder::m_swapModuleID {}
private

Swap Module identifier, set by SCTRawContByteStreamTool.

Definition at line 166 of file ITkStripsRodEncoder.h.

166{};

The documentation for this class was generated from the following files: