393 def makeAlgs (self, config) :
394
395
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
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
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
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
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'
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
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
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
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
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