

COLUMN TIME FORMAT A20
-- scan entries for discontinuity (at beginning of store)
-- and note when the lumi was reset (set to zero) for updates below
SELECT to_char(CREATETIME, 'dd/mm/yyyy hh24:mi:ss')CREATETIME,B0ILUM,B0TLUM,B0TLIV 
  FROM BEAM_CONDITIONS_FULL WHERE CREATETIME BETWEEN 
  TO_DATE('2008.03.22 11:30:00','YYYY.MM.DD HH24:MI:SS') AND
  TO_DATE('2008.03.23 05:30:00','YYYY.MM.DD HH24:MI:SS') 
/

UPDATE BEAM_CONDITIONS_FULL SET 
  B0TLUM=B0TLUM+1482.47363
WHERE CREATETIME BETWEEN
 TO_DATE('2008.03.22 14:10:00','YYYY.MM.DD HH24:MI:SS') AND
 TO_DATE('2008.03.23 05:28:30','YYYY.MM.DD HH24:MI:SS')
/
UPDATE BEAM_CONDITIONS_FULL SET 
  B0TLIV=B0TLIV+958.771118
WHERE CREATETIME BETWEEN
 TO_DATE('2008.03.22 14:10:00','YYYY.MM.DD HH24:MI:SS') AND
 TO_DATE('2008.03.23 05:28:30','YYYY.MM.DD HH24:MI:SS')
/

-- Correct STORE_SUMMARY table with updated values from previous query:
UPDATE STORE_SUMMARY SET B0INTEGRATEDLUMI=6556.15576
  WHERE TEVSTORE=6001
/
UPDATE STORE_SUMMARY SET B0INTEGRATEDLIVELUMI=5506.47718
  WHERE TEVSTORE=6001
/
UPDATE STORE_SUMMARY SET GOOD_EFFICIENCY=GOOD/B0INTEGRATEDLUMI,
   GOODSVX_EFFICIENCY=GOODSVX/B0INTEGRATEDLUMI,
   EFFICIENCY=B0INTEGRATEDLIVELUMI/B0INTEGRATEDLUMI
   WHERE TEVSTORE=6001
/

-- Now do: 
--   setup rundb
--   $RUNDB_DIR/src/rundb/createStorePlot 5820
--  on node b0server02 (or any other AcNet connected machine) as user cdfdaq

-- Now check:
--   http://www-cdfonline.fnal.gov/daq/stores/store5820.html
-- To make sure things look OK.  Looks at lost-lumi numbers on 
--    left hand side and make sure that are all positive.
--
--    Click on "5820 Summary" and then "Fit" to make sure lumi fit OK
-- 
--  Post eLog entry
--

