8 sys.argv=[sys.argv[0],
'-b']
10 from ROOT
import TGraph, TSpline3
14 meta_schema = {
'MP':
'ATLAS_MUONCALIBR_MPI',
'UM' :
'ATLAS_MUONCALIBR_UM',
'RM' :
'ATLAS_MUONCALIBR_RM'}
15 cursor.execute(
"select data_schema from " + meta_schema[db] +
".MDT_HEAD where head_id=:hid", {
'hid': head_id})
16 return cursor.fetchone()[0]
20 gr.SetName(
"gr_" +
str(rt_id))
21 for i
in range(0, len(r)):
22 gr.SetPoint(i, r[i], t[i])
23 sp=TSpline3(
"sp_" +
str(rt_id), gr)
25 id_str=up.stationNameString() +
"_" +
str(up.stationPhi()) +
"_" +
str(up.stationEta())
26 gr.Write(
"gr_" + id_str)
27 sp.Write(
"sp_" + id_str)
33 ra = CalibDbInfo.dbr[CalibDbInfo.calibdb]
34 tns = CalibDbInfo.tns[CalibDbInfo.calibdb]
36 reader_passwd = CalibDbInfo.dbr_password[CalibDbInfo.calibdb]
37 connection=cx_Oracle.connect(ra, reader_passwd, tns)
38 cursor=connection.cursor()
41 query=
"select rt.validflag, rt.region_id, mp.r, mp.t from " + data_schema +
".mdt_rt rt, " + data_schema +
".mdt_rt_map mp where mp.head_id=:hid and rt.head_id=:hid and rt.region_id= mp.region_id and mp.calibflag= rt.calibflag and mp.point_nr<rt.bins and rt.validflag>2 order by rt.region_id, mp.point_nr"
42 cursor.arraysize = 1000*100
44 cursor.execute(query, {
'hid': head_id})
50 for validflag_in, region_id, r_p, t_p
in cursor.fetchall():
70 ret.append(values[key])
74 ra = CalibDbInfo.dbr[CalibDbInfo.calibdb]
75 tns = CalibDbInfo.tns[CalibDbInfo.calibdb]
76 connection=cx_Oracle.connect(ra, reader_passwd, tns)
77 cursor=connection.cursor()
80 query=
"select CHAMBER, TUBE_ID, TO_NUMBER(P4), VALIDFLAG, TO_NUMBER(ADC_0) from " + data_schema +
".MDT_TUBE where head_id=:hid and validflag>2 order by chamber"
81 cursor.arraysize = 1000*400
82 cursor.execute(query, {
'hid': head_id})
86 filled_chambers=
set([])
87 for chamber, tube, t0, validflag, adc
in cursor.fetchall():
88 if prev_chamber != chamber:
91 t0s[(up.stationNameString(), up.stationPhi(), up.stationEta())] =
build_t0_vec(current_values)
92 filled_chambers.add(prev_chamber)
93 prev_chamber = chamber
96 tid=288 * (up.mdtMultilayer() - 1) + 72 * (up.mdtTubeLayer() - 1) + (up.mdtTube() - 1 )
97 current_values[tid] = (t0, validflag, adc)
99 t0s[(up.stationNameString(), up.stationPhi(), up.stationEta())] =
build_t0_vec(current_values)