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