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