ATLAS Offline Software
Loading...
Searching...
No Matches
TileRawChannelNoiseMonitorAlgorithm.py
Go to the documentation of this file.
2# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3#
4'''
5@file TileRawChannelNoiseMonitorAlgorithm.py
6@brief Python configuration of TileRawChannelNoiseMonitorAlgorithm algorithm for the Run III
7'''
9
10 ''' Function to configure TileRawChannelNoiseMonitorAlgorithm algorithm in the monitoring system.'''
11
12 # Define one top-level monitoring algorithm. The new configuration
13 # framework uses a component accumulator.
14 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
15 result = ComponentAccumulator()
16
17 from TileRecUtils.TileDQstatusConfig import TileDQstatusAlgCfg
18 result.merge( TileDQstatusAlgCfg(flags) )
19
20 from TileGeoModel.TileGMConfig import TileGMCfg
21 result.merge(TileGMCfg(flags))
22
23 from TileConditions.TileCablingSvcConfig import TileCablingSvcCfg
24 result.merge( TileCablingSvcCfg(flags) )
25
26 from TileConditions.TileBadChannelsConfig import TileBadChannelsCondAlgCfg
27 result.merge( TileBadChannelsCondAlgCfg(flags, **kwargs) )
28
29 from TileConditions.TileEMScaleConfig import TileEMScaleCondAlgCfg
30 result.merge( TileEMScaleCondAlgCfg(flags) )
31
32 kwargs.setdefault('CheckDCS', flags.Tile.useDCS)
33 if kwargs['CheckDCS']:
34 from TileConditions.TileDCSConfig import TileDCSCondAlgCfg
35 result.merge( TileDCSCondAlgCfg(flags) )
36
37 #kwargs.setdefault('TriggerChain', 'HLT_noalg_cosmiccalo_L1RD1_EMPTY') #FIXME
38 kwargs.setdefault('TriggerTypes', [0x82])
39 kwargs.setdefault('Gain', 1)
40 kwargs.setdefault('TileRawChannelContainer', flags.Tile.RawChannelContainer)
41 kwargs.setdefault('ignoreDisconnectedChannels', flags.Common.isOnline)
42
43 # The following class will make a sequence, configure algorithms, and link
44 # them to GenericMonitoringTools
45 from AthenaMonitoring import AthMonitorCfgHelper
46 helper = AthMonitorCfgHelper(flags,'TileRawChanNoiseMonitoring')
47
48 # Adding an TileCellMonitorAlgorithm algorithm to the helper
49 from AthenaConfiguration.ComponentFactory import CompFactory
50 TileRawChannelNoiseMonitorAlgorithm = CompFactory.TileRawChannelNoiseMonitorAlgorithm
51 tileRawChanNoiseMonAlg = helper.addAlgorithm(TileRawChannelNoiseMonitorAlgorithm, 'TileRawChanNoiseMonAlg')
52
53 for k, v in kwargs.items():
54 setattr(tileRawChanNoiseMonAlg, k, v)
55
56 run = str(flags.Input.RunNumbers[0])
57
58 # 1) Configure histogram with TileRawChanNoiseMonAlg algorithm execution time
59 executeTimeGroup = helper.addGroup(tileRawChanNoiseMonAlg, 'TileRawChanNoiseMonExecuteTime', 'Tile/')
60 executeTimeGroup.defineHistogram('TIME_execute', path = 'RawChannelNoise', type='TH1F',
61 title = 'Time for execute TileRawChanNoiseMonAlg algorithm;time [#mus]',
62 xbins = 100, xmin = 0, xmax = 100000)
63
64
65 from TileCalibBlobObjs.Classes import TileCalibUtils as Tile
66
67 from TileMonitoring.TileMonitoringCfgHelper import getPartitionName, getCellName, getGainName
68
69 # 2) Configure histograms with Tile raw channel amplitude per channel
70 gainName = getGainName(kwargs['Gain'])
71 dimensions = [int(Tile.MAX_ROS) - 1, int(Tile.MAX_DRAWER), int(Tile.MAX_CHAN)]
72 chanAmpArray = helper.addArray(dimensions, tileRawChanNoiseMonAlg,
73 'TileRawChannelNoise', topPath = 'Tile/RawChannelNoise')
74 for postfix, tool in chanAmpArray.Tools.items():
75 ros, module, channel = [int(x) for x in postfix.split('_')[1:]]
76
77 partition = getPartitionName(ros + 1)
78 moduleName = Tile.getDrawerString(ros + 1, module)
79 cellName = getCellName(partition, channel)
80
81 title = 'Run %s %s: Tile cell %s / channel %s amplitude (%s);Amplitude [ADC]'
82 title = title % (run, moduleName, cellName, str(channel), gainName)
83 name = 'amplitude;TileRawChannelNoise_%s_%s_ch_%s_%s' % (moduleName, cellName, str(channel), gainName)
84 fullPath = '{}/{}'.format(partition, moduleName)
85
86 tool.defineHistogram(name, title = title, path = fullPath, type = 'TH1F',
87 xbins = 81, xmin = -20.25, xmax = 20.25)
88
89 accumalator = helper.result()
90 result.merge(accumalator)
91 return result
92
93if __name__=='__main__':
94
95 # Setup logs
96 from AthenaCommon.Logging import log
97 from AthenaCommon.Constants import INFO
98 log.setLevel(INFO)
99
100 # Set the Athena configuration flags
101 from AthenaConfiguration.AllConfigFlags import initConfigFlags
102 from AthenaConfiguration.TestDefaults import defaultGeometryTags, defaultConditionsTags
103 flags = initConfigFlags()
104 flags.Input.Files = ['/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TileRecEx/data24_13p6TeV.00485506.physics_CosmicCalo.merge.RAW._lb0202._SFO-ALL.TT130.10_events._0001.1']
105 flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN3
106 flags.IOVDb.GlobalTag = defaultConditionsTags.RUN3_DATA
107 flags.Output.HISTFileName = 'TileRawChannelNoiseMonitorOutput.root'
108 flags.DQ.useTrigger = False
109 flags.DQ.enableLumiAccess = False
110 flags.Exec.MaxEvents = 3
111 flags.fillFromArgs()
112 flags.lock()
113
114 # Initialize configuration object, add accumulator, merge, and run.
115 from AthenaConfiguration.MainServicesConfig import MainServicesCfg
116 cfg = MainServicesCfg(flags)
117
118 from TileByteStream.TileByteStreamConfig import TileRawDataReadingCfg
119 cfg.merge( TileRawDataReadingCfg(flags, readMuRcv=False) )
120
121 from TileRecUtils.TileRawChannelMakerConfig import TileRawChannelMakerCfg
122 cfg.merge( TileRawChannelMakerCfg(flags) )
123
124 cfg.merge( TileRawChannelNoiseMonitoringConfig(flags) )
125
126 cfg.printConfig(withDetails = True, summariseProps = True)
127 flags.dump()
128
129 cfg.store( open('TileRawChannelNoiseMonitorAlgorithm.pkl','wb') )
130
131 sc = cfg.run()
132
133 import sys
134 # Success should be 0
135 sys.exit(not sc.isSuccess())