1 |
SUBROUTINE GPUCARD(IACT,IS,ID,IPA,IT,DELOSS,TIME,PATH, |
2 |
+ TRAPAR,NUMVOL,IMEC) |
3 |
************************************************************************ |
4 |
* * |
5 |
* To collect and store the hit structure for CARD * |
6 |
* * |
7 |
* Variables definition: * |
8 |
* IN: * |
9 |
* IACT, integer specifing the action to be taken. It is the INWVOL * |
10 |
* variable in GCTRAK common * |
11 |
* IS , set number * |
12 |
* ID , detector number * |
13 |
* IPA , particle number * |
14 |
* IT , track number * |
15 |
* DELOSS, energy loss in the step * |
16 |
* TIME , current time of flight * |
17 |
* PATH , current track lenght * |
18 |
* TRAPAR, track parameter, is the VECT vector in GCTRAK common * |
19 |
* NUMVOL, integr array of numbers identifying the DETECTOR * |
20 |
* IMEC , integer indicating the LOSS mecanism position inside NMEC * |
21 |
* vector, zero if not present * |
22 |
* * |
23 |
* * |
24 |
* Called by: GUSTEP * |
25 |
* Author: Francesco Cafagna, 21/02/96 16.13.51 * |
26 |
* * |
27 |
************************************************************************ |
28 |
#include "gphit.inc" |
29 |
#include "gcunit.inc" |
30 |
* |
31 |
INTEGER IACT,IS,ID,IPA,IT,NUMVOL(20),IMEC,IDHIT |
32 |
REAL DELOSS,TIME,PATH,TRAPAR(7),VHIT(NHCARD) |
33 |
LOGICAL SAVE |
34 |
* |
35 |
* Track is inside a volume |
36 |
* |
37 |
IF(IACT.EQ.0) THEN |
38 |
IF(IMEC.GT.0) THEN |
39 |
SAVE = .TRUE. |
40 |
VHIT(7) = DELOSS + VHIT(7) |
41 |
ENDIF |
42 |
ENDIF |
43 |
* |
44 |
* Entering a new volume or is a new track |
45 |
* |
46 |
IF(IACT.EQ.1) THEN |
47 |
SAVE = .FALSE. |
48 |
CALL VZERO(VHIT,NHCARD) |
49 |
DO I=1,3 |
50 |
VHIT(I) = TRAPAR(I) |
51 |
ENDDO |
52 |
IF(IMEC.GT.0) THEN |
53 |
SAVE = .TRUE. |
54 |
VHIT(7) = DELOSS |
55 |
ENDIF |
56 |
VHIT(8) = TIME |
57 |
VHIT(9) = PATH |
58 |
VHIT(10)= IPA |
59 |
VHIT(11)= TRAPAR(7) |
60 |
IDHIT = -1 |
61 |
ENDIF |
62 |
* |
63 |
* Track is exiting current volume |
64 |
* |
65 |
IF(IACT.EQ.2) THEN |
66 |
DO I=1,3 |
67 |
VHIT(I+3) = TRAPAR(I) |
68 |
#if defined(GPAMELA_INTER) |
69 |
* interactive case, we need the average position |
70 |
VHIT(I) = (VHIT(I) + VHIT(I+3) )/2. |
71 |
#endif |
72 |
ENDDO |
73 |
IF(IMEC.GT.0) THEN |
74 |
SAVE = .TRUE. |
75 |
VHIT(7) = DELOSS + VHIT(7) |
76 |
ENDIF |
77 |
VHIT(8) = (TIME + VHIT(8))/2. |
78 |
VHIT(9) = PATH - VHIT(9) |
79 |
VHIT(11)= (TRAPAR(7) + VHIT(11))/2. |
80 |
* |
81 |
* Store the hit |
82 |
* |
83 |
IF(IDHIT.EQ.-1) THEN |
84 |
IF(SAVE) CALL GSAHIT (IS,ID,IT,NUMVOL,VHIT,IDHIT) |
85 |
IF (IDHIT.EQ.0) THEN |
86 |
WRITE(CHMAIL,10000) IS,ID,IT |
87 |
CALL GMAIL(1,0) |
88 |
ENDIF |
89 |
ELSE |
90 |
WRITE(CHMAIL,10100) IS,ID,IT |
91 |
CALL GMAIL(1,0) |
92 |
ENDIF |
93 |
ENDIF |
94 |
* |
95 |
* Track is exiting the set up |
96 |
* |
97 |
IF(IACT.EQ.3) THEN |
98 |
* |
99 |
* Check if the hit have been previously stored or not |
100 |
* |
101 |
IF(IDHIT.LT.0) THEN |
102 |
DO I=1,3 |
103 |
VHIT(I+3) = TRAPAR(I) |
104 |
#if defined(GPAMELA_INTER) |
105 |
* interactive case, we need the average position |
106 |
VHIT(I) = (VHIT(I) + VHIT(I+3) )/2. |
107 |
#endif |
108 |
ENDDO |
109 |
IF(IMEC.GT.0) THEN |
110 |
SAVE = .TRUE. |
111 |
VHIT(7) = DELOSS + VHIT(7) |
112 |
ENDIF |
113 |
VHIT(8) = (TIME + VHIT(8))/2. |
114 |
VHIT(9) = PATH - VHIT(9) |
115 |
VHIT(11)= (TRAPAR(7) + VHIT(11))/2. |
116 |
* |
117 |
* Store the hit |
118 |
* |
119 |
IF(IDHIT.EQ.-1) THEN |
120 |
IF(SAVE) CALL GSAHIT (IS,ID,IT,NUMVOL,VHIT,IDHIT) |
121 |
IF (IDHIT.EQ.0) THEN |
122 |
WRITE(CHMAIL,10200) IS,ID,IT |
123 |
CALL GMAIL(1,0) |
124 |
ENDIF |
125 |
ELSE |
126 |
WRITE(CHMAIL,10300) IS,ID,IT |
127 |
CALL GMAIL(1,0) |
128 |
ENDIF |
129 |
ENDIF |
130 |
ENDIF |
131 |
10000 FORMAT(' GPUCARD error: HIT have not be stored for SET=' |
132 |
+ ,I4,', DET=',I4,', TRACK=',I6) |
133 |
10100 FORMAT(' GPUCARD error: HIT have not be initialized for SET=' |
134 |
+ ,I4,', DET=',I4,', TRACK=',I6) |
135 |
10200 FORMAT(' GPUCARD error: HIT have not be stored for SET=' |
136 |
+ ,I4,', DET=',I4,', TRACK=',I6) |
137 |
10300 FORMAT(' GPUCARD error: HIT have not be initialized for SET=' |
138 |
+ ,I4,', DET=',I4,', TRACK=',I6) |
139 |
RETURN |
140 |
END |