ATLAS Offline Software
Loading...
Searching...
No Matches
TileCellBuilderConfig.py
Go to the documentation of this file.
1# Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
2
3"""Define method to construct configured Tile Cell builder tool"""
4
5from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
6from AthenaConfiguration.ComponentFactory import CompFactory
7from AthenaConfiguration.Enums import LHCPeriod, BeamType
8from TileConfiguration.TileConfigFlags import TileRunType
9from AthenaConfiguration.Enums import ProductionStep
10
11def TileCellBuilderCfg(flags, mergeChannels=True, doDigiHSTruth=False, **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 if doDigiHSTruth:
23 kwargs.setdefault('TileRawChannelContainer', "TileRawChannelCnt_DigiHSTruth")
24 else:
25 kwargs.setdefault('TileRawChannelContainer', flags.Tile.RawChannelContainer)
26 kwargs.setdefault('SkipGain', -1) # Never skip any gain by default
27
28 testBeam = flags.Beam.Type is BeamType.TestBeam
29 if doDigiHSTruth:
30 kwargs.setdefault('MBTSContainer', 'MBTSContainer2_DigiHSTruth' if not testBeam and flags.GeoModel.Run in [LHCPeriod.Run1, LHCPeriod.Run2, LHCPeriod.Run3] else "")
31 kwargs.setdefault('E4prContainer', 'E4prContainer2_DigiHSTruth' if not testBeam and flags.GeoModel.Run is LHCPeriod.Run2 else "")
32 else:
33 kwargs.setdefault('MBTSContainer', 'MBTSContainer' if not testBeam and flags.GeoModel.Run in [LHCPeriod.Run1, LHCPeriod.Run2, LHCPeriod.Run3] else "")
34 kwargs.setdefault('E4prContainer', 'E4prContainer' if not testBeam and flags.GeoModel.Run is LHCPeriod.Run2 else "")
35
36 kwargs['mergeChannels'] = mergeChannels
37 if flags.Common.ProductionStep in [ProductionStep.PileUpPretracking, ProductionStep.MinbiasPreprocessing]:
38 kwargs.setdefault('EventInfo', flags.Overlay.BkgPrefix + "EventInfo")
39
40 if kwargs['SkipGain'] not in [-1, 0, 1]:
41 raise(Exception("Invalid Tile gain requsted to be skipped: %s" % kwargs['SkipGain']))
42
43 from TileRecUtils.TileDQstatusConfig import TileDQstatusAlgCfg
44 acc.merge( TileDQstatusAlgCfg(flags) )
45
46 if not testBeam:
47 from LArGeoAlgsNV.LArGMConfig import LArGMCfg
48 acc.merge(LArGMCfg(flags))
49
50 from TileGeoModel.TileGMConfig import TileGMCfg
51 acc.merge(TileGMCfg(flags))
52
53 from TileConditions.TileInfoLoaderConfig import TileInfoLoaderCfg
54 acc.merge( TileInfoLoaderCfg(flags) )
55
56 from TileConditions.TileCablingSvcConfig import TileCablingSvcCfg
57 acc.merge(TileCablingSvcCfg(flags))
58
59 from TileConditions.TileBadChannelsConfig import TileBadChannelsCondAlgCfg
60 acc.merge( TileBadChannelsCondAlgCfg(flags) )
61
62 from TileConditions.TileEMScaleConfig import TileEMScaleCondAlgCfg
63 acc.merge( TileEMScaleCondAlgCfg(flags) )
64
65 if 'TileCondToolTiming' not in kwargs:
66 from TileConditions.TileTimingConfig import TileCondToolTimingCfg
67 kwargs['TileCondToolTiming'] = acc.popToolsAndMerge( TileCondToolTimingCfg(flags) )
68
69 if kwargs['CheckDCS']:
70 from TileConditions.TileDCSConfig import TileDCSCondAlgCfg
71 acc.merge( TileDCSCondAlgCfg(flags) )
72
73 if not (flags.Input.isMC or flags.Overlay.DataOverlay) and mergeChannels and 'TileDSPRawChannelContainer' not in kwargs:
74 from TileRecUtils.TileRawChannelCorrectionConfig import TileRawChannelCorrectionAlgCfg
75 corrAlgAcc = TileRawChannelCorrectionAlgCfg(flags)
76 tileRawChannelCorrectionAlg = corrAlgAcc.getPrimary()
77 tileRawChannelContainerDSP = tileRawChannelCorrectionAlg.OutputRawChannelContainer
78 kwargs['TileDSPRawChannelContainer'] = tileRawChannelContainerDSP
79 acc.merge( corrAlgAcc )
80
81 TileCellBuilder=CompFactory.TileCellBuilder
82 acc.setPrivateTools( TileCellBuilder(**kwargs) )
83
84 return acc
85
86
87if __name__ == "__main__":
88
89 from AthenaConfiguration.AllConfigFlags import initConfigFlags
90 from AthenaConfiguration.TestDefaults import defaultGeometryTags, defaultTestFiles
91 from AthenaCommon.Logging import log
92 from AthenaCommon.Constants import DEBUG
93
94 # Test setup
95 log.setLevel(DEBUG)
96
97 flags = initConfigFlags()
98 flags.Input.Files = defaultTestFiles.RAW_RUN2
99 flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN2
100 flags.Tile.RunType = TileRunType.PHY
101 flags.fillFromArgs()
102 flags.lock()
103
104 acc = ComponentAccumulator()
105
106 print( acc.popToolsAndMerge( TileCellBuilderCfg(flags) ) )
107
108 flags.dump()
109 acc.printConfig(withDetails = True, summariseProps = True)
110 acc.store( open('TileCellBuilder.pkl','wb') )
void print(char *figname, TCanvas *c1)
This class creates Cells from RawChannels and stores them in a container.
TileCellBuilderCfg(flags, mergeChannels=True, doDigiHSTruth=False, **kwargs)