3 from pkg_resources
import resource_string
5 from ..lib
import (DCSC_DefectTranslate_Subdetector,
6 DCSC_Variable_With_Mapping,
10 MDTBA, MDTBC, MDTEA, MDTEC = 302, 303, 304, 305
14 Creates dictionaries representing the mappings
15 for different systems onto the chamber name.
20 hv, lv, jtag, name, output_channel = line.split()
21 return int(hv),
int(lv),
int(jtag), name,
int(output_channel)
23 mdtcodes = resource_string(
"DCSCalculator2.subdetectors.data",
"mdt_codes.dat").
decode().strip().
split(
"\n")
26 lines = [line
for line
in [fix_line(raw_line)
for raw_line
in mdtcodes
if raw_line]
if line]
28 name_to_output =
make_multi_mapping((name, output_channel)
for hv, lv, jtag, name, output_channel
in lines)
29 hv_to_name =
make_multi_mapping((hv, name)
for hv, lv, jtag, name, output_channel
in lines)
30 lv_to_name =
make_multi_mapping((lv, name)
for hv, lv, jtag, name, output_channel
in lines)
31 jtag_to_name =
make_multi_mapping((jtag, name)
for hv, lv, jtag, name, output_channel
in lines)
32 name_to_name =
make_multi_mapping((name, name)
for hv, lv, jtag, name, output_channel
in lines)
34 return name_to_output, hv_to_name, lv_to_name, jtag_to_name, name_to_name
39 Some chambers dont have a second multilayer (ML2).
40 Dont flag these as bad.
42 if iov.channel
in range(245, 253):
45 iov.fsmCurrentState_ML1
in [
"ON"]
and iov.v1set_ML1 >= 2730
and
46 ((iov.fsmCurrentState_ML2
in [
"ON"]
and iov.v1set_ML2 >= 2730)
or iov.fsmCurrentState_ML2 ==
"")
52 iov.fsmCurrentState_ML1 ==
"STANDBY" and iov.v0set_ML1 >= 2730
and
53 iov.fsmCurrentState_ML2 ==
"STANDBY" and iov.v0set_ML2 >= 2730
59 iov.fsmCurrentState_ML1
in [
"ON"]
and iov.v1set_ML1 >= 3050
and
60 ((iov.fsmCurrentState_ML2
in [
"ON"]
and iov.v1set_ML2 >= 3050)
or iov.fsmCurrentState_ML2 ==
"")
66 iov.fsmCurrentState_ML1 ==
"STANDBY" and iov.v0set_ML1 >= 3050
and
67 iov.fsmCurrentState_ML2 ==
"STANDBY" and iov.v0set_ML2 >= 3050
85 return iov.fsmCurrentState_LV ==
"ON"
88 return iov.fsmCurrentState_JTAG ==
"INITIALIZED"
92 The MDTs require a channel mapping to map channelids from different folders
93 onto a consistent numbering scheme. Here we use the chamber name (e.g., BIS2C08)
94 as the "master" channel. Everything else is mapped on to this.
96 folder_base =
"/MDT/DCS"
102 super(MDT, self).
__init__(*args, **kwargs)
105 name_to_output, hv_to_name, lv_to_name, jtag_to_name, name_to_name = mappings
117 self.
translators = [MDT.color_to_defect_translator(flag, defect)
for flag, defect
in ((MDTBA,
'MS_MDT_BA_STANDBY_HV'),
118 (MDTBC,
'MS_MDT_BC_STANDBY_HV'),
119 (MDTEA,
'MS_MDT_EA_STANDBY_HV'),
120 (MDTEC,
'MS_MDT_EC_STANDBY_HV'),
130 dead_fraction_caution =
None
131 dead_fraction_bad = 0.1