2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
5#include "GaudiKernel/MsgStream.h"
6#include "eformat/Status.h"
12FullEventAssembler<IDMAP>::FullEventAssembler():
18 m_lvl1_trigger_type(0),
25FullEventAssembler<IDMAP>::~FullEventAssembler()
32void FullEventAssembler<IDMAP>::clear()
35 for(const auto& [id, rod] : m_rodMap) delete rod;
38 for(const auto& [id, rob] : m_robMap) delete rob;
44void FullEventAssembler<IDMAP>::fill(RawEventWrite* re, MsgStream& log )
46 m_runnum = re->run_no() ;
47 m_lvl1_id = re->lvl1_id();
48 m_lvl1_trigger_type = re->lvl1_trigger_type();
52 RodToRob(m_rodMap,m_robMap,log);
53 // ROB to FullEventFragment
54 RobToEvt(m_robMap,re,log);
59typename FullEventAssembler<IDMAP>::RODDATA*
60FullEventAssembler<IDMAP>::getRodData(uint32_t id)
62 if (auto itr = m_rodMap.find(id); itr != m_rodMap.end()) {
66 auto* theROD = new RODDATA();
67 m_rodMap.emplace(id, theROD);
74FullEventAssembler<IDMAP>::RodToRob(RODMAP& rodMap,
75 ROBMAP& robMap, MsgStream& log ) const
77 // loop over all the RODs
78 for(const auto& [rodid, rod] : rodMap)
80 if(log.level() <= MSG::DEBUG)
81 log << MSG::DEBUG << " Rod id = " << std::format("{:x}", rodid) << endmsg;
83 // make an ROB id from an ROD id.
84 const uint32_t robid = m_idmap.getRobID(rodid);
86 // find or make a ROS fragment
87 if (robMap.contains(robid))
89 log << MSG::ERROR << " More than one ROD in ROB:" << std::format("{:x}", robid) << endmsg;
92 { // Make a new ROBFragment
93 auto theROB = new OFFLINE_FRAGMENTS_NAMESPACE_WRITE::ROBFragment(robid,m_runnum,m_lvl1_id,m_bcid,
94 m_lvl1_trigger_type,m_detEvtType,rod->size(),
96 eformat::STATUS_BACK);
97 theROB->minor_version(m_rob_version);
98 theROB->rod_minor_version(m_rod_version);
99 robMap.emplace(robid, theROB);
105template <class IDMAP>
106void FullEventAssembler<IDMAP>::RobToEvt(ROBMAP& robMap, RawEventWrite* re, MsgStream& log ) const
108 const bool debug = log.level() <= MSG::DEBUG;
109 if(debug) log << MSG::DEBUG << " RobToEvt, number of ROBFrag= " << robMap.size() << endmsg;
111 for(const auto& [robid, theROB] : robMap)
113 if(debug) log << MSG::DEBUG << " RobToEvt: adding ROB "
114 << std::format("{:x}", theROB->source_id()) << endmsg;
118 if(debug) log << MSG::DEBUG << " FullEventFragment is done " << re << endmsg;
122template <class IDMAP>
123FullEventAssembler<IDMAP>::RODMAP::const_iterator
124FullEventAssembler<IDMAP>::begin() const
126 return m_rodMap.begin();
130template <class IDMAP>
131FullEventAssembler<IDMAP>::RODMAP::const_iterator
132FullEventAssembler<IDMAP>::end() const
134 return m_rodMap.end();
138template <class IDMAP>
139void FullEventAssembler<IDMAP>::setRodMinorVersion(uint16_t m )
145template <class IDMAP>
146void FullEventAssembler<IDMAP>::setRobMinorVersion(uint16_t m )
152template <class IDMAP>
153void FullEventAssembler<IDMAP>::setDetEvtType(uint32_t m )
159template <class IDMAP>
160void FullEventAssembler<IDMAP>::setLvl1TriggerType(uint8_t m )
162 m_lvl1_trigger_type = m;
166template <class IDMAP>
167typename FullEventAssembler<IDMAP>::IDMAP_t& FullEventAssembler<IDMAP>::idMap()