ATLAS Offline Software
Loading...
Searching...
No Matches
BTaggingConfigFlags Namespace Reference

Functions

 getGrades (flags)
 getTaggerList (flags)
 minimumJetPtForTrackAssociation (flags)
 calibrationTag (flags)
 saveSv1 (prevFlags)
 runOldSecVrtSecIncl (prevFlags)
 isRun3Derivation (flags)
 runFlipTag (flags)
 _copiedVariables (flags, tagger, probs, track_vars, uints=())
 getCalibratedCopies (flags)
 getNNs (flags)
 createBTaggingConfigFlags ()

Variables

list Run1Grades = [ "Good", "BlaShared", "PixShared", "SctShared", "0HitBLayer" ]
list Run2Grades
list Run4Grades
list calibrationChannelAliases
dict _frozen_t0_calibration
list _fold_hashes = ['jetFoldHash', 'jetFoldHash_noHits', 'jetFoldRankHash']

Function Documentation

◆ _copiedVariables()

_copiedVariables ( flags,
tagger,
probs,
track_vars,
uints = () )
protected

Definition at line 92 of file BTaggingConfigFlags.py.

92def _copiedVariables(flags, tagger, probs, track_vars, uints=()):
93 suffixes = [''] + (['SimpleFlip'] if flags.BTagging.RunFlipTaggers else [])
94
95 def names(parts):
96 return [f'{tagger}{s}_{p}' for s in suffixes for p in parts]
97
98 return {
99 'floats': names(probs),
100 'uints': list(uints),
101 'charVectors': names(track_vars),
102 'trackLinks': names(['TrackLinks']),
103 }
104
105

◆ calibrationTag()

calibrationTag ( flags)

Definition at line 55 of file BTaggingConfigFlags.py.

55def calibrationTag(flags):
56 if flags.GeoModel.Run >= LHCPeriod.Run4:
57 return "BTagCalibITk-23-00-03-v1"
58 return ""
59
60

◆ createBTaggingConfigFlags()

createBTaggingConfigFlags ( )

Definition at line 229 of file BTaggingConfigFlags.py.

229def createBTaggingConfigFlags():
230 btagcf = AthConfigFlags()
231
232 btagcf.addFlag("BTagging.taggerList", getTaggerList)
233 btagcf.addFlag("BTagging.databaseScheme", '')
234 btagcf.addFlag("BTagging.calibrationChannelAliases",
235 calibrationChannelAliases)
236 btagcf.addFlag("BTagging.forcedCalibrationChannel", '')
237 btagcf.addFlag("BTagging.calibrationTag",
238 calibrationTag)
239
240 # the track association minimum is set to 4 GeV because of track
241 # jets in offline reconstruction.
242 btagcf.addFlag("BTagging.minimumJetPtForTrackAssociation",
243 minimumJetPtForTrackAssociation)
244
245 # these are only used for IPxD and SV1 likelihoods
246 btagcf.addFlag("BTagging.RunModus", "analysis") # reference mode used in FlavourTagPerformanceFramework (RetagFragment.py)
247 btagcf.addFlag("BTagging.ReferenceType", "ALL") # reference type for IP and SV taggers (B, UDSG, ALL)
248 btagcf.addFlag("BTagging.JetPtMinRef", 15e3) # in MeV for uncalibrated pt
249 btagcf.addFlag("BTagging.Grades", getGrades)
250
251
252 # Taggers for validation
253 btagcf.addFlag("BTagging.SaveSV1Probabilities", saveSv1)
254 # Run the flip taggers
255 btagcf.addFlag("BTagging.RunFlipTaggers", runFlipTag)
256
257 # Trackless approach
258 btagcf.addFlag("BTagging.Trackless", False)
259 btagcf.addFlag("BTagging.Trackless_JetCollection", "AntiKt4EMPFlowJets")
260 btagcf.addFlag("BTagging.Trackless_JetPtMin", 250*Units.GeV)
261 btagcf.addFlag("BTagging.Trackless_dR", 0.4)
262
263 # more aggressive trackless approach
264 btagcf.addFlag("BTagging.savePixelHits", False)
265 btagcf.addFlag("BTagging.saveSCTHits", False)
266
267 # experimental flags
268 btagcf.addFlag("BTagging.Pseudotrack", False)
269
270 #NewVrtSecInclusiveAlg
271 btagcf.addFlag("BTagging.RunNewVrtSecInclusive", runOldSecVrtSecIncl)
272
273 # track classification tool flags
274 btagcf.addFlag("BTagging.TrkClassFiveBinMode",False)
275
276 # a flag to add V0finder
277 btagcf.addFlag("BTagging.AddV0Finder", False)
278
279 # GNN vertex fitter
280 btagcf.addFlag("BTagging.GNNVertexFitter", False)
281
282 # (multifold) NN trainings, each jet collection maps to a list of
283 # dicts. The dict has several keys:
284 # - folds: list of NNs to run
285 # - remapping (optional): any variable remapping
286 # - ip_prefix (optional): for taggers trained on the poor man's
287 # impact parameters, the decoration prefix they should be read
288 # from. Schedules PoorMansIpAugmenterAlg with this prefix. See
289 # _ip_definitions in FlavorTaggingConfig.py for the allowed
290 # prefixes and the definition each one selects.
291 # - <group>_ip_prefix (optional): same, for one constituent group
292 # ('tracks', 'electrons', 'muons'). A group with no entry follows
293 # ip_prefix, which is itself the tracks prefix.
294 btagcf.addFlag("BTagging.NNs", getNNs)
295 # taggers running on a frozen-calibration shallow copy of their jet
296 # collection (see FlavorTaggingConfig.FlavorTaggingCfg)
297 btagcf.addFlag("BTagging.CalibratedCopies", getCalibratedCopies)
298 btagcf.addFlag("BTagging.AK4TaggerName", lambda pcf: (
299 "GN2HLv01" if pcf.GeoModel.Run>=LHCPeriod.Run4 else "GN2v01"))
300
301 # master switch for using Triton for NN inference.
302 # see athena/PhysicsAnalysis/JetTagging/FlavorTagInference/python/FlavorTagNNConfig.py
303 btagcf.addFlag("BTagging.UseTriton", False)
304
305 return btagcf

