Skip to content
Snippets Groups Projects
Commit c121d7e7 authored by Susumu Oda's avatar Susumu Oda Committed by Edward Moyse
Browse files

Add SCTSiPropertiesTestAlgConfig.py and run it in unit test.

parent fb5d41a9
No related branches found
No related tags found
No related merge requests found
"""Define methods to configure SiPropertiesTool """Define methods to configure SiPropertiesTool
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
""" """
from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
from AthenaConfiguration.ComponentFactory import CompFactory from AthenaConfiguration.ComponentFactory import CompFactory
from AtlasGeoModel.GeoModelConfig import GeoModelCfg
SCT_SiliconHVCondAlg=CompFactory.SCT_SiliconHVCondAlg SCT_SiliconHVCondAlg=CompFactory.SCT_SiliconHVCondAlg
SCT_SiliconTempCondAlg=CompFactory.SCT_SiliconTempCondAlg SCT_SiliconTempCondAlg=CompFactory.SCT_SiliconTempCondAlg
SCT_SiliconConditionsTool=CompFactory.SCT_SiliconConditionsTool SCT_SiliconConditionsTool=CompFactory.SCT_SiliconConditionsTool
...@@ -20,6 +21,7 @@ def SCT_SiliconConditionsCfg(flags, name="SCT_Silicon", **kwargs): ...@@ -20,6 +21,7 @@ def SCT_SiliconConditionsCfg(flags, name="SCT_Silicon", **kwargs):
DCSConditionsTool may be provided in kwargs DCSConditionsTool may be provided in kwargs
""" """
acc = ComponentAccumulator() acc = ComponentAccumulator()
acc.merge(GeoModelCfg(flags)) # For SCT_ID used in SCT_SiliconConditionsTool
CondArgs = {} CondArgs = {}
DCSConditionsTool = kwargs.get("DCSConditionsTool") DCSConditionsTool = kwargs.get("DCSConditionsTool")
if DCSConditionsTool: if DCSConditionsTool:
......
...@@ -43,6 +43,10 @@ atlas_add_test( TestSCTProperties ...@@ -43,6 +43,10 @@ atlas_add_test( TestSCTProperties
PROPERTIES TIMEOUT 300 PROPERTIES TIMEOUT 300
ENVIRONMENT THREADS=5 ) ENVIRONMENT THREADS=5 )
atlas_add_test( TestSCTPropertiesNewConf
SCRIPT python -m SiPropertiesTool.SCTSiPropertiesTestAlgConfig
PROPERTIES TIMEOUT 300 )
atlas_add_test( SiPropertiesConfig_test atlas_add_test( SiPropertiesConfig_test
SCRIPT test/SiPropertiesConfig_test.py SCRIPT test/SiPropertiesConfig_test.py
PROPERTIES TIMEOUT 300 ) PROPERTIES TIMEOUT 300 )
...@@ -50,4 +54,3 @@ atlas_add_test( SiPropertiesConfig_test ...@@ -50,4 +54,3 @@ atlas_add_test( SiPropertiesConfig_test
# Install files from the package: # Install files from the package:
atlas_install_python_modules( python/*.py ) atlas_install_python_modules( python/*.py )
atlas_install_joboptions( share/*.py ) atlas_install_joboptions( share/*.py )
"""Define method to configure and test SCTSiPropertiesTestAlg
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
"""
from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
from AthenaConfiguration.ComponentFactory import CompFactory
def SCTSiPropertiesTestAlgCfg(flags, name="SCTSiPropertiesTestAlg", **kwargs):
"""Return a configured SCTSiPropertiesTestAlg"""
acc = ComponentAccumulator()
from SiPropertiesTool.SCT_SiPropertiesConfig import SCT_SiPropertiesCfg
kwargs.setdefault("SCTPropertiesTool", acc.popToolsAndMerge(SCT_SiPropertiesCfg(flags)))
acc.addEventAlgo(CompFactory.SCTSiPropertiesTestAlg(**kwargs))
return acc
if __name__=="__main__":
from AthenaCommon.Logging import log
from AthenaCommon.Constants import INFO
log.setLevel(INFO)
from AthenaCommon.Configurable import Configurable
Configurable.configurableRun3Behavior=1
from AthenaConfiguration.AllConfigFlags import ConfigFlags
ConfigFlags.Input.isMC = True
ConfigFlags.Input.ProjectName = "mc16_13TeV"
ConfigFlags.Input.RunNumber = [300000] # MC16c 2017 run number
ConfigFlags.addFlag("Input.InitialTimeStamp", 1500000000) # MC16c 2017 time stamp
ConfigFlags.IOVDb.GlobalTag = "OFLCOND-MC16-SDR-18"
ConfigFlags.GeoModel.AtlasVersion = "ATLAS-R2-2015-03-01-00"
ConfigFlags.Detector.GeometrySCT = True
ConfigFlags.lock()
from AthenaConfiguration.MainServicesConfig import MainServicesCfg
cfg = MainServicesCfg(ConfigFlags)
from McEventSelector.McEventSelectorConfig import McEventSelectorCfg
cfg.merge(McEventSelectorCfg(ConfigFlags))
cfg.merge(SCTSiPropertiesTestAlgCfg(ConfigFlags))
cfg.run(maxEvents=20)
"""Define methods to configure SCT SiProperties """Define methods to configure SCT SiProperties
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
""" """
from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
from AthenaConfiguration.ComponentFactory import CompFactory from AthenaConfiguration.ComponentFactory import CompFactory
from SCT_ConditionsTools.SCT_DCSConditionsConfig import SCT_DCSConditionsCfg
from SCT_ConditionsTools.SCT_SiliconConditionsConfig import SCT_SiliconConditionsCfg
from SCT_GeoModel.SCT_GeoModelConfig import SCT_GeometryCfg
SiPropertiesTool=CompFactory.SiPropertiesTool SiPropertiesTool=CompFactory.SiPropertiesTool
SCTSiPropertiesCondAlg=CompFactory.SCTSiPropertiesCondAlg SCTSiPropertiesCondAlg=CompFactory.SCTSiPropertiesCondAlg
...@@ -19,6 +22,22 @@ def SCT_SiPropertiesCfg(flags, name="SCTSiPropertiesCondAlg", **kwargs): ...@@ -19,6 +22,22 @@ def SCT_SiPropertiesCfg(flags, name="SCTSiPropertiesCondAlg", **kwargs):
SiConditionsTool and/or SiPropertiesTool may be provided in kwargs SiConditionsTool and/or SiPropertiesTool may be provided in kwargs
""" """
acc = ComponentAccumulator() acc = ComponentAccumulator()
acc.merge(SCT_GeometryCfg(flags)) # For SCT_DetectorElementCollection used in SCTSiPropertiesCondAlg
DCSkwargs = {}
# For HLT
if flags.Common.isOnline and not flags.Input.isMC:
dcs_folder = "/SCT/HLT/DCS"
DCSkwargs["dbInstance"] = "SCT"
DCSkwargs["hvFolder"] = dcs_folder + "/HV"
DCSkwargs["tempFolder"] = dcs_folder + "/MODTEMP"
DCSkwargs["stateFolder"] = dcs_folder + "/CHANSTAT"
DCSAcc = SCT_DCSConditionsCfg(flags, **DCSkwargs)
SCAcc = SCT_SiliconConditionsCfg(flags, DCSConditionsTool=DCSAcc.popPrivateTools())
acc.merge(DCSAcc)
acc.merge(SCAcc)
tool = kwargs.get("SiPropertiesTool", SCT_SiPropertiesToolCfg(flags)) tool = kwargs.get("SiPropertiesTool", SCT_SiPropertiesToolCfg(flags))
alg = SCTSiPropertiesCondAlg(name, **kwargs) alg = SCTSiPropertiesCondAlg(name, **kwargs)
acc.addCondAlgo(alg) acc.addCondAlgo(alg)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment