ATLAS Offline Software
MonitoredConfig.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
2 
3 from AthenaConfiguration.ComponentFactory import CompFactory
4 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
5 
6 def MonitoredCfg(flags):
7  result = ComponentAccumulator()
8  monAlg = CompFactory.MonitoredAlg('MonAlg')
9 
10  from AthenaMonitoringKernel.GenericMonitoringTool import GenericMonitoringTool
11  monTool = GenericMonitoringTool(flags, 'MonTool')
12 
13  #monTool.HistPath = 'MyGroup/MySubDir' # default is the parent name of MonTool
14  monTool.defineHistogram( 'nTracks', path='EXPERT', type='TH1F', title='Counts',
15  xbins=10, xmin=0, xmax=10 )
16  monTool.defineHistogram( 'eta', path='EXPERT', type='TH1F', title='#eta;;Entries',
17  xbins=30, xmin=-3, xmax=3 )
18  monTool.defineHistogram( 'AbsPhi', path='EXPERT', type='TH1F', title='|#phi|;;Entries',
19  xbins=10, xmin=0, xmax=3.15 )
20  monTool.defineHistogram( 'eta,AbsPhi', path='EXPERT', type='TH2F', title='#eta vs #phi',
21  xbins=15, xmin=-3, xmax=3, ybins=15, ymin=0, ymax=3.15 )
22  monTool.defineHistogram( 'TIME_execute', path='EXPERT', type='TH1F', title='Time for execute',
23  xbins=100, xmin=0, xmax=100 )
24 
25  monAlg.MonTool = monTool
26 
27  histSvc = CompFactory.THistSvc(Output = ["EXPERT DATAFILE='expert-monitoring.root', OPT='RECREATE'"])
28 
29  result.addEventAlgo(monAlg)
30  result.addService(histSvc)
31  return result
32 
33 
34 if __name__=="__main__":
35  from AthenaConfiguration.MainServicesConfig import MainServicesCfg
36  from AthenaConfiguration.AllConfigFlags import initConfigFlags
37  flags = initConfigFlags()
38  flags.Exec.MaxEvents = 10
39  cfg = MainServicesCfg(flags)
40  cfg.merge(MonitoredCfg(flags))
41  cfg.run()
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
GenericMonitoringTool
Definition: GenericMonitoringTool.h:53
MonitoredConfig.MonitoredCfg
def MonitoredCfg(flags)
Definition: MonitoredConfig.py:6
python.MainServicesConfig.MainServicesCfg
def MainServicesCfg(flags, LoopMgr='AthenaEventLoopMgr')
Definition: MainServicesConfig.py:260
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19