ATLAS Offline Software
Loading...
Searching...
No Matches
GepJetAlgConfig.py
Go to the documentation of this file.
1# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
2
3from enum import Enum
4
5from AthenaConfiguration.ComponentFactory import CompFactory
6from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
7
9 flags,
10 name,
11 jetAlgName,
12 caloClustersKey,
13 outputJetsKey,
14 wta_seed_cleaning_name='TwoPass',
15 wta_min_cluster_et=2.0, # In GeV
16 wta_min_seed_et=5.0,
17 wta_inf_buffer=False,
18 wta_max_const_n=205,
19 wta_max_seed_sorting_n=50,
20 wta_jet_dR=0.4,
21 wta_block_n=4,
22 OutputLevel=None):
23
24 cfg = ComponentAccumulator()
25
26
27 if jetAlgName not in ('ModAntikT', 'Cone', 'WTACone'):
28 raise ValueError("jetAlgName must be one of ModAntikT, Cone, WTACone")
29 if jetAlgName == 'WTACone':
30 if wta_seed_cleaning_name not in ('Baseline', 'TwoPass'):
31 raise ValueError("wta_seed_cleaning_name must be Baseline or TwoPass")
32 if wta_block_n not in (1, 4):
33 raise ValueError("wta_block_n must be 1 or 4")
34 if wta_inf_buffer:
35 wta_max_const_n = 9999
36 wta_max_seed_sorting_n = 9999
37
38 alg = CompFactory.GepJetAlg(name,
39 jetAlgName=jetAlgName,
40 caloClustersKey=caloClustersKey,
41 outputJetsKey=outputJetsKey,
42 WTAConstEtCut=wta_min_cluster_et,
43 WTASeedEtCut=wta_min_seed_et,
44 WTAMaxConstN=wta_max_const_n,
45 WTAMaxSeedSortingN=wta_max_seed_sorting_n,
46 WTAJet_dR=wta_jet_dR,
47 WTASeedCleaningName=wta_seed_cleaning_name,
48 WTABlockN=wta_block_n)
49
50 if OutputLevel is not None:
51 alg.OutputLevel = OutputLevel
52
53 cfg.addEventAlgo(alg)
54
55 return cfg
56
57
58# JetTaggerLRJ seed / constituent source options. These mirror the C++ enums
59# Gep::JetTaggerSeedSource and Gep::JetTaggerConstSource (JetTaggerLRJMaker.h);
60# keep the string values in sync with them.
61class _StrEnum(Enum):
62 @classmethod
63 def to_list(cls):
64 return [member.value for member in cls]
65
66
68 WTACone = "WTACone"
69 jFexSRJ = "jFexSRJ"
70 gFexSRJ = "gFexSRJ"
71
72
74 Towers = "Towers"
75 WTACone = "WTACone"
76
77
78# ---------------------------------------------------------------------------
79# JetTaggerLRJ presets, with version-dependent settings.
80# GepJetTaggerLRJAlgCfg. Keyed by GepJetAlg property name.
81# 2 = BasicV2 (reclusters jets, no substructure, seed-opt disabled)
82# 3 = AdvancedV3 (tower-level granularity, full substructure)
83# ---------------------------------------------------------------------------
84_LRJ_PRESETS = {
85 2: {
86 'LRJDSearch': 0.001, # rMergeCut (seed-pos-opt effectively disabled)
87 'LRJMaxObjectsConsidered': 8,
88 'LRJEtaBitLength': 10,
89 'LRJPhiBitLength': 9,
90 'LRJNumSubjetsLength': 0, # no substructure variables computed
91 'LRJNSubjetinessBitLength': 0,
92 'LRJMassApproxBitLength': 0,
93 'LRJPsiRBitLength': 0,
94 'LRJEnableOverlapRemoval': False,
95 'LRJMinEtSeedPosOptimization': False,
96 },
97 3: {
98 'LRJDSearch': 2.0,
99 'LRJMaxObjectsConsidered': 512, # raised 128->512 so the E_T>2 GeV tower cut (not this cap) bounds the input; 128 kept elsewhere for latency estimation
100 'LRJEtaBitLength': 7,
101 'LRJPhiBitLength': 6,
102 'LRJNumSubjetsLength': 2,
103 'LRJNSubjetinessBitLength': 8,
104 'LRJMassApproxBitLength': 8,
105 'LRJPsiRBitLength': 8,
106 'LRJEnableOverlapRemoval': True,
107 'LRJMinEtSeedPosOptimization': True,
108 },
109}
110
111
112def GepJetTaggerLRJAlgCfg(flags, name, **kwargs):
113
114 # ---- Configure GepJetAlg in JetTaggerLRJ mode ----
115
116 cfg = ComponentAccumulator()
117
118 # This wrapper always drives GepJetAlg in JetTaggerLRJ mode.
119 kwargs['jetAlgName'] = 'JetTaggerLRJ'
120 kwargs['EnableLRJMaker'] = True
121
122 # ---- preset selector: 2 = BasicV2, 3 = AdvancedV3 ----
123 algo_version = kwargs.setdefault('LRJAlgoVersion', 3)
124 if algo_version not in (2, 3):
125 raise ValueError("LRJAlgoVersion must be 2 (BasicV2) or 3 (AdvancedV3)")
126 for prop, value in _LRJ_PRESETS[algo_version].items():
127 kwargs.setdefault(prop, value)
128
129 # ---- seed / constituent sources ----
130 kwargs.setdefault('LRJSeedSource', LRJSeedSourceType.WTACone.value) # WTACone | jFexSRJ | gFexSRJ
131 kwargs.setdefault('LRJConstSource', LRJConstSourceType.Towers.value) # Towers | WTACone
132 kwargs.setdefault('LRJWTAConeSeedsKey', '') # Required if LRJSeedSource == 'WTACone'
133 kwargs.setdefault('jFexSRJetRoIs', 'L1_jFexSRJetRoISim')
134 kwargs.setdefault('LRJgFexSRJetRoIs', 'L1_gFexSRJetRoISim')
135
136 # ---- version-independent settings (identical across presets) ----
137 kwargs.setdefault('LRJJetR', 1.1) # r2Cut = LRJJetR**2 = 1.21
138 kwargs.setdefault('LRJNSeedsInput', 10)
139 kwargs.setdefault('LRJNProtoSeeds', 6)
140 kwargs.setdefault('LRJNSeedsOutput', 2)
141 kwargs.setdefault('LRJEtBitLength', 13)
142 kwargs.setdefault('LRJDeltaRLutLength', 8)
143 kwargs.setdefault('LRJEnableEtWeightedMidpoint', False) # geometric midpoint
144 kwargs.setdefault('LRJSubjetEtThresholdGeV', 25.0)
145 kwargs.setdefault('LRJMinEtSeedPosOptCutGeV', 25.0)
146 kwargs.setdefault('LRJSeedEtCutGeV', 5.0) # reserved; not yet applied
147 kwargs.setdefault('LRJConstEtCutGeV', 2.0) # reserved; not yet applied
148
149 # ---- digitization: physical ranges ----
150 kwargs.setdefault('LRJPhiMin', -3.2)
151 kwargs.setdefault('LRJPhiMax', 3.2)
152 kwargs.setdefault('LRJEtaMin', -4.85)
153 kwargs.setdefault('LRJEtaMax', 4.95)
154 kwargs.setdefault('LRJEtMin', 0.0)
155 kwargs.setdefault('LRJEtMax', 1024.0)
156 kwargs.setdefault('LRJMassApproxMax', 512.0)
157 kwargs.setdefault('LRJInputEtToGeV', 1.0e-3)
158
159 # ---- output toggles ----
160 kwargs.setdefault('LRJWriteSubstructure', True)
161 kwargs.setdefault('LRJWriteSubjetKinematics', True)
162 kwargs.setdefault('LRJWriteConstituentIndices', True)
163
164 # Ensure that configuration is within possible values for the algorithm
165 if kwargs['LRJSeedSource'] not in LRJSeedSourceType.to_list():
166 raise ValueError(f"LRJSeedSource must be one of {LRJSeedSourceType.to_list()}")
167 if kwargs['LRJConstSource'] not in LRJConstSourceType.to_list():
168 raise ValueError(f"LRJConstSource must be one of {LRJConstSourceType.to_list()}")
169 if kwargs['LRJSeedSource'] == LRJSeedSourceType.WTACone.value \
170 and not kwargs['LRJWTAConeSeedsKey']:
171 raise ValueError("LRJWTAConeSeedsKey must be set when LRJSeedSource == 'WTACone'")
172
173 alg = CompFactory.GepJetAlg(name, **kwargs)
174
175 cfg.addEventAlgo(alg)
176
177 return cfg
GepJetAlgCfg(flags, name, jetAlgName, caloClustersKey, outputJetsKey, wta_seed_cleaning_name='TwoPass', wta_min_cluster_et=2.0, wta_min_seed_et=5.0, wta_inf_buffer=False, wta_max_const_n=205, wta_max_seed_sorting_n=50, wta_jet_dR=0.4, wta_block_n=4, OutputLevel=None)
GepJetTaggerLRJAlgCfg(flags, name, **kwargs)