375 def makeAlgs (self, config) :
376
377
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
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
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
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
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'
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
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
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
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
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