ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
Algorithms
TruthParticleLevelAnalysisAlgorithms
python
ParticleLevelPhotonsConfig.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
ParticleLevelPhotonsBlock
(ConfigBlock):
7
"""ConfigBlock for particle-level truth photons"""
8
9
def
__init__
(self):
10
super(ParticleLevelPhotonsBlock, self).
__init__
()
11
self.addOption(
'containerName'
,
'TruthPhotons'
, type=str,
12
info=
'the name of the input truth photons 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 photons.'
,
17
meta={
'role'
:
'selection'
})
18
self.addOption(
'isolated'
,
True
, type=bool,
19
info=
'select only truth photons that are isolated.'
)
20
self.addOption(
'isolationVariable'
,
''
, type=str,
21
info=
'variable to use in isolation cuts of the form `var/pT < cut`.'
)
22
self.addOption(
'isolationCut'
, -1, type=float,
23
info=
'threshold to use in isolation cuts of the form `var/pT < cut`.'
)
24
self.addOption(
'saveUID'
,
False
, type=bool,
25
info=
'save unique ID in output.'
)
26
# Always skip on data
27
self.setOptionValue(
'skipOnData'
,
True
)
28
29
def
instanceName
(self) :
30
"""Return the instance name for this block"""
31
name = self.
containerName
32
if
self.
selectionName
: name = name +
'_'
+ self.
selectionName
33
return
name
34
35
def
makeAlgs
(self, config):
36
config.setSourceName (self.
containerName
, self.
containerName
)
37
38
# decorate the missing elements of the 4-vector so we can save it later
39
alg = config.createAlgorithm(
'CP::ParticleLevelPtEtaPhiDecoratorAlg'
,
40
'ParticleLevelPtEtaPhiDecoratorPhotons'
,
41
reentrant=
True
)
42
alg.particles = self.
containerName
43
44
# check for prompt isolation
45
alg = config.createAlgorithm(
'CP::ParticleLevelIsolationAlg'
,
46
'ParticleLevelIsolationPhotons'
,
47
reentrant=
True
)
48
alg.particles = self.
containerName
49
alg.isolation =
'isIsolated'
+ self.
selectionName
if
self.
isolated
else
'isIsolatedButNotRequired'
+ self.
selectionName
50
alg.notTauOrigin =
'notFromTauButNotRequired'
+ self.
selectionName
51
alg.checkType =
'IsoPhoton'
52
if
self.
isolationVariable
:
53
alg.isoVar = self.
isolationVariable
54
alg.isoCut = self.isolationCut
55
56
if
self.
isolated
:
57
config.addSelection (self.
containerName
, self.
selectionName
, alg.isolation+
',as_char'
)
58
59
# output branches to be scheduled only once
60
if
'pt'
not
in
config.getOutputVars(self.
containerName
):
61
outputVars = [
62
[
'pt'
,
'pt'
,
'float'
],
63
[
'eta'
,
'eta'
,
'float'
],
64
[
'phi'
,
'phi'
,
'float'
],
65
[
'e'
,
'e'
,
'float'
],
66
[
'classifierParticleType'
,
'type'
,
'unsigned'
],
67
[
'classifierParticleOrigin'
,
'origin'
,
'unsigned'
],
68
]
69
if
self.
saveUID
:
70
outputVars += [[
'uid'
,
'uid'
,
'int'
]]
71
for
decoration, branch, auxType
in
outputVars:
72
config.addOutputVar (self.
containerName
, decoration, branch, noSys=
True
, auxType=auxType)
ParticleLevelPhotonsConfig.ParticleLevelPhotonsBlock
Definition
ParticleLevelPhotonsConfig.py:6
ParticleLevelPhotonsConfig.ParticleLevelPhotonsBlock.selectionName
name selectionName
Definition
ParticleLevelPhotonsConfig.py:32
ParticleLevelPhotonsConfig.ParticleLevelPhotonsBlock.isolationVariable
isolationVariable
Definition
ParticleLevelPhotonsConfig.py:52
ParticleLevelPhotonsConfig.ParticleLevelPhotonsBlock.makeAlgs
makeAlgs(self, config)
Definition
ParticleLevelPhotonsConfig.py:35
ParticleLevelPhotonsConfig.ParticleLevelPhotonsBlock.containerName
containerName
Definition
ParticleLevelPhotonsConfig.py:36
ParticleLevelPhotonsConfig.ParticleLevelPhotonsBlock.isolated
isolated
Definition
ParticleLevelPhotonsConfig.py:56
ParticleLevelPhotonsConfig.ParticleLevelPhotonsBlock.saveUID
saveUID
Definition
ParticleLevelPhotonsConfig.py:69
ParticleLevelPhotonsConfig.ParticleLevelPhotonsBlock.__init__
__init__(self)
Definition
ParticleLevelPhotonsConfig.py:9
ParticleLevelPhotonsConfig.ParticleLevelPhotonsBlock.instanceName
instanceName(self)
Definition
ParticleLevelPhotonsConfig.py:29
Generated on
for ATLAS Offline Software by
1.17.0