370 def makeAlgs (self, config) :
371
372
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
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
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
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
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'
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
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
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
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
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