ATLAS Offline Software
TileCellBuilderConfig.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 Tile Cell builder tool"""
4 
5 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
6 from AthenaConfiguration.ComponentFactory import CompFactory
7 from AthenaConfiguration.Enums import LHCPeriod
8 from TileConfiguration.TileConfigFlags import TileRunType
9 from AthenaConfiguration.Enums import ProductionStep
10 
11 def TileCellBuilderCfg(flags, mergeChannels=True, **kwargs):
12  """Return component accumulator with configured private Tile Cell builder tool
13 
14  Arguments:
15  flags -- Athena configuration flags
16  SkipGain - skip given gain. Defaults to -1 [use all gains]. Possible values: 0 [LG], 1 [HG].
17  mergeChannels -- merge DSP results with offline reco results. Defaults to True.
18  """
19 
20  acc = ComponentAccumulator()
21  kwargs.setdefault('CheckDCS', flags.Tile.useDCS)
22  kwargs.setdefault('TileRawChannelContainer', flags.Tile.RawChannelContainer)
23  kwargs.setdefault('SkipGain', -1) # Never skip any gain by default
24 
25  kwargs.setdefault('MBTSContainer', 'MBTSContainer' if flags.GeoModel.Run in [LHCPeriod.Run1, LHCPeriod.Run2, LHCPeriod.Run3] else "")
26  kwargs.setdefault('E4prContainer', 'E4prContainer' if flags.GeoModel.Run is LHCPeriod.Run2 else "")
27 
28  kwargs['mergeChannels'] = mergeChannels
29  if flags.Common.ProductionStep is ProductionStep.PileUpPretracking:
30  kwargs.setdefault('EventInfo', flags.Overlay.BkgPrefix + "EventInfo")
31 
32  if kwargs['SkipGain'] not in [-1, 0, 1]:
33  raise(Exception("Invalid Tile gain requsted to be skipped: %s" % kwargs['SkipGain']))
34 
35  from TileRecUtils.TileDQstatusConfig import TileDQstatusAlgCfg
36  acc.merge( TileDQstatusAlgCfg(flags) )
37 
38  from LArGeoAlgsNV.LArGMConfig import LArGMCfg
39  acc.merge(LArGMCfg(flags))
40 
41  from TileGeoModel.TileGMConfig import TileGMCfg
42  acc.merge(TileGMCfg(flags))
43 
44  from TileConditions.TileInfoLoaderConfig import TileInfoLoaderCfg
45  acc.merge( TileInfoLoaderCfg(flags) )
46 
47  from TileConditions.TileCablingSvcConfig import TileCablingSvcCfg
48  acc.merge(TileCablingSvcCfg(flags))
49 
50  from TileConditions.TileBadChannelsConfig import TileBadChannelsCondAlgCfg
51  acc.merge( TileBadChannelsCondAlgCfg(flags) )
52 
53  from TileConditions.TileEMScaleConfig import TileEMScaleCondAlgCfg
54  acc.merge( TileEMScaleCondAlgCfg(flags) )
55 
56  if 'TileCondToolTiming' not in kwargs:
57  from TileConditions.TileTimingConfig import TileCondToolTimingCfg
58  kwargs['TileCondToolTiming'] = acc.popToolsAndMerge( TileCondToolTimingCfg(flags) )
59 
60  if kwargs['CheckDCS']:
61  from TileConditions.TileDCSConfig import TileDCSCondAlgCfg
62  acc.merge( TileDCSCondAlgCfg(flags) )
63 
64  if not (flags.Input.isMC or flags.Overlay.DataOverlay) and mergeChannels and 'TileDSPRawChannelContainer' not in kwargs:
65  from TileRecUtils.TileRawChannelCorrectionConfig import TileRawChannelCorrectionAlgCfg
66  corrAlgAcc = TileRawChannelCorrectionAlgCfg(flags)
67  tileRawChannelCorrectionAlg = corrAlgAcc.getPrimary()
68  tileRawChannelContainerDSP = tileRawChannelCorrectionAlg.OutputRawChannelContainer
69  kwargs['TileDSPRawChannelContainer'] = tileRawChannelContainerDSP
70  acc.merge( corrAlgAcc )
71 
72  TileCellBuilder=CompFactory.TileCellBuilder
73  acc.setPrivateTools( TileCellBuilder(**kwargs) )
74 
75  return acc
76 
77 
78 if __name__ == "__main__":
79 
80  from AthenaConfiguration.AllConfigFlags import initConfigFlags
81  from AthenaConfiguration.TestDefaults import defaultGeometryTags, defaultTestFiles
82  from AthenaCommon.Logging import log
83  from AthenaCommon.Constants import DEBUG
84 
85  # Test setup
86  log.setLevel(DEBUG)
87 
88  flags = initConfigFlags()
89  flags.Input.Files = defaultTestFiles.RAW_RUN2
90  flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN2
91  flags.Tile.RunType = TileRunType.PHY
92  flags.fillFromArgs()
93  flags.lock()
94 
96 
97  print( acc.popToolsAndMerge( TileCellBuilderCfg(flags) ) )
98 
99  flags.dump()
100  acc.printConfig(withDetails = True, summariseProps = True)
101  acc.store( open('TileCellBuilder.pkl','wb') )
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
python.TileTimingConfig.TileCondToolTimingCfg
def TileCondToolTimingCfg(flags, **kwargs)
Definition: TileTimingConfig.py:77
TileCellBuilderConfig.TileCellBuilderCfg
def TileCellBuilderCfg(flags, mergeChannels=True, **kwargs)
Definition: TileCellBuilderConfig.py:11
python.TileInfoLoaderConfig.TileInfoLoaderCfg
def TileInfoLoaderCfg(flags, **kwargs)
Definition: TileInfoLoaderConfig.py:12
TileDQstatusConfig.TileDQstatusAlgCfg
def TileDQstatusAlgCfg(flags, **kwargs)
Definition: TileDQstatusConfig.py:31
python.TileBadChannelsConfig.TileBadChannelsCondAlgCfg
def TileBadChannelsCondAlgCfg(flags, **kwargs)
Definition: TileBadChannelsConfig.py:10
Constants
some useful constants -------------------------------------------------—
LArGMConfig.LArGMCfg
def LArGMCfg(flags)
Definition: LArGMConfig.py:8
print
void print(char *figname, TCanvas *c1)
Definition: TRTCalib_StrawStatusPlots.cxx:25
python.TileEMScaleConfig.TileEMScaleCondAlgCfg
def TileEMScaleCondAlgCfg(flags, **kwargs)
Definition: TileEMScaleConfig.py:10
python.TileDCSConfig.TileDCSCondAlgCfg
def TileDCSCondAlgCfg(flags, **kwargs)
Definition: TileDCSConfig.py:8
TileCellBuilder
This class creates Cells from RawChannels and stores them in a container.
Definition: TileCellBuilder.h:109
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
TileGMConfig.TileGMCfg
def TileGMCfg(flags)
Definition: TileGMConfig.py:7