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