2 Copyright (C) 2002-2025 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(),
95 &(*rod)[0],eformat::STATUS_BACK);
96 theROB->minor_version(m_rob_version);
97 theROB->rod_minor_version(m_rod_version);
98 robMap.emplace(robid, theROB);
104template <class IDMAP>
105void FullEventAssembler<IDMAP>::RobToEvt(ROBMAP& robMap, RawEventWrite* re, MsgStream& log ) const
107 const bool debug = log.level() <= MSG::DEBUG;
108 if(debug) log << MSG::DEBUG << " RobToEvt, number of ROBFrag= " << robMap.size() << endmsg;
110 for(const auto& [robid, theROB] : robMap)
112 if(debug) log << MSG::DEBUG << " RobToEvt: adding ROB "
113 << std::format("{:x}", theROB->source_id()) << endmsg;
117 if(debug) log << MSG::DEBUG << " FullEventFragment is done " << re << endmsg;
121template <class IDMAP>
122FullEventAssembler<IDMAP>::RODMAP::const_iterator
123FullEventAssembler<IDMAP>::begin() const
125 return m_rodMap.begin();
129template <class IDMAP>
130FullEventAssembler<IDMAP>::RODMAP::const_iterator
131FullEventAssembler<IDMAP>::end() const
133 return m_rodMap.end();
137template <class IDMAP>
138void FullEventAssembler<IDMAP>::setRodMinorVersion(uint16_t m )
144template <class IDMAP>
145void FullEventAssembler<IDMAP>::setRobMinorVersion(uint16_t m )
151template <class IDMAP>
152void FullEventAssembler<IDMAP>::setDetEvtType(uint32_t m )
158template <class IDMAP>
159void FullEventAssembler<IDMAP>::setLvl1TriggerType(uint8_t m )
161 m_lvl1_trigger_type = m;
165template <class IDMAP>
166typename FullEventAssembler<IDMAP>::IDMAP_t& FullEventAssembler<IDMAP>::idMap()