52 from AthenaConfiguration.ComponentAccumulator
import ComponentAccumulator
53 from AthenaConfiguration.AccumulatorCache
import AccumulatorCache
54 from AthenaConfiguration.ComponentFactory
import CompFactory
55 import TrkConfig.AtlasExtrapolatorToolsConfig
as TC
56 from TrkConfig.TrkExSTEP_PropagatorConfig
import AtlasSTEP_PropagatorCfg
66 from TrkConfig.AtlasExtrapolatorToolsConfig
import (
67 AtlasMultipleScatteringUpdatorCfg)
72 from TrkConfig.TrkExRungeKuttaPropagatorConfig
import (
73 RungeKuttaPropagatorCfg)
74 AtlasRungeKuttaPropagator = result.popToolsAndMerge(
76 AtlasSTEP_Propagator = result.popToolsAndMerge(
79 if flags.Detector.GeometryITk:
80 from TrkConfig.TrkExRungeKuttaPropagatorConfig
import ITkPropagatorCfg
81 ITkPropagator = result.popToolsAndMerge(
85 AtlasPropagators += [AtlasRungeKuttaPropagator]
86 AtlasPropagators += [AtlasSTEP_Propagator]
87 if flags.Detector.GeometryITk:
88 AtlasPropagators += [ITkPropagator]
91 AtlasMaterialEffectsUpdator = result.popToolsAndMerge(
92 TC.AtlasMaterialEffectsUpdatorCfg(flags))
93 AtlasMaterialEffectsUpdatorLandau = result.popToolsAndMerge(
94 TC.AtlasMaterialEffectsUpdatorLandauCfg(flags))
95 ITkMaterialEffectsUpdator =
None
96 if flags.Detector.GeometryITk:
97 ITkMaterialEffectsUpdator = result.popToolsAndMerge(
98 TC.ITkMaterialEffectsUpdatorCfg(flags))
101 AtlasUpdators += [AtlasMaterialEffectsUpdator]
102 AtlasUpdators += [AtlasMaterialEffectsUpdatorLandau]
103 if flags.Detector.GeometryITk:
104 AtlasUpdators += [ITkMaterialEffectsUpdator]
106 AtlasNavigator = result.popToolsAndMerge(TC.AtlasNavigatorCfg(flags))
109 AtlasSubPropagators = []
110 AtlasSubPropagators += [AtlasRungeKuttaPropagator.name]
111 if flags.Detector.GeometryITk:
112 AtlasSubPropagators += [ITkPropagator.name]
114 AtlasSubPropagators += [AtlasRungeKuttaPropagator.name]
115 AtlasSubPropagators += [AtlasSTEP_Propagator.name]
116 AtlasSubPropagators += [AtlasSTEP_Propagator.name]
117 AtlasSubPropagators += [AtlasSTEP_Propagator.name]
118 AtlasSubPropagators += [AtlasRungeKuttaPropagator.name]
120 AtlasSubUpdators = []
121 AtlasSubUpdators += [AtlasMaterialEffectsUpdator.name]
122 if flags.Detector.GeometryITk:
123 AtlasSubUpdators += [ITkMaterialEffectsUpdator.name]
125 AtlasSubUpdators += [AtlasMaterialEffectsUpdator.name]
126 AtlasSubUpdators += [AtlasMaterialEffectsUpdator.name]
127 AtlasSubUpdators += [AtlasMaterialEffectsUpdator.name]
128 AtlasSubUpdators += [AtlasMaterialEffectsUpdator.name]
129 AtlasSubUpdators += [AtlasMaterialEffectsUpdator.name]
131 AtlasELossUpdater = result.popToolsAndMerge(
132 TC.AtlasEnergyLossUpdatorCfg(flags))
133 AtlasEnergyLossUpdater = AtlasELossUpdater
136 Extrapolator = CompFactory.Trk.Extrapolator(
138 Navigator=AtlasNavigator,
139 MaterialEffectsUpdators=AtlasUpdators,
140 MultipleScatteringUpdater=result.popToolsAndMerge(
142 STEP_Propagator=AtlasSTEP_Propagator,
143 Propagators=AtlasPropagators,
144 SubPropagators=AtlasSubPropagators,
145 SubMEUpdators=AtlasSubUpdators,
146 EnergyLossUpdater=AtlasEnergyLossUpdater
149 result.setPrivateTools(Extrapolator)
161 PFlowExtrapolator = result.popToolsAndMerge(
164 from TrkConfig.TrkExRungeKuttaPropagatorConfig
import (
165 RungeKuttaPropagatorCfg)
166 RungeKuttaPropagator = result.popToolsAndMerge(
168 from TrkConfig.TrkExSTEP_PropagatorConfig
import (
169 AtlasSTEP_PropagatorCfg)
170 pflowSTEP_Propagator = result.popToolsAndMerge(
173 pflowPropagators = []
174 pflowPropagators += [RungeKuttaPropagator]
175 pflowPropagators += [pflowSTEP_Propagator]
177 pflowSubPropagators = []
178 pflowSubPropagators += [RungeKuttaPropagator.name]
179 pflowSubPropagators += [RungeKuttaPropagator.name]
180 pflowSubPropagators += [pflowSTEP_Propagator.name]
181 pflowSubPropagators += [pflowSTEP_Propagator.name]
182 pflowSubPropagators += [pflowSTEP_Propagator.name]
183 pflowSubPropagators += [RungeKuttaPropagator.name]
185 PFlowExtrapolator.Propagators = pflowPropagators
186 PFlowExtrapolator.SubPropagators = pflowSubPropagators
187 PFlowExtrapolator.STEP_Propagator = pflowSTEP_Propagator
189 result.setPrivateTools(PFlowExtrapolator)
203 egammaExtrapolator = result.popToolsAndMerge(
206 from TrkConfig.TrkExRungeKuttaPropagatorConfig
import (
207 RungeKuttaPropagatorCfg)
208 RungeKuttaPropagator = result.popToolsAndMerge(
210 from TrkConfig.TrkExSTEP_PropagatorConfig
import (
211 AtlasNoMatSTEP_PropagatorCfg)
212 NoMatSTEP_Propagator = result.popToolsAndMerge(
215 if flags.Detector.GeometryITk:
216 from TrkConfig.TrkExRungeKuttaPropagatorConfig
import ITkPropagatorCfg
217 ITkPropagator = result.popToolsAndMerge(
220 egammaPropagators = []
221 egammaPropagators += [RungeKuttaPropagator]
222 egammaPropagators += [NoMatSTEP_Propagator]
223 if flags.Detector.GeometryITk:
224 egammaPropagators += [ITkPropagator]
226 MaterialEffectsUpdator = result.popToolsAndMerge(
227 TC.AtlasMaterialEffectsUpdatorCfg(flags))
228 NoElossMaterialEffectsUpdator = result.popToolsAndMerge(
229 TC.AtlasNoElossMaterialEffectsUpdatorCfg(flags))
230 ITkMaterialEffectsUpdator =
None
231 if flags.Detector.GeometryITk:
232 ITkMaterialEffectsUpdator = result.popToolsAndMerge(
233 TC.ITkMaterialEffectsUpdatorCfg(flags))
236 egammaUpdators += [MaterialEffectsUpdator]
237 egammaUpdators += [NoElossMaterialEffectsUpdator]
238 if flags.Detector.GeometryITk:
239 egammaUpdators += [ITkMaterialEffectsUpdator]
242 egammaSubPropagators = []
243 egammaSubPropagators += [RungeKuttaPropagator.name]
244 if flags.Detector.GeometryITk:
245 egammaSubPropagators += [ITkPropagator.name]
247 egammaSubPropagators += [RungeKuttaPropagator.name]
249 egammaSubPropagators += [RungeKuttaPropagator.name]
250 egammaSubPropagators += [RungeKuttaPropagator.name]
251 egammaSubPropagators += [NoMatSTEP_Propagator.name]
252 egammaSubPropagators += [RungeKuttaPropagator.name]
254 egammaSubUpdators = []
255 egammaSubUpdators += [MaterialEffectsUpdator.name]
256 if flags.Detector.GeometryITk:
257 egammaSubUpdators += [ITkMaterialEffectsUpdator.name]
259 egammaSubUpdators += [MaterialEffectsUpdator.name]
260 egammaSubUpdators += [MaterialEffectsUpdator.name]
261 egammaSubUpdators += [NoElossMaterialEffectsUpdator.name]
262 egammaSubUpdators += [NoElossMaterialEffectsUpdator.name]
263 egammaSubUpdators += [MaterialEffectsUpdator.name]
265 egammaExtrapolator.MaterialEffectsUpdators = egammaUpdators
266 egammaExtrapolator.SubMEUpdators = egammaSubUpdators
267 egammaExtrapolator.Propagators = egammaPropagators
268 egammaExtrapolator.SubPropagators = egammaSubPropagators
270 egammaExtrapolator.STEP_Propagator = NoMatSTEP_Propagator
272 result.setPrivateTools(egammaExtrapolator)
278 name='MCTruthClassifierExtrapolator'):
288 MCTruthExtrapolator = result.popToolsAndMerge(
293 NoElossMaterialEffectsUpdator = result.popToolsAndMerge(
294 TC.AtlasNoElossMaterialEffectsUpdatorCfg(flags))
295 MCTruthUpdators += [NoElossMaterialEffectsUpdator]
297 MCTruthSubUpdators = []
300 MCTruthSubUpdators += [NoElossMaterialEffectsUpdator.name]
301 MCTruthSubUpdators += [NoElossMaterialEffectsUpdator.name]
302 MCTruthSubUpdators += [NoElossMaterialEffectsUpdator.name]
303 MCTruthSubUpdators += [NoElossMaterialEffectsUpdator.name]
304 MCTruthSubUpdators += [NoElossMaterialEffectsUpdator.name]
305 MCTruthSubUpdators += [NoElossMaterialEffectsUpdator.name]
307 MCTruthExtrapolator.MaterialEffectsUpdators = MCTruthUpdators
308 MCTruthExtrapolator.SubMEUpdators = MCTruthSubUpdators
310 result.setPrivateTools(MCTruthExtrapolator)
323 if 'Propagators' not in kwargs:
324 from TrkConfig.TrkExRungeKuttaPropagatorConfig
import (
326 InDetPropagator = result.popToolsAndMerge(
328 Propagators = [InDetPropagator]
329 kwargs.setdefault(
"Propagators", Propagators)
331 propagator = kwargs.get(
'Propagators')[0].name
if (
332 kwargs.get(
'Propagators',
None)
is not None
333 and len(kwargs.get(
'Propagators',
None)) > 0)
else None
335 if 'MaterialEffectsUpdators' not in kwargs:
336 InDetMaterialEffectsUpdator = result.getPrimaryAndMerge(
337 TC.InDetMaterialEffectsUpdatorCfg(flags))
338 MaterialEffectsUpdators = [InDetMaterialEffectsUpdator]
339 kwargs.setdefault(
"MaterialEffectsUpdators", MaterialEffectsUpdators)
340 material_updator = kwargs.get(
'MaterialEffectsUpdators')[0].name
if (
341 kwargs.get(
'MaterialEffectsUpdators',
None)
is not None
342 and len(kwargs.get(
'MaterialEffectsUpdators',
None)) > 0)
else None
344 if 'Navigator' not in kwargs:
345 AtlasNavigator = result.popToolsAndMerge(
346 TC.AtlasNavigatorCfg(flags, name=
"InDetNavigator"))
347 kwargs.setdefault(
"Navigator", AtlasNavigator)
354 sub_propagators += [propagator]
355 sub_updators += [material_updator]
358 sub_propagators += [propagator]
359 sub_updators += [material_updator]
362 sub_updators += [material_updator]
364 kwargs.setdefault(
"SubPropagators", sub_propagators)
365 kwargs.setdefault(
"SubMEUpdators", sub_updators)
367 AtlasELossUpdater = result.popToolsAndMerge(
368 TC.AtlasEnergyLossUpdatorCfg(flags))
369 kwargs.setdefault(
"EnergyLossUpdater", AtlasELossUpdater)
371 extrapolator = CompFactory.Trk.Extrapolator(name, **kwargs)
372 result.setPrivateTools(extrapolator)
377 from TrkConfig.AtlasExtrapolatorToolsConfig
import (
378 AtlasMultipleScatteringUpdatorCfg)
383 AtlasMaterialEffectsUpdator = result.popToolsAndMerge(
384 TC.AtlasMaterialEffectsUpdatorCfg(flags,
385 name=
"MuonMaterialEffectsUpdator"))
386 kwargs.setdefault(
"MaterialEffectsUpdators", [AtlasMaterialEffectsUpdator])
388 kwargs.setdefault(
"MultipleScatteringUpdater",
389 result.popToolsAndMerge(
393 AtlasNavigator = result.popToolsAndMerge(TC.AtlasNavigatorCfg(
394 flags, name=
'InDetNavigator' if use_old_names
else None))
395 kwargs.setdefault(
"Navigator", AtlasNavigator)
397 AtlasELossUpdater = result.popToolsAndMerge(
398 TC.AtlasEnergyLossUpdatorCfg(flags))
399 kwargs.setdefault(
"EnergyLossUpdater", AtlasELossUpdater)
401 if 'STEP_Propagator' not in kwargs:
402 AtlasSTEP_Propagator = result.popToolsAndMerge(
404 kwargs.setdefault(
"STEP_Propagator", AtlasSTEP_Propagator)
406 if 'Propagators' not in kwargs:
408 kwargs.setdefault(
"Propagators", [result.popToolsAndMerge(
411 kwargs.setdefault(
"Propagators", [kwargs[
"STEP_Propagator"]])
413 kwargs.setdefault(
"ResolveMuonStation",
True)
415 kwargs.setdefault(
"Tolerance", 0.0011)
417 extrap = CompFactory.Trk.Extrapolator(name, **kwargs)
418 result.setPrivateTools(extrap)
423 name="MuonStraightLineExtrapolator",
430 muon_prop = result.popToolsAndMerge(
434 kwargs.setdefault(
"Propagators", [muon_prop])
435 kwargs.setdefault(
"STEP_Propagator", muon_prop)
436 extrap = result.popToolsAndMerge(
438 result.setPrivateTools(extrap)
439 result.addPublicTool(extrap)
451 kwargs.setdefault(
"Propagators", [result.popToolsAndMerge(
453 kwargs.setdefault(
"STEP_Propagator",
456 prop = result.popToolsAndMerge(
458 kwargs.setdefault(
"Propagators", [prop])
459 kwargs.setdefault(
"STEP_Propagator", prop)
460 kwargs.setdefault(
"ResolveMuonStation",
False)
461 kwargs.setdefault(
"Navigator", result.popToolsAndMerge(
462 TC.AtlasNavigatorCfg(flags, name=
"InDetNavigator")))
463 kwargs.setdefault(
"EnergyLossUpdater", result.popToolsAndMerge(
464 TC.AtlasEnergyLossUpdatorCfg(flags)))
466 result.setPrivateTools(result.popToolsAndMerge(
471 if __name__ ==
"__main__":
473 from AthenaConfiguration.AllConfigFlags
import initConfigFlags
476 from AthenaConfiguration.ComponentAccumulator
import printProperties
477 from AthenaConfiguration.TestDefaults
import defaultTestFiles
478 from AthenaCommon.Logging
import logging
480 flags.Input.Files = defaultTestFiles.RDO_RUN2
486 mlog = logging.getLogger(
"AtlasExtrapolatorConfigTest")
487 mlog.info(
"Configuring AtlasExtrapolator : ")
492 mlog.info(
"Configuring egammaCaloExtrapolator : ")
497 mlog.info(
"Configuring MCTruthClassifierExtrapolator : ")
503 f =
open(
"atlasextrapolator.pkl",
"wb")