CMS 3D CMS Logo

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__ (self, db, authFile=None)
 
def update_gain_logs (self, iov, cfgname)
 

Public Attributes

 GainO2OPartition
 
 GainO2OSkippedDevices
 
 GainO2OWhitelistedDevices
 
 iovstart
 
 o2o_partitions
 
 o2oid
 

Private Member Functions

def _readPartitions (self, p)
 
def _readSkippedDevices (self, p, whitelist=False)
 

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  def __init__(self, db, authFile=None):
66  DbManager.__init__(self, db, authFile)
67  self.GainO2OPartition = make_dbtype(GainO2OPartitionDef, self.schema)
68  self.GainO2OSkippedDevices = make_dbtype(GainO2OSkippedDevicesDef, self.schema)
69  self.GainO2OWhitelistedDevices = make_dbtype(GainO2OWhitelistedDevicesDef, self.schema)
70 
def __init__(self, db, authFile=None)
Definition: o2o_db_gain.py:65
def make_dbtype(backendName, schemaName, baseType)
Definition: conddblib.py:215

Member Function Documentation

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

Definition at line 71 of file o2o_db_gain.py.

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

102  def _readSkippedDevices(self, p, whitelist=False):
103  dev_type = self.GainO2OSkippedDevices
104  attr_name = 'SkippedDevices'
105  if whitelist:
106  dev_type = self.GainO2OWhitelistedDevices
107  attr_name = 'WhitelistedDevices'
108 
109  dev_list = []
110  value = lambda p: None if p is None else p.value()
111  for itemid, pset in enumerate(getattr(p.SiStripCondObjBuilderFromDb, attr_name)):
112  entry = dev_type(
113  o2oid = self.o2oid,
114  itemid = itemid,
115  fecCrate = value(pset.getParameter('fecCrate')),
116  fecSlot = value(pset.getParameter('fecSlot')),
117  fecRing = value(pset.getParameter('fecRing')),
118  ccuAddr = value(pset.getParameter('ccuAddr')),
119  ccuChan = value(pset.getParameter('ccuChan')),
120  lldChan = value(pset.getParameter('lldChan')),
121  i2cAddr = value(pset.getParameter('i2cAddr')),
122  fedId = value(pset.getParameter('fedId')),
123  feUnit = value(pset.getParameter('feUnit')),
124  feChan = value(pset.getParameter('feChan')),
125  fedApv = value(pset.getParameter('fedApv')),
126  detid = value(pset.getParameter('detid'))
127  )
128  dev_list.append(entry)
129 
130  return dev_list
131 
Definition: value.py:1
def _readSkippedDevices(self, p, whitelist=False)
Definition: o2o_db_gain.py:102
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.

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

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().