3 from AthenaConfiguration.ComponentAccumulator
import ComponentAccumulator
4 from AthenaConfiguration.ComponentFactory
import CompFactory
6 from BTagging.BTagConfig
import BTagAlgsCfg, GetTaggerTrainingMap
7 from BTagging.BTagTrackAugmenterAlgConfig
import BTagTrackAugmenterAlgCfg
9 from JetTagCalibration.JetTagCalibConfig
import JetTagCalibCfg
10 from FlavorTagDiscriminants.FoldDecoratorConfig
import FoldDecoratorCfg
11 from ElectronPhotonSelectorTools.AsgElectronLikelihoodToolsConfig
import AsgElectronLikelihoodToolCfg
12 from ElectronPhotonSelectorTools.LikelihoodEnums
import LikeEnum
13 from MuonSelectorTools.MuonSelectorToolsConfig
import MuonSelectionToolCfg
15 PFLOW_JETS =
'AntiKt4EMPFlowJets'
18 trackAugmenterPrefix=None):
20 Run flavour tagging in derivations.
21 Configures several jet collections at once.
25 pv_cols = [
'PrimaryVertices'] * len(jet_cols)
26 if len(pv_cols) != len(jet_cols):
27 raise ValueError(
'PV collection length is not the same as Jets')
31 acc.merge(JetTagCalibCfg(cfgFlags))
33 if 'AntiKt4EMTopoJets' in jet_cols:
38 if PFLOW_JETS
in jet_cols
and cfgFlags.BTagging.Trackless:
48 largeRJetCollection =
'AntiKt10UFOCSSKSoftDropBeta100Zcut10Jets'
49 if largeRJetCollection
in jet_cols:
51 jet_cols.remove(largeRJetCollection)
54 for jet_col, pv_col
in zip(jet_cols, pv_cols):
57 if jet_col == PFLOW_JETS:
63 cfgFlags, jet_col, pv_col,
64 trackAugmenterPrefix=trackAugmenterPrefix
68 if cfgFlags.BTagging.GNNVertexFitter:
69 from GNNVertexFitter.GNNVertexFitterConfig
import GNNVertexFitterAlgCfg
76 from ParticleJetTools.ParticleJetToolsConfig
import getJetDeltaRFlavorLabelTool
80 jetDec = CompFactory.JetDecorationAlg(
81 name=
'hltJetLabelingAlg',
82 JetContainer=
'HLT_AntiKt4EMPFlowJets_subresjesgscIS_ftf',
85 acc.addEventAlgo(jetDec)
91 jet_col_name_without_Jets = jet_col.replace(
'Jets',
'')
95 trackContainer =
'GhostTrack'
96 primaryVertexContainer =
'PrimaryVertices'
97 variableRemapping = {
'BTagTrackToJetAssociator': trackContainer}
102 TrackCollection=
'InDetTrackParticles',
103 PrimaryVertexCollectionName=primaryVertexContainer,
106 for nnFile
in nnFiles:
108 tagger_name = nnFile.split(
'/')[-3]
111 CompFactory.FlavorTagDiscriminants.JetTagDecoratorAlg(
112 f
'{jet_col}{tagger_name}JetTagAlg',
114 constituentContainer=trackContainer,
115 decorator=CompFactory.FlavorTagDiscriminants.GNNTool(
118 variableRemapping=variableRemapping,
119 trackLinkType=
'IPARTICLE'
128 trackAugmenterPrefix=None):
130 Return a component accumulator which runs tagging on a single jet collection.
133 jet_col_name_without_Jets = jet_col.replace(
'Jets',
'')
135 input_muons =
'Muons'
136 if cfgFlags.BTagging.Pseudotrack:
142 TrackCollection=track_collection,
143 PrimaryVertexCollectionName=pv_col,
144 prefix=trackAugmenterPrefix
150 JetCollection=jet_col_name_without_Jets,
152 trackCollection=track_collection,
153 primaryVertices=pv_col,
155 renameTrackJets=
True,
156 AddedJetSuffix=
'Jets',
163 """Decorate tracks with information about reconstructed leptons"""
166 electronID_tool = acc.popToolsAndMerge(
169 muonID_tool = acc.popToolsAndMerge(
172 acc.addEventAlgo(CompFactory.FlavorTagDiscriminants.TrackLeptonDecoratorAlg(
173 'TrackLeptonDecoratorAlg',
175 electronSelectionTool=electronID_tool,
176 muonSelectionTool=muonID_tool,
183 """Decorate tracks with detailed truth information."""
185 if not cfgFlags.Input.isMC:
188 from InDetTrackSystematicsTools.InDetTrackSystematicsToolsConfig
import (
189 InDetTrackTruthOriginToolCfg,
192 acc.addEventAlgo(CompFactory.FlavorTagDiscriminants.TruthParticleDecoratorAlg(
193 'TruthParticleDecoratorAlg',
194 trackTruthOriginTool=trackTruthOriginTool
196 acc.addEventAlgo(CompFactory.FlavorTagDiscriminants.TrackTruthDecoratorAlg(
197 'TrackTruthDecoratorAlg',
199 trackTruthOriginTool=trackTruthOriginTool,
200 truthLeptonTool=CompFactory.TruthClassificationTool(
"TruthClassificationTool")
207 if cfgFlags.BTagging.Pseudotrack:
208 return 'InDetPseudoTrackParticles'
209 return 'InDetTrackParticles'
217 AddressRemappingSvc, ProxyProviderSvc=CompFactory.getComps(
"AddressRemappingSvc",
"ProxyProviderSvc",)
219 AddressRemappingSvc.TypeKeyRenameMaps += [
'xAOD::JetAuxContainer#AntiKt4EMTopoJets.BTagTrackToJetAssociator->AntiKt4EMTopoJets.BTagTrackToJetAssociator_' + suffix]
220 AddressRemappingSvc.TypeKeyRenameMaps += [
'xAOD::JetAuxContainer#AntiKt4EMTopoJets.JFVtx->AntiKt4EMTopoJets.JFVtx_' + suffix]
221 AddressRemappingSvc.TypeKeyRenameMaps += [
'xAOD::JetAuxContainer#AntiKt4EMTopoJets.SecVtx->AntiKt4EMTopoJets.SecVtx_' + suffix]
223 AddressRemappingSvc.TypeKeyRenameMaps += [
'xAOD::JetAuxContainer#AntiKt4EMTopoJets.btaggingLink->AntiKt4EMTopoJets.btaggingLink_' + suffix]
224 AddressRemappingSvc.TypeKeyRenameMaps += [
'xAOD::BTaggingContainer#BTagging_AntiKt4EMTopo->BTagging_AntiKt4EMTopo_' + suffix]
225 AddressRemappingSvc.TypeKeyRenameMaps += [
'xAOD::BTaggingAuxContainer#BTagging_AntiKt4EMTopoAux.->BTagging_AntiKt4EMTopo_' + suffix+
"Aux."]
226 AddressRemappingSvc.TypeKeyRenameMaps += [
'xAOD::VertexContainer#BTagging_AntiKt4EMTopoSecVtx->BTagging_AntiKt4EMTopoSecVtx_' + suffix]
227 AddressRemappingSvc.TypeKeyRenameMaps += [
'xAOD::VertexAuxContainer#BTagging_AntiKt4EMTopoSecVtxAux.->BTagging_AntiKt4EMTopoSecVtx_' + suffix+
"Aux."]
228 AddressRemappingSvc.TypeKeyRenameMaps += [
'xAOD::BTagVertexContainer#BTagging_AntiKt4EMTopoJFVtx->BTagging_AntiKt4EMTopoJFVtx_' + suffix]
229 AddressRemappingSvc.TypeKeyRenameMaps += [
'xAOD::BTagVertexAuxContainer#BTagging_AntiKt4EMTopoJFVtxAux.->BTagging_AntiKt4EMTopoJFVtx_' + suffix+
"Aux."]
230 acc.addService(AddressRemappingSvc)
238 AddressRemappingSvc, ProxyProviderSvc=CompFactory.getComps(
"AddressRemappingSvc",
"ProxyProviderSvc",)
240 AddressRemappingSvc.TypeKeyRenameMaps += [
'xAOD::JetAuxContainer#AntiKt4EMPFlowJets.BTagTrackToJetAssociator->AntiKt4EMPFlowJets.BTagTrackToJetAssociator_' + suffix]
241 AddressRemappingSvc.TypeKeyRenameMaps += [
'xAOD::JetAuxContainer#AntiKt4EMPFlowJets.JFVtx->AntiKt4EMPFlowJets.JFVtx_' + suffix]
242 AddressRemappingSvc.TypeKeyRenameMaps += [
'xAOD::JetAuxContainer#AntiKt4EMPFlowJets.SecVtx->AntiKt4EMPFlowJets.SecVtx_' + suffix]
244 AddressRemappingSvc.TypeKeyRenameMaps += [
'xAOD::JetAuxContainer#AntiKt4EMPFlowJets.btaggingLink->AntiKt4EMPFlowJets.btaggingLink_' + suffix]
245 AddressRemappingSvc.TypeKeyRenameMaps += [
'xAOD::BTaggingContainer#BTagging_AntiKt4EMPFlow->BTagging_AntiKt4EMPFlow_' + suffix]
246 AddressRemappingSvc.TypeKeyRenameMaps += [
'xAOD::BTaggingAuxContainer#BTagging_AntiKt4EMPFlowAux.->BTagging_AntiKt4EMPFlow_' + suffix+
"Aux."]
247 AddressRemappingSvc.TypeKeyRenameMaps += [
'xAOD::VertexContainer#BTagging_AntiKt4EMPFlowSecVtx->BTagging_AntiKt4EMPFlowSecVtx_' + suffix]
248 AddressRemappingSvc.TypeKeyRenameMaps += [
'xAOD::VertexAuxContainer#BTagging_AntiKt4EMPFlowSecVtxAux.->BTagging_AntiKt4EMPFlowSecVtx_' + suffix+
"Aux."]
249 AddressRemappingSvc.TypeKeyRenameMaps += [
'xAOD::BTagVertexContainer#BTagging_AntiKt4EMPFlowJFVtx->BTagging_AntiKt4EMPFlowJFVtx_' + suffix]
250 AddressRemappingSvc.TypeKeyRenameMaps += [
'xAOD::BTagVertexAuxContainer#BTagging_AntiKt4EMPFlowJFVtxAux.->BTagging_AntiKt4EMPFlowJFVtx_' + suffix+
"Aux."]
251 acc.addService(AddressRemappingSvc)