5 from __future__
import print_function
9 from TileCoolDcs
import TileDCSDataInfo
14 re_ai = re.compile(
"ATLTILLV(\\d{2})(:ELMB/LVCAN.*_)(\\d*)/AI/M5VMB_TEMP2.value")
15 re_states = re.compile(
"ATLTILLV(\\d{2})(:ELMB/LVCAN.*_)(\\d*)/states.ForDAQ_MBHV")
16 re_hv = re.compile(
"ATLTILLV(\\d{2}):Drawer(\\d*).Readings.Monitoring.hvOut1.value")
17 re_hvset = re.compile(
"ATLTILLV(\\d{2}):Drawer(\\d*).Readings.Requests.hvOut1.order")
18 re_daq = re.compile(
"ATLTILSCS:DAQ(.*).state")
21 partitionID = { 0 :
"EBA",
30 info = TileDCSDataInfo.TileDCSDataInfo()
31 dbstring=info.get_dbstring(
'ORACLE',
int(par[1])
if len(par)>1
and par[1].isdigit()
else 2)
36 print (
"Connecting to",dbstring[0])
38 db = ROOT.TSQLServer.Connect( dbstring[0], dbstring[1], dbstring[2])
41 statement =
"select ELEMENT_NAME, SYS_ID, DP_ID from ATLAS_PVSSTIL.elements"
42 stmt = db.Statement(statement)
43 if stmt.Process()
is True:
45 while stmt.NextResultRow():
47 element_name = stmt.GetString(0)
48 sys_id = stmt.GetString(1)
49 dp_id = stmt.GetString(2)
52 channel_id = dp_id + (
'000'+sys_id)[-3:]
55 result_ai = re_ai.search(element_name)
56 result_states = re_states.search(element_name)
57 result_hv = re_hv.search(element_name)
58 result_hvset = re_hvset.search(element_name)
59 result_daq = re_daq.search(element_name)
62 partition = partitionID[
int(result_ai.groups()[0])]
63 drawer = partition+(
'00'+result_ai.groups()[2])[-2:]
65 for part
in result_ai.groups():
68 buffer.append(
"/TILE/DCS/AI\t%s\t%s\t%s\n"%(drawer,channel_id,oracleId) )
71 partition = partitionID[
int(result_states.groups()[0])]
72 drawer = partition+(
'00'+result_states.groups()[2])[-2:]
74 for part
in result_states.groups():
77 buffer.append(
"/TILE/DCS/STATES\t%s\t%s\t%s\n"%(drawer,channel_id,oracleId) )
80 part = result_hv.groups()
81 partition = partitionID[
int(part[0])]
82 drawer = partition+(
'00'+part[1])[-2:]
83 oracleId =
"ATLTILLV"+part[0]
84 oracleId +=
":Drawer"+part[1]+
".Readings.Monitoring"
85 buffer.append(
"/TILE/DCS/HV\t%s\t%s\t%s\n"%(drawer,channel_id,oracleId) )
88 part = result_hvset.groups()
89 partition = partitionID[
int(part[0])]
90 drawer = partition+(
'00'+part[1])[-2:]
91 oracleId =
"ATLTILLV"+part[0]
92 oracleId +=
":Drawer"+part[1]+
".Readings.Requests"
93 buffer.append(
"/TILE/DCS/HVSET\t%s\t%s\t%s\n"%(drawer,channel_id,oracleId) )
96 part = result_daq.groups()
97 partition = part[0][:3]
98 oracleId =
"ATLTILSCS:DAQ"+partition+
".state"
100 drawer = partition +
"XX"
101 buffer.append(
"/DAQdummy/%s/DAQdummy\t%s\t%s\t%s\n"%(partition,drawer,channel_id,oracleId) )
105 oldname=info.find_data_file(
"cool_channel_id.dat")
106 newname=
"cool_channel_id.dat"
107 print (
"Old file:", oldname)
108 print (
"New file:", newname)