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