本文整理汇总了Python中RecoLuminosity.LumiDB.CommonUtil.parselumicorrector方法的典型用法代码示例。如果您正苦于以下问题:Python CommonUtil.parselumicorrector方法的具体用法?Python CommonUtil.parselumicorrector怎么用?Python CommonUtil.parselumicorrector使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RecoLuminosity.LumiDB.CommonUtil
的用法示例。
在下文中一共展示了CommonUtil.parselumicorrector方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: normValueById
# 需要导入模块: from RecoLuminosity.LumiDB import CommonUtil [as 别名]
# 或者: from RecoLuminosity.LumiDB.CommonUtil import parselumicorrector [as 别名]
def normValueById(schema,normid):
'''
select * from luminormsv2data where data_id=normid
output:
{since:[corrector(0),{paramname:paramvalue}(1),amodetag(2),egev(3),comment(4)]}
'''
result={}
l=nameDealer.luminormv2dataTableName()
paramdict={}
qHandle=schema.newQuery()
try:
qHandle.addToTableList(l)
qConditionStr='DATA_ID=:normid'
qCondition=coral.AttributeList()
qCondition.extend('normid','unsigned long long')
qCondition['normid'].setData(normid)
qResult=coral.AttributeList()
qHandle.setCondition(qConditionStr,qCondition)
cursor=qHandle.execute()
while cursor.next():
since=cursor.currentRow()['SINCE'].data()
corrector=cursor.currentRow()['CORRECTOR'].data()
amodetag=cursor.currentRow()['AMODETAG'].data()
nominalegev=cursor.currentRow()['NOMINALEGEV'].data()
comment=''
if not cursor.currentRow()['COMMENT'].isNull():
comment=cursor.currentRow()['COMMENT'].data()
(correctorfunc,params)=CommonUtil.parselumicorrector(corrector)
paramdict={}
for param in params:
paramvalue=0.0
if not cursor.currentRow()[param.upper()].isNull():
paramvalue=cursor.currentRow()[param.upper()].data()
paramdict[param]=paramvalue
result[since]=[correctorfunc,paramdict,amodetag,nominalegev,comment]
except:
raise
return result
示例2: RuntimeError
# 需要导入模块: from RecoLuminosity.LumiDB import CommonUtil [as 别名]
# 或者: from RecoLuminosity.LumiDB.CommonUtil import parselumicorrector [as 别名]
else:
normdata_id=normDML.normIdByName(dbsession.nominalSchema(),normname)
for normvalueDict in normvalues:
if 'corrector' not in normvalueDict or not normvalueDict['corrector']:
raise RuntimeError('parameter corrector is required for create/insert action')
if 'since' not in normvalueDict or not normvalueDict['since']:
raise RuntimeError('parameter since is required for create/insert action')
correctorStr=normvalueDict['corrector']
sincerun=int(normvalueDict['since'])
if options.firstsince:
if sincerun<int(options.firstsince):
continue
amodetag=normvalueDict['amodetag']
egev=int(normvalueDict['egev'])
detailcomment=normvalueDict['comment']
(correctorname,parameterlist)=CommonUtil.parselumicorrector(correctorStr)
parameterDict={}
for param in parameterlist:
parameterDict[param]=normvalueDict[param]
normDML.insertValueToNormId(dbsession.nominalSchema(),normdata_id,sincerun,correctorStr,amodetag,egev,parameterDict,comment=detailcomment)
dbsession.transaction().commit()
##############################
# setdefault/unsetdefault
##############################
if options.action in ['setdefault','unsetdefault']:
dbsession=svc.openSession(isReadOnly=False,cpp2sqltype=[('unsigned int','NUMBER(10)'),('unsigned long long','NUMBER(20)')])
dbsession.transaction().start(False)
if options.action=='setdefault':
normDML.promoteNormToTypeDefault(dbsession.nominalSchema(),options.normname,options.lumitype)
if options.action=='unsetdefault':