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

Public Member Functions

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

Public Attributes

 noEffSF
 quality
 saveDetailedSF
 containerName
 saveCombinedSF

Detailed Description

the ConfigBlock for the muon working point efficiency computation

Definition at line 355 of file MuonAnalysisConfig.py.

Constructor & Destructor Documentation

◆ __init__()

python.MuonAnalysisConfig.MuonWorkingPointEfficiencyConfig.__init__ ( self)

Definition at line 358 of file MuonAnalysisConfig.py.

358 def __init__ (self) :
359 super (MuonWorkingPointEfficiencyConfig, self).__init__ ()
360 self.setBlockName('MuonWorkingPointEfficiency')
361 self.addDependency('MuonWorkingPointSelection', required=True)
362 self.addDependency('EventSelection', required=False)
363 self.addDependency('EventSelectionMerger', required=False)
364 self.addOption ('containerName', '', type=str,
365 noneAction='error',
366 info="the name of the input container.",
367 meta={'role':'containerRef'})
368 self.addOption ('selectionName', '', type=str,
369 noneAction='error',
370 info="the name of the muon selection to define (e.g. `tight` or `loose`).",
371 meta={'role':'selection'})
372 self.addOption ('postfix', None, type=str,
373 info="a postfix to apply to decorations and algorithm names. "
374 "Typically not needed here as `selectionName` is used internally.")
375 self.addOption ('trackSelection', True, type=bool,
376 info="whether or not to set up an instance of "
377 "`CP::AsgLeptonTrackSelectionAlg`, with the recommended $d_0$ and "
378 r"$z_0\sin\theta$ cuts.")
379 self.addOption ('quality', None, type=str,
380 info="the ID WP to use. Supported ID WPs: `Tight`, `Medium`, "
381 "`Loose`, `LowPt`, `HighPt`.",
382 meta={'choices':(['Tight','Medium','Loose','LowPt','HighPt'],1)})
383 self.addOption ('isolation', None, type=str,
384 info="the isolation WP to use. Supported isolation WPs: "
385 "`PflowLoose_VarRad`, `PflowTight_VarRad`, `Loose_VarRad`, "
386 "`Tight_VarRad`, `NonIso`.",
387 meta={'choices':(['PflowLoose_VarRad','PflowTight_VarRad','Loose_VarRad','Tight_VarRad','NonIso'],1)})
388 self.addOption ('systematicBreakdown', False, type=bool,
389 info="enables the full breakdown of efficiency SF systematics "
390 "(1 NP per uncertainty source, instead of 1 NP in total).")
391 self.addOption ('noEffSF', False, type=bool,
392 info="disables the calculation of efficiencies and scale factors. "
393 "Experimental! Only useful to test a new WP for which scale "
394 "factors are not available.",
395 expertMode=True)
396 self.addOption ('saveDetailedSF', True, type=bool,
397 info="save all the independent detailed object scale factors.")
398 self.addOption ('saveCombinedSF', False, type=bool,
399 info="save the combined object scale factor.")
400 self.addOption('useLRT', False, type=bool,
401 info="apply the LRT-specific reco/ID efficiency SF treatment. When "
402 "set (and quality is Medium, the only WP supported for LRT muons), "
403 "the reco SF tool routes per-muon via the isLRT flag and uses the "
404 "LRT-specific CalibrationRelease.")
405

Member Function Documentation

◆ instanceName()

python.MuonAnalysisConfig.MuonWorkingPointEfficiencyConfig.instanceName ( self)

Definition at line 406 of file MuonAnalysisConfig.py.

406 def instanceName (self) :
407 if self.postfix is not None:
408 return self.containerName + '_' + self.postfix
409 else:
410 return self.containerName + '_' + self.selectionName
411

◆ makeAlgs()

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

Definition at line 412 of file MuonAnalysisConfig.py.