◆ getCalibratedCopies()

getCalibratedCopies ( flags)
Taggers to run on a frozen-calibration shallow copy of their jet
collection, as {collection: {tagger: {calibration, copied_variables}}}
(aft/open-tasks#105). The copied variables are an explicit opt-in list
of the outputs that flow back to the original jets; unlisted taggers
run directly on the original collection. Empty outside derivations.

Definition at line 106 of file BTaggingConfigFlags.py.

106def getCalibratedCopies(flags):
107 '''
108 Taggers to run on a frozen-calibration shallow copy of their jet
109 collection, as {collection: {tagger: {calibration, copied_variables}}}
110 (aft/open-tasks#105). The copied variables are an explicit opt-in list
111 of the outputs that flow back to the original jets; unlisted taggers
112 run directly on the original collection. Empty outside derivations.
113 '''
114 if not isRun3Derivation(flags):
115 return {}
116 gn3_base = ['pb', 'pc', 'ps', 'pu', 'pud', 'pg', 'ptau',
117 'ptFromTruthDressedWZJet']
118 gn3_probs = gn3_base + ['pquark']
119 gn3_epcl_probs = gn3_base + ['pbquark', 'pantibquark', 'pcquark',
120 'panticquark', 'pother']
121 gn2_tracks = ['TrackOrigin', 'VertexIndex']
122 gn3_tracks = ['TrackOrigin', 'TrackType', 'VertexIndex']
123 taggers = {
124 'GN2v01': (['pb', 'pc', 'pu', 'ptau'], gn2_tracks, _fold_hashes),
125 'GN3V00': (gn3_probs, gn3_tracks, ()),
126 'GN3PflowMuonsV00': (gn3_probs, gn3_tracks, ()),
127 'GN3EPCLV01': (gn3_epcl_probs, gn3_tracks, ()),
128 }
129 return {
130 'AntiKt4EMPFlowJets': {
131 tagger: {
132 'calibration': _frozen_t0_calibration,
133 'copied_variables': _copiedVariables(
134 flags, tagger, probs, tracks, uints),
135 }
136 for tagger, (probs, tracks, uints) in taggers.items()
137 },
138 }
139

◆ getGrades()

getGrades ( flags)

Definition at line 28 of file BTaggingConfigFlags.py.

28def getGrades(flags):
29 if flags.GeoModel.Run is LHCPeriod.Run1:
30 return Run1Grades
31 elif flags.GeoModel.Run in [LHCPeriod.Run2, LHCPeriod.Run3]:
32 return Run2Grades
33 else:
34 return Run4Grades
35
36

◆ getNNs()

getNNs ( flags)
Gets the paths of models to run via MultiFoldTagger.

Definition at line 140 of file BTaggingConfigFlags.py.

140def getNNs(flags):
141 '''
142 Gets the paths of models to run via MultiFoldTagger.
143 '''
144
145 # dummy for now
146 ak4_nns = []
147 if flags.GeoModel.Run >= LHCPeriod.Run4:
148 ak4_nns = ["BTagging/20260308/GN2HL/antikt4emtopo/network.onnx"]
149 else:
150 caldir = 'BTagging/20231205/GN2v01/antikt4empflow'
151 ak4_nns = [f'{caldir}/network_fold{n}.onnx' for n in range(4)]
152
153 # We can save our results to the jet container, rather than the b-tagging container
154 # but this functionality is not yet setup for non multi-fold taggers. The easiest (/hackiest)
155 # solution is to pass all the GN3 paths below as seperate single-fold-multi-fold-taggers
156 # But this *should* be cleaned up at some point
157 # Note also, reco tests failing due to leptonID missing, so for now don't run taggers unless derivation
158 # https://gitlab.cern.ch/atlas/athena/-/merge_requests/77764#note_9063625
159 gn3v00_paths = [
160 "BTagging/20250213/GN3V00/antikt4empflow/network.onnx", # Only tracks
161 "BTagging/20250213/GN3PflowMuonsV00/antikt4empflow/network.onnx", # Tracks+Muons+PFlow
162 ] if isRun3Derivation(flags) else []
163 gn3v01_paths = [
164 "BTagging/20260805/GN3EPCLV01/antikt4empflow/network.onnx", # Electrons+Pflow+Charge+Muons
165 ] if isRun3Derivation(flags) else []
166 # Combine the paths for GN3v00 and GN3v01 models
167 gn3_paths = gn3v00_paths + gn3v01_paths
168
169 bjr4_paths = [
170 "JetCalibTools/CalibArea-00-04-83/CalibrationFactors/bJES_calibFactors_R22_MC20MC23_AntiKt4EMPflow_bJR4v01_20260319.onnx" # bJR4v01
171 ] if isRun3Derivation(flags) else []
172
173 lrj_paths = [
174 "BTagging/20230705/gn2xv01/antikt10ufo/network.onnx",
175 "BTagging/20240925/GN2Xv02/antikt10ufo/network.onnx",
176 "BTagging/20250310/GN2XTauV00/antikt10ufo/network.onnx",
177 "BTagging/20250912/GN3XPV01/antikt10ufo/network.onnx",
178 "BTagging/20260803/tautauJRv00/antikt10ufo/network.onnx",
179 "JetCalibTools/CalibArea-00-04-83/CalibrationFactors/bbJESJMS_calibFactors_R22_MC20_CSSKUFO_bJR10v00Ext_20260513.onnx", # bJR10v00Ext
180 "JetCalibTools/CalibArea-00-04-83/CalibrationFactors/bbJESJMS_calibFactors_R22_MC20MC23_CSSKUFO_bJR10v01_20260513.onnx" # bJR10v01
181 ]
182 # we can't flip large-R taggers
183 noflip = dict(flip=False)
184
185 return {
186 'AntiKt4EMPFlowJets': [
187 {
188 'folds': ak4_nns,
189 'hash': 'jetFoldHash',
190 'cone_association': True,
191 },
192 *[{'folds' : [nn_path]} for nn_path in gn3_paths+bjr4_paths]
193 ],
194 'AntiKt4EMTopoJets': [
195 {
196 'folds': ak4_nns,
197 'hash': 'jetFoldHash',
198 'cone_association': True,
199 },
200 ],
201 'AntiKt4EMPFlowCustomVtxJets': [
202 {
203 'folds': ak4_nns,
204 'hash': 'jetFoldHash',
205 'cone_association': True
206 },
207 *[{'folds' : [nn_path]} for nn_path in gn3_paths+bjr4_paths]
208 ],
209 'AntiKt4EMPFlowByVertexJets': [
210 {
211 'folds': ak4_nns,
212 'hash': 'jetFoldHash',
213 'cone_association': True
214 }
215 ],
216 'AntiKt10UFOCSSKSoftDropBeta100Zcut10Jets': [
217 {'folds' : [nn_path], **noflip} for nn_path in lrj_paths
218 ],
219 'DFAntiKt4HIJets': [
220 {
221 'folds': ak4_nns,
222 'hash': 'jetFoldHash',
223 'cone_association': True
224 }
225 ]
226 }
227
228

◆ getTaggerList()

getTaggerList ( flags)

Definition at line 37 of file BTaggingConfigFlags.py.

37def getTaggerList(flags):
38 base = ['IP2D','IP3D','SV1','JetFitterNN']
39 if flags.Trigger.doHLT:
40 base = []
41 elif flags.GeoModel.Run >= LHCPeriod.Run4:
42 base += ['MV2c10']
43 flip = ['IP2DNeg', 'IP3DNeg','IP2DFlip', 'IP3DFlip','SV1Flip']
44 if flags.BTagging.RunFlipTaggers:
45 return base + flip
46 return base
47
48

◆ isRun3Derivation()

isRun3Derivation ( flags)

Definition at line 69 of file BTaggingConfigFlags.py.

69def isRun3Derivation(flags):
70 derivation = flags.Common.ProductionStep is ProductionStep.Derivation
71 before_the_future = flags.GeoModel.Run < LHCPeriod.Run4
72 return derivation and before_the_future
73
74

◆ minimumJetPtForTrackAssociation()

minimumJetPtForTrackAssociation ( flags)

Definition at line 49 of file BTaggingConfigFlags.py.

49def minimumJetPtForTrackAssociation(flags):
50 if flags.Trigger.doHLT:
51 return 5e3
52 return 4e3
53
54

◆ runFlipTag()

runFlipTag ( flags)

Definition at line 75 of file BTaggingConfigFlags.py.

75def runFlipTag(flags):
76 return isRun3Derivation(flags)
77
78
79# Frozen calibration applied to the tagged shallow copy, decoupling the
80# listed taggers from changes to the reco-level t0 calibration
81# (aft/open-tasks#105). Deliberately hard-coded: must NOT follow
82# JetCalibToolsConfig updates.

◆ runOldSecVrtSecIncl()

runOldSecVrtSecIncl ( prevFlags)

Definition at line 65 of file BTaggingConfigFlags.py.

65def runOldSecVrtSecIncl(prevFlags):
66 return prevFlags.Common.ProductionStep is ProductionStep.Derivation
67
68

◆ saveSv1()

saveSv1 ( prevFlags)

Definition at line 61 of file BTaggingConfigFlags.py.

61def saveSv1(prevFlags):
62 return prevFlags.GeoModel.Run >= LHCPeriod.Run4
63
64

Variable Documentation

◆ _fold_hashes

list BTaggingConfigFlags._fold_hashes = ['jetFoldHash', 'jetFoldHash_noHits', 'jetFoldRankHash']
protected

Definition at line 89 of file BTaggingConfigFlags.py.

◆ _frozen_t0_calibration

dict BTaggingConfigFlags._frozen_t0_calibration
protected
Initial value:
= {
'configFile': 'JES_MC15cRecommendation_PFlow_Aug2016_rel21.config',
'calibArea': '00-04-77',
'calibSequence': 'JetArea_Residual_EtaJES',
}

Definition at line 83 of file BTaggingConfigFlags.py.

◆ calibrationChannelAliases

list BTaggingConfigFlags.calibrationChannelAliases
Initial value:
= [
"AntiKt4EMTopo->AntiKt4EMTopo,AntiKt4EMPFlow",
"AntiKt4EMPFlow->AntiKt4EMPFlow,AntiKt4EMTopo",
"AntiKt4HI->AntiKt4HI,AntiKt4EMPFlow,AntiKt4EMTopo,AntiKt4LCTopo",
"AntiKtVR30Rmax4Rmin02PV0Track->AntiKtVR30Rmax4Rmin02PV0Track,AntiKt4EMPFlow,AntiKt4EMTopo",
"AntiKt4PFlowCustomVtx->AntiKt4EMPFlow,AntiKt4EMTopo",
"AntiKtVR30Rmax4Rmin02Track->AntiKtVR30Rmax4Rmin02PV0Track,AntiKt4EMPFlow,AntiKt4EMTopo",
]

Definition at line 18 of file BTaggingConfigFlags.py.

◆ Run1Grades

list BTaggingConfigFlags.Run1Grades = [ "Good", "BlaShared", "PixShared", "SctShared", "0HitBLayer" ]

Definition at line 8 of file BTaggingConfigFlags.py.

◆ Run2Grades

list BTaggingConfigFlags.Run2Grades
Initial value:
= [ "0HitIn0HitNInExp2","0HitIn0HitNInExpIn","0HitIn0HitNInExpNIn","0HitIn0HitNIn",
"0HitInExp", "0HitIn",
"0HitNInExp", "0HitNIn",
"InANDNInShared", "PixShared", "SctShared",
"InANDNInSplit", "PixSplit",
"Good" ]

Definition at line 9 of file BTaggingConfigFlags.py.

◆ Run4Grades

list BTaggingConfigFlags.Run4Grades
Initial value:
= [ "A01","A02","A03","A04","A05","A06","A07","A08","A14_1","A14_2","A14_3","A14_4",
"B01","B02","B03","B04","B05","B06","B07","B08","B14_1","B14_2","B14_3","B14_4",
"C01","C02030405","C06","C07","C08","C14_1","C14_2","C14_3","C14_4" ]

Definition at line 15 of file BTaggingConfigFlags.py.