3 """Define method to construct configured Tile hits to TTL1 algorithm"""
5 from AthenaConfiguration.ComponentAccumulator
import ComponentAccumulator
6 from AthenaConfiguration.ComponentFactory
import CompFactory
7 from AthenaConfiguration.Enums
import ProductionStep
8 from TileSimAlgs.TileHitVecToCntConfig
import TileHitVecToCntCfg
12 """Return component accumulator with configured Tile hits to TTL1 algorithm
15 flags -- Athena configuration flags
18 kwargs.setdefault(
'name',
'TileHitToTTL1')
19 kwargs.setdefault(
'TileHitContainer',
'TileHitCnt')
20 kwargs.setdefault(
'maskBadChannels',
True)
24 from TileConditions.TileInfoLoaderConfig
import TileInfoLoaderCfg
27 from TileConditions.TileSamplingFractionConfig
import TileSamplingFractionCondAlgCfg
30 from TileConditions.TileCablingSvcConfig
import TileCablingSvcCfg
33 if 'RndmSvc' not in kwargs:
34 from RngComps.RngCompsConfig
import AthRNGSvcCfg
35 kwargs[
'RndmSvc'] = acc.getPrimaryAndMerge(
AthRNGSvcCfg(flags)).name
37 if kwargs[
'maskBadChannels']:
38 from TileConditions.TileBadChannelsConfig
import TileBadChannelsCondAlgCfg
41 from TileConditions.TileEMScaleConfig
import TileEMScaleCondAlgCfg
44 if flags.Common.ProductionStep == ProductionStep.PileUpPresampling:
45 kwargs.setdefault(
'TileTTL1Container', flags.Overlay.BkgPrefix +
'TileTTL1Cnt')
46 if flags.Detector.EnableMBTS:
47 kwargs.setdefault(
'TileMBTSTTL1Container', flags.Overlay.BkgPrefix +
'TileTTL1MBTS')
49 kwargs.setdefault(
'TileMBTSTTL1Container',
'')
50 elif flags.Common.isOverlay:
51 kwargs.setdefault(
'TileTTL1Container', flags.Overlay.SigPrefix +
'TileTTL1Cnt')
52 if flags.Detector.EnableMBTS:
53 kwargs.setdefault(
'TileMBTSTTL1Container', flags.Overlay.SigPrefix +
'TileTTL1MBTS')
55 kwargs.setdefault(
'TileMBTSTTL1Container',
'')
57 kwargs.setdefault(
'TileTTL1Container',
'TileTTL1Cnt')
58 if flags.Detector.EnableMBTS:
59 kwargs.setdefault(
'TileMBTSTTL1Container',
'TileTTL1MBTS')
61 kwargs.setdefault(
'TileMBTSTTL1Container',
'')
63 TileHitToTTL1=CompFactory.TileHitToTTL1
70 """Return component accumulator with configured Tile hits to TTL1 algorithm for cosmics
73 flags -- Athena configuration flags
76 kwargs.setdefault(
'name',
'TileHitToTTL1_Cosmics')
77 kwargs.setdefault(
'TileTTL1Type',
'Cosmics')
78 kwargs.setdefault(
'TileTTL1Container',
'TileTTL1CosmicsCnt')
79 if flags.Detector.EnableMBTS:
80 kwargs.setdefault(
'TileMBTSTTL1Container',
'TileMBTSTTL1CosmicsContainer')
82 kwargs.setdefault(
'TileMBTSTTL1Container',
'')
89 if hasattr(TileHitToTTL1,
'TileTTL1Container'):
90 tileTTL1Container = TileHitToTTL1.TileTTL1Container
92 tileTTL1Container = TileHitToTTL1.getDefaultProperty(
'TileTTL1Container')
93 tileTTL1Container =
str(tileTTL1Container).
split(
'+').pop()
94 outputItemList = [
'TileTTL1Container#' + tileTTL1Container]
96 if hasattr(TileHitToTTL1,
'TileMBTSTTL1Container'):
97 mbtsTTL1Container = TileHitToTTL1.TileMBTSTTL1Container
99 mbtsTTL1Container = TileHitToTTL1.getDefaultProperty(
'TileMBTSTTL1Container')
100 mbtsTTL1Container =
str(mbtsTTL1Container).
split(
'+').pop()
101 outputItemList += [
'TileTTL1Container#' + mbtsTTL1Container]
104 if flags.Output.doWriteRDO:
105 if flags.Digitization.EnableTruth:
106 outputItemList += [
"CaloCalibrationHitContainer#*"]
107 from DigitizationConfig.TruthDigitizationOutputConfig
import TruthDigitizationOutputCfg
109 from OutputStreamAthenaPool.OutputStreamConfig
import OutputStreamCfg
110 acc.merge(
OutputStreamCfg(flags, streamName =
'RDO', ItemList = outputItemList))
116 """Return component accumulator with configured Tile hits to TTL1 algorithm and Output Stream
119 flags -- Athena configuration flags
129 """Return component accumulator with configured Tile hits to TTL1 algorithm for cosmics and Output Stream
132 flags -- Athena configuration flags
141 if __name__ ==
"__main__":
143 from AthenaConfiguration.AllConfigFlags
import initConfigFlags
144 from AthenaConfiguration.TestDefaults
import defaultConditionsTags, defaultTestFiles
145 from AthenaCommon.Logging
import log
152 flags.Input.Files = defaultTestFiles.HITS_RUN2
153 flags.IOVDb.GlobalTag = defaultConditionsTags.RUN2_MC
154 flags.Digitization.PileUp =
False
155 flags.Output.RDOFileName =
"myRDO-TileHitToTTL1.pool.root"
156 flags.Exec.MaxEvents = 3
161 from AthenaConfiguration.MainServicesConfig
import MainServicesCfg
164 from AthenaPoolCnvSvc.PoolReadConfig
import PoolReadCfg
167 if 'EventInfo' not in flags.Input.Collections:
168 from xAODEventInfoCnv.xAODEventInfoCnvConfig
import EventInfoCnvAlgCfg
170 inputKey=
'McEventInfo',
171 outputKey=
'EventInfo'))
176 acc.printConfig(withDetails =
True, summariseProps =
True)
177 acc.store(
open(
'TileHitToTTL1.pkl',
'wb') )
182 sys.exit(
not sc.isSuccess())