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

This class provides conversion from BS to ROD format. More...

#include <RpcROD_Encoder.h>

Collaboration diagram for RpcROD_Encoder:

Public Member Functions

 RpcROD_Encoder ()
 constructor More...
 
 ~RpcROD_Encoder ()
 destructor More...
 
void set (const RPC_Hid2RESrcID *hid2re)
 initialize the map More...
 
void add (const RpcPad *rc)
 add Rpc pads to the current list More...
 
void clear ()
 clear the current pad list More...
 
void fillROD (std::vector< uint32_t > &v)
 convert all pad in the current list to a vector of 32bit words More...
 

Private Member Functions

void packFragments (const std::vector< uint16_t > &v16, std::vector< uint32_t > &v, int n) const
 

Static Private Member Functions

static uint32_t set32bits (const unsigned short int *v16, const unsigned short int *pos, const unsigned short int n)
 

Private Attributes

const RPC_Hid2RESrcIDm_hid2re
 
std::vector< const RpcPad * > m_vRpcPad
 

Detailed Description

This class provides conversion from BS to ROD format.

Author
H. Ma
Version
0-0-1 , Oct 7, 2002

Modified, Jan 02, 2003 Split from LArROD_Decoder.

Adapted for Muons by Ketevi A. Assamagan Jan 14 2003, BNL Conversion from RpcFiredChannel, CoinMatrix, Pad to ROD format

Definition at line 30 of file RpcROD_Encoder.h.

Constructor & Destructor Documentation

◆ RpcROD_Encoder()

RpcROD_Encoder::RpcROD_Encoder ( )

constructor

Definition at line 19 of file RpcROD_Encoder.cxx.

19 : m_hid2re(nullptr) {}

◆ ~RpcROD_Encoder()

RpcROD_Encoder::~RpcROD_Encoder ( )
default

destructor

Member Function Documentation

◆ add()

void RpcROD_Encoder::add ( const RpcPad rc)

add Rpc pads to the current list

add coincidence matrices

Definition at line 33 of file RpcROD_Encoder.cxx.

33  {
34  m_vRpcPad.push_back(rc);
35 }

◆ clear()

void RpcROD_Encoder::clear ( )

clear the current pad list

clear vector

Definition at line 39 of file RpcROD_Encoder.cxx.

39  {
40  m_vRpcPad.erase(m_vRpcPad.begin(), m_vRpcPad.end());
41 }

◆ fillROD()

void RpcROD_Encoder::fillROD ( std::vector< uint32_t > &  v)

convert all pad in the current list to a vector of 32bit words

convert all RPC Pad in the current list to a vector of 32bit words

Definition at line 47 of file RpcROD_Encoder.cxx.

