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

Constructor & Destructor Documentation

◆ __init__()

python.MuonAnalysisConfig.MuonWorkingPointEfficiencyConfig.__init__ ( self)

Definition at line 330 of file MuonAnalysisConfig.py.

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

Member Function Documentation

◆ instanceName()

python.MuonAnalysisConfig.MuonWorkingPointEfficiencyConfig.instanceName ( self)

Definition at line 369 of file MuonAnalysisConfig.py.

369 def instanceName (self) :
370 if self.postfix is not None:
371 return self.containerName + '_' + self.postfix
372 else:
373 return self.containerName + '_' + self.selectionName
374

◆ makeAlgs()

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

Definition at line 375 of file MuonAnalysisConfig.py.

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

Member Data Documentation

◆ containerName

python.MuonAnalysisConfig.MuonWorkingPointEfficiencyConfig.containerName

Definition at line 407 of file MuonAnalysisConfig.py.

◆ noEffSF

python.MuonAnalysisConfig.MuonWorkingPointEfficiencyConfig.noEffSF

Definition at line 389 of file MuonAnalysisConfig.py.

◆ quality

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

Definition at line 412 of file MuonAnalysisConfig.py.

◆ saveCombinedSF

python.MuonAnalysisConfig.MuonWorkingPointEfficiencyConfig.saveCombinedSF

Definition at line 477 of file MuonAnalysisConfig.py.

◆ saveDetailedSF

python.MuonAnalysisConfig.MuonWorkingPointEfficiencyConfig.saveDetailedSF

Definition at line 406 of file MuonAnalysisConfig.py.


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