ATLAS Offline Software
Loading...
Searching...
No Matches
lucid.py
Go to the documentation of this file.
1# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
2
3"""
4Lucid's criteria are that:
5
61) all non-excluded modules are good.
72) The magnet calculator does not report that it is ramping
8"""
9
10from DQUtils import process_iovs
11from DQUtils.sugar import IOVSet
12
13from DCSCalculator2.lib import DCSC_Subdetector_DefectsOnly, DCSC_Defect_Global_Variable
14from DCSCalculator2.variable import DefectIOV
15
16from DCSCalculator2.subdetectors.magnets import Magnets
17
18class 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
44class 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
72class 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 ]
calculate_good_iovs(self, lbtime, subdetector)
Definition lucid.py:24
__init__(self, folder_name, defect_name, excluded_channels=None)
Definition lucid.py:50