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