ATLAS Offline Software
MuonsCommonConfig.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2023 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 
10 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
11 from AthenaConfiguration.ComponentFactory import CompFactory
12 
13 def 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 MuonSelectionToolCfg
29 
30  DFCommonMuonsSelector = acc.popToolsAndMerge(MuonSelectionToolCfg(flags,
31  name = "DFCommonMuonsSelector",
32  MaxEta = 3.,
33  MuQuality = 3,
34  TurnOffMomCorr = True))
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  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 
89 def MuonVariablesCfg(flags):
90  extraVariablesMuons = [
91  "pt","eta", "phi","truthType","truthOrigin","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 
116  from AthenaConfiguration.Enums import LHCPeriod
117  if flags.GeoModel.Run >= LHCPeriod.Run3: extraVariablesMuons += [
118  "etaLayer1STGCHits", "etaLayer2STGCHits","phiLayer1STGCHits","phiLayer2STGCHits","MMHits"
119  ]
120  else: extraVariablesMuons += [
121  "cscUnspoiledEtaHits","cscEtaHits",
122  ]
123  return extraVariablesMuons
124 
125 
127  return ["phi","theta","qOverP","d0","z0","vz",
128  "definingParametersCovMatrixDiag", "definingParametersCovMatrixOffDiag",
129  "chiSquared","numberDoF",
130  "vertexLink",
131  "truthParticleLink",
132  #ID hit summary
133  "numberOfPixelHits","numberOfPixelHoles","numberOfPixelDeadSensors", "numberOfInnermostPixelLayerHits",
134  "numberOfSCTHits","numberOfSCTHoles","numberOfSCTDeadSensors",
135  "numberOfTRTHits","numberOfTRTOutliers",
136  # MS hit summary
137  "numberOfPrecisionLayers","numberOfPrecisionHoleLayers",
138  "numberOfPhiLayers","numberOfPhiHoleLayers",
139 
140  "alignEffectChId","alignEffectDeltaTrans","alignEffectSigmaDeltaTrans",
141  "alignEffectDeltaAngle","alignEffectSigmaDeltaAngle",
142 ]
143 
145  return [
146  #Perigee
147  "phi", "theta","qOverP", "d0", "z0", "vz",
148  "definingParametersCovMatrixDiag", "definingParametersCovMatrixOffDiag",
149  "chiSquared", "numberDoF",
150 
151  "vertexLink", "truthParticleLink",
152  #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)
153  "numberOfPixelHits","numberOfPixelHoles","numberOfPixelDeadSensors",
154  "numberOfSCTHits","numberOfSCTHoles","numberOfSCTDeadSensors",
155  "numberOfTRTHits","numberOfTRTOutliers",
156  # MS hit summary
157  "numberOfPhiLayers", "numberOfPhiHoleLayers",
158  "numberOfPrecisionHoleLayers", "numberOfPrecisionLayers",
159  # AEOT
160  "alignEffectChId", "alignEffectDeltaTrans", "alignEffectSigmaDeltaTrans", "alignEffectDeltaAngle", "alignEffectSigmaDeltaAngle"
161  ]
162 
163 def MSTrkVarsCfg(flags):
164  return [
165  "theta","qOverP","phi","d0","z0","vz",
166  "definingParametersCovMatrixDiag","definingParametersCovMatrixOffDiag",
167  "chiSquared", "numberDoF",
168  "vertexLink","truthParticleLink"
169  ]
170 
172  return [
173  "theta","phi","qOverP", "d0", "z0", "vz",
174  "chiSquared", "numberDoF",
175  "definingParametersCovMatrixDiag","definingParametersCovMatrixOffDiag",
176 
177  "numberOfPixelHits","numberOfPixelDeadSensors", "numberOfPixelHoles",
178  "numberOfSCTHits","numberOfSCTDeadSensors", "numberOfSCTHoles",
179  "numberOfTRTHits","numberOfTRTOutliers",
180 
181  "truthType","truthOrigin",
182  ]
183 
185  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"]
186 
188  return ["theta","phi","qOverP","numberOfPrecisionLayers","numberOfPrecisionHoleLayers","numberOfPixelHits","numberOfPixelDeadSensors","numberOfSCTHits","numberOfSCTDeadSensors","d0","z0","vz","definingParametersCovMatrixDiag","definingParametersCovMatrixOffDiag","numberOfPixelHoles","numberOfSCTHoles","numberOfTRTHits","numberOfTRTOutliers","truthType","truthOrigin"]
189 
191 
192  return ["trackParticleLinks","pt","eta","phi","m","f1","topoetcone40","truthParticleLink","caloClusterLinks"]
193 
195 
196  return ["pt","eta","phi","m","caloClusterLinks","author","f1","topoetcone40","Tight","truthParticleLink","vertexLink"]
197 
199  return ["chamberIndex"]
200 
201 def MuonCPContentCfg(flags):
202  return [
203  "InDetTrackParticles",
204  "InDetTrackParticlesAux.{id_variables}".format(id_variables = ".".join(MuonCPInDetVarsCfg(flags))),
205  "InDetForwardTrackParticles",
206  "InDetForwardTrackParticlesAux.{fwdid_variables}".format(fwdid_variables = ".".join(MuonCPInDetFwdVarsCfg(flags))),
207  "CombinedMuonTrackParticles",
208  "CombinedMuonTrackParticlesAux.{cmb_variables}".format(cmb_variables = ".".join(CombinedTrackVarsCfg(flags))),
209  "ExtrapolatedMuonTrackParticles",
210  "ExtrapolatedMuonTrackParticlesAux.{me_variables}".format(me_variables = ".".join(MuonCPMETrkVarsCfg(flags))),
211  "MuonSpectrometerTrackParticles",
212  "MuonSpectrometerTrackParticlesAux.{ms_variables}".format(ms_variables = ".".join(MSTrkVarsCfg(flags))),
213  "Muons",
214  "MuonsAux.{muon_variables}".format(muon_variables = ".".join(MuonVariablesCfg(flags))),
215  "InDetForwardTrackParticles",
216  "InDetForwardTrackParticlesAux.{sifwd_variables}".format(sifwd_variables = ".".join(MuonCPInDetSiAssocVarsCfg(flags))),
217  "MuonSegments",
218  "MuonSegmentsAux.{seg_variables}".format(seg_variables = ".".join(MuonSegmentVarsCfg(flags))),
219  "Electrons",
220  "ElectronsAux.{el_variables}".format(el_variables = ".".join(MuonCPElectronsVarsCfg(flags))),
221  "Photons",
222  "PhotonsAux.{ph_variables}".format(ph_variables = ".".join(MuonCPPhotonsVarsCfg(flags))),
223  ]
224 
226  return [
227  "InDetLargeD0TrackParticles",
228  "InDetLargeD0TrackParticlesAux.{id_variables}".format(id_variables = ".".join(MuonCPInDetVarsCfg(flags))),
229  "InDetForwardTrackParticles",
230  "InDetForwardTrackParticlesAux.{fwdid_variables}".format(fwdid_variables = ".".join(MuonCPInDetFwdVarsCfg(flags))),
231  "CombinedMuonsLRTTrackParticles",
232  "CombinedMuonsLRTTrackParticlesAux.{cmb_variables}".format(cmb_variables = ".".join(CombinedTrackVarsCfg(flags))),
233  "MuonsLRT",
234  "MuonsLRTAux.{muon_variables}".format(muon_variables = ".".join(MuonVariablesCfg(flags))),
235  "MuonSpectrometerTrackParticles",
236  "MuonSpectrometerTrackParticlesAux.{ms_variables}".format(ms_variables = ".".join(MSTrkVarsCfg(flags))),
237  "ExtraPolatedMuonsLRTTrackParticles",
238  "ExtraPolatedMuonsLRTTrackParticlesAux.{me_variables}".format(me_variables = ".".join(MuonCPMETrkVarsCfg(flags))),
239  "MuonSegments",
240  "MuonSegmentsAux.{seg_variables}".format(seg_variables = ".".join(MuonSegmentVarsCfg(flags))),
241  "LRTElectrons",
242  "LRTElectronsAux.{el_variables}".format(el_variables = ".".join(MuonCPElectronsVarsCfg(flags))),
243  "Photons",
244  "PhotonsAux.{ph_variables}".format(ph_variables = ".".join(MuonCPPhotonsVarsCfg(flags))),
245  "LRTegammaClustersAux.calEta.calPhi.calE.calM",
246  "LRTegammaTopoSeededClusters",
247  "LRTegammaTopoSeededClustersAux.calEta.calPhi",
248  ]
IsolationSteeringDerivConfig.LRTMuonIsolationSteeringDerivCfg
def LRTMuonIsolationSteeringDerivCfg(flags, name='LRTMuonCaloIsolationSteeringDeriv')
Definition: IsolationSteeringDerivConfig.py:104
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
vtune_athena.format
format
Definition: vtune_athena.py:14
python.MuonsCommonConfig.MuonSegmentVarsCfg
def MuonSegmentVarsCfg(flags)
Definition: MuonsCommonConfig.py:198
python.MuonsCommonConfig.MuonCPContentCfg
def MuonCPContentCfg(flags)
Definition: MuonsCommonConfig.py:201
python.MuonsCommonConfig.CombinedTrackVarsCfg
def CombinedTrackVarsCfg(flags)
Definition: MuonsCommonConfig.py:126
python.MuonsCommonConfig.MSTrkVarsCfg
def MSTrkVarsCfg(flags)
Definition: MuonsCommonConfig.py:163
python.MuonsCommonConfig.MuonCPInDetVarsCfg
def MuonCPInDetVarsCfg(flags)
Definition: MuonsCommonConfig.py:184
python.MuonsCommonConfig.MuonCPPhotonsVarsCfg
def MuonCPPhotonsVarsCfg(flags)
Definition: MuonsCommonConfig.py:194
python.MuonsCommonConfig.MuonVariablesCfg
def MuonVariablesCfg(flags)
Definition: MuonsCommonConfig.py:89
python.MuonsCommonConfig.MuonCPMETrkVarsCfg
def MuonCPMETrkVarsCfg(flags)
Definition: MuonsCommonConfig.py:144
python.MuonsCommonConfig.MuonsCommonCfg
def MuonsCommonCfg(flags, suff="")
Definition: MuonsCommonConfig.py:13
python.DerivationFrameworkToolsConfig.AsgSelectionToolWrapperCfg
def AsgSelectionToolWrapperCfg(ConfigFlags, name, **kwargs)
Definition: DerivationFrameworkToolsConfig.py:11
TCS::join
std::string join(const std::vector< std::string > &v, const char c=',')
Definition: Trigger/TrigT1/L1Topo/L1TopoCommon/Root/StringUtils.cxx:10
python.MuonSelectorToolsConfig.MuonSelectionToolCfg
def MuonSelectionToolCfg(flags, name="MuonSelectionTool", **kwargs)
Standard configuration of the MuonSelectionTool used in reconstruction & validation jobs The snippet ...
Definition: MuonSelectorToolsConfig.py:16
python.MuonsCommonConfig.MuonCPInDetFwdVarsCfg
def MuonCPInDetFwdVarsCfg(flags)
Definition: MuonsCommonConfig.py:187
DerivationTrackIsoConfig.DerivationTrackIsoCfg
def DerivationTrackIsoCfg(flags, **jwarg)
Definition: DerivationTrackIsoConfig.py:11
python.MuonsCommonConfig.MuonCPContentLRTCfg
def MuonCPContentLRTCfg(flags)
Definition: MuonsCommonConfig.py:225
python.MuonsCommonConfig.MuonCPElectronsVarsCfg
def MuonCPElectronsVarsCfg(flags)
Definition: MuonsCommonConfig.py:190
IsolationBuilderConfig.muIsolationCfg
def muIsolationCfg(flags, name='muIsolation', noCalo=False, **kwargs)
Definition: IsolationBuilderConfig.py:75
python.MuonsCommonConfig.MuonCPInDetSiAssocVarsCfg
def MuonCPInDetSiAssocVarsCfg(flags)
Definition: MuonsCommonConfig.py:171