5 * Revision 1.1.1.1 1995/10/24 10:21:09 cernlib
9 #include "geant321/pilot.h"
10 *CMZ : 3.21/02 29/03/94 15.41.20 by S.Giani
12 SUBROUTINE GFDIGI(IUSET,IUDET,NTDIM,NVDIM,NDDIM,NDMAX,NUMVS
13 +, LTRA,NTRA,NUMBV,KDIGI,NDIGS)
15 C. ******************************************************************
18 C. * Returns the digitisations for the physical volume *
19 C. * specified by the list NUMVS with generic volume name IUDET *
20 C. * belonging to set IUSET. *
21 C. * IUSET user set identifier *
22 C. * IUDET user detector identifier (name of the *
23 C. * corresponding sensitive volume) *
24 C. * NTDIM 1st dimension of LTRA (max. number of tracks *
26 C. * NVDIM 1st dimension of NUMVS, NUMBV (usually =NV, the *
27 C. * number of volume descriptors which permit to iden- *
28 C. * tify a given detector, possibly smaller than NV) *
29 C. * NDDIM 1st dimension of KDIGI (argument ND of GSDETD) *
30 C. * NDMAX is the maximum number of digitisations to be *
32 C. * NUMVS is a 1-Dim array that must contain on input the *
33 C. * geometric path of the detector volume to be *
35 C. * All 0 interpreted as 'all physical volumes with *
36 C. * generic name IUDET' *
37 C. * LTRA is a 2-Dim array that will contain on output for *
38 C. * each digitisation the numbers of the tracks which *
39 C. * have produced it *
40 C. * NTRA is a 1-Dim array that will contain on output for *
41 C. * each digitisation the total number of tracks *
43 C. * In case this number is greater than NTDIM, only *
44 C. * the first NTDIM corresponding tracks can be *
45 C. * returned on LTRA *
46 C. * NUMBV is a 2-Dim array that will contain on output for *
47 C. * each digitisation the list of volume numbers which *
48 C. * identify each physical volume *
49 C. * KDIGI is a 2-Dim array that will contain the NDIGI *
51 C. * NDIGI is the total number of digitisations in this *
53 C. * In case the total number of digitisations is *
54 C. * greater than NDMAX, NDIGI is set to NDMAX+1 and *
55 C. * only NDMAX digitisations are returned *
56 C. * - KDIGI(1,I) = digitisation type 1 for digitisation *
58 C. * - NUMBV(1,I) = volume number 1 for digitisation number I *
59 C. * - LTRA (1,I) = first track number contributing to *
60 C. * digitisation number I *
61 C. * In the calling routine, the arrays LTRA, NTRA, NUMVS, *
62 C. * NUMBV, KDIGI must be dimensioned to: *
63 C. * LTRA (NTDIM,NDMAX) *
66 C. * NUMBV(NVDIM,NDMAX) *
67 C. * KDIGI(NDDIM,NDMAX) *
69 C. * ==>Called by : <USER> *
70 C. * Author W.Gebel ********* *
72 C. ******************************************************************
74 #include "geant321/gcbank.inc"
76 DIMENSION NUMVT(NVMAX),NUMVS(NVDIM),NUMBV(NVDIM,1)
77 DIMENSION LTRA(NTDIM,1),NTRA(1),KDIGI(NDDIM,1)
78 EQUIVALENCE (WS(1),NUMVT(1))
79 CHARACTER*4 IUSET,IUDET
81 C. --------------------------------------------------------------------------
83 C Find if selected set, detector exists
86 IF(JDIGI.LE.0)GO TO 999
88 CALL GLOOK(IUSET,IQ(JSET+1),NSET,ISET)
89 IF(ISET.LE.0)GO TO 999
96 CALL GLOOK(IUDET,IQ(JS+1),NDET,IDET)
97 IF(IDET.EQ.0)GO TO 999
101 IF(JDID.LE.0)GO TO 999
105 IF(ILAST.EQ.0)GO TO 999
119 IF(I.GE.ILAST)GO TO 110
123 NTRM1= IBITS(IQ(JDID+I+NK),0,16)
128 C Find the selected volume
129 C (if NO volumes exist take ALL digits)
140 IF(IV.LE.NVMAX)NUMVT(IV)=IQ(JDID+I+NK)
147 IF(IV.LE.NVMAX)NUMVT(IV)=IBITS(IQ(JDID+I+NK),K-1,NB)
151 IF(NUMVS(IV).NE.0)THEN
152 IF(NUMVS(IV).NE.NUMVT(IV))GO TO 10
161 C ========> Now store number of tracks and volume numbers,
162 C and fetch track numbers and digits
165 IF(IDIG.GT.NDMAX)GO TO 110
169 CALL VZERO (NUMBV(1,IDIG),NVDIM)
170 CALL UCOPY (NUMVT(1),NUMBV(1,IDIG),NVMIN)
180 LTRA(ITR ,IDIG)=IBITS(IQ(JDID+I+NK),16,16)
184 LTRA(ITR+1,IDIG)=IBITS(IQ(JDID+I+NK), 0,16)
188 IF(NTRT.LE.NTDIM)THEN
190 + LTRA(NTRT,IDIG)=IBITS(IQ(JDID+I+NK),16,16)
195 C Get unpacked digits
206 IF(ID.LE.NDDIM)KDIGI(ID,IDIG)=IQ(JDID+I+NK)
213 IF(ID.LE.NDDIM)KDIGI(ID,IDIG)=IBITS(IQ(JDID+I+NK),K-1,NB)