ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
HLT
Trigger
TrigControl
TrigServices
python
TrigServicesConfig.py
Go to the documentation of this file.
1
# Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
2
3
from
AthenaConfiguration.ComponentAccumulator
import
ComponentAccumulator
4
from
AthenaConfiguration.ComponentFactory
import
CompFactory
5
from
AthenaMonitoringKernel.GenericMonitoringTool
import
GenericMonitoringTool
6
7
from
AthenaCommon.Logging
import
logging
8
log = logging.getLogger(
'TrigServicesConfig'
)
9
10
11
def
setDefaultOnlineFlags
(flags):
12
"""Populate flags with the default settings for online running"""
13
14
from
AthenaConfiguration.Enums
import
Format
15
flags.Common.isOnline =
True
16
flags.Input.Files = []
17
flags.Input.isMC =
False
18
flags.Input.Format = Format.BS
19
flags.Trigger.doHLT =
True
# This distinguishes the HLT setup from online reco (GM, EventDisplay)
20
flags.Trigger.Online.isPartition =
True
# athenaHLT and partition at P1
21
flags.Trigger.EDMVersion = 3
22
flags.Trigger.writeBS =
True
23
flags.Scheduler.CheckDependencies =
True
24
flags.Scheduler.ShowDataDeps =
True
25
flags.Scheduler.ShowControlFlow =
True
26
flags.Scheduler.ShowDataFlow =
True
27
flags.Scheduler.EnableVerboseViews =
True
28
flags.Scheduler.AutoLoadUnmetDependencies =
False
29
flags.Input.FailOnUnknownCollections =
True
30
31
32
def
getMessageSvc
(flags, msgSvcType="TrigMessageSvc"):
33
from
AthenaCommon.Constants
import
DEBUG, WARNING
34
35
# set message limit to unlimited when general DEBUG is requested
36
msgLimit = -100
if
flags.Exec.OutputLevel>DEBUG
else
0
37
38
msgsvc = CompFactory.getComp(msgSvcType)(
39
"MessageSvc"
,
40
OutputLevel = flags.Exec.OutputLevel,
41
Format =
"%t % F%40W%C%6W%R%e%4W%s%8W%R%T %0W%M"
,
42
ErsFormat =
"%S: %M"
,
43
printEventIDLevel = WARNING,
44
45
# Message suppression
46
enableSuppression =
False
,
47
suppressRunningOnly =
True
,
48
# 0 = no suppression, negative = log-suppression, positive = normal suppression
49
# Do not rely on the defaultLimit property, always set each limit separately
50
defaultLimit = msgLimit,
51
verboseLimit = msgLimit,
52
debugLimit = msgLimit,
53
infoLimit = msgLimit,
54
warningLimit = msgLimit,
55
errorLimit = 0,
56
fatalLimit = 0,
57
58
# Message forwarding to ERS
59
useErsError = [
'*'
],
60
useErsFatal = [
'*'
],
61
ersPerEventLimit = 2,
# ATR-25214
62
63
# show summary statistics of messages in finalize
64
showStats =
True
,
65
statLevel = WARNING
66
)
67
return
msgsvc
68
69
70
def
getTrigCOOLUpdateHelper
(flags, name='TrigCOOLUpdateHelper'):
71
'''Enable COOL folder updates'''
72
73
acc = ComponentAccumulator()
74
75
montool =
GenericMonitoringTool
(flags,
'MonTool'
, HistPath=
'HLTFramework/'
+name)
76
montool.defineHistogram(
'TIME_CoolFolderUpdate'
, path=
'EXPERT'
, type=
'TH1F'
,
77
title=
'Time for conditions update;time [ms]'
,
78
xbins=100, xmin=0, xmax=200)
79
80
cool_helper = CompFactory.TrigCOOLUpdateHelper(
81
name,
82
MonTool = montool,
83
CoolFolderMap =
'/TRIGGER/HLT/COOLUPDATE'
,
84
# List of folders that can be updated during the run:
85
Folders = [
'/Indet/Onl/Beampos'
,
86
'/TRIGGER/LUMI/HLTPrefLumi'
,
87
'/TRIGGER/HLT/PrescaleKey'
] )
88
89
from
IOVDbSvc.IOVDbSvcConfig
import
addFolders
90
acc.merge( addFolders(flags, cool_helper.CoolFolderMap,
'TRIGGER_ONL'
,
91
className=
'CondAttrListCollection'
) )
92
93
acc.setPrivateTools( cool_helper )
94
return
acc
95
96
97
def
getHltEventLoopMgr
(flags, name='HltEventLoopMgr'):
98
'''online event loop manager'''
99
100
svc = CompFactory.HltEventLoopMgr(
101
name,
102
setMagFieldFromPtree = flags.Trigger.Online.BFieldAutoConfig
103
)
104
105
# Rewrite LVL1 result if L1 simulation and BS-writing is enabled
106
if flags.Trigger.doLVL1 and flags.Trigger.writeBS:
107
svc.RewriteLVL1 = True
108
svc.L1TriggerResultRHKey = 'L1TriggerResult'
109
svc.RoIBResultRHKey = 'RoIBResult'
110
111
# Monitoring
112
svc.MonTool = GenericMonitoringTool(flags, 'MonTool', HistPath='HLTFramework/'+name)
113
114
svc.MonTool.defineHistogram('TotalTime', path='EXPERT', type='TH1F',
115
title='Total event processing time (all events);Time [ms];Events',
116
xbins=200, xmin=0, xmax=10000)
117
svc.MonTool.defineHistogram('TotalTime;TotalTime_extRange', path='EXPERT', type='TH1F',
118
title='Total event processing time (all events);Time [ms];Events',
119
xbins=200, xmin=0, xmax=20000, opt='kCanRebin')
120
121
svc.MonTool.defineHistogram('TotalTimeAccepted', path='EXPERT', type='TH1F',
122
title='Total event processing time (accepted events);Time [ms];Events',
123
xbins=200, xmin=0, xmax=10000)
124
svc.MonTool.defineHistogram('TotalTimeAccepted;TotalTimeAccepted_extRange', path='EXPERT', type='TH1F',
125
title='Total event processing time (accepted events);Time [ms];Events',
126
xbins=200, xmin=0, xmax=20000, opt='kCanRebin')
127
128
svc.MonTool.defineHistogram('TotalTimeRejected', path='EXPERT', type='TH1F',
129
title='Total event processing time (rejected events);Time [ms];Events',
130
xbins=200, xmin=0, xmax=10000)
131
svc.MonTool.defineHistogram('TotalTimeRejected;TotalTimeRejected_extRange', path='EXPERT', type='TH1F',
132
title='Total event processing time (rejected events);Time [ms];Events',
133
xbins=200, xmin=0, xmax=20000, opt='kCanRebin')
134
135
svc.MonTool.defineHistogram('SlotIdleTime', path='EXPERT', type='TH1F',
136
title='Time between freeing and assigning a scheduler slot;Time [ms];Events',
137
xbins=400, xmin=0, xmax=400)
138
svc.MonTool.defineHistogram('SlotIdleTime;SlotIdleTime_extRange', path='EXPERT', type='TH1F',
139
title='Time between freeing and assigning a scheduler slot;Time [ms];Events',
140
xbins=400, xmin=0, xmax=800, opt='kCanRebin')
141
142
svc.MonTool.defineHistogram('TIME_clearStore', path='EXPERT', type='TH1F',
143
title='Time of clearStore() calls;Time [ms];Calls',
144
xbins=200, xmin=0, xmax=50)
145
svc.MonTool.defineHistogram('TIME_clearStore;TIME_clearStore_extRange', path='EXPERT', type='TH1F',
146
title='Time of clearStore() calls;Time [ms];Calls',
147
xbins=200, xmin=0, xmax=200, opt='kCanRebin')
148
149
svc.MonTool.defineHistogram('PopSchedulerTime', path='EXPERT', type='TH1F',
150
title='Time spent waiting for a finished event from the Scheduler;Time [ms];drainScheduler() calls',
151
xbins=250, xmin=0, xmax=250)
152
svc.MonTool.defineHistogram('PopSchedulerNumEvt', path='EXPERT', type='TH1F',
153
title='Number of events popped out of scheduler at the same time;Time [ms];drainScheduler() calls',
154
xbins=50, xmin=0, xmax=50)
155
156
from TrigSteerMonitor.TrigSteerMonitorConfig import getTrigErrorMonTool
157
svc.TrigErrorMonTool = getTrigErrorMonTool(flags)
158
159
if flags.Trigger.CostMonitoring.doCostMonitoring:
160
svc.TrigErrorMonTool.TrigCostSvc = CompFactory.TrigCostSvc()
161
162
return svc
163
164
165
def TrigServicesCfg(flags):
166
acc = ComponentAccumulator()
167
168
acc.addService( getMessageSvc(flags) )
169
acc.addService(CompFactory.ROBDataProviderSvc('ROBDataProviderSvc'))
170
171
cool_helper = acc.popToolsAndMerge( getTrigCOOLUpdateHelper(flags) )
172
173
loop_mgr = getHltEventLoopMgr(flags)
174
loop_mgr.CoolUpdateTool = cool_helper
175
176
from TriggerJobOpts.TriggerHistSvcConfig import TriggerHistSvcConfig
177
acc.merge( TriggerHistSvcConfig(flags) )
178
179
from TrigOutputHandling.TrigOutputHandlingConfig import HLTResultMTMakerCfg
180
loop_mgr.ResultMaker = HLTResultMTMakerCfg(flags)
181
182
from TriggerJobOpts.TriggerByteStreamConfig import ByteStreamReadCfg
183
acc.merge(ByteStreamReadCfg(flags))
184
loop_mgr.EvtSel = acc.getService('EventSelectorByteStream')
185
loop_mgr.OutputCnvSvc = acc.getService('ByteStreamCnvSvc')
186
187
# Rewrite LVL1 result if L1 simulation and BS-writing is enabled
188
if flags.Trigger.doLVL1 and flags.Trigger.writeBS:
189
from TrigT1ResultByteStream.TrigT1ResultByteStreamConfig import L1TriggerByteStreamEncoderCfg
190
acc.merge(L1TriggerByteStreamEncoderCfg(flags))
191
192
from TrigSteerMonitor.TrigSteerMonitorConfig import SchedulerMonSvcCfg
193
acc.merge( SchedulerMonSvcCfg(flags) )
194
loop_mgr.MonitorScheduler = True
195
196
acc.addService(loop_mgr, primary=True)
197
acc.setAppProperty("EventLoop", loop_mgr.name)
198
199
return acc
200
201
202
def commonServicesCfg(flags):
203
from AthenaCommon.Constants import INFO
204
from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
205
from AthenaConfiguration.ComponentFactory import CompFactory
206
207
# Basic services
208
cfg = ComponentAccumulator()
209
cfg.addService(CompFactory.ClassIDSvc(CLIDDBFiles = ['clid.db','Gaudi_clid.db']))
210
211
cfg.addService(CompFactory.AlgContextSvc(BypassIncidents=True))
212
cfg.addAuditor(CompFactory.AlgContextAuditor())
213
214
cfg.addService(CompFactory.StoreGateSvc())
215
cfg.addService(CompFactory.StoreGateSvc("DetectorStore"))
216
cfg.addService(CompFactory.StoreGateSvc("HistoryStore"))
217
cfg.addService(CompFactory.StoreGateSvc("ConditionStore"))
218
219
cfg.addService( CompFactory.SG.HiveMgrSvc(
220
"EventDataSvc",
221
NSlots = flags.Concurrency.NumConcurrentEvents) )
222
223
cfg.addService( CompFactory.AlgResourcePool(
224
OutputLevel = INFO,
225
TopAlg=["AthSequencer/AthMasterSeq"]) )
226
227
from AthenaConfiguration.MainServicesConfig import AvalancheSchedulerSvcCfg
228
cfg.merge( AvalancheSchedulerSvcCfg(flags, maxParallelismExtra=1) )
229
230
# SGCommitAuditor to sweep new DataObjects at end of Alg execute
231
cfg.addAuditor( CompFactory.SGCommitAuditor() )
232
233
# CoreDumpSvc
234
cfg.addService( CompFactory.CoreDumpSvc(
235
CoreDumpStream = "stdout",
236
CallOldHandler = False, # avoid calling e.g. ROOT signal handler
237
FastStackTrace = True, # first produce a fast stacktrace
238
StackTrace = True, # then produce full stacktrace using gdb
239
DumpCoreFile = True, # also produce core file (if allowed by ulimit -c)
240
FatalHandler = 0, # no extra fatal handler
241
KillOnSigInt = True, # athenaEF runs the event loop in-process (ATR-32990)
242
TimeOut = 120e9), # timeout for stack trace generation changed to 120s (ATR-17112,ATR-25404)
243
create = True ) # always create the service
244
245
# Miscellaneous environment settings.
246
# This includes fixing the cache sizes that Eigen assumes, so that
247
# operations on large matrices will give identical results across
248
# hardware with differing cache sizes.
249
cfg.addService(CompFactory.AthEnvironmentSvc(), create=True)
250
251
# IOVSvc
252
cfg.addService( CompFactory.IOVSvc(
253
updateInterval = "RUN",
254
preLoadData = True,
255
preLoadExtensibleFolders = False, # ATR-19392
256
forceResetAtBeginRun = False) )
257
258
# PerfMon
259
if flags.PerfMon.doFastMonMT or flags.PerfMon.doFullMonMT:
260
from PerfMonComps.PerfMonCompsConfig import PerfMonMTSvcCfg
261
cfg.merge( PerfMonMTSvcCfg(flags) )
262
263
from TrigServices.TrigServicesConfig import TrigServicesCfg
264
cfg.merge( TrigServicesCfg(flags) )
265
266
# ApplicationMgr properties
267
cfg.setAppProperty('AuditAlgorithms', True)
268
cfg.setAppProperty('InitializationLoopCheck', False)
269
270
return cfg
271
272
273
if __name__=="__main__":
274
from AthenaConfiguration.AllConfigFlags import initConfigFlags
275
276
flags = initConfigFlags()
277
setDefaultOnlineFlags(flags)
278
flags.lock()
279
280
cfg = ComponentAccumulator()
281
cfg.merge( commonServicesCfg(flags) )
282
cfg.wasMerged()
GenericMonitoringTool
Definition
GenericMonitoringTool.h:51
Constants
python.TrigServicesConfig.getHltEventLoopMgr
getHltEventLoopMgr(flags, name='HltEventLoopMgr')
Definition
TrigServicesConfig.py:97
python.TrigServicesConfig.setDefaultOnlineFlags
setDefaultOnlineFlags(flags)
Definition
TrigServicesConfig.py:11
python.TrigServicesConfig.getMessageSvc
getMessageSvc(flags, msgSvcType="TrigMessageSvc")
Definition
TrigServicesConfig.py:32
python.TrigServicesConfig.getTrigCOOLUpdateHelper
getTrigCOOLUpdateHelper(flags, name='TrigCOOLUpdateHelper')
Definition
TrigServicesConfig.py:70
Generated on
for ATLAS Offline Software by
1.17.0