ATLAS Offline Software
EventSelectorByteStream.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
7 #include <vector>
8 #include <algorithm>
9 
10 #include "EventContextByteStream.h"
14 
15 #include "GaudiKernel/ClassID.h"
16 #include "GaudiKernel/FileIncident.h"
17 #include "GaudiKernel/IIncidentSvc.h"
18 #include "GaudiKernel/IIoComponentMgr.h"
19 
22 
23 // EventInfoAttributeList includes
26 #include "eformat/StreamTag.h"
27 
28 
29 namespace {
31  StatusCode putEvent_ST(const IAthenaIPCTool& tool,
32  long eventNumber, const void* source,
33  size_t nbytes, unsigned int status) {
35  return sc;
36  }
37 }
38 
39 
40 // Constructor.
42  ISvcLocator *svcloc)
43  : base_class(name, svcloc) {
44  declareProperty("HelperTools", m_helperTools);
45 
46  // RunNumber, OldRunNumber and OverrideRunNumberFromInput are used
47  // to override the run number coming in on the input stream
48  m_runNo.verifier().setLower(0);
49  // The following properties are only for compatibility with
50  // McEventSelector and are not really used anywhere
51  // TODO(berghaus): validate if those are even used
52  m_eventsPerRun.verifier().setLower(0);
53  m_firstEventNo.verifier().setLower(1);
54  m_firstLBNo.verifier().setLower(0);
55  m_eventsPerLB.verifier().setLower(0);
56  m_initTimeStamp.verifier().setLower(0);
57 
58  m_inputCollectionsProp.declareUpdateHandler(
60 }
61 
62 /******************************************************************************/
63 void EventSelectorByteStream::inputCollectionsHandler(Gaudi::Details::PropertyBase&) {
64  lock_t lock (m_mutex);
65  if (this->FSMState() != Gaudi::StateMachine::OFFLINE) {
66  this->reinit(lock).ignore();
67  }
68 }
69 
70 
71 /******************************************************************************/
73 }
74 
75 
76 /******************************************************************************/
80 }
81 
82 
83 //________________________________________________________________________________
85 
86  m_autoRetrieveTools = false;
87  m_checkToolDeps = false;
88 
89  if (m_isSecondary.value()) {
90  ATH_MSG_DEBUG("Initializing secondary event selector " << name());
91  } else {
92  ATH_MSG_DEBUG("Initializing " << name());
93  }
94 
95  if (!::AthService::initialize().isSuccess()) {
96  ATH_MSG_FATAL("Cannot initialize AthService base class.");
97  return(StatusCode::FAILURE);
98  }
99 
100  // Check for input setting
101  if (m_filebased && m_inputCollectionsProp.value().empty()) {
102  ATH_MSG_FATAL("Unable to retrieve valid input list");
103  return(StatusCode::FAILURE);
104  }
105  m_skipEventSequence = m_skipEventSequenceProp.value();
106  std::sort(m_skipEventSequence.begin(), m_skipEventSequence.end());
107 
108  // Check ByteStreamCnvSvc
109  m_eventSource = serviceLocator()->service(m_eventSourceName.value());
110  if (!m_eventSource) {
111  ATH_MSG_FATAL("Cannot get ByteStreamInputSvc");
112  return(StatusCode::FAILURE);
113  }
114 
115  // Get CounterTool (if configured)
116  if (!m_counterTool.empty()) {
117  if (!m_counterTool.retrieve().isSuccess()) {
118  ATH_MSG_FATAL("Cannot get CounterTool.");
119  return(StatusCode::FAILURE);
120  }
121  }
122  // Get HelperTools
123  if (!m_helperTools.empty()) {
124  if (!m_helperTools.retrieve().isSuccess()) {
125  ATH_MSG_FATAL("Cannot get " << m_helperTools);
126  return(StatusCode::FAILURE);
127  }
128  }
129  // Get SharedMemoryTool (if configured)
130  if (!m_eventStreamingTool.empty() && !m_eventStreamingTool.retrieve().isSuccess()) {
131  ATH_MSG_FATAL("Cannot get AthenaSharedMemoryTool");
132  return(StatusCode::FAILURE);
133  }
134 
135  // Register this service for 'I/O' events
136  ServiceHandle<IIoComponentMgr> iomgr("IoComponentMgr", name());
137  if (!iomgr.retrieve().isSuccess()) {
138  ATH_MSG_FATAL("Cannot retrieve IoComponentMgr.");
139  return(StatusCode::FAILURE);
140  }
141  if (!iomgr->io_register(this).isSuccess()) {
142  ATH_MSG_FATAL("Cannot register myself with the IoComponentMgr.");
143  return(StatusCode::FAILURE);
144  }
145 
146  // Register the input files with the iomgr
147  bool allGood = true;
148  const std::vector<std::string>& incol = m_inputCollectionsProp.value();
149  for (std::size_t icol = 0, imax = incol.size(); icol != imax; ++icol) {
150  if (!iomgr->io_register(this, IIoComponentMgr::IoMode::READ, incol[icol]).isSuccess()) {
151  ATH_MSG_FATAL("could not register [" << incol[icol] << "] for output !");
152  allGood = false;
153  } else {
154  ATH_MSG_VERBOSE("io_register[" << this->name() << "](" << incol[icol] << ") [ok]");
155  }
156  }
157  if (!allGood) {
158  return(StatusCode::FAILURE);
159  }
160 
161  // Make sure MetaDataSvc is initialized before the first file is opened
162  ServiceHandle<IAthMetaDataSvc> metaDataSvc("MetaDataSvc", name());
163  ATH_CHECK(metaDataSvc.retrieve());
164 
165  // Must happen before trying to open a file
166  lock_t lock (m_mutex);
167  StatusCode risc = this->reinit(lock);
168 
169  return risc;
170 }
171 //__________________________________________________________________________
173  ATH_MSG_INFO("reinitialization...");
174  // reset markers
175  if (m_inputCollectionsProp.value().size()>0) {
176  m_numEvt.resize(m_inputCollectionsProp.value().size(), -1);
177  m_firstEvt.resize(m_inputCollectionsProp.value().size(), -1);
178  }
179  else {
180  m_numEvt.resize(1);
181  m_firstEvt.resize(1);
182  }
183 
184  // Initialize InputCollectionsIterator
185  m_inputCollectionsIterator = m_inputCollectionsProp.value().begin();
186  m_NumEvents = 0;
187  bool retError = false;
188  if (!m_helperTools.empty()) {
189  for (ToolHandle<IAthenaSelectorTool>& tool : m_helperTools) {
190  if (!tool->postInitialize().isSuccess()) {
191  ATH_MSG_FATAL("Failed to postInitialize() " << tool->name());
192  retError = true;
193  }
194  }
195  }
196  if (retError) {
197  ATH_MSG_FATAL("Failed to postInitialize() helperTools");
198  return(StatusCode::FAILURE);
199  }
200 
201  // If file based input then fire appropriate incidents
202  if (m_filebased) {
203  if (!m_firstFileFired) {
204  FileIncident firstInputFileIncident(name(), "FirstInputFile", "BSF:" + *m_inputCollectionsIterator);
205  m_incidentSvc->fireIncident(firstInputFileIncident);
206  m_firstFileFired = true;
207  }
208 
209  // try to open a file
210  if (this->openNewRun(lock).isFailure()) {
211  ATH_MSG_FATAL("Unable to open any file in initialize");
212  return(StatusCode::FAILURE);
213  }
214  // should be in openNewRun, but see comment there
215  m_beginFileFired = true;
216  }
217 
218  return(StatusCode::SUCCESS);
219 }
220 
221 //________________________________________________________________________________
223  ATH_MSG_DEBUG("Calling EventSelectorByteStream::start()");
224  lock_t lock (m_mutex);
225  // Create the begin and end iterator's for this selector.
227  // Increment to get the new event in.
229 
230  return(StatusCode::SUCCESS);
231 }
232 
233 //________________________________________________________________________________
235  ATH_MSG_DEBUG("Calling EventSelectorByteStream::stop()");
236  // Handle open files
237  if (m_filebased) {
238  // Close the file
239  if (m_eventSource->ready()) {
240  m_eventSource->closeBlockIterator(false);
241  FileIncident endInputFileIncident(name(), "EndInputFile", "stop");
242  m_incidentSvc->fireIncident(endInputFileIncident);
243  }
244  }
245  return(StatusCode::SUCCESS);
246 }
247 
248 //__________________________________________________________________________
250  if (!m_counterTool.empty()) {
251  if (!m_counterTool->preFinalize().isSuccess()) {
252  ATH_MSG_WARNING("Failed to preFinalize() CounterTool");
253  }
254  }
255  for (ToolHandle<IAthenaSelectorTool>& tool : m_helperTools) {
256  if (!tool->preFinalize().isSuccess()) {
257  ATH_MSG_WARNING("Failed to preFinalize() " << tool->name());
258  }
259  }
260  delete m_beginIter; m_beginIter = 0;
261  delete m_endIter; m_endIter = 0;
262  // Release AthenaSharedMemoryTool
263  if (!m_eventStreamingTool.empty() && !m_eventStreamingTool.release().isSuccess()) {
264  ATH_MSG_WARNING("Cannot release AthenaSharedMemoryTool");
265  }
266  // Release CounterTool
267  if (!m_counterTool.empty()) {
268  if (!m_counterTool.release().isSuccess()) {
269  ATH_MSG_WARNING("Cannot release CounterTool.");
270  }
271  }
272  // Release HelperTools
273  if (!m_helperTools.release().isSuccess()) {
274  ATH_MSG_WARNING("Cannot release " << m_helperTools);
275  }
276  if (m_eventSource) m_eventSource->release();
277  // Finalize the Service base class.
278  return(AthService::finalize());
279 }
280 
282  FileIncident endInputFileIncident(name(), "EndInputFile", "BSF:" + *m_inputCollectionsIterator);
283  m_incidentSvc->fireIncident(endInputFileIncident);
284  ++m_inputCollectionsIterator;
285  ++m_fileCount;
286 }
287 
289  // Should be protected upstream, but this is further protection
290  if (!m_filebased) {
291  ATH_MSG_ERROR("cannot open new run for non-filebased inputs");
292  return(StatusCode::FAILURE);
293  }
294  // Check for end of file list
295  if (m_inputCollectionsIterator == m_inputCollectionsProp.value().end()) {
296  ATH_MSG_INFO("End of input file list reached");
297  return(StatusCode::FAILURE);
298  }
299  std::string blockname = *m_inputCollectionsIterator;
300  // try to open a file, if failure go to next FIXME: PVG: silent failure?
301  //long nev = m_eventSource->getBlockIterator(blockname);
302  auto nevguid = m_eventSource->getBlockIterator(blockname);
303  long nev = nevguid.first;
304  if (nev == -1) {
305  ATH_MSG_FATAL("Unable to access file " << *m_inputCollectionsIterator << ", stopping here");
307  }
308  // Fire the incident
309  if (!m_beginFileFired) {
310  FileIncident beginInputFileIncident(name(), "BeginInputFile", "BSF:" + *m_inputCollectionsIterator,nevguid.second);
311  m_incidentSvc->fireIncident(beginInputFileIncident);
312  //m_beginFileFired = true; // Should go here, but can't because IEvtSelector next is const
313  }
314 
315  // check if file is empty
316  if (nev == 0) {
317  ATH_MSG_WARNING("no events in file " << blockname << " try next");
318  if (m_eventSource->ready()) m_eventSource->closeBlockIterator(true);
319  this->nextFile(lock);
320  return openNewRun(lock);
321  // check if skipping all events in that file (minus events already skipped)
322  } else if (m_skipEvents.value() - m_NumEvents > nev) {
323  ATH_MSG_WARNING("skipping more events " << m_skipEvents.value() - m_NumEvents << "(" << nev <<") than in file " << *m_inputCollectionsIterator << ", try next");
324  m_NumEvents += nev;
325  m_numEvt[m_fileCount] = nev;
326  if (m_eventSource->ready()) m_eventSource->closeBlockIterator(true);
327  this->nextFile(lock);
328  return openNewRun(lock);
329  }
330 
331  ATH_MSG_DEBUG("Opened block/file " << blockname);
332  m_firstEvt[m_fileCount] = m_NumEvents;
333  m_numEvt[m_fileCount] = nev;
334 
335  return(StatusCode::SUCCESS);
336 }
337 
338 StatusCode EventSelectorByteStream::createContext(IEvtSelector::Context*& it) const {
339  it = new EventContextByteStream(this);
340  return(StatusCode::SUCCESS);
341 }
342 
343 StatusCode EventSelectorByteStream::next(IEvtSelector::Context& it) const {
344  lock_t lock (m_mutex);
345  return nextImpl (it, lock);
346 }
348  lock_t& lock) const
349 {
350  static std::atomic<int> n_bad_events = 0; // cross loop counter of bad events
351  // Check if this is an athenaMP client process
352  if (!m_eventStreamingTool.empty() && m_eventStreamingTool->isClient()) {
353  void* source = 0;
354  unsigned int status = 0;
355  if (!m_eventStreamingTool->getLockedEvent(&source, status).isSuccess()) {
356  ATH_MSG_FATAL("Cannot get NextEvent from AthenaSharedMemoryTool");
357  return(StatusCode::FAILURE);
358  }
359  m_eventSource->setEvent(static_cast<char*>(source), status);
360  return(StatusCode::SUCCESS);
361  }
362  // Call all selector tool preNext before starting loop
363  for (const ToolHandle<IAthenaSelectorTool>& tool : m_helperTools) {
364  if (!tool->preNext().isSuccess()) {
365  ATH_MSG_WARNING("Failed to preNext() " << tool->name());
366  }
367  }
368  if (!m_counterTool.empty()) {
369  if (!m_counterTool->preNext().isSuccess()) {
370  ATH_MSG_WARNING("Failed to preNext() CounterTool.");
371  }
372  }
373  // Find an event to return
374  for (;;) {
375  bool badEvent{};
377  if (sc.isRecoverable()) {
378  badEvent = true;
379  } else if (sc.isFailure()) {
380  return StatusCode::FAILURE;
381  }
382 
383  // increment that an event was found
384  ++m_NumEvents;
385 
386  // check bad event flag and handle as configured
387  if (badEvent) {
388  int nbad = ++n_bad_events;
389  ATH_MSG_INFO("Bad event encountered, current count at " << nbad);
390  bool toomany = (m_maxBadEvts >= 0 && nbad > m_maxBadEvts);
391  if (toomany) {ATH_MSG_FATAL("too many bad events ");}
392  if (!m_procBadEvent || toomany) {
393  // End of file
394  it = *m_endIter;
395  return(StatusCode::FAILURE);
396  }
397  ATH_MSG_WARNING("Continue with bad event");
398  }
399 
400  // Check whether properties or tools reject this event
401  if ( m_NumEvents > m_skipEvents.value() &&
402  (m_skipEventSequence.empty() || m_NumEvents != m_skipEventSequence.front()) ) {
403 
404  // Build a DH for use by other components
405  StatusCode rec_sg = m_eventSource->generateDataHeader();
406  if (rec_sg != StatusCode::SUCCESS) {
407  ATH_MSG_ERROR("Fail to record BS DataHeader in StoreGate. Skipping events?! " << rec_sg);
408  }
409 
410  // Build event info attribute list
411  if (recordAttributeListImpl(lock).isFailure()) ATH_MSG_WARNING("Unable to build event info att list");
412 
413  StatusCode status(StatusCode::SUCCESS);
414  for (const ToolHandle<IAthenaSelectorTool>& tool : m_helperTools) {
415  StatusCode toolStatus = tool->postNext();
416  if (toolStatus.isRecoverable()) {
417  ATH_MSG_INFO("Request skipping event from: " << tool->name());
418  status = StatusCode::RECOVERABLE;
419  } else if (toolStatus.isFailure()) {
420  ATH_MSG_WARNING("Failed to postNext() " << tool->name());
421  status = StatusCode::FAILURE;
422  }
423  }
424  if (status.isRecoverable()) {
425  ATH_MSG_INFO("skipping event " << m_NumEvents);
426  } else if (status.isFailure()) {
427  ATH_MSG_WARNING("Failed to postNext() HelperTool.");
428  } else {
429  if (!m_counterTool.empty()) {
430  if (!m_counterTool->postNext().isSuccess()) {
431  ATH_MSG_WARNING("Failed to postNext() CounterTool.");
432  }
433  }
434  break;
435  }
436 
437  // Validate the event
438  try {
439  m_eventSource->validateEvent();
440  }
442  ATH_MSG_ERROR("badFragment data encountered");
443 
444  int nbad = ++n_bad_events;
445  ATH_MSG_INFO("Bad event encountered, current count at " << nbad);
446 
447  bool toomany = (m_maxBadEvts >= 0 && nbad > m_maxBadEvts);
448  if (toomany) {ATH_MSG_FATAL("too many bad events ");}
449  if (!m_procBadEvent || toomany) {
450  // End of file
451  it = *m_endIter;
452  return(StatusCode::FAILURE);
453  }
454  ATH_MSG_WARNING("Continue with bad event");
455  }
456  } else {
457  if (!m_skipEventSequence.empty() && m_NumEvents == m_skipEventSequence.front()) {
458  m_skipEventSequence.erase(m_skipEventSequence.begin());
459  }
460  if ( m_NumEvents % 1'000 == 0 ) {
461  ATH_MSG_INFO("Skipping event " << m_NumEvents - 1);
462  } else {
463  ATH_MSG_DEBUG("Skipping event " << m_NumEvents - 1);
464  }
465  }
466  } // for loop
467 
468  if (!m_eventStreamingTool.empty() && m_eventStreamingTool->isServer()) { // For SharedReader Server, put event into SHM
469  const RawEvent* pre = m_eventSource->currentEvent();
470  StatusCode sc;
471  while ( (sc = putEvent_ST(*m_eventStreamingTool,
472  m_NumEvents - 1, pre->start(),
473  pre->fragment_size_word() * sizeof(uint32_t),
474  m_eventSource->currentEventStatus())).isRecoverable() ) {
475  usleep(1000);
476  }
477  if (!sc.isSuccess()) {
478  ATH_MSG_ERROR("Cannot put Event " << m_NumEvents - 1 << " to AthenaSharedMemoryTool");
479  return(StatusCode::FAILURE);
480  }
481  }
482  return(StatusCode::SUCCESS);
483 }
484 
485 //________________________________________________________________________________
486 StatusCode EventSelectorByteStream::next(IEvtSelector::Context& ctxt, int jump) const {
487  lock_t lock (m_mutex);
488  return nextImpl (ctxt, jump, lock);
489 }
490 //________________________________________________________________________________
491 StatusCode
492 EventSelectorByteStream::nextImpl(IEvtSelector::Context& ctxt,
493  int jump,
494  lock_t& lock) const
495 {
496  if (jump > 0) {
497  if ( m_NumEvents+jump != m_skipEvents.value()) {
498  // Save initial event count
499  unsigned int cntr = m_NumEvents;
500  // In case NumEvents increments multiple times in a single next call
501  while (m_NumEvents+1 <= cntr + jump) {
502  if (!nextImpl(ctxt, lock).isSuccess()) {
503  return(StatusCode::FAILURE);
504  }
505  }
506  }
507  else ATH_MSG_DEBUG("Jump covered by skip event " << m_skipEvents.value());
508  return(StatusCode::SUCCESS);
509  }
510  else {
511  ATH_MSG_WARNING("Called jump next with non-multiple jump");
512  }
513  return(StatusCode::SUCCESS);
514 }
515 
516 //________________________________________________________________________________
517 StatusCode EventSelectorByteStream::nextHandleFileTransition(IEvtSelector::Context& ctxt) const
518 {
519  lock_t lock (m_mutex);
520  return nextHandleFileTransitionImpl (ctxt, lock);
521 }
522 StatusCode EventSelectorByteStream::nextHandleFileTransitionImpl(IEvtSelector::Context& ctxt,
523  lock_t& lock) const
524 {
525  const RawEvent* pre{};
526  bool badEvent{};
527  // if event source not ready from init, try next file
528  if (m_filebased && !m_eventSource->ready()) {
529  // next file
530  this->nextFile(lock);
531  if (this->openNewRun(lock).isFailure()) {
532  ATH_MSG_DEBUG("Event source found no more valid files left in input list");
533  m_NumEvents = -1;
534  return StatusCode::FAILURE;
535  }
536  }
537  try {
538  pre = m_eventSource->nextEvent();
539  }
540  catch (const ByteStreamExceptions::readError&) {
541  ATH_MSG_FATAL("Caught ByteStreamExceptions::readError");
542  return StatusCode::FAILURE;
543  }
544  catch (const ByteStreamExceptions::badFragment&) {
545  ATH_MSG_ERROR("badFragment encountered");
546  badEvent = true;
547  }
548  catch (const ByteStreamExceptions::badFragmentData&) {
549  ATH_MSG_ERROR("badFragment data encountered");
550  badEvent = true;
551  }
552  // Check whether a RawEvent has actually been provided
553  if (pre == nullptr) {
554  ctxt = *m_endIter;
555  return StatusCode::FAILURE;
556  }
557 
558  // If not secondary just return the status code based on if the event is bas
559  if (!m_isSecondary.value()) {
560  // check bad event flag and handle as configured
561  return badEvent ? StatusCode::RECOVERABLE : StatusCode::SUCCESS;
562  }
563 
564  // Build a DH for use by other components
565  StatusCode rec_sg = m_eventSource->generateDataHeader();
566  if (rec_sg != StatusCode::SUCCESS) {
567  ATH_MSG_ERROR("Fail to record BS DataHeader in StoreGate. Skipping events?! " << rec_sg);
568  }
569 
570  return StatusCode::SUCCESS;
571 }
572 //________________________________________________________________________________
573 StatusCode EventSelectorByteStream::nextWithSkip(IEvtSelector::Context& ctxt) const
574 {
575  lock_t lock (m_mutex);
576  return nextWithSkipImpl (ctxt, lock);
577 }
578 StatusCode EventSelectorByteStream::nextWithSkipImpl(IEvtSelector::Context& ctxt,
579  lock_t& lock) const {
580  ATH_MSG_DEBUG("EventSelectorByteStream::nextWithSkip");
581 
582  for (;;) {
583  // Check if we're at the end of file
585  if (sc.isRecoverable()) {
586  continue; // handles empty files
587  }
588  if (sc.isFailure()) {
589  return StatusCode::FAILURE;
590  }
591 
592  // Increase event count
593  ++m_NumEvents;
594 
595  if (!m_counterTool.empty() && !m_counterTool->preNext().isSuccess()) {
596  ATH_MSG_WARNING("Failed to preNext() CounterTool.");
597  }
598  if ( m_NumEvents > m_skipEvents.value() &&
599  (m_skipEventSequence.empty() || m_NumEvents != m_skipEventSequence.front()) ) {
600  return StatusCode::SUCCESS;
601  } else {
602  if (!m_skipEventSequence.empty() && m_NumEvents == m_skipEventSequence.front()) {
603  m_skipEventSequence.erase(m_skipEventSequence.begin());
604  }
605  if (m_isSecondary.value()) {
606  ATH_MSG_INFO("skipping secondary event " << m_NumEvents);
607  } else {
608  ATH_MSG_INFO("skipping event " << m_NumEvents);
609  }
610  }
611  }
612 
613  return StatusCode::SUCCESS;
614 }
615 //________________________________________________________________________________
616 StatusCode EventSelectorByteStream::previous(IEvtSelector::Context& ctxt) const
617 {
618  lock_t lock (m_mutex);
619  return previousImpl (ctxt, lock);
620 }
621 StatusCode EventSelectorByteStream::previousImpl(IEvtSelector::Context& /*ctxt*/,
622  lock_t& /*lock*/) const {
623  ATH_MSG_DEBUG(" ... previous");
624  const RawEvent* pre = 0;
625  bool badEvent(false);
626  // if event source not ready from init, try next file
627  if (m_eventSource->ready()) {
628  try {
629  pre = m_eventSource->previousEvent();
630  }
631  catch (const ByteStreamExceptions::readError&) {
632  ATH_MSG_FATAL("Caught ByteStreamExceptions::readError");
633  return StatusCode::FAILURE;
634  }
635  catch (const ByteStreamExceptions::badFragment&) {
636  ATH_MSG_ERROR("badFragment encountered");
637  badEvent = true;
638  }
640  ATH_MSG_ERROR("badFragment data encountered");
641  badEvent = true;
642  }
643  // Check whether a RawEvent has actually been provided
644  if (pre == 0) {
645  ATH_MSG_ERROR("No event built");
646  //it = *m_endIter;
647  return(StatusCode::FAILURE);
648  }
649  }
650  else {
651  ATH_MSG_FATAL("Attempt to read previous data on invalid reader");
652  return(StatusCode::FAILURE);
653  }
654  // increment that an event was found
655  //++m_NumEvents;
656 
657  // check bad event flag and handle as configured
658  if (badEvent) {
659  ATH_MSG_ERROR("Called previous for bad event");
660  if (!m_procBadEvent) {
661  // End of file
662  //it = *m_endIter;
663  return(StatusCode::FAILURE);
664  }
665  ATH_MSG_WARNING("Continue with bad event");
666  }
667 
668  // Build a DH for use by other components
669  StatusCode rec_sg = m_eventSource->generateDataHeader();
670  if (rec_sg != StatusCode::SUCCESS) {
671  ATH_MSG_ERROR("Fail to record BS DataHeader in StoreGate. Skipping events?! " << rec_sg);
672  }
673 
674  return StatusCode::SUCCESS;
675 }
676 //________________________________________________________________________________
677 StatusCode EventSelectorByteStream::previous(IEvtSelector::Context& ctxt, int jump) const {
678  lock_t lock (m_mutex);
679  return previousImpl (ctxt, jump, lock);
680 }
681 //________________________________________________________________________________
683 EventSelectorByteStream::previousImpl(IEvtSelector::Context& ctxt,
684  int jump,
685  lock_t& lock) const
686 {
687  if (jump > 0) {
688  for (int i = 0; i < jump; i++) {
689  if (!previousImpl(ctxt, lock).isSuccess()) {
690  return(StatusCode::FAILURE);
691  }
692  }
693  return(StatusCode::SUCCESS);
694  }
695  return(StatusCode::FAILURE);
696 }
697 //________________________________________________________________________________
698 StatusCode EventSelectorByteStream::last(IEvtSelector::Context& it)const {
699  if (it.identifier() == m_endIter->identifier()) {
700  ATH_MSG_DEBUG("last(): Last event in InputStream.");
701  return(StatusCode::SUCCESS);
702  }
703  return(StatusCode::FAILURE);
704 }
705 //________________________________________________________________________________
706 StatusCode EventSelectorByteStream::rewind(IEvtSelector::Context& /*it*/) const {
707  ATH_MSG_ERROR("rewind() not implemented");
708  return(StatusCode::FAILURE);
709 }
710 
711 //________________________________________________________________________________
712 StatusCode EventSelectorByteStream::resetCriteria(const std::string& /*criteria*/, IEvtSelector::Context& /*ctxt*/) const {
713  return(StatusCode::SUCCESS);
714 }
715 
716 //__________________________________________________________________________
717 StatusCode EventSelectorByteStream::seek(Context& /* it */, int evtNum) const {
718  lock_t lock (m_mutex);
719  // Check that input is seekable
720  if (!m_filebased) {
721  ATH_MSG_ERROR("Input not seekable, choose different input svc");
722  return StatusCode::FAILURE;
723  }
724  // find the file index with that event
725  long fileNum = findEvent(evtNum, lock);
726  if (fileNum == -1 && evtNum >= m_firstEvt[m_fileCount] && evtNum < m_NumEvents) {
727  fileNum = m_fileCount;
728  }
729  // if unable to locate file, exit
730  if (fileNum == -1) {
731  ATH_MSG_INFO("seek: Reached end of Input.");
732  return(StatusCode::RECOVERABLE);
733  }
734  // check if it is the current file
735  if (fileNum != m_fileCount) { // event in different file
736  // Close input file if open
737  if (m_eventSource->ready()) m_eventSource->closeBlockIterator(true);
738  ATH_MSG_DEBUG("Seek to item: \"" << m_inputCollectionsProp.value()[fileNum] << "\" from the explicit file list.");
739  std::string fileName = m_inputCollectionsProp.value()[fileNum];
740  m_fileCount = fileNum;
741  // Open the correct file
742  auto nevguid = m_eventSource->getBlockIterator(fileName);
743  long nev = nevguid.first;
744  if (nev == -1) {
745  ATH_MSG_FATAL("Unable to open file with seeked event " << evtNum << " file " << fileName);
746  return StatusCode::FAILURE;
747  }
748  int delta = evtNum - m_firstEvt[m_fileCount];
749  if (delta > 0) {
751  if (nextImpl(*beginIter,delta, lock).isFailure()) return StatusCode::FAILURE;
752  }
753  }
754  // event in current file
755  {
756  int delta = (evtNum - m_firstEvt[m_fileCount] + 1) - m_eventSource->positionInBlock();
757  ATH_MSG_DEBUG("Seeking event " << evtNum << " in current file with delta " << delta);
758  if ( delta == 0 ) { // current event
759  // nothing to do
760  }
761  else if ( delta > 0 ) { // forward
763  if ( this->nextImpl(*beginIter, delta, lock).isFailure() ) return StatusCode::FAILURE;
764  }
765  else if ( delta < 0 ) { // backward
767  if ( this->previousImpl(*beginIter, -1*delta, lock).isFailure() ) return(StatusCode::FAILURE);
768  }
769  }
770  return StatusCode::SUCCESS;
771 }
772 
774 {
775  lock_t lock (m_mutex);
776  return recordAttributeListImpl (lock);
777 }
779 {
780  std::string listName("EventInfoAtts");
781 
782  if (eventStore()->contains<AthenaAttributeList>(listName)) {
783  const AthenaAttributeList* oldAttrList = nullptr;
784  if (!eventStore()->retrieve(oldAttrList, listName).isSuccess()) {
785  ATH_MSG_ERROR("Cannot retrieve old AttributeList from StoreGate.");
786  return(StatusCode::FAILURE);
787  }
788  if (!eventStore()->removeDataAndProxy(oldAttrList).isSuccess()) {
789  ATH_MSG_ERROR("Cannot remove old AttributeList from StoreGate.");
790  return(StatusCode::FAILURE);
791  }
792  }
793 
794  // build the new attr list
795  auto attrList = std::make_unique<AthenaAttributeList>();
796 
797  // fill the attr list
798  ATH_CHECK(fillAttributeListImpl(attrList.get(), "", false, lock));
799 
800  // put result in event store
801  if (eventStore()->record(std::move(attrList), listName).isFailure()) {
802  return StatusCode::FAILURE;
803  }
804 
805  return StatusCode::SUCCESS;
806 }
807 
808 StatusCode EventSelectorByteStream::fillAttributeList(coral::AttributeList *attrList, const std::string &suffix, bool copySource) const
809 {
810  lock_t lock (m_mutex);
811  return fillAttributeListImpl (attrList, suffix, copySource, lock);
812 }
813 StatusCode EventSelectorByteStream::fillAttributeListImpl(coral::AttributeList *attrList, const std::string &suffix, bool /* copySource */,
814  lock_t& /*lock*/) const
815 {
816  attrList->extend("RunNumber" + suffix, "unsigned int");
817  attrList->extend("EventNumber" + suffix, "unsigned long long");
818  attrList->extend("LumiBlockN" + suffix, "unsigned int");
819  attrList->extend("BunchId" + suffix, "unsigned int");
820  attrList->extend("EventTime" + suffix, "unsigned int");
821  attrList->extend("EventTimeNanoSec" + suffix, "unsigned int");
822 
823  // fill attribute list
824  const RawEvent* event = m_eventSource->currentEvent();
825 
826  (*attrList)["RunNumber" + suffix].data<unsigned int>() = event->run_no();
827  if (event->version() < 0x03010000) {
828  (*attrList)["EventNumber" + suffix].data<unsigned long long>() = event->lvl1_id();
829  } else {
830  (*attrList)["EventNumber" + suffix].data<unsigned long long>() = event->global_id();
831  }
832  (*attrList)["LumiBlockN" + suffix].data<unsigned int>() = event->lumi_block();
833  (*attrList)["BunchId" + suffix].data<unsigned int>() = event->bc_id();
834 
835  unsigned int bc_time_sec = event->bc_time_seconds();
836  unsigned int bc_time_ns = event->bc_time_nanoseconds();
837  // bc_time_ns should be lt 1e9.
838  if (bc_time_ns > 1000000000) {
839  // round it off to 1e9
840  ATH_MSG_WARNING(" bc_time nanosecond number larger than 1e9, it is " << bc_time_ns << ", reset it to 1 sec");
841  bc_time_ns = 1000000000;
842  }
843  (*attrList)["EventTime" + suffix].data<unsigned int>() = bc_time_sec;
844  (*attrList)["EventTimeNanoSec" + suffix].data<unsigned int>() = bc_time_ns;
845 
847 
848  event->status(buffer);
849  attrList->extend("TriggerStatus" + suffix, "unsigned int");
850  (*attrList)["TriggerStatus" + suffix].data<unsigned int>() = *buffer;
851 
852  attrList->extend("ExtendedL1ID" + suffix, "unsigned int");
853  attrList->extend("L1TriggerType" + suffix, "unsigned int");
854  (*attrList)["ExtendedL1ID" + suffix].data<unsigned int>() = event->lvl1_id();
855  (*attrList)["L1TriggerType" + suffix].data<unsigned int>() = event->lvl1_trigger_type();
856 
857  // Grab L1 words
858  event->lvl1_trigger_info(buffer);
859  for (uint32_t iT1 = 0; iT1 < event->nlvl1_trigger_info(); ++iT1) {
860  std::stringstream name;
861  name << "L1TriggerInfo_" << iT1;
862  attrList->extend(name.str() + suffix, "unsigned int");
863  (*attrList)[name.str() + suffix].data<unsigned int>() = *buffer;
864  ++buffer;
865  }
866 
867  // Grab L2 words
868  event->lvl2_trigger_info(buffer);
869  for (uint32_t iT1 = 0; iT1 < event->nlvl2_trigger_info(); ++iT1) {
870  if (*buffer != 0) {
871  std::stringstream name;
872  name << "L2TriggerInfo_" << iT1;
873  attrList->extend(name.str() + suffix, "unsigned int");
874  (*attrList)[name.str() + suffix].data<unsigned int>() = *buffer;
875  }
876  ++buffer;
877  }
878 
879  // Grab EF words
880  event->event_filter_info(buffer);
881  for (uint32_t iT1 = 0; iT1 < event->nevent_filter_info(); ++iT1) {
882  if (*buffer != 0) {
883  std::stringstream name;
884  name << "EFTriggerInfo_" << iT1;
885  attrList->extend(name.str() + suffix, "unsigned int");
886  (*attrList)[name.str() + suffix].data<unsigned int>() = *buffer;
887  }
888  ++buffer;
889  }
890 
891  // Grab stream tags
892  event->stream_tag(buffer);
893  std::vector<eformat::helper::StreamTag> onl_streamTags;
894  eformat::helper::decode(event->nstream_tag(), buffer, onl_streamTags);
895  for (std::vector<eformat::helper::StreamTag>::const_iterator itS = onl_streamTags.begin(),
896  itSE = onl_streamTags.end(); itS != itSE; ++itS) {
897  attrList->extend(itS->name + suffix, "string");
898  (*attrList)[itS->name + suffix].data<std::string>() = itS->type;
899  }
900 
901  return StatusCode::SUCCESS;
902 }
903 
904 //__________________________________________________________________________
905 int EventSelectorByteStream::findEvent(int evtNum, lock_t& /*lock*/) const {
906  // Loop over file event counts
907  //ATH_MSG_INFO("try to find evnum = " << evtNum << " in " << m_numEvt.size() << " files");
908  for (size_t i = 0; i < m_inputCollectionsProp.value().size(); i++) {
909  if (m_inputCollectionsProp.value().size() != m_numEvt.size()) {
910  ATH_MSG_ERROR("vector size incompatibility");
911  break;
912  }
913  // if file not opened yet, check it
914  if (m_numEvt[i] == -1) {
915  std::string fileName = m_inputCollectionsProp.value()[i];
916  auto nevguid = m_eventSource->getBlockIterator(fileName);
917  long nev = nevguid.first;
918  // if failure on file open, exit
919  if (nev==-1) {
920  break;
921  }
922  // set initial event counter for that file
923  if (i > 0) {
924  m_firstEvt[i] = m_firstEvt[i - 1] + m_numEvt[i - 1];
925  } else {
926  m_firstEvt[i] = 0;
927  }
928  // log number of events in that file
929  m_numEvt[i] = nev;
930  }
931  // if sought event is in this file, then return the index of that file
932  if (evtNum >= m_firstEvt[i] && evtNum < m_firstEvt[i] + m_numEvt[i]) {
933  ATH_MSG_INFO("found " << evtNum << " in file " << i);
934  return(i);
935  }
936  }
937  ATH_MSG_INFO("did not find ev " << evtNum);
938  // return file not found marker
939  return(-1);
940 }
941 
942 //__________________________________________________________________________
943 int EventSelectorByteStream::curEvent (const Context& /*it*/) const {
944  // event counter in IEvtSelectorSeek interface
945  lock_t lock (m_mutex);
946  return int(m_NumEvents);
947 }
948 
949 //__________________________________________________________________________
950 int EventSelectorByteStream::size (Context& /*it*/) const {
951  return -1;
952 }
953 
954 //________________________________________________________________________________
956  lock_t lock (m_mutex);
957  if (m_eventStreamingTool.empty()) {
958  return(StatusCode::FAILURE);
959  }
960  return(m_eventStreamingTool->makeServer(1, ""));
961 }
962 
963 //________________________________________________________________________________
965  lock_t lock (m_mutex);
966  if (m_eventStreamingTool.empty()) {
967  return(StatusCode::FAILURE);
968  }
969  std::string dummyStr;
970  return(m_eventStreamingTool->makeClient(0, dummyStr));
971 }
972 
973 //________________________________________________________________________________
975  lock_t lock (m_mutex);
976  if (m_eventStreamingTool.empty()) {
977  return(StatusCode::FAILURE);
978  }
979  if (m_eventStreamingTool->isClient()) {
980  StatusCode sc = m_eventStreamingTool->lockEvent(evtNum);
981  while (sc.isRecoverable()) {
982  usleep(1000);
983  sc = m_eventStreamingTool->lockEvent(evtNum);
984  }
985  return(sc);
986  }
987  return(StatusCode::FAILURE);
988 }
989 
990 //________________________________________________________________________________
992  lock_t lock (m_mutex);
993  if (m_eventStreamingTool.empty()) {
994  ATH_MSG_ERROR("No AthenaSharedMemoryTool configured for readEvent()");
995  return(StatusCode::FAILURE);
996  }
997  ATH_MSG_VERBOSE("Called read Event " << maxevt);
998  for (int i = 0; i < maxevt || maxevt == -1; ++i) {
999  const RawEvent* pre = 0;
1000  if (this->nextImpl(*m_beginIter, lock).isSuccess()) {
1001  pre = m_eventSource->currentEvent();
1002  } else {
1003  if (m_NumEvents == -1) {
1004  ATH_MSG_VERBOSE("Called read Event and read last event from input: " << i);
1005  break;
1006  }
1007  ATH_MSG_ERROR("Unable to retrieve next event for " << i << "/" << maxevt);
1008  return(StatusCode::FAILURE);
1009  }
1010  if (m_eventStreamingTool->isServer()) {
1011  StatusCode sc;
1012  while ( (sc = putEvent_ST(*m_eventStreamingTool,
1013  m_NumEvents - 1,
1014  pre->start(),
1015  pre->fragment_size_word() * sizeof(uint32_t),
1016  m_eventSource->currentEventStatus())).isRecoverable() ) {
1017  usleep(1000);
1018  }
1019  if (!sc.isSuccess()) {
1020  ATH_MSG_ERROR("Cannot put Event " << m_NumEvents - 1 << " to AthenaSharedMemoryTool");
1021  return(StatusCode::FAILURE);
1022  }
1023  }
1024  }
1025  // End of file, wait for last event to be taken
1026  StatusCode sc;
1027  while ( (sc = putEvent_ST(*m_eventStreamingTool, 0, 0, 0, 0)).isRecoverable() ) {
1028  usleep(1000);
1029  }
1030  if (!sc.isSuccess()) {
1031  ATH_MSG_ERROR("Cannot put last Event marker to AthenaSharedMemoryTool");
1032  return(StatusCode::FAILURE);
1033  }
1034  return(StatusCode::SUCCESS);
1035 }
1036 
1037 //________________________________________________________________________________
1038 StatusCode EventSelectorByteStream::createAddress(const IEvtSelector::Context& /*it*/,
1039  IOpaqueAddress*& iop) const {
1040  SG::DataProxy* proxy = eventStore()->proxy(ClassID_traits<DataHeader>::ID(),"ByteStreamDataHeader");
1041  if (proxy !=0) {
1042  iop = proxy->address();
1043  return(StatusCode::SUCCESS);
1044  } else {
1045  iop = 0;
1046  return(StatusCode::FAILURE);
1047  }
1048 }
1049 
1050 //________________________________________________________________________________
1051 StatusCode
1052 EventSelectorByteStream::releaseContext(IEvtSelector::Context*& /*it*/) const {
1053  return(StatusCode::SUCCESS);
1054 }
1055 
1056 //________________________________________________________________________________
1058  lock_t lock (m_mutex);
1059  ATH_MSG_INFO("I/O reinitialization...");
1060  ServiceHandle<IIoComponentMgr> iomgr("IoComponentMgr", name());
1061  if (!iomgr.retrieve().isSuccess()) {
1062  ATH_MSG_FATAL("Could not retrieve IoComponentMgr !");
1063  return(StatusCode::FAILURE);
1064  }
1065  if (!iomgr->io_hasitem(this)) {
1066  ATH_MSG_FATAL("IoComponentMgr does not know about myself !");
1067  return(StatusCode::FAILURE);
1068  }
1069  std::vector<std::string> inputCollections = m_inputCollectionsProp.value();
1070  for (std::size_t i = 0, imax = inputCollections.size(); i != imax; ++i) {
1071  ATH_MSG_INFO("I/O reinitialization, file = " << inputCollections[i]);
1072  std::string &fname = inputCollections[i];
1073  if (!iomgr->io_contains(this, fname)) {
1074  ATH_MSG_ERROR("IoComponentMgr does not know about [" << fname << "] !");
1075  return(StatusCode::FAILURE);
1076  }
1077  if (!iomgr->io_retrieve(this, fname).isSuccess()) {
1078  ATH_MSG_FATAL("Could not retrieve new value for [" << fname << "] !");
1079  return(StatusCode::FAILURE);
1080  }
1081  }
1082  // all good... copy over.
1083  m_beginFileFired = false;
1084 
1085  // Set m_inputCollectionsProp. But we _dont_ want to run the update
1086  // handler --- that calls reinit(), which will deadlock since
1087  // we're holding the lock. Instead, we'll call reinit() ourselves.
1088  auto old_cb = m_inputCollectionsProp.updateCallBack();
1089  m_inputCollectionsProp.declareUpdateHandler(
1090  [] (Gaudi::Details::PropertyBase&) {}
1091  );
1093  m_inputCollectionsProp.declareUpdateHandler (old_cb);;
1094 
1095  return(this->reinit(lock));
1096 }
1097 
1098 //__________________________________________________________________________
1100 {
1101  return true;
1102 }
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
EventSelectorByteStream.h
EventSelectorByteStream::m_firstFileFired
bool m_firstFileFired
Definition: EventSelectorByteStream.h:196
EventSelectorByteStream::curEvent
virtual int curEvent(const Context &it) const override
Return the current event number.
Definition: EventSelectorByteStream.cxx:943
AtlasMcWeight::decode
double decode(number_type binnedWeight)
Convert weight from unsigned to double.
Definition: AtlasMcWeight.cxx:32
EventSelectorByteStream::findEvent
int findEvent(int evtNum, lock_t &lock) const
Search for event with number evtNum.
Definition: EventSelectorByteStream.cxx:905
python.tests.PyTestsLib.finalize
def finalize(self)
_info( "content of StoreGate..." ) self.sg.dump()
Definition: PyTestsLib.py:50
EventSelectorByteStream::m_filebased
Gaudi::Property< bool > m_filebased
Definition: EventSelectorByteStream.h:207
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
hotSpotInTAG.suffix
string suffix
Definition: hotSpotInTAG.py:186
StateLessPT_NewConfig.proxy
proxy
Definition: StateLessPT_NewConfig.py:392
EventSelectorByteStream::m_skipEvents
Gaudi::Property< long > m_skipEvents
Definition: EventSelectorByteStream.h:193
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
EventSelectorByteStream::makeClient
virtual StatusCode makeClient(int num) override
Make this a client.
Definition: EventSelectorByteStream.cxx:964
EventSelectorByteStream::fillAttributeList
virtual StatusCode fillAttributeList(coral::AttributeList *attrList, const std::string &suffix, bool copySource) const override
Fill AttributeList with specific items from the selector and a suffix.
Definition: EventSelectorByteStream.cxx:808
OFFLINE_FRAGMENTS_NAMESPACE::DataType
uint32_t DataType
Definition: RawEvent.h:24
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
IAthMetaDataSvc.h
This file contains the class definition for the IAthMetaDataSvc class.
initialize
void initialize()
Definition: run_EoverP.cxx:894
EventContextByteStream::identifier
virtual void * identifier() const
Inequality operator.
Definition: EventContextByteStream.cxx:25
RawEvent
OFFLINE_FRAGMENTS_NAMESPACE::FullEventFragment RawEvent
data type for reading raw event
Definition: RawEvent.h:37
skel.it
it
Definition: skel.GENtoEVGEN.py:396
EventSelectorByteStream::eventStore
StoreGateSvc * eventStore() const
Definition: EventSelectorByteStream.cxx:78
EventSelectorByteStream::openNewRun
StatusCode openNewRun(lock_t &lock) const
Definition: EventSelectorByteStream.cxx:288
EventSelectorByteStream::fillAttributeListImpl
StatusCode fillAttributeListImpl(coral::AttributeList *attrList, const std::string &suffix, bool copySource, lock_t &lock) const
Definition: EventSelectorByteStream.cxx:813
python.PyKernel.AttributeList
AttributeList
Definition: PyKernel.py:36
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
EventSelectorByteStream::m_runNo
Gaudi::CheckedProperty< int > m_runNo
Definition: EventSelectorByteStream.h:209
EventSelectorByteStream::~EventSelectorByteStream
virtual ~EventSelectorByteStream()
Standard Destructor.
Definition: EventSelectorByteStream.cxx:72
AthenaAttributeList.h
EventSelectorByteStream::nextHandleFileTransitionImpl
StatusCode nextHandleFileTransitionImpl(IEvtSelector::Context &ctxt, lock_t &lock) const
Definition: EventSelectorByteStream.cxx:522
EventSelectorByteStream::m_firstLBNo
Gaudi::CheckedProperty< int > m_firstLBNo
Definition: EventSelectorByteStream.h:212
EventSelectorByteStream::rewind
virtual StatusCode rewind(Context &it) const override
Definition: EventSelectorByteStream.cxx:706
EventSelectorByteStream::m_beginIter
EventContextByteStream * m_beginIter
Definition: EventSelectorByteStream.h:186
EventSelectorByteStream::EventSelectorByteStream
EventSelectorByteStream(const std::string &name, ISvcLocator *svcloc)
Standard Constructor.
Definition: EventSelectorByteStream.cxx:41
EventSelectorByteStream::readEvent
virtual StatusCode readEvent(int maxevt) override
Read the next maxevt events.
Definition: EventSelectorByteStream.cxx:991
atlasStyleMacro.icol
int icol
Definition: atlasStyleMacro.py:13
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
EventSelectorByteStream::createContext
virtual StatusCode createContext(Context *&it) const override
create context
Definition: EventSelectorByteStream.cxx:338
EventSelectorByteStream::m_mutex
mutex_t m_mutex
Definition: EventSelectorByteStream.h:170
EventSelectorByteStream::createAddress
virtual StatusCode createAddress(const Context &it, IOpaqueAddress *&iop) const override
Definition: EventSelectorByteStream.cxx:1038
EventSelectorByteStream::m_endIter
EventContextByteStream * m_endIter
Definition: EventSelectorByteStream.h:187
EventSelectorByteStream::size
virtual int size(Context &it) const override
Always returns -1.
Definition: EventSelectorByteStream.cxx:950
EventSelectorByteStream::m_helperTools
ToolHandleArray< IAthenaSelectorTool > m_helperTools
HelperTools, vector of names of AlgTools that are executed by the EventSelector.
Definition: EventSelectorByteStream.h:200
StoreGateSvc
The Athena Transient Store API.
Definition: StoreGateSvc.h:125
TileAANtupleConfig.inputCollections
inputCollections
Definition: TileAANtupleConfig.py:133
EventSelectorByteStream::m_initTimeStamp
Gaudi::CheckedProperty< int > m_initTimeStamp
Definition: EventSelectorByteStream.h:214
createCoolChannelIdFile.buffer
buffer
Definition: createCoolChannelIdFile.py:12
EventSelectorByteStream::reinit
StatusCode reinit(lock_t &lock)
Reinitialize the service when a fork() occurred/was-issued.
Definition: EventSelectorByteStream.cxx:172
FortranAlgorithmOptions.fileName
fileName
Definition: FortranAlgorithmOptions.py:13
EventSelectorByteStream::nextFile
void nextFile(lock_t &lock) const
Definition: EventSelectorByteStream.cxx:281
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
ByteStreamExceptions::readError
Definition: ByteStreamExceptions.h:21
event
POOL::TEvent event(POOL::TEvent::kClassAccess)
EventSelectorByteStream::nextImpl
StatusCode nextImpl(Context &it, lock_t &lock) const
Definition: EventSelectorByteStream.cxx:347
lumiFormat.i
int i
Definition: lumiFormat.py:85
IAthenaIPCTool
Definition: IAthenaIPCTool.h:14
EventSelectorByteStream::m_counterTool
ToolHandle< IAthenaSelectorTool > m_counterTool
Definition: EventSelectorByteStream.h:201
EventSelectorByteStream::m_eventsPerRun
Gaudi::CheckedProperty< int > m_eventsPerRun
Definition: EventSelectorByteStream.h:211
EventSelectorByteStream::m_procBadEvent
Gaudi::Property< bool > m_procBadEvent
process bad events, which fail check_tree().
Definition: EventSelectorByteStream.h:183
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
EventSelectorByteStream::inputCollectionsHandler
void inputCollectionsHandler(Gaudi::Details::PropertyBase &)
Definition: EventSelectorByteStream.cxx:63
ByteStreamExceptions.h
StoreGateSvc::currentStoreGate
static StoreGateSvc * currentStoreGate()
get current StoreGate
Definition: StoreGateSvc.cxx:69
ClassID_traits
Default, invalid implementation of ClassID_traits.
Definition: Control/AthenaKernel/AthenaKernel/ClassID_traits.h:40
file
TFile * file
Definition: tile_monitor.h:29
EventSelectorByteStream::m_maxBadEvts
Gaudi::Property< int > m_maxBadEvts
number of bad events allowed before quitting.
Definition: EventSelectorByteStream.h:184
EventSelectorByteStream::ATLAS_THREAD_SAFE
int m_fileCount ATLAS_THREAD_SAFE
number of files to process.
Definition: EventSelectorByteStream.h:171
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
EventSelectorByteStream::last
virtual StatusCode last(Context &it) const override
Definition: EventSelectorByteStream.cxx:698
AthenaAttributeList
An AttributeList represents a logical row of attributes in a metadata table. The name and type of eac...
Definition: PersistentDataModel/PersistentDataModel/AthenaAttributeList.h:45
xAOD::eventNumber
eventNumber
Definition: EventInfo_v1.cxx:124
ByteStreamAddress.h
EventSelectorByteStream::m_firstEventNo
Gaudi::CheckedProperty< int > m_firstEventNo
Definition: EventSelectorByteStream.h:210
DataHeader.h
This file contains the class definition for the DataHeader and DataHeaderElement classes.
imax
int imax(int i, int j)
Definition: TileLaserTimingTool.cxx:33
python.egammaTruthD3PDObject.blockname
blockname
Definition: egammaTruthD3PDObject.py:64
EventSelectorByteStream::m_isSecondary
Gaudi::Property< bool > m_isSecondary
IsSecondary, know if this is an instance of secondary event selector.
Definition: EventSelectorByteStream.h:180
checkRpcDigits.allGood
bool allGood
Loop over the SDOs & Digits.
Definition: checkRpcDigits.py:171
ByteStreamExceptions::badFragmentData
Definition: ByteStreamExceptions.h:33
EventSelectorByteStream::stop
virtual StatusCode stop() override
Definition: EventSelectorByteStream.cxx:234
EventSelectorByteStream::m_incidentSvc
ServiceHandle< IIncidentSvc > m_incidentSvc
Definition: EventSelectorByteStream.h:191
EventSelectorByteStream::m_eventSourceName
Gaudi::Property< std::string > m_eventSourceName
Definition: EventSelectorByteStream.h:182
EventSelectorByteStream::m_inputCollectionsProp
Gaudi::Property< std::vector< std::string > > m_inputCollectionsProp
Definition: EventSelectorByteStream.h:189
StoreGateSvc::proxy
virtual SG::DataProxy * proxy(const void *const pTransient) const override final
get proxy for a given data object address in memory
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
pool::READ
@ READ
Definition: Database/APR/StorageSvc/StorageSvc/pool.h:68
EventSelectorByteStream::m_beginFileFired
bool m_beginFileFired
Definition: EventSelectorByteStream.h:197
AtlCoolConsole.tool
tool
Definition: AtlCoolConsole.py:453
EventSelectorAthenaPool::ATLAS_THREAD_SAFE
PoolCollectionConverter *m_poolCollectionConverter ATLAS_THREAD_SAFE
Definition: EventSelectorAthenaPool.h:171
EventSelectorByteStream::recordAttributeListImpl
StatusCode recordAttributeListImpl(lock_t &lock) const
Definition: EventSelectorByteStream.cxx:778
EventSelectorByteStream::previous
virtual StatusCode previous(Context &it) const override
Definition: EventSelectorByteStream.cxx:616
python.AthDsoLogger.fname
string fname
Definition: AthDsoLogger.py:67
EventSelectorByteStream::seek
virtual StatusCode seek(Context &, int evtnum) const override
Seek to a given event number.
Definition: EventSelectorByteStream.cxx:717
ByteStreamExceptions::fileAccessError
Definition: ByteStreamExceptions.h:15
EventSelectorByteStream::finalize
virtual StatusCode finalize() override
Definition: EventSelectorByteStream.cxx:249
EventSelectorByteStream::m_eventSource
SmartIF< IByteStreamInputSvc > m_eventSource
Definition: EventSelectorByteStream.h:188
EventSelectorByteStream::share
virtual StatusCode share(int evtnum) override
Request to share a given event number.
Definition: EventSelectorByteStream.cxx:974
ByteStreamExceptions::badFragment
Definition: ByteStreamExceptions.h:27
EventSelectorByteStream::start
virtual StatusCode start() override
Definition: EventSelectorByteStream.cxx:222
LArCellNtuple.nev
int nev
Definition: LArCellNtuple.py:135
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
SG::SourceID
std::string SourceID
Definition: AthenaKernel/AthenaKernel/SourceID.h:25
re
const boost::regex re(r_e)
EventSelectorByteStream::makeServer
virtual StatusCode makeServer(int num) override
Make this a server.
Definition: EventSelectorByteStream.cxx:955
EventSelectorByteStream::releaseContext
virtual StatusCode releaseContext(Context *&it) const override
Definition: EventSelectorByteStream.cxx:1052
if
if(febId1==febId2)
Definition: LArRodBlockPhysicsV0.cxx:567
EventSelectorByteStream::disconnectIfFinished
virtual bool disconnectIfFinished(const SG::SourceID &fid) const override
Definition: EventSelectorByteStream.cxx:1099
EventContextByteStream
This class provides the Context for EventSelectorByteStream.
Definition: EventContextByteStream.h:21
EventSelectorByteStream::recordAttributeList
virtual StatusCode recordAttributeList() const override
Record AttributeList in StoreGate.
Definition: EventSelectorByteStream.cxx:773
EventSelectorByteStream::m_eventsPerLB
Gaudi::CheckedProperty< int > m_eventsPerLB
Definition: EventSelectorByteStream.h:213
EventSelectorByteStream::m_skipEventSequenceProp
Gaudi::Property< std::vector< long > > m_skipEventSequenceProp
Definition: EventSelectorByteStream.h:194
copySelective.source
string source
Definition: copySelective.py:32
merge.status
status
Definition: merge.py:17
EventContextByteStream.h
This file contains the class definition for the EventContextByteStream class.
checker_macros.h
Define macros for attributes used to control the static checker.
SG::DataProxy
Definition: DataProxy.h:45
EventSelectorByteStream::lock_t
std::lock_guard< mutex_t > lock_t
Definition: EventSelectorByteStream.h:127
EventSelectorByteStream::previousImpl
StatusCode previousImpl(Context &it, lock_t &lock) const
Definition: EventSelectorByteStream.cxx:621
IAthenaIPCTool.h
EventSelectorByteStream::initialize
virtual StatusCode initialize() override
Implementation of Service base class methods.
Definition: EventSelectorByteStream.cxx:84
EventSelectorByteStream::next
virtual StatusCode next(Context &it) const override
Definition: EventSelectorByteStream.cxx:343
EventSelectorByteStream::resetCriteria
virtual StatusCode resetCriteria(const std::string &criteria, Context &context) const override
Set a selection criteria.
Definition: EventSelectorByteStream.cxx:712
ServiceHandle< IIoComponentMgr >
EventSelectorByteStream::io_reinit
virtual StatusCode io_reinit() override
Callback method to reinitialize the internal state of the component for I/O purposes (e....
Definition: EventSelectorByteStream.cxx:1057