CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Public Attributes | Private Member Functions
o2o_db_gain.DbManagerGain Class Reference
Inheritance diagram for o2o_db_gain.DbManagerGain:

Public Member Functions

def __init__
 
def update_gain_logs
 

Public Attributes

 GainO2OPartition
 
 GainO2OSkippedDevices
 
 GainO2OWhitelistedDevices
 
 iovstart
 
 o2o_partitions
 
 o2oid
 

Private Member Functions

def _readPartitions
 
def _readSkippedDevices
 

Detailed Description

Definition at line 64 of file o2o_db_gain.py.

Constructor & Destructor Documentation

def o2o_db_gain.DbManagerGain.__init__ (   self,
  db,
  authFile = None 
)

Definition at line 65 of file o2o_db_gain.py.

65 
66  def __init__(self, db, authFile=None):
67  DbManager.__init__(self, db, authFile)
68  self.GainO2OPartition = make_dbtype(GainO2OPartitionDef, self.schema)
69  self.GainO2OSkippedDevices = make_dbtype(GainO2OSkippedDevicesDef, self.schema)
70  self.GainO2OWhitelistedDevices = make_dbtype(GainO2OWhitelistedDevicesDef, self.schema)
def make_dbtype
Definition: conddblib.py:190

Member Function Documentation

def o2o_db_gain.DbManagerGain._readPartitions (   self,
  p 
)
private

Definition at line 71 of file o2o_db_gain.py.

71 
72  def _readPartitions(self, p):
73  self.o2o_partitions = []
74  partitionDict = {'PartTECM':'TEC-','PartTECP':'TEC+','PartTIBD':'TIB/TID','PartTOB':'TOB'}
75  o2otimestamp = datetime.datetime.utcnow()
76  for part in partitionDict:
77  psetPart = p.SiStripConfigDb.Partitions.getParameter(part)
78  if not psetPart: continue
79  entry = self.GainO2OPartition(
80  o2oid = self.o2oid,
81  iovstart = self.iovstart,
82  o2otimestamp = o2otimestamp,
83  subDetector = partitionDict[part],
84  partitionname = psetPart.getParameter('PartitionName').value(),
85  fecVersionMajorId = psetPart.getParameter('FecVersion')[0],
86  fecVersionMinorId = psetPart.getParameter('FecVersion')[1],
87  fedVersionMajorId = psetPart.getParameter('FedVersion')[0],
88  fedVersionMinorId = psetPart.getParameter('FedVersion')[1],
89  connectionVersionMajorId = psetPart.getParameter('CablingVersion')[0],
90  connectionVersionMinorId = psetPart.getParameter('CablingVersion')[1],
91  dcuInfoVersionMajorId = psetPart.getParameter('DcuDetIdsVersion')[0],
92  dcuInfoVersionMinorId = psetPart.getParameter('DcuDetIdsVersion')[1],
93  dcuPsuMapVersionMajorId = psetPart.getParameter('DcuPsuMapVersion')[0],
94  dcuPsuMapVersionMinorId = psetPart.getParameter('DcuPsuMapVersion')[1],
95  maskVersionMajorId = psetPart.getParameter('MaskVersion')[0],
96  maskVersionMinorId = psetPart.getParameter('MaskVersion')[1],
97  apvTimingVersionMajorId = psetPart.getParameter('ApvTimingVersion')[0],
98  apvTimingVersionMinorId = psetPart.getParameter('ApvTimingVersion')[1],
99  timingRunNumber = psetPart.getParameter('RunNumber').value()
100  )
101  self.o2o_partitions.append(entry)
Definition: value.py:1
def o2o_db_gain.DbManagerGain._readSkippedDevices (   self,
  p,
  whitelist = False 
)
private

Definition at line 102 of file o2o_db_gain.py.

References o2o_db_gain.DbManagerGain.GainO2OSkippedDevices, o2o_db_gain.DbManagerGain.GainO2OWhitelistedDevices, o2o_db_gain.GainO2OPartitionDef.o2oid, o2o_db_gain.GainO2OSkippedDevicesDef.o2oid, and o2o_db_gain.DbManagerGain.o2oid.

