84#include "eformat/Status.h"
88 : base_class(name, svcloc) {}
98 if (tmpsrc.human_detector() !=
"UNKNOWN") {
104 if (tmpsrc.human_detector() !=
"UNKNOWN") {
111 eformat::helper::SourceIdentifier tmpsrc(p.first);
112 ATH_MSG_INFO(
" RobId=0x" << MSG::hex << p.first <<
" -> in Sub Det = " << tmpsrc.human_detector());
113 for (uint32_t status : p.second) {
114 eformat::helper::Status tmpstatus(status);
116 << MSG::hex << std::setfill(
'0' ) << std::setw(8) << tmpstatus.code()
117 <<
" Generic Part=0x" << std::setw(4) << tmpstatus.generic()
118 <<
" Specific Part=0x" << std::setw(4) << tmpstatus.specific());
124 eformat::helper::SourceIdentifier tmpsrc(p.first, 0);
125 ATH_MSG_INFO(
" SubDetId=0x" << MSG::hex << p.first <<
" -> " << tmpsrc.human_detector());
126 for (uint32_t status : p.second) {
127 eformat::helper::Status tmpstatus(status);
129 << MSG::hex << std::setfill(
'0' ) << std::setw(8) << tmpstatus.code()
130 <<
" Generic Part=0x" << std::setw(4) << tmpstatus.generic()
131 <<
" Specific Part=0x" << std::setw(4) << tmpstatus.specific());
134 return(StatusCode::SUCCESS);
147 ATH_MSG_DEBUG(
" ---> Number of ROB Id s requested : " << robIds.size() <<
", Caller Name = " << callerName);
150 for (uint32_t
id : robIds) {
152 if ( (eformat::helper::SourceIdentifier(
id).module_id() != 0) &&
153 (eformat::helper::SourceIdentifier(
id).subdetector_id() == eformat::TDAQ_LVL2) ) {
154 id = eformat::helper::SourceIdentifier(eformat::helper::SourceIdentifier(
id).subdetector_id(),0).code();
157 ATH_MSG_ERROR(
"Inconsistent flag for masking L2/EF module IDs");
160 }
else if ( (eformat::helper::SourceIdentifier(
id).module_id() != 0) &&
161 (eformat::helper::SourceIdentifier(
id).subdetector_id() == eformat::TDAQ_EVENT_FILTER) &&
163 id = eformat::helper::SourceIdentifier(eformat::helper::SourceIdentifier(
id).subdetector_id(),0).code();
166 ROBMAP::iterator map_it = robmap.find(
id) ;
167 if (map_it != robmap.end()) {
168 ATH_MSG_DEBUG(
" ---> Found ROB Id : 0x" << MSG::hex << (*map_it).second->source_id()
169 << MSG::dec <<
" in cache");
172 << MSG::dec <<
" not found in cache for running mode OFFLINE (method addROBData),");
188 ATH_MSG_FATAL(
" +-----------------------------------------------------------------+ ");
189 ATH_MSG_FATAL(
" | The method ROBDataProviderSvc::setNextEvent(const ROBF* result) | ");
190 ATH_MSG_FATAL(
" | is not implemented for this version of ROBDataProviderSvc | ");
191 ATH_MSG_FATAL(
" | Use the version from the HLT repository if you need it. | ");
192 ATH_MSG_FATAL(
" +-----------------------------------------------------------------+ ");
193 ATH_MSG_FATAL(
" ---> The " <<
result.size() <<
" ROB fragments in the call will not be used.");
217 std::vector<OFFLINE_FRAGMENTS_NAMESPACE::PointerType> robF(
MAX_ROBFRAGMENTS);
219 re->start(rePointer);
225 for (
size_t irob = 0; irob < robcount; irob++) {
228 std::unique_ptr<const ROBF> rob=std::make_unique<const ROBF>(robF[irob]);
229 uint32_t
id = rob->source_id();
231 if ( (eformat::helper::SourceIdentifier(
id).module_id() != 0) &&
232 (eformat::helper::SourceIdentifier(
id).subdetector_id() == eformat::TDAQ_LVL2) ) {
233 id = eformat::helper::SourceIdentifier(eformat::helper::SourceIdentifier(
id).subdetector_id(),0).code();
235 ATH_MSG_ERROR(
"Inconsistent flag for masking L2/EF module IDs");
238 }
else if ( (eformat::helper::SourceIdentifier(
id).module_id() != 0) &&
239 (eformat::helper::SourceIdentifier(
id).subdetector_id() == eformat::TDAQ_EVENT_FILTER) &&
241 id = eformat::helper::SourceIdentifier(eformat::helper::SourceIdentifier(
id).subdetector_id(),0).code();
244 if (rob->nstatus() > 0) {
245 const uint32_t* it_status;
246 rob->status(it_status);
247 eformat::helper::Status tmpstatus(*it_status);
248 ATH_MSG_DEBUG(
" ---> ROB Id = 0x" << MSG::hex <<
id << std::setfill(
'0')
249 <<
" with Generic Status Code = 0x" << std::setw(4) << tmpstatus.generic()
250 <<
" and Specific Status Code = 0x" << std::setw(4) << tmpstatus.specific() << MSG::dec
255 ATH_MSG_DEBUG(
" ---> Empty ROB Id = 0x" << MSG::hex <<
id << MSG::dec
259 ROBMAP::const_iterator it = cache->
robmap.find(
id);
260 if (it != cache->
robmap.end()) {
261 ATH_MSG_WARNING(
" ROBDataProviderSvc:: Duplicate ROBID 0x" << MSG::hex <<
id
262 <<
" found. " << MSG::dec <<
" Overwriting the previous one ");
264 cache->
robmap[id]=std::move(rob);
277 const std::string_view callerName) {
280 for (uint32_t
id : ids) {
282 if ( (eformat::helper::SourceIdentifier(
id).module_id() != 0) &&
283 (eformat::helper::SourceIdentifier(
id).subdetector_id() == eformat::TDAQ_LVL2) ) {
284 id = eformat::helper::SourceIdentifier(eformat::helper::SourceIdentifier(
id).subdetector_id(),0).code();
286 ATH_MSG_ERROR(
"Inconsistent flag for masking L2/EF module IDs");
289 }
else if ( (eformat::helper::SourceIdentifier(
id).module_id() != 0) &&
290 (eformat::helper::SourceIdentifier(
id).subdetector_id() == eformat::TDAQ_EVENT_FILTER) &&
292 id = eformat::helper::SourceIdentifier(eformat::helper::SourceIdentifier(
id).subdetector_id(),0).code();
294 ROBMAP::iterator map_it = cache->
robmap.find(
id);
295 if (map_it != cache->
robmap.end()) {
296 v.push_back((*map_it).second.get());
298 ATH_MSG_DEBUG(
"Failed to find ROB for id 0x" << MSG::hex <<
id << MSG::dec <<
", Caller Name = " << callerName);
302 for (
const auto& p : cache->
robmap) {
304 ATH_MSG_VERBOSE(
" # = " << nrob <<
" id = 0x" << MSG::hex << p.second->source_id() << MSG::dec);
314 for (
auto& it : toclear) {
338 const std::function<
void(
const ROBF* )>& fn )
const {
339 for (
const auto& el :
m_eventsCache.get( context )->robmap ) {
340 fn( el.second.get() );
356 if (rob->nstatus() == 0) {
360 const uint32_t* rob_it_status;
361 rob->status(rob_it_status);
363 eformat::helper::SourceIdentifier tmpsrc(rob->rob_source_id());
365 FilterRobMap::iterator map_it_rob =
m_filterRobMap.find(tmpsrc.code());
367 for (uint32_t status : map_it_rob->second) {
368 if (*rob_it_status == status) {
374 FilterSubDetMap::iterator map_it_subdet =
m_filterSubDetMap.find(tmpsrc.subdetector_id());
376 for (uint32_t status : map_it_subdet->second) {
377 if (*rob_it_status == status) {
const boost::regex re(r_e)
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
static const size_t MAX_ROBFRAGMENTS
OFFLINE_FRAGMENTS_NAMESPACE::FullEventFragment RawEvent
data type for reading raw event
virtual void setNextEvent(const EventContext &context, const std::vector< OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment > &result) override
Add a given LVL1/LVL2 ROBFragment to cache.
virtual void setEventStatus(const EventContext &context, uint32_t status) override
Store the status for the event.
std::map< uint32_t, std::unique_ptr< const ROBF >, std::less< uint32_t > > ROBMAP
vector of ROBFragment class
Gaudi::Property< ArrayPairIntType > m_filterSubDetWithStatus
virtual StatusCode initialize() override
initialize the service
virtual void addROBData(const EventContext &context, const std::vector< uint32_t > &robIds, const std::string_view callerName="UNKNOWN") override
Add ROBFragments to cache for given ROB ids, ROB fragments may be retrieved with DataCollector.
FilterRobMap m_filterRobMap
Gaudi::Property< ArrayPairIntType > m_filterRobWithStatus
Gaudi::Property< bool > m_filterEmptyROB
Filter out empty ROB fragments which are send by the ROS.
virtual void getROBData(const EventContext &context, const std::vector< uint32_t > &robIds, VROBFRAG &robFragments, const std::string_view callerName="UNKNOWN") override
Retrieve ROBFragments for given ROB ids from cache.
ROBDataProviderSvc(const std::string &name, ISvcLocator *svcloc)
Constructor.
virtual void processCachedROBs(const EventContext &context, const std::function< void(const ROBF *)> &fn) const override
static void robmapClear(ROBMAP &toclear)
bool filterRobWithStatus(const ROBF *rob)
method to filter ROBs with given Status code
virtual uint32_t getEventStatus(const EventContext &context) override
Retrieve the status for the event.
OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment ROBF
ROB Fragment class.
SG::SlotSpecificObj< EventCache > m_eventsCache
virtual const RawEvent * getEvent(const EventContext &context) override
Retrieve the whole event.
FilterSubDetMap m_filterSubDetMap
Maintain a set of objects, one per slot.
const DataType * PointerType
size_t getNSlots()
Return the number of event slots.