Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:52:15

0001 CREATE OR REPLACE PACKAGE fill_dummy IS
0002 procedure fill_pedestals;
0003 procedure fill_gains;
0004 end;
0005 /
0006 show errors
0007 
0008 create or replace package body fill_dummy is
0009 norm number := 2147483648;
0010 TYPE table_type IS TABLE OF number INDEX BY BINARY_INTEGER;
0011 chambers table_type;
0012 
0013 procedure fill_pedestals is
0014 run number;
0015 layer number;
0016 i number;
0017 j number;
0018 k number;
0019 i_record_id number;
0020 i_map_id number;
0021 i_map_index number;
0022 mean_ped number;
0023 mean_rms number;
0024 rndm number;
0025 i_ped number;
0026 i_rms number;
0027 BEGIN
0028 select max(record_id) into i_record_id from pedestals;
0029 if i_record_id is null then
0030  i_record_id:=0;
0031 end if;
0032 select max(map_id) into i_map_id from pedestals_map;
0033 if i_map_id is null then
0034  i_map_id:=0;
0035 end if;
0036 for run in 1..5 loop
0037  i_record_id:=i_record_id+1;
0038  insert into pedestals values (i_record_id,run,sysdate,sysdate);
0039  i_map_index:=0;
0040  for i in 1..18 loop
0041   select dbms_random.random into rndm from dual;
0042   mean_ped:=597+rndm/norm*21;
0043   select dbms_random.random into rndm from dual;
0044   mean_rms:=2.07+rndm/norm*0.24;
0045   for j in 1..6 loop
0046    i_map_id:=i_map_id+1;
0047    i_map_index:=i_map_index+1;
0048    layer:=chambers(i)+j;
0049    insert into pedestals_map values (i_map_id,i_record_id,i_map_index,layer);
0050    for k in 1..80 loop
0051     select dbms_random.random into rndm from dual;
0052     i_ped:=mean_ped+rndm/norm*56;
0053     i_rms:=mean_rms+rndm/norm*0.35;
0054     insert into pedestals_data values(i_map_id,k,i_ped,i_rms);
0055    end loop;
0056   end loop;
0057  end loop;
0058 end loop;
0059 END fill_pedestals;
0060 
0061 procedure fill_gains is
0062 run number;
0063 layer number;
0064 i number;
0065 j number;
0066 k number;
0067 i_record_id number;
0068 i_map_id number;
0069 i_map_index number;
0070 mean_gain_slope number;
0071 mean_gain_intercept number;
0072 mean_gain_chi2 number;
0073 rndm number;
0074 i_gain_slope number;
0075 i_gain_intercept number;
0076 i_gain_chi2 number;
0077 BEGIN
0078 select max(record_id) into i_record_id from gains;
0079 if i_record_id is null then
0080  i_record_id:=0;
0081 end if;
0082 select max(map_id) into i_map_id from gains_map;
0083 if i_map_id is null then
0084  i_map_id:=0;
0085 end if;
0086 for run in 1..5 loop
0087  i_record_id:=i_record_id+1;
0088  insert into gains values (i_record_id,run,sysdate,sysdate);
0089  i_map_index:=0;
0090  for i in 1..18 loop
0091   select dbms_random.random into rndm from dual;
0092   mean_gain_slope:=7.31+rndm/norm*0.68;
0093   select dbms_random.random into rndm from dual;
0094   mean_gain_intercept:=-13.2+rndm/norm*8.8;
0095   select dbms_random.random into rndm from dual;
0096   mean_gain_chi2:=2.17+rndm/norm*0.76;
0097   for j in 1..6 loop
0098    i_map_id:=i_map_id+1;
0099    i_map_index:=i_map_index+1;
0100    layer:=chambers(i)+j;
0101 --   DBMS_OUTPUT.PUT_LINE (i_map_id||' '||i_record_id||' '||i_map_index||
0102 --    ' '||layer);
0103    insert into gains_map values (i_map_id,i_record_id,i_map_index,layer);
0104    for k in 1..80 loop
0105     select dbms_random.random into rndm from dual;
0106     i_gain_slope:=mean_gain_slope+rndm/norm*0.58;
0107     i_gain_intercept:=mean_gain_intercept+rndm/norm*11.8;
0108     i_gain_chi2:=mean_gain_chi2*(1+rndm/norm*0.8);
0109     insert into gains_data values(i_map_id,k,i_gain_slope,i_gain_intercept,
0110     i_gain_chi2);
0111    end loop;
0112   end loop;
0113  end loop;
0114 end loop;
0115 END fill_gains;
0116 
0117 BEGIN
0118 chambers(1):= 220121140;
0119 chambers(2):= 220121150;
0120 chambers(3):= 220121160;
0121 chambers(4):= 220121270;
0122 chambers(5):= 220121280;
0123 chambers(6):= 220121290;
0124 chambers(7):= 220121300;
0125 chambers(8):= 220121310;
0126 chambers(9):= 220121320;
0127 chambers(10):= 220131140;
0128 chambers(11):= 220131150;
0129 chambers(12):= 220131160;
0130 chambers(13):= 220131270;
0131 chambers(14):= 220131280;
0132 chambers(15):= 220131290;
0133 chambers(16):= 220131300;
0134 chambers(17):= 220131310;
0135 chambers(18):= 220131320;
0136 end;
0137 /
0138 show errors