00008 :
00009 print 'creating lumi db schema...'
00010 dbsession.transaction().start(False)
00011 schema=dbsession.nominalSchema()
00012 db=dbUtil.dbUtil(schema)
00013
00014
00015 cmsrunsummary=coral.TableDescription()
00016 cmsrunsummary.setName( nameDealer.cmsrunsummaryTableName() )
00017 cmsrunsummary.insertColumn('RUNNUM','unsigned int')
00018 cmsrunsummary.insertColumn('HLTKEY','string')
00019 cmsrunsummary.insertColumn('FILLNUM','unsigned int')
00020 cmsrunsummary.insertColumn('SEQUENCE','string')
00021 cmsrunsummary.insertColumn('STARTTIME','time stamp',6)
00022 cmsrunsummary.insertColumn('STOPTIME','time stamp',6)
00023 cmsrunsummary.setPrimaryKey('RUNNUM')
00024 cmsrunsummary.setNotNullConstraint('HLTKEY',True)
00025 cmsrunsummary.setNotNullConstraint('FILLNUM',True)
00026 cmsrunsummary.setNotNullConstraint('SEQUENCE',True)
00027 cmsrunsummary.createIndex('cmsrunsummary_fillnum',('FILLNUM'))
00028 cmsrunsummary.createIndex('cmsrunsummary_startime',('STARTTIME'))
00029 db.createTable(cmsrunsummary,False)
00030
00031
00032 summary=coral.TableDescription()
00033 summary.setName( nameDealer.lumisummaryTableName() )
00034 summary.insertColumn('LUMISUMMARY_ID','unsigned long long')
00035 summary.insertColumn('RUNNUM','unsigned int')
00036 summary.insertColumn('CMSLSNUM','unsigned int')
00037 summary.insertColumn('LUMILSNUM','unsigned int')
00038 summary.insertColumn('LUMIVERSION','string')
00039 summary.insertColumn('DTNORM','float')
00040 summary.insertColumn('LHCNORM','float')
00041 summary.insertColumn('INSTLUMI','float')
00042 summary.insertColumn('INSTLUMIERROR','float')
00043 summary.insertColumn('INSTLUMIQUALITY','short')
00044 summary.insertColumn('CMSALIVE','short')
00045 summary.insertColumn('STARTORBIT','unsigned int')
00046 summary.insertColumn('NUMORBIT','unsigned int')
00047 summary.insertColumn('LUMISECTIONQUALITY','short')
00048 summary.insertColumn('BEAMENERGY','float')
00049 summary.insertColumn('BEAMSTATUS','string')
00050 summary.insertColumn('CMSBXINDEXBLOB','blob')
00051 summary.insertColumn('BEAMINTENSITYBLOB_1','blob')
00052 summary.insertColumn('BEAMINTENSITYBLOB_2','blob')
00053
00054 summary.setPrimaryKey('LUMISUMMARY_ID')
00055 summary.setNotNullConstraint('RUNNUM',True)
00056 summary.setNotNullConstraint('CMSLSNUM',True)
00057 summary.setNotNullConstraint('LUMILSNUM',True)
00058 summary.setNotNullConstraint('LUMIVERSION',True)
00059 summary.setNotNullConstraint('DTNORM',True)
00060 summary.setNotNullConstraint('LHCNORM',True)
00061 summary.setNotNullConstraint('INSTLUMI',True)
00062 summary.setNotNullConstraint('INSTLUMIERROR',True)
00063 summary.setNotNullConstraint('INSTLUMIQUALITY',True)
00064 summary.setNotNullConstraint('CMSALIVE',True)
00065 summary.setNotNullConstraint('STARTORBIT',True)
00066 summary.setNotNullConstraint('NUMORBIT',True)
00067 summary.setNotNullConstraint('LUMISECTIONQUALITY',True)
00068 summary.setNotNullConstraint('BEAMENERGY',True)
00069 summary.setNotNullConstraint('BEAMSTATUS',True)
00070
00071 summary.setUniqueConstraint(('RUNNUM','LUMIVERSION','LUMILSNUM'))
00072 summary.createIndex('lumisummary_runnum',('RUNNUM'))
00073
00074 db.createTable(summary,True)
00075
00076 detail=coral.TableDescription()
00077 detail.setName( nameDealer.lumidetailTableName() )
00078 detail.insertColumn('LUMIDETAIL_ID','unsigned long long')
00079 detail.insertColumn('LUMISUMMARY_ID','unsigned long long')
00080 detail.insertColumn('BXLUMIVALUE','blob')
00081 detail.insertColumn('BXLUMIERROR','blob')
00082 detail.insertColumn('BXLUMIQUALITY','blob')
00083 detail.insertColumn('ALGONAME','string')
00084 detail.setPrimaryKey('LUMIDETAIL_ID')
00085 detail.createForeignKey('DETAILSOURCE','LUMISUMMARY_ID',nameDealer.lumisummaryTableName(),'LUMISUMMARY_ID')
00086 detail.setNotNullConstraint('BXLUMIVALUE',True)
00087 detail.setNotNullConstraint('BXLUMIERROR',True)
00088 detail.setNotNullConstraint('BXLUMIQUALITY',True)
00089 detail.setNotNullConstraint('ALGONAME',True)
00090
00091 detail.setUniqueConstraint(('LUMISUMMARY_ID','ALGONAME'))
00092
00093 db.createTable(detail,True)
00094
00095 trg=coral.TableDescription()
00096 trg.setName( nameDealer.trgTableName() )
00097 trg.insertColumn('TRG_ID','unsigned long long')
00098 trg.insertColumn('RUNNUM','unsigned int')
00099 trg.insertColumn('CMSLSNUM','unsigned int')
00100 trg.insertColumn('BITNUM','unsigned int')
00101 trg.insertColumn('BITNAME','string')
00102 trg.insertColumn('TRGCOUNT','unsigned int')
00103 trg.insertColumn('DEADTIME','unsigned long long')
00104 trg.insertColumn('PRESCALE','unsigned int')
00105
00106 trg.setNotNullConstraint('RUNNUM',True)
00107 trg.setNotNullConstraint('CMSLSNUM',True)
00108 trg.setNotNullConstraint('BITNUM',True)
00109 trg.setNotNullConstraint('BITNAME',True)
00110 trg.setNotNullConstraint('TRGCOUNT',True)
00111 trg.setNotNullConstraint('DEADTIME',True)
00112 trg.setNotNullConstraint('PRESCALE',True)
00113 trg.setPrimaryKey('TRG_ID')
00114 trg.createIndex('trg_runnum',('RUNNUM'))
00115
00116 db.createTable(trg,True)
00117
00118 hlt=coral.TableDescription()
00119 hlt.setName( nameDealer.hltTableName() )
00120 hlt.insertColumn( 'HLT_ID','unsigned long long')
00121 hlt.insertColumn( 'RUNNUM','unsigned int')
00122 hlt.insertColumn( 'CMSLSNUM','unsigned int')
00123 hlt.insertColumn( 'PATHNAME','string')
00124 hlt.insertColumn( 'INPUTCOUNT','unsigned int')
00125 hlt.insertColumn( 'ACCEPTCOUNT','unsigned int')
00126 hlt.insertColumn( 'PRESCALE','unsigned int')
00127 hlt.setPrimaryKey( 'HLT_ID' )
00128 hlt.setNotNullConstraint('RUNNUM',True)
00129 hlt.setNotNullConstraint('CMSLSNUM',True)
00130 hlt.setNotNullConstraint('PATHNAME',True)
00131 hlt.setNotNullConstraint('INPUTCOUNT',True)
00132 hlt.setNotNullConstraint('ACCEPTCOUNT',True)
00133 hlt.setNotNullConstraint('PRESCALE',True)
00134 hlt.createIndex('hlt_runnum',('RUNNUM'))
00135 db.createTable(hlt,True)
00136
00137 trghlt=coral.TableDescription()
00138 trghlt.setName( nameDealer.trghltMapTableName() )
00139
00140 trghlt.insertColumn( 'HLTKEY','string' )
00141 trghlt.insertColumn( 'HLTPATHNAME','string' )
00142 trghlt.insertColumn( 'L1SEED','string' )
00143 trghlt.setNotNullConstraint('HLTKEY',True)
00144 trghlt.setNotNullConstraint('HLTPATHNAME',True)
00145 trghlt.setNotNullConstraint('L1SEED',True)
00146 db.createTable(trghlt,False)
00147
00148 lumiresult=coral.TableDescription()
00149 lumiresult.setName( nameDealer.lumiresultTableName() )
00150 lumiresult.insertColumn( 'RUNNUM','unsigned int' )
00151 lumiresult.insertColumn( 'LUMIVERSION','string' )
00152 lumiresult.insertColumn( 'DELIVEREDLUMI','float' )
00153 lumiresult.insertColumn( 'RECORDEDLUMI','float' )
00154 db.createTable(lumiresult,False)
00155
00156 lumihltresult=coral.TableDescription()
00157 lumihltresult.setName( nameDealer.lumihltresultTableName() )
00158 lumihltresult.insertColumn( 'RUNNUM','unsigned int' )
00159 lumihltresult.insertColumn( 'LUMIVERSION','string' )
00160 lumihltresult.insertColumn( 'HLTPATH','float' )
00161 lumihltresult.insertColumn( 'RECORDEDLUMI','float' )
00162 db.createTable(lumihltresult,False)
00163
00164
00165 lumivalidation=coral.TableDescription()
00166 lumivalidation.setName( nameDealer.lumivalidationTableName() )
00167 lumivalidation.insertColumn( 'RUNNUM','unsigned int' )
00168 lumivalidation.insertColumn( 'CMSLSNUM','unsigned int' )
00169 lumivalidation.insertColumn( 'FLAG','string' )
00170 lumivalidation.insertColumn( 'COMMENT','string' )
00171 lumivalidation.setPrimaryKey(('RUNNUM','CMSLSNUM'))
00172 lumivalidation.setNotNullConstraint('FLAG',True)
00173
00174 db.createTable(lumivalidation,False)
00175 dbsession.transaction().commit()