ATLAS Offline Software
CTP.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
2 
3 from collections import OrderedDict as odict
4 
5 from AthenaCommon.Logging import logging
6 log = logging.getLogger(__name__)
7 
8 from ..Config.MonitorDef import MonitorDef
9 from ..Config.CTPInputConfig import CTPInputConfig
10 from .BunchGroupSet import BunchGroupSet
11 from .MonCounters import MenuMonCountersCollection
12 
13 class CTP(object):
14 
15  def __init__(self):
16  self.inputConnectors = CTPInputConfig.cablingLayout()
17  self.random = Random( names = ['Random0', 'Random1', 'Random2', 'Random3'], cuts = [1, 1, 1, 1] )
19  self.counters = MenuMonCountersCollection() # monitoring counters in the menu
20 
21  # Customisations via flags
22 
23  def setBunchGroupSetName(self, name):
24  self.bunchGroupSet.name = name
25  return self.bunchGroupSet
26 
27  def addBunchGroup(self, name, internalNumber, bunches):
28  self.bunchGroupSet.addBunchGroup(name, internalNumber, bunches)
29 
30  def setupMonitoring(self, menuName, menuItems, menuThresholds, connectors):
31 
34 
35  # add the CTPMon counters (selection defined in L1/Config/MonitorDef.py)
36  for counter in MonitorDef.ctpmonCounters( menuThresholds, connectors ):
37  self.counters.addCounter( counter )
38 
39  # add the CTPIN counters (selection defined in L1/Config/MonitorDef.py)
40  for counter in MonitorDef.ctpinCounters( menuThresholds, connectors, self.inputConnectors["ctpin"] ):
41  self.counters.addCounter( counter )
42 
43  # mark the L1 Items that they should be monitored
44  MonitorDef.applyItemCounter( menuName, menuItems )
45  pass
46 
47  def checkConnectorAvailability(self, availableConnectors, menuToLoad):
48  inputConnectorList = []
49  inputConnectorList += self.inputConnectors["optical"].values()
50  inputConnectorList += self.inputConnectors["electrical"].values()
51  inputConnectorList += self.inputConnectors["ctpin"]["slot7"].values()
52  inputConnectorList += self.inputConnectors["ctpin"]["slot8"].values()
53  inputConnectorList += self.inputConnectors["ctpin"]["slot9"].values()
54  for connName in inputConnectorList:
55  if connName != '' and connName not in availableConnectors:
56  msg = "Connector '%s' requested in L1/Config/CTPConfig.py not defined as menu input. Please add it to L1/Menu/Menu_%s.py" % (connName, menuToLoad[1])
57  log.error(msg)
58  raise RuntimeError(msg)
59 
60  def json(self):
61  confObj = odict()
62  confObj["inputs"] = self.inputConnectors
63  confObj["monitoring"] = self.counters.json()
64  return confObj
65 
66 
67 
68 class Random(object):
69  def __init__(self, names, cuts):
70  self.names = names
71  self.cuts = cuts
72 
python.L1.Base.CTP.CTP.counters
counters
Definition: CTP.py:19
python.L1.Base.CTP.CTP.setBunchGroupSetName
def setBunchGroupSetName(self, name)
Definition: CTP.py:23
python.L1.Base.CTP.CTP.random
random
Definition: CTP.py:17
python.L1.Base.BunchGroupSet.BunchGroupSet
Definition: BunchGroupSet.py:50
python.L1.Base.MonCounters.MenuMonCountersCollection
Definition: MonCounters.py:9
python.L1.Base.CTP.CTP.json
def json(self)
Definition: CTP.py:60
python.L1.Base.CTP.CTP.addBunchGroup
def addBunchGroup(self, name, internalNumber, bunches)
Definition: CTP.py:27
python.Bindings.values
values
Definition: Control/AthenaPython/python/Bindings.py:805
python.L1.Base.CTP.CTP.bunchGroupSet
bunchGroupSet
Definition: CTP.py:18
python.L1.Base.CTP.Random.names
names
Definition: CTP.py:70
python.L1.Base.CTP.CTP.checkConnectorAvailability
def checkConnectorAvailability(self, availableConnectors, menuToLoad)
Definition: CTP.py:47
python.L1.Base.CTP.CTP
Definition: CTP.py:13
python.L1.Base.CTP.CTP.setupMonitoring
def setupMonitoring(self, menuName, menuItems, menuThresholds, connectors)
Definition: CTP.py:30
python.L1.Base.CTP.CTP.inputConnectors
inputConnectors
Definition: CTP.py:16
python.L1.Base.CTP.Random
Definition: CTP.py:68
python.L1.Base.CTP.Random.__init__
def __init__(self, names, cuts)
Definition: CTP.py:69
python.L1.Base.CTP.Random.cuts
cuts
Definition: CTP.py:71
pickleTool.object
object
Definition: pickleTool.py:30
python.L1.Base.CTP.CTP.__init__
def __init__(self)
Definition: CTP.py:15