|
ATLAS Offline Software
|
Go to the documentation of this file.
5 #ifndef TRIGSERVICES_HLTEVENTLOOPMGR_H
6 #define TRIGSERVICES_HLTEVENTLOOPMGR_H
32 #include "GaudiKernel/EventIDBase.h"
33 #include "GaudiKernel/IEventProcessor.h"
34 #include "GaudiKernel/IEvtSelector.h"
35 #include "GaudiKernel/IConversionSvc.h"
36 #include "GaudiKernel/IAlgResourcePool.h"
37 #include "GaudiKernel/IAlgExecStateSvc.h"
38 #include "GaudiKernel/IHiveWhiteBoard.h"
39 #include "GaudiKernel/IScheduler.h"
40 #include "GaudiKernel/IIoComponentMgr.h"
41 #include "GaudiKernel/SmartIF.h"
42 #include "Gaudi/Interfaces/IOptionsSvc.h"
45 #include "tbb/concurrent_queue.h"
46 #include "tbb/task_group.h"
51 #include <condition_variable>
71 class HltEventLoopMgr :
public extends<AthService, ITrigEventLoopMgr, IEventProcessor>,
143 std::atomic<EventIDBase::number_type>
maxLB{0};
181 const EventContext& eventContext);
184 void resetEventTimer(
const EventContext& eventContext,
bool processing);
220 ToolHandle<TrigCOOLUpdateHelper>
m_coolHelper{
this,
"CoolUpdateTool",
"TrigCOOLUpdateHelper"};
222 ToolHandle<GenericMonitoringTool>
m_monTool{
this,
"MonTool",
"",
"Monitoring tool"};
223 ToolHandle<ITrigErrorMonTool>
m_errorMonTool{
this,
"TrigErrorMonTool",
"TrigErrorMonTool",
"Error monitoring tool"};
234 this,
"SchedulerSvc",
"AvalancheSchedulerSvc",
"Name of the scheduler"};
237 this,
"WhiteboardSvc",
"EventDataSvc",
"Name of the Whiteboard"};
240 this,
"HardTimeout", 10*60*1000,
"Hard event processing timeout in milliseconds"};
243 this,
"SoftTimeoutFraction", 0.8,
"Fraction of the hard timeout to be set as the soft timeout"};
246 this,
"TimeoutThreadIntervalMs", 1000,
"How often the timeout thread checks for soft timeout, in milliseconds"};
249 this,
"TraceOnTimeout",
true,
250 "Print a stack trace on the first soft timeout (might take a while, holding all threads)"};
253 this,
"MaxParallelIOTasks", -1,
254 "Maximum number of I/O tasks which can be executed in parallel. "
255 "If <=0 then the number of scheduler threads is used."};
258 this,
"MaxIOWakeUpIntervalMs", -1,
259 "Maximum time input or output handling thread will sleep unless notified. Negative value (default) means no limit, "
260 "i.e. threads will only wake up on notifications. Zero means threads will never wait for notifications. "
261 "Positive value means the number of milliseconds after which a thread will wake up if it's not notified earlier."};
264 this,
"MaxFrameworkErrors", 10,
265 "Tolerable number of recovered framework errors before exiting (<0 means all are tolerated)"};
268 this,
"FwkErrorDebugStreamName",
"HLTMissingData",
269 "Debug stream name for events with HLT framework errors"};
272 this,
"AlgErrorDebugStreamName",
"HltError",
273 "Debug stream name for events with HLT algorithm errors"};
276 this,
"TimeoutDebugStreamName",
"HltTimeout",
277 "Debug stream name for events with HLT timeout"};
280 this,
"TruncationDebugStreamName",
"TruncatedHLTResult",
281 "Debug stream name for events with HLT result truncation"};
284 this,
"SORPath",
"/TDAQ/RunCtrl/SOR_Params",
"Path to StartOfRun parameters in detector store"};
287 this,
"execAtStart", {},
"List of algorithms/sequences to execute during prepareForRun"};
290 this,
"setMagFieldFromPtree",
true,
"Read magnet currents from ptree"};
293 this,
"forceRunNumber", 0,
"Override run number"};
296 this,
"forceLumiblock", 0,
"Override lumiblock number"};
299 this,
"forceStartOfRunTime", 0,
"Override SOR time (epoch in nano-seconds)"};
302 this,
"RewriteLVL1",
false,
303 "Encode L1 results to ByteStream and write to the output. Possible only with athenaHLT, not online."};
306 this,
"MonitorScheduler",
false,
"Enable SchedulerMonSvc to collect scheduler status data in online histograms"};
309 this,
"EventContextWHKey",
"EventContext",
"StoreGate key for recording EventContext"};
312 this,
"EventInfoRHKey",
"EventInfo",
"StoreGate key for reading xAOD::EventInfo"};
315 this,
"L1TriggerResultRHKey",
"",
"StoreGate key for reading L1TriggerResult for RewriteLVL1"};
318 this,
"RoIBResultRHKey",
"",
"StoreGate key for reading RoIBResult for RewriteLVL1 with legacy (Run-2) L1 simulation"};
367 #endif // TRIGSERVICES_HLTEVENTLOOPMGR_H
Property holding a SG store/key/clid from which a ReadHandle is made.
StatusCode clearWBSlot(size_t evtSlot) const
Clear an event slot in the whiteboard.
ServiceHandle< StoreGateSvc > m_inputMetaDataStore
Gaudi::Property< std::string > m_schedulerName
std::unique_ptr< TrigSORFromPtreeHelper > m_sorHelper
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfoRHKey
ServiceHandle< Gaudi::Interfaces::IOptionsSvc > m_jobOptionsSvc
StatusCode failedEvent(HLT::OnlineErrorCode errorCode, const EventContext &eventContext)
Handle a failure to process an event.
SmartIF< IHiveWhiteBoard > m_whiteboard
SG::ReadHandleKey< xAOD::TrigCompositeContainer > m_l1TriggerResultRHKey
Gaudi::Property< bool > m_traceOnTimeout
StatusCode exitCode
Event exit status code.
virtual StatusCode stop() override
Gaudi::Property< float > m_hardTimeout
StatusCode updateMagField(const boost::property_tree::ptree &pt) const
Set magnetic field currents from ptree.
Tool to perform COOL updates during the run.
StatusCode execAtStart(const EventContext &ctx) const
Execute optional algs/sequences.
void eventTimerCallback()
The method executed by the event timeout monitoring thread.
void resetEventTimer(const EventContext &eventContext, bool processing)
Reset the timeout flag and the timer, and mark the slot as busy or idle according to the second argum...
Gaudi::Property< bool > m_setMagFieldFromPtree
bool coolUpdateOngoing
COOL update ongoing.
Gaudi::Property< float > m_softTimeoutFraction
std::unique_ptr< HLT::LoopThread > m_outputThread
Output handling thread (triggers post-processing of finished events)
std::unique_ptr< HLT::LoopThread > m_timeoutThread
Timeout thread.
HltEventLoopMgr(HltEventLoopMgr &&)=delete
std::string m_applicationName
Application name.
tbb::task_group m_parallelIOTaskGroup
Task group to execute parallel I/O tasks asynchronously.
AthenaMT event loop manager for running HLT online.
SmartIF< IScheduler > m_schedulerSvc
void inputThreadCallback()
std::condition_variable coolUpdateCond
Condition variable to synchronize COOL updates.
virtual StatusCode nextEvent(int maxevt=-1) override
Implementation of IEventProcessor::nextEvent which implements the event loop.
std::vector< std::chrono::steady_clock::time_point > m_eventTimerStartPoint
Vector of event start-processing time stamps in each slot.
Flags and counters steering the main event loop execution.
HltEventLoopMgr(const std::string &name, ISvcLocator *svcLoc)
Standard constructor.
virtual EventContext createEventContext() override
create an Event Context object
Gaudi::Property< bool > m_monitorScheduler
This class is a collection of AttributeLists where each one is associated with a channel number....
ToolHandle< ITrigErrorMonTool > m_errorMonTool
Gaudi::Property< std::string > m_sorPath
Assign a CLID to EventContext.
Gaudi::Property< std::vector< std::string > > m_execAtStart
Gaudi::Property< int > m_maxParallelIOTasks
ToolHandle< GenericMonitoringTool > m_monTool
virtual StatusCode hltUpdateAfterFork(const boost::property_tree::ptree &pt) override
virtual StatusCode initialize() override
ServiceHandle< StoreGateSvc > m_detectorStore
Gaudi::Property< unsigned int > m_forceLumiblock
std::atomic< bool > eventsAvailable
Event source has more events.
ServiceHandle< ISchedulerMonSvc > m_schedulerMonSvc
Gaudi::Property< int > m_maxFrameworkErrors
std::chrono::milliseconds m_softTimeoutValue
Soft timeout value set to HardTimeout*SoftTimeoutFraction at initialisation.
Gaudi::Property< std::string > m_fwkErrorDebugStreamName
virtual StatusCode finalize() override
ServiceHandle< IIoComponentMgr > m_ioCompMgr
The Athena Transient Store API.
It used to be useful piece of code for replacing actual SG with other store of similar functionality ...
Class to modify timeout flag.
Gaudi::Property< unsigned int > m_forceRunNumber
virtual StatusCode prepareForRun ATLAS_NOT_THREAD_SAFE(const boost::property_tree::ptree &pt) override
::StatusCode StatusCode
StatusCode definition for legacy code.
HltEventLoopMgr & operator=(const HltEventLoopMgr &)=delete
tbb::concurrent_bounded_queue< bool > m_parallelIOQueue
Queue limiting the number of parallel I/O tasks.
Gaudi::Property< bool > m_rewriteLVL1
SG::ReadHandleKey< ROIB::RoIBResult > m_roibResultRHKey
ServiceHandle< StoreGateSvc > m_evtStore
Header file to be included by clients of the Monitored infrastructure.
Gaudi::Property< int > m_maxIOWakeUpIntervalMs
virtual StatusCode executeEvent(EventContext &&ctx) override
Implementation of IEventProcessor::executeEvent which processes a single event.
Gaudi::Property< std::string > m_timeoutDebugStreamName
std::atomic< size_t > m_freeSlots
Number of free slots used to synchronise input/output tasks.
Gaudi::Property< unsigned long long > m_forceSOR_ns
std::mutex coolUpdateMutex
Mutex to synchronize COOL updates.
ToolHandle< HLTResultMTMaker > m_hltResultMaker
std::atomic< int > m_nFrameworkErrors
Counter of framework errors.
Property holding a SG store/key/clid from which a WriteHandle is made.
ServiceHandle< IEvtSelector > m_evtSelector
std::condition_variable loopEndedCond
Condition variable to notify the main thread of the end of the event loop.
EventContext m_currentRunCtx
"Event" context of current run with dummy event/slot number
StatusCode clearTemporaryStores()
Clear per-event stores.
boost::property_tree::ptree ptree
HltEventLoopMgr(const HltEventLoopMgr &)=delete
void outputThreadCallback()
The method executed by the output handling thread.
int m_workerPID
Worker PID.
StatusCode processFinishedEvent()
Perform all end-of-event actions for a single event popped out from the scheduler.
void updateMetadataStore(const coral::AttributeList &sor_attrlist) const
void updateDFProps()
Read DataFlow configuration properties.
HltEventLoopMgr & operator=(HltEventLoopMgr &&)=delete
StatusCode startNextEvent()
std::atomic< bool > loopEnded
No more events available and all ongoing processing has finished.
Gaudi::Property< std::string > m_whiteboardName
Gaudi::Property< std::string > m_algErrorDebugStreamName
ServiceHandle< IConversionSvc > m_outputCnvSvc
SmartIF< IAlgExecStateSvc > m_aess
virtual StatusCode stopRun() override
Implementation of IEventProcessor::stopRun (obsolete for online runnning)
SmartIF< IAlgResourcePool > m_algResourcePool
void printSORAttrList(const coral::AttributeList &atr) const
Print the SOR record.
Gaudi::Property< std::string > m_truncationDebugStreamName
std::vector< std::chrono::steady_clock::time_point > m_freeSlotStartPoint
Vector of time stamps telling when each scheduler slot was freed.
std::unique_ptr< HLT::LoopThread > m_inputThread
Input handling thread (triggers reading new events)
std::atomic< size_t > m_localEventNumber
Event counter used for local bookkeeping; incremental per instance of HltEventLoopMgr,...
Gaudi::Property< unsigned int > m_timeoutThreadIntervalMs
SG::ReadHandleKey< HLT::HLTResultMT > m_hltResultRHKey
StoreGate key for reading the HLT result.
ServiceHandle< IIncidentSvc > m_incidentSvc
std::atomic< EventIDBase::number_type > maxLB
Max lumiblock number seen in the loop.
IEvtSelector::Context * m_evtSelContext
Event selector context.
tbb::concurrent_bounded_queue< EventContext * > m_finishedEventsQueue
Queue of events ready for output processing.
virtual StatusCode prepareForStart(const boost::property_tree::ptree &) override
Define macros for attributes used to control the static checker.
bool m_timeoutTraceGenerated
Flag set when a soft timeout produces a stack trace, to avoid producing multiple traces.
EventLoopStatus m_loopStatus
Object keeping track of the event loop status.
std::mutex loopEndedMutex
Mutex to notify the main thread of the end of the event loop.
virtual ~HltEventLoopMgr() noexcept override
Standard destructor.
SG::WriteHandleKey< EventContext > m_eventContextWHKey
virtual StatusCode executeRun(int maxevt=-1) override
Implementation of IEventProcessor::executeRun which calls IEventProcessor::nextEvent.
ToolHandle< TrigCOOLUpdateHelper > m_coolHelper
const coral::AttributeList & getSorAttrList() const
Extract the single attr list off the SOR CondAttrListCollection.
std::vector< bool > m_isSlotProcessing
Vector of flags to tell if a slot is idle or processing.