47  {
48  if (m_vRpcPad.empty()) { return; }
49  std::vector<unsigned short int> v16;
50 
51  RPCRODStructure rodReadout;
52  RXReadOutStructure rxReadout;
53  PadReadOutStructure padReadout;
54  MatrixReadOutStructure matrixReadout;
55 
56  // first group the pads into their receivers
57 
58  typedef std::vector<const RpcPad*> receiver;
59  std::map<int, receiver> mapReceiver;
60 
61  for (const auto& pPad : m_vRpcPad) {
62  int sector = pPad->sector();
63  mapReceiver[sector].push_back(pPad);
64  }
65 
66  std::map<int, receiver>::iterator re = mapReceiver.begin();
67  std::map<int, receiver>::iterator re_end = mapReceiver.end();
68 
69  // make the header of the ROD
70  v.push_back(rodReadout.getHeaderMarker());
71  v.push_back(rodReadout.getHeaderSize());
72  v.push_back(rodReadout.getFormatVersion());
73  uint16_t side = ((*re).first < 32) ? 0 : 1;
74  uint16_t rodId = ((*re).first % 32) / 2;
75  assert(rodId <= 15);
76 
77  v.push_back(rodReadout.getSourceID(side, rodId));
78  v.push_back(0); // Level1ID
79  v.push_back(0); // BunchCrossingID
80  v.push_back(0); // Level1TriggerType
81  v.push_back(0); // DetectorEventType
82 
83  // make the body of the ROD
84  for (; re != re_end; ++re) {
85  // make the header of the receiver
86  uint16_t rxHeader[3];
87  rxHeader[0] = 0;
88  rxHeader[1] = ((*re).first % 32) % 2 << 3;
89  rxHeader[2] = 0;
90 
91  uint16_t receiverHeader = rxReadout.makeHeader(rxHeader);
92 
93  v16.push_back(receiverHeader);
94 
95  // make the receiver body
96  std::vector<const RpcPad*>::const_iterator it = (*re).second.begin();
97  std::vector<const RpcPad*>::const_iterator it_end = (*re).second.end();
98 
99  for (; it != it_end; ++it) {
100  const RpcPad* pad = (*it);
101 
102  // make the pad header
103  unsigned short int padHeader[3];
104  padHeader[0] = 0;
105  padHeader[1] = pad->onlineId();
106  padHeader[2] = pad->status();
107  v16.push_back(padReadout.makeHeader(padHeader));
108  // make the pad body:: cma header, sub-header, body, and footer
109  RpcPad::const_iterator it_cma = pad->begin();
110  RpcPad::const_iterator it_cma_end = pad->end();
111  for (; it_cma != it_cma_end; ++it_cma) {
112  const RpcCoinMatrix* cma = (*it_cma);
113  unsigned short int cmaHeader[3];
114  cmaHeader[0] = 0;
115  cmaHeader[1] = cma->onlineId();
116  cmaHeader[2] = cma->fel1Id();
117  v16.push_back(matrixReadout.makeHeader(cmaHeader));
118  v16.push_back(matrixReadout.makeSubHeader());
119  RpcCoinMatrix::const_iterator it_fCh = cma->begin();
120  RpcCoinMatrix::const_iterator it_fCh_end = cma->end();
121  for (; it_fCh != it_fCh_end; ++it_fCh) {
122  const RpcFiredChannel* firedChannel = (*it_fCh);
123  unsigned short int body[5];
124  body[0] = 0;
125  body[1] = firedChannel->bcid();
126  body[2] = firedChannel->time();
127  body[3] = firedChannel->ijk();
128 
129  if (body[3] < 7) {
130  body[4] = firedChannel->channel();
131  } else {
132  body[4] = firedChannel->thr() | ((firedChannel->ovl()) << 2);
133  }
134 
135  v16.push_back(matrixReadout.makeBody(body));
136  }
137  v16.push_back(matrixReadout.makeFooter(cma->crc()));
138  }
139 
140  // make the pad footer
141 
142  ubit16 errorCodes[6] = {0, 0, 0, 0, 0, 0};
143  v16.push_back(padReadout.makeFooter(errorCodes));
144  }
145  // make the receiver footer
146  v16.push_back(rxReadout.makeFooter((uint16_t)0));
147  } // end of receivers
148 
149  // if numbers of 16 words is odd, add 0 to make it even
150  int n16words = v16.size();
151  if (n16words % 2 == 1) {
152  v16.push_back(0);
153  n16words++;
154  }
155  packFragments(v16, v, n16words);
156 
157  // finally make the ROD footer
158  v.push_back(0); // NumberOfStatusElements
159  v.push_back(0); // NumberOfDataElements
160  v.push_back(0); }

◆ packFragments()

void RpcROD_Encoder::packFragments ( const std::vector< uint16_t > &  v16,
std::vector< uint32_t > &  v,
int  n 
) const
private

Definition at line 162 of file RpcROD_Encoder.cxx.

162  {
163  // now merge 2 consecutive 16 bit words in 32 bit words
164  const unsigned short int nWords = 2;
165  unsigned short int position[nWords] = {0, 16};
166  unsigned short int v16words[nWords] = {0, 0};
167  for (int i = 0; i < n;) {
168  v16words[i % nWords] = v16[i];
169  v16words[(i + 1) % nWords] = v16[i + 1];
170  v.push_back(set32bits(v16words, position, nWords));
171  i += nWords;
172  }
173  }

◆ set()

void RpcROD_Encoder::set ( const RPC_Hid2RESrcID hid2re)

initialize the map

add coincidence matrices

Definition at line 27 of file RpcROD_Encoder.cxx.

27  {
28  m_hid2re = hid2re;
29 }

◆ set32bits()

uint32_t RpcROD_Encoder::set32bits ( const unsigned short int *  v16,
const unsigned short int *  pos,
const unsigned short int  n 
)
staticprivate

Definition at line 175 of file RpcROD_Encoder.cxx.

175  {
176  uint32_t v32 = 0;
177  uint32_t p = 0, v = 0;
178 
179  for (ubit16 i = 0; i < n; i++) {
180  v = (uint32_t)(*(v16 + i));
181  p = (uint32_t)(*(pos + i));
182  v32 = v32 | (v << p);
183  }
184  return v32;
185 }

Member Data Documentation

◆ m_hid2re

const RPC_Hid2RESrcID* RpcROD_Encoder::m_hid2re
private

Definition at line 64 of file RpcROD_Encoder.h.

