Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:22:59

0001 /*
0002  *
0003  * GO 20091112: indexes added
0004  *
0005  * PhG 20010-01-06:
0006  *   LMF_LASER_COLORS_DEF -> LMF_LASER_COLOR_DEF + column changes.
0007  *   Err. on norm. factor
0008  * 
0009  * GO 20010109: new indexes added - removed SEQ_ID from 
0010  *   LMF_PRIM_DATASET_DAT - partitioned tables 
0011  *
0012  * GO 20100323: sequences redefined with NOCACHE
0013  *      
0014  * GO 20100910: removed contraints against RUN_IOV (cannot constraint on a
0015  *   different account): substituted by triggers
0016  *
0017  * GO 20100927: SYNONYMs created (may need grant on CMS_ECAL_COND)
0018  * GO 20101011: modified table structure for XXX_CLS_XXX tables
0019  * GO 20101020: LMF_CLS_XXX tables modified to move the REF field after
0020  *              LOGIC_ID (needed to use only one class in C++) 
0021  * GO 20101124: modified Corr coeff table
0022  * GO 20110301: final (hopefully) version with pre-partitioned 
0023  *              tables and local indices, as well as with
0024  *              splitted DB sequences.
0025  * GO 20110531: added support for CLS classes. Added partitions %_11b. 
0026  * GO 20110907: updated the script to reflect the current table layout 
0027  *              (PN_PRIM_DAT tables columns swapped w.r.t. the real ones)
0028  * GO 20110907: added USING INDEX LOCAL ENABLE clause to the creation of
0029  *              LMF_LED_XX_PN_PRIM_DAT table as a test (see e-mail from 
0030  *              Skorupinski)
0031  */
0032 
0033 PROMPT "Starting creating laser tables: "
0034 PROMPT "   please GRANT SELECT ON RUN_IOV from CMS_ECAL_COND account"
0035 
0036 /* create sequences. Create different sequences for different years */
0037 
0038 CREATE SEQUENCE LMF_RUN_TAG_SQ INCREMENT BY 1 START WITH 1 NOCACHE;
0039 CREATE SEQUENCE LMF_RUN_IOV_10_SQ INCREMENT BY 1 START WITH 1 NOCACHE;
0040 CREATE SEQUENCE LMF_RUN_IOV_11_SQ INCREMENT BY 1 START WITH 1158001 NOCACHE;
0041 CREATE SEQUENCE LMF_LMR_SUB_IOV_ID_10_SQ INCREMENT BY 1 START WITH 1 NOCACHE;
0042 CREATE SEQUENCE LMF_LMR_SUB_IOV_ID_11_SQ INCREMENT BY 1 START WITH 2401 NOCACHE;
0043 CREATE SEQUENCE LMF_IOV_10_SQ INCREMENT BY 1 START WITH 1 NOCACHE;
0044 CREATE SEQUENCE LMF_IOV_11_SQ INCREMENT BY 1 START WITH 2401 NOCACHE;
0045 CREATE SEQUENCE SEQ_ID_10_SQ INCREMENT BY 1 START WITH 1 NOCACHE;
0046 CREATE SEQUENCE SEQ_ID_11_SQ INCREMENT BY 1 START WITH 18001 NOCACHE;
0047 
0048 /*  LMF_RUN_TAG: done  */
0049 CREATE TABLE LMF_RUN_TAG
0050 (
0051   GEN_TAG VARCHAR2(100),
0052   VERSION NUMBER,
0053   TAG_ID  NUMBER NOT NULL
0054 )
0055 /
0056 
0057 INSERT INTO LMF_RUN_TAG VALUES ('gen', 1, lmf_run_tag_sq.nextVal);
0058 
0059 ALTER TABLE LMF_RUN_TAG
0060   ADD CONSTRAINT LMF_RUN_TAG_PK PRIMARY KEY (TAG_ID) USING INDEX LOCAL ENABLE
0061 /
0062 
0063 /* LMF_COLOR_DEF: done */
0064 CREATE TABLE LMF_COLOR_DEF
0065 (
0066   COLOR_ID    NUMBER NOT NULL,
0067   COLOR_INDEX NUMBER    NOT NULL,
0068   SNAME       VARCHAR2(10) NOT NULL,
0069   LNAME       VARCHAR2(100) NOT NULL
0070 )
0071 /
0072 
0073 ALTER TABLE LMF_COLOR_DEF
0074   ADD CONSTRAINT LM_COLOR_DEF_PK PRIMARY KEY (COLOR_ID) USING INDEX LOCAL 
0075         ENABLE
0076 /
0077 
0078 INSERT INTO LMF_COLOR_DEF VALUES (1, 0, 'blue', 
0079         'blue laser (440 nm) or blue led');
0080 INSERT INTO LMF_COLOR_DEF VALUES (2, 1, 'green', 'green (495 nm)');
0081 INSERT INTO LMF_COLOR_DEF VALUES (3, 2, 
0082         'red/orange', 'red laser (706 nm) or orange led');
0083 INSERT INTO LMF_COLOR_DEF VALUES (4, 3, 'IR', 'infrared (796 nm)');
0084 
0085 /* LMF_TRIG_TYPE_DEF */
0086 CREATE TABLE LMF_TRIG_TYPE_DEF
0087 (
0088   TRIG_TYPE NUMBER,
0089   SNAME VARCHAR2(5),
0090   LNAME VARCHAR2(50),
0091   CONSTRAINT LMF_TRIG_TYPE_DEF PRIMARY KEY(TRIG_TYPE) USING INDEX LOCAL ENABLE
0092 )
0093 /
0094 
0095 INSERT INTO LMF_TRIG_TYPE_DEF VALUES (1, 'las', 'laser');
0096 INSERT INTO LMF_TRIG_TYPE_DEF VALUES (2, 'led', 'led');
0097 INSERT INTO LMF_TRIG_TYPE_DEF VALUES (3, 'tp', 'test pulse');
0098 INSERT INTO LMF_TRIG_TYPE_DEF VALUES (4, 'ped', 'pedestal');
0099 
0100 /* LMF_SEQ_VERS */
0101 CREATE TABLE LMF_SEQ_VERS
0102 (
0103   VERS NUMBER(3),
0104   DB_TIMESTAMP TIMESTAMP DEFAULT sys_extract_utc(SYSTIMESTAMP) NOT NULL,
0105   DESCR VARCHAR2(100),
0106   CONSTRAINTS LMF_SEQ_VERS_PK PRIMARY KEY(VERS) USING INDEX LOCAL ENABLE
0107 )
0108 /
0109 
0110 INSERT INTO LMF_SEQ_VERS VALUES (0, DEFAULT, 'none');
0111 INSERT INTO LMF_SEQ_VERS VALUES (1, DEFAULT, 'default');
0112 
0113 /* LMF_SEQ_DAT 
0114 -- In the table the list of calibration sequences, that is a scan
0115 -- of the whole ECAL with the different event type. 1 row = 1 sequence.
0116 */
0117 CREATE TABLE LMF_SEQ_DAT
0118 (
0119   SEQ_ID        NUMBER,
0120   RUN_IOV_ID    NUMBER,
0121   SEQ_NUM       NUMBER,
0122   SEQ_START     DATE NOT NULL,
0123   SEQ_STOP      DATE NOT NULL,
0124   VMIN          NUMBER,
0125   VMAX          NUMBER,
0126   CONSTRAINTS LMF_SEQ_DAT_PK PRIMARY KEY(SEQ_ID) USING INDEX LOCAL ENABLE,
0127   CONSTRAINTS LMF_SEQ_DAT_FK2 FOREIGN KEY(VMIN) REFERENCES LMF_SEQ_VERS(VERS),
0128   CONSTRAINTS LMF_SEQ_DAT_FK3 FOREIGN KEY(VMAX) REFERENCES LMF_SEQ_VERS(VERS)
0129 )
0130 PARTITION BY RANGE ("SEQ_ID")
0131 (PARTITION "LMF_SEQ_DAT_10" VALUES LESS THAN (18000) 
0132  TABLESPACE CMS_ECAL_LASER_COND_2010_DATA,
0133  PARTITION "LMF_SEQ_DAT_11" VALUES LESS THAN (36000)
0134  TABLESPACE CMS_ECAL_LASER_COND_2011_DATA)
0135 /
0136 
0137 /*  LMF_RUN_IOV  */
0138 -- This table holds the list of monitoring subruns, that a batch
0139 -- of consecutive events on the same region and of the same type.
0140 CREATE TABLE LMF_RUN_IOV
0141 (
0142   LMF_IOV_ID     NUMBER NOT NULL,
0143   TAG_ID         NUMBER NOT NULL,
0144   SEQ_ID         NUMBER NOT NULL,
0145   LMR            NUMBER NOT NULL,
0146   COLOR_ID       NUMBER NOT NULL,
0147   TRIG_TYPE      NUMBER NOT NULL,
0148   SUBRUN_START   DATE NOT NULL,
0149   SUBRUN_END     DATE NOT NULL,
0150   SUBRUN_TYPE    VARCHAR2(20) NOT NULL,
0151   DB_TIMESTAMP   TIMESTAMP DEFAULT SYS_EXTRACT_UTC(SYSTIMESTAMP) NOT NULL
0152 )
0153 PARTITION BY RANGE ("LMF_IOV_ID")
0154 (PARTITION "LMF_RUN_IOV_10" VALUES LESS THAN (1158000) 
0155  TABLESPACE CMS_ECAL_LASER_COND_2010_DATA,
0156  PARTITION "LMF_RUN_IOV_11" VALUES LESS THAN (2316000)
0157  TABLESPACE CMS_ECAL_LASER_COND_2011_DATA)
0158 /
0159 
0160 ALTER TABLE LMF_RUN_IOV
0161   ADD CONSTRAINT LMF_RUN_IOV_PK PRIMARY KEY (LMF_IOV_ID) USING INDEX LOCAL 
0162         ENABLE
0163 /
0164 
0165 ALTER TABLE LMF_RUN_IOV
0166   ADD CONSTRAINT LMF_RUN_IOV_UK UNIQUE (SEQ_ID, LMR, COLOR_ID, TRIG_TYPE)
0167 /
0168 
0169 ALTER TABLE LMF_RUN_IOV
0170   ADD CONSTRAINT LMF_RUN_IOV_FK1 FOREIGN KEY (TAG_ID)
0171   REFERENCES LMF_RUN_TAG(TAG_ID)
0172 /
0173 
0174 ALTER TABLE LMF_RUN_IOV
0175   ADD CONSTRAINT LMF_RUN_IOV_FK2 FOREIGN KEY (SEQ_ID)
0176   REFERENCES LMF_SEQ_DAT(SEQ_ID)
0177 /
0178 
0179 ALTER TABLE LMF_RUN_IOV
0180   ADD CONSTRAINT LMF_RUN_IOV_FK3 FOREIGN KEY (COLOR_ID)
0181   REFERENCES LMF_COLOR_DEF(COLOR_ID)
0182 /
0183 
0184 ALTER TABLE LMF_RUN_IOV
0185   ADD CONSTRAINT LMF_RUN_IOV_FK4 FOREIGN KEY (TRIG_TYPE)
0186   REFERENCES LMF_TRIG_TYPE_DEF
0187 /
0188 
0189 /*  LMF_LASER_CONFIG_DAT  */
0190 CREATE TABLE LMF_LASER_CONFIG_DAT
0191 (
0192   LMF_IOV_ID     NUMBER NOT NULL,
0193   LOGIC_ID       NUMBER NOT NULL,
0194   WAVELENGTH     NUMBER,
0195   VFE_GAIN       NUMBER,
0196   PN_GAIN        NUMBER,
0197   LSR_POWER      NUMBER,
0198   LSR_ATTENUATOR NUMBER,
0199   LSR_CURRENT    NUMBER,
0200   LSR_DELAY_1    NUMBER,
0201   LSR_DELAY_2    NUMBER
0202 )
0203 PARTITION BY RANGE ("LMF_IOV_ID")
0204 (PARTITION "LMF_LASER_CONFIG_DAT_10" VALUES LESS THAN (1158000) 
0205  TABLESPACE CMS_ECAL_LASER_COND_2010_DATA,
0206  PARTITION "LMF_LASER_CONFIG_DAT_11" VALUES LESS THAN (2316000)
0207  TABLESPACE CMS_ECAL_LASER_COND_2011_DATA)
0208 /
0209 
0210 ALTER TABLE LMF_LASER_CONFIG_DAT
0211   ADD CONSTRAINT LMF_LASER_CONFIG_DAT_PK PRIMARY KEY (LMF_IOV_ID,LOGIC_ID)
0212         USING INDEX LOCAL ENABLE        
0213 /
0214 
0215 ALTER TABLE LMF_LASER_CONFIG_DAT
0216   ADD CONSTRAINT LMF_LASER_CONFIG_DAT_FK1 FOREIGN KEY (LMF_IOV_ID)
0217   REFERENCES LMF_RUN_IOV(LMF_IOV_ID)
0218 /
0219 
0220 /*  LMF_RUN_DAT  */
0221 CREATE TABLE LMF_RUN_DAT
0222 (
0223   LMF_IOV_ID   NUMBER NOT NULL,
0224   LOGIC_ID     NUMBER NOT NULL,
0225   NEVENTS      NUMBER,
0226   QUALITY_FLAG NUMBER
0227 )
0228 PARTITION BY RANGE ("LMF_IOV_ID")
0229 (PARTITION "LMF_RUN_DAT_10" VALUES LESS THAN (1158000)
0230  TABLESPACE CMS_ECAL_LASER_COND_2010_DATA,
0231  PARTITION "LMF_RUN_DAT_11" VALUES LESS THAN (2316000)
0232  TABLESPACE CMS_ECAL_LASER_COND_2011_DATA)
0233 /
0234 
0235 ALTER TABLE LMF_RUN_DAT
0236   ADD CONSTRAINT LMF_RUN_DAT_PK PRIMARY KEY (LMF_IOV_ID,LOGIC_ID)
0237         USING INDEX LOCAL ENABLE
0238 /
0239 
0240 ALTER TABLE LMF_RUN_DAT
0241   ADD CONSTRAINT LMF_RUN_DAT_FK1 FOREIGN KEY (LMF_IOV_ID)
0242   REFERENCES LMF_RUN_IOV(LMF_IOV_ID)
0243 /
0244 
0245 
0246 /*  LMF_TEST_PULSE_CONFIG_DAT  */
0247 CREATE TABLE LMF_TEST_PULSE_CONFIG_DAT
0248 (
0249   LMF_IOV_ID NUMBER NOT NULL,
0250   LOGIC_ID   NUMBER NOT NULL,
0251   VFE_GAIN   NUMBER,
0252   DAC_MGPA   NUMBER,
0253   PN_GAIN    NUMBER,
0254   PN_VINJ    NUMBER
0255 )
0256 PARTITION BY RANGE ("LMF_IOV_ID")
0257 (PARTITION "LMF_TEST_PULSE_CONFIG_DAT_10" VALUES LESS THAN (1158000)
0258  TABLESPACE CMS_ECAL_LASER_COND_2010_DATA,
0259  PARTITION "LMF_TEST_PULSE_CONFIG_DAT_11" VALUES LESS THAN (2316000)
0260  TABLESPACE CMS_ECAL_LASER_COND_2011_DATA)
0261 /
0262 
0263 ALTER TABLE LMF_TEST_PULSE_CONFIG_DAT
0264   ADD CONSTRAINT LMF_TEST_PULSE_CONFIG_DAT_PK PRIMARY KEY (LMF_IOV_ID,LOGIC_ID) USING INDEX LOCAL ENABLE
0265 /
0266 
0267 ALTER TABLE LMF_TEST_PULSE_CONFIG_DAT
0268   ADD CONSTRAINT LMF_TEST_PULSE_CONFIG_DAT_FK1 FOREIGN KEY (LMF_IOV_ID)
0269   REFERENCES LMF_RUN_IOV(LMF_IOV_ID)
0270 /
0271 
0272 
0273 /* LMF_PRIM_VERS */
0274 CREATE TABLE LMF_PRIM_VERS
0275 (
0276   VERS         NUMBER,
0277   DB_TIMESTAMP TIMESTAMP DEFAULT SYS_EXTRACT_UTC(SYSTIMESTAMP) NOT NULL,
0278   DESCR        VARCHAR2(100),
0279   CONSTRAINTS LMF_PRIM_VERS_PK  PRIMARY KEY(VERS) USING INDEX LOCAL ENABLE
0280 )
0281 /
0282 
0283 INSERT INTO LMF_PRIM_VERS VALUES (0, DEFAULT, 'none');
0284 INSERT INTO LMF_PRIM_VERS VALUES (1, DEFAULT, 'default');
0285 INSERT INTO LMF_PRIM_VERS VALUES (2, DEFAULT, 'vers. 2');
0286 INSERT INTO LMF_PRIM_VERS VALUES (3, DEFAULT, 'vers. 3');
0287 INSERT INTO LMF_PRIM_VERS VALUES (4, DEFAULT, 'vers. 4');
0288 
0289 /*  LMF_CLS_XXX_DAT  */
0290 CREATE TABLE LMF_CLS_BLUE_DAT
0291 (
0292   LMF_IOV_ID        NUMBER NOT NULL,
0293   LOGIC_ID          NUMBER NOT NULL,
0294   LMF_IOV_ID_REF    NUMBER,
0295   MEAN              NUMBER, 
0296   NORM              NUMBER, 
0297   RMS               NUMBER, 
0298   NEVT              NUMBER,
0299   ENORM             NUMBER,
0300   FLAG              NUMBER,
0301   FLAGNORM          NUMBER,
0302   VMIN              NUMBER,
0303   VMAX              NUMBER,
0304   CONSTRAINTS LMF_CLS_BLUE_DAT_FK1 FOREIGN KEY(VMIN)
0305     REFERENCES LMF_PRIM_VERS(VERS),
0306   CONSTRAINTS LMF_CLS_BLUE_DAT_FK2 FOREIGN KEY(VMAX)
0307     REFERENCES LMF_PRIM_VERS(VERS),
0308   CONSTRAINTS LMF_CLS_BLUE_DAT_FK3 FOREIGN KEY(LMF_IOV_ID)
0309     REFERENCES LMF_RUN_IOV(LMF_IOV_ID)
0310 )
0311 PARTITION BY RANGE ("LMF_IOV_ID")
0312 (PARTITION "LMF_CLS_BLUE_DAT_10" VALUES LESS THAN (1158000)
0313  TABLESPACE CMS_ECAL_LASER_COND_2010_DATA,
0314  PARTITION "LMF_CLS_BLUE_DAT_11" VALUES LESS THAN (2316000)
0315  TABLESPACE CMS_ECAL_LASER_COND_2011_DATA)
0316 /
0317 
0318 CREATE TABLE LMF_CLS_IR_DAT
0319 (
0320   LMF_IOV_ID        NUMBER NOT NULL,
0321   LOGIC_ID          NUMBER NOT NULL,
0322   LMF_IOV_ID_REF    NUMBER,
0323   MEAN              NUMBER, 
0324   NORM              NUMBER, 
0325   RMS               NUMBER, 
0326   NEVT              NUMBER,
0327   ENORM             NUMBER,
0328   FLAG              NUMBER,
0329   FLAGNORM          NUMBER,
0330   VMIN              NUMBER,
0331   VMAX              NUMBER,
0332   CONSTRAINTS LMF_CLS_IR_DAT_FK1 FOREIGN KEY(VMIN)
0333     REFERENCES LMF_PRIM_VERS(VERS),
0334   CONSTRAINTS LMF_CLS_IR_DAT_FK2 FOREIGN KEY(VMAX)
0335     REFERENCES LMF_PRIM_VERS(VERS),
0336   CONSTRAINTS LMF_CLS_IR_DAT_FK3 FOREIGN KEY(LMF_IOV_ID)
0337     REFERENCES LMF_RUN_IOV(LMF_IOV_ID)
0338 )
0339 PARTITION BY RANGE ("LMF_IOV_ID")
0340 (PARTITION "LMF_CLS_IR_DAT_10" VALUES LESS THAN (1158000)
0341  TABLESPACE CMS_ECAL_LASER_COND_2010_DATA,
0342  PARTITION "LMF_CLS_IR_DAT_11" VALUES LESS THAN (2316000)
0343  TABLESPACE CMS_ECAL_LASER_COND_2011_DATA)
0344 /
0345 
0346 ALTER TABLE LMF_CLS_IR_DAT
0347   ADD CONSTRAINT LMF_CLS_IR_DAT_PK PRIMARY KEY (LMF_IOV_ID,LOGIC_ID,
0348         VMIN) USING INDEX LOCAL ENABLE
0349 /
0350 
0351 /* LMF_CORR_VERS */
0352 CREATE TABLE LMF_CORR_VERS
0353 (
0354   VERS NUMBER,
0355   DB_TIMESTAMP TIMESTAMP DEFAULT SYS_EXTRACT_UTC(SYSTIMESTAMP) NOT NULL,
0356   DESCR VARCHAR2(100),
0357   CONSTRAINTS LMF_CORR_VERS_PK PRIMARY KEY(VERS) USING INDEX LOCAL ENABLE
0358 )
0359 /
0360 
0361 INSERT INTO LMF_CORR_VERS VALUES (0, DEFAULT, 'none');
0362 INSERT INTO LMF_CORR_VERS VALUES (1, DEFAULT, 'default');
0363 
0364 /* LMF_IOV */
0365 CREATE TABLE LMF_IOV
0366 (
0367   IOV_ID    NUMBER,
0368   IOV_START DATE,
0369   IOV_STOP  DATE,
0370   VMIN      NUMBER,
0371   VMAX      NUMBER,
0372   CONSTRAINTS LMF_IOV_PK PRIMARY KEY(IOV_ID) USING INDEX LOCAL ENABLE,
0373   CONSTRAINTS LMF_IOV_FK1 FOREIGN KEY(VMIN) REFERENCES LMF_CORR_VERS(VERS),
0374   CONSTRAINTS LMF_IOV_FK2 FOREIGN KEY(VMAX) REFERENCES LMF_CORR_VERS(VERS)
0375 )
0376 PARTITION BY RANGE ("IOV_ID")
0377 (PARTITION "LMF_IOV_10" VALUES LESS THAN (2400)
0378  TABLESPACE CMS_ECAL_LASER_COND_2010_DATA,
0379  PARTITION "LMF_IOV_11" VALUES LESS THAN (4800)
0380  TABLESPACE CMS_ECAL_LASER_COND_2011_DATA)
0381 /
0382 
0383 /* LMF_LMR_SUB_IOV */
0384 CREATE TABLE LMF_LMR_SUB_IOV
0385 (
0386   LMR_SUB_IOV_ID     NUMBER,
0387   IOV_ID             NUMBER,
0388   T1                 DATE,
0389   T2                 DATE,
0390   T3                 DATE,
0391   CONSTRAINTS LMF_LMR_SUB_IOV_PK PRIMARY KEY(LMR_SUB_IOV_ID)
0392         USING INDEX LOCAL ENABLE,
0393   CONSTRAINTS LMF_LMR_SUB_IOV_FK FOREIGN KEY(IOV_ID) REFERENCES LMF_IOV
0394 )
0395 PARTITION BY RANGE ("LMR_SUB_IOV_ID")
0396 (PARTITION "LMF_LMR_SUB_IOV_10" VALUES LESS THAN (2400)
0397  TABLESPACE CMS_ECAL_LASER_COND_2010_DATA,
0398  PARTITION "LMF_LMR_SUB_IOV_11" VALUES LESS THAN (4800)
0399  TABLESPACE CMS_ECAL_LASER_COND_2011_DATA)
0400 /
0401 
0402 /* LMF_CORR_COEF_DAT */
0403 CREATE TABLE LMF_CORR_COEF_DAT
0404 (
0405   LMR_SUB_IOV_ID NUMBER NOT NULL,
0406   LOGIC_ID       NUMBER NOT NULL,
0407   P1             NUMBER, -- OR BINARY_FLOAT
0408   P2             NUMBER, -- OR BINARY_FLOAT
0409   P3             NUMBER, -- OR BINARY_FLOAT
0410   P1_ERR         NUMBER, -- OR BINARY_FLOAT
0411   P2_ERR         NUMBER, -- OR BINARY_FLOAT
0412   P3_ERR         NUMBER, -- OR BINARY_FLOAT
0413   FLAG           NUMBER,
0414   SEQ_ID         NUMBER
0415 )
0416 PARTITION BY RANGE ("LMR_SUB_IOV_ID")
0417 (PARTITION "LMF_CORR_COEF_DAT_10" VALUES LESS THAN (2400)
0418  TABLESPACE CMS_ECAL_LASER_COND_2010_DATA,
0419  PARTITION "LMF_CORR_COEF_DAT_11" VALUES LESS THAN (4800)
0420  TABLESPACE CMS_ECAL_LASER_COND_2011_DATA,
0421  PARTITION "LMF_CORR_COEF_DAT_11b" VALUES LESS THAN (10000) /* added 30-05-2011 */
0422  TABLESPACE CMS_ECAL_LASER_COND_2011_DATA)
0423 /
0424 
0425 ALTER TABLE LMF_CORR_COEF_DAT
0426   ADD CONSTRAINT LMF_CORR_COEF_DAT_PK PRIMARY KEY (LOGIC_ID, LMR_SUB_IOV_ID)
0427         USING INDEX LOCAL ENABLE
0428 /
0429 
0430 ALTER TABLE LMF_CORR_COEF_DAT
0431   ADD CONSTRAINT LMF_CORR_COEF_DAT_FK1 FOREIGN KEY (LMR_SUB_IOV_ID)
0432   REFERENCES LMF_LMR_SUB_IOV
0433 /
0434 
0435 ALTER TABLE LMF_CORR_COEF_DAT
0436  ADD CONSTRAINT LMF_CORR_COEF_DAT_FK2 FOREIGN KEY (SEQ_ID)
0437  REFERENCES LMF_SEQ_DAT
0438 /
0439 
0440 /*  RUN_LASERRUN_CONFIG_DAT  */
0441 CREATE TABLE RUN_LASERRUN_CONFIG_DAT
0442 (
0443   IOV_ID              NUMBER NOT NULL,
0444   LOGIC_ID            NUMBER NOT NULL,
0445   LASER_SEQUENCE_TYPE VARCHAR2(20),
0446   LASER_SEQUENCE_COND VARCHAR2(20)
0447 )
0448 /
0449 
0450 ALTER TABLE RUN_LASERRUN_CONFIG_DAT
0451   ADD CONSTRAINT RUN_LASERRUN_CONFIG_DAT_PK UNIQUE (IOV_ID,LOGIC_ID)
0452 /
0453 
0454 -- BLUE LASER PRIMITIVE TABLES
0455 
0456 /*  LMF_LASER_BLUE_PN_PRIM_DAT  */
0457 CREATE TABLE LMF_LASER_BLUE_PN_PRIM_DAT
0458 (
0459   LMF_IOV_ID        NUMBER NOT NULL,
0460   LOGIC_ID          NUMBER NOT NULL,
0461   SHAPE_COR_PN      NUMBER, 
0462   MEAN              NUMBER, -- or BINARY_FLOAT
0463   RMS               NUMBER, -- or BINARY_FLOAT
0464   M3                NUMBER, -- or BINARY_FLOAT
0465   PNA_OVER_PNB_MEAN NUMBER, -- or BINARY_FLOAT
0466   PNA_OVER_PNB_RMS  NUMBER, -- or BINARY_FLOAT
0467   PNA_OVER_PNB_M3   NUMBER, -- or BINARY_FLOAT
0468   FLAG              NUMBER,
0469   VMIN              NUMBER,
0470   VMAX              NUMBER,
0471   CONSTRAINTS LMF_LASER_BLUE_PN_PRIM_DAT_FK1 FOREIGN KEY(VMIN) 
0472     REFERENCES LMF_PRIM_VERS(VERS),
0473   CONSTRAINTS LMF_LASER_BLUE_PN_PRIM_DAT_FK2 FOREIGN KEY(VMAX) 
0474     REFERENCES LMF_PRIM_VERS(VERS)
0475 )
0476 PARTITION BY RANGE ("LMF_IOV_ID")
0477 (PARTITION "LMF_LASER_BLUE_PN_PRIM_DAT_10" VALUES LESS THAN (1158000)
0478  TABLESPACE CMS_ECAL_LASER_COND_2010_DATA,
0479  PARTITION "LMF_LASER_BLUE_PN_PRIM_DAT_11" VALUES LESS THAN (2316000)
0480  TABLESPACE CMS_ECAL_LASER_COND_2011_DATA)
0481 /
0482 
0483 ALTER TABLE LMF_LASER_BLUE_PN_PRIM_DAT
0484   ADD CONSTRAINT LMF_LASER_BLUE_PN_PRIM_DAT_PK PRIMARY KEY (LMF_IOV_ID,LOGIC_ID,
0485         VMIN) USING INDEX LOCAL ENABLE
0486 /
0487 
0488 ALTER TABLE LMF_LASER_BLUE_PN_PRIM_DAT
0489   ADD CONSTRAINT LMF_LASER_BLUE_PN_PRIM_DAT_FK3 FOREIGN KEY (LMF_IOV_ID)
0490   REFERENCES LMF_RUN_IOV
0491 /
0492 
0493 /*  LMF_LASER_BLUE_PULSE_DAT  */
0494 CREATE TABLE LMF_LASER_BLUE_PULSE_DAT
0495 (
0496   LMF_IOV_ID  NUMBER NOT NULL,
0497   LOGIC_ID    NUMBER NOT NULL,
0498   FIT_METHOD  NUMBER,
0499   MTQ_AMPL    NUMBER, -- OR BINARY_FLOAT
0500   MTQ_TIME    NUMBER, -- OR BINARY_FLOAT
0501   MTQ_RISE    NUMBER, -- OR BINARY_FLOAT
0502   MTQ_FWHM    NUMBER, -- OR BINARY_FLOAT
0503   MTQ_FW20    NUMBER, -- OR BINARY_FLOAT
0504   MTQ_FW80    NUMBER, -- OR BINARY_FLOAT
0505   MTQ_SLIDING NUMBER,  -- OR BINARY_FLOAT
0506   VMIN        NUMBER,
0507   VMAX        NUMBER,
0508   CONSTRAINTS LMF_LASER_BLUE_PULSE_DAT_FK1 FOREIGN KEY(VMIN) 
0509     REFERENCES LMF_PRIM_VERS(VERS),
0510   CONSTRAINTS LMF_LASER_BLUE_PULSE_DAT_FK2 FOREIGN KEY(VMAX) 
0511     REFERENCES LMF_PRIM_VERS(VERS)
0512 )
0513 PARTITION BY RANGE ("LMF_IOV_ID")
0514 (PARTITION "LMF_LASER_BLUE_PULSE_DAT_10" VALUES LESS THAN (1158000)
0515  TABLESPACE CMS_ECAL_LASER_COND_2010_DATA,
0516  PARTITION "LMF_LASER_BLUE_PULSE_DAT_11" VALUES LESS THAN (2316000)
0517  TABLESPACE CMS_ECAL_LASER_COND_2011_DATA)
0518 /
0519 
0520 ALTER TABLE LMF_LASER_BLUE_PULSE_DAT
0521   ADD CONSTRAINT LMF_LASER_BLUE_PULSE_DAT_PK PRIMARY KEY (LMF_IOV_ID,LOGIC_ID,
0522         VMIN) USING INDEX LOCAL ENABLE
0523 /
0524 
0525 ALTER TABLE LMF_LASER_BLUE_PULSE_DAT
0526   ADD CONSTRAINT LMF_LASER_BLUE_PULSE_DAT_FK3 FOREIGN KEY (LMF_IOV_ID)
0527   REFERENCES LMF_RUN_IOV(LMF_IOV_ID)
0528 /
0529 
0530 /*  LMF_TESTPULSE_PN_PRIM_DAT */
0531 CREATE TABLE LMF_TESTPULSE_PN_PRIM_DAT
0532 (
0533   LMF_IOV_ID        NUMBER NOT NULL,
0534   LOGIC_ID          NUMBER NOT NULL,
0535   MEAN              NUMBER, -- or BINARY_FLOAT
0536   RMS               NUMBER, -- or BINARY_FLOAT
0537   M3                NUMBER, -- or BINARY_FLOAT
0538   FLAG              NUMBER,
0539   VMIN              NUMBER,
0540   VMAX              NUMBER,
0541   CONSTRAINTS LMF_TESTPULSE_PN_PRIM_DAT_FK1 FOREIGN KEY(VMIN) 
0542     REFERENCES LMF_PRIM_VERS(VERS),
0543   CONSTRAINTS LMF_TESTPULSE_PN_PRIM_DAT_FK2 FOREIGN KEY(VMAX) 
0544     REFERENCES LMF_PRIM_VERS(VERS)
0545 )
0546 PARTITION BY RANGE ("LMF_IOV_ID")
0547 (PARTITION "LMF_TESTPULSE_PN_PRIM_DAT_10" VALUES LESS THAN (1158000)
0548  TABLESPACE CMS_ECAL_LASER_COND_2010_DATA,
0549  PARTITION "LMF_TESTPULSE_PN_PRIM_DAT_11" VALUES LESS THAN (2316000)
0550  TABLESPACE CMS_ECAL_LASER_COND_2011_DATA)
0551 /
0552 
0553 ALTER TABLE LMF_TESTPULSE_PN_PRIM_DAT
0554   ADD CONSTRAINT LMF_TESTPULSE_PN_DAT_PK PRIMARY KEY (LMF_IOV_ID,LOGIC_ID,
0555         VMIN) USING INDEX LOCAL ENABLE
0556 /
0557 
0558 ALTER TABLE LMF_TESTPULSE_PN_PRIM_DAT
0559   ADD CONSTRAINT LMF_TESTPULSE_PN_DAT_FK1 FOREIGN KEY (LMF_IOV_ID)
0560   REFERENCES LMF_RUN_IOV
0561 /
0562 
0563 /*  LMF_TESTPULSE_PRIM_DAT */
0564 CREATE TABLE LMF_TESTPULSE_PRIM_DAT
0565 (
0566   LMF_IOV_ID        NUMBER NOT NULL,
0567   LOGIC_ID          NUMBER NOT NULL,
0568   MEAN              NUMBER, -- or BINARY_FLOAT
0569   RMS               NUMBER, -- or BINARY_FLOAT
0570   M3                NUMBER, -- or BINARY_FLOAT
0571   FLAG              NUMBER,
0572   VMIN              NUMBER,
0573   VMAX              NUMBER,
0574   CONSTRAINTS LMF_TESTPULSE_PRIM_DAT_FK1 FOREIGN KEY(VMIN) 
0575     REFERENCES LMF_PRIM_VERS(VERS),
0576   CONSTRAINTS LMF_TESTPULSE_PRIM_DAT_FK2 FOREIGN KEY(VMAX) 
0577     REFERENCES LMF_PRIM_VERS(VERS)
0578 )
0579 PARTITION BY RANGE ("LMF_IOV_ID")
0580 (PARTITION "LMF_TESTPULSE_PRIM_DAT_10" VALUES LESS THAN (1158000)
0581  TABLESPACE CMS_ECAL_LASER_COND_2010_DATA,
0582  PARTITION "LMF_TESTPULSE_PRIM_DAT_11" VALUES LESS THAN (2316000)
0583  TABLESPACE CMS_ECAL_LASER_COND_2011_DATA)
0584 /
0585 
0586 ALTER TABLE LMF_TESTPULSE_PRIM_DAT
0587   ADD CONSTRAINT LMF_TESTPULSE_PRIM_DAT_PK PRIMARY KEY (LMF_IOV_ID,LOGIC_ID,
0588         VMIN) USING INDEX LOCAL ENABLE
0589 /
0590 
0591 ALTER TABLE LMF_TESTPULSE_PRIM_DAT
0592   ADD CONSTRAINT LMF_TESTPULSE_PRIM_DAT_FK3 FOREIGN KEY (LMF_IOV_ID)
0593   REFERENCES LMF_RUN_IOV
0594 /
0595 
0596 /*  LMF_LASER_BLUE_PRIM_DAT: done  */
0597 CREATE TABLE LMF_LASER_BLUE_PRIM_DAT
0598 (
0599   LMF_IOV_ID        NUMBER NOT NULL,
0600   LOGIC_ID          NUMBER NOT NULL,
0601   FLAG              NUMBER,
0602   MEAN              NUMBER, -- OR BINARY_FLOAT
0603   RMS               NUMBER, -- OR BINARY_FLOAT
0604   M3                NUMBER, -- OR BINARY_FLOAT
0605   APD_OVER_PNA_MEAN NUMBER, -- OR BINARY_FLOAT
0606   APD_OVER_PNA_RMS  NUMBER, -- OR BINARY_FLOAT
0607   APD_OVER_PNA_M3   NUMBER, -- OR BINARY_FLOAT
0608   APD_OVER_PNB_MEAN NUMBER, -- OR BINARY_FLOAT
0609   APD_OVER_PNB_RMS  NUMBER, -- OR BINARY_FLOAT
0610   APD_OVER_PNB_M3   NUMBER, -- OR BINARY_FLOAT
0611   APD_OVER_PN_MEAN  NUMBER, -- OR BINARY_FLOAT
0612   APD_OVER_PN_RMS   NUMBER, -- OR BINARY_FLOAT
0613   APD_OVER_PN_M3    NUMBER, -- OR BINARY_FLOAT
0614   ALPHA             NUMBER, -- OR BINARY_FLOAT
0615   BETA              NUMBER, -- OR BINARY_FLOAT
0616   SHAPE_COR         NUMBER, -- OR BINARY_FLOAT
0617   VMIN              NUMBER,
0618   VMAX              NUMBER,
0619   CONSTRAINTS LMF_LASER_BLUE_PRIM_DAT_FK1 FOREIGN KEY(VMIN) 
0620     REFERENCES LMF_PRIM_VERS(VERS),
0621   CONSTRAINTS LMF_LASER_BLUE_PRIM_DAT_FK2 FOREIGN KEY(VMAX) 
0622     REFERENCES LMF_PRIM_VERS(VERS)
0623 )
0624 PARTITION BY RANGE ("LMF_IOV_ID")
0625 (PARTITION "LMF_LASER_BLUE_PRIM_DAT_10" VALUES LESS THAN (1158000)
0626  TABLESPACE CMS_ECAL_LASER_COND_2010_DATA,
0627  PARTITION "LMF_LASER_BLUE_PRIM_DAT_11" VALUES LESS THAN (2316000)
0628  TABLESPACE CMS_ECAL_LASER_COND_2011_DATA)
0629 /
0630 
0631 ALTER TABLE LMF_LASER_BLUE_PRIM_DAT
0632   ADD CONSTRAINT LMF_LASER_BLUE_PRIM_DAT_PK PRIMARY KEY (LMF_IOV_ID,LOGIC_ID,
0633         VMIN) USING INDEX LOCAL ENABLE
0634 /
0635 
0636 ALTER TABLE LMF_LASER_BLUE_PRIM_DAT
0637   ADD CONSTRAINT LMF_LASER_BLUE_PRIM_DAT_FK3 FOREIGN KEY (LMF_IOV_ID)
0638   REFERENCES LMF_RUN_IOV(LMF_IOV_ID)
0639 /
0640 
0641 -- IR LASER PRIMITIVE TABLES
0642 
0643 /*  LMF_LASER_IR_PN_PRIM_DAT  */
0644 CREATE TABLE LMF_LASER_IR_PN_PRIM_DAT
0645 (
0646   LMF_IOV_ID        NUMBER NOT NULL,
0647   LOGIC_ID          NUMBER NOT NULL,
0648   SHAPE_COR_PN      NUMBER, 
0649   MEAN              NUMBER, -- or BINARY_FLOAT
0650   RMS               NUMBER, -- or BINARY_FLOAT
0651   M3                NUMBER, -- or BINARY_FLOAT
0652   PNA_OVER_PNB_MEAN NUMBER, -- or BINARY_FLOAT
0653   PNA_OVER_PNB_RMS  NUMBER, -- or BINARY_FLOAT
0654   PNA_OVER_PNB_M3   NUMBER, -- or BINARY_FLOAT
0655   FLAG              NUMBER,
0656   VMIN              NUMBER,
0657   VMAX              NUMBER,
0658   CONSTRAINTS LMF_LASER_IR_PN_PRIM_DAT_FK1 FOREIGN KEY(VMIN) 
0659     REFERENCES LMF_PRIM_VERS(VERS),
0660   CONSTRAINTS LMF_LASER_IR_PN_PRIM_DAT_FK2 FOREIGN KEY(VMAX) 
0661     REFERENCES LMF_PRIM_VERS(VERS)
0662 )
0663 PARTITION BY RANGE ("LMF_IOV_ID")
0664 (PARTITION "LMF_LASER_IR_PN_PRIM_DAT_10" VALUES LESS THAN (1158000)
0665  TABLESPACE CMS_ECAL_LASER_COND_2010_DATA,
0666  PARTITION "LMF_LASER_IR_PN_PRIM_DAT_11" VALUES LESS THAN (2316000)
0667  TABLESPACE CMS_ECAL_LASER_COND_2011_DATA)
0668 /
0669 
0670 ALTER TABLE LMF_LASER_IR_PN_PRIM_DAT
0671   ADD CONSTRAINT LMF_LASER_IR_PN_PRIM_DAT_PK PRIMARY KEY (LMF_IOV_ID,LOGIC_ID,
0672         VMIN) USING INDEX LOCAL ENABLE
0673 /
0674 
0675 ALTER TABLE LMF_LASER_IR_PN_PRIM_DAT
0676   ADD CONSTRAINT LMF_LASER_IR_PN_PRIM_DAT_FK3 FOREIGN KEY (LMF_IOV_ID)
0677   REFERENCES LMF_RUN_IOV
0678 /
0679 
0680 /*  LMF_LASER_IR_PULSE_DAT  */
0681 CREATE TABLE LMF_LASER_IR_PULSE_DAT
0682 (
0683   LMF_IOV_ID  NUMBER NOT NULL,
0684   LOGIC_ID    NUMBER NOT NULL,
0685   FIT_METHOD  NUMBER,
0686   MTQ_AMPL    NUMBER, -- OR BINARY_FLOAT
0687   MTQ_TIME    NUMBER, -- OR BINARY_FLOAT
0688   MTQ_RISE    NUMBER, -- OR BINARY_FLOAT
0689   MTQ_FWHM    NUMBER, -- OR BINARY_FLOAT
0690   MTQ_FW20    NUMBER, -- OR BINARY_FLOAT
0691   MTQ_FW80    NUMBER, -- OR BINARY_FLOAT
0692   MTQ_SLIDING NUMBER, -- OR BINARY_FLOAT
0693   VMIN        NUMBER,
0694   VMAX        NUMBER,
0695   CONSTRAINTS LMF_LASER_IR_PULSE_DAT_FK1 FOREIGN KEY(VMIN) 
0696     REFERENCES LMF_PRIM_VERS(VERS),
0697   CONSTRAINTS LMF_LASER_IR_PULSE_DAT_FK2 FOREIGN KEY(VMAX) 
0698     REFERENCES LMF_PRIM_VERS(VERS)
0699 )
0700 PARTITION BY RANGE ("LMF_IOV_ID")
0701 (PARTITION "LMF_LASER_IR_PULSE_DAT_10" VALUES LESS THAN (1158000)
0702  TABLESPACE CMS_ECAL_LASER_COND_2010_DATA,
0703  PARTITION "LMF_LASER_IR_PULSE_DAT_11" VALUES LESS THAN (2316000)
0704  TABLESPACE CMS_ECAL_LASER_COND_2011_DATA)
0705 /
0706 
0707 ALTER TABLE LMF_LASER_IR_PULSE_DAT
0708   ADD CONSTRAINT LMF_LASER_IR_PULSE_DAT_PK PRIMARY KEY (LMF_IOV_ID,LOGIC_ID,
0709         VMIN) USING INDEX LOCAL ENABLE
0710 /
0711 
0712 ALTER TABLE LMF_LASER_IR_PULSE_DAT
0713   ADD CONSTRAINT LMF_LASER_IR_PULSE_DAT_FK3 FOREIGN KEY (LMF_IOV_ID)
0714   REFERENCES LMF_RUN_IOV(LMF_IOV_ID)
0715 /
0716 
0717 /*  LMF_LASER_IR_PRIM_DAT  */
0718 CREATE TABLE LMF_LASER_IR_PRIM_DAT
0719 (
0720   LMF_IOV_ID        NUMBER NOT NULL,
0721   LOGIC_ID          NUMBER NOT NULL,
0722   FLAG              NUMBER,
0723   MEAN              NUMBER, -- OR BINARY_FLOAT
0724   RMS               NUMBER, -- OR BINARY_FLOAT
0725   M3                NUMBER, -- OR BINARY_FLOAT
0726   APD_OVER_PNA_MEAN NUMBER, -- OR BINARY_FLOAT
0727   APD_OVER_PNA_RMS  NUMBER, -- OR BINARY_FLOAT
0728   APD_OVER_PNA_M3   NUMBER, -- OR BINARY_FLOAT
0729   APD_OVER_PNB_MEAN NUMBER, -- OR BINARY_FLOAT
0730   APD_OVER_PNB_RMS  NUMBER, -- OR BINARY_FLOAT
0731   APD_OVER_PNB_M3   NUMBER, -- OR BINARY_FLOAT
0732   APD_OVER_PN_MEAN  NUMBER, -- OR BINARY_FLOAT
0733   APD_OVER_PN_RMS   NUMBER, -- OR BINARY_FLOAT
0734   APD_OVER_PN_M3    NUMBER, -- OR BINARY_FLOAT
0735   ALPHA             NUMBER, -- OR BINARY_FLOAT
0736   BETA              NUMBER, -- OR BINARY_FLOAT
0737   SHAPE_COR         NUMBER, -- OR BINARY_FLOAT
0738   VMIN              NUMBER,
0739   VMAX              NUMBER,
0740   CONSTRAINTS LMF_LASER_IR_PRIM_DAT_FK1 FOREIGN KEY(VMIN) 
0741     REFERENCES LMF_PRIM_VERS(VERS),
0742   CONSTRAINTS LMF_LASER_IR_PRIM_DAT_FK2 FOREIGN KEY(VMAX) 
0743     REFERENCES LMF_PRIM_VERS(VERS)
0744 )
0745 PARTITION BY RANGE ("LMF_IOV_ID")
0746 (PARTITION "LMF_LASER_IR_PRIM_DAT_10" VALUES LESS THAN (1158000)
0747  TABLESPACE CMS_ECAL_LASER_COND_2010_DATA,
0748  PARTITION "LMF_LASER_IR_PRIM_DAT_11" VALUES LESS THAN (2316000)
0749  TABLESPACE CMS_ECAL_LASER_COND_2011_DATA)
0750 /
0751 
0752 ALTER TABLE LMF_LASER_IR_PRIM_DAT
0753   ADD CONSTRAINT LMF_LASER_IR_PRIM_DAT_PK PRIMARY KEY (LMF_IOV_ID,LOGIC_ID,
0754         VMIN) USING INDEX LOCAL ENABLE
0755 /
0756 
0757 ALTER TABLE LMF_LASER_IR_PRIM_DAT
0758   ADD CONSTRAINT LMF_LASER_IR_PRIM_DAT_FK3 FOREIGN KEY (LMF_IOV_ID)
0759   REFERENCES LMF_RUN_IOV(LMF_IOV_ID)
0760 /
0761 
0762 -- BLUE LED PRIMITIVE TABLES
0763 
0764 /*  LMF_LED_BLUE_PN_PRIM_DAT  */
0765 CREATE TABLE LMF_LED_BLUE_PN_PRIM_DAT
0766 (
0767   LMF_IOV_ID        NUMBER NOT NULL,
0768   LOGIC_ID          NUMBER NOT NULL,
0769   MEAN              NUMBER, -- or BINARY_FLOAT
0770   RMS               NUMBER, -- or BINARY_FLOAT
0771   M3                NUMBER, -- or BINARY_FLOAT
0772   PNA_OVER_PNB_MEAN NUMBER, -- or BINARY_FLOAT
0773   PNA_OVER_PNB_RMS  NUMBER, -- or BINARY_FLOAT
0774   PNA_OVER_PNB_M3   NUMBER, -- or BINARY_FLOAT
0775   FLAG              NUMBER,
0776   VMIN              NUMBER,
0777   VMAX              NUMBER,
0778   CONSTRAINTS LMF_LED_BLUE_PN_PRIM_DAT_FK1 FOREIGN KEY(VMIN) 
0779     REFERENCES LMF_PRIM_VERS(VERS),
0780   CONSTRAINTS LMF_LED_BLUE_PN_PRIM_DAT_FK2 FOREIGN KEY(VMAX) 
0781     REFERENCES LMF_PRIM_VERS(VERS)
0782 )
0783 PARTITION BY RANGE ("LMF_IOV_ID")
0784 (PARTITION "LMF_LED_BLUE_PN_PRIM_DAT_10" VALUES LESS THAN (1158000)
0785  TABLESPACE CMS_ECAL_LASER_COND_2010_DATA,
0786  PARTITION "LMF_LED_BLUE_PN_PRIM_DAT_11" VALUES LESS THAN (2316000)
0787  TABLESPACE CMS_ECAL_LASER_COND_2011_DATA)
0788 /
0789 
0790 ALTER TABLE LMF_LED_BLUE_PN_PRIM_DAT
0791   ADD CONSTRAINT LMF_LED_BLUE_PN_PRIM_DAT_PK PRIMARY KEY (LMF_IOV_ID,LOGIC_ID,
0792         VMIN) USING INDEX LOCAL ENABLE 
0793 /
0794 
0795 ALTER TABLE LMF_LED_BLUE_PN_PRIM_DAT
0796   ADD CONSTRAINT LMF_LED_BLUE_PN_PRIM_DAT_FK3 FOREIGN KEY (LMF_IOV_ID)
0797   REFERENCES LMF_RUN_IOV
0798 /
0799 
0800 /*  LMF_LED_BLUE_PRIM_DAT  */
0801 CREATE TABLE LMF_LED_BLUE_PRIM_DAT
0802 (
0803   LMF_IOV_ID        NUMBER NOT NULL,
0804   LOGIC_ID          NUMBER NOT NULL,
0805   FLAG              NUMBER,
0806   MEAN              NUMBER, -- OR BINARY_FLOAT
0807   RMS               NUMBER, -- OR BINARY_FLOAT
0808   M3                NUMBER, -- OR BINARY_FLOAT
0809   APD_OVER_PNA_MEAN NUMBER, -- OR BINARY_FLOAT
0810   APD_OVER_PNA_RMS  NUMBER, -- OR BINARY_FLOAT
0811   APD_OVER_PNA_M3   NUMBER, -- OR BINARY_FLOAT
0812   APD_OVER_PNB_MEAN NUMBER, -- OR BINARY_FLOAT
0813   APD_OVER_PNB_RMS  NUMBER, -- OR BINARY_FLOAT
0814   APD_OVER_PNB_M3   NUMBER, -- OR BINARY_FLOAT
0815   APD_OVER_PN_MEAN  NUMBER, -- OR BINARY_FLOAT
0816   APD_OVER_PN_RMS   NUMBER, -- OR BINARY_FLOAT
0817   APD_OVER_PN_M3    NUMBER, -- OR BINARY_FLOAT
0818   ALPHA             NUMBER, -- OR BINARY_FLOAT
0819   BETA              NUMBER, -- OR BINARY_FLOAT
0820   SHAPE_COR         NUMBER, -- OR BINARY_FLOAT
0821   VMIN              NUMBER,
0822   VMAX              NUMBER,
0823   CONSTRAINTS LMF_LED_BLUE_PRIM_DAT_FK1 FOREIGN KEY(VMIN) 
0824     REFERENCES LMF_PRIM_VERS(VERS),
0825   CONSTRAINTS LMF_LED_BLUE_PRIM_DAT_FK2 FOREIGN KEY(VMAX) 
0826     REFERENCES LMF_PRIM_VERS(VERS)
0827 )
0828 PARTITION BY RANGE ("LMF_IOV_ID")
0829 (PARTITION "LMF_LED_BLUE_PRIM_DAT_10" VALUES LESS THAN (1158000)
0830  TABLESPACE CMS_ECAL_LASER_COND_2010_DATA,
0831  PARTITION "LMF_LED_BLUE_PRIM_DAT_11" VALUES LESS THAN (2316000)
0832  TABLESPACE CMS_ECAL_LASER_COND_2011_DATA)
0833 /
0834 
0835 ALTER TABLE LMF_LED_BLUE_PRIM_DAT
0836   ADD CONSTRAINT LMF_LED_BLUE_PRIM_DAT_PK PRIMARY KEY (LMF_IOV_ID,LOGIC_ID,
0837         VMIN) USING INDEX LOCAL ENABLE
0838 /
0839 
0840 ALTER TABLE LMF_LED_BLUE_PRIM_DAT
0841   ADD CONSTRAINT LMF_LED_BLUE_PRIM_DAT_FK3 FOREIGN KEY (LMF_IOV_ID)
0842   REFERENCES LMF_RUN_IOV(LMF_IOV_ID)
0843 /
0844 
0845 -- ORANGE LED PRIMITIVE TABLES
0846 
0847 /*  LMF_LED_ORANGE_PN_PRIM_DAT  */
0848 CREATE TABLE LMF_LED_ORANGE_PN_PRIM_DAT
0849 (
0850   LMF_IOV_ID        NUMBER NOT NULL,
0851   LOGIC_ID          NUMBER NOT NULL,
0852   MEAN              NUMBER, -- or BINARY_FLOAT
0853   RMS               NUMBER, -- or BINARY_FLOAT
0854   M3                NUMBER, -- or BINARY_FLOAT
0855   PNA_OVER_PNB_MEAN NUMBER, -- or BINARY_FLOAT
0856   PNA_OVER_PNB_RMS  NUMBER, -- or BINARY_FLOAT
0857   PNA_OVER_PNB_M3   NUMBER, -- or BINARY_FLOAT
0858   FLAG              NUMBER,
0859   VMIN              NUMBER,
0860   VMAX              NUMBER,
0861   CONSTRAINTS LMF_LED_ORANGE_PN_PRIM_DAT_FK1 FOREIGN KEY(VMIN) 
0862     REFERENCES LMF_PRIM_VERS(VERS),
0863   CONSTRAINTS LMF_LED_ORANGE_PN_PRIM_DAT_FK2 FOREIGN KEY(VMAX) 
0864     REFERENCES LMF_PRIM_VERS(VERS)
0865 )
0866 PARTITION BY RANGE ("LMF_IOV_ID")
0867 (PARTITION "LMF_LED_ORANGE_PN_PRIM_DAT_10" VALUES LESS THAN (1158000)
0868  TABLESPACE CMS_ECAL_LASER_COND_2010_DATA,
0869  PARTITION "LMF_LED_ORANGE_PN_PRIM_DAT_11" VALUES LESS THAN (2316000)
0870  TABLESPACE CMS_ECAL_LASER_COND_2011_DATA)
0871 /
0872 
0873 ALTER TABLE LMF_LED_ORANGE_PN_PRIM_DAT
0874   ADD CONSTRAINT LMF_LED_ORANGE_PN_PRIM_DAT_PK PRIMARY KEY (LMF_IOV_ID,LOGIC_ID,
0875         VMIN) USING INDEX LOCAL ENABLE
0876 /
0877 
0878 ALTER TABLE LMF_LED_ORANGE_PN_PRIM_DAT
0879   ADD CONSTRAINT LMF_LED_ORANGE_PN_PRIM_DAT_FK3 FOREIGN KEY (LMF_IOV_ID)
0880   REFERENCES LMF_RUN_IOV
0881 /
0882 
0883 /*  LMF_LED_ORANGE_PRIM_DAT  */
0884 CREATE TABLE LMF_LED_ORANGE_PRIM_DAT
0885 (
0886   LMF_IOV_ID        NUMBER NOT NULL,
0887   LOGIC_ID          NUMBER NOT NULL,
0888   FLAG              NUMBER,
0889   MEAN              NUMBER, -- OR BINARY_FLOAT
0890   RMS               NUMBER, -- OR BINARY_FLOAT
0891   M3                NUMBER, -- OR BINARY_FLOAT
0892   APD_OVER_PNA_MEAN NUMBER, -- OR BINARY_FLOAT
0893   APD_OVER_PNA_RMS  NUMBER, -- OR BINARY_FLOAT
0894   APD_OVER_PNA_M3   NUMBER, -- OR BINARY_FLOAT
0895   APD_OVER_PNB_MEAN NUMBER, -- OR BINARY_FLOAT
0896   APD_OVER_PNB_RMS  NUMBER, -- OR BINARY_FLOAT
0897   APD_OVER_PNB_M3   NUMBER, -- OR BINARY_FLOAT
0898   APD_OVER_PN_MEAN  NUMBER, -- OR BINARY_FLOAT
0899   APD_OVER_PN_RMS   NUMBER, -- OR BINARY_FLOAT
0900   APD_OVER_PN_M3    NUMBER, -- OR BINARY_FLOAT
0901   ALPHA             NUMBER, -- OR BINARY_FLOAT
0902   BETA              NUMBER, -- OR BINARY_FLOAT
0903   SHAPE_COR         NUMBER, -- OR BINARY_FLOAT
0904   VMIN              NUMBER,
0905   VMAX              NUMBER,
0906   CONSTRAINTS LMF_LED_ORANGE_PRIM_DAT_FK1 FOREIGN KEY(VMIN) 
0907     REFERENCES LMF_PRIM_VERS(VERS),
0908   CONSTRAINTS LMF_LED_ORANGE_PRIM_DAT_FK2 FOREIGN KEY(VMAX) 
0909     REFERENCES LMF_PRIM_VERS(VERS)
0910 )
0911 PARTITION BY RANGE ("LMF_IOV_ID")
0912 (PARTITION "LMF_LED_ORANGE_PRIM_DAT_10" VALUES LESS THAN (1158000)
0913  TABLESPACE CMS_ECAL_LASER_COND_2010_DATA,
0914  PARTITION "LMF_LED_ORANGE_PRIM_DAT_11" VALUES LESS THAN (2316000)
0915  TABLESPACE CMS_ECAL_LASER_COND_2011_DATA)
0916 /
0917 
0918 ALTER TABLE LMF_LED_ORANGE_PRIM_DAT
0919   ADD CONSTRAINT LMF_LED_ORANGE_PRIM_DAT_PK PRIMARY KEY (LMF_IOV_ID,LOGIC_ID,
0920         VMIN) USING INDEX LOCAL ENABLE
0921 /
0922 
0923 ALTER TABLE LMF_LED_ORANGE_PRIM_DAT
0924   ADD CONSTRAINT LMF_LED_ORANGE_PRIM_DAT_FK3 FOREIGN KEY (LMF_IOV_ID)
0925   REFERENCES LMF_RUN_IOV(LMF_IOV_ID)
0926 /
0927 
0928 PROMPT "Creating indices";
0929 
0930 CREATE INDEX LMF_RUN_STRT_IX ON LMF_RUN_IOV(SUBRUN_START) LOCAL
0931   (PARTITION LMF_RUN_IOV_10 TABLESPACE CMS_ECAL_LASER_COND_2010_DATA,
0932    PARTITION LMF_RUN_IOV_11 TABLESPACE CMS_ECAL_LASER_COND_2011_DATA)
0933 /
0934 
0935 CREATE INDEX LMF_RUN_END_IX ON LMF_RUN_IOV(SUBRUN_END) LOCAL
0936   (PARTITION LMF_RUN_IOV_10 TABLESPACE CMS_ECAL_LASER_COND_2010_DATA,
0937    PARTITION LMF_RUN_IOV_11 TABLESPACE CMS_ECAL_LASER_COND_2011_DATA)
0938 /
0939 
0940 CREATE INDEX LMF_SEQ_DAT_IX ON LMF_SEQ_DAT(RUN_IOV_ID) LOCAL
0941   (PARTITION LMF_SEQ_DAT_10 TABLESPACE CMS_ECAL_LASER_COND_2010_DATA,
0942    PARTITION LMF_SEQ_DAT_11 TABLESPACE CMS_ECAL_LASER_COND_2011_DATA)
0943 /
0944 
0945 CREATE INDEX LMF_IOV_START_IX ON LMF_IOV(IOV_START) LOCAL
0946   (PARTITION LMF_IOV_10 TABLESPACE CMS_ECAL_LASER_COND_2010_DATA,
0947    PARTITION LMF_IOV_11 TABLESPACE CMS_ECAL_LASER_COND_2011_DATA)
0948 /
0949 CREATE INDEX LMF_IOV_STOP_IX ON LMF_IOV(IOV_STOP) LOCAL
0950   (PARTITION LMF_IOV_10 TABLESPACE CMS_ECAL_LASER_COND_2010_DATA,
0951    PARTITION LMF_IOV_11 TABLESPACE CMS_ECAL_LASER_COND_2011_DATA)
0952 /
0953 
0954 CREATE INDEX RUN_LASRRUN_CONFIG_DAT_IX ON RUN_LASERRUN_CONFIG_DAT(IOV_ID)
0955 /
0956 
0957 CREATE INDEX LMF_LMR_SUB_IOV_IX ON LMF_LMR_SUB_IOV(T1) LOCAL
0958   (PARTITION LMF_LMR_SUB_IOV_10 TABLESPACE CMS_ECAL_LASER_COND_2010_DATA,
0959    PARTITION LMF_LMR_SUB_IOV_11 TABLESPACE CMS_ECAL_LASER_COND_2011_DATA)
0960 /
0961 
0962 /* FOREIGN KEYS INDEXES */
0963 
0964 CREATE INDEX LMF_CLS_BLUE_DAT_FIX1 ON LMF_CLS_BLUE_DAT(LMF_IOV_ID) LOCAL
0965 /
0966 CREATE INDEX LMF_CLS_BLUE_DAT_FIX2 ON LMF_CLS_BLUE_DAT(LMF_IOV_ID_REF) LOCAL
0967   (PARTITION LMF_CLS_BLUE_DAT_10 TABLESPACE CMS_ECAL_LASER_COND_2010_DATA,
0968    PARTITION LMF_CLS_BLUE_DAT_11 TABLESPACE CMS_ECAL_LASER_COND_2011_DATA)
0969 /
0970 
0971 CREATE INDEX LMF_CLS_IR_DAT_FIX1 ON LMF_CLS_IR_DAT(LMF_IOV_ID) LOCAL
0972 /
0973 CREATE INDEX LMF_CLS_IR_DAT_FIX2 ON LMF_CLS_IR_DAT(LMF_IOV_ID_REF) LOCAL
0974   (PARTITION LMF_CLS_IR_DAT_10 TABLESPACE CMS_ECAL_LASER_COND_2010_DATA,
0975    PARTITION LMF_CLS_IR_DAT_11 TABLESPACE CMS_ECAL_LASER_COND_2011_DATA)
0976 /
0977 
0978 CREATE INDEX LMF_RUN_IOV_FIX1 ON LMF_RUN_IOV(SEQ_ID) LOCAL
0979   (PARTITION LMF_RUN_IOV_10 TABLESPACE CMS_ECAL_LASER_COND_2010_DATA,
0980    PARTITION LMF_RUN_IOV_11 TABLESPACE CMS_ECAL_LASER_COND_2011_DATA)
0981 /
0982 CREATE INDEX LMF_RUN_IOV_FIX2 ON LMF_RUN_IOV(TAG_ID) LOCAL
0983   (PARTITION LMF_RUN_IOV_10 TABLESPACE CMS_ECAL_LASER_COND_2010_DATA,
0984    PARTITION LMF_RUN_IOV_11 TABLESPACE CMS_ECAL_LASER_COND_2011_DATA)
0985 /
0986 CREATE INDEX LMF_RUN_IOV_FIX3 ON LMF_RUN_IOV(COLOR_ID) LOCAL
0987   (PARTITION LMF_RUN_IOV_10 TABLESPACE CMS_ECAL_LASER_COND_2010_DATA,
0988    PARTITION LMF_RUN_IOV_11 TABLESPACE CMS_ECAL_LASER_COND_2011_DATA)
0989 /
0990 CREATE INDEX LMF_RUN_IOV_FIX4 ON LMF_RUN_IOV(TRIG_TYPE) LOCAL
0991   (PARTITION LMF_RUN_IOV_10 TABLESPACE CMS_ECAL_LASER_COND_2010_DATA,
0992    PARTITION LMF_RUN_IOV_11 TABLESPACE CMS_ECAL_LASER_COND_2011_DATA)
0993 /
0994 
0995 CREATE INDEX LMF_LASER_BLUE_PULSE_DAT_FIX ON LMF_LASER_BLUE_PULSE_DAT(LMF_IOV_ID) LOCAL
0996 /
0997 
0998 CREATE INDEX LMF_LASER_CONFIG_DAT_FIX ON LMF_LASER_CONFIG_DAT(LMF_IOV_ID) LOCAL
0999 /
1000 
1001 CREATE INDEX LMF_RUN_DAT_FIX ON LMF_RUN_DAT(LMF_IOV_ID) LOCAL
1002 /
1003 
1004 CREATE INDEX LMF_TEST_PULSE_CONFIG_DAT_FIX ON LMF_TEST_PULSE_CONFIG_DAT(LMF_IOV_ID) LOCAL
1005 /   
1006 
1007 CREATE INDEX LMF_LMR_SUB_IOV_FIX ON LMF_LMR_SUB_IOV(IOV_ID) LOCAL
1008   (PARTITION LMF_LMR_SUB_IOV_10 TABLESPACE CMS_ECAL_LASER_COND_2010_DATA,
1009    PARTITION LMF_LMR_SUB_IOV_11 TABLESPACE CMS_ECAL_LASER_COND_2011_DATA)
1010 /
1011 
1012 CREATE INDEX LMF_CORR_COEF_DAT_FIX1 ON LMF_CORR_COEF_DAT(LMR_SUB_IOV_ID) LOCAL
1013   (PARTITION LMF_CORR_COEF_DAT_10 TABLESPACE CMS_ECAL_LASER_COND_2010_DATA,
1014    PARTITION LMF_CORR_COEF_DAT_11 TABLESPACE CMS_ECAL_LASER_COND_2011_DATA)
1015 /
1016 
1017 CREATE INDEX LMF_CORR_COEF_DAT_FIX2 ON LMF_CORR_COEF_DAT(SEQ_ID) LOCAL
1018   (PARTITION LMF_CORR_COEF_DAT_10 TABLESPACE CMS_ECAL_LASER_COND_2010_DATA,
1019    PARTITION LMF_CORR_COEF_DAT_11 TABLESPACE CMS_ECAL_LASER_COND_2011_DATA)
1020 /
1021 
1022 CREATE INDEX LMF_LASER_BLUE_PN_PRIM_DAT_FIX ON LMF_LASER_BLUE_PN_PRIM_DAT(LMF_IOV_ID) LOCAL
1023 /
1024 
1025 CREATE INDEX LMF_TESTPULSE_PN_PRIM_DAT_FIX ON LMF_TESTPULSE_PN_PRIM_DAT(LMF_IOV_ID) LOCAL
1026 /
1027 
1028 CREATE INDEX LMF_TESTPULSE_PRIM_DAT_FIX ON LMF_TESTPULSE_PRIM_DAT(LMF_IOV_ID) LOCAL
1029 /
1030 
1031 CREATE INDEX LMF_LASER_BLUE_PRIM_DAT_FIX ON LMF_LASER_BLUE_PRIM_DAT(LMF_IOV_ID) LOCAL
1032 /
1033 
1034 CREATE INDEX LMF_LASER_IR_PN_PRIM_DAT_FIX ON LMF_LASER_IR_PN_PRIM_DAT(LMF_IOV_ID) LOCAL
1035 /
1036 
1037 CREATE INDEX LMF_LASER_IR_PULSE_DAT_FIX ON LMF_LASER_IR_PULSE_DAT(LMF_IOV_ID) LOCAL
1038 /
1039 
1040 CREATE INDEX LMF_LASER_IR_PRIM_DAT_FIX ON LMF_LASER_IR_PRIM_DAT(LMF_IOV_ID) LOCAL
1041 /
1042 
1043 CREATE INDEX LMF_LED_BLUE_PN_PRIM_DAT_FIX ON LMF_LED_BLUE_PN_PRIM_DAT(LMF_IOV_ID) LOCAL
1044 /
1045 
1046 CREATE INDEX LMF_LED_BLUE_PRIM_DAT_FIX ON LMF_LED_BLUE_PRIM_DAT(LMF_IOV_ID) LOCAL
1047 /
1048 
1049 /* VMIN, VMAX indices */
1050 CREATE INDEX LMF_SEQ_FKIX ON LMF_SEQ_DAT(VMIN) LOCAL 
1051   (PARTITION LMF_SEQ_DAT_10 TABLESPACE CMS_ECAL_LASER_COND_2010_DATA, 
1052    PARTITION LMF_SEQ_DAT_11 TABLESPACE CMS_ECAL_LASER_COND_2011_DATA)
1053 /
1054 CREATE INDEX LMF_CLS_BLUE_FKIX ON LMF_CLS_BLUE_DAT(VMIN) LOCAL 
1055   (PARTITION LMF_CLS_BLUE_DAT_10 TABLESPACE CMS_ECAL_LASER_COND_2010_DATA, 
1056    PARTITION LMF_CLS_BLUE_DAT_11 TABLESPACE CMS_ECAL_LASER_COND_2011_DATA)
1057 /
1058 CREATE INDEX LMF_CLS_IR_FKIX ON LMF_CLS_IR_DAT(VMIN) LOCAL 
1059   (PARTITION LMF_CLS_IR_DAT_10 TABLESPACE CMS_ECAL_LASER_COND_2010_DATA, 
1060    PARTITION LMF_CLS_IR_DAT_11 TABLESPACE CMS_ECAL_LASER_COND_2011_DATA)
1061 /
1062 CREATE INDEX LMF_IOVFKIX ON LMF_IOV(VMIN) LOCAL 
1063   (PARTITION LMF_IOV10 TABLESPACE CMS_ECAL_LASER_COND_2010_DATA, 
1064    PARTITION LMF_IOV11 TABLESPACE CMS_ECAL_LASER_COND_2011_DATA)
1065 /
1066 CREATE INDEX LMF_LASER_BLUE_PULSE_FKIX ON LMF_LASER_BLUE_PULSE_DAT(VMIN) LOCAL 
1067   (PARTITION LMF_LASER_BLUE_PULSE_DAT_10 TABLESPACE CMS_ECAL_LASER_COND_2010_DATA, 
1068    PARTITION LMF_LASER_BLUE_PULSE_DAT_11 TABLESPACE CMS_ECAL_LASER_COND_2011_DATA)
1069 /
1070 CREATE INDEX LMF_LASER_BLUE_PN_PRIM_FKIX ON LMF_LASER_BLUE_PN_PRIM_DAT(VMIN) LOCAL 
1071   (PARTITION LMF_LASER_BLUE_PN_PRIM_DAT_10 TABLESPACE CMS_ECAL_LASER_COND_2010_DATA, 
1072    PARTITION LMF_LASER_BLUE_PN_PRIM_DAT_11 TABLESPACE CMS_ECAL_LASER_COND_2011_DATA)
1073 /
1074 CREATE INDEX LMF_LASER_BLUE_PRIM_FKIX ON LMF_LASER_BLUE_PRIM_DAT(VMIN) LOCAL 
1075   (PARTITION LMF_LASER_BLUE_PRIM_DAT_10 TABLESPACE CMS_ECAL_LASER_COND_2010_DATA, 
1076    PARTITION LMF_LASER_BLUE_PRIM_DAT_11 TABLESPACE CMS_ECAL_LASER_COND_2011_DATA)
1077 /
1078 CREATE INDEX LMF_LED_BLUE_PN_PRIM_FKIX ON LMF_LED_BLUE_PN_PRIM_DAT(VMIN) LOCAL 
1079   (PARTITION LMF_LED_BLUE_PN_PRIM_DAT_10 TABLESPACE CMS_ECAL_LASER_COND_2010_DATA, 
1080    PARTITION LMF_LED_BLUE_PN_PRIM_DAT_11 TABLESPACE CMS_ECAL_LASER_COND_2011_DATA)
1081 /
1082 CREATE INDEX LMF_LED_BLUE_PRIM_FKIX ON LMF_LED_BLUE_PRIM_DAT(VMIN) LOCAL 
1083   (PARTITION LMF_LED_BLUE_PRIM_DAT_10 TABLESPACE CMS_ECAL_LASER_COND_2010_DATA, 
1084    PARTITION LMF_LED_BLUE_PRIM_DAT_11 TABLESPACE CMS_ECAL_LASER_COND_2011_DATA)
1085 /
1086 CREATE INDEX LMF_LED_ORANGE_PN_PRIM_FKIX ON LMF_LED_ORANGE_PN_PRIM_DAT(VMIN) LOCAL 
1087   (PARTITION LMF_LED_ORANGE_PN_PRIM_DAT_10 TABLESPACE CMS_ECAL_LASER_COND_2010_DATA, 
1088    PARTITION LMF_LED_ORANGE_PN_PRIM_DAT_11 TABLESPACE CMS_ECAL_LASER_COND_2011_DATA)
1089 /
1090 CREATE INDEX LMF_LED_ORANGE_PRIM_FKIX ON LMF_LED_ORANGE_PRIM_DAT(VMIN) LOCAL 
1091   (PARTITION LMF_LED_ORANGE_PRIM_DAT_10 TABLESPACE CMS_ECAL_LASER_COND_2010_DATA, 
1092    PARTITION LMF_LED_ORANGE_PRIM_DAT_11 TABLESPACE CMS_ECAL_LASER_COND_2011_DATA)
1093 /
1094 CREATE INDEX LMF_LASER_IR_PULSE_FKIX ON LMF_LASER_IR_PULSE_DAT(VMIN) LOCAL 
1095   (PARTITION LMF_LASER_IR_PULSE_DAT_10 TABLESPACE CMS_ECAL_LASER_COND_2010_DATA, 
1096    PARTITION LMF_LASER_IR_PULSE_DAT_11 TABLESPACE CMS_ECAL_LASER_COND_2011_DATA)
1097 /
1098 CREATE INDEX LMF_LASER_IR_PN_PRIM_FKIX ON LMF_LASER_IR_PN_PRIM_DAT(VMIN) LOCAL 
1099   (PARTITION LMF_LASER_IR_PN_PRIM_DAT_10 TABLESPACE CMS_ECAL_LASER_COND_2010_DATA, 
1100    PARTITION LMF_LASER_IR_PN_PRIM_DAT_11 TABLESPACE CMS_ECAL_LASER_COND_2011_DATA)
1101 /
1102 CREATE INDEX LMF_LASER_IR_PRIM_FKIX ON LMF_LASER_IR_PRIM_DAT(VMIN) LOCAL 
1103   (PARTITION LMF_LASER_IR_PRIM_DAT_10 TABLESPACE CMS_ECAL_LASER_COND_2010_DATA, 
1104    PARTITION LMF_LASER_IR_PRIM_DAT_11 TABLESPACE CMS_ECAL_LASER_COND_2011_DATA)
1105 /
1106 CREATE INDEX LMF_TESTPULSE_PN_PRIM_FKIX ON LMF_TESTPULSE_PN_PRIM_DAT(VMIN) LOCAL 
1107   (PARTITION LMF_TESTPULSE_PN_PRIM_DAT_10 TABLESPACE CMS_ECAL_LASER_COND_2010_DATA, 
1108    PARTITION LMF_TESTPULSE_PN_PRIM_DAT_11 TABLESPACE CMS_ECAL_LASER_COND_2011_DATA)
1109 /
1110 CREATE INDEX LMF_TESTPULSE_PRIM_FKIX ON LMF_TESTPULSE_PRIM_DAT(VMIN) LOCAL 
1111   (PARTITION LMF_TESTPULSE_PRIM_DAT_10 TABLESPACE CMS_ECAL_LASER_COND_2010_DATA, 
1112    PARTITION LMF_TESTPULSE_PRIM_DAT_11 TABLESPACE CMS_ECAL_LASER_COND_2011_DATA)
1113 /
1114 
1115 CREATE OR REPLACE TRIGGER LMF_CHECK_SEQ_DAT_TG
1116   BEFORE INSERT ON LMF_SEQ_DAT
1117   REFERENCING NEW AS new_seq_dat
1118   FOR EACH ROW
1119   DECLARE
1120   result NUMBER;
1121   BEGIN
1122     SELECT COUNT(IOV_ID) INTO result FROM CMS_ECAL_COND.RUN_IOV
1123         WHERE IOV_ID = :new_seq_dat.RUN_IOV_ID;
1124     IF result = 0 THEN
1125        RAISE_APPLICATION_ERROR(-20000, 'RUN.IOV_ID = ' ||
1126          :new_seq_dat.RUN_IOV_ID || ' does not exists!');
1127     END IF;
1128   END;
1129 /
1130 
1131 CREATE OR REPLACE TRIGGER LMF_CHECK_LASERCONF_TG
1132   BEFORE INSERT ON RUN_LASERRUN_CONFIG_DAT
1133   REFERENCING NEW AS new_config_dat
1134   FOR EACH ROW
1135   DECLARE
1136   result NUMBER;
1137   BEGIN
1138     SELECT COUNT(IOV_ID) INTO result FROM CMS_ECAL_COND.RUN_IOV
1139         WHERE IOV_ID = :new_config_dat.IOV_ID;
1140     IF result = 0 THEN
1141        RAISE_APPLICATION_ERROR(-20000, 'RUN.IOV_ID = ' ||
1142          :new_config_dat.IOV_ID || ' does not exists!');
1143     END IF;
1144   END;
1145 /
1146 
1147 CREATE OR REPLACE TRIGGER LMF_CHECK_TRIPLETS_TG
1148   BEFORE INSERT ON LMF_LMR_SUB_IOV
1149   REFERENCING NEW AS new_sub_iov
1150   FOR EACH ROW
1151     BEGIN
1152       IF ((:new_sub_iov.t2 < :new_sub_iov.t1) OR
1153           (:new_sub_iov.t3 < :new_sub_iov.t2) OR
1154           (:new_sub_iov.t3 < :new_sub_iov.t1))
1155       THEN
1156         RAISE_APPLICATION_ERROR (
1157            num => -20000,
1158            msg =>       'Wrong triplets detected: T2 < T1 or T3 < T2');
1159       END IF;
1160     END;
1161 /
1162 
1163 /* create triggers to support 0 values in LMF_IOV_ID_REF and ensure referential
1164    integrity */
1165 
1166 CREATE OR REPLACE TRIGGER LMF_CLS_BLUE_DAT_TG
1167   BEFORE INSERT ON LMF_CLS_BLUE_DAT
1168   REFERENCING NEW AS new
1169   FOR EACH ROW
1170     DECLARE
1171       rowcount NUMBER;
1172     BEGIN
1173       IF (:new.LMF_IOV_ID_REF != 0) THEN
1174         SELECT COUNT(LMF_IOV_ID) INTO rowcount FROM LMF_RUN_IOV WHERE LMF_IOV_ID = :n\
1175 ew.LMF_IOV_ID_REF;
1176         IF (rowcount = 0) THEN
1177           RAISE_APPLICATION_ERROR(-20001, 'LMF_IOV_ID_REF = ' || :new.LMF_IOV_ID_REF \
1178 || ' not found');
1179         END IF;
1180       END IF;
1181     END;
1182 /
1183 
1184 CREATE OR REPLACE TRIGGER LMF_CLS_IR_DAT_TG
1185   BEFORE INSERT ON LMF_CLS_IR_DAT
1186   REFERENCING NEW AS new
1187   FOR EACH ROW
1188     DECLARE
1189       rowcount NUMBER;
1190     BEGIN
1191       IF (:new.LMF_IOV_ID_REF != 0) THEN
1192         SELECT COUNT(LMF_IOV_ID) INTO rowcount FROM LMF_RUN_IOV WHERE LMF_IOV_ID = :n\
1193 ew.LMF_IOV_ID_REF;
1194         IF (rowcount = 0) THEN
1195           RAISE_APPLICATION_ERROR(-20001, 'LMF_IOV_ID_REF = ' || :new.LMF_IOV_ID_REF \
1196 || ' not found');
1197         END IF;
1198       END IF;
1199     END;
1200 /
1201  
1202 /*
1203 CREATE SYNONYM RUN_TYPE_DEF FOR CMS_ECAL_COND.RUN_TYPE_DEF;
1204 CREATE SYNONYM RUN_IOV FOR CMS_ECAL_COND.RUN_IOV;
1205 CREATE SYNONYM VIEWDESCRIPTION FOR CMS_ECAL_COND.VIEWDESCRIPTION;
1206 CREATE SYNONYM CHANNELVIEW FOR CMS_ECAL_COND.CHANNELVIEW;
1207 CREATE SYNONYM LOCATION_DEF FOR CMS_ECAL_COND.LOCATION_DEF;
1208 */