ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
Algorithms
TruthParticleLevelAnalysisAlgorithms
python
ParticleLevelElectronsConfig.py
Go to the documentation of this file.
1
# Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
2
3
from
AnalysisAlgorithmsConfig.ConfigBlock
import
ConfigBlock
4
5
6
class
ParticleLevelElectronsBlock
(ConfigBlock):
7
"""ConfigBlock for particle-level truth electrons"""
8
9
def
__init__
(self):
10
super(ParticleLevelElectronsBlock, self).
__init__
()
11
self.addOption(
'containerName'
,
'TruthElectrons'
, type=str,
12
info=
'the name of the input truth electrons container.'
,
13
meta={
'role'
:
'container'
})
14
self.addOption(
'selectionName'
,
''
, type=str,
15
info=
'the name of the selection to create. If left empty, '
16
'applies the selection to all truth electrons.'
,
17
meta={
'role'
:
'selection'
})
18
self.addOption(
'isolated'
,
True
, type=bool,
19
info=
'select only truth electrons that are isolated.'
)
20
self.addOption(
'notFromTau'
,
True
, type=bool,
21
info=
'select only truth electrons that did not orginate '
22
'from a tau-lepton decay.'
)
23
self.addOption(
'saveUID'
,
False
, type=bool,
24
info=
'save unique ID in output.'
)
25
# Always skip on data
26
self.setOptionValue(
'skipOnData'
,
True
)
27
28
def
instanceName
(self) :
29
"""Return the instance name for this block"""
30
name = self.
containerName
31
if
self.
selectionName
: name = name +
'_'
+ self.
selectionName
32
return
name
33
34
def
makeAlgs
(self, config):
35
config.setSourceName (self.
containerName
, self.
containerName
)
36
37
# decorate the charge so we can save it later
38
alg = config.createAlgorithm(
'CP::ParticleLevelChargeDecoratorAlg'
,
39
'ParticleLevelChargeDecoratorElectrons'
,
40
reentrant=
True
)
41
alg.particles = self.
containerName
42
43
# check for prompt isolation and possible origin from tau decays
44
alg = config.createAlgorithm(
'CP::ParticleLevelIsolationAlg'
,
45
'ParticleLevelIsolationElectrons'
,
46
reentrant=
True
)
47
alg.particles = self.
containerName
48
alg.isolation =
'isIsolated'
+ self.
selectionName
if
self.
isolated
else
'isIsolatedButNotRequired'
+ self.
selectionName
49
alg.notTauOrigin =
'notFromTau'
+ self.
selectionName
if
self.
notFromTau
else
'notFromTauButNotRequired'
+ self.
selectionName
50
alg.checkType =
'IsoElectron'
51
52
if
self.
isolated
:
53
config.addSelection (self.
containerName
, self.
selectionName
, alg.isolation+
',as_char'
)
54
if
self.
notFromTau
:
55
config.addSelection (self.
containerName
, self.
selectionName
, alg.notTauOrigin+
',as_char'
)
56
57
# output branches to be scheduled only once
58
if
'pt'
not
in
config.getOutputVars(self.
containerName
):
59
outputVars = [
60
[
'pt_dressed'
,
'pt'
,
'float'
],
61
[
'eta_dressed'
,
'eta'
,
'float'
],
62
[
'phi_dressed'
,
'phi'
,
'float'
],
63
[
'e_dressed'
,
'e'
,
'float'
],
64
[
'charge'
,
'charge'
,
'float'
],
65
[
'classifierParticleType'
,
'type'
,
'unsigned'
],
66
[
'classifierParticleOrigin'
,
'origin'
,
'unsigned'
],
67
]
68
if
self.
saveUID
:
69
outputVars += [[
'uid'
,
'uid'
,
'int'
]]
70
for
decoration, branch, auxType
in
outputVars:
71
config.addOutputVar (self.
containerName
, decoration, branch, noSys=
True
, auxType=auxType)
ParticleLevelElectronsConfig.ParticleLevelElectronsBlock
Definition
ParticleLevelElectronsConfig.py:6
ParticleLevelElectronsConfig.ParticleLevelElectronsBlock.__init__
__init__(self)
Definition
ParticleLevelElectronsConfig.py:9
ParticleLevelElectronsConfig.ParticleLevelElectronsBlock.makeAlgs
makeAlgs(self, config)
Definition
ParticleLevelElectronsConfig.py:34
ParticleLevelElectronsConfig.ParticleLevelElectronsBlock.instanceName
instanceName(self)
Definition
ParticleLevelElectronsConfig.py:28
ParticleLevelElectronsConfig.ParticleLevelElectronsBlock.selectionName
name selectionName
Definition
ParticleLevelElectronsConfig.py:31
ParticleLevelElectronsConfig.ParticleLevelElectronsBlock.saveUID
saveUID
Definition
ParticleLevelElectronsConfig.py:68
ParticleLevelElectronsConfig.ParticleLevelElectronsBlock.notFromTau
notFromTau
Definition
ParticleLevelElectronsConfig.py:54
ParticleLevelElectronsConfig.ParticleLevelElectronsBlock.isolated
isolated
Definition
ParticleLevelElectronsConfig.py:52
ParticleLevelElectronsConfig.ParticleLevelElectronsBlock.containerName
containerName
Definition
ParticleLevelElectronsConfig.py:35
Generated on
for ATLAS Offline Software by
1.17.0