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",
'')
100 acc.setPrivateTools(CompFactory.TileHitVecToCntTool(**kwargs))
106 """Return component accumulator with configured Tile hit vector to container algorithm
109 flags -- Athena configuration flags
114 if 'DigitizationTool' not in kwargs:
116 kwargs.setdefault(
'DigitizationTool', tool)
119 if flags.Common.isOverlay:
120 if flags.Concurrency.NumThreads > 0:
121 kwargs.setdefault(
'Cardinality', flags.Concurrency.NumThreads)
123 kwargs.setdefault(
'name',
'TileHitVecToCnt')
124 Alg = CompFactory.TileHitVecToCnt
125 acc.addEventAlgo(Alg(**kwargs))
127 kwargs[
"PileUpTools"] = [kwargs.pop(
"DigitizationTool")]
134 """Return component accumulator with Output Stream configuration for Tile hits
137 flags -- Athena configuration flags
140 if flags.Output.doWriteRDO:
149 """Return component accumulator with configured Tile hit vector to container algorithm and Output Stream
152 flags -- Athena configuration flags
162 if __name__ ==
"__main__":
164 from AthenaConfiguration.AllConfigFlags
import initConfigFlags
165 from AthenaConfiguration.TestDefaults
import defaultConditionsTags, defaultTestFiles
166 from AthenaCommon.Logging
import log
173 flags.Input.Files = defaultTestFiles.HITS_RUN2
174 flags.Output.RDOFileName =
'myRDO-TileHitVecToCnt.pool.root'
175 flags.IOVDb.GlobalTag = defaultConditionsTags.RUN2_MC
176 flags.Digitization.PileUp =
False
177 flags.Exec.MaxEvents = 3
183 from AthenaConfiguration.MainServicesConfig
import MainServicesCfg
186 from AthenaPoolCnvSvc.PoolReadConfig
import PoolReadCfg
189 if 'EventInfo' not in flags.Input.Collections:
190 from xAODEventInfoCnv.xAODEventInfoCnvConfig
import EventInfoCnvAlgCfg
192 inputKey=
'McEventInfo',
193 outputKey=
'EventInfo'))
197 acc.getService(
'StoreGateSvc').Dump =
True
198 acc.printConfig(withDetails =
True, summariseProps =
True)
200 acc.store(
open(
'TileHitVecToCnt.pkl',
'wb') )
205 sys.exit(
not sc.isSuccess())