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));
35 : base_class(
name, pSvcLocator),
36 m_evtStore (
"StoreGateSvc",
name)
38 declareProperty(
"ByteStreamOutputSvc",
m_ioSvcName);
39 declareProperty(
"UserType",
m_userType =
"RawEvent");
49 const EventContext& ctx = Gaudi::Hive::currentContext();
50 const auto& feaMap =
m_slots.get(ctx)->m_feaMap;
51 const auto& fea = feaMap.find(
name);
52 return fea!=feaMap.end() ? fea->second.get() :
nullptr;
57 const EventContext& ctx = Gaudi::Hive::currentContext();
59 return StatusCode::SUCCESS;
66 return(StatusCode::FAILURE);
76 if (
it == ioSvcNames.end()) {
80 if (!ioSvcNames.empty()) {
82 for (
const std::string&
svcName : ioSvcNames) {
85 SmartIF<IByteStreamOutputSvc> ioSvc{service(
svcName)};
89 std::string bsOutputStreamName;
90 SimpleProperty<std::string> propBSO(
"BSOutputStreamName", bsOutputStreamName);
91 ATH_CHECK(ioSvc.as<IProperty>()->getProperty(&propBSO));
92 bsOutputStreamName = propBSO.value();
97 return(StatusCode::SUCCESS);
111 const EventContext& ctx = Gaudi::Hive::currentContext();
117 uint64_t event = evtInfo->eventNumber();
118 uint32_t run_no = evtInfo->runNumber();
119 uint32_t bc_time_sec = evtInfo->timeStamp();
120 uint32_t bc_time_ns = evtInfo->timeStampNSOffset();
122 uint32_t lvl1_id = evtInfo->extendedLevel1ID();
126 uint8_t lvl1_type = evtInfo->level1TriggerType();
128 uint16_t lumi_block = evtInfo->lumiBlock();
132 eformat::helper::SourceIdentifier sid = eformat::helper::SourceIdentifier(eformat::FULL_SD_EVENT, nevt);
133 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));
136 std::vector<eformat::helper::StreamTag> on_streamTags;
137 for (
const auto& sTag : evtInfo->streamTags()) {
138 on_streamTags.emplace_back(sTag.name(), sTag.type(), sTag.obeysLumiblock(), sTag.robs(), detsOnline(sTag.dets()));
140 uint32_t nStreamTagWords = eformat::helper::size_word(on_streamTags);
143 re->stream_tag(nStreamTagWords, slot.
m_tagBuff.data());
147 return StatusCode::SUCCESS;
152 if (
m_evtStore->retrieve(trigDecision,
"xTrigDecision") != StatusCode::SUCCESS) {
153 ATH_MSG_WARNING(
"Property " <<
m_fillTriggerBits.name() <<
" set to True but failed to retrieve xAOD::TrigDecision. Leaving empty trigger bits in the event header.");
154 return StatusCode::SUCCESS;
158 const std::vector<uint32_t> &tbp = trigDecision->tbp();
159 const std::vector<uint32_t> &
tap = trigDecision->tap();
160 const std::vector<uint32_t> &tav = trigDecision->tav();
161 const size_t l1TotSize = tbp.size() +
tap.size() + tav.size();
174 re->lvl1_trigger_info(l1TotSize, slot.
m_l1Buff.data());
178 const std::vector<uint32_t>& lvl2PP = trigDecision->lvl2PassedPhysics();
179 if (lvl2PP.size() > 0) {
181 re->lvl2_trigger_info(lvl2PP.size(), slot.
m_l2Buff.data());
185 const std::vector<uint32_t>& efPP = trigDecision->efPassedPhysics();
186 if (efPP.size() > 0) {
188 re->event_filter_info(efPP.size(), slot.
m_efBuff.data());
191 return(StatusCode::SUCCESS);
197 const EventContext& ctx = Gaudi::Hive::currentContext();
202 return(StatusCode::FAILURE);
210 std::vector<uint32_t>
buffer (rawSize);
212 if (
count != rawSize) {
214 return(StatusCode::FAILURE);
219 rawEvent.check_tree();
221 ATH_MSG_ERROR(
"commitOutput failed, because FullEventFragment invalid");
222 return(StatusCode::FAILURE);
224 ATH_MSG_DEBUG(
"commitOutput: Size of Event (words) = " << rawEvent.fragment_size_word());
233 if (!itSvc->second->putEvent(&rawEvent)) {
235 return(StatusCode::FAILURE);
240 return(StatusCode::SUCCESS);
247 for (
auto&
p : feaMap) {
258 m_slots->m_rawEventWrite = std::move (rawEventWrite);