ATLAS Offline Software
Public Member Functions | List of all members
python.MuonAnalysisConfig.MuonTriggerAnalysisSFBlock Class Reference
Inheritance diagram for python.MuonAnalysisConfig.MuonTriggerAnalysisSFBlock:
Collaboration diagram for python.MuonAnalysisConfig.MuonTriggerAnalysisSFBlock:

Public Member Functions

def __init__ (self, configName='')
 
def makeAlgs (self, config)
 

Detailed Description

Definition at line 384 of file MuonAnalysisConfig.py.

Constructor & Destructor Documentation

◆ __init__()

def python.MuonAnalysisConfig.MuonTriggerAnalysisSFBlock.__init__ (   self,
  configName = '' 
)

Definition at line 386 of file MuonAnalysisConfig.py.

386  def __init__ (self, configName='') :
387  super (MuonTriggerAnalysisSFBlock, self).__init__ ()
388 
389  self.addOption ('triggerChainsPerYear', {}, type=None,
390  info="a dictionary with key (string) the year and value (list of "
391  "strings) the trigger chains. The default is {} (empty dictionary).")
392  self.addOption ('muonID', '', type=str,
393  info="the muon quality WP (string) to use.")
394  self.addOption ('saveEff', False, type=bool,
395  info="define whether we decorate also the trigger scale efficiency "
396  "The default is false.")
397  self.addOption ('containerName', '', type=str,
398  info="the input muon container, with a possible selection, in "
399  "the format container or container.selection.")
400 

Member Function Documentation

◆ makeAlgs()

def python.MuonAnalysisConfig.MuonTriggerAnalysisSFBlock.makeAlgs (   self,
  config 
)

Definition at line 401 of file MuonAnalysisConfig.py.

401  def makeAlgs (self, config) :
402 
403  if config.dataType() is not DataType.Data:
404 
405  # Dictionary from TrigGlobalEfficiencyCorrection/Triggers.cfg
406  # Key is trigger chain (w/o HLT prefix)
407  # Value is empty for single leg trigger or list of legs
408  triggerDict = TriggerDict()
409 
410  if config.campaign() is Campaign.MC20a:
411  years = [2015, 2016]
412  elif config.campaign() is Campaign.MC20d:
413  years = [2017]
414  elif config.campaign() is Campaign.MC20e:
415  years = [2018]
416  elif config.campaign() in [Campaign.MC21a, Campaign.MC23a]:
417  years = [2022]
418  elif config.campaign() in [Campaign.MC23c, Campaign.MC23d]:
419  years = [2023]
420 
421  triggerConfigs = {}
422  triggerConfigYears = {}
423  for year in years:
424  triggerChains = self.triggerChainsPerYear.get(int(year), self.triggerChainsPerYear.get(str(year), []))
425  for chain in triggerChains:
426  chain = chain.replace(" || ", "_OR_")
427  chain_noHLT = chain.replace("HLT_","")
428  legs = triggerDict[chain_noHLT]
429  if len(legs)==0:
430  if chain_noHLT.startswith('mu') and chain_noHLT[2].isdigit:
431  # Need to support HLT_mu26_ivarmedium_OR_HLT_mu50
432  triggerConfigs[chain_noHLT] = chain
433  if chain_noHLT in triggerConfigYears.keys():
434  triggerConfigYears[chain_noHLT].append(year)
435  else:
436  triggerConfigYears[chain_noHLT] = [year]
437  else:
438  for leg in legs:
439  if leg.startswith('mu') and leg[2].isdigit:
440  # Need to support HLT_mu14_ivarloose
441  triggerConfigs[leg] = 'HLT_' + leg
442  if chain_noHLT in triggerConfigYears.keys():
443  triggerConfigYears[leg].append(year)
444  else:
445  triggerConfigYears[leg] = [year]
446 
447  for trig_short, trig in triggerConfigs.items():
448  alg = config.createAlgorithm('CP::MuonTriggerEfficiencyScaleFactorAlg',
449  'MuonTrigEfficiencyCorrectionsAlg_' + trig_short)
450  config.addPrivateTool( 'efficiencyScaleFactorTool',
451  'CP::MuonTriggerScaleFactors' )
452 
453  # Reproduce config from TrigGlobalEfficiencyAlg
454  alg.efficiencyScaleFactorTool.MuonQuality = self.muonID
455  alg.efficiencyScaleFactorTool.AllowZeroSF = True
456 
457  # Avoid warnings for MC20a 2015-2016 triggers covering a single year
458  if config.campaign() is Campaign.MC20a:
459  if triggerConfigYears[trig_short] == [2015]:
460  alg.maxRunNumber = 290000
461  elif triggerConfigYears[trig_short] == [2016]:
462  alg.minRunNumber = 290000
463 
464  alg.trigger = trig
465  alg.scaleFactorDecoration = 'muon_trigEffSF_' + trig_short + '_%SYS%'
466  if(self.saveEff):
467  alg.mcEfficiencyDecoration = 'muon_trigEff_' + trig_short + '_%SYS%'
468  alg.outOfValidity = 2 #silent
469  alg.outOfValidityDeco = 'bad_eff_muontrig_' + trig_short
470  alg.muons = config.readName (self.containerName)
471  alg.preselection = config.getPreselection (self.containerName, '')
472  config.addOutputVar (self.containerName, alg.scaleFactorDecoration, 'trigEffSF_' + trig_short)
473  if(self.saveEff):
474  config.addOutputVar (self.containerName, alg.scaleFactorDecoration, 'trigEff_' + trig_short)

The documentation for this class was generated from the following file:
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
dumpHVPathFromNtuple.append
bool append
Definition: dumpHVPathFromNtuple.py:91
TriggerLeg_DictHelpers.TriggerDict
def TriggerDict()
Definition: TriggerLeg_DictHelpers.py:7
python.processes.powheg.ZZ.ZZ.__init__
def __init__(self, base_directory, **kwargs)
Constructor: all process options are set here.
Definition: ZZ.py:18
if
if(febId1==febId2)
Definition: LArRodBlockPhysicsV0.cxx:567
get
T * get(TKey *tobj)
get a TObject* from a TKey* (why can't a TObject be a TKey?)
Definition: hcg.cxx:127
str
Definition: BTagTrackIpAccessor.cxx:11