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

Constructor & Destructor Documentation

◆ __init__()

python.MuonAnalysisConfig.MuonWorkingPointEfficiencyConfig.__init__ ( self)

Definition at line 334 of file MuonAnalysisConfig.py.

334 def __init__ (self) :
335 super (MuonWorkingPointEfficiencyConfig, self).__init__ ()
336 self.setBlockName('MuonWorkingPointEfficiency')
337 self.addDependency('MuonWorkingPointSelection', required=True)
338 self.addDependency('EventSelection', required=False)
339 self.addDependency('EventSelectionMerger', required=False)
340 self.addOption ('containerName', '', type=str,
341 noneAction='error',
342 info="the name of the input container.")
343 self.addOption ('selectionName', '', type=str,
344 noneAction='error',
345 info="the name of the muon selection to define (e.g. `tight` or `loose`).")
346 self.addOption ('postfix', None, type=str,
347 info="a postfix to apply to decorations and algorithm names. "
348 "Typically not needed here as `selectionName` is used internally.")
349 self.addOption ('trackSelection', True, type=bool,
350 info="whether or not to set up an instance of "
351 "`CP::AsgLeptonTrackSelectionAlg`, with the recommended $d_0$ and "
352 r"$z_0\sin\theta$ cuts.")
353 self.addOption ('quality', None, type=str,
354 info="the ID WP to use. Supported ID WPs: `Tight`, `Medium`, "
355 "`Loose`, `LowPt`, `HighPt`.")
356 self.addOption ('isolation', None, type=str,
357 info="the isolation WP to use. Supported isolation WPs: "
358 "`PflowLoose_VarRad`, `PflowTight_VarRad`, `Loose_VarRad`, "
359 "`Tight_VarRad`, `NonIso`.")
360 self.addOption ('systematicBreakdown', False, type=bool,
361 info="enables the full breakdown of efficiency SF systematics "
362 "(1 NP per uncertainty source, instead of 1 NP in total).")
363 self.addOption ('noEffSF', False, type=bool,
364 info="disables the calculation of efficiencies and scale factors. "
365 "Experimental! Only useful to test a new WP for which scale "
366 "factors are not available.",
367 expertMode=True)
368 self.addOption ('saveDetailedSF', True, type=bool,
369 info="save all the independent detailed object scale factors.")
370 self.addOption ('saveCombinedSF', False, type=bool,
371 info="save the combined object scale factor.")
372

Member Function Documentation

◆ instanceName()

python.MuonAnalysisConfig.MuonWorkingPointEfficiencyConfig.instanceName ( self)

Definition at line 373 of file MuonAnalysisConfig.py.

373 def instanceName (self) :
374 if self.postfix is not None:
375 return self.containerName + '_' + self.postfix
376 else:
377 return self.containerName + '_' + self.selectionName
378

◆ makeAlgs()

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

Definition at line 379 of file MuonAnalysisConfig.py.

