<%@ LANGUAGE="VBScript" %> <% start_time = Time %> Pedestal Correlation with IDE <% ' ' Get the two ROWID's for the measurement, the outside routine will determine which ones ! ' Dim Rowid(1) Dim Wurst(1) Dim IDE_Ped(20) Dim Phobos_Ped(20) Dim Chip(20) Dim String(20) Dim Stringchip(20) Dim Logdate(1) Dim Description(1) Dim Comments(1) Dim Nchans(1) For i=0 To 1 Rowid(i)="-" Wurst(i)=-1 Logdate(i)=" " Description(i)=" " Comments(i)=" " Nchans(i)=" " Next nrows=0 If Request("REQ_ROWID_0")<>"" And Request("REQ_ROWID_0")<>"-" Then Rowid(nrows)=Request("REQ_ROWID_0") nrows=nrows+1 End If If Request("REQ_ROWID_1")<>"" And Request("REQ_ROWID_1")<>"-" Then Rowid(nrows)=Request("REQ_ROWID_1") nrows=nrows+1 End If nrows=nrows-1 ' ' gsfs added lines to read xmin, xmax, ymin, ymax 6/5/00 If Not IsEmpty(Request("xmin")) Then xmin = CDbl(Request("xmin")) End If If Not IsEmpty(Request("xmax")) Then xmax = CDbl(Request("xmax")) End If If Not IsEmpty(Request("ymin")) Then ymin = CDbl(Request("ymin")) End If If Not IsEmpty(Request("ymax")) Then ymax = CDbl(Request("ymax")) End If If Not IsEmpty(Request("xtic")) Then xtic = CDbl(Request("xtic")) End If If Not IsEmpty(Request("ytic")) Then ytic = CDbl(Request("ytic")) End If ' End of gsfs addition ' If nrows>-1 Then Set Connection = Server.CreateObject("ADODB.Connection") Connection.Mode = adModeRead Connection.Open phdb_rd ' ' Get number of channels in a string ' ' SQLStmtx = "select max(ahc.wurst_id) istring,max(chip_type) onechip,max(chip_type)*count(wurst_read_pos) nstring" SQLStmtx = SQLStmtx & " from assembly.asm_hybrid_chip ahc,assembly.asm_hybrid_id ahi,assembly.asm_hybrid_log ahl " SQLStmtx = SQLStmtx & " where ahl.ROWID = '" & CStr(Rowid(0)) & "'" SQLStmtx = SQLStmtx & " and ahl.HYBRID_ID=ahi.HYBRID_ID" SQLStmtx = SQLStmtx & " and ahc.hybrid_type=ahi.hybrid_type" SQLStmtx = SQLStmtx & " group by ahc.hybrid_type,ahc.wurst_id" Set RSx = Connection.Execute(SQLStmtx) kstring=0 Do While Not RSx.EOF nstring=Cint(RSx("nstring")) onechip=Cint(RSx("onechip")) kstring=kstring+1 RSx.MoveNext Loop SQLStmt0 = "select ahl.HYBRID_ID,to_char(LOGDATE,'MM/DD/YYYY HH24:MI:SS')LDATE,ahl.WURST_ID,CONFIG,ahl.COMMENTS,aha.DESCRIPTION from ASSEMBLY.ASM_HYBRID_LOG ahl,ASSEMBLY.ASM_HYBRID_ACTION aha " SQLStmt2 = "select ahl.WURST_ID,sm.MEASUREMENT_ID,sml.DESCRIPTION,sm.MEASUREMENT_VALUE value from ASSEMBLY.ASM_HYBRID_LOG ahl,ASSEMBLY.STRING_MEASUREMENT sm, ASSEMBLY.STRING_MEASUREMENT_LIST sml" ' ' Prepare for plotting data ' SQLStmt1 = "select max(ahc.hybrid_chip_pos) chip,max(ahc.wurst_id) string,max(ahc.wurst_read_pos) stringchip,max(acid.mean_ped) mped,avg(scm.measurement_out) aped" SQLStmt1 = SQLStmt1 & " from assembly.asm_hybrid_log ahl,assembly.string_channel_measurement scm,assembly.asm_hybrid_chip ahc," SQLStmt1 = SQLStmt1 & " assembly.asm_hybrid_id ahi,assembly.asm_chip_bond_id acbi,assembly.asm_chip_id_data acid " If nrows=0 Then ' ' Just one string ' SQLStmt0 = SQLStmt0 & " where ahl.ROWID = '" & CStr(Rowid(0)) & "'" SQLStmt1 = SQLStmt1 & " where ahl.ROWID = '" & CStr(Rowid(0)) & "'" SQLStmt2 = SQLStmt2 & " where ahl.ROWID = '" & CStr(Rowid(0)) & "'" Else ' ' Two strings ' SQLStmt0 = SQLStmt0 & " where (ahl.ROWID = '" & CStr(Rowid(0)) & "' or ahl.ROWID = '" & CStr(Rowid(1)) & "') " SQLStmt1 = SQLStmt1 & " where (ahl.ROWID = '" & CStr(Rowid(0)) & "' or ahl.ROWID = '" & CStr(Rowid(1)) & "') " SQLStmt2 = SQLStmt2 & " where (ahl.ROWID = '" & CStr(Rowid(0)) & "' or ahl.ROWID = '" & CStr(Rowid(1)) & "') " End If SQLStmt0 = SQLStmt0 & " and ahl.ACTION=aha.ACTION order by ahl.WURST_ID" SQLStmt1 = SQLStmt1 & " and ahl.logdate=scm.startdate and ahl.hybrid_id=ahi.hybrid_id and ahi.hybrid_type=ahc.hybrid_type " SQLStmt1 = SQLStmt1 & " and ahc.wurst_id=ahl.wurst_id and ahl.hybrid_id=acbi.hybrid_id and ahc.hybrid_chip_pos=acbi.hybrid_chip_pos" SQLStmt1 = SQLStmt1 & " and acbi.chip_run=acid.chip_run and acbi.chip_id=acid.chip_id " SQLStmt1 = SQLStmt1 & " and scm.measurement_id='PEDCAL'" SQLStmt1 = SQLStmt1 & " and ahc.wurst_read_pos=floor(scm.channelnum/ahc.chip_type) group by ahc.hybrid_chip_pos" SQLStmt1 = SQLStmt1 & " order by chip" SQLStmt2 = SQLStmt2 & " and ahl.LOGDATE=sm.STARTDATE and sm.MEASUREMENT_ID=sml.MEASUREMENT_ID order by sm.MEASUREMENT_ID,ahl.WURST_ID" Set RS0 = Connection.Execute(SQLStmt0) Set RS2 = Connection.Execute(SQLStmt2) %> <% If Not RS0.EoF Then %>

