The Gaudi Framework  v29r0 (ff2e7097)
HiveSlimEventLoopMgr.cpp
Go to the documentation of this file.
1 // FW includes
4 #include "GaudiKernel/DataSvc.h"
13 #include "GaudiKernel/Incident.h"
14 #include "GaudiKernel/MsgStream.h"
15 #include "GaudiKernel/SmartIF.h"
16 #include "GaudiKernel/SvcFactory.h"
17 
18 #include "HistogramAgent.h"
19 
21 
22 #include "GaudiKernel/Algorithm.h"
24 
26 
27 #include <GaudiKernel/IScheduler.h>
28 
29 // External libraries
30 #include <chrono>
31 
32 // Instantiation of a static factory class used by clients to create instances of this service
34 
35 #define ON_DEBUG if ( UNLIKELY( outputLevel() <= MSG::DEBUG ) )
36 #define ON_VERBOSE if ( UNLIKELY( outputLevel() <= MSG::VERBOSE ) )
37 
38 #define DEBMSG ON_DEBUG debug()
39 #define VERMSG ON_VERBOSE verbose()
40 
41 //--------------------------------------------------------------------------------------------
42 // Standard Constructor
43 //--------------------------------------------------------------------------------------------
45  : base_class( name, svcLoc ), m_appMgrUI( svcLoc )
46 {
47 }
48 
49 //--------------------------------------------------------------------------------------------
50 // Standard Destructor
51 //--------------------------------------------------------------------------------------------
53 {
59  if ( m_evtContext ) delete m_evtContext;
60 }
61 
62 //--------------------------------------------------------------------------------------------
63 // implementation of IAppMgrUI::initialize
64 //--------------------------------------------------------------------------------------------
66 {
67 
68  if ( !m_appMgrUI.isValid() ) {
69  return StatusCode::FAILURE;
70  }
71 
73  if ( !sc.isSuccess() ) {
74  error() << "Failed to initialize Service Base class." << endmsg;
75  return StatusCode::FAILURE;
76  }
77 
78  // Get the references to the services that are needed by the ApplicationMgr itself
79  m_incidentSvc = serviceLocator()->service( "IncidentSvc" );
80  if ( !m_incidentSvc.isValid() ) {
81  fatal() << "Error retrieving IncidentSvc." << endmsg;
82  return StatusCode::FAILURE;
83  }
84 
85  // Setup access to event data services
86  m_evtDataMgrSvc = serviceLocator()->service( "EventDataSvc" );
87  if ( !m_evtDataMgrSvc.isValid() ) {
88  fatal() << "Error retrieving EventDataSvc interface IDataManagerSvc." << endmsg;
89  return StatusCode::FAILURE;
90  }
91  m_whiteboard = serviceLocator()->service( "EventDataSvc" );
92  if ( !m_whiteboard.isValid() ) {
93  fatal() << "Error retrieving EventDataSvc interface IHiveWhiteBoard." << endmsg;
94  return StatusCode::FAILURE;
95  }
97  if ( !m_schedulerSvc.isValid() ) {
98  fatal() << "Error retrieving SchedulerSvc interface IScheduler." << endmsg;
99  return StatusCode::FAILURE;
100  }
101  // Obtain the IProperty of the ApplicationMgr
103  if ( !m_appMgrProperty.isValid() ) {
104  fatal() << "IProperty interface not found in ApplicationMgr." << endmsg;
105  return StatusCode::FAILURE;
106  }
107 
108  // We do not expect a Event Selector necessarily being declared
109  setProperty( m_appMgrProperty->getProperty( "EvtSel" ) ).ignore();
110 
111  if ( m_evtsel != "NONE" || m_evtsel.length() == 0 ) {
112  m_evtSelector = serviceLocator()->service( "EventSelector" );
113  if ( m_evtSelector.isValid() ) {
114  // Setup Event Selector
116  if ( !sc.isSuccess() ) {
117  fatal() << "Can not create the event selector Context." << endmsg;
118  return sc;
119  }
120  } else {
121  fatal() << "EventSelector not found." << endmsg;
122  return sc;
123  }
124  } else {
125  m_evtSelector = 0;
126  m_evtContext = 0;
127  if ( m_warnings ) {
128  warning() << "Unable to locate service \"EventSelector\" " << endmsg;
129  warning() << "No events will be processed from external input." << endmsg;
130  }
131  }
132 
133  // Setup access to histogramming services
134  m_histoDataMgrSvc = serviceLocator()->service( "HistogramDataSvc" );
135  if ( !m_histoDataMgrSvc.isValid() ) {
136  fatal() << "Error retrieving HistogramDataSvc." << endmsg;
137  return sc;
138  }
139  // Setup histogram persistency
140  m_histoPersSvc = serviceLocator()->service( "HistogramPersistencySvc" );
141  if ( !m_histoPersSvc.isValid() ) {
142  warning() << "Histograms cannot not be saved - though required." << endmsg;
143  return sc;
144  }
145 
146  // Setup algorithm resource pool
147  m_algResourcePool = serviceLocator()->service( "AlgResourcePool" );
148  if ( !m_algResourcePool.isValid() ) {
149  fatal() << "Error retrieving AlgResourcePool" << endmsg;
150  return StatusCode::FAILURE;
151  }
152 
153  m_algExecStateSvc = serviceLocator()->service( "AlgExecStateSvc" );
154  if ( !m_algExecStateSvc.isValid() ) {
155  fatal() << "Error retrieving AlgExecStateSvc" << endmsg;
156  return StatusCode::FAILURE;
157  }
158 
160  info() << "Found " << m_eventNumberBlacklist.size() << " events in black list" << endmsg;
161 
162  return StatusCode::SUCCESS;
163 }
164 //--------------------------------------------------------------------------------------------
165 // implementation of IService::reinitialize
166 //--------------------------------------------------------------------------------------------
168 {
169 
170  // Check to see whether a new Event Selector has been specified
171  setProperty( m_appMgrProperty->getProperty( "EvtSel" ) );
172  if ( m_evtsel != "NONE" || m_evtsel.length() == 0 ) {
173  SmartIF<IService> theSvc( serviceLocator()->service( "EventSelector" ) );
174  SmartIF<IEvtSelector> theEvtSel( theSvc );
175  StatusCode sc;
176  if ( theEvtSel.isValid() && ( theEvtSel.get() != m_evtSelector.get() ) ) {
177  // Setup Event Selector
178  if ( m_evtSelector.get() && m_evtContext ) {
179  // Need to release context before switching to new event selector
181  m_evtContext = 0;
182  }
183  m_evtSelector = theEvtSel;
184  if ( theSvc->FSMState() == Gaudi::StateMachine::INITIALIZED ) {
185  sc = theSvc->reinitialize();
186  if ( !sc.isSuccess() ) {
187  error() << "Failure Reinitializing EventSelector " << theSvc->name() << endmsg;
188  return sc;
189  }
190  } else {
191  sc = theSvc->sysInitialize();
192  if ( !sc.isSuccess() ) {
193  error() << "Failure Initializing EventSelector " << theSvc->name() << endmsg;
194  return sc;
195  }
196  }
198  if ( !sc.isSuccess() ) {
199  error() << "Can not create Context " << theSvc->name() << endmsg;
200  return sc;
201  }
202 
203  } else if ( m_evtSelector.isValid() ) {
204  if ( m_evtContext ) {
206  m_evtContext = 0;
207  }
209  if ( !sc.isSuccess() ) {
210  error() << "Can not create Context " << theSvc->name() << endmsg;
211  return sc;
212  }
213  }
214  } else if ( m_evtSelector.isValid() && m_evtContext ) {
216  m_evtSelector = 0;
217  m_evtContext = 0;
218  }
219  return StatusCode::SUCCESS;
220 }
221 
222 //--------------------------------------------------------------------------------------------
223 // implementation of IService::stop
224 //--------------------------------------------------------------------------------------------
225 // Removed call to MinimalEventLoopMgr!
227 {
228  if ( !m_endEventFired ) {
229  // Fire pending EndEvent incident
230  m_incidentSvc->fireIncident( Incident( name(), IncidentType::EndEvent ) );
231  m_endEventFired = true;
232  }
233  return StatusCode::SUCCESS;
234 }
235 
236 //--------------------------------------------------------------------------------------------
237 // implementation of IAppMgrUI::finalize
238 //--------------------------------------------------------------------------------------------
239 // Removed call to MinimalEventLoopMgr!
241 {
242 
243  StatusCode scRet;
245 
246  if ( sc.isFailure() ) {
247  scRet = StatusCode::FAILURE;
248  error() << "Problems finalizing Service base class" << endmsg;
249  }
250 
251  // Save Histograms Now
252  if ( m_histoPersSvc != 0 ) {
253  HistogramAgent agent;
254  sc = m_histoDataMgrSvc->traverseTree( &agent );
255  if ( sc.isSuccess() ) {
256  IDataSelector* objects = agent.selectedObjects();
257  // skip /stat entry!
258  if ( objects->size() > 0 ) {
259  IDataSelector::iterator i;
260  for ( i = objects->begin(); i != objects->end(); i++ ) {
261  IOpaqueAddress* pAddr = 0;
262  StatusCode iret = m_histoPersSvc->createRep( *i, pAddr );
263  if ( iret.isSuccess() ) {
264  ( *i )->registry()->setAddress( pAddr );
265  } else {
266  sc = iret;
267  }
268  }
269  for ( i = objects->begin(); i != objects->end(); i++ ) {
270  IRegistry* reg = ( *i )->registry();
271  StatusCode iret = m_histoPersSvc->fillRepRefs( reg->address(), *i );
272  if ( !iret.isSuccess() ) {
273  sc = iret;
274  }
275  }
276  }
277  if ( sc.isSuccess() ) {
278  info() << "Histograms converted successfully according to request." << endmsg;
279  } else {
280  error() << "Error while saving Histograms." << endmsg;
281  }
282  } else {
283  error() << "Error while traversing Histogram data store" << endmsg;
284  }
285  }
286 
287  scRet = sc;
288 
289  // Release event selector context
290  if ( m_evtSelector && m_evtContext ) {
292  m_evtContext = 0;
293  }
294 
295  m_incidentSvc = 0; // release
296  m_appMgrUI = 0; // release
297 
298  // Release all interfaces...
299  m_histoDataMgrSvc = 0;
300  m_histoPersSvc = 0;
301 
302  m_evtSelector = 0;
303  m_whiteboard = 0;
304  m_evtDataMgrSvc = 0;
305 
306  return scRet;
307 }
308 
309 //--------------------------------------------------------------------------------------------
310 // implementation of executeEvent(void* par)
311 //--------------------------------------------------------------------------------------------
313 {
314 
315  // Leave the interface intact and swallow this C trick.
316  int& createdEvts = *( (int*)createdEvts_IntPtr );
317 
318  EventContext* evtContext( nullptr );
319 
320  // Check if event number is in blacklist
321  if ( LIKELY( m_blackListBS != nullptr ) ) { // we are processing a finite number of events, use bitset blacklist
322  if ( m_blackListBS->test( createdEvts ) ) {
323  verbose() << "Event " << createdEvts << " on black list" << endmsg;
325  }
326  } else if ( std::binary_search( m_eventNumberBlacklist.begin(), m_eventNumberBlacklist.end(), createdEvts ) ) {
327 
328  verbose() << "Event " << createdEvts << " on black list" << endmsg;
330  }
331 
332  if ( createEventContext( evtContext, createdEvts ).isFailure() ) {
333  fatal() << "Impossible to create event context" << endmsg;
334  return StatusCode::FAILURE;
335  }
336 
337  verbose() << "Beginning to process event " << createdEvts << endmsg;
338 
339  // An incident may schedule a stop, in which case is better to exit before the actual execution.
340  // DP have to find out who shoots this
341  /* if ( m_scheduledStop ) {
342  always() << "Terminating event processing loop due to a stop scheduled by an incident listener" << endmsg;
343  return StatusCode::SUCCESS;
344  }*/
345 
346  StatusCode declEvtRootSc = declareEventRootAddress();
347  if ( declEvtRootSc.isFailure() ) { // We ran out of events!
348  createdEvts = -1; // Set created event to a negative value: we finished!
349  return StatusCode::SUCCESS;
350  }
351 
352  // Fire BeginEvent "Incident"
354  std::unique_ptr<Incident>( new Incident( name(), IncidentType::BeginEvent, *evtContext ) ) );
355 
356  // Now add event to the scheduler
357  verbose() << "Adding event " << evtContext->evt() << ", slot " << evtContext->slot() << " to the scheduler" << endmsg;
358 
360  std::unique_ptr<Incident>( new Incident( name(), IncidentType::BeginProcessing, *evtContext ) ) );
361 
362  StatusCode addEventStatus = m_schedulerSvc->pushNewEvent( evtContext );
363 
364  // If this fails, we need to wait for something to complete
365  if ( !addEventStatus.isSuccess() ) {
366  fatal() << "An event processing slot should be now free in the scheduler, but it appears not to be the case."
367  << endmsg;
368  }
369 
370  createdEvts++;
371  return StatusCode::SUCCESS;
372 }
373 
374 //--------------------------------------------------------------------------------------------
375 // implementation of IEventProcessing::executeRun
376 //--------------------------------------------------------------------------------------------
378 {
379  StatusCode sc;
380  bool eventfailed = false;
381 
382  if ( maxevt > 0 ) { // finite number of events to process
383  const unsigned int umaxevt = static_cast<unsigned int>( maxevt );
384  m_blackListBS = new boost::dynamic_bitset<>( maxevt ); // all initialized to zero
385  for ( unsigned int i = 0; i < m_eventNumberBlacklist.size() && m_eventNumberBlacklist[i] <= umaxevt;
386  ++i ) { // black list is sorted in init
387  m_blackListBS->set( m_eventNumberBlacklist[i], true );
388  }
389  }
390 
391  sc = m_algResourcePool->beginRun();
392  if ( sc.isFailure() ) eventfailed = true;
393 
394  // Call now the nextEvent(...)
395  sc = nextEvent( maxevt );
396  if ( !sc.isSuccess() ) eventfailed = true;
397 
398  sc = m_algResourcePool->endRun();
399  if ( sc.isFailure() ) eventfailed = true;
400 
401  if ( m_blackListBS != nullptr ) delete m_blackListBS;
402 
403  if ( eventfailed )
404  return StatusCode::FAILURE;
405  else
406  return StatusCode::SUCCESS;
407 }
408 
409 //--------------------------------------------------------------------------------------------
410 // Implementation of IEventProcessor::stopRun()
411 //--------------------------------------------------------------------------------------------
413 {
414  // Set the application return code
416  if ( Gaudi::setAppReturnCode( appmgr, Gaudi::ReturnCode::ScheduledStop ).isFailure() ) {
417  error() << "Could not set return code of the application (" << Gaudi::ReturnCode::ScheduledStop << ")" << endmsg;
418  }
419  m_scheduledStop = true;
420  return StatusCode::SUCCESS;
421 }
422 
423 //--------------------------------------------------------------------------------------------
424 // implementation of IAppMgrUI::nextEvent
425 //--------------------------------------------------------------------------------------------
426 // Here the loop on the events takes place.
427 // This is also the natural place to put the preparation of the algorithms
428 // contexts, which contain the event specific data.
429 #include "GaudiKernel/Memory.h"
431 {
432 
433  // Calculate runtime
436 
437  // Reset the application return code.
439 
440  int finishedEvts = 0;
441  int createdEvts = 0;
442  int skippedEvts = 0;
443  info() << "Starting loop on events" << endmsg;
444  // Loop until the finished events did not reach the maxevt number
445  bool loop_ended = false;
446  // Run the first event before spilling more than one
447  bool newEvtAllowed = false;
448 
449  constexpr double oneOver1204 = 1. / 1024.;
450 
451  uint iteration = 0;
452  time_point start_time = Clock::now();
453  while ( !loop_ended and ( maxevt < 0 or ( finishedEvts + skippedEvts ) < maxevt ) ) {
454  debug() << "work loop iteration " << iteration++ << endmsg;
455  // if the created events did not reach maxevt, create an event
456  if ( ( newEvtAllowed or createdEvts == 0 ) && // Launch the first event alone
457  createdEvts >= 0 && // The events are not finished with an unlimited number of events
458  ( createdEvts < maxevt or maxevt < 0 ) && // The events are not finished with a limited number of events
459  m_schedulerSvc->freeSlots() > 0 ) { // There are still free slots in the scheduler
460 
461  if ( 1 == createdEvts ) // reset counter to count from event 1
462  start_time = Clock::now();
463 
464  debug() << "createdEvts: " << createdEvts << ", freeslots: " << m_schedulerSvc->freeSlots() << endmsg;
465  // DP remove to remove the syscalls...
466  // if (0!=createdEvts){
467  // info() << "Event Number = " << createdEvts
468  // << " WSS (MB) = " << System::mappedMemory(System::MemoryUnit::kByte)*oneOver1204
469  // << " Time (s) = " << secsFromStart(start_time) << endmsg;
470  // }
471 
472  // TODO can we adapt the interface of executeEvent for a nicer solution?
474  while ( !sc.isSuccess() // we haven't created an event yet
475  && ( createdEvts < maxevt or maxevt < 0 ) ) { // redunant check for maxEvts, can we do better?
476  sc = executeEvent( &createdEvts );
477 
478  if ( sc.isRecoverable() ) { // we skipped an event
479 
480  // this is all to skip the event
481  size_t slot =
482  m_whiteboard->allocateStore( createdEvts ); // we need a new store, not to change the previous event
483  m_whiteboard->selectStore( slot );
484  declareEventRootAddress(); // actually skip over the event
485  m_whiteboard->freeStore( slot ); // delete the store
486 
487  ++createdEvts;
488  ++skippedEvts;
489  } else if ( sc.isRecoverable() ) { // exit immediatly
490  return StatusCode::FAILURE;
491  } // else we have an success --> exit loop
492  }
493 
494  } // end if condition createdEvts < maxevt
495  else {
496  // all the events were created but not all finished or the slots were
497  // all busy: the scheduler should finish its job
498 
499  debug() << "Draining the scheduler" << endmsg;
500 
501  // Pull out of the scheduler the finished events
502  if ( drainScheduler( finishedEvts ).isFailure() ) {
503  loop_ended = true;
504  }
505  newEvtAllowed = true;
506  }
507  } // end main loop on finished events
508  time_point end_time = Clock::now();
509 
510  info() << "---> Loop Finished (skipping 1st evt) - "
511  << " WSS " << System::mappedMemory( System::MemoryUnit::kByte ) * oneOver1204 << " total time "
512  << std::chrono::duration_cast<std::chrono::nanoseconds>( end_time - start_time ).count() << endmsg;
513  info() << skippedEvts << " events were SKIPed" << endmsg;
514 
515  return StatusCode::SUCCESS;
516 }
517 
518 //---------------------------------------------------------------------------
519 
522 {
523  refpAddr = 0;
525  if ( !sc.isSuccess() ) {
526  return sc;
527  }
528  // Create root address and assign address to data service
529  sc = m_evtSelector->createAddress( *m_evtContext, refpAddr );
530  if ( !sc.isSuccess() ) {
531  sc = m_evtSelector->next( *m_evtContext );
532  if ( sc.isSuccess() ) {
533  sc = m_evtSelector->createAddress( *m_evtContext, refpAddr );
534  if ( !sc.isSuccess() ) {
535  warning() << "Error creating IOpaqueAddress." << endmsg;
536  }
537  }
538  }
539  return sc;
540 }
541 
542 //---------------------------------------------------------------------------
543 
545 {
546 
547  StatusCode sc;
548  if ( m_evtContext ) {
549  //---This is the "event iterator" context from EventSelector
550  IOpaqueAddress* pAddr = 0;
551  sc = getEventRoot( pAddr );
552  if ( !sc.isSuccess() ) {
553  info() << "No more events in event selection " << endmsg;
554  return StatusCode::FAILURE;
555  }
556  sc = m_evtDataMgrSvc->setRoot( "/Event", pAddr );
557  if ( !sc.isSuccess() ) {
558  warning() << "Error declaring event root address." << endmsg;
559  }
560  } else {
561  //---In case of no event selector----------------
562  sc = m_evtDataMgrSvc->setRoot( "/Event", new DataObject() );
563  if ( !sc.isSuccess() ) {
564  warning() << "Error declaring event root DataObject" << endmsg;
565  }
566  }
567  return StatusCode::SUCCESS;
568 }
569 
570 //---------------------------------------------------------------------------
571 
573 {
574  evtContext = new EventContext;
575 
576  evtContext->set( createdEvts, m_whiteboard->allocateStore( createdEvts ) );
577 
578  m_algExecStateSvc->reset( *evtContext );
579 
580  StatusCode sc = m_whiteboard->selectStore( evtContext->slot() );
581  if ( sc.isFailure() ) {
582  warning() << "Slot " << evtContext->slot() << " could not be selected for the WhiteBoard" << endmsg;
583  }
584  return sc;
585 }
586 
587 //---------------------------------------------------------------------------
588 
590 {
591 
593 
594  // maybe we can do better
595  std::vector<EventContext*> finishedEvtContexts;
596 
597  EventContext* finishedEvtContext( nullptr );
598 
599  // Here we wait not to loose cpu resources
600  debug() << "Waiting for a context" << endmsg;
601  sc = m_schedulerSvc->popFinishedEvent( finishedEvtContext );
602 
603  // We got past it: cache the pointer
604  if ( sc.isSuccess() ) {
605  debug() << "Context obtained" << endmsg;
606  } else {
607  // A problem occurred.
608  debug() << "Context not obtained: a problem in the scheduling?" << endmsg;
609  // return StatusCode::FAILURE;
610  }
611 
612  finishedEvtContexts.push_back( finishedEvtContext );
613 
614  // Let's see if we can pop other event contexts
615  while ( m_schedulerSvc->tryPopFinishedEvent( finishedEvtContext ).isSuccess() ) {
616  finishedEvtContexts.push_back( finishedEvtContext );
617  }
618 
619  // Now we flush them
620  StatusCode finalSC;
621  for ( auto& thisFinishedEvtContext : finishedEvtContexts ) {
622  if ( nullptr == thisFinishedEvtContext ) {
623  error() << "Detected nullptr ctxt before clearing WB!" << endmsg;
624  finalSC = StatusCode::FAILURE;
625  continue;
626  }
627  if ( m_algExecStateSvc->eventStatus( *thisFinishedEvtContext ) != EventStatus::Success ) {
628  fatal() << "Failed event detected on " << thisFinishedEvtContext << endmsg;
629  finalSC = StatusCode::FAILURE;
630  }
631  // shouldn't these incidents move to the forward scheduler?
632  // If we want to consume incidents with an algorithm at the end of the graph
633  // we need to add this to forward scheduler lambda action,
634  // otherwise we have to do this serially on this thread!
635  m_incidentSvc->fireIncident( Incident( name(), IncidentType::EndProcessing, *thisFinishedEvtContext ) );
636  m_incidentSvc->fireIncident( Incident( name(), IncidentType::EndEvent, *thisFinishedEvtContext ) );
637 
638  debug() << "Clearing slot " << thisFinishedEvtContext->slot() << " (event " << thisFinishedEvtContext->evt()
639  << ") of the whiteboard" << endmsg;
640 
641  StatusCode sc = clearWBSlot( thisFinishedEvtContext->slot() );
642  if ( !sc.isSuccess() )
643  error() << "Whiteboard slot " << thisFinishedEvtContext->slot() << " could not be properly cleared";
644 
645  delete thisFinishedEvtContext;
646 
647  finishedEvts++;
648  }
649  return finalSC;
650 }
651 
652 //---------------------------------------------------------------------------
653 
655 {
656  StatusCode sc = m_whiteboard->clearStore( evtSlot );
657  if ( !sc.isSuccess() ) {
658  warning() << "Clear of Event data store failed" << endmsg;
659  }
660  return m_whiteboard->freeStore( evtSlot );
661 }
662 //---------------------------------------------------------------------------
StatusCode clearWBSlot(int evtSlot)
Clear a slot in the WB.
StatusCode initialize() override
Definition: Service.cpp:64
Gaudi::Property< std::string > m_evtsel
SmartIF< IIncidentSvc > m_incidentSvc
Reference to the incident service.
SmartIF< IDataManagerSvc > m_evtDataMgrSvc
Reference to the Event Data Service&#39;s IDataManagerSvc interface.
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition: ISvcLocator.h:25
StatusCode declareEventRootAddress()
Declare the root address of the event.
const std::string & name() const override
Retrieve name of the service.
Definition: Service.cpp:289
void set(const ContextEvt_t &e=0, const ContextID_t &s=INVALID_CONTEXT_ID)
Definition: EventContext.h:44
StatusCode finalize() override
Definition: Service.cpp:174
StatusCode setProperty(const Gaudi::Details::PropertyBase &p) override
set the property form another property
ContextID_t slot() const
Definition: EventContext.h:40
SmartIF< IAppMgrUI > m_appMgrUI
Reference to the IAppMgrUI interface of the application manager.
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
HiveSlimEventLoopMgr(const std::string &nam, ISvcLocator *svcLoc)
Standard Constructor.
StatusCode drainScheduler(int &finishedEvents)
Drain the scheduler from all actions that may be queued.
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:75
HistogramAgent base in charge of collecting all the refereces to DataObjects in a transient store tha...
SmartIF< IHiveWhiteBoard > m_whiteboard
Reference to the Whiteboard.
SmartIF< IScheduler > m_schedulerSvc
A shortcut for the scheduler.
MsgStream & verbose() const
shortcut for the method msgStream(MSG::VERBOSE)
bool m_scheduledStop
Scheduled stop of event processing.
T binary_search(T...args)
Gaudi::Property< std::vector< unsigned int > > m_eventNumberBlacklist
T duration_cast(T...args)
T end(T...args)
virtual StatusCode getProperty(Gaudi::Details::PropertyBase *p) const =0
Get the property by property.
virtual StatusCode createRep(DataObject *pObject, IOpaqueAddress *&refpAddress)=0
Convert the transient object to the requested representation.
This class represents an entry point to all the event specific data.
Definition: EventContext.h:24
SmartIF< IProperty > m_appMgrProperty
Property interface of ApplicationMgr.
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:86
constexpr int ScheduledStop
Definition: AppReturnCode.h:27
ContextEvt_t evt() const
Definition: EventContext.h:39
STL class.
TYPE * get() const
Get interface pointer.
Definition: SmartIF.h:82
virtual StatusCode sysInitialize()=0
Initialize Service.
Gaudi::Property< bool > m_warnings
StatusCode service(const Gaudi::Utils::TypeNameString &name, T *&svc, bool createIf=true)
Templated method to access a service by name.
Definition: ISvcLocator.h:79
T push_back(T...args)
StatusCode finalize() override
implementation of IService::finalize
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
StatusCode stopRun() override
implementation of IEventProcessor::stopRun()
virtual StatusCode selectStore(size_t partitionIndex)=0
Activate an given &#39;slot&#39; for all subsequent calls within the same thread id.
virtual void fireIncident(const Incident &incident)=0
Fire an Incident.
~HiveSlimEventLoopMgr() override
Standard Destructor.
MsgStream & warning() const
shortcut for the method msgStream(MSG::WARNING)
virtual StatusCode clearStore(size_t partitionIndex)=0
Clear an given &#39;slot&#39;.
virtual StatusCode traverseTree(IDataStoreAgent *pAgent)=0
Analyse by traversing all data objects in the data store.
virtual StatusCode endRun()=0
End Run.
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:28
StatusCode executeRun(int maxevt) override
implementation of IEventProcessor::executeRun()
StatusCode createEventContext(EventContext *&eventContext, int createdEvents)
Create event context.
The IRegistry represents the entry door to the environment any data object residing in a transient da...
Definition: IRegistry.h:22
virtual StatusCode pushNewEvent(EventContext *eventContext)=0
Make an event available to the scheduler.
#define DECLARE_SERVICE_FACTORY(x)
Definition: Service.h:211
StatusCode getEventRoot(IOpaqueAddress *&refpAddr)
Create event address using event selector.
bool isRecoverable() const
Definition: StatusCode.h:87
virtual StatusCode releaseContext(Context *&) const =0
Release the Context object.
std::chrono::high_resolution_clock Clock
Definition: ITimelineSvc.h:10
IDataSelector * selectedObjects()
Return the set of selected DataObjects.
StatusCode setAppReturnCode(SmartIF< IProperty > &appmgr, int value, bool force=false)
Set the application return code.
Definition: AppReturnCode.h:51
virtual StatusCode setRoot(std::string root_name, DataObject *pObject)=0
Initialize data store for new event by giving new event path.
#define LIKELY(x)
Definition: Kernel.h:127
virtual void reset(const EventContext &ctx)=0
GAUDI_API long mappedMemory(MemoryUnit unit=kByte, InfoType fetch=Memory, long pid=-1)
Basic Process Information: priority boost.
Definition: Memory.cpp:204
T size(T...args)
StatusCode initialize() override
implementation of IService::initialize
virtual StatusCode beginRun()=0
Begin Run.
SmartIF< IAlgExecStateSvc > m_algExecStateSvc
Reference to the AlgExecStateSvc.
MsgStream & debug() const
shortcut for the method msgStream(MSG::DEBUG)
SmartIF< IConversionSvc > m_histoPersSvc
Reference to the Histogram Persistency Service.
virtual size_t allocateStore(int evtnumber)=0
Allocate a store partition for new event.
Gaudi::Property< std::string > m_schedulerName
bool isValid() const
Allow for check if smart pointer is valid.
Definition: SmartIF.h:68
T begin(T...args)
Clock::time_point time_point
Definition: ITimelineSvc.h:11
virtual StatusCode tryPopFinishedEvent(EventContext *&eventContext)=0
Try to retrieve a finished event from the scheduler.
Base class for all Incidents (computing events).
Definition: Incident.h:17
virtual const EventStatus::Status & eventStatus(const EventContext &ctx) const =0
SmartIF< IDataManagerSvc > m_histoDataMgrSvc
Reference to the Histogram Data Service.
SmartIF< IEvtSelector > m_evtSelector
Reference to the Event Selector.
virtual StatusCode freeStore(size_t partitionIndex)=0
Free a store partition.
StatusCode reinitialize() override
implementation of IService::reinitialize
virtual StatusCode next(Context &c) const =0
Fetch the next event or the first event if it will be use soon after the creation of the context...
StatusCode service(const std::string &name, const T *&psvc, bool createIf=true) const
Access a service by name, creating it if it doesn&#39;t already exist.
Definition: Service.h:85
T sort(T...args)
virtual StatusCode createContext(Context *&c) const =0
Create and return a context object that will keep track of the state of selection.
void reset(TYPE *ptr=nullptr)
Set the internal pointer to the passed one disposing of the old one.
Definition: SmartIF.h:92
virtual StatusCode createAddress(const Context &c, IOpaqueAddress *&iop) const =0
Create an IOpaqueAddress object from the event fetched.
Opaque address interface definition.
int maxevt
Definition: Bootstrap.cpp:279
void ignore() const
Definition: StatusCode.h:109
MsgStream & fatal() const
shortcut for the method msgStream(MSG::FATAL)
constexpr int Success
Definition: AppReturnCode.h:18
SmartIF< IAlgResourcePool > m_algResourcePool
Reference to the Algorithm resource pool.
StatusCode executeEvent(void *par) override
implementation of IEventProcessor::executeEvent(void* par)
virtual IOpaqueAddress * address() const =0
Retrieve opaque storage address.
virtual StatusCode fillRepRefs(IOpaqueAddress *pAddress, DataObject *pObject)=0
Resolve the references of the converted object.
StatusCode nextEvent(int maxevt) override
implementation of IService::nextEvent
virtual unsigned int freeSlots()=0
Get the free event processing slots.
SmartIF< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator.
Definition: Service.cpp:292
virtual StatusCode popFinishedEvent(EventContext *&eventContext)=0
Retrieve a finished event from the scheduler.
bool m_endEventFired
Flag to avoid to fire the EnvEvent incident twice in a row (and also not before the first event) ...
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:209
boost::dynamic_bitset * m_blackListBS
StatusCode stop() override
implementation of IService::stop
IEvtSelector::Context * m_evtContext
Event Iterator.