334 def makeAlgs (self, config) :
335
336
337 if config.geometry() is LHCPeriod.Run1:
338 raise ValueError ("Can't set up the MuonWorkingPointEfficiencyConfig with %s, there must be something wrong!" % config.geometry().value)
339
340 postfix = self.postfix
341 if postfix is None :
342 postfix = self.selectionName
343 if postfix != '' and postfix[0] != '_' :
344 postfix = '_' + postfix
345
346 sfList = []
347
348 if config.dataType() is not DataType.Data and not self.noEffSF:
349 alg = config.createAlgorithm( 'CP::MuonEfficiencyScaleFactorAlg',
350 'MuonEfficiencyScaleFactorAlgReco' )
351 config.addPrivateTool( 'efficiencyScaleFactorTool',
352 'CP::MuonEfficiencyScaleFactors' )
353 alg.scaleFactorDecoration = 'muon_reco_effSF' + postfix + "_%SYS%"
354 alg.outOfValidity = 2
355 alg.outOfValidityDeco = 'muon_reco_bad_eff' + postfix
356 alg.efficiencyScaleFactorTool.WorkingPoint = self.quality
357 if config.geometry() >= LHCPeriod.Run3:
358 alg.efficiencyScaleFactorTool.CalibrationRelease = '251211_Preliminary_r24run3'
359 else:
360 alg.efficiencyScaleFactorTool.CalibrationRelease = '230213_Preliminary_r22run2'
361 alg.efficiencyScaleFactorTool.BreakDownSystematics = self.systematicBreakdown
362 alg.muons = config.readName (self.containerName)
363 alg.preselection = config.getPreselection (self.containerName, self.selectionName)
364 if self.saveDetailedSF:
365 config.addOutputVar (self.containerName, alg.scaleFactorDecoration,
366 'reco_effSF' + postfix)
367 sfList += [alg.scaleFactorDecoration]
368
369
370 if config.dataType() is not DataType.Data and self.quality == 'HighPt' and not self.noEffSF:
371 alg = config.createAlgorithm( 'CP::MuonEfficiencyScaleFactorAlg',
372 'MuonEfficiencyScaleFactorAlgBMVHighPt' )
373 config.addPrivateTool( 'efficiencyScaleFactorTool',
374 'CP::MuonEfficiencyScaleFactors' )
375 alg.scaleFactorDecoration = 'muon_BadMuonVeto_effSF' + postfix + "_%SYS%"
376 alg.outOfValidity = 2
377 alg.outOfValidityDeco = 'muon_BadMuonVeto_bad_eff' + postfix
378 alg.efficiencyScaleFactorTool.WorkingPoint = 'BadMuonVeto_HighPt'
379 if config.geometry() >= LHCPeriod.Run3:
380 alg.efficiencyScaleFactorTool.CalibrationRelease = '220817_Preliminary_r22run3'
381 else:
382 alg.efficiencyScaleFactorTool.CalibrationRelease = '230213_Preliminary_r22run2'
383 alg.efficiencyScaleFactorTool.BreakDownSystematics = self.systematicBreakdown
384 alg.muons = config.readName (self.containerName)
385 alg.preselection = config.getPreselection (self.containerName, self.selectionName)
386 if self.saveDetailedSF:
387 config.addOutputVar (self.containerName, alg.scaleFactorDecoration,
388 'BadMuonVeto_effSF' + postfix)
389 sfList += [alg.scaleFactorDecoration]
390
391
392 if config.dataType() is not DataType.Data and self.isolation != 'NonIso' and not self.noEffSF:
393 alg = config.createAlgorithm( 'CP::MuonEfficiencyScaleFactorAlg',
394 'MuonEfficiencyScaleFactorAlgIsol' )
395 config.addPrivateTool( 'efficiencyScaleFactorTool',
396 'CP::MuonEfficiencyScaleFactors' )
397 alg.scaleFactorDecoration = 'muon_isol_effSF' + postfix + "_%SYS%"
398 alg.outOfValidity = 2
399 alg.outOfValidityDeco = 'muon_isol_bad_eff' + postfix
400 alg.efficiencyScaleFactorTool.WorkingPoint = self.isolation + 'Iso'
401 if config.geometry() >= LHCPeriod.Run3:
402 alg.efficiencyScaleFactorTool.CalibrationRelease = '251211_Preliminary_r24run3'
403 else:
404 alg.efficiencyScaleFactorTool.CalibrationRelease = '230213_Preliminary_r22run2'
405 alg.efficiencyScaleFactorTool.BreakDownSystematics = self.systematicBreakdown
406 alg.muons = config.readName (self.containerName)
407 alg.preselection = config.getPreselection (self.containerName, self.selectionName)
408 if self.saveDetailedSF:
409 config.addOutputVar (self.containerName, alg.scaleFactorDecoration,
410 'isol_effSF' + postfix)
411 sfList += [alg.scaleFactorDecoration]
412
413
414 if config.dataType() is not DataType.Data and self.trackSelection and not self.noEffSF:
415 alg = config.createAlgorithm( 'CP::MuonEfficiencyScaleFactorAlg',
416 'MuonEfficiencyScaleFactorAlgTTVA' )
417 config.addPrivateTool( 'efficiencyScaleFactorTool',
418 'CP::MuonEfficiencyScaleFactors' )
419 alg.scaleFactorDecoration = 'muon_TTVA_effSF' + postfix + "_%SYS%"
420 alg.outOfValidity = 2
421 alg.outOfValidityDeco = 'muon_TTVA_bad_eff' + postfix
422 alg.efficiencyScaleFactorTool.WorkingPoint = 'TTVA'
423 if config.geometry() >= LHCPeriod.Run3:
424 alg.efficiencyScaleFactorTool.CalibrationRelease = '251211_Preliminary_r24run3'
425 else:
426 alg.efficiencyScaleFactorTool.CalibrationRelease = '230213_Preliminary_r22run2'
427 alg.efficiencyScaleFactorTool.BreakDownSystematics = self.systematicBreakdown
428 alg.muons = config.readName (self.containerName)
429 alg.preselection = config.getPreselection (self.containerName, self.selectionName)
430 if self.saveDetailedSF:
431 config.addOutputVar (self.containerName, alg.scaleFactorDecoration,
432 'TTVA_effSF' + postfix)
433 sfList += [alg.scaleFactorDecoration]
434
435 if config.dataType() is not DataType.Data and not self.noEffSF and self.saveCombinedSF:
436 alg = config.createAlgorithm( 'CP::AsgObjectScaleFactorAlg',
437 'MuonCombinedEfficiencyScaleFactorAlg' )
438 alg.particles = config.readName (self.containerName)
439 alg.inScaleFactors = sfList
440 alg.outScaleFactor = 'effSF' + postfix + '_%SYS%'
441 config.addOutputVar (self.containerName, alg.outScaleFactor, 'effSF' + postfix)
442