14 #include "eformat/SourceIdentifier.h"
15 #include "eformat/StreamTag.h"
17 #include "GaudiKernel/IClassIDSvc.h"
25 std::set<eformat::SubDetector> detsOnline(
const std::set<uint32_t>& detsOffline) {
26 std::set<eformat::SubDetector>
out;
27 for (
const uint32_t detid : detsOffline)
28 out.insert(
static_cast<eformat::SubDetector
>(detid));
36 m_evtStore (
"StoreGateSvc",
name)
51 return(StatusCode::FAILURE);
61 if (
it == ioSvcNames.end()) {
65 if (ioSvcNames.size() != 0) {
68 itSvc != itSvcE; ++itSvc) {
72 if (!service(*itSvc,
svc).isSuccess()) {
74 return(StatusCode::FAILURE);
79 return(StatusCode::FAILURE);
82 std::string bsOutputStreamName;
83 SimpleProperty<std::string> propBSO(
"BSOutputStreamName", bsOutputStreamName);
84 if (!ioSvc->getProperty(&propBSO).isSuccess()) {
85 ATH_MSG_FATAL(
"Cannot get BSOutputStreamName from " << *itSvc);
86 return(StatusCode::FAILURE);
88 bsOutputStreamName = propBSO.value();
93 return(StatusCode::SUCCESS);
107 const EventContext& ctx = Gaudi::Hive::currentContext();
113 uint64_t event = evtInfo->eventNumber();
114 uint32_t run_no = evtInfo->runNumber();
115 uint32_t bc_time_sec = evtInfo->timeStamp();
116 uint32_t bc_time_ns = evtInfo->timeStampNSOffset();
118 uint32_t lvl1_id = evtInfo->extendedLevel1ID();
122 uint8_t lvl1_type = evtInfo->level1TriggerType();
124 uint16_t lumi_block = evtInfo->lumiBlock();
128 eformat::helper::SourceIdentifier sid = eformat::helper::SourceIdentifier(eformat::FULL_SD_EVENT, nevt);
129 RawEventWrite*
re =
setRawEvent (std::make_unique<RawEventWrite>(sid.code(), bc_time_sec, bc_time_ns, global_id,
run_type, run_no, lumi_block, lvl1_id, bc_id, lvl1_type));
132 std::vector<eformat::helper::StreamTag> on_streamTags;
133 for (
const auto& sTag : evtInfo->streamTags()) {
134 on_streamTags.emplace_back(sTag.name(), sTag.type(), sTag.obeysLumiblock(), sTag.robs(), detsOnline(sTag.dets()));
136 uint32_t nStreamTagWords = eformat::helper::size_word(on_streamTags);
139 re->stream_tag(nStreamTagWords, slot.
m_tagBuff.data());
143 return StatusCode::SUCCESS;
148 if (
m_evtStore->retrieve(trigDecision,
"xTrigDecision") != StatusCode::SUCCESS) {
149 ATH_MSG_WARNING(
"Property " <<
m_fillTriggerBits.name() <<
" set to True but failed to retrieve xAOD::TrigDecision. Leaving empty trigger bits in the event header.");
150 return StatusCode::SUCCESS;
154 const std::vector<uint32_t> &tbp = trigDecision->tbp();
155 const std::vector<uint32_t> &
tap = trigDecision->tap();
156 const std::vector<uint32_t> &tav = trigDecision->tav();
157 const size_t l1TotSize = tbp.size() +
tap.size() + tav.size();
170 re->lvl1_trigger_info(l1TotSize, slot.
m_l1Buff.data());
174 const std::vector<uint32_t>& lvl2PP = trigDecision->lvl2PassedPhysics();
175 if (lvl2PP.size() > 0) {
177 re->lvl2_trigger_info(lvl2PP.size(), slot.
m_l2Buff.data());
181 const std::vector<uint32_t>& efPP = trigDecision->efPassedPhysics();
182 if (efPP.size() > 0) {
184 re->event_filter_info(efPP.size(), slot.
m_efBuff.data());
187 return(StatusCode::SUCCESS);
193 const EventContext& ctx = Gaudi::Hive::currentContext();
198 return(StatusCode::FAILURE);
206 std::vector<uint32_t>
buffer (rawSize);
208 if (
count != rawSize) {
210 return(StatusCode::FAILURE);
215 rawEvent.check_tree();
217 ATH_MSG_ERROR(
"commitOutput failed, because FullEventFragment invalid");
218 return(StatusCode::FAILURE);
220 ATH_MSG_DEBUG(
"commitOutput: Size of Event (words) = " << rawEvent.fragment_size_word());
229 if (!itSvc->second->putEvent(&rawEvent)) {
231 return(StatusCode::FAILURE);
236 return(StatusCode::SUCCESS);
243 for (
auto&
p : feaMap) {
261 return StatusCode::SUCCESS;
267 static const InterfaceID IDByteStreamCnvSvc(
"ByteStreamCnvSvc", 1, 0);
268 return IDByteStreamCnvSvc;
276 m_slots->m_rawEventWrite = std::move (rawEventWrite);