ATLAS Offline Software
TileRawChannelBuilderMFConfig.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 MF raw channel builder tool"""
4 
5 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
6 from AthenaConfiguration.ComponentFactory import CompFactory
7 from TileConfiguration.TileConfigFlags import TileRunType
8 
9 def TileRawChannelBuilderMFCfg(flags, **kwargs):
10  """Return component accumulator with configured private Tile MF raw channel builder tool
11 
12  Arguments:
13  flags -- Athena configuration flags
14  """
15 
16  name = kwargs.pop('name', 'TileRawChannelBuilderMF')
17  kwargs.setdefault('TileRawChannelContainer', 'TileRawChannelMF')
18 
19  acc = ComponentAccumulator()
20 
21  if 'TileCondToolOfcOnFly' not in kwargs:
22  from TileConditions.TileOFCConfig import TileCondToolOfcCfg
23  ofcTool = acc.popToolsAndMerge( TileCondToolOfcCfg(flags) )
24  kwargs['TileCondToolOfcOnFly'] = ofcTool
25 
26  if flags.Tile.OfcFromCOOL and 'TileCondToolOfc' not in kwargs:
27  from TileConditions.TileOFCConfig import TileCondToolOfcCoolCfg
28  ofcCoolTool = acc.popToolsAndMerge( TileCondToolOfcCoolCfg(flags, OfcType = 'OF2') )
29  kwargs['TileCondToolOfc'] = ofcCoolTool
30 
31  if 'TileCondToolNoiseSample' not in kwargs:
32  from TileConditions.TileSampleNoiseConfig import TileCondToolNoiseSampleCfg
33  sampleNoiseTool = acc.popToolsAndMerge( TileCondToolNoiseSampleCfg(flags) )
34  kwargs['TileCondToolNoiseSample'] = sampleNoiseTool
35 
36  if flags.Tile.BestPhaseFromCOOL: # can't correct time and use best phase at the same time
37  kwargs['correctTime'] = False
38  else:
39  kwargs.setdefault('correctTime', flags.Tile.correctTime)
40 
41  kwargs.setdefault('BestPhase', flags.Tile.BestPhaseFromCOOL)
42  kwargs.setdefault('MaxIterations', 5) # iterative mode on
43  kwargs.setdefault('AmplitudeCorrection', False)
44  kwargs.setdefault('TimeFromCOF', False)
45 
46  if flags.Tile.correctTime and 'TileCondToolTiming' not in kwargs:
47  from TileConditions.TileTimingConfig import TileCondToolTimingCfg
48  timingTool = acc.popToolsAndMerge( TileCondToolTimingCfg(flags) )
49  kwargs['TileCondToolTiming'] = timingTool
50 
51  TileRawChannelBuilderMF=CompFactory.TileRawChannelBuilderMF
52  from TileRecUtils.TileRawChannelBuilderConfig import TileRawChannelBuilderCfg
53  rawChanBuilder = acc.popToolsAndMerge( TileRawChannelBuilderCfg(flags, name, TileRawChannelBuilderMF, **kwargs) )
54  acc.setPrivateTools(rawChanBuilder)
55 
56  return acc
57 
58 
59 if __name__ == "__main__":
60 
61  from AthenaConfiguration.AllConfigFlags import initConfigFlags
62  from AthenaConfiguration.TestDefaults import defaultGeometryTags, defaultTestFiles
63  from AthenaCommon.Logging import log
64  from AthenaCommon.Constants import DEBUG
65 
66  # Test setup
67  log.setLevel(DEBUG)
68 
69  flags = initConfigFlags()
70  flags.Input.Files = defaultTestFiles.RAW_RUN2
71  flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN2
72  flags.Tile.RunType = TileRunType.PHY
73  flags.Tile.NoiseFilter = 1
74  flags.lock()
75 
76  flags.dump()
77 
79 
80  #printing Configurables isn't reliable with GaudiConfig2
81  acc.popToolsAndMerge( TileRawChannelBuilderMFCfg(flags) )
82 
83  acc.printConfig(withDetails = True, summariseProps = True)
84  acc.store( open('TileRawChannelBuilderMF.pkl','wb') )
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
python.TileSampleNoiseConfig.TileCondToolNoiseSampleCfg
def TileCondToolNoiseSampleCfg(flags, **kwargs)
Definition: TileSampleNoiseConfig.py:69
python.TileTimingConfig.TileCondToolTimingCfg
def TileCondToolTimingCfg(flags, **kwargs)
Definition: TileTimingConfig.py:77
python.TileOFCConfig.TileCondToolOfcCoolCfg
def TileCondToolOfcCoolCfg(flags, **kwargs)
Definition: TileOFCConfig.py:66
TileRawChannelBuilderMFConfig.TileRawChannelBuilderMFCfg
def TileRawChannelBuilderMFCfg(flags, **kwargs)
Definition: TileRawChannelBuilderMFConfig.py:9
Constants
some useful constants -------------------------------------------------—
TileRawChannelBuilderConfig.TileRawChannelBuilderCfg
def TileRawChannelBuilderCfg(flags, name, TileRawChannelBuilder, **kwargs)
Definition: TileRawChannelBuilderConfig.py:9
Trk::open
@ open
Definition: BinningType.h:40
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19
python.TileOFCConfig.TileCondToolOfcCfg
def TileCondToolOfcCfg(flags, **kwargs)
Definition: TileOFCConfig.py:98