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