ATLAS Offline Software
Loading...
Searching...
No Matches
L1TopoRDO.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
6
7#include <cstdint>
8#include <vector>
9#include <sstream>
10#include <iomanip>
11#include <string>
12#include "L1TopoRDO/ModuleID.h"
13
14
15const std::vector<uint32_t>& L1TopoRDO::getDataWords () const
16{
17 return m_dataWords;
18}
19
20void L1TopoRDO::setDataWords (std::vector<uint32_t> &&dataWords) noexcept
21{
22 m_dataWords = std::move(dataWords);
23}
24
25const std::vector<uint32_t>& L1TopoRDO::getStatusWords () const
26{
27 return m_statusWords;
28}
29
30void L1TopoRDO::setStatusWords (std::vector<uint32_t> &&statusWords) noexcept
31{
32 m_statusWords = std::move(statusWords);
33}
34
35std::vector<L1Topo::Error> L1TopoRDO::getErrors() const
36{
37 std::vector<L1Topo::Error> errors;
38 // bit of a hack: use the map of error enum to string as a way to iterate over all the errors that are defined
39 for (const auto & it : L1Topo::errorText){
40 auto e = it.first;
41 if (checkError(e)){
42 errors.push_back(e);
43 }
44 }
45 return errors;
46}
47
48
50 return (m_error>>static_cast<unsigned int>(e) & 1);
51}
52
54 m_error |= (1 << static_cast<unsigned int>(e));
55}
56
57uint32_t L1TopoRDO::getSourceID() const
58{
59 return m_sourceID;
60}
61
62void L1TopoRDO::setSourceID(const uint32_t id)
63{
64 m_sourceID=id;
65}
66
68{
69 return L1Topo::ModuleID(static_cast<uint16_t>(m_sourceID)).isDAQ();
70}
71
73{
74 return L1Topo::ModuleID(static_cast<uint16_t>(m_sourceID)).isROI();
75}
76
77const std::string L1TopoRDO::dump() const
78{
79 std::ostringstream s;
80 s << " ";
81 for (auto & word: m_dataWords){
82 s << std::hex << std::showbase << std::setfill('0') << std::setw(8)
83 << word << " " << std::dec << std::noshowbase;
84 }
85 return s.str();
86}
87
void setError(L1Topo::Error)
set a flag to record an error
Definition L1TopoRDO.cxx:53
bool checkError(L1Topo::Error) const
check if a certain error flag has been set
Definition L1TopoRDO.cxx:49
void setStatusWords(std::vector< uint32_t > &&) noexcept
set the status words
Definition L1TopoRDO.cxx:30
std::vector< L1Topo::Error > getErrors() const
get a vector of Errors found during RAW to RDO conversion; see enum and
Definition L1TopoRDO.cxx:35
bool isDAQModule() const
check the module type, derived from the source ID and the L1Topo module
Definition L1TopoRDO.cxx:67
uint32_t getSourceID() const
get the source identifier, i.e. the word representing the subdet type and
Definition L1TopoRDO.cxx:57
const std::string dump() const
terse printout method used by RoIBResult
Definition L1TopoRDO.cxx:77
void setDataWords(std::vector< uint32_t > &&) noexcept
set the data words
Definition L1TopoRDO.cxx:20
uint32_t m_sourceID
Definition L1TopoRDO.h:79
const std::vector< uint32_t > & getStatusWords() const
get the status words
Definition L1TopoRDO.cxx:25
void setSourceID(const uint32_t)
set the source identifier
Definition L1TopoRDO.cxx:62
std::vector< uint32_t > m_dataWords
Definition L1TopoRDO.h:75
uint32_t m_error
Definition L1TopoRDO.h:78
bool isROIModule() const
check the module type, derived from the source ID and the L1Topo module
Definition L1TopoRDO.cxx:72
const std::vector< uint32_t > & getDataWords() const
get the data words
Definition L1TopoRDO.cxx:15
std::vector< uint32_t > m_statusWords
Definition L1TopoRDO.h:76
Represents the L1Topo module ID, with decoder and encoder.
Definition ModuleID.h:28
bool isROI() const
True if this is a ROI module.
Definition ModuleID.cxx:29
bool isDAQ() const
True if this is a DAQ module.
Definition ModuleID.cxx:25
static const std::map< Error, std::string > errorText
Define the text to print for each error type above - bad design to put it in the header file?
Definition Error.h:18
Error
The different types of error that can be flagged in the L1TopoRDO.
Definition Error.h:16