ATLAS Offline Software
ParticleLevelTausConfig.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2024 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. The default is "",'
15  ' which applies the selection to all truth taus.')
16  self.addOption('isolated', True, type=bool,
17  info='select only truth taus that are isolated.')
18  # Always skip on data
19  self.setOptionValue('skipOnData', True)
20 
21  def makeAlgs(self, config):
22  config.setSourceName (self.containerName, self.containerName)
23 
24  # decorate the missing elements of the 4-vector so we can save it later
25  alg = config.createAlgorithm('CP::ParticleLevelPtEtaPhiDecoratorAlg', 'ParticleLevelPtEtaPhiDecoratorTaus' + self.selectionName)
26  alg.particles = self.containerName
27 
28  # decorate the charge so we can save it later
29  alg = config.createAlgorithm('CP::ParticleLevelChargeDecoratorAlg', 'ParticleLevelChargeDecoratorTaus' + self.selectionName)
30  alg.particles = self.containerName
31 
32  # check for prompt isolation and possible origin from tau decays
33  alg = config.createAlgorithm('CP::ParticleLevelIsolationAlg', 'ParticleLevelIsolationTaus' + self.selectionName)
34  alg.particles = self.containerName
35  alg.isolation = 'isIsolated' + self.selectionName if self.isolated else 'isIsolatedButNotRequired' + self.selectionName
36  alg.notTauOrigin = 'notFromTauButNotRequired' + self.selectionName
37  alg.checkType = 'IsoTau'
38 
39  if self.isolated:
40  config.addSelection (self.containerName, self.selectionName, alg.isolation+',as_char')
41 
42  # output branches to be scheduled only once
43  if ParticleLevelTausBlock.get_instance_count() == 1:
44  outputVars = [
45  ['pt', 'pt'],
46  ['eta', 'eta'],
47  ['phi', 'phi'],
48  ['e', 'e'],
49  ['charge', 'charge'],
50  ['IsHadronicTau', 'IsHadronicTau'],
51  ['classifierParticleType', 'type'],
52  ['classifierParticleOrigin', 'origin'],
53  ]
54  for decoration, branch in outputVars:
55  config.addOutputVar (self.containerName, decoration, branch, noSys=True)
ParticleLevelTausConfig.ParticleLevelTausBlock.makeAlgs
def makeAlgs(self, config)
Definition: ParticleLevelTausConfig.py:21
ParticleLevelTausConfig.ParticleLevelTausBlock.__init__
def __init__(self)
Definition: ParticleLevelTausConfig.py:9
ParticleLevelTausConfig.ParticleLevelTausBlock
Definition: ParticleLevelTausConfig.py:6