ATLAS Offline Software
Loading...
Searching...
No Matches
ActsTruthConfig.py
Go to the documentation of this file.
1# Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
2
3from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
4from AthenaConfiguration.ComponentFactory import CompFactory
5from AthenaCommon.Utils.unixtools import find_datafile
6from ActsInterop import UnitConstants
7from ActsConfig.ActsUtilities import extractChildKwargs
8
10 *,
11 collectionName: str) -> ComponentAccumulator:
12 acc = ComponentAccumulator()
13
14 AddressRemappingSvc = CompFactory.AddressRemappingSvc(
15 TypeKeyOverwriteMaps = [f"InDetSimDataCollection#{collectionName}->InDetSimDataCollectionWrap#{collectionName}"]
16 )
17 acc.addService(AddressRemappingSvc)
18 return acc
19
20
22 name: str = 'ActsPixelClusterToTruthAssociationAlg',
23 **kwargs: dict) -> ComponentAccumulator:
24 acc = ComponentAccumulator()
25 acc.merge( MapToInDetSimDataWrapSvcCfg(flags, collectionName='ITkPixelSDO_Map') )
26
27 kwargs.setdefault('InputTruthParticleLinks', 'xAODTruthLinks')
28 kwargs.setdefault('SimData', 'ITkPixelSDO_Map')
29 kwargs.setdefault('DepositedEnergyMin', 300) # @TODO revise ? From PRD_MultiTruthBuilder.h; should be 1/10 of threshold
30 kwargs.setdefault('Measurements', 'ITkPixelClusters')
31 kwargs.setdefault('AssociationMapOut', 'ITkPixelClustersToTruthParticles')
32
33 acc.addEventAlgo( CompFactory.ActsTrk.PixelClusterToTruthAssociationAlg(name=name, **kwargs) )
34 return acc
35
37 name: str = 'ActsStripClusterToTruthAssociationAlg',
38 **kwargs: dict) -> ComponentAccumulator:
39 acc = ComponentAccumulator()
40 acc.merge( MapToInDetSimDataWrapSvcCfg(flags, collectionName='ITkStripSDO_Map') )
41
42 kwargs.setdefault('InputTruthParticleLinks', 'xAODTruthLinks')
43 kwargs.setdefault('SimData', 'ITkStripSDO_Map')
44 kwargs.setdefault('DepositedEnergyMin', 600) # @TODO revise ? From PRD_MultiTruthBuilder.h; should be 1/10 of threshold
45 kwargs.setdefault('Measurements', 'ITkStripClusters')
46 kwargs.setdefault('AssociationMapOut', 'ITkStripClustersToTruthParticles')
47
48 acc.addEventAlgo( CompFactory.ActsTrk.StripClusterToTruthAssociationAlg(name=name, **kwargs) )
49 return acc
50
52 name: str = 'ActsHgtdClusterToTruthAssociationAlg',
53 **kwargs: dict) -> ComponentAccumulator:
54 acc = ComponentAccumulator()
55 acc.merge( MapToInDetSimDataWrapSvcCfg(flags, collectionName='HGTD_SDO_Map') )
56
57 kwargs.setdefault('InputTruthParticleLinks', 'xAODTruthLinks')
58 kwargs.setdefault('SimData', 'HGTD_SDO_Map')
59 kwargs.setdefault('DepositedEnergyMin', 600) # @TODO revise ? From PRD_MultiTruthBuilder.h; should be 1/10 of threshold
60 kwargs.setdefault('Measurements', 'HGTD_Clusters')
61 kwargs.setdefault('AssociationMapOut', 'HgtdClustersToTruthParticles')
62
63 acc.addEventAlgo( CompFactory.ActsTrk.HgtdClusterToTruthAssociationAlg(name=name, **kwargs) )
64 return acc
65
67 name: str = 'ActsInDetPixelClusterToTruthAssociationAlg',
68 **kwargs: dict) -> ComponentAccumulator:
69 # Inner Detector configurations
70 acc = ComponentAccumulator()
71 acc.merge( MapToInDetSimDataWrapSvcCfg(flags, collectionName='PixelSDO_Map') )
72
73 kwargs.setdefault('InputTruthParticleLinks', 'xAODTruthLinks')
74 kwargs.setdefault('SimData', 'PixelSDO_Map')
75 kwargs.setdefault('DepositedEnergyMin', 300) # @TODO revise ? From PRD_MultiTruthBuilder.h; should be 1/10 of threshold
76 kwargs.setdefault('Measurements', 'PixelClusters')
77 kwargs.setdefault('AssociationMapOut', 'PixelClustersToTruthParticles')
78
79 acc.addEventAlgo( CompFactory.ActsTrk.PixelClusterToTruthAssociationAlg(name=name, **kwargs) )
80 return acc
81
83 name: str = 'ActsInDetStripClusterToTruthAssociationAlg',
84 **kwargs: dict) -> ComponentAccumulator:
85 # Inner Detector configurations
86 acc = ComponentAccumulator()
87 acc.merge( MapToInDetSimDataWrapSvcCfg(flags, collectionName='SCT_SDO_Map') )
88
89 kwargs.setdefault('InputTruthParticleLinks', 'xAODTruthLinks')
90 kwargs.setdefault('SimData', 'SCT_SDO_Map')
91 kwargs.setdefault('DepositedEnergyMin', 600) # @TODO revise ? From PRD_MultiTruthBuilder.h; should be 1/10 of threshold
92 kwargs.setdefault('Measurements', 'SCT_Clusters')
93 kwargs.setdefault('AssociationMapOut', 'SCT_ClustersToTruthParticles')
94
95 acc.addEventAlgo( CompFactory.ActsTrk.StripClusterToTruthAssociationAlg(name=name, **kwargs) )
96 return acc
97
99 name: str = 'ActsTracksToTruthAssociationAlg',
100 **kwargs: dict) -> ComponentAccumulator:
101 acc = ComponentAccumulator()
102 acc.merge( MapToInDetSimDataWrapSvcCfg(flags, collectionName='ITkStripSDO_Map') )
103
104 kwargs.setdefault('ACTSTracksLocation','ActsTracks')
105 kwargs.setdefault('PixelClustersToTruthAssociationMap','ITkPixelClustersToTruthParticles')
106 kwargs.setdefault('StripClustersToTruthAssociationMap','ITkStripClustersToTruthParticles')
107 if flags.Reco.EnableHGTDExtension and (flags.Acts.useHGTDClusterInTrackFinding or (flags.HGTD.doActs and flags.Tracking.doTruth)):
108 kwargs.setdefault('HgtdClustersToTruthAssociationMap','HgtdClustersToTruthParticles')
109 kwargs.setdefault('AssociationMapOut','ActsTracksToTruthParticles')
110 kwargs.setdefault('MaxEnergyLoss',1e3*UnitConstants.TeV)
111
112 acc.addEventAlgo( CompFactory.ActsTrk.TrackToTruthAssociationAlg(name=name, **kwargs) )
113 return acc
114
116 name: str = 'ActsInDetTracksToTruthAssociationAlg',
117 **kwargs: dict) -> ComponentAccumulator:
118 # Inner Detector configurations
119 acc = ComponentAccumulator()
120 acc.merge( MapToInDetSimDataWrapSvcCfg(flags, collectionName='SCT_SDO_Map') )
121
122 kwargs.setdefault('ACTSTracksLocation','ActsTracks')
123 kwargs.setdefault('PixelClustersToTruthAssociationMap','PixelClustersToTruthParticles')
124 kwargs.setdefault('StripClustersToTruthAssociationMap','SCT_ClustersToTruthParticles')
125 kwargs.setdefault('AssociationMapOut','ActsTracksToTruthParticles')
126 kwargs.setdefault('MaxEnergyLoss',1e3*UnitConstants.TeV)
127
128 acc.addEventAlgo( CompFactory.ActsTrk.TrackToTruthAssociationAlg(name=name, **kwargs) )
129 return acc
130
132 name: str = 'ActsTruthParticleHitCountAlg',
133 **kwargs: dict) -> ComponentAccumulator:
134 acc = ComponentAccumulator()
135 acc.merge( MapToInDetSimDataWrapSvcCfg(flags, collectionName='ITkStripSDO_Map') )
136
137 kwargs.setdefault('PixelClustersToTruthAssociationMap','ITkPixelClustersToTruthParticles')
138 kwargs.setdefault('StripClustersToTruthAssociationMap','ITkStripClustersToTruthParticles')
139 if flags.Reco.EnableHGTDExtension and flags.Acts.useHGTDClusterInTrackFinding:
140 kwargs.setdefault('HgtdClustersToTruthAssociationMap','HgtdClustersToTruthParticles')
141 kwargs.setdefault('TruthParticleHitCountsOut','TruthParticleHitCounts')
142 kwargs.setdefault('MaxEnergyLoss',1e3*UnitConstants.TeV) # @TODO introduce flag and synchronise with TrackToTruthAssociationAlg
143 kwargs.setdefault('NHitsMin',4)
144
145
146 acc.addEventAlgo( CompFactory.ActsTrk.TruthParticleHitCountAlg(name=name, **kwargs) )
147 return acc
148
150 name: str = 'ActsInDetTruthParticleHitCountAlg',
151 **kwargs: dict) -> ComponentAccumulator:
152 # Inner Detector configurations
153 acc = ComponentAccumulator()
154 acc.merge( MapToInDetSimDataWrapSvcCfg(flags, collectionName='SCT_SDO_Map') )
155
156 kwargs.setdefault('PixelClustersToTruthAssociationMap','PixelClustersToTruthParticles')
157 kwargs.setdefault('StripClustersToTruthAssociationMap','SCT_ClustersToTruthParticles')
158 kwargs.setdefault('TruthParticleHitCountsOut','TruthParticleHitCounts')
159 kwargs.setdefault('MaxEnergyLoss',1e3*UnitConstants.TeV) # @TODO introduce flag and synchronise with TrackToTruthAssociationAlg
160 kwargs.setdefault('NHitsMin',4)
161
162 acc.addEventAlgo( CompFactory.ActsTrk.TruthParticleHitCountAlg(name=name, **kwargs) )
163 return acc
164
166 **kwargs: dict) -> ComponentAccumulator:
167 acc = ComponentAccumulator()
168
169 if flags.Detector.EnablePixel:
170 acc.merge(ActsInDetPixelClusterToTruthAssociationAlgCfg(flags, **extractChildKwargs(prefix="PixelClusterToTruthAssociationAlg.", **kwargs) ))
171
172 if flags.Detector.EnableSCT:
173 acc.merge(ActsInDetStripClusterToTruthAssociationAlgCfg(flags, **extractChildKwargs(prefix="StripClusterToTruthAssociationAlg.", **kwargs) ))
174
175 if flags.Detector.EnableITkPixel:
176 acc.merge(ActsPixelClusterToTruthAssociationAlgCfg(flags, **extractChildKwargs(prefix="PixelClusterToTruthAssociationAlg.", **kwargs) ))
177
178 if flags.Detector.EnableITkStrip:
179 acc.merge(ActsStripClusterToTruthAssociationAlgCfg(flags, **extractChildKwargs(prefix="StripClusterToTruthAssociationAlg.", **kwargs) ))
180
181 if flags.Reco.EnableHGTDExtension and flags.Acts.useHGTDClusterInTrackFinding:
182 acc.merge(ActsHgtdClusterToTruthAssociationAlgCfg(flags, **extractChildKwargs(prefix="HgtdClusterToTruthAssociationAlg.", **kwargs) ))
183 return acc
184
186 kwargs.setdefault('MatchWeights',[0., # other
187 10., 5., # ID (pixel, strips)
188 0., 0., 0. , 0., 0., # MS (MdtDriftCircle, RpcStrip, TgcStrip, MMCluster, sTgcStrip)
189 0. ]) # HGTD
190 # weights used for hit purity and hit efficiencies
191 kwargs.setdefault('CountWeights',[0., # other
192 1.,1., # ID (pixel, strips)
193 0., 0., 0. , 0., 0., # MS (MdtDriftCircle, RpcStrip, TgcStrip, MMCluster, sTgcStrip)
194 0. ]) # HGTD
195 kwargs.setdefault('StatisticPtBins',[1e3,2.5e3,5e3,10e3,100e3])
196 kwargs.setdefault('ShowDetailedTables',False)
197 kwargs.setdefault('PdgIdCategorisation',False)
198 kwargs.setdefault('StatisticEtaBins',[eta/10. for eta in range(5, 40, 5)])
199
201 name: str = 'ActsTrackParticleTruthDecorationAlg',
202 **kwargs: dict) -> ComponentAccumulator:
203 acc = ComponentAccumulator()
204 kwargs.setdefault('TrackToTruthAssociationMaps','ActsCombinedTracksToTruthParticleAssociation')
205 kwargs.setdefault('TrackParticleContainerName','ActsCombinedTracksParticlesAlt')
206 kwargs.setdefault('TruthParticleHitCounts','TruthParticleHitCounts')
207 # weights used for computing the matching probability and identifying the best match
209 kwargs.setdefault('ComputeTrackRecoEfficiency',False)
210
211 if 'TruthSelectionTool' not in kwargs:
212 # should be as tight or looser as the TruthSelectionTool when analysing the truth matches
213 from InDetPhysValMonitoring.InDetPhysValMonitoringConfig import InDetRttTruthSelectionToolCfg
214 kwargs.setdefault("TruthSelectionTool", acc.popToolsAndMerge(
215 InDetRttTruthSelectionToolCfg(flags,
216 name='RelaxedInDetRttTruthSelectionTool',
217 requireOnlyPrimary=False,
218 minPt=500.,
219 maxEta=4.5
220 )))
221
222 if 'MCTruthClassifier' not in kwargs:
223 from MCTruthClassifier.MCTruthClassifierConfig import MCTruthClassifierCfg
224 kwargs.setdefault("MCTruthClassifier", acc.popToolsAndMerge(
225 MCTruthClassifierCfg(flags)))
226
227 acc.addEventAlgo( CompFactory.ActsTrk.TrackParticleTruthDecorationAlg(name=name, **kwargs) )
228 return acc
229
231 name: str = 'ActsTracksValidationAlg',
232 **kwargs: dict) -> ComponentAccumulator:
233 acc = ComponentAccumulator()
234 kwargs.setdefault('TruthParticleHitCounts','TruthParticleHitCounts')
235 kwargs.setdefault('TrackToTruthAssociationMap','ActsTracksToTruthParticles')
237 kwargs.setdefault('ComputeTrackRecoEfficiency',True)
238
239 if 'TruthSelectionTool' not in kwargs:
240 from InDetPhysValMonitoring.InDetPhysValMonitoringConfig import InDetRttTruthSelectionToolCfg
241 kwargs.setdefault("TruthSelectionTool", acc.popToolsAndMerge(
242 InDetRttTruthSelectionToolCfg(flags)))
243
244 acc.addEventAlgo( CompFactory.ActsTrk.TrackFindingValidationAlg(name=name, **kwargs) )
245 return acc
246
248 flags,
249 name: str = "TruthTrackBuilderTool",
250 **kwargs: dict) -> ComponentAccumulator:
251
252 acc = ComponentAccumulator()
253
254 kwargs.setdefault("usePixelClusters", flags.Acts.Gbts.Training.usePixelClusters)
255 kwargs.setdefault("useStripClusters", flags.Acts.Gbts.Training.useStripClusters)
256
257 acc.setPrivateTools(
258 CompFactory.ActsTrk.TruthTrackBuilderTool(
259 name=name,
260 **kwargs
261 )
262 )
263
264 return acc
265
267 name: str = "ActsGbtsTrainingAlg",
268 **kwargs: dict) -> ComponentAccumulator:
269 acc = ComponentAccumulator()
270
271 if "TruthTrackBuilderTool" not in kwargs:
272 kwargs.setdefault(
273 "TruthTrackBuilderTool",
274 acc.popToolsAndMerge(
276 )
277 )
278
279 kwargs.setdefault("geometryFile", find_datafile("gbts_layer_geometry.txt"))
280 kwargs.setdefault("outputConnectionTable", flags.Acts.Gbts.Training.outputConnectionTable)
281 kwargs.setdefault("doSymmetrization", flags.Acts.Gbts.Training.doSymmetrization)
282 kwargs.setdefault("useOldFormatting", flags.Acts.Gbts.Training.useOldFormatting)
283 kwargs.setdefault("probThreshold", flags.Acts.Gbts.Training.probThreshold)
284
285 acc.addEventAlgo(
286 CompFactory.ActsTrk.GbtsTrainingAlg(name=name, **kwargs)
287 )
288
289 return acc
ComponentAccumulator ActsTruthTrackBuilderToolCfg(flags, str name="TruthTrackBuilderTool", **dict kwargs)
ComponentAccumulator ActsTruthAssociationAlgCfg(flags, **dict kwargs)
setDefaultTruthMatchingArgs(kwargs)
ComponentAccumulator ActsTrackParticleTruthDecorationAlgCfg(flags, str name='ActsTrackParticleTruthDecorationAlg', **dict kwargs)
ComponentAccumulator ActsGbtsTrainingAlgCfg(flags, str name="ActsGbtsTrainingAlg", **dict kwargs)
ComponentAccumulator ActsInDetPixelClusterToTruthAssociationAlgCfg(flags, str name='ActsInDetPixelClusterToTruthAssociationAlg', **dict kwargs)
ComponentAccumulator ActsInDetStripClusterToTruthAssociationAlgCfg(flags, str name='ActsInDetStripClusterToTruthAssociationAlg', **dict kwargs)
ComponentAccumulator ActsStripClusterToTruthAssociationAlgCfg(flags, str name='ActsStripClusterToTruthAssociationAlg', **dict kwargs)
ComponentAccumulator ActsTruthParticleHitCountAlgCfg(flags, str name='ActsTruthParticleHitCountAlg', **dict kwargs)
ComponentAccumulator ActsPixelClusterToTruthAssociationAlgCfg(flags, str name='ActsPixelClusterToTruthAssociationAlg', **dict kwargs)
ComponentAccumulator ActsInDetTruthParticleHitCountAlgCfg(flags, str name='ActsInDetTruthParticleHitCountAlg', **dict kwargs)
ComponentAccumulator ActsTrackFindingValidationAlgCfg(flags, str name='ActsTracksValidationAlg', **dict kwargs)
ComponentAccumulator ActsHgtdClusterToTruthAssociationAlgCfg(flags, str name='ActsHgtdClusterToTruthAssociationAlg', **dict kwargs)
ComponentAccumulator ActsTrackToTruthAssociationAlgCfg(flags, str name='ActsTracksToTruthAssociationAlg', **dict kwargs)
ComponentAccumulator ActsInDetTrackToTruthAssociationAlgCfg(flags, str name='ActsInDetTracksToTruthAssociationAlg', **dict kwargs)
ComponentAccumulator MapToInDetSimDataWrapSvcCfg(flags, *, str collectionName)