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