ATLAS Offline Software
Public Member Functions | Private Member Functions | Private Attributes | List of all members
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. More...
 
virtual StatusCode convertToBS (std::vector< OFFLINE_FRAGMENTS_NAMESPACE_WRITE::ROBFragment * > &vrobf, const EventContext &eventContext) override
 xAOD->BS conversion More...
 
virtual const std::vector< uint32_t > & robIds () const override
 Declare ROB IDs for conversion. More...
 

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 66 of file L1TopoPhase1ByteStreamTool.cxx.

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

◆ 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 
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 }

◆ convertToBS()

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

xAOD->BS conversion

Definition at line 62 of file L1TopoPhase1ByteStreamTool.cxx.

62  {
63  return StatusCode::FAILURE;
64 }

◆ initialize()

StatusCode L1TopoPhase1ByteStreamTool::initialize ( )
overridevirtual

Definition at line 26 of file L1TopoPhase1ByteStreamTool.cxx.

26  {
27 
28  ConversionMode topoRawMode = getConversionMode(m_topoRawReadKey, m_topoRawWriteKey, msg());
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 }

◆ robIds()

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

Declare ROB IDs for conversion.

Definition at line 41 of file L1TopoPhase1ByteStreamTool.h.

41  {
42  return m_robIds.value();
43  }

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 50 of file L1TopoPhase1ByteStreamTool.h.

◆ m_topoRawReadKey

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

Definition at line 56 of file L1TopoPhase1ByteStreamTool.h.

◆ m_topoRawWriteKey

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

Definition at line 53 of file L1TopoPhase1ByteStreamTool.h.


The documentation for this class was generated from the following files:
L1TopoPhase1ByteStreamTool::convert
StatusCode convert(const ROBF *rob, const std::unique_ptr< xAOD::L1TopoRawDataContainer > &container) const
Definition: L1TopoPhase1ByteStreamTool.cxx:66
L1TopoPhase1ByteStreamTool::m_topoRawWriteKey
SG::WriteHandleKey< xAOD::L1TopoRawDataContainer > m_topoRawWriteKey
Definition: L1TopoPhase1ByteStreamTool.h:53
Undefined
@ Undefined
Definition: MaterialTypes.h:8
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
PixelByteStreamErrors::Decoding
@ Decoding
Definition: PixelByteStreamErrors.h:14
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
ROBF
OFFLINE_FRAGMENTS_NAMESPACE_WRITE::ROBFragment ROBF
Definition: ByteStreamMergeOutputSvc.cxx:16
OFFLINE_FRAGMENTS_NAMESPACE::PointerType
const DataType * PointerType
Definition: RawEvent.h:25
lumiFormat.i
int i
Definition: lumiFormat.py:92
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
calibdata.exception
exception
Definition: calibdata.py:496
test_pyathena.parent
parent
Definition: test_pyathena.py:15
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
L1Topo::Error::ROD_ERROR
@ ROD_ERROR
L1Topo::Error::SLINK_STATUS_ERROR
@ SLINK_STATUS_ERROR
DataVector::back
const T * back() const
Access the last element in the collection as an rvalue.
L1TopoPhase1ByteStreamTool::m_robIds
Gaudi::Property< std::vector< uint32_t > > m_robIds
Definition: L1TopoPhase1ByteStreamTool.h:50
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
DataVector::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:76
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
L1Topo::Error::ROB_ERROR
@ ROB_ERROR
error
Definition: IImpactPoint3dEstimator.h:70
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7
L1TopoPhase1ByteStreamTool::m_topoRawReadKey
SG::ReadHandleKey< xAOD::L1TopoRawDataContainer > m_topoRawReadKey
Definition: L1TopoPhase1ByteStreamTool.h:56