ATLAS Offline Software
Public Member Functions | Private Member Functions | Private Attributes | List of all members
RpcByteStreamDecoder Class Reference

#include <RpcByteStreamDecoder.h>

Collaboration diagram for RpcByteStreamDecoder:

Public Member Functions

 RpcByteStreamDecoder (const RPCbytestream *p_bytestream, const RpcCablingCondData *readCdo, const RpcIdHelper *rpcId, MsgStream *log=nullptr)
 
 ~RpcByteStreamDecoder ()
 
StatusCode decodeByteStream ()
 
std::vector< RpcPad * > * getPads ()
 
void print ()
 

Private Member Functions

RpcPaddecodePad (PADreadout &pad)
 
RpcCoinMatrixdecodeMatrix (MatrixReadOut *matrix, Identifier &id)
 
RpcByteStreamDecoderoperator= (const RpcByteStreamDecoder &right)
 
 RpcByteStreamDecoder (const RpcByteStreamDecoder &)
 

Private Attributes

const RPCbytestreamm_bytestream
 
const RpcCablingCondDatam_cabling
 
const RpcIdHelperm_rpcIdHelper
 
std::vector< RpcPad * > * m_rpcpads
 
MsgStream * m_log
 
bool m_debug
 
bool m_verbose
 

Detailed Description

Definition at line 24 of file RpcByteStreamDecoder.h.

Constructor & Destructor Documentation

◆ RpcByteStreamDecoder() [1/2]

RpcByteStreamDecoder::RpcByteStreamDecoder ( const RPCbytestream p_bytestream,
const RpcCablingCondData readCdo,
const RpcIdHelper rpcId,
MsgStream *  log = nullptr 
)

Definition at line 11 of file RpcByteStreamDecoder.cxx.

12  :
13  m_bytestream(p_bytestream), m_cabling(readCdo), m_rpcIdHelper(rpcId) {
14  m_rpcpads = new std::vector<RpcPad*>;
15  m_log = log;
16  if (m_log) {
17  m_debug = m_log->level() <= MSG::DEBUG;
18  m_verbose = m_log->level() <= MSG::VERBOSE;
19  } else {
20  m_debug = false;
21  m_verbose = false;
22  }
23 }

◆ ~RpcByteStreamDecoder()

RpcByteStreamDecoder::~RpcByteStreamDecoder ( )

Definition at line 25 of file RpcByteStreamDecoder.cxx.

25  {
26  if (m_rpcpads != nullptr) {
27  delete m_rpcpads;
28  m_rpcpads = nullptr;
29  }
30 }

◆ RpcByteStreamDecoder() [2/2]

RpcByteStreamDecoder::RpcByteStreamDecoder ( const RpcByteStreamDecoder )
private

Member Function Documentation

◆ decodeByteStream()

StatusCode RpcByteStreamDecoder::decodeByteStream ( )

Definition at line 32 of file RpcByteStreamDecoder.cxx.

32  {
33  if (m_debug && m_log) *m_log << MSG::DEBUG << "Start decoding" << endmsg;
34 
35  PAD_Readout padReadout = m_bytestream->pad_readout();
36 
37  // Iterate on the readout PADS and decode them
38  for (PAD_Readout::iterator it = padReadout.begin(); it != padReadout.end(); ++it) {
39  PADreadout pad = (*it).second;
40  RpcPad* newpad = decodePad(pad);
41 
42  // Push back the decoded pad in the vector
43  m_rpcpads->push_back(newpad);
44  }
45 
46  if (m_debug && m_log) *m_log << MSG::DEBUG << "Number of decoded Pads : " << m_rpcpads->size() << endmsg;
47 
48  return StatusCode::SUCCESS;
49 }

◆ decodeMatrix()

RpcCoinMatrix * RpcByteStreamDecoder::decodeMatrix ( MatrixReadOut matrix,
Identifier id 
)
private

Definition at line 129 of file RpcByteStreamDecoder.cxx.

