ATLAS Offline Software
Loading...
Searching...
No Matches
integrator_readDb.py
Go to the documentation of this file.
1#!/bin/env python
2
3# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
4#
5# integrator_readDb.py
6# Nils Gollub <nils.gollub@cern.ch>, 2008-02-07
7
8import sys
9
10#=== process command line arguments
11usage = "Usage: integrator_readDb.py [\"yyyy-mm-dd hh:mm:ss\"]"
12if (len(sys.argv)>2) or ("-h" in sys.argv) or ("--help" in sys.argv):
13 print (usage)
14 sys.exit(0)
15sys.argv.pop(0)
16pointInTime = -1
17if len(sys.argv)>0:
18 pointInTime = sys.argv.pop(0)
19
20#=== get a logger
21from TileCalibBlobPython.TileCalibLogger import getLogger
22log = getLogger("int_readDb")
23
24#=== open the database
25from TileCalibBlobPython import TileCalibTools
26db = TileCalibTools.openDb('SQLITE', 'CONDBR2', 'READONLY')
27
28#=== get a blob writer
29blobReader = TileCalibTools.TileBlobReader(db,"/TILE/ONL01/INTEGRATOR")
30
31#=== write out the comment
32comment = blobReader.getComment(pointInTime)
33log.info("Comment: \"%s\"", comment)
34
35#=== write out all values
36for ros in range(1,5):
37 for mod in range(64):
38
39 #=== get the drawer
40 cd = blobReader.getDrawer(ros,mod,pointInTime)
41 #=== check if data is avialable and continue if not
42 if not cd:
43 continue
44
45 for pmt in range(48):
46 for gain in range(6):
47 outStr = "ros/mod/pmt/gain = %i/%2i/%2i/%i : " % (ros,mod,pmt,gain)
48 outStr+= "gain=%f+/-%f " % (cd.getData(pmt,gain,0),cd.getData(pmt,gain,1))
49 outStr+= "ped=%f+/-%f " % (cd.getData(pmt,gain,4),cd.getData(pmt,gain,5))
50 outStr+= "rms=%f+/-%f " % (cd.getData(pmt,gain,6),cd.getData(pmt,gain,7))
51 outStr+= "dac=%3i chi2=%f" % (cd.getData(pmt,gain,3),cd.getData(pmt,gain,2))
52 log.info(outStr)
53
54
55#=== close the database connection
56db.closeDatabase()