*--------1---------2---------3---------4---------5---------6---------7-- * Statistics and data logging: * * 1. Logbook: occurence list, SPACAL radius matching * 2. The mask representation in the VHDL format for * the frontend ALTERA code. * 3. The H1 database - list of masks sorted by the * ascending radial projection onto SPACAL subroutine GENLOG include './Include/mskdata.inc' integer Index, Mask, Pointer, HowMany integer AccEfficiency(MaskNumExp, 12), TotEfficiency(12) real SRadius(MaskNumExp, 12), Temp, Result character*10 Header character*5 Entry(11), MSKstore(MaskNumExp, 12), Exchange character*2 Suffix(12) data Suffix/'00', '01', '02', '03', '04', '05', + '10', '11', '12', '13', '14', '15'/ * initialize statistical variables *---------------------------------- Exchange = '+0000' do J = 1, 12 TotEfficiency(J) = 0 do I = 1, MaskNumExp MSKstore(I, J) = Exchange AccEfficiency(I, J) = 0 SRadius(I, J) = 0. end do end do * expanding masks *---------------------------------- do J = 1, 12 Index = 0 do I = 1, Limit(J) Mask = Bookshelf(I, J) call MUTATE(Mask, Entry, HowMany) do K = 1, HowMany Index = Index + 1 if (Weight(I, J).ne.0) then SRadius(Index, J) = Sproject(I, J) / Weight(I, J) end if Yield(Index, J) = Weight(I, J) / HowMany MSKstore(Index, J) = Entry(K) end do end do Limit(J) = Index end do * merge weights for two similar masks *---------------------------------- do J = 1, 12 do I = 1, Limit(J) do K = (I+1), Limit(J) if (MSKstore(I, J).eq.MSKstore(K, J)) then SRadius(I, J) = SRadius(I, J) * Yield(I, J) + + SRadius(K, J) * Yield(K, J) Yield(I, J) = Yield(I, J) + Yield(K, J) SRadius(I, J) = SRadius(I, J) / Yield(I, J) MSKstore(K, J) = Exchange SRadius(K, J) = 0. Yield(K, J) = 0. end if end do end do end do * sorting masks according to their occurrence *---------------------------------- do J = 1, 12 do I = 1, Limit(J) Pointer = I Result = Yield(Pointer, J) do K = (I+1), Limit(J) if (Result.lt.Yield(K, J)) then Result = Yield(K, J) Pointer = K end if end do Temp = Yield(Pointer, J) Yield(Pointer, J) = Yield(I, J) Yield(I, J) = Temp Temp = Sradius(Pointer, J) SRadius(Pointer, J) = SRadius(I, J) SRadius(I, J) = Temp Exchange = MSKstore(Pointer, J) MSKstore(Pointer, J) = MSKstore(I, J) MSKstore(I, J) = Exchange end do end do * estimating efficiencies *---------------------------------- do J = 1, 12 Result = 0. do I = 1, Limit(J) Result = Result + 100. * Yield(I, J) / Subset(J) AccEfficiency(I, J) = int(Result) end do end do * Minimum amount of masks needed *---------------------------------- do J = 1, 12 Index = 0 do I = 1, Limit(J) if (AccEfficiency(I, J).lt.Cut) then Index = I end if end do TotEfficiency(J) = AccEfficiency(Index, J) Limit(J) = Index end do * sorting masks according to their * Spacal XY - projections *---------------------------------- do J = 1, 12 do I = 1, Limit(J) Pointer = I Result = SRadius(Pointer, J) do K = (I + 1), Limit(J) if (Result.gt.SRadius(K, J)) then Result = SRadius(K, J) Pointer = K end if end do Temp = Yield(Pointer, J) Yield(Pointer, J) = Yield(I, J) Yield(I, J) = Temp Temp = SRadius(Pointer, J) SRadius(Pointer, J) = SRadius(I, J) SRadius(I, J) = Temp Exchange = MSKstore(Pointer, J) MSKstore(Pointer, J) = MSKstore(I, J) MSKstore(I, J) = Exchange end do end do * Bookkeeping *---------------------------------- Exchange = '+0000' open(unit=10, file='logbook.txt', status='new') do J = 1, 12 if (Limit(J).ne.0) then Header = 'Sector '//Suffix(J) write(10, *) Header,'(',TotEfficiency(J),'%):' write(10, *)' ' write(10, *)' N Int Spacal Freq Mask' do I = 1, Limit(J) if (MSKstore(I, J).ne.Exchange) then write(10, 100) I, AccEfficiency(I, J), + SRadius(I, J), 100.*Yield(I, J)/Subset(J), + MSKstore(I, J) end if end do write(10, *)' ' end if end do close(10) * looking for any tracks in each sector and * generating vhdl code for the Altera chip * ------------------------------------------------ do Index = 1, 12 HowMany = Limit(Index) if (HowMany.ne.0) then call GENCODE(Index, HowMany, MaskNumExp, MSKstore) end if end do Creating the H1 database * ------------------------------------------------ open(unit = 10, file = 'database.txt', status = "NEW") do J = 1, 12 if (Limit(J).ne.0) then Header = 'Sector '//Suffix(J) write(10, *) Header, Limit(J) write(10, *)' ' write(10, 200) (MSKstore(I, J), I = 1, Limit(J)) write(10, *)' ' end if end do close(10) 100 format(1x, 1I3, 1x, 1I3, 1x, 1F7.2, 1x, 1F5.2, 1x, 1A5) 200 format(1x, A5,' ',A5,' ',A5,' ',A5,' ',A5,' ',A5,' ', + A5,' ',A5,' ',A5,' ',A5,' ',A5,' ',A5) return end