412 def makeAlgs (self, config) :
413
414 # The setup below is inappropriate for Run 1
415 if config.geometry() is LHCPeriod.Run1:
416 raise ValueError ("Can't set up the MuonWorkingPointEfficiencyConfig with %s, there must be something wrong!" % config.geometry().value)
417
418 postfix = self.postfix
419 if postfix is None :
420 postfix = self.selectionName
421 if postfix != '' and postfix[0] != '_' :
422 postfix = '_' + postfix
423
424 sfList = []
425 if config.dataType() is not DataType.Data and not self.noEffSF:
426 if self.isolation is None :
427 raise ValueError ("muon isolation working point not set, "
428 "use e.g. \"NonIso\" to disable the isolation selection")
429 # LRT muons: MCP supports only Medium WP. Enable per-muon isLRT flag and use dedicated LRT reco-sf release.
430 if self.useLRT and self.quality != 'Medium':
431 raise ValueError ("useLRT is only supported with the Medium quality working point, not '%s'" % self.quality)
432
433 isRun3 = config.geometry() >= LHCPeriod.Run3
434 if isRun3:
435 recoRelease = '250418_Preliminary_r24run3' if self.useLRT else '251211_Preliminary_r24run3'
436 else:
437 recoRelease = '240620_LRT_r22run2' if self.useLRT else '230213_Preliminary_r22run2_loosefix'
438 defaultRelease = '251211_Preliminary_r24run3' if isRun3 else '230213_Preliminary_r22run2_loosefix'
439
440 # (enabled, algorithm name suffix, working point, decoration prefix, calibration release)
441 sfConfigs = [
442 # reco/ID efficiency scale factor
443 (True, 'Reco', self.quality, 'reco', recoRelease),
444 # HighPt-specific BadMuonVeto efficiency scale factor
445 (self.quality == 'HighPt', 'BMVHighPt', 'BadMuonVeto_HighPt', 'BadMuonVeto',
446 # not available as part of '230123_Preliminary_r22run3'!
447 '220817_Preliminary_r22run3' if isRun3 else '230213_Preliminary_r22run2_loosefix'),
448 # isolation efficiency scale factor
449 (self.isolation != 'NonIso', 'Isol', self.isolation + 'Iso', 'isol', defaultRelease),
450 # TTVA scale factor
451 (self.trackSelection, 'TTVA', 'TTVA', 'TTVA', defaultRelease),
452 ]
453
454 for enabled, algSuffix, workingPoint, prefix, release in sfConfigs:
455 if not enabled:
456 continue
457 alg = config.createAlgorithm( 'CP::MuonEfficiencyScaleFactorAlg',
458 'MuonEfficiencyScaleFactorAlg' + algSuffix )
459 config.addPrivateTool( 'efficiencyScaleFactorTool',
460 'CP::MuonEfficiencyScaleFactors' )
461 config.setExtraInputs ({('xAOD::EventInfo', 'EventInfo.RandomRunNumber')})
462 sfDecoration = 'muon_' + prefix + '_effSF' + postfix + "_%SYS%"
463 alg.scaleFactorDecoration = sfDecoration
464 alg.outOfValidity = 2 #silent
465 alg.outOfValidityDeco = 'muon_' + prefix + '_bad_eff' + postfix
466 alg.efficiencyScaleFactorTool.WorkingPoint = workingPoint
467 alg.efficiencyScaleFactorTool.CalibrationRelease = release
468 alg.efficiencyScaleFactorTool.BreakDownSystematics = self.systematicBreakdown
469 alg.muons = config.readName (self.containerName)
470 alg.preselection = config.getPreselection (self.containerName, self.selectionName)
471 if self.saveDetailedSF:
472 config.addOutputVar (self.containerName, sfDecoration,
473 prefix + '_effSF' + postfix)
474 sfList += [sfDecoration]
475
476 if config.dataType() is not DataType.Data and not self.noEffSF and self.saveCombinedSF:
477 alg = config.createAlgorithm( 'CP::AsgObjectScaleFactorAlg',
478 'MuonCombinedEfficiencyScaleFactorAlg' )
479 alg.particles = config.readName (self.containerName)
480 alg.inScaleFactors = sfList
481 alg.outScaleFactor = 'effSF' + postfix + '_%SYS%'
482 config.addOutputVar (self.containerName, alg.outScaleFactor, 'effSF' + postfix)
483

Member Data Documentation

◆ containerName

python.MuonAnalysisConfig.MuonWorkingPointEfficiencyConfig.containerName

Definition at line 472 of file MuonAnalysisConfig.py.

◆ noEffSF

python.MuonAnalysisConfig.MuonWorkingPointEfficiencyConfig.noEffSF

Definition at line 425 of file MuonAnalysisConfig.py.

◆ quality

python.MuonAnalysisConfig.MuonWorkingPointEfficiencyConfig.quality

Definition at line 431 of file MuonAnalysisConfig.py.

◆ saveCombinedSF

python.MuonAnalysisConfig.MuonWorkingPointEfficiencyConfig.saveCombinedSF

Definition at line 476 of file MuonAnalysisConfig.py.

◆ saveDetailedSF

python.MuonAnalysisConfig.MuonWorkingPointEfficiencyConfig.saveDetailedSF

Definition at line 471 of file MuonAnalysisConfig.py.


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