ATLAS Offline Software
TileRawChannelBuilderConfig.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2 
3 """Define method to construct configured base Tile 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 TileRawChannelBuilderCfg(flags, name, TileRawChannelBuilder, **kwargs):
10  """Return component accumulator with configured private base Tile raw channel builder tool
11 
12  Arguments:
13  flags -- Athena configuration flags
14  name -- name of Tile raw channel builder
15  TileRawChannelbuilder -- concrete Tile raw channel builder tool.
16  """
17 
18  acc = ComponentAccumulator()
19 
20  runType = flags.Tile.RunType
21 
22  createContainer = ( kwargs.get('TileRawChannelContainer', "") != "" )
23 
24  if createContainer:
25  from TileRecUtils.TileDQstatusConfig import TileDQstatusAlgCfg
26  acc.merge( TileDQstatusAlgCfg(flags) )
27  else:
28  kwargs['TileDQstatus'] = ""
29 
30  from TileConditions.TileInfoLoaderConfig import TileInfoLoaderCfg
31  acc.merge( TileInfoLoaderCfg(flags) )
32 
33  from TileConditions.TileCablingSvcConfig import TileCablingSvcCfg
34  acc.merge( TileCablingSvcCfg(flags) )
35 
36  kwargs['RunType'] = runType.getIntValue()
37  kwargs['calibrateEnergy'] = False
38 
39  kwargs.setdefault('AmpMinForAmpCorrection', flags.Tile.AmpMinForAmpCorrection)
40  kwargs.setdefault('TimeMinForAmpCorrection', flags.Tile.TimeMinForAmpCorrection)
41  kwargs.setdefault('TimeMaxForAmpCorrection', flags.Tile.TimeMaxForAmpCorrection)
42 
43  tileRawChannelContainerDSP = ""
44  if createContainer:
45  if 'NoiseFilterTools' not in kwargs:
46  from TileRecUtils.TileRawChannelCorrectionConfig import TileRawChannelCorrectionToolsCfg
47  correctionTools = acc.popToolsAndMerge( TileRawChannelCorrectionToolsCfg(flags) )
48  kwargs['NoiseFilterTools'] = correctionTools
49 
50  if not (flags.Input.isMC or flags.Overlay.DataOverlay) and len(kwargs['NoiseFilterTools']) > 0:
51  tileRawChannelContainerDSP = 'TileRawChannelCntCorrected'
52  from TileRecUtils.TileRawChannelCorrectionConfig import TileRawChannelCorrectionAlgCfg
53  acc.merge( TileRawChannelCorrectionAlgCfg(flags) )
54 
55  kwargs.setdefault('DSPContainer', tileRawChannelContainerDSP)
56 
57  acc.setPrivateTools( TileRawChannelBuilder(name, **kwargs) )
58 
59  return acc
60 
61 
62 if __name__ == "__main__":
63 
64  from AthenaConfiguration.AllConfigFlags import initConfigFlags
65  from AthenaConfiguration.TestDefaults import defaultGeometryTags, defaultTestFiles
66  from AthenaCommon.Logging import log
67  from AthenaCommon.Constants import DEBUG
68 
69  # Test setup
70  log.setLevel(DEBUG)
71 
72  flags = initConfigFlags()
73  flags.Input.Files = defaultTestFiles.RAW_RUN2
74  flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN2
75  flags.Tile.RunType = TileRunType.PHY
76  flags.Tile.NoiseFilter = 1
77  flags.lock()
78 
79  flags.dump()
80 
82 
83  TileRawChannelBuilderFitFilter=CompFactory.TileRawChannelBuilderFitFilter
84  rchBuilderFitAcc = TileRawChannelBuilderCfg(flags,
85  name = 'TileRawChannelBuilderFit',
86  TileRawChannelBuilder = TileRawChannelBuilderFitFilter)
87  print( acc.popToolsAndMerge(rchBuilderFitAcc) )
88 
89  TileRawChannelBuilderOpt2Filter=CompFactory.TileRawChannelBuilderOpt2Filter
90  rchBuilderOpt2Acc = TileRawChannelBuilderCfg(flags,
91  name = 'TileRawChannelBuilderOpt2',
92  TileRawChannelBuilder = TileRawChannelBuilderOpt2Filter)
93  print( acc.popToolsAndMerge(rchBuilderOpt2Acc) )
94 
95 
96  acc.printConfig(withDetails = True, summariseProps = True)
97  acc.store( open('TileRawChannelBuilder.pkl','wb') )
98 
99 
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
python.TileInfoLoaderConfig.TileInfoLoaderCfg
def TileInfoLoaderCfg(flags, **kwargs)
Definition: TileInfoLoaderConfig.py:12
TileDQstatusConfig.TileDQstatusAlgCfg
def TileDQstatusAlgCfg(flags, **kwargs)
Definition: TileDQstatusConfig.py:31
Constants
some useful constants -------------------------------------------------—
TileRawChannelBuilder
Definition: TileRawChannelBuilder.h:59
TileRawChannelBuilderConfig.TileRawChannelBuilderCfg
def TileRawChannelBuilderCfg(flags, name, TileRawChannelBuilder, **kwargs)
Definition: TileRawChannelBuilderConfig.py:9
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
TileRawChannelCorrectionConfig.TileRawChannelCorrectionAlgCfg
def TileRawChannelCorrectionAlgCfg(flags, **kwargs)
Definition: TileRawChannelCorrectionConfig.py:151
python.TileCablingSvcConfig.TileCablingSvcCfg
def TileCablingSvcCfg(flags)
Definition: TileCablingSvcConfig.py:11
TileRawChannelCorrectionConfig.TileRawChannelCorrectionToolsCfg
def TileRawChannelCorrectionToolsCfg(flags, **kwargs)
Definition: TileRawChannelCorrectionConfig.py:126