Skip to content
Snippets Groups Projects
Commit db1a4456 authored by John Chapman's avatar John Chapman
Browse files

DerivationFrameworkMCTruth: Use MCTruthClassifer configuration from MCTruthClassifierConfig

parent c74a4c0e
No related branches found
No related tags found
No related merge requests found
Pipeline #11696070 passed
# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
# Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
# Common code for setting up the gen filter tools
......@@ -10,7 +10,7 @@ def GenFilterToolCfg(flags):
acc = ComponentAccumulator()
# Set up the MCTruthClassifier
from DerivationFrameworkMCTruth.TruthDerivationToolsConfig import DFCommonMCTruthClassifierCfg
from MCTruthClassifier.MCTruthClassifierConfig import DFCommonMCTruthClassifierCfg
acc.merge(DFCommonMCTruthClassifierCfg(flags))
#Save the post-shower HT and MET filter values that will make combining filtered samples easier (adds to the EventInfo)
......
......@@ -124,14 +124,6 @@ def TruthD2DecoratorCfg(flags, name, **kwargs):
acc.addPublicTool(TruthD2Decorator(name, **kwargs), primary = True)
return acc
def DFCommonMCTruthClassifierCfg(flags):
"""Configure the MCTruthClassifier tool"""
acc = ComponentAccumulator()
MCTruthClassifier = CompFactory.MCTruthClassifier
acc.addPublicTool(MCTruthClassifier(name = "DFCommonTruthClassifier", ParticleCaloExtensionTool = ""),
primary = True)
return acc
def TruthClassificationDecoratorCfg(flags, name, **kwargs):
"""Configure the TruthClassificationDecorator tool"""
acc = ComponentAccumulator()
......@@ -218,6 +210,7 @@ def HardScatterCollectionMakerCfg(flags, name, **kwargs):
#add the 'decoration' tool to dress the main truth collection with the classification
def DFCommonTruthClassificationToolCfg(flags):
"""dress the main truth collection with the classification"""
from MCTruthClassifier.MCTruthClassifierConfig import DFCommonMCTruthClassifierCfg
accMCTC = DFCommonMCTruthClassifierCfg(flags)
DFCommonTruthClassifier = accMCTC.getPrimary()
acc = TruthClassificationDecoratorCfg(flags,
......
......@@ -4,26 +4,27 @@ __doc__ = """
Tool configuration to instantiate MCTruthClassifier
with default configurations."""
from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
from AthenaConfiguration.ComponentFactory import CompFactory
from AthenaConfiguration.Enums import LHCPeriod
def MCTruthClassifierCfg(flags, **kwargs):
def MCTruthClassifierCfg(flags, name="MCTruthClassifier", **kwargs):
"""
This is the default configuration allowing all options.
By default, it does not do calo truth matching.
"""
kwargs.setdefault("ParticleCaloExtensionTool", "")
kwargs.setdefault("CaloDetDescrManager", "")
return MCTruthClassifierCaloTruthMatchCfg(flags, **kwargs)
return MCTruthClassifierCaloTruthMatchCfg(flags, name, **kwargs)
def MCTruthClassifierCaloTruthMatchCfg(flags, **kwargs):
def MCTruthClassifierCaloTruthMatchCfg(flags, name="MCTruthClassifier", **kwargs):
"""
This is the default configuration allowing all options.
By default, it does calo truth matching using a
dedicated instance of the ParticleCaloExtensionTool
"""
from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
from AthenaConfiguration.Enums import LHCPeriod
acc = ComponentAccumulator()
if "ParticleCaloExtensionTool" not in kwargs:
......@@ -44,19 +45,25 @@ def MCTruthClassifierCaloTruthMatchCfg(flags, **kwargs):
if flags.GeoModel.Run >= LHCPeriod.Run4:
kwargs.setdefault("FwdElectronUseG4Sel", False)
from AthenaConfiguration.ComponentFactory import CompFactory
acc.setPrivateTools(CompFactory.MCTruthClassifier(**kwargs))
return acc
def DFCommonMCTruthClassifierCfg(flags):
"""Configure the MCTruthClassifier tool"""
acc = ComponentAccumulator()
acc.addPublicTool(acc.popToolsAndMerge(MCTruthClassifierCfg(flags, name = "DFCommonTruthClassifier")),
primary = True)
return acc
if __name__ == "__main__":
from AthenaConfiguration.AllConfigFlags import initConfigFlags
from AthenaConfiguration.TestDefaults import defaultTestFiles
from AthenaCommon.Logging import logging
from AthenaConfiguration.ComponentAccumulator import (
ComponentAccumulator, printProperties)
from AthenaConfiguration.ComponentAccumulator import printProperties
flags = initConfigFlags()
flags.Input.isMC = True
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment