ATLAS Offline Software
Loading...
Searching...
No Matches
python.createDBForTest Namespace Reference

Functions

 createDB (folder, sqlite, currents)

Function Documentation

◆ createDB()

python.createDBForTest.createDB ( folder,
sqlite,
currents )
Create sqlite file with DCS currents

Definition at line 5 of file createDBForTest.py.

5def 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))
void print(char *figname, TCanvas *c1)