ATLAS Offline Software
Loading...
Searching...
No Matches
ROBDataProviderSvc Class Reference

ROBDataProviderSvc provides access to individual ROB fragments. More...

#include <ROBDataProviderSvc.h>

Inheritance diagram for ROBDataProviderSvc:
Collaboration diagram for ROBDataProviderSvc:

Classes

struct  EventCache
 ROB fragment cache per slot. More...

Public Types

using ROBF = OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment
 ROB Fragment class.

Public Member Functions

virtual StatusCode initialize () override
 Initialize.
virtual void setNextEvent (const EventContext &ctx, const RawEvent *re) override
 Add all ROBFragments of a RawEvent to cache.
virtual void getROBData (const EventContext &ctx, const std::vector< uint32_t > &robIds, VROBFRAG &robFragments, const std::string_view callerName="UNKNOWN") override
 Retrieve ROBFragments for given ROB ids from cache.
virtual const RawEventgetEvent (const EventContext &ctx) override
 Retrieve the whole event.
virtual void setEventStatus (const EventContext &ctx, uint32_t status) override
 Store the status for the event.
virtual uint32_t getEventStatus (const EventContext &ctx) override
 Retrieve the status for the event.
virtual void processCachedROBs (const EventContext &ctx, const std::function< void(const ROBF *)> &fn) const override

Private Member Functions

bool filterRobWithStatus (const ROBF *rob)
 method to filter ROBs with given Status code

Private Attributes

SG::SlotSpecificObj< EventCachem_eventsCache
std::unordered_map< uint32_t, std::vector< uint32_t > > m_filterRobMap
 map of full ROB Source ids and status words to be ignored for the ROB map
std::unordered_map< eformat::SubDetector, std::vector< uint32_t > > m_filterSubDetMap
 map of Sub Det Source ids and status words to be ignored for the ROB map
Gaudi::Property< std::vector< std::pair< int, int > > > m_filterRobWithStatus
Gaudi::Property< std::vector< std::pair< int, int > > > m_filterSubDetWithStatus
Gaudi::Property< bool > m_filterEmptyROB

Detailed Description

ROBDataProviderSvc provides access to individual ROB fragments.

Created: Sept 19, 2002 By: Hong Ma Modified: Aug. 18 2003 (common class for Online/Offline) By: Werner Wiedenmann Modified: Apr 21 2005 (remove dependency on data flow repository) By: Werner Wiedenmann Modified: Aug 2026 (major rewrite/cleanup for Phase-II) By: Frank Winklmeier

Definition at line 33 of file ROBDataProviderSvc.h.

Member Typedef Documentation

◆ ROBF

ROB Fragment class.

Definition at line 37 of file ROBDataProviderSvc.h.

Member Function Documentation

◆ filterRobWithStatus()

bool ROBDataProviderSvc::filterRobWithStatus ( const ROBF * rob)
private

method to filter ROBs with given Status code

Filter ROB with Sub Detector Id and Status Code.

Definition at line 232 of file ROBDataProviderSvc.cxx.

232 {
233 // No filter criteria defined
234 if (m_filterRobMap.empty() && m_filterSubDetMap.empty()) {
235 return false;
236 }
237 // There should be at least one status element if there was an error
238 // in case there are 0 status elements then there was no known error
239 // (see event format document ATL-D-ES-0019 (EDMS))
240 if (rob->nstatus() == 0) {
241 return false;
242 }
243 // The ROB has at least one status element, access it via an iterator
244 const uint32_t* rob_it_status;
245 rob->status(rob_it_status);
246
247 // Build the full ROB Sourceidentifier
248 eformat::helper::SourceIdentifier src(rob->rob_source_id());
249 // Check if there is a ROB specific filter rule defined for this ROB Id and match the status code
250 if (auto it = m_filterRobMap.find(src.code()); it != m_filterRobMap.end()) {
251 if (std::ranges::contains(it->second, *rob_it_status))
252 return true;
253 }
254
255 // Check if there is a sub detector specific filter rule defined for this ROB Id and match the status code
256 if (auto it = m_filterSubDetMap.find(src.subdetector_id()); it != m_filterSubDetMap.end()) {
257 if (std::ranges::contains(it->second, *rob_it_status))
258 return true;
259 }
260
261 return false;
262}
std::unordered_map< uint32_t, std::vector< uint32_t > > m_filterRobMap
map of full ROB Source ids and status words to be ignored for the ROB map
std::unordered_map< eformat::SubDetector, std::vector< uint32_t > > m_filterSubDetMap
map of Sub Det Source ids and status words to be ignored for the ROB map
setEventNumber uint32_t

◆ getEvent()

const RawEvent * ROBDataProviderSvc::getEvent ( const EventContext & ctx)
overridevirtual

Retrieve the whole event.

Definition at line 206 of file ROBDataProviderSvc.cxx.

