ATLAS Offline Software
Loading...
Searching...
No Matches
L1TopoTOB.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 <iostream>
6#include <iomanip>
7#include <bitset>
9#include "L1TopoRDO/Helpers.h"
11
12namespace L1Topo {
13
22 L1TopoTOB::L1TopoTOB(const uint32_t word)
23 : m_word(word){
24 this->decode();
25 }
26
27 bool operator==(const L1Topo::L1TopoTOB& lhs, const L1Topo::L1TopoTOB& rhs){
28 return (lhs.word()==rhs.word());
29 }
30 bool operator!=(const L1Topo::L1TopoTOB& lhs, const L1Topo::L1TopoTOB& rhs){
31 return (lhs.word()!=rhs.word());
32 }
33 bool operator<(const L1Topo::L1TopoTOB& lhs, const L1Topo::L1TopoTOB& rhs){
34 return (lhs.word()<rhs.word());
35 }
36 bool operator>(const L1Topo::L1TopoTOB& lhs, const L1Topo::L1TopoTOB& rhs){
37 return (lhs.word()>rhs.word());
38 }
39
40 /* See https://twiki.cern.ch/twiki/pub/Atlas/L1CaloUpgrade/ROD_data_format_v1.0.8.xlsx */
41
43 // assert (L1Topo::blockType(m_word)==L1Topo::BlockTypes::L1TOPO_TOB);
44 m_trigger_bits = m_word & 0xff;
45 m_overflow_bits = (m_word>>8) & 0xff;
46 m_error_bits = (m_word>>16) & 0x1f;
47 m_ctp_signal = (m_word>>24) & 0xf;
48 return;
49 }
50
52 m_word = static_cast<uint32_t>(L1Topo::BlockTypes::L1TOPO_TOB) << 28;
53 m_word |= (m_trigger_bits & 0xff);
54 m_word |= (m_overflow_bits & 0xff) << 8;
55 m_word |= (m_error_bits & 0x1f) << 16;
56 m_word |= (m_ctp_signal &= 0xf) << 24;
57 return;
58 }
59
60 uint32_t L1TopoTOB::ctp_signal() const{
61 return m_ctp_signal;
62 }
63 uint32_t L1TopoTOB::error_bits() const{
64 return m_error_bits;
65 }
66 bool L1TopoTOB::crc_EM() const{
67 return (m_error_bits & 0x01);
68 }
69 bool L1TopoTOB::crc_Tau() const{
70 return (m_error_bits & 0x02);
71 }
72 bool L1TopoTOB::crc_Muon() const{
73 return (m_error_bits & 0x04);
74 }
75 bool L1TopoTOB::crc_Jet() const{
76 return (m_error_bits & 0x08);
77 }
79 return (m_error_bits & 0x10);
80 }
81 uint32_t L1TopoTOB::overflow_bits() const{
82 return m_overflow_bits;
83 }
84 uint32_t L1TopoTOB::trigger_bits() const{
85 return m_trigger_bits;
86 }
87 uint32_t L1TopoTOB::word() const{
88 return m_word;
89 }
90
91 // CTP index can be unpacked into 3 bits: index, clock and fpga
92 //
93 uint32_t L1TopoTOB::index() const{
94 return m_ctp_signal & 0x1;
95 }
96 uint32_t L1TopoTOB::clock() const{
97 return (m_ctp_signal >> 1) & 0x1;
98 }
99 uint32_t L1TopoTOB::fpga() const{
100 return (m_ctp_signal >> 3) & 0x1;
101 }
102
103 std::ostream& operator<<(std::ostream& os, const L1TopoTOB& c) {
104 os << " L1Topo TOB: "
105 << " ctp_signal 0x" << std::hex << c.ctp_signal() << std::dec
106 << " ( index " << c.index() << " clock " << c.clock() << " fpga " << c.fpga() << " )"
107 << " CRC error bits 0b" << std::bitset<5>(c.error_bits())
108 << " overflow bits 0b" << std::bitset<8>(c.overflow_bits())
109 << " trigger bits 0b" << std::bitset<8>(c.trigger_bits())
110 << std::dec << "\n";
111 return os;
112 }
113
114} // namespace L1Topo
115
Represents the L1Topo TOB word of the L1Topo ROI data, with decode and encoder.
Definition L1TopoTOB.h:17
bool crc_Tau() const
flag true if Tau TOB input links have errors (bit 17)
Definition L1TopoTOB.cxx:69
bool crc_Jet() const
flag true if Jet TOB input links have errors (bit 19)
Definition L1TopoTOB.cxx:75
uint32_t clock() const
clock cycle bit, 0 or 1, part ofthe ctp_signal
Definition L1TopoTOB.cxx:96
uint32_t error_bits() const
access to five bits which flag CRC errors on the input links. They are available as individual flags ...
Definition L1TopoTOB.cxx:63
L1TopoTOB(const uint32_t ctp_signal, uint32_t overflow_bits, uint32_t trigger_bits, uint32_t error_bits)
Construct from contents and encode word.
Definition L1TopoTOB.cxx:14
bool crc_Muon() const
flag true if Muon TOB input links have errors (bit 18)
Definition L1TopoTOB.cxx:72
void encode()
method used by constructor to encode word
Definition L1TopoTOB.cxx:51
uint32_t m_ctp_signal
Definition L1TopoTOB.h:57
uint32_t m_error_bits
Definition L1TopoTOB.h:60
uint32_t m_overflow_bits
Definition L1TopoTOB.h:58
uint32_t overflow_bits() const
accessor method for overflow bits
Definition L1TopoTOB.cxx:81
uint32_t index() const
index bit, 0 or 1, part ofthe ctp_signal
Definition L1TopoTOB.cxx:93
uint32_t m_word
Definition L1TopoTOB.h:61
uint32_t m_trigger_bits
Definition L1TopoTOB.h:59
uint32_t ctp_signal() const
access method for ctp signal bits
Definition L1TopoTOB.cxx:60
uint32_t fpga() const
fpga number bit , 0 or 1, part ofthe ctp_signal
Definition L1TopoTOB.cxx:99
uint32_t word() const
accessor method for data word
Definition L1TopoTOB.cxx:87
uint32_t trigger_bits() const
accessor method for trigger bits
Definition L1TopoTOB.cxx:84
void decode()
method used by constructor to decode word
Definition L1TopoTOB.cxx:42
bool crc_Energy() const
flag true if Energy TOB input links have errors (bit 20)
Definition L1TopoTOB.cxx:78
bool crc_EM() const
flag true if EM TOB input links have errors (bit 16)
Definition L1TopoTOB.cxx:66
bool operator!=(const L1TopoTOB &, const L1TopoTOB &)
Comparison operators, based on word.
Definition L1TopoTOB.cxx:30
bool operator<(const L1TopoTOB &, const L1TopoTOB &)
Comparison operators, based on word.
Definition L1TopoTOB.cxx:33
bool operator>(const L1TopoTOB &, const L1TopoTOB &)
Comparison operators, based on word.
Definition L1TopoTOB.cxx:36
std::ostream & operator<<(std::ostream &, const Error)
Helper to print errors as text rather than numbers.
Definition Error.cxx:8
bool operator==(const L1TopoTOB &, const L1TopoTOB &)
Comparison operators, based on word.
Definition L1TopoTOB.cxx:27