ATLAS Offline Software
Loading...
Searching...
No Matches
TileL2Config.py
Go to the documentation of this file.
1# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2
3"""Define methods to construct configured Tile L2 builder tool and algorithm"""
4
5from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
6from AthenaConfiguration.ComponentFactory import CompFactory
7from AthenaConfiguration.Enums import ProductionStep
8
9
10def TileL2BuilderCfg(flags, **kwargs):
11 """Return component accumulator with configured private Tile L2 builder tool
12
13 Arguments:
14 flags -- Athena configuration flags
15 """
16
17 kwargs.setdefault('name', 'TileL2Builder')
18
19 rawChannelContainer = 'TileRawChannelCnt'
20 if (flags.Input.isMC or flags.Overlay.DataOverlay):
21 rawChannelContainer = flags.Tile.RawChannelContainer
22 kwargs.setdefault('TileRawChannelContainer', rawChannelContainer)
23
24 acc = ComponentAccumulator()
25
26 from TileGeoModel.TileGMConfig import TileGMCfg
27 acc.merge( TileGMCfg(flags) )
28
29 from TileConditions.TileCablingSvcConfig import TileCablingSvcCfg
30 acc.merge( TileCablingSvcCfg(flags) )
31
32 from TileConditions.TileBadChannelsConfig import TileBadChannelsCondAlgCfg
33 acc.merge( TileBadChannelsCondAlgCfg(flags) )
34
35 from TileConditions.TileEMScaleConfig import TileEMScaleCondAlgCfg
36 acc.merge( TileEMScaleCondAlgCfg(flags) )
37
38 TileL2Builder=CompFactory.TileL2Builder
39 acc.setPrivateTools( TileL2Builder(**kwargs) )
40
41 return acc
42
43
44
45def TileRawChannelToL2Cfg(flags, **kwargs):
46 """Return component accumulator with configured Tile raw channels to L2 algorithm
47
48 Arguments:
49 flags -- Athena configuration flags
50 """
51
52 kwargs.setdefault('name', 'TileRawChannelToL2')
53
54 if flags.Common.ProductionStep == ProductionStep.PileUpPresampling:
55 kwargs.setdefault('TileL2Container', flags.Overlay.BkgPrefix + 'TileL2Cnt')
56 else:
57 kwargs.setdefault('TileL2Container', 'TileL2Cnt')
58
59 acc = ComponentAccumulator()
60
61 if 'TileL2Builder' not in kwargs:
62 l2Builder = acc.popToolsAndMerge( TileL2BuilderCfg(flags) )
63 kwargs['TileL2Builder'] = l2Builder
64
65
66 TileRawChannelToL2=CompFactory.TileRawChannelToL2
67 acc.addEventAlgo( TileRawChannelToL2(**kwargs), primary = True )
68
69 return acc
70
71
72def TileRawChannelToL2OutputCfg(flags, streamName = 'RDO', **kwargs):
73 """Return component accumulator with configured Tile raw channels to L2 algorithm with Output stream
74
75 Arguments:
76 flags -- Athena configuration flags
77 streamName -- name of output stream. Defaults to RDO.
78 """
79
80 acc = TileRawChannelToL2Cfg(flags, **kwargs)
81 tileRawChanToL2Alg = acc.getPrimary()
82
83 if 'TileL2Container' in tileRawChanToL2Alg._properties:
84 tileL2Container = tileRawChanToL2Alg._properties['TileL2Container']
85 else:
86 tileL2Container = tileRawChanToL2Alg._descriptors['TileL2Container'].default
87
88 if flags.Output.doWriteRDO:
89 from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
90 acc.merge( OutputStreamCfg(flags, streamName, [f'TileL2Container#{tileL2Container}']) )
91
92 return acc
93
94
95if __name__ == "__main__":
96
97 from AthenaConfiguration.AllConfigFlags import initConfigFlags
98 from AthenaConfiguration.TestDefaults import defaultConditionsTags, defaultGeometryTags, defaultTestFiles
99 from AthenaCommon.Logging import log
100 from AthenaCommon.Constants import DEBUG
101
102 # Test setup
103 log.setLevel(DEBUG)
104
105 flags = initConfigFlags()
106 flags.Input.Files = defaultTestFiles.RAW_RUN2
107 flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN2
108 flags.IOVDb.GlobalTag = defaultConditionsTags.RUN2_DATA
109 flags.fillFromArgs()
110 flags.Output.ESDFileName = "myESD.pool.root"
111 flags.lock()
112
113 # Construct our accumulator to run
114 from AthenaConfiguration.MainServicesConfig import MainServicesCfg
115 acc = MainServicesCfg(flags)
116
117 from TileByteStream.TileByteStreamConfig import TileRawDataReadingCfg
118 acc.merge( TileRawDataReadingCfg(flags, readDigits=False, readMuRcv=False) )
119
120 acc.merge( TileRawChannelToL2OutputCfg(flags, streamName = 'ESD') )
121 acc.getService('StoreGateSvc').Dump = True
122
123 flags.dump()
124 acc.printConfig(withDetails = True, summariseProps = True)
125 acc.store( open('TileL2.pkl','wb') )
126
127
128 sc = acc.run(maxEvents=3)
129
130 # Success should be 0
131 import sys
132 sys.exit(not sc.isSuccess())
This class emulates the algorithms processed at the TileCal ROD DSP level to contribute to the LVL2 t...
TileRawChannelToL2OutputCfg(flags, streamName='RDO', **kwargs)
TileL2BuilderCfg(flags, **kwargs)
TileRawChannelToL2Cfg(flags, **kwargs)