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