ATLAS Offline Software
Loading...
Searching...
No Matches
AthenaEventLoopMgr.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
5#define GAUDISVC_EVENTLOOPMGR_CPP
6
7#include <cassert>
8#include <ios>
9#include <iostream>
10#include <fstream> /* ofstream */
11#include <iomanip>
12#include <memory>
13#include <stdexcept>
14#include <print>
15
16// Athena includes
24
25#include "GaudiKernel/IAlgManager.h"
26#include "GaudiKernel/IAlgorithm.h"
27#include "GaudiKernel/SmartIF.h"
28#include "GaudiKernel/Incident.h"
29#include "GaudiKernel/DataObject.h"
30#include "GaudiKernel/IIncidentSvc.h"
31#include "GaudiKernel/IEvtSelector.h"
32#include "GaudiKernel/IDataManagerSvc.h"
33#include "GaudiKernel/IConversionSvc.h"
34#include "GaudiKernel/GaudiException.h"
35#include "GaudiKernel/EventContext.h"
36#include "GaudiKernel/EventIDBase.h"
37#include "GaudiKernel/ThreadLocalContext.h"
38#include "GaudiKernel/AppReturnCode.h"
39
41
42#include "EventInfo/EventInfo.h"
43#include "EventInfo/EventID.h"
44#include "EventInfo/EventType.h"
45
48
49#include "ClearStorePolicy.h"
50
51#include "AthenaEventLoopMgr.h"
53
54
55//=========================================================================
56// Standard Constructor
57//=========================================================================
59 ISvcLocator* svcLoc)
60 : base_class(nam, svcLoc),
61 AthMessaging (nam),
62 m_incidentSvc ( "IncidentSvc", nam ),
63 m_eventStore( "StoreGateSvc", nam ),
64 m_evtSelector(nullptr), m_evtSelCtxt(nullptr),
65 m_histoDataMgrSvc( "HistogramDataSvc", nam ),
66 m_histoPersSvc ( "HistogramPersistencySvc", nam ),
67 m_evtIdModSvc ( "", nam ),
69 m_currentRun(0), m_firstRun(true), m_tools(this),
70 m_nevt(0), m_writeHists(false),
71 m_nev(0), m_proc(0), m_useTools(false),
72 m_chronoStatSvc( "ChronoStatSvc", nam ),
73 m_conditionsCleaner( "Athena::ConditionsCleanerSvc", nam )
74{
75 declareProperty("EvtStore", m_eventStore, "The StoreGateSvc instance to interact with for event payload" );
76 declareProperty("EvtSel", m_evtsel,
77 "Name of Event Selector to use. If empty string (default) "
78 "take value from ApplicationMgr");
79 declareProperty("HistogramPersistency", m_histPersName="",
80 "Histogram persistency technology to use: ROOT, HBOOK, NONE. "
81 "By default (empty string) get property value from "
82 "ApplicationMgr");
83 declareProperty("HistWriteInterval", m_writeInterval=0 ,
84 "histogram write/update interval");
85 declareProperty("FailureMode", m_failureMode=1 ,
86 "Controls behaviour of event loop depending on return code of"
87 " Algorithms. 0: all non-SUCCESSes terminate job. "
88 "1: RECOVERABLE skips to next event, FAILURE terminates job "
89 "(DEFAULT). 2: RECOVERABLE and FAILURE skip to next events");
90 declareProperty("EventPrintoutInterval", m_eventPrintoutInterval=1,
91 "Print event heartbeat printouts every m_eventPrintoutInterval events");
92 declareProperty("IntervalInSeconds", m_intervalInSeconds = 0,
93 "heartbeat time interval is seconds rather than events"
94 "you also get a nice event rate printout then");
95 declareProperty("DoLiteLoop",m_liteLoop=false,"Runs the bare minimum during executeEvent");
96 declareProperty("UseDetailChronoStat",m_doChrono=false);
97 declareProperty("ClearStorePolicy",
98 m_clearStorePolicy = "EndEvent",
99 "Configure the policy wrt handling of when the "
100 "'clear-the-event-store' event shall happen: at EndEvent "
101 "(default as it is makes things easier for memory management"
102 ") or at BeginEvent (easier e.g. for interactive use)");
103 declareProperty("PreSelectTools",m_tools,"AlgTools for event pre-selection")->
104 declareUpdateHandler( &AthenaEventLoopMgr::setupPreSelectTools, this );
105 declareProperty("RequireInputAttributeList", m_requireInputAttributeList = false,
106 "Require valid input attribute list to be present");
107 declareProperty("UseSecondaryEventNumber", m_useSecondaryEventNumber = false,
108 "In case of DoubleEventSelector use event number from secondary input");
109 declareProperty("EvtIdModifierSvc", m_evtIdModSvc,
110 "ServiceHandle for EvtIdModifierSvc");
111 declareProperty("ExecAtPreFork", m_execAtPreFork,
112 "List of algorithms/sequences to execute during PreFork");
113}
114
115//=========================================================================
116// Standard Destructor
117//=========================================================================
121
122//=========================================================================
123// implementation of IAppMgrUI::initalize
124//=========================================================================
126{
127 ATH_MSG_INFO ( "Initializing {}", name() ) ;
128
129 m_autoRetrieveTools = false;
130 m_checkToolDeps = false;
131
132 StatusCode sc = MinimalEventLoopMgr::initialize();
133 if ( !sc.isSuccess() )
134 {
135 ATH_MSG_ERROR ( "Failed to initialize base class MinimalEventLoopMgr" );
136 return sc;
137 }
138
139//-------------------------------------------------------------------------
140// Setup access to event data services
141//-------------------------------------------------------------------------
142
143 sc = m_eventStore.retrieve();
144 if( !sc.isSuccess() )
145 {
146 ATH_MSG_FATAL ( "Error retrieving pointer to StoreGateSvc" );
147 return sc;
148 }
149
150//--------------------------------------------------------------------------
151// Get the references to the services that are needed by the ApplicationMgr
152// itself
153//--------------------------------------------------------------------------
154 sc = m_incidentSvc.retrieve();
155 if( !sc.isSuccess() )
156 {
157 ATH_MSG_FATAL ( "Error retrieving IncidentSvc." );
158 return sc;
159 }
160
161//--------------------------------------------------------------------------
162// Access Property Manager interface:
163//--------------------------------------------------------------------------
164 SmartIF<IProperty> prpMgr(serviceLocator());
165 if ( !prpMgr.isValid() )
166 {
167 ATH_MSG_FATAL ( "IProperty interface not found in ApplicationMgr." );
168 return StatusCode::FAILURE;
169 }
170
171
172//--------------------------------------------------------------------------
173// Set up the Histogram Service
174//--------------------------------------------------------------------------
175 sc = m_histoDataMgrSvc.retrieve();
176 if( !sc.isSuccess() )
177 {
178 ATH_MSG_FATAL ( "Error retrieving HistogramDataSvc" );
179 return sc;
180 }
181
182 const std::string& histPersName(m_histPersName.value());
183 if ( histPersName.length() == 0 )
184 {
185 CHECK(setProperty(prpMgr->getProperty("HistogramPersistency")));
186 }
187
188 if ( histPersName != "NONE" ) {
189
190 m_histoPersSvc = IConversionSvc_t( "HistogramPersistencySvc",
191 this->name() );
192
193 if( !sc.isSuccess() ) {
194 ATH_MSG_WARNING ( "Histograms cannot not be saved - though required." );
195 } else {
196
197 SmartIF<IProperty> histSvc;
198 if (histPersName == "ROOT") {
199 histSvc = serviceLocator()->service("RootHistSvc");
200 } else if ( histPersName == "HBOOK" ) {
201 histSvc = serviceLocator()->service("HbookHistSvc");
202 }
203
204 if (!histSvc) {
205 ATH_MSG_ERROR ( "could not locate actual Histogram persistency service" );
206 } else {
207 const Gaudi::Details::PropertyBase &prop = histSvc->getProperty("OutputFile");
208 std::string val;
209 try {
210 const StringProperty &sprop = dynamic_cast<const StringProperty&>( prop );
211
212 val = sprop.value();
213
214 } catch (...) {
215 ATH_MSG_VERBOSE ( "could not dcast OutputFile property to a StringProperty."
216 " Need to fix Gaudi." );
217
218 val = prop.toString();
219
220 }
221
222 if (val != "" &&
223 val != "UndefinedROOTOutputFileName" &&
224 val != "UndefinedHbookOutputFileName" ) {
225 m_writeHists = true;
226 }
227 }
228 }
229
230 } else {
231 ATH_MSG_DEBUG ( "Histograms saving not required." );
232 }
233
234//--------------------------------------------------------------------------
235// Set up the EventID modifier Service
236//--------------------------------------------------------------------------
237 if( m_evtIdModSvc.empty() ) {
238 ATH_MSG_DEBUG ( "EventID modifier Service not set. No run number, ... overrides will be applied." );
239 }
240 else if ( !m_evtIdModSvc.retrieve().isSuccess() ) {
241 ATH_MSG_INFO ( "Could not find EventID modifier Service. No run number, ... overrides will be applied." );
242 }
243
244//-------------------------------------------------------------------------
245// Setup EventSelector service
246//-------------------------------------------------------------------------
247 const std::string& selName(m_evtsel.value());
248 // the evt sel is usually specified as a property of ApplicationMgr
249 if (selName.empty())
250 sc = setProperty(prpMgr->getProperty("EvtSel"));
251 if (sc.isFailure()) ATH_MSG_WARNING ( "Unable to set EvtSel property" );
252
253 // We do not expect a Event Selector necessarily being declared
254 if( !selName.empty() && selName != "NONE") {
255 SmartIF<IEvtSelector> theEvtSel{serviceLocator()->service( selName )};
256 if( theEvtSel && ( theEvtSel != m_evtSelector ) ) {
257 // Event Selector changed (or setup for the first time)
258 m_evtSelector = theEvtSel;
259
260 // reset iterator
261 if (m_evtSelector->createContext(m_evtSelCtxt).isFailure()) {
262 ATH_MSG_FATAL ( "Can not create the event selector Context."
263 );
264 return StatusCode::FAILURE;
265 }
266 if (msgLevel(MSG::INFO)) {
267 SmartIF<INamedInterface> named(theEvtSel);
268 if (named) {
269 ATH_MSG_INFO ( "Setup EventSelector service {}", named->name( )
270 );
271 }
272 }
273 } else if (sc.isFailure()) {
274 ATH_MSG_FATAL ( "No valid event selector called {}", selName
275 );
276 return StatusCode::FAILURE;
277 }
278 }
279
280//-------------------------------------------------------------------------
281// Setup 'Clear-Store' policy
282//-------------------------------------------------------------------------
283 try {
285 } catch(...) {
286 return StatusCode::FAILURE;
287 }
288
289 // Get the AlgExecStateSvc
290 m_aess = serviceLocator()->service("AlgExecStateSvc");
291 if( !m_aess.isValid() ) {
292 ATH_MSG_FATAL ( "Error retrieving AlgExecStateSvc" );
293 return StatusCode::FAILURE;
294 }
295
296 // Listen to the BeforeFork incident
297 m_incidentSvc->addListener(this,"BeforeFork",0);
298
299 CHECK( m_conditionsCleaner.retrieve() );
300
301 // Print if we override the event number using the one from secondary event
303 {
304 ATH_MSG_INFO ( "Using secondary event number." );
305 }
306
307 return sc;
308}
309
310//=========================================================================
311// property handlers
312//=========================================================================
313void
314AthenaEventLoopMgr::setClearStorePolicy(Gaudi::Details::PropertyBase&) {
315 const std::string& policyName = m_clearStorePolicy.value();
316
317 if ( policyName != "BeginEvent" &&
318 policyName != "EndEvent" ) {
319
320 ATH_MSG_FATAL ( "Unknown policy [{}] for the 'ClearStore-policy !\n"
321 "Valid values are: BeginEvent, EndEvent",
322 policyName
323 );
324 throw GaudiException("Can not setup 'ClearStore'-policy",
325 name(),
326 StatusCode::FAILURE);
327 }
328
329 return;
330}
331
332void
333AthenaEventLoopMgr::setupPreSelectTools(Gaudi::Details::PropertyBase&) {
334
335 m_toolInvoke.clear();
336 m_toolReject.clear();
337 m_toolAccept.clear();
338
339 m_tools.retrieve().ignore();
340 if(m_tools.size() > 0) {
341 m_useTools=true;
342 m_toolInvoke.resize(m_tools.size());
343 m_toolReject.resize(m_tools.size());
344 m_toolAccept.resize(m_tools.size());
345
346 tool_iterator firstTool = m_tools.begin();
347 tool_iterator lastTool = m_tools.end();
348 unsigned int toolCtr = 0;
349 for ( ; firstTool != lastTool; ++firstTool )
350 {
351 // reset statistics
352 m_toolInvoke[toolCtr] = 0;
353 m_toolReject[toolCtr] = 0;
354 m_toolAccept[toolCtr] = 0;
355 toolCtr++;
356 }
357 }
358
359 return;
360
361}
362
363/* Called from ApplicationMgr::stopRun()
364 usually when a stop was requested by a signal
365*/
367{
368 ATH_MSG_DEBUG("In stopRun()");
369 CHECK( MinimalEventLoopMgr::stopRun() );
370 // change the appMgr return code to ScheduledStop so no errors are reported
371 auto appProp = m_appMgrUI.as<IProperty>();
372 CHECK( Gaudi::setAppReturnCode( appProp, Gaudi::ReturnCode::ScheduledStop, true ) );
373 return StatusCode::SUCCESS;
374}
375
376//=========================================================================
377// implementation of IAppMgrUI::finalize
378//=========================================================================
380{
381
382 StatusCode sc = MinimalEventLoopMgr::finalize();
383 if (sc.isFailure()) {
384 ATH_MSG_ERROR ( "Error in Algorithm Finalize" );
385 }
386
387 StatusCode sc2 = writeHistograms(true);
388 if (sc2.isFailure()) {
389 ATH_MSG_ERROR ( "Error in writing Histograms" );
390 }
391
392 // Release all interfaces (ignore StatusCodes)
393 m_histoDataMgrSvc.release().ignore();
394 m_histoPersSvc.release().ignore();
395
396 if (m_evtSelector) m_evtSelector->release();
397 m_incidentSvc.release().ignore();
398
399 delete m_evtSelCtxt; m_evtSelCtxt = nullptr;
400
401 if(m_useTools) {
402 tool_iterator firstTool = m_tools.begin();
403 tool_iterator lastTool = m_tools.end();
404 unsigned int toolCtr = 0;
405 ATH_MSG_INFO ( "Summary of AthenaEvtLoopPreSelectTool invocation: (invoked/success/failure)" );
406 ATH_MSG_INFO ( "-----------------------------------------------------" );
407
408 for ( ; firstTool != lastTool; ++firstTool ) {
409 ATH_MSG_INFO ( "{:>2}.) {:.<48} ({:>6}/{:>6}/{:>6})",
410 toolCtr+1,
411 (*firstTool)->name(),
412 m_toolInvoke[toolCtr],
413 m_toolAccept[toolCtr],
414 m_toolReject[toolCtr]);
415 toolCtr++;
416 }
417 }
418 return ( sc.isFailure() || sc2.isFailure() ) ? StatusCode::FAILURE :
419 StatusCode::SUCCESS;
420
421}
422
423//=========================================================================
424// write out the histograms
425//=========================================================================
427
428 StatusCode sc (StatusCode::SUCCESS);
429
430 if ( 0 != m_histoPersSvc && m_writeHists ) {
431 std::vector<DataObject*> objects;
432 sc = m_histoDataMgrSvc->traverseTree( [&objects]( IRegistry* reg, int ) {
433 DataObject* obj = reg->object();
434 if ( !obj || obj->clID() == CLID_StatisticsFile ) return false;
435 objects.push_back( obj );
436 return true;
437 } );
438
439 if ( !sc.isSuccess() ) {
440 ATH_MSG_ERROR ( "Error while traversing Histogram data store" );
441 return sc;
442 }
443
444 if ( objects.size() > 0) {
445 int writeInterval(m_writeInterval.value());
446
447 if ( m_nevt == 1 || force ||
448 (writeInterval != 0 && m_nevt%writeInterval == 0) ) {
449
450 // skip /stat entry!
451 sc = std::accumulate( begin( objects ), end( objects ), sc, [&]( StatusCode isc, auto& i ) {
452 IOpaqueAddress* pAddr = nullptr;
453 StatusCode iret = m_histoPersSvc->createRep( i, pAddr );
454 if ( iret.isFailure() ) return iret;
455 i->registry()->setAddress( pAddr );
456 return isc;
457 } );
458 sc = std::accumulate( begin( objects ), end( objects ), sc, [&]( StatusCode isc, auto& i ) {
459 IRegistry* reg = i->registry();
460 StatusCode iret = m_histoPersSvc->fillRepRefs( reg->address(), i );
461 return iret.isFailure() ? iret : isc;
462 } );
463 if ( ! sc.isSuccess() ) {
464 ATH_MSG_ERROR ( "Error while saving Histograms." );
465 }
466 }
467
468 if (force || (writeInterval != 0 && m_nevt%writeInterval == 0) ) {
469 ATH_MSG_DEBUG ( "committing Histograms" );
470 m_histoPersSvc->conversionSvc()->commitOutput("",true).ignore();
471 }
472 }
473
474 }
475
476 return sc;
477}
478
479//=========================================================================
480// Call sysInitialize() on all algorithms and output streams
481//=========================================================================
483
484 // Initialize the list of Algorithms. Note that existing Algorithms
485 // are protected against multiple initialization attempts.
486 ListAlg::iterator ita;
487 for ( ita = m_topAlgList.begin(); ita != m_topAlgList.end(); ++ita )
488 {
489 StatusCode sc = (*ita)->sysInitialize();
490 if( sc.isFailure() )
491 {
492 ATH_MSG_ERROR( "Unable to initialize Algorithm: {}", (*ita)->name()) ;
493 return sc;
494 }
495 }
496
497 // Initialize the list of Output Streams. Note that existing Output Streams
498 // are protected against multiple initialization attempts.
499 for (ita = m_outStreamList.begin(); ita != m_outStreamList.end(); ++ita )
500 {
501 StatusCode sc = (*ita)->sysInitialize();
502 if( sc.isFailure() ) {
503 ATH_MSG_ERROR ( "Unable to initialize Output Stream: {}", (*ita)->name() );
504 return sc;
505 }
506
507 }
508
509 return StatusCode::SUCCESS;
510}
511
512//=========================================================================
513// Run the algorithms for the current event
514//=========================================================================
515StatusCode AthenaEventLoopMgr::executeAlgorithms(const EventContext& ctx) {
516
517 // Call the execute() method of all top algorithms
518 for ( ListAlg::iterator ita = m_topAlgList.begin();
519 ita != m_topAlgList.end();
520 ++ita )
521 {
522 const StatusCode& sc = (*ita)->sysExecute(ctx);
523 // this duplicates what is already done in Algorithm::sysExecute, which
524 // calls Algorithm::setExecuted, but eventually we plan to remove that
525 // function
526 m_aess->algExecState(*ita,ctx).setState(AlgExecState::State::Done, sc);
527 if ( !sc.isSuccess() ) {
528 // StatusCode doesn't work with std::format
529 ATH_MSG_INFO ( "Execution of algorithm "
530 << (*ita)->name() << " failed with StatusCode::" << sc );
531 return sc;
532 }
533 }
534
535 return StatusCode::SUCCESS;
536}
537
538
539//=========================================================================
540// Execute one event
541//=========================================================================
542StatusCode AthenaEventLoopMgr::executeEvent(EventContext&& ctx)
543{
544 //This is a lightweight implementation of the executeEvent, used when e.g. processing TTrees with RootNtupleEventSelector
545 if(m_liteLoop) {
546 m_incidentSvc->fireIncident(Incident("BeginEvent",IncidentType::BeginEvent));
547 StatusCode sc = executeAlgorithms(ctx);
548 m_incidentSvc->fireIncident(Incident("EndEvent",IncidentType::EndEvent));
549 ++m_proc;
550 ++m_nev;
551 return sc;
552 }
553
555
557 if (m_firstRun || (m_currentRun != ctx.eventID().run_number()) ) {
558 // Fire EndRun incident unless this is the first run
559 if (!m_firstRun) {
560 m_incidentSvc->fireIncident(Incident(name(),IncidentType::EndRun));
561 }
562 m_firstRun=false;
563 m_currentRun = ctx.eventID().run_number();
564
565 ATH_MSG_INFO ( " ===>>> start of run {} <<<===", m_currentRun );
566
567 m_incidentSvc->fireIncident(Incident(name(),IncidentType::BeginRun,ctx));
568 }
569
570 bool toolsPassed=true;
571 bool eventFailed = false;
572 // Call any attached tools to reject events early
573 unsigned int toolCtr=0;
574 if(m_useTools) {
575 //note: pEvent cannot be nullptr here, it has already been dereferenced
576 tool_store::iterator theTool = m_tools.begin();
577 tool_store::iterator lastTool = m_tools.end();
578 while(toolsPassed && theTool!=lastTool )
579 {
580 toolsPassed = (*theTool)->passEvent(ctx.eventID());
581 m_toolInvoke[toolCtr]++;
582 {toolsPassed ? m_toolAccept[toolCtr]++ : m_toolReject[toolCtr]++;}
583 ++toolCtr;
584 ++theTool;
585 }
586 }
587
588
589 uint64_t evtNumber = ctx.eventID().event_number();
590 bool doEvtHeartbeat(m_eventPrintoutInterval.value() > 0 &&
591 ( (!m_intervalInSeconds && 0 == (m_nev % m_eventPrintoutInterval.value())) ||
592 (m_intervalInSeconds && (time(nullptr)-m_lastTime)>m_intervalInSeconds) ));
593 if (doEvtHeartbeat) {
594 if(!m_useTools) {
595 ATH_MSG_INFO ( " ===>>> start processing event #{}, run #{} {} events processed so far <<<===",
596 evtNumber, m_currentRun, m_nev);
598 ATH_MSG_INFO(" ===>>> Event processing rate = {} Hz <<<===",
599 double(m_nev-m_lastNev)/(time(nullptr)-m_lastTime));
600 m_lastNev = m_nev; m_lastTime = time(nullptr);
601 }
602 }
603
604 else ATH_MSG_INFO ( " ===>>> start processing event #{}, run #{} {} events read and {} events processed so far <<<===",
605 evtNumber, m_currentRun, m_nev, m_proc);
606 }
607
608 // Reset the timeout singleton
610 if(toolsPassed) {
611 // Fire BeginEvent "Incident"
612 //m_incidentSvc->fireIncident(Incident(*pEvent, name(),"BeginEvent"));
613
614 // An incident may schedule a stop, in which case is better to exit before the actual execution.
615 if ( m_scheduledStop ) {
616 ATH_MSG_ALWAYS ( "A stopRun was requested by an incidentListener. "
617 "Do not process this event." );
618 return (StatusCode::SUCCESS);
619 }
620
621 CHECK( m_conditionsCleaner->event (ctx, false) );
622
623 // Call the execute() method of all top algorithms
624 StatusCode sc = executeAlgorithms(ctx);
625
626 if(!sc.isSuccess()) {
627 eventFailed = true;
628 m_aess->setEventStatus( EventStatus::AlgFail, ctx );
629
633 if (m_failureMode == 1 && sc.isRecoverable() ) {
634 ATH_MSG_WARNING ( "RECOVERABLE error returned by algorithm. "
635 "Skipping remaining algorithms.\n"
636 "\tNo output will be written for this event, "
637 "but job will continue to next event" );
638 eventFailed = false;
639 }
640
642 if (m_failureMode >= 2) {
643 ATH_MSG_INFO ( "Skipping remaining algorithms.\n"
644 "\tNo output will be written for this event, "
645 "but job will continue to next event" );
646 eventFailed = false;
647 }
648
649 } else {
650
651 m_aess->setEventStatus( EventStatus::Success, ctx );
652
653 // Call the execute() method of all output streams
654 for (ListAlg::iterator ito = m_outStreamList.begin();
655 ito != m_outStreamList.end(); ++ito ) {
656 sc = (*ito)->sysExecute(ctx);
657 if( !sc.isSuccess() ) {
658 eventFailed = true;
659 }
660 }
661
662 writeHistograms().ignore();
663
664 }
665
666 // Fire EndEvent "Incident"
667 //m_incidentSvc->fireIncident(Incident(*pEvent, name(),"EndEvent"));
668 ++m_proc;
669 } // end of toolsPassed test
670 ++m_nev;
671 if (doEvtHeartbeat) {
673 if (!m_useTools)
674 ATH_MSG_INFO(" ===>>> done processing event #{}, run #{} {} events processed so far <<<===",
675 evtNumber, m_currentRun, m_nev);
676 else
677 ATH_MSG_INFO(" ===>>> done processing event #{}, run #{} {} events read and {} events processed so far <<<===",
678 evtNumber, m_currentRun, m_nev, m_proc);
679 }
680 std::ofstream outfile( "eventLoopHeartBeat.txt");
681 if ( !outfile ) {
682 ATH_MSG_ERROR ( " unable to open: eventLoopHeartBeat.txt" );
683 } else {
684 std::println (outfile, " done processing event #{}, run #{} {} events read so far <<<===",
685 evtNumber, m_currentRun, m_nev);
686 outfile.close();
687 }
688
689 }
690
691 //------------------------------------------------------------------------
692 // Check if there was an error processing current event
693 //------------------------------------------------------------------------
694 return eventFailed?StatusCode::FAILURE:StatusCode::SUCCESS;
695
696}
697
698//=========================================================================
699// implementation of IEventProcessor::executeRun
700//=========================================================================
701StatusCode AthenaEventLoopMgr::executeRun(int maxevt)
702{
703 if (!(this->nextEvent(maxevt)).isSuccess()) return StatusCode::FAILURE;
704 m_incidentSvc->fireIncident(Incident(name(),"EndEvtLoop"));
705 m_incidentSvc->fireIncident(Incident(name(),IncidentType::EndRun));
706
707 return StatusCode::SUCCESS;
708}
709
710//=========================================================================
711// implementation of IAppMgrUI::nextEvent
712//=========================================================================
713StatusCode AthenaEventLoopMgr::nextEvent(int maxevt)
714{
715 // make nextEvent(0) a dummy call
716 if (0 == maxevt) return StatusCode::SUCCESS;
717
718 static std::atomic<int> total_nevt = 0;
719
720 // the current 'clear-store' policy
721 static const ClearStorePolicy::Type s_clearStore =
722 clearStorePolicy( m_clearStorePolicy.value(), msgStream() );
723
724
725 // These following two initialization loops are performed here in case new
726 // Top level Algorithms or Output Streams have been created interactively
727 // at run-time instead of configuration time. Note also that it is possible
728 // that some newly created Algorithms are still not initialized as a result
729 // of these loops (e.g. where the membership of an existing Sequencer is
730 // changed at run-time. In this case, the Algorithm::sysExecute() function
731 // will ensure that the Algorithm is correctly initialized. This mechanism
732 // actually makes loops redundant, but they do provide a well defined
733 // location for the initialization to take place in the non-interactive case.
734
735 StatusCode sc = initializeAlgorithms();
736 if(sc.isFailure())
737 return sc;
738
739 // loop over events if the maxevt (received as input) is different from -1.
740 // if evtmax is -1 it means infinite loop
741
742 while(maxevt == -1 || m_nevt < maxevt) {
743
744 if(m_doChrono && total_nevt>0) m_chronoStatSvc->chronoStart("EventLoopMgr"); //start after first event
745 if(m_doChrono && total_nevt>0) m_chronoStatSvc->chronoStart("EventLoopMgr_preexec");
746
747 // Check if there is a scheduled stop issued by some algorithm/sevice
748 if ( m_scheduledStop ) {
749 m_scheduledStop = false;
750 ATH_MSG_ALWAYS ( "A stopRun was requested. Terminating event loop." );
751 break;
752 }
753
754
755
756 ++m_nevt; ++total_nevt;
757 //-----------------------------------------------------------------------
758 // Clear the event store, if used in the event loop
759 //-----------------------------------------------------------------------
760 if( s_clearStore == ClearStorePolicy::BeginEvent &&
761 0 != total_nevt ) {
762 sc = m_eventStore->clearStore();
763 if( !sc.isSuccess() ) {
764 ATH_MSG_ERROR ( "Clear of Event data store failed" );
765 m_incidentSvc->fireIncident(Incident(name(),"EndEvtLoop"));
766 return sc;
767 }
768 }
769
770
771
772 //-----------------------------------------------------------------------
773 // we need an EventInfo Object to fire the incidents.
774 //-----------------------------------------------------------------------
775 if ( m_evtSelCtxt )
776 { // Deal with the case when an EventSelector is provided
777
778 IOpaqueAddress* addr = nullptr;
779
780 sc = m_evtSelector->next(*m_evtSelCtxt);
781
782 if ( !sc.isSuccess() )
783 {
784 // This is the end of the loop. No more events in the selection
785 ATH_MSG_INFO ( "No more events in event selection " );
786 sc = StatusCode::SUCCESS;
787 break;
788 }
789
790 if (m_evtSelector->createAddress(*m_evtSelCtxt, addr).isFailure()) {
791 ATH_MSG_ERROR ( "Could not create an IOpaqueAddress" );
792 break;
793 }
794
795
796 // Most iterators provide the IOA of an event header (EventInfo, DataHeader)
797 if (nullptr != addr) {
798 //create its proxy
799 sc = m_eventStore->recordAddress(addr);
800 if( !sc.isSuccess() ) {
801 ATH_MSG_WARNING ( "Error declaring Event object" );
802 continue;
803 }
804 }
805 if ((sc=m_eventStore->loadEventProxies()).isFailure()) {
806 ATH_MSG_ERROR ( "Error loading Event proxies" );
807 continue;
808 }
809 }
810 if(m_doChrono && total_nevt>1) m_chronoStatSvc->chronoStop("EventLoopMgr_preexec");
811 if(m_doChrono && total_nevt>1) m_chronoStatSvc->chronoStart("EventLoopMgr_execute");
812 // create an empty EventContext that will get set inside executeEvent
813 EventContext ctx;
814 // Execute event for all required algorithms
815 sc = executeEvent( std::move( ctx ) );
816 if(m_doChrono && total_nevt>1) m_chronoStatSvc->chronoStop("EventLoopMgr_execute");
817 if(m_doChrono && total_nevt>1) m_chronoStatSvc->chronoStart("EventLoopMgr_postexec");
818 if( !sc.isSuccess() )
819 {
820 ATH_MSG_ERROR ( "Terminating event processing loop due to errors" );
821 break;
822 }
823
824 //-----------------------------------------------------------------------
825 // Clear the event store, if used in the event loop
826 //-----------------------------------------------------------------------
827 if ( s_clearStore == ClearStorePolicy::EndEvent ) {
828 sc = m_eventStore->clearStore();
829 if( !sc.isSuccess() ) {
830 ATH_MSG_ERROR ( "Clear of Event data store failed" );
831 break;
832 }
833 }
834 if(m_doChrono && total_nevt>1) m_chronoStatSvc->chronoStop("EventLoopMgr_postexec");
835 if(m_doChrono && total_nevt>1) m_chronoStatSvc->chronoStop("EventLoopMgr");
836 } //event loop
837
838
839
840 return sc;
841
842}
843
844
845//=========================================================================
846// Seek to a given event.
847// The event selector must support the IEvtSelectorSeek interface for this to work.
848//=========================================================================
849StatusCode AthenaEventLoopMgr::seek (int evt)
850{
851 IEvtSelectorSeek* is = dynamic_cast<IEvtSelectorSeek*> (m_evtSelector);
852 if (is == nullptr) {
853 ATH_MSG_ERROR ( "Seek failed; unsupported by event selector" );
854 return StatusCode::FAILURE;
855 }
856 //cppcheck-suppress nullPointerRedundantCheck
857 if (!m_evtSelCtxt) {
858 if (m_evtSelector->createContext(m_evtSelCtxt).isFailure()) {
859 ATH_MSG_FATAL ( "Can not create the event selector Context." );
860 return StatusCode::FAILURE;
861 }
862 }
863 //m_evtSelCtxt cannot be null if createContext succeeded
864 //cppcheck-suppress nullPointerRedundantCheck
865 StatusCode sc = is->seek (*m_evtSelCtxt, evt);
866 if (sc.isSuccess()) {
867 m_nevt = evt;
868 }
869 else {
870 ATH_MSG_ERROR ( "Seek failed." );
871 }
872 return sc;
873}
874
875
876//=========================================================================
877// Return the current event count.
878//=========================================================================
880{
881 return m_nevt;
882}
883
884//=========================================================================
890
891//=========================================================================
892// Return the collection size
893//=========================================================================
895{
896 IEvtSelectorSeek* cs = dynamic_cast<IEvtSelectorSeek*> (m_evtSelector);
897 if (cs == nullptr) {
898 ATH_MSG_ERROR ( "Collection size unsupported by event selector" );
899 return -1;
900 }
901 //cppcheck-suppress nullPointerRedundantCheck
902 if (!m_evtSelCtxt) {
903 if (m_evtSelector->createContext(m_evtSelCtxt).isFailure()) {
904 ATH_MSG_FATAL ( "Can not create the event selector Context." );
905 return -1;
906 }
907 }
908 //m_evtSelCtxt cannot be null if createContext succeeded
909 //cppcheck-suppress nullPointerRedundantCheck
910 return cs->size (*m_evtSelCtxt);
911}
912
913//=========================================================================
914// Handle incidents
915//=========================================================================
916void AthenaEventLoopMgr::handle(const Incident& inc)
917{
918 if(inc.type()!="BeforeFork")
919 return;
920
921 if(!m_firstRun) {
922 ATH_MSG_WARNING ( "Skipping BeforeFork handler. Begin run has already passed" );
923 return;
924 }
925
926 // Initialize Algorithms and Output Streams
927 StatusCode sc = initializeAlgorithms();
928 if(sc.isFailure()) {
929 ATH_MSG_ERROR ( "Failed to initialize Algorithms" );
930 return;
931 }
932
933 if(!m_evtSelCtxt) {
934 ATH_MSG_WARNING ( "Skipping BeforeFork handler. No event selector is provided" );
935 return;
936 }
937
938 // Construct EventInfo
939 IOpaqueAddress* addr = nullptr;
940 sc = m_evtSelector->next(*m_evtSelCtxt);
941 if(!sc.isSuccess()) {
942 ATH_MSG_INFO ( "No more events in event selection " );
943 return;
944 }
945 sc = m_evtSelector->createAddress(*m_evtSelCtxt, addr);
946 if (sc.isFailure()) {
947 ATH_MSG_ERROR ( "Could not create an IOpaqueAddress" );
948 return;
949 }
950 if (nullptr != addr) {
951 //create its proxy
952 sc = m_eventStore->recordAddress(addr);
953 if(!sc.isSuccess()) {
954 ATH_MSG_ERROR ( "Error declaring Event object" );
955 return;
956 }
957 }
958
959 if(m_eventStore->loadEventProxies().isFailure()) {
960 ATH_MSG_WARNING ( "Error loading Event proxies" );
961 return;
962 }
963
964 // Need to make sure we have a valid EventContext in place before
965 // doing anything that could fire incidents.
966 EventContext ctx;
967 // In the case of the BeginRun incident, we just want to take the
968 // next IoV from the list in the EvtIdModifierSvc, but leave it to
969 // be used for the next executeEvent call. TODO CHECK
970 if( installEventContext(ctx).isFailure() ) {
971 throw std::runtime_error( "Error installing event context object" );
972 }
973
974 m_incidentSvc->fireIncident(Incident(name(),IncidentType::BeginRun,ctx));
975 m_firstRun=false;
976 m_currentRun = ctx.eventID().run_number();
977
978 // Execute requested algorithms/sequences
979 if ( execAtPreFork(ctx).isFailure() ) {
980 ATH_MSG_ERROR ( "Unable to execute requested algorithms/sequences during PreFork!" );
981 return;
982 }
983
984 // Clear Store
985 const ClearStorePolicy::Type s_clearStore = clearStorePolicy( m_clearStorePolicy.value(), msgStream() );
986 if(s_clearStore==ClearStorePolicy::EndEvent) {
987 sc = m_eventStore->clearStore();
988 if(!sc.isSuccess()) {
989 ATH_MSG_ERROR ( "Clear of Event data store failed" );
990 }
991 }
992}
993
994//=========================================================================
995// Execute certain algorithms/sequence in PreFork
996//=========================================================================
997StatusCode AthenaEventLoopMgr::execAtPreFork(const EventContext& ctx) const {
998 IAlgManager* algMgr = Gaudi::svcLocator()->as<IAlgManager>();
999
1000 StatusCode sc;
1001 for (const std::string& name : m_execAtPreFork) {
1002 SmartIF<IAlgorithm>& alg = algMgr->algorithm(name, /*createIf*/false);
1003 if ( alg ) {
1004 ATH_MSG_INFO("Executing {}...", alg->name());
1005 sc &= alg->sysExecute(ctx);
1006 }
1007 else ATH_MSG_WARNING("Cannot find algorithm or sequence {}", name);
1008 }
1009 return sc;
1010}
1011
1012//=========================================================================
1013// Fill in our EventContext object and make it current.
1014//=========================================================================
1015StatusCode AthenaEventLoopMgr::installEventContext(EventContext& ctx) {
1016 // first get EventInfo and conditionsRun
1017 std::unique_ptr<EventInfo> eventInfo;
1018 EventID eventID;
1019 unsigned int conditionsRun = EventIDBase::UNDEFNUM;
1020 bool consume_modifier_stream = false; // FIXME/CHECK: was true inside TP converter and checks for active storegate
1021
1022 // Event index for run-dependent EventID modification: m_nevt-1 in serial,
1023 // or the absolute index supplied by the AthenaMP consumer (chunk base +
1024 // in-chunk offset derived from m_nevt without mutating state).
1026 ? static_cast<long>(m_nevt - 1)
1028
1029 if (m_evtSelCtxt) { // Deal with the case when an EventSelector is provided
1030 // First try to build a legacy EventInfo object from the TAG information
1031 // Read the attribute list
1032 const AthenaAttributeList* pAttrList =
1033 m_eventStore->tryConstRetrieve<AthenaAttributeList>("Input");
1034 if (pAttrList != nullptr && pAttrList->size() > 6) {
1035 // Try making EventID-only EventInfo object from in-file TAG
1036 try {
1037 unsigned int runNumber = (*pAttrList)["RunNumber"].data<unsigned int>();
1038 unsigned long long eventNumber = (*pAttrList)["EventNumber"].data<unsigned long long>();
1039 unsigned int eventTime = (*pAttrList)["EventTime"].data<unsigned int>();
1040 unsigned int eventTimeNS = (*pAttrList)["EventTimeNanoSec"].data<unsigned int>();
1041 unsigned int lumiBlock = (*pAttrList)["LumiBlockN"].data<unsigned int>();
1042 unsigned int bunchId = (*pAttrList)["BunchId"].data<unsigned int>();
1043
1044 ATH_MSG_DEBUG("use TAG with runNumber={}", runNumber);
1045 consume_modifier_stream = true;
1046 // an option to override primary eventNumber with the secondary one in
1047 // case of DoubleEventSelector
1049 unsigned long long eventNumberSecondary{};
1050 if (!(pAttrList->exists("hasSecondaryInput") &&
1051 (*pAttrList)["hasSecondaryInput"].data<bool>())) {
1052 ATH_MSG_FATAL("Secondary EventNumber requested, but secondary input does not exist!");
1053 return StatusCode::FAILURE;
1054 }
1055 if (pAttrList->exists("EventNumber_secondary")) {
1056 eventNumberSecondary = (*pAttrList)["EventNumber_secondary"].data<unsigned long long>();
1057 } else {
1058 // try legacy EventInfo if secondary input did not have attribute
1059 // list primary input should not have this EventInfo type
1060 const EventInfo* pEventSecondary = m_eventStore->tryConstRetrieve<EventInfo>();
1061 if (pEventSecondary) {
1062 eventNumberSecondary = pEventSecondary->event_ID()->event_number();
1063 } else {
1064 ATH_MSG_FATAL("Secondary EventNumber requested, but it does not exist!");
1065 return StatusCode::FAILURE;
1066 }
1067 }
1068 if (eventNumberSecondary != 0) {
1069 bool doEvtHeartbeat(m_eventPrintoutInterval.value() > 0 &&
1070 0 == (m_nev % m_eventPrintoutInterval.value()));
1071 if (doEvtHeartbeat) {
1072 ATH_MSG_INFO(" ===>>> using secondary event #{} instead of #{} <<<===",
1073 eventNumberSecondary, eventNumber);
1074 }
1075 eventNumber = eventNumberSecondary;
1076 }
1077 }
1078
1079 eventInfo = std::make_unique<EventInfo>(
1080 std::make_unique<EventID>(runNumber, eventNumber, eventTime,
1081 eventTimeNS, lumiBlock, bunchId),
1082 nullptr);
1083 eventID = *(eventInfo->event_ID());
1084
1085 if (!m_evtIdModSvc.isSet() && pAttrList->exists("ConditionsRun")) {
1086 conditionsRun = (*pAttrList)["ConditionsRun"].data<unsigned int>();
1087 } else {
1088 conditionsRun = runNumber;
1089 }
1090
1091 } catch (...) {
1092 }
1093 /* FIXME: PvG, not currently written
1094 if( pEvent != 0 && pAttrList->size() > 7 ) {
1095 // Try adding EventType information
1096 try {
1097 float eventWeight = (*pAttrList)["EventWeight"].data<float>();
1098 const EventType* pType = new EventType(); pEvent->setEventType(pType);
1099 pEvent->event_type()->set_mc_event_weight(eventWeight);
1100 } catch (...) {
1101 pEvent->setEventType(0);
1102 }
1103 }
1104 */
1105 } else if (m_requireInputAttributeList) {
1106 ATH_MSG_FATAL("Valid input attribute list required but not present!");
1107 return StatusCode::FAILURE;
1108 }
1109 // In the case that there is no TAG information
1110 if( !eventInfo ) {
1111 // Secondly try to retrieve a legacy EventInfo object from the input file
1113 const EventInfo* pei = m_eventStore->tryConstRetrieve<EventInfo>();
1114 if( pei ) {
1115 eventID = *(pei->event_ID());
1116 } else {
1117 // Finally try to retrieve an xAOD::EventInfo object from the
1118 // input file and build a legacy EventInfo object from that.
1119 const xAOD::EventInfo* xAODEvent = m_eventStore->tryConstRetrieve<xAOD::EventInfo>();
1120 if (xAODEvent == nullptr) {
1121 ATH_MSG_ERROR("Failed to get EventID from input. Tried old-style and xAOD::EventInfo");
1122 return StatusCode::FAILURE;
1123 }
1124 ATH_MSG_DEBUG("use xAOD::EventInfo with runNumber={}", xAODEvent->runNumber());
1125 // Record the old-style object for those clients that still need it
1126 eventInfo = std::make_unique<EventInfo>(
1127 std::make_unique<EventID>(eventIDFromxAOD(xAODEvent)),
1128 std::make_unique<EventType>(eventTypeFromxAOD(xAODEvent)));
1129 eventID = *(eventInfo->event_ID());
1130 StatusCode sc = m_eventStore->record(std::move(eventInfo), "");
1131 if (!sc.isSuccess()) {
1132 ATH_MSG_ERROR("Error declaring event data object");
1133 return StatusCode::FAILURE;
1134 }
1135 }
1136 }
1137 } else {
1138 // No EventSelector is provided, so with no iterator it's up to us
1139 // to create an EventInfo
1140 eventInfo = std::make_unique<EventInfo>(
1141 std::make_unique<EventID>(1, m_nevt, 0), std::make_unique<EventType>());
1142 eventInfo->event_ID()->set_lumi_block(m_nevt);
1143 eventID = *(eventInfo->event_ID());
1144 StatusCode sc = m_eventStore->record(std::move(eventInfo), "");
1145 if (!sc.isSuccess()) {
1146 ATH_MSG_ERROR("Error declaring event data object");
1147 return (StatusCode::FAILURE);
1148 }
1149 }
1150
1151 ctx.setEventID( eventID );
1152 ctx.set(m_nev,0);
1154 Atlas::ExtendedEventContext( m_eventStore->hiveProxyDict(),
1155 conditionsRun) );
1156 modifyEventContext(ctx, eventID, consume_modifier_stream);
1157 Gaudi::Hive::setCurrentContext( ctx );
1158
1159 m_aess->reset( ctx );
1160 if (m_eventStore->record(std::make_unique<EventContext> ( ctx ),
1161 "EventContext").isFailure())
1162 {
1163 ATH_MSG_ERROR ( "Error recording event context object" );
1164 return (StatusCode::FAILURE);
1165 }
1166
1167 return StatusCode::SUCCESS;
1168}
1169
1170//---------------------------------------------------------------------------
1171
1172void AthenaEventLoopMgr::modifyEventContext(EventContext& ctx, const EventID& eID, bool consume_modifier_stream) {
1173 if (m_evtIdModSvc.isSet()) {
1174 EventID new_eID(eID);
1175 m_evtIdModSvc->modify_evtid(new_eID, m_curEvtModIdx, consume_modifier_stream);
1176 if (msgLevel(MSG::DEBUG)) {
1177 unsigned int oldrunnr=eID.run_number();
1178 unsigned int oldLB=eID.lumi_block();
1179 unsigned int oldTS=eID.time_stamp();
1180 unsigned int oldTSno=eID.time_stamp_ns_offset();
1181 ATH_MSG_DEBUG ( "modifyEventContext: use evtIdModSvc runnr={} -> {}",
1182 oldrunnr, new_eID.run_number());
1183 ATH_MSG_DEBUG ( "modifyEventContext: use evtIdModSvc LB={} -> {}",
1184 oldLB, new_eID.lumi_block());
1185 ATH_MSG_DEBUG ( "modifyEventContext: use evtIdModSvc TimeStamp={} -> {}",
1186 oldTS, new_eID.time_stamp());
1187 ATH_MSG_DEBUG ( "modifyEventContext: use evtIdModSvc TimeStamp ns Offset={} -> {}",
1188 oldTSno, new_eID.time_stamp_ns_offset());
1189 }
1190 ctx.setEventID( new_eID );
1191 Atlas::getExtendedEventContext(ctx).setConditionsRun( ctx.eventID().run_number() );
1192 return;
1193 }
1194
1195 ctx.setEventID( eID );
1196}
#define ATH_MSG_DEBUG(x,...)
#define ATH_MSG_ERROR(x,...)
#define ATH_MSG_ALWAYS(x,...)
#define ATH_MSG_WARNING(x,...)
#define ATH_MSG_VERBOSE(x,...)
#define ATH_MSG_INFO(x,...)
#define ATH_MSG_FATAL(x,...)
The default ATLAS batch event loop manager.
ClearStorePolicy::Type clearStorePolicy(const std::string &policyName, MsgStream &msg)
returns the enum-version of the policy (by name)
Helpers for checking error return status codes and reporting errors.
#define CHECK(...)
Evaluate an expression and check for errors.
Assign a CLID to EventContext.
This class provides a unique identification for each event, in terms of run/event number and/or a tim...
EventID eventIDFromxAOD(const xAOD::EventInfo *xaod)
Create EventID object from xAOD::EventInfo.
EventType eventTypeFromxAOD(const xAOD::EventInfo *xaod)
Create EventType object from xAOD::EventInfo.
This class provides general information about an event.
This file contains the class definition for the IAthenaEvtLoopPreSelectTool class.
Extension to IEvtSelector to allow for seeking.
static Double_t sc
void setProperty(columnar::PythonToolHandle &self, const std::string &key, nb::object value)
An AttributeList represents a logical row of attributes in a metadata table.
AthMessaging(IMessageSvc *msgSvc, const std::string &name)
Constructor.
An AttributeList represents a logical row of attributes in a metadata table.
virtual ~AthenaEventLoopMgr()
Standard Destructor.
UnsignedIntegerProperty m_eventPrintoutInterval
IntegerProperty m_failureMode
IEvtSelector::Context * m_evtSelCtxt
Gaudi EventSelector Context (may be used as a cursor by the evt selector).
virtual int curEvent() const override
Return the current event count.
tool_stats m_toolInvoke
tool called counter
IIncidentSvc_t m_incidentSvc
Reference to the incident service.
unsigned int m_nev
events processed
StoreGateSvc_t m_eventStore
Reference to StoreGateSvc;.
bool m_useSecondaryEventNumber
read event number from secondary input
tool_stats m_toolAccept
tool returns StatusCode::SUCCESS counter
virtual void handle(const Incident &inc) override
IIncidentListenet interfaces.
bool m_requireInputAttributeList
require input attribute list
SmartIF< IAlgExecStateSvc > m_aess
Reference to the Algorithm Execution State Svc.
virtual StatusCode writeHistograms(bool force=false)
Dump out histograms as needed.
StringProperty m_histPersName
tool_stats m_toolReject
tool returns StatusCode::FAILURE counter
AthenaEventLoopMgr()
no implementation
StatusCode execAtPreFork(const EventContext &ctx) const
Execute certain algorithms/sequences in PreFork.
IConversionSvc_t m_histoPersSvc
IEvtSelector * m_evtSelector
Reference to the Event Selector.
virtual StatusCode executeEvent(EventContext &&ctx) override
implementation of IEventProcessor::executeEvent(EventContext&& ctx)
virtual StatusCode initialize() override
implementation of IAppMgrUI::initalize
virtual StatusCode seek(int evt) override
Seek to a given event.
virtual int size() override
Return the size of the collection.
IEvtIdModifierSvc_t m_evtIdModSvc
StringProperty m_evtsel
virtual StatusCode finalize() override
implementation of IAppMgrUI::finalize
IntegerProperty m_writeInterval
StringProperty m_clearStorePolicy
ServiceHandle< IConversionSvc > IConversionSvc_t
StatusCode installEventContext(EventContext &ctx)
virtual StatusCode stopRun() override
Called from ApplicationMgr::stopRun() to terminate the loop.
void setupPreSelectTools(Gaudi::Details::PropertyBase &)
property update handler:sets up the Pre-selection tools
virtual const std::string & name() const override
virtual StatusCode executeAlgorithms(const EventContext &)
Run the algorithms for the current event.
StringArrayProperty m_execAtPreFork
virtual void modifyEventContext(EventContext &ctx, const EventID &eID, bool consume_modifier_stream)
number_type m_currentRun
current run number
unsigned int m_intervalInSeconds
StatusCode initializeAlgorithms()
Initialize all algorithms and output streams.
tool_store::const_iterator tool_iterator
tool_store m_tools
internal tool store
virtual StatusCode executeRun(int maxevt) override
implementation of IEventProcessor::executeRun(int maxevt)
virtual StatusCode nextEvent(int maxevt) override
implementation of IAppMgrUI::nextEvent. maxevt==0 returns immediately
ServiceHandle< IChronoStatSvc > m_chronoStatSvc
ServiceHandle< Athena::IConditionsCleanerSvc > m_conditionsCleaner
IDataManagerSvc_t m_histoDataMgrSvc
Reference to the Histogram Data Service.
virtual void setNextEventModifierIndex(long idx) override
Supply absolute input event index for EvtIdModifierSvc. See IEventSeek.h.
void setClearStorePolicy(Gaudi::Details::PropertyBase &clearStorePolicy)
property update handler:set the clear-store policy value and check its value.
void resetTimeout(Timeout &instance)
Reset timeout.
Definition Timeout.h:83
static Timeout & instance()
Get reference to Timeout singleton.
Definition Timeout.h:64
void setConditionsRun(EventIDBase::number_type conditionsRun)
This class provides a unique identification for each event, in terms of run/event number and/or a tim...
Definition EventID.h:34
This class provides general information about an event.
EventID * event_ID()
the unique identification of the event.
Abstract interface for seeking for an event selector.
virtual StatusCode seek(IEvtSelector::Context &c, int evtnum) const =0
Seek to a given event number.
virtual int size(IEvtSelector::Context &c) const =0
Return the size of the collection, or -1 if we can't get the size.
uint32_t runNumber() const
The current event's run number.
void setExtendedEventContext(EventContext &ctx, ExtendedEventContext &&ectx)
Move an extended context into a context object.
const ExtendedEventContext & getExtendedEventContext(const EventContext &ctx)
Retrieve an extended context from a context object.
event_number_t eventIndex
EventInfo_v1 EventInfo
Definition of the latest event info version.