ATLAS Offline Software
ParticleLevelOverlapRemovalConfig.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2 
3 from AnalysisAlgorithmsConfig.ConfigBlock import ConfigBlock
4 
5 
7  """ConfigBlock for particle-level overlap removal"""
8 
9  def __init__(self):
10  super(ParticleLevelOverlapRemovalBlock, self).__init__()
11  self.addOption('jets', '', type=str,
12  info ='the name of the input truth jets container, in the format "container" or "container.selection".')
13  self.addOption('electrons', '', type=str,
14  info='the name of the input truth electrons container, in the format "container" or "container.selection".')
15  self.addOption('muons', '', type=str,
16  info='the name of the input truth muons container, in the format "container" or "container.selection".')
17  self.addOption('photons', '', type=str,
18  info='the name of the input truth photons container, in the format "container" or "container.selection".')
19  self.addOption('label', 'passesOR', type=str,
20  info='the name of the decoration to apply to all particles passing OR')
21  self.addOption('useDressedProperties', True, type=bool,
22  info='whether to use dressed electron and muon kinematics rather than simple P4 kinematics')
23  self.addOption('useRapidityForDeltaR', True, type=bool,
24  info='whether to use rapidity instead of pseudo-rapidity for the calculation of DeltaR')
25  # Always skip on data
26  self.setOptionValue('skipOnData', True)
27 
28  def instanceName (self) :
29  """Return the instance name for this block"""
30  return self.label
31 
32  def makeAlgs(self, config):
33  alg = config.createAlgorithm('CP::ParticleLevelOverlapRemovalAlg',
34  'ParticleLevelOverlapRemoval',
35  reentrant=True)
36  alg.useDressedProperties = self.useDressedProperties
37  alg.useRapidityForDeltaR = self.useRapidityForDeltaR
38  alg.labelOR = self.label
39  if self.electrons:
40  alg.electrons, alg.electronSelection = config.readNameAndSelection (self.electrons)
41  alg.doJetElectronOR = True
42  selection = self.electrons.split(".")[1] if len(self.electrons.split(".")) == 2 else ''
43  config.addSelection (self.electrons.split(".")[0], selection, alg.labelOR + ',as_char')
44  if self.muons:
45  alg.muons, alg.muonSelection = config.readNameAndSelection (self.muons)
46  alg.doJetMuonOR = True
47  selection = self.muons.split(".")[1] if len(self.muons.split(".")) == 2 else ''
48  config.addSelection (self.muons.split(".")[0], selection, alg.labelOR + ',as_char')
49  if self.photons:
50  alg.photons, alg.photonSelection = config.readNameAndSelection (self.photons)
51  alg.doJetPhotonOR = True
52  selection = self.photons.split(".")[1] if len(self.photons.split(".")) == 2 else ''
53  config.addSelection (self.photons.split(".")[0], selection, alg.labelOR + ',as_char')
54  if self.jets:
55  alg.jets, alg.jetSelection = config.readNameAndSelection (self.jets)
56  selection = self.jets.split(".")[1] if len(self.jets.split(".")) == 2 else ''
57  config.addSelection (self.jets.split(".")[0], selection, alg.labelOR + ',as_char')
58  else:
59  raise ValueError('Particle-level overlap removal needs the jet container to be run!')
ParticleLevelOverlapRemovalConfig.ParticleLevelOverlapRemovalBlock
Definition: ParticleLevelOverlapRemovalConfig.py:6
ParticleLevelOverlapRemovalConfig.ParticleLevelOverlapRemovalBlock.makeAlgs
def makeAlgs(self, config)
Definition: ParticleLevelOverlapRemovalConfig.py:32
ParticleLevelOverlapRemovalConfig.ParticleLevelOverlapRemovalBlock.instanceName
def instanceName(self)
Definition: ParticleLevelOverlapRemovalConfig.py:28
ParticleLevelOverlapRemovalConfig.ParticleLevelOverlapRemovalBlock.__init__
def __init__(self)
Definition: ParticleLevelOverlapRemovalConfig.py:9
Trk::split
@ split
Definition: LayerMaterialProperties.h:38