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 218 of file MuonAnalysisConfig.py.

Constructor & Destructor Documentation

◆ __init__()

python.MuonAnalysisConfig.MuonWorkingPointSelectionConfig.__init__ ( self)

Definition at line 221 of file MuonAnalysisConfig.py.

221 def __init__ (self) :
222 super (MuonWorkingPointSelectionConfig, self).__init__ ()
223 self.setBlockName('MuonWorkingPointSelection')
224 self.addOption ('containerName', '', type=str,
225 noneAction='error',
226 info="the name of the input container.")
227 self.addOption ('selectionName', '', type=str,
228 noneAction='error',
229 info="the name of the muon selection to define (e.g. `tight` or `loose`).")
230 self.addOption ('postfix', None, type=str,
231 info="a postfix to apply to decorations and algorithm names. "
232 "Typically not needed here as `selectionName` is used internally.")
233 self.addOption ('trackSelection', True, type=bool,
234 info="whether or not to set up an instance of "
235 "`CP::AsgLeptonTrackSelectionAlg`, with the recommended $d_0$ and "
236 r"$z_0\sin\theta$ cuts.")
237 self.addOption ('maxD0Significance', 3, type=float,
238 info="maximum $d_0$ significance used for the track selection.")
239 self.addOption ('maxDeltaZ0SinTheta', 0.5, type=float,
240 info=r"maximum $\Delta z_0\sin\theta$ (in mm) used for the track selection.")
241 self.addOption ('quality', None, type=str,
242 info="the ID WP to use. Supported ID WPs: `Tight`, `Medium`, "
243 "`Loose`, `LowPt`, `HighPt`.")
244 self.addOption ('isolation', None, type=str,
245 info="the isolation WP to use. Supported isolation WPs: "
246 "`PflowLoose_VarRad`, `PflowTight_VarRad`, `Loose_VarRad`, "
247 "`Tight_VarRad`, `NonIso`.")
248 self.addOption ('addSelectionToPreselection', True, type=bool,
249 info="whether to retain only muons satisfying the working point "
250 "requirements.")
251 self.addOption ('isoDecSuffix', '', type=str,
252 info="the `isoDecSuffix` name if using close-by-corrected isolation working points.")
253 self.addOption ('excludeNSWFromPrecisionLayers', False, type=bool,
254 info="only for testing purposes, turn on to ignore NSW hits and "
255 "fix a crash with older derivations (p-tag <p5834).")
256 self.addOption('useLRT', False, type=bool,
257 info="whether to enable LRT handling in CP::MuonSelectionTool")
258

Member Function Documentation

◆ instanceName()

python.MuonAnalysisConfig.MuonWorkingPointSelectionConfig.instanceName ( self)

Definition at line 259 of file MuonAnalysisConfig.py.

259 def instanceName (self) :
260 if self.postfix is not None:
261 return self.containerName + '_' + self.postfix
262 else:
263 return self.containerName + '_' + self.selectionName
264

◆ makeAlgs()

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

Definition at line 265 of file MuonAnalysisConfig.py.