206 {
207 return m_eventsCache.get(ctx)->event;
208}
SG::SlotSpecificObj< EventCache > m_eventsCache

◆ getEventStatus()

uint32_t ROBDataProviderSvc::getEventStatus ( const EventContext & ctx)
overridevirtual

Retrieve the status for the event.

Definition at line 218 of file ROBDataProviderSvc.cxx.

218 {
219 return m_eventsCache.get(ctx)->eventStatus;
220}

◆ getROBData()

void ROBDataProviderSvc::getROBData ( const EventContext & ctx,
const std::vector< uint32_t > & robIds,
VROBFRAG & robFragments,
const std::string_view callerName = "UNKNOWN" )
overridevirtual

Retrieve ROBFragments for given ROB ids from cache.

Return ROBData for ROB ids.

Definition at line 189 of file ROBDataProviderSvc.cxx.

190 {
191
192 EventCache* cache = m_eventsCache.get(ctx);
193
194 for (uint32_t id : ids) {
195 const auto map_it = cache->robmap.find(id);
196 if (map_it != cache->robmap.end()) {
197 robFragments.push_back(map_it->second.get());
198 } else {
199 ATH_MSG_DEBUG("Failed to find ROB for id 0x" << MSG::hex << id << MSG::dec << ", Caller Name = " << callerName);
200 }
201 }
202}
#define ATH_MSG_DEBUG(x,...)
const IIntersectionCache * cache() const
Retrieve the associated cache block, if it exists.
ROB fragment cache per slot.

◆ initialize()

StatusCode ROBDataProviderSvc::initialize ( )
overridevirtual

Initialize.

Initialization.

Definition at line 92 of file ROBDataProviderSvc.cxx.

92 {
93 ATH_MSG_INFO("Initializing");
94
95 for (const auto& [srcid, status] : m_filterRobWithStatus) {
96 eformat::helper::SourceIdentifier src(srcid);
97 if (src.human_detector() != "UNKNOWN") {
98 m_filterRobMap[src.code()].push_back(status);
99 }
100 }
101 for (const auto& [subdet, status] : m_filterSubDetWithStatus) {
102 eformat::helper::SourceIdentifier src(static_cast<eformat::SubDetector>(subdet), 0);
103 if (src.human_detector() != "UNKNOWN") {
104 m_filterSubDetMap[src.subdetector_id()].push_back(status);
105 }
106 }
107 ATH_MSG_INFO("---> Filter out empty ROB fragments = " << std::boolalpha << m_filterEmptyROB.value());
108 ATH_MSG_INFO("---> Filter out specific ROBs by Status Code: # ROBs = " << m_filterRobMap.size());
109
110 for (const auto& [id, status_vec] : m_filterRobMap) {
111 eformat::helper::SourceIdentifier src(id);
112 ATH_MSG_INFO(" RobId=0x" << MSG::hex << id << " -> in Sub Det = " << src.human_detector());
113 for (uint32_t status : status_vec) {
114 eformat::helper::Status tmpstatus(status);
115 ATH_MSG_INFO(" Status Code=0x"
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());
119 }
120 }
121
122 ATH_MSG_INFO("---> Filter out Sub Detector ROBs by Status Code: # Sub Detectors = " <<
123 m_filterSubDetMap.size());
124
125 for (const auto& [det, status_vec] : m_filterSubDetMap) {
126 eformat::helper::SourceIdentifier src(det, 0);
127 ATH_MSG_INFO(" SubDetId=0x" << MSG::hex << det << " -> " << src.human_detector());
128 for (uint32_t status : status_vec) {
129 eformat::helper::Status tmpstatus(status);
130 ATH_MSG_INFO(" Status Code=0x" <<
131 MSG::hex << std::setfill( '0' ) << std::setw(8) << tmpstatus.code() <<
132 " Generic Part=0x" << std::setw(4) << tmpstatus.generic() <<
133 " Specific Part=0x" << std::setw(4) << tmpstatus.specific());
134 }
135 }
136 return StatusCode::SUCCESS;
137}
#define ATH_MSG_INFO(x,...)
Gaudi::Property< std::vector< std::pair< int, int > > > m_filterSubDetWithStatus
Gaudi::Property< bool > m_filterEmptyROB
Gaudi::Property< std::vector< std::pair< int, int > > > m_filterRobWithStatus

◆ processCachedROBs()

void ROBDataProviderSvc::processCachedROBs ( const EventContext & ctx,
const std::function< void(const ROBF *)> & fn ) const
overridevirtual

Definition at line 223 of file ROBDataProviderSvc.cxx.

224 {
225 for ( const auto& el : m_eventsCache.get(ctx)->robmap ) {
226 fn( el.second.get() );
227 }
228}

◆ setEventStatus()

void ROBDataProviderSvc::setEventStatus ( const EventContext & ctx,
uint32_t status )
overridevirtual

Store the status for the event.

Set the status for the event.

Definition at line 212 of file ROBDataProviderSvc.cxx.

