ATLAS Offline Software
Loading...
Searching...
No Matches
JetReclusteringConfig.py
Go to the documentation of this file.
1# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2
3from AnalysisAlgorithmsConfig.ConfigBlock import ConfigBlock
4from AthenaCommon.SystemOfUnits import GeV
5
6class JetReclusteringBlock(ConfigBlock):
7 """ConfigBlock for the jet reclustering algorithm:
8 run FastJet with small-R jets as input. The output
9 is a new container containing the reclustered jets.
10 The default output variables are the RC jet kinematics
11 as well as a vector of indices pointing to the
12 small-R jets that formed the RC jets.
13 ---- to be updated with substructure variables!"""
14
15 def __init__(self):
16 super(JetReclusteringBlock, self).__init__()
17 self.addOption ('containerName', None, type=str,
18 info='name of the output reclustered jets container.',
19 meta={'role':'container'})
20 self.addOption ('jets', None, type=str,
21 info='the input jet collection to recluster, with a possible selection, in the format `container` or `container.selection`.',
22 meta={'role':'containerRef'})
23 self.addOption ('clusteringAlgorithm', 'AntiKt', type=str,
24 info='algorithm to use to recluster the jets: `AntiKt`, `Kt`, `CamKt`.',
25 meta={'choices':(['AntiKt','Kt','CamKt'],1)})
26 self.addOption ('reclusteredJetsRadius', 1.0, type=float,
27 info='radius parameter of the reclustering algorithm.')
28 self.addOption ('minPt', 200*GeV, type=float,
29 info=r'minimum $p_\mathrm{T}$ requirement (in MeV) on the reclustered jets, creating the selection `passed_sel`.')
30 self.addOption ('maxEta', 0., type=float,
31 info=r'maximum $\vert\eta\vert$ requirement on the reclustered jets, creating the selection `passed_sel`.')
32 self.addOption ('maxRapidity', 2.5, type=float,
33 info='maximum rapidity requirement on the reclustered jets, creating the selection `passed_sel`.')
34 def instanceName (self) :
35 """Return the instance name for this block"""
36 return self.containerName
37
38 def makeAlgs(self, config):
39
40 alg = config.createAlgorithm('CP::JetReclusteringAlg', 'JetReclusteringAlg')
41
42 alg.jets, alg.jetSelection = config.readNameAndSelection(self.jets)
43 alg.reclusteredJets = config.writeName(self.containerName)
44 alg.smallRjetIndices = 'smallRjetIndices_%SYS%'
45 alg.rcJetEnergy = 'e_%SYS%'
46 alg.clusteringAlgorithm = self.clusteringAlgorithm
47 alg.reclusteredJetsRadius = self.reclusteredJetsRadius
48
49 # prepare selection algorithm
50 if self.minPt > 0 or self.maxEta > 0 or self.maxRapidity > 0 :
51 selAlg = config.createAlgorithm('CP::AsgSelectionAlg', 'RCJetsMinPtAlg')
52 selAlg.selectionDecoration = 'passed_sel,as_bits'
53 config.addPrivateTool('selectionTool', 'CP::AsgPtEtaSelectionTool')
54 selAlg.selectionTool.minPt = self.minPt
55 selAlg.selectionTool.maxEta = self.maxEta
56 selAlg.selectionTool.maxRapidity = self.maxRapidity
57 selAlg.particles = config.readName(self.containerName)
58 selAlg.preselection = config.getPreselection(self.containerName, '')
59 config.addSelection(self.containerName, 'passed_sel', selAlg.selectionDecoration)
60
61 config.addOutputVar(self.containerName, 'pt', 'pt')
62 config.addOutputVar(self.containerName, 'eta', 'eta')
63 config.addOutputVar(self.containerName, 'phi', 'phi')
64 config.addOutputVar(self.containerName, 'm', 'm')
65 config.addOutputVar(self.containerName, alg.rcJetEnergy, 'e')
66 config.addOutputVar(self.containerName, alg.smallRjetIndices, 'small_r_jet_indices')