9 from AthenaConfiguration.ComponentFactory
import CompFactory
10 from AthenaConfiguration.ComponentAccumulator
import ComponentAccumulator
14 """Given the list of TrackCollection keys from the input file, try to guess
15 which one is aliased to Tracks."""
17 for a
in [
'CombinedInDetTracks',
20 'ConvertedIPatTracks',
21 'ConvertedXKalmanTracks',
23 if a
in tcolls:
return a
28 """Configure an algorithm to read a TrackCollection.
29 KEY is the desired TrackCollection key.
30 Will do nothing in serial mode, or if the requested object is not
35 if flags.Concurrency.NumThreads <= 0:
40 from AthenaConfiguration.AutoConfigFlags
import GetFileMD
41 tcolls = set ([k
for t,k
in GetFileMD (flags.Input.Files).
get(
'itemList', [])
42 if t ==
'TrackCollection'])
43 tracks_alias = _guessTracksAlias (tcolls)
46 if key ==
'Tracks' and tracks_alias
is not None and key
not in tcolls:
55 if key == tracks_alias
and 'Tracks' not in tcolls:
59 if flags.Detector.GeometryPixel:
60 extra_inputs.append((
'InDetDD::SiDetectorElementCollection',
'ConditionStore+PixelDetectorElementCollection'))
61 if flags.Detector.GeometrySCT:
62 extra_inputs.append((
'InDetDD::SiDetectorElementCollection',
'ConditionStore+SCT_DetectorElementCollection'))
63 if flags.Detector.GeometryTRT:
64 extra_inputs.append((
'InDetDD::TRT_DetElementContainer' ,
'ConditionStore+TRT_DetElementContainer' ))
65 if flags.Detector.GeometryITkPixel:
66 extra_inputs.append((
'InDetDD::SiDetectorElementCollection' ,
'ConditionStore+ITkPixelDetectorElementCollection' ))
67 if flags.Detector.GeometryITkStrip:
68 extra_inputs.append((
'InDetDD::SiDetectorElementCollection' ,
'ConditionStore+ITkStripDetectorElementCollection' ))
69 if flags.Detector.GeometryMuon:
70 extra_inputs.append((
'MuonGM::MuonDetectorManager',
'ConditionStore+MuonDetectorManager'))
73 AthReadAlg=CompFactory.AthReadAlg
74 alg = AthReadAlg (
'TrackCollectionRead_' + key,
75 Key =
'TrackCollection/' + key,
77 ExtraInputs = extra_inputs)
78 result.addEventAlgo (alg)
81 from SGComps.AddressRemappingConfig
import AddressRemappingCfg
86 if __name__ ==
"__main__":
87 from AthenaConfiguration.AllConfigFlags
import initConfigFlags
90 from AthenaConfiguration.TestDefaults
import defaultTestFiles
92 print (
'--- Reference aliased object by base name.')
93 flags1 = flags.clone()
94 flags1.Concurrency.NumThreads = 1
95 flags1.Input.Files = defaultTestFiles.ESD
97 acc1 = TrackCollectionReadCfg (flags1,
'CombinedInDetTracks')
98 acc1.printConfig (summariseProps=
True)
101 print (
'--- Reference aliased object by alias.')
102 flags2 = flags.clone()
103 flags2.Concurrency.NumThreads = 1
104 flags2.Input.Files = defaultTestFiles.ESD
106 acc2 = TrackCollectionReadCfg (flags2,
'Tracks')
107 acc2.printConfig (summariseProps=
True)
110 print (
'--- Non-aliased object.')
111 flags3 = flags.clone()
112 flags3.Concurrency.NumThreads = 1
113 flags3.Input.Files = defaultTestFiles.ESD
115 acc3 = TrackCollectionReadCfg (flags3,
'ResolvedForwardTracks')
116 acc3.printConfig (summariseProps=
True)
119 print (
'--- Non-existent object.')
120 flags4 = flags.clone()
121 flags4.Concurrency.NumThreads = 1
122 flags4.Input.Files = defaultTestFiles.ESD
124 acc4 = TrackCollectionReadCfg (flags4,
'FooTracks')
125 acc4.printConfig (summariseProps=
True)
128 print (
'--- Non-threaded.')
129 flags5 = flags.clone()
130 flags5.Input.Files = defaultTestFiles.ESD
132 acc5 = TrackCollectionReadCfg (flags5,
'Tracks')
133 acc5.printConfig (summariseProps=
True)