ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigT1
TrigT1CaloByteStream
src
CpmRoiSubBlockV1.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/CPMRoI.h
"
7
8
#include "
CpmRoiSubBlockV1.h
"
9
10
namespace
LVL1BS
{
11
12
// Constant definitions
13
14
const
int
CpmRoiSubBlockV1::s_wordIdVal
;
15
16
const
int
CpmRoiSubBlockV1::s_glinkPins
;
17
const
int
CpmRoiSubBlockV1::s_hitsLen
;
18
const
int
CpmRoiSubBlockV1::s_errorLen
;
19
const
int
CpmRoiSubBlockV1::s_locationLen
;
20
const
int
CpmRoiSubBlockV1::s_bunchCrossingBits
;
21
22
23
CpmRoiSubBlockV1::CpmRoiSubBlockV1
()
24
{
25
}
26
27
CpmRoiSubBlockV1::~CpmRoiSubBlockV1
()
28
{
29
}
30
31
// Clear all data
32
33
void
CpmRoiSubBlockV1::clear
()
34
{
35
L1CaloSubBlock::clear
();
36
m_roiData
.clear();
37
}
38
39
// Store header
40
41
void
CpmRoiSubBlockV1::setRoiHeader
(
const
int
version
,
const
int
crate
,
42
const
int
module
)
43
{
44
setHeader
(
s_wordIdVal
,
version
,
NEUTRAL
, 0,
crate
,
module
, 0, 1);
45
}
46
47
// Store RoI
48
49
void
CpmRoiSubBlockV1::fillRoi
(
const
LVL1::CPMRoI
roi
)
50
{
51
const
LVL1::CPMRoI
roiTemp(
crate
(),
module
(), 0, 0, 0, 0);
52
if
(
roi
.crate() == roiTemp.
crate
() &&
roi
.cpm() == roiTemp.
cpm
()) {
53
m_roiData
.resize(
s_glinkPins
);
54
const
int
pin = (
roi
.chip() << 1) |
55
((
roi
.location() >>
s_locationLen
) & 0x1);
56
m_roiData
[pin] =
roi
;
57
}
58
}
59
60
// Return RoI for given chip and location (left/right)
61
62
LVL1::CPMRoI
CpmRoiSubBlockV1::roi
(
const
int
chip,
const
int
loc)
const
63
{
64
const
int
pin = (chip << 1) | (loc & 0x1);
65
if
(pin <
s_glinkPins
&& !
m_roiData
.empty())
return
m_roiData
[pin];
66
else
return
LVL1::CPMRoI
(0);
67
}
68
69
// Packing/Unpacking routines
70
71
bool
CpmRoiSubBlockV1::pack
()
72
{
73
bool
rc
=
false
;
74
switch
(
version
()) {
75
case
1:
76
switch
(
format
()) {
77
case
NEUTRAL
:
78
rc
=
packNeutral
();
79
break
;
80
default
:
81
break
;
82
}
83
break
;
84
default
:
85
break
;
86
}
87
return
rc
;
88
}
89
90
bool
CpmRoiSubBlockV1::unpack
()
91
{
92
bool
rc
=
false
;
93
switch
(
version
()) {
94
case
1:
95
switch
(
format
()) {
96
case
NEUTRAL
:
97
rc
=
unpackNeutral
();
98
break
;
99
default
:
100
setUnpackErrorCode
(
UNPACK_FORMAT
);
101
break
;
102
}
103
break
;
104
default
:
105
setUnpackErrorCode
(
UNPACK_VERSION
);
106
break
;
107
}
108
return
rc
;
109
}
110
111
// Pack neutral data
112
113
bool
CpmRoiSubBlockV1::packNeutral
()
114
{
115
m_roiData
.resize(
s_glinkPins
);
116
for
(
int
pin = 0; pin <
s_glinkPins
; ++pin) {
117
// RoI data
118
const
LVL1::CPMRoI
&
roi
(
m_roiData
[pin]);
119
packerNeutral
(pin,
roi
.hits(),
s_hitsLen
);
120
packerNeutral
(pin,
roi
.error(),
s_errorLen
);
121
packerNeutral
(pin,
roi
.location(),
s_locationLen
);
122
// Bunch Crossing number
123
if
(pin <
s_bunchCrossingBits
) {
124
packerNeutral
(pin,
bunchCrossing
() >> pin, 1);
125
}
else
packerNeutral
(pin, 0, 1);
126
// G-Link parity
127
packerNeutralParity
(pin);
128
}
129
return
true
;
130
}
131
132
// Unpack neutral data
133
134
bool
CpmRoiSubBlockV1::unpackNeutral
()
135
{
136
m_roiData
.resize(
s_glinkPins
);
137
int
bunchCrossing
= 0;
138
for
(
int
pin = 0; pin <
s_glinkPins
; ++pin) {
139
// RoI data
140
const
int
hits =
unpackerNeutral
(pin,
s_hitsLen
);
141
const
int
error
=
unpackerNeutral
(pin,
s_errorLen
);
142
const
int
loc =
unpackerNeutral
(pin,
s_locationLen
) |
143
((pin & 0x1) <<
s_locationLen
);
144
const
int
chip = pin >> 1;
145
m_roiData
[pin] =
LVL1::CPMRoI
(
crate
(),
module
(), chip, loc, hits,
error
);
146
// Bunch Crossing number
147
if
(pin <
s_bunchCrossingBits
) {
148
bunchCrossing
|=
unpackerNeutral
(pin, 1) << pin;
149
}
else
unpackerNeutral
(pin, 1);
150
// G-Link parity error
151
unpackerNeutralParityError
(pin);
152
}
153
setBunchCrossing
(
bunchCrossing
);
154
const
bool
rc
=
unpackerSuccess
();
155
if
(!
rc
)
setUnpackErrorCode
(
UNPACK_DATA_TRUNCATED
);
156
return
rc
;
157
}
158
159
}
// end namespace
CpmRoiSubBlockV1.h
rc
static Double_t rc
Definition
LArPhysWaveHECTool.cxx:37
CPMRoI.h
LVL1BS::CpmRoiSubBlockV1::packNeutral
bool packNeutral()
Pack neutral data.
Definition
CpmRoiSubBlockV1.cxx:113
LVL1BS::CpmRoiSubBlockV1::pack
bool pack()
Pack data.
Definition
CpmRoiSubBlockV1.cxx:71
LVL1BS::CpmRoiSubBlockV1::clear
void clear()
Clear all data.
Definition
CpmRoiSubBlockV1.cxx:33
LVL1BS::CpmRoiSubBlockV1::roi
LVL1::CPMRoI roi(int chip, int loc) const
Return RoI for given chip and location (left/right).
Definition
CpmRoiSubBlockV1.cxx:62
LVL1BS::CpmRoiSubBlockV1::s_bunchCrossingBits
static const int s_bunchCrossingBits
Definition
CpmRoiSubBlockV1.h:56
LVL1BS::CpmRoiSubBlockV1::m_roiData
std::vector< LVL1::CPMRoI > m_roiData
RoI words.
Definition
CpmRoiSubBlockV1.h:64
LVL1BS::CpmRoiSubBlockV1::s_wordIdVal
static const int s_wordIdVal
Header word ID.
Definition
CpmRoiSubBlockV1.h:50
LVL1BS::CpmRoiSubBlockV1::fillRoi
void fillRoi(LVL1::CPMRoI roi)
Store RoI.
Definition
CpmRoiSubBlockV1.cxx:49
LVL1BS::CpmRoiSubBlockV1::setRoiHeader
void setRoiHeader(int version, int crate, int module)
Store header.
Definition
CpmRoiSubBlockV1.cxx:41
LVL1BS::CpmRoiSubBlockV1::unpackNeutral
bool unpackNeutral()
Unpack neutral data.
Definition
CpmRoiSubBlockV1.cxx:134
LVL1BS::CpmRoiSubBlockV1::s_locationLen
static const int s_locationLen
Definition
CpmRoiSubBlockV1.h:55
LVL1BS::CpmRoiSubBlockV1::s_hitsLen
static const int s_hitsLen
Definition
CpmRoiSubBlockV1.h:53
LVL1BS::CpmRoiSubBlockV1::CpmRoiSubBlockV1
CpmRoiSubBlockV1()
Definition
CpmRoiSubBlockV1.cxx:23
LVL1BS::CpmRoiSubBlockV1::s_errorLen
static const int s_errorLen
Definition
CpmRoiSubBlockV1.h:54
LVL1BS::CpmRoiSubBlockV1::unpack
bool unpack()
Unpack data.
Definition
CpmRoiSubBlockV1.cxx:90
LVL1BS::CpmRoiSubBlockV1::s_glinkPins
static const int s_glinkPins
Definition
CpmRoiSubBlockV1.h:52
LVL1BS::CpmRoiSubBlockV1::~CpmRoiSubBlockV1
~CpmRoiSubBlockV1()
Definition
CpmRoiSubBlockV1.cxx:27
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::CPMRoI
CPM RoI data.
Definition
Trigger/TrigT1/TrigT1CaloEvent/TrigT1CaloEvent/CPMRoI.h:20
LVL1::CPMRoI::crate
int crate() const
Return crate number (0-1).
Definition
Trigger/TrigT1/TrigT1CaloEvent/TrigT1CaloEvent/CPMRoI.h:81
LVL1::CPMRoI::cpm
int cpm() const
Return CPM number (1-14).
Definition
Trigger/TrigT1/TrigT1CaloEvent/TrigT1CaloEvent/CPMRoI.h:86
LVL1BS
Definition
ZdcModifySlices.h:10
error
Definition
IImpactPoint3dEstimator.h:72
Generated on
for ATLAS Offline Software by
1.17.0