Skip to content
Snippets Groups Projects
Forked from faser / calypso
1261 commits behind the upstream repository.
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
FaserGeometryConfig_EVNT_test.py 2.13 KiB
#!/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
    import sys
    from AthenaCommon.Logging import log
    from AthenaCommon.Constants import VERBOSE, INFO
    from AthenaCommon.Configurable import Configurable
    from CalypsoConfiguration.AllConfigFlags import ConfigFlags
    from CalypsoConfiguration.MainServicesConfig import MainServicesCfg
    from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
    # Set up logging and new style config
    from FaserGeoModel.FaserGeoModelConfig import FaserGeometryCfg
    log.setLevel(VERBOSE)
    Configurable.configurableRun3Behavior = True

    from AthenaConfiguration.TestDefaults import defaultTestFiles
    # Provide MC input
    ConfigFlags.Input.Files = defaultTestFiles.EVNT
    ConfigFlags.GeoModel.FaserVersion = "FASER-01"
    ConfigFlags.Detector.SimulateVeto               = True
    ConfigFlags.Detector.SimulateFaserSCT           = True
    ConfigFlags.Detector.SimulateUpstreamDipole     = True
    ConfigFlags.Detector.SimulateCentralDipole      = True
    ConfigFlags.Detector.SimulateDownstreamDipole   = True
    ConfigFlags.IOVDb.GlobalTag = "OFLCOND-XXXX-XXX-XX"
    ConfigFlags.GeoModel.Align.Dynamic    = False
    ConfigFlags.lock()

    # Construct ComponentAccumulator
    acc = MainServicesCfg(ConfigFlags)
    acc.merge(PoolReadCfg(ConfigFlags))
    acc.merge(FaserGeometryCfg(ConfigFlags))
    # acc.getService("StoreGateSvc").Dump=True
    # acc.getService("ConditionStore").Dump=True

    # from GaudiCoreSvc.GaudiCoreSvcConf import MessageSvc
    # msgSvc = MessageSvc()
    # acc.addService(msgSvc)

    from AthenaCommon.Logging import logging
    logging.getLogger('forcomps').setLevel(VERBOSE)
    acc.foreach_component("*").OutputLevel = VERBOSE

    acc.foreach_component("*ClassID*").OutputLevel = INFO
    
    acc.printConfig(withDetails=True)
    f=open('FaserGeoModelCfg_EVNT.pkl','wb')
    acc.store(f)
    f.close()
    ConfigFlags.dump()
    # Execute and finish
    sys.exit(int(acc.run(maxEvents=3).isFailure()))