ATLAS Offline Software
trt.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
2 
3 from DCSCalculator2.lib import DCSC_Subdetector, DCSC_Variable
4 from DQUtils.sugar import IOVSet
5 
6 def offset_channelids(iovs, offset):
7  return IOVSet(iov._replace(channel=iov.channel+offset) for iov in iovs)
8 
9 BAR_MAX_ID, ECA_MAX_ID, ECC_MAX_ID = 710, 640, 640
10 
11 # These six modules do not exist
12 BAR_REMOVED_IDS = 6
13 
14 # Strategy here is to remap the different folders onto different input channel
15 # id regions. Then we have to construct a modified mapping in TRT to map
16 # those inputs onto the outputs.
17 
18 class DCSC_Variable_TRT_HV(DCSC_Variable):
19  """
20  Different regions are stored in different folders, but they are the same
21  variable.
22  """
23 
24  def read(self, query_range, folder_base, folder_name):
25  normal_read = super(DCSC_Variable_TRT_HV, self).read
26 
27  iovs_bar = normal_read(query_range, folder_base, "HV/BARREL")
28  iovs_eca = normal_read(query_range, folder_base, "HV/ENDCAPA")
29  iovs_ecc = normal_read(query_range, folder_base, "HV/ENDCAPC")
30 
31  # Filter out unused IDs
32  iovs_bar = [i for i in iovs_bar if 0 < i.channel <= BAR_MAX_ID]
33  iovs_eca = [i for i in iovs_eca if 0 < i.channel <= ECA_MAX_ID]
34  iovs_ecc = [i for i in iovs_ecc if 0 < i.channel <= ECC_MAX_ID]
35 
36  iovs_eca = offset_channelids(iovs_eca, BAR_MAX_ID)
37  iovs_ecc = offset_channelids(iovs_ecc, BAR_MAX_ID + ECA_MAX_ID)
38 
39  return sorted(iovs_bar + iovs_eca + iovs_ecc,
40  key = lambda i: (i.channel, i.since))
41 
42 class TRT(DCSC_Subdetector):
43 
44  # Disabled until mismatch in number of channels is handled.
45  #__DISABLED__ = True
46 
47  folder_base = "/TRT/DCS"
48 
49  mapping = {
50  121: list(range(1, BAR_MAX_ID + 1 - BAR_REMOVED_IDS)),
51  124: list(range(1 + BAR_MAX_ID, 1 + BAR_MAX_ID + ECA_MAX_ID)),
52  125: list(range(1 + BAR_MAX_ID + ECA_MAX_ID, 1 + BAR_MAX_ID + ECA_MAX_ID + ECC_MAX_ID)),
53  }
54 
55  variables = [
56  DCSC_Variable_TRT_HV("TRT HV", lambda iov: 1400 < iov.OUTPUTVOLTAGE_VALUE < 3000)
57  ]
58 
59  dead_fraction_caution = 0.05
60  dead_fraction_bad = 0.20
61 
python.subdetectors.trt.TRT
Definition: trt.py:42
python.subdetectors.trt.DCSC_Variable_TRT_HV
Definition: trt.py:18
python.subdetectors.trt.offset_channelids
def offset_channelids(iovs, offset)
Definition: trt.py:6
python.subdetectors.trt.DCSC_Variable_TRT_HV.read
def read(self, query_range, folder_base, folder_name)
Definition: trt.py:24
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:195
histSizes.list
def list(name, path='/')
Definition: histSizes.py:38
DerivationFramework::TriggerMatchingUtils::sorted
std::vector< typename T::value_type > sorted(T begin, T end)
Helper function to create a sorted vector from an unsorted one.