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

#include <ITkStripsRodDecoder.h>

Inheritance diagram for ITkStripsRodDecoder:
Collaboration diagram for ITkStripsRodDecoder:

Classes

struct  CacheHelper
 Temp object to help with trigger caching. More...
struct  SharedData
 Struct to hold data shared in methods used in fillCollection method. More...

Public Member Functions

virtual ~ITkStripsRodDecoder ()=default
 Destructor.
virtual StatusCode initialize () override
 Initialize.
virtual StatusCode fillCollection (const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment &robFrag, SCT_RDO_Container &rdoIDCont, IDCInDetBSErrContainer &errs, DataPool< SCT3_RawData > *dataItemsPool, const EventContext &ctx, const std::vector< IdentifierHash > *vecHash=nullptr) const override
 Fill SCT RDO Collection with decoded ROB data.

Private Types

enum  ITk_DecoderNumbers { N_SIDES = 2 , N_CHIPS_PER_SIDE = 6 , N_STRIPS_PER_CHIP = 128 , N_STRIPS_PER_SIDE = N_CHIPS_PER_SIDE*N_STRIPS_PER_CHIP }
 Define frequently used magic numbers. More...

Private Member Functions

int makeRDO (const bool isOld, SharedData &data, CacheHelper &cache, DataPool< SCT3_RawData > *dataItemsPool) const
 Builds RawData RDO and adds to RDO container.
StatusCode addRODError (uint32_t rodID, SCT_ByteStreamErrors::ErrorType error, SCT_RodDecoderErrorsHelper &errs, const std::unordered_set< IdentifierHash > *foundHashes=nullptr) const
 Add an error for each wafer in the problematic ROD.
StatusCode addSingleError (const IdentifierHash &hashID, SCT_ByteStreamErrors::ErrorType error, SCT_RodDecoderErrorsHelper &errs) const
 Add single eror.
StatusCode processHeader (const uint16_t inData, const uint32_t robID, SharedData &data, SCT_RDO_Container &rdoIDCont, DataPool< SCT3_RawData > *dataItemsPool, CacheHelper &cache, SCT_RodDecoderErrorsHelper &errs, bool &hasError, bool &breakNow, const EventContext &ctx) const
 Process header word.
StatusCode processHccHeader (const uint16_t inData, const uint8_t data8, uint8_t &isHCCHeader, const uint32_t robID, SharedData &data, SCT_RDO_Container &rdoIDCont, DataPool< SCT3_RawData > *dataItemsPool, CacheHelper &cache, SCT_RodDecoderErrorsHelper &errs, bool &hasError, bool &breakNow, const EventContext &ctx) const
 Process header word.
StatusCode processHits (const uint16_t inData, const uint32_t robID, SharedData &data, SCT_RDO_Container &rdoIDCont, DataPool< SCT3_RawData > *dataItemsPool, CacheHelper &cache, SCT_RodDecoderErrorsHelper &errs, bool &hasError, const EventContext &ctx) const
 Process raw data word.

Private Attributes

const SCT_IDm_itkStripsID {nullptr}
 Identifier helper class for the SCT subdetector that creates compact Identifier objects and IdentifierHash or hash IDs.
IdContext m_contextITk
 "Context" of an expanded identifier (ExpandedIdentifier) for compact or hash versions (Identifier32 or IdentifierHash)
ToolHandle< IITkStripCablingToolm_cabling
 Providing mappings of online and offline identifiers and also serial numbers.
ToolHandle< ISCT_ConfigurationConditionsToolm_configTool
 Service that keeps track of configuration conditions.
std::atomic_uint m_singleCondHitNumber {0}
 Total number of single strips with hit decoded in condensed mode.
std::atomic_uint m_pairedCondHitNumber {0}
 Total number of paired strips with hit decoded in condensed mode.
std::atomic_uint m_firstExpHitNumber {0}
 Total number of first strips with hit decoded in expanded mode.
std::atomic_uint m_evenExpHitNumber {0}
 Total number of consecutive paired strips with hit decoded in expanded mode.
std::atomic_uint m_lastExpHitNumber {0}
 Total number of last consecutive strips with hit decoded in expanded mode.
std::atomic_uint m_headNumber {0}
 Total number of decoded header data.
std::atomic_uint m_trailerNumber {0}
 Total number of decoded trailer data.
std::atomic_uint m_headErrorBCID {0}
 Total number of BCID errors in the header data.
std::atomic_uint m_headErrorLvl1ID {0}
 Total number of Lvl1ID errors in the header data.
std::atomic_uint m_headErrorTimeout {0}
 Total number of timeout errors in the header data.
std::atomic_uint m_headErrorFormatter {0}
 Total number of formatter errors in the header data.
std::atomic_uint m_headErrorPreamble {0}
 Total number of preamble errors in the header data.
std::atomic_uint m_trailerErrorOverflow {0}
 Total number of overflow errors in the trailer data.
std::atomic_uint m_trailerErrorLimit {0}
 Total number of header trailer limit errors in the trailer data.
std::atomic_uint m_trailerErrorBit {0}
 Total number of trailer bit errors.
std::atomic_uint m_configDataBit {0}
 Total number of configuration data for raw data.
std::atomic_uint m_flagErrorBit {0}
 Total number of flag error data.
std::atomic_uint m_condHit1Error {0}
 Total number of first hit data errors.
std::atomic_uint m_condHit2Error {0}
 Total number second hit data errors.
std::atomic_uint m_chipNumberError {0}
 Total number of chip number errors.
std::atomic_uint m_unknownDataFormat {0}
 Total number of unknown data formats.