129  {
130  if (m_debug && m_log) *m_log << MSG::DEBUG << "Decoding a new RpcCoinMatrix" << endmsg;
131 
132  // Matrix Header and SubHeader
133  MatrixReadOutStructure matrix_header = matrix->getHeader();
134  MatrixReadOutStructure matrix_subheader = matrix->getSubHeader();
135  MatrixReadOutStructure matrix_footer = matrix->getFooter();
136  // Check the data structure
137  // cppcheck-suppress assertWithSideEffect
138  assert(matrix_header.isHeader());
139  // cppcheck-suppress assertWithSideEffect
140  assert(matrix_subheader.isSubHeader());
141  // cppcheck-suppress assertWithSideEffect
142  assert(matrix_footer.isFooter());
143 
144  // Create the coincidence matrix
145  RpcCoinMatrix* coinMatrix =
146  new RpcCoinMatrix(id, matrix_header.cmid(), matrix_footer.crc(), matrix_header.fel1id(), matrix_subheader.febcid());
147 
148  // Iterate on fired channels and decode them
149  MatrixReadOutStructure cm_hit;
150  for (int j = 0; j < matrix->numberOfBodyWords(); ++j) {
151  cm_hit = matrix->getCMAHit(j);
152  // cppcheck-suppress assertWithSideEffect
153  assert(cm_hit.isBody());
154  RpcFiredChannel* firedChannel = nullptr;
155 
156  if (cm_hit.ijk() < rpcRawHitWordLength) {
157  firedChannel = new RpcFiredChannel(cm_hit.bcid(), cm_hit.time(), cm_hit.ijk(), cm_hit.channel());
158  } else if (cm_hit.ijk() == rpcRawHitWordLength) {
159  firedChannel = new RpcFiredChannel(cm_hit.bcid(), cm_hit.time(), cm_hit.ijk(), cm_hit.threshold(), cm_hit.overlap());
160  }
161 
162  coinMatrix->push_back(firedChannel);
163  }
164 
165  if (m_debug && m_log) *m_log << MSG::DEBUG << "Number of Fired Channels in Matrix : " << coinMatrix->size() << endmsg;
166  return coinMatrix;
167 }

◆ decodePad()

RpcPad * RpcByteStreamDecoder::decodePad ( PADreadout pad)
private

Definition at line 52 of file RpcByteStreamDecoder.cxx.

52  {
53  if (m_debug && m_log) *m_log << MSG::DEBUG << "Decoding a new RpcPad" << endmsg;
54 
55  // Identifier elements
56  int name = 0;
57  int eta = 0;
58  int phi = 0;
59  int doublet_r = 0;
60  int doublet_z = 0;
61  int doublet_phi = 0;
62  int gas_gap = 0;
63  int measures_phi = 0;
64  int strip = 0;
65 
66  PadReadOut* readout = pad.give_pad_readout();
67 
68  // Retrieve PAD sector and PAD ID
69  int sector = pad.sector();
70  int pad_id = pad.PAD();
71  // Compute side and logic sector
72  int side = (sector < 32) ? 0 : 1;
73  int logic_sector = sector % 32;
74  // Compute the key to retrieve the offline id from the map (as from LVL1 sim.)
75  int key = side * 10000 + logic_sector * 100 + pad_id;
76 
77  if (m_debug && m_log) *m_log << MSG::DEBUG << "Pad: Side " << side << " Sector logic" << logic_sector << " Id " << pad_id << endmsg;
78 
79  // Retrieve the identifier elements from the map
81  RDOindex index = (*pad_map.find(key)).second;
82 
83  index.offline_indexes(name, eta, phi, doublet_r, doublet_z, doublet_phi, gas_gap, measures_phi, strip);
84 
85  // Build the pad offline identifier
86  bool valid{false};
87  Identifier id = m_rpcIdHelper->padID(name, eta, phi, doublet_r, doublet_z, doublet_phi, valid);
88 
89  if (m_log && !valid) {
90  *m_log << MSG::ERROR << "Invalid pad offline indices " << endmsg;
91  *m_log << MSG::ERROR << "Name : " << name << endmsg;
92  *m_log << MSG::ERROR << "Eta " << eta << " Phi " << phi << endmsg;
93  *m_log << MSG::ERROR << "Doublet r " << doublet_r << " Doublet_z " << doublet_z << " Doublet_phi " << doublet_phi << endmsg;
94  *m_log << MSG::ERROR << "Gas gap " << gas_gap << " Measures_phi " << measures_phi << " Strip " << strip << endmsg;
95  }
96 
97  // Retrieve Pad status and error code from Pad header and footer
98  PadReadOutStructure pad_header = readout->getHeader();
99  PadReadOutStructure pad_footer = readout->getFooter();
100  // Check the data format
101  // cppcheck-suppress assertWithSideEffect
102  assert(pad_header.isHeader());
103  // cppcheck-suppress assertWithSideEffect
104  assert(pad_footer.isFooter());
105 
106  unsigned int hashId = index.hash();
107  unsigned int onlineId = pad_id;
108  // unsigned int status = pad_header.status();
109  unsigned int status = 0;
110  unsigned int errorCode = pad_footer.errorCode();
111 
112  // Construct the new Pad
113  RpcPad* rpc_pad = new RpcPad(id, hashId, onlineId, status, errorCode, sector);
114 
115  // Iterate on the matrices and decode them
116  for (int i = 0; i < readout->numberOfCMROFragments(); ++i) {
118  RpcCoinMatrix* coinMatrix = decodeMatrix(matrix, id);
119  // Add the matrix to the pad
120  rpc_pad->push_back(coinMatrix);
121  }
122 
123  if (m_debug && m_log) *m_log << MSG::DEBUG << "Number of matrices in Pad : " << rpc_pad->size() << endmsg;
124 
125  return rpc_pad;
126 }

