ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigT1
L1Topo
L1TopoRDO
src
Fibre.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
6
#include <iostream>
7
#include "
L1TopoRDO/Fibre.h
"
8
#include "
L1TopoRDO/Helpers.h
"
9
#include "
L1TopoRDO/BlockTypes.h
"
10
11
namespace
L1Topo
{
12
13
Fibre::Fibre
(std::vector<uint32_t> &&
status
, std::vector<uint32_t> &&
count
)
14
:
m_status
(
std
::move(
status
)),
m_count
(
std
::move(
count
)),
m_word
(0) {
15
this->
encode
();
16
}
17
18
Fibre::Fibre
(
const
uint32_t
word
)
19
:
m_status
(5,0),
m_count
(5,0),
m_word
(
word
) {
20
this->
decode
();
21
}
22
23
// assume the vectors are correctly ordered - no way to know what they mean nor what order they should be in
24
// will read vector from left to right and pack word left to right, unusually.
25
void
Fibre::encode
(){
26
m_word
=
static_cast<
uint32_t
>
(
L1Topo::BlockTypes::FIBRE
) << 28;
27
// assert(status.size()<=5);
28
// assert(status.size()==count.size());
29
for
(
unsigned
int
i=0; i<5 && i<
m_status
.size() && i<
m_count
.size(); ++i){
30
// assert(m_count.at(i)<0x10); // should not exceed 4 bits
31
uint32_t fibre = (
m_status
.at(i) & 0x1) << 4 | (
m_count
.at(i) & 0xf) ;
32
m_word
|= (fibre << (((4-i)*5)+3) );
33
}
34
}
35
36
void
Fibre::decode
(){
37
for
(
unsigned
int
i=0; i<5; ++i){
38
uint32_t fibre =
m_word
>> (((4-i)*5)+3) & 0x1f;
39
m_status
.at(i) = (fibre >> 4) & 0x1;
40
m_count
.at(i) = fibre & 0xf;
41
}
42
}
43
44
uint32_t
Fibre::word
()
const
{
45
return
m_word
;
46
}
47
48
const
std::vector<uint32_t>&
Fibre::status
()
const
{
49
return
m_status
;
50
}
51
52
const
std::vector<uint32_t>&
Fibre::count
()
const
{
53
return
m_count
;
54
}
55
56
std::ostream&
operator<<
(std::ostream& os,
const
Fibre
& f) {
57
58
os <<
" Fibre status,sizes: "
;
59
for
(
unsigned
int
i=0; i<5 && i<f.status().
size
() && i<f.count().size(); ++i){
60
os <<
"("
<< f.status().at(i) <<
","
<< f.count().at(i) <<
") "
;
61
}
62
return
os;
63
}
64
65
66
}
// namespace L1Topo
67
BlockTypes.h
Fibre.h
size
size_t size() const
Number of registered mappings.
Helpers.h
L1Topo::Fibre
Represents the L1Topo fibre word of the L1Topo DAQ header, with decoder and encoder.
Definition
Fibre.h:22
L1Topo::Fibre::Fibre
Fibre(std::vector< uint32_t > &&status, std::vector< uint32_t > &&count)
Construct from contents and encode word: vectors of up to 5 status flags and sizes....
Definition
Fibre.cxx:13
L1Topo::Fibre::encode
void encode()
method used by constructor to encode word
Definition
Fibre.cxx:25
L1Topo::Fibre::m_status
std::vector< uint32_t > m_status
fibre status
Definition
Fibre.h:41
L1Topo::Fibre::m_word
uint32_t m_word
The raw data representation.
Definition
Fibre.h:45
L1Topo::Fibre::status
const std::vector< uint32_t > & status() const
access method
Definition
Fibre.cxx:48
L1Topo::Fibre::word
uint32_t word() const
access method
Definition
Fibre.cxx:44
L1Topo::Fibre::m_count
std::vector< uint32_t > m_count
fibre counts
Definition
Fibre.h:43
L1Topo::Fibre::count
const std::vector< uint32_t > & count() const
access method
Definition
Fibre.cxx:52
L1Topo::Fibre::decode
void decode()
method used by constructor to decode word
Definition
Fibre.cxx:36
L1Topo
Definition
BlockTypes.h:11
L1Topo::BlockTypes::FIBRE
@ FIBRE
Definition
BlockTypes.h:16
L1Topo::operator<<
std::ostream & operator<<(std::ostream &, const Error)
Helper to print errors as text rather than numbers.
Definition
Error.cxx:8
std
STL namespace.
Generated on
for ATLAS Offline Software by
1.17.0