ATLAS Offline Software
Loading...
Searching...
No Matches
ParticleLevelJetsConfig.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 ParticleLevelJetsBlock(ConfigBlock):
7 """ConfigBlock for particle-level truth jets"""
8
9 def __init__(self):
10 super(ParticleLevelJetsBlock, self).__init__()
11 self.addOption('containerName', 'AntiKt4TruthDressedWZJets', type=str,
12 info='the name of the input truth jets container.',
13 meta={'role':'container'})
14 self.addOption('outputTruthLabelIDs', False, type=bool,
15 info='enable `HadronConeExclTruthLabelID` and `PartonTruthLabelID` decorations.')
16 # Always skip on data
17 self.setOptionValue('skipOnData', True)
18
19 def instanceName (self) :
20 """Return the instance name for this block"""
21 return self.containerName
22
23 def makeAlgs(self, config):
24 config.setSourceName (self.containerName, self.containerName)
25
26 # count the number of heavy-flavour jets for normalisation of e.g. V+HF samples
27 if "AntiKt4" in self.containerName:
28 alg = config.createAlgorithm('CP::ParticleLevelJetsAlg',
29 'ParticleLevelJetsAlg',
30 reentrant=True)
31 alg.jets = self.containerName
32
33 # decorate the energy so we can save it later
34 alg = config.createAlgorithm( 'CP::AsgEnergyDecoratorAlg', 'ParticleLevelEnergyDecorator' )
35 alg.particles = self.containerName
36
37 # For some decorations the type is not known at initialization
38 # time, in which case we need to pass it in manually. We could
39 # also pass in the type for all decorations, but is not
40 # necessary and introduces the possibility of a type mismatch.
41 outputVars = [
42 ['pt', 'pt', None],
43 ['eta', 'eta', None],
44 ['phi', 'phi', None],
45 ['e_%SYS%', 'e', None],
46 ['GhostBHadronsFinalCount', 'nGhosts_bHadron', 'int'],
47 ['GhostCHadronsFinalCount', 'nGhosts_cHadron', 'int'],
48 ]
49
51 outputVars += [
52 ['HadronConeExclTruthLabelID', 'HadronConeExclTruthLabelID', None],
53 ['PartonTruthLabelID', 'PartonTruthLabelID', None],
54 ]
55
56 for decoration, branch, auxType in outputVars:
57 config.addOutputVar (self.containerName, decoration, branch, noSys=True, auxType=auxType)
58
59 if "AntiKt4" in self.containerName:
60 config.addOutputVar('EventInfo', 'num_truth_bjets_nocuts', 'num_truth_bjets_nocuts', noSys=True, auxType='int')
61 config.addOutputVar('EventInfo', 'num_truth_cjets_nocuts', 'num_truth_cjets_nocuts', noSys=True, auxType='int')