ATLAS Offline Software
ActsTruthConfig.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2 
3 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
4 from AthenaConfiguration.ComponentFactory import CompFactory
5 from ActsInterop import UnitConstants
6 from ActsConfig.ActsUtilities import extractChildKwargs
7 
9  *,
10  collectionName: str) -> ComponentAccumulator:
11  acc = ComponentAccumulator()
12 
13  AddressRemappingSvc = CompFactory.AddressRemappingSvc(
14  TypeKeyOverwriteMaps = [f"InDetSimDataCollection#{collectionName}->InDetSimDataCollectionWrap#{collectionName}"]
15  )
16  acc.addService(AddressRemappingSvc)
17  return acc
18 
19 
21  name: str = 'ActsPixelClusterToTruthAssociationAlg',
22  **kwargs: dict) -> ComponentAccumulator:
23  acc = ComponentAccumulator()
24  acc.merge( MapToInDetSimDataWrapSvcCfg(flags, collectionName='ITkPixelSDO_Map') )
25 
26  kwargs.setdefault('InputTruthParticleLinks', 'xAODTruthLinks')
27  kwargs.setdefault('SimData', 'ITkPixelSDO_Map')
28  kwargs.setdefault('DepositedEnergyMin', 300) # @TODO revise ? From PRD_MultiTruthBuilder.h; should be 1/10 of threshold
29  kwargs.setdefault('Measurements', 'ITkPixelClusters')
30  kwargs.setdefault('AssociationMapOut', 'ITkPixelClustersToTruthParticles')
31 
32  acc.addEventAlgo( CompFactory.ActsTrk.PixelClusterToTruthAssociationAlg(name=name, **kwargs) )
33  return acc
34 
36  name: str = 'ActsStripClusterToTruthAssociationAlg',
37  **kwargs: dict) -> ComponentAccumulator:
38  acc = ComponentAccumulator()
39  acc.merge( MapToInDetSimDataWrapSvcCfg(flags, collectionName='ITkStripSDO_Map') )
40 
41  kwargs.setdefault('InputTruthParticleLinks', 'xAODTruthLinks')
42  kwargs.setdefault('SimData', 'ITkStripSDO_Map')
43  kwargs.setdefault('DepositedEnergyMin', 600) # @TODO revise ? From PRD_MultiTruthBuilder.h; should be 1/10 of threshold
44  kwargs.setdefault('Measurements', 'ITkStripClusters')
45  kwargs.setdefault('AssociationMapOut', 'ITkStripClustersToTruthParticles')
46 
47  acc.addEventAlgo( CompFactory.ActsTrk.StripClusterToTruthAssociationAlg(name=name, **kwargs) )
48  return acc
49 
51  name: str = 'ActsTracksToTruthAssociationAlg',
52  **kwargs: dict) -> ComponentAccumulator:
53  acc = ComponentAccumulator()
54  acc.merge( MapToInDetSimDataWrapSvcCfg(flags, collectionName='ITkStripSDO_Map') )
55 
56  kwargs.setdefault('ACTSTracksLocation','ActsTracks')
57  kwargs.setdefault('PixelClustersToTruthAssociationMap','ITkPixelClustersToTruthParticles')
58  kwargs.setdefault('StripClustersToTruthAssociationMap','ITkStripClustersToTruthParticles')
59  kwargs.setdefault('AssociationMapOut','ActsTracksToTruthParticles')
60  kwargs.setdefault('MaxEnergyLoss',1e3*UnitConstants.TeV)
61 
62  if 'TrackingGeometryTool' not in kwargs:
63  from ActsConfig.ActsGeometryConfig import ActsTrackingGeometryToolCfg
64  kwargs.setdefault("TrackingGeometryTool", acc.popToolsAndMerge(ActsTrackingGeometryToolCfg(flags)))
65 
66  acc.addEventAlgo( CompFactory.ActsTrk.TrackToTruthAssociationAlg(name=name, **kwargs) )
67  return acc
68 
70  name: str = 'ActsTruthParticleHitCountAlg',
71  **kwargs: dict) -> ComponentAccumulator:
72  acc = ComponentAccumulator()
73  acc.merge( MapToInDetSimDataWrapSvcCfg(flags, collectionName='ITkStripSDO_Map') )
74 
75  kwargs.setdefault('PixelClustersToTruthAssociationMap','ITkPixelClustersToTruthParticles')
76  kwargs.setdefault('StripClustersToTruthAssociationMap','ITkStripClustersToTruthParticles')
77  kwargs.setdefault('TruthParticleHitCountsOut','TruthParticleHitCounts')
78  kwargs.setdefault('MaxEnergyLoss',1e3*UnitConstants.TeV) # @TODO introduce flag and synchronise with TrackToTruthAssociationAlg
79  kwargs.setdefault('NHitsMin',4)
80 
81  if 'TrackingGeometryTool' not in kwargs:
82  from ActsConfig.ActsGeometryConfig import ActsTrackingGeometryToolCfg
83  kwargs.setdefault("TrackingGeometryTool", acc.popToolsAndMerge(ActsTrackingGeometryToolCfg(flags)))
84 
85  acc.addEventAlgo( CompFactory.ActsTrk.TruthParticleHitCountAlg(name=name, **kwargs) )
86  return acc
87 
88 
90  **kwargs: dict) -> ComponentAccumulator:
91  acc = ComponentAccumulator()
92 
93  if flags.Detector.EnableITkPixel:
94  acc.merge(ActsPixelClusterToTruthAssociationAlgCfg(flags, **extractChildKwargs(prefix="PixelClusterToTruthAssociationAlg.", **kwargs) ))
95 
96  if flags.Detector.EnableITkStrip:
97  acc.merge(ActsStripClusterToTruthAssociationAlgCfg(flags, **extractChildKwargs(prefix="StripClusterToTruthAssociationAlg.", **kwargs) ))
98 
99  return acc
100 
102  kwargs.setdefault('MatchWeights',[0., # other
103  10., 5., # ID (pixel, strips)
104  0., 0., 0. , 0., # MS
105  0. ]) # HGTD
106  # weights used for hit purity and hit efficiencies
107  kwargs.setdefault('CountWeights',[0., # other
108  1.,1., # ID (pixel, strips)
109  0., 0., 0. , 0., # MS
110  0. ]) # HGTD
111  kwargs.setdefault('StatisticPtBins',[1e3,2.5e3,5e3,10e3,100e3])
112  kwargs.setdefault('ShowDetailedTables',False)
113  kwargs.setdefault('PdgIdCategorisation',False)
114  kwargs.setdefault('StatisticEtaBins',[eta/10. for eta in range(5, 40, 5)])
115 
117  name: str = 'ActsTrackParticleTruthDecorationAlg',
118  **kwargs: dict) -> ComponentAccumulator:
119  acc = ComponentAccumulator()
120  kwargs.setdefault('TrackToTruthAssociationMaps','ActsCombinedTracksToTruthParticleAssociation')
121  kwargs.setdefault('TrackParticleContainerName','ActsCombinedTracksParticlesAlt')
122  kwargs.setdefault('TruthParticleHitCounts','TruthParticleHitCounts')
123  # weights used for computing the matching probability and identifying the best match
125  kwargs.setdefault('ComputeTrackRecoEfficiency',False)
126 
127  if 'TruthSelectionTool' not in kwargs:
128  # should be as tight or looser as the TruthSelectionTool when analysing the truth matches
129  from InDetPhysValMonitoring.InDetPhysValMonitoringConfig import InDetRttTruthSelectionToolCfg
130  kwargs.setdefault("TruthSelectionTool", acc.popToolsAndMerge(
132  name='RelaxedInDetRttTruthSelectionTool',
133  requireOnlyPrimary=False,
134  minPt=500.,
135  maxEta=4.5
136  )))
137 
138  acc.addEventAlgo( CompFactory.ActsTrk.TrackParticleTruthDecorationAlg(name=name, **kwargs) )
139  return acc
140 
142  name: str = 'ActsTracksValidationAlg',
143  **kwargs: dict) -> ComponentAccumulator:
144  acc = ComponentAccumulator()
145  kwargs.setdefault('TruthParticleHitCounts','TruthParticleHitCounts')
146  kwargs.setdefault('TrackToTruthAssociationMap','ActsTracksToTruthParticles')
148  kwargs.setdefault('ComputeTrackRecoEfficiency',True)
149 
150  if 'TruthSelectionTool' not in kwargs:
151  from InDetPhysValMonitoring.InDetPhysValMonitoringConfig import InDetRttTruthSelectionToolCfg
152  kwargs.setdefault("TruthSelectionTool", acc.popToolsAndMerge(
154 
155  acc.addEventAlgo( CompFactory.ActsTrk.TrackFindingValidationAlg(name=name, **kwargs) )
156  return acc
ActsTruthConfig.setDefaultTruthMatchingArgs
def setDefaultTruthMatchingArgs(kwargs)
Definition: ActsTruthConfig.py:101
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
ActsUtilities.extractChildKwargs
dict extractChildKwargs(*str prefix, **dict kwargs)
Definition: ActsUtilities.py:3
ActsTruthConfig.MapToInDetSimDataWrapSvcCfg
ComponentAccumulator MapToInDetSimDataWrapSvcCfg(flags, *str collectionName)
Definition: ActsTruthConfig.py:8
ActsTruthConfig.ActsTruthParticleHitCountAlgCfg
ComponentAccumulator ActsTruthParticleHitCountAlgCfg(flags, str name='ActsTruthParticleHitCountAlg', **dict kwargs)
Definition: ActsTruthConfig.py:69
ActsTruthConfig.ActsTrackToTruthAssociationAlgCfg
ComponentAccumulator ActsTrackToTruthAssociationAlgCfg(flags, str name='ActsTracksToTruthAssociationAlg', **dict kwargs)
Definition: ActsTruthConfig.py:50
ActsTruthConfig.ActsPixelClusterToTruthAssociationAlgCfg
ComponentAccumulator ActsPixelClusterToTruthAssociationAlgCfg(flags, str name='ActsPixelClusterToTruthAssociationAlg', **dict kwargs)
Definition: ActsTruthConfig.py:20
ActsTruthConfig.ActsTrackFindingValidationAlgCfg
ComponentAccumulator ActsTrackFindingValidationAlgCfg(flags, str name='ActsTracksValidationAlg', **dict kwargs)
Definition: ActsTruthConfig.py:141
InDetPhysValMonitoringConfig.InDetRttTruthSelectionToolCfg
def InDetRttTruthSelectionToolCfg(flags, name="InDetRttTruthSelectionTool", **kwargs)
Definition: InDetPhysValMonitoringConfig.py:38
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:195
ActsGeometryConfig.ActsTrackingGeometryToolCfg
ComponentAccumulator ActsTrackingGeometryToolCfg(flags, str name="ActsTrackingGeometryTool")
Definition: ActsGeometryConfig.py:99
ActsTruthConfig.ActsTruthAssociationAlgCfg
ComponentAccumulator ActsTruthAssociationAlgCfg(flags, **dict kwargs)
Definition: ActsTruthConfig.py:89
ActsTruthConfig.ActsTrackParticleTruthDecorationAlgCfg
ComponentAccumulator ActsTrackParticleTruthDecorationAlgCfg(flags, str name='ActsTrackParticleTruthDecorationAlg', **dict kwargs)
Definition: ActsTruthConfig.py:116
ActsTruthConfig.ActsStripClusterToTruthAssociationAlgCfg
ComponentAccumulator ActsStripClusterToTruthAssociationAlgCfg(flags, str name='ActsStripClusterToTruthAssociationAlg', **dict kwargs)
Definition: ActsTruthConfig.py:35