The Gaudi Framework  v30r1 (5d4f4ae2)
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  delete m_evtContext;
60 }
61 
62 //--------------------------------------------------------------------------------------------
63 // implementation of IAppMgrUI::initialize
64 //--------------------------------------------------------------------------------------------
66 {
67 
68  if ( !m_appMgrUI ) return StatusCode::FAILURE;
69 
71  if ( !sc.isSuccess() ) {
72  error() << "Failed to initialize Service Base class." << endmsg;
73  return StatusCode::FAILURE;
74  }
75 
76  // Get the references to the services that are needed by the ApplicationMgr itself
77  m_incidentSvc = serviceLocator()->service( "IncidentSvc" );
78  if ( !m_incidentSvc ) {
79  fatal() << "Error retrieving IncidentSvc." << endmsg;
80  return StatusCode::FAILURE;
81  }
82 
83  // Setup access to event data services
84  m_evtDataMgrSvc = serviceLocator()->service( "EventDataSvc" );
85  if ( !m_evtDataMgrSvc ) {
86  fatal() << "Error retrieving EventDataSvc interface IDataManagerSvc." << endmsg;
87  return StatusCode::FAILURE;
88  }
89  m_whiteboard = serviceLocator()->service( "EventDataSvc" );
90  if ( !m_whiteboard ) {
91  fatal() << "Error retrieving EventDataSvc interface IHiveWhiteBoard." << endmsg;
92  return StatusCode::FAILURE;
93  }
95  if ( !m_schedulerSvc ) {
96  fatal() << "Error retrieving SchedulerSvc interface IScheduler." << endmsg;
97  return StatusCode::FAILURE;
98  }
99  // Obtain the IProperty of the ApplicationMgr
101  if ( !m_appMgrProperty ) {
102  fatal() << "IProperty interface not found in ApplicationMgr." << endmsg;
103  return StatusCode::FAILURE;
104  }
105 
106  // We do not expect a Event Selector necessarily being declared
107  setProperty( m_appMgrProperty->getProperty( "EvtSel" ) ).ignore();
108 
109  if ( m_evtsel != "NONE" || m_evtsel.length() == 0 ) {
110  m_evtSelector = serviceLocator()->service( "EventSelector" );
111  if ( m_evtSelector ) {
112  // Setup Event Selector
114  if ( !sc.isSuccess() ) {
115  fatal() << "Can not create the event selector Context." << endmsg;
116  return sc;
117  }
118  } else {
119  fatal() << "EventSelector not found." << endmsg;
120  return sc;
121  }
122  } else {
123  m_evtSelector = 0;
124  m_evtContext = 0;
125  if ( m_warnings ) {
126  warning() << "Unable to locate service \"EventSelector\" " << endmsg;
127  warning() << "No events will be processed from external input." << endmsg;
128  }
129  }
130 
131  // Setup access to histogramming services
132  m_histoDataMgrSvc = serviceLocator()->service( "HistogramDataSvc" );
133  if ( !m_histoDataMgrSvc ) {
134  fatal() << "Error retrieving HistogramDataSvc." << endmsg;
135  return sc;
136  }
137  // Setup histogram persistency
138  m_histoPersSvc = serviceLocator()->service( "HistogramPersistencySvc" );
139  if ( !m_histoPersSvc ) {
140  warning() << "Histograms cannot not be saved - though required." << endmsg;
141  return sc;
142  }
143 
144  // Setup algorithm resource pool
145  m_algResourcePool = serviceLocator()->service( "AlgResourcePool" );
146  if ( !m_algResourcePool ) {
147  fatal() << "Error retrieving AlgResourcePool" << endmsg;
148  return StatusCode::FAILURE;
149  }
150 
151  m_algExecStateSvc = serviceLocator()->service( "AlgExecStateSvc" );
152  if ( !m_algExecStateSvc ) {
153  fatal() << "Error retrieving AlgExecStateSvc" << endmsg;
154  return StatusCode::FAILURE;
155  }
156 
158  info() << "Found " << m_eventNumberBlacklist.size() << " events in black list" << endmsg;
159 
160  return StatusCode::SUCCESS;
161 }
162 //--------------------------------------------------------------------------------------------
163 // implementation of IService::reinitialize
164 //--------------------------------------------------------------------------------------------
166 {
167 
168  // Check to see whether a new Event Selector has been specified
169  setProperty( m_appMgrProperty->getProperty( "EvtSel" ) );
170  if ( m_evtsel != "NONE" || m_evtsel.empty() ) {
171  auto theSvc = serviceLocator()->service( "EventSelector" );
172  auto theEvtSel = theSvc.as<IEvtSelector>();
173  StatusCode sc;
174  if ( theEvtSel && ( theEvtSel.get() != m_evtSelector.get() ) ) {
175  // Setup Event Selector
176  if ( m_evtSelector.get() && m_evtContext ) {
177  // Need to release context before switching to new event selector
179  m_evtContext = nullptr;
180  }
181  m_evtSelector = theEvtSel;
182  if ( theSvc->FSMState() == Gaudi::StateMachine::INITIALIZED ) {
183  sc = theSvc->reinitialize();
184  if ( !sc.isSuccess() ) {
185  error() << "Failure Reinitializing EventSelector " << theSvc->name() << endmsg;
186  return sc;
187  }
188  } else {
189  sc = theSvc->sysInitialize();
190  if ( !sc.isSuccess() ) {
191  error() << "Failure Initializing EventSelector " << theSvc->name() << endmsg;
192  return sc;
193  }
194  }
196  if ( !sc.isSuccess() ) {
197  error() << "Can not create Context " << theSvc->name() << endmsg;
198  return sc;
199  }
200 
201  } else if ( m_evtSelector ) {
202  if ( m_evtContext ) {
204  m_evtContext = nullptr;
205  }
207  if ( !sc.isSuccess() ) {
208  error() << "Can not create Context " << theSvc->name() << endmsg;
209  return sc;
210  }
211  }
212  } else if ( m_evtSelector && m_evtContext ) {
214  m_evtSelector = nullptr;
215  m_evtContext = nullptr;
216  }
217  return StatusCode::SUCCESS;
218 }
219 
220 //--------------------------------------------------------------------------------------------
221 // implementation of IService::stop
222 //--------------------------------------------------------------------------------------------
223 // Removed call to MinimalEventLoopMgr!
225 {
226  if ( !m_endEventFired ) {
227  // Fire pending EndEvent incident
228  m_incidentSvc->fireIncident( Incident( name(), IncidentType::EndEvent ) );
229  m_endEventFired = true;
230  }
231  return StatusCode::SUCCESS;
232 }
233 
234 //--------------------------------------------------------------------------------------------
235 // implementation of IAppMgrUI::finalize
236 //--------------------------------------------------------------------------------------------
237 // Removed call to MinimalEventLoopMgr!
239 {
240 
241  StatusCode scRet;
243 
244  if ( sc.isFailure() ) {
245  scRet = StatusCode::FAILURE;
246  error() << "Problems finalizing Service base class" << endmsg;
247  }
248 
249  // Save Histograms Now
250  if ( m_histoPersSvc ) {
251  HistogramAgent agent;
252  sc = m_histoDataMgrSvc->traverseTree( &agent );
253  if ( sc.isSuccess() ) {
254  const IDataSelector& objects = agent.selectedObjects();
255  // skip /stat entry!
256  sc = std::accumulate( begin( objects ), end( objects ), sc, [&]( StatusCode s, const auto& i ) {
257  IOpaqueAddress* pAddr = nullptr;
258  StatusCode iret = m_histoPersSvc->createRep( i, pAddr );
259  if ( iret.isSuccess() ) i->registry()->setAddress( pAddr );
260  return s.isFailure() ? s : iret;
261  } );
262  sc = std::accumulate( begin( objects ), end( objects ), sc, [&]( StatusCode s, const auto& i ) {
263  IRegistry* reg = i->registry();
264  StatusCode iret = m_histoPersSvc->fillRepRefs( reg->address(), i );
265  return s.isFailure() ? s : iret;
266  } );
267  if ( sc.isSuccess() ) {
268  info() << "Histograms converted successfully according to request." << endmsg;
269  } else {
270  error() << "Error while saving Histograms." << endmsg;
271  }
272  } else {
273  error() << "Error while traversing Histogram data store" << endmsg;
274  }
275  }
276 
277  scRet = sc;
278 
279  // Release event selector context
280  if ( m_evtSelector && m_evtContext ) {
282  m_evtContext = nullptr;
283  }
284 
286  m_appMgrUI.reset();
287 
288  // Release all interfaces...
291 
295 
296  return scRet;
297 }
298 
299 //--------------------------------------------------------------------------------------------
300 // implementation of executeEvent(void* par)
301 //--------------------------------------------------------------------------------------------
303 {
304 
305  // Leave the interface intact and swallow this C trick.
306  int& createdEvts = *( (int*)createdEvts_IntPtr );
307 
308  EventContext* evtContext( nullptr );
309 
310  // Check if event number is in blacklist
311  if ( LIKELY( m_blackListBS != nullptr ) ) { // we are processing a finite number of events, use bitset blacklist
312  if ( m_blackListBS->test( createdEvts ) ) {
313  verbose() << "Event " << createdEvts << " on black list" << endmsg;
315  }
316  } else if ( std::binary_search( m_eventNumberBlacklist.begin(), m_eventNumberBlacklist.end(), createdEvts ) ) {
317 
318  verbose() << "Event " << createdEvts << " on black list" << endmsg;
320  }
321 
322  if ( createEventContext( evtContext, createdEvts ).isFailure() ) {
323  fatal() << "Impossible to create event context" << endmsg;
324  return StatusCode::FAILURE;
325  }
326 
327  verbose() << "Beginning to process event " << createdEvts << endmsg;
328 
329  // An incident may schedule a stop, in which case is better to exit before the actual execution.
330  // DP have to find out who shoots this
331  /* if ( m_scheduledStop ) {
332  always() << "Terminating event processing loop due to a stop scheduled by an incident listener" << endmsg;
333  return StatusCode::SUCCESS;
334  }*/
335 
336  StatusCode declEvtRootSc = declareEventRootAddress();
337  if ( declEvtRootSc.isFailure() ) { // We ran out of events!
338  createdEvts = -1; // Set created event to a negative value: we finished!
339  return StatusCode::SUCCESS;
340  }
341 
342  // Fire BeginEvent "Incident"
343  m_incidentSvc->fireIncident( std::make_unique<Incident>( name(), IncidentType::BeginEvent, *evtContext ) );
344 
345  // Now add event to the scheduler
346  verbose() << "Adding event " << evtContext->evt() << ", slot " << evtContext->slot() << " to the scheduler" << endmsg;
347 
348  m_incidentSvc->fireIncident( std::make_unique<Incident>( name(), IncidentType::BeginProcessing, *evtContext ) );
349 
350  StatusCode addEventStatus = m_schedulerSvc->pushNewEvent( evtContext );
351 
352  // If this fails, we need to wait for something to complete
353  if ( !addEventStatus.isSuccess() ) {
354  fatal() << "An event processing slot should be now free in the scheduler, but it appears not to be the case."
355  << endmsg;
356  }
357 
358  createdEvts++;
359  return StatusCode::SUCCESS;
360 }
361 
362 //--------------------------------------------------------------------------------------------
363 // implementation of IEventProcessing::executeRun
364 //--------------------------------------------------------------------------------------------
366 {
367  StatusCode sc;
368  bool eventfailed = false;
369 
370  if ( maxevt > 0 ) { // finite number of events to process
371  const unsigned int umaxevt = static_cast<unsigned int>( maxevt );
372  m_blackListBS = new boost::dynamic_bitset<>( maxevt ); // all initialized to zero
373  for ( unsigned int i = 0; i < m_eventNumberBlacklist.size() && m_eventNumberBlacklist[i] <= umaxevt;
374  ++i ) { // black list is sorted in init
375  m_blackListBS->set( m_eventNumberBlacklist[i], true );
376  }
377  }
378 
379  sc = m_algResourcePool->beginRun();
380  if ( sc.isFailure() ) eventfailed = true;
381 
382  // Call now the nextEvent(...)
383  sc = nextEvent( maxevt );
384  if ( sc.isFailure() ) eventfailed = true;
385 
386  sc = m_algResourcePool->endRun();
387  if ( sc.isFailure() ) eventfailed = true;
388 
389  delete m_blackListBS;
390 
391  return eventfailed ? StatusCode::FAILURE : StatusCode::SUCCESS;
392 }
393 
394 //--------------------------------------------------------------------------------------------
395 // Implementation of IEventProcessor::stopRun()
396 //--------------------------------------------------------------------------------------------
398 {
399  // Set the application return code
400  auto appmgr = serviceLocator()->as<IProperty>();
402  error() << "Could not set return code of the application (" << Gaudi::ReturnCode::ScheduledStop << ")" << endmsg;
403  }
404  m_scheduledStop = true;
405  return StatusCode::SUCCESS;
406 }
407 
408 //--------------------------------------------------------------------------------------------
409 // implementation of IAppMgrUI::nextEvent
410 //--------------------------------------------------------------------------------------------
411 // Here the loop on the events takes place.
412 // This is also the natural place to put the preparation of the algorithms
413 // contexts, which contain the event specific data.
414 #include "GaudiKernel/Memory.h"
416 {
417 
418  // Calculate runtime
420 
421  // Reset the application return code.
423 
424  int finishedEvts = 0;
425  int createdEvts = 0;
426  int skippedEvts = 0;
427  info() << "Starting loop on events" << endmsg;
428  // Loop until the finished events did not reach the maxevt number
429  bool loop_ended = false;
430  // Run the first event before spilling more than one
431  bool newEvtAllowed = false;
432 
433  constexpr double oneOver1024 = 1. / 1024.;
434 
435  uint iteration = 0;
436  auto start_time = Clock::now();
437  while ( !loop_ended && ( maxevt < 0 || ( finishedEvts + skippedEvts ) < maxevt ) ) {
438  debug() << "work loop iteration " << iteration++ << endmsg;
439  // if the created events did not reach maxevt, create an event
440  if ( ( newEvtAllowed || createdEvts == 0 ) && // Launch the first event alone
441  createdEvts >= 0 && // The events are not finished with an unlimited number of events
442  ( createdEvts < maxevt || maxevt < 0 ) && // The events are not finished with a limited number of events
443  m_schedulerSvc->freeSlots() > 0 && // There are still free slots in the scheduler
444  m_whiteboard->freeSlots() > 0 ) { // There are still free slots in the whiteboard
445 
446  if ( 1 == createdEvts ) // reset counter to count from event 1
447  start_time = Clock::now();
448 
449  debug() << "createdEvts: " << createdEvts << ", freeslots: " << m_schedulerSvc->freeSlots() << endmsg;
450  // DP remove to remove the syscalls...
451  // if (0!=createdEvts){
452  // info() << "Event Number = " << createdEvts
453  // << " WSS (MB) = " << System::mappedMemory(System::MemoryUnit::kByte)*oneOver1024
454  // << " Time (s) = " << secsFromStart(start_time) << endmsg;
455  // }
456 
457  // TODO can we adapt the interface of executeEvent for a nicer solution?
459  while ( !sc.isSuccess() // we haven't created an event yet
460  && ( createdEvts < maxevt || maxevt < 0 ) ) { // redunant check for maxEvts, can we do better?
461  sc = executeEvent( &createdEvts );
462 
463  if ( sc.isRecoverable() ) { // we skipped an event
464 
465  // this is all to skip the event
466  size_t slot =
467  m_whiteboard->allocateStore( createdEvts ); // we need a new store, not to change the previous event
468  m_whiteboard->selectStore( slot );
469  declareEventRootAddress(); // actually skip over the event
470  m_whiteboard->freeStore( slot ); // delete the store
471 
472  ++createdEvts;
473  ++skippedEvts;
474  } else if ( sc.isRecoverable() ) { // exit immediatly
475  return StatusCode::FAILURE;
476  } // else we have an success --> exit loop
477  }
478 
479  } // end if condition createdEvts < maxevt
480  else {
481  // all the events were created but not all finished or the slots were
482  // all busy: the scheduler should finish its job
483 
484  debug() << "Draining the scheduler" << endmsg;
485 
486  // Pull out of the scheduler the finished events
487  if ( drainScheduler( finishedEvts ).isFailure() ) loop_ended = true;
488  newEvtAllowed = true;
489  }
490  } // end main loop on finished events
491  auto end_time = Clock::now();
492 
493  info() << "---> Loop Finished (skipping 1st evt) - "
494  << " WSS " << System::mappedMemory( System::MemoryUnit::kByte ) * oneOver1024 << " total time "
495  << std::chrono::duration_cast<std::chrono::nanoseconds>( end_time - start_time ).count() << endmsg;
496  info() << skippedEvts << " events were SKIPed" << endmsg;
497 
498  return StatusCode::SUCCESS;
499 }
500 
501 //---------------------------------------------------------------------------
502 
505 {
506  refpAddr = nullptr;
508  if ( sc.isFailure() ) return sc;
509  // Create root address and assign address to data service
510  sc = m_evtSelector->createAddress( *m_evtContext, refpAddr );
511  if ( sc.isSuccess() ) return sc;
512  sc = m_evtSelector->next( *m_evtContext );
513  if ( sc.isFailure() ) return sc;
514  sc = m_evtSelector->createAddress( *m_evtContext, refpAddr );
515  if ( !sc.isSuccess() ) warning() << "Error creating IOpaqueAddress." << endmsg;
516  return sc;
517 }
518 
519 //---------------------------------------------------------------------------
520 
522 {
523  StatusCode sc;
524  if ( m_evtContext ) {
525  //---This is the "event iterator" context from EventSelector
526  IOpaqueAddress* pAddr = nullptr;
527  sc = getEventRoot( pAddr );
528  if ( !sc.isSuccess() ) {
529  info() << "No more events in event selection " << endmsg;
530  return StatusCode::FAILURE;
531  }
532  sc = m_evtDataMgrSvc->setRoot( "/Event", pAddr );
533  if ( !sc.isSuccess() ) {
534  warning() << "Error declaring event root address." << endmsg;
535  }
536  } else {
537  //---In case of no event selector----------------
538  sc = m_evtDataMgrSvc->setRoot( "/Event", new DataObject() );
539  if ( !sc.isSuccess() ) {
540  warning() << "Error declaring event root DataObject" << endmsg;
541  }
542  }
543  return StatusCode::SUCCESS;
544 }
545 
546 //---------------------------------------------------------------------------
547 
549 {
550  evtContext = new EventContext;
551  evtContext->set( createdEvts, m_whiteboard->allocateStore( createdEvts ) );
552  m_algExecStateSvc->reset( *evtContext );
553 
554  StatusCode sc = m_whiteboard->selectStore( evtContext->slot() );
555  if ( sc.isFailure() ) {
556  warning() << "Slot " << evtContext->slot() << " could not be selected for the WhiteBoard" << endmsg;
557  }
558  return sc;
559 }
560 
561 //---------------------------------------------------------------------------
562 
564 {
565 
567 
568  // maybe we can do better
569  std::vector<EventContext*> finishedEvtContexts;
570 
571  EventContext* finishedEvtContext( nullptr );
572 
573  // Here we wait not to loose cpu resources
574  debug() << "Waiting for a context" << endmsg;
575  sc = m_schedulerSvc->popFinishedEvent( finishedEvtContext );
576 
577  // We got past it: cache the pointer
578  if ( sc.isSuccess() ) {
579  debug() << "Context obtained" << endmsg;
580  } else {
581  // A problem occurred.
582  debug() << "Context not obtained: a problem in the scheduling?" << endmsg;
583  // return StatusCode::FAILURE;
584  }
585 
586  finishedEvtContexts.push_back( finishedEvtContext );
587 
588  // Let's see if we can pop other event contexts
589  while ( m_schedulerSvc->tryPopFinishedEvent( finishedEvtContext ).isSuccess() ) {
590  finishedEvtContexts.push_back( finishedEvtContext );
591  }
592 
593  // Now we flush them
594  StatusCode finalSC;
595  for ( auto& thisFinishedEvtContext : finishedEvtContexts ) {
596  if ( !thisFinishedEvtContext ) {
597  error() << "Detected nullptr ctxt before clearing WB!" << endmsg;
598  finalSC = StatusCode::FAILURE;
599  continue;
600  }
601  if ( m_algExecStateSvc->eventStatus( *thisFinishedEvtContext ) != EventStatus::Success ) {
602  fatal() << "Failed event detected on " << thisFinishedEvtContext << endmsg;
603  finalSC = StatusCode::FAILURE;
604  }
605  // shouldn't these incidents move to the forward scheduler?
606  // If we want to consume incidents with an algorithm at the end of the graph
607  // we need to add this to forward scheduler lambda action,
608  // otherwise we have to do this serially on this thread!
609  m_incidentSvc->fireIncident( Incident( name(), IncidentType::EndProcessing, *thisFinishedEvtContext ) );
610  m_incidentSvc->fireIncident( Incident( name(), IncidentType::EndEvent, *thisFinishedEvtContext ) );
611 
612  debug() << "Clearing slot " << thisFinishedEvtContext->slot() << " (event " << thisFinishedEvtContext->evt()
613  << ") of the whiteboard" << endmsg;
614 
615  StatusCode sc = clearWBSlot( thisFinishedEvtContext->slot() );
616  if ( !sc.isSuccess() )
617  error() << "Whiteboard slot " << thisFinishedEvtContext->slot() << " could not be properly cleared";
618 
619  delete thisFinishedEvtContext;
620 
621  finishedEvts++;
622  }
623  return finalSC;
624 }
625 
626 //---------------------------------------------------------------------------
627 
629 {
630  StatusCode sc = m_whiteboard->clearStore( evtSlot );
631  if ( !sc.isSuccess() ) warning() << "Clear of Event data store failed" << endmsg;
632  return m_whiteboard->freeStore( evtSlot );
633 }
634 //---------------------------------------------------------------------------
virtual StatusCode traverseTree(IDataStoreAgent *pAgent)=0
Analyse by traversing all data objects in the data store.
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.
The Event Selector Interface.
Definition: IEvtSelector.h:18
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:50
HistogramAgent base in charge of collecting all the refereces to DataObjects in a transient store tha...
SmartIF< IHiveWhiteBoard > m_whiteboard
Reference to the Whiteboard.
virtual StatusCode setRoot(std::string root_name, DataObject *pObject)=0
Initialize data store for new event by giving new event path.
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)
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.
virtual size_t freeSlots()=0
Get free slots number.
SmartIF< IFace > as()
Definition: ISvcLocator.h:109
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:61
constexpr int ScheduledStop
Definition: AppReturnCode.h:27
auto begin(reverse_wrapper< T > &w)
Definition: reverse.h:58
ContextEvt_t evt() const
Definition: EventContext.h:39
STL class.
TYPE * get() const
Get interface pointer.
Definition: SmartIF.h:82
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 endRun()=0
End Run.
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
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
auto end(reverse_wrapper< T > &w)
Definition: reverse.h:64
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:62
virtual StatusCode releaseContext(Context *&) const =0
Release the Context object.
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
#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
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
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.
string s
Definition: gaudirun.py:253
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...
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.
T accumulate(T...args)
Opaque address interface definition.
int maxevt
Definition: Bootstrap.cpp:276
void ignore() const
Definition: StatusCode.h:84
MsgStream & fatal() const
shortcut for the method msgStream(MSG::FATAL)
constexpr int Success
Definition: AppReturnCode.h:18
The IProperty is the basic interface for all components which have properties that can be set or get...
Definition: IProperty.h:20
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.