ATLAS Offline Software
Classes | Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
ByteStreamEventStorageInputSvc Class Reference

This class is the ByteStreamInputSvc for reading events written by EventStorage. More...

#include <ByteStreamEventStorageInputSvc.h>

Inheritance diagram for ByteStreamEventStorageInputSvc:
Collaboration diagram for ByteStreamEventStorageInputSvc:

Classes

struct  EventCache
 

Public Member Functions

 ByteStreamEventStorageInputSvc (const std::string &name, ISvcLocator *pSvcLocator)
 Constructors: More...
 
virtual ~ByteStreamEventStorageInputSvc ()
 Destructor. More...
 
virtual StatusCode initialize () override
 Required of all Gaudi Services. More...
 
virtual StatusCode stop () override
 
virtual StatusCode finalize () override
 
virtual const RawEventcurrentEvent () const override
 Implementation of the IByteStreamInputSvc interface methods. More...
 
virtual const RawEventnextEvent () override
 ++, new More...
 
virtual const RawEventpreviousEvent () override
 –, old More...
 
virtual void setEvent (void *data, unsigned int eventStatus) override
 
virtual unsigned int currentEventStatus () const override
 Return the current event status. More...
 
virtual void validateEvent () override
 
virtual long positionInBlock () override
 
virtual std::pair< long, std::string > getBlockIterator (const std::string &fileName) override
 
virtual void closeBlockIterator (bool clearMetadata=true) override
 
virtual bool setSequentialRead ()
 
virtual bool ready () override
 
virtual StatusCode generateDataHeader () override
 

Private Types

enum  Advance { PREVIOUS = -1, NEXT = 1 }
 

Private Member Functions

StatusCode loadMetadata ()
 
void buildFragment (EventCache *cache, uint32_t eventSize, bool validate) const
 
bool readerReady ()
 
bool ROBFragmentCheck (const RawEvent *) const
 
unsigned validateEvent (const RawEvent *const rawEvent) const
 
void setEvent (const EventContext &context, void *data, unsigned int eventStatus)
 
const RawEventgetEvent (Advance step)
 
std::unique_ptr< DataHeaderElementmakeBSProvenance () const
 
template<typename T >
StatusCode deleteEntry (const std::string &key)
 

Private Attributes

std::mutex m_readerMutex
 
SG::SlotSpecificObj< EventCachem_eventsCache
 
std::unique_ptr< EventStorage::DataReader > m_reader
 DataReader from EventStorage. More...
 
std::vector< long long int > m_evtOffsets
 offset for event i in that file More...
 
unsigned int m_evtInFile
 
long long int m_evtFileOffset
 last read in event offset within a file, can be -1 More...
 
std::string m_fileGUID
 current file GUID More...
 
ServiceHandle< StoreGateSvcm_storeGate {this, "EventStore", "StoreGateSvc"}
 Pointer to StoreGate. More...
 
ServiceHandle< StoreGateSvcm_inputMetadata {this, "MetaDataStore", "StoreGateSvc/InputMetaDataStore"}
 
ServiceHandle< IROBDataProviderSvcm_robProvider
 
Gaudi::Property< bool > m_sequential {this, "EnableSequential", false, "enable sequential reading"}
 
Gaudi::Property< bool > m_dump {this, "DumpFlag", false, "Dump fragments"}
 
Gaudi::Property< float > m_wait {this, "WaitSecs", 0.0f, "Seconds to wait if input is in wait state"}
 
Gaudi::Property< bool > m_valEvent {this, "ValidateEvent", false, "switch on check_tree when reading events"}
 
Gaudi::Property< std::string > m_eventInfoKey {this, "EventInfoKey", "EventInfo", "Key of EventInfo in metadata store"}
 

Detailed Description

This class is the ByteStreamInputSvc for reading events written by EventStorage.

Definition at line 35 of file ByteStreamEventStorageInputSvc.h.

Member Enumeration Documentation

◆ Advance

Enumerator
PREVIOUS 
NEXT 

Definition at line 113 of file ByteStreamEventStorageInputSvc.h.

113 { PREVIOUS = -1, NEXT = 1 };

Constructor & Destructor Documentation

◆ ByteStreamEventStorageInputSvc()

ByteStreamEventStorageInputSvc::ByteStreamEventStorageInputSvc ( const std::string &  name,
ISvcLocator *  pSvcLocator 
)

Constructors:

Definition at line 38 of file ByteStreamEventStorageInputSvc.cxx.

40  : base_class(name, pSvcLocator)
41  , m_readerMutex()
42  , m_eventsCache()
43  , m_reader()
44  , m_evtOffsets()
45  , m_evtInFile(0)
46  , m_evtFileOffset(0)
47  , m_fileGUID("")
48  , m_robProvider("ROBDataProviderSvc", name)
49 {
50  assert(pSvcLocator != nullptr);
51 }

◆ ~ByteStreamEventStorageInputSvc()

ByteStreamEventStorageInputSvc::~ByteStreamEventStorageInputSvc ( )
virtualdefault

Destructor.

Member Function Documentation

◆ buildFragment()

