25 def __init__(self):
26
27 self.correctionsFromCOOL = {}
28 self.UNIX2COOL = 1000000000
29
30
31 dbSvc = cool.DatabaseSvcFactory.databaseService()
32
33 dbString = 'oracle://ATLAS_COOLPROD;schema=ATLAS_COOLONL_TRIGGER;dbname=CONDBR2'
34 try:
35 db = dbSvc.openDatabase(dbString, False)
36 except Exception as e:
37 print ('Error: Problem opening database', e)
38 sys.exit(1)
39
40 folder_name = "/TRIGGER/Receivers/Factors/HVCorrections"
41 folder=db.getFolder(folder_name)
42
43 startUtime = int(time.time())
44 endUtime = int(time.time())
45 startValKey = startUtime * self.UNIX2COOL
46 endValKey = endUtime * self.UNIX2COOL
47 chsel = cool.ChannelSelection(0,sys.maxsize)
48
49 try:
50 itr=folder.browseObjects(startValKey, endValKey, chsel)
51 except Exception as e:
52 print (e)
53 sys.exit(1)
54
55 for row in itr:
56 ReceiverId = hex(int(row.channelId()))
57 payload = row.payload()
58 HVCorrection = payload['factor']
59
60 self.correctionsFromCOOL[ReceiverId] = HVCorrection
61