ATLAS Offline Software
TrigServicesConfig.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2024 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 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 
49 def 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 
76 def getHltROBDataProviderSvc(flags, name='ROBDataProviderSvc'):
77  '''online ROB data provider service'''
78  svc = CompFactory.HltROBDataProviderSvc(name,
79  doCostMonitoring = (flags.Trigger.CostMonitoring.doCostMonitoring and
80  flags.Trigger.CostMonitoring.monitorROBs) )
81 
82  svc.MonTool = GenericMonitoringTool(flags, 'MonTool', HistPath='HLTFramework/'+name)
83  svc.MonTool.defineHistogram('TIME_ROBReserveData', path='EXPERT', type='TH1F',
84  title='Time to reserve ROBs for later retrieval;time [mu s]',
85  xbins=100, xmin=0, xmax=1000)
86  svc.MonTool.defineHistogram('NUMBER_ROBReserveData', path='EXPERT', type='TH1F',
87  title='Number of reserved ROBs for later retrieval;number',
88  xbins=100, xmin=0, xmax=500)
89  svc.MonTool.defineHistogram('TIME_ROBRequest', path='EXPERT', type='TH1F',
90  title='Time for ROB retrievals;time [mu s]',
91  xbins=400, xmin=0, xmax=200000)
92  svc.MonTool.defineHistogram('NUMBER_ROBRequest', path='EXPERT', type='TH1F',
93  title='Number of retrieved ROBs;number',
94  xbins=100, xmin=0, xmax=1000)
95  svc.MonTool.defineHistogram('TIME_CollectAllROBs', path='EXPERT', type='TH1F',
96  title='Time for retrieving complete event data;time [mu s]',
97  xbins=400, xmin=0, xmax=200000)
98  svc.MonTool.defineHistogram('NUMBER_CollectAllROBs', path='EXPERT', type='TH1F',
99  title='Number of received ROBs for collect call;number',
100  xbins=100, xmin=0, xmax=2500)
101 
102  return svc
103 
104 
105 def getHltEventLoopMgr(flags, name='HltEventLoopMgr'):
106  '''online event loop manager'''
107 
108  svc = CompFactory.HltEventLoopMgr(
109  name,
110  setMagFieldFromPtree = flags.Trigger.Online.BFieldAutoConfig
111  )
112 
113  # Rewrite LVL1 result if L1 simulation and BS-writing is enabled
114  if flags.Trigger.doLVL1 and flags.Trigger.writeBS:
115  svc.RewriteLVL1 = True
116  if flags.Trigger.enableL1MuonPhase1 or flags.Trigger.enableL1CaloPhase1:
117  svc.L1TriggerResultRHKey = 'L1TriggerResult'
118  if flags.Trigger.enableL1CaloLegacy or not flags.Trigger.enableL1MuonPhase1:
119  svc.RoIBResultRHKey = 'RoIBResult'
120 
121  # Monitoring
122  svc.MonTool = GenericMonitoringTool(flags, 'MonTool', HistPath='HLTFramework/'+name)
123 
124  svc.MonTool.defineHistogram('TotalTime', path='EXPERT', type='TH1F',
125  title='Total event processing time (all events);Time [ms];Events',
126  xbins=200, xmin=0, xmax=10000)
127  svc.MonTool.defineHistogram('TotalTime;TotalTime_extRange', path='EXPERT', type='TH1F',
128  title='Total event processing time (all events);Time [ms];Events',
129  xbins=200, xmin=0, xmax=20000, opt='kCanRebin')
130 
131  svc.MonTool.defineHistogram('TotalTimeAccepted', path='EXPERT', type='TH1F',
132  title='Total event processing time (accepted events);Time [ms];Events',
133  xbins=200, xmin=0, xmax=10000)
134  svc.MonTool.defineHistogram('TotalTimeAccepted;TotalTimeAccepted_extRange', path='EXPERT', type='TH1F',
135  title='Total event processing time (accepted events);Time [ms];Events',
136  xbins=200, xmin=0, xmax=20000, opt='kCanRebin')
137 
138  svc.MonTool.defineHistogram('TotalTimeRejected', path='EXPERT', type='TH1F',
139  title='Total event processing time (rejected events);Time [ms];Events',
140  xbins=200, xmin=0, xmax=10000)
141  svc.MonTool.defineHistogram('TotalTimeRejected;TotalTimeRejected_extRange', path='EXPERT', type='TH1F',
142  title='Total event processing time (rejected events);Time [ms];Events',
143  xbins=200, xmin=0, xmax=20000, opt='kCanRebin')
144 
145  svc.MonTool.defineHistogram('SlotIdleTime', path='EXPERT', type='TH1F',
146  title='Time between freeing and assigning a scheduler slot;Time [ms];Events',
147  xbins=400, xmin=0, xmax=400)
148  svc.MonTool.defineHistogram('SlotIdleTime;SlotIdleTime_extRange', path='EXPERT', type='TH1F',
149  title='Time between freeing and assigning a scheduler slot;Time [ms];Events',
150  xbins=400, xmin=0, xmax=800, opt='kCanRebin')
151 
152  svc.MonTool.defineHistogram('TIME_clearStore', path='EXPERT', type='TH1F',
153  title='Time of clearStore() calls;Time [ms];Calls',
154  xbins=200, xmin=0, xmax=50)
155  svc.MonTool.defineHistogram('TIME_clearStore;TIME_clearStore_extRange', path='EXPERT', type='TH1F',
156  title='Time of clearStore() calls;Time [ms];Calls',
157  xbins=200, xmin=0, xmax=200, opt='kCanRebin')
158 
159  svc.MonTool.defineHistogram('PopSchedulerTime', path='EXPERT', type='TH1F',
160  title='Time spent waiting for a finished event from the Scheduler;Time [ms];drainScheduler() calls',
161  xbins=250, xmin=0, xmax=250)
162  svc.MonTool.defineHistogram('PopSchedulerNumEvt', path='EXPERT', type='TH1F',
163  title='Number of events popped out of scheduler at the same time;Time [ms];drainScheduler() calls',
164  xbins=50, xmin=0, xmax=50)
165 
166  from TrigSteerMonitor.TrigSteerMonitorConfig import getTrigErrorMonTool
167  svc.TrigErrorMonTool = getTrigErrorMonTool(flags)
168 
169  if flags.Trigger.CostMonitoring.doCostMonitoring:
170  svc.TrigErrorMonTool.TrigCostSvc = CompFactory.TrigCostSvc()
171 
172  return svc
173 
174 
175 def TrigServicesCfg(flags):
176  acc = ComponentAccumulator()
177 
178  acc.addService( getMessageSvc(flags) )
179  acc.addService( getHltROBDataProviderSvc(flags) )
180  cool_helper = acc.popToolsAndMerge( getTrigCOOLUpdateHelper(flags) )
181 
182  loop_mgr = getHltEventLoopMgr(flags)
183  loop_mgr.CoolUpdateTool = cool_helper
184 
185  from TriggerJobOpts.TriggerHistSvcConfig import TriggerHistSvcConfig
186  acc.merge( TriggerHistSvcConfig(flags) )
187 
188  from TrigOutputHandling.TrigOutputHandlingConfig import HLTResultMTMakerCfg
189  loop_mgr.ResultMaker = HLTResultMTMakerCfg(flags)
190 
191  from TriggerJobOpts.TriggerByteStreamConfig import ByteStreamReadCfg
192  acc.merge(ByteStreamReadCfg(flags))
193  loop_mgr.EvtSel = acc.getService('EventSelectorByteStream')
194  loop_mgr.OutputCnvSvc = acc.getService('ByteStreamCnvSvc')
195 
196  # Rewrite LVL1 result if L1 simulation and BS-writing is enabled
197  if flags.Trigger.doLVL1 and flags.Trigger.writeBS:
198  from TrigT1ResultByteStream.TrigT1ResultByteStreamConfig import L1TriggerByteStreamEncoderCfg
199  acc.merge(L1TriggerByteStreamEncoderCfg(flags))
200 
201  from TrigSteerMonitor.TrigSteerMonitorConfig import SchedulerMonSvcCfg
202  acc.merge( SchedulerMonSvcCfg(flags) )
203  loop_mgr.MonitorScheduler = True
204 
205  acc.addService(loop_mgr, primary=True)
206  acc.setAppProperty("EventLoop", loop_mgr.name)
207 
208  return acc
209 
210 
211 if __name__=="__main__":
212  from TrigPSC.PscDefaultFlags import defaultOnlineFlags
214  flags.lock()
215 
217  cfg.merge( TrigServicesCfg(flags) )
218  cfg.wasMerged()
python.TrigServicesConfig.getMessageSvc
def getMessageSvc(flags, msgSvcType="TrigMessageSvc")
Definition: TrigServicesConfig.py:11
python.TrigServicesConfig.getHltEventLoopMgr
def getHltEventLoopMgr(flags, name='HltEventLoopMgr')
Definition: TrigServicesConfig.py:105
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
TrigOutputHandlingConfig.HLTResultMTMakerCfg
def HLTResultMTMakerCfg(flags, name="HLTResultMTMaker")
Definition: TrigOutputHandlingConfig.py:6
python.ByteStreamConfig.ByteStreamReadCfg
def ByteStreamReadCfg(flags, type_names=None)
Definition: Event/ByteStreamCnvSvc/python/ByteStreamConfig.py:25
python.TrigSteerMonitorConfig.getTrigErrorMonTool
def getTrigErrorMonTool(flags, name='TrigErrorMonTool')
Definition: TrigSteerMonitorConfig.py:78
python.TrigServicesConfig.getHltROBDataProviderSvc
def getHltROBDataProviderSvc(flags, name='ROBDataProviderSvc')
Definition: TrigServicesConfig.py:76
python.TrigSteerMonitorConfig.SchedulerMonSvcCfg
def SchedulerMonSvcCfg(flags, name='SchedulerMonSvc')
Definition: TrigSteerMonitorConfig.py:7
python.TriggerHistSvcConfig.TriggerHistSvcConfig
def TriggerHistSvcConfig(flags)
Definition: TriggerHistSvcConfig.py:17
Constants
some useful constants -------------------------------------------------—
python.IOVDbSvcConfig.addFolders
def addFolders(flags, folderStrings, detDb=None, className=None, extensible=False, tag=None, db=None, modifiers='')
Definition: IOVDbSvcConfig.py:72
TrigT1ResultByteStreamConfig.L1TriggerByteStreamEncoderCfg
def L1TriggerByteStreamEncoderCfg(flags)
Definition: TrigT1ResultByteStreamConfig.py:299
GenericMonitoringTool
Definition: GenericMonitoringTool.py:1
python.TrigServicesConfig.TrigServicesCfg
def TrigServicesCfg(flags)
Definition: TrigServicesConfig.py:175
python.PscDefaultFlags.defaultOnlineFlags
def defaultOnlineFlags()
Definition: PscDefaultFlags.py:28
python.TrigServicesConfig.getTrigCOOLUpdateHelper
def getTrigCOOLUpdateHelper(flags, name='TrigCOOLUpdateHelper')
Definition: TrigServicesConfig.py:49