ATLAS Offline Software
Loading...
Searching...
No Matches
L1TopoPhase1ByteStreamTool Class Reference

#include <L1TopoPhase1ByteStreamTool.h>

Inheritance diagram for L1TopoPhase1ByteStreamTool:
Collaboration diagram for L1TopoPhase1ByteStreamTool:

Public Member Functions

 L1TopoPhase1ByteStreamTool (const std::string &type, const std::string &name, const IInterface *parent)
virtual ~L1TopoPhase1ByteStreamTool () override=default
virtual StatusCode initialize () override
virtual StatusCode convertFromBS (const std::vector< const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment * > &vrobf, const EventContext &eventContext) const override
 BS->xAOD conversion.
virtual StatusCode convertToBS (std::vector< OFFLINE_FRAGMENTS_NAMESPACE_WRITE::ROBFragment * > &vrobf, const xAOD::TrigCompositeContainer *tc, const EventContext &eventContext) override
 xAOD->BS conversion
virtual const std::vector< uint32_t > & robIds () const override
 Declare ROB IDs for conversion.

Private Member Functions

StatusCode convert (const ROBF *rob, const std::unique_ptr< xAOD::L1TopoRawDataContainer > &container) const

Private Attributes

Gaudi::Property< std::vector< uint32_t > > m_robIds {this, "ROBIDs", {}, "List of ROB IDs required for conversion to/from xAOD RoI"}
SG::WriteHandleKey< xAOD::L1TopoRawDataContainerm_topoRawWriteKey {this,"L1TopoPhase1RAWDataWriteContainer" ,"L1_Phase1L1TopoRAWData","Write Phase1 L1Topo RAW data"}
SG::ReadHandleKey< xAOD::L1TopoRawDataContainerm_topoRawReadKey {this,"L1TopoPhase1RAWDataReadContainer" ,"L1_Phase1L1TopoRAWData","Read Phase1 L1Topo RAW data"}

Detailed Description

Definition at line 28 of file L1TopoPhase1ByteStreamTool.h.

Constructor & Destructor Documentation

◆ L1TopoPhase1ByteStreamTool()

L1TopoPhase1ByteStreamTool::L1TopoPhase1ByteStreamTool ( const std::string & type,
const std::string & name,
const IInterface * parent )

Definition at line 20 of file L1TopoPhase1ByteStreamTool.cxx.

23 : base_class(type, name, parent) {}

◆ ~L1TopoPhase1ByteStreamTool()

virtual L1TopoPhase1ByteStreamTool::~L1TopoPhase1ByteStreamTool ( )
overridevirtualdefault

Member Function Documentation

◆ convert()

StatusCode L1TopoPhase1ByteStreamTool::convert ( const ROBF * rob,
const std::unique_ptr< xAOD::L1TopoRawDataContainer > & container ) const
private

Definition at line 68 of file L1TopoPhase1ByteStreamTool.cxx.

