ATLAS Offline Software
Loading...
Searching...
No Matches
TileTowerMonitorAlgorithm.py
Go to the documentation of this file.
2# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3#
4'''
5@file TileTowerMonitorAlgorithm.py
6@brief Python configuration of TileTowerMonitorAlgorithm algorithm for the Run III
7'''
8from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
9from AthenaConfiguration.ComponentFactory import CompFactory
10
11def TileTowerMonitoringConfig(flags, **kwargs):
12
13 ''' Function to configure TileTowerMonitorAlgorithm algorithm in the monitoring system.'''
14
15 # Define one top-level monitoring algorithm. The new configuration
16 # framework uses a component accumulator.
17
18 result = ComponentAccumulator()
19
20 from TileMonitoring.TileTowerBuilderConfig import TileTowerBuilderAlgCfg
21 result.merge(TileTowerBuilderAlgCfg(flags))
22
23 # The following class will make a sequence, configure algorithms, and link
24 # them to GenericMonitoringTools
25 from AthenaMonitoring import AthMonitorCfgHelper
26 helper = AthMonitorCfgHelper(flags,'TileTowerMonitoring')
27
28 # Adding an TileTowerMonitorAlgorithm algorithm to the helper
29 TileTowerMonitorAlgorithm=CompFactory.TileTowerMonitorAlgorithm
30 tileTowerMonAlg = helper.addAlgorithm(TileTowerMonitorAlgorithm, 'TileTowerMonAlg')
31
32 tileTowerMonAlg.TriggerChain = ''
33
34 # L1Trigger Type Bits:
35 # bit0_RNDM, bit1_ZeroBias, bit2_L1Cal, bit3_Muon,
36 # bit4_RPC, bit5_FTK, bit6_CTP, bit7_Calib, AnyPhysTrig
37 kwargs.setdefault('fillHistogramsForL1Triggers', ['AnyPhysTrig', 'bit7_Calib'])
38 l1Triggers = kwargs['fillHistogramsForL1Triggers']
39
40 for k, v in kwargs.items():
41 setattr(tileTowerMonAlg, k, v)
42
43 run = str(flags.Input.RunNumbers[0])
44
45 # 1) Configure histogram with TileTowerMonAlg algorithm execution time
46 executeTimeGroup = helper.addGroup(tileTowerMonAlg, 'TileTowerMonExecuteTime', 'Tile/')
47 executeTimeGroup.defineHistogram('TIME_execute', path = 'Tower', type='TH1F',
48 title = 'Time for execute TileTowerMonAlg algorithm;time [#mus]',
49 xbins = 100, xmin = 0, xmax = 100000)
50
51
52 from TileCalibBlobObjs.Classes import TileCalibUtils as Tile
53 from TileMonitoring.TileMonitoringCfgHelper import addTileEtaPhiMapsArray
54
55 # ) Configure histograms with most energetic Tile tower position
56 addTileEtaPhiMapsArray(helper, tileTowerMonAlg, name = 'TileTowerEtaPhi', type='TH2D',
57 title = 'Most energetic Tile Tower position', path = 'Tile/Tower',
58 run = run, triggers = l1Triggers, perSample = False)
59
60 # ) Configure histograms with position correlation of Tile tower opposite to most energetic tower
61 addTileEtaPhiMapsArray(helper, tileTowerMonAlg, name = 'TileTowerEtaPhiDiff', type='TH2D',
62 title = 'Position correlation of Tile Tower opposite to most energetic tower',
63 path = 'Tile/Tower', run = run, triggers = l1Triggers, perSample = False,
64 etaTitle = '#Delta #eta', etabins = 41, etamin = -2.05, etamax = 2.05,
65 phiTitle = '#Delta #phi', phibins = Tile.MAX_DRAWER + 1, phimin = -0.05, phimax = 6.45)
66
67
68 from TileMonitoring.TileMonitoringCfgHelper import addTile1DHistogramsArray
69
70 # ) Configure histograms with Et in most energetic Tile tower per partition
71 addTile1DHistogramsArray(helper, tileTowerMonAlg, name = 'TileTowerEt', xvalue = 'Et',
72 title = 'E_{T} [MeV] in most energetic Tile Tower', path = 'Tile/Tower',
73 xbins = 80, xmin = 0., xmax = 20000., type = 'TH1D', run = run,
74 triggers = l1Triggers, perPartition = True, perSample = False,
75 perGain = False, subDirectory = True, allPartitions = True)
76
77 # ) Configure histograms with all Tile towers energy per partition
78 addTile1DHistogramsArray(helper, tileTowerMonAlg, name = 'TileAllTowerEnergy', xvalue = 'energy',
79 title = 'All Tile Towers Energy [MeV]', path = 'Tile/Tower',
80 xbins = 80, xmin = 0., xmax = 20000., type = 'TH1D', run = run,
81 triggers = l1Triggers, perPartition = True, perSample = False,
82 perGain = False, subDirectory = True, allPartitions = True)
83
84
85 accumalator = helper.result()
86 result.merge(accumalator)
87 return result
88
89if __name__=='__main__':
90
91 # Setup logs
92 from AthenaCommon.Logging import log
93 from AthenaCommon.Constants import INFO
94 log.setLevel(INFO)
95
96 # Set the Athena configuration flags
97 from AthenaConfiguration.AllConfigFlags import initConfigFlags
98 from AthenaConfiguration.TestDefaults import defaultTestFiles
99 flags = initConfigFlags()
100 flags.Input.Files = defaultTestFiles.ESD
101 flags.Output.HISTFileName = 'TileTowerMonitorOutput.root'
102 flags.DQ.useTrigger = False
103 flags.DQ.enableLumiAccess = False
104 flags.Exec.MaxEvents = 3
105 flags.fillFromArgs()
106 flags.lock()
107
108 # Initialize configuration object, add accumulator, merge, and run.
109 from AthenaConfiguration.MainServicesConfig import MainServicesCfg
110 from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
111 cfg = MainServicesCfg(flags)
112 cfg.merge(PoolReadCfg(flags))
113
114 l1Triggers = ['bit0_RNDM', 'bit1_ZeroBias', 'bit2_L1Cal', 'bit3_Muon',
115 'bit4_RPC', 'bit5_FTK', 'bit6_CTP', 'bit7_Calib', 'AnyPhysTrig']
116
117 cfg.merge( TileTowerMonitoringConfig(flags,
118 fillHistogramsForL1Triggers = l1Triggers) )
119
120 cfg.printConfig(withDetails = True, summariseProps = True)
121 flags.dump()
122
123 cfg.store( open('TileTowerMonitorAlgorithm.pkl','wb') )
124
125 sc = cfg.run()
126
127 import sys
128 # Success should be 0
129 sys.exit(not sc.isSuccess())