3 generate_mdt_mapping.py -- a script to generate the MDT channel mapping for HV, LV, JTAG from the COOL database.
13 https://svnweb.cern.ch/trac/atlasoff/browser/DataQuality/DQUtils/tags/DQUtils-00-01-04/python/db.py
14 https://svnweb.cern.ch/trac/atlasoff/browser/DataQuality/DQUtils/tags/DQUtils-00-01-04/python/channel_mapping.py
18 [afs] asetup 20.1.4.7,here
19 [afs] python generate_mdt_mapping.py > mdt_codes.dat
21 Two exceptions, thanks to George Iakovidis and Stephanie Zimmerman:
22 * BOG0B12, BOG0B14 are associated to BOG0A12, BOG0A14 because they are located at z=0.
23 * BME5A13, BME5C13 share the same HV, LV with BME4A13, BME4C13 respectively (bigger chambers with 2xCSM)
28 from DQUtils
import Databases
29 from DQUtils.channel_mapping
import get_channel_ids_names
31 database =
"COOLOFL_DCS/CONDBR2"
33 MDTBA, MDTBC, MDTEA, MDTEC = 302, 303, 304, 305
36 """ e.g., translate BOF7C12 to MDTBC """
38 if key[0] ==
"B" and key[4] ==
"A":
return MDTBA
39 if key[0] ==
"B" and key[4] ==
"B":
return MDTBA
40 if key[0] ==
"B" and key[4] ==
"C":
return MDTBC
41 if key[0] ==
"E" and key[4] ==
"A":
return MDTEA
42 if key[0] ==
"E" and key[4] ==
"C":
return MDTEC
50 all_keys = hv.keys() + lv.keys() + jt.keys()
51 string_keys =
filter(
lambda key: isinstance(key, str), all_keys)
54 for key
in string_keys:
56 region, folder = key.split(
"__")
57 region_keys.add(region)
59 for key
in sorted(region_keys):
60 line =
"%-6s %-6s %-6s %-8s %3s" % (hv.get(key+
"__HV", 0),
61 lv.get(key+
"__LV", 0),
62 jt.get(key+
"__JTAG", 0),
68 if key ==
"BOG0A12" and "BOG0B12" in region_keys:
continue
69 if key ==
"BOG0A14" and "BOG0B14" in region_keys:
continue
70 if key ==
"BOG0B12": line = line.replace(
"%-6s BOG0B12" % (0),
"%-6s BOG0A12" % (jt[
"BOG0A12__JTAG"]))
71 if key ==
"BOG0B14": line = line.replace(
"%-6s BOG0B14" % (0),
"%-6s BOG0A14" % (jt[
"BOG0A14__JTAG"]))
72 if key ==
"BME5A13": line = line.replace(
"%-6s %-6s" % (0, 0),
"%-6s %-6s" % (hv[
"BME4A13__HV"], lv[
"BME4A13__LV"]))
73 if key ==
"BME5C13": line = line.replace(
"%-6s %-6s" % (0, 0),
"%-6s %-6s" % (hv[
"BME4C13__HV"], lv[
"BME4C13__LV"]))
79 if __name__ ==
"__main__":