47 {
48
49
50
51
52 const eformat::helper::SourceIdentifier sid(
m_robIds.value().at(0));
53 auto it = std::find_if(vrobf.begin(), vrobf.end(), [&sid](
const ROBF* rob){return rob->rob_source_id() == sid.code();});
54 if (it == vrobf.end()) {
55 ATH_MSG_ERROR(
"No CTP ROB fragment with ID 0x" << std::hex << sid.code() << std::dec <<
" was found!");
56 return StatusCode::FAILURE;
57 }
58 ATH_MSG_VERBOSE(
"Found CTP ROD with source ID 0x" << MSG::hex << sid.code() << MSG::dec);
59
60
61
62
65 rob->rod_data( it_data );
66 const uint32_t ndata = rob->rod_ndata();
67
68
69
70
71 uint32_t headerMarker = eformat::ROD;
72 uint32_t formatVersion = rob->rod_version();
74 uint32_t sourceID = rob->rod_source_id();
75
76
77
78
81 dataStatus.rod_error = false;
82 dataStatus.status_word = 0;
83 dataStatus.status_info = 0;
84
85 try {
87 }
88 catch (std::exception const & ex) {
90 dataStatus.rob_error = true;
91 }
92
93 try {
95 }
96 catch (std::exception const & ex) {
98 dataStatus.rod_error = true;
99 }
100
101
103 rob->rod_status(status);
104 uint32_t nstatus = rob->rod_nstatus();
105 if (msgLvl(MSG::VERBOSE)) {
107 for (uint32_t i=0;
i<nstatus; ++
i, ++
status) {
108 ATH_MSG_VERBOSE(
" Status word: 0x" << MSG::hex << std::setw(8) << std::setfill(
'0') << *status);
109 }
110 }
111 rob->rod_status(status);
112
113 if(nstatus > 0) dataStatus.status_word =
static_cast<uint32_t>(*status);
114 if(nstatus > 1) {
116 dataStatus.status_info =
static_cast<uint32_t>(*status);
117 }
118
119 uint32_t errStatus = dataStatus.status_word;
120 uint32_t statInfo = dataStatus.status_info;
121
122
123
124
125 std::vector<uint32_t> vDataWords;
126 vDataWords.reserve(ndata);
127 if (msgLvl(MSG::VERBOSE)) {
130 ATH_MSG_VERBOSE(
" 0x" << MSG::hex << std::setfill(
'0') << std::setw(8) << word << MSG::dec);
131 }
132 }
134
136 nExtraWords=CTPfragment::numberExtraPayloadWords(rob);
137 unsigned int ctpVersionNumber = CTPfragment::ctpFormatVersion(rob);
138
139
140
141
142 auto result = std::make_unique<xAOD::CTPResult>();
143 auto resultAux = std::make_unique<xAOD::CTPResultAuxInfo>();
144 result->setStore(resultAux.get());
145
146
148
149
150 result->setHeader(headerMarker, formatVersion, sourceID, L1ID);
151 result->setTrailer(ndata, errStatus, statInfo);
152 result->setL1AcceptBunchPosition(CTPfragment::lvl1AcceptBunch(rob));
153 result->setTurnCounter(CTPfragment::turnCounter(rob));
154
155
157 ATH_CHECK( ctpResultWriteHandle.
record( std::move(result), std::move(resultAux) ));
159
160 return StatusCode::SUCCESS;
161}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
OFFLINE_FRAGMENTS_NAMESPACE_WRITE::ROBFragment ROBF
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
void initialize(xAOD::CTPResult &ctpRes, const uint32_t ctpVersionNumber, std::vector< uint32_t > &data, const uint32_t nExtraWords)
Initialize the object using xAOD::Header, xAOD::Trailer, and the payload data.
span(T *ptr, std::size_t sz) -> span< T >
A couple needed deduction guides.
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())