ATLAS Offline Software
Trigger
TrigT1
L1Topo
L1TopoRDO
src
L1Topo/L1TopoRDO/src/Header.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 "
L1TopoRDO/Header.h
"
6
#include "
L1TopoRDO/BlockTypes.h
"
7
#include "
L1TopoRDO/Helpers.h
"
8
//#include <cassert>
9
10
namespace
L1Topo
{
11
12
Header::Header
(
const
uint32_t
version
,
const
uint32_t
active_fibres,
const
uint32_t
payload_crc,
const
uint32_t
fpga,
const
uint32_t
last_block,
const
uint32_t
bcn_sign,
const
uint32_t
bcn_offset)
13
:m_version(
version
), m_active_fibres(active_fibres), m_payload_crc(payload_crc), m_fpga(fpga),
14
m_last_block(last_block), m_bcn_sign(bcn_sign), m_bcn_offset(bcn_offset), m_bcn(0), m_word(0) {
15
this->
encode
();
16
m_bcn
=
signedBCN
(
m_bcn_sign
,
m_bcn_offset
);
17
}
18
19
Header::Header
(
const
uint32_t
word)
20
: m_word(word){
21
this->
decode
();
22
m_bcn
=
signedBCN
(
m_bcn_sign
,
m_bcn_offset
);
23
}
24
25
/* See https://twiki.cern.ch/twiki/pub/Atlas/L1CaloUpgrade/ROD_data_format_v1.0.9.xlsx */
26
27
void
Header::decode
(){
28
// assert (L1Topo::blockType(m_word)==L1Topo::BlockTypes::HEADER);
29
m_bcn_offset
=
m_word
& 0x7;
30
m_bcn_sign
= (
m_word
>>3) & 0
x1
;
31
m_last_block
= (
m_word
>>4) & 0
x1
;
32
m_fpga
= (
m_word
>> 5 ) & 0
x1
;
33
m_payload_crc
= (
m_word
>>8) & 0xff;
34
m_active_fibres
= (
m_word
>>16) & 0xff;
35
m_version
= (
m_word
>>24) & 0xf;
36
return
;
37
}
38
39
void
Header::encode
(){
40
m_word
=
static_cast<
uint32_t
>
(
L1Topo::BlockTypes::HEADER
) << 28;
41
m_word
|= (
m_bcn_offset
& 0x7);
42
m_word
|= (
m_bcn_sign
& 0x1) << 3;
43
m_word
|= (
m_last_block
& 0x1) << 4;
44
m_word
|= (
m_fpga
& 0x1) << 5;
45
m_word
|= (
m_payload_crc
& 0xff) << 8;
46
m_word
|= (
m_active_fibres
& 0xff) << 16;
47
m_word
|= (
m_version
& 0xf) << 24;
48
return
;
49
}
50
51
uint32_t
Header::version
()
const
{
52
return
m_version
;
53
}
54
uint32_t
Header::active_fibres
()
const
{
55
return
m_active_fibres
;
56
}
57
uint32_t
Header::payload_crc
()
const
{
58
return
m_payload_crc
;
59
}
60
uint32_t
Header::fpga
()
const
{
61
return
m_fpga
;
62
}
63
uint32_t
Header::last_block
()
const
{
64
return
m_last_block
;
65
}
66
uint32_t
Header::bcn_sign
()
const
{
67
return
m_bcn_sign
;
68
}
69
uint32_t
Header::bcn_offset
()
const
{
70
return
m_bcn_offset
;
71
}
72
int
Header::bcn
()
const
{
73
return
m_bcn
;
74
}
75
uint32_t
Header::word
()
const
{
76
return
m_word
;
77
}
78
79
int
signedBCN
(
const
uint32_t
sign
,
uint32_t
offset
){
80
return
static_cast<
int
>
(
offset
) * (
sign
>0 ? -1 : 1);
// sign=0 is false
81
}
82
83
std::pair<uint32_t,uint32_t>
signAndOffsetBCN
(
const
int
bcn){
84
uint32_t
offset
= std::abs(bcn);
85
uint32_t
sign
= (bcn<0)?1:0;
// negative bcn encoded as 1
86
return
std::pair<uint32_t,uint32_t>(
sign
,
offset
);
87
}
88
89
std::ostream&
operator<<
(std::ostream&
os
,
const
Header
&
h
) {
90
os
<<
" Block header:"
91
<<
" version "
<<
h
.version()
92
<< std::hex
93
<<
" active_fibres 0x"
<<
h
.active_fibres()
94
<<
" payload_crc 0x"
<<
h
.payload_crc()
95
<< std::dec
96
<<
" fpga "
<<
h
.fpga()
97
<<
" relative bcn "
<<
h
.bcn()
98
<<
" last_block "
<<
h
.last_block();
99
return
os
;
100
}
101
102
}
// namespace L1Topo
103
L1Topo::Header::active_fibres
uint32_t active_fibres() const
access method
Definition:
L1Topo/L1TopoRDO/src/Header.cxx:54
plotBeamSpotCompare.x1
x1
Definition:
plotBeamSpotCompare.py:216
L1Topo::signAndOffsetBCN
std::pair< uint32_t, uint32_t > signAndOffsetBCN(const int bcn)
reverse helper function to return the sign and offset bits given a relative bunch crossing number
Definition:
L1Topo/L1TopoRDO/src/Header.cxx:83
L1Topo::operator<<
std::ostream & operator<<(std::ostream &, const Error)
Helper to print errors as text rather than numbers.
Definition:
Error.cxx:8
L1Topo::Header::m_bcn_offset
uint32_t m_bcn_offset
Definition:
L1Topo/L1TopoRDO/L1TopoRDO/Header.h:54
L1Topo::Header::m_bcn_sign
uint32_t m_bcn_sign
Definition:
L1Topo/L1TopoRDO/L1TopoRDO/Header.h:53
xAOD::uint32_t
setEventNumber uint32_t
Definition:
EventInfo_v1.cxx:127
L1Topo::Header::bcn_sign
uint32_t bcn_sign() const
access method
Definition:
L1Topo/L1TopoRDO/src/Header.cxx:66
L1Topo::Header::m_active_fibres
uint32_t m_active_fibres
Definition:
L1Topo/L1TopoRDO/L1TopoRDO/Header.h:49
BlockTypes.h
L1Topo::Header::fpga
uint32_t fpga() const
access method
Definition:
L1Topo/L1TopoRDO/src/Header.cxx:60
L1Topo::Header::m_last_block
uint32_t m_last_block
Definition:
L1Topo/L1TopoRDO/L1TopoRDO/Header.h:52
L1Topo::Header
Represents the L1Topo header word of the L1Topo DAQ data, with decoder and encoder.
Definition:
L1Topo/L1TopoRDO/L1TopoRDO/Header.h:18
Header.h
L1Topo::Header::bcn
int bcn() const
access method
Definition:
L1Topo/L1TopoRDO/src/Header.cxx:72
L1Topo::Header::m_word
uint32_t m_word
Definition:
L1Topo/L1TopoRDO/L1TopoRDO/Header.h:56
sign
int sign(int a)
Definition:
TRT_StrawNeighbourSvc.h:107
L1Topo::Header::encode
void encode()
method used by constructor to encode word
Definition:
L1Topo/L1TopoRDO/src/Header.cxx:39
L1Topo::Header::m_fpga
uint32_t m_fpga
Definition:
L1Topo/L1TopoRDO/L1TopoRDO/Header.h:51
L1Topo::Header::Header
Header(const uint32_t version, const uint32_t active_fibres, const uint32_t payload_crc, const uint32_t fpga, const uint32_t last_block, const uint32_t bcn_sign, const uint32_t bcn_offset)
Construct from contents and encode word.
Definition:
L1Topo/L1TopoRDO/src/Header.cxx:12
L1Topo::Header::version
uint32_t version() const
access method
Definition:
L1Topo/L1TopoRDO/src/Header.cxx:51
ReadFromCoolCompare.os
os
Definition:
ReadFromCoolCompare.py:231
L1Topo::Header::decode
void decode()
method used by constructor to decode word
Definition:
L1Topo/L1TopoRDO/src/Header.cxx:27
L1Topo::Header::word
uint32_t word() const
access method
Definition:
L1Topo/L1TopoRDO/src/Header.cxx:75
get_generator_info.version
version
Definition:
get_generator_info.py:33
h
L1Topo::Header::last_block
uint32_t last_block() const
access method
Definition:
L1Topo/L1TopoRDO/src/Header.cxx:63
L1Topo::BlockTypes::HEADER
@ HEADER
convertTimingResiduals.offset
offset
Definition:
convertTimingResiduals.py:71
L1Topo::Header::m_payload_crc
uint32_t m_payload_crc
Definition:
L1Topo/L1TopoRDO/L1TopoRDO/Header.h:50
L1Topo
Definition:
BlockTypes.h:11
L1Topo::Header::payload_crc
uint32_t payload_crc() const
access method
Definition:
L1Topo/L1TopoRDO/src/Header.cxx:57
Helpers.h
L1Topo::Header::m_bcn
int m_bcn
Definition:
L1Topo/L1TopoRDO/L1TopoRDO/Header.h:55
L1Topo::signedBCN
int signedBCN(const uint32_t sign, uint32_t offset)
helper function to return a relative bunch crossing as a signed integer, given the sign bit and offse...
Definition:
L1Topo/L1TopoRDO/src/Header.cxx:79
L1Topo::Header::bcn_offset
uint32_t bcn_offset() const
access method
Definition:
L1Topo/L1TopoRDO/src/Header.cxx:69
L1Topo::Header::m_version
uint32_t m_version
Definition:
L1Topo/L1TopoRDO/L1TopoRDO/Header.h:48
Generated on Thu Nov 7 2024 21:16:06 for ATLAS Offline Software by
1.8.18