From 6fbc80459533a719e473efac56a0cf5bf97bccea Mon Sep 17 00:00:00 2001 From: John Chapman <jchapman@cern.ch> Date: Wed, 30 Jan 2019 15:43:56 +0100 Subject: [PATCH] Initial ComponentAccumulator method to build the whole ATLAS Detector This commit adds an initial attempt add configuring the description of the whole ATLAS detector in GeoModel using ComponentAccumulator. It also adds tests for building the full Atlas geometry based on different input file types. --- .../GeoModel/AtlasGeoModel/CMakeLists.txt | 11 +++++ .../python/AtlasGeoModelConfig.py | 26 ++++++++++++ .../test/AtlasGeometryConfig_AOD_test.py | 36 ++++++++++++++++ .../test/AtlasGeometryConfig_EVNT_test.py | 41 +++++++++++++++++++ .../test/AtlasGeometryConfig_HITS_test.py | 37 +++++++++++++++++ 5 files changed, 151 insertions(+) create mode 100644 DetectorDescription/GeoModel/AtlasGeoModel/python/AtlasGeoModelConfig.py create mode 100755 DetectorDescription/GeoModel/AtlasGeoModel/test/AtlasGeometryConfig_AOD_test.py create mode 100755 DetectorDescription/GeoModel/AtlasGeoModel/test/AtlasGeometryConfig_EVNT_test.py create mode 100755 DetectorDescription/GeoModel/AtlasGeoModel/test/AtlasGeometryConfig_HITS_test.py diff --git a/DetectorDescription/GeoModel/AtlasGeoModel/CMakeLists.txt b/DetectorDescription/GeoModel/AtlasGeoModel/CMakeLists.txt index 925b0935411..8654ff91070 100644 --- a/DetectorDescription/GeoModel/AtlasGeoModel/CMakeLists.txt +++ b/DetectorDescription/GeoModel/AtlasGeoModel/CMakeLists.txt @@ -8,7 +8,18 @@ atlas_subdir( AtlasGeoModel ) # Install files from the package: atlas_install_python_modules( python/*.py ) atlas_install_joboptions( share/*.py ) +atlas_install_scripts( test/*.py ) + +atlas_add_test( EVNT_InputGeo_test + SCRIPT test/AtlasGeometryConfig_EVNT_test.py + PROPERTIES TIMEOUT 300 ) if( NOT SIMULATIONBASE ) atlas_add_test( AtlasGeoModelConfig SCRIPT python -m AtlasGeoModel.GeoModelConfig POST_EXEC_SCRIPT nopost.sh ) + atlas_add_test( HITS_InputGeo_test + SCRIPT test/AtlasGeometryConfig_HITS_test.py + PROPERTIES TIMEOUT 300 ) + atlas_add_test( AOD_InputGeo_test + SCRIPT test/AtlasGeometryConfig_AOD_test.py + PROPERTIES TIMEOUT 300 ) endif() diff --git a/DetectorDescription/GeoModel/AtlasGeoModel/python/AtlasGeoModelConfig.py b/DetectorDescription/GeoModel/AtlasGeoModel/python/AtlasGeoModelConfig.py new file mode 100644 index 00000000000..cc2c90572cd --- /dev/null +++ b/DetectorDescription/GeoModel/AtlasGeoModel/python/AtlasGeoModelConfig.py @@ -0,0 +1,26 @@ +# +# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# + +from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator +from AthenaConfiguration.AthConfigFlags import AthConfigFlags + +def AtlasGeometryCfg (flags): + acc = ComponentAccumulator() + + from AtlasGeoModel.InDetGMConfig import InDetGeometryCfg + acc.merge(InDetGeometryCfg(flags)) + from LArGeoAlgsNV.LArGMConfig import LArGMCfg + acc.merge(LArGMCfg(flags)) + from TileGeoModel.TileGMConfig import TileGMCfg + acc.merge(TileGMCfg(flags)) + from MuonConfig.MuonGeometryConfig import MuonGeoModelCfg + acc.merge(MuonGeoModelCfg(flags)) + #from AtlasGeoModel.ForDetGeoModelConfig import ForDetGeometryCfg + #acc.merge(ForDetGeometryCfg(flags)) + from BeamPipeGeoModel.BeamPipeGMConfig import BeamPipeGeometryCfg + acc.merge(BeamPipeGeometryCfg(flags)) + if (flags.Detector.Simulate and flags.Beam.Type == "cosmics") or flags.Detector.SimulateCavern: + from CavernInfraGeoModel.CavernInfraGeoModelConf import CavernInfraDetectorTool + gms.DetectorTools += [ CavernInfraDetectorTool() ] + return acc diff --git a/DetectorDescription/GeoModel/AtlasGeoModel/test/AtlasGeometryConfig_AOD_test.py b/DetectorDescription/GeoModel/AtlasGeoModel/test/AtlasGeometryConfig_AOD_test.py new file mode 100755 index 00000000000..cb09147b156 --- /dev/null +++ b/DetectorDescription/GeoModel/AtlasGeoModel/test/AtlasGeometryConfig_AOD_test.py @@ -0,0 +1,36 @@ +#!/usr/bin/env python +"""Run a test on Atlas Geometry configuration using a HITS file as input + +Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +""" +if __name__ == "__main__": + import os + from AthenaCommon.Logging import log + from AthenaCommon.Constants import DEBUG + from AthenaCommon.Configurable import Configurable + from AthenaConfiguration.AllConfigFlags import ConfigFlags + from AthenaConfiguration.MainServicesConfig import MainServicesSerialCfg + from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg + from AtlasGeoModel.AtlasGeoModelConfig import AtlasGeometryCfg + # Set up logging and new style config + log.setLevel(DEBUG) + Configurable.configurableRun3Behavior = True + from AthenaConfiguration.TestDefaults import defaultTestFiles + # Provide MC input + ConfigFlags.Input.Files = defaultTestFiles.AOD + ConfigFlags.GeoModel.Align.Dynamic = True + ConfigFlags.lock() + + # Construct ComponentAccumulator + acc = MainServicesSerialCfg() + acc.merge(PoolReadCfg(ConfigFlags)) + acc.merge(AtlasGeometryCfg(ConfigFlags)) + #acc.getService("StoreGateSvc").Dump=True + acc.getService("ConditionStore").Dump=True + acc.printConfig(withDetails=True) + f=open('AtlasGeoModelCfg_HITS.pkl','w') + acc.store(f) + f.close() + ConfigFlags.dump() + # Execute and finish + acc.run(maxEvents=3) diff --git a/DetectorDescription/GeoModel/AtlasGeoModel/test/AtlasGeometryConfig_EVNT_test.py b/DetectorDescription/GeoModel/AtlasGeoModel/test/AtlasGeometryConfig_EVNT_test.py new file mode 100755 index 00000000000..97619ecd199 --- /dev/null +++ b/DetectorDescription/GeoModel/AtlasGeoModel/test/AtlasGeometryConfig_EVNT_test.py @@ -0,0 +1,41 @@ +#!/usr/bin/env python +"""Run a test on Atlas Geometry configuration using a EVNT file as input + +Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +""" +if __name__ == "__main__": + import os + from AthenaCommon.Logging import log + from AthenaCommon.Constants import DEBUG + from AthenaCommon.Configurable import Configurable + from AthenaConfiguration.AllConfigFlags import ConfigFlags + from AthenaConfiguration.MainServicesConfig import MainServicesSerialCfg + from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg + from AtlasGeoModel.AtlasGeoModelConfig import AtlasGeometryCfg + # Set up logging and new style config + log.setLevel(DEBUG) + Configurable.configurableRun3Behavior = True + from AthenaConfiguration.TestDefaults import defaultTestFiles + # Provide MC input + ConfigFlags.Input.Files = defaultTestFiles.EVNT + ConfigFlags.GeoModel.AtlasVersion = "ATLAS-R2-2016-01-00-01" + ConfigFlags.IOVDb.GlobalTag = "OFLCOND-MC16-SDR-16" + ConfigFlags.Detector.SimulatePixel = True + ConfigFlags.Detector.SimulateSCT = True + ConfigFlags.Detector.SimulateTRT = True + ConfigFlags.GeoModel.Align.Dynamic = False + ConfigFlags.lock() + + # Construct ComponentAccumulator + acc = MainServicesSerialCfg() + acc.merge(PoolReadCfg(ConfigFlags)) + acc.merge(AtlasGeometryCfg(ConfigFlags)) + #acc.getService("StoreGateSvc").Dump=True + acc.getService("ConditionStore").Dump=True + acc.printConfig(withDetails=True) + f=open('AtlasGeoModelCfg_EVNT.pkl','w') + acc.store(f) + f.close() + ConfigFlags.dump() + # Execute and finish + acc.run(maxEvents=3) diff --git a/DetectorDescription/GeoModel/AtlasGeoModel/test/AtlasGeometryConfig_HITS_test.py b/DetectorDescription/GeoModel/AtlasGeoModel/test/AtlasGeometryConfig_HITS_test.py new file mode 100755 index 00000000000..e9217f3fbe9 --- /dev/null +++ b/DetectorDescription/GeoModel/AtlasGeoModel/test/AtlasGeometryConfig_HITS_test.py @@ -0,0 +1,37 @@ +#!/usr/bin/env python +"""Run a test on Atlas Geometry configuration using a HITS file as input + +Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +""" +if __name__ == "__main__": + import os + from AthenaCommon.Logging import log + from AthenaCommon.Constants import DEBUG + from AthenaCommon.Configurable import Configurable + from AthenaConfiguration.AllConfigFlags import ConfigFlags + from AthenaConfiguration.MainServicesConfig import MainServicesSerialCfg + from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg + from AtlasGeoModel.AtlasGeoModelConfig import AtlasGeometryCfg + # Set up logging and new style config + log.setLevel(DEBUG) + Configurable.configurableRun3Behavior = True + from AthenaConfiguration.TestDefaults import defaultTestFiles + # Provide MC input + ConfigFlags.Input.Files = defaultTestFiles.HITS + ConfigFlags.IOVDb.GlobalTag = "OFLCOND-MC16-SDR-16" + ConfigFlags.GeoModel.Align.Dynamic = False + ConfigFlags.lock() + + # Construct ComponentAccumulator + acc = MainServicesSerialCfg() + acc.merge(PoolReadCfg(ConfigFlags)) + acc.merge(AtlasGeometryCfg(ConfigFlags)) + #acc.getService("StoreGateSvc").Dump=True + acc.getService("ConditionStore").Dump=True + acc.printConfig(withDetails=True) + f=open('AtlasGeoModelCfg_HITS.pkl','w') + acc.store(f) + f.close() + ConfigFlags.dump() + # Execute and finish + acc.run(maxEvents=3) -- GitLab