ATLAS Offline Software
Loading...
Searching...
No Matches
TileJiveXMLConfig.py
Go to the documentation of this file.
2# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3#
4
5from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
6from AthenaConfiguration.ComponentFactory import CompFactory
7from AthenaConfiguration.Enums import Format
8import os
9
10'''
11@file TileAtlantisConfig.py
12@brief Python configuration of Atlantis algorithm for Tile for the Run III
13'''
14
15
17 ''' Function to get Tile digits container to be used in Atlantis.'''
18
19 tileDigitsContainer = "TileDigitsCnt"
20
21 if flags.Input.Format is Format.POOL:
22 if "TileDigitsCnt" in flags.Input.Collections:
23 tileDigitsContainer = "TileDigitsCnt"
24 elif "TileDigitsFlt" in flags.Input.Collections:
25 tileDigitsContainer = "TileDigitsFlt"
26
27 return tileDigitsContainer
28
29
31 ''' Function to get Tile raw channel container to be used in Atlantis.'''
32
33 tileRawChannelContainer = ""
34
35 if flags.Input.Format is Format.BS and flags.Tile.readDigits:
36 if flags.Tile.doOpt2:
37 tileRawChannelContainer = 'TileRawChannelOpt2'
38 elif flags.Tile.doOptATLAS:
39 tileRawChannelContainer = 'TileRawChannelFixed'
40 elif flags.Tile.doFitCOOL:
41 tileRawChannelContainer = 'TileRawChannelFitCool'
42 elif flags.Tile.doFit:
43 tileRawChannelContainer = 'TileRawChannelFit'
44 else:
45 if "TileRawChannelOpt2" in flags.Input.Collections:
46 tileRawChannelContainer = 'TileRawChannelOpt2'
47 elif "TileRawChannelFitCool" in flags.Input.Collections:
48 tileRawChannelContainer = 'TileRawChannelFitCool'
49 elif "TileRawChannelFit" in flags.Input.Collections:
50 tileRawChannelContainer = 'TileRawChannelFit'
51 elif "TileRawChannelCnt" in flags.Input.Collections:
52 tileRawChannelContainer = 'TileRawChannelCnt'
53
54 return tileRawChannelContainer
55
56
57def TileAlgoJiveXMLCfg(flags, TileDigitsContainer=None, TileRawChannelContainer=None,
58 CaloClusterContainer='TileTopoCluster', **kwargs):
59 """
60 Function to configure AlgoJiveXML algorithm for Tile.
61
62 Arguments:
63 TileDigitsContainer -- name of Tile digits container (default: None).
64 In the case of None it will be autoconfigured.
65 In the case of empty string it will not be used.
66 TileRawChannelContainer -- name of Tile raw channel container (default: None).
67 In the case of None it will be autoconfigured.
68 In the case of empty string it will not be used.
69 CaloClusterContainer -- name of Calo cluster container (default: TileTopoCluster).
70 In the case of empty string it will not be used.
71 """
72
73 if TileDigitsContainer is None:
74 digitsContainer = getTileDigitsContainer(flags)
75 else:
76 digitsContainer = TileDigitsContainer
77
78 if TileRawChannelContainer is None:
79 rawChannelContainer = getTileRawChannelContainer(flags)
80 else:
81 rawChannelContainer = TileRawChannelContainer
82
83 useDigits = digitsContainer != ""
84 useRawChannels = rawChannelContainer != ""
85 useClusters = CaloClusterContainer != ""
86
87 from AthenaCommon.Logging import logging
88 msg = logging.getLogger('TileAlgoJiveXMLCfg')
89
90 if useDigits:
91 msg.info(f'Use TileDigitsContainer [{digitsContainer}]')
92 else:
93 msg.info('TileDigitsContainer is not configured => no use of digits')
94
95 if useRawChannels:
96 msg.info(f'Use TileRawChannelContainer [{rawChannelContainer}] for detailed information')
97 else:
98 msg.info('TileRawChannelContainer is not configured => no detailed cell information')
99
100 if useClusters:
101 msg.info(f'Use CaloClusterContainer [{CaloClusterContainer}]')
102 else:
103 msg.info('CaloClusterContainer is not configured => no clusters information')
104
105 acc = ComponentAccumulator()
106
107 from TileGeoModel.TileGMConfig import TileGMCfg
108 acc.merge(TileGMCfg(flags))
109
110 from LArGeoAlgsNV.LArGMConfig import LArGMCfg
111 acc.merge(LArGMCfg(flags))
112
113 from TileConditions.TileCablingSvcConfig import TileCablingSvcCfg
114 acc.merge( TileCablingSvcCfg(flags) )
115
116 from TileConditions.TileInfoLoaderConfig import TileInfoLoaderCfg
117 acc.merge( TileInfoLoaderCfg(flags) )
118
119 from TileConditions.TileBadChannelsConfig import TileBadChannelsCondAlgCfg
120 acc.merge( TileBadChannelsCondAlgCfg(flags) )
121
122 from TileConditions.TileEMScaleConfig import TileEMScaleCondAlgCfg
123 acc.merge( TileEMScaleCondAlgCfg(flags) )
124
125 from TileConditions.TileTimingConfig import TileTimingCondAlgCfg
126 acc.merge( TileTimingCondAlgCfg(flags) )
127
128 if useClusters:
129 from TileMonitoring.TileTopoClusterConfig import TileTopoClusterCfg
130 acc.merge( TileTopoClusterCfg(flags) )
131
132 dataRetrieverTools = [
133 CompFactory.JiveXML.CaloTileRetriever(
134 name="TileRetriever",
135 TileDigitsContainer=digitsContainer,
136 TileRawChannelContainer=rawChannelContainer,
137 DoTileCellDetails=useRawChannels,
138 DoTileDigit=useDigits,
139 DoBadTile=False,
140 CellThreshold=50.0
141 )
142 ]
143
144 dataRetrieverTools += [
145 CompFactory.JiveXML.CaloMBTSRetriever(
146 name="MBTSRetriever",
147 TileDigitsContainer=digitsContainer,
148 TileRawChannelContainer=rawChannelContainer,
149 DoMBTSDigits=useDigits,
150 DoMBTSCellDetails=useRawChannels,
151 MBTSThreshold=0.05
152 )
153 ]
154
155 if useClusters:
156 dataRetrieverTools += [
157 CompFactory.JiveXML.CaloClusterRetriever(
158 name="TileClusterRetriever",
159 FavouriteClusterCollection="TileTopoCluster",
160 OtherClusterCollections=["TileTopoCluster"]
161 )
162 ]
163
164 for dataRetrieverTool in dataRetrieverTools:
165 acc.addPublicTool(dataRetrieverTool)
166
167 kwargs.setdefault("AtlasRelease", os.environ.get("AtlasVersion", "Unknown"))
168 kwargs.setdefault("WriteToFile", True)
169 kwargs.setdefault("OnlineMode", False)
170 kwargs.setdefault("StreamToServerTool", None)
171
172 kwargs.setdefault("WriteGeometry", False)
173 kwargs.setdefault("DataRetrieverTools", dataRetrieverTools)
174
175 AlgoJiveXML = CompFactory.JiveXML.AlgoJiveXML
176 acc.addEventAlgo(AlgoJiveXML(name="AlgoJiveXML", **kwargs), primary=True)
177
178 return acc
179
180
181if __name__ == '__main__':
182
183 # Setup logs
184 from AthenaCommon.Logging import log
185 from AthenaCommon.Constants import INFO
186 log.setLevel(INFO)
187
188 # Set the Athena configuration flags
189 from AthenaConfiguration.AllConfigFlags import initConfigFlags
190 from AthenaConfiguration.TestDefaults import defaultTestFiles
191 flags = initConfigFlags()
192 flags.Input.Files = defaultTestFiles.ESD
193 flags.Exec.MaxEvents = 3
194 flags.fillFromArgs()
195 flags.lock()
196
197 # Initialize configuration object, add accumulator, merge, and run.
198 from AthenaConfiguration.MainServicesConfig import MainServicesCfg
199 from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
200 cfg = MainServicesCfg(flags)
201 cfg.merge(PoolReadCfg(flags))
202
203 cfg.merge( TileAlgoJiveXMLCfg(flags) )
204
205 cfg.printConfig(withDetails=True, summariseProps=True)
206 flags.dump()
207
208 sc = cfg.run()
209
210 import sys
211 # Success should be 0
212 sys.exit(not sc.isSuccess())
TileAlgoJiveXMLCfg(flags, TileDigitsContainer=None, TileRawChannelContainer=None, CaloClusterContainer='TileTopoCluster', **kwargs)