◆ m_vRpcPad

std::vector<const RpcPad*> RpcROD_Encoder::m_vRpcPad
private

Definition at line 65 of file RpcROD_Encoder.h.


The documentation for this class was generated from the following files:
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
MatrixReadOutStructure::makeBody
ubit16 makeBody(ubit16 *inputData)
Definition: MatrixReadOutStructure.cxx:83
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
RPCRODStructure::getFormatVersion
RODword getFormatVersion()
Definition: RPCRODStructure.h:46
RpcFiredChannel::ovl
ubit16 ovl() const
Definition: RpcFiredChannel.h:61
RpcFiredChannel::thr
ubit16 thr() const
Definition: RpcFiredChannel.h:65
RpcCoinMatrix::crc
ubit16 crc() const
Definition: RpcCoinMatrix.h:69
MatrixReadOutStructure::makeSubHeader
ubit16 makeSubHeader()
Definition: MatrixReadOutStructure.cxx:76
PadReadOutStructure::makeHeader
ubit16 makeHeader(ubit16 *inputData)
Definition: PadReadOutStructure.cxx:74
RpcFiredChannel::channel
ubit16 channel() const
Definition: RpcFiredChannel.h:58
PadReadOutStructure
Definition: PadReadOutStructure.h:13
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
RpcROD_Encoder::m_vRpcPad
std::vector< const RpcPad * > m_vRpcPad
Definition: RpcROD_Encoder.h:65
RpcROD_Encoder::set32bits
static uint32_t set32bits(const unsigned short int *v16, const unsigned short int *pos, const unsigned short int n)
Definition: RpcROD_Encoder.cxx:175
skel.it
it
Definition: skel.GENtoEVGEN.py:396
RpcROD_Encoder::m_hid2re
const RPC_Hid2RESrcID * m_hid2re
Definition: RpcROD_Encoder.h:64
RpcPad::status
ubit16 status() const
Definition: RpcPad.h:105
RpcCoinMatrix
Definition: RpcCoinMatrix.h:20
RpcFiredChannel
Definition: RpcFiredChannel.h:20
RPCRODStructure::getHeaderSize
RODword getHeaderSize()
Definition: RPCRODStructure.h:44
TRT::Hit::side
@ side
Definition: HitInfo.h:83
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
xAOD::uint16_t
setWord1 uint16_t
Definition: eFexEMRoI_v1.cxx:93
RXReadOutStructure::makeFooter
ubit16 makeFooter(ubit16 errorCode)
Definition: RXReadOutStructure.cxx:55
lumiFormat.i
int i
Definition: lumiFormat.py:85
beamspotman.n
n
Definition: beamspotman.py:731
RpcROD_Encoder::packFragments
void packFragments(const std::vector< uint16_t > &v16, std::vector< uint32_t > &v, int n) const
Definition: RpcROD_Encoder.cxx:162
RPCRODStructure::getSourceID
RODword getSourceID(ubit16 subsystem, ubit16 RODID)
Definition: RPCRODStructure.cxx:43
PadReadOutStructure::makeFooter
ubit16 makeFooter(ubit16 errorCode)
Definition: PadReadOutStructure.h:25
MatrixReadOutStructure::makeFooter
ubit16 makeFooter(ubit16 inputData)
Definition: MatrixReadOutStructure.cxx:100
RXReadOutStructure::makeHeader
ubit16 makeHeader(ubit16 *inputData)
Definition: RXReadOutStructure.cxx:47
RpcCoinMatrix::onlineId
ubit16 onlineId() const
Definition: RpcCoinMatrix.h:67
RpcPad::onlineId
ubit16 onlineId() const
Definition: RpcPad.h:107
RPCRODStructure
Definition: RPCRODStructure.h:16
MatrixReadOutStructure::makeHeader
ubit16 makeHeader(ubit16 *inputData)
Definition: MatrixReadOutStructure.cxx:68
MatrixReadOutStructure
Definition: MatrixReadOutStructure.h:13
RpcPad
Definition: RpcPad.h:21
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
DataVector::end
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
python.PyAthena.v
v
Definition: PyAthena.py:154
RpcFiredChannel::bcid
ubit16 bcid() const
Definition: RpcFiredChannel.h:52
RpcCoinMatrix::fel1Id
ubit16 fel1Id() const
Definition: RpcCoinMatrix.h:71
RPCRODStructure::getHeaderMarker
RODword getHeaderMarker()
Definition: RPCRODStructure.h:43
RXReadOutStructure
Definition: RXReadOutStructure.h:14
re
const boost::regex re(r_e)
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.