From c2ad2e7d521b66be2e74a67c18af31d8b47a9989 Mon Sep 17 00:00:00 2001 From: John Chapman <jchapman@cern.ch> Date: Wed, 30 Jan 2019 13:37:08 +0100 Subject: [PATCH] ComponentAccumulator configuration of TRT Geometry --- .../InDetDetDescr/TRT_GeoModel/CMakeLists.txt | 8 +++ .../TRT_GeoModel/python/TRT_GeoModelConfig.py | 54 +++++++++++++++++++ .../TRT_GeoModel/test/TRT_GMConfig_test.py | 25 +++++++++ 3 files changed, 87 insertions(+) create mode 100644 InnerDetector/InDetDetDescr/TRT_GeoModel/python/TRT_GeoModelConfig.py create mode 100755 InnerDetector/InDetDetDescr/TRT_GeoModel/test/TRT_GMConfig_test.py diff --git a/InnerDetector/InDetDetDescr/TRT_GeoModel/CMakeLists.txt b/InnerDetector/InDetDetDescr/TRT_GeoModel/CMakeLists.txt index bb2815df1d4..e5575eaeb15 100644 --- a/InnerDetector/InDetDetDescr/TRT_GeoModel/CMakeLists.txt +++ b/InnerDetector/InDetDetDescr/TRT_GeoModel/CMakeLists.txt @@ -39,3 +39,11 @@ atlas_add_component( TRT_GeoModel INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${CORAL_INCLUDE_DIRS} LINK_LIBRARIES ${Boost_LIBRARIES} ${CORAL_LIBRARIES} ${GEOMODEL_LIBRARIES} AthenaKernel GeoModelUtilities GaudiKernel TRT_ConditionsServicesLib InDetGeoModelUtils InDetReadoutGeometry SGTools StoreGateLib SGtests AthenaPoolUtilities DetDescrConditions IdDictDetDescr TRT_ConditionsData InDetIdentifier ) +atlas_add_test( TRT_GMConfig_test + SCRIPT test/TRT_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/TRT_GeoModel/python/TRT_GeoModelConfig.py b/InnerDetector/InDetDetDescr/TRT_GeoModel/python/TRT_GeoModelConfig.py new file mode 100644 index 00000000000..80c868a2eb8 --- /dev/null +++ b/InnerDetector/InDetDetDescr/TRT_GeoModel/python/TRT_GeoModelConfig.py @@ -0,0 +1,54 @@ +# +# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# + +from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator +from AthenaConfiguration.AthConfigFlags import AthConfigFlags +from IOVDbSvc.IOVDbSvcConfig import addFoldersSplitOnline + +def TRT_GeometryCfg( flags ): + from AtlasGeoModel.GeoModelConfig import GeoModelCfg + acc,geoModelSvc = GeoModelCfg( flags ) + from GeometryDBSvc.GeometryDBSvcConf import GeometryDBSvc + acc.addService(GeometryDBSvc("InDetGeometryDBSvc")) + from TRT_GeoModel.TRT_GeoModelConf import TRT_DetectorTool + trtDetectorTool = TRT_DetectorTool() + trtDetectorTool.DoXenonArgonMixture = flags.Detector.SimulateTRT + trtDetectorTool.DoKryptonMixture = flags.Detector.SimulateTRT + trtDetectorTool.useDynamicAlignFolders = flags.GeoModel.Align.Dynamic + geoModelSvc.DetectorTools += [ trtDetectorTool ] + acc.addService(geoModelSvc) + # Inner Detector alignment + acc.merge(addFoldersSplitOnline(flags,"TRT","/TRT/Onl/Calib/DX","/TRT/Calib/DX")) + if flags.Detector.SimulateTRT: # revert to old style CondHandle in case of simulation + # Dead/Noisy Straw Lists + acc.merge(addFoldersSplitOnline(flags, "TRT","/TRT/Onl/Cond/Status","/TRT/Cond/Status")) + acc.merge(addFoldersSplitOnline(flags, "TRT","/TRT/Onl/Cond/StatusPermanent","/TRT/Cond/StatusPermanent")) + # Argon straw list + acc.merge(addFoldersSplitOnline(flags, "TRT","/TRT/Onl/Cond/StatusHT","/TRT/Cond/StatusHT")) + else: + # Dead/Noisy Straw Lists + acc.merge(addFoldersSplitOnline(flags, "TRT","/TRT/Onl/Cond/Status","/TRT/Cond/Status",className='TRTCond::StrawStatusMultChanContainer')) + acc.merge(addFoldersSplitOnline(flags, "TRT","/TRT/Onl/Cond/StatusPermanent","/TRT/Cond/StatusPermanent",className='TRTCond::StrawStatusMultChanContainer')) + # Argon straw list + acc.merge(addFoldersSplitOnline(flags, "TRT","/TRT/Onl/Cond/StatusHT","/TRT/Cond/StatusHT",className='TRTCond::StrawStatusMultChanContainer')) + # TRT Condition Algorithm + from TRT_ConditionsAlgs.TRT_ConditionsAlgsConf import TRTAlignCondAlg + TRTAlignCondAlg = TRTAlignCondAlg(name = "TRTAlignCondAlg", + UseDynamicFolders = flags.GeoModel.Align.Dynamic) + if flags.GeoModel.Align.Dynamic: + acc.merge(addFoldersSplitOnline(flags,"TRT","/TRT/Onl/AlignL1/TRT","/TRT/AlignL1/TRT",className="CondAttrListCollection")) + acc.merge(addFoldersSplitOnline(flags,"TRT","/TRT/Onl/AlignL2","/TRT/AlignL2",className="AlignableTransformContainer")) + TRTAlignCondAlg.ReadKeyDynamicGlobal = "/TRT/AlignL1/TRT" + TRTAlignCondAlg.ReadKeyDynamicRegular = "/TRT/AlignL2" + else: + if (not flags.Detector.SimulateTRT) or flags.Detector.OverlayTRT: + acc.merge(addFoldersSplitOnline(flags,"TRT","/TRT/Onl/Align","/TRT/Align",className="AlignableTransformContainer")) + else: + acc.merge(addFoldersSplitOnline(flags,"TRT","/TRT/Onl/Align","/TRT/Align")) + import os + if "AthSimulation_DIR" not in os.environ: # Protection for AthSimulation builds + if (not flags.Detector.SimulateTRT) or flags.Detector.OverlayTRT: + acc.addCondAlgo(TRTAlignCondAlg) + + return acc diff --git a/InnerDetector/InDetDetDescr/TRT_GeoModel/test/TRT_GMConfig_test.py b/InnerDetector/InDetDetDescr/TRT_GeoModel/test/TRT_GMConfig_test.py new file mode 100755 index 00000000000..4bd3f95734a --- /dev/null +++ b/InnerDetector/InDetDetDescr/TRT_GeoModel/test/TRT_GMConfig_test.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python +"""Run tests on TRT_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 TRT_GeoModel.TRT_GeoModelConfig import TRT_GeometryCfg + acc = TRT_GeometryCfg(ConfigFlags) + f=open('TRT_GeometryCfg.pkl','w') + acc.store(f) + f.close() -- GitLab