ATLAS Offline Software
Loading...
Searching...
No Matches
TrigServicesConfig.py
Go to the documentation of this file.
1# Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
2
3from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
4from AthenaConfiguration.ComponentFactory import CompFactory
5from AthenaMonitoringKernel.GenericMonitoringTool import GenericMonitoringTool
6
7from AthenaCommon.Logging import logging
8log = logging.getLogger('TrigServicesConfig')
9
10
11def getMessageSvc(flags, msgSvcType="TrigMessageSvc"):
12 from AthenaCommon.Constants import DEBUG, WARNING
13
14 # set message limit to unlimited when general DEBUG is requested
15 msgLimit = -100 if flags.Exec.OutputLevel>DEBUG else 0
16
17 msgsvc = CompFactory.getComp(msgSvcType)(
18 "MessageSvc",
19 OutputLevel = flags.Exec.OutputLevel,
20 Format = "%t % F%40W%C%6W%R%e%4W%s%8W%R%T %0W%M",
21 ErsFormat = "%S: %M",
22 printEventIDLevel = WARNING,
23
24 # Message suppression
25 enableSuppression = False,
26 suppressRunningOnly = True,
27 # 0 = no suppression, negative = log-suppression, positive = normal suppression
28 # Do not rely on the defaultLimit property, always set each limit separately
29 defaultLimit = msgLimit,
30 verboseLimit = msgLimit,
31 debugLimit = msgLimit,
32 infoLimit = msgLimit,
33 warningLimit = msgLimit,
34 errorLimit = 0,
35 fatalLimit = 0,
36
37 # Message forwarding to ERS
38 useErsError = ['*'],
39 useErsFatal = ['*'],
40 ersPerEventLimit = 2, # ATR-25214
41
42 # show summary statistics of messages in finalize
43 showStats = True,
44 statLevel = WARNING
45 )
46 return msgsvc
47
48
49def getTrigCOOLUpdateHelper(flags, name='TrigCOOLUpdateHelper'):
50 '''Enable COOL folder updates'''
51
52 acc = ComponentAccumulator()
53
54 montool = GenericMonitoringTool(flags, 'MonTool', HistPath='HLTFramework/'+name)
55 montool.defineHistogram('TIME_CoolFolderUpdate', path='EXPERT', type='TH1F',
56 title='Time for conditions update;time [ms]',
57 xbins=100, xmin=0, xmax=200)
58
59 cool_helper = CompFactory.TrigCOOLUpdateHelper(
60 name,
61 MonTool = montool,
62 CoolFolderMap = '/TRIGGER/HLT/COOLUPDATE',
63 # List of folders that can be updated during the run:
64 Folders = ['/Indet/Onl/Beampos',
65 '/TRIGGER/LUMI/HLTPrefLumi',
66 '/TRIGGER/HLT/PrescaleKey'] )
67
68 from IOVDbSvc.IOVDbSvcConfig import addFolders
69 acc.merge( addFolders(flags, cool_helper.CoolFolderMap, 'TRIGGER_ONL',
70 className='CondAttrListCollection') )
71
72 acc.setPrivateTools( cool_helper )
73 return acc
74
75
76def getHltEventLoopMgr(flags, name='HltEventLoopMgr'):
77 '''online event loop manager'''
78
79 svc = CompFactory.HltEventLoopMgr(
80 name,
81 setMagFieldFromPtree = flags.Trigger.Online.BFieldAutoConfig
82 )
83
84 # Rewrite LVL1 result if L1 simulation and BS-writing is enabled
85 if flags.Trigger.doLVL1 and flags.Trigger.writeBS:
86 svc.RewriteLVL1 = True
87 svc.L1TriggerResultRHKey = 'L1TriggerResult'
88 svc.RoIBResultRHKey = 'RoIBResult'
89
90 # Monitoring
91 svc.MonTool = GenericMonitoringTool(flags, 'MonTool', HistPath='HLTFramework/'+name)
92
93 svc.MonTool.defineHistogram('TotalTime', path='EXPERT', type='TH1F',
94 title='Total event processing time (all events);Time [ms];Events',
95 xbins=200, xmin=0, xmax=10000)
96 svc.MonTool.defineHistogram('TotalTime;TotalTime_extRange', path='EXPERT', type='TH1F',
97 title='Total event processing time (all events);Time [ms];Events',
98 xbins=200, xmin=0, xmax=20000, opt='kCanRebin')
99
100 svc.MonTool.defineHistogram('TotalTimeAccepted', path='EXPERT', type='TH1F',
101 title='Total event processing time (accepted events);Time [ms];Events',
102 xbins=200, xmin=0, xmax=10000)
103 svc.MonTool.defineHistogram('TotalTimeAccepted;TotalTimeAccepted_extRange', path='EXPERT', type='TH1F',
104 title='Total event processing time (accepted events);Time [ms];Events',
105 xbins=200, xmin=0, xmax=20000, opt='kCanRebin')
106
107 svc.MonTool.defineHistogram('TotalTimeRejected', path='EXPERT', type='TH1F',
108 title='Total event processing time (rejected events);Time [ms];Events',
109 xbins=200, xmin=0, xmax=10000)
110 svc.MonTool.defineHistogram('TotalTimeRejected;TotalTimeRejected_extRange', path='EXPERT', type='TH1F',
111 title='Total event processing time (rejected events);Time [ms];Events',
112 xbins=200, xmin=0, xmax=20000, opt='kCanRebin')
113
114 svc.MonTool.defineHistogram('SlotIdleTime', path='EXPERT', type='TH1F',
115 title='Time between freeing and assigning a scheduler slot;Time [ms];Events',
116 xbins=400, xmin=0, xmax=400)
117 svc.MonTool.defineHistogram('SlotIdleTime;SlotIdleTime_extRange', path='EXPERT', type='TH1F',
118 title='Time between freeing and assigning a scheduler slot;Time [ms];Events',
119 xbins=400, xmin=0, xmax=800, opt='kCanRebin')
120
121 svc.MonTool.defineHistogram('TIME_clearStore', path='EXPERT', type='TH1F',
122 title='Time of clearStore() calls;Time [ms];Calls',
123 xbins=200, xmin=0, xmax=50)
124 svc.MonTool.defineHistogram('TIME_clearStore;TIME_clearStore_extRange', path='EXPERT', type='TH1F',
125 title='Time of clearStore() calls;Time [ms];Calls',
126 xbins=200, xmin=0, xmax=200, opt='kCanRebin')
127
128 svc.MonTool.defineHistogram('PopSchedulerTime', path='EXPERT', type='TH1F',
129 title='Time spent waiting for a finished event from the Scheduler;Time [ms];drainScheduler() calls',
130 xbins=250, xmin=0, xmax=250)
131 svc.MonTool.defineHistogram('PopSchedulerNumEvt', path='EXPERT', type='TH1F',
132 title='Number of events popped out of scheduler at the same time;Time [ms];drainScheduler() calls',
133 xbins=50, xmin=0, xmax=50)
134
135 from TrigSteerMonitor.TrigSteerMonitorConfig import getTrigErrorMonTool
136 svc.TrigErrorMonTool = getTrigErrorMonTool(flags)
137
138 if flags.Trigger.CostMonitoring.doCostMonitoring:
139 svc.TrigErrorMonTool.TrigCostSvc = CompFactory.TrigCostSvc()
140
141 return svc
142
143
144def TrigServicesCfg(flags):
145 acc = ComponentAccumulator()
146
147 acc.addService( getMessageSvc(flags) )
148 acc.addService(CompFactory.ROBDataProviderSvc('ROBDataProviderSvc'))
149
150 cool_helper = acc.popToolsAndMerge( getTrigCOOLUpdateHelper(flags) )
151
152 loop_mgr = getHltEventLoopMgr(flags)
153 loop_mgr.CoolUpdateTool = cool_helper
154
155 from TriggerJobOpts.TriggerHistSvcConfig import TriggerHistSvcConfig
156 acc.merge( TriggerHistSvcConfig(flags) )
157
158 from TrigOutputHandling.TrigOutputHandlingConfig import HLTResultMTMakerCfg
159 loop_mgr.ResultMaker = HLTResultMTMakerCfg(flags)
160
161 from TriggerJobOpts.TriggerByteStreamConfig import ByteStreamReadCfg
162 acc.merge(ByteStreamReadCfg(flags))
163 loop_mgr.EvtSel = acc.getService('EventSelectorByteStream')
164 loop_mgr.OutputCnvSvc = acc.getService('ByteStreamCnvSvc')
165
166 # Rewrite LVL1 result if L1 simulation and BS-writing is enabled
167 if flags.Trigger.doLVL1 and flags.Trigger.writeBS:
168 from TrigT1ResultByteStream.TrigT1ResultByteStreamConfig import L1TriggerByteStreamEncoderCfg
169 acc.merge(L1TriggerByteStreamEncoderCfg(flags))
170
171 from TrigSteerMonitor.TrigSteerMonitorConfig import SchedulerMonSvcCfg
172 acc.merge( SchedulerMonSvcCfg(flags) )
173 loop_mgr.MonitorScheduler = True
174
175 acc.addService(loop_mgr, primary=True)
176 acc.setAppProperty("EventLoop", loop_mgr.name)
177
178 return acc
179
180
181if __name__=="__main__":
182 from AthenaConfiguration.AllConfigFlags import initConfigFlags
183 from TrigServices.TriggerUnixStandardSetup import setDefaultOnlineFlags
184
185 flags = initConfigFlags()
186 setDefaultOnlineFlags(flags)
187 flags.lock()
188
189 cfg = ComponentAccumulator()
190 cfg.merge( TrigServicesCfg(flags) )
191 cfg.wasMerged()
getHltEventLoopMgr(flags, name='HltEventLoopMgr')
getMessageSvc(flags, msgSvcType="TrigMessageSvc")
getTrigCOOLUpdateHelper(flags, name='TrigCOOLUpdateHelper')