ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
MagneticField
MagFieldServices
share
test_magFieldCondAlg.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
import
sys
9
from
MagFieldServices.createDBForTest
import
createDB
10
folder =
'/EXT/DCS/MAGNETS/SENSORDATA'
11
sqlite =
'magfieldForTest.db'
12
13
14
# Testing IOVs and currents: (since LB, solenoid, toroids)
15
# Default test - should read both mag field files, and turn off fields for events 5 to 9, and back on for 10 to 14
16
currents = [(0, 7730, 20400),
17
(5, 0, 0),
18
(10, 7730, 20400)]
19
20
# Optional test: only toroid is on for whole run. Scale factor for solenoid will become 1 at event 5,
21
# but solenoid field will still be off
22
# currents = [(0, 0, 20400),
23
# (5, 7730, 20400),
24
# (10, 7730, 20400)]
25
26
# Optional test: only solenoid is on for whole run. Scale factor for toroid will become 1 at event 5,
27
# but toroid field will still be off
28
# currents = [(0, 7730, 0),
29
# (5, 7730, 20400),
30
# (10, 7730, 20400)]
31
32
33
# Create sqlite file with DCS currents
34
createDB(folder, sqlite, currents)
35
36
from
MagFieldServices.MagFieldServicesConfig
import
AtlasFieldCacheCondAlgCfg
37
from
AthenaConfiguration.MainServicesConfig
import
MainEvgenServicesCfg
38
from
AthenaConfiguration.ComponentFactory
import
CompFactory
39
from
AthenaConfiguration.AllConfigFlags
import
initConfigFlags
40
41
flags = initConfigFlags()
42
flags.Input.Files = []
43
flags.Concurrency.NumThreads = 1
44
flags.Exec.MaxEvents = currents[-1][0]+5
# 5 events per IOV
45
46
#Run3 for now
47
from
AthenaConfiguration.TestDefaults
import
defaultGeometryTags
48
flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN3
49
50
51
flags.IOVDb.GlobalTag =
'CONDBR2-BLKPA-RUN2-01'
52
flags.IOVDb.SqliteInput = sqlite
53
flags.IOVDb.SqliteFolders = (folder,)
54
flags.lock()
55
56
acc = MainEvgenServicesCfg(flags)
57
acc.getService(
'EventSelector'
).EventsPerLB = 1
58
59
acc.merge(AtlasFieldCacheCondAlgCfg(flags, LockMapCurrents=
False
))
60
61
acc.addEventAlgo(CompFactory.MagField.CondReader(
'MagFieldCondReader'
))
62
63
sys.exit(acc.run().isFailure())
Generated on
for ATLAS Offline Software by
1.17.0