Module tdcmap_mod
module tdcmap_mod
! Uses
use precision_mod
! Variables
integer, public, PARAMETER :: nslot = 26
integer, public, PARAMETER :: nchannel = 96
integer, public, PARAMETER :: tdcmap_size = nslot * nchannel
integer, public, PARAMETER :: nindexv = 3
integer, public, PARAMETER :: mbank = 2
logical, public :: FBCmapNew
integer, public, dimension (tdcmap_size, mbank) :: tdcown
integer, public, dimension (tdcmap_size, nindexv, mbank) :: tdcmap
! Subroutines and functions
public subroutine readFbcMaps ()
private function tdcmap_read (sname, tdcmap, tdcown, bankID)
private subroutine CheckPlane (plane, iplane, isubsys)
private subroutine CheckFullyInstrumentedFlag ()
end module tdcmap_mod
Description of Variables
nslot
integer, public, PARAMETER :: nslot = 26
max slots per crate
nchannel
integer, public, PARAMETER :: nchannel = 96
max channels per slot
tdcmap_size
integer, public, PARAMETER :: tdcmap_size = nslot * nchannel
nindexv
integer, public, PARAMETER :: nindexv = 3
mbank
integer, public, PARAMETER :: mbank = 2
max number of crates
FBCmapNew
logical, public :: FBCmapNew
tdcown
integer, public, dimension (tdcmap_size, mbank) :: tdcown
which subsystem
tdcmap
integer, public, dimension (tdcmap_size, nindexv, mbank) :: tdcmap
index: 1=plane, 2=wire, 3=???
Description of Subroutines and Functions
readFbcMaps
public subroutine readFbcMaps ()
! Calls: CheckFullyInstrumentedFlag, SetupPCcells, kerror
end subroutine readFbcMaps
----------------------------------------------------------------------c
Subroutine: TDCMAP_READ c
Author: Bommalu Scheumann ( TRIUMF ) c
Experiment: BNL - #787 c
Date: January 23, 1988 c
----------------------------------------------------------------------c
Input: SNAME (Character*4) : Name of component for map file c
c
I/O: TDCOWN(j) (INTEGER*4) : integer code of sub-system c
"owning" jth FB TDC address c
(see /SS_INDEX/) c
c
Output: TDCMAP(j,k) (INTEGER*4) : kth index variable value c
corresponding to jth FB TDC c
address c
NOTE: The arrays TDCMAP and TDCOWN correspond to ONE TDC c
crate. c
----------------------------------------------------------------------c
Description: This routine sets up the mapping between TDC channels c
of a FastBus crate and elements of a detector c
component. The TDC map file for the given component c
is fetched (component is SNAME, attribute is 'MAP') c
If it isn't the current map file in use for this c
component, it is opened, read and c
its contents translated into the given TDC map array. c
c
TDC map files must have the format: c
c
Line(s) Description c
------------------------------------------------------ c
1...(n-1) comments (ignored by this routine) c
n hash (#) character in column 1 (indicates c
start of data) (1 <= n <= 10) c
n+1 MSHFT(1) ... MSHFT(NIV) c
MSHFT represents the number of shifts neededc
for each index variable to make a component c
address c
(n+2)... data lines c
c
A data line must have the format: c
c
islot ichannel iv(1) ... iv(niv) c
c
For example, in the case of the drift chamber, the c
line: c
c
10 5 1 6 c
c
would indicate that wire 6 of cell 1 is connected to c
channel 5 in slot 10 of the FB crate. "Cell number" c
would be the first index variable and "wire number" c
the second index variable. The drift chamber thus c
uses two index variables. c
c
This information is stored in the following manner: c
c
IADDRESS = ISLOT*NCHANNEL + ICHANNEL + 1 c
TDCMAP(IADDRESS, 1) = IV(1) c
... c
TDCMAP(IADDRESS, NIV) = IV(NIV) c
TDCOWN(IADDRESS) = ISUBSYSTEM c
c
The maximum number of index variables that a sub- c
system can use is (NINDEXV - 1) (see KOFIA$INCLUDE: c
TDCMAP.PAR). TDCMAP(IADDRESS, NINDEXV) is reserved c
for something called MAP_ID (see code). c
c
Before the map reading takes place, any old map c
information for the sub-system is deleted. As the new c
map information is read in, if an address turns out to c
be owned by another sub-system, THAT sub-system's map c
information is deleted. The presumption is that NEW c
map information overrides OLD map information. NO two c
components may use the same address at the same time. c
----------------------------------------------------------------------c
Modifications: c
c
31-Jul-1997 RP Set nindexv to a maximum of 3, it means that the c
number of detector index can be at most 2 c
18-July-99 AO Cosmetic mods to F90 style c
10-Jun-2002 ML Modifications to PC multiplexing c
----------------------------------------------------------------------c
tdcmap_read
private function tdcmap_read (sname, tdcmap, tdcown, bankID)
character (len=4) :: sname
integer (kind=I4), INTENT(OUT), dimension (tdcmap_size, nindexv) :: tdcmap
integer (kind=i4), INTENT(OUT), dimension (tdcmap_size) :: tdcown
integer (kind=i4), INTENT(IN) :: bankID
integer (kind=I4) :: tdcmap_read
! Calls: CDFGET, RITE, kerror2
end function tdcmap_read
CheckPlane
private subroutine CheckPlane (plane, iplane, isubsys)
type (plane_type), INTENT(inout) :: plane
integer, INTENT(in) :: iplane
integer, INTENT(in) :: isubsys
! Calls: kerror
end subroutine CheckPlane
CheckFullyInstrumentedFlag
private subroutine CheckFullyInstrumentedFlag ()
! Calls: CheckPlane
end subroutine CheckFullyInstrumentedFlag