ATLAS Offline Software
Loading...
Searching...
No Matches
ParticleLevelNeutrinosConfig.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 ParticleLevelNeutrinosBlock(ConfigBlock):
7 """ConfigBlock for particle-level truth neutrinos"""
8
9 def __init__(self):
10 super(ParticleLevelNeutrinosBlock, self).__init__()
11 self.addOption('containerName', 'TruthNeutrinos', type=str,
12 info='the name of the input truth neutrinos 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 neutrinos.',
17 meta={'role':'selection'})
18 self.addOption('isolated', True, type=bool,
19 info='select only truth neutrinos that are isolated.')
20 self.addOption('notFromTau', True, type=bool,
21 info='select only truth neutrinos that did not orginate '
22 'from a tau decay.')
23 # Always skip on data
24 self.setOptionValue('skipOnData', True)
25
26 def instanceName (self) :
27 """Return the instance name for this block"""
28 name = self.containerName
29 if self.selectionName: name = name + '_' + self.selectionName
30 return name
31
32 def makeAlgs(self, config):
33 config.setSourceName (self.containerName, self.containerName)
34
35 # decorate the missing elements of the 4-vector so we can save it later
36 alg = config.createAlgorithm('CP::ParticleLevelPtEtaPhiDecoratorAlg',
37 'ParticleLevelPtEtaPhiEDecoratorNeutrinos',
38 reentrant=True)
39 alg.particles = self.containerName
40
41 # check for prompt isolation and possible origin from tau decays
42 alg = config.createAlgorithm('CP::ParticleLevelIsolationAlg',
43 'ParticleLevelIsolationNeutrinos',
44 reentrant=True)
45 alg.particles = self.containerName
46 alg.isolation = 'isIsolated' + self.selectionName if self.isolated else 'isIsolatedButNotRequired' + self.selectionName
47 alg.notTauOrigin = 'notFromTau' + self.selectionName if self.notFromTau else 'notFromTauButNotRequired' + self.selectionName
48 alg.checkType = 'Neutrino'
49
50 if self.isolated:
51 config.addSelection (self.containerName, self.selectionName, alg.isolation+',as_char')
52 if self.notFromTau:
53 config.addSelection (self.containerName, self.selectionName, alg.notTauOrigin+',as_char')
54
55 # output branches to be scheduled only once
56 if 'pt' not in config.getOutputVars(self.containerName):
57 outputVars = [
58 ['pt', 'pt', 'float'],
59 ['eta', 'eta', 'float'],
60 ['phi', 'phi', 'float'],
61 ['e', 'e', 'float'],
62 ]
63 for decoration, branch, auxType in outputVars:
64 config.addOutputVar (self.containerName, decoration, branch, noSys=True, auxType=auxType)