379 def makeAlgs (self, config) :
380
381
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
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
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
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
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'
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
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
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
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
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