Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 /*
0002  *  Creates all the data tables required to configure the trigger and FE for the trigger
0003  */
0004 
0005 
0006 CREATE TABLE FE_CONFIG_MAIN (
0007 conf_id NUMBER NOT NULL, -- (the most important trigger key)
0008 ped_conf_id NUMBER NOT NULL, -- (the link to the pedestals)
0009 lin_conf_id NUMBER NOT NULL, -- (the link to the lin table)
0010 lut_conf_id NUMBER NOT NULL, -- (the link to the LUT table)
0011 fgr_conf_id NUMBER NOT NULL, -- (the link to the fine grain table)
0012 sli_conf_id NUMBER NOT NULL, -- (the link to the sliding window table)
0013 wei_conf_id NUMBER NOT NULL, -- (the link to the weight configuration table)
0014 spi_conf_id NUMBER NOT NULL, -- (the link to the spike killer conf table) 
0015 bxt_conf_id NUMBER NOT NULL, -- (the link to the bad xt configuration table)
0016 btt_conf_id NUMBER NOT NULL, -- (the link to the bad tt configuration table)
0017 bst_conf_id NUMBER NOT NULL, -- (the link to the bad strip configuration table)
0018 tag         VARCHAR2(100), -- (a comment if you want to add it)
0019 version NUMBER  NOT NULL, -- (the most important trigger key)
0020 description VARCHAR2(200)  , -- (just a string )
0021 db_timestamp            TIMESTAMP DEFAULT SYSTIMESTAMP NOT NULL
0022 );
0023 
0024 ALTER TABLE FE_CONFIG_MAIN ADD CONSTRAINT FE_CONFIG_MAIN_PK PRIMARY KEY (CONF_ID);
0025 ALTER TABLE FE_CONFIG_MAIN ADD CONSTRAINT FE_CONFIG_L1_UNIQUE_uk UNIQUE (ped_conf_id,lin_conf_id,lut_conf_id,fgr_conf_id,sli_conf_id,wei_conf_id, spi_conf_id, bxt_conf_id, btt_conf_id, bst_conf_id);
0026 ALTER TABLE FE_CONFIG_MAIN ADD CONSTRAINT FE_CONFIG_L2_UNIQUE_uk UNIQUE (tag,version);
0027 
0028 CREATE SEQUENCE FE_CONFIG_MAIN_SQ INCREMENT BY 1 START WITH 1 nocache;
0029 
0030 
0031 
0032 CREATE OR REPLACE TRIGGER fe_config_main_auto_ver_tg
0033   BEFORE INSERT ON FE_CONFIG_MAIN
0034   FOR EACH ROW
0035     begin
0036   select test_update_tag_and_version('FE_CONFIG_MAIN', :new.tag, :new.version) into :new.version from dual;
0037 end;
0038 /
0039 SHOW ERRORS;
0040 
0041 
0042 
0043 
0044 CREATE TABLE FE_CONFIG_PED_INFO (
0045  ped_conf_id NUMBER(10) NOT NULL,
0046  TAG VARCHAR2(100), 
0047  version number,        
0048  iov_id NUMBER(10) , -- references the condition DB table used 
0049  db_timestamp  TIMESTAMP DEFAULT SYSTIMESTAMP NOT NULL  
0050 );
0051 ALTER TABLE FE_CONFIG_PED_INFO ADD CONSTRAINT  FE_CONFIG_PED_INFO_PK PRIMARY KEY (ped_conf_id);
0052 ALTER TABLE FE_CONFIG_PED_INFO ADD CONSTRAINT  FE_CONFIG_PED_UNIQUE_uk UNIQUE (tag,version);
0053 
0054 
0055 CREATE TABLE FE_CONFIG_LIN_INFO (
0056  lin_conf_id NUMBER(10) NOT NULL,
0057  TAG VARCHAR2(100),
0058  version number ,
0059  iov_id NUMBER(10) , -- references the condition DB table used 
0060  db_timestamp  TIMESTAMP DEFAULT SYSTIMESTAMP NOT NULL  
0061 );
0062 ALTER TABLE FE_CONFIG_lin_INFO ADD CONSTRAINT  FE_CONFIG_lin_INFO_PK PRIMARY KEY (lin_conf_id);
0063 ALTER TABLE FE_CONFIG_lin_INFO ADD CONSTRAINT  FE_CONFIG_lin_UNIQUE_uk UNIQUE (tag,version);
0064 
0065 
0066 
0067 CREATE TABLE FE_CONFIG_LUT_INFO (
0068  lut_conf_id NUMBER(10) NOT NULL,
0069  TAG VARCHAR2(100),
0070  version number ,
0071  number_of_groups NUMBER(10) , 
0072  db_timestamp  TIMESTAMP DEFAULT SYSTIMESTAMP NOT NULL  
0073 );
0074 ALTER TABLE FE_CONFIG_lut_INFO ADD CONSTRAINT  FE_CONFIG_lut_INFO_PK PRIMARY KEY (lut_conf_id);
0075 ALTER TABLE FE_CONFIG_lut_INFO ADD CONSTRAINT  FE_CONFIG_lut_UNIQUE_uk UNIQUE (tag,version);
0076 
0077 
0078 
0079 CREATE TABLE FE_CONFIG_fgr_INFO (
0080  fgr_conf_id NUMBER(10) NOT NULL,
0081  TAG VARCHAR2(100), 
0082  version number ,
0083  number_of_groups NUMBER(10) , 
0084  db_timestamp  TIMESTAMP DEFAULT SYSTIMESTAMP NOT NULL  
0085 );
0086 ALTER TABLE FE_CONFIG_fgr_INFO ADD CONSTRAINT  FE_CONFIG_fgr_INFO_PK PRIMARY KEY (fgr_conf_id);
0087 ALTER TABLE FE_CONFIG_fgr_INFO ADD CONSTRAINT  FE_CONFIG_fgr_UNIQUE_uk UNIQUE (tag,version);
0088 
0089 
0090 
0091 CREATE TABLE FE_CONFIG_sliding_INFO (
0092  sli_conf_id NUMBER(10) NOT NULL,
0093  TAG VARCHAR2(100), 
0094  version number, 
0095  iov_id NUMBER(10) , -- references the condition DB table used 
0096  db_timestamp  TIMESTAMP DEFAULT SYSTIMESTAMP NOT NULL  
0097 );
0098 ALTER TABLE FE_CONFIG_sliding_INFO ADD CONSTRAINT  FE_CONFIG_SLIDING_INFO_PK PRIMARY KEY (sli_conf_id);
0099 ALTER TABLE FE_CONFIG_sliding_INFO ADD CONSTRAINT  FE_CONFIG_sliding_UNIQUE_uk UNIQUE (tag,version);
0100 
0101 CREATE TABLE FE_CONFIG_spike_INFO (
0102  spi_conf_id NUMBER(10) NOT NULL,
0103  TAG VARCHAR2(100),
0104  version number,
0105  db_timestamp  TIMESTAMP DEFAULT SYSTIMESTAMP NOT NULL
0106 );
0107 ALTER TABLE FE_CONFIG_spike_INFO ADD CONSTRAINT  FE_CONFIG_Spike_INFO_PK PRIMARY KEY (spi_conf_id);
0108 ALTER TABLE FE_CONFIG_spike_INFO ADD CONSTRAINT  FE_CONFIG_spike_UNIQUE_uk UNIQUE (tag,version);
0109 
0110 
0111 
0112 CREATE TABLE FE_CONFIG_WEIGHT_INFO (
0113  wei_conf_id NUMBER(10) NOT NULL,
0114  TAG VARCHAR2(100), 
0115  version number,        
0116  number_of_groups NUMBER(10) , -- (the number of groups of weights)
0117  db_timestamp  TIMESTAMP DEFAULT SYSTIMESTAMP NOT NULL  
0118 );
0119 ALTER TABLE FE_CONFIG_WEIGHT_INFO ADD CONSTRAINT  FE_CONFIG_WEIGHT_INFO_PK PRIMARY KEY (wei_conf_id);
0120 ALTER TABLE FE_CONFIG_weight_INFO ADD CONSTRAINT  FE_CONFIG_weight_UNIQUE_uk UNIQUE (tag,version);
0121 
0122 
0123 CREATE TABLE FE_CONFIG_BadCrystals_INFO (
0124  rec_id NUMBER(10) NOT NULL,
0125  TAG VARCHAR2(100),
0126  version number ,
0127  db_timestamp  TIMESTAMP DEFAULT SYSTIMESTAMP NOT NULL  
0128 );
0129 ALTER TABLE FE_CONFIG_BadCrystals_INFO ADD CONSTRAINT  FE_CONFIG_Badxt_INFO_PK PRIMARY KEY (rec_id);
0130 ALTER TABLE FE_CONFIG_badcrystals_INFO ADD CONSTRAINT  FE_CONFIG_badxt_UNIQUE_uk UNIQUE (tag,version);
0131 
0132 
0133 CREATE TABLE FE_CONFIG_BadTT_INFO (
0134  rec_id NUMBER(10) NOT NULL,
0135  TAG VARCHAR2(100),
0136  version number ,
0137  db_timestamp  TIMESTAMP DEFAULT SYSTIMESTAMP NOT NULL  
0138 );
0139 ALTER TABLE FE_CONFIG_BadTT_INFO ADD CONSTRAINT  FE_CONFIG_BadTT_INFO_PK PRIMARY KEY (rec_id);
0140 ALTER TABLE FE_CONFIG_badtt_INFO ADD CONSTRAINT  FE_CONFIG_badtt_UNIQUE_uk UNIQUE (tag,version);
0141 
0142 CREATE TABLE FE_CONFIG_BadST_INFO (
0143  rec_id NUMBER(10) NOT NULL,
0144  TAG VARCHAR2(100),
0145  version number ,
0146  db_timestamp  TIMESTAMP DEFAULT SYSTIMESTAMP NOT NULL  
0147 );
0148 ALTER TABLE FE_CONFIG_BadST_INFO ADD CONSTRAINT  FE_CONFIG_BadST_INFO_PK PRIMARY KEY (rec_id);
0149 ALTER TABLE FE_CONFIG_badSt_INFO ADD CONSTRAINT  FE_CONFIG_badSt_UNIQUE_uk UNIQUE (tag,version);
0150 
0151 
0152 
0153 
0154 CREATE OR REPLACE TRIGGER fe_config_ped_info_auto_ver_tg
0155   BEFORE INSERT ON FE_CONFIG_ped_info
0156   FOR EACH ROW
0157     begin
0158   select test_update_tag_and_version('FE_CONFIG_PED_INFO', :new.tag, :new.version) into :new.version from dual;
0159 end;
0160 /
0161 SHOW ERRORS;
0162 
0163 
0164 CREATE OR REPLACE TRIGGER fe_config_lin_info_auto_ver_tg
0165   BEFORE INSERT ON FE_CONFIG_lin_info
0166   FOR EACH ROW
0167     begin
0168   select test_update_tag_and_version('FE_CONFIG_LIN_INFO', :new.tag, :new.version) into :new.version from dual;
0169 end;
0170 /
0171 SHOW ERRORS;
0172 
0173 
0174 CREATE OR REPLACE TRIGGER fe_config_lut_info_auto_ver_tg
0175   BEFORE INSERT ON FE_CONFIG_LUT_INFO
0176   FOR EACH ROW
0177     begin
0178   select test_update_tag_and_version('FE_CONFIG_LUT_INFO', :new.tag, :new.version) into :new.version from dual;
0179 end;
0180 /
0181 SHOW ERRORS;
0182 
0183 
0184 CREATE OR REPLACE TRIGGER fe_config_FGR_info_auto_ver_tg
0185   BEFORE INSERT ON FE_CONFIG_FGR_INFO
0186   FOR EACH ROW
0187     begin
0188   select test_update_tag_and_version('FE_CONFIG_FGR_INFO', :new.tag, :new.version) into :new.version from dual;
0189 end;
0190 /
0191 SHOW ERRORS;
0192 
0193 
0194 CREATE OR REPLACE TRIGGER fe_config_WEI_info_auto_ver_tg
0195   BEFORE INSERT ON FE_CONFIG_WEIGHT_INFO
0196   FOR EACH ROW
0197     begin
0198   select test_update_tag_and_version('FE_CONFIG_WEIGHT_INFO', :new.tag, :new.version) into :new.version from dual;
0199 end;
0200 /
0201 SHOW ERRORS;
0202 
0203 
0204 CREATE OR REPLACE TRIGGER fe_config_sli_info_auto_ver_tg
0205   BEFORE INSERT ON FE_CONFIG_sliding_info
0206   FOR EACH ROW
0207     begin
0208   select test_update_tag_and_version('FE_CONFIG_SLIDING_INFO', :new.tag, :new.version) into :new.version from dual;
0209 end;
0210 /
0211 SHOW ERRORS;
0212 
0213 CREATE OR REPLACE TRIGGER fe_config_spi_info_auto_ver_tg
0214   BEFORE INSERT ON FE_CONFIG_spike_info
0215   FOR EACH ROW
0216     begin
0217   select test_update_tag_and_version('FE_CONFIG_Spike_INFO', :new.tag, :new.version) into :new.version from dual;
0218 end;
0219 /
0220 SHOW ERRORS;
0221 
0222 
0223 CREATE OR REPLACE TRIGGER fe_config_bxt_info_auto_ver_tg
0224   BEFORE INSERT ON FE_CONFIG_Badcrystals_INFO
0225   FOR EACH ROW
0226     begin
0227   select test_update_tag_and_version('FE_CONFIG_BADCRYSTALS_INFO', :new.tag, :new.version) into :new.version from dual;
0228 end;
0229 /
0230 SHOW ERRORS;
0231 
0232 CREATE OR REPLACE TRIGGER fe_config_btt_info_auto_ver_tg
0233   BEFORE INSERT ON FE_CONFIG_BADTT_INFO
0234   FOR EACH ROW
0235     begin
0236   select test_update_tag_and_version('FE_CONFIG_BADTT_INFO', :new.tag, :new.version) into :new.version from dual;
0237 end;
0238 /
0239 SHOW ERRORS;
0240 
0241 CREATE OR REPLACE TRIGGER fe_config_bst_info_auto_ver_tg
0242   BEFORE INSERT ON FE_CONFIG_BADST_INFO
0243   FOR EACH ROW
0244     begin
0245   select test_update_tag_and_version('FE_CONFIG_BADST_INFO', :new.tag, :new.version) into :new.version from dual;
0246 end;
0247 /
0248 SHOW ERRORS;
0249 
0250 
0251 
0252 
0253 
0254 
0255 
0256 
0257 
0258 /*
0259  *  here we have the pedestals - 3 values per crystal (1 per gain)
0260  */
0261 
0262 
0263 CREATE TABLE FE_CONFIG_PED_DAT (
0264  ped_conf_id NUMBER(10) NOT NULL,
0265  logic_id NUMBER(10) not null, 
0266  mean_12 NUMBER(10),
0267  mean_6 NUMBER(10),
0268  mean_1 NUMBER(10));
0269 
0270 ALTER TABLE FE_CONFIG_PED_DAT ADD CONSTRAINT FE_CONFIG_PED_pk PRIMARY KEY (ped_conf_id, logic_id);
0271 ALTER TABLE FE_CONFIG_PED_DAT ADD CONSTRAINT FE_CONFIG_PED_fk FOREIGN KEY (ped_conf_id) REFERENCES FE_CONFIG_PED_INFO (ped_conf_id);
0272 
0273 
0274 
0275 /*
0276  * adc_to_gev is the LSB equivalent energy typical is 0.035 GeV/ADC 
0277  *  here we have the absolute calibration - 1 value per barrel + 1 value per EC maybe
0278  * logic_id=2000000001 for EE and 1000000000 for EB
0279  * Energy_crystal=FE_CONFIG_calib_lsb_DAT.adc_to_gev * fe_config_calib_dat.calibration * Peak(ADCCounts)
0280  * and at higher gains 
0281  * Energy_crystal= FE_CONFIG_calib_lsb_DAT.adc_to_gev * fe_config_calib_dat.calibration * gain_ratio * Peak(ADCCounts) 
0282  */
0283 
0284 
0285 /*
0286  *  here we have the linearization - 1 value per crystal
0287  */
0288 
0289 CREATE TABLE FE_CONFIG_lin_DAT (
0290   lin_conf_id        NUMBER(10),
0291   logic_id              NUMBER(10), -- (crystal)
0292   multx12                Number,
0293   multx6                 number,
0294   multx1                 number,
0295   shift12                number,
0296   shift6                 number,
0297   shift1                 number
0298 );
0299 
0300 ALTER TABLE FE_CONFIG_lin_DAT ADD CONSTRAINT FE_CONFIG_lin_pk PRIMARY KEY (lin_conf_id, logic_id);
0301 ALTER TABLE FE_CONFIG_lin_DAT ADD CONSTRAINT FE_CONFIG_lin_fk FOREIGN KEY (lin_conf_id) REFERENCES FE_CONFIG_lin_INFO (lin_conf_id);
0302 
0303 
0304 /*
0305  *  here we have the linearization parameters used to compute the lin coeff.
0306  */
0307 
0308 
0309 
0310 
0311 
0312 /*
0313  *  here we have the weights and the sliding window parameters - values per strip
0314  */
0315 
0316 
0317 CREATE TABLE FE_CONFIG_sliding_DAT (
0318   sli_conf_id        NUMBER(10),
0319   logic_id              NUMBER(10), -- (strip)
0320   sliding                 NUMBER(10)
0321 );
0322 
0323 ALTER TABLE FE_CONFIG_sliding_DAT ADD CONSTRAINT FE_CONFIG_sliding_pk PRIMARY KEY (sli_conf_id, logic_id);
0324 ALTER TABLE FE_CONFIG_sliding_DAT ADD CONSTRAINT FE_CONFIG_sliding_fk FOREIGN KEY (sli_conf_id) REFERENCES FE_CONFIG_sliding_INFO (sli_conf_id);
0325 
0326 CREATE TABLE FE_CONFIG_spike_DAT (
0327   spi_conf_id        NUMBER(10),
0328   logic_id              NUMBER(10), -- (barrel tower)                                                                                
0329   spike_threshold       NUMBER(10)
0330 );
0331 
0332 ALTER TABLE FE_CONFIG_spike_dat ADD CONSTRAINT FE_CONFIG_spike_pk PRIMARY KEY (spi_conf_id, logic_id);
0333 ALTER TABLE FE_CONFIG_spike_DAT ADD CONSTRAINT FE_CONFIG_spike_fk FOREIGN KEY (spi_conf_id) REFERENCES FE_CONFIG_spike_INFO (spi_conf_id);
0334 
0335 
0336 
0337 
0338 create table FE_WEIGHT_PER_GROUP_DAT(
0339  wei_conf_id number not null,
0340  group_id number(10) not null,
0341  W0 NUMBER,
0342  W1 NUMBER,
0343  W2 NUMBER,
0344  W3 NUMBER,
0345  W4 NUMBER      
0346  );
0347 
0348 ALTER TABLE FE_WEIGHT_PER_GROUP_DAT ADD CONSTRAINT FE_WEIGHT_PER_GROUP_pk PRIMARY KEY (wei_conf_id , group_id);
0349 ALTER TABLE FE_WEIGHT_PER_GROUP_DAT ADD CONSTRAINT FE_WEIGHT_PER_GROUP_fk foreign KEY (wei_conf_id) REFERENCES FE_CONFIG_WEIGHT_INFO (wei_conf_id);
0350 
0351 
0352 CREATE TABLE FE_CONFIG_WEIGHT_DAT (
0353  wei_conf_id NUMBER NOT NULL,
0354  logic_id NUMBER(10) not null, -- ( of the strip)
0355  group_id number(10) not null);
0356 
0357 ALTER TABLE FE_CONFIG_WEIGHT_DAT ADD CONSTRAINT FE_CONFIG_WEIGHT_fk  FOREIGN KEY (wei_conf_id) REFERENCES FE_CONFIG_WEIGHT_INFO (wei_conf_id);
0358 ALTER TABLE FE_CONFIG_WEIGHT_DAT ADD CONSTRAINT FE_CONFIG_WEIGHT_fk2  FOREIGN KEY (wei_conf_id, group_id) REFERENCES FE_WEIGHT_PER_GROUP_DAT (wei_conf_id, group_id);
0359 
0360 
0361 /*
0362  *  here we have the LUT and fine grain para - values per TT
0363  */
0364 
0365 
0366 
0367 create table FE_LUT_PER_GROUP_DAT(
0368  lut_conf_id number(10) not null,
0369  group_id number(10) not null,
0370  lut_id NUMBER(10),
0371  lut_value NUMBER
0372  );
0373 
0374 ALTER TABLE FE_LUT_PER_GROUP_DAT ADD CONSTRAINT FE_LUT_PER_GROUP_pk PRIMARY KEY (lut_conf_id, group_id , lut_id);
0375 ALTER TABLE FE_LUT_PER_GROUP_DAT ADD CONSTRAINT FE_LUT_PER_GROUP_fk foreign KEY (lut_conf_id) REFERENCES FE_CONFIG_LUT_INFO (lut_conf_id);
0376 
0377 
0378 CREATE TABLE FE_CONFIG_LUT_DAT (
0379  lut_conf_id NUMBER NOT NULL,
0380  logic_id NUMBER(10) not null, -- ( of the TT)
0381  group_id number(10) not null);
0382 
0383 ALTER TABLE FE_CONFIG_LUT_DAT ADD CONSTRAINT FE_CONFIG_LUT_fk  FOREIGN KEY (lut_conf_id) REFERENCES FE_CONFIG_LUT_INFO (lut_conf_id);
0384 
0385 
0386 
0387 create table FE_fgr_PER_GROUP_DAT(
0388  fgr_conf_id NUMBER NOT NULL,
0389  group_id number(10) not null,
0390  threshold_low NUMBER,
0391  threshold_high NUMBER,
0392  ratio_low NUMBER,
0393  ratio_high NUMBER,
0394  lut_value NUMBER(10)   
0395  );
0396 
0397 ALTER TABLE FE_fgr_PER_GROUP_DAT ADD CONSTRAINT FE_fgr_PER_GROUP_pk PRIMARY KEY (fgr_conf_id, group_id);
0398 
0399 
0400 CREATE TABLE FE_CONFIG_FGR_DAT (
0401  fgr_conf_id NUMBER NOT NULL,
0402  logic_id NUMBER(10) not null, -- ( of the TT)
0403  group_id number(10) not null);
0404 
0405 ALTER TABLE FE_CONFIG_FGR_DAT ADD CONSTRAINT FE_CONFIG_FGR_pk PRIMARY KEY (fgr_conf_id, logic_id);
0406 ALTER TABLE FE_CONFIG_FGR_DAT ADD CONSTRAINT FE_CONFIG_FGR_fk  FOREIGN KEY (fgr_conf_id) REFERENCES FE_CONFIG_FGR_INFO (fgr_conf_id);
0407 
0408 /* endcap part not by groups */
0409 CREATE TABLE FE_CONFIG_FGREEST_DAT (
0410  fgr_conf_id        NUMBER(10),
0411  logic_id              NUMBER(10), -- (tower by tcc and tt)
0412  threshold                Number(10),
0413  lut_fg                 number(10)
0414 );
0415 
0416 ALTER TABLE FE_CONFIG_FGREEST_DAT ADD CONSTRAINT FE_CONFIG_FGREEST_pk PRIMARY KEY (fgr_conf_id, logic_id);
0417 ALTER TABLE FE_CONFIG_FGREEST_DAT ADD CONSTRAINT FE_CONFIG_FGREEST_fk FOREIGN KEY (fgr_conf_id) REFERENCES FE_CONFIG_FGR_INFO (fgr_conf_id);
0418 
0419 CREATE TABLE FE_CONFIG_FGREETT_DAT (
0420  fgr_conf_id        NUMBER(10),
0421  logic_id              NUMBER(10), -- (strip)
0422  lut_value                 number(10)
0423 );
0424 
0425 ALTER TABLE FE_CONFIG_FGREETT_DAT ADD CONSTRAINT FE_CONFIG_FGREETT_pk PRIMARY KEY (fgr_conf_id, logic_id);
0426 ALTER TABLE FE_CONFIG_FGREETT_DAT ADD CONSTRAINT FE_CONFIG_FGREETT_fk FOREIGN KEY (fgr_conf_id) REFERENCES FE_CONFIG_FGR_INFO (fgr_conf_id);
0427 
0428 
0429 
0430 CREATE TABLE FE_CONFIG_BadCrystals_DAT (
0431 rec_id NUMBER(10) NOT NULL,
0432 tcc_id  NUMBER(10),
0433 fed_id NUMBER(10),
0434 tt_id  NUMBER(10),
0435 cry_id NUMBER(10),
0436  status NUMBER(10));
0437 
0438 ALTER TABLE FE_CONFIG_BadCrystals_DAT ADD CONSTRAINT FE_CONFIG_BXT_pk PRIMARY KEY (rec_id,tcc_id,fed_id,tt_id,cry_id);
0439  ALTER TABLE FE_CONFIG_BadCrystals_DAT ADD CONSTRAINT FE_CONFIG_BXT_fk FOREIGN KEY (rec_id) REFERENCES FE_CONFIG_BadCrystals_INFO (rec_id); 
0440 /* ALTER TABLE FE_CONFIG_BadCrystals_DAT ADD CONSTRAINT FE_CONFIG_BXT_fk FOREIGN KEY  (REC_ID) REFERENCES COND2CONF_INFO (REC_ID); */
0441 
0442 CREATE TABLE FE_CONFIG_BadTT_DAT (
0443 rec_id NUMBER(10) NOT NULL,
0444 tcc_id  NUMBER(10),
0445 fed_id NUMBER(10),
0446 tt_id  NUMBER(10),
0447  status NUMBER(10));
0448 
0449 ALTER TABLE FE_CONFIG_BadTT_DAT ADD CONSTRAINT FE_CONFIG_BTT_pk PRIMARY KEY (rec_id,tcc_id,fed_id,tt_id );
0450 ALTER TABLE FE_CONFIG_BadTT_DAT ADD CONSTRAINT FE_CONFIG_BTT_fk FOREIGN KEY (rec_id) REFERENCES FE_CONFIG_BadTT_INFO (rec_id); 
0451 /* ALTER TABLE FE_CONFIG_BadTT_DAT ADD CONSTRAINT FE_CONFIG_BTT_fk FOREIGN KEY (rec_id) REFERENCES COND2CONF_INFO (rec_id); */
0452 
0453 CREATE TABLE FE_CONFIG_BadST_DAT (
0454 rec_id NUMBER(10) NOT NULL,
0455 tcc_id  NUMBER(10),
0456 fed_id NUMBER(10),
0457 tt_id  NUMBER(10),
0458 st_is  NUMBER(2),
0459 status NUMBER(10));
0460 
0461 ALTER TABLE FE_CONFIG_BadST_DAT ADD CONSTRAINT FE_CONFIG_BST_pk PRIMARY KEY (rec_id,tcc_id,fed_id,tt_id,st_id );
0462 ALTER TABLE FE_CONFIG_BadST_DAT ADD CONSTRAINT FE_CONFIG_BST_fk FOREIGN KEY (rec_id) REFERENCES FE_CONFIG_BadST_INFO (rec_id); 
0463 
0464 
0465 
0466 /* now the main table constraints */
0467 
0468 
0469 ALTER TABLE FE_CONFIG_MAIN ADD CONSTRAINT FE_CONFIG_MAIN_to_PED_fk FOREIGN KEY (ped_conf_id) REFERENCES FE_CONFIG_PED_INFO (ped_conf_id);
0470 ALTER TABLE FE_CONFIG_MAIN ADD CONSTRAINT FE_CONFIG_MAIN_to_lin_fk FOREIGN KEY (lin_conf_id) REFERENCES FE_CONFIG_LIN_INFO (lin_conf_id);
0471 ALTER TABLE FE_CONFIG_MAIN ADD CONSTRAINT FE_CONFIG_MAIN_to_lut_fk FOREIGN KEY (lut_conf_id) REFERENCES FE_CONFIG_LUT_INFO (lut_conf_id);
0472 ALTER TABLE FE_CONFIG_MAIN ADD CONSTRAINT FE_CONFIG_MAIN_to_fgr_fk FOREIGN KEY (fgr_conf_id) REFERENCES FE_CONFIG_fgr_INFO (fgr_conf_id);
0473 ALTER TABLE FE_CONFIG_MAIN ADD CONSTRAINT FE_CONFIG_MAIN_to_sli_fk FOREIGN KEY (sli_conf_id) REFERENCES FE_CONFIG_sliding_INFO (sli_conf_id);
0474 ALTER TABLE FE_CONFIG_MAIN ADD CONSTRAINT FE_CONFIG_MAIN_to_spi_fk FOREIGN KEY (spi_conf_id) REFERENCES FE_CONFIG_spike_INFO (spi_conf_id);
0475 ALTER TABLE FE_CONFIG_MAIN ADD CONSTRAINT FE_CONFIG_MAIN_to_WEIGHT_fk FOREIGN KEY (wei_conf_id) REFERENCES FE_CONFIG_WEIGHT_INFO (wei_conf_id);
0476 /*  ALTER TABLE FE_CONFIG_MAIN ADD CONSTRAINT FE_CONFIG_MAIN_to_BXT_fk FOREIGN KEY (bxt_conf_id) REFERENCES FE_CONFIG_BadCrystals_INFO (bxt_conf_id); */
0477 /* ALTER TABLE FE_CONFIG_MAIN ADD CONSTRAINT FE_CONFIG_MAIN_to_BTT_fk FOREIGN KEY (btt_conf_id) REFERENCES FE_CONFIG_BadTT_INFO (btt_conf_id); */
0478 
0479 
0480 CREATE TABLE FE_CONFIG_linparam_DAT (
0481   lin_conf_id        NUMBER(10),
0482   logic_id           NUMBER(10), -- (crystal)
0483   etsat                Number
0484 );
0485 
0486 ALTER TABLE FE_CONFIG_linparam_DAT ADD CONSTRAINT FE_CONFIG_linparam_pk PRIMARY KEY (lin_conf_id, logic_id);
0487 ALTER TABLE FE_CONFIG_linparam_DAT ADD CONSTRAINT FE_CONFIG_linparam_fk FOREIGN KEY (lin_conf_id) REFERENCES FE_CONFIG_lin_INFO (lin_conf_id);
0488 
0489 
0490 CREATE TABLE FE_CONFIG_lutparam_DAT (
0491   lut_conf_id        NUMBER(10),
0492   logic_id           NUMBER(10), -- (crystal)
0493   etsat                Number,
0494   ttthreshlow         Number,
0495   ttthreshhigh         Number
0496 );
0497 
0498 ALTER TABLE FE_CONFIG_lutparam_DAT ADD CONSTRAINT FE_CONFIG_lutparam_pk PRIMARY KEY (lut_conf_id, logic_id);
0499 ALTER TABLE FE_CONFIG_lutparam_DAT ADD CONSTRAINT FE_CONFIG_lutparam_fk FOREIGN KEY (lut_conf_id) REFERENCES FE_CONFIG_lut_INFO (lut_conf_id);
0500 
0501 CREATE TABLE FE_CONFIG_fgrparam_DAT (
0502   fgr_conf_id        NUMBER(10),
0503   logic_id           NUMBER(10), -- (crystal)
0504   fg_lowthresh         Number,
0505   fg_highthresh         Number,
0506   fg_lowratio         Number,
0507   fg_highratio         Number
0508 );
0509 
0510 ALTER TABLE FE_CONFIG_fgrparam_DAT ADD CONSTRAINT FE_CONFIG_fgrparam_pk PRIMARY KEY (fgr_conf_id, logic_id);
0511 ALTER TABLE FE_CONFIG_fgrparam_DAT ADD CONSTRAINT FE_CONFIG_fgrparam_fk FOREIGN KEY (fgr_conf_id) REFERENCES FE_CONFIG_fgr_INFO (fgr_conf_id);
0512 
0513 
0514 
0515 
0516 
0517 CREATE SEQUENCE FE_CONFIG_PED_SQ INCREMENT BY 1 START WITH 1 nocache;
0518 CREATE SEQUENCE FE_CONFIG_LIN_SQ INCREMENT BY 1 START WITH 1 nocache;
0519 CREATE SEQUENCE FE_CONFIG_LUT_SQ INCREMENT BY 1 START WITH 1 nocache;
0520 CREATE SEQUENCE FE_CONFIG_FGR_SQ INCREMENT BY 1 START WITH 1 nocache;
0521 CREATE SEQUENCE FE_CONFIG_SLI_SQ INCREMENT BY 1 START WITH 1 nocache;
0522 CREATE SEQUENCE FE_CONFIG_Spi_SQ INCREMENT BY 1 START WITH 1 nocache;
0523 CREATE SEQUENCE FE_CONFIG_WEIGHT_SQ INCREMENT BY 1 START WITH  1 nocache;
0524 CREATE SEQUENCE FE_CONFIG_LUTGROUP_SQ INCREMENT BY 1 START WITH 1 nocache;
0525 CREATE SEQUENCE FE_CONFIG_FGRGROUP_SQ INCREMENT BY 1 START WITH 1 nocache;
0526 CREATE SEQUENCE FE_CONFIG_WEIGHTGROUP_SQ INCREMENT BY 1 START WITH 1 nocache;
0527 CREATE SEQUENCE FE_CONFIG_BXT_SQ INCREMENT BY 1 START WITH 1 nocache;
0528 CREATE SEQUENCE FE_CONFIG_BTT_SQ INCREMENT BY 1 START WITH 1 nocache;
0529 CREATE SEQUENCE FE_CONFIG_BST_SQ INCREMENT BY 1 START WITH 1 nocache;
0530 
0531 
0532 
0533 /* create synonym CHANNELVIEW              for cms_ecal_cond.CHANNELVIEW              ; */
0534 /* create synonym VIEWDESCRIPTION          for cms_ecal_cond.VIEWDESCRIPTION          ; */
0535 
0536 
0537 
0538 
0539 
0540