9 Keeps a list of drawer, variable <---> folder, channel
10 associations and provides information about the available
11 variables and their datatypes.
14 LVPS_AI = (
"/TILE/DCS/",
"AI")
15 LVPS_STATES = (
"/TILE/DCS/",
"STATES")
16 VARS_HV = (
"/TILE/DCS/",
"HV")
17 VARS_HVSET = (
"/TILE/DCS/",
"HVSET")
18 VARS_DAQ = (
"/DAQdummy/",
"/DAQdummy")
19 type_float = (
'f',
'/F')
22 vars_LVPS_STATES = {
"FORDAQ_MB" : [ LVPS_STATES, type_int],
23 "FORDAQ_HV" : [ LVPS_STATES, type_int],
24 "FORDAQ_MBHV" : [ LVPS_STATES, type_int]}
26 vars_LVPS_AI = {
"15VMB_OUTPUT_I" : [ LVPS_AI, type_float],
27 "M5VMB_TEMP2" : [ LVPS_AI, type_float],
28 "M5VMB_SENSES" : [ LVPS_AI, type_float],
29 "M5VMB_OUTPUT_V" : [ LVPS_AI, type_float],
30 "M5VMB_OUTPUT_I" : [ LVPS_AI, type_float],
31 "M5VMB_INPUT_V" : [ LVPS_AI, type_float],
32 "15VHV_INPUT_V" : [ LVPS_AI, type_float],
33 "M15VHV_TEMP3" : [ LVPS_AI, type_float],
34 "M15VHV_TEMP2" : [ LVPS_AI, type_float],
35 "15VHV_OUTPUT_I" : [ LVPS_AI, type_float],
36 "M15VHV_OUTPUT_V" : [ LVPS_AI, type_float],
37 "M15VHV_OUTPUT_I" : [ LVPS_AI, type_float],
38 "M15VHV_INPUT_V" : [ LVPS_AI, type_float],
39 "15VHV_OUTPUT_V" : [ LVPS_AI, type_float],
40 "EXT_TEMP2" : [ LVPS_AI, type_float],
41 "15VMB_TEMP3" : [ LVPS_AI, type_float],
42 "3VDIG_INPUT_V" : [ LVPS_AI, type_float],
43 "3VDIG_OUTPUT_I" : [ LVPS_AI, type_float],
44 "3VDIG_OUTPUT_V" : [ LVPS_AI, type_float],
45 "3VDIG_SENSES" : [ LVPS_AI, type_float],
46 "15VMB_TEMP2" : [ LVPS_AI, type_float],
47 "3VDIG_TEMP2" : [ LVPS_AI, type_float],
48 "3VDIG_TEMP3" : [ LVPS_AI, type_float],
49 "15VMB_SENSES" : [ LVPS_AI, type_float],
50 "5VDIG_INPUT_V" : [ LVPS_AI, type_float],
51 "5VDIG_OUTPUT_I" : [ LVPS_AI, type_float],
52 "5VDIG_OUTPUT_V" : [ LVPS_AI, type_float],
53 "5VDIG_SENSES" : [ LVPS_AI, type_float],
54 "15VMB_OUTPUT_V" : [ LVPS_AI, type_float],
55 "5VDIG_TEMP2" : [ LVPS_AI, type_float],
56 "5VDIG_TEMP3" : [ LVPS_AI, type_float],
57 "M5VMB_TEMP3" : [ LVPS_AI, type_float],
58 "5VHV_INPUT_V" : [ LVPS_AI, type_float],
59 "5VHV_OUTPUT_I" : [ LVPS_AI, type_float],
60 "5VHV_OUTPUT_V" : [ LVPS_AI, type_float],
61 "15VMB_INPUT_V" : [ LVPS_AI, type_float],
63 "5VHV_TEMP2" : [ LVPS_AI, type_float],
64 "5VHV_TEMP3" : [ LVPS_AI, type_float],
65 "15VHV_TEMP3" : [ LVPS_AI, type_float],
66 "5VMB_INPUT_V" : [ LVPS_AI, type_float],
67 "5VMB_OUTPUT_I" : [ LVPS_AI, type_float],
68 "5VMB_OUTPUT_V" : [ LVPS_AI, type_float],
69 "5VMB_SENSES" : [ LVPS_AI, type_float],
70 "15VHV_TEMP2" : [ LVPS_AI, type_float],
71 "5VMB_TEMP2" : [ LVPS_AI, type_float],
72 "5VMB_TEMP3" : [ LVPS_AI, type_float],
73 "EXT_TEMP1" : [ LVPS_AI, type_float]}
78 vars_HV[
"hvOut"+i] = [ VARS_HV, type_float ]
81 vars_HV[
"hvIn"+i] = [ VARS_HV, type_float ]
84 vars_HV[
"volt"+i] = [ VARS_HV, type_float ]
85 vars_HV[
"temp"+i] = [ VARS_HV, type_float ]
90 vars_HVSET[
"Set.hvOut"+i] = [ VARS_HVSET, type_float ]
93 vars_HVSET[
"Set.hvIn"+i] = [ VARS_HVSET, type_float ]
96 vars_HVSET[
"Set.volt"+i] = [ VARS_HVSET, type_float ]
97 vars_HVSET[
"Set.temp"+i] = [ VARS_HVSET, type_float ]
103 vars_DAQ[
"STATE"] = [ VARS_DAQ, type_int]
105 systemID = {
"LBA" : 88 ,
111 partitionID = { 0 :
"EBA",
120 self.
vars[var] = info
122 self.
vars[var] = info
124 self.
vars[var] = info
126 self.
vars[var] = info
128 self.
vars[var] = info
135 lines =
open(filename,
"r").readlines()
138 folder, drawer, channel, oracleId = line.split()
140 keyFolderDrawer = ( folder , drawer)
142 raise Exception (
"trying to generate key twice: ", keyFolderDrawer)
146 keyFolderChannel = ( folder ,
int(channel))
148 raise Exception (
"trying to generate key twice: ", keyFolderChannel)
151 self.
dbstring = {
"DEFAULT":[],
"COOL":[],
"ORACLE":[],
"TESTBEAM":[]}
152 self.
dbstring[
'DEFAULT'] += [dbstring]*3
153 dbstring =
"oracle://ATLAS_COOLPROD;schema=ATLAS_COOLOFL_DCS;dbname=COMP200;"
154 dbstring+=
"user=ATLAS_COOL_READER;password=COOLRED4PRO"
157 self.
dbstring[
'COOL'] += [dbstring.replace(
"COMP200",
"CONDBR2")]
158 self.
dbstring[
'ORACLE'] += [[
"oracle://localhost/ATONR_PVSSPROD",
"ATLAS_PVSS_READER",
"PVSSRED4PRO"]]
159 self.
dbstring[
'ORACLE'] += [[
"oracle://localhost/ATLAS_PVSSPROD",
"ATLAS_PVSS_READER",
"PVSSRED4PRO"]]
160 self.
dbstring[
'ORACLE'] += [[
"oracle://localhost/ATONR_ADG",
"ATLAS_PVSS_READER",
"PVSSRED4PRO"]]
161 self.
dbstring[
'TESTBEAM'] += [[
"oracle://localhost/INTR",
"ATLAS_PVSS_READER",
"PVSSRED4INT"]]*3
170 raise Exception (
"ERROR: drawer not valid: ", drawer)
171 key = (folder, drawer )
173 print (
"get_channel WARNING, can not resolve key: ", key)
179 key = (folder, channel)
181 print (
"get_drawer WARNING, can not resolve key: ", key)
188 For a given DCS variable and drawer, return the complete COOL
189 folder name and the channel number associated to the drawer
191 if variable
not in self.
vars:
192 raise Exception (
"Variable not known: ", variable)
193 partition = drawer[0:3]
195 folderDef = self.
vars[variable][0]
197 if variable==
"STATE":
198 drawer = partition+
"XX"
199 folder = folderDef[0]+partition+folderDef[1]
201 folder = folderDef[0]+folderDef[1]
202 key = (folder, drawer)
204 print (
"WARNING, can not resolve key: ", key)
207 return (folder, channel)
211 Returns the type of a variable
213 if variable
not in self.
vars:
214 raise Exception (
"Variable not known: ", variable)
215 return self.
vars[variable][1]
221 partition = drawer[0:3]
222 drawerNum =
int(drawer[3:5])
223 valid = (
"LBA" ,
"LBC",
"EBA",
"EBC")
224 if partition
not in valid:
226 if drawerNum<1
or drawerNum>64:
232 Return a dictionary listing all folders that need to be
233 accessed as keys and all variables associated to the key folder
237 for var
in variables:
238 if var
not in self.
vars:
239 print (
"Unknown variable, IGNORING IT: ", var)
242 if folder
not in folderDict:
243 folderDict[folder] = [var]
245 folderDict[folder].
extend([var])
249 """the python equivalent to the C++ PathResolver for datafiles.
253 pathlist = os.getenv(
'DATAPATH').
split(os.pathsep)
255 for path
in pathlist:
256 f = os.path.join( path, fname )
257 if os.access( f, access ):