ATLAS Offline Software
Loading...
Searching...
No Matches
ParticleLevelOverlapRemovalConfig.py
Go to the documentation of this file.
1# Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
2
3from 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 meta={'role':'containerRef'})
14 self.addOption('electrons', '', type=str,
15 info='the name of the input truth electrons container, in the format `container` or `container.selection`.',
16 meta={'role':'containerRef'})
17 self.addOption('muons', '', type=str,
18 info='the name of the input truth muons container, in the format `container` or `container.selection`.',
19 meta={'role':'containerRef'})
20 self.addOption('photons', '', type=str,
21 info='the name of the input truth photons container, in the format `container` or `container.selection`.',
22 meta={'role':'containerRef'})
23 self.addOption('label', 'passesOR', type=str,
24 info='the name of the decoration to apply to all particles passing OR.')
25 self.addOption('useDressedProperties', True, type=bool,
26 info='whether to use dressed electron and muon kinematics rather than simple 4-vector kinematics.')
27 self.addOption('useRapidityForDeltaR', True, type=bool,
28 info=r'whether to use rapidity instead of pseudo-rapidity for the calculation of $\Delta R$.')
29 # Always skip on data
30 self.setOptionValue('skipOnData', True)
31
32 def instanceName (self) :
33 """Return the instance name for this block"""
34 return self.label
35
36 def makeAlgs(self, config):
37 if not self.jets:
38 raise ValueError('Particle-level overlap removal needs the jet container to be run!')
39
40 alg = config.createAlgorithm('CP::ParticleLevelOverlapRemovalAlg',
41 'ParticleLevelOverlapRemoval',
42 reentrant=True)
43 alg.useDressedProperties = self.useDressedProperties
44 alg.useRapidityForDeltaR = self.useRapidityForDeltaR
45 alg.labelOR = self.label
46 if self.electrons:
47 electronsName, alg.electronSelection = config.readNameAndSelection (self.electrons)
48 alg.electrons = electronsName
49 alg.doJetElectronOR = True
50 alg.decORelectron = f'{electronsName}.{self.label}'
52 alg.ptDressedElectron = f'{electronsName}.pt_dressed'
53 alg.etaDressedElectron = f'{electronsName}.eta_dressed'
54 alg.phiDressedElectron = f'{electronsName}.phi_dressed'
55 alg.eDressedElectron = f'{electronsName}.e_dressed'
56 container, _, selection = self.electrons.partition(".")
57 config.addSelection (container, selection, alg.labelOR + ',as_char')
58 if self.muons:
59 muonsName, alg.muonSelection = config.readNameAndSelection (self.muons)
60 alg.muons = muonsName
61 alg.doJetMuonOR = True
62 alg.decORmuon = f'{muonsName}.{self.label}'
64 alg.ptDressedMuon = f'{muonsName}.pt_dressed'
65 alg.etaDressedMuon = f'{muonsName}.eta_dressed'
66 alg.phiDressedMuon = f'{muonsName}.phi_dressed'
67 alg.eDressedMuon = f'{muonsName}.e_dressed'
68 container, _, selection = self.muons.partition(".")
69 config.addSelection (container, selection, alg.labelOR + ',as_char')
70 if self.photons:
71 photonsName, alg.photonSelection = config.readNameAndSelection (self.photons)
72 alg.photons = photonsName
73 alg.doJetPhotonOR = True
74 alg.decORphoton = f'{photonsName}.{self.label}'
75 container, _, selection = self.photons.partition(".")
76 config.addSelection (container, selection, alg.labelOR + ',as_char')
77 jetsName, alg.jetSelection = config.readNameAndSelection (self.jets)
78 alg.jets = jetsName
79 alg.decORjet = f'{jetsName}.{self.label}'
80 container, _, selection = self.jets.partition(".")
81 config.addSelection (container, selection, alg.labelOR + ',as_char')
82