ATLAS Offline Software
Loading...
Searching...
No Matches
TileDigiNoiseMonitorAlgorithm.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 TileDigiNoiseMonitorAlgorithm.py
6@brief Python configuration of TileDigiNoiseMonitorAlgorithm algorithm for the Run III
7'''
8def TileDigiNoiseMonitoringConfig(flags, **kwargs):
9
10 ''' Function to configure TileDigiNoiseMonitorAlgorithm 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 kwargs.setdefault('ignoreDisconnectedChannels', flags.Common.isOnline)
30
31 kwargs.setdefault('fillPedestalDifference', True)
32 if kwargs['fillPedestalDifference'] and 'TileCondToolNoiseSample' not in kwargs:
33 from TileConditions.TileSampleNoiseConfig import TileCondToolNoiseSampleCfg
34 sampleNoiseTool = result.popToolsAndMerge( TileCondToolNoiseSampleCfg(flags) )
35 kwargs['TileCondToolNoiseSample'] = sampleNoiseTool
36
37 kwargs.setdefault('CheckDCS', flags.Tile.useDCS)
38 if kwargs['CheckDCS']:
39 from TileConditions.TileDCSConfig import TileDCSCondAlgCfg
40 result.merge( TileDCSCondAlgCfg(flags) )
41
42 #kwargs.setdefault('TriggerChain', 'HLT_noalg_cosmiccalo_L1RD1_EMPTY') #FIXME
43 kwargs.setdefault('TriggerTypes', [0x82])
44
45 # The following class will make a sequence, configure algorithms, and link
46 # them to GenericMonitoringTools
47 from AthenaMonitoring import AthMonitorCfgHelper
48 helper = AthMonitorCfgHelper(flags,'TileDigiNoiseMonitoring')
49
50 from AthenaConfiguration.Enums import Format
51 if flags.Input.Format is Format.POOL:
52 kwargs.setdefault('TileDigitsContainer', 'TileDigitsFlt')
53
54 # Adding an TileCellMonitorAlgorithm algorithm to the helper
55 from AthenaConfiguration.ComponentFactory import CompFactory
56 tileDigiNoiseMonAlg = helper.addAlgorithm(CompFactory.TileDigiNoiseMonitorAlgorithm, 'TileDigiNoiseMonAlg')
57
58 for k, v in kwargs.items():
59 setattr(tileDigiNoiseMonAlg, k, v)
60
61 run = str(flags.Input.RunNumbers[0])
62
63 # 1) Configure histogram with TileDigiNoiseMonAlg algorithm execution time
64 executeTimeGroup = helper.addGroup(tileDigiNoiseMonAlg, 'TileDigiNoiseMonExecuteTime', 'Tile/')
65 executeTimeGroup.defineHistogram('TIME_execute', path = 'DigiNoise', type='TH1F',
66 title = 'Time for execute TileDigiNoiseMonAlg algorithm;time [#mus]',
67 xbins = 100, xmin = 0, xmax = 100000)
68
69
70 from TileMonitoring.TileMonitoringCfgHelper import addTileModuleChannelMapsArray
71
72 # 1) Configure histograms with status of Tile channel pedestals per partition and gain
73 addTileModuleChannelMapsArray(helper, tileDigiNoiseMonAlg, name = 'TileDigiNoisePed',
74 title = 'Pedestal', path = 'Tile/DigiNoise', type = 'TProfile2D',
75 value = 'pedestal', run = run, perGain = True, separator = '_')
76
77 # 2) Configure histograms with status of Tile channel high frequency noise per partition and gain
78 addTileModuleChannelMapsArray(helper, tileDigiNoiseMonAlg, name = 'TileDigiNoiseHFN',
79 title = 'High frequency noise', path = 'Tile/DigiNoise', type = 'TProfile2D',
80 value = 'HFN', run = run, perGain = True, separator = '_')
81
82
83 accumalator = helper.result()
84 result.merge(accumalator)
85 return result
86
87if __name__=='__main__':
88
89 # Setup logs
90 from AthenaCommon.Logging import log
91 from AthenaCommon.Constants import INFO
92 log.setLevel(INFO)
93
94 # Set the Athena configuration flags
95 from AthenaConfiguration.AllConfigFlags import initConfigFlags
96 from AthenaConfiguration.TestDefaults import defaultGeometryTags, defaultConditionsTags
97 flags = initConfigFlags()
98 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']
99 flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN3
100 flags.IOVDb.GlobalTag = defaultConditionsTags.RUN3_DATA
101 flags.Output.HISTFileName = 'TileDigiNoiseMonitorOutput.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 cfg = MainServicesCfg(flags)
111
112 from TileByteStream.TileByteStreamConfig import TileRawDataReadingCfg
113 cfg.merge( TileRawDataReadingCfg(flags, readMuRcv=False) )
114
115 cfg.merge( TileDigiNoiseMonitoringConfig(flags, TriggerChain = '') )
116
117 cfg.printConfig(withDetails = True, summariseProps = True)
118 flags.dump()
119
120 cfg.store( open('TileDigiNoiseMonitorAlgorithm.pkl','wb') )
121
122 sc = cfg.run()
123
124 import sys
125 # Success should be 0
126 sys.exit(not sc.isSuccess())