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