379 def makeAlgs (self, config) :
380
381 # The setup below is inappropriate for Run 1
382 if config.geometry() is LHCPeriod.Run1:
383 raise ValueError ("Can't set up the MuonWorkingPointEfficiencyConfig with %s, there must be something wrong!" % config.geometry().value)
384
385 postfix = self.postfix
386 if postfix is None :
387 postfix = self.selectionName
388 if postfix != '' and postfix[0] != '_' :
389 postfix = '_' + postfix
390
391 sfList = []
392 # Set up the reco/ID efficiency scale factor calculation algorithm:
393 if config.dataType() is not DataType.Data and not self.noEffSF:
394 alg = config.createAlgorithm( 'CP::MuonEfficiencyScaleFactorAlg',
395 'MuonEfficiencyScaleFactorAlgReco' )
396 config.addPrivateTool( 'efficiencyScaleFactorTool',
397 'CP::MuonEfficiencyScaleFactors' )
398 config.setExtraInputs ({('xAOD::EventInfo', 'EventInfo.RandomRunNumber')})
399 alg.scaleFactorDecoration = 'muon_reco_effSF' + postfix + "_%SYS%"
400 alg.outOfValidity = 2 #silent
401 alg.outOfValidityDeco = 'muon_reco_bad_eff' + postfix
402 alg.efficiencyScaleFactorTool.WorkingPoint = self.quality
403 if config.geometry() >= LHCPeriod.Run3:
404 alg.efficiencyScaleFactorTool.CalibrationRelease = '251211_Preliminary_r24run3'
405 else:
406 alg.efficiencyScaleFactorTool.CalibrationRelease = '230213_Preliminary_r22run2_loosefix'
407 alg.efficiencyScaleFactorTool.BreakDownSystematics = self.systematicBreakdown
408 alg.muons = config.readName (self.containerName)
409 alg.preselection = config.getPreselection (self.containerName, self.selectionName)
410 if self.saveDetailedSF:
411 config.addOutputVar (self.containerName, alg.scaleFactorDecoration,
412 'reco_effSF' + postfix)
413 sfList += [alg.scaleFactorDecoration]
414
415 # Set up the HighPt-specific BadMuonVeto efficiency scale factor calculation algorithm:
416 if config.dataType() is not DataType.Data and self.quality == 'HighPt' and not self.noEffSF:
417 alg = config.createAlgorithm( 'CP::MuonEfficiencyScaleFactorAlg',
418 'MuonEfficiencyScaleFactorAlgBMVHighPt' )
419 config.addPrivateTool( 'efficiencyScaleFactorTool',
420 'CP::MuonEfficiencyScaleFactors' )
421 alg.scaleFactorDecoration = 'muon_BadMuonVeto_effSF' + postfix + "_%SYS%"
422 alg.outOfValidity = 2 #silent
423 alg.outOfValidityDeco = 'muon_BadMuonVeto_bad_eff' + postfix
424 alg.efficiencyScaleFactorTool.WorkingPoint = 'BadMuonVeto_HighPt'
425 if config.geometry() >= LHCPeriod.Run3:
426 alg.efficiencyScaleFactorTool.CalibrationRelease = '220817_Preliminary_r22run3' # not available as part of '230123_Preliminary_r22run3'!
427 else:
428 alg.efficiencyScaleFactorTool.CalibrationRelease = '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 'BadMuonVeto_effSF' + postfix)
435 sfList += [alg.scaleFactorDecoration]
436
437 # Set up the isolation efficiency scale factor calculation algorithm:
438 if config.dataType() is not DataType.Data and self.isolation != 'NonIso' and not self.noEffSF:
439 alg = config.createAlgorithm( 'CP::MuonEfficiencyScaleFactorAlg',
440 'MuonEfficiencyScaleFactorAlgIsol' )
441 config.addPrivateTool( 'efficiencyScaleFactorTool',
442 'CP::MuonEfficiencyScaleFactors' )
443 alg.scaleFactorDecoration = 'muon_isol_effSF' + postfix + "_%SYS%"
444 alg.outOfValidity = 2 #silent
445 alg.outOfValidityDeco = 'muon_isol_bad_eff' + postfix
446 alg.efficiencyScaleFactorTool.WorkingPoint = self.isolation + 'Iso'
447 if config.geometry() >= LHCPeriod.Run3:
448 alg.efficiencyScaleFactorTool.CalibrationRelease = '251211_Preliminary_r24run3'
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 'isol_effSF' + postfix)
457 sfList += [alg.scaleFactorDecoration]
458
459 # Set up the TTVA scale factor calculation algorithm:
460 if config.dataType() is not DataType.Data and self.trackSelection and not self.noEffSF:
461 alg = config.createAlgorithm( 'CP::MuonEfficiencyScaleFactorAlg',
462 'MuonEfficiencyScaleFactorAlgTTVA' )
463 config.addPrivateTool( 'efficiencyScaleFactorTool',
464 'CP::MuonEfficiencyScaleFactors' )
465 alg.scaleFactorDecoration = 'muon_TTVA_effSF' + postfix + "_%SYS%"
466 alg.outOfValidity = 2 #silent
467 alg.outOfValidityDeco = 'muon_TTVA_bad_eff' + postfix
468 alg.efficiencyScaleFactorTool.WorkingPoint = 'TTVA'
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 'TTVA_effSF' + postfix)
479 sfList += [alg.scaleFactorDecoration]
480
481 if config.dataType() is not DataType.Data and not self.noEffSF and self.saveCombinedSF:
482 alg = config.createAlgorithm( 'CP::AsgObjectScaleFactorAlg',
483 'MuonCombinedEfficiencyScaleFactorAlg' )
484 alg.particles = config.readName (self.containerName)
485 alg.inScaleFactors = sfList
486 alg.outScaleFactor = 'effSF' + postfix + '_%SYS%'
487 config.addOutputVar (self.containerName, alg.outScaleFactor, 'effSF' + postfix)
488

Member Data Documentation

◆ containerName

python.MuonAnalysisConfig.MuonWorkingPointEfficiencyConfig.containerName

Definition at line 411 of file MuonAnalysisConfig.py.

◆ noEffSF

python.MuonAnalysisConfig.MuonWorkingPointEfficiencyConfig.noEffSF

Definition at line 393 of file MuonAnalysisConfig.py.

◆ quality

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

Definition at line 416 of file MuonAnalysisConfig.py.

◆ saveCombinedSF

python.MuonAnalysisConfig.MuonWorkingPointEfficiencyConfig.saveCombinedSF

Definition at line 481 of file MuonAnalysisConfig.py.

◆ saveDetailedSF

python.MuonAnalysisConfig.MuonWorkingPointEfficiencyConfig.saveDetailedSF

Definition at line 410 of file MuonAnalysisConfig.py.


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