3 """Define method to construct configured Tile cabling service"""
5 from AthenaConfiguration.AccumulatorCache
import AccumulatorCache
6 from AthenaConfiguration.ComponentFactory
import CompFactory
7 from AthenaConfiguration.Enums
import LHCPeriod
12 """Return component accumulator with configured Tile cabling service
15 flags -- Athena configuration flags
18 from AthenaCommon.Logging
import logging
19 msg = logging.getLogger(
'TileCablingSvc')
21 from AthenaConfiguration.ComponentAccumulator
import ComponentAccumulator
24 from TileGeoModel.TileGMConfig
import TileGMCfg
27 tileCablingSvc = CompFactory.TileCablingSvc()
29 geometry = flags.GeoModel.AtlasVersion
31 if not flags.Common.isOnline:
32 runNumber = flags.Input.RunNumbers[0]
33 if flags.Input.OverrideRunNumber > 0:
34 from AthenaKernel.EventIdOverrideConfig
import getMinMaxRunNumbers
36 if flags.GeoModel.Run
is LHCPeriod.Run1:
37 if runNumber > 219651:
39 tileCablingSvc.CablingType = 4
40 msg.warning(
"Forcing RUN2 cabling for run %s with geometry %s", runNumber, geometry)
42 elif flags.GeoModel.Run
is LHCPeriod.Run2:
43 if (flags.Input.isMC
and runNumber >= 310000)
or runNumber >= 343000
or runNumber < 1:
45 tileCablingSvc.CablingType = 5
46 msg.info(
"Forcing RUN2a (2018) cabling for run %s with geometry %s", runNumber, geometry)
49 tileCablingSvc.CablingType = 4
50 msg.info(
"Forcing RUN2 (2014-2017) cabling for run %s with geometry %s", runNumber, geometry)
51 elif flags.GeoModel.Run
is LHCPeriod.Run3:
52 tileCablingSvc.CablingType = 6
53 msg.info(
"Forcing RUN3 cabling for run %s with geometry %s", flags.GeoModel.Run.value, geometry)
55 if flags.GeoModel.Run
is LHCPeriod.Run1:
56 tileCablingSvc.CablingType = 4
57 msg.warning(
"Forcing RUN2 (2014-2017) cabling for unknown run number and geometry %s", geometry)
58 if flags.GeoModel.Run
is LHCPeriod.Run2:
59 tileCablingSvc.CablingType = 5
60 msg.info(
"Forcing RUN2a (2018) cabling for online run with geometry %s", geometry)
61 elif flags.GeoModel.Run
is LHCPeriod.Run3:
62 tileCablingSvc.CablingType = 6
63 msg.info(
"Forcing RUN3 cabling for online run with geometry %s", geometry)
64 elif flags.GeoModel.Run
is LHCPeriod.Run4:
65 tileCablingSvc.CablingType = 6
66 msg.warning(
"Forcing RUN3 cabling beyond Run3 for online run with geometry %s", geometry)
68 msg.error(
"Tile Cabling version not set for %s", geometry)
70 acc.addService(tileCablingSvc, primary =
True)
75 if __name__ ==
"__main__":
77 from AthenaConfiguration.ComponentAccumulator
import ComponentAccumulator
78 from AthenaConfiguration.AllConfigFlags
import initConfigFlags
79 from AthenaConfiguration.TestDefaults
import defaultTestFiles
80 from AthenaCommon.Logging
import log
87 flags.Input.Files = defaultTestFiles.RAW_RUN2
93 acc.printConfig(withDetails =
True, summariseProps =
True)
94 print(acc.getService(
'TileCablingSvc'))
95 acc.store(
open(
'TileCablingSvc.pkl',
'wb') )