ATLAS Offline Software
Loading...
Searching...
No Matches
MuonsCommonConfig.py
Go to the documentation of this file.
1# Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
2
3#********************************************************************
4# MuonsCommonConfig.py
5# Configures all tools needed for muon object selection and kernels
6# used to write results into SG.
7# ComponentAccumulator version
8#********************************************************************
9
10from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
11from AthenaConfiguration.ComponentFactory import CompFactory
12
13def MuonsCommonCfg(flags, suff=""):
14 """Main method configuring common muon augmentations"""
15
16 Container = "Muons"+suff
17
18 acc = ComponentAccumulator()
19 #====================================================================
20 # MCP GROUP TOOLS
21 #====================================================================
22
23 from DerivationFrameworkTools.DerivationFrameworkToolsConfig import AsgSelectionToolWrapperCfg
24 DFCommonMuonToolWrapperTools = []
25
26
28 from MuonSelectorTools.MuonSelectorToolsConfig import MuonLoosenedNonCalibratedSelectionToolCfg
29
30 DFCommonMuonsSelector = acc.popToolsAndMerge(MuonLoosenedNonCalibratedSelectionToolCfg(flags,
31 name = "DFCommonMuonsSelector",
32 MaxEta = 3.,
33 MuQuality = 3))
34 acc.addPublicTool(DFCommonMuonsSelector)
35 DFCommonMuonToolWrapperIDCuts = acc.getPrimaryAndMerge(AsgSelectionToolWrapperCfg(
36 flags,
37 name = "DFCommonMuonToolWrapperIDCuts"+suff,
38 AsgSelectionTool = DFCommonMuonsSelector,
39 CutType = "IDHits",
40 StoreGateEntryName = "DFCommonMuonPassIDCuts",
41 ContainerName = Container))
42 DFCommonMuonToolWrapperTools.append(DFCommonMuonToolWrapperIDCuts)
43
44 DFCommonMuonToolWrapperPreselection = acc.getPrimaryAndMerge(AsgSelectionToolWrapperCfg(
45 flags,
46 name = "DFCommonMuonToolWrapperPreselection"+suff,
47 AsgSelectionTool = DFCommonMuonsSelector,
48 CutType = "Preselection",
49 StoreGateEntryName = "DFCommonMuonPassPreselection",
50 ContainerName = Container))
51 DFCommonMuonToolWrapperTools.append(DFCommonMuonToolWrapperPreselection)
52
53
56 CommonAugmentation = CompFactory.DerivationFramework.CommonAugmentation
57 acc.addEventAlgo(CommonAugmentation("DFCommonMuonsKernel"+suff,
58 AugmentationTools = DFCommonMuonToolWrapperTools))
59
60 from IsolationAlgs.DerivationTrackIsoConfig import DerivationTrackIsoCfg
61 # A selection of WP is probably needed, as only a few variables are in CP content !
62 # maybe MUON derivations can add some other ones for studies
63 #listofTTVAWP = [ 'Loose', 'Nominal', 'Tight',
64 # 'Prompt_D0Sig', 'Prompt_MaxWeight',
65 # 'Nonprompt_Hard_D0Sig',
66 # 'Nonprompt_Medium_D0Sig',
67 # 'Nonprompt_All_D0Sig',
68 # 'Nonprompt_Hard_MaxWeight',
69 # 'Nonprompt_Medium_MaxWeight',
70 # 'Nonprompt_All_MaxWeight' ]
71 for WP in [ 'Nonprompt_All_MaxWeight' ]:
72 acc.merge(DerivationTrackIsoCfg(flags, WP = WP, object_types = ('Electrons', 'Muons'), postfix=suff))
73
74 if "LRT" in Container and not hasattr(acc, 'LRTMuonCaloIsolationBuilder'):
75 from IsolationAlgs.IsolationSteeringDerivConfig import LRTMuonIsolationSteeringDerivCfg
76 acc.merge(LRTMuonIsolationSteeringDerivCfg(flags))
77
78 from IsolationAlgs.IsolationBuilderConfig import muIsolationCfg
79 acc.merge(muIsolationCfg(flags,
80 name="muonIsolationLRT",
81 # Avoid overlap with the previously-configured IsolationBuilder.
82 noCalo=True,
83 MuonCollectionContainerName = Container
84 ))
85
86 return acc
87
89 extraVariablesMuons = [
90 "pt","eta", "phi","truthType","truthOrigin","truthClassification","author","muonType","charge","allAuthors", "CaloMuonIDTag", "CaloMuonScore",
91
92 "inDetTrackParticleLink","extrapolatedMuonSpectrometerTrackParticleLink", "muonSpectrometerTrackParticleLink","combinedTrackParticleLink", "TruthLink","truthParticleLink", "msOnlyExtrapolatedMuonSpectrometerTrackParticleLink", "clusterLink", "muonSegmentLinks",
93 "InnerDetectorPt","MuonSpectrometerPt","DFCommonGoodMuon", "momentumBalanceSignificance","scatteringCurvatureSignificance","scatteringNeighbourSignificance",
94 "neflowisol20","topoetcone20", "topoetcone20_CloseByCorr", "neflowisol20_CloseByCorr",
95 "ptcone20_Nonprompt_All_MaxWeightTTVA_pt1000", "ptcone20_Nonprompt_All_MaxWeightTTVA_pt500",
96 "ptvarcone30_Nonprompt_All_MaxWeightTTVA_pt1000", "ptvarcone30_Nonprompt_All_MaxWeightTTVA_pt500",
97 "ptvarcone30_Nonprompt_All_MaxWeightTTVA_pt500_CloseByCorr","ptvarcone30_Nonprompt_All_MaxWeightTTVA_pt1000_CloseByCorr",
98
99 "ptcone20","ptcone30","ptcone40","ptvarcone20","ptvarcone30","ptvarcone40","topoetcone30","topoetcone40",
100
101 "numberOfPrecisionLayers","combinedTrackOutBoundsPrecisionHits","numberOfPrecisionLayers","numberOfPrecisionHoleLayers","numberOfGoodPrecisionLayers",
102 "innerSmallHits","innerLargeHits","middleSmallHits","middleLargeHits","outerSmallHits","outerLargeHits",
103 "extendedSmallHits","extendedLargeHits",
104 "extendedSmallHoles","isSmallGoodSectors",
105
106 "extendedClosePrecisionHits","extendedLargeHoles","extendedOutBoundsPrecisionHits","innerClosePrecisionHits","innerLargeHoles","innerOutBoundsPrecisionHits","innerSmallHoles","isEndcapGoodLayers","middleClosePrecisionHits","middleLargeHoles","middleOutBoundsPrecisionHits","middleSmallHoles","outerClosePrecisionHits","outerLargeHoles","outerOutBoundsPrecisionHits","outerSmallHoles","segmentDeltaEta","spectrometerFieldIntegral",
107
108 "EnergyLoss","energyLossType",
109
110 "DFCommonJetDr","DFCommonMuonPassIDCuts","DFCommonMuonPassPreselection","DFCommonGoodMuon",
111
112 "CaloLRLikelihood","quality",
113 ]
114
115 from AthenaConfiguration.Enums import LHCPeriod
116 if flags.GeoModel.Run >= LHCPeriod.Run3: extraVariablesMuons += [
117 "etaLayer1STGCHits", "etaLayer2STGCHits","phiLayer1STGCHits","phiLayer2STGCHits","MMHits"
118 ]
119 else: extraVariablesMuons += [
120 "cscUnspoiledEtaHits","cscEtaHits",
121 ]
122 return extraVariablesMuons
123
124
126 return ["phi","theta","qOverP","d0","z0","vz","truthType","truthOrigin","truthClassification",
127 "definingParametersCovMatrixDiag", "definingParametersCovMatrixOffDiag",
128 "chiSquared","numberDoF",
129 "vertexLink",
130 "truthParticleLink",
131 #ID hit summary
132 "numberOfPixelHits","numberOfPixelHoles","numberOfPixelDeadSensors", "numberOfInnermostPixelLayerHits",
133 "numberOfSCTHits","numberOfSCTHoles","numberOfSCTDeadSensors",
134 "numberOfTRTHits","numberOfTRTOutliers",
135 # MS hit summary
136 "numberOfPrecisionLayers","numberOfPrecisionHoleLayers",
137 "numberOfPhiLayers","numberOfPhiHoleLayers",
138
139 "alignEffectChId","alignEffectDeltaTrans","alignEffectSigmaDeltaTrans",
140 "alignEffectDeltaAngle","alignEffectSigmaDeltaAngle",
141 ]
142
144 return [
145 #Perigee
146 "phi", "theta","qOverP", "d0", "z0", "vz", "truthType", "truthOrigin", "truthClassification",
147 "definingParametersCovMatrixDiag", "definingParametersCovMatrixOffDiag",
148 "chiSquared", "numberDoF",
149
150 "vertexLink", "truthParticleLink",
151 #ID hit summary (these shouldn't be here, adding them to fully replicate the previous version of DAODs since I got a crash somehow in tests; we should remove them asap)
152 "numberOfPixelHits","numberOfPixelHoles","numberOfPixelDeadSensors",
153 "numberOfSCTHits","numberOfSCTHoles","numberOfSCTDeadSensors",
154 "numberOfTRTHits","numberOfTRTOutliers",
155 # MS hit summary
156 "numberOfPhiLayers", "numberOfPhiHoleLayers",
157 "numberOfPrecisionHoleLayers", "numberOfPrecisionLayers",
158 # AEOT
159 "alignEffectChId", "alignEffectDeltaTrans", "alignEffectSigmaDeltaTrans", "alignEffectDeltaAngle", "alignEffectSigmaDeltaAngle"
160 ]
161
162def MSTrkVarsCfg(flags):
163 return [
164 "theta","qOverP","phi","d0","z0","vz",
165 "definingParametersCovMatrixDiag","definingParametersCovMatrixOffDiag",
166 "chiSquared", "numberDoF",
167 "vertexLink","truthParticleLink"
168 ]
169
171 return [
172 "theta","phi","qOverP", "d0", "z0", "vz",
173 "chiSquared", "numberDoF",
174 "definingParametersCovMatrixDiag","definingParametersCovMatrixOffDiag",
175
176 "numberOfPixelHits","numberOfPixelDeadSensors", "numberOfPixelHoles",
177 "numberOfSCTHits","numberOfSCTDeadSensors", "numberOfSCTHoles",
178 "numberOfTRTHits","numberOfTRTOutliers",
179
180 "truthType","truthOrigin","truthClassification",
181 ]
182
184 return ["phi","theta","qOverP","numberOfPixelHits","numberOfPixelHoles","numberOfPixelDeadSensors","numberOfSCTHits","numberOfSCTHoles","numberOfSCTDeadSensors","numberOfTRTHits","numberOfTRTOutliers","numberOfPrecisionLayers","d0","z0","vz","definingParametersCovMatrixDiag","definingParametersCovMatrixOffDiag","vertexLink","truthParticleLink","chiSquared","numberDoF","numberOfPhiLayers","numberOfPhiHoleLayers","numberOfPrecisionHoleLayers","truthType","truthOrigin","truthClassification"]
185
187 return ["theta","phi","qOverP","numberOfPrecisionLayers","numberOfPrecisionHoleLayers","numberOfPixelHits","numberOfPixelDeadSensors","numberOfSCTHits","numberOfSCTDeadSensors","d0","z0","vz","definingParametersCovMatrixDiag","definingParametersCovMatrixOffDiag","numberOfPixelHoles","numberOfSCTHoles","numberOfTRTHits","numberOfTRTOutliers","truthType","truthOrigin","truthClassification"]
188
190
191 return ["trackParticleLinks","pt","eta","phi","m","f1","topoetcone40","truthParticleLink","caloClusterLinks"]
192
194
195 return ["pt","eta","phi","m","caloClusterLinks","author","f1","topoetcone40","Tight","truthParticleLink","vertexLink"]
196
198 return ["chamberIndex"]
199
201 return [
202 "InDetTrackParticles",
203 "InDetTrackParticlesAux.{id_variables}".format(id_variables = ".".join(MuonCPInDetVarsCfg(flags))),
204 "InDetForwardTrackParticles",
205 "InDetForwardTrackParticlesAux.{fwdid_variables}".format(fwdid_variables = ".".join(MuonCPInDetFwdVarsCfg(flags))),
206 "CombinedMuonTrackParticles",
207 "CombinedMuonTrackParticlesAux.{cmb_variables}".format(cmb_variables = ".".join(CombinedTrackVarsCfg(flags))),
208 "ExtrapolatedMuonTrackParticles",
209 "ExtrapolatedMuonTrackParticlesAux.{me_variables}".format(me_variables = ".".join(MuonCPMETrkVarsCfg(flags))),
210 "MuonSpectrometerTrackParticles",
211 "MuonSpectrometerTrackParticlesAux.{ms_variables}".format(ms_variables = ".".join(MSTrkVarsCfg(flags))),
212 "Muons",
213 "MuonsAux.{muon_variables}".format(muon_variables = ".".join(MuonVariablesCfg(flags))),
214 "InDetForwardTrackParticles",
215 "InDetForwardTrackParticlesAux.{sifwd_variables}".format(sifwd_variables = ".".join(MuonCPInDetSiAssocVarsCfg(flags))),
216 "MuonSegments",
217 "MuonSegmentsAux.{seg_variables}".format(seg_variables = ".".join(MuonSegmentVarsCfg(flags))),
218 "Electrons",
219 "ElectronsAux.{el_variables}".format(el_variables = ".".join(MuonCPElectronsVarsCfg(flags))),
220 "Photons",
221 "PhotonsAux.{ph_variables}".format(ph_variables = ".".join(MuonCPPhotonsVarsCfg(flags))),
222 ]
223
225 return [
226 "InDetLargeD0TrackParticles",
227 "InDetLargeD0TrackParticlesAux.{id_variables}".format(id_variables = ".".join(MuonCPInDetVarsCfg(flags))),
228 "InDetForwardTrackParticles",
229 "InDetForwardTrackParticlesAux.{fwdid_variables}".format(fwdid_variables = ".".join(MuonCPInDetFwdVarsCfg(flags))),
230 "CombinedMuonsLRTTrackParticles",
231 "CombinedMuonsLRTTrackParticlesAux.{cmb_variables}".format(cmb_variables = ".".join(CombinedTrackVarsCfg(flags))),
232 "MuonsLRT",
233 "MuonsLRTAux.{muon_variables}".format(muon_variables = ".".join(MuonVariablesCfg(flags))),
234 "MuonSpectrometerTrackParticles",
235 "MuonSpectrometerTrackParticlesAux.{ms_variables}".format(ms_variables = ".".join(MSTrkVarsCfg(flags))),
236 "ExtraPolatedMuonsLRTTrackParticles",
237 "ExtraPolatedMuonsLRTTrackParticlesAux.{me_variables}".format(me_variables = ".".join(MuonCPMETrkVarsCfg(flags))),
238 "MuonSegments",
239 "MuonSegmentsAux.{seg_variables}".format(seg_variables = ".".join(MuonSegmentVarsCfg(flags))),
240 "LRTElectrons",
241 "LRTElectronsAux.{el_variables}".format(el_variables = ".".join(MuonCPElectronsVarsCfg(flags))),
242 "Photons",
243 "PhotonsAux.{ph_variables}".format(ph_variables = ".".join(MuonCPPhotonsVarsCfg(flags))),
244 "LRTegammaClustersAux.calEta.calPhi.calE.calM",
245 "LRTegammaTopoSeededClusters",
246 "LRTegammaTopoSeededClustersAux.calEta.calPhi",
247 ]