ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
MagneticField
MagFieldServices
python
createDBForTest.py
Go to the documentation of this file.
1
#
2
# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3
#
4
5
def
createDB
(folder, sqlite, currents):
6
"""Create sqlite file with DCS currents"""
7
import
os
8
os.environ[
'CLING_STANDARD_PCH'
] =
'none'
# See bug ROOT-10789
9
from
PyCool
import
cool
10
from
CoolConvUtilities
import
AtlCoolLib, AtlCoolTool
11
12
# Cleanup previous file
13
if
os.path.isfile(sqlite):
14
os.remove(sqlite)
15
16
db = cool.DatabaseSvcFactory.databaseService().createDatabase(
17
f
'sqlite://;schema={sqlite};dbname=CONDBR2'
)
18
spec = cool.RecordSpecification()
19
spec.extend(
"value"
, cool.StorageType.Float)
20
spec.extend(
"quality_invalid"
, cool.StorageType.Bool)
21
f = AtlCoolLib.ensureFolder(
22
db, folder, spec, AtlCoolLib.athenaDesc(
True
,
'CondAttrListCollection'
))
23
24
for
v
in
currents:
25
sol = cool.Record(spec)
26
sol[
'value'
] = v[1]
27
sol[
'quality_invalid'
] =
False
28
tor = cool.Record(spec)
29
tor[
'value'
] = v[2]
30
tor[
'quality_invalid'
] =
False
31
f.storeObject(v[0], cool.ValidityKeyMax, sol, 1)
# channel 1
32
f.storeObject(v[0], cool.ValidityKeyMax, tor, 3)
# channel 3
33
34
# print database content
35
act =
AtlCoolTool.AtlCoolTool
(db)
36
print
(act.more(folder))
print
void print(char *figname, TCanvas *c1)
Definition
TRTCalib_StrawStatusPlots.cxx:26
python.AtlCoolTool.AtlCoolTool
Definition
AtlCoolTool.py:163
python.createDBForTest.createDB
createDB(folder, sqlite, currents)
Definition
createDBForTest.py:5
Generated on
for ATLAS Offline Software by
1.17.0