265 def makeAlgs (self, config) :
266 log = logging.getLogger('MuonWorkingPointSelectionConfig')
267
268 from xAODMuon.xAODMuonEnums import xAODMuonEnums
269 if self.quality == 'Tight' :
270 quality = xAODMuonEnums.Quality.Tight
271 elif self.quality == 'Medium' :
272 quality = xAODMuonEnums.Quality.Medium
273 elif self.quality == 'Loose' :
274 quality = xAODMuonEnums.Quality.Loose
275 elif self.quality == 'VeryLoose' :
276 quality = xAODMuonEnums.Quality.VeryLoose
277 elif self.quality == 'HighPt' :
278 quality = 4
279 elif self.quality == 'LowPt' :
280 quality = 5
281 else :
282 raise ValueError ("invalid muon quality: \"" + self.quality +
283 "\", allowed values are Tight, Medium, Loose, " +
284 "VeryLoose, HighPt, LowPt")
285
286 # The setup below is inappropriate for Run 1
287 if config.geometry() is LHCPeriod.Run1:
288 raise ValueError ("Can't set up the MuonWorkingPointSelectionConfig with %s, there must be something wrong!" % config.geometry().value)
289
290 postfix = self.postfix
291 if postfix is None :
292 postfix = self.selectionName
293 if postfix != '' and postfix[0] != '_' :
294 postfix = '_' + postfix
295
296 # Set up the track selection algorithm:
297 if self.trackSelection:
298 alg = config.createAlgorithm( 'CP::AsgLeptonTrackSelectionAlg',
299 'MuonTrackSelectionAlg',
300 reentrant=True )
301 alg.selectionDecoration = 'trackSelection' + postfix + ',as_bits'
302 alg.maxD0Significance = self.maxD0Significance
303 alg.maxDeltaZ0SinTheta = self.maxDeltaZ0SinTheta
304 alg.particles = config.readName (self.containerName)
305 alg.preselection = config.getPreselection (self.containerName, '')
306 config.addSelection (self.containerName, self.selectionName, alg.selectionDecoration, preselection=self.addSelectionToPreselection)
307
308 # Setup the muon quality selection
309 alg = config.createAlgorithm( 'CP::MuonSelectionAlgV2',
310 'MuonSelectionAlg' )
311 config.addPrivateTool( 'selectionTool', 'CP::MuonSelectionTool' )
312 alg.selectionTool.MuQuality = quality
313 alg.selectionTool.IsRun3Geo = config.geometry() >= LHCPeriod.Run3
314 alg.selectionTool.UseLRT = self.useLRT
315 if config.geometry() is LHCPeriod.Run4:
316 log.warning("Disabling NSW hits for Run4 geometry")
317 alg.selectionTool.ExcludeNSWFromPrecisionLayers = True
318 else:
319 alg.selectionTool.ExcludeNSWFromPrecisionLayers = self.excludeNSWFromPrecisionLayers and (config.geometry() >= LHCPeriod.Run3)
320 alg.selectionDecoration = 'good_muon' + postfix + ',as_char'
321 alg.badMuonVetoDecoration = 'is_bad' + postfix + ',as_char'
322 alg.muons = config.readName (self.containerName)
323 alg.preselection = config.getPreselection (self.containerName, self.selectionName)
324 config.addSelection (self.containerName, self.selectionName,
325 alg.selectionDecoration,
326 preselection=self.addSelectionToPreselection)
327 if self.quality == 'HighPt':
328 config.addOutputVar (self.containerName, 'is_bad' + postfix, 'is_bad' + postfix)
329
330 # Set up the isolation calculation algorithm:
331 if self.isolation != 'NonIso' :
332 alg = config.createAlgorithm( 'CP::MuonIsolationAlg',
333 'MuonIsolationAlg' )
334 config.addPrivateTool( 'isolationTool', 'CP::IsolationSelectionTool' )
335 alg.isolationTool.MuonWP = self.isolation
336 alg.isolationTool.IsoDecSuffix = self.isoDecSuffix
337 alg.isolationDecoration = 'isolated_muon' + postfix + ',as_char'
338 alg.muons = config.readName (self.containerName)
339 alg.preselection = config.getPreselection (self.containerName, self.selectionName)
340 config.addSelection (self.containerName, self.selectionName,
341 alg.isolationDecoration,
342 preselection=self.addSelectionToPreselection)
343
344

Member Data Documentation

◆ containerName

python.MuonAnalysisConfig.MuonWorkingPointSelectionConfig.containerName

Definition at line 306 of file MuonAnalysisConfig.py.

◆ quality

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

Definition at line 269 of file MuonAnalysisConfig.py.

◆ selectionName

python.MuonAnalysisConfig.MuonWorkingPointSelectionConfig.selectionName

Definition at line 306 of file MuonAnalysisConfig.py.

◆ trackSelection

python.MuonAnalysisConfig.MuonWorkingPointSelectionConfig.trackSelection

Definition at line 297 of file MuonAnalysisConfig.py.


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