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