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
 saveDetailedSF
 containerName
str quality = 'HighPt' and not self.noEffSF:
 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

Member Function Documentation

◆ instanceName()

python.MuonAnalysisConfig.MuonWorkingPointEfficiencyConfig.instanceName ( self)

Definition at line 387 of file MuonAnalysisConfig.py.

387 def instanceName (self) :
388 if self.postfix is not None:
389 return self.containerName + '_' + self.postfix
390 else:
391 return self.containerName + '_' + self.selectionName
392

◆ makeAlgs()

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

Definition at line 393 of file MuonAnalysisConfig.py.

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

Member Data Documentation

◆ containerName

python.MuonAnalysisConfig.MuonWorkingPointEfficiencyConfig.containerName

Definition at line 425 of file MuonAnalysisConfig.py.

◆ noEffSF

python.MuonAnalysisConfig.MuonWorkingPointEfficiencyConfig.noEffSF

Definition at line 407 of file MuonAnalysisConfig.py.

◆ quality

str python.MuonAnalysisConfig.MuonWorkingPointEfficiencyConfig.quality = 'HighPt' and not self.noEffSF:

Definition at line 430 of file MuonAnalysisConfig.py.

◆ saveCombinedSF

python.MuonAnalysisConfig.MuonWorkingPointEfficiencyConfig.saveCombinedSF

Definition at line 495 of file MuonAnalysisConfig.py.

◆ saveDetailedSF

python.MuonAnalysisConfig.MuonWorkingPointEfficiencyConfig.saveDetailedSF

Definition at line 424 of file MuonAnalysisConfig.py.


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