9 print 'creating lumi db schema...'
10 dbsession.transaction().
start(
False)
11 schema=dbsession.nominalSchema()
15 cmsrunsummary=coral.TableDescription()
17 cmsrunsummary.insertColumn(
'RUNNUM',
'unsigned int')
18 cmsrunsummary.insertColumn(
'HLTKEY',
'string')
19 cmsrunsummary.insertColumn(
'FILLNUM',
'unsigned int')
20 cmsrunsummary.insertColumn(
'SEQUENCE',
'string')
21 cmsrunsummary.insertColumn(
'STARTTIME',
'time stamp',6)
22 cmsrunsummary.insertColumn(
'STOPTIME',
'time stamp',6)
23 cmsrunsummary.setPrimaryKey(
'RUNNUM')
24 cmsrunsummary.setNotNullConstraint(
'HLTKEY',
True)
25 cmsrunsummary.setNotNullConstraint(
'FILLNUM',
True)
26 cmsrunsummary.setNotNullConstraint(
'SEQUENCE',
True)
27 cmsrunsummary.createIndex(
'cmsrunsummary_fillnum',(
'FILLNUM'))
28 cmsrunsummary.createIndex(
'cmsrunsummary_startime',(
'STARTTIME'))
29 db.createTable(cmsrunsummary,
False)
32 summary=coral.TableDescription()
34 summary.insertColumn(
'LUMISUMMARY_ID',
'unsigned long long')
35 summary.insertColumn(
'RUNNUM',
'unsigned int')
36 summary.insertColumn(
'CMSLSNUM',
'unsigned int')
37 summary.insertColumn(
'LUMILSNUM',
'unsigned int')
38 summary.insertColumn(
'LUMIVERSION',
'string')
39 summary.insertColumn(
'DTNORM',
'float')
40 summary.insertColumn(
'LHCNORM',
'float')
41 summary.insertColumn(
'INSTLUMI',
'float')
42 summary.insertColumn(
'INSTLUMIERROR',
'float')
43 summary.insertColumn(
'INSTLUMIQUALITY',
'short')
44 summary.insertColumn(
'CMSALIVE',
'short')
45 summary.insertColumn(
'STARTORBIT',
'unsigned int')
46 summary.insertColumn(
'NUMORBIT',
'unsigned int')
47 summary.insertColumn(
'LUMISECTIONQUALITY',
'short')
48 summary.insertColumn(
'BEAMENERGY',
'float')
49 summary.insertColumn(
'BEAMSTATUS',
'string')
50 summary.insertColumn(
'CMSBXINDEXBLOB',
'blob')
51 summary.insertColumn(
'BEAMINTENSITYBLOB_1',
'blob')
52 summary.insertColumn(
'BEAMINTENSITYBLOB_2',
'blob')
54 summary.setPrimaryKey(
'LUMISUMMARY_ID')
55 summary.setNotNullConstraint(
'RUNNUM',
True)
56 summary.setNotNullConstraint(
'CMSLSNUM',
True)
57 summary.setNotNullConstraint(
'LUMILSNUM',
True)
58 summary.setNotNullConstraint(
'LUMIVERSION',
True)
59 summary.setNotNullConstraint(
'DTNORM',
True)
60 summary.setNotNullConstraint(
'LHCNORM',
True)
61 summary.setNotNullConstraint(
'INSTLUMI',
True)
62 summary.setNotNullConstraint(
'INSTLUMIERROR',
True)
63 summary.setNotNullConstraint(
'INSTLUMIQUALITY',
True)
64 summary.setNotNullConstraint(
'CMSALIVE',
True)
65 summary.setNotNullConstraint(
'STARTORBIT',
True)
66 summary.setNotNullConstraint(
'NUMORBIT',
True)
67 summary.setNotNullConstraint(
'LUMISECTIONQUALITY',
True)
68 summary.setNotNullConstraint(
'BEAMENERGY',
True)
69 summary.setNotNullConstraint(
'BEAMSTATUS',
True)
71 summary.setUniqueConstraint((
'RUNNUM',
'LUMIVERSION',
'LUMILSNUM'))
72 summary.createIndex(
'lumisummary_runnum',(
'RUNNUM'))
74 db.createTable(summary,
True)
76 detail=coral.TableDescription()
78 detail.insertColumn(
'LUMIDETAIL_ID',
'unsigned long long')
79 detail.insertColumn(
'LUMISUMMARY_ID',
'unsigned long long')
80 detail.insertColumn(
'BXLUMIVALUE',
'blob')
81 detail.insertColumn(
'BXLUMIERROR',
'blob')
82 detail.insertColumn(
'BXLUMIQUALITY',
'blob')
83 detail.insertColumn(
'ALGONAME',
'string')
84 detail.setPrimaryKey(
'LUMIDETAIL_ID')
86 detail.setNotNullConstraint(
'BXLUMIVALUE',
True)
87 detail.setNotNullConstraint(
'BXLUMIERROR',
True)
88 detail.setNotNullConstraint(
'BXLUMIQUALITY',
True)
89 detail.setNotNullConstraint(
'ALGONAME',
True)
91 detail.setUniqueConstraint((
'LUMISUMMARY_ID',
'ALGONAME'))
93 db.createTable(detail,
True)
95 trg=coral.TableDescription()
97 trg.insertColumn(
'TRG_ID',
'unsigned long long')
98 trg.insertColumn(
'RUNNUM',
'unsigned int')
99 trg.insertColumn(
'CMSLSNUM',
'unsigned int')
100 trg.insertColumn(
'BITNUM',
'unsigned int')
101 trg.insertColumn(
'BITNAME',
'string')
102 trg.insertColumn(
'TRGCOUNT',
'unsigned int')
103 trg.insertColumn(
'DEADTIME',
'unsigned long long')
104 trg.insertColumn(
'PRESCALE',
'unsigned int')
106 trg.setNotNullConstraint(
'RUNNUM',
True)
107 trg.setNotNullConstraint(
'CMSLSNUM',
True)
108 trg.setNotNullConstraint(
'BITNUM',
True)
109 trg.setNotNullConstraint(
'BITNAME',
True)
110 trg.setNotNullConstraint(
'TRGCOUNT',
True)
111 trg.setNotNullConstraint(
'DEADTIME',
True)
112 trg.setNotNullConstraint(
'PRESCALE',
True)
113 trg.setPrimaryKey(
'TRG_ID')
114 trg.createIndex(
'trg_runnum',(
'RUNNUM'))
116 db.createTable(trg,
True)
118 hlt=coral.TableDescription()
120 hlt.insertColumn(
'HLT_ID',
'unsigned long long')
121 hlt.insertColumn(
'RUNNUM',
'unsigned int')
122 hlt.insertColumn(
'CMSLSNUM',
'unsigned int')
123 hlt.insertColumn(
'PATHNAME',
'string')
124 hlt.insertColumn(
'INPUTCOUNT',
'unsigned int')
125 hlt.insertColumn(
'ACCEPTCOUNT',
'unsigned int')
126 hlt.insertColumn(
'PRESCALE',
'unsigned int')
127 hlt.setPrimaryKey(
'HLT_ID' )
128 hlt.setNotNullConstraint(
'RUNNUM',
True)
129 hlt.setNotNullConstraint(
'CMSLSNUM',
True)
130 hlt.setNotNullConstraint(
'PATHNAME',
True)
131 hlt.setNotNullConstraint(
'INPUTCOUNT',
True)
132 hlt.setNotNullConstraint(
'ACCEPTCOUNT',
True)
133 hlt.setNotNullConstraint(
'PRESCALE',
True)
134 hlt.createIndex(
'hlt_runnum',(
'RUNNUM'))
135 db.createTable(hlt,
True)
137 trghlt=coral.TableDescription()
140 trghlt.insertColumn(
'HLTKEY',
'string' )
141 trghlt.insertColumn(
'HLTPATHNAME',
'string' )
142 trghlt.insertColumn(
'L1SEED',
'string' )
143 trghlt.setNotNullConstraint(
'HLTKEY',
True)
144 trghlt.setNotNullConstraint(
'HLTPATHNAME',
True)
145 trghlt.setNotNullConstraint(
'L1SEED',
True)
146 db.createTable(trghlt,
False)
148 lumiresult=coral.TableDescription()
150 lumiresult.insertColumn(
'RUNNUM',
'unsigned int' )
151 lumiresult.insertColumn(
'LUMIVERSION',
'string' )
152 lumiresult.insertColumn(
'DELIVEREDLUMI',
'float' )
153 lumiresult.insertColumn(
'RECORDEDLUMI',
'float' )
154 db.createTable(lumiresult,
False)
156 lumihltresult=coral.TableDescription()
158 lumihltresult.insertColumn(
'RUNNUM',
'unsigned int' )
159 lumihltresult.insertColumn(
'LUMIVERSION',
'string' )
160 lumihltresult.insertColumn(
'HLTPATH',
'float' )
161 lumihltresult.insertColumn(
'RECORDEDLUMI',
'float' )
162 db.createTable(lumihltresult,
False)
165 lumivalidation=coral.TableDescription()
167 lumivalidation.insertColumn(
'RUNNUM',
'unsigned int' )
168 lumivalidation.insertColumn(
'CMSLSNUM',
'unsigned int' )
169 lumivalidation.insertColumn(
'FLAG',
'string' )
170 lumivalidation.insertColumn(
'COMMENT',
'string' )
171 lumivalidation.setPrimaryKey((
'RUNNUM',
'CMSLSNUM'))
172 lumivalidation.setNotNullConstraint(
'FLAG',
True)
174 db.createTable(lumivalidation,
False)
175 dbsession.transaction().commit()