ATLAS Offline Software
RpcByteStreamEncoder.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "RpcByteStreamEncoder.h"
6 
8  m_padContainer(padContainer), m_byteStream(), m_byteStreamWord(0), m_highest(true) {}
9 
11 
13  StatusCode sc;
14  // Iterate on the pads and add them to the bytestream
16  for (pad_it = m_padContainer->begin(); pad_it != m_padContainer->end(); ++pad_it) {
17  const RpcPad* newpad = (*pad_it);
18  addPad(newpad);
19  sc = StatusCode::SUCCESS;
20  }
21  return sc;
22 }
23 
25 
27  // Add the pad header
29  ubit16 inputData[3] = {0, pad->onlineId(), pad->status()};
30  ubit16 padHeader = pros.makeHeader(inputData);
31  addWord(padHeader);
32 
33  // Iterate on the matrices and add them to the bytestream
35  for (cma_it = pad->begin(); cma_it != pad->end(); ++cma_it) {
36  const RpcCoinMatrix* newcma = (*cma_it);
37  addMatrix(newcma);
38  }
39  // Add the pad footer
40  ubit16 errorCode = pad->errorCode();
41  ubit16 padFooter = pros.makeFooter(errorCode);
42  addWord(padFooter);
43 }
44 
47  ubit16 dataWord;
48 
49  // Add the matrix header
50  ubit16 inputData[3] = {0, matrix->onlineId(), matrix->fel1Id()};
51  dataWord = mros.makeHeader(inputData);
52  addWord(dataWord);
53 
54  // Add the matrix subheader
55  dataWord = mros.makeSubHeader();
56  addWord(dataWord);
57 
58  // Matrix Body
60  for (chan_it = matrix->begin(); chan_it != matrix->end(); ++chan_it) {
61  const RpcFiredChannel* newchan = (*chan_it);
62  addFiredChannel(newchan);
63  }
64  // Add the matrix footer
65  dataWord = mros.makeFooter(matrix->crc());
66  addWord(dataWord);
67 }
68 
71  ubit16 dataWord;
72  ubit16 inputData[5];
73 
74  // Add the fired channel
75  inputData[0] = 0;
76  inputData[1] = firedChannel->bcid();
77  inputData[2] = firedChannel->time();
78  inputData[3] = firedChannel->ijk();
79  inputData[4] = firedChannel->channel();
80 
81  dataWord = mros.makeBody(inputData);
82  addWord(dataWord);
83 }
84 
86  unsigned int dataWord32 = (unsigned int)dataWord;
87  if (m_highest) {
88  m_byteStreamWord = (dataWord32 << 16);
89  m_highest = false;
90  } else {
91  m_byteStreamWord = m_byteStreamWord | dataWord32;
92  m_byteStream->push_back(m_byteStreamWord);
93  m_byteStreamWord = 0;
94  m_highest = true;
95  }
96 }
MatrixReadOutStructure::makeBody
ubit16 makeBody(ubit16 *inputData)
Definition: MatrixReadOutStructure.cxx:83
RpcByteStreamEncoder::m_highest
bool m_highest
Definition: RpcByteStreamEncoder.h:49
RpcFiredChannel::ijk
ubit16 ijk() const
Definition: RpcFiredChannel.h:56
RpcFiredChannel::time
ubit16 time() const
Definition: RpcFiredChannel.h:54
DataModel_detail::const_iterator
Const iterator class for DataVector/DataList.
Definition: DVLIterator.h:82
MatrixReadOutStructure::makeSubHeader
ubit16 makeSubHeader()
Definition: MatrixReadOutStructure.cxx:76
PadReadOutStructure::makeHeader
ubit16 makeHeader(ubit16 *inputData)
Definition: PadReadOutStructure.cxx:74
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
RpcFiredChannel::channel
ubit16 channel() const
Definition: RpcFiredChannel.h:58
PadReadOutStructure
Definition: PadReadOutStructure.h:13
RpcByteStreamEncoder::m_byteStreamWord
unsigned int m_byteStreamWord
Definition: RpcByteStreamEncoder.h:48
RpcByteStreamEncoder::addPad
void addPad(const RpcPad *pad)
Definition: RpcByteStreamEncoder.cxx:26
RpcByteStreamEncoder::RpcByteStreamEncoder
RpcByteStreamEncoder(const RpcPadContainer *padContainer)
Definition: RpcByteStreamEncoder.cxx:7
RpcByteStreamEncoder::addRx
void addRx()
Definition: RpcByteStreamEncoder.cxx:24
RpcPad::status
ubit16 status() const
Definition: RpcPad.h:105
RpcCoinMatrix
Definition: RpcCoinMatrix.h:20
RpcFiredChannel
Definition: RpcFiredChannel.h:20
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
RpcByteStreamEncoder::addWord
void addWord(ubit16 dataWord)
Definition: RpcByteStreamEncoder.cxx:85
RpcByteStreamEncoder::encodeByteStream
StatusCode encodeByteStream()
Definition: RpcByteStreamEncoder.cxx:12
RpcPad::errorCode
ubit16 errorCode() const
Definition: RpcPad.h:106
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
PadReadOutStructure::makeFooter
ubit16 makeFooter(ubit16 errorCode)
Definition: PadReadOutStructure.h:25
MatrixReadOutStructure::makeFooter
ubit16 makeFooter(ubit16 inputData)
Definition: MatrixReadOutStructure.cxx:100
RpcByteStreamEncoder::m_padContainer
const RpcPadContainer * m_padContainer
Definition: RpcByteStreamEncoder.h:46
IdentifiableContainerMT::end
const_iterator end() const
return const_iterator for end of container
Definition: IdentifiableContainerMT.h:242
IdentifiableContainerMT::const_iterator
Definition: IdentifiableContainerMT.h:82
IdentifiableContainerMT::begin
const_iterator begin() const
return const_iterator for first entry
Definition: IdentifiableContainerMT.h:236
RpcPad::onlineId
ubit16 onlineId() const
Definition: RpcPad.h:107
RpcByteStreamEncoder::addFiredChannel
void addFiredChannel(const RpcFiredChannel *firedChannel)
Definition: RpcByteStreamEncoder.cxx:69
RpcByteStreamEncoder::~RpcByteStreamEncoder
~RpcByteStreamEncoder()
MatrixReadOutStructure::makeHeader
ubit16 makeHeader(ubit16 *inputData)
Definition: MatrixReadOutStructure.cxx:68
MatrixReadOutStructure
Definition: MatrixReadOutStructure.h:13
RpcPad
Definition: RpcPad.h:21
DataVector::end
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
RpcByteStreamEncoder.h
RpcFiredChannel::bcid
ubit16 bcid() const
Definition: RpcFiredChannel.h:52
python.testIfMatch.matrix
matrix
Definition: testIfMatch.py:66
RpcByteStreamEncoder::m_byteStream
RpcByteStream * m_byteStream
Definition: RpcByteStreamEncoder.h:47
RpcByteStreamEncoder::addMatrix
void addMatrix(const RpcCoinMatrix *matrix)
Definition: RpcByteStreamEncoder.cxx:45
ubit16
unsigned short int ubit16
Definition: RpcByteStreamEncoder.h:20
DataVector::begin
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
RpcPadContainer
Use IdentifiableContainer with RpcPad.
Definition: RpcPadContainer.h:23