1 |
* |
2 |
* $Id: gpdcal.F,v 3.3 2005/06/21 02:42:03 cafagna Exp $ |
3 |
* |
4 |
* $Log: gpdcal.F,v $ |
5 |
* Revision 3.3 2005/06/21 02:42:03 cafagna |
6 |
* Major modification to the geometry and to the random number chain |
7 |
* |
8 |
* Revision 3.2 2003/12/17 11:32:48 pamela |
9 |
* CALO SIMULATION COMPLETED: geometry and special tracking parameters updated and simulation checked by a comparison with the Trieste's standalone Monte Carlo simulation |
10 |
* |
11 |
* Revision 3.1.1.1 2002/07/11 16:02:14 cafagna |
12 |
* First GPAMELA release on CVS |
13 |
* |
14 |
* |
15 |
*CMZ : 2.03/00 31/10/2000 11.18.51 by Francesco Cafagna |
16 |
*CMZ : 2.02/00 10/10/2000 14.09.00 by Francesco Cafagna |
17 |
*CMZ : 2.01/00 05/04/2000 14.35.18 by Marialuigia Ambriola |
18 |
*CMZ : 2.00/00 29/02/2000 17.39.10 by Francesco Cafagna |
19 |
*CMZ : 1.02/00 10/02/2000 17.28.08 by Francesco Cafagna |
20 |
*CMZ : 1.01/00 21/05/96 17.33.38 by Francesco Cafagna |
21 |
*CMZ : 1.00/02 05/04/96 11.26.03 by Francesco Cafagna |
22 |
*-- Author : Francesco Cafagna 23/02/96 |
23 |
SUBROUTINE GPDCAL |
24 |
************************************************************************ |
25 |
* * |
26 |
* To perform CAL digitization * |
27 |
* * |
28 |
* Called by: GUDIGI * |
29 |
* Author: Francesco Cafagna, 23/02/96 12.50.38 * |
30 |
* * |
31 |
************************************************************************ |
32 |
#include "gcunit.inc" |
33 |
#include "gpphit.inc" |
34 |
PARAMETER (NH=NHCAL,NHM=NHMCAL,NVOL=3,NVOL1=2) |
35 |
#include "gprhit.inc" |
36 |
#include "gpcal.inc" |
37 |
#include "gpsed.inc" |
38 |
#include "gpkey.inc" |
39 |
#include "gpgeo.inc" |
40 |
*ml:21/02/02 |
41 |
#include "gpencal.inc" |
42 |
*end ml. |
43 |
* |
44 |
INTEGER IS,ID,NV,NVM,NNHM |
45 |
CHARACTER*4 CSET |
46 |
INTEGER NUMD1(NVOL1),NUMBV1(NVOL1,NHM) |
47 |
* |
48 |
* Vector zeroed |
49 |
* |
50 |
CALL VZERO(ICAPL ,NHMCAL) |
51 |
CALL VZERO(ICASI ,NHMCAL) |
52 |
CALL VZERO(ICAST ,NHMCAL) |
53 |
CALL VZERO(XCASI,NHMCAL) |
54 |
CALL VZERO(YCASI,NHMCAL) |
55 |
CALL VZERO(ZCASI,NHMCAL) |
56 |
CALL VZERO(IPARCAL,NHMCAL) |
57 |
CALL VZERO(ERCASI,NHMCAL) |
58 |
CALL VZERO(NUMD ,NVOL) |
59 |
CALL VZERO(NUMD1 ,NVOL1) |
60 |
c ml:16/4/2003 |
61 |
CALL VZERO(ICASTRIP,NHMCAL) |
62 |
CALL VZERO(ICAPLANE,NHMCAL) |
63 |
CALL VZERO(ICAMOD,NHMCAL) |
64 |
CALL VZERO(ENESTRIP,NHMCAL) |
65 |
c end 16/4/2003 |
66 |
* |
67 |
NV = NVOL |
68 |
NVM= NVMAX |
69 |
* |
70 |
* The tungsten plane case |
71 |
* |
72 |
IS = ISCAL |
73 |
ID = IDCAST |
74 |
IT = -1 |
75 |
CSET = 'CAL ' |
76 |
* |
77 |
* Check on the volume level |
78 |
* |
79 |
IF (NV.GT.NVM) THEN |
80 |
WRITE(CHMAIL,10000) CSET,CNSED(IS,ID),NVOL,NVMAX, |
81 |
+ IDRUN,IDEVT |
82 |
CALL GMAIL(1,0) |
83 |
GO TO 10 |
84 |
ENDIF |
85 |
CALL VZERO(VHITS,NH*NHM) |
86 |
CALL VZERO(ITRA ,NHM) |
87 |
NHITS = -1 |
88 |
* |
89 |
* Update the max number of hits to be retrived |
90 |
* |
91 |
NNHM = NHM |
92 |
IF(NNHM.LE.0) THEN |
93 |
WRITE(CHMAIL,10100) CSET,CNSED(IS,ID),NTHCAL,NHM, |
94 |
+ IDRUN,IDEVT |
95 |
CALL GMAIL(1,0) |
96 |
GO TO 10 |
97 |
ENDIF |
98 |
CALL VZERO(NUMBV,NVOL*NHM) |
99 |
CALL GPRHIT(CSET,CNSED(IS,ID),IS,ID,NVOL,NH,NNHM,1, |
100 |
+ IT,NUMD,ITRA,NUMBV,VHITS,NHITS) |
101 |
* |
102 |
* If there was a problem in GPRHIT then exit |
103 |
* |
104 |
IF(NHITS.LT.0) THEN |
105 |
WRITE(CHMAIL,10200) CSET,CNSED(IS,ID),NHITS,NHM, |
106 |
+ IDRUN,IDEVT |
107 |
CALL GMAIL(1,0) |
108 |
GO TO 10 |
109 |
ENDIF |
110 |
* |
111 |
* >>>>>>>>>>>>>>>>>>>>>> DIGI action |
112 |
* |
113 |
* |
114 |
* Fill the CWN common |
115 |
* |
116 |
NTHCAL=0 |
117 |
DO I=1,NHITS |
118 |
NTHCAL = NTHCAL + 1 |
119 |
ICAPL(NTHCAL) = NUMBV((NVCAL-2),I) |
120 |
ICASI(NTHCAL) = NUMBV((NVCAL-1),I) |
121 |
ICAST(NTHCAL) = NUMBV((NVCAL),I) |
122 |
XINCAL(NTHCAL) = VHITS(1,I) |
123 |
YINCAL(NTHCAL) = VHITS(2,I) |
124 |
ZINCAL(NTHCAL) = VHITS(3,I) |
125 |
ERELCAL(NTHCAL) = VHITS(4,I) |
126 |
c IPARCAL(NTHCAL) = VHITS(5,I) |
127 |
c P0CAL(NTHCAL) = VHITS(6,I) |
128 |
ENDDO |
129 |
C |
130 |
C The energy released per strip |
131 |
C |
132 |
NV = NVOL1 |
133 |
NVM= NVMAX |
134 |
* |
135 |
* The tungsten plane case |
136 |
* |
137 |
IS = ISCAL |
138 |
ID = IDCASI |
139 |
IT = -1 |
140 |
CSET = 'CAL ' |
141 |
* |
142 |
* Check on the volume level |
143 |
* |
144 |
IF (NV.GT.NVM) THEN |
145 |
WRITE(CHMAIL,10000) CSET,CNSED(IS,ID),NVOL,NVMAX, |
146 |
+ IDRUN,IDEVT |
147 |
CALL GMAIL(1,0) |
148 |
GO TO 10 |
149 |
ENDIF |
150 |
CALL VZERO(VHITS,NH*NHM) |
151 |
CALL VZERO(ITRA ,NHM) |
152 |
NHITS = -1 |
153 |
* |
154 |
* Update the max number of hits to be retrived |
155 |
* |
156 |
NNHM = NHM |
157 |
IF(NNHM.LE.0) THEN |
158 |
WRITE(CHMAIL,10100) CSET,CNSED(IS,ID),NTHCALI,NHM, |
159 |
+ IDRUN,IDEVT |
160 |
CALL GMAIL(1,0) |
161 |
GO TO 10 |
162 |
ENDIF |
163 |
CALL VZERO(NUMBV,NVOL*NHM) |
164 |
CALL GPRHIT(CSET,CNSED(IS,ID),IS,ID,NVOL,NH,NNHM,1, |
165 |
+ IT,NUMD,ITRA,NUMBV,VHITS,NHITS) |
166 |
* |
167 |
* If there was a problem in GPRHIT then exit |
168 |
* |
169 |
IF(NHITS.LT.0) THEN |
170 |
WRITE(CHMAIL,10200) CSET,CNSED(IS,ID),NHITS,NHM, |
171 |
+ IDRUN,IDEVT |
172 |
CALL GMAIL(1,0) |
173 |
GO TO 10 |
174 |
ENDIF |
175 |
* |
176 |
* >>>>>>>>>>>>>>>>>>>>>> DIGI action |
177 |
* |
178 |
* |
179 |
* Fill the CWN common |
180 |
* |
181 |
c |
182 |
NTHCALI=0 |
183 |
DO I=1,NHITS |
184 |
NTHCALI=NTHCALI+1 |
185 |
ICASTRIP(NTHCALI)=NUMBV(NVCALI,I) |
186 |
ICAPLANE(NTHCALI)=NUMBV((NVCALI-1),I) |
187 |
ICAMOD(NTHCALI)=VHITS(1,I) |
188 |
ENESTRIP(NTHCALI)=VHITS(2,I) |
189 |
ENDDO |
190 |
c |
191 |
10000 FORMAT(' GPDCAL: VOLUME level too big: SET=',A4,', DET=',A4,', |
192 |
+ NVOL=',I3,', NVMAX=',I3,', RUN=',I5,', EVT=',I8) |
193 |
10100 FORMAT(' GPDCAL: MAX number of hits retrived: SET=',A4, |
194 |
+ ', DET=',A4,',NHREAD=',I5,', NHMAX=',I5, |
195 |
+ ', RUN=',I5,', EVT=',I8) |
196 |
10200 FORMAT(' GPDCAL: Error in GPRHIT: SET=',A4, |
197 |
+ ', DET=',A4,',NHITS=',I5,', NHMAX=',I5, |
198 |
+ ', RUN=',I5,', EVT=',I8) |
199 |
10 RETURN |
200 |
END |