Loading [MathJax]/jax/input/TeX/config.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
AthenaEventLoopMgr.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2025 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 
15 // Athena includes
23 
24 #include "GaudiKernel/IAlgManager.h"
25 #include "GaudiKernel/IAlgorithm.h"
26 #include "GaudiKernel/SmartIF.h"
27 #include "GaudiKernel/Incident.h"
28 #include "GaudiKernel/DataObject.h"
29 #include "GaudiKernel/IIncidentSvc.h"
30 #include "GaudiKernel/IEvtSelector.h"
31 #include "GaudiKernel/IDataManagerSvc.h"
32 #include "GaudiKernel/IConversionSvc.h"
33 #include "GaudiKernel/GaudiException.h"
34 #include "GaudiKernel/EventContext.h"
35 #include "GaudiKernel/EventIDBase.h"
36 #include "GaudiKernel/ThreadLocalContext.h"
37 #include "GaudiKernel/Algorithm.h"
38 
39 #include "StoreGate/StoreGateSvc.h"
40 
41 #include "EventInfo/EventInfo.h"
42 #include "EventInfo/EventID.h"
43 #include "EventInfo/EventType.h"
44 
45 #include "xAODEventInfo/EventInfo.h"
50 
51 #include "ClearStorePolicy.h"
52 
53 #include "AthenaEventLoopMgr.h"
55 
56 
57 //=========================================================================
58 // Standard Constructor
59 //=========================================================================
61  ISvcLocator* svcLoc)
62  : base_class(nam, svcLoc),
63  AthMessaging (nam),
64  m_incidentSvc ( "IncidentSvc", nam ),
65  m_eventStore( "StoreGateSvc", nam ),
66  m_evtSelector(nullptr), m_evtSelCtxt(nullptr),
67  m_histoDataMgrSvc( "HistogramDataSvc", nam ),
68  m_histoPersSvc ( "HistogramPersistencySvc", nam ),
69  m_evtIdModSvc ( "", nam ),
70  m_execAtPreFork(),
71  m_currentRun(0), m_firstRun(true), m_tools(this),
72  m_nevt(0), m_writeHists(false),
73  m_nev(0), m_proc(0), m_useTools(false),
74  m_chronoStatSvc( "ChronoStatSvc", nam ),
75  m_conditionsCleaner( "Athena::ConditionsCleanerSvc", nam )
76 {
77  declareProperty("EvtStore", m_eventStore, "The StoreGateSvc instance to interact with for event payload" );
78  declareProperty("EvtSel", m_evtsel,
79  "Name of Event Selector to use. If empty string (default) "
80  "take value from ApplicationMgr");
81  declareProperty("HistogramPersistency", m_histPersName="",
82  "Histogram persistency technology to use: ROOT, HBOOK, NONE. "
83  "By default (empty string) get property value from "
84  "ApplicationMgr");
85  declareProperty("HistWriteInterval", m_writeInterval=0 ,
86  "histogram write/update interval");
87  declareProperty("FailureMode", m_failureMode=1 ,
88  "Controls behaviour of event loop depending on return code of"
89  " Algorithms. 0: all non-SUCCESSes terminate job. "
90  "1: RECOVERABLE skips to next event, FAILURE terminates job "
91  "(DEFAULT). 2: RECOVERABLE and FAILURE skip to next events");
92  declareProperty("EventPrintoutInterval", m_eventPrintoutInterval=1,
93  "Print event heartbeat printouts every m_eventPrintoutInterval events");
94  declareProperty("IntervalInSeconds", m_intervalInSeconds = 0,
95  "heartbeat time interval is seconds rather than events"
96  "you also get a nice event rate printout then");
97  declareProperty("DoLiteLoop",m_liteLoop=false,"Runs the bare minimum during executeEvent");
98  declareProperty("UseDetailChronoStat",m_doChrono=false);
99  declareProperty("ClearStorePolicy",
100  m_clearStorePolicy = "EndEvent",
101  "Configure the policy wrt handling of when the "
102  "'clear-the-event-store' event shall happen: at EndEvent "
103  "(default as it is makes things easier for memory management"
104  ") or at BeginEvent (easier e.g. for interactive use)");
105  declareProperty("PreSelectTools",m_tools,"AlgTools for event pre-selection")->
106  declareUpdateHandler( &AthenaEventLoopMgr::setupPreSelectTools, this );
107  declareProperty("RequireInputAttributeList", m_requireInputAttributeList = false,
108  "Require valid input attribute list to be present");
109  declareProperty("UseSecondaryEventNumber", m_useSecondaryEventNumber = false,
110  "In case of DoubleEventSelector use event number from secondary input");
111  declareProperty("EvtIdModifierSvc", m_evtIdModSvc,
112  "ServiceHandle for EvtIdModifierSvc");
113  declareProperty("ExecAtPreFork", m_execAtPreFork,
114  "List of algorithms/sequences to execute during PreFork");
115 }
116 
117 //=========================================================================
118 // Standard Destructor
119 //=========================================================================
121 {
122 }
123 
124 //=========================================================================
125 // implementation of IAppMgrUI::initalize
126 //=========================================================================
128 {
129  ATH_MSG_INFO ( "Initializing " << name() ) ;
130 
131  m_autoRetrieveTools = false;
132  m_checkToolDeps = false;
133 
135  if ( !sc.isSuccess() )
136  {
137  ATH_MSG_ERROR ( "Failed to initialize base class MinimalEventLoopMgr" );
138  return sc;
139  }
140 
141 //-------------------------------------------------------------------------
142 // Setup access to event data services
143 //-------------------------------------------------------------------------
144 
145  sc = m_eventStore.retrieve();
146  if( !sc.isSuccess() )
147  {
148  ATH_MSG_FATAL ( "Error retrieving pointer to StoreGateSvc" );
149  return sc;
150  }
151 
152 //--------------------------------------------------------------------------
153 // Get the references to the services that are needed by the ApplicationMgr
154 // itself
155 //--------------------------------------------------------------------------
156  sc = m_incidentSvc.retrieve();
157  if( !sc.isSuccess() )
158  {
159  ATH_MSG_FATAL ( "Error retrieving IncidentSvc." );
160  return sc;
161  }
162 
163 //--------------------------------------------------------------------------
164 // Access Property Manager interface:
165 //--------------------------------------------------------------------------
166  SmartIF<IProperty> prpMgr(serviceLocator());
167  if ( !prpMgr.isValid() )
168  {
169  ATH_MSG_FATAL ( "IProperty interface not found in ApplicationMgr." );
170  return StatusCode::FAILURE;
171  }
172 
173 
174 //--------------------------------------------------------------------------
175 // Set up the Histogram Service
176 //--------------------------------------------------------------------------
177  sc = m_histoDataMgrSvc.retrieve();
178  if( !sc.isSuccess() )
179  {
180  ATH_MSG_FATAL ( "Error retrieving HistogramDataSvc" );
181  return sc;
182  }
183 
184  const std::string& histPersName(m_histPersName.value());
185  if ( histPersName.length() == 0 )
186  {
187  CHECK(setProperty(prpMgr->getProperty("HistogramPersistency")));
188  }
189 
190  if ( histPersName != "NONE" ) {
191 
192  m_histoPersSvc = IConversionSvc_t( "HistogramPersistencySvc",
193  this->name() );
194 
195  if( !sc.isSuccess() ) {
196  ATH_MSG_WARNING ( "Histograms cannot not be saved - though required." );
197  } else {
198 
199  SmartIF<IProperty> histSvc;
200  if (histPersName == "ROOT") {
201  histSvc = serviceLocator()->service("RootHistSvc");
202  } else if ( histPersName == "HBOOK" ) {
203  histSvc = serviceLocator()->service("HbookHistSvc");
204  }
205 
206  if (!histSvc) {
207  ATH_MSG_ERROR ( "could not locate actual Histogram persistency service" );
208  } else {
209  const Gaudi::Details::PropertyBase &prop = histSvc->getProperty("OutputFile");
210  std::string val;
211  try {
212  const StringProperty &sprop = dynamic_cast<const StringProperty&>( prop );
213 
214  val = sprop.value();
215 
216  } catch (...) {
217  ATH_MSG_VERBOSE ( "could not dcast OutputFile property to a StringProperty."
218  << " Need to fix Gaudi." );
219 
220  val = prop.toString();
221 
222  }
223 
224  if (val != "" &&
225  val != "UndefinedROOTOutputFileName" &&
226  val != "UndefinedHbookOutputFileName" ) {
227  m_writeHists = true;
228  }
229  }
230  }
231 
232  } else {
233  ATH_MSG_DEBUG ( "Histograms saving not required." );
234  }
235 
236 //--------------------------------------------------------------------------
237 // Set up the EventID modifier Service
238 //--------------------------------------------------------------------------
239  if( m_evtIdModSvc.empty() ) {
240  ATH_MSG_DEBUG ( "EventID modifier Service not set. No run number, ... overrides will be applied." );
241  }
242  else if ( !m_evtIdModSvc.retrieve().isSuccess() ) {
243  ATH_MSG_INFO ( "Could not find EventID modifier Service. No run number, ... overrides will be applied." );
244  }
245 
246 //-------------------------------------------------------------------------
247 // Setup EventSelector service
248 //-------------------------------------------------------------------------
249  const std::string& selName(m_evtsel.value());
250  // the evt sel is usually specified as a property of ApplicationMgr
251  if (selName.empty())
252  sc = setProperty(prpMgr->getProperty("EvtSel"));
253  if (sc.isFailure()) ATH_MSG_WARNING ( "Unable to set EvtSel property" );
254 
255  // We do not expect a Event Selector necessarily being declared
256  if( !selName.empty() && selName != "NONE") {
257  SmartIF<IEvtSelector> theEvtSel{serviceLocator()->service( selName )};
258  if( theEvtSel && ( theEvtSel != m_evtSelector ) ) {
259  // Event Selector changed (or setup for the first time)
260  m_evtSelector = theEvtSel;
261 
262  // reset iterator
263  if (m_evtSelector->createContext(m_evtSelCtxt).isFailure()) {
264  ATH_MSG_FATAL ( "Can not create the event selector Context."
265  );
266  return StatusCode::FAILURE;
267  }
268  if (msgLevel(MSG::INFO)) {
269  SmartIF<INamedInterface> named(theEvtSel);
270  if (named) {
271  ATH_MSG_INFO ( "Setup EventSelector service " << named->name( )
272  );
273  }
274  }
275  } else if (sc.isFailure()) {
276  ATH_MSG_FATAL ( "No valid event selector called " << selName
277  );
278  return StatusCode::FAILURE;
279  }
280  }
281 
282 //-------------------------------------------------------------------------
283 // Setup 'Clear-Store' policy
284 //-------------------------------------------------------------------------
285  try {
287  } catch(...) {
288  return StatusCode::FAILURE;
289  }
290 
291  // Get the AlgExecStateSvc
292  m_aess = serviceLocator()->service("AlgExecStateSvc");
293  if( !m_aess.isValid() ) {
294  ATH_MSG_FATAL ( "Error retrieving AlgExecStateSvc" );
295  return StatusCode::FAILURE;
296  }
297 
298  // Listen to the BeforeFork incident
299  m_incidentSvc->addListener(this,"BeforeFork",0);
300 
301  CHECK( m_conditionsCleaner.retrieve() );
302 
303  // Print if we override the event number using the one from secondary event
305  {
306  ATH_MSG_INFO ( "Using secondary event number." );
307  }
308 
309  return sc;
310 }
311 
312 //=========================================================================
313 // property handlers
314 //=========================================================================
315 void
316 AthenaEventLoopMgr::setClearStorePolicy(Gaudi::Details::PropertyBase&) {
317  const std::string& policyName = m_clearStorePolicy.value();
318 
319  if ( policyName != "BeginEvent" &&
320  policyName != "EndEvent" ) {
321 
322  ATH_MSG_FATAL ( "Unknown policy [" << policyName
323  << "] for the 'ClearStore-policy !"
324  << endmsg
325  << "Valid values are: BeginEvent, EndEvent"
326  );
327  throw GaudiException("Can not setup 'ClearStore'-policy",
328  name(),
329  StatusCode::FAILURE);
330  }
331 
332  return;
333 }
334 
335 void
336 AthenaEventLoopMgr::setupPreSelectTools(Gaudi::Details::PropertyBase&) {
337 
338  m_toolInvoke.clear();
339  m_toolReject.clear();
340  m_toolAccept.clear();
341 
342  m_tools.retrieve().ignore();
343  if(m_tools.size() > 0) {
344  m_useTools=true;
345  m_toolInvoke.resize(m_tools.size());
346  m_toolReject.resize(m_tools.size());
347  m_toolAccept.resize(m_tools.size());
348 
349  tool_iterator firstTool = m_tools.begin();
350  tool_iterator lastTool = m_tools.end();
351  unsigned int toolCtr = 0;
352  for ( ; firstTool != lastTool; ++firstTool )
353  {
354  // reset statistics
355  m_toolInvoke[toolCtr] = 0;
356  m_toolReject[toolCtr] = 0;
357  m_toolAccept[toolCtr] = 0;
358  toolCtr++;
359  }
360  }
361 
362  return;
363 
364 }
365 
366 //=========================================================================
367 // implementation of IAppMgrUI::finalize
368 //=========================================================================
370 {
371 
373  if (sc.isFailure()) {
374  ATH_MSG_ERROR ( "Error in Algorithm Finalize" );
375  }
376 
377  StatusCode sc2 = writeHistograms(true);
378  if (sc2.isFailure()) {
379  ATH_MSG_ERROR ( "Error in writing Histograms" );
380  }
381 
382  // Release all interfaces (ignore StatusCodes)
383  m_histoDataMgrSvc.release().ignore();
384  m_histoPersSvc.release().ignore();
385 
386  if (m_evtSelector) m_evtSelector->release();
387  m_incidentSvc.release().ignore();
388 
389  delete m_evtSelCtxt; m_evtSelCtxt = nullptr;
390 
391  if(m_useTools) {
392  tool_iterator firstTool = m_tools.begin();
393  tool_iterator lastTool = m_tools.end();
394  unsigned int toolCtr = 0;
395  ATH_MSG_INFO ( "Summary of AthenaEvtLoopPreSelectTool invocation: (invoked/success/failure)" );
396  ATH_MSG_INFO ( "-----------------------------------------------------" );
397 
398  for ( ; firstTool != lastTool; ++firstTool ) {
399  ATH_MSG_INFO ( std::setw(2) << std::setiosflags(std::ios_base::right)
400  << toolCtr+1 << ".) " << std::resetiosflags(std::ios_base::right)
401  << std::setw(48) << std::setfill('.')
402  << std::setiosflags(std::ios_base::left)
403  << (*firstTool)->name() << std::resetiosflags(std::ios_base::left)
404  << std::setfill(' ')
405  << " ("
406  << std::setw(6) << std::setiosflags(std::ios_base::right)
407  << m_toolInvoke[toolCtr]
408  << "/"
409  << m_toolAccept[toolCtr]
410  << "/"
411  << m_toolReject[toolCtr]
412  << ")"
413  );
414  toolCtr++;
415  }
416  }
417  return ( sc.isFailure() || sc2.isFailure() ) ? StatusCode::FAILURE :
418  StatusCode::SUCCESS;
419 
420 }
421 
422 //=========================================================================
423 // write out the histograms
424 //=========================================================================
426 
427  StatusCode sc (StatusCode::SUCCESS);
428 
429  if ( 0 != m_histoPersSvc && m_writeHists ) {
430  std::vector<DataObject*> objects;
431  sc = m_histoDataMgrSvc->traverseTree( [&objects]( IRegistry* reg, int ) {
432  DataObject* obj = reg->object();
433  if ( !obj || obj->clID() == CLID_StatisticsFile ) return false;
434  objects.push_back( obj );
435  return true;
436  } );
437 
438  if ( !sc.isSuccess() ) {
439  ATH_MSG_ERROR ( "Error while traversing Histogram data store" );
440  return sc;
441  }
442 
443  if ( objects.size() > 0) {
444  int writeInterval(m_writeInterval.value());
445 
446  if ( m_nevt == 1 || force ||
447  (writeInterval != 0 && m_nevt%writeInterval == 0) ) {
448 
449  // skip /stat entry!
450  sc = std::accumulate( begin( objects ), end( objects ), sc, [&]( StatusCode isc, auto& i ) {
451  IOpaqueAddress* pAddr = nullptr;
452  StatusCode iret = m_histoPersSvc->createRep( i, pAddr );
453  if ( iret.isFailure() ) return iret;
454  i->registry()->setAddress( pAddr );
455  return isc;
456  } );
457  sc = std::accumulate( begin( objects ), end( objects ), sc, [&]( StatusCode isc, auto& i ) {
458  IRegistry* reg = i->registry();
459  StatusCode iret = m_histoPersSvc->fillRepRefs( reg->address(), i );
460  return iret.isFailure() ? iret : isc;
461  } );
462  if ( ! sc.isSuccess() ) {
463  ATH_MSG_ERROR ( "Error while saving Histograms." );
464  }
465  }
466 
467  if (force || (writeInterval != 0 && m_nevt%writeInterval == 0) ) {
468  ATH_MSG_DEBUG ( "committing Histograms" );
469  m_histoPersSvc->conversionSvc()->commitOutput("",true).ignore();
470  }
471  }
472 
473  }
474 
475  return sc;
476 }
477 
478 //=========================================================================
479 // Call sysInitialize() on all algorithms and output streams
480 //=========================================================================
482 
483  // Initialize the list of Algorithms. Note that existing Algorithms
484  // are protected against multiple initialization attempts.
485  ListAlg::iterator ita;
486  for ( ita = m_topAlgList.begin(); ita != m_topAlgList.end(); ++ita )
487  {
488  StatusCode sc = (*ita)->sysInitialize();
489  if( sc.isFailure() )
490  {
491  ATH_MSG_ERROR ( "Unable to initialize Algorithm: "
492  << (*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: "
504  << (*ita)->name() );
505  return sc;
506  }
507 
508  }
509 
510  return StatusCode::SUCCESS;
511 }
512 
513 //=========================================================================
514 // Run the algorithms for the current event
515 //=========================================================================
517 
518  // Call the execute() method of all top algorithms
519  for ( ListAlg::iterator ita = m_topAlgList.begin();
520  ita != m_topAlgList.end();
521  ++ita )
522  {
523  const StatusCode& sc = (*ita)->sysExecute(ctx);
524  // this duplicates what is already done in Algorithm::sysExecute, which
525  // calls Algorithm::setExecuted, but eventually we plan to remove that
526  // function
527  m_aess->algExecState(*ita,ctx).setState(AlgExecState::State::Done, sc);
528  if ( !sc.isSuccess() ) {
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 //=========================================================================
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));
548  m_incidentSvc->fireIncident(Incident("EndEvent",IncidentType::EndEvent));
549  ++m_proc;
550  ++m_nev;
551  return sc;
552  }
553 
554  CHECK( installEventContext(ctx) );
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())) ||
593  if (doEvtHeartbeat) {
594  if(!m_useTools) {
595  ATH_MSG_INFO ( " ===>>> start processing event #" << evtNumber << ", run #" << m_currentRun << " " << m_nev << " events processed so far <<<===" );
596  if(m_intervalInSeconds) {
597  ATH_MSG_INFO(" ===>>> Event processing rate = " << double(m_nev-m_lastNev)/(time(nullptr)-m_lastTime) << " Hz <<<===");
598  m_lastNev = m_nev; m_lastTime = time(nullptr);
599  }
600  }
601 
602  else ATH_MSG_INFO ( " ===>>> start processing event #" << evtNumber << ", run #" << m_currentRun
603  << " " << m_nev << " events read and " << m_proc
604  << " events processed so far <<<===" );
605  }
606 
607  // Reset the timeout singleton
609  if(toolsPassed) {
610  // Fire BeginEvent "Incident"
611  //m_incidentSvc->fireIncident(Incident(*pEvent, name(),"BeginEvent"));
612 
613  // An incident may schedule a stop, in which case is better to exit before the actual execution.
614  if ( m_scheduledStop ) {
615  ATH_MSG_ALWAYS ( "A stopRun was requested by an incidentListener. "
616  << "Do not process this event." );
617  return (StatusCode::SUCCESS);
618  }
619 
620  CHECK( m_conditionsCleaner->event (ctx, false) );
621 
622  // Call the execute() method of all top algorithms
624 
625  if(!sc.isSuccess()) {
626  eventFailed = true;
627  m_aess->setEventStatus( EventStatus::AlgFail, ctx );
628 
632  if (m_failureMode == 1 && sc.isRecoverable() ) {
633  ATH_MSG_WARNING ( "RECOVERABLE error returned by algorithm. "
634  << "Skipping remaining algorithms." << std::endl
635  << "\tNo output will be written for this event, "
636  << "but job will continue to next event" );
637  eventFailed = false;
638  }
639 
641  if (m_failureMode >= 2) {
642  ATH_MSG_INFO ( "Skipping remaining algorithms." << std::endl
643  << "\tNo output will be written for this event, "
644  << "but job will continue to next event" );
645  eventFailed = false;
646  }
647 
648  } else {
649 
650  m_aess->setEventStatus( EventStatus::Success, ctx );
651 
652  // Call the execute() method of all output streams
653  for (ListAlg::iterator ito = m_outStreamList.begin();
654  ito != m_outStreamList.end(); ++ito ) {
655  sc = (*ito)->sysExecute(ctx);
656  if( !sc.isSuccess() ) {
657  eventFailed = true;
658  }
659  }
660 
661  writeHistograms().ignore();
662 
663  }
664 
665  // Fire EndEvent "Incident"
666  //m_incidentSvc->fireIncident(Incident(*pEvent, name(),"EndEvent"));
667  ++m_proc;
668  } // end of toolsPassed test
669  ++m_nev;
670  if (doEvtHeartbeat) {
671  if(!m_intervalInSeconds) {
672  if (!m_useTools)
673  ATH_MSG_INFO(" ===>>> done processing event #" << evtNumber << ", run #" << m_currentRun
674  << " " << m_nev << " events processed so far <<<===");
675  else
676  ATH_MSG_INFO(" ===>>> done processing event #" << evtNumber << ", run #" << m_currentRun
677  << " " << m_nev << " events read and " << m_proc
678  << " events processed so far <<<===");
679  }
680  std::ofstream outfile( "eventLoopHeartBeat.txt");
681  if ( !outfile ) {
682  ATH_MSG_ERROR ( " unable to open: eventLoopHeartBeat.txt" );
683  } else {
684  outfile << " done processing event #" << evtNumber << ", run #" << m_currentRun
685  << " " << m_nev << " events read so far <<<===" << std::endl;
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 //=========================================================================
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 //=========================================================================
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 
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 = 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 = eventStore()->recordAddress(addr);
800  if( !sc.isSuccess() ) {
801  ATH_MSG_WARNING ( "Error declaring Event object" );
802  continue;
803  }
804  }
805  if ((sc=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 = 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 //=========================================================================
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 //=========================================================================
885 // Return the collection size
886 //=========================================================================
888 {
889  IEvtSelectorSeek* cs = dynamic_cast<IEvtSelectorSeek*> (m_evtSelector);
890  if (cs == nullptr) {
891  ATH_MSG_ERROR ( "Collection size unsupported by event selector" );
892  return -1;
893  }
894  //cppcheck-suppress nullPointerRedundantCheck
895  if (!m_evtSelCtxt) {
896  if (m_evtSelector->createContext(m_evtSelCtxt).isFailure()) {
897  ATH_MSG_FATAL ( "Can not create the event selector Context." );
898  return -1;
899  }
900  }
901  //m_evtSelCtxt cannot be null if createContext succeeded
902  //cppcheck-suppress nullPointerRedundantCheck
903  return cs->size (*m_evtSelCtxt);
904 }
905 
906 //=========================================================================
907 // Handle incidents
908 //=========================================================================
909 void AthenaEventLoopMgr::handle(const Incident& inc)
910 {
911  if(inc.type()!="BeforeFork")
912  return;
913 
914  if(!m_firstRun) {
915  ATH_MSG_WARNING ( "Skipping BeforeFork handler. Begin run has already passed" );
916  return;
917  }
918 
919  // Initialize Algorithms and Output Streams
921  if(sc.isFailure()) {
922  ATH_MSG_ERROR ( "Failed to initialize Algorithms" );
923  return;
924  }
925 
926  if(!m_evtSelCtxt) {
927  ATH_MSG_WARNING ( "Skipping BeforeFork handler. No event selector is provided" );
928  return;
929  }
930 
931  // Construct EventInfo
932  IOpaqueAddress* addr = nullptr;
933  sc = m_evtSelector->next(*m_evtSelCtxt);
934  if(!sc.isSuccess()) {
935  ATH_MSG_INFO ( "No more events in event selection " );
936  return;
937  }
938  sc = m_evtSelector->createAddress(*m_evtSelCtxt, addr);
939  if (sc.isFailure()) {
940  ATH_MSG_ERROR ( "Could not create an IOpaqueAddress" );
941  return;
942  }
943  if (nullptr != addr) {
944  //create its proxy
945  sc = eventStore()->recordAddress(addr);
946  if(!sc.isSuccess()) {
947  ATH_MSG_ERROR ( "Error declaring Event object" );
948  return;
949  }
950  }
951 
952  if(eventStore()->loadEventProxies().isFailure()) {
953  ATH_MSG_WARNING ( "Error loading Event proxies" );
954  return;
955  }
956 
957  // Need to make sure we have a valid EventContext in place before
958  // doing anything that could fire incidents.
959  EventContext ctx;
960  // In the case of the BeginRun incident, we just want to take the
961  // next IoV from the list in the EvtIdModifierSvc, but leave it to
962  // be used for the next executeEvent call. TODO CHECK
963  if( installEventContext(ctx).isFailure() ) {
964  throw std::runtime_error( "Error installing event context object" );
965  }
966 
967  m_incidentSvc->fireIncident(Incident(name(),IncidentType::BeginRun,ctx));
968  m_firstRun=false;
969  m_currentRun = ctx.eventID().run_number();
970 
971  // Execute requested algorithms/sequences
972  if ( execAtPreFork(ctx).isFailure() ) {
973  ATH_MSG_ERROR ( "Unable to execute requested algorithms/sequences during PreFork!" );
974  return;
975  }
976 
977  // Clear Store
978  const ClearStorePolicy::Type s_clearStore = clearStorePolicy( m_clearStorePolicy.value(), msgStream() );
979  if(s_clearStore==ClearStorePolicy::EndEvent) {
980  sc = eventStore()->clearStore();
981  if(!sc.isSuccess()) {
982  ATH_MSG_ERROR ( "Clear of Event data store failed" );
983  }
984  }
985 }
986 
987 //=========================================================================
988 // Execute certain algorithms/sequence in PreFork
989 //=========================================================================
990 StatusCode AthenaEventLoopMgr::execAtPreFork(const EventContext& ctx) const {
991  IAlgManager* algMgr = Gaudi::svcLocator()->as<IAlgManager>();
992 
993  StatusCode sc;
994  for (const std::string& name : m_execAtPreFork) {
995  SmartIF<IAlgorithm>& alg = algMgr->algorithm(name, /*createIf*/false);
996  if ( alg ) {
997  ATH_MSG_INFO("Executing " << alg->name() << "...");
998  sc &= alg->sysExecute(ctx);
999  }
1000  else ATH_MSG_WARNING("Cannot find algorithm or sequence " << name);
1001  }
1002  return sc;
1003 }
1004 
1005 
1006 StoreGateSvc*
1008  return m_eventStore.get();
1009 }
1010 
1011 
1012 //=========================================================================
1013 // Fill in our EventContext object and make it current.
1014 //=========================================================================
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  if (m_evtSelCtxt) { // Deal with the case when an EventSelector is provided
1023  // First try to build a legacy EventInfo object from the TAG information
1024  // Read the attribute list
1025  const AthenaAttributeList* pAttrList =
1027  if (pAttrList != nullptr && pAttrList->size() > 6) {
1028  // Try making EventID-only EventInfo object from in-file TAG
1029  try {
1030  unsigned int runNumber = (*pAttrList)["RunNumber"].data<unsigned int>();
1031  unsigned long long eventNumber = (*pAttrList)["EventNumber"].data<unsigned long long>();
1032  unsigned int eventTime = (*pAttrList)["EventTime"].data<unsigned int>();
1033  unsigned int eventTimeNS = (*pAttrList)["EventTimeNanoSec"].data<unsigned int>();
1034  unsigned int lumiBlock = (*pAttrList)["LumiBlockN"].data<unsigned int>();
1035  unsigned int bunchId = (*pAttrList)["BunchId"].data<unsigned int>();
1036 
1037  ATH_MSG_DEBUG("use TAG with runNumber=" << runNumber);
1038  consume_modifier_stream = true;
1039  // an option to override primary eventNumber with the secondary one in
1040  // case of DoubleEventSelector
1042  unsigned long long eventNumberSecondary{};
1043  if (!(pAttrList->exists("hasSecondaryInput") &&
1044  (*pAttrList)["hasSecondaryInput"].data<bool>())) {
1045  ATH_MSG_FATAL("Secondary EventNumber requested, but secondary input does not exist!");
1046  return StatusCode::FAILURE;
1047  }
1048  if (pAttrList->exists("EventNumber_secondary")) {
1049  eventNumberSecondary = (*pAttrList)["EventNumber_secondary"].data<unsigned long long>();
1050  } else {
1051  // try legacy EventInfo if secondary input did not have attribute
1052  // list primary input should not have this EventInfo type
1053  const EventInfo* pEventSecondary = eventStore()->tryConstRetrieve<EventInfo>();
1054  if (pEventSecondary) {
1055  eventNumberSecondary = pEventSecondary->event_ID()->event_number();
1056  } else {
1057  ATH_MSG_FATAL("Secondary EventNumber requested, but it does not exist!");
1058  return StatusCode::FAILURE;
1059  }
1060  }
1061  if (eventNumberSecondary != 0) {
1062  bool doEvtHeartbeat(m_eventPrintoutInterval.value() > 0 &&
1063  0 == (m_nev % m_eventPrintoutInterval.value()));
1064  if (doEvtHeartbeat) {
1065  ATH_MSG_INFO(" ===>>> using secondary event #"
1066  << eventNumberSecondary << " instead of #"
1067  << eventNumber << " <<<===");
1068  }
1069  eventNumber = eventNumberSecondary;
1070  }
1071  }
1072 
1073  eventInfo = std::make_unique<EventInfo>(
1074  std::make_unique<EventID>(runNumber, eventNumber, eventTime,
1075  eventTimeNS, lumiBlock, bunchId),
1076  nullptr);
1077  eventID = *(eventInfo->event_ID());
1078 
1079  if (!m_evtIdModSvc.isSet() && pAttrList->exists("ConditionsRun")) {
1080  conditionsRun = (*pAttrList)["ConditionsRun"].data<unsigned int>();
1081  } else {
1082  conditionsRun = runNumber;
1083  }
1084 
1085  } catch (...) {
1086  }
1087  /* FIXME: PvG, not currently written
1088  if( pEvent != 0 && pAttrList->size() > 7 ) {
1089  // Try adding EventType information
1090  try {
1091  float eventWeight = (*pAttrList)["EventWeight"].data<float>();
1092  const EventType* pType = new EventType(); pEvent->setEventType(pType);
1093  pEvent->event_type()->set_mc_event_weight(eventWeight);
1094  } catch (...) {
1095  pEvent->setEventType(0);
1096  }
1097  }
1098  */
1099  } else if (m_requireInputAttributeList) {
1100  ATH_MSG_FATAL("Valid input attribute list required but not present!");
1101  return StatusCode::FAILURE;
1102  }
1103  // In the case that there is no TAG information
1104  if( !eventInfo ) {
1105  // Secondly try to retrieve a legacy EventInfo object from the input file
1106  // m_nevt - 1 because it's incremented early
1108  const EventInfo* pei = eventStore()->tryConstRetrieve<EventInfo>();
1109  if( pei ) {
1110  eventID = *(pei->event_ID());
1111  } else {
1112  // Finally try to retrieve an xAOD::EventInfo object from the
1113  // input file and build a legacy EventInfo object from that.
1115  if (xAODEvent == nullptr) {
1116  ATH_MSG_ERROR("Failed to get EventID from input. Tried old-style and xAOD::EventInfo");
1117  return StatusCode::FAILURE;
1118  }
1119  ATH_MSG_DEBUG("use xAOD::EventInfo with runNumber=" << xAODEvent->runNumber());
1120  // Record the old-style object for those clients that still need it
1121  eventInfo = std::make_unique<EventInfo>(
1122  std::make_unique<EventID>(eventIDFromxAOD(xAODEvent)),
1123  std::make_unique<EventType>(eventTypeFromxAOD(xAODEvent)));
1124  eventID = *(eventInfo->event_ID());
1125  StatusCode sc = eventStore()->record(std::move(eventInfo), "");
1126  if (!sc.isSuccess()) {
1127  ATH_MSG_ERROR("Error declaring event data object");
1128  return StatusCode::FAILURE;
1129  }
1130  }
1131  }
1132  } else {
1133  // No EventSelector is provided, so with no iterator it's up to us
1134  // to create an EventInfo
1135  eventInfo = std::make_unique<EventInfo>(
1136  std::make_unique<EventID>(1, m_nevt, 0), std::make_unique<EventType>());
1137  eventInfo->event_ID()->set_lumi_block(m_nevt);
1138  eventID = *(eventInfo->event_ID());
1139  StatusCode sc = eventStore()->record(std::move(eventInfo), "");
1140  if (!sc.isSuccess()) {
1141  ATH_MSG_ERROR("Error declaring event data object");
1142  return (StatusCode::FAILURE);
1143  }
1144  }
1145 
1146  ctx.setEventID( eventID );
1147  ctx.set(m_nev,0);
1149  Atlas::ExtendedEventContext( eventStore()->hiveProxyDict(),
1150  conditionsRun) );
1151  modifyEventContext(ctx, eventID, consume_modifier_stream);
1152  Gaudi::Hive::setCurrentContext( ctx );
1153 
1154  m_aess->reset( ctx );
1155  if (eventStore()->record(std::make_unique<EventContext> ( ctx ),
1156  "EventContext").isFailure())
1157  {
1158  ATH_MSG_ERROR ( "Error recording event context object" );
1159  return (StatusCode::FAILURE);
1160  }
1161 
1162  return StatusCode::SUCCESS;
1163 }
1164 
1165 //---------------------------------------------------------------------------
1166 
1167 void AthenaEventLoopMgr::modifyEventContext(EventContext& ctx, const EventID& eID, bool consume_modifier_stream) {
1168  if (m_evtIdModSvc.isSet()) {
1169  EventID new_eID(eID);
1170  // m_nevt - 1 because it's incremented early
1171  m_evtIdModSvc->modify_evtid(new_eID, m_nevt - 1, consume_modifier_stream);
1172  if (msgLevel(MSG::DEBUG)) {
1173  unsigned int oldrunnr=eID.run_number();
1174  unsigned int oldLB=eID.lumi_block();
1175  unsigned int oldTS=eID.time_stamp();
1176  unsigned int oldTSno=eID.time_stamp_ns_offset();
1177  ATH_MSG_DEBUG ( "modifyEventContext: use evtIdModSvc runnr=" << oldrunnr << " -> " << new_eID.run_number() );
1178  ATH_MSG_DEBUG ( "modifyEventContext: use evtIdModSvc LB=" << oldLB << " -> " << new_eID.lumi_block() );
1179  ATH_MSG_DEBUG ( "modifyEventContext: use evtIdModSvc TimeStamp=" << oldTS << " -> " << new_eID.time_stamp() );
1180  ATH_MSG_DEBUG ( "modifyEventContext: use evtIdModSvc TimeStamp ns Offset=" << oldTSno << " -> " << new_eID.time_stamp_ns_offset() );
1181  }
1182  ctx.setEventID( new_eID );
1183  Atlas::getExtendedEventContext(ctx).setConditionsRun( ctx.eventID().run_number() );
1184  return;
1185  }
1186 
1187  ctx.setEventID( eID );
1188 }
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
StoreGateSvc::record
StatusCode record(T *p2BRegistered, const TKEY &key)
Record an object with a key.
AthenaEventLoopMgr::m_lastTime
time_t m_lastTime
Definition: AthenaEventLoopMgr.h:208
AthenaEventLoopMgr::curEvent
virtual int curEvent() const
Return the current event count.
Definition: AthenaEventLoopMgr.cxx:879
AthenaEventLoopMgr::size
virtual int size()
Return the size of the collection.
Definition: AthenaEventLoopMgr.cxx:887
AthenaEventLoopMgr::m_evtIdModSvc
IEvtIdModifierSvc_t m_evtIdModSvc
Definition: AthenaEventLoopMgr.h:93
ClearStorePolicy::EndEvent
@ EndEvent
Definition: ClearStorePolicy.h:15
python.tests.PyTestsLib.finalize
def finalize(self)
_info( "content of StoreGate..." ) self.sg.dump()
Definition: PyTestsLib.py:50
AthenaEventLoopMgr::m_toolAccept
tool_stats m_toolAccept
tool returns StatusCode::SUCCESS counter
Definition: AthenaEventLoopMgr.h:121
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
AthenaEventLoopMgr::m_tools
tool_store m_tools
internal tool store
Definition: AthenaEventLoopMgr.h:122
SGout2dot.alg
alg
Definition: SGout2dot.py:243
LArConditions2Ntuple.objects
objects
Definition: LArConditions2Ntuple.py:63
AthenaEventLoopMgr::m_evtSelCtxt
IEvtSelector::Context * m_evtSelCtxt
Gaudi EventSelector Context (may be used as a cursor by the evt selector)
Definition: AthenaEventLoopMgr.h:79
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
AthMsgStreamMacros.h
calibdata.force
bool force
Definition: calibdata.py:19
IEventSeek.h
Abstract interface for seeking within an event stream.
ExtendedEventContext.h
AthenaEventLoopMgr::eventStore
StoreGateSvc * eventStore() const
Definition: AthenaEventLoopMgr.cxx:1007
AthenaEventLoopMgr::name
virtual const std::string & name() const
Definition: AthenaEventLoopMgr.h:185
initialize
void initialize()
Definition: run_EoverP.cxx:894
AthenaEventLoopMgr::initialize
virtual StatusCode initialize()
implementation of IAppMgrUI::initalize
Definition: AthenaEventLoopMgr.cxx:127
AthenaEventLoopMgr::m_conditionsCleaner
ServiceHandle< Athena::IConditionsCleanerSvc > m_conditionsCleaner
Definition: AthenaEventLoopMgr.h:216
accumulate
bool accumulate(AccumulateMap &map, std::vector< module_t > const &modules, FPGATrackSimMatrixAccumulator const &acc)
Accumulates an accumulator (e.g.
Definition: FPGATrackSimMatrixAccumulator.cxx:22
AthenaEventLoopMgr.h
The default ATLAS batch event loop manager.
AthenaEventLoopMgr::m_histPersName
StringProperty m_histPersName
Definition: AthenaEventLoopMgr.h:99
EventInfoAuxContainer.h
PlotCalibFromCool.begin
begin
Definition: PlotCalibFromCool.py:94
AthenaEventLoopMgr::m_proc
unsigned int m_proc
Definition: AthenaEventLoopMgr.h:203
clearStorePolicy
ClearStorePolicy::Type clearStorePolicy(const std::string &policyName, MsgStream &msg)
returns the enum-version of the policy (by name)
Definition: ClearStorePolicy.cxx:7
AthenaEventLoopMgr::executeRun
virtual StatusCode executeRun(int maxevt)
implementation of IEventProcessor::executeRun(int maxevt)
Definition: AthenaEventLoopMgr.cxx:701
AthenaEventLoopMgr::m_evtSelector
IEvtSelector * m_evtSelector
Reference to the Event Selector.
Definition: AthenaEventLoopMgr.h:77
EventType.h
This class provides general information about an event. It extends EventInfo with a list of sub-evts ...
AthenaEventLoopMgr::m_failureMode
IntegerProperty m_failureMode
Definition: AthenaEventLoopMgr.h:107
LArG4FSStartPointFilter.evt
evt
Definition: LArG4FSStartPointFilter.py:42
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
AthenaEventLoopMgr::m_incidentSvc
IIncidentSvc_t m_incidentSvc
Reference to the incident service.
Definition: AthenaEventLoopMgr.h:70
EventContextClid.h
Assign a CLID to EventContext.
AthenaEventLoopMgr::m_eventStore
StoreGateSvc_t m_eventStore
Reference to StoreGateSvc;.
Definition: AthenaEventLoopMgr.h:74
xAOD::EventInfo_v1::runNumber
uint32_t runNumber() const
The current event's run number.
AthenaEventLoopMgr::m_writeInterval
IntegerProperty m_writeInterval
Definition: AthenaEventLoopMgr.h:198
AthenaEventLoopMgr::m_currentRun
number_type m_currentRun
current run number
Definition: AthenaEventLoopMgr.h:103
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
EventInfoContainer.h
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
AthenaEventLoopMgr::m_nev
unsigned int m_nev
events processed
Definition: AthenaEventLoopMgr.h:202
python.HLT.Jet.JetMenuSequencesConfig.selName
def selName(recoSequenceName, hypoType=JetHypoAlgType.STANDARD)
Definition: JetMenuSequencesConfig.py:136
AthenaEventLoopMgr::~AthenaEventLoopMgr
virtual ~AthenaEventLoopMgr()
Standard Destructor.
Definition: AthenaEventLoopMgr.cxx:120
AthenaEventLoopMgr::modifyEventContext
virtual void modifyEventContext(EventContext &ctx, const EventID &eID, bool consume_modifier_stream)
Definition: AthenaEventLoopMgr.cxx:1167
AthenaEventLoopMgr::installEventContext
StatusCode installEventContext(EventContext &ctx)
Definition: AthenaEventLoopMgr.cxx:1015
Atlas::getExtendedEventContext
const ExtendedEventContext & getExtendedEventContext(const EventContext &ctx)
Retrieve an extended context from a context object.
Definition: ExtendedEventContext.cxx:32
EventInfoFromxAOD.h
IEvtSelectorSeek::seek
virtual StatusCode seek(IEvtSelector::Context &c, int evtnum) const =0
Seek to a given event number.
AthenaEventLoopMgr::nextEvent
virtual StatusCode nextEvent(int maxevt)
implementation of IAppMgrUI::nextEvent. maxevt==0 returns immediately
Definition: AthenaEventLoopMgr.cxx:713
StoreGateSvc
The Athena Transient Store API.
Definition: StoreGateSvc.h:125
AthenaEventLoopMgr::initializeAlgorithms
StatusCode initializeAlgorithms()
Initialize all algorithms and output streams.
Definition: AthenaEventLoopMgr.cxx:481
EventID.h
This class provides a unique identification for each event, in terms of run/event number and/or a tim...
IEvtIdModifierSvc.h
AthenaEventLoopMgr::IConversionSvc_t
ServiceHandle< IConversionSvc > IConversionSvc_t
Definition: AthenaEventLoopMgr.h:87
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
AthenaEventLoopMgr::m_doChrono
bool m_doChrono
Definition: AthenaEventLoopMgr.h:214
AthenaEventLoopMgr::execAtPreFork
StatusCode execAtPreFork(const EventContext &ctx) const
Execute certain algorithms/sequences in PreFork.
Definition: AthenaEventLoopMgr.cxx:990
AthenaEventLoopMgr::handle
void handle(const Incident &inc)
IIncidentListenet interfaces.
Definition: AthenaEventLoopMgr.cxx:909
AthenaEventLoopMgr::m_requireInputAttributeList
bool m_requireInputAttributeList
require input attribute list
Definition: AthenaEventLoopMgr.h:125
lumiFormat.i
int i
Definition: lumiFormat.py:85
AthenaEventLoopMgr::m_histoPersSvc
IConversionSvc_t m_histoPersSvc
Definition: AthenaEventLoopMgr.h:89
Atlas::ExtendedEventContext
Definition: ExtendedEventContext.h:23
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
AthenaEventLoopMgr::m_aess
SmartIF< IAlgExecStateSvc > m_aess
Reference to the Algorithm Execution State Svc.
Definition: AthenaEventLoopMgr.h:153
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
EventInfo::event_ID
EventID * event_ID()
the unique identification of the event.
Definition: EventInfo/EventInfo/EventInfo.h:224
ClearStorePolicy::Type
Type
Definition: ClearStorePolicy.h:13
IEvtSelectorSeek::size
virtual int size(IEvtSelector::Context &c) const =0
Return the size of the collection, or -1 if we can't get the size.
AthenaEventLoopMgr::m_useTools
bool m_useTools
Definition: AthenaEventLoopMgr.h:204
IAthenaEvtLoopPreSelectTool.h
This file contains the class definition for the IAthenaEvtLoopPreSelectTool class.
AthenaEventLoopMgr::m_lastNev
unsigned int m_lastNev
Definition: AthenaEventLoopMgr.h:206
AthenaEventLoopMgr::seek
virtual StatusCode seek(int evt)
Seek to a given event.
Definition: AthenaEventLoopMgr.cxx:849
MuonSegmentReaderConfig.histSvc
histSvc
Definition: MuonSegmentReaderConfig.py:96
AthenaEventLoopMgr::m_execAtPreFork
StringArrayProperty m_execAtPreFork
Definition: AthenaEventLoopMgr.h:96
AthMessaging
Class to provide easy MsgStream access and capabilities.
Definition: AthMessaging.h:55
ATH_MSG_ALWAYS
#define ATH_MSG_ALWAYS(x)
Definition: AthMsgStreamMacros.h:35
xAOD::uint64_t
uint64_t
Definition: EventInfo_v1.cxx:123
AthenaEventLoopMgr::finalize
virtual StatusCode finalize()
implementation of IAppMgrUI::finalize
Definition: AthenaEventLoopMgr.cxx:369
AthenaAttributeList
An AttributeList represents a logical row of attributes in a metadata table. The name and type of eac...
Definition: PersistentDataModel/PersistentDataModel/AthenaAttributeList.h:45
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:422
AthenaEventLoopMgr::m_eventPrintoutInterval
UnsignedIntegerProperty m_eventPrintoutInterval
Definition: AthenaEventLoopMgr.h:110
xAOD::eventNumber
eventNumber
Definition: EventInfo_v1.cxx:124
StoreGateSvc::clearStore
virtual StatusCode clearStore(bool forceRemove=false) override final
clear DataStore contents: called by the event loop mgrs
Definition: StoreGateSvc.cxx:450
Athena::Timeout::instance
static Timeout & instance()
Get reference to Timeout singleton.
Definition: Timeout.h:64
AthenaEventLoopMgr::executeEvent
virtual StatusCode executeEvent(EventContext &&ctx)
implementation of IEventProcessor::executeEvent(EventContext&& ctx)
Definition: AthenaEventLoopMgr.cxx:542
AthenaEventLoopMgr::m_toolInvoke
tool_stats m_toolInvoke
tool called counter
Definition: AthenaEventLoopMgr.h:119
Atlas::ExtendedEventContext::setConditionsRun
void setConditionsRun(EventIDBase::number_type conditionsRun)
Definition: ExtendedEventContext.h:36
AthenaEventLoopMgr::m_toolReject
tool_stats m_toolReject
tool returns StatusCode::FAILURE counter
Definition: AthenaEventLoopMgr.h:120
AthenaEventLoopMgr::setupPreSelectTools
void setupPreSelectTools(Gaudi::Details::PropertyBase &)
property update handler:sets up the Pre-selection tools
Definition: AthenaEventLoopMgr.cxx:336
EventAuxInfo.h
AthenaEventLoopMgr::m_clearStorePolicy
StringProperty m_clearStorePolicy
Definition: AthenaEventLoopMgr.h:136
errorcheck.h
Helpers for checking error return status codes and reporting errors.
EventInfo
This class provides general information about an event. Event information is provided by the accessor...
Definition: EventInfo/EventInfo/EventInfo.h:43
AthenaEventLoopMgr::m_liteLoop
bool m_liteLoop
Definition: AthenaEventLoopMgr.h:210
AthenaEventLoopMgr::m_chronoStatSvc
ServiceHandle< IChronoStatSvc > m_chronoStatSvc
Definition: AthenaEventLoopMgr.h:215
StoreGateSvc::recordAddress
StatusCode recordAddress(const std::string &skey, IOpaqueAddress *pAddress, bool clearAddressFlag=true)
Create a proxy object using an IOpaqueAddress and a transient key.
StoreGateSvc::tryConstRetrieve
const T * tryConstRetrieve() const
AthenaAttributeList.h
An AttributeList represents a logical row of attributes in a metadata table. The name and type of eac...
EventInfo.h
xAOD::EventInfo_v1
Class describing the basic event information.
Definition: EventInfo_v1.h:43
AthenaEventLoopMgr::m_useSecondaryEventNumber
bool m_useSecondaryEventNumber
read event number from secondary input
Definition: AthenaEventLoopMgr.h:128
DeMoAtlasDataLoss.runNumber
string runNumber
Definition: DeMoAtlasDataLoss.py:64
AthenaEventLoopMgr::setClearStorePolicy
void setClearStorePolicy(Gaudi::Details::PropertyBase &clearStorePolicy)
property update handler:set the clear-store policy value and check its value.
Definition: AthenaEventLoopMgr.cxx:316
ClearStorePolicy::BeginEvent
@ BeginEvent
Definition: ClearStorePolicy.h:14
CaloSwCorrections.time
def time(flags, cells_name, *args, **kw)
Definition: CaloSwCorrections.py:242
AthenaEventLoopMgr::m_intervalInSeconds
unsigned int m_intervalInSeconds
Definition: AthenaEventLoopMgr.h:207
AthenaEventLoopMgr::m_firstRun
bool m_firstRun
Definition: AthenaEventLoopMgr.h:104
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
Pythia8_RapidityOrderMPI.val
val
Definition: Pythia8_RapidityOrderMPI.py:14
AthenaEventLoopMgr::m_writeHists
bool m_writeHists
Definition: AthenaEventLoopMgr.h:199
AthenaEventLoopMgr::m_evtsel
StringProperty m_evtsel
Definition: AthenaEventLoopMgr.h:81
DEBUG
#define DEBUG
Definition: page_access.h:11
eventIDFromxAOD
EventID eventIDFromxAOD(const xAOD::EventInfo *xaod)
Create EventID object from xAOD::EventInfo.
Definition: EventInfoFromxAOD.cxx:16
EventID
This class provides a unique identification for each event, in terms of run/event number and/or a tim...
Definition: EventID.h:35
AthenaEventLoopMgr::writeHistograms
virtual StatusCode writeHistograms(bool force=false)
Dump out histograms as needed.
Definition: AthenaEventLoopMgr.cxx:425
AthenaEventLoopMgr::tool_iterator
tool_store::const_iterator tool_iterator
Definition: AthenaEventLoopMgr.h:115
AthenaEventLoopMgr::AthenaEventLoopMgr
AthenaEventLoopMgr()
no implementation
ClearStorePolicy.h
AthenaEventLoopMgr::m_nevt
int m_nevt
Definition: AthenaEventLoopMgr.h:196
Athena::TimeoutMaster::resetTimeout
void resetTimeout(Timeout &instance)
Reset timeout.
Definition: Timeout.h:83
xAOD::lumiBlock
setTeId lumiBlock
Definition: L2StandAloneMuon_v1.cxx:327
python.PyAthena.obj
obj
Definition: PyAthena.py:132
eventTypeFromxAOD
EventType eventTypeFromxAOD(const xAOD::EventInfo *xaod)
Create EventType object from xAOD::EventInfo.
Definition: EventInfoFromxAOD.cxx:34
PrepareReferenceFile.outfile
outfile
Definition: PrepareReferenceFile.py:42
StoreGateSvc.h
AthenaEventLoopMgr::executeAlgorithms
virtual StatusCode executeAlgorithms(const EventContext &)
Run the algorithms for the current event.
Definition: AthenaEventLoopMgr.cxx:516
Atlas::setExtendedEventContext
void setExtendedEventContext(EventContext &ctx, ExtendedEventContext &&ectx)
Move an extended context into a context object.
Definition: ExtendedEventContext.cxx:50
AthenaEventLoopMgr::m_histoDataMgrSvc
IDataManagerSvc_t m_histoDataMgrSvc
Reference to the Histogram Data Service.
Definition: AthenaEventLoopMgr.h:85
IEvtSelectorSeek
Abstract interface for seeking for an event selector.
Definition: IEvtSelectorSeek.h:28
EventInfoCnvParams::eventIndex
thread_local event_number_t eventIndex
Definition: IEvtIdModifierSvc.h:34