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