ATLAS Offline Software
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 
5 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
6 from AthenaConfiguration.ComponentFactory import CompFactory
7 from AthenaConfiguration.Enums import ProductionStep
8 
9 
10 def 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 
45 def 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 
72 def 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 
95 if __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())
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
python.OutputStreamConfig.OutputStreamCfg
def OutputStreamCfg(flags, streamName, ItemList=[], MetadataItemList=[], disableEventTag=False, trigNavThinningSvc=None, takeItemsFromInput=False, extendProvenanceRecord=True, AcceptAlgs=[], HelperTools=[])
Definition: OutputStreamConfig.py:12
TileL2Config.TileRawChannelToL2Cfg
def TileRawChannelToL2Cfg(flags, **kwargs)
Definition: TileL2Config.py:45
TileL2Config.TileL2BuilderCfg
def TileL2BuilderCfg(flags, **kwargs)
Definition: TileL2Config.py:10
TileL2Config.TileRawChannelToL2OutputCfg
def TileRawChannelToL2OutputCfg(flags, streamName='RDO', **kwargs)
Definition: TileL2Config.py:72
python.TileBadChannelsConfig.TileBadChannelsCondAlgCfg
def TileBadChannelsCondAlgCfg(flags, **kwargs)
Definition: TileBadChannelsConfig.py:10
python.MainServicesConfig.MainServicesCfg
def MainServicesCfg(flags, LoopMgr='AthenaEventLoopMgr')
Definition: MainServicesConfig.py:256
Constants
some useful constants -------------------------------------------------—
python.TileEMScaleConfig.TileEMScaleCondAlgCfg
def TileEMScaleCondAlgCfg(flags, **kwargs)
Definition: TileEMScaleConfig.py:10
Trk::open
@ open
Definition: BinningType.h:40
TileL2Builder
Definition: TileL2Builder.h:44
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19
TileByteStreamConfig.TileRawDataReadingCfg
def TileRawDataReadingCfg(flags, readDigits=True, readRawChannel=True, readMuRcv=None, readMuRcvDigits=False, readMuRcvRawCh=False, readBeamElem=None, readLaserObj=None, readDigitsFlx=False, readL2=False, stateless=False, **kwargs)
Definition: TileByteStreamConfig.py:87
TileRawChannelToL2
This class emulates the algorithms processed at the TileCal ROD DSP level to contribute to the LVL2 t...
Definition: TileRawChannelToL2.h:50
python.TileCablingSvcConfig.TileCablingSvcCfg
def TileCablingSvcCfg(flags)
Definition: TileCablingSvcConfig.py:11
TileGMConfig.TileGMCfg
def TileGMCfg(flags)
Definition: TileGMConfig.py:7