ATLAS Offline Software
Loading...
Searching...
No Matches
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
 ~RpcROD_Encoder ()
 destructor
void set (const RPC_Hid2RESrcID *hid2re)
 initialize the map
void add (const RpcPad *rc)
 add Rpc pads to the current list
void clear ()
 clear the current pad list
void fillROD (std::vector< uint32_t > &v)
 convert all pad in the current list to a vector of 32bit words

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) {}
const RPC_Hid2RESrcID * m_hid2re

◆ ~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}
static Double_t rc
std::vector< const RpcPad * > m_vRpcPad

◆ 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); }
const boost::regex re(r_e)
Athena::TPCnvVers::Old Athena::TPCnvVers::Current Athena::TPCnvVers::Old Athena::TPCnvVers::Current Athena::TPCnvVers::Old Athena::TPCnvVers::Current Athena::TPCnvVers::Current RpcCoinMatrix
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
unsigned short int ubit16
DataModel_detail::const_iterator< DataVector > const_iterator
Definition DataVector.h:838
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
ubit16 makeBody(ubit16 *inputData)
ubit16 makeHeader(ubit16 *inputData)
ubit16 makeFooter(ubit16 inputData)
ubit16 makeFooter(ubit16 errorCode)
ubit16 makeHeader(ubit16 *inputData)
RODword getHeaderSize()
RODword getSourceID(ubit16 subsystem, ubit16 RODID)
RODword getFormatVersion()
RODword getHeaderMarker()
ubit16 makeHeader(ubit16 *inputData)
ubit16 makeFooter(ubit16 errorCode)
ubit16 crc() const
ubit16 fel1Id() const
ubit16 onlineId() const
ubit16 bcid() const
ubit16 thr() const
ubit16 channel() const
ubit16 ovl() const
ubit16 ijk() const
ubit16 time() const
ubit16 onlineId() const
Definition RpcPad.h:107
ubit16 status() const
Definition RpcPad.h:105
void packFragments(const std::vector< uint16_t > &v16, std::vector< uint32_t > &v, int n) const
setWord1 uint16_t

◆ 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 }
static uint32_t set32bits(const unsigned short int *v16, const unsigned short int *pos, const unsigned short int n)

◆ 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}
setEventNumber uint32_t

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: