ATLAS Offline Software
Loading...
Searching...
No Matches
TauTruthCommonConfig.py
Go to the documentation of this file.
1# Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
2
3#********************************************************************
4# TauTruthCommonConfig.py
5# Schedules all tools needed for tau truth object selection and writes
6# results into SG. These may then be accessed along the train.
7#********************************************************************
8
9from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
10from AthenaConfiguration.ComponentFactory import CompFactory
11
12
13def DFCommonTauTruthMatchingToolCfg(flags, name = "DFCommonTauTruthMatchingTool", **kwargs):
14 kwargs.setdefault("TruthJetContainerName", "AntiKt4TruthDressedWZJets")
15 from TauAnalysisTools.TauAnalysisToolsConfig import TauTruthMatchingToolCfg
16 return TauTruthMatchingToolCfg(flags, name, **kwargs)
17
18
19def TauTruthMatchingWrapperCfg(flags, cont, **kwargs):
20 """Configure the tau truth matching wrapper"""
21 acc = ComponentAccumulator()
22 name = "DFCommon"+cont+"TruthMatchingWrapper"
23 DFCommonTauTruthMatchingTool = acc.addPublicTool(acc.popToolsAndMerge(
24 DFCommonTauTruthMatchingToolCfg(flags)))
25 kwargs.setdefault("TauTruthMatchingTool", DFCommonTauTruthMatchingTool)
26 kwargs.setdefault("TauContainerName", cont)
27 acc.setPrivateTools(
28 CompFactory.DerivationFramework.TauTruthMatchingWrapper(name = name, **kwargs))
29 return acc
30
31
32def TauTruthToolsCfg(flags):
33 """Configure tau truth making and matching"""
34
35 acc = ComponentAccumulator()
36
37 # Ensure that we are running on MC
38 if not flags.Input.isMC and not flags.Overlay.DataOverlay:
39 # FIXME If this happens it indicates an issue with the configuration in the caller, so better to throw an exception?!
40 return acc
41
42 # truth tau building
43 from TauAnalysisTools.TauAnalysisToolsConfig import BuildTruthTausAlgCfg
44 acc.merge(BuildTruthTausAlgCfg(flags))
45
46 # tau truth matching, if reconstructed taus are present in the input
47 # this should be dropped from derivations and deferred to analysis level (the only use case in derivations is PHYSLITE)
48 TauTruthAugmentationTools2 = []
49 for cont in ["TauJets","TauJets_EleRM"]:
50 if "xAOD::TauJetContainer#"+cont in flags.Input.TypedCollections:
51 TauTruthAugmentationTools2.append(
52 acc.addPublicTool(acc.popToolsAndMerge(TauTruthMatchingWrapperCfg(flags, cont))))
53
54 CommonAugmentation = CompFactory.DerivationFramework.CommonAugmentation
55 acc.addEventAlgo(CommonAugmentation( "TauTruthCommonKernel2",
56 AugmentationTools = TauTruthAugmentationTools2,
57 ExtraInputs = {( 'xAOD::TruthParticleContainer' , 'StoreGateSvc+TruthTaus' )} ))
58
59 return acc
TauTruthMatchingWrapperCfg(flags, cont, **kwargs)
DFCommonTauTruthMatchingToolCfg(flags, name="DFCommonTauTruthMatchingTool", **kwargs)