68 {
69 ATH_MSG_DEBUG("executing convert() from ROBFragment to xAOD::L1TopoRawData");
70
71 uint32_t rodId = rob->rob_source_id();
72
73 ATH_MSG_DEBUG("ROD sub-detector ID: 0x" << MSG::hex << rodId << MSG::dec);
74
75 // First use ROB & ROD error check methods
76 bool error_rob(false);
77 bool error_rod(false);
78 try {
79 if (rob->check_rob()) {
80 ATH_MSG_VERBOSE("ROB fragment checked ok");
81 }
82 } catch (std::exception const& ex) {
83 ATH_MSG_WARNING("ROB fragment not valid: " << ex.what());
84 error_rob = true;
85 }
86 try {
87 if (rob->check_rod()) {
88 ATH_MSG_VERBOSE("ROD fragment checked ok");
89 }
90 } catch (std::exception const& ex) {
91 ATH_MSG_WARNING("ROD fragment not valid: " << ex.what());
92 error_rod = true;
93 }
94
95 // Print some header info
97 MSG::hex << " \n"
98 << " rod_version 0x" << rob->rod_version() << " \n"
99 << " rod_run_no 0x" << MSG::dec
100 << rob->rod_run_no() << " \n"
101 << " rod_lvl1_id 0x" << MSG::hex
102 << rob->rod_lvl1_id() << " \n"
103 << " rod_bc_id 0x" << rob->rod_bc_id() << " \n"
104 << " rod_lvl1_trigger_type 0x" << rob->rod_lvl1_trigger_type()
105 << " \n"
106 << " nchildren 0x" << rob->nchildren() << " \n"
107 << MSG::dec);
108
109 // print and check status words
110 OFFLINE_FRAGMENTS_NAMESPACE::PointerType it_status = rob->rod_status();
111 const uint32_t nstatus = rob->rod_nstatus();
112 ATH_MSG_VERBOSE("Number of status words: " << nstatus);
113 std::vector<uint32_t> vStatusWords;
114 vStatusWords.reserve(nstatus);
115 ATH_MSG_VERBOSE("Dumping ROD status words:");
116 for (uint32_t i = 0; i < nstatus; ++i, ++it_status) {
117 vStatusWords.push_back(static_cast<uint32_t>(*it_status));
118 ATH_MSG_VERBOSE(" 0x" << MSG::hex << std::setfill('0') << std::setw(8)
119 << *it_status << MSG::dec);
120 }
121 // for definition of first status word see:
122 // - bits 00-15: https://edms.cern.ch/document/445840/5.0a section 5.8
123 // - bits 16-31: bits 16-31:
124 // https://twiki.cern.ch/twiki/bin/viewauth/Atlas/ROBINFragmentErrors
125 // Can do something more specific eventually.
126 bool error_status(false);
127 if (vStatusWords.size() == 0) {
128 ATH_MSG_WARNING("ROD has no status word");
129 }
130 if (vStatusWords.size() > 0 && vStatusWords.at(0) != 0) {
131 ATH_MSG_WARNING("Non-zero first status word, payload may not be valid");
132 error_status = true;
133 }
134
135 // print and interpret data words and save them for RDO
136 OFFLINE_FRAGMENTS_NAMESPACE::PointerType it_data = rob->rod_data();
137 const uint32_t ndata = rob->rod_ndata();
138 ATH_MSG_VERBOSE("Number of data words: " << ndata);
139
140 ATH_MSG_VERBOSE("Dumping L1Topo data words:");
141 std::vector<uint32_t> vDataWords;
142 vDataWords.reserve(ndata);
143 for (uint32_t i = 0; i < ndata; ++i, ++it_data) {
144 vDataWords.push_back(static_cast<uint32_t>(*it_data));
145 ATH_MSG_VERBOSE(" 0x" << MSG::hex << std::setfill('0') << std::setw(8)
146 << *it_data << MSG::dec);
147 }
148
149 //Set Error
150 uint32_t error = 0;
151 if (error_status) {
152 error |= (1 << static_cast<unsigned int>(L1Topo::Error::SLINK_STATUS_ERROR));
153 }
154 if (error_rob) {
155 error |= (1 << static_cast<unsigned int>(L1Topo::Error::ROB_ERROR));
156 }
157 if (error_rod) {
158 error |= (1 << static_cast<unsigned int>(L1Topo::Error::ROD_ERROR));
159 }
160
161 // Fill xAOD
162 container->push_back(std::make_unique<xAOD::L1TopoRawData>());
163 container->back()->initialize(vDataWords,vStatusWords,error,rodId);
164
165 return StatusCode::SUCCESS;
166
167}
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
@ SLINK_STATUS_ERROR
Definition Error.h:16
const DataType * PointerType
Definition RawEvent.h:25
const SG::AuxVectorData * container() const
Return the container holding this element.
setEventNumber uint32_t

◆ convertFromBS()

StatusCode L1TopoPhase1ByteStreamTool::convertFromBS ( const std::vector< const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment * > & vrobf,
const EventContext & eventContext ) const
overridevirtual

BS->xAOD conversion.

Definition at line 41 of file L1TopoPhase1ByteStreamTool.cxx.

