ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigT1
TrigT1CaloByteStream
src
JemRoiSubBlockV2.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
6
#include "
TrigT1CaloEvent/JEMTobRoI.h
"
7
8
#include "
JemRoiSubBlockV2.h
"
9
10
namespace
LVL1BS
{
11
12
// Constant definitions
13
14
const
int
JemRoiSubBlockV2::s_wordIdVal
;
15
16
const
int
JemRoiSubBlockV2::s_frames
;
17
const
int
JemRoiSubBlockV2::s_framesPerPin
;
18
const
int
JemRoiSubBlockV2::s_bunchCrossingPin
;
19
const
int
JemRoiSubBlockV2::s_energySmallBits
;
20
const
int
JemRoiSubBlockV2::s_energyLargeBits
;
21
const
int
JemRoiSubBlockV2::s_locationBits
;
22
const
int
JemRoiSubBlockV2::s_bunchCrossingBits
;
23
const
int
JemRoiSubBlockV2::s_paddingBits
;
24
25
26
JemRoiSubBlockV2::JemRoiSubBlockV2
()
27
{
28
}
29
30
JemRoiSubBlockV2::~JemRoiSubBlockV2
()
31
{
32
}
33
34
// Clear all data
35
36
void
JemRoiSubBlockV2::clear
()
37
{
38
L1CaloSubBlock::clear
();
39
m_roiData
.clear();
40
}
41
42
// Store header
43
44
void
JemRoiSubBlockV2::setRoiHeader
(
const
int
version
,
const
int
crate
,
45
const
int
module
)
46
{
47
setHeader
(
s_wordIdVal
,
version
,
NEUTRAL
, 0,
crate
,
module
, 0, 1);
48
}
49
50
// Store RoI
51
52
void
JemRoiSubBlockV2::fillRoi
(
const
LVL1::JEMTobRoI
roi
)
53
{
54
const
LVL1::JEMTobRoI
roiTemp(
crate
(),
module
(), 0, 0, 0, 0);
55
if
(
roi
.crate() == roiTemp.
crate
() &&
roi
.jem() == roiTemp.
jem
()) {
56
m_roiData
.resize(
s_frames
);
57
const
int
pos =
roi
.frame();
58
m_roiData
[pos] =
roi
;
59
}
60
}
61
62
// Return RoI for given frame
63
64
LVL1::JEMTobRoI
JemRoiSubBlockV2::roi
(
const
int
frame)
const
65
{
66
if
(frame >= 0 && frame <
s_frames
&& !
m_roiData
.empty()) {
67
return
m_roiData
[frame];
68
}
else
return
LVL1::JEMTobRoI
(0);
69
}
70
71
// Packing/Unpacking routines
72
73
bool
JemRoiSubBlockV2::pack
()
74
{
75
bool
rc
=
false
;
76
switch
(
version
()) {
77
case
1:
//<< CHECK
78
switch
(
format
()) {
79
case
NEUTRAL
:
80
rc
=
packNeutral
();
81
break
;
82
default
:
83
break
;
84
}
85
break
;
86
default
:
87
break
;
88
}
89
return
rc
;
90
}
91
92
bool
JemRoiSubBlockV2::unpack
()
93
{
94
bool
rc
=
false
;
95
switch
(
version
()) {
96
case
2:
//<< CHECK
97
switch
(
format
()) {
98
case
NEUTRAL
:
99
rc
=
unpackNeutral
();
100
break
;
101
default
:
102
setUnpackErrorCode
(
UNPACK_FORMAT
);
103
break
;
104
}
105
break
;
106
default
:
107
setUnpackErrorCode
(
UNPACK_VERSION
);
108
break
;
109
}
110
return
rc
;
111
}
112
113
// Pack neutral data
114
115
bool
JemRoiSubBlockV2::packNeutral
()
116
{
117
m_roiData
.resize(
s_frames
);
118
int
maxPin = 0;
119
// RoI data
120
for
(
int
frame = 0; frame <
s_frames
; ++frame) {
121
const
LVL1::JEMTobRoI
&
roi
(
m_roiData
[frame]);
122
const
int
pin1 = frame /
s_framesPerPin
;
123
const
int
pin2 =
s_bunchCrossingPin
+ pin1 + 1;
124
packerNeutral
(pin1,
roi
.energyLarge(),
s_energyLargeBits
);
125
packerNeutral
(pin1, 0, 1);
126
packerNeutral
(pin2,
roi
.energySmall(),
s_energySmallBits
);
127
packerNeutral
(pin2,
roi
.location(),
s_locationBits
);
128
maxPin = pin2;
129
}
130
// Bunch Crossing number
131
packerNeutral
(
s_bunchCrossingPin
,
bunchCrossing
(),
s_bunchCrossingBits
);
132
packerNeutral
(
s_bunchCrossingPin
, 0,
s_paddingBits
);
133
// G-Link parity
134
for
(
int
pin = 0; pin <= maxPin; ++pin)
packerNeutralParity
(pin);
135
136
return
true
;
137
}
138
139
// Unpack neutral data
140
141
bool
JemRoiSubBlockV2::unpackNeutral
()
142
{
143
m_roiData
.resize(
s_frames
);
144
int
maxPin = 0;
145
// RoI data
146
for
(
int
frame = 0; frame <
s_frames
; ++frame) {
147
const
int
pin1 = frame /
s_framesPerPin
;
148
const
int
pin2 =
s_bunchCrossingPin
+ pin1 + 1;
149
const
int
enLarge =
unpackerNeutral
(pin1,
s_energyLargeBits
);
150
unpackerNeutral
(pin1, 1);
151
const
int
enSmall =
unpackerNeutral
(pin2,
s_energySmallBits
);
152
const
int
loc =
unpackerNeutral
(pin2,
s_locationBits
);
153
m_roiData
[frame] =
LVL1::JEMTobRoI
(
crate
(),
module
(),
154
frame, loc, enLarge, enSmall);
155
maxPin = pin2;
156
}
157
// Bunch Crossing number
158
setBunchCrossing
(
unpackerNeutral
(
s_bunchCrossingPin
,
s_bunchCrossingBits
));
159
unpackerNeutral
(
s_bunchCrossingPin
,
s_paddingBits
);
160
// G-Link parity
161
for
(
int
pin = 0; pin <= maxPin; ++pin)
unpackerNeutralParityError
(pin);
162
const
bool
rc
=
unpackerSuccess
();
163
if
(!
rc
)
setUnpackErrorCode
(
UNPACK_DATA_TRUNCATED
);
164
return
rc
;
165
}
166
167
}
// end namespace
JemRoiSubBlockV2.h
rc
static Double_t rc
Definition
LArPhysWaveHECTool.cxx:37
JEMTobRoI.h
LVL1BS::JemRoiSubBlockV2::s_energySmallBits
static const int s_energySmallBits
Definition
JemRoiSubBlockV2.h:55
LVL1BS::JemRoiSubBlockV2::s_framesPerPin
static const int s_framesPerPin
Definition
JemRoiSubBlockV2.h:53
LVL1BS::JemRoiSubBlockV2::JemRoiSubBlockV2
JemRoiSubBlockV2()
Definition
JemRoiSubBlockV2.cxx:26
LVL1BS::JemRoiSubBlockV2::s_wordIdVal
static const int s_wordIdVal
Header word ID.
Definition
JemRoiSubBlockV2.h:50
LVL1BS::JemRoiSubBlockV2::s_bunchCrossingPin
static const int s_bunchCrossingPin
Definition
JemRoiSubBlockV2.h:54
LVL1BS::JemRoiSubBlockV2::unpack
bool unpack()
Unpack data.
Definition
JemRoiSubBlockV2.cxx:92
LVL1BS::JemRoiSubBlockV2::clear
void clear()
Clear all data.
Definition
JemRoiSubBlockV2.cxx:36
LVL1BS::JemRoiSubBlockV2::roi
LVL1::JEMTobRoI roi(int frame) const
Return RoI for given frame.
Definition
JemRoiSubBlockV2.cxx:64
LVL1BS::JemRoiSubBlockV2::s_paddingBits
static const int s_paddingBits
Definition
JemRoiSubBlockV2.h:59
LVL1BS::JemRoiSubBlockV2::~JemRoiSubBlockV2
~JemRoiSubBlockV2()
Definition
JemRoiSubBlockV2.cxx:30
LVL1BS::JemRoiSubBlockV2::pack
bool pack()
Pack data.
Definition
JemRoiSubBlockV2.cxx:73
LVL1BS::JemRoiSubBlockV2::s_frames
static const int s_frames
Definition
JemRoiSubBlockV2.h:52
LVL1BS::JemRoiSubBlockV2::s_bunchCrossingBits
static const int s_bunchCrossingBits
Definition
JemRoiSubBlockV2.h:58
LVL1BS::JemRoiSubBlockV2::s_locationBits
static const int s_locationBits
Definition
JemRoiSubBlockV2.h:57
LVL1BS::JemRoiSubBlockV2::fillRoi
void fillRoi(LVL1::JEMTobRoI roi)
Store RoI.
Definition
JemRoiSubBlockV2.cxx:52
LVL1BS::JemRoiSubBlockV2::unpackNeutral
bool unpackNeutral()
Unpack neutral data.
Definition
JemRoiSubBlockV2.cxx:141
LVL1BS::JemRoiSubBlockV2::packNeutral
bool packNeutral()
Pack neutral data.
Definition
JemRoiSubBlockV2.cxx:115
LVL1BS::JemRoiSubBlockV2::setRoiHeader
void setRoiHeader(int version, int crate, int module)
Store header.
Definition
JemRoiSubBlockV2.cxx:44
LVL1BS::JemRoiSubBlockV2::m_roiData
std::vector< LVL1::JEMTobRoI > m_roiData
RoIs.
Definition
JemRoiSubBlockV2.h:67
LVL1BS::JemRoiSubBlockV2::s_energyLargeBits
static const int s_energyLargeBits
Definition
JemRoiSubBlockV2.h:56
LVL1BS::L1CaloSubBlock::crate
int crate() const
Definition
L1CaloSubBlock.h:263
LVL1BS::L1CaloSubBlock::UNPACK_VERSION
@ UNPACK_VERSION
Definition
L1CaloSubBlock.h:38
LVL1BS::L1CaloSubBlock::UNPACK_FORMAT
@ UNPACK_FORMAT
Definition
L1CaloSubBlock.h:39
LVL1BS::L1CaloSubBlock::UNPACK_DATA_TRUNCATED
@ UNPACK_DATA_TRUNCATED
Definition
L1CaloSubBlock.h:40
LVL1BS::L1CaloSubBlock::NEUTRAL
@ NEUTRAL
Definition
L1CaloSubBlock.h:28
LVL1BS::L1CaloSubBlock::setUnpackErrorCode
void setUnpackErrorCode(int code)
Set the unpacking error code.
Definition
L1CaloSubBlock.h:338
LVL1BS::L1CaloSubBlock::unpackerSuccess
bool unpackerSuccess() const
Return unpacker success flag.
Definition
L1CaloSubBlock.h:354
LVL1BS::L1CaloSubBlock::setHeader
void setHeader(int wordId, int version, int format, int seqno, int crate, int module, int slices2, int slices1)
Store header data.
Definition
L1CaloSubBlock.cxx:99
LVL1BS::L1CaloSubBlock::unpackerNeutralParityError
bool unpackerNeutralParityError(int pin)
Unpack and test G-Link parity bit for given pin.
Definition
L1CaloSubBlock.cxx:464
LVL1BS::L1CaloSubBlock::clear
void clear()
Clear all data.
Definition
L1CaloSubBlock.cxx:82
LVL1BS::L1CaloSubBlock::packerNeutralParity
void packerNeutralParity(int pin)
Pack current G-Link parity bit for given pin.
Definition
L1CaloSubBlock.cxx:434
LVL1BS::L1CaloSubBlock::unpackerNeutral
uint32_t unpackerNeutral(int pin, int nbits)
Unpack given number of bits of neutral data for given pin.
Definition
L1CaloSubBlock.cxx:445
LVL1BS::L1CaloSubBlock::module
int module() const
Definition
L1CaloSubBlock.h:268
LVL1BS::L1CaloSubBlock::bunchCrossing
int bunchCrossing() const
Return the Bunch Crossing number (neutral format only).
Definition
L1CaloSubBlock.h:333
LVL1BS::L1CaloSubBlock::version
int version() const
Definition
L1CaloSubBlock.h:243
LVL1BS::L1CaloSubBlock::packerNeutral
void packerNeutral(int pin, uint32_t datum, int nbits)
Pack given neutral data from given pin.
Definition
L1CaloSubBlock.cxx:413
LVL1BS::L1CaloSubBlock::format
int format() const
Definition
L1CaloSubBlock.h:248
LVL1BS::L1CaloSubBlock::setBunchCrossing
void setBunchCrossing(int bc)
Set the Bunch Crossing number (neutral format only).
Definition
L1CaloSubBlock.h:328
LVL1::JEMTobRoI
JEM RoI data.
Definition
Trigger/TrigT1/TrigT1CaloEvent/TrigT1CaloEvent/JEMTobRoI.h:19
LVL1::JEMTobRoI::jem
int jem() const
Return JEM number (0-15).
Definition
Trigger/TrigT1/TrigT1CaloEvent/TrigT1CaloEvent/JEMTobRoI.h:79
LVL1::JEMTobRoI::crate
int crate() const
Return crate number (0-1).
Definition
Trigger/TrigT1/TrigT1CaloEvent/TrigT1CaloEvent/JEMTobRoI.h:74
LVL1BS
Definition
ZdcModifySlices.h:10
Generated on
for ATLAS Offline Software by
1.17.0