std::atomic_uint m_nHits {0}
 Total number of SCT hits in ByteStream.
std::atomic_uint m_nRDOs {0}
 Total number of SCT RDOs created.
std::atomic_uint m_maskedLinkNumber {0}
 Total number of masked links in the header data.
std::atomic_uint m_maskedRODNumber {0}
 Total number of masked RDOs.
std::atomic_uint m_rodClockErrorNumber {0}
 Total number of ROD clock errors.
std::atomic_uint m_truncatedRODNumber {0}
 Total number of truncated ROBFragments.
std::atomic_uint m_numMissingLinkHeader {0}
 Total number of missing link headers.
std::vector< bool > m_swapPhiReadoutDirection {}
 Swap phi readout direction.

Detailed Description

Definition at line 73 of file ITkStripsRodDecoder.h.

Member Enumeration Documentation

◆ ITk_DecoderNumbers

Define frequently used magic numbers.

Enumerator
N_SIDES 
N_CHIPS_PER_SIDE 
N_STRIPS_PER_CHIP 
N_STRIPS_PER_SIDE 

Definition at line 115 of file ITkStripsRodDecoder.h.

Constructor & Destructor Documentation

◆ ~ITkStripsRodDecoder()

virtual ITkStripsRodDecoder::~ITkStripsRodDecoder ( )
virtualdefault

Destructor.

Member Function Documentation

◆ addRODError()

StatusCode ITkStripsRodDecoder::addRODError ( uint32_t rodID,
SCT_ByteStreamErrors::ErrorType error,
SCT_RodDecoderErrorsHelper & errs,
const std::unordered_set< IdentifierHash > * foundHashes = nullptr ) const
private

Add an error for each wafer in the problematic ROD.

Parameters
rodIDIdentifer of ROD.
errorTypeError type info.
errsByte stream error container.
foundHashesFE-links whose headers are found. Used only for MissingLinkHeaderError.

Definition at line 256 of file ITkStripsRodDecoder.cxx.

259{
260 return StatusCode::SUCCESS;
261}

◆ addSingleError()

StatusCode ITkStripsRodDecoder::addSingleError ( const IdentifierHash & hashID,
SCT_ByteStreamErrors::ErrorType error,
SCT_RodDecoderErrorsHelper & errs ) const
private

Add single eror.

Parameters
hashIDIdentifier for hash.
bsErrorTypeByte Stream error type info.
errsByte stream error container.

Definition at line 265 of file ITkStripsRodDecoder.cxx.

268{
269 return StatusCode::SUCCESS;
270}

◆ fillCollection()

StatusCode ITkStripsRodDecoder::fillCollection ( const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment & robFrag,
SCT_RDO_Container & rdoIDCont,
IDCInDetBSErrContainer & errs,
DataPool< SCT3_RawData > * dataItemsPool,
const EventContext & ctx,
const std::vector< IdentifierHash > * vecHash = nullptr ) const
overridevirtual

Fill SCT RDO Collection with decoded ROB data.

Decode the rob data fragment and fill the collection SCT_RDO_Collection with the RDO built by the makeRDO(..) method. rdoIdc, and errs are updated based on robFrag and vecHash.

Parameters
robFragROB fragment.
rdoIDContRDO ID Container to be filled.
errsByte stream error container.
vecHashVector of hashes.

Definition at line 43 of file ITkStripsRodDecoder.cxx.

