From f6a554c372ed510b02ba5866b33bef879ae0eef6 Mon Sep 17 00:00:00 2001 From: John Chapman <jchapman@cern.ch> Date: Wed, 30 Jan 2019 13:36:48 +0100 Subject: [PATCH] ComponentAccumulator configuration of SCT Geometry --- .../InDetDetDescr/SCT_GeoModel/CMakeLists.txt | 6 ++- .../SCT_GeoModel/python/SCT_GeoModelConfig.py | 52 ++++++++++++++++++- .../SCT_GeoModel/test/SCT_GMConfig_test.py | 25 +++++++++ 3 files changed, 81 insertions(+), 2 deletions(-) create mode 100755 InnerDetector/InDetDetDescr/SCT_GeoModel/test/SCT_GMConfig_test.py diff --git a/InnerDetector/InDetDetDescr/SCT_GeoModel/CMakeLists.txt b/InnerDetector/InDetDetDescr/SCT_GeoModel/CMakeLists.txt index edc57338d20..3b2e0af643f 100644 --- a/InnerDetector/InDetDetDescr/SCT_GeoModel/CMakeLists.txt +++ b/InnerDetector/InDetDetDescr/SCT_GeoModel/CMakeLists.txt @@ -37,6 +37,10 @@ atlas_add_component( SCT_GeoModel INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${CORAL_INCLUDE_DIRS} LINK_LIBRARIES ${Boost_LIBRARIES} ${CORAL_LIBRARIES} ${GEOMODEL_LIBRARIES} AthenaKernel GeoModelUtilities GaudiKernel InDetGeoModelUtils InDetReadoutGeometry SGTools StoreGateLib SGtests AthenaPoolUtilities DetDescrConditions Identifier InDetIdentifier ) +atlas_add_test( SCT_GMConfig_test + SCRIPT test/SCT_GMConfig_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/SCT_GeoModel/python/SCT_GeoModelConfig.py b/InnerDetector/InDetDetDescr/SCT_GeoModel/python/SCT_GeoModelConfig.py index 6c8522d4cac..89e8786c714 100644 --- a/InnerDetector/InDetDetDescr/SCT_GeoModel/python/SCT_GeoModelConfig.py +++ b/InnerDetector/InDetDetDescr/SCT_GeoModel/python/SCT_GeoModelConfig.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2017 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,53 @@ def getSCT_DetectorTool(name="SCT_DetectorTool", **kwargs): kwargs.setdefault("GeoDbTagSvc", "GeoDbTagSvc"); from AthenaCommon.DetFlags import DetFlags return CfgMgr.SCT_DetectorTool(name, **kwargs) + + +###### ComponentAccumulator + +from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator +from AthenaConfiguration.AthConfigFlags import AthConfigFlags +from IOVDbSvc.IOVDbSvcConfig import addFoldersSplitOnline + +def SCT_GeometryCfg( flags ): + from AtlasGeoModel.GeoModelConfig import GeoModelCfg + acc,geoModelSvc = GeoModelCfg( flags ) + from GeometryDBSvc.GeometryDBSvcConf import GeometryDBSvc + acc.addService(GeometryDBSvc("InDetGeometryDBSvc")) + if flags.GeoModel.Run=="RUN4": + if "GMX" == flags.GeoModel.StripGeoType(): + from SCT_GeoModelXml.SCT_GeoModelXmlConf import SCT_GMX_DetectorTool + sctDetectorTool = SCT_GMX_DetectorTool() + else: + from SCT_SLHC_GeoModel.SCT_SLHC_GeoModelConf import SCT_SLHC_DetectorTool + sctDetectorTool = SCT_SLHC_DetectorTool() + from InDetServMatGeoModel.InDetServMatGeoModelConf import InDetServMatBuilderToolSLHC + InDetServMatBuilderToolSLHC = InDetServMatBuilderToolSLHC() + acc.addPublicTool( InDetServMatBuilderToolSLHC ) + sctDetectorTool.ServiceBuilderTool = InDetServMatBuilderToolSLHC + else: + from SCT_GeoModel.SCT_GeoModelConf import SCT_DetectorTool + sctDetectorTool = SCT_DetectorTool() + sctDetectorTool.useDynamicAlignFolders = flags.GeoModel.Align.Dynamic + geoModelSvc.DetectorTools += [ sctDetectorTool ] + acc.addService(geoModelSvc) + 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/SCT","/Indet/AlignL2/SCT",className="CondAttrListCollection")) + acc.merge(addFoldersSplitOnline(flags,"INDET","/Indet/Onl/AlignL3","/Indet/AlignL3",className="AlignableTransformContainer")) + else: + if (not flags.Detector.SimulateSCT) or flags.Detector.OverlaySCT: + acc.merge(addFoldersSplitOnline(flags,"INDET","/Indet/Onl/Align","/Indet/Align",className="AlignableTransformContainer")) + else: + acc.merge(addFoldersSplitOnline(flags,"INDET","/Indet/Onl/Align","/Indet/Align")) + import os + if "AthSimulation_DIR" not in os.environ: # Protection for AthSimulation builds + if (not flags.Detector.SimulateSCT) or flags.Detector.OverlaySCT: + from SCT_ConditionsAlgorithms.SCT_ConditionsAlgorithmsConf import SCT_AlignCondAlg + sctAlignCondAlg = SCT_AlignCondAlg(name = "SCT_AlignCondAlg", + UseDynamicAlignFolders = flags.GeoModel.Align.Dynamic) + acc.addCondAlgo(sctAlignCondAlg) + from SCT_ConditionsAlgorithms.SCT_ConditionsAlgorithmsConf import SCT_DetectorElementCondAlg + sctDetectorElementCondAlg = SCT_DetectorElementCondAlg(name = "SCT_DetectorElementCondAlg") + acc.addCondAlgo(sctDetectorElementCondAlg) + return acc diff --git a/InnerDetector/InDetDetDescr/SCT_GeoModel/test/SCT_GMConfig_test.py b/InnerDetector/InDetDetDescr/SCT_GeoModel/test/SCT_GMConfig_test.py new file mode 100755 index 00000000000..b7dbd7f1137 --- /dev/null +++ b/InnerDetector/InDetDetDescr/SCT_GeoModel/test/SCT_GMConfig_test.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python +"""Run tests on SCT_GeoModel 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 SCT_GeoModel.SCT_GeoModelConfig import SCT_GeometryCfg + acc = SCT_GeometryCfg(ConfigFlags) + f=open('SCT_GeometryCfg.pkl','w') + acc.store(f) + f.close() -- GitLab