ATLAS Offline Software
lucid.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
2 
3 """
4 Lucid's criteria are that:
5 
6 1) all non-excluded modules are good.
7 2) The magnet calculator does not report that it is ramping
8 """
9 
10 from DQUtils import process_iovs
11 from DQUtils.sugar import IOVSet
12 
13 from DCSCalculator2.lib import DCSC_Subdetector_DefectsOnly, DCSC_Defect_Global_Variable
14 from DCSCalculator2.variable import DefectIOV
15 
16 from DCSCalculator2.subdetectors.magnets import Magnets
17 
18 class Lucid_Magnets(DCSC_Defect_Global_Variable):
19 
20  def __init__(self):
21  self.folder_name = None # unused
22 
23  # Hmmm, magnets get run twice because of this
24  def calculate_good_iovs(self, lbtime, subdetector):
25  magnets = Magnets()
26  result = magnets.run(lbtime)
27  by_defect = result.by_channel
28 
29  toroid_ramp = by_defect.get("GLOBAL_TOROID_RAMPING", IOVSet())
30  solenoid_ramp = by_defect.get("GLOBAL_SOLENOID_RAMPING", IOVSet())
31 
32  self.input_hashes = [hash(toroid_ramp), hash(solenoid_ramp)]
33  result = IOVSet()
34 
35  events = process_iovs(toroid_ramp, solenoid_ramp)
36  for since, until, (toroid, solenoid) in events:
37  if toroid or solenoid:
38  result.add(since, until, "LCD_MAGNETS_RAMPING", True, "")
39 
40  self.iovs = result.solidify(DefectIOV)
41 
42  return self
43 
44 class Lucid_Voltage(DCSC_Defect_Global_Variable):
45  """
46  Require that /LUCID/DCS/(LV|HV) has powerStatus == True for all modules
47  which are not in the excluded_channels set
48  """
49 
50  def __init__(self, folder_name, defect_name, excluded_channels=None):
51  super(Lucid_Voltage, self).__init__(folder_name, None)
52  self.defect_name = defect_name
53  self.excluded_channels = excluded_channels
54 
55  def make_good_iovs(self, iovs):
56 
57  # Filter out channels which are permanently dead
58  excluded_channels = self.excluded_channels
59  if excluded_channels:
60  iovs = iovs.empty(i for i in iovs
61  if i.channel not in excluded_channels)
62 
63  chans, iovsets = iovs.chans_iovsets
64 
65  result = IOVSet()
66  for since, until, states in process_iovs(*iovsets):
67  if not all(s and s.powerStatus for s in states):
68  result.add(since, until, self.defect_name, True, "")
69 
70  return result.solidify(DefectIOV)
71 
72 class Lucid(DCSC_Subdetector_DefectsOnly):
73  folder_base = '/LUCID/DCS'
74 
75  variables = [
76  # 20170317 - LUCID hasn't worked in Run 2
77  #Lucid_Magnets(),
78  #Lucid_Voltage("LV", "LCD_LV_OFF"),
79  #Lucid_Voltage("HV", "LCD_HV_OFF", excluded_channels=set((5, 16, 19, 24))),
80  ]
python.subdetectors.lucid.Lucid_Voltage.defect_name
defect_name
Definition: lucid.py:52
python.subdetectors.lucid.Lucid_Voltage.excluded_channels
excluded_channels
Definition: lucid.py:53
python.subdetectors.lucid.Lucid_Magnets.iovs
iovs
Definition: lucid.py:40
python.subdetectors.lucid.Lucid_Magnets.folder_name
folder_name
Definition: lucid.py:21
python.subdetectors.lucid.Lucid_Magnets
Definition: lucid.py:18
python.subdetectors.lucid.Lucid_Magnets.input_hashes
input_hashes
Definition: lucid.py:32
python.subdetectors.lucid.Lucid_Voltage.make_good_iovs
def make_good_iovs(self, iovs)
Definition: lucid.py:55
python.events.process_iovs
def process_iovs(*iovsets)
Definition: events.py:30
python.subdetectors.lucid.Lucid
Definition: lucid.py:72
python.subdetectors.lucid.Lucid_Voltage
Definition: lucid.py:44
python.subdetectors.lucid.Lucid_Voltage.__init__
def __init__(self, folder_name, defect_name, excluded_channels=None)
Definition: lucid.py:50
Cut::all
@ all
Definition: SUSYToolsAlg.cxx:64
CaloCondBlobAlgs_fillNoiseFromASCII.hash
dictionary hash
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:109
python.subdetectors.lucid.Lucid_Magnets.__init__
def __init__(self)
Definition: lucid.py:20
python.subdetectors.lucid.Lucid_Magnets.calculate_good_iovs
def calculate_good_iovs(self, lbtime, subdetector)
Definition: lucid.py:24