49{
50 SCT_RodDecoderErrorsHelper errs = errorsIDC; // on destruction will fill the IDC
51
52 const uint32_t robID=robFrag.rod_source_id();
53
54 StatusCode sc = StatusCode::SUCCESS;
55
57 data.reset();
58
59 CacheHelper cache; // For the trigger
60 cache.vecHash = vecHash;
61
63 const unsigned long int vecROBDataSize{robFrag.rod_ndata()};
64 if (vecROBDataSize > robFrag.payload_size_word()) {
65 ATH_MSG_WARNING("The ROB data does not seem to fit in the payload. Rejecting fragment (ndata size " << vecROBDataSize << " !< payload size " << robFrag.payload_size_word()
66 << " header size: " << robFrag.rod_header_size_word()
67 << " trailer size: " << robFrag.rod_trailer_size_word()
68 << " fragment size: " << robFrag.rod_fragment_size_word()
69 << ")");
70 return StatusCode::RECOVERABLE;
71 }
72 robFrag.rod_data(vecROBData);
73
74 ATH_MSG_DEBUG("vecROBDataSize: " << vecROBDataSize);
75
76 // Loop over header, hit element, flagged ABCD error, raw data, trailer words
77 for (uint32_t i=0; i<vecROBDataSize; i++) {
78 // The data is 16-bits wide packed to a 32-bit word (rob_it1). So we unpack it here.
79 ATH_MSG_DEBUG("ROB: "<< std::bitset<32>(vecROBData[i]));
80 }
81
82 const uint8_t* vecROBData_8bits = reinterpret_cast<const uint8_t*>(vecROBData);
83 const size_t total_bytes = vecROBDataSize * sizeof(uint32_t);
84
85 uint32_t nclusters = 0;
86 uint8_t isHCCHeader = 0;
87 int nPacket = 0;
88 uint16_t hccword1 = 0;
89 uint8_t word8 = 0;
90 uint8_t HccHeadFound = 0;
91 uint16_t packetSize = 0;
92 bool noClusterTag = false;
93
94 for (size_t i=0; i < total_bytes; i+=2) {
95 //Read Header
96 bool hasError = false;
97 bool breakNow = false;
98 uint16_t psize=packetSize/4;
99 uint16_t word16 = (vecROBData_8bits[i] << 8) | vecROBData_8bits[i + 1];
100 ATH_MSG_DEBUG(" 16-bit word: " << std::bitset<16>(word16) << " " << (uint32_t)i << " " << total_bytes );
101
102 if(i==total_bytes-2) ATH_MSG_DEBUG("nClusters found (this): " << (uint32_t)nclusters);
103
104 ATH_MSG_DEBUG("Check: " << nPacket << " Packets: " << packetSize/4 << " isHCCHeader: " << (uint32_t)isHCCHeader << " " << nPacket);
105
106 if(psize != 0 && nPacket != 0){
107 ATH_MSG_DEBUG("check: " << (nPacket+1) % (packetSize/2));
108 if((nPacket+1) % (packetSize/2)==0) nPacket=-1;
109 }
110
111 if(word16 == 0 && noClusterTag){
112 ATH_MSG_DEBUG("Skip empty end of packet 16-bit word: ");
113 nPacket++;
114 }else if((vecROBData_8bits[i] == 0 || isHCCHeader == 1) && HccHeadFound == 0 && nPacket<2){
115 //HCC header found
116 ATH_MSG_DEBUG("HCC header found, will decode the next three 8-bit words: " <<(uint32_t)isHCCHeader);
117 if(isHCCHeader == 0){
118 hccword1 = (vecROBData_8bits[i + 1] << 8) | vecROBData_8bits[i+2];
119 ATH_MSG_DEBUG("HCC header: "<<std::bitset<16>(hccword1));
120 } else if(isHCCHeader == 1){
121 word8 = vecROBData_8bits[i + 1];
122 ATH_MSG_DEBUG("HCC header: "<<std::bitset<8>(word8));
123 }
124 ATH_CHECK(processHccHeader(hccword1, word8, isHCCHeader, robID, data, rdoIDCont, dataItemsPool, cache, errs, hasError, breakNow,ctx));
125 if(isHCCHeader==0) HccHeadFound = 1;
126 nPacket++;
127 noClusterTag=false;
128 }else if((HccHeadFound==1 && vecROBData_8bits[i] == 0) || HccHeadFound==2){
129 if(HccHeadFound==1) HccHeadFound=2;
130 else if(HccHeadFound==2){
131 packetSize = word16;
132 ATH_MSG_DEBUG("Packet size is: " << packetSize );
133 HccHeadFound=0;
134 }
135 nPacket++;
136 }else if(((vecROBData_8bits[i] & 0xF8) == 0x18) && (((nPacket+1) % (packetSize/2)) == 5)){
137 nPacket++;
138 ATH_MSG_DEBUG("Header found: " << std::bitset<16>(word16));
139 nclusters=0;
140 ATH_CHECK(processHeader(word16, robID, data, rdoIDCont, dataItemsPool, cache, errs, hasError, breakNow,ctx));
141 }else{
142 nPacket++;
143 if(word16 == 0xed6f){
144 ATH_MSG_DEBUG("No more clusters found");
145 noClusterTag=true;
146 continue;
147 }else{
148 nclusters+=1;
149 ATH_CHECK(processHits(word16, robID, data, rdoIDCont, dataItemsPool, cache, errs, hasError, ctx));
150 }
151 }
152 }
153
154 // Create the last RDO of the last link of the event
155 if (data.isStripValid()) {
156 if (not data.isSaved(false) and data.isOldStripValid()) {
157 const int rdoMade{makeRDO(false, data, cache, dataItemsPool)};
158 if (rdoMade == -1) {
159 sc = StatusCode::RECOVERABLE;
160 ATH_CHECK(addSingleError(data.linkIDHash, SCT_ByteStreamErrors::ByteStreamParseError, errs));
161 }
162 else {
163 data.setSaved(false, rdoMade);
164 }
165 }
166 }
167
168 for (auto& [hash, rdoColl] : data.rdoCollMap) {
169 if (rdoColl==nullptr) continue; // nullptr means the collection is already filled.
170
171 if (rdoColl->empty()) { // Empty collection is not filled.
172 rdoColl.reset();
173 errs.removeIfEmpty(hash); // To get the same result as before. Not sure whether we need this.
174 continue;
175 }
176
177 ATH_CHECK(data.writeHandleMap[hash].addOrDelete(std::move(rdoColl)));
178 }
179
180 if (sc.isFailure()) ATH_MSG_DEBUG("One or more ByteStream errors found ");
181 return sc;
182}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
char data[hepevt_bytes_allocation_ATLAS]
Definition HepEvt.cxx:11
StatusCode addSingleError(const IdentifierHash &hashID, SCT_ByteStreamErrors::ErrorType error, SCT_RodDecoderErrorsHelper &errs) const
Add single eror.
int makeRDO(const bool isOld, SharedData &data, CacheHelper &cache, DataPool< SCT3_RawData > *dataItemsPool) const
Builds RawData RDO and adds to RDO container.
StatusCode processHeader(const uint16_t inData, const uint32_t robID, SharedData &data, SCT_RDO_Container &rdoIDCont, DataPool< SCT3_RawData > *dataItemsPool, CacheHelper &cache, SCT_RodDecoderErrorsHelper &errs, bool &hasError, bool &breakNow, const EventContext &ctx) const
Process header word.
StatusCode processHits(const uint16_t inData, const uint32_t robID, SharedData &data, SCT_RDO_Container &rdoIDCont, DataPool< SCT3_RawData > *dataItemsPool, CacheHelper &cache, SCT_RodDecoderErrorsHelper &errs, bool &hasError, const EventContext &ctx) const
Process raw data word.
StatusCode processHccHeader(const uint16_t inData, const uint8_t data8, uint8_t &isHCCHeader, const uint32_t robID, SharedData &data, SCT_RDO_Container &rdoIDCont, DataPool< SCT3_RawData > *dataItemsPool, CacheHelper &cache, SCT_RodDecoderErrorsHelper &errs, bool &hasError, bool &breakNow, const EventContext &ctx) const
Process header word.
void removeIfEmpty(const IdentifierHash id)
::StatusCode StatusCode
StatusCode definition for legacy code.
const DataType * PointerType
Definition RawEvent.h:25
setWord1 uint16_t
setEventNumber uint32_t
Temp object to help with trigger caching.
const std::vector< IdentifierHash > * vecHash
Struct to hold data shared in methods used in fillCollection method.

