ATLAS Offline Software
Loading...
Searching...
No Matches
python.MuonAnalysisConfig.MuonWorkingPointSelectionConfig Class Reference
Inheritance diagram for python.MuonAnalysisConfig.MuonWorkingPointSelectionConfig:
Collaboration diagram for python.MuonAnalysisConfig.MuonWorkingPointSelectionConfig:

Public Member Functions

 __init__ (self)
 instanceName (self)
 makeAlgs (self, config)

Public Attributes

str quality = 'Tight' :
 trackSelection
 containerName
 selectionName

Detailed Description

the ConfigBlock for the muon working point selection

Definition at line 163 of file MuonAnalysisConfig.py.

Constructor & Destructor Documentation

◆ __init__()

python.MuonAnalysisConfig.MuonWorkingPointSelectionConfig.__init__ ( self)

Definition at line 166 of file MuonAnalysisConfig.py.

166 def __init__ (self) :
167 super (MuonWorkingPointSelectionConfig, self).__init__ ()
168 self.setBlockName('MuonWorkingPointSelection')
169 self.addOption ('containerName', '', type=str,
170 noneAction='error',
171 info="the name of the input container.")
172 self.addOption ('selectionName', '', type=str,
173 noneAction='error',
174 info="the name of the muon selection to define (e.g. `tight` or `loose`).")
175 self.addOption ('postfix', None, type=str,
176 info="a postfix to apply to decorations and algorithm names. "
177 "Typically not needed here as `selectionName` is used internally.")
178 self.addOption ('trackSelection', True, type=bool,
179 info="whether or not to set up an instance of "
180 "`CP::AsgLeptonTrackSelectionAlg`, with the recommended $d_0$ and "
181 r"$z_0\sin\theta$ cuts.")
182 self.addOption ('maxD0Significance', 3, type=float,
183 info="maximum $d_0$ significance used for the track selection.")
184 self.addOption ('maxDeltaZ0SinTheta', 0.5, type=float,
185 info=r"maximum $\Delta z_0\sin\theta$ (in mm) used for the track selection.")
186 self.addOption ('quality', None, type=str,
187 info="the ID WP to use. Supported ID WPs: `Tight`, `Medium`, "
188 "`Loose`, `LowPt`, `HighPt`.")
189 self.addOption ('isolation', None, type=str,
190 info="the isolation WP to use. Supported isolation WPs: "
191 "`PflowLoose_VarRad`, `PflowTight_VarRad`, `Loose_VarRad`, "
192 "`Tight_VarRad`, `NonIso`.")
193 self.addOption ('addSelectionToPreselection', True, type=bool,
194 info="whether to retain only muons satisfying the working point "
195 "requirements.")
196 self.addOption ('isoDecSuffix', '', type=str,
197 info="the `isoDecSuffix` name if using close-by-corrected isolation working points.")
198 self.addOption ('excludeNSWFromPrecisionLayers', False, type=bool,
199 info="only for testing purposes, turn on to ignore NSW hits and "
200 "fix a crash with older derivations (p-tag <p5834).")
201

Member Function Documentation

◆ instanceName()

python.MuonAnalysisConfig.MuonWorkingPointSelectionConfig.instanceName ( self)

Definition at line 202 of file MuonAnalysisConfig.py.

202 def instanceName (self) :
203 if self.postfix is not None:
204 return self.containerName + '_' + self.postfix
205 else:
206 return self.containerName + '_' + self.selectionName
207

◆ makeAlgs()

python.MuonAnalysisConfig.MuonWorkingPointSelectionConfig.makeAlgs ( self,
config )

Definition at line 208 of file MuonAnalysisConfig.py.

