ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
Algorithms
TruthParticleLevelAnalysisAlgorithms
python
ParticleLevelTausConfig.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
ParticleLevelTausBlock
(ConfigBlock):
7
"""ConfigBlock for particle-level truth taus"""
8
9
def
__init__
(self):
10
super(ParticleLevelTausBlock, self).
__init__
()
11
self.addOption(
'containerName'
,
'TruthTaus'
, type=str,
12
info=
'the name of the input truth taus 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 taus.'
)
16
self.addOption(
'isolated'
,
True
, type=bool,
17
info=
'select only truth taus that are isolated.'
)
18
self.addOption(
'saveUID'
,
False
, type=bool,
19
info=
'save unique ID in output.'
)
20
# Always skip on data
21
self.setOptionValue(
'skipOnData'
,
True
)
22
23
def
instanceName
(self) :
24
"""Return the instance name for this block"""
25
name = self.
containerName
26
if
self.
selectionName
: name = name +
'_'
+ self.
selectionName
27
return
name
28
29
def
makeAlgs
(self, config):
30
config.setSourceName (self.
containerName
, self.
containerName
)
31
32
# decorate the missing elements of the 4-vector so we can save it later
33
alg = config.createAlgorithm(
'CP::ParticleLevelPtEtaPhiDecoratorAlg'
,
34
'ParticleLevelPtEtaPhiDecoratorTaus'
,
35
reentrant=
True
)
36
alg.particles = self.
containerName
37
38
# decorate the charge so we can save it later
39
alg = config.createAlgorithm(
'CP::ParticleLevelChargeDecoratorAlg'
,
40
'ParticleLevelChargeDecoratorTaus'
,
41
reentrant=
True
)
42
alg.particles = self.
containerName
43
44
# check for prompt isolation and possible origin from tau decays
45
alg = config.createAlgorithm(
'CP::ParticleLevelIsolationAlg'
,
46
'ParticleLevelIsolationTaus'
,
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 =
'IsoTau'
52
53
if
self.
isolated
:
54
config.addSelection (self.
containerName
, self.
selectionName
, alg.isolation+
',as_char'
)
55
56
# output branches to be scheduled only once
57
if
ParticleLevelTausBlock.get_instance_count() == 1
or
'pt'
not
in
config.getOutputVars(self.
containerName
):
58
outputVars = [
59
[
'pt'
,
'pt'
,
'float'
],
60
[
'eta'
,
'eta'
,
'float'
],
61
[
'phi'
,
'phi'
,
'float'
],
62
[
'e'
,
'e'
,
'float'
],
63
[
'charge'
,
'charge'
,
'float'
],
64
[
'IsHadronicTau'
,
'IsHadronicTau'
,
'char'
],
65
[
'pdgId'
,
'pdgId'
,
'int'
],
66
[
'numCharged'
,
'numCharged'
,
'unsigned_long'
],
67
[
'classifierParticleType'
,
'type'
,
'unsigned'
],
68
[
'classifierParticleOrigin'
,
'origin'
,
'unsigned'
],
69
[
'pt_vis'
,
'pt_vis'
,
'double'
],
70
[
'eta_vis'
,
'eta_vis'
,
'double'
],
71
[
'phi_vis'
,
'phi_vis'
,
'double'
],
72
[
'm_vis'
,
'm_vis'
,
'double'
],
73
[
'pt_vis_dressed'
,
'pt_vis_dressed'
,
'float'
],
74
[
'eta_vis_dressed'
,
'eta_vis_dressed'
,
'float'
],
75
[
'phi_vis_dressed'
,
'phi_vis_dressed'
,
'float'
],
76
[
'm_vis_dressed'
,
'm_vis_dressed'
,
'float'
],
77
[
'pt_invis'
,
'pt_invis'
,
'double'
],
78
[
'eta_invis'
,
'eta_invis'
,
'double'
],
79
[
'phi_invis'
,
'phi_invis'
,
'double'
],
80
[
'm_invis'
,
'm_invis'
,
'double'
],
81
82
]
83
if
self.
saveUID
:
84
outputVars += [[
'uid'
,
'uid'
,
'int'
]]
85
for
decoration, branch, auxType
in
outputVars:
86
config.addOutputVar (self.
containerName
, decoration, branch, noSys=
True
, auxType=auxType)
ParticleLevelTausConfig.ParticleLevelTausBlock
Definition
ParticleLevelTausConfig.py:6
ParticleLevelTausConfig.ParticleLevelTausBlock.instanceName
instanceName(self)
Definition
ParticleLevelTausConfig.py:23
ParticleLevelTausConfig.ParticleLevelTausBlock.isolated
isolated
Definition
ParticleLevelTausConfig.py:53
ParticleLevelTausConfig.ParticleLevelTausBlock.__init__
__init__(self)
Definition
ParticleLevelTausConfig.py:9
ParticleLevelTausConfig.ParticleLevelTausBlock.makeAlgs
makeAlgs(self, config)
Definition
ParticleLevelTausConfig.py:29
ParticleLevelTausConfig.ParticleLevelTausBlock.containerName
containerName
Definition
ParticleLevelTausConfig.py:30
ParticleLevelTausConfig.ParticleLevelTausBlock.selectionName
name selectionName
Definition
ParticleLevelTausConfig.py:26
ParticleLevelTausConfig.ParticleLevelTausBlock.saveUID
saveUID
Definition
ParticleLevelTausConfig.py:83
Generated on
for ATLAS Offline Software by
1.17.0