Skip to content
Snippets Groups Projects
Commit cb1c0e48 authored by Rupert Tombs's avatar Rupert Tombs
Browse files

Link new config for tools. Move particlebrokers out of core to avoid circular imports. Add flake8.

Avoid including excess GeoIDSvc instances with different names between AFII and otherwise. Thanks to JC
parent f575346f
Branches
No related tags found
No related merge requests found
...@@ -99,5 +99,5 @@ atlas_add_test( ISF_ServicesConfigNew_test ...@@ -99,5 +99,5 @@ atlas_add_test( ISF_ServicesConfigNew_test
set_target_properties( ISF_Services_TruthSvc_test PROPERTIES ENABLE_EXPORTS True ) set_target_properties( ISF_Services_TruthSvc_test PROPERTIES ENABLE_EXPORTS True )
# Install files from the package: # Install files from the package:
atlas_install_python_modules( python/*.py ) atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
...@@ -20,7 +20,10 @@ from ISF_HepMC_Tools.ISF_HepMC_ToolsConfigNew import ( ...@@ -20,7 +20,10 @@ from ISF_HepMC_Tools.ISF_HepMC_ToolsConfigNew import (
ParticleSimWhiteListCfg, ParticleSimWhiteListCfg,
) )
from BarcodeServices.BarcodeServicesConfigNew import BarcodeSvcCfg from BarcodeServices.BarcodeServicesConfigNew import BarcodeSvcCfg
from ISF_Geant4CommonTools.ISF_Geant4CommonToolsConfigNew import (
EntryLayerToolCfg, AFIIEntryLayerToolCfg
)
from ISF_Tools.ISF_ToolsConfigNew import ParticleOrderingToolCfg
def GenParticleFiltersToolCfg(ConfigFlags): def GenParticleFiltersToolCfg(ConfigFlags):
result = ComponentAccumulator() result = ComponentAccumulator()
...@@ -64,6 +67,39 @@ def LongLivedInputConverterCfg(ConfigFlags, name="ISF_LongLivedInputConverter", ...@@ -64,6 +67,39 @@ def LongLivedInputConverterCfg(ConfigFlags, name="ISF_LongLivedInputConverter",
return InputConverterCfg(name, **kwargs) return InputConverterCfg(name, **kwargs)
def ParticleBrokerSvcNoOrderingCfg(ConfigFlags, name="ISF_ParticleBrokerSvcNoOrdering", **kwargs):
result = EntryLayerToolCfg(ConfigFlags)
kwargs.setdefault("EntryLayerTool", result.popPrivateTools())
kwargs.setdefault("GeoIDSvc", result.getService("ISF_GeoIDSvc"))
kwargs.setdefault("AlwaysUseGeoIDSvc", False)
kwargs.setdefault("ValidateGeoIDs", ConfigFlags.ISF.ValidationMode)
kwargs.setdefault("ValidationOutput", ConfigFlags.ISF.ValidationMode)
kwargs.setdefault("ValidationStreamName", "ParticleBroker")
baracc = BarcodeSvcCfg(ConfigFlags)
kwargs.setdefault("BarcodeService", baracc.getPrimary())
result.merge(baracc)
result.addService(CompFactory.ISF.ParticleBrokerDynamicOnReadIn(name, **kwargs))
return result
def ParticleBrokerSvcCfg(ConfigFlags, name="ISF_ParticleBrokerSvc", **kwargs):
# comment copied from old config
#kwargs.setdefault("ParticleOrderingTool", "ISF_InToOutSubDetOrderingTool")
result = ParticleOrderingToolCfg(ConfigFlags)
kwargs.setdefault("ParticleOrderingTool", result.popPrivateTools())
result.merge(ParticleBrokerSvcNoOrderingCfg(name, **kwargs))
return result
def AFIIParticleBrokerSvcCfg(ConfigFlags, name="ISF_AFIIParticleBrokerSvc", **kwargs):
result = AFIIEntryLayerToolCfg(ConfigFlags)
kwargs.setdefault("EntryLayerTool", result.popPrivateTools())
result.merge(ParticleBrokerSvcCfg(name, **kwargs))
return result
# Generic Truth Service Configurations # Generic Truth Service Configurations
def TruthServiceCfg(ConfigFlags, **kwargs): def TruthServiceCfg(ConfigFlags, **kwargs):
"""Return the TruthService config flagged by Sim.TruthStrategy""" """Return the TruthService config flagged by Sim.TruthStrategy"""
......
...@@ -8,34 +8,9 @@ from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator ...@@ -8,34 +8,9 @@ from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
from AthenaConfiguration.ComponentFactory import CompFactory from AthenaConfiguration.ComponentFactory import CompFactory
from AthenaCommon.SystemOfUnits import mm from AthenaCommon.SystemOfUnits import mm
from SubDetectorEnvelopes.SubDetectorEnvelopesConfigNew import EnvelopeDefSvcCfg from SubDetectorEnvelopes.SubDetectorEnvelopesConfigNew import EnvelopeDefSvcCfg
from BarcodeServices.BarcodeServicesConfigNew import BarcodeSvcCfg
from ISF_Tools.ISF_ToolsConfigNew import ParticleKillerToolCfg from ISF_Tools.ISF_ToolsConfigNew import ParticleKillerToolCfg
def ParticleBrokerSvcNoOrderingCfg(ConfigFlags, name="ISF_ParticleBrokerSvcNoOrdering", **kwargs):
kwargs.setdefault("EntryLayerTool", "ISF_EntryLayerTool") # TODO
kwargs.setdefault("GeoIDSvc", "ISF_GeoIDSvc") # TODO
kwargs.setdefault("AlwaysUseGeoIDSvc", False)
kwargs.setdefault("ValidateGeoIDs", ConfigFlags.ISF.ValidationMode)
kwargs.setdefault("ValidationOutput", ConfigFlags.ISF.ValidationMode)
kwargs.setdefault("ValidationStreamName", "ParticleBroker")
result = BarcodeSvcCfg(ConfigFlags)
kwargs.setdefault("BarcodeService", result.getPrimary())
result.addService(CompFactory.ISF.ParticleBrokerDynamicOnReadIn(name, **kwargs))
return result
def ParticleBrokerSvcCfg(ConfigFlags, name="ISF_ParticleBrokerSvc", **kwargs):
#kwargs.setdefault("ParticleOrderingTool", "ISF_InToOutSubDetOrderingTool")
kwargs.setdefault("ParticleOrderingTool", "ISF_ParticleOrderingTool") # TODO
return ParticleBrokerSvcNoOrderingCfg(name, **kwargs)
def AFIIParticleBrokerSvcCfg(ConfigFlags, name="ISF_AFIIParticleBrokerSvc", **kwargs):
kwargs.setdefault("EntryLayerTool", "ISF_AFIIEntryLayerTool") # TODO
return ParticleBrokerSvcCfg(name, **kwargs)
def ISFEnvelopeDefSvcCfg(ConfigFlags, name="ISF_ISFEnvelopeDefSvc", **kwargs): def ISFEnvelopeDefSvcCfg(ConfigFlags, name="ISF_ISFEnvelopeDefSvc", **kwargs):
result = EnvelopeDefSvcCfg(ConfigFlags) result = EnvelopeDefSvcCfg(ConfigFlags)
# ATLAS common envlope definitions # ATLAS common envlope definitions
...@@ -72,7 +47,8 @@ def AFIIGeoIDSvcCfg(ConfigFlags, name="ISF_AFIIGeoIDSvc", **kwargs): ...@@ -72,7 +47,8 @@ def AFIIGeoIDSvcCfg(ConfigFlags, name="ISF_AFIIGeoIDSvc", **kwargs):
def ParticleKillerSvcCfg(ConfigFlags, name="ISF_ParticleKillerSvc", **kwargs): def ParticleKillerSvcCfg(ConfigFlags, name="ISF_ParticleKillerSvc", **kwargs):
result = ComponentAccumulator() result = ComponentAccumulator()
kwargs.setdefault("Identifier", "ParticleKiller") kwargs.setdefault("Identifier", "ParticleKiller")
kwargs.setdefault("SimulatorTool", ParticleKillerToolCfg(ConfigFlags)) tool = result.popToolsAndMerge(ParticleKillerToolCfg(ConfigFlags))
kwargs.setdefault("SimulatorTool", tool)
svc = CompFactory.ISF.LegacySimSvc(name, **kwargs) svc = CompFactory.ISF.LegacySimSvc(name, **kwargs)
result.addService(svc) result.addService(svc)
return result return result
...@@ -12,5 +12,5 @@ atlas_add_component( ISF_Tools ...@@ -12,5 +12,5 @@ atlas_add_component( ISF_Tools
LINK_LIBRARIES GaudiKernel AthenaBaseComps AtlasDetDescr BarcodeInterfacesLib GeneratorObjects ISF_Event ISF_InterfacesLib TrackRecordLib ) LINK_LIBRARIES GaudiKernel AthenaBaseComps AtlasDetDescr BarcodeInterfacesLib GeneratorObjects ISF_Event ISF_InterfacesLib TrackRecordLib )
# Install files from the package: # Install files from the package:
atlas_install_python_modules( python/*.py ) atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
""" """
from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
from AthenaConfiguration.ComponentFactory import CompFactory from AthenaConfiguration.ComponentFactory import CompFactory
from AthenaCommon.SystemOfUnits import MeV from AthenaCommon.SystemOfUnits import MeV
from BarcodeServices.BarcodeServicesConfigNew import BarcodeSvcCfg from BarcodeServices.BarcodeServicesConfigNew import BarcodeSvcCfg
...@@ -15,7 +16,9 @@ def ParticleHelperCfg(flags, name="ISF_ParticleHelper", **kwargs): ...@@ -15,7 +16,9 @@ def ParticleHelperCfg(flags, name="ISF_ParticleHelper", **kwargs):
def MemoryMonitorToolCfg(flags, name="ISF_MemoryMonitor", **kwargs): def MemoryMonitorToolCfg(flags, name="ISF_MemoryMonitor", **kwargs):
return CompFactory.ISF.MemoryMonitoringTool(name, **kwargs) acc = ComponentAccumulator()
acc.setPrivateTools(CompFactory.ISF.MemoryMonitoringTool(name, **kwargs))
return acc
def EntryLayerFilterCfg(ConfigFlags, **kwargs): def EntryLayerFilterCfg(ConfigFlags, **kwargs):
...@@ -112,12 +115,16 @@ def CosmicEventFilterToolCfg(flags, name="ISF_CosmicEventFilter", **kwargs): ...@@ -112,12 +115,16 @@ def CosmicEventFilterToolCfg(flags, name="ISF_CosmicEventFilter", **kwargs):
kwargs.setdefault("PDG_ID", flags.Sim.CosmicFilterID) kwargs.setdefault("PDG_ID", flags.Sim.CosmicFilterID)
kwargs.setdefault("ptMin", flags.Sim.CosmicFilterPTmin) kwargs.setdefault("ptMin", flags.Sim.CosmicFilterPTmin)
kwargs.setdefault("ptMax", flags.Sim.CosmicFilterPTmax) kwargs.setdefault("ptMax", flags.Sim.CosmicFilterPTmax)
return CompFactory.ISF.CosmicEventFilterTool(name, **kwargs) acc = ComponentAccumulator()
acc.setPrivateTools(CompFactory.ISF.CosmicEventFilterTool(name, **kwargs))
return acc
def StoppedParticleFilterToolCfg(flags, name="ISF_StoppedParticleFilter", **kwargs): def StoppedParticleFilterToolCfg(flags, name="ISF_StoppedParticleFilter", **kwargs):
kwargs.setdefault("VolumeNames", ["StoppingPositions"]) kwargs.setdefault("VolumeNames", ["StoppingPositions"])
return CompFactory.ISF.CosmicEventFilterTool(name, **kwargs) acc = ComponentAccumulator()
acc.setPrivateTools(CompFactory.ISF.CosmicEventFilterTool(name, **kwargs))
return acc
def InToOutSubDetOrderingToolCfg(flags, name="ISF_InToOutSubDetOrderingTool", **kwargs): def InToOutSubDetOrderingToolCfg(flags, name="ISF_InToOutSubDetOrderingTool", **kwargs):
...@@ -127,7 +134,9 @@ def InToOutSubDetOrderingToolCfg(flags, name="ISF_InToOutSubDetOrderingTool", ** ...@@ -127,7 +134,9 @@ def InToOutSubDetOrderingToolCfg(flags, name="ISF_InToOutSubDetOrderingTool", **
kwargs.setdefault("OrderCalo" , 10000 ) kwargs.setdefault("OrderCalo" , 10000 )
kwargs.setdefault("OrderMS" , 100 ) kwargs.setdefault("OrderMS" , 100 )
kwargs.setdefault("OrderCavern" , 1 ) kwargs.setdefault("OrderCavern" , 1 )
return CompFactory.ISF.GenericParticleOrderingTool(name, **kwargs) acc = ComponentAccumulator()
acc.setPrivateTools(CompFactory.ISF.GenericParticleOrderingTool(name, **kwargs))
return acc
def ParticleOrderingToolCfg(flags, name="ISF_ParticleOrderingTool", **kwargs): def ParticleOrderingToolCfg(flags, name="ISF_ParticleOrderingTool", **kwargs):
...@@ -136,12 +145,18 @@ def ParticleOrderingToolCfg(flags, name="ISF_ParticleOrderingTool", **kwargs): ...@@ -136,12 +145,18 @@ def ParticleOrderingToolCfg(flags, name="ISF_ParticleOrderingTool", **kwargs):
kwargs.setdefault("OrderCalo" , 1) kwargs.setdefault("OrderCalo" , 1)
kwargs.setdefault("OrderMS" , 1) kwargs.setdefault("OrderMS" , 1)
kwargs.setdefault("OrderCavern" , 1) kwargs.setdefault("OrderCavern" , 1)
return CompFactory.ISF.GenericParticleOrderingTool(name, **kwargs) acc = ComponentAccumulator()
acc.setPrivateTools(CompFactory.ISF.GenericParticleOrderingTool(name, **kwargs))
return acc
def EnergyParticleOrderingToolCfg(flags, name="ISF_EnergyParticleOrderingTool", **kwargs): def EnergyParticleOrderingToolCfg(flags, name="ISF_EnergyParticleOrderingTool", **kwargs):
return CompFactory.ISF.EnergyParticleOrderingTool(name, **kwargs) acc = ComponentAccumulator()
acc.setPrivateTools(CompFactory.ISF.EnergyParticleOrderingTool(name, **kwargs))
return acc
def ParticleKillerToolCfg(flags, name="ISF_ParticleKillerTool", **kwargs): def ParticleKillerToolCfg(flags, name="ISF_ParticleKillerTool", **kwargs):
return CompFactory.ISF.ParticleKillerSimTool(name, **kwargs) acc = ComponentAccumulator()
acc.setPrivateTools(CompFactory.ISF.ParticleKillerSimTool(name, **kwargs))
return acc
...@@ -2,16 +2,19 @@ ...@@ -2,16 +2,19 @@
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
""" """
from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
from AthenaConfiguration.ComponentFactory import CompFactory from AthenaConfiguration.ComponentFactory import CompFactory
from ISF_Services.ISF_ServicesConfigNew import GeoIDSvcCfg, AFIIGeoIDSvcCfg from ISF_Services.ISF_ServicesCoreConfigNew import GeoIDSvcCfg, AFIIGeoIDSvcCfg
from ISF_Tools.ISF_ToolsConfigNew import EntryLayerFilterCfg from ISF_Tools.ISF_ToolsConfigNew import EntryLayerFilterCfg
def EntryLayerToolCfg(flags, name="ISF_EntryLayerTool", **kwargs): def EntryLayerToolCfg(flags, name="ISF_EntryLayerTool", **kwargs):
acc = GeoIDSvcCfg(flags) acc = ComponentAccumulator()
kwargs.setdefault("GeoIDSvc", acc.getService("ISF_GeoIDSvc")) if "GeoIDSvc" not in kwargs:
acc_filter = EntryLayerFilterCfg(flags) acc.merge(GeoIDSvcCfg(flags))
kwargs.setdefault("ParticleFilters", [acc.popToolsAndMerge(acc_filter)]) kwargs["GeoIDSvc"] = acc.getService("ISF_GeoIDSvc")
filt = acc.popToolsAndMerge(EntryLayerFilterCfg(flags))
kwargs.setdefault("ParticleFilters", [filt])
if flags.Sim.DoFullChain: # TODO and DetFlags.pileup.any_on(): if flags.Sim.DoFullChain: # TODO and DetFlags.pileup.any_on():
kwargs.setdefault("EvtStore", "OriginalEvent_SG") # For Fast Chain kwargs.setdefault("EvtStore", "OriginalEvent_SG") # For Fast Chain
acc.setPrivateTools(CompFactory.ISF.EntryLayerTool(name, **kwargs)) acc.setPrivateTools(CompFactory.ISF.EntryLayerTool(name, **kwargs))
...@@ -19,10 +22,12 @@ def EntryLayerToolCfg(flags, name="ISF_EntryLayerTool", **kwargs): ...@@ -19,10 +22,12 @@ def EntryLayerToolCfg(flags, name="ISF_EntryLayerTool", **kwargs):
def EntryLayerToolMTCfg(flags, name="ISF_EntryLayerToolMT", **kwargs): def EntryLayerToolMTCfg(flags, name="ISF_EntryLayerToolMT", **kwargs):
acc = GeoIDSvcCfg(flags) acc = ComponentAccumulator()
kwargs.setdefault("GeoIDSvc", acc.getService("ISF_GeoIDSvc")) if "GeoIDSvc" not in kwargs:
acc_filter = EntryLayerFilterCfg(flags) acc.merge(GeoIDSvcCfg(flags))
kwargs.setdefault("ParticleFilters", [acc.popToolsAndMerge(acc_filter)]) kwargs["GeoIDSvc"] = acc.getService("ISF_GeoIDSvc")
filt = acc.popToolsAndMerge(EntryLayerFilterCfg(flags))
kwargs.setdefault("ParticleFilters", [filt])
if flags.Sim.DoFullChain: # TODO and DetFlags.pileup.any_on(): if flags.Sim.DoFullChain: # TODO and DetFlags.pileup.any_on():
kwargs.setdefault("EvtStore", "OriginalEvent_SG") # For Fast Chain kwargs.setdefault("EvtStore", "OriginalEvent_SG") # For Fast Chain
acc.setPrivateTools(CompFactory.ISF.EntryLayerToolMT(name, **kwargs)) acc.setPrivateTools(CompFactory.ISF.EntryLayerToolMT(name, **kwargs))
...@@ -30,14 +35,20 @@ def EntryLayerToolMTCfg(flags, name="ISF_EntryLayerToolMT", **kwargs): ...@@ -30,14 +35,20 @@ def EntryLayerToolMTCfg(flags, name="ISF_EntryLayerToolMT", **kwargs):
def AFIIEntryLayerToolCfg(flags, name="ISF_AFIIEntryLayerTool", **kwargs): def AFIIEntryLayerToolCfg(flags, name="ISF_AFIIEntryLayerTool", **kwargs):
acc = AFIIGeoIDSvcCfg(flags) acc = ComponentAccumulator()
kwargs.setdefault("GeoIDSvc", acc.getService("ISF_AFIIGeoIDSvc")) if "GeoIDSvc" not in kwargs:
acc.merge(EntryLayerToolCfg(name, **kwargs)) acc.merge(AFIIGeoIDSvcCfg(flags))
kwargs["GeoIDSvc"] = acc.getService("ISF_AFIIGeoIDSvc")
tool = acc.popToolsAndMerge(EntryLayerToolCfg(name, **kwargs))
acc.setPrivateTools(tool)
return acc return acc
def AFIIEntryLayerToolMTCfg(flags, name="ISF_AFIIEntryLayerToolMT", **kwargs): def AFIIEntryLayerToolMTCfg(flags, name="ISF_AFIIEntryLayerToolMT", **kwargs):
acc = AFIIGeoIDSvcCfg(flags) acc = ComponentAccumulator()
kwargs.setdefault("GeoIDSvc", acc.getService("ISF_AFIIGeoIDSvc")) if "GeoIDSvc" not in kwargs:
acc.merge(EntryLayerToolMTCfg(name, **kwargs)) acc.merge(AFIIGeoIDSvcCfg(flags))
kwargs["GeoIDSvc"] = acc.getService("ISF_AFIIGeoIDSvc")
tool = acc.popToolsAndMerge(EntryLayerToolMTCfg(name, **kwargs))
acc.setPrivateTools(tool)
return acc return acc
...@@ -26,5 +26,5 @@ atlas_add_component( ISF_Geant4Tools ...@@ -26,5 +26,5 @@ atlas_add_component( ISF_Geant4Tools
LINK_LIBRARIES ${ROOT_LIBRARIES} ${XERCESC_LIBRARIES} ${CLHEP_LIBRARIES} AtlasHepMCLib ${GEANT4_LIBRARIES} ${EIGEN_LIBRARIES} AthenaKernel GaudiKernel G4AtlasInterfaces AthenaBaseComps StoreGateLib SGtests AtlasDetDescr GeneratorObjects G4AtlasToolsLib G4AtlasAlgLib MCTruth SimHelpers ISF_Event ISF_InterfacesLib ISF_Geant4Event ISF_Geant4ToolsLib ) LINK_LIBRARIES ${ROOT_LIBRARIES} ${XERCESC_LIBRARIES} ${CLHEP_LIBRARIES} AtlasHepMCLib ${GEANT4_LIBRARIES} ${EIGEN_LIBRARIES} AthenaKernel GaudiKernel G4AtlasInterfaces AthenaBaseComps StoreGateLib SGtests AtlasDetDescr GeneratorObjects G4AtlasToolsLib G4AtlasAlgLib MCTruth SimHelpers ISF_Event ISF_InterfacesLib ISF_Geant4Event ISF_Geant4ToolsLib )
# Install files from the package: # Install files from the package:
atlas_install_python_modules( python/*.py ) atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
...@@ -5,8 +5,9 @@ Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration ...@@ -5,8 +5,9 @@ Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
from AthenaConfiguration.ComponentFactory import CompFactory from AthenaConfiguration.ComponentFactory import CompFactory
from AthenaCommon.SystemOfUnits import MeV from AthenaCommon.SystemOfUnits import MeV
from ISF_Services.ISF_ServicesCoreConfigNew import GeoIDSvcCfg, AFIIGeoIDSvcCfg
from ISF_Services.ISF_ServicesConfigNew import ( from ISF_Services.ISF_ServicesConfigNew import (
TruthServiceCfg, GeoIDSvcCfg, AFIIGeoIDSvcCfg, TruthServiceCfg,
ParticleBrokerSvcCfg, InputConverterCfg, ParticleBrokerSvcCfg, InputConverterCfg,
LongLivedInputConverterCfg LongLivedInputConverterCfg
) )
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment