1 |
* |
2 |
* $Id: gpuspe.F,v 3.1.1.1 2002/07/11 16:02:14 cafagna Exp $ |
3 |
* |
4 |
* $Log: gpuspe.F,v $ |
5 |
* Revision 3.1.1.1 2002/07/11 16:02:14 cafagna |
6 |
* First GPAMELA release on CVS |
7 |
* |
8 |
* |
9 |
*CMZ : 2.01/00 06/03/2000 13.07.03 by Francesco Cafagna |
10 |
*CMZ : 2.00/00 03/03/2000 15.39.06 by Francesco Cafagna |
11 |
*CMZ : 1.02/00 22/10/99 15.34.29 by Francesco Cafagna |
12 |
*CMZ : 1.01/00 23/05/96 15.01.53 by Francesco Cafagna |
13 |
*CMZ : 1.00/02 04/04/96 16.47.16 by Francesco Cafagna |
14 |
*-- Author : Francesco Cafagna 21/02/96 |
15 |
SUBROUTINE GPUSPE(IACT,IS,ID,IPA,IT,DELOSS,PATH, |
16 |
+ TRAPAR,NUMVOL,IMEC) |
17 |
************************************************************************ |
18 |
* * |
19 |
* To collect and store the hit structure for SPE * |
20 |
* * |
21 |
* Variables definition: * |
22 |
* IN: * |
23 |
* IACT, integer specifing the action to be taken. It is the INWVOL * |
24 |
* variable in GCTRAK common * |
25 |
* IS , set number * |
26 |
* ID , detector number * |
27 |
* IPA , particle number * |
28 |
* IT , track number * |
29 |
* DELOSS, energy loss in the step * |
30 |
* PATH , current track lenght * |
31 |
* TRAPAR, track parameter, is the VECT vector in GCTRAK common * |
32 |
* NUMVOL, integr array of numbers identifying the DETECTOR * |
33 |
* IMEC , integer indicating the LOSS mecanism position inside NMEC * |
34 |
* vector, zero if not present * |
35 |
* * |
36 |
* * |
37 |
* Called by: GUSTEP * |
38 |
* Author: Francesco Cafagna, 21/02/96 16.13.51 * |
39 |
* * |
40 |
************************************************************************ |
41 |
#include "gphit.inc" |
42 |
#include "gcunit.inc" |
43 |
* |
44 |
INTEGER IACT,IS,ID,IPA,IT,NUMVOL(20),NVOLSPE(3),IMEC,IDHIT |
45 |
REAL DELOSS,PATH,TRAPAR(7),VHIT(NHSPE) |
46 |
REAL DELTA2,SIGMA2,SIGMA,GRNDM0,GPGAUS |
47 |
LOGICAL SAVE |
48 |
* |
49 |
* Track is inside a volume |
50 |
* |
51 |
IF(IACT.EQ.0) THEN |
52 |
IF(IMEC.GT.0) THEN |
53 |
SAVE = .TRUE. |
54 |
VHIT(7) = DELOSS + VHIT(7) |
55 |
ENDIF |
56 |
ENDIF |
57 |
* |
58 |
* Entering a new volume or is a new track |
59 |
* |
60 |
IF(IACT.EQ.1) THEN |
61 |
SAVE = .FALSE. |
62 |
CALL VZERO(VHIT,NHSPE) |
63 |
DO I=1,3 |
64 |
VHIT(I) = TRAPAR(I) |
65 |
ENDDO |
66 |
IF(IMEC.GT.0) THEN |
67 |
SAVE = .TRUE. |
68 |
VHIT(7) = DELOSS |
69 |
ENDIF |
70 |
VHIT(8) = PATH |
71 |
VHIT(9) = IPA |
72 |
VHIT(10)= TRAPAR(7) |
73 |
IDHIT = -1 |
74 |
NVOLSPE(1) = NUMVOL(1) |
75 |
IF(NUMVOL(1).EQ.0) NVOLSPE(1)=6 |
76 |
NVOLSPE(2) = NUMVOL(2) |
77 |
NVOLSPE(3) = NUMVOL(3) |
78 |
ENDIF |
79 |
* |
80 |
* Track is exiting current volume |
81 |
* |
82 |
IF(IACT.EQ.2) THEN |
83 |
DO I=1,3 |
84 |
VHIT(I+3) = TRAPAR(I) |
85 |
#if defined(GPAMELA_INTER) |
86 |
* interactive case, we need the average position |
87 |
VHIT(I) = (VHIT(I) + VHIT(I+3) )/2. |
88 |
#endif |
89 |
ENDDO |
90 |
IF(IMEC.GT.0) THEN |
91 |
SAVE = .TRUE. |
92 |
VHIT(7) = DELOSS + VHIT(7) |
93 |
ENDIF |
94 |
VHIT(8) = PATH - VHIT(8) |
95 |
#if defined(GPAMELA_NOGFLUCT) |
96 |
* |
97 |
* change in de/dx with gaussian convolution |
98 |
* see Hall paper: NIM 220 (1984) 356. |
99 |
* |
100 |
* FIRST: Look if the STOP mechanism is present |
101 |
* |
102 |
IF(IMEC.EQ.1) THEN |
103 |
* This particle has NOT been stopped. So gaussian energy spread... |
104 |
* Delta is in GeV^2/cm |
105 |
DELTA2=.5E-8 |
106 |
SIGMA2=DELTA2*VHIT(8) |
107 |
SIGMA=SQRT(SIGMA2) |
108 |
GRNDM0 = GPGAUS(0.) |
109 |
VHIT(7)=VHIT(7)+GRNDM0*SIGMA |
110 |
IF(VHIT(7).LT.0.) VHIT(7)=0. |
111 |
ENDIF |
112 |
#endif |
113 |
* |
114 |
* Store the hit |
115 |
* |
116 |
IF(IDHIT.EQ.-1) THEN |
117 |
c$$$ IF(SAVE) CALL GSAHIT (IS,ID,IT,NUMVOL,VHIT,IDHIT) |
118 |
IF(SAVE) CALL GSAHIT (IS,ID,IT,NVOLSPE,VHIT,IDHIT) |
119 |
IF (IDHIT.EQ.0) THEN |
120 |
WRITE(CHMAIL,10000) IS,ID,IT |
121 |
CALL GMAIL(1,0) |
122 |
ENDIF |
123 |
ELSE |
124 |
WRITE(CHMAIL,10100) IS,ID,IT |
125 |
CALL GMAIL(1,0) |
126 |
ENDIF |
127 |
ENDIF |
128 |
* |
129 |
* Track is exiting the set up |
130 |
* |
131 |
IF(IACT.EQ.3) THEN |
132 |
* |
133 |
* Check if the hit have been previously stored or not |
134 |
* |
135 |
IF(IDHIT.LT.0) THEN |
136 |
DO I=1,3 |
137 |
VHIT(I+3) = TRAPAR(I) |
138 |
#if defined(GPAMELA_INTER) |
139 |
* interactive case, we need the average position |
140 |
VHIT(I) = (VHIT(I) + VHIT(I+3) )/2. |
141 |
#endif |
142 |
ENDDO |
143 |
IF(IMEC.GT.0) THEN |
144 |
SAVE = .TRUE. |
145 |
VHIT(7) = DELOSS + VHIT(7) |
146 |
ENDIF |
147 |
VHIT(8) = PATH - VHIT(8) |
148 |
#if defined(GPAMELA_NOGFLUCT) |
149 |
* |
150 |
* change in de/dx with gaussian convolution |
151 |
* see Hall paper: NIM 220 (1984) 356. |
152 |
* |
153 |
* FIRST: Look if the STOP mechanism is present |
154 |
* |
155 |
IF(IMEC.EQ.1) THEN |
156 |
* This particle has NOT been stopped. So gaussian energy spread... |
157 |
* Delta is in GeV^2/cm |
158 |
DELTA2=.5E-8 |
159 |
SIGMA2=DELTA2*VHIT(8) |
160 |
SIGMA=SQRT(SIGMA2) |
161 |
GRNDM0 = GPGAUS(0.) |
162 |
VHIT(7)=VHIT(7)+GRNDM0*SIGMA |
163 |
IF(VHIT(7).LT.0.) VHIT(7)=0. |
164 |
ENDIF |
165 |
#endif |
166 |
* |
167 |
* Store the hit |
168 |
* |
169 |
IF(IDHIT.EQ.-1) THEN |
170 |
c$$$ IF(SAVE) CALL GSAHIT (IS,ID,IT,NUMVOL,VHIT,IDHIT) |
171 |
IF(SAVE) CALL GSAHIT (IS,ID,IT,NVOLSPE,VHIT,IDHIT) |
172 |
IF (IDHIT.EQ.0) THEN |
173 |
WRITE(CHMAIL,10200) IS,ID,IT |
174 |
CALL GMAIL(1,0) |
175 |
ENDIF |
176 |
ELSE |
177 |
WRITE(CHMAIL,10300) IS,ID,IT |
178 |
CALL GMAIL(1,0) |
179 |
ENDIF |
180 |
ENDIF |
181 |
ENDIF |
182 |
10000 FORMAT(' GPUSPE error: HIT have not be stored for SET=' |
183 |
+ ,I4,', DET=',I4,', TRACK=',I6) |
184 |
10100 FORMAT(' GPUSPE error: HIT have not be initialized for SET=' |
185 |
+ ,I4,', DET=',I4,', TRACK=',I6) |
186 |
10200 FORMAT(' GPUSPE error: HIT have not be stored for SET=' |
187 |
+ ,I4,', DET=',I4,', TRACK=',I6) |
188 |
10300 FORMAT(' GPUSPE error: HIT have not be initialized for SET=' |
189 |
+ ,I4,', DET=',I4,', TRACK=',I6) |
190 |
RETURN |
191 |
END |