3 """Define method to construct configured private Tile hit vector to container tool"""
5 from AthenaConfiguration.ComponentAccumulator
import ComponentAccumulator
6 from AthenaConfiguration.ComponentFactory
import CompFactory
7 from AthenaConfiguration.Enums
import BeamType
8 from OutputStreamAthenaPool.OutputStreamConfig
import OutputStreamCfg
9 from DigitizationConfig.PileUpMergeSvcConfig
import PileUpMergeSvcCfg, PileUpXingFolderCfg
10 from DigitizationConfig.PileUpToolsConfig
import PileUpToolsCfg
13 """Return the earliest bunch crossing time for which interactions will be sent to the TileHitVecToCntTool"""
18 """Return the latest bunch crossing time for which interactions will be sent to the TileHitVecToCntTool"""
23 """Return a PileUpXingFolder tool for Tile"""
24 item_list = [
'TileHitVector#TileHitVec']
25 if flags.Detector.EnableMBTS:
26 item_list += [
'TileHitVector#MBTSHits']
29 kwargs.setdefault(
'ItemList', item_list )
34 """Return component accumulator with configured private Tile hit vector to container tool
37 flags -- Athena configuration flags
40 kwargs.setdefault(
'name',
'TileHitVecToCntTool')
41 kwargs.setdefault(
'RndmEvtOverlay', flags.Common.isOverlay)
42 if flags.Common.isOverlay:
43 kwargs.setdefault(
'OnlyUseContainerName',
False)
45 kwargs.setdefault(
'OnlyUseContainerName', flags.Digitization.PileUp)
49 from TileConditions.TileInfoLoaderConfig
import TileInfoLoaderCfg
52 from TileConditions.TileSamplingFractionConfig
import TileSamplingFractionCondAlgCfg
55 from TileConditions.TileCablingSvcConfig
import TileCablingSvcCfg
58 if flags.Detector.EnableMBTS:
59 kwargs.setdefault(
'TileHitVectors', [
'TileHitVec',
'MBTSHits'])
61 kwargs.setdefault(
'TileHitVectors', [
'TileHitVec'])
62 kwargs.setdefault(
'TileHitContainer',
'TileHitCnt')
64 if flags.Common.isOverlay
and not flags.Sim.DoFullChain:
65 from SGComps.SGInputLoaderConfig
import SGInputLoaderCfg
66 acc.merge(
SGInputLoaderCfg(flags, [f
'TileHitVector#{vec}' for vec
in kwargs[
'TileHitVectors']]))
68 kwargs.setdefault(
'DoHSTruthReconstruction', flags.Digitization.EnableCaloHSTruthRecoInputs)
69 if kwargs[
'DoHSTruthReconstruction']:
70 kwargs.setdefault(
'TileHitContainer_DigiHSTruth',
'TileHitCnt_DigiHSTruth')
72 kwargs.setdefault(
'TileHitContainer_DigiHSTruth',
'')
74 if 'RndmSvc' not in kwargs:
75 from RngComps.RngCompsConfig
import AthRNGSvcCfg
76 kwargs[
'RndmSvc'] = acc.getPrimaryAndMerge(
AthRNGSvcCfg(flags)).name
78 if kwargs[
'RndmEvtOverlay']:
79 kwargs.setdefault(
'PileUp',
False)
81 kwargs.setdefault(
'PileUp', flags.Digitization.PileUp)
83 if flags.Beam.Type
is BeamType.Cosmics:
84 CosmicTriggerTimeTool=CompFactory.CosmicTriggerTimeTool
86 kwargs.setdefault(
'HitTimeFlag', 2)
87 kwargs.setdefault(
'UseTriggerTime',
True)
89 if flags.Digitization.PileUp:
91 if flags.Digitization.DoXingByXingPileUp:
96 kwargs.setdefault(
"PileUpMergeSvc", acc.getPrimaryAndMerge(
PileUpMergeSvcCfg(flags, Intervals=intervals)).name)
98 kwargs.setdefault(
"PileUpMergeSvc",
'')
99 kwargs.setdefault(
"OnlyUseContainerName", flags.Digitization.PileUp)
100 TileHitVecToCntTool=CompFactory.TileHitVecToCntTool
107 """Return component accumulator with configured Tile hit vector to container algorithm
110 flags -- Athena configuration flags
115 if 'DigitizationTool' not in kwargs:
117 kwargs.setdefault(
'DigitizationTool', tool)
120 if flags.Common.isOverlay:
121 if flags.Concurrency.NumThreads > 0:
122 kwargs.setdefault(
'Cardinality', flags.Concurrency.NumThreads)
124 kwargs.setdefault(
'name',
'TileHitVecToCnt')
125 Alg = CompFactory.TileHitVecToCnt
126 acc.addEventAlgo(Alg(**kwargs))
128 kwargs[
"PileUpTools"] = [kwargs.pop(
"DigitizationTool")]
135 """Return component accumulator with Output Stream configuration for Tile hits
138 flags -- Athena configuration flags
141 if flags.Output.doWriteRDO:
150 """Return component accumulator with configured Tile hit vector to container algorithm and Output Stream
153 flags -- Athena configuration flags
163 if __name__ ==
"__main__":
165 from AthenaConfiguration.AllConfigFlags
import initConfigFlags
166 from AthenaConfiguration.TestDefaults
import defaultConditionsTags, defaultTestFiles
167 from AthenaCommon.Logging
import log
174 flags.Input.Files = defaultTestFiles.HITS_RUN2
175 flags.Output.RDOFileName =
'myRDO-TileHitVecToCnt.pool.root'
176 flags.IOVDb.GlobalTag = defaultConditionsTags.RUN2_MC
177 flags.Digitization.PileUp =
False
178 flags.Exec.MaxEvents = 3
184 from AthenaConfiguration.MainServicesConfig
import MainServicesCfg
187 from AthenaPoolCnvSvc.PoolReadConfig
import PoolReadCfg
190 if 'EventInfo' not in flags.Input.Collections:
191 from xAODEventInfoCnv.xAODEventInfoCnvConfig
import EventInfoCnvAlgCfg
193 inputKey=
'McEventInfo',
194 outputKey=
'EventInfo'))
198 acc.getService(
'StoreGateSvc').Dump =
True
199 acc.printConfig(withDetails =
True, summariseProps =
True)
201 acc.store(
open(
'TileHitVecToCnt.pkl',
'wb') )
206 sys.exit(
not sc.isSuccess())