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
 
 iovstart
 
 o2o_partitions
 
 o2o_skipped
 
 o2oid
 

Private Member Functions

def _readPartitions (self, p)
 
def _readSkippedDevices (self, p)
 

Detailed Description

Definition at line 60 of file o2o_db_gain.py.

Constructor & Destructor Documentation

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

Definition at line 61 of file o2o_db_gain.py.

61  def __init__(self, db, authFile=None):
62  DbManager.__init__(self, db, authFile)
63  self.GainO2OPartition = make_dbtype(GainO2OPartitionDef, self.schema)
64  self.GainO2OSkippedDevices = make_dbtype(GainO2OSkippedDevicesDef, self.schema)
65 
def __init__(self, db, authFile=None)
Definition: o2o_db_gain.py:61
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 66 of file o2o_db_gain.py.

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

Definition at line 97 of file o2o_db_gain.py.

97  def _readSkippedDevices(self, p):
98  self.o2o_skipped = []
99  value = lambda p: None if p is None else p.value()
100  for itemid, pset in enumerate(p.SiStripCondObjBuilderFromDb.SkippedDevices):
101  entry = self.GainO2OSkippedDevices(
102  o2oid = self.o2oid,
103  itemid = itemid,
104  fecCrate = value(pset.getParameter('fecCrate')),
105  fecSlot = value(pset.getParameter('fecSlot')),
106  fecRing = value(pset.getParameter('fecRing')),
107  ccuAddr = value(pset.getParameter('ccuAddr')),
108  ccuChan = value(pset.getParameter('ccuChan')),
109  lldChan = value(pset.getParameter('lldChan')),
110  i2cAddr = value(pset.getParameter('i2cAddr')),
111  fedId = value(pset.getParameter('fedId')),
112  feUnit = value(pset.getParameter('feUnit')),
113  feChan = value(pset.getParameter('feChan')),
114  fedApv = value(pset.getParameter('fedApv')),
115  detid = value(pset.getParameter('detid'))
116  )
117  self.o2o_skipped.append(entry)
118 
Definition: value.py:1
def _readSkippedDevices(self, p)
Definition: o2o_db_gain.py:97
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 119 of file o2o_db_gain.py.

119  def update_gain_logs(self, iov, cfgname):
120  """Insert bookkeeping info to the tables.
121  Args:
122  iov (int or str): IOV number
123  cfgname (str): name of the CMSSW cfg file.
124  The cfg file need to be placed in the current directory.
125  """
126 
127  self.iovstart = int(iov)
128  sys.path.append(os.getcwd())
129  if cfgname.endswith('.py'):
130  cfgname = cfgname.replace('.py', '')
131  cfg = import_module(cfgname)
132 
133  self.check_table(GainO2OPartitionDef, self.GainO2OPartition)
134  self.check_table(GainO2OSkippedDevicesDef, self.GainO2OSkippedDevices)
135  destSession = self.connect()
136  o2oid = destSession.query(self.GainO2OPartition.o2oid).order_by(self.GainO2OPartition.o2oid.desc()).first()
137  if o2oid:
138  self.o2oid = o2oid[0] + 1
139  else:
140  self.o2oid = 0
141 
142  self._readPartitions(cfg.process)
143  for entry in self.o2o_partitions:
144  destSession.add(entry)
145 
146  self._readSkippedDevices(cfg.process)
147  for entry in self.o2o_skipped:
148  destSession.add(entry)
149 
150  destSession.commit()
151  logging.info('Inserted Gain O2O info to DB!')
152 
153 
def _readPartitions(self, p)
Definition: o2o_db_gain.py:66
def update_gain_logs(self, iov, cfgname)
Definition: o2o_db_gain.py:119
def _readSkippedDevices(self, p)
Definition: o2o_db_gain.py:97

Member Data Documentation

o2o_db_gain.DbManagerGain.GainO2OPartition

Definition at line 63 of file o2o_db_gain.py.

o2o_db_gain.DbManagerGain.GainO2OSkippedDevices

Definition at line 64 of file o2o_db_gain.py.

o2o_db_gain.DbManagerGain.iovstart

Definition at line 127 of file o2o_db_gain.py.

o2o_db_gain.DbManagerGain.o2o_partitions

Definition at line 67 of file o2o_db_gain.py.

o2o_db_gain.DbManagerGain.o2o_skipped

Definition at line 98 of file o2o_db_gain.py.

o2o_db_gain.DbManagerGain.o2oid

Definition at line 138 of file o2o_db_gain.py.