◆ initialize()

StatusCode ITkStripsRodDecoder::initialize ( )
overridevirtual

Initialize.

Definition at line 20 of file ITkStripsRodDecoder.cxx.

21{
22
23 // Retrieve cabling tool
24 ATH_CHECK(m_cabling.retrieve());
25 ATH_MSG_DEBUG("Retrieved tool " << m_cabling);
27 m_contextITk = m_itkStripsID->wafer_context();
28 m_swapPhiReadoutDirection.resize(m_itkStripsID->wafer_hash_max(), false);
29 ATH_CHECK(m_configTool.retrieve());
30 const InDetDD::SCT_DetectorManager* itkStripsDetManager{nullptr};
31 ATH_CHECK(detStore()->retrieve(itkStripsDetManager, "ITkStrip"));
32 const InDetDD::SiDetectorElementCollection* sctDetElementColl{itkStripsDetManager->getDetectorElementCollection()};
33 for (const InDetDD::SiDetectorElement* element: *sctDetElementColl) {
34 if (element->swapPhiReadoutDirection()) {
35 m_swapPhiReadoutDirection[element->identifyHash()] = true;
36 }
37 }
38 ATH_MSG_DEBUG("Initialization was successful");
39 return StatusCode::SUCCESS;
40}
ToolHandle< IITkStripCablingTool > m_cabling
Providing mappings of online and offline identifiers and also serial numbers.
const SCT_ID * m_itkStripsID
Identifier helper class for the SCT subdetector that creates compact Identifier objects and Identifie...
ToolHandle< ISCT_ConfigurationConditionsTool > m_configTool
Service that keeps track of configuration conditions.
IdContext m_contextITk
"Context" of an expanded identifier (ExpandedIdentifier) for compact or hash versions (Identifier32 o...
std::vector< bool > m_swapPhiReadoutDirection
Swap phi readout direction.
virtual const SiDetectorElementCollection * getDetectorElementCollection() const override
access to whole collectiom
retrieve(aClass, aKey=None)
Definition PyKernel.py:110

◆ makeRDO()

int ITkStripsRodDecoder::makeRDO ( const bool isOld,
SharedData & data,
CacheHelper & cache,
DataPool< SCT3_RawData > * dataItemsPool ) const
private

Builds RawData RDO and adds to RDO container.

Method that builds the RawData RDO and add it to the collection rdoIdc and cache are updated based on other arguments.

Returns
Method has 3 possible return values: 1 if RDO was successfully created 0 if collection was deliberately skipped (for trigger) -1 if there was an error in the decoding - will be passed on as StatusCode::RECOVERABLE by fillCollection()
Parameters
isOldif true use data.oldStrip, otherwise use data.strip.
dataStruct to hold data shared in methods used in fillCollection method
cacheCache.

Definition at line 186 of file ITkStripsRodDecoder.cxx.

190{
191 // If the link is already decoded, RDO will not be created.
192 SCT_RDO_Collection* rdoColl{data.rdoCollMap[data.linkIDHash].get()};
193 if (rdoColl==nullptr) return 0;
194
195 int strip{isOld ? data.oldStrip : data.strip};
196 if (((strip & 0x7F) + (data.groupSize-1) >= N_STRIPS_PER_CHIP) or (strip<0) or (strip>=N_STRIPS_PER_SIDE)) {
197 ATH_MSG_WARNING("Cluster with " << data.groupSize << " strips, starting at strip " << strip
198 << " in collection " << data.linkIDHash << " out of range. Will not make RDO");
199 return -1;
200 }
201
202 // This option is for the trigger, if there is a vecHash* given, test it!
203 if (cache.vecHash) {
204 if (data.linkIDHash == cache.skipHash) {
205 ATH_MSG_VERBOSE("Collection for Hash not to be decoded, skip");
206 return 0;
207 }
208 else if (data.linkIDHash != cache.lastHash) {
209 cache.lastHash = data.linkIDHash;
210 // Maybe the new hash is not in the list, so test it
211 std::vector<IdentifierHash>::const_iterator hashIDIterator{find(cache.vecHash->begin(),
212 cache.vecHash->end(),
213 data.linkIDHash)};
214 if (hashIDIterator == cache.vecHash->end()) {
215 ATH_MSG_VERBOSE("Collection for Hash not to be decoded, skip");
216 // Remember this one, so that we do not find(...) forever
217 cache.skipHash = data.linkIDHash;
218 return 0;
219 }
220 }
221 }
222
223 // See if strips go from 0 to N_STRIPS_PER_SIDE-1(=767) or vice versa
224 if (m_swapPhiReadoutDirection[data.linkIDHash]) {
226 strip = strip-(data.groupSize-1);
227 }
228
229 // Get identifier from the hash, this is not nice
230 const Identifier digitID{m_itkStripsID->strip_id(data.collID, strip)};
231 if (not m_itkStripsID->is_sct(digitID)) {
232 ATH_MSG_WARNING("Cluster with invalid Identifier. Will not make RDO");
233 return -1;
234 }
235
236 const unsigned int rawDataWord{static_cast<unsigned int>(data.groupSize | (strip << 11) | (data.timeBin <<22) | (data.errors << 25))};
237
238 ATH_MSG_DEBUG("Output Raw Data " << std::hex << " Coll " << data.collID.getString()
239 << ":-> " << m_itkStripsID->print_to_string(digitID) << std::dec);
240
241 // Now the Collection is there for sure. Create RDO and push it into Collection.
242 m_nRDOs++;
243
244 if(dataItemsPool){
245 SCT3_RawData* sct_rdo = dataItemsPool->nextElementPtr();
246 (*sct_rdo) = SCT3_RawData(digitID, rawDataWord, &(data.errorHit));
247 rdoColl->push_back(sct_rdo);
248 }else{
249 rdoColl->push_back(std::make_unique<SCT3_RawData>(digitID, rawDataWord, &(data.errorHit)));
250 }
251 return 1;
252}
#define ATH_MSG_VERBOSE(x)
InDetRawDataCollection< SCT_RDORawData > SCT_RDO_Collection
pointer nextElementPtr()
obtain the next available element in pool by pointer pool is resized if its limit has been reached On...
value_type push_back(value_type pElem)
std::atomic_uint m_nRDOs
Total number of SCT RDOs created.
std::string find(const std::string &s)
return a remapped string
Definition hcg.cxx:138

◆ processHccHeader()

StatusCode ITkStripsRodDecoder::processHccHeader ( const uint16_t inData,
const uint8_t data8,
uint8_t & isHCCHeader,
const uint32_t robID,
SharedData & data,
SCT_RDO_Container & rdoIDCont,
DataPool< SCT3_RawData > * dataItemsPool,
CacheHelper & cache,
SCT_RodDecoderErrorsHelper & errs,
bool & hasError,
bool & breakNow,
const EventContext & ctx ) const
private

Process header word.

Parameters
inDatainput 16 bit data word for header
robIDROB ID
dataStruct to hold data shared in methods used in fillCollection method
rdoIDContRDO ID Container to be filled.
cacheCache.
errsSCT_RodDecoderErrorsHelper to fill IDCInDetBSErrContainer
hasErrorfalse means no error, true means at least one error
breakNowto tell if need to break after this method execution.

Definition at line 273 of file ITkStripsRodDecoder.cxx.

285{
286
287 StatusCode sc{StatusCode::SUCCESS};
288
289 if(isHCCHeader == 1){
290 isHCCHeader = 0;
291 ATH_MSG_DEBUG("Decoding HCC bits");
292 /*24 bits in total
293 bits from 24-8 are in hccword1
294 Last 8bits are in word8
295 */
296 uint8_t barrel = ((hccword1 >> 8) & 0x80);
297 ATH_MSG_DEBUG("is barrel: " << std::bitset<16>(hccword1 >> 8) << " " << std::bitset<8>(barrel));
298 uint8_t side = ((hccword1 >> 5) & 0x80);
299 ATH_MSG_DEBUG("side : " << std::bitset<16>(hccword1 >> 5) << " " << std::bitset<8>(side));
300 uint8_t disk = ((hccword1 >> 9) & 0x7);
301 ATH_MSG_DEBUG("disk : " << std::bitset<16>((hccword1 >> 9) & 0x7) << " " << std::bitset<8>(disk));
302 uint8_t inout = ((hccword1 >> 8) & 0x1);
303 ATH_MSG_DEBUG("inout : " << std::bitset<16>((hccword1 >> 8) & 0x1) << " " << std::bitset<8>(inout));
304 uint8_t petal = ((hccword1 >> 7) & 0x1);
305 ATH_MSG_DEBUG("petal : " << std::bitset<16>((hccword1 >> 7) & 0x1) << " " << std::bitset<8>(petal));
306 uint8_t phimod = hccword1 & 0x7F;
307 ATH_MSG_DEBUG("phimod : " << std::bitset<16>(hccword1 & 0x7F) << " " << std::bitset<8>(phimod));
308 uint8_t hccnum = word8 & 0x80;
309 ATH_MSG_DEBUG("hccnum : " << std::bitset<16>(word8 & 0x80) << " " << std::bitset<8>(hccnum));
310 uint8_t etamod = word8 & 0x3F;
311 ATH_MSG_DEBUG("etamod : " << std::bitset<16>(word8 & 0x3F) << " " << std::bitset<8>(etamod));
312
313 bool isbarrel = (barrel != 0x0);
314 bool issideA = (side != 0x0);
315 bool isinout = (inout == 0x1);
316 bool ispetal = (petal == 0x1);
317 uint8_t hccN = (hccnum == 0x80) ? 2 : 1;
318
319
320 ATH_MSG_DEBUG("isBarrel: " << isbarrel << " isSideA: " << issideA << " disk: " << (uint32_t)disk);
321 ATH_MSG_DEBUG("isInOut: " << isinout << " isPetal: " << ispetal << " phimod: " << (uint32_t)phimod);
322 ATH_MSG_DEBUG("HCCNum: " << (uint32_t)hccN << " etamod: " << (uint32_t)etamod);
323
324 ATH_MSG_DEBUG("hccheader " << isbarrel << " " << issideA << " " << (uint32_t)disk << " " << (uint32_t)inout << " " << (uint32_t)phimod << " " << (uint32_t)etamod << " " << (uint32_t)hccN );
325 }
326 else isHCCHeader++;
327
328 return sc;
329}
phimod(flags, cells_name, *args, **kw)
etamod(flags, cells_name, *args, **kw)

◆ processHeader()

StatusCode ITkStripsRodDecoder::processHeader ( const uint16_t inData,
const uint32_t robID,
SharedData & data,
SCT_RDO_Container & rdoIDCont,
DataPool< SCT3_RawData > * dataItemsPool,
CacheHelper & cache,
SCT_RodDecoderErrorsHelper & errs,
bool & hasError,
bool & breakNow,
const EventContext & ctx ) const
private

Process header word.

Parameters
inDatainput 16 bit data word for header
robIDROB ID
dataStruct to hold data shared in methods used in fillCollection method
rdoIDContRDO ID Container to be filled.
cacheCache.
errsSCT_RodDecoderErrorsHelper to fill IDCInDetBSErrContainer
hasErrorfalse means no error, true means at least one error
breakNowto tell if need to break after this method execution.

Definition at line 332 of file ITkStripsRodDecoder.cxx.

342{
343 StatusCode sc = StatusCode::SUCCESS;
344
345 data.foundHeader = true;
346 m_headNumber++;
347
348 uint8_t type = (word16 >> 11) & 0x1F;
349 // Useful information
350 uint8_t l0tag = (word16 >> 7) & 0xF;
351 uint8_t bcid_low = (word16 >> 4) & 0x7;
352 uint8_t bcid_xor = word16 & 0xF;
353
354 ATH_MSG_DEBUG("l0tag: " << (uint32_t)l0tag << " bcid_low: " << (uint32_t)bcid_low << " bcid_xor: " << (uint32_t)bcid_xor << " type: " << (uint32_t)type << " word16: " << std::bitset<16>(word16));
355
356 if (type == 0x03) { // PR Header
357 bool breakNow{false};
358 ATH_MSG_DEBUG("PR Packet Found");
359 if (hasError) sc = StatusCode::RECOVERABLE;
360 if (breakNow) return sc;
361 } else {
362 ATH_MSG_WARNING("Unexpected packet type (not PR): 0x" << std::hex << int(type));
363 return sc;
364 }
365
366 // Create the last RDO of the previous link if any
367 if (data.isStripValid()) {
368 if (not data.isSaved(false) and data.isOldStripValid()) {
369
370 const int rdoMade{makeRDO(false, data, cache, dataItemsPool)};
371 if (rdoMade == -1) {
372 hasError = true;
373 ATH_CHECK(addSingleError(data.linkIDHash, SCT_ByteStreamErrors::ByteStreamParseError, errs));
374 }
375 else {
376 data.setSaved(false, rdoMade);
377 }
378 }
379 }
380
381 // Everything is set to default for a new hunt of RDO
382 data.reset();
383
384 // Link Number (or stream) in the ROD fragment
385 const int rodlinkNumber{static_cast<int>(word16 & 0x7F)};
386
387 // This is the real calculation for the offline
388 data.linkNumber = (((rodlinkNumber >>4)&0x7)*12+(rodlinkNumber &0xF));
389 const uint32_t onlineID{(robID & 0xFFFFFF) | (data.linkNumber << 24)};
390 ATH_MSG_DEBUG("OnlineID: " << (uint32_t)onlineID << " Link number: " << data.linkNumber);
391 IdentifierHash hash;
392 if ((onlineID ==0) or (data.linkNumber > 95)) {
393 ATH_CHECK(addSingleError(data.linkIDHash, SCT_ByteStreamErrors::ByteStreamParseError, errs));
394 hasError = true;
395 ATH_MSG_DEBUG("Header: xxx Link number out of range (skipping following data)"
396 << std::dec << data.linkNumber);
397 breakNow = true;
398 return sc;
399 }
400 else {
401 hash = m_cabling->getHashFromOnlineId(onlineID, ctx);
402 if (hash.is_valid()) {
403 ATH_MSG_DEBUG("setCollectionCall");
404 data.setCollection(m_itkStripsID, hash, rdoIDCont, dataItemsPool, errs);
405 }
406 else {
407 std::stringstream msg;
408 msg <<std::hex << onlineID;
409 ATH_MSG_WARNING("Rob fragment (rob=" << robID << ") with invalid onlineID " << msg.str() << " -> " << hash << ".");
410 }
411 }
412 if (!hasError and not hash.is_valid()) {
413 std::stringstream msg;
414 msg <<std::hex << onlineID;
415 ATH_MSG_WARNING("Rob fragment (rob=" << robID << ") with invalid onlineID " << msg.str() << " -> " << hash << ".");
416 hasError = true;
417 }
418
419 data.condensedMode = static_cast<bool>(word16 & 0x100);
420
421 return sc;
422}
std::atomic_uint m_headNumber
Total number of decoded header data.
MsgStream & msg
Definition testRead.cxx:32

◆ processHits()

StatusCode ITkStripsRodDecoder::processHits ( const uint16_t inData,
const uint32_t robID,
SharedData & data,
SCT_RDO_Container & rdoIDCont,
DataPool< SCT3_RawData > * dataItemsPool,
CacheHelper & cache,
SCT_RodDecoderErrorsHelper & errs,
bool & hasError,
const EventContext & ctx ) const
private

Process raw data word.

Parameters
inDatainput 16 bit data word for header
robIDROB ID
dataStruct to hold data shared in methods used in fillCollection method
errsSCT_RodDecoderErrorsHelper to fill IDCInDetBSErrContainer
hasErrorfalse means no error, true means at least one error

Definition at line 424 of file ITkStripsRodDecoder.cxx.

433{
434 StatusCode sc = StatusCode::SUCCESS;
435
436 uint8_t stripNumber = 0;
437 uint8_t address = (word16 >> 3) & 0xFF;
438
439 ATH_MSG_DEBUG("Cluster address: " << std::bitset<8>(address) << " " << (uint32_t)address);
440
441 stripNumber = (address >= 128) ? 2*(address-128)+1 : 2*address;
442
443 //Get the next three strips in the cluster
444 uint8_t firsthit = (word16 & 0x4);
445 uint8_t secondhit = (word16 & 0x2);
446 uint8_t thirdhit = (word16 & 0x1);
447 ATH_MSG_DEBUG("First hit: " << std::bitset<16>(firsthit));
448 ATH_MSG_DEBUG("Second hit: " << std::bitset<16>(secondhit));
449 ATH_MSG_DEBUG("Third hit: " << std::bitset<16>(thirdhit));
450 uint8_t stripN1 = 0,stripN2 = 0,stripN3=0;
451 uint8_t addr = 0;
452 if(firsthit != 0x0) {
453 addr = address+1;
454 stripN1 = (addr >= 128) ? 2*(addr-128)+1 : 2*addr;
455 ATH_MSG_DEBUG("Hits: " << (uint32_t)(stripN1));
456 }
457 if(secondhit != 0x0) {
458 addr = address+2;
459 stripN2 = (addr >= 128) ? 2*(addr-128)+1 : 2*addr;
460 ATH_MSG_DEBUG("Hits: " << (uint32_t)(stripN2));
461 }
462 if(thirdhit != 0x0) {
463 addr = address+3;
464 stripN3 = (addr >= 128) ? 2*(addr-128)+1 : 2*addr;
465 ATH_MSG_DEBUG("Hits: " << (uint32_t)(stripN3));
466 }
467
468 uint8_t nchip = (word16 >> 11) & 0xF;
469
470 ATH_MSG_DEBUG("Chip number: " << (int)nchip << " Strip Number: " << (uint32_t)stripNumber);
471 ATH_MSG_DEBUG("abcclusters " << (uint32_t)nchip << " " << (uint32_t)stripNumber << " " << (uint32_t)(stripN1) << " " << (uint32_t)(stripN2) << " " << (uint32_t)(stripN3));
472
473 return sc;
474}

Member Data Documentation

◆ m_cabling

ToolHandle<IITkStripCablingTool> ITkStripsRodDecoder::m_cabling
private
Initial value:
{this,
"ITkStripCablingTool",
"ITkStripCablingTool",
"Tool to retrieve ITkStrip Cabling"}

Providing mappings of online and offline identifiers and also serial numbers.

Definition at line 346 of file ITkStripsRodDecoder.h.

346 {this,
347 "ITkStripCablingTool",
348 "ITkStripCablingTool",
349 "Tool to retrieve ITkStrip Cabling"};

◆ m_chipNumberError

std::atomic_uint ITkStripsRodDecoder::m_chipNumberError {0}
mutableprivate

Total number of chip number errors.

Definition at line 415 of file ITkStripsRodDecoder.h.

415{0};

◆ m_condHit1Error

std::atomic_uint ITkStripsRodDecoder::m_condHit1Error {0}
mutableprivate

Total number of first hit data errors.

Definition at line 409 of file ITkStripsRodDecoder.h.

409{0};

◆ m_condHit2Error

std::atomic_uint ITkStripsRodDecoder::m_condHit2Error {0}
mutableprivate

Total number second hit data errors.

Definition at line 412 of file ITkStripsRodDecoder.h.

412{0};

◆ m_configDataBit

std::atomic_uint ITkStripsRodDecoder::m_configDataBit {0}
mutableprivate

Total number of configuration data for raw data.

Definition at line 403 of file ITkStripsRodDecoder.h.

403{0};

◆ m_configTool

ToolHandle<ISCT_ConfigurationConditionsTool> ITkStripsRodDecoder::m_configTool
private
Initial value:
{this,
"ConfigTool",
"SCT_ConfigurationConditionsTool/InDetSCT_ConfigurationConditionsTool",
"Tool to retrieve SCT Configuration Tool"}

Service that keeps track of configuration conditions.

Definition at line 352 of file ITkStripsRodDecoder.h.

352 {this,
353 "ConfigTool",
354 "SCT_ConfigurationConditionsTool/InDetSCT_ConfigurationConditionsTool",
355 "Tool to retrieve SCT Configuration Tool"};

◆ m_contextITk

IdContext ITkStripsRodDecoder::m_contextITk
private

"Context" of an expanded identifier (ExpandedIdentifier) for compact or hash versions (Identifier32 or IdentifierHash)

Definition at line 343 of file ITkStripsRodDecoder.h.

◆ m_evenExpHitNumber

std::atomic_uint ITkStripsRodDecoder::m_evenExpHitNumber {0}
mutableprivate

Total number of consecutive paired strips with hit decoded in expanded mode.

Definition at line 367 of file ITkStripsRodDecoder.h.

367{0};

◆ m_firstExpHitNumber

std::atomic_uint ITkStripsRodDecoder::m_firstExpHitNumber {0}
mutableprivate

Total number of first strips with hit decoded in expanded mode.

Definition at line 364 of file ITkStripsRodDecoder.h.

364{0};

◆ m_flagErrorBit

std::atomic_uint ITkStripsRodDecoder::m_flagErrorBit {0}
mutableprivate

Total number of flag error data.

Definition at line 406 of file ITkStripsRodDecoder.h.

406{0};

◆ m_headErrorBCID

std::atomic_uint ITkStripsRodDecoder::m_headErrorBCID {0}
mutableprivate

Total number of BCID errors in the header data.

Definition at line 379 of file ITkStripsRodDecoder.h.

379{0};

◆ m_headErrorFormatter

std::atomic_uint ITkStripsRodDecoder::m_headErrorFormatter {0}
mutableprivate

Total number of formatter errors in the header data.

Definition at line 388 of file ITkStripsRodDecoder.h.

388{0};

◆ m_headErrorLvl1ID

std::atomic_uint ITkStripsRodDecoder::m_headErrorLvl1ID {0}
mutableprivate

Total number of Lvl1ID errors in the header data.

Definition at line 382 of file ITkStripsRodDecoder.h.

382{0};

◆ m_headErrorPreamble

std::atomic_uint ITkStripsRodDecoder::m_headErrorPreamble {0}
mutableprivate

Total number of preamble errors in the header data.

Definition at line 391 of file ITkStripsRodDecoder.h.

391{0};

◆ m_headErrorTimeout

std::atomic_uint ITkStripsRodDecoder::m_headErrorTimeout {0}
mutableprivate

Total number of timeout errors in the header data.

Definition at line 385 of file ITkStripsRodDecoder.h.

385{0};

◆ m_headNumber

std::atomic_uint ITkStripsRodDecoder::m_headNumber {0}
mutableprivate

Total number of decoded header data.

Definition at line 373 of file ITkStripsRodDecoder.h.

373{0};

◆ m_itkStripsID

const SCT_ID* ITkStripsRodDecoder::m_itkStripsID {nullptr}
private

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

Also allows decoding of these IDs.

Definition at line 339 of file ITkStripsRodDecoder.h.

339{nullptr};

◆ m_lastExpHitNumber

std::atomic_uint ITkStripsRodDecoder::m_lastExpHitNumber {0}
mutableprivate

Total number of last consecutive strips with hit decoded in expanded mode.

Definition at line 370 of file ITkStripsRodDecoder.h.

370{0};

◆ m_maskedLinkNumber

std::atomic_uint ITkStripsRodDecoder::m_maskedLinkNumber {0}
mutableprivate

Total number of masked links in the header data.

Definition at line 427 of file ITkStripsRodDecoder.h.

427{0};

◆ m_maskedRODNumber

std::atomic_uint ITkStripsRodDecoder::m_maskedRODNumber {0}
mutableprivate

Total number of masked RDOs.

Definition at line 430 of file ITkStripsRodDecoder.h.

430{0};

◆ m_nHits

std::atomic_uint ITkStripsRodDecoder::m_nHits {0}
mutableprivate

Total number of SCT hits in ByteStream.

Definition at line 421 of file ITkStripsRodDecoder.h.

421{0};

◆ m_nRDOs

std::atomic_uint ITkStripsRodDecoder::m_nRDOs {0}
mutableprivate

Total number of SCT RDOs created.

Definition at line 424 of file ITkStripsRodDecoder.h.

424{0};

◆ m_numMissingLinkHeader

std::atomic_uint ITkStripsRodDecoder::m_numMissingLinkHeader {0}
mutableprivate

Total number of missing link headers.

Definition at line 439 of file ITkStripsRodDecoder.h.

439{0};

◆ m_pairedCondHitNumber

std::atomic_uint ITkStripsRodDecoder::m_pairedCondHitNumber {0}
mutableprivate

Total number of paired strips with hit decoded in condensed mode.

Definition at line 361 of file ITkStripsRodDecoder.h.

361{0};

◆ m_rodClockErrorNumber

std::atomic_uint ITkStripsRodDecoder::m_rodClockErrorNumber {0}
mutableprivate

Total number of ROD clock errors.

Definition at line 433 of file ITkStripsRodDecoder.h.

433{0};

◆ m_singleCondHitNumber

std::atomic_uint ITkStripsRodDecoder::m_singleCondHitNumber {0}
mutableprivate

Total number of single strips with hit decoded in condensed mode.

Definition at line 358 of file ITkStripsRodDecoder.h.

358{0};

◆ m_swapPhiReadoutDirection

std::vector<bool> ITkStripsRodDecoder::m_swapPhiReadoutDirection {}
private

Swap phi readout direction.

Definition at line 442 of file ITkStripsRodDecoder.h.

442{};

◆ m_trailerErrorBit

std::atomic_uint ITkStripsRodDecoder::m_trailerErrorBit {0}
mutableprivate

Total number of trailer bit errors.

Definition at line 400 of file ITkStripsRodDecoder.h.

400{0};

◆ m_trailerErrorLimit

std::atomic_uint ITkStripsRodDecoder::m_trailerErrorLimit {0}
mutableprivate

Total number of header trailer limit errors in the trailer data.

Definition at line 397 of file ITkStripsRodDecoder.h.

397{0};

◆ m_trailerErrorOverflow

std::atomic_uint ITkStripsRodDecoder::m_trailerErrorOverflow {0}
mutableprivate

Total number of overflow errors in the trailer data.

Definition at line 394 of file ITkStripsRodDecoder.h.

394{0};

◆ m_trailerNumber

std::atomic_uint ITkStripsRodDecoder::m_trailerNumber {0}
mutableprivate

Total number of decoded trailer data.

Definition at line 376 of file ITkStripsRodDecoder.h.

376{0};

◆ m_truncatedRODNumber

std::atomic_uint ITkStripsRodDecoder::m_truncatedRODNumber {0}
mutableprivate

Total number of truncated ROBFragments.

Definition at line 436 of file ITkStripsRodDecoder.h.

436{0};

◆ m_unknownDataFormat

std::atomic_uint ITkStripsRodDecoder::m_unknownDataFormat {0}
mutableprivate

Total number of unknown data formats.

Definition at line 418 of file ITkStripsRodDecoder.h.

418{0};

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