ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigT1
TrigT1RPChardware
src
PadReadOutStructure.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
TrigT1RPChardware/PadReadOutStructure.h
"
6
7
#include <fstream>
8
#include <iostream>
9
#include <string>
10
11
// header structure
12
const
ubit16
PadReadOutStructure::s_headerPos
[s_headerNum] = {12, 9, 0};
13
// const ubit16 PadReadOutStructure::s_headerPos[s_headerNum] ={ 12, 8, 0};
14
const
ubit16
PadReadOutStructure::s_headerLen
[s_headerNum] = {4, 3, 9};
15
// const ubit16 PadReadOutStructure::s_headerLen[s_headerNum] ={ 4, 4, 8};
16
const
ubit16
PadReadOutStructure::s_headerVal
= 0x0005;
17
// subheader structure
18
const
ubit16
PadReadOutStructure::s_subHeaderPos
[s_subHeaderNum] = {12, 0};
19
const
ubit16
PadReadOutStructure::s_subHeaderLen
[s_subHeaderNum] = {4, 12};
20
const
ubit16
PadReadOutStructure::s_subHeaderVal
= 0x0006;
21
// prefooter structure
22
const
ubit16
PadReadOutStructure::s_prefooterPos
[s_prefooterNum] = {12, 3, 2, 1, 0};
23
const
ubit16
PadReadOutStructure::s_prefooterLen
[s_prefooterNum] = {4, 1, 1, 1, 1};
24
const
ubit16
PadReadOutStructure::s_prefooterVal
= 0x000a;
25
// footer structure
26
const
ubit16
PadReadOutStructure::s_footerPos
[s_footerNum] = {12, 11, 10, 9, 8, 0};
27
// const ubit16 PadReadOutStructure::s_footerPos[s_footerNum]={ 12,0};
28
const
ubit16
PadReadOutStructure::s_footerLen
[s_footerNum] = {4, 1, 1, 1, 1, 8};
29
// const ubit16 PadReadOutStructure::s_footerLen[s_footerNum]={ 4,12};
30
const
ubit16
PadReadOutStructure::s_footerVal
= 0x0007;
31
32
//----------------------------------------------------------------------------//
33
PadReadOutStructure::PadReadOutStructure
() {
34
//
35
// Constructor used by the simulation program
36
//
37
m_padid
= 0xffff;
38
m_l1id
= 0xffff;
39
m_bcid
= 0xffff;
40
m_fifoCM
= 0xffff;
41
m_fifoOR
= 0xffff;
42
m_fifoL1
= 0xffff;
43
m_fifoPAD
= 0xffff;
44
m_status
= 0xffff;
45
m_errorSH
= 0xffff;
46
m_errorL1
= 0xffff;
47
m_errorH
= 0xffff;
48
m_errorCM
= 0xffff;
49
m_errorCMID
= 0xffff;
50
m_errorCode
= 0xffff;
51
m_vectorStruct
= 0;
52
setInit
();
53
}
54
//----------------------------------------------------------------------------//
55
PadReadOutStructure::PadReadOutStructure
(
ubit16
inputData) {
56
//
57
// Constructor used by the simulation program
58
//
59
m_vectorStruct
= 0;
60
decodeFragment
(inputData,
m_field
);
61
}
62
//----------------------------------------------------------------------------//
63
64
void
PadReadOutStructure::setInit
() {
65
m_field
=
'U'
;
66
// m_word =0xffff;
67
// m_padid =0xffff;
68
// m_status =0xffff;
69
// m_errorCode =0xffff;
70
}
71
72
//----------------------------------------------------------------------------//
73
74
ubit16
PadReadOutStructure::makeHeader
(
ubit16
*inputData) {
75
// m_status = *(inputData+2);
76
m_padid
= *(inputData + 1);
77
m_l1id
= *(inputData + 2);
78
// ubit16 theHeader[s_headerNum] = *inputData;
79
//={s_headerVal,*(inputData+1),*(inputData+2)};
80
m_vectorStruct
= inputData;
81
*(
m_vectorStruct
) =
s_headerVal
;
82
m_word
=
set16Bits
(
s_headerNum
,
s_headerPos
,
m_vectorStruct
);
// theHeader);
83
return
m_word
;
84
}
85
//----------------------------------------------------------------------------//
86
/*
87
ubit16 PadReadOutStructure::makeFooter_new(ubit16* inputData) {
88
// m_errorCode= *inputData;
89
m_errorSH = *(inputData+1);
90
m_errorL1 = *(inputData+2);
91
m_errorH = *(inputData+3);
92
m_errorCM = *(inputData+4);
93
m_errorCMID =*(inputData+5);
94
m_vectorStruct = inputData;
95
*(m_vectorStruct)= s_footerVal;
96
// ubit16 theFooter[s_footerNum]={s_footerVal};
97
//for(int i=1;i<5;i++) *(theFooter+i) = *(inputData+i);
98
m_word = set16Bits(s_footerNum,s_footerPos,m_vectorStruct);//theFooter);
99
return m_word;
100
}
101
*/
102
//----------------------------------------------------------------------------//
103
ubit16
PadReadOutStructure::makeFooter
(
ubit16
*inputData) {
104
// m_errorCode= *inputData;
105
m_errorSH
= *(inputData + 1);
106
m_errorL1
= *(inputData + 2);
107
m_errorH
= *(inputData + 3);
108
m_errorCM
= *(inputData + 4);
109
m_errorCMID
= *(inputData + 5);
110
m_vectorStruct
= inputData;
111
*(
m_vectorStruct
) =
s_footerVal
;
112
// ubit16 theFooter[s_footerNum]={s_footerVal};
113
// for(int i=1;i<5;i++) *(theFooter+i) = *(inputData+i);
114
m_word
=
set16Bits
(
s_footerNum
,
s_footerPos
,
m_vectorStruct
);
// theFooter);
115
return
m_word
;
116
}
117
//----------------------------------------------------------------------------//
118
ubit16
PadReadOutStructure::decodeFragment
(
ubit16
inputWord,
char
&
field
) {
119
// Removed last because it is not used
120
// bool last=false;
121
ubit16
errorCode
= 0;
122
setInit
();
123
m_word
= inputWord;
124
errorCode
= 0;
125
if
(
isHeader
()) {
126
m_field
=
'H'
;
127
m_padid
=
get16Bits
(inputWord,
s_headerPos
[1],
s_headerLen
[1]);
128
m_l1id
=
get16Bits
(inputWord,
s_headerPos
[2],
s_headerLen
[2]);
129
}
else
if
(
isSubHeader
()) {
130
m_field
=
'S'
;
131
m_bcid
=
get16Bits
(inputWord,
s_subHeaderPos
[1],
s_subHeaderLen
[1]);
132
}
else
if
(
isPreFooter
()) {
133
m_field
=
'P'
;
134
m_fifoCM
=
get16Bits
(inputWord,
s_prefooterPos
[1],
s_prefooterLen
[1]);
135
m_fifoOR
=
get16Bits
(inputWord,
s_prefooterPos
[2],
s_prefooterLen
[2]);
136
m_fifoL1
=
get16Bits
(inputWord,
s_prefooterPos
[3],
s_prefooterLen
[3]);
137
m_fifoPAD
=
get16Bits
(inputWord,
s_prefooterPos
[4],
s_prefooterLen
[4]);
138
m_status
= inputWord & 0x0fff;
139
}
else
if
(
isFooter
()) {
140
m_field
=
'F'
;
141
m_errorSH
=
get16Bits
(inputWord,
s_footerPos
[1],
s_footerLen
[1]);
142
m_errorL1
=
get16Bits
(inputWord,
s_footerPos
[2],
s_footerLen
[2]);
143
m_errorH
=
get16Bits
(inputWord,
s_footerPos
[3],
s_footerLen
[3]);
144
m_errorCM
=
get16Bits
(inputWord,
s_footerPos
[4],
s_footerLen
[4]);
145
m_errorCMID
=
get16Bits
(inputWord,
s_footerPos
[5],
s_footerLen
[5]);
146
m_errorCode
= inputWord & 0x0fff;
147
}
else
{
148
m_field
=
'B'
;
149
if
((
m_word
& 0xf000) == (
m_MRS
.getFooterVal() << 12)) {
150
/* last=true; */
151
}
else
{
152
/* last=false; */
153
}
154
}
155
field
=
m_field
;
156
return
errorCode
;
// temporary: force return to 0
157
}
158
159
//----------------------------------------------------------------------------//
160
bool
PadReadOutStructure::isBody
() {
161
ubit16
theword = (
m_word
& 0xf000) >> 12;
162
if
((theword !=
s_headerVal
) && (theword !=
s_subHeaderVal
) && (theword !=
s_prefooterVal
) && (theword !=
s_footerVal
))
return
true
;
163
return
false
;
164
}
165
//----------------------------------------------------------------------------//
166
bool
PadReadOutStructure::isHeader
() {
167
bool
status
=
false
;
168
ubit16
theHeader[
s_headerNum
] = {
s_headerVal
};
169
if
((
m_word
&
s_last4bitsON
) ==
set16Bits
(1,
s_headerPos
, theHeader))
status
=
true
;
170
return
status
;
171
}
172
173
//-----------------------------------------------------------------------//
174
bool
PadReadOutStructure::isSubHeader
() {
175
bool
status
=
false
;
176
ubit16
theSubHeader[
s_subHeaderNum
] = {
s_subHeaderVal
};
177
if
((
m_word
&
s_last4bitsON
) ==
set16Bits
(1,
s_subHeaderPos
, theSubHeader))
status
=
true
;
178
return
status
;
179
}
180
181
//-----------------------------------------------------------------------//
182
bool
PadReadOutStructure::isPreFooter
() {
183
bool
status
=
false
;
184
ubit16
thepreFooter[
s_prefooterNum
] = {
s_prefooterVal
};
185
if
((
m_word
&
s_last4bitsON
) ==
set16Bits
(1,
s_prefooterPos
, thepreFooter))
status
=
true
;
186
return
status
;
187
}
188
189
//-----------------------------------------------------------------------//
190
bool
PadReadOutStructure::isFooter
() {
191
bool
status
=
false
;
192
ubit16
theFooter[
s_footerNum
] = {
s_footerVal
};
193
if
((
m_word
&
s_last4bitsON
) ==
set16Bits
(1,
s_footerPos
, theFooter))
status
=
true
;
194
return
status
;
195
}
PadReadOutStructure.h
ubit16
unsigned short int ubit16
Definition
RpcByteStreamEncoder.h:20
PadReadOutStructure::m_bcid
ubit16 m_bcid
Definition
PadReadOutStructure.h:61
PadReadOutStructure::m_errorSH
ubit16 m_errorSH
Definition
PadReadOutStructure.h:71
PadReadOutStructure::s_subHeaderNum
static const ubit16 s_subHeaderNum
Definition
PadReadOutStructure.h:90
PadReadOutStructure::makeFooter
ubit16 makeFooter(ubit16 errorCode)
Definition
PadReadOutStructure.h:25
PadReadOutStructure::s_footerNum
static const ubit16 s_footerNum
Definition
PadReadOutStructure.h:98
PadReadOutStructure::m_status
ubit16 m_status
Definition
PadReadOutStructure.h:68
PadReadOutStructure::isHeader
bool isHeader()
Definition
PadReadOutStructure.cxx:166
PadReadOutStructure::s_prefooterLen
static const ubit16 s_prefooterLen[s_prefooterNum]
Definition
PadReadOutStructure.h:23
PadReadOutStructure::m_fifoPAD
ubit16 m_fifoPAD
Definition
PadReadOutStructure.h:67
PadReadOutStructure::s_subHeaderVal
static const ubit16 s_subHeaderVal
Definition
PadReadOutStructure.h:93
PadReadOutStructure::m_errorCMID
ubit16 m_errorCMID
Definition
PadReadOutStructure.h:75
PadReadOutStructure::s_subHeaderLen
static const ubit16 s_subHeaderLen[s_subHeaderNum]
Definition
PadReadOutStructure.h:19
PadReadOutStructure::PadReadOutStructure
PadReadOutStructure()
Definition
PadReadOutStructure.cxx:33
PadReadOutStructure::s_footerLen
static const ubit16 s_footerLen[s_footerNum]
Definition
PadReadOutStructure.h:28
PadReadOutStructure::m_vectorStruct
ubit16 * m_vectorStruct
Definition
PadReadOutStructure.h:105
PadReadOutStructure::s_headerVal
static const ubit16 s_headerVal
Definition
PadReadOutStructure.h:89
PadReadOutStructure::isFooter
bool isFooter()
Definition
PadReadOutStructure.cxx:190
PadReadOutStructure::errorCode
ubit16 errorCode() const
Definition
PadReadOutStructure.h:34
PadReadOutStructure::m_l1id
ubit16 m_l1id
Definition
PadReadOutStructure.h:59
PadReadOutStructure::s_prefooterVal
static const ubit16 s_prefooterVal
Definition
PadReadOutStructure.h:97
PadReadOutStructure::isBody
bool isBody()
Definition
PadReadOutStructure.cxx:160
PadReadOutStructure::s_prefooterPos
static const ubit16 s_prefooterPos[s_prefooterNum]
Definition
PadReadOutStructure.h:22
PadReadOutStructure::s_headerNum
static const ubit16 s_headerNum
Definition
PadReadOutStructure.h:86
PadReadOutStructure::s_footerPos
static const ubit16 s_footerPos[s_footerNum]
Definition
PadReadOutStructure.h:26
PadReadOutStructure::s_subHeaderPos
static const ubit16 s_subHeaderPos[s_subHeaderNum]
Definition
PadReadOutStructure.h:18
PadReadOutStructure::s_footerVal
static const ubit16 s_footerVal
Definition
PadReadOutStructure.h:101
PadReadOutStructure::m_errorH
ubit16 m_errorH
Definition
PadReadOutStructure.h:73
PadReadOutStructure::m_fifoOR
ubit16 m_fifoOR
Definition
PadReadOutStructure.h:65
PadReadOutStructure::setInit
void setInit()
Definition
PadReadOutStructure.cxx:64
PadReadOutStructure::m_MRS
MatrixReadOutStructure m_MRS
Definition
PadReadOutStructure.h:80
PadReadOutStructure::isSubHeader
bool isSubHeader()
Definition
PadReadOutStructure.cxx:174
PadReadOutStructure::status
ubit16 status() const
Definition
PadReadOutStructure.h:33
PadReadOutStructure::isPreFooter
bool isPreFooter()
Definition
PadReadOutStructure.cxx:182
PadReadOutStructure::s_prefooterNum
static const ubit16 s_prefooterNum
Definition
PadReadOutStructure.h:94
PadReadOutStructure::s_headerLen
static const ubit16 s_headerLen[s_headerNum]
Definition
PadReadOutStructure.h:14
PadReadOutStructure::m_errorCode
ubit16 m_errorCode
Definition
PadReadOutStructure.h:76
PadReadOutStructure::makeHeader
ubit16 makeHeader(ubit16 *inputData)
Definition
PadReadOutStructure.cxx:74
PadReadOutStructure::s_headerPos
static const ubit16 s_headerPos[s_headerNum]
Definition
PadReadOutStructure.h:12
PadReadOutStructure::m_fifoCM
ubit16 m_fifoCM
Definition
PadReadOutStructure.h:64
PadReadOutStructure::m_padid
ubit16 m_padid
Definition
PadReadOutStructure.h:58
PadReadOutStructure::m_errorCM
ubit16 m_errorCM
Definition
PadReadOutStructure.h:74
PadReadOutStructure::m_errorL1
ubit16 m_errorL1
Definition
PadReadOutStructure.h:72
PadReadOutStructure::decodeFragment
ubit16 decodeFragment(ubit16 inputWord, char &field)
Definition
PadReadOutStructure.cxx:118
PadReadOutStructure::m_fifoL1
ubit16 m_fifoL1
Definition
PadReadOutStructure.h:66
RPCReadOut::s_last4bitsON
static constexpr ubit16 s_last4bitsON
Definition
RPCReadOut.h:56
RPCReadOut::field
char field() const
Definition
RPCReadOut.h:19
RPCReadOut::get16Bits
ubit16 get16Bits(const ubit16 input, const ubit16 position, const ubit16 length) const
Definition
RPCReadOut.h:47
RPCReadOut::set16Bits
ubit16 set16Bits(const ubit16 n, const ubit16 *pos, const ubit16 *val) const
Definition
RPCReadOut.h:30
RPCReadOut::m_word
ubit16 m_word
Definition
RPCReadOut.h:27
RPCReadOut::m_field
char m_field
Definition
RPCReadOut.h:28
Generated on
for ATLAS Offline Software by
1.17.0