ATLAS Offline Software
Loading...
Searching...
No Matches
ITkStripsRodEncoder.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef ITkStripsRawDataByteStreamCnv_ITkStripsRodEncoder_h
6#define ITkStripsRawDataByteStreamCnv_ITkStripsRodEncoder_h
7
10
12#include "GaudiKernel/ToolHandle.h"
13
15
16#include <set>
17#include <atomic>
18
19class SCT_ID;
20class SCT_RDORawData;
21class Identifier;
22class IdentifierHash;
23
31class
32ITkStripsRodEncoder : public extends<AthAlgTool, IITkStripsRodEncoder>{
33 public:
34
35 using base_class::base_class;
36
38 virtual ~ITkStripsRodEncoder() = default;
39
41 virtual StatusCode initialize() override;
42
54 virtual void fillROD(std::vector<uint32_t>& vec32Data, const uint32_t& robID,
55 const std::vector<const SCT_RDORawData*>& vecRDOs) const override;
56
57
58 private:
59
71
72 mutable std::atomic<uint8_t> m_bcid = 0;
73 mutable std::atomic<uint8_t> m_l0tag = 0;
74
75 bool isNear(const int& eta_mod, bool isBarrel = false) const{
76 if (isBarrel){
77 int pos = std::abs(eta_mod) % 4;
78 return (pos == 2 || pos == 3);
79 }else{
80 int pos = std::abs(eta_mod) % 4;
81 if (eta_mod >= 10) pos = (eta_mod + 2) % 4;
82 if (eta_mod >= 16) pos = (eta_mod + 4) % 4;
83 return (pos == 1 || pos == 2);
84 }
85 }
86
87 void encodeData(const std::vector<uint16_t>& clusters, const uint16_t ichannel, std::vector<uint8_t>& data_encode,
88 int typ, uint8_t l0tag, uint8_t bc_count, uint32_t hccKey, uint16_t& size) const;
89
98 void packFragments(std::vector<uint8_t>& vec8Words, std::vector<uint32_t>& vec32Words) const;
99
109
110 std::vector<uint16_t> clusterFinder(const std::bitset<256>& inputData, const uint8_t maxCluster=63) const;
111 uint16_t clusterFinder_sub(uint64_t& hits_high64, uint64_t& hits_low64, bool isSecondRow) const;
112
113 uint32_t set32Bits(const unsigned short int* arr8Words,
114 const unsigned short int* position,
115 const unsigned short int& numWords) const;
116
117 bool getBit_128b(uint8_t bit_addr, uint64_t data_high64, uint64_t data_low64) const;
118 void setBit_128b(uint8_t bit_addr, bool value, uint64_t& data_high64, uint64_t& data_low64) const;
119 bool getParity_8bits(uint8_t val) const;
120
122 int getBarrelEC(const SCT_RDORawData* rdo) const;
123
125 uint8_t getDiskLayer(const SCT_RDORawData* rdo) const;
126
128 uint8_t getPhiModule(const SCT_RDORawData* rdo) const;
129
131 int getEtaModule(const SCT_RDORawData* rdo) const;
132
134 uint16_t getStripMax(const SCT_RDORawData* rdo) const;
135
137 int getSide(const SCT_RDORawData* rdo) const;
138
140 int getTimeBin(const SCT_RDORawData* rdo) const;
141
143 int getStrip(const SCT_RDORawData* rdo) const;
144
146 Identifier offlineID(const SCT_RDORawData* rdo) const;
147
149 uint32_t onlineID(const SCT_RDORawData* rdo, const EventContext& ctx) const;
150
152 int getRODLink(const SCT_RDORawData* rdo, const EventContext& ctx) const;
153
155 uint16_t getHeaderPhysicsPacket(int typ, uint8_t l0tag, uint8_t bc_count) const;
156
158 uint16_t getHeaderUsingRDO(const SCT_RDORawData* rdo, const EventContext& ctx) const;
159
161 uint16_t getHeaderUsingHash(const IdentifierHash& linkHash, const int& errorWord, const EventContext& ctx) const;
162
164 uint16_t getTrailer(const int& errorWord) const;
165
167 ToolHandle<IITkStripCablingTool> m_cabling{this,
168 "ITkStripCablingTool",
169 "ITkStripCablingTool",
170 "Tool to retrieve ITkStrips Cabling"};
171
172 ToolHandle<ITkStripDataRateMonTool> m_dataRateMonTool{this, "DataRateMonitoringTool", "", "Monitoring tool for data rate evaluation"};
173
176 const SCT_ID* m_itkStripsID{nullptr};
177
179 BooleanProperty m_condensed{this, "CondensedMode", false, "Condensed mode (true) or Expanded mode (false)"};
180
182 std::set<Identifier> m_swapModuleID{};
183};
184
185#endif // ITKSTRIP_RAWDATABYTESTREAMCNV_ITKSTRIP_RODENCODER_H
size_t size() const
Number of registered mappings.
Athena Algorithm Tool that provides conversion from ITkStrips RDO to ROD format Bytestream.
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.
ToolHandle< IITkStripCablingTool > m_cabling
Providing mappings of online and offline identifiers and also serial numbers.
Identifier offlineID(const SCT_RDORawData *rdo) const
Get the offline Identifier from the RDO.
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.
BooleanProperty m_condensed
Example Boolean used to determine decoding mode, maybe unused finally.
int getBarrelEC(const SCT_RDORawData *rdo) const
Get the barrel/endcape info from the RDO.
virtual void fillROD(std::vector< uint32_t > &vec32Data, const uint32_t &robID, const std::vector< const SCT_RDORawData * > &vecRDOs) const override
Main Convert method.
void setBit_128b(uint8_t bit_addr, bool value, uint64_t &data_high64, uint64_t &data_low64) const
uint16_t clusterFinder_sub(uint64_t &hits_high64, uint64_t &hits_low64, bool isSecondRow) const
uint16_t getHeaderUsingRDO(const SCT_RDORawData *rdo, const EventContext &ctx) const
Get the 16-bit word for a header for a hit.
bool getBit_128b(uint8_t bit_addr, uint64_t data_high64, uint64_t data_low64) const
uint16_t getHeaderUsingHash(const IdentifierHash &linkHash, const int &errorWord, const EventContext &ctx) const
Get the 16-bit word for a header for a link with a ByteStream error.
std::atomic< uint8_t > m_l0tag
int getEtaModule(const SCT_RDORawData *rdo) const
Get the eta value info from the RDO.
uint16_t getTrailer(const int &errorWord) const
Get the 16-bit word for a trailer, with or without ByteStream errors.
int getSide(const SCT_RDORawData *rdo) const
Get the side info from the RDO.
virtual ~ITkStripsRodEncoder()=default
Destructor.
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.
uint32_t set32Bits(const unsigned short int *arr8Words, const unsigned short int *position, const unsigned short int &numWords) const
int getTimeBin(const SCT_RDORawData *rdo) const
Get the time bin 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
ToolHandle< ITkStripDataRateMonTool > m_dataRateMonTool
virtual StatusCode initialize() override
Initialize.
std::set< Identifier > m_swapModuleID
Swap Module identifier, set by SCTRawContByteStreamTool.
bool isNear(const int &eta_mod, bool isBarrel=false) const
uint32_t onlineID(const SCT_RDORawData *rdo, const EventContext &ctx) const
Get the online Identifier from the RDO.
int getRODLink(const SCT_RDORawData *rdo, const EventContext &ctx) const
Get the ROD link number info in the RDO header data.
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.
bool getParity_8bits(uint8_t val) const
std::atomic< uint8_t > m_bcid
Method to encode RDO data to vector of 16 bin words.
This is a "hash" representation of an Identifier.
This is an Identifier helper class for the SCT subdetector.
Definition SCT_ID.h:68