From 153342db7b356daf577b163e6d76af29a44dafd6 Mon Sep 17 00:00:00 2001 From: John Chapman <jchapman@cern.ch> Date: Tue, 29 Jan 2019 15:35:07 +0100 Subject: [PATCH] Add ComponentAccumulator configuration for BeamPipeDetectorTool and accompanying test --- .../BeamPipeGeoModel/CMakeLists.txt | 7 ++++++ .../python/BeamPipeGMConfig.py | 10 ++++++++ .../test/BeamPipeGMConfig_test.py | 24 +++++++++++++++++++ 3 files changed, 41 insertions(+) create mode 100644 AtlasGeometryCommon/BeamPipeGeoModel/python/BeamPipeGMConfig.py create mode 100755 AtlasGeometryCommon/BeamPipeGeoModel/test/BeamPipeGMConfig_test.py diff --git a/AtlasGeometryCommon/BeamPipeGeoModel/CMakeLists.txt b/AtlasGeometryCommon/BeamPipeGeoModel/CMakeLists.txt index f8006b9f70b..48e3a87cb8a 100644 --- a/AtlasGeometryCommon/BeamPipeGeoModel/CMakeLists.txt +++ b/AtlasGeometryCommon/BeamPipeGeoModel/CMakeLists.txt @@ -34,3 +34,10 @@ atlas_add_component( BeamPipeGeoModel INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${CORAL_INCLUDE_DIRS} LINK_LIBRARIES ${Boost_LIBRARIES} ${CORAL_LIBRARIES} ${GEOMODEL_LIBRARIES} GeoModelUtilities SGTools StoreGateLib GaudiKernel BeamPipeGeoModelLib ) +atlas_add_test( BeamPipeGMConfig_test + SCRIPT test/BeamPipeGMConfig_test.py + PROPERTIES TIMEOUT 300 ) + +# Install files from the package: +atlas_install_python_modules( python/*.py ) +atlas_install_scripts( test/*.py ) diff --git a/AtlasGeometryCommon/BeamPipeGeoModel/python/BeamPipeGMConfig.py b/AtlasGeometryCommon/BeamPipeGeoModel/python/BeamPipeGMConfig.py new file mode 100644 index 00000000000..1f4b632cb63 --- /dev/null +++ b/AtlasGeometryCommon/BeamPipeGeoModel/python/BeamPipeGMConfig.py @@ -0,0 +1,10 @@ +# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator +from AtlasGeoModel.GeoModelConfig import GeoModelCfg + +def BeamPipeGeometryCfg(flags): + result,gms=GeoModelCfg(flags) + from BeamPipeGeoModel.BeamPipeGeoModelConf import BeamPipeDetectorTool + gms.DetectorTools += [ BeamPipeDetectorTool() ] + result.addService(gms) + return result diff --git a/AtlasGeometryCommon/BeamPipeGeoModel/test/BeamPipeGMConfig_test.py b/AtlasGeometryCommon/BeamPipeGeoModel/test/BeamPipeGMConfig_test.py new file mode 100755 index 00000000000..a2db6f080f1 --- /dev/null +++ b/AtlasGeometryCommon/BeamPipeGeoModel/test/BeamPipeGMConfig_test.py @@ -0,0 +1,24 @@ +#!/usr/bin/env python +"""Run tests on BeamPipeGeoModel configuration + +Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +""" +if __name__ == "__main__": + from AthenaCommon.Configurable import Configurable + Configurable.configurableRun3Behavior=1 + from AthenaConfiguration.AllConfigFlags import ConfigFlags + from AthenaConfiguration.TestDefaults import defaultTestFiles + + ConfigFlags.Input.Files = defaultTestFiles.HITS + ConfigFlags.Detector.SimulatePixel = False + ConfigFlags.Detector.SimulateSCT = False + ConfigFlags.Detector.SimulateTRT = False + ConfigFlags.GeoModel.Align.Dynamic = False + ConfigFlags.lock() + + from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator + from BeamPipeGeoModel.BeamPipeGMConfig import BeamPipeGeometryCfg + acc = BeamPipeGeometryCfg(ConfigFlags) + f=open('BeamPipeGeometryCfg.pkl','w') + acc.store(f) + f.close() -- GitLab