void ByteStreamEventStorageInputSvc::buildFragment ( EventCache cache,
uint32_t  eventSize,
bool  validate 
) const
private

Definition at line 304 of file ByteStreamEventStorageInputSvc.cxx.

305  {
308  DataType* fragment = reinterpret_cast<DataType*>(cache->data);
309 
310  if (validate) {
311  // check fragment type
312  const DataType headWord = fragment[0];
313  ATH_MSG_DEBUG("First word of the fragment " << MSG::hex << headWord << MSG::dec);
314  // format version
315  const DataType formatVersion = eformat::helper::Version(fragment[3]).major_version();
316  ATH_MSG_DEBUG("Format version" << MSG::hex << formatVersion << MSG::dec);
317  // error message
318  if((formatVersion != eformat::MAJOR_DEFAULT_VERSION) &&
319  (formatVersion != eformat::MAJOR_V24_VERSION) &&
320  (formatVersion != eformat::MAJOR_V30_VERSION) &&
321  (formatVersion != eformat::MAJOR_V40_VERSION) &&
322  (formatVersion != eformat::MAJOR_V31_VERSION) ) {
323  ATH_MSG_ERROR("unsupported Format Version : "
324  << MSG::hex << formatVersion << MSG::dec);
325  }
326 
327  if(eformat::FULL_EVENT == headWord || 0xcc1234cc == headWord) { // ROS = 0xcc1234cc
328  try {
329  // convert old fragment
330  if(formatVersion != eformat::MAJOR_DEFAULT_VERSION) {
331  // 100 for increase of data-size due to header conversion
332  const uint32_t newEventSize = eventSize + 1000;
333  DataType* newFragment = new DataType[newEventSize];
334  eformat::old::convert(fragment, newFragment, newEventSize);
335 
336  // delete old fragment
337  delete [] fragment; fragment = nullptr;
338 
339  // set new pointer
340  fragment = newFragment;
341  cache->data = reinterpret_cast< char* >(fragment);
342  }
343  } catch (const eformat::Issue& ex) {
344  // bad event
345  ATH_MSG_WARNING(ex.what());
346  ATH_MSG_ERROR("Skipping bad event");
348  }
349  } else {
350  // Unknown fragment
351  ATH_MSG_FATAL("Unknown Header work in input fragment " << MSG::hex << headWord);
353  }
354  }
355 
356  // This is a FullEventFragment
357  // make a new FEFrag in memory from it
358  cache->eventStatus = 0;
359  if(fragment[5] > 0) {
360  cache->eventStatus += eformat::helper::Status(fragment[6]).specific();
361  cache->eventStatus += (eformat::helper::Status(fragment[6]).generic() & 0x000000ff) << 16;
362  }
363 
364  // This is a FullEventFragment
365  // make a new RawEvent in memory from it
366  cache->rawEvent = std::make_unique<RawEvent>(fragment);
367  ATH_MSG_DEBUG("Made an FullEventFragment from ES " << fragment);
368 }

◆ closeBlockIterator()

void ByteStreamEventStorageInputSvc::closeBlockIterator ( bool  clearMetadata = true)
overridevirtual

Definition at line 466 of file ByteStreamEventStorageInputSvc.cxx.

467 {
468  if (clearMetadata) {
469  ATH_MSG_WARNING("Clearing input metadata store");
470  StatusCode status = m_inputMetadata->clearStore();
471  if (!status.isSuccess()) {
472  ATH_MSG_WARNING("Unable to clear Input MetaData Proxies");
473  }
474  }
475 
476  if (!readerReady()) {
477  ATH_MSG_INFO("No more events in this run, high water mark for this file = "
478  << m_evtOffsets.size()-1);
479  }
480 
481  m_reader.reset();
482 }

◆ currentEvent()

const RawEvent * ByteStreamEventStorageInputSvc::currentEvent ( ) const
overridevirtual

Implementation of the IByteStreamInputSvc interface methods.

Definition at line 633 of file ByteStreamEventStorageInputSvc.cxx.

634 {
635  const EventContext& context{Gaudi::Hive::currentContext()};
636  return m_eventsCache.get(context)->rawEvent.get();
637 }

◆ currentEventStatus()

unsigned int ByteStreamEventStorageInputSvc::currentEventStatus ( ) const
overridevirtual

Return the current event status.

Definition at line 642 of file ByteStreamEventStorageInputSvc.cxx.

643 {
644  const EventContext& context{Gaudi::Hive::currentContext()};
645  return m_eventsCache.get(context)->eventStatus;
646 }

◆ deleteEntry()

template<typename T >
StatusCode ByteStreamEventStorageInputSvc::deleteEntry ( const std::string &  key)
inlineprivate

Definition at line 118 of file ByteStreamEventStorageInputSvc.h.

119  {
120  if (m_storeGate->contains<T>(key)) {
121  const T* tmp = m_storeGate->tryConstRetrieve<T>(key);
122  if (tmp != nullptr) ATH_CHECK(m_storeGate->remove<T>(tmp));
123  }
124  return StatusCode::SUCCESS;
125  }

◆ finalize()

StatusCode ByteStreamEventStorageInputSvc::finalize ( )
overridevirtual

Definition at line 83 of file ByteStreamEventStorageInputSvc.cxx.

83  {
84  return StatusCode::SUCCESS;
85 }

◆ generateDataHeader()

StatusCode ByteStreamEventStorageInputSvc::generateDataHeader ( )
overridevirtual

Definition at line 373 of file ByteStreamEventStorageInputSvc.cxx.

374 {
375  std::lock_guard<std::mutex> lock(m_readerMutex);
376 
377  // get file GUID
378  m_fileGUID = m_reader->GUID();
379 
380  // reader returns -1 when end of the file is reached
381  if(m_evtFileOffset != -1) {
382  ATH_MSG_DEBUG("ByteStream File GUID: " << m_fileGUID);
383  ATH_MSG_DEBUG("ByteStream Event Position in File: " << m_evtFileOffset);
384 
385  // To accommodate for skipEvents option in EventSelector
386  // While skipping BS event Selector does not return SUCCESS code,
387  // just advances silently through events. So SG content is not refreshed
388  // Lets do refresh of the event header here
389  std::string key = "ByteStreamDataHeader";
390  ATH_CHECK(deleteEntry<DataHeader>(key));
391 
392  // Created data header element with BS provenance information
393  std::unique_ptr<DataHeaderElement> dataHeaderElement = makeBSProvenance();
394  // Create data header itself
395  std::unique_ptr<DataHeader> dataHeader = std::make_unique<DataHeader>();
396  // Declare header primary
397  dataHeader->setStatus(DataHeader::Input);
398  // Set processTag
399  dataHeader->setProcessTag(dataHeaderElement->getKey());
400  //add the data header element self reference to the object vector
401  dataHeader->insert(*std::move(dataHeaderElement));
402 
403  // Clean up EventInfo from the previous event
404  key = m_eventInfoKey.value();
405  ATH_CHECK(deleteEntry<xAOD::EventInfo>(key));
406  // Now add ref to xAOD::EventInfo
407  std::unique_ptr<IOpaqueAddress> iopx = std::make_unique<ByteStreamAddress>(
409  ATH_CHECK(m_storeGate->recordAddress(key, std::move(iopx)));
410  const SG::DataProxy* ptmpx = m_storeGate->transientProxy(
412  if (ptmpx != nullptr) {
413  DataHeaderElement element(ptmpx, 0, key);
414  dataHeader->insert(element);
415  }
416 
417  // Clean up auxiliary EventInfo from the previous event
418  key = m_eventInfoKey.value() + "Aux.";
419  ATH_CHECK(deleteEntry<xAOD::EventAuxInfo>(key));
420  // Now add ref to xAOD::EventAuxInfo
421  std::unique_ptr<IOpaqueAddress> iopaux = std::make_unique<ByteStreamAddress>(
423  ATH_CHECK(m_storeGate->recordAddress(key, std::move(iopaux)));
424  const SG::DataProxy* ptmpaux = m_storeGate->transientProxy(
426  if (ptmpaux !=0) {
427  DataHeaderElement element(ptmpaux, 0, key);
428  dataHeader->insert(element);
429  }
430 
431  // Record new data header.Boolean flags will allow it's deletion in case
432  // of skipped events.
433  ATH_CHECK(m_storeGate->record<DataHeader>(dataHeader.release(),
434  "ByteStreamDataHeader", true, false, true));
435  }
436  return StatusCode::SUCCESS;
437 }

◆ getBlockIterator()

std::pair< long, std::string > ByteStreamEventStorageInputSvc::getBlockIterator ( const std::string &  fileName)
overridevirtual

Definition at line 505 of file ByteStreamEventStorageInputSvc.cxx.

506 {
507  // open the file
508  if(m_reader != 0) closeBlockIterator();
509 
510  m_reader = std::unique_ptr<EventStorage::DataReader>(pickDataReader(fileName));
511 
512  if(m_reader == nullptr) {
513  ATH_MSG_ERROR("Failed to open file " << fileName);
515  return std::make_pair(-1,"END");
516  }
517 
518  // Initialize offset vector
519  m_evtOffsets.resize(m_reader->eventsInFile(), -1);
520  m_evtOffsets.clear();
521 
522  // Get ByteStream Metadata into Input MetaData Store
523  // (include begin Input File Incident)
524  if (loadMetadata().isSuccess()) {
525  ATH_MSG_DEBUG("Recorded ByteStreamMetadata in InputMetaDataStore");
526  } else {
527  ATH_MSG_ERROR("Unable to record ByteStreamMetadata in InputMetaDataStore");
528  return std::make_pair(-1, "FAIL");
529  }
530 
531  m_evtInFile = 0;
532 
533  // enable sequentialReading if multiple files
534  if(m_sequential) {
535  bool test = setSequentialRead();
536  if (!test) return std::make_pair(-1,"SEQ");
537  }
538 
539  ATH_MSG_INFO("Picked valid file: " << m_reader->fileName());
540  // initialize offsets and counters
541  m_evtOffsets.push_back(static_cast<long long>(m_reader->getPosition()));
542  return std::make_pair(m_reader->eventsInFile(), m_reader->GUID());
543 }

◆ getEvent()

const RawEvent* ByteStreamEventStorageInputSvc::getEvent ( Advance  step)
private

◆ initialize()

StatusCode ByteStreamEventStorageInputSvc::initialize ( )
overridevirtual

Required of all Gaudi Services.

Definition at line 60 of file ByteStreamEventStorageInputSvc.cxx.

61 {
62  ATH_MSG_INFO("Initializing");
63 
64  ATH_CHECK(m_inputMetadata.retrieve());
65  ATH_CHECK(m_storeGate.retrieve());
66  ATH_CHECK(m_robProvider.retrieve());
67 
68  return StatusCode::SUCCESS;
69 }

◆ loadMetadata()

StatusCode ByteStreamEventStorageInputSvc::loadMetadata ( )
private

Definition at line 99 of file ByteStreamEventStorageInputSvc.cxx.

100 {
101  // default goes into ByteStreamMetadata
102  auto bsmdc = std::make_unique<ByteStreamMetadataContainer>();
103  bsmdc->push_back(std::make_unique<ByteStreamMetadata>(*m_reader));
104  ATH_MSG_DEBUG("ByteStreamMetadata:\n" << *(bsmdc->front()));
105 
106  return m_inputMetadata->record(std::move(bsmdc), "ByteStreamMetadata");
107 }

◆ makeBSProvenance()

std::unique_ptr< DataHeaderElement > ByteStreamEventStorageInputSvc::makeBSProvenance ( ) const
private

Definition at line 651 of file ByteStreamEventStorageInputSvc.cxx.

652 {
653  Token token;
654  token.setDb(m_fileGUID);
655  token.setTechnology(0x00001000);
656  token.setOid(Token::OID_t(0LL, m_evtFileOffset));
657 
658  return std::make_unique<DataHeaderElement>(ClassID_traits<DataHeader>::ID(),
659  "StreamRAW", std::move(token));
660 }

◆ nextEvent()

const RawEvent * ByteStreamEventStorageInputSvc::nextEvent ( )
overridevirtual

++, new

Definition at line 179 of file ByteStreamEventStorageInputSvc.cxx.

179  {
180 
181  std::lock_guard<std::mutex> lock( m_readerMutex );
182  const EventContext& context{ Gaudi::Hive::currentContext() };
183  EventCache* cache = m_eventsCache.get(context);
184 
185  // initialize before building RawEvent
186  cache->releaseEvent();
187 
188  // Load data buffer from file
189  unsigned int eventSize;
190  if (readerReady()) {
191  DRError ecode;
192  // Check if have moved back from high water mark
193  m_evtInFile++; // increment iterator
194  if (m_evtInFile+1 > m_evtOffsets.size()) {
195  //get current event position (cast to long long until native tdaq implementation)
196  ATH_MSG_DEBUG("nextEvent _above_ high water mark");
197  m_evtFileOffset = static_cast<long long>(m_reader->getPosition());
198  m_evtOffsets.push_back(m_evtFileOffset);
199  ecode = m_reader->getData(eventSize, &(cache->data));
200  } else {
201  // Load from previous offset
202  ATH_MSG_DEBUG("nextEvent below high water mark");
204  ecode = m_reader->getData(eventSize, &(cache->data), m_evtFileOffset);
205  }
206 
207  if (DRWAIT == ecode && m_wait > 0) {
208  do {
209  // wait for n seconds
210  ATH_MSG_DEBUG("Waiting for input: " << m_wait << " seconds");
211  int result = usleep(static_cast<int>(m_wait * 1e6));
212  if (result != 0) {
213  ATH_MSG_ERROR("System Error while running sleep");
214  return nullptr;
215  }
216  } while(m_reader->getData(eventSize, &(cache->data)) == DRWAIT);
217  } else if (DROK != ecode) {
218  ATH_MSG_ERROR("Error reading next event");
220  }
221  ATH_MSG_DEBUG("Event Size " << eventSize);
222 
223  } else {
224  ATH_MSG_ERROR("DataReader not ready. Need to getBlockIterator first");
225  return nullptr;
226  }
227 
228  // Use buffer to build FullEventFragment
229  try {
230  buildFragment(cache, eventSize, true);
231  }
232  catch (...) {
233  // rethrow any exceptions
234  throw;
235  }
236 
237  if (cache->rawEvent == nullptr) {
238  ATH_MSG_ERROR("Failure to build fragment");
239  return nullptr;
240  }
241 
242  // Set it for the data provider
243  m_robProvider->setNextEvent(context, cache->rawEvent.get());
244  m_robProvider->setEventStatus(context, cache->eventStatus);
245 
246  //++m_totalEventCounter;
247 
248  // dump
249  if (m_dump) {
250  DumpFrags::dump(cache->rawEvent.get());
251  }
252  ATH_MSG_DEBUG("switched to next event in slot " << context);
253  return cache->rawEvent.get();
254 }

◆ positionInBlock()

long ByteStreamEventStorageInputSvc::positionInBlock ( )
overridevirtual

Definition at line 91 of file ByteStreamEventStorageInputSvc.cxx.

92 {
93  return m_evtOffsets.size();
94 }

◆ previousEvent()

const RawEvent * ByteStreamEventStorageInputSvc::previousEvent ( )
overridevirtual

–, old

Definition at line 112 of file ByteStreamEventStorageInputSvc.cxx.

113 {
114  std::lock_guard<std::mutex> lock(m_readerMutex);
115  const EventContext& context{Gaudi::Hive::currentContext()};
116  EventCache* cache = m_eventsCache.get(context);
117  // initialize before building RawEvent
118  cache->releaseEvent();
119 
120  // Load data buffer from file
121  unsigned int eventSize;
122  if (readerReady()) {
123  //get current event position (cast to long long until native tdaq implementation)
124  m_evtInFile--;
126  DRError ecode = m_reader->getData(eventSize, &(cache->data), m_evtOffsets.at(m_evtInFile - 1));
127 
128  if (DRWAIT == ecode && m_wait > 0) {
129  do {
130  // wait for n seconds
131  ATH_MSG_DEBUG("Waiting for input: " << m_wait << " seconds");
132  int result = usleep(static_cast<int>(m_wait * 1e6));
133  if (result != 0) {
134  ATH_MSG_ERROR("System Error while running sleep");
135  return nullptr;
136  }
137  } while(m_reader->getData(eventSize, &(cache->data), m_evtFileOffset) == DRWAIT);
138  } else if (DROK != ecode) {
139  ATH_MSG_ERROR("Error reading previous event");
141  }
142  ATH_MSG_DEBUG("Event Size " << eventSize);
143  }
144  else {
145  ATH_MSG_ERROR("DataReader not ready. Need to getBlockIterator first");
146  return nullptr;
147  }
148 
149  // Use buffer to build FullEventFragment
150  try {
151  buildFragment(cache, eventSize, true);
152  }
153  catch (...) {
154  // rethrow any exceptions
155  throw;
156  }
157 
158  if (cache->rawEvent == nullptr) {
159  ATH_MSG_ERROR("Failure to build fragment");
160  return nullptr;
161  }
162 
163  // Set it for the data provider
164  m_robProvider->setNextEvent(context, cache->rawEvent.get());
165  m_robProvider->setEventStatus(context, cache->eventStatus);
166 
167  // dump
168  if (m_dump) {
169  DumpFrags::dump(cache->rawEvent.get());
170  }
171  ATH_MSG_DEBUG( "switched to previous event in slot " << context);
172  return cache->rawEvent.get();
173 }

◆ readerReady()

bool ByteStreamEventStorageInputSvc::readerReady ( )
private

Definition at line 548 of file ByteStreamEventStorageInputSvc.cxx.

549 {
550  bool eofFlag(false);
551 
552  if (m_reader) eofFlag = m_reader->endOfFile();
553  else {
554  ATH_MSG_INFO("eformat reader object not initialized");
555  return false;
556  }
557 
558  bool moreEvent = m_reader->good();
559 
560  return (!eofFlag) && moreEvent;
561 }

◆ ready()

bool ByteStreamEventStorageInputSvc::ready ( )
overridevirtual

Definition at line 497 of file ByteStreamEventStorageInputSvc.cxx.

498 {
499  return readerReady();
500 }

◆ ROBFragmentCheck()

bool ByteStreamEventStorageInputSvc::ROBFragmentCheck ( const RawEvent re) const
private

Definition at line 566 of file ByteStreamEventStorageInputSvc.cxx.

567 {
568  bool allOK = true;
569  uint32_t total = re->nchildren();
570  uint32_t lastId = 0;
571  std::vector<eformat::FragmentProblem> problems;
572 
573  for (size_t i = 0; i<total; ++i) {
575  re->child(fp, i);
576 
578  lastId = f.source_id();
579 
580  problems.clear();
581  f.problems(problems);
582  if(!problems.empty()) {
583  allOK = false;
584  for(const auto& problem : problems) {
585  ATH_MSG_WARNING("Failed to create ROBFragment id = " << lastId << ", "
586  << eformat::helper::SourceIdentifier(lastId).human() << " : "
587  << eformat::helper::FragmentProblemDictionary.string(problem));
588  }
589  }
590  }
591 
592  return allOK;
593 }

◆ setEvent() [1/2]

void ByteStreamEventStorageInputSvc::setEvent ( const EventContext &  context,
void *  data,
unsigned int  eventStatus 
)
private

Definition at line 607 of file ByteStreamEventStorageInputSvc.cxx.

609 {
611  EventCache* cache = m_eventsCache.get(context);
612  cache->releaseEvent();
613 
614  DataType* fragment = reinterpret_cast<DataType*>(data);
615  cache->rawEvent = std::make_unique<RawEvent>(fragment);
616  cache->eventStatus = eventStatus;
617 
618  // Set it for the data provider
619  m_robProvider->setNextEvent(context, cache->rawEvent.get());
620  m_robProvider->setEventStatus(context, cache->eventStatus);
621 
622  // Build a DH for use by other components
623  StatusCode rec_sg = generateDataHeader();
624  if (rec_sg != StatusCode::SUCCESS) {
625  ATH_MSG_ERROR("Fail to record BS DataHeader in StoreGate. Skipping events?! "
626  << rec_sg);
627  }
628 }

◆ setEvent() [2/2]

void ByteStreamEventStorageInputSvc::setEvent ( void *  data,
unsigned int  eventStatus 
)
overridevirtual

Definition at line 598 of file ByteStreamEventStorageInputSvc.cxx.

599 {
600  const EventContext& context{Gaudi::Hive::currentContext()};
601  return setEvent(context, data, eventStatus);
602 }

◆ setSequentialRead()

bool ByteStreamEventStorageInputSvc::setSequentialRead ( )
virtual

Definition at line 487 of file ByteStreamEventStorageInputSvc.cxx.

488 {
489  // enable SequenceReading
490  m_reader->enableSequenceReading();
491  return true;
492 }

◆ stop()

StatusCode ByteStreamEventStorageInputSvc::stop ( )
overridevirtual

Definition at line 74 of file ByteStreamEventStorageInputSvc.cxx.

75 {
76  // close moved to EventSelector for explicit coupling with incident
77  return StatusCode::SUCCESS;
78 }

◆ validateEvent() [1/2]

void ByteStreamEventStorageInputSvc::validateEvent ( )
overridevirtual

Definition at line 259 of file ByteStreamEventStorageInputSvc.cxx.

260 {
261  const EventContext& context{Gaudi::Hive::currentContext()};
262  const RawEvent* const event = m_eventsCache.get(context)->rawEvent.get();
263  m_eventsCache.get(context)->eventStatus = validateEvent(event);
264 }

◆ validateEvent() [2/2]

unsigned ByteStreamEventStorageInputSvc::validateEvent ( const RawEvent *const  rawEvent) const
private

Definition at line 269 of file ByteStreamEventStorageInputSvc.cxx.

270 {
271  unsigned int status = 0;
272  if (m_valEvent) {
273  // check validity
274  std::vector<eformat::FragmentProblem> problems;
275  rawEvent->problems(problems);
276 
277  if(!problems.empty()) {
278  status += 0x01000000;
279 
280  // bad event
281  ATH_MSG_WARNING("Failed to create FullEventFragment");
282  for(const auto& problem : problems)
283  ATH_MSG_WARNING(eformat::helper::FragmentProblemDictionary.string(problem));
284 
286  }
287 
288  if(!ROBFragmentCheck(rawEvent)) {
289  status += 0x02000000;
290 
291  // bad event
292  ATH_MSG_ERROR("Skipping bad event");
294  }
295  } else {
296  ATH_MSG_DEBUG("Processing event without validating.");
297  }
298  return status;
299 }

Member Data Documentation

◆ m_dump

Gaudi::Property<bool> ByteStreamEventStorageInputSvc::m_dump {this, "DumpFlag", false, "Dump fragments"}
private

Definition at line 99 of file ByteStreamEventStorageInputSvc.h.

◆ m_eventInfoKey

Gaudi::Property<std::string> ByteStreamEventStorageInputSvc::m_eventInfoKey {this, "EventInfoKey", "EventInfo", "Key of EventInfo in metadata store"}
private

Definition at line 102 of file ByteStreamEventStorageInputSvc.h.

◆ m_eventsCache

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

Definition at line 81 of file ByteStreamEventStorageInputSvc.h.

◆ m_evtFileOffset

long long int ByteStreamEventStorageInputSvc::m_evtFileOffset
private

last read in event offset within a file, can be -1

Definition at line 87 of file ByteStreamEventStorageInputSvc.h.

◆ m_evtInFile

unsigned int ByteStreamEventStorageInputSvc::m_evtInFile
private

Definition at line 86 of file ByteStreamEventStorageInputSvc.h.

◆ m_evtOffsets

std::vector<long long int> ByteStreamEventStorageInputSvc::m_evtOffsets
private

offset for event i in that file

Definition at line 85 of file ByteStreamEventStorageInputSvc.h.

◆ m_fileGUID

std::string ByteStreamEventStorageInputSvc::m_fileGUID
private

current file GUID

Definition at line 89 of file ByteStreamEventStorageInputSvc.h.

◆ m_inputMetadata

ServiceHandle<StoreGateSvc> ByteStreamEventStorageInputSvc::m_inputMetadata {this, "MetaDataStore", "StoreGateSvc/InputMetaDataStore"}
private

Definition at line 96 of file ByteStreamEventStorageInputSvc.h.

◆ m_reader

std::unique_ptr<EventStorage::DataReader> ByteStreamEventStorageInputSvc::m_reader
private

DataReader from EventStorage.

Definition at line 83 of file ByteStreamEventStorageInputSvc.h.

◆ m_readerMutex

std::mutex ByteStreamEventStorageInputSvc::m_readerMutex
private

Definition at line 70 of file ByteStreamEventStorageInputSvc.h.

◆ m_robProvider

ServiceHandle<IROBDataProviderSvc> ByteStreamEventStorageInputSvc::m_robProvider
private

Definition at line 97 of file ByteStreamEventStorageInputSvc.h.

◆ m_sequential

Gaudi::Property<bool> ByteStreamEventStorageInputSvc::m_sequential {this, "EnableSequential", false, "enable sequential reading"}
private

Definition at line 98 of file ByteStreamEventStorageInputSvc.h.

◆ m_storeGate

ServiceHandle<StoreGateSvc> ByteStreamEventStorageInputSvc::m_storeGate {this, "EventStore", "StoreGateSvc"}
private

Pointer to StoreGate.

Definition at line 95 of file ByteStreamEventStorageInputSvc.h.

◆ m_valEvent

Gaudi::Property<bool> ByteStreamEventStorageInputSvc::m_valEvent {this, "ValidateEvent", false, "switch on check_tree when reading events"}
private

Definition at line 101 of file ByteStreamEventStorageInputSvc.h.

◆ m_wait

Gaudi::Property<float> ByteStreamEventStorageInputSvc::m_wait {this, "WaitSecs", 0.0f, "Seconds to wait if input is in wait state"}
private

Definition at line 100 of file ByteStreamEventStorageInputSvc.h.


The documentation for this class was generated from the following files:
ByteStreamEventStorageInputSvc::m_evtFileOffset
long long int m_evtFileOffset
last read in event offset within a file, can be -1
Definition: ByteStreamEventStorageInputSvc.h:87
DataHeader::setProcessTag
void setProcessTag(const std::string &processTag)
Set ProcessTag for DataHeader.
Definition: DataHeader.cxx:237
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
OFFLINE_FRAGMENTS_NAMESPACE::PointerType
const DataType * PointerType
Definition: RawEvent.h:25
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
validation.validate
def validate(testSampleDir, thisSampleName, testSamplePath, weight_database, outputSamples)
Definition: validation.py:26
get_generator_info.result
result
Definition: get_generator_info.py:21
ByteStreamEventStorageInputSvc::NEXT
@ NEXT
Definition: ByteStreamEventStorageInputSvc.h:113
ByteStreamEventStorageInputSvc::PREVIOUS
@ PREVIOUS
Definition: ByteStreamEventStorageInputSvc.h:113
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
ByteStreamEventStorageInputSvc::m_readerMutex
std::mutex m_readerMutex
Definition: ByteStreamEventStorageInputSvc.h:70
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
DataHeader::Input
@ Input
Definition: DataHeader.h:125
ByteStreamEventStorageInputSvc::m_evtOffsets
std::vector< long long int > m_evtOffsets
offset for event i in that file
Definition: ByteStreamEventStorageInputSvc.h:85
ByteStreamEventStorageInputSvc::m_eventsCache
SG::SlotSpecificObj< EventCache > m_eventsCache
Definition: ByteStreamEventStorageInputSvc.h:81
ByteStreamEventStorageInputSvc::m_storeGate
ServiceHandle< StoreGateSvc > m_storeGate
Pointer to StoreGate.
Definition: ByteStreamEventStorageInputSvc.h:95
Issue
Configuration Issue
Definition: PscIssues.h:31
ByteStreamEventStorageInputSvc::setSequentialRead
virtual bool setSequentialRead()
Definition: ByteStreamEventStorageInputSvc.cxx:487
TRT::Track::event
@ event
Definition: InnerDetector/InDetCalibEvent/TRT_CalibData/TRT_CalibData/TrackInfo.h:74
ByteStreamEventStorageInputSvc::validateEvent
virtual void validateEvent() override
Definition: ByteStreamEventStorageInputSvc.cxx:259
ByteStreamEventStorageInputSvc::m_eventInfoKey
Gaudi::Property< std::string > m_eventInfoKey
Definition: ByteStreamEventStorageInputSvc.h:102
ByteStreamEventStorageInputSvc::m_robProvider
ServiceHandle< IROBDataProviderSvc > m_robProvider
Definition: ByteStreamEventStorageInputSvc.h:97
python.RatesEmulationExample.lock
lock
Definition: RatesEmulationExample.py:148
TrigInDetValidation_Base.test
test
Definition: TrigInDetValidation_Base.py:142
ByteStreamEventStorageInputSvc::generateDataHeader
virtual StatusCode generateDataHeader() override
Definition: ByteStreamEventStorageInputSvc.cxx:373
ByteStreamEventStorageInputSvc::m_evtInFile
unsigned int m_evtInFile
Definition: ByteStreamEventStorageInputSvc.h:86
ByteStreamEventStorageInputSvc::m_dump
Gaudi::Property< bool > m_dump
Definition: ByteStreamEventStorageInputSvc.h:99
ByteStreamEventStorageInputSvc::closeBlockIterator
virtual void closeBlockIterator(bool clearMetadata=true) override
Definition: ByteStreamEventStorageInputSvc.cxx:466
ByteStreamEventStorageInputSvc::m_valEvent
Gaudi::Property< bool > m_valEvent
Definition: ByteStreamEventStorageInputSvc.h:101
RawEvent
OFFLINE_FRAGMENTS_NAMESPACE::FullEventFragment RawEvent
data type for reading raw event
Definition: RawEvent.h:37
ByteStreamEventStorageInputSvc::loadMetadata
StatusCode loadMetadata()
Definition: ByteStreamEventStorageInputSvc.cxx:99
Token
This class provides a token that identifies in a unique way objects on the persistent storage.
Definition: Token.h:21
ByteStreamEventStorageInputSvc::m_wait
Gaudi::Property< float > m_wait
Definition: ByteStreamEventStorageInputSvc.h:100
ByteStreamEventStorageInputSvc::ROBFragmentCheck
bool ROBFragmentCheck(const RawEvent *) const
Definition: ByteStreamEventStorageInputSvc.cxx:566
DataHeaderElement::getKey
const std::string & getKey() const
Definition: DataHeader.cxx:117
Token::OID_t
Definition: Token.h:24
DataHeaderElement
This class provides a persistent form for the TransientAddress.
Definition: DataHeader.h:37
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
ByteStreamExceptions::readError
Definition: ByteStreamExceptions.h:21
OFFLINE_FRAGMENTS_NAMESPACE::DataType
uint32_t DataType
Definition: RawEvent.h:24
ByteStreamEventStorageInputSvc::m_reader
std::unique_ptr< EventStorage::DataReader > m_reader
DataReader from EventStorage.
Definition: ByteStreamEventStorageInputSvc.h:83
eformat::ROBFragment
Definition: L1CaloBsDecoderUtil.h:12
DataHeader
This class provides the layout for summary information stored for data written to POOL.
Definition: DataHeader.h:123
lumiFormat.i
int i
Definition: lumiFormat.py:85
trigmenu_modify_prescale_json.fp
fp
Definition: trigmenu_modify_prescale_json.py:53
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
ClassID_traits
Default, invalid implementation of ClassID_traits.
Definition: Control/AthenaKernel/AthenaKernel/ClassID_traits.h:37
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
Token::setDb
Token & setDb(const Guid &db)
Set database name.
Definition: Token.h:66
hist_file_dump.f
f
Definition: hist_file_dump.py:140
DeMoUpdate.tmp
string tmp
Definition: DeMoUpdate.py:1167
Token::setTechnology
Token & setTechnology(int t)
Set technology type.
Definition: Token.h:79
DataHeader::insert
void insert(const SG::TransientAddress *sgAddress, IOpaqueAddress *tokAddress=0, const std::string &pTag="")
Insert a new element into the "DataObject" vector.
Definition: DataHeader.cxx:261
ByteStreamExceptions::badFragmentData
Definition: ByteStreamExceptions.h:33
DataHeader::setStatus
void setStatus(statusFlag status)
Set StatusFlag enum for DataHeader.
Definition: DataHeader.cxx:229
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
ByteStreamEventStorageInputSvc::readerReady
bool readerReady()
Definition: ByteStreamEventStorageInputSvc.cxx:548
ByteStreamEventStorageInputSvc::buildFragment
void buildFragment(EventCache *cache, uint32_t eventSize, bool validate) const
Definition: ByteStreamEventStorageInputSvc.cxx:304
Token::setOid
Token & setOid(const OID_t &oid)
Set object identifier.
Definition: Token.h:85
TMVAToMVAUtils::convert
std::unique_ptr< MVAUtils::BDT > convert(TMVA::MethodBDT *bdt, bool isRegression=true, bool useYesNoLeaf=false)
Definition: TMVAToMVAUtils.h:114
ByteStreamExceptions::badFragment
Definition: ByteStreamExceptions.h:27
Athena::Status
Status
Athena specific StatusCode values.
Definition: AthStatusCode.h:22
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
ByteStreamEventStorageInputSvc::m_sequential
Gaudi::Property< bool > m_sequential
Definition: ByteStreamEventStorageInputSvc.h:98
re
const boost::regex re(r_e)
ByteStreamEventStorageInputSvc::m_inputMetadata
ServiceHandle< StoreGateSvc > m_inputMetadata
Definition: ByteStreamEventStorageInputSvc.h:96
DataType
OFFLINE_FRAGMENTS_NAMESPACE::PointerType DataType
Definition: CTPResultByteStreamTool.cxx:22
merge.status
status
Definition: merge.py:16
jobOptions.fileName
fileName
Definition: jobOptions.SuperChic_ALP2.py:39
DumpFrags::dump
static void dump(const RawEvent *re)
dump fragments from FullEventFragment
Definition: DumpFrags.h:21
SG::DataProxy
Definition: DataProxy.h:45
ByteStreamEventStorageInputSvc::makeBSProvenance
std::unique_ptr< DataHeaderElement > makeBSProvenance() const
Definition: ByteStreamEventStorageInputSvc.cxx:651
TSU::T
unsigned long long T
Definition: L1TopoDataTypes.h:35
ByteStreamEventStorageInputSvc::m_fileGUID
std::string m_fileGUID
current file GUID
Definition: ByteStreamEventStorageInputSvc.h:89
ByteStreamEventStorageInputSvc::setEvent
virtual void setEvent(void *data, unsigned int eventStatus) override
Definition: ByteStreamEventStorageInputSvc.cxx:598
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37