ATLAS Offline Software
Loading...
Searching...
No Matches
TileLaserCalibAlgConfig.py
Go to the documentation of this file.
2# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3#
4
5from TileConfiguration.TileConfigFlags import TileRunType
6
7'''
8@file TileLaserCalibAlgConfig.py
9@brief Python configuration of TileLaserDefaultCalibTool tool for the Run III
10'''
11def TileLaserDefaulCalibToolCfg(flags, **kwargs):
12
13 ''' Function to configure TileLaserDefaultCalibTool tool'''
14
15 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
16 acc = ComponentAccumulator()
17
18 from TileConditions.TileCablingSvcConfig import TileCablingSvcCfg
19 acc.merge( TileCablingSvcCfg(flags) )
20
21 from TileConditions.TileInfoLoaderConfig import TileInfoLoaderCfg
22 acc.merge( TileInfoLoaderCfg(flags) )
23
24 from TileGeoModel.TileGMConfig import TileGMCfg
25 acc.merge(TileGMCfg( flags ))
26
27 from TileRecUtils.TileDQstatusConfig import TileDQstatusAlgCfg
28 acc.merge( TileDQstatusAlgCfg(flags) )
29
30 if 'TileBadChanTool' not in kwargs:
31 from TileConditions.TileBadChannelsConfig import TileBadChanToolCfg
32 badChanTool = acc.popToolsAndMerge( TileBadChanToolCfg(flags) )
33 kwargs['TileBadChanTool'] = badChanTool
34
35 if 'TileCondToolEmscale' not in kwargs:
36 from TileConditions.TileEMScaleConfig import TileCondToolEmscaleCfg
37 emScaleTool = acc.popToolsAndMerge( TileCondToolEmscaleCfg(flags) )
38 kwargs['TileCondToolEmscale'] = emScaleTool
39
40 if 'TileDCSTool' not in kwargs:
41 from TileConditions.TileDCSConfig import TileDCSToolCfg
42 kwargs['TileDCSTool'] = acc.popToolsAndMerge( TileDCSToolCfg(flags) )
43
44 from AthenaConfiguration.ComponentFactory import CompFactory
45 TileLaserDefalutCalibTool = CompFactory.TileLaserDefaultCalibTool
46
47 acc.setPrivateTools(TileLaserDefalutCalibTool(**kwargs))
48
49 return acc
50
51
52'''
53@brief Python configuration of TileLaserCalibAlg algorithm for the Run III
54'''
55def TileLaserCalibAlgCfg(flags, **kwargs):
56
57 ''' Function to configure TileLaserCalibAlg algorithm'''
58
59 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
60 acc = ComponentAccumulator()
61
62 if 'Tools' not in kwargs:
63 laserCalibTool = acc.popToolsAndMerge( TileLaserDefaulCalibToolCfg(flags) )
64 kwargs['Tools'] = [laserCalibTool]
65
66 from AthenaConfiguration.ComponentFactory import CompFactory
67 TileLaserCalibAlg = CompFactory.TileLaserCalibAlg
68
69 acc.addEventAlgo(TileLaserCalibAlg(**kwargs), primary=True)
70
71 return acc
72
73if __name__=='__main__':
74
75 # Setup logs
76 from AthenaCommon.Logging import log
77 from AthenaCommon.Constants import INFO
78 log.setLevel(INFO)
79
80 # Set the Athena configuration flags
81 from AthenaConfiguration.AllConfigFlags import initConfigFlags
82 from AthenaConfiguration.TestDefaults import defaultConditionsTags, defaultGeometryTags
83
84 inputDirectory = '/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TileByteStream/TileByteStream-02-00-00'
85 inputFile = 'data18_tilecomm.00363899.calibration_tile.daq.RAW._lb0000._TileREB-ROS._0005-200ev.data'
86
87 flags = initConfigFlags()
88 flags.Input.Files = [inputDirectory + '/' + inputFile]
89 flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN2
90 flags.IOVDb.GlobalTag = defaultConditionsTags.RUN2_DATA
91 flags.Tile.RunType = TileRunType.LAS
92 flags.Exec.MaxEvents = 3
93 flags.fillFromArgs()
94 flags.lock()
95
96 # Initialize configuration object, add accumulator, merge, and run.
97 from AthenaConfiguration.MainServicesConfig import MainServicesCfg
98 cfg = MainServicesCfg(flags)
99
100 from TileByteStream.TileByteStreamConfig import TileRawDataReadingCfg
101 cfg.merge( TileRawDataReadingCfg(flags) )
102
103 from TileRecUtils.TileRawChannelMakerConfig import TileRawChannelMakerCfg
104 cfg.merge( TileRawChannelMakerCfg(flags) )
105
106 cfg.merge( TileLaserCalibAlgCfg(flags) )
107
108 cfg.printConfig(withDetails = True, summariseProps = True)
109 flags.dump()
110
111 cfg.store( open('TileLaserCalibAlg.pkl','wb') )
112
113 sc = cfg.run()
114
115 import sys
116 # Success should be 0
117 sys.exit(not sc.isSuccess())
TileLaserDefaulCalibToolCfg(flags, **kwargs)