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
str quality
 saveDetailedSF
 containerName
 saveCombinedSF

Detailed Description

the ConfigBlock for the muon working point efficiency computation

Definition at line 345 of file MuonAnalysisConfig.py.

Constructor & Destructor Documentation

◆ __init__()

python.MuonAnalysisConfig.MuonWorkingPointEfficiencyConfig.__init__ ( self)

Definition at line 348 of file MuonAnalysisConfig.py.

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

Member Function Documentation

◆ instanceName()

python.MuonAnalysisConfig.MuonWorkingPointEfficiencyConfig.instanceName ( self)

Definition at line 392 of file MuonAnalysisConfig.py.

392 def instanceName (self) :
393 if self.postfix is not None:
394 return self.containerName + '_' + self.postfix
395 else:
396 return self.containerName + '_' + self.selectionName
397

◆ makeAlgs()

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

Definition at line 398 of file MuonAnalysisConfig.py.

398 def makeAlgs (self, config) :
399
400 # The setup below is inappropriate for Run 1
401 if config.geometry() is LHCPeriod.Run1:
402 raise ValueError ("Can't set up the MuonWorkingPointEfficiencyConfig with %s, there must be something wrong!" % config.geometry().value)
403
404 postfix = self.postfix
405 if postfix is None :
406 postfix = self.selectionName
407 if postfix != '' and postfix[0] != '_' :
408 postfix = '_' + postfix
409
410 sfList = []
411 # Set up the reco/ID efficiency scale factor calculation algorithm:
412 if config.dataType() is not DataType.Data and not self.noEffSF:
413 alg = config.createAlgorithm( 'CP::MuonEfficiencyScaleFactorAlg',
414 'MuonEfficiencyScaleFactorAlgReco' )
415 config.addPrivateTool( 'efficiencyScaleFactorTool',
416 'CP::MuonEfficiencyScaleFactors' )
417 config.setExtraInputs ({('xAOD::EventInfo', 'EventInfo.RandomRunNumber')})
418 alg.scaleFactorDecoration = 'muon_reco_effSF' + postfix + "_%SYS%"
419 alg.outOfValidity = 2 #silent
420 alg.outOfValidityDeco = 'muon_reco_bad_eff' + postfix
421 alg.efficiencyScaleFactorTool.WorkingPoint = self.quality
422 # LRT muons: MCP supports only Medium WP. Enable per-muon isLRT flag and use dedicated LRT reco-sf release.
423 if self.useLRT and self.quality != 'Medium':
424 raise ValueError ("useLRT is only supported with the Medium quality working point, not '%s'" % self.quality)
425 if config.geometry() >= LHCPeriod.Run3:
426 alg.efficiencyScaleFactorTool.CalibrationRelease = '250418_Preliminary_r24run3' if self.useLRT else '251211_Preliminary_r24run3'
427 else:
428 alg.efficiencyScaleFactorTool.CalibrationRelease = '240620_LRT_r22run2' if self.useLRT else '230213_Preliminary_r22run2_loosefix'
429 alg.efficiencyScaleFactorTool.BreakDownSystematics = self.systematicBreakdown
430 alg.muons = config.readName (self.containerName)
431 alg.preselection = config.getPreselection (self.containerName, self.selectionName)
432 if self.saveDetailedSF:
433 config.addOutputVar (self.containerName, alg.scaleFactorDecoration,
434 'reco_effSF' + postfix)
435 sfList += [alg.scaleFactorDecoration]
436
437 # Set up the HighPt-specific BadMuonVeto efficiency scale factor calculation algorithm:
438 if config.dataType() is not DataType.Data and self.quality == 'HighPt' and not self.noEffSF:
439 alg = config.createAlgorithm( 'CP::MuonEfficiencyScaleFactorAlg',
440 'MuonEfficiencyScaleFactorAlgBMVHighPt' )
441 config.addPrivateTool( 'efficiencyScaleFactorTool',
442 'CP::MuonEfficiencyScaleFactors' )
443 alg.scaleFactorDecoration = 'muon_BadMuonVeto_effSF' + postfix + "_%SYS%"
444 alg.outOfValidity = 2 #silent
445 alg.outOfValidityDeco = 'muon_BadMuonVeto_bad_eff' + postfix
446 alg.efficiencyScaleFactorTool.WorkingPoint = 'BadMuonVeto_HighPt'
447 if config.geometry() >= LHCPeriod.Run3:
448 alg.efficiencyScaleFactorTool.CalibrationRelease = '220817_Preliminary_r22run3' # not available as part of '230123_Preliminary_r22run3'!
449 else:
450 alg.efficiencyScaleFactorTool.CalibrationRelease = '230213_Preliminary_r22run2_loosefix'
451 alg.efficiencyScaleFactorTool.BreakDownSystematics = self.systematicBreakdown
452 alg.muons = config.readName (self.containerName)
453 alg.preselection = config.getPreselection (self.containerName, self.selectionName)
454 if self.saveDetailedSF:
455 config.addOutputVar (self.containerName, alg.scaleFactorDecoration,
456 'BadMuonVeto_effSF' + postfix)
457 sfList += [alg.scaleFactorDecoration]
458
459 # Set up the isolation efficiency scale factor calculation algorithm:
460 if config.dataType() is not DataType.Data and self.isolation != 'NonIso' and not self.noEffSF:
461 alg = config.createAlgorithm( 'CP::MuonEfficiencyScaleFactorAlg',
462 'MuonEfficiencyScaleFactorAlgIsol' )
463 config.addPrivateTool( 'efficiencyScaleFactorTool',
464 'CP::MuonEfficiencyScaleFactors' )
465 alg.scaleFactorDecoration = 'muon_isol_effSF' + postfix + "_%SYS%"
466 alg.outOfValidity = 2 #silent
467 alg.outOfValidityDeco = 'muon_isol_bad_eff' + postfix
468 alg.efficiencyScaleFactorTool.WorkingPoint = self.isolation + 'Iso'
469 if config.geometry() >= LHCPeriod.Run3:
470 alg.efficiencyScaleFactorTool.CalibrationRelease = '251211_Preliminary_r24run3'
471 else:
472 alg.efficiencyScaleFactorTool.CalibrationRelease = '230213_Preliminary_r22run2_loosefix'
473 alg.efficiencyScaleFactorTool.BreakDownSystematics = self.systematicBreakdown
474 alg.muons = config.readName (self.containerName)
475 alg.preselection = config.getPreselection (self.containerName, self.selectionName)
476 if self.saveDetailedSF:
477 config.addOutputVar (self.containerName, alg.scaleFactorDecoration,
478 'isol_effSF' + postfix)
479 sfList += [alg.scaleFactorDecoration]
480
481 # Set up the TTVA scale factor calculation algorithm:
482 if config.dataType() is not DataType.Data and self.trackSelection and not self.noEffSF:
483 alg = config.createAlgorithm( 'CP::MuonEfficiencyScaleFactorAlg',
484 'MuonEfficiencyScaleFactorAlgTTVA' )
485 config.addPrivateTool( 'efficiencyScaleFactorTool',
486 'CP::MuonEfficiencyScaleFactors' )
487 alg.scaleFactorDecoration = 'muon_TTVA_effSF' + postfix + "_%SYS%"
488 alg.outOfValidity = 2 #silent
489 alg.outOfValidityDeco = 'muon_TTVA_bad_eff' + postfix
490 alg.efficiencyScaleFactorTool.WorkingPoint = 'TTVA'
491 if config.geometry() >= LHCPeriod.Run3:
492 alg.efficiencyScaleFactorTool.CalibrationRelease = '251211_Preliminary_r24run3'
493 else:
494 alg.efficiencyScaleFactorTool.CalibrationRelease = '230213_Preliminary_r22run2_loosefix'
495 alg.efficiencyScaleFactorTool.BreakDownSystematics = self.systematicBreakdown
496 alg.muons = config.readName (self.containerName)
497 alg.preselection = config.getPreselection (self.containerName, self.selectionName)
498 if self.saveDetailedSF:
499 config.addOutputVar (self.containerName, alg.scaleFactorDecoration,
500 'TTVA_effSF' + postfix)
501 sfList += [alg.scaleFactorDecoration]
502
503 if config.dataType() is not DataType.Data and not self.noEffSF and self.saveCombinedSF:
504 alg = config.createAlgorithm( 'CP::AsgObjectScaleFactorAlg',
505 'MuonCombinedEfficiencyScaleFactorAlg' )
506 alg.particles = config.readName (self.containerName)
507 alg.inScaleFactors = sfList
508 alg.outScaleFactor = 'effSF' + postfix + '_%SYS%'
509 config.addOutputVar (self.containerName, alg.outScaleFactor, 'effSF' + postfix)
510

Member Data Documentation

◆ containerName

python.MuonAnalysisConfig.MuonWorkingPointEfficiencyConfig.containerName

Definition at line 433 of file MuonAnalysisConfig.py.

◆ noEffSF

python.MuonAnalysisConfig.MuonWorkingPointEfficiencyConfig.noEffSF

Definition at line 412 of file MuonAnalysisConfig.py.

◆ quality

str python.MuonAnalysisConfig.MuonWorkingPointEfficiencyConfig.quality

Definition at line 424 of file MuonAnalysisConfig.py.

◆ saveCombinedSF

python.MuonAnalysisConfig.MuonWorkingPointEfficiencyConfig.saveCombinedSF

Definition at line 503 of file MuonAnalysisConfig.py.

◆ saveDetailedSF

python.MuonAnalysisConfig.MuonWorkingPointEfficiencyConfig.saveDetailedSF

Definition at line 432 of file MuonAnalysisConfig.py.


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