110 likes | 235 Vues
Status of CFT offline calibration. Current status. Database design – done Design tests - done Cft_calibration_db_server – done ( ? ) Cft_calibration - ???. Creating CFT calibration def main(argv): upass = getpass.getpass() dbconn = connect("mayorov",upass,"d0db")
E N D
Current status • Database design – done • Design tests - done • Cft_calibration_db_server – done (?) • Cft_calibration - ???
Creating CFT calibration def main(argv): upass = getpass.getpass() dbconn = connect("mayorov",upass,"d0db") cursor=dbconn.cursor() cursor.execute("select cc_sqc.nextval from dual"); id_tuple=cursor.fetchone() id=id_tuple[0] print id cursor.execute("insert into cft_calibrations (id,version) "\ "values ( %s,1)" %id) print "cft_calibrations: new record inserted" cursor.execute("insert into cft_calib_subsets (cc_id,ccr_run_number)" \ "( select distinct %s, max(ccr_run_number) "\ "from cft_gains group by chn_id)" %id) cursor.execute("select count(distinct cft_gains.chn_id) "\ "from cft_gains, cft_calib_subsets "\ "where cc_id=%s and "\ "cft_gains.ccr_run_number=cft_calib_subsets.ccr_run_number" %id) nchan=cursor.fetchone() cursor.execute("select count(*) from cft_channels") totchan=cursor.fetchone() if nchan[0]!=totchan[0]: cursor.execute("update cft_calibrations set status='INCOMPLETE'") else: cursor.execute("update cft_calibrations set status='GOOD'")
className="CftCalibration" • condition="where $(CftCalibration.id) = 24 " • queryObject = servant.query(className,condition,tables,fields) • dataSet = queryObject.getRef() • dbRefSet_1 = dataSet.dbRowSet.value() • for cc in dbRefSet_1: • className="CftCalibSubset" • condition="where $(CftCalibSubset.ccId) = %s order by ccr_run_number desc " % cc.id • queryObject = servant.query(className,condition,tables,fields) • dataSet2 = queryObject.getRef() • ccsSet = dataSet2.dbRowSet.value() • for ccs in ccsSet: • refServant=ccs.CCS_CCR_FK • dataSet3=refServant.getRef() • ccrSet=dataSet3.dbRowSet.value() • for ccr in ccrSet: • className="CftPedestal" • condition= "where $(CftPedestal.ccrRunNumber) in ( select max(p2.ccr_run_number) " \ • " from cft_pedestals p2,cft_calib_subsets where cft_calib_subsets.cc_id= %s and " \ • " p2.ccr_run_number=cft_calib_subsets.ccr_run_number and "\ • " chn_id= $(CftPedestal.chnId) ) order by $(CftPedestal.chnId)" % cc.id • queryObject = servant.query(className,condition,tables,fields) • dataSet4 = queryObject.getRef() • pedSet = dataSet4.dbRowSet.value() • count=0 • for ped in pedSet: • print "CHN_ID %s" % ped.chnId • print "CCR_RUN_NUMBER %s" % ped.ccrRunNumber • print "VALUE %s" % ped.value • print "\n" • count = count +1 • if count>20: • break • Few changes in InCalib.py fix the problem
CftGain::dbkey_type gain1key(10,1); CftGain::dbkey_type gain2key(10,2); d0_RefTo<CftGain> gain1(dbin,gain1key); d0_RefTo<CftGain> gain2(dbin,gain2key); std::cout << (*gain1)<<std::endl; std::cout << (*gain2)<<std::endl;
dict = { 'aspects': [ { 'cppname': '__base1._dbkey._x', 'dbname': 'CHN_ID', 'dbtype': 'number', 'desc': 1, 'id': 1, 'idltype': 'long', 'ooname': 'chnId', 'queryable': 1 }, { 'cppname': '__base1._dbkey._y', 'dbname': 'CCR_RUN_NUMBER', 'dbtype': 'number', 'desc': 1, 'id': 1, 'idltype': 'long', 'ooname': 'ccrRunNumber', 'queryable': 1 }, { 'cppname': '_value', 'dbname': 'VALUE', 'dbtype': 'number', 'desc': 0, 'id': 0, 'idltype': 'long', 'ooname': 'value', 'queryable': 1 } ], 'cppobject': 'CftGain', 'fKeys': [ { 'fkName' : 'CG_CCR_FK', 'fkObject' : 'CftCalibRuns', 'fkColumns' : [('ccrRunNumber','runNumber')] }, { 'fkName' : 'CG_CHN_FK', 'fkObject' : 'CftChannel', 'fkColumns' : [('chnId','id')] } ], 'object': 'CftGains', 'order': [ ], 'type_table': 1, 'table': 'CFT_GAINS' }
SQL query: select CHN_ID into :sql_oid from CFT_GAINS where CHN_ID=10 and CCR_RUN_NUMBER=1 SQL query: select CHN_ID,CCR_RUN_NUMBER,VALUE into :x1,:x2,:x3 from CFT_GAINS where CHN_ID=:sql_oid SQL query: using sql_oid=10 CftGain Database key: 109c168c Database key: $(.__base1._dbkey._x): 10, $(.__base1._dbkey._y): 1 value: 9.78488 SQL query: select CHN_ID into :sql_oid from CFT_GAINS where CHN_ID=10 and CCR_RUN_NUMBER=2 CftGain Database key: 109c168c Database key: $(.__base1._dbkey._x): 10, $(.__base1._dbkey._y): 1 value: 9.78488
Problems • d0omOracle or d0omCORBA ? • Tools for generating dictionary files and c++ classes ? • Compound UID for d0om?