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