The Gaudi Framework master (9cc87df9)
Loading...
Searching...
No Matches
HiveSlimEventLoopMgr.cpp
Go to the documentation of this file.
1/***********************************************************************************\
2* (c) Copyright 1998-2026 CERN for the benefit of the LHCb and ATLAS collaborations *
3* *
4* This software is distributed under the terms of the Apache version 2 licence, *
5* copied verbatim in the file "LICENSE". *
6* *
7* In applying this licence, CERN does not waive the privileges and immunities *
8* granted to it by virtue of its status as an Intergovernmental Organization *
9* or submit itself to any jurisdiction. *
10\***********************************************************************************/
11// Local includes
12#include "HistogramAgent.h"
13
14// Framework includes
17#include <GaudiKernel/DataSvc.h>
29#include <GaudiKernel/SmartIF.h>
31
32// STL includes
33#include <algorithm>
34#include <chrono>
35#include <cstdint>
36#include <memory>
37#include <vector>
38
39class HiveSlimEventLoopMgr : public extends<Service, IEventProcessor> {
40
41protected:
42 Gaudi::Property<std::string> m_histPersName{ this, "HistogramPersistency", "", "" };
43 Gaudi::Property<std::string> m_evtsel{ this, "EvtSel", "", "" };
44 Gaudi::Property<std::string> m_schedulerName{ this, "SchedulerName", "AvalancheSchedulerSvc",
45 "Name of the scheduler to be used" };
46
47 Gaudi::Property<std::vector<unsigned int>> m_eventNumberBlacklist{ this, "EventNumberBlackList", {}, "" };
48 Gaudi::Property<bool> m_abortOnFailure{ this, "AbortOnFailure", true, "Abort job on event failure" };
49
70 bool m_endEventFired = false;
74 StatusCode clearWBSlot( int evtSlot );
78 StatusCode drainScheduler( int& finishedEvents );
82 bool m_scheduledStop = false;
85
86 // if finite number of evts is processed use bitset
88
90
91public:
92 // inherit base class constructor
93 using extends::extends;
94
95 ~HiveSlimEventLoopMgr() override;
96
100 StatusCode initialize() override;
102 StatusCode reinitialize() override;
104 StatusCode stop() override;
106 StatusCode finalize() override;
108 StatusCode nextEvent( int maxevt ) override;
112 StatusCode executeEvent( EventContext&& ctx ) override;
114 StatusCode executeRun( int maxevt ) override;
116 StatusCode stopRun() override;
117};
118
119// Instantiation of a static factory class used by clients to create instances of this service
121
122#define ON_DEBUG if ( msgLevel( MSG::DEBUG ) )
123#define DEBUG_MSG ON_DEBUG debug()
124
125#define ON_VERBOSE if ( msgLevel( MSG::VERBOSE ) )
126#define VERBOSE_MSG ON_VERBOSE verbose()
127
128//--------------------------------------------------------------------------------------------
129// Standard Destructor
130//--------------------------------------------------------------------------------------------
132
133//--------------------------------------------------------------------------------------------
134// implementation of IAppMgrUI::initialize
135//--------------------------------------------------------------------------------------------
138 if ( !sc.isSuccess() ) {
139 error() << "Failed to initialize Service Base class." << endmsg;
140 return StatusCode::FAILURE;
141 }
142
143 // Get the references to the services that are needed by the ApplicationMgr itself
144 m_incidentSvc = serviceLocator()->service( "IncidentSvc" );
145 if ( !m_incidentSvc ) {
146 fatal() << "Error retrieving IncidentSvc." << endmsg;
147 return StatusCode::FAILURE;
148 }
149
150 // Setup access to event data services
151 m_evtDataMgrSvc = serviceLocator()->service( "EventDataSvc" );
152 if ( !m_evtDataMgrSvc ) {
153 fatal() << "Error retrieving EventDataSvc interface IDataManagerSvc." << endmsg;
154 return StatusCode::FAILURE;
155 }
156 m_whiteboard = serviceLocator()->service( "EventDataSvc" );
157 if ( !m_whiteboard ) {
158 fatal() << "Error retrieving EventDataSvc interface IHiveWhiteBoard." << endmsg;
159 return StatusCode::FAILURE;
160 }
162 if ( !m_schedulerSvc ) {
163 fatal() << "Error retrieving SchedulerSvc interface IScheduler." << endmsg;
164 return StatusCode::FAILURE;
165 }
166 // Obtain the IProperty of the ApplicationMgr
168 if ( !m_appMgrProperty ) {
169 fatal() << "IProperty interface not found in ApplicationMgr." << endmsg;
170 return StatusCode::FAILURE;
171 }
172
173 // We do not expect a Event Selector necessarily being declared
175
176 if ( m_evtsel != "NONE" || m_evtsel.length() == 0 ) {
177 m_evtSelector = serviceLocator()->service( "EventSelector" );
178 if ( m_evtSelector ) {
179 // Setup Event Selector
181 if ( !sc.isSuccess() ) {
182 fatal() << "Can not create the event selector Context." << endmsg;
183 return sc;
184 }
185 } else {
186 fatal() << "EventSelector not found." << endmsg;
187 return sc;
188 }
189 } else {
190 m_evtSelector = 0;
191 m_evtContext = 0;
192 info() << "\"EventSelector\" disabled: no events will be processed from external input." << endmsg;
193 }
194
195 setProperty( m_appMgrProperty->getProperty( "HistogramPersistency" ) ).ignore();
196 if ( m_histPersName != "NONE" && !m_histPersName.empty() ) {
197 // Setup access to histogramming services
198 m_histoDataMgrSvc = serviceLocator()->service( "HistogramDataSvc" );
199 if ( !m_histoDataMgrSvc ) {
200 fatal() << "Error retrieving HistogramDataSvc." << endmsg;
201 return StatusCode::FAILURE;
202 }
203 // Setup histogram persistency
204 m_histoPersSvc = serviceLocator()->service( "HistogramPersistencySvc" );
205 if ( !m_histoPersSvc ) { warning() << "Histograms cannot not be saved - though required." << endmsg; }
206 }
207
208 // Setup algorithm resource pool
209 m_algResourcePool = serviceLocator()->service( "AlgResourcePool" );
210 if ( !m_algResourcePool ) {
211 fatal() << "Error retrieving AlgResourcePool" << endmsg;
212 return StatusCode::FAILURE;
213 }
214
215 m_algExecStateSvc = serviceLocator()->service( "AlgExecStateSvc" );
216 if ( !m_algExecStateSvc ) {
217 fatal() << "Error retrieving AlgExecStateSvc" << endmsg;
218 return StatusCode::FAILURE;
219 }
220
222 info() << "Found " << m_eventNumberBlacklist.size() << " events in black list" << endmsg;
223
224 return StatusCode::SUCCESS;
225}
226//--------------------------------------------------------------------------------------------
227// implementation of IService::reinitialize
228//--------------------------------------------------------------------------------------------
230
231 // Check to see whether a new Event Selector has been specified
232 setProperty( m_appMgrProperty->getProperty( "EvtSel" ) ).ignore( /* AUTOMATICALLY ADDED FOR gaudi/Gaudi!763 */ );
233 if ( m_evtsel != "NONE" || m_evtsel.empty() ) {
234 auto theSvc = serviceLocator()->service( "EventSelector" );
235 auto theEvtSel = theSvc.as<IEvtSelector>();
236 StatusCode sc;
237 if ( theEvtSel && ( theEvtSel.get() != m_evtSelector.get() ) ) {
238 // Setup Event Selector
239 if ( m_evtSelector.get() && m_evtContext ) {
240 // Need to release context before switching to new event selector
241 m_evtSelector->releaseContext( m_evtContext ).ignore( /* AUTOMATICALLY ADDED FOR gaudi/Gaudi!763 */ );
242 m_evtContext = nullptr;
243 }
244 m_evtSelector = theEvtSel;
245 if ( theSvc->FSMState() == Gaudi::StateMachine::INITIALIZED ) {
246 sc = theSvc->reinitialize();
247 if ( !sc.isSuccess() ) {
248 error() << "Failure Reinitializing EventSelector " << theSvc->name() << endmsg;
249 return sc;
250 }
251 } else {
252 sc = theSvc->sysInitialize();
253 if ( !sc.isSuccess() ) {
254 error() << "Failure Initializing EventSelector " << theSvc->name() << endmsg;
255 return sc;
256 }
257 }
259 if ( !sc.isSuccess() ) {
260 error() << "Can not create Context " << theSvc->name() << endmsg;
261 return sc;
262 }
263
264 } else if ( m_evtSelector ) {
265 if ( m_evtContext ) {
266 m_evtSelector->releaseContext( m_evtContext ).ignore( /* AUTOMATICALLY ADDED FOR gaudi/Gaudi!763 */ );
267 m_evtContext = nullptr;
268 }
270 if ( !sc.isSuccess() ) {
271 error() << "Can not create Context " << theSvc->name() << endmsg;
272 return sc;
273 }
274 }
275 } else if ( m_evtSelector && m_evtContext ) {
276 m_evtSelector->releaseContext( m_evtContext ).ignore( /* AUTOMATICALLY ADDED FOR gaudi/Gaudi!763 */ );
277 m_evtSelector = nullptr;
278 m_evtContext = nullptr;
279 }
280 return StatusCode::SUCCESS;
281}
282
283//--------------------------------------------------------------------------------------------
284// implementation of IService::stop
285//--------------------------------------------------------------------------------------------
286// Removed call to MinimalEventLoopMgr!
288 if ( !m_endEventFired ) {
289 // Fire pending EndEvent incident
290 m_incidentSvc->fireIncident( Incident( name(), IncidentType::EndEvent ) );
291 m_endEventFired = true;
292 }
293 return StatusCode::SUCCESS;
294}
295
296//--------------------------------------------------------------------------------------------
297// implementation of IAppMgrUI::finalize
298//--------------------------------------------------------------------------------------------
299// Removed call to MinimalEventLoopMgr!
301
302 StatusCode scRet;
304
305 if ( sc.isFailure() ) {
306 scRet = StatusCode::FAILURE;
307 error() << "Problems finalizing Service base class" << endmsg;
308 }
309
310 // Save Histograms Now
311 if ( m_histoPersSvc ) {
312 HistogramAgent agent;
313 sc = m_histoDataMgrSvc->traverseTree( &agent );
314 if ( sc.isSuccess() ) {
315 const IDataSelector& objects = agent.selectedObjects();
316 // skip /stat entry!
317 sc = std::accumulate( begin( objects ), end( objects ), sc, [&]( StatusCode s, const auto& i ) {
318 IOpaqueAddress* pAddr = nullptr;
319 StatusCode iret = m_histoPersSvc->createRep( i, pAddr );
320 if ( iret.isSuccess() ) i->registry()->setAddress( pAddr );
321 return s.isFailure() ? s : iret;
322 } );
323 sc = std::accumulate( begin( objects ), end( objects ), sc, [&]( StatusCode s, const auto& i ) {
324 IRegistry* reg = i->registry();
325 StatusCode iret = m_histoPersSvc->fillRepRefs( reg->address(), i );
326 return s.isFailure() ? s : iret;
327 } );
328 if ( sc.isSuccess() ) {
329 info() << "Histograms converted successfully according to request." << endmsg;
330 } else {
331 error() << "Error while saving Histograms." << endmsg;
332 }
333 } else {
334 error() << "Error while traversing Histogram data store" << endmsg;
335 }
336 }
337
338 scRet = sc;
339
340 // Release event selector context
341 if ( m_evtSelector && m_evtContext ) {
343 m_evtContext = nullptr;
344 }
345
347
348 // Release all interfaces...
351
355
356 return scRet;
357}
358
359//--------------------------------------------------------------------------------------------
360// implementation of executeEvent(void* par)
361//--------------------------------------------------------------------------------------------
363
364 m_algExecStateSvc->reset( ctx );
365
366 // Check if event number is in blacklist
367 if ( !m_blackList.empty() ) { // we are processing a finite number of events, use bitset blacklist
368 if ( m_blackList.at( ctx.evt() ) ) {
369 VERBOSE_MSG << "Event " << ctx.evt() << " on black list" << endmsg;
370 m_whiteboard->freeStore( ctx.slot() ).ignore( /* AUTOMATICALLY ADDED FOR gaudi/Gaudi!763 */ );
372 }
374 VERBOSE_MSG << "Event " << ctx.evt() << " on black list" << endmsg;
375 m_whiteboard->freeStore( ctx.slot() ).ignore( /* AUTOMATICALLY ADDED FOR gaudi/Gaudi!763 */ );
377 }
378
379 VERBOSE_MSG << "Beginning to process event " << ctx.evt() << endmsg;
380
381 // An incident may schedule a stop, in which case is better to exit before the actual execution.
382 if ( m_scheduledStop ) {
383 always() << "Terminating event processing loop due to a stop scheduled by an incident listener" << endmsg;
384 return StatusCode::SUCCESS;
385 }
386
387 // Fire BeginEvent "Incident"
388 m_incidentSvc->fireIncident( std::make_unique<Incident>( name(), IncidentType::BeginEvent, ctx ) );
389
390 // Now add event to the scheduler
391 VERBOSE_MSG << "Adding event " << ctx.evt() << ", slot " << ctx.slot() << " to the scheduler" << endmsg;
392
393 m_incidentSvc->fireIncident( std::make_unique<Incident>( name(), IncidentType::BeginProcessing, ctx ) );
394
395 StatusCode addEventStatus = m_schedulerSvc->pushNewEvent( new EventContext{ std::move( ctx ) } );
396
397 // If this fails, we need to wait for something to complete
398 if ( !addEventStatus.isSuccess() ) {
399 fatal() << "An event processing slot should be now free in the scheduler, but it appears not to be the case."
400 << endmsg;
401 }
402
403 return StatusCode::SUCCESS;
404}
405
406//--------------------------------------------------------------------------------------------
407// implementation of IEventProcessing::executeRun
408//--------------------------------------------------------------------------------------------
410 StatusCode sc;
411 bool eventfailed = false;
412
413 if ( maxevt > 0 ) { // finite number of events to process
414 const unsigned int umaxevt = static_cast<unsigned int>( maxevt );
415 m_blackList.assign( maxevt, 0 ); // all initialized to 0
416 for ( unsigned int i = 0; i < m_eventNumberBlacklist.size() && m_eventNumberBlacklist[i] < umaxevt;
417 ++i ) { // black list is sorted in init
419 }
420 }
421
422 // Call now the nextEvent(...)
423 sc = nextEvent( maxevt );
424 if ( sc.isFailure() ) eventfailed = true;
425
427
428 return eventfailed ? StatusCode::FAILURE : StatusCode::SUCCESS;
429}
430
431//--------------------------------------------------------------------------------------------
432// Implementation of IEventProcessor::stopRun()
433//--------------------------------------------------------------------------------------------
435 // Set the application return code
436 auto appmgr = serviceLocator()->as<IProperty>();
437 if ( Gaudi::setAppReturnCode( appmgr, Gaudi::ReturnCode::ScheduledStop ).isFailure() ) {
438 error() << "Could not set return code of the application (" << Gaudi::ReturnCode::ScheduledStop << ")" << endmsg;
439 }
440 m_scheduledStop = true;
441 return StatusCode::SUCCESS;
442}
443
444//--------------------------------------------------------------------------------------------
445// implementation of IAppMgrUI::nextEvent
446//--------------------------------------------------------------------------------------------
447// Here the loop on the events takes place.
448// This is also the natural place to put the preparation of the algorithms
449// contexts, which contain the event specific data.
450#include <GaudiKernel/Memory.h>
452
453 // Calculate runtime
455
456 // Reset the application return code.
458
459 int finishedEvts = 0;
460 int createdEvts = 0;
461 int skippedEvts = 0;
462 info() << "Starting loop on events" << endmsg;
463 // Loop until the finished events did not reach the maxevt number
464 bool loop_ended = false;
465 // Run the first event before spilling more than one
466 bool newEvtAllowed = false;
467
468 constexpr double oneOver1024 = 1. / 1024.;
469
470 uint iteration = 0;
471 auto start_time = Clock::now();
472 StatusCode finalSC;
473 while ( !loop_ended && ( maxevt < 0 || ( finishedEvts + skippedEvts ) < maxevt ) ) {
474 DEBUG_MSG << "work loop iteration " << iteration++ << endmsg;
475 // if the created events did not reach maxevt, create an event
476 if ( ( newEvtAllowed || createdEvts == 0 ) && // Launch the first event alone
477 createdEvts >= 0 && // The events are not finished with an unlimited number of events
478 ( createdEvts < maxevt || maxevt < 0 ) && // The events are not finished with a limited number of events
479 m_schedulerSvc->freeSlots() > 0 && // There are still free slots in the scheduler
480 m_whiteboard->freeSlots() > 0 && // There are still free slots in the whiteboard
481 finalSC.isSuccess() && // Stop submitting events after a failure
482 !m_scheduledStop // There is not a scheduled stop
483 ) {
484
485 if ( 1 == createdEvts ) // reset counter to count from event 1
486 start_time = Clock::now();
487
488 DEBUG_MSG << "createdEvts: " << createdEvts << ", freeslots: " << m_schedulerSvc->freeSlots() << endmsg;
489 // DP remove to remove the syscalls...
490 // if (0!=createdEvts){
491 // info() << "Event Number = " << createdEvts
492 // << " WSS (MB) = " << System::mappedMemory(System::MemoryUnit::kByte)*oneOver1024
493 // << " Time (s) = " << secsFromStart(start_time) << endmsg;
494 // }
495
496 // TODO can we adapt the interface of executeEvent for a nicer solution?
498 while ( !sc.isSuccess() // we haven't created an event yet
499 && ( createdEvts < maxevt || maxevt < 0 ) ) { // redunant check for maxEvts, can we do better?
500 {
501 auto ctx = createEventContext();
502 if ( !ctx.valid() ) {
503 createdEvts = -1;
504 break; // invalid context means end of loop
505 }
506 sc = executeEvent( std::move( ctx ) );
507 }
508 if ( sc.isRecoverable() ) { // we skipped an event
509 ++skippedEvts;
510 } else if ( sc.isFailure() ) { // exit immediatly
511 return sc;
512 } // else we have an success --> exit loop
513 ++createdEvts;
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_MSG << "Draining the scheduler" << endmsg;
522
523 // Pull out of the scheduler the finished events
524 if ( drainScheduler( finishedEvts ).isFailure() ) { finalSC = StatusCode::FAILURE; }
525 // Keep algorithms and event services alive until all submitted events have finished,
526 // including after an event failure has stopped submission of new events.
527 loop_ended = finalSC.isFailure() && m_schedulerSvc->freeSlots() == m_whiteboard->getNumberOfStores();
528 newEvtAllowed = true;
529 }
530 } // end main loop on finished events
531 auto end_time = Clock::now();
532
533 info() << "---> Loop Finished (skipping 1st evt) - "
534 << " WSS " << System::mappedMemory( System::MemoryUnit::kByte ) * oneOver1024 << " total time "
535 << std::chrono::duration_cast<std::chrono::nanoseconds>( end_time - start_time ).count() << endmsg;
536 info() << skippedEvts << " events were SKIPed" << endmsg;
537
538 return finalSC;
539}
540
541//---------------------------------------------------------------------------
542
545 refpAddr = nullptr;
547 if ( sc.isFailure() ) return sc;
548 // Create root address and assign address to data service
549 sc = m_evtSelector->createAddress( *m_evtContext, refpAddr );
550 if ( sc.isSuccess() ) return sc;
552 if ( sc.isFailure() ) return sc;
553 sc = m_evtSelector->createAddress( *m_evtContext, refpAddr );
554 if ( !sc.isSuccess() ) warning() << "Error creating IOpaqueAddress." << endmsg;
555 return sc;
556}
557
558//---------------------------------------------------------------------------
559
561 StatusCode sc;
562 if ( m_evtContext ) {
563 //---This is the "event iterator" context from EventSelector
564 IOpaqueAddress* pAddr = nullptr;
565 sc = getEventRoot( pAddr );
566 if ( !sc.isSuccess() ) {
567 info() << "No more events in event selection " << endmsg;
568 return StatusCode::FAILURE;
569 }
570 sc = m_evtDataMgrSvc->setRoot( "/Event", pAddr );
571 if ( !sc.isSuccess() ) { warning() << "Error declaring event root address." << endmsg; }
572 } else {
573 //---In case of no event selector----------------
574 sc = m_evtDataMgrSvc->setRoot( "/Event", new DataObject() );
575 if ( !sc.isSuccess() ) { warning() << "Error declaring event root DataObject" << endmsg; }
576 }
577 return StatusCode::SUCCESS;
578}
579
580//---------------------------------------------------------------------------
581
584 ++m_nevt;
585
586 StatusCode sc = m_whiteboard->selectStore( ctx.slot() );
587 if ( sc.isFailure() ) {
588 throw GaudiException( "Slot " + std::to_string( ctx.slot() ) + " could not be selected for the WhiteBoard", name(),
589 sc );
590 }
591 if ( declareEventRootAddress().isFailure() ) { // We ran out of events!
592 // invalid context terminates the loop
593 return EventContext{};
594 }
595 return ctx;
596}
597
598//---------------------------------------------------------------------------
599
601
603
604 // maybe we can do better
605 std::vector<EventContext*> finishedEvtContexts;
606
607 EventContext* finishedEvtContext( nullptr );
608
609 // Here we wait not to loose cpu resources
610 DEBUG_MSG << "Waiting for a context" << endmsg;
611 sc = m_schedulerSvc->popFinishedEvent( finishedEvtContext );
612
613 // We got past it: cache the pointer
614 DEBUG_MSG << "Context " << ( sc.isSuccess() ? "obtained" : "not obtained: a problem in the scheduling?" ) << endmsg;
615 finishedEvtContexts.push_back( finishedEvtContext );
616
617 // Let's see if we can pop other event contexts
618 while ( m_schedulerSvc->tryPopFinishedEvent( finishedEvtContext ).isSuccess() ) {
619 finishedEvtContexts.push_back( finishedEvtContext );
620 }
621
622 // Now we flush them
623 StatusCode finalSC;
624 for ( auto& thisFinishedEvtContext : finishedEvtContexts ) {
625 if ( !thisFinishedEvtContext ) {
626 error() << "Detected nullptr ctxt before clearing WB!" << endmsg;
627 finalSC = StatusCode::FAILURE;
628 continue;
629 }
630 if ( m_algExecStateSvc->eventStatus( *thisFinishedEvtContext ) != EventStatus::Success ) {
631 ( m_abortOnFailure ? fatal() : error() ) << "Failed event detected on " << thisFinishedEvtContext << endmsg;
632 if ( m_abortOnFailure ) finalSC = StatusCode::FAILURE;
633 }
634 // shouldn't these incidents move to the forward scheduler?
635 // If we want to consume incidents with an algorithm at the end of the graph
636 // we need to add this to forward scheduler lambda action,
637 // otherwise we have to do this serially on this thread!
638 m_incidentSvc->fireIncident( Incident( name(), IncidentType::EndProcessing, *thisFinishedEvtContext ) );
639 m_incidentSvc->fireIncident( Incident( name(), IncidentType::EndEvent, *thisFinishedEvtContext ) );
640
641 DEBUG_MSG << "Clearing slot " << thisFinishedEvtContext->slot() << " (event " << thisFinishedEvtContext->evt()
642 << ") of the whiteboard" << endmsg;
643
644 StatusCode sc = clearWBSlot( thisFinishedEvtContext->slot() );
645 if ( !sc.isSuccess() )
646 error() << "Whiteboard slot " << thisFinishedEvtContext->slot() << " could not be properly cleared";
647
648 delete thisFinishedEvtContext;
649
650 ++finishedEvts;
651 }
652 return finalSC;
653}
654
655//---------------------------------------------------------------------------
656
658 StatusCode sc = m_whiteboard->clearStore( evtSlot );
659 if ( !sc.isSuccess() ) warning() << "Clear of Event data store failed" << endmsg;
660 return m_whiteboard->freeStore( evtSlot );
661}
662//---------------------------------------------------------------------------
#define DEBUG_MSG
#define VERBOSE_MSG
std::vector< DataObject * > IDataSelector
This is only a placeholder to allow me compiling until the responsible guy does his work!
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition MsgStream.h:198
#define DECLARE_COMPONENT(type)
system_clock high_resolution_clock
constexpr __enable_if_is_duration< _ToDur > duration_cast(const duration< _Rep, _Period > &__d)
constexpr _OI move(_II __first, _II __last, _OI __result)
constexpr void sort(_RandomAccessIterator __first, _RandomAccessIterator __last)
constexpr bool binary_search(_ForwardIterator __first, _ForwardIterator __last, const _Tp &__val)
constexpr _Tp accumulate(_InputIterator __first, _InputIterator __last, _Tp __init)
constexpr auto begin(_Container &__cont) -> decltype(__cont.begin())
constexpr auto end(_Container &__cont) -> decltype(__cont.end())
constexpr void push_back(const value_type &__x)
constexpr void assign(_InputIterator __first, _InputIterator __last)
constexpr reference at(size_type __n)
constexpr bool empty() const noexcept
constexpr void clear() noexcept
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
MsgStream & warning() const
shortcut for the method msgStream(MSG::WARNING)
MsgStream & fatal() const
shortcut for the method msgStream(MSG::FATAL)
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
MsgStream & always() const
shortcut for the method msgStream(MSG::ALWAYS)
DataObject()
Standard Constructor.
This class represents an entry point to all the event specific data.
size_t ContextEvt_t
Implementation of property with value of concrete type.
Definition Property.h:35
auto length() const
Definition Property.h:267
auto size() const
Definition Property.h:262
auto empty() const
Definition Property.h:272
auto begin() const
Definition Property.h:282
auto end() const
Definition Property.h:287
GaudiException(std::string Message, std::string Tag, StatusCode Code)
Constructor (1).
HistogramAgent base in charge of collecting all the references to DataObjects in a transient store th...
const IDataSelector & selectedObjects() const
Return the set of selected DataObjects.
EventContext::ContextEvt_t m_nevt
SmartIF< IScheduler > m_schedulerSvc
A shortcut for the scheduler.
StatusCode stopRun() override
implementation of IEventProcessor::stopRun()
std::vector< uint8_t > m_blackList
Gaudi::Property< bool > m_abortOnFailure
StatusCode getEventRoot(IOpaqueAddress *&refpAddr)
Create event address using event selector.
Gaudi::Property< std::string > m_histPersName
StatusCode executeRun(int maxevt) override
implementation of IEventProcessor::executeRun()
SmartIF< IDataManagerSvc > m_evtDataMgrSvc
Reference to the Event Data Service's IDataManagerSvc interface.
StatusCode stop() override
implementation of IService::stop
StatusCode initialize() override
implementation of IService::initialize
StatusCode drainScheduler(int &finishedEvents)
Drain the scheduler from all actions that may be queued.
StatusCode nextEvent(int maxevt) override
implementation of IService::nextEvent
StatusCode reinitialize() override
implementation of IService::reinitialize
StatusCode executeEvent(EventContext &&ctx) override
implementation of IEventProcessor::executeEvent(EventContext&&)
Gaudi::Property< std::string > m_schedulerName
SmartIF< IConversionSvc > m_histoPersSvc
Reference to the Histogram Persistency Service.
SmartIF< IIncidentSvc > m_incidentSvc
Reference to the incident service.
SmartIF< IEvtSelector > m_evtSelector
Reference to the Event Selector.
bool m_endEventFired
Flag to avoid to fire the EnvEvent incident twice in a row (and also not before the first event).
StatusCode clearWBSlot(int evtSlot)
Clear a slot in the WB.
Gaudi::Property< std::vector< unsigned int > > m_eventNumberBlacklist
SmartIF< IHiveWhiteBoard > m_whiteboard
Reference to the Whiteboard.
SmartIF< IProperty > m_appMgrProperty
Property interface of ApplicationMgr.
SmartIF< IAlgResourcePool > m_algResourcePool
Reference to the Algorithm resource pool.
StatusCode declareEventRootAddress()
Declare the root address of the event.
SmartIF< IDataManagerSvc > m_histoDataMgrSvc
Reference to the Histogram Data Service.
IEvtSelector::Context * m_evtContext
Event Iterator.
bool m_scheduledStop
Scheduled stop of event processing.
StatusCode finalize() override
implementation of IService::finalize
SmartIF< IAlgExecStateSvc > m_algExecStateSvc
Reference to the AlgExecStateSvc.
SmartIF< IIncidentListener > m_abortEventListener
Instance of the incident listener waiting for AbortEvent.
Gaudi::Property< std::string > m_evtsel
EventContext createEventContext() override
implementation of IEventProcessor::createEventContext()
virtual const EventStatus::Status & eventStatus(const EventContext &ctx) const =0
virtual void reset(const EventContext &ctx)=0
reset all states for the given EventContext
virtual StatusCode createRep(DataObject *pObject, IOpaqueAddress *&refpAddress)=0
Convert the transient object to the requested representation.
virtual StatusCode fillRepRefs(IOpaqueAddress *pAddress, DataObject *pObject)=0
Resolve the references of the converted object.
The Event Selector Interface.
virtual StatusCode releaseContext(Context *&) const =0
Release the Context object.
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.
virtual StatusCode createAddress(const Context &c, IOpaqueAddress *&iop) const =0
Create an IOpaqueAddress object from the event fetched.
virtual StatusCode createContext(Context *&c) const =0
Create and return a context object that will keep track of the state of selection.
virtual StatusCode freeStore(size_t partitionIndex)=0
Free a store partition.
virtual size_t allocateStore(int evtnumber)=0
Allocate a store partition for new event.
virtual size_t freeSlots()=0
Get free slots number.
virtual StatusCode clearStore(size_t partitionIndex)=0
Clear an given 'slot'.
virtual StatusCode selectStore(size_t partitionIndex)=0
Activate an given 'slot' for all subsequent calls within the same thread id.
virtual size_t getNumberOfStores() const =0
Get the number of 'slots'.
virtual void fireIncident(const Incident &incident)=0
Fire an Incident.
Opaque address interface definition.
The IProperty is the basic interface for all components which have properties that can be set or get.
Definition IProperty.h:32
virtual StatusCode getProperty(Gaudi::Details::PropertyBase *p) const =0
Get the property by property.
The IRegistry represents the entry door to the environment any data object residing in a transient da...
Definition IRegistry.h:29
virtual IOpaqueAddress * address() const =0
Retrieve opaque storage address.
virtual unsigned int freeSlots()=0
Get the free event processing slots.
virtual StatusCode pushNewEvent(EventContext *eventContext)=0
Make an event available to the scheduler.
virtual StatusCode popFinishedEvent(EventContext *&eventContext)=0
Retrieve a finished event from the scheduler.
virtual StatusCode tryPopFinishedEvent(EventContext *&eventContext)=0
Try to retrieve a finished event from the scheduler.
virtual SmartIF< IService > & service(const Gaudi::Utils::TypeNameString &typeName, const bool createIf=true)=0
Returns a smart pointer to a service.
SmartIF< IFace > as()
Definition ISvcLocator.h:64
Incident(const std::string &source, const std::string &type)
Default Constructor.
Definition Incident.cpp:15
SmartIF< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator.
Definition Service.cpp:336
StatusCode finalize() override
Definition Service.cpp:223
const std::string & name() const override
Retrieve name of the service.
Definition Service.cpp:333
StatusCode initialize() override
Definition Service.cpp:118
Small smart pointer class with automatic reference counting for IInterface.
Definition SmartIF.h:28
TYPE * get() const
Get interface pointer.
Definition SmartIF.h:82
SmartIF< IFace > as() const
return a new SmartIF instance to another interface
Definition SmartIF.h:110
void reset(TYPE *ptr=nullptr)
Set the internal pointer to the passed one disposing of the old one.
Definition SmartIF.h:88
This class is used for returning status codes from appropriate routines.
Definition StatusCode.h:64
bool isFailure() const
Definition StatusCode.h:118
constexpr static const auto RECOVERABLE
Definition StatusCode.h:101
void ignore() const
Allow discarding a StatusCode without warning.
Definition StatusCode.h:128
bool isSuccess() const
Definition StatusCode.h:302
bool isRecoverable() const
Definition StatusCode.h:306
constexpr static const auto SUCCESS
Definition StatusCode.h:99
constexpr static const auto FAILURE
Definition StatusCode.h:100
Base class used to extend a class implementing other interfaces.
Definition extends.h:19
constexpr int ScheduledStop
constexpr int Success
StatusCode setAppReturnCode(SmartIF< IProperty > &appmgr, int value, bool force=false)
Set the application return code.
GAUDI_API long mappedMemory(MemoryUnit unit=kByte, InfoType fetch=Memory, long pid=-1)
Basic Process Information: priority boost.
Definition Memory.cpp:172
@ kByte
Definition Memory.h:50
virtual StatusCode setRoot(std::string root_name, DataObject *pObject)=0
Initialize data store for new event by giving new event path.
virtual StatusCode traverseTree(IDataStoreAgent *pAgent)=0
Analyse by traversing all data objects in the data store.