ATLAS Offline Software
Loading...
Searching...
No Matches
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
8from AthenaConfiguration.AllConfigFlags import initConfigFlags
9from AthenaConfiguration.ComponentFactory import CompFactory
10from AthenaConfiguration.MainServicesConfig import MainEvgenServicesCfg
11from MagFieldServices.MagFieldServicesConfig import AtlasFieldCacheCondAlgCfg
12import sys
13from MagFieldServices.createDBForTest import createDB
14folder = '/EXT/DCS/MAGNETS/SENSORDATA'
15sqlite = 'magFieldSolenoid.db'
16
17
18# Default test - should read both mag field fields
19currents = [(0, 7730, 20400)]
20
21# Create sqlite file with DCS currents
22createDB(folder, sqlite, currents)
23
24
25flags = initConfigFlags()
26flags.Input.Files = []
27flags.Exec.MaxEvents = 1
28flags.IOVDb.GlobalTag = 'CONDBR2-BLKPA-RUN2-01'
29flags.IOVDb.SqliteInput = sqlite
30flags.IOVDb.SqliteFolders = (folder,)
31flags.lock()
32
33acc = MainEvgenServicesCfg(flags)
34acc.getService('EventSelector').EventsPerLB = 1
35
36acc.merge(AtlasFieldCacheCondAlgCfg(flags, LockMapCurrents=False))
37
38acc.addEventAlgo(CompFactory.MagField.SolenoidTest('MagFieldSolenoidTest',
39 StepsR=5, StepsZ=5,
40 StepsPhi=5, HistStreamName="SolenoidTest"))
41acc.addService(CompFactory.THistSvc(
42 Output=["SolenoidTest DATAFILE='solenoidTest.root' OPT='RECREATE'"]))
43
44sys.exit(acc.run().isFailure())