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