212 {
213 m_eventsCache.get(ctx)->eventStatus = status;
214}
status
Definition merge.py:16

◆ setNextEvent()

void ROBDataProviderSvc::setNextEvent ( const EventContext & ctx,
const RawEvent * re )
overridevirtual

Add all ROBFragments of a RawEvent to cache.

Add a new RAW event and rebuild map.

Definition at line 141 of file ROBDataProviderSvc.cxx.

141 {
142
143 EventCache* cache = m_eventsCache.get(ctx);
144 // assign the event
145 cache->event=re;
146 // clear the old map
147 cache->robmap.clear();
148 // set the LVL1 id
149 cache->currentLvl1ID = re->lvl1_id();
150
151 // loop over all ROBs
152 auto iter = re->child_iter();
154 // create ROBFragment
155 auto rob = std::make_unique<const ROBF>(fp);
156 const uint32_t id = rob->source_id();
157
158 if (filterRobWithStatus(rob.get())) {
159 if (rob->nstatus() > 0) {
160 const uint32_t* it_status;
161 rob->status(it_status);
162 eformat::helper::Status tmpstatus(*it_status);
163 ATH_MSG_DEBUG("---> ROB Id = 0x" << MSG::hex << id << std::setfill('0') <<
164 " with Generic Status Code = 0x" << std::setw(4) << tmpstatus.generic() <<
165 " and Specific Status Code = 0x" << std::setw(4) << tmpstatus.specific() << MSG::dec <<
166 " removed for L1 Id = " << cache->currentLvl1ID);
167 }
168 rob.reset();
169 } else if ((rob->rod_ndata() == 0) && m_filterEmptyROB) {
170 ATH_MSG_DEBUG("---> Empty ROB Id = 0x" << MSG::hex << id << MSG::dec <<
171 " removed for L1 Id = " << cache->currentLvl1ID);
172 rob.reset();
173 } else {
174 // add to the map, warn in case of overwrite
175 const auto& [itr, new_entry] = cache->robmap.insert_or_assign(id, std::move(rob));
176 if (!new_entry) {
177 ATH_MSG_WARNING("ROBDataProviderSvc:: Duplicate ROBID 0x" << MSG::hex << id <<
178 " found. " << MSG::dec << "Overwriting the previous one.");
179 }
180 }
181 }
182 ATH_MSG_DEBUG("---> setNextEvent offline for " << name() <<
183 ", current LVL1 id = " << cache->currentLvl1ID <<
184 ", size of ROB cache = " << cache->robmap.size());
185}
const std::regex re(r_e)
#define ATH_MSG_WARNING(x,...)
bool filterRobWithStatus(const ROBF *rob)
method to filter ROBs with given Status code
const DataType * PointerType
Definition RawEvent.h:25

Member Data Documentation

◆ m_eventsCache

SG::SlotSpecificObj<EventCache> ROBDataProviderSvc::m_eventsCache
private

Definition at line 76 of file ROBDataProviderSvc.h.

◆ m_filterEmptyROB

Gaudi::Property<bool> ROBDataProviderSvc::m_filterEmptyROB
private
Initial value:
{
this, "filterEmptyROB", false, "Filter out empty ROB fragments"}

Definition at line 89 of file ROBDataProviderSvc.h.

89 {
90 this, "filterEmptyROB", false, "Filter out empty ROB fragments"};

◆ m_filterRobMap

std::unordered_map<uint32_t, std::vector<uint32_t> > ROBDataProviderSvc::m_filterRobMap
private

map of full ROB Source ids and status words to be ignored for the ROB map

Definition at line 79 of file ROBDataProviderSvc.h.

◆ m_filterRobWithStatus

Gaudi::Property<std::vector<std::pair<int, int> > > ROBDataProviderSvc::m_filterRobWithStatus
private
Initial value:
{
this, "filterRobWithStatus", {}, "ROB IDs and status words to filter (full ROB SourceID)"}

Definition at line 85 of file ROBDataProviderSvc.h.

85 {
86 this, "filterRobWithStatus", {}, "ROB IDs and status words to filter (full ROB SourceID)"};

◆ m_filterSubDetMap

std::unordered_map<eformat::SubDetector, std::vector<uint32_t> > ROBDataProviderSvc::m_filterSubDetMap
private

map of Sub Det Source ids and status words to be ignored for the ROB map

Definition at line 82 of file ROBDataProviderSvc.h.

◆ m_filterSubDetWithStatus

Gaudi::Property<std::vector<std::pair<int, int> > > ROBDataProviderSvc::m_filterSubDetWithStatus
private
Initial value:
{
this, "filterSubDetWithStatus", {}, "Sub-detector IDs and status words to filter"}

Definition at line 87 of file ROBDataProviderSvc.h.

87 {
88 this, "filterSubDetWithStatus", {}, "Sub-detector IDs and status words to filter"};

The documentation for this class was generated from the following files: