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 acc.flagPerfmonDomain('Truth')
23 name = "DFCommon"+cont+"TruthMatchingWrapper"
24 DFCommonTauTruthMatchingTool = acc.addPublicTool(acc.popToolsAndMerge(
25 DFCommonTauTruthMatchingToolCfg(flags)))
26 kwargs.setdefault("TauTruthMatchingTool", DFCommonTauTruthMatchingTool)
27 kwargs.setdefault("TauContainerName", cont)
28 acc.setPrivateTools(
29 CompFactory.DerivationFramework.TauTruthMatchingWrapper(name = name, **kwargs))
30 return acc
31
32
33def TauTruthToolsCfg(flags):
34 """Configure tau truth making and matching"""
35
36 acc = ComponentAccumulator()
37 acc.flagPerfmonDomain('Truth')
38 # Ensure that we are running on MC
39 if not flags.Input.isMC and not flags.Overlay.DataOverlay:
40 # FIXME If this happens it indicates an issue with the configuration in the caller, so better to throw an exception?!
41 return acc
42
43 # truth tau building
44 from TauAnalysisTools.TauAnalysisToolsConfig import BuildTruthTausAlgCfg
45 acc.merge(BuildTruthTausAlgCfg(flags))
46
47 # tau truth matching, if reconstructed taus are present in the input
48 # this should be dropped from derivations and deferred to analysis level (the only use case in derivations is PHYSLITE)
49 TauTruthAugmentationTools2 = []
50 for cont in ["TauJets","TauJets_EleRM"]:
51 if "xAOD::TauJetContainer#"+cont in flags.Input.TypedCollections:
52 TauTruthAugmentationTools2.append(
53 acc.addPublicTool(acc.popToolsAndMerge(TauTruthMatchingWrapperCfg(flags, cont))))
54
55 CommonAugmentation = CompFactory.DerivationFramework.CommonAugmentation
56 acc.addEventAlgo(CommonAugmentation( "TauTruthCommonKernel2",
57 AugmentationTools = TauTruthAugmentationTools2,
58 ExtraInputs = {( 'xAOD::TruthParticleContainer' , 'StoreGateSvc+TruthTaus' )} ))
59
60 return acc
TauTruthMatchingWrapperCfg(flags, cont, **kwargs)
DFCommonTauTruthMatchingToolCfg(flags, name="DFCommonTauTruthMatchingTool", **kwargs)