1 |
* |
2 |
* $Id$ |
3 |
* |
4 |
* $Log$ |
5 |
* |
6 |
*CMZ : 2.01/00 05/04/2000 14.35.18 by Marialuigia Ambriola |
7 |
*CMZ : 2.00/00 03/03/2000 15.39.06 by Francesco Cafagna |
8 |
*CMZ : 1.02/00 22/10/99 16.17.58 by Francesco Cafagna |
9 |
*CMZ : 1.01/00 21/05/96 17.33.38 by Francesco Cafagna |
10 |
*CMZ : 1.00/02 04/04/96 16.08.24 by Francesco Cafagna |
11 |
*-- Author : Francesco Cafagna 23/02/96 |
12 |
SUBROUTINE GPDCAS |
13 |
************************************************************************ |
14 |
* * |
15 |
* To perform CAS digitization * |
16 |
* * |
17 |
* Called by: GUDIGI * |
18 |
* Author: Francesco Cafagna, 23/02/96 12.50.38 * |
19 |
* * |
20 |
************************************************************************ |
21 |
#include "gcunit.inc" |
22 |
#include "gpphit.inc" |
23 |
PARAMETER (NH=NHCAS,NHM=NHMCAS,NVOL=2) |
24 |
#include "gprhit.inc" |
25 |
#include "gpcas.inc" |
26 |
#include "gpsed.inc" |
27 |
* |
28 |
INTEGER IS,ID,NV,NVM |
29 |
CHARACTER*4 CSET |
30 |
* |
31 |
* |
32 |
* Vector zeroed |
33 |
* |
34 |
CALL VZERO(ICAS,NHM) |
35 |
CALL VZERO(XCAS,NHM) |
36 |
CALL VZERO(YCAS,NHM) |
37 |
CALL VZERO(ZCAS,NHM) |
38 |
CALL VZERO(XOCAS,NHM) |
39 |
CALL VZERO(YOCAS,NHM) |
40 |
CALL VZERO(ZOCAS,NHM) |
41 |
CALL VZERO(ERCAS,NHM) |
42 |
CALL VZERO(TIMECAS,NHM) |
43 |
CALL VZERO(PACAS,NHM) |
44 |
CALL VZERO(P0CAS,NHM) |
45 |
CALL VZERO(ICASPAR,NHM) |
46 |
CALL VZERO(NUMD ,NVOL) |
47 |
* |
48 |
NV = NVOL |
49 |
NVM= NVMAX |
50 |
IS = ISCAS |
51 |
ID = IDCASX |
52 |
CSET = 'CAS ' |
53 |
IT = -1 |
54 |
* |
55 |
* Check on the volume level |
56 |
* |
57 |
IF (NV.GT.NVM) THEN |
58 |
WRITE(CHMAIL,10000) CSET,CNSED(IS,ID),NVOL,NVMAX, |
59 |
+ IDRUN,IDEVT |
60 |
CALL GMAIL(1,0) |
61 |
GO TO 10 |
62 |
ENDIF |
63 |
CALL VZERO(VHITS,NH*NHM) |
64 |
CALL VZERO(ITRA ,NHM) |
65 |
CALL VZERO(NUMBV,NVOL*NHM) |
66 |
NHITS = -1 |
67 |
CALL GPRHIT(CSET,CNSED(IS,ID),IS,ID,NVOL,NH,NHM,1, |
68 |
+ IT,NUMD,ITRA,NUMBV,VHITS,NHITS) |
69 |
* |
70 |
* If there was a problem in GPRHIT then exit |
71 |
* |
72 |
IF(NHITS.LT.0) THEN |
73 |
WRITE(CHMAIL,10100) CSET,CNSED(IS,ID),NHITS,NHM, |
74 |
+ IDRUN,IDEVT |
75 |
CALL GMAIL(1,0) |
76 |
GO TO 10 |
77 |
ENDIF |
78 |
* |
79 |
* >>>>>>>>>>>>>>>>>>>>>> DIGI action |
80 |
* |
81 |
* |
82 |
* Fill the CWN common |
83 |
* |
84 |
NTHCAS = NHITS |
85 |
DO I=1,NHITS |
86 |
ICAS(I) = NUMBV(NVCAS,I) |
87 |
#if defined(GPAMELA_INTER) |
88 |
XINCAS(I) = 2*VHITS(1,I)-VHITS(4,I) |
89 |
YINCAS(I) = 2*VHITS(2,I)-VHITS(5,I) |
90 |
ZINCAS(I) = 2*VHITS(3,I)-VHITS(6,I) |
91 |
#endif |
92 |
#if !defined(GPAMELA_INTER) |
93 |
XINCAS(I) = VHITS(1,I) |
94 |
YINCAS(I) = VHITS(2,I) |
95 |
ZINCAS(I) = VHITS(3,I) |
96 |
#endif |
97 |
XOUTCAS(I) = VHITS(4,I) |
98 |
YOUTCAS(I) = VHITS(5,I) |
99 |
ZOUTCAS(I) = VHITS(6,I) |
100 |
ERELCAS(I) = VHITS(7,I) |
101 |
TIMECAS(I)= VHITS(8,I) |
102 |
PATHCAS(I) = VHITS(9,I) |
103 |
IPARCAS(I) = VHITS(10,I) |
104 |
P0CAS(I) = VHITS(11,I) |
105 |
ENDDO |
106 |
* |
107 |
* Next detector |
108 |
* |
109 |
ID = IDCASY |
110 |
CALL VZERO(VHITS,NH*NHM) |
111 |
CALL VZERO(ITRA ,NHM) |
112 |
CALL VZERO(NUMBV,NVOL*NHM) |
113 |
NHITS = -1 |
114 |
* |
115 |
* Update the max number of hits to be retrived |
116 |
* |
117 |
NNHM = NHM - NTHCAS |
118 |
IF(NNHM.LE.0) THEN |
119 |
WRITE(CHMAIL,10100) CSET,CNSED(IS,ID),NTHCAS,NHM, |
120 |
+ IDRUN,IDEVT |
121 |
CALL GMAIL(1,0) |
122 |
GO TO 10 |
123 |
ENDIF |
124 |
CALL GPRHIT(CSET,CNSED(IS,ID),IS,ID,NVOL,NH,NNHM,1, |
125 |
+ IT,NUMD,ITRA,NUMBV,VHITS,NHITS) |
126 |
* |
127 |
* If there was a problem in GPRHIT then exit |
128 |
* |
129 |
IF(NHITS.LT.0) THEN |
130 |
WRITE(CHMAIL,10200) CSET,CNSED(IS,ID),NHITS,NHM, |
131 |
+ IDRUN,IDEVT |
132 |
CALL GMAIL(1,0) |
133 |
GO TO 10 |
134 |
ENDIF |
135 |
* |
136 |
* >>>>>>>>>>>>>>>>>>>>>> DIGI action |
137 |
* |
138 |
* |
139 |
* Fill the CWN common |
140 |
* |
141 |
DO I=1,NHITS |
142 |
NTHCAS = NTHCAS + 1 |
143 |
ICAS(NTHCAS) = 2 + NUMBV(NVCAS,I) |
144 |
#if defined(GPAMELA_INTER) |
145 |
XINCAS(NTHCAS) = 2*VHITS(1,I)-VHITS(4,I) |
146 |
YINCAS(NTHCAS) = 2*VHITS(2,I)-VHITS(5,I) |
147 |
ZINCAS(NTHCAS) = 2*VHITS(3,I)-VHITS(6,I) |
148 |
#endif |
149 |
#if !defined(GPAMELA_INTER) |
150 |
XINCAS(NTHCAS) = VHITS(1,I) |
151 |
YINCAS(NTHCAS) = VHITS(2,I) |
152 |
ZINCAS(NTHCAS) = VHITS(3,I) |
153 |
#endif |
154 |
XOUTCAS(NTHCAS) = VHITS(4,I) |
155 |
YOUTCAS(NTHCAS) = VHITS(5,I) |
156 |
ZOUTCAS(NTHCAS) = VHITS(6,I) |
157 |
ERELCAS(NTHCAS) = VHITS(7,I) |
158 |
TIMECAS(NTHCAS)= VHITS(8,I) |
159 |
PATHCAS(NTHCAS) = VHITS(9,I) |
160 |
IPARCAS(NTHCAS) = VHITS(10,I) |
161 |
P0CAS(NTHCAS) = VHITS(11,I) |
162 |
ENDDO |
163 |
* |
164 |
10000 FORMAT(' GPDCAS: VOLUME level too big: SET=',A4,', DET=',A4,', |
165 |
+ NVOL=',I3,', NVMAX=',I3,', RUN=',I5,', EVT=',I8) |
166 |
10100 FORMAT(' GPDCAS: Error in GPRHIT: SET=',A4, |
167 |
+ ', DET=',A4,',NHITS=',I5,', NHMAX=',I5, |
168 |
+ ', RUN=',I5,', EVT=',I8) |
169 |
10200 FORMAT(' GPDCAS: Error in GPRHIT: SET=',A4, |
170 |
+ ', DET=',A4,',NHITS=',I5,', NHMAX=',I5, |
171 |
+ ', RUN=',I5,', EVT=',I8) |
172 |
10 RETURN |
173 |
END |