ATLAS Offline Software
Loading...
Searching...
No Matches
ISF_ActsToolsConfig.py
Go to the documentation of this file.
1# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2"""
3 ComponentAccumulator tool configuration for ISF_ActsTools
4"""
5
6from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
7from AthenaConfiguration.ComponentFactory import CompFactory
8from AthenaCommon.Logging import logging
9from ISF_Algorithms.CollectionMergerConfig import CollectionMergerCfg
10
11def ActsFatrasWriteHandlerCfg(flags, name="ActsFatrasWriteHandler", **kwargs):
12 """Return ActsFatrasWriteHandler configured with ComponentAccumulator"""
13 acc = ComponentAccumulator()
14 mlog = logging.getLogger(name)
15 mlog.info('Start configuration ActsFatrasWriteHandler')
16
17 if flags.Detector.EnablePixel:
18 bare_collection_name = "PixelHits"
19 merger_input_property = "PixelHits"
20 region = "ID"
21 if flags.Detector.EnableITkPixel:
22 bare_collection_name = "ITkPixelHits"
23 merger_input_property = "ITkPixelHits"
24 region = "ITk"
25 mergeable_collection_suffix = "_Fatras"
26 acc_pixel, pixel_hits_collection_name = CollectionMergerCfg(flags,
27 bare_collection_name,
28 mergeable_collection_suffix,
29 merger_input_property,
30 region)
31 acc.merge(acc_pixel)
32
33 if flags.Detector.EnableSCT:
34 bare_collection_name = "SCT_Hits"
35 merger_input_property = "SCTHits"
36 region = "ID"
37 if flags.Detector.EnableITkPixel:
38 bare_collection_name = "ITkStripHits"
39 merger_input_property = "ITkStripHits"
40 region = "ITk"
41 acc_sct, sct_hits_collection_name = CollectionMergerCfg(flags,
42 bare_collection_name,
43 mergeable_collection_suffix,
44 merger_input_property,
45 region)
46 acc.merge(acc_sct)
47
48 kwargs.setdefault("PixelCollectionName", pixel_hits_collection_name)
49 kwargs.setdefault("SCTCollectionName", sct_hits_collection_name)
50
51 acc.setPrivateTools(CompFactory.ActsFatrasWriteHandler(name=name, **kwargs))
52 return acc
53
54def ActsFatrasSimToolCfg(flags, name="ISF_ActsFatrasSimTool", **kwargs):
55 """Return ISF_FatrasSimHitCreatorID configured with ComponentAccumulator"""
56 acc = ComponentAccumulator()
57 mlog = logging.getLogger(name)
58 mlog.info('Start configuration ISF_ActsFatraSimTool')
59
60 kwargs.setdefault("MaxSteps", 20000)
61
62 from ISF_FatrasServices.ISF_FatrasConfig import fatrasKinematicFilterCfg
63 kwargs.setdefault("ParticleFilter", acc.addPublicTool(acc.popToolsAndMerge(fatrasKinematicFilterCfg(flags))))
64 # added https://its.cern.ch/jira/browse/ATLASSIM-7245
65 from ISF_Services.ISF_ServicesConfig import TruthServiceCfg
66 kwargs.setdefault("TruthRecordService", acc.getPrimaryAndMerge(TruthServiceCfg(flags)))
67 from RngComps.RngCompsConfig import AthRNGSvcCfg
68 kwargs.setdefault("RNGService", acc.getPrimaryAndMerge(AthRNGSvcCfg(flags)))
69
70 # Ensure GeoIDSvc is configured
71 from ISF_Services.ISF_ServicesCoreConfig import ATLFAST_GeoIDSvcCfg
72 kwargs.setdefault("GeoIDSvc", acc.getPrimaryAndMerge(ATLFAST_GeoIDSvcCfg(flags)))
73
74 from ActsConfig.ActsGeometryConfig import ActsExtrapolationToolCfg
75 kwargs.setdefault("ExtrapolationTool", acc.popToolsAndMerge(ActsExtrapolationToolCfg(flags)))
76
77 kwargs.setdefault("ActsFatrasWriteHandler", acc.popToolsAndMerge(ActsFatrasWriteHandlerCfg(flags)))
78 writtenContainers =[]
79 if flags.Detector.EnablePixel:
80 if (flags.Sim.ISFRun and flags.Sim.ISF.HITSMergingRequired.get('ID', True)):
81 writtenContainers += [("SiHitCollection", "PixelHits_Fatras")]
82 if flags.Detector.EnableSCT:
83 if (flags.Sim.ISFRun and flags.Sim.ISF.HITSMergingRequired.get('ID', True)):
84 writtenContainers += [("SiHitCollection", "SCT_Hits_Fatras")]
85 if flags.Detector.EnableITkPixel:
86 if (flags.Sim.ISFRun and flags.Sim.ISF.HITSMergingRequired.get('ITk', True)):
87 writtenContainers += [("SiHitCollection", "ITkPixelHits_Fatras")]
88 if flags.Detector.EnableITkStrip:
89 if (flags.Sim.ISFRun and flags.Sim.ISF.HITSMergingRequired.get('ITk', True)):
90 writtenContainers += [("SiHitCollection", "ITkStripHits_Fatras")]
91 kwargs.setdefault("ExtraOutputs", writtenContainers)
92 acc.setPrivateTools(CompFactory.ISF.ActsFatrasSimTool(name, **kwargs))
93 return acc
ActsFatrasWriteHandlerCfg(flags, name="ActsFatrasWriteHandler", **kwargs)