From aacd3f7326b451e4153100e9b784ee54aa7512ba Mon Sep 17 00:00:00 2001 From: John Chapman <jchapman@cern.ch> Date: Wed, 30 Jan 2019 13:36:31 +0100 Subject: [PATCH] ComponentAccumulator configuration of Pixel Geometry --- .../PixelGeoModel/CMakeLists.txt | 5 ++ .../python/PixelGeoModelConfig.py | 46 ++++++++++++++++++- .../PixelGeoModel/test/PixelGMConfig_test.py | 25 ++++++++++ 3 files changed, 75 insertions(+), 1 deletion(-) create mode 100755 InnerDetector/InDetDetDescr/PixelGeoModel/test/PixelGMConfig_test.py diff --git a/InnerDetector/InDetDetDescr/PixelGeoModel/CMakeLists.txt b/InnerDetector/InDetDetDescr/PixelGeoModel/CMakeLists.txt index 27c9c4eb524..c7af047071c 100644 --- a/InnerDetector/InDetDetDescr/PixelGeoModel/CMakeLists.txt +++ b/InnerDetector/InDetDetDescr/PixelGeoModel/CMakeLists.txt @@ -45,5 +45,10 @@ atlas_add_component( PixelGeoModel src/components/*.cxx LINK_LIBRARIES GaudiKernel PixelGeoModelLib ) +atlas_add_test( PixelGMConfig_test + SCRIPT test/PixelGMConfig_test.py + PROPERTIES TIMEOUT 300 ) + # Install files from the package: atlas_install_python_modules( python/*.py ) +atlas_install_scripts( test/*.py ) diff --git a/InnerDetector/InDetDetDescr/PixelGeoModel/python/PixelGeoModelConfig.py b/InnerDetector/InDetDetDescr/PixelGeoModel/python/PixelGeoModelConfig.py index f24fc6ec634..b2ae09a76fc 100644 --- a/InnerDetector/InDetDetDescr/PixelGeoModel/python/PixelGeoModelConfig.py +++ b/InnerDetector/InDetDetDescr/PixelGeoModel/python/PixelGeoModelConfig.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration from AthenaCommon import CfgMgr @@ -10,3 +10,47 @@ def getPixelDetectorTool(name="PixelDetectorTool", **kwargs): kwargs.setdefault("ServiceBuilderTool", ""); return CfgMgr.PixelDetectorTool(name, **kwargs) + + +############## ComponentAccumulator +from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator +from AthenaConfiguration.AthConfigFlags import AthConfigFlags +from IOVDbSvc.IOVDbSvcConfig import addFoldersSplitOnline + +def PixelGeometryCfg( flags ): + from AtlasGeoModel.GeoModelConfig import GeoModelCfg + acc,geoModelSvc = GeoModelCfg( flags ) + from GeometryDBSvc.GeometryDBSvcConf import GeometryDBSvc + acc.addService(GeometryDBSvc("InDetGeometryDBSvc")) + from PixelGeoModel.PixelGeoModelConf import PixelDetectorTool + pixelDetectorTool = PixelDetectorTool("PixelDetectorTool") + from BCM_GeoModel.BCM_GeoModelConf import InDetDD__BCM_Builder + bcmTool = InDetDD__BCM_Builder() + acc.addPublicTool( bcmTool ) + pixelDetectorTool.BCM_Tool = bcmTool + from BLM_GeoModel.BLM_GeoModelConf import InDetDD__BLM_Builder + blmTool = InDetDD__BLM_Builder() + acc.addPublicTool( blmTool ) + pixelDetectorTool.BLM_Tool = blmTool + if flags.GeoModel.Run=="RUN4": + from InDetServMatGeoModel.InDetServMatGeoModelConf import InDetServMatBuilderToolSLHC + InDetServMatBuilderToolSLHC = InDetServMatBuilderToolSLHC() + acc.addPublicTool( InDetServMatBuilderToolSLHC ) + pixelDetectorTool.ServiceBuilderTool = InDetServMatBuilderToolSLHC + pixelDetectorTool.useDynamicAlignFolders = flags.GeoModel.Align.Dynamic + geoModelSvc.DetectorTools += [ pixelDetectorTool ] + acc.addService(geoModelSvc) + # Pixel module distortions + acc.merge(addFoldersSplitOnline(flags,"INDET","/Indet/Onl/PixelDist","/Indet/PixelDist")) # Not used ??? + # IBL stave distortions + acc.merge(addFoldersSplitOnline(flags,"INDET","/Indet/Onl/IBLDist","/Indet/IBLDist",className="CondAttrListCollection")) + if flags.GeoModel.Align.Dynamic: + acc.merge(addFoldersSplitOnline(flags,"INDET","/Indet/Onl/AlignL1/ID","/Indet/AlignL1/ID",className="CondAttrListCollection")) + acc.merge(addFoldersSplitOnline(flags,"INDET","/Indet/Onl/AlignL2/PIX","/Indet/AlignL2/PIX",className="CondAttrListCollection")) + acc.merge(addFoldersSplitOnline(flags,"INDET","/Indet/Onl/AlignL3","/Indet/AlignL3",className="AlignableTransformContainer")) + else: + if (not flags.Detector.SimulatePixel) or flags.Detector.OverlayPixel: + acc.merge(addFoldersSplitOnline(flags,"INDET","/Indet/Onl/Align","/Indet/Align",className="AlignableTransformContainer")) + else: + acc.merge(addFoldersSplitOnline(flags,"INDET","/Indet/Onl/Align","/Indet/Align")) + return acc diff --git a/InnerDetector/InDetDetDescr/PixelGeoModel/test/PixelGMConfig_test.py b/InnerDetector/InDetDetDescr/PixelGeoModel/test/PixelGMConfig_test.py new file mode 100755 index 00000000000..e045030a3ff --- /dev/null +++ b/InnerDetector/InDetDetDescr/PixelGeoModel/test/PixelGMConfig_test.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python +"""Run tests on PixelGeoModel 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.IOVDb.GlobalTag = "OFLCOND-MC16-SDR-16" + 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 PixelGeoModel.PixelGeoModelConfig import PixelGeometryCfg + acc = PixelGeometryCfg(ConfigFlags) + f=open('PixelGeometryCfg.pkl','w') + acc.store(f) + f.close() -- GitLab