◆ getPads()

std::vector<RpcPad*>* RpcByteStreamDecoder::getPads ( )
inline

Definition at line 35 of file RpcByteStreamDecoder.h.

35 { return m_rpcpads; };

◆ operator=()

RpcByteStreamDecoder& RpcByteStreamDecoder::operator= ( const RpcByteStreamDecoder right)
private

◆ print()

void RpcByteStreamDecoder::print ( )

Definition at line 170 of file RpcByteStreamDecoder.cxx.

170  {
171  std::cout << "Printing out RPC RDO's : " << std::endl;
172  std::cout << "Number of Pads in event : " << m_rpcpads->size() << std::endl;
173  std::vector<RpcPad*>::const_iterator pad_it;
174  int ipad = 1;
175  // Iterate on pads
176  for (pad_it = m_rpcpads->begin(); pad_it != m_rpcpads->end(); ++pad_it, ++ipad) {
177  std::cout << "Pad number " << ipad << " Identifier : " << std::endl;
178  (*pad_it)->identify().show();
179  std::cout << std::endl;
180  std::cout << "Number of Matrices in Pad : " << (*pad_it)->size() << std::endl;
181  // Iterate on the pad's coincidence matrices
182  RpcPad::const_iterator mat_it;
183  int imat = 1;
184  for (mat_it = (*pad_it)->begin(); mat_it != (*pad_it)->end(); ++mat_it, ++imat) {
185  std::cout << "Matrix number " << imat << std::endl;
186  std::cout << "Number of fired channels: " << (*mat_it)->size() << std::endl;
188  int ichan = 1;
189  // Printout the fired channels
190  for (chan_it = (*mat_it)->begin(); chan_it != (*mat_it)->end(); ++chan_it, ++ichan) {
191  std::cout << "Fired Channel " << ichan << " :: bcid " << (*chan_it)->bcid() << " ijk " << (*chan_it)->ijk()
192  << " channel " << (*chan_it)->channel() << std::endl;
193  }
194  }
195  }
196 }

Member Data Documentation

◆ m_bytestream

const RPCbytestream* RpcByteStreamDecoder::m_bytestream
private

Definition at line 46 of file RpcByteStreamDecoder.h.

◆ m_cabling

const RpcCablingCondData* RpcByteStreamDecoder::m_cabling
private

Definition at line 47 of file RpcByteStreamDecoder.h.

◆ m_debug

bool RpcByteStreamDecoder::m_debug
private

Definition at line 52 of file RpcByteStreamDecoder.h.

◆ m_log

MsgStream* RpcByteStreamDecoder::m_log
private

Definition at line 51 of file RpcByteStreamDecoder.h.

◆ m_rpcIdHelper

const RpcIdHelper* RpcByteStreamDecoder::m_rpcIdHelper
private

Definition at line 48 of file RpcByteStreamDecoder.h.

◆ m_rpcpads

std::vector<RpcPad*>* RpcByteStreamDecoder::m_rpcpads
private

Definition at line 49 of file RpcByteStreamDecoder.h.

◆ m_verbose

bool RpcByteStreamDecoder::m_verbose
private

Definition at line 53 of file RpcByteStreamDecoder.h.


The documentation for this class was generated from the following files:
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
python.SystemOfUnits.second
int second
Definition: SystemOfUnits.py:120
PadReadOutStructure::errorCode
ubit16 errorCode() const
Definition: PadReadOutStructure.h:34
MatrixReadOutStructure::febcid
ubit16 febcid()
Definition: MatrixReadOutStructure.h:32
DataModel_detail::const_iterator
Const iterator class for DataVector/DataList.
Definition: DVLIterator.h:82
MatrixReadOutStructure::channel
ubit16 channel()
Definition: MatrixReadOutStructure.h:36
MatrixReadOutStructure::ijk
ubit16 ijk()
Definition: MatrixReadOutStructure.h:35
SiliconTech::strip
@ strip
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:64
MatrixReadOutStructure::isBody
bool isBody()
Definition: MatrixReadOutStructure.cxx:180
PadReadOutStructure
Definition: PadReadOutStructure.h:13
MatrixReadOutStructure::crc
ubit16 crc()
Definition: MatrixReadOutStructure.h:40
RpcByteStreamDecoder::decodeMatrix
RpcCoinMatrix * decodeMatrix(MatrixReadOut *matrix, Identifier &id)
Definition: RpcByteStreamDecoder.cxx:129
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:79
index
Definition: index.py:1
RpcPad
Athena::TPCnvVers::Old Athena::TPCnvVers::Current Athena::TPCnvVers::Old Athena::TPCnvVers::Current Athena::TPCnvVers::Old Athena::TPCnvVers::Current Athena::TPCnvVers::Current Athena::TPCnvVers::Current RpcPad
Definition: MuonEventAthenaPoolTPCnv.cxx:146
skel.it
it
Definition: skel.GENtoEVGEN.py:423
RpcByteStreamDecoder::m_bytestream
const RPCbytestream * m_bytestream
Definition: RpcByteStreamDecoder.h:46
MatrixReadOutStructure::isHeader
bool isHeader()
Definition: MatrixReadOutStructure.cxx:166
MatrixReadOutStructure::overlap
ubit16 overlap()
Definition: MatrixReadOutStructure.h:38
MatrixReadOutStructure::fel1id
ubit16 fel1id()
Definition: MatrixReadOutStructure.h:31
MatrixReadOutStructure::cmid
ubit16 cmid()
Definition: MatrixReadOutStructure.h:30
RpcIdHelper::padID
Identifier padID(const Identifier &elementID, int doubletZ, int doubletPhi) const
Definition: RpcIdHelper.cxx:1043
PADreadout
Definition: PADreadout.h:20
PadReadOut::getFooter
PadReadOutStructure getFooter()
Definition: PadReadOut.cxx:204
RpcCoinMatrix
Definition: RpcCoinMatrix.h:20
RPCbytestream::pad_readout
PAD_Readout pad_readout(void) const
Definition: RPCbytestream.h:64
RpcFiredChannel
Definition: RpcFiredChannel.h:20
TRT::Hit::side
@ side
Definition: HitInfo.h:83
PadReadOut
Definition: PadReadOut.h:15
MatrixReadOut
Definition: MatrixReadOut.h:18
calibdata.valid
list valid
Definition: calibdata.py:45
lumiFormat.i
int i
Definition: lumiFormat.py:92
Identifier
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:32
PADreadout::PAD
int PAD(void) const
Definition: PADreadout.h:41
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
RpcByteStreamDecoder::m_debug
bool m_debug
Definition: RpcByteStreamDecoder.h:52
MatrixReadOutStructure::isFooter
bool isFooter()
Definition: MatrixReadOutStructure.cxx:187
PadReadOutStructure::isHeader
bool isHeader()
Definition: PadReadOutStructure.cxx:166
PADreadout::sector
int sector(void) const
Definition: PADreadout.h:40
RpcCablingCondData::RDOmap
std::map< int, RDOindex, std::less< int > > RDOmap
Definition: RpcCablingCondData.h:25
RpcByteStreamDecoder::m_cabling
const RpcCablingCondData * m_cabling
Definition: RpcByteStreamDecoder.h:47
RpcByteStreamDecoder::m_verbose
bool m_verbose
Definition: RpcByteStreamDecoder.h:53
PADreadout::matrices_readout
MatrixReadOut * matrices_readout(int) const
Definition: PADreadout.cxx:77
RpcByteStreamDecoder::m_rpcIdHelper
const RpcIdHelper * m_rpcIdHelper
Definition: RpcByteStreamDecoder.h:48
defineDB.ichan
int ichan
Definition: JetTagCalibration/share/defineDB.py:28
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
PAD_Readout
std::map< int, PADreadout, std::less< int > > PAD_Readout
Definition: RpcByteStreamDecoder.h:22
MatrixReadOutStructure
Definition: MatrixReadOutStructure.h:13
DataVector::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
RpcPad
Definition: RpcPad.h:21
MatrixReadOutStructure::isSubHeader
bool isSubHeader()
Definition: MatrixReadOutStructure.cxx:173
MatrixReadOutStructure::time
ubit16 time()
Definition: MatrixReadOutStructure.h:34
python.testIfMatch.matrix
matrix
Definition: testIfMatch.py:66
RpcCoinMatrix
Athena::TPCnvVers::Old Athena::TPCnvVers::Current Athena::TPCnvVers::Old Athena::TPCnvVers::Current Athena::TPCnvVers::Old Athena::TPCnvVers::Current Athena::TPCnvVers::Current RpcCoinMatrix
Definition: MuonEventAthenaPoolTPCnv.cxx:134
RpcByteStreamDecoder::decodePad
RpcPad * decodePad(PADreadout &pad)
Definition: RpcByteStreamDecoder.cxx:52
PadReadOut::numberOfCMROFragments
ubit16 numberOfCMROFragments()
Definition: PadReadOut.h:30
DEBUG
#define DEBUG
Definition: page_access.h:11
PadReadOut::getHeader
PadReadOutStructure getHeader()
Definition: PadReadOut.cxx:199
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
RpcByteStreamDecoder::m_log
MsgStream * m_log
Definition: RpcByteStreamDecoder.h:51
MatrixReadOutStructure::threshold
ubit16 threshold()
Definition: MatrixReadOutStructure.h:37
merge.status
status
Definition: merge.py:17
python.Constants.VERBOSE
int VERBOSE
Definition: Control/AthenaCommon/python/Constants.py:14
PadReadOutStructure::isFooter
bool isFooter()
Definition: PadReadOutStructure.cxx:190
RpcByteStreamDecoder::m_rpcpads
std::vector< RpcPad * > * m_rpcpads
Definition: RpcByteStreamDecoder.h:49
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
MatrixReadOutStructure::bcid
ubit16 bcid()
Definition: MatrixReadOutStructure.h:33
PADreadout::give_pad_readout
PadReadOut * give_pad_readout(void)
Definition: PADreadout.cxx:87
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37
RDOindex
Definition: RDOindex.h:85
RpcCablingCondData::give_RDOs
const RDOmap & give_RDOs(void) const
Definition: RpcCablingCondData.cxx:10