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