%@ LANGUAGE="VBScript" %>
<%
Const maxc=100
If Request("run_type")="" Then
Run_type="ALLBEAM"
Else
Run_type=CStr(Request("run_type"))
End If
'start of PR01 was at Run 7267
'start of PR03 was at Run 10313
If Request("run_min")="" Then
Run_min=10313
Else
Run_min= CLng(Request("run_min"))
End If
If Request("run_max")="" Then
Run_max=9999999
Else
Run_max= CLng(Request("run_max"))
End If
' response.write(Run_type)
time_start=Now()
'
' Check if people registered for shift/logbook writing
'
registered=0
'
' you can only registered if you are at BNL
'
If cloc="CH" Then
Response.Cookies("CTEST")="cookieset"
If Request.Cookies("PHOBOSPORTAL").HasKeys Then
strCookie1=Request.Cookies("PHOBOSPORTAL")("OPERATOR1")
If Not (IsNull(strCookie1) OR ( Len(strCookie1) = 0)) Then
registered=1
End If
End if
End If
Set Connection = Server.CreateObject("ADODB.Connection")
Connection.Mode = adModeRead
Connection.Open phdb_rd_repl
Dim fso, DataFile
Set fso = CreateObject("Scripting.FileSystemObject")
Set DataFile = fso.CreateTextFile(ph_image_directory+"RunList.txt", True)
runentry = "# Run " & " " & " BFIELD " & " " & " Trigger Configuration " & " " & "Totals : Written/Analysed/IsColGoodVtx "
DataFile.WriteLine(runentry)
SQLStmtx = "select to_char(sysdate,'MM/DD/YYYY HH24:MI:SS') rddate,to_char(sysdate,'HH24:MI:SS') ttime,global_name from global_name "
' response.write(SQLStmtx & "
" )
Set RSx = Connection.Execute(SQLStmtx)
If Not RSx.EOF Then
select case CStr(RSx("global_name"))
case "PHDB.WORLD"
dbname=""
case "ORACLE.WORLD"
dbname=""
case "KRPHOBOS.WORLD"
dbname="(KR)"
case "ROCHESTER.WORLD"
dbname="(ROC)"
end select
Else
dbname="Undefined Database"
End If
SQLStmty = "select trigger_config tc from phoffline.runs where run = (select max(run) from phoffline.runs where trigger_config is not null)"
Set RSy = Connection.Execute(SQLStmty)
If Request("nruns")<>"" Then
SQLStmt0 = "select max(RUN) maxrun from phoffline.runs "
Set RS0 = Connection.Execute(SQLStmt0)
run_min=CLng(RS0("maxrun"))-CLng(Request("nruns"))+1
run_max=9999999
If run_min<0 Then
run_min=0
End If
Else
' Official Start of PR01
run_min = Run_Min
End If
SQLStmt = " select lol.trigger_config, lol.run, lol.nevents, "
SQLStmt = SQLStmt & " lss.nevents_s,lss.nseq_s,lss.nback_s,lss.ncoll_s, lss.niscol, lss.niscolvtx, "
SQLStmt = SQLStmt & "mg.imag_min,mg.imag_max,mg.hneg_min,mg.hneg_max,mg.imag_c "
SQLStmt = SQLStmt & " from "
SQLStmt = SQLStmt & " (select max(rs.RUN) run,max(rs.RUN_DATE) run_date,max(rs.RUN_TYPE) run_type, "
SQLStmt = SQLStmt & " max(rs.NEVENTS) nevents,max(rs.NSEQ) nseq, max(TRIGGER_CONFIG) trigger_config "
SQLStmt = SQLStmt & " from phoffline.runs rs,phoffline.run_numbers rn,phoffline.runseqs vr "
SQLStmt = SQLStmt & " where rs.run=rn.run and rn.run=vr.run "
SQLStmt = SQLStmt & " and rs.RUN>=" & run_min & " and rs.RUN<=" & run_max & " and (vr.status = 0 or vr.status = 3) "
SQLStmt = SQLStmt & " group by rs.run) lol, "
SQLStmt = SQLStmt & " (select max(rs.RUN) run,sum(ss.NEVENTS) nevents_s,count(sequence) nseq_s,sum(PPPN_W) nback_s,sum(PPPN_N_3) ncoll_s, "
SQLStmt = SQLStmt & " sum(ss.ISCOL) niscol, sum(ss.ISCOLVTX) niscolvtx "
SQLStmt = SQLStmt & " from phoffline.runs rs,phoffline.scaler_summary ss "
SQLStmt = SQLStmt & " where ss.run=rs.run "
SQLStmt = SQLStmt & " and rs.RUN>=" & run_min & " and rs.RUN<=" & run_max & " "
SQLStmt = SQLStmt & " group by rs.run) lss, "
SQLStmt = SQLStmt & " (select max(run) run,max(imag) imag_max,min(imag) imag_min,max(hall_neg) hneg_max,min(hall_neg) hneg_min,count(imag) imag_c "
SQLStmt = SQLStmt & " from (select se.run,mm.logdate,mm.imag,mm.hall_neg from phoffline.magnet_monitoring mm, "
SQLStmt = SQLStmt & " (select rn.run,min(log_date)-0/(24*60) start_run,max(log_date)+0/(24*60) end_run from phoffline.log_entries le,phoffline.run_numbers rn "
SQLStmt = SQLStmt & " where le.logid=rn.logid and (le.action='START_RUN' OR le.action='END_RUN' ) "
SQLStmt = SQLStmt & " and rn.RUN>=" & run_min & " and rn.RUN<=" & run_max
SQLStmt = SQLStmt & " group by rn.run) se "
SQLStmt = SQLStmt & " where mm.logdate between se.start_run and se.end_run) "
SQLStmt = SQLStmt & " group by run) mg "
SQLStmt = SQLStmt & " where lol.run=lss.run(+) "
SQLStmt = SQLStmt & " and lol.run=mg.run(+) "
If Run_type<>"" Then
SQLStmt = SQLStmt & " and lol.run_type='" & Run_type & "' "
End If
SQLStmt = SQLStmt & " order by lol.trigger_config, lol.run desc "
'response.write(SQLStmt & "
" )
Set RS = Connection.Execute(SQLStmt)
SQLStmtz = "select max(run) last_run from phoffline.runs where run_type = '" & Run_type & "' and trigger_config <> ' ' "
SQLStmtz = SQLStmtz & " and run < (select max(run) from phoffline.runs where run_type = '" & Run_type & "' and trigger_config <> ' ') "
Set RSz = Connection.Execute(SQLStmtz)
time_ora=CStr(round(24*60*60*(Now()-time_start),1))
If run_type="" Then
title="Analyzed Totals"
Else
title="Analysed Totals, runs of type " & Run_type
End If
%>
| Trigger Cfg | Magnet Polarity | Total Events Written | Analysed | PN.PP narrow | PN(2).PP(2) narrow | IsCollision | IsCollision && GoodVertex |
| <%= old_trig_config %> |
BZERO |
<%= BZERO_total_events %> |
<%= BZERO_total_analysed %> (<%If BZERO_total_events>0 Then response.Write(Round(BZERO_total_analysed/BZERO_total_events*100,1)) End If %> %) |
<%= BZERO_total_pnppnarrow %> (<%If BZERO_total_events>0 Then response.Write(Round(BZERO_total_pnppnarrow/BZERO_total_events*100,1)) End If %> %) |
<%= BZERO_total_pn2pp2narrow %> (<%If BZERO_total_events>0 Then response.Write(Round(BZERO_total_pn2pp2narrow/BZERO_total_events*100,1)) End If %> %) |
<%= BZERO_total_iscol %> (<%If BZERO_total_events>0 Then response.Write(Round(BZERO_total_iscol/BZERO_total_events*100,1)) End If %> %) |
<%= BZERO_total_iscolvtx %> (<%If BZERO_total_events>0 Then response.Write(Round(BZERO_total_iscolvtx/BZERO_total_events*100,1)) End If %> %) |
| <%= old_trig_config %> |
BPLUS : B |
<%= BPLUS_total_events %> |
<%= BPLUS_total_analysed %> (<%If BPLUS_total_events>0 Then response.Write(Round(BPLUS_total_analysed/BPLUS_total_events*100,1)) End If %> %) |
<%= BPLUS_total_pnppnarrow %> (<%If BPLUS_total_events>0 Then response.Write(Round(BPLUS_total_pnppnarrow/BPLUS_total_events*100,1)) End If %> %) |
<%= BPLUS_total_pn2pp2narrow %> (<%If BPLUS_total_events>0 Then response.Write(Round(BPLUS_total_pn2pp2narrow/BPLUS_total_events*100,1)) End If %> %) |
<%= BPLUS_total_iscol %> (<%If BPLUS_total_events>0 Then response.Write(Round(BPLUS_total_iscol/BPLUS_total_events*100,1)) End If %> %) |
<%= BPLUS_total_iscolvtx %> (<%If BPLUS_total_events>0 Then response.Write(Round(BPLUS_total_iscolvtx/BPLUS_total_events*100,1)) End If %> %) |
| <%= old_trig_config %> |
BMINUS : A |
<%= BMINUS_total_events %> |
<%= BMINUS_total_analysed %> (<%If BMINUS_total_events>0 Then response.Write(Round(BMINUS_total_analysed/BMINUS_total_events*100,1)) End If %> %) |
<%= BMINUS_total_pnppnarrow %> (<%If BMINUS_total_events>0 Then response.Write(Round(BMINUS_total_pnppnarrow/BMINUS_total_events*100,1)) End If %> %) |
<%= BMINUS_total_pn2pp2narrow %> (<%If BMINUS_total_events>0 Then response.Write(Round(BMINUS_total_pn2pp2narrow/BMINUS_total_events*100,1)) End If %> %) |
<%= BMINUS_total_iscol %> (<%If BMINUS_total_events>0 Then response.Write(Round(BMINUS_total_iscol/BMINUS_total_events*100,1)) End If %> %) |
<%= BMINUS_total_iscolvtx %> (<%If BMINUS_total_events>0 Then response.Write(Round(BMINUS_total_iscolvtx/BMINUS_total_events*100,1)) End If %> %) |
| <%= trig_config %> |
BZERO |
<%= BZERO_total_events %> |
<%= BZERO_total_analysed %> (<%If BZERO_total_events>0 Then response.Write(Round(BZERO_total_analysed/BZERO_total_events*100,1)) End If %> %) |
<%= BZERO_total_pnppnarrow %> (<%If BZERO_total_events>0 Then response.Write(Round(BZERO_total_pnppnarrow/BZERO_total_events*100,1)) End If %> %) |
<%= BZERO_total_pn2pp2narrow %> (<%If BZERO_total_events>0 Then response.Write(Round(BZERO_total_pn2pp2narrow/BZERO_total_events*100,1)) End If %> %) |
<%= BZERO_total_iscol %> (<%If BZERO_total_events>0 Then response.Write(Round(BZERO_total_iscol/BZERO_total_events*100,1)) End If %> %) |
<%= BZERO_total_iscolvtx %> (<%If BZERO_total_events>0 Then response.Write(Round(BZERO_total_iscolvtx/BZERO_total_events*100,1)) End If %> %) |
| <%= trig_config %> |
BPLUS : B |
<%= BPLUS_total_events %> |
<%= BPLUS_total_analysed %> (<%If BPLUS_total_events>0 Then response.Write(Round(BPLUS_total_analysed/BPLUS_total_events*100,1)) End If %> %) |
<%= BPLUS_total_pnppnarrow %> (<%If BPLUS_total_events>0 Then response.Write(Round(BPLUS_total_pnppnarrow/BPLUS_total_events*100,1)) End If %> %) |
<%= BPLUS_total_pn2pp2narrow %> (<%If BPLUS_total_events>0 Then response.Write(Round(BPLUS_total_pn2pp2narrow/BPLUS_total_events*100,1)) End If %> %) |
<%= BPLUS_total_iscol %> (<%If BPLUS_total_events>0 Then response.Write(Round(BPLUS_total_iscol/BPLUS_total_events*100,1)) End If %> %) |
<%= BPLUS_total_iscolvtx %> (<%If BPLUS_total_events>0 Then response.Write(Round(BPLUS_total_iscolvtx/BPLUS_total_events*100,1)) End If %> %) |
| <%= trig_config %> |
BMINUS : A |
<%= BMINUS_total_events %> |
<%= BMINUS_total_analysed %> (<%If BMINUS_total_events>0 Then response.Write(Round(BMINUS_total_analysed/BMINUS_total_events*100,1)) End If %> %) |
<%= BMINUS_total_pnppnarrow %> (<%If BMINUS_total_events>0 Then response.Write(Round(BMINUS_total_pnppnarrow/BMINUS_total_events*100,1)) End If %> %) |
<%= BMINUS_total_pn2pp2narrow %> (<%If BMINUS_total_events>0 Then response.Write(Round(BMINUS_total_pn2pp2narrow/BMINUS_total_events*100,1)) End If %> %) |
<%= BMINUS_total_iscol %> (<%If BMINUS_total_events>0 Then response.Write(Round(BMINUS_total_iscol/BMINUS_total_events*100,1)) End If %> %) |
<%= BMINUS_total_iscolvtx %> (<%If BMINUS_total_events>0 Then response.Write(Round(BMINUS_total_iscolvtx/BMINUS_total_events*100,1)) End If %> %) |
Notes :