208 def makeAlgs (self, config) :
209 log = logging.getLogger('MuonWorkingPointSelectionConfig')
210
211 from xAODMuon.xAODMuonEnums import xAODMuonEnums
212 if self.quality == 'Tight' :
213 quality = xAODMuonEnums.Quality.Tight
214 elif self.quality == 'Medium' :
215 quality = xAODMuonEnums.Quality.Medium
216 elif self.quality == 'Loose' :
217 quality = xAODMuonEnums.Quality.Loose
218 elif self.quality == 'VeryLoose' :
219 quality = xAODMuonEnums.Quality.VeryLoose
220 elif self.quality == 'HighPt' :
221 quality = 4
222 elif self.quality == 'LowPt' :
223 quality = 5
224 else :
225 raise ValueError ("invalid muon quality: \"" + self.quality +
226 "\", allowed values are Tight, Medium, Loose, " +
227 "VeryLoose, HighPt, LowPt")
228
229 # The setup below is inappropriate for Run 1
230 if config.geometry() is LHCPeriod.Run1:
231 raise ValueError ("Can't set up the MuonWorkingPointSelectionConfig with %s, there must be something wrong!" % config.geometry().value)
232
233 postfix = self.postfix
234 if postfix is None :
235 postfix = self.selectionName
236 if postfix != '' and postfix[0] != '_' :
237 postfix = '_' + postfix
238
239 # Set up the track selection algorithm:
240 if self.trackSelection:
241 alg = config.createAlgorithm( 'CP::AsgLeptonTrackSelectionAlg',
242 'MuonTrackSelectionAlg',
243 reentrant=True )
244 alg.selectionDecoration = 'trackSelection' + postfix + ',as_bits'
245 alg.maxD0Significance = self.maxD0Significance
246 alg.maxDeltaZ0SinTheta = self.maxDeltaZ0SinTheta
247 alg.particles = config.readName (self.containerName)
248 alg.preselection = config.getPreselection (self.containerName, '')
249 config.addSelection (self.containerName, self.selectionName, alg.selectionDecoration, preselection=self.addSelectionToPreselection)
250
251 # Setup the muon quality selection
252 alg = config.createAlgorithm( 'CP::MuonSelectionAlgV2',
253 'MuonSelectionAlg' )
254 config.addPrivateTool( 'selectionTool', 'CP::MuonSelectionTool' )
255 alg.selectionTool.MuQuality = quality
256 alg.selectionTool.IsRun3Geo = config.geometry() >= LHCPeriod.Run3
257 if config.geometry() is LHCPeriod.Run4:
258 log.warning("Disabling NSW hits for Run4 geometry")
259 alg.selectionTool.ExcludeNSWFromPrecisionLayers = True
260 else:
261 alg.selectionTool.ExcludeNSWFromPrecisionLayers = self.excludeNSWFromPrecisionLayers and (config.geometry() >= LHCPeriod.Run3)
262 alg.selectionDecoration = 'good_muon' + postfix + ',as_char'
263 alg.badMuonVetoDecoration = 'is_bad' + postfix + ',as_char'
264 alg.muons = config.readName (self.containerName)
265 alg.preselection = config.getPreselection (self.containerName, self.selectionName)
266 config.addSelection (self.containerName, self.selectionName,
267 alg.selectionDecoration,
268 preselection=self.addSelectionToPreselection)
269 if self.quality == 'HighPt':
270 config.addOutputVar (self.containerName, 'is_bad' + postfix, 'is_bad' + postfix)
271
272 # Set up the isolation calculation algorithm:
273 if self.isolation != 'NonIso' :
274 alg = config.createAlgorithm( 'CP::MuonIsolationAlg',
275 'MuonIsolationAlg' )
276 config.addPrivateTool( 'isolationTool', 'CP::IsolationSelectionTool' )
277 alg.isolationTool.MuonWP = self.isolation
278 alg.isolationTool.IsoDecSuffix = self.isoDecSuffix
279 alg.isolationDecoration = 'isolated_muon' + postfix + ',as_char'
280 alg.muons = config.readName (self.containerName)
281 alg.preselection = config.getPreselection (self.containerName, self.selectionName)
282 config.addSelection (self.containerName, self.selectionName,
283 alg.isolationDecoration,
284 preselection=self.addSelectionToPreselection)
285
286

Member Data Documentation

◆ containerName

python.MuonAnalysisConfig.MuonWorkingPointSelectionConfig.containerName

Definition at line 249 of file MuonAnalysisConfig.py.

◆ quality

str python.MuonAnalysisConfig.MuonWorkingPointSelectionConfig.quality = 'Tight' :

Definition at line 212 of file MuonAnalysisConfig.py.

◆ selectionName

python.MuonAnalysisConfig.MuonWorkingPointSelectionConfig.selectionName

Definition at line 249 of file MuonAnalysisConfig.py.

◆ trackSelection

python.MuonAnalysisConfig.MuonWorkingPointSelectionConfig.trackSelection

Definition at line 240 of file MuonAnalysisConfig.py.


The documentation for this class was generated from the following file: