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

Constructor & Destructor Documentation

◆ __init__()

python.MuonAnalysisConfig.MuonWorkingPointEfficiencyConfig.__init__ ( self)

Definition at line 325 of file MuonAnalysisConfig.py.

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

Member Function Documentation

◆ instanceName()

python.MuonAnalysisConfig.MuonWorkingPointEfficiencyConfig.instanceName ( self)

Definition at line 364 of file MuonAnalysisConfig.py.

364 def instanceName (self) :
365 if self.postfix is not None:
366 return self.containerName + '_' + self.postfix
367 else:
368 return self.containerName + '_' + self.selectionName
369

◆ makeAlgs()

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

Definition at line 370 of file MuonAnalysisConfig.py.

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

Member Data Documentation

◆ containerName

python.MuonAnalysisConfig.MuonWorkingPointEfficiencyConfig.containerName

Definition at line 402 of file MuonAnalysisConfig.py.

◆ noEffSF

python.MuonAnalysisConfig.MuonWorkingPointEfficiencyConfig.noEffSF

Definition at line 384 of file MuonAnalysisConfig.py.

◆ quality

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

Definition at line 407 of file MuonAnalysisConfig.py.

◆ saveCombinedSF

python.MuonAnalysisConfig.MuonWorkingPointEfficiencyConfig.saveCombinedSF

Definition at line 472 of file MuonAnalysisConfig.py.

◆ saveDetailedSF

python.MuonAnalysisConfig.MuonWorkingPointEfficiencyConfig.saveDetailedSF

Definition at line 401 of file MuonAnalysisConfig.py.


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