ATLAS Offline Software
test_magFieldSolenoid.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 #
3 # Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
4 #
5 # Test magnetic field conditions algs with varying currents.
6 #
7 # Folder name
8 from AthenaConfiguration.AllConfigFlags import initConfigFlags
9 from AthenaConfiguration.ComponentFactory import CompFactory
10 from AthenaConfiguration.MainServicesConfig import MainEvgenServicesCfg
11 from MagFieldServices.MagFieldServicesConfig import AtlasFieldCacheCondAlgCfg
12 import sys
13 from MagFieldServices.createDBForTest import createDB
14 folder = '/EXT/DCS/MAGNETS/SENSORDATA'
15 sqlite = 'magFieldSolenoid.db'
16 
17 
18 # Default test - should read both mag field fields
19 currents = [(0, 7730, 20400)]
20 
21 # Create sqlite file with DCS currents
22 createDB(folder, sqlite, currents)
23 
24 
25 flags = initConfigFlags()
26 flags.Input.Files = []
27 flags.Exec.MaxEvents = 1
28 flags.IOVDb.GlobalTag = 'CONDBR2-BLKPA-RUN2-01'
29 flags.IOVDb.SqliteInput = sqlite
30 flags.IOVDb.SqliteFolders = (folder,)
31 flags.lock()
32 
34 acc.getService('EventSelector').EventsPerLB = 1
35 
36 acc.merge(AtlasFieldCacheCondAlgCfg(flags, LockMapCurrents=False))
37 
38 acc.addEventAlgo(CompFactory.MagField.SolenoidTest('MagFieldSolenoidTest',
39  StepsR=5, StepsZ=5,
40  StepsPhi=5, HistStreamName="SolenoidTest"))
41 acc.addService(CompFactory.THistSvc(
42  Output=["SolenoidTest DATAFILE='solenoidTest.root' OPT='RECREATE'"]))
43 
44 sys.exit(acc.run().isFailure())
python.createDBForTest.createDB
def createDB(folder, sqlite, currents)
Definition: createDBForTest.py:5
python.MainServicesConfig.MainEvgenServicesCfg
def MainEvgenServicesCfg(flags, LoopMgr="AthenaEventLoopMgr", withSequences=True)
Definition: MainServicesConfig.py:353
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19
python.MagFieldServicesConfig.AtlasFieldCacheCondAlgCfg
def AtlasFieldCacheCondAlgCfg(flags, **kwargs)
Definition: MagFieldServicesConfig.py:8