41 {
42
43 // prepare container
44 auto l1topoContainer = std::make_unique<xAOD::L1TopoRawDataContainer> ();
45 auto l1topoAuxContainer = std::make_unique<xAOD::L1TopoRawDataAuxContainer> ();
46 l1topoContainer->setStore(l1topoAuxContainer.get());
47
48 // Iterate over ROBFragments to decode
49 for (const ROBF* rob : vrobf) {
50 ATH_CHECK( convert(rob, l1topoContainer) );
51 }
52
53 SG::WriteHandle<xAOD::L1TopoRawDataContainer> l1topo_cont(m_topoRawWriteKey, ctx);
54 ATH_CHECK(l1topo_cont.record(std::move(l1topoContainer),std::move(l1topoAuxContainer)));
55 ATH_MSG_DEBUG("Recorded L1TopoRawDataContainer with key " << l1topo_cont.key());
56
57 return StatusCode::SUCCESS;
58}
#define ATH_CHECK
Evaluate an expression and check for errors.
OFFLINE_FRAGMENTS_NAMESPACE_WRITE::ROBFragment ROBF
SG::WriteHandleKey< xAOD::L1TopoRawDataContainer > m_topoRawWriteKey
StatusCode convert(const ROBF *rob, const std::unique_ptr< xAOD::L1TopoRawDataContainer > &container) const

◆ convertToBS()

StatusCode L1TopoPhase1ByteStreamTool::convertToBS ( std::vector< OFFLINE_FRAGMENTS_NAMESPACE_WRITE::ROBFragment * > & vrobf,
const xAOD::TrigCompositeContainer * tc,
const EventContext & eventContext )
overridevirtual

xAOD->BS conversion

Definition at line 62 of file L1TopoPhase1ByteStreamTool.cxx.

64 {
65 return StatusCode::FAILURE;
66}

◆ initialize()

StatusCode L1TopoPhase1ByteStreamTool::initialize ( )
overridevirtual

Definition at line 26 of file L1TopoPhase1ByteStreamTool.cxx.

26 {
27
28 ConversionMode topoRawMode = getConversionMode(m_topoRawReadKey, m_topoRawWriteKey, msg());
29 ATH_CHECK(topoRawMode!=ConversionMode::Undefined);
30 ATH_CHECK(m_topoRawWriteKey.initialize(topoRawMode==ConversionMode::Decoding));
31 ATH_CHECK(m_topoRawReadKey.initialize(topoRawMode==ConversionMode::Encoding));
32 ATH_MSG_DEBUG((topoRawMode==ConversionMode::Encoding ? "Encoding" : "Decoding") << " topoRaw ROB IDs: "
33 << std::hex << std::showbase << m_robIds.value() << std::dec);
34
35
36 return StatusCode::SUCCESS;
37
38}
Gaudi::Property< std::vector< uint32_t > > m_robIds
SG::ReadHandleKey< xAOD::L1TopoRawDataContainer > m_topoRawReadKey
MsgStream & msg
Definition testRead.cxx:32

◆ robIds()

virtual const std::vector< uint32_t > & L1TopoPhase1ByteStreamTool::robIds ( ) const
inlineoverridevirtual

Declare ROB IDs for conversion.

Definition at line 43 of file L1TopoPhase1ByteStreamTool.h.

43 {
44 return m_robIds.value();
45 }

Member Data Documentation

◆ m_robIds

Gaudi::Property<std::vector<uint32_t> > L1TopoPhase1ByteStreamTool::m_robIds {this, "ROBIDs", {}, "List of ROB IDs required for conversion to/from xAOD RoI"}
private

Definition at line 52 of file L1TopoPhase1ByteStreamTool.h.

52{this, "ROBIDs", {}, "List of ROB IDs required for conversion to/from xAOD RoI"};

◆ m_topoRawReadKey

SG::ReadHandleKey< xAOD::L1TopoRawDataContainer > L1TopoPhase1ByteStreamTool::m_topoRawReadKey {this,"L1TopoPhase1RAWDataReadContainer" ,"L1_Phase1L1TopoRAWData","Read Phase1 L1Topo RAW data"}
private

Definition at line 58 of file L1TopoPhase1ByteStreamTool.h.

58{this,"L1TopoPhase1RAWDataReadContainer" ,"L1_Phase1L1TopoRAWData","Read Phase1 L1Topo RAW data"};

◆ m_topoRawWriteKey

SG::WriteHandleKey< xAOD::L1TopoRawDataContainer > L1TopoPhase1ByteStreamTool::m_topoRawWriteKey {this,"L1TopoPhase1RAWDataWriteContainer" ,"L1_Phase1L1TopoRAWData","Write Phase1 L1Topo RAW data"}
private

Definition at line 55 of file L1TopoPhase1ByteStreamTool.h.

55{this,"L1TopoPhase1RAWDataWriteContainer" ,"L1_Phase1L1TopoRAWData","Write Phase1 L1Topo RAW data"};

The documentation for this class was generated from the following files: