1 |
* |
2 |
* $Id: gpucal.F,v 3.3 2005/06/21 02:42:04 cafagna Exp $ |
3 |
* |
4 |
* $Log: gpucal.F,v $ |
5 |
* Revision 3.3 2005/06/21 02:42:04 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 10.57.01 by Francesco Cafagna |
16 |
*CMZ : 2.01/00 05/04/2000 14.35.18 by Marialuigia Ambriola |
17 |
*CMZ : 2.00/00 29/02/2000 10.23.24 by Francesco Cafagna |
18 |
*CMZ : 1.02/00 08/02/2000 21.29.53 by Francesco Cafagna |
19 |
*CMZ : 1.00/02 04/04/96 16.47.16 by Francesco Cafagna |
20 |
*-- Author : Francesco Cafagna 21/02/96 |
21 |
SUBROUTINE GPUCAL(IACT,IS,ID,IPA,IT,DELOSS,PATH, |
22 |
+ TRAPAR,NUMVOL,IMEC) |
23 |
************************************************************************ |
24 |
* * |
25 |
* To collect and store the hit structure for CAL * |
26 |
* * |
27 |
* Variables definition: * |
28 |
* IN: * |
29 |
* IACT, integer specifing the action to be taken. It is the INWVOL * |
30 |
* variable in GCTRAK common * |
31 |
* IS , set number * |
32 |
* ID , detector number * |
33 |
* IPA , particle number * |
34 |
* IT , track number * |
35 |
* DELOSS, energy loss in the step * |
36 |
* PATH , current track lenght * |
37 |
* TRAPAR, track parameter, is the VECT vector in GCTRAK common * |
38 |
* NUMVOL, integer array of numbers identifying the DETECTOR * |
39 |
* IMEC , integer indicating the LOSS mecanism position inside NMEC * |
40 |
* vector, zero if not present * |
41 |
* * |
42 |
* * |
43 |
* NOTE: The IT variable is overwritten and the GSCHIT is used * |
44 |
* to account for the multi-tracks produced in an e.m. shower * |
45 |
* * |
46 |
* Called by: GUSTEP * |
47 |
* Author: Francesco Cafagna, 21/02/96 16.13.51 * |
48 |
* * |
49 |
************************************************************************ |
50 |
#include "gphit.inc" |
51 |
#include "gcunit.inc" |
52 |
*ml: (19/02/03) |
53 |
#include "gckine.inc" |
54 |
#include "gcflag.inc" |
55 |
#include "gpencal.inc" |
56 |
*end ml |
57 |
*EM: |
58 |
PARAMETER (CALIB=0.0001085200) |
59 |
*END EM. |
60 |
INTEGER IACT,IS,ID,IPA,IT,NUMVOL(20),IMEC,IDHIT |
61 |
REAL DELOSS,PATH,TRAPAR(7),VHIT(NHCAL),XYZM(3),XYZD(3) |
62 |
* REAL DELOSS,PATH,TRAPAR(7),XYZM(3),XYZD(3) |
63 |
REAL DELTA2,SIGMA2,SIGMA,GRNDM0,GPGAUS,PATHINI |
64 |
LOGICAL SAVE |
65 |
* |
66 |
*ml (19/02/02): |
67 |
INTEGER IPL,IMOD,IST |
68 |
DATA IEVOLD/-1/ |
69 |
* |
70 |
* It's a new event |
71 |
* |
72 |
C # IF(IEVOLD.NE.IEVENT) THEN |
73 |
C # c print*,'IS,ID,NUMVOL=',IS,ID,NUMVOL |
74 |
C # c print*,'GPUCAL:last event=',ievold |
75 |
C # IEVOLD=IEVENT |
76 |
C # CALL VZERO(ENEMAT,44*9*32) |
77 |
C # ENDIF |
78 |
|
79 |
C # Please note that ENEMAT is zeroed just on the very first event here. |
80 |
C # Then is cleared into GUTREV on an event by event basis. |
81 |
IF(IEVOLD.EQ.-1) THEN |
82 |
IEVOLD=IEVENT |
83 |
CALL VZERO(ENEMAT,44*9*32) |
84 |
ENDIF |
85 |
|
86 |
*end ml. |
87 |
* |
88 |
* Track is inside a volume |
89 |
* |
90 |
IF(IACT.EQ.0) THEN |
91 |
IF(IMEC.GT.0) THEN |
92 |
SAVE = .TRUE. |
93 |
*EM: |
94 |
cccc VHIT(4) = (DELOSS/CALIB) + VHIT(4) |
95 |
* END EM |
96 |
C ML |
97 |
VHIT(4) = DELOSS + VHIT(4) |
98 |
ENEMAT(NUMVOL(1),NUMVOL(2),NUMVOL(3))= |
99 |
+ ENEMAT(NUMVOL(1),NUMVOL(2),NUMVOL(3))+DELOSS |
100 |
*END ML |
101 |
ENDIF |
102 |
ENDIF |
103 |
* |
104 |
* Entering a new volume or is a new track |
105 |
* |
106 |
IF(IACT.EQ.1) THEN |
107 |
SAVE = .FALSE. |
108 |
CALL VZERO(VHIT,NHCAL) |
109 |
DO I=1,3 |
110 |
VHIT(I) = TRAPAR(I) |
111 |
ENDDO |
112 |
IF(IMEC.GT.0) THEN |
113 |
SAVE = .TRUE. |
114 |
*EM: |
115 |
c VHIT(4) = DELOSS/CALIB |
116 |
*END EM. |
117 |
VHIT(4) = DELOSS |
118 |
C ML: |
119 |
ENEMAT(NUMVOL(1),NUMVOL(2),NUMVOL(3))= |
120 |
+ ENEMAT(NUMVOL(1),NUMVOL(2),NUMVOL(3))+DELOSS |
121 |
*END ML |
122 |
ENDIF |
123 |
IDHIT = -1 |
124 |
* Store the particle and momentum if is the first track |
125 |
c IF(IT.EQ.1) THEN |
126 |
c VHIT(5) = IPA |
127 |
c VHIT(6) = TRAPAR(7) |
128 |
c ENDIF |
129 |
PATHINI = PATH |
130 |
ENDIF |
131 |
* |
132 |
* Track is exiting current volume |
133 |
* |
134 |
IF(IACT.EQ.2) THEN |
135 |
IF(IMEC.GT.0) THEN |
136 |
SAVE = .TRUE. |
137 |
*EM: |
138 |
c VHIT(4) = (DELOSS/CALIB) + VHIT(4) |
139 |
*END EM |
140 |
VHIT(4) = DELOSS + VHIT(4) |
141 |
*ML: |
142 |
ENEMAT(NUMVOL(1),NUMVOL(2),NUMVOL(3))= |
143 |
+ ENEMAT(NUMVOL(1),NUMVOL(2),NUMVOL(3))+DELOSS |
144 |
*END EM |
145 |
ENDIF |
146 |
#if defined(GPAMELA_NOGFLUCT) |
147 |
* |
148 |
* change in de/dx with gaussian convolution |
149 |
* see Hall paper: NIM 220 (1984) 356. |
150 |
* |
151 |
* FIRST: Look if the STOP mechanism is present |
152 |
* |
153 |
IF(IMEC.EQ.1) THEN |
154 |
* This particle has NOT been stopped. So gaussian energy spread... |
155 |
* Delta is in GeV^2/cm |
156 |
DELTA2=.5E-8 |
157 |
SIGMA2=DELTA2*(PATH - PATHINI) |
158 |
SIGMA=SQRT(SIGMA2) |
159 |
GRNDM0 = GPGAUS(0.) |
160 |
*EM: |
161 |
c VHIT(4)=VHIT(4)+GRNDM0*SIGMA/CALIB |
162 |
CML17/04/03 VHIT(4)=VHIT(4)+GRNDM0*SIGMA |
163 |
*END EM |
164 |
CML17/04/03 IF(VHIT(4).LT.0.) VHIT(4)=0. |
165 |
ENDIF |
166 |
#endif |
167 |
* |
168 |
* Store the hit |
169 |
* |
170 |
IF(IDHIT.EQ.-1) THEN |
171 |
*ML: |
172 |
* IF(SAVE) CALL GSCHIT (IS,ID,1,NUMVOL,VHIT,4,IDHIT) |
173 |
IF(SAVE) THEN |
174 |
CALL GSCHIT (IS,ID,1,NUMVOL,VHIT,1,IDHIT) |
175 |
c CALL GSAHIT (IS,ID,IT,NUMVOL,VHIT,IDHIT) |
176 |
ENDIF |
177 |
*END ML. |
178 |
IF (IDHIT.EQ.0) THEN |
179 |
WRITE(CHMAIL,10000) IS,ID,IT |
180 |
CALL GMAIL(1,0) |
181 |
ENDIF |
182 |
ELSE |
183 |
WRITE(CHMAIL,10100) IS,ID,IT |
184 |
CALL GMAIL(1,0) |
185 |
ENDIF |
186 |
ENDIF |
187 |
* |
188 |
* Track is exiting the set up |
189 |
* |
190 |
IF(IACT.EQ.3) THEN |
191 |
* |
192 |
* Check if the hit have been previously stored or not |
193 |
* |
194 |
IF(IDHIT.LT.0) THEN |
195 |
IF(IMEC.GT.0) THEN |
196 |
SAVE = .TRUE. |
197 |
*EM: |
198 |
c VHIT(4) = (DELOSS/CALIB) + VHIT(4) |
199 |
* END EM. |
200 |
VHIT(4) = DELOSS + VHIT(4) |
201 |
*ML: |
202 |
ENEMAT(NUMVOL(1),NUMVOL(2),NUMVOL(3))= |
203 |
+ ENEMAT(NUMVOL(1),NUMVOL(2),NUMVOL(3))+DELOSS |
204 |
*END ML. |
205 |
ENDIF |
206 |
#if defined(GPAMELA_NOGFLUCT) |
207 |
* |
208 |
* change in de/dx with gaussian convolution |
209 |
* see Hall paper: NIM 220 (1984) 356. |
210 |
* |
211 |
* FIRST: Look if the STOP mechanism is present |
212 |
* |
213 |
IF(IMEC.EQ.1) THEN |
214 |
* This particle has NOT been stopped. So gaussian energy spread... |
215 |
* Delta is in GeV^2/cm |
216 |
DELTA2=.5E-8 |
217 |
SIGMA2=DELTA2*(PATH - PATHINI) |
218 |
SIGMA=SQRT(SIGMA2) |
219 |
GRNDM0 = GPGAUS(0.) |
220 |
*EM: |
221 |
c VHIT(4)=VHIT(4)+GRNDM0*SIGMA/CALIB |
222 |
CML17/04/03 VHIT(4)=VHIT(4)+GRNDM0*SIGMA |
223 |
*END EM. |
224 |
CML17/04/03 IF(VHIT(4).LT.0.) VHIT(4)=0. |
225 |
ENDIF |
226 |
#endif |
227 |
* |
228 |
* Store the hit |
229 |
* |
230 |
IF(IDHIT.EQ.-1) THEN |
231 |
*ML |
232 |
C IF (SAVE) CALL GSCHIT (IS,ID,1,NUMVOL,VHIT,4,IDHIT) |
233 |
IF (SAVE) THEN |
234 |
CALL GSCHIT (IS,ID,1,NUMVOL,VHIT,1,IDHIT) |
235 |
ENDIF |
236 |
CL IF (SAVE) CALL GSCHIT (IS,ID,1,NUMVOL,VHIT,1,IDHIT) |
237 |
*END ML. |
238 |
IF (IDHIT.EQ.0) THEN |
239 |
WRITE(CHMAIL,10200) IS,ID,IT |
240 |
CALL GMAIL(1,0) |
241 |
ENDIF |
242 |
ELSE |
243 |
WRITE(CHMAIL,10300) IS,ID,IT |
244 |
CALL GMAIL(1,0) |
245 |
ENDIF |
246 |
ENDIF |
247 |
ENDIF |
248 |
10000 FORMAT(' GPUCAL error: HIT have not be stored for SET=' |
249 |
+ ,I4,', DET=',I4,', TRACK=',I6) |
250 |
10100 FORMAT(' GPUCAL error: HIT have not be initialized for SET=' |
251 |
+ ,I4,', DET=',I4,', TRACK=',I6) |
252 |
10200 FORMAT(' GPUCAL error: HIT have not be stored for SET=' |
253 |
+ ,I4,', DET=',I4,', TRACK=',I6) |
254 |
10300 FORMAT(' GPUCAL error: HIT have not be initialized for SET=' |
255 |
+ ,I4,', DET=',I4,', TRACK=',I6) |
256 |
RETURN |
257 |
END |