135 auto addRob = [&](
const eformat::helper::SourceIdentifier& sid,
const size_t ndata,
const uint32_t*
data){
136 vrobf.push_back(newRobFragment(eventContext, sid.code(), ndata,
data,
m_detEvType));
139 auto convertDataToRob = [&](
const eformat::helper::SourceIdentifier& sid,
const auto& dataVec){
140 uint32_t*
data = newRodData(eventContext, dataVec.size());
142 for (
size_t i=0;
i<dataVec.size(); ++
i) {
143 ATH_MSG_VERBOSE(
" 0x" << MSG::hex << std::setw(8) << dataVec.at(
i).roIWord() << MSG::dec);
144 data[
i] = dataVec.at(
i).roIWord();
146 return addRob(sid, dataVec.size(),
data);
151 const eformat::helper::SourceIdentifier ctpSID{eformat::TDAQ_CTP,
m_ctpModuleID};
152 const std::vector<ROIB::CTPRoI>& ctpDataVec = roibResult->cTPResult().roIVec();
156 rob->rod_minor_version(roibResult->cTPResult().header().formatVersion() & 0xffffu);
164 constexpr
size_t word_size = 32;
165 constexpr
size_t words_per_set = 512 / word_size;
166 constexpr
size_t num_words = 3 * words_per_set;
167 uint32_t* l1bits_data = newRodData(eventContext, num_words);
169 for (
const std::bitset<512>& bset : {tbp,
tap, tav}) {
170 const std::string
sbits = bset.to_string();
171 const size_t iword_output_start = words_per_set * iset;
172 for (
size_t iword_in_set = 0; iword_in_set < words_per_set; ++iword_in_set) {
173 const size_t bword_pos = 512 - (iword_in_set+1) * word_size;
174 std::bitset<word_size> bword{
sbits.substr(bword_pos, word_size)};
175 l1bits_data[iword_output_start + iword_in_set] =
static_cast<uint32_t>(bword.to_ulong());
179 rawEvent->lvl1_trigger_info(num_words, l1bits_data);
188 const eformat::helper::SourceIdentifier muctpiSID{eformat::TDAQ_MUON_CTP_INTERFACE,
m_muCTPIModuleID};
189 const std::vector<ROIB::MuCTPIRoI>& muctpiDataVec = roibResult->muCTPIResult().roIVec();
190 convertDataToRob(muctpiSID, muctpiDataVec);
195 const std::vector<ROIB::JetEnergyResult>& jetEnergyResultVec = roibResult->jetEnergyResult();
196 for (
size_t slink=0; slink<jetEnergyResultVec.size(); ++slink) {
197 const eformat::helper::SourceIdentifier jetSID{eformat::TDAQ_CALO_JET_PROC_ROI,
m_jetModuleID.value().at(slink)};
198 convertDataToRob(jetSID, jetEnergyResultVec.at(slink).roIVec());
204 const std::vector<ROIB::EMTauResult>& emTauResultVec = roibResult->eMTauResult();
205 for (
size_t slink=0; slink<emTauResultVec.size(); ++slink) {
206 const eformat::helper::SourceIdentifier emSID{eformat::TDAQ_CALO_CLUSTER_PROC_ROI,
m_emModuleID.value().at(slink)};
207 convertDataToRob(emSID, emTauResultVec.at(slink).roIVec());
213 const std::vector<ROIB::L1TopoResult>& l1TopoResultVec = roibResult->l1TopoResult();
214 for (
size_t slink=0; slink<l1TopoResultVec.size(); ++slink) {
215 eformat::helper::SourceIdentifier topoSID{l1TopoResultVec.at(slink).rdo().getSourceID()};
218 topoSID = eformat::helper::SourceIdentifier(eformat::TDAQ_CALO_TOPO_PROC,
m_l1TopoModuleID.value().at(slink));
219 ATH_MSG_DEBUG(
"Source ID in L1TopoRDO was zero so using Property for slink " << slink <<
": "
222 else if (topoSID.code() == 0) {
223 topoSID = eformat::helper::SourceIdentifier( eformat::TDAQ_CALO_TOPO_PROC, 0 );
224 ATH_MSG_WARNING(
"Source ID in L1TopoRDO was zero, no properties available for slink counter " << slink
225 <<
", so as a fall back, constructed module 0 with source ID "
228 const std::vector<uint32_t>& dataVec = l1TopoResultVec.at(slink).rdo().getDataWords();
229 uint32_t*
data = newRodData(eventContext, dataVec.size());
230 for (
size_t i=0;
i<dataVec.size(); ++
i) {
231 ATH_MSG_VERBOSE(
" " << MSG::hex << std::setw(8) << std::showbase << dataVec.at(
i) << std::noshowbase << MSG::dec);
234 addRob(topoSID, dataVec.size(),
data);
238 return StatusCode::SUCCESS;