Correlation of IDE and Phobos Average Chip Pedestals, HYBRID ID : <%= RS0("HYBRID_ID")%>

<% End If Do While Not RS0.EoF wurst_id=CInt(RS0("WURST_ID")) logdate(wurst_id)=RS0("LDATE") description(wurst_id)=RS0("DESCRIPTION") comments(wurst_id)=RS0("COMMENTS") nchans(wurst_id)=nstring RS0.MoveNext Loop %>
<% old_test="XXXXXX" Do While Not RS2.Eof If old_test<>CStr(RS2("MEASUREMENT_ID")) Then If old_test<>"XXXXXX" Then 'finish previous row %> <% End If old_test=CStr(RS2("MEASUREMENT_ID")) %> <% If CInt(RS2("WURST_ID"))=0 Then %> <% Else %> <% End If Else If CInt(RS2("WURST_ID"))=1 Then %> <% Else %> <% End If End If %> <% RS2.MoveNext Loop %>
 

String_0

String_1

Test Date <%=logdate(0)%> <%=logdate(1)%>
Test Type <%=Description(0)%> <%=Description(1)%>
Channels <%=Nchans(0)%> <%=Nchans(1)%>
Comments <%=comments(0)%> <%=comments(1)%>
<%=RS2("DESCRIPTION")%> <%=RS2("VALUE")%>   <%=RS2("VALUE")%> <%=RS2("VALUE")%> Error: Table logic messed up

 <% ' ' Do heavy duty database extraction here ' Set RS1 = Connection.Execute(SQLStmt1) npoints=0 Do While Not RS1.EoF ' ' Get average pedestals ' Chip(npoints)=CInt(RS1("chip")) If Not IsNull(RS1("mped")) Then IDE_Ped(npoints)=-CDbl(RS1("mped")) Else IDE_Ped(npoints)=-999 End If Phobos_Ped(npoints)=CDbl(RS1("aped")) String(npoints)=CDbl(RS1("string")) Stringchip(npoints)=CDbl(RS1("stringchip")) npoints=npoints+1 RS1.MoveNext Loop npoints=npoints-1 %> <% start_time = Time %> <% ' ' Prepare plot ' seed=-(second(now())+60*minute(now())+3600*hour(now())+3600*24*day(now())) filename="mped" & cstr(int(100000.*rnd(seed))) & ".jpg" filename_full=ph_image_directory & filename %> <% Dim Chart Dim Color(8) Color(0) = vbRed Color(1) = vbBlue Color(2) = vbYellow Color(3) = vbGreen Color(4)= vbMagenta Color(5)= vbCyan Color(6)= vbWhite Color(7)= vbBlack rem ********************************************************************** rem * Instantiate the Chart component rem ********************************************************************** Set Chart = Server.CreateObject ("ASPChart.Chart") rem ********************************************************************** rem * Create x Array rem ********************************************************************** Chart.AddSeries 6 Chart.SeriesTitle = "Average pedestal correlation" Chart.LineWidth = 1 Chart.Stairs = True Chart.SeriesInLegend = true For ipoints=0 To npoints Chart.AddXY Phobos_Ped(ipoints),IDE_Ped(ipoints),"",Color(1) Next rem ********************************************************************** rem * Add and format the title rem ********************************************************************** rem Chart.ChartTitleAdd ("Pedestal, Hybrid " & CStr(RSx("HYBRID_ID"))) Chart.ChartTitleFont.Size = 16 Chart.ChartTitleFont.Name = "Arial" Chart.ChartTitleFont.Italic = true Chart.ChartTitleFont.Bold = true Chart.View3D = false Chart.LegendVisible = false Chart.LegendStyle = cSeries Chart.AxisGridLines = true Chart.Frame = false Chart.BottomAxisIncrement = 50. Chart.LeftAxisIncrement = 50. ' ' gsfs added xtic, ytic option If IsEmpty(xtic) Then Chart.BottomAxisIncrement = 50. Else Chart.BottomAxisIncrement = xtic End If If IsEmpty(ytic) Then Chart.LeftAxisIncrement = 50. Else Chart.LeftAxisIncrement = ytic End If ' rem ********************************************************************** rem * Remove the OuterBevel, add a gradient fill to chart panel rem ********************************************************************** Chart.BevelOuter = 0 rem Chart.GradientVisible = true rem Chart.GradientStartColor = vbWhite rem Chart.GradientEndColor = vbYellow Chart.PanelColor = Color(6) rem ********************************************************************** rem * Set the Width and Height of the image rem ********************************************************************** Chart.Height = 400 Chart.Width = 400 ' If nrows<1 Then ' Single String ' Chart.HorizAxisMax =(wurst_id+1)*nstring+1 ' Chart.HorizAxisMin = wurst_id*nstring ' Else Chart.HorizAxisMin =-500 Chart.HorizAxisMax = 100 ' End If Chart.VertAxisMin = -400. Chart.VertAxisMax = 200. ' Following lines added by gsfs 8/1/00 If IsEmpty(xmin) Then Chart.HorizAxisMin = -500 Else Chart.HorizAxisMin = xmin End If If IsEmpty(xmax) Then Chart.HorizAxisMax = 100 Else Chart.HorizAxisMax = xmax End If If IsEmpty(ymin) Then Chart.VertAxisMin = -400. Else Chart.VertAxisMin = ymin End If If IsEmpty(ymax) Then Chart.VertAxisMax = 200. Else Chart.VertAxisMax = ymax End If ' End of gsfs addition Chart.AddAxisLabel 1 , "-Mean Pedestal as measured by IDE [mV]" Chart.AddAxisLabel 2 , "Mean Pedestal as measured by Phobos [mV]" rem ********************************************************************** rem * Set the filename, save the image and write the image tag rem ********************************************************************** Chart.FileName = filename_full Chart.SaveChart line="

" Response.Write (line) rem ********************************************************************** rem * Destroy the object rem ********************************************************************** Set Chart = nothing ' Database is not needed anymore ! Connection.Close %> <% Else %> Both ROWID's are empty ! <%End If%>

 

<% For ipoints=0 To npoints %> <% Next %>
Chip Number String String Readout Seq -IDE_Pedestal

(note sign change)

Phobos_Pedestal
<%=Chip(ipoints)%> <%=String(ipoints)%> <%=Stringchip(ipoints)%> <%=Round(IDE_Ped(ipoints),0)%> <%=Round(Phobos_Ped(ipoints),0)%>