ATLAS Offline Software
Loading...
Searching...
No Matches
MuonChainConfiguration.py
Go to the documentation of this file.
1# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2
3
8from AthenaCommon.Logging import logging
9logging.getLogger().info("Importing %s",__name__)
10log = logging.getLogger(__name__)
11
12from ..Config.ChainConfigurationBase import ChainConfigurationBase
13
14from .MuonMenuSequences import (
15 muFastSequenceGenCfg, muFastCalibSequenceGenCfg, mul2mtSAOvlpRmSequenceGenCfg,
16 muCombSequenceGenCfg, muCombOvlpRmSequenceGenCfg, mul2mtCBOvlpRmSequenceGenCfg,
17 mul2IOOvlpRmSequenceGenCfg, muCombLRTSequenceGenCfg, muEFSASequenceGenCfg,
18 muEFSAFSSequenceGenCfg, efLateMuSequenceGenCfg, muEFCBSequenceGenCfg,
19 muEFCBl2ioSequenceGenCfg, muEFCBl2mtSequenceGenCfg, muEFCBidReuseSequenceGenCfg,
20 muEFCBIDperfSequenceGenCfg, muEFCBLRTSequenceGenCfg, muEFCBLRTIDperfSequenceGenCfg,
21 muEFCBFSSequenceGenCfg, muEFIDtpSequenceGenCfg, muEFIsoSequenceGenCfg,
22 muEFMSIsoSequenceGenCfg, efLateMuRoISequenceGenCfg, muRoiClusterSequenceGenCfg )
23
24from TrigMuonHypo.TrigMuonHypoConfig import TrigMuonEFInvMassHypoToolFromDict
25from TrigMuonHypo.TrigMuonHypoConfig import TrigMuonEFIdtpInvMassHypoToolFromDict
26
27
28
31
32class MuonChainConfiguration(ChainConfigurationBase):
33
34 def __init__(self, chainDict):
35 ChainConfigurationBase.__init__(self,chainDict)
36
37 # ----------------------
38 # Assemble the chain depending on information from chainName
39 # ----------------------
40
41 def assembleChainImpl(self, flags):
42 chainSteps = []
43
44 stepDictionary = self.getStepDictionary()
45
46 is_probe_leg = self.chainPart['tnpInfo']=="probe"
47 key = self.chainPart['extra']
48
49 steps=stepDictionary[key]
50
51 for step in steps:
52 if step:
53 chainstep = getattr(self, step)(flags, is_probe_leg=is_probe_leg)
54 chainSteps+=[chainstep]
55
56 myChain = self.buildChain(chainSteps)
57 return myChain
58
60
61 # --------------------
62 # define here the names of the steps and obtain the chainStep configuration
63 # --------------------
64 doMSonly = 'msonly' in self.chainPart['msonlyInfo']
65 muCombStep = 'getmuComb'
66 efCBStep = 'getmuEFCB'
67 if self.chainPart['isoInfo']:
68 isoStep = 'getmuEFIso'
69 if doMSonly:
70 isoStep = 'getmuEFMSIso'
71 #need to align SA and isolation steps between
72 # ms-only and standard iso chains
73 muCombStep = 'getmuMSEmpty'
74 efCBStep = 'getEFCBEmpty'
75 else:
76 isoStep=None
77 if doMSonly:
78 #need to align final SA step between ms-only
79 #and standard chains
80 muCombStep = 'getmuMSEmpty'
81 efCBStep = None
82
83 useNewFast = 'newFast' in self.chainPart['l2AlgInfo']
84 L2SAStep = 'getmuFast'
85 if useNewFast:
86 # TEMPORARY: the new Fast is scheduled in the EFSA until development is finalized. Then it will be moved to the L2 step
87 L2SAStep = 'getmuFastEmpty'
88 muCombStep = 'getmuMSEmpty'
89
90 stepDictionary = {
91 "":[L2SAStep, muCombStep, 'getmuEFSA',efCBStep, isoStep], #RoI-based triggers
92 "noL1":['getFSmuEFSA'] if doMSonly else ['getFSmuEFSA', 'getFSmuEFCB'], #full scan triggers
93 "lateMu":['getLateMuRoI','getLateMu'], #late muon triggers
94 "muoncalib":['getmuFast'], #calibration
95 "vtx":['getmuRoiClu'], #LLP Trigger
96 "mucombTag":['getmuFast', muCombStep], #Trigger for alignment
97 }
98
99 return stepDictionary
100
101
102 # --------------------
103 def getmuFast(self, flags, is_probe_leg=False):
104
105 if 'muoncalib' in self.chainPart['extra']:
106 return self.getStep(flags, "mufastcalib", [muFastCalibSequenceGenCfg], is_probe_leg=is_probe_leg )
107 elif 'l2mt' in self.chainPart['l2AlgInfo']:
108 return self.getStep(flags, "mufastl2mt", [mul2mtSAOvlpRmSequenceGenCfg], is_probe_leg=is_probe_leg )
109 else:
110 return self.getStep(flags, "mufast", [muFastSequenceGenCfg], is_probe_leg=is_probe_leg )
111
112
113 # --------------------
114 def getmuComb(self, flags, is_probe_leg=False):
115
116 doOvlpRm = False
117 if self.chainPart['signature'] == 'Bphysics':
118 doOvlpRm = False
119 elif self.mult>1:
120 doOvlpRm = True
121 elif len( self.dict['signatures'] )>1 and not self.chainPart['extra']:
122 doOvlpRm = True
123 else:
124 doOvlpRm = False
125
126 trkMode = "FTF"
127 stepSuffix=""
128 if 'fT' in self.chainPart['addInfo']:
129 trkMode = "fastTracking"
130 stepSuffix = "fT"
131
132 if 'l2mt' in self.chainPart['l2AlgInfo']:
133 return self.getStep(flags, f"muCombl2mt{stepSuffix}", [mul2mtCBOvlpRmSequenceGenCfg], is_probe_leg=is_probe_leg, trackingMode=trkMode)
134 elif 'l2io' in self.chainPart['l2AlgInfo']:
135 return self.getStep(flags, f'muCombIO{stepSuffix}', [mul2IOOvlpRmSequenceGenCfg], is_probe_leg=is_probe_leg, trackingMode=trkMode)
136 elif doOvlpRm:
137 return self.getStep(flags, f'muCombOVR{stepSuffix}', [muCombOvlpRmSequenceGenCfg], is_probe_leg=is_probe_leg, trackingMode=trkMode )
138 elif "LRT" in self.chainPart['addInfo']:
139 return self.getStep(flags, f'muCombLRT{stepSuffix}', [muCombLRTSequenceGenCfg], is_probe_leg=is_probe_leg, trackingMode=trkMode )
140 else:
141 return self.getStep(flags, f'muComb{stepSuffix}', [muCombSequenceGenCfg], is_probe_leg=is_probe_leg, trackingMode=trkMode )
142
143 # --------------------
144 def getmuCombIO(self, flags, is_probe_leg=False):
145 return self.getStep(flags, 'muCombIO', [mul2IOOvlpRmSequenceGenCfg], is_probe_leg=is_probe_leg )
146
147 # --------------------
148 def getmuEFSA(self, flags, is_probe_leg=False):
149 useBucketFilter = 'mlbkt' in self.chainPart['addInfo']
150 useNewFast = 'newFast' in self.chainPart['l2AlgInfo']
151 step_name = f'muEFSA{"_newFast" if useNewFast else ""}{"_mlbkt" if useBucketFilter else ""}'
152 return self.getStep(flags, step_name, [muEFSASequenceGenCfg], is_probe_leg=is_probe_leg, useBucketFilter=useBucketFilter, useNewFast=useNewFast)
153
154 # --------------------
155 def getmuEFCB(self, flags, is_probe_leg=False):
156 if 'invm' in self.chainPart['invMassInfo']: # No T&P support, add if needed
157 return self.getStep(flags, 'EFCB', [muEFCBSequenceGenCfg], comboTools=[TrigMuonEFInvMassHypoToolFromDict], is_probe_leg=is_probe_leg)
158 elif "LRT" in self.chainPart['addInfo']:
159 if "idperf" in self.chainPart['addInfo']:
160 return self.getStep(flags, 'EFCBLRTIDPERF', [muEFCBLRTIDperfSequenceGenCfg], is_probe_leg=is_probe_leg)
161 else:
162 return self.getStep(flags, 'EFCBLRT', [muEFCBLRTSequenceGenCfg], is_probe_leg=is_probe_leg)
163 elif "idperf" in self.chainPart['addInfo']:
164 return self.getStep(flags, 'EFCBIDPERF', [muEFCBIDperfSequenceGenCfg], is_probe_leg=is_probe_leg)
165 elif "idtp" in self.chainPart['addInfo']:
166 return self.getStep(flags, 'EFIDTP', [muEFIDtpSequenceGenCfg], is_probe_leg=is_probe_leg)
167 else:
168 if flags.Muon.enableTrigIDtrackReuse or "idReuse" in self.chainPart['addInfo']:
169 if "l2io" in self.chainPart['l2AlgInfo']:
170 return self.getStep(flags, 'EFCBl2io', [muEFCBl2ioSequenceGenCfg], is_probe_leg=is_probe_leg)
171 elif "l2mt" in self.chainPart['l2AlgInfo']:
172 return self.getStep(flags, 'EFCBl2mt', [muEFCBl2mtSequenceGenCfg], is_probe_leg=is_probe_leg)
173 else:
174 return self.getStep(flags, 'EFCBidReuse', [muEFCBidReuseSequenceGenCfg], is_probe_leg=is_probe_leg)
175 else:
176 return self.getStep(flags, 'EFCB', [muEFCBSequenceGenCfg], is_probe_leg=is_probe_leg)
177
178 # --------------------
179 def getFSmuEFSA(self, flags, is_probe_leg=False):
180 return self.getStep(flags, 'FSmuEFSA', [muEFSAFSSequenceGenCfg], is_probe_leg=is_probe_leg)
181
182 # --------------------
183 def getFSmuEFCB(self, flags, is_probe_leg=False):
184 if 'invm' in self.chainPart['invMassInfo']:
185 return self.getStep(flags, 'FSmuEFCB', [muEFCBFSSequenceGenCfg],comboTools=[TrigMuonEFInvMassHypoToolFromDict], is_probe_leg=is_probe_leg)
186 else:
187 return self.getStep(flags, 'FSmuEFCB', [muEFCBFSSequenceGenCfg], is_probe_leg=is_probe_leg)
188
189 #---------------------
190 def getmuEFIso(self, flags, is_probe_leg=False):
191 if any(x in self.dict['topo'] for x in ['b7invmAB9vtx20', 'b11invmAB60vtx20', 'b11invmAB24vtx20', 'b24invmAB60vtx20']):
192 from TrigBphysHypo.TrigMultiTrkComboHypoConfig import DrellYanComboHypoCfg, TrigMultiTrkComboHypoToolFromDict
193 return self.getStep(flags, 'muEFIsoDY', [muEFIsoSequenceGenCfg], comboHypoCfg=DrellYanComboHypoCfg, comboTools=[TrigMultiTrkComboHypoToolFromDict], is_probe_leg=is_probe_leg)
194 else:
195 return self.getStep(flags, 'muEFIso', [muEFIsoSequenceGenCfg], is_probe_leg=is_probe_leg)
196
197 #---------------------
198 def getmuEFMSIso(self, flags, is_probe_leg=False):
199 return self.getStep(flags, 'muEFMSIso',[ muEFMSIsoSequenceGenCfg], is_probe_leg=is_probe_leg)
200
201 #--------------------
202 def getmuMSEmpty(self, flags, is_probe_leg=False): # No T&P info needed for empty step?
203 return self.getEmptyStep('muMS_empty')
204
205 #--------------------
206 def getmuFastEmpty(self, flags, is_probe_leg=False): # No T&P info needed for empty step?
207 return self.getEmptyStep('muFast_empty')
208
209 #--------------------
210 def getEFCBEmpty(self, flags, is_probe_leg=False): # No T&P info needed for empty step?
211 return self.getEmptyStep('muefCB_Empty')
212
213 #--------------------
214 def getLateMuRoI(self, flags, is_probe_leg=False): # No T&P support, add if needed
215 return self.getStep(flags, 'muEFLateRoI',[efLateMuRoISequenceGenCfg], is_probe_leg=is_probe_leg)
216
217 #--------------------
218 def getLateMu(self, flags, is_probe_leg=False): # No T&P support, add if needed
219 return self.getStep(flags, 'muEFLate',[efLateMuSequenceGenCfg], is_probe_leg=is_probe_leg)
220
221 #--------------------
222 def getmuRoiClu(self, flags, is_probe_leg=False):
223 return self.getStep(flags, 'muRoiClu',[muRoiClusterSequenceGenCfg])
224
225
227 tool = TrigMuonEFIdtpInvMassHypoToolFromDict(flags, chainDict)
228 return tool
229
230