103  def _readSkippedDevices(self, p, whitelist=False):
104  dev_type = self.GainO2OSkippedDevices
105  attr_name = 'SkippedDevices'
106  if whitelist:
107  dev_type = self.GainO2OWhitelistedDevices
108  attr_name = 'WhitelistedDevices'
109 
110  dev_list = []
111  value = lambda p: None if p is None else p.value()
112  for itemid, pset in enumerate(getattr(p.SiStripCondObjBuilderFromDb, attr_name)):
113  entry = dev_type(
114  o2oid = self.o2oid,
115  itemid = itemid,
116  fecCrate = value(pset.getParameter('fecCrate')),
117  fecSlot = value(pset.getParameter('fecSlot')),
118  fecRing = value(pset.getParameter('fecRing')),
119  ccuAddr = value(pset.getParameter('ccuAddr')),
120  ccuChan = value(pset.getParameter('ccuChan')),
121  lldChan = value(pset.getParameter('lldChan')),
122  i2cAddr = value(pset.getParameter('i2cAddr')),
123  fedId = value(pset.getParameter('fedId')),
124  feUnit = value(pset.getParameter('feUnit')),
125  feChan = value(pset.getParameter('feChan')),
126  fedApv = value(pset.getParameter('fedApv')),
127  detid = value(pset.getParameter('detid'))
128  )
129  dev_list.append(entry)
130 
131  return dev_list
Definition: value.py:1
def o2o_db_gain.DbManagerGain.update_gain_logs (   self,
  iov,
  cfgname 
)
Insert bookkeeping info to the tables.
Args:
    iov (int or str): IOV number
    cfgname (str): name of the CMSSW cfg file.
The cfg file need to be placed in the current directory.

Definition at line 132 of file o2o_db_gain.py.

133  def update_gain_logs(self, iov, cfgname):
134  """Insert bookkeeping info to the tables.
135  Args:
136  iov (int or str): IOV number
137  cfgname (str): name of the CMSSW cfg file.
138  The cfg file need to be placed in the current directory.
139  """
141  self.iovstart = int(iov)
142  sys.path.append(os.getcwd())
143  if cfgname.endswith('.py'):
144  cfgname = cfgname.replace('.py', '')
145  cfg = import_module(cfgname)
146 
147  self.check_table(GainO2OPartitionDef, self.GainO2OPartition)
148  self.check_table(GainO2OSkippedDevicesDef, self.GainO2OSkippedDevices)
149  self.check_table(GainO2OWhitelistedDevicesDef, self.GainO2OWhitelistedDevices)
150  destSession = self.connect()
151  o2oid = destSession.query(self.GainO2OPartition.o2oid).order_by(self.GainO2OPartition.o2oid.desc()).first()
152  if o2oid:
153  self.o2oid = o2oid[0] + 1
154  else:
155  self.o2oid = 0
156 
157  self._readPartitions(cfg.process)
158  for entry in self.o2o_partitions:
159  destSession.add(entry)
160 
161  o2o_skipped = self._readSkippedDevices(cfg.process)
162  for entry in o2o_skipped:
163  destSession.add(entry)
164 
165  o2o_whitelisted = self._readSkippedDevices(cfg.process, whitelist=True)
166  for entry in o2o_whitelisted:
167  destSession.add(entry)
168 
169  destSession.commit()
170  logging.info('Inserted Gain O2O info to DB!')
171 

Member Data Documentation

o2o_db_gain.DbManagerGain.GainO2OPartition

Definition at line 67 of file o2o_db_gain.py.

o2o_db_gain.DbManagerGain.GainO2OSkippedDevices

Definition at line 68 of file o2o_db_gain.py.

Referenced by o2o_db_gain.DbManagerGain._readSkippedDevices().

o2o_db_gain.DbManagerGain.GainO2OWhitelistedDevices

Definition at line 69 of file o2o_db_gain.py.

Referenced by o2o_db_gain.DbManagerGain._readSkippedDevices().

o2o_db_gain.DbManagerGain.iovstart

Definition at line 140 of file o2o_db_gain.py.

o2o_db_gain.DbManagerGain.o2o_partitions

Definition at line 72 of file o2o_db_gain.py.

o2o_db_gain.DbManagerGain.o2oid

Definition at line 152 of file o2o_db_gain.py.

Referenced by o2o_db_gain.DbManagerGain._readSkippedDevices().