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
 trackSelection
 containerName
 selectionName

Detailed Description

the ConfigBlock for the muon working point selection

Definition at line 221 of file MuonAnalysisConfig.py.

Constructor & Destructor Documentation

◆ __init__()

python.MuonAnalysisConfig.MuonWorkingPointSelectionConfig.__init__ ( self)

Definition at line 224 of file MuonAnalysisConfig.py.

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

Member Function Documentation

◆ instanceName()

python.MuonAnalysisConfig.MuonWorkingPointSelectionConfig.instanceName ( self)

Definition at line 266 of file MuonAnalysisConfig.py.

266 def instanceName (self) :
267 if self.postfix is not None:
268 return self.containerName + '_' + self.postfix
269 else:
270 return self.containerName + '_' + self.selectionName
271

◆ makeAlgs()

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

Definition at line 272 of file MuonAnalysisConfig.py.

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

Member Data Documentation

◆ containerName

python.MuonAnalysisConfig.MuonWorkingPointSelectionConfig.containerName

Definition at line 316 of file MuonAnalysisConfig.py.

◆ quality

str python.MuonAnalysisConfig.MuonWorkingPointSelectionConfig.quality

Definition at line 287 of file MuonAnalysisConfig.py.

◆ selectionName

python.MuonAnalysisConfig.MuonWorkingPointSelectionConfig.selectionName

Definition at line 316 of file MuonAnalysisConfig.py.

◆ trackSelection

python.MuonAnalysisConfig.MuonWorkingPointSelectionConfig.trackSelection

Definition at line 307 of file MuonAnalysisConfig.py.


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