ATLAS Offline Software
lar.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
2 
3 from ..lib import DCSC_DefectTranslate_Subdetector, DCSC_Global_Variable
4 
5 GREY, RED, YELLOW = 0, 1, 2
6 EMBA, EMBC, EMECA, EMECC, HECA, HECC, FCALA, FCALC = 202, 203, 204, 205, 214, 215, 224, 225
7 
9  """
10  This subdetector only uses one global variable, FSM.
11 
12  Since it only has a global variable, it is not possible to calculate a dead
13  fraction, so this is set to -1, and the dead fraction logic is not called.
14  """
15 
16  folder_base = "/LAR/DCS"
17 
18  # This mapping dictionary has a different meaning for LAr with respect
19  # to the other systems. These channels represent represent 'global'
20  # states which should be merged together for a DQ region, rather than
21  # channels which should be counted in a dead fraction.
22  mapping = {
23  EMBA: [1],
24  EMBC: [2],
25  EMECA: [3],
26  EMECC: [4],
27  FCALA: [28, 30],
28  FCALC: [29, 31],
29  HECA: [13, 14, 30],
30  HECC: [8, 15, 31],
31  }
32 
33  def select_globals(self, output_channel, input_globals):
34  """
35  Returns a list where each element is a list of (single channel) iovs.
36 
37  The purpose of this function is to map (one or more) channels in the
38  /LAR/DCS/FSM folder on to output DQ regions. These channels are merged
39  together downstream from this function.
40 
41  The `input_globals` may contain a list of iovs which has multiple
42  channels. This function may be over-ridden by inheriting classes to
43  select channels for this output channel.
44  """
45  global_iov_sets = []
46  belongs_to_output = set(self.mapping[output_channel])
47 
48  for input_global in input_globals:
49  for input_channel, iovs in sorted(input_global.by_channel.items()):
50  if input_channel in belongs_to_output:
51  global_iov_sets.append(iovs)
52 
53  return global_iov_sets
54 
55  variables = [
56  DCSC_Global_Variable("FSM",
57  evaluator=lambda iov: (iov.STATE == "READY" and (iov.STATUS == "OK" or iov.STATUS == "WARNING")),
58  caution_evaluator=lambda iov: (iov.STATE == "UNKNOWN" or iov.STATE == "DEAD" or iov.STATUS == "ERROR")
59  ),
60  ]
61 
62  def __init__(self, *args, **kwargs):
63  super(LAr, self).__init__(*args, **kwargs)
64  self.translators = ([LAr.color_to_defect_translator(flag, defect, [RED])
65  for flag, defect in ((EMBA, 'LAR_EMBA_DCS_ERROR'),
66  (EMBC, 'LAR_EMBC_DCS_ERROR'),
67  (EMECA, 'LAR_EMECA_DCS_ERROR'),
68  (EMECC, 'LAR_EMECC_DCS_ERROR'),
69  (HECA, 'LAR_HECA_DCS_ERROR'),
70  (HECC, 'LAR_HECC_DCS_ERROR'),
71  (FCALA, 'LAR_FCALA_DCS_ERROR'),
72  (FCALC, 'LAR_FCALC_DCS_ERROR'),
73  )]
74  + [LAr.color_to_defect_translator(flag, defect, [YELLOW, GREY])
75  for flag, defect in ((EMBA, 'LAR_EMBA_DCS_WARNING'),
76  (EMBC, 'LAR_EMBC_DCS_WARNING'),
77  (EMECA, 'LAR_EMECA_DCS_WARNING'),
78  (EMECC, 'LAR_EMECC_DCS_WARNING'),
79  (HECA, 'LAR_HECA_DCS_WARNING'),
80  (HECC, 'LAR_HECC_DCS_WARNING'),
81  (FCALA, 'LAR_FCALA_DCS_WARNING'),
82  (FCALC, 'LAR_FCALC_DCS_WARNING'),
83  )])
python.variable.DCSC_Global_Variable
Definition: variable.py:232
python.subdetector.DCSC_DefectTranslate_Subdetector.translators
translators
Definition: subdetector.py:541
python.subdetector.DCSC_DefectTranslate_Subdetector
Definition: subdetector.py:532
python.subdetectors.lar.LAr.select_globals
def select_globals(self, output_channel, input_globals)
Definition: lar.py:33
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.
CxxUtils::set
constexpr std::enable_if_t< is_bitmask_v< E >, E & > set(E &lhs, E rhs)
Convenience function to set bits in a class enum bitmask.
Definition: bitmask.h:224
python.subdetectors.lar.LAr.__init__
def __init__(self, *args, **kwargs)
Definition: lar.py:62
python.subdetectors.lar.LAr.mapping
dictionary mapping
Definition: lar.py:22
python.subdetectors.lar.LAr
Definition: lar.py:8