ATLAS Offline Software
TileInfoLoaderConfig.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
2 
3 """Define method to construct configured Tile info loader service"""
4 
5 
6 from AthenaConfiguration.ComponentFactory import CompFactory
7 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
8 from AthenaConfiguration.AccumulatorCache import AccumulatorCache
9 
10 @AccumulatorCache
11 def TileInfoLoaderCfg(flags, **kwargs):
12  """Return component accumulator with configured Tile info loader service
13 
14  Arguments:
15  flags -- Athena configuration flags
16  """
17 
18  from AthenaCommon.Logging import logging
19  msg = logging.getLogger('TileInfoLoaderCfg')
20 
21  from TileConditions.TileCablingSvcConfig import TileCablingSvcCfg
22  acc = ComponentAccumulator()
23  acc.merge (TileCablingSvcCfg(flags))
24 
25  kwargs.setdefault('LoadWienerFilterWeights', flags.Tile.doWiener)
26 
27  if 'NoiseScaleIndex' not in kwargs:
28  if flags.Tile.doOpt2 and not flags.Tile.doOptATLAS:
29  msg.info("Adjusting TileInfo to return cell noise for Opt.Filter with iterations")
30  kwargs['NoiseScaleIndex'] = 2 # Noise for Optimal Filter with iterations
31  else:
32  msg.info("Adjusting TileInfo to return cell noise for Opt.Filter without iterations")
33  kwargs['NoiseScaleIndex'] = 1 # Noise for Optimal Filter without iterations
34 
35  kwargs.setdefault('TileNoise', flags.Digitization.DoCaloNoise)
36  if kwargs['TileNoise']:
37  msg.info("Switching ON noise in Tile Digitization" )
38  else:
39  msg.info("Switching OFF noise in Tile Digitization" )
40 
41 
42  TileInfoLoader=CompFactory.TileInfoLoader
43  acc.addService(TileInfoLoader(**kwargs), primary = True, create=True)
44 
45  return acc
46 
47 
48 if __name__ == "__main__":
49 
50  from AthenaConfiguration.AllConfigFlags import initConfigFlags
51  from AthenaConfiguration.TestDefaults import defaultTestFiles
52  from AthenaCommon.Logging import log
53  from AthenaCommon.Constants import DEBUG
54 
55  # Test setup
56  log.setLevel(DEBUG)
57 
58  flags = initConfigFlags()
59  flags.Input.Files = defaultTestFiles.RAW_RUN2
60  flags.lock()
61 
63  acc.merge( TileInfoLoaderCfg(flags) )
64 
65  acc.printConfig(withDetails = True, summariseProps = True)
66  print(acc.getService('TileInfoLoader'))
67  acc.store( open('TileInfoLoader.pkl','wb') )
68 
69  print('All OK')
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
TileInfoLoader
Definition: TileInfoLoader.h:53
python.TileInfoLoaderConfig.TileInfoLoaderCfg
def TileInfoLoaderCfg(flags, **kwargs)
Definition: TileInfoLoaderConfig.py:11
Constants
some useful constants -------------------------------------------------—
print
void print(char *figname, TCanvas *c1)
Definition: TRTCalib_StrawStatusPlots.cxx:26
Trk::open
@ open
Definition: BinningType.h:40
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19
python.TileCablingSvcConfig.TileCablingSvcCfg
def TileCablingSvcCfg(flags)
Definition: TileCablingSvcConfig.py:11