1 |
cafagna |
3.1 |
* |
2 |
cafagna |
3.8 |
* $Id: gpdspe.F,v 3.7 2006/02/07 11:38:52 bottai Exp $ |
3 |
cafagna |
3.2 |
* |
4 |
|
|
* $Log: gpdspe.F,v $ |
5 |
cafagna |
3.8 |
* Revision 3.7 2006/02/07 11:38:52 bottai |
6 |
|
|
* test of mail delivery |
7 |
|
|
* |
8 |
bottai |
3.7 |
* Revision 3.6 2006/02/06 14:17:21 bottai |
9 |
|
|
* adapt again the resolution simulation to the ITRPB volume identification |
10 |
|
|
* |
11 |
bottai |
3.6 |
* Revision 3.5 2006/01/24 13:52:01 bottai |
12 |
|
|
* prepare to store the x and y multiplicity of the hit |
13 |
|
|
* |
14 |
bottai |
3.5 |
* Revision 3.4 2006/01/18 09:41:33 bottai |
15 |
|
|
* Some correction to the spe plane ID due to the new geometry tree |
16 |
|
|
* |
17 |
bottai |
3.4 |
* Revision 3.3 2005/12/05 12:15:21 pam-ba |
18 |
|
|
* new spectrometer geometry and internal magnetic field |
19 |
|
|
* |
20 |
pam-ba |
3.3 |
* Revision 3.2 2005/07/25 11:53:21 cafagna |
21 |
|
|
* Several updates. See history for details |
22 |
|
|
* |
23 |
cafagna |
3.2 |
* Revision 3.1.1.1 2002/07/11 16:02:13 cafagna |
24 |
|
|
* First GPAMELA release on CVS |
25 |
cafagna |
3.1 |
* |
26 |
|
|
* |
27 |
|
|
*CMZ : 2.01/00 05/04/2000 14.35.18 by Marialuigia Ambriola |
28 |
|
|
*CMZ : 2.00/00 03/03/2000 15.39.06 by Francesco Cafagna |
29 |
|
|
*CMZ : 1.02/00 19/01/2000 15.50.14 by Francesco Cafagna |
30 |
|
|
*CMZ : 1.01/00 16/05/96 17.38.13 by Francesco Cafagna |
31 |
|
|
*CMZ : 1.00/02 27/03/96 18.35.42 by Francesco Cafagna |
32 |
|
|
*-- Author : Francesco Cafagna 23/02/96 |
33 |
|
|
SUBROUTINE GPDSPE |
34 |
bottai |
3.7 |
************************************************************************* |
35 |
|
|
* * |
36 |
|
|
* To perform SPE digitization * |
37 |
|
|
* * |
38 |
|
|
* Called by: GUDIGI * |
39 |
|
|
* Author: Francesco Cafagna, 23/02/96 12.50.38 * |
40 |
|
|
* * |
41 |
|
|
************************************************************************* |
42 |
cafagna |
3.1 |
#include "gcunit.inc" |
43 |
|
|
#include "gpphit.inc" |
44 |
pam-ba |
3.3 |
PARAMETER (RADDEG=57.295779) |
45 |
cafagna |
3.2 |
PARAMETER (NH=NHSPE,NHM=NHMSPE,NVOL=3) |
46 |
cafagna |
3.1 |
#include "gppdigi.inc" |
47 |
|
|
c +SEQ,GPDSPE. |
48 |
|
|
#include "gprhit.inc" |
49 |
|
|
#include "gpspe.inc" |
50 |
|
|
#include "gpsed.inc" |
51 |
cafagna |
3.8 |
#include "gpkey.inc" |
52 |
cafagna |
3.1 |
* |
53 |
|
|
INTEGER IS,ID,NV,NVM,GPNHIT,NTHIT,NHFRST |
54 |
|
|
CHARACTER*4 CSET |
55 |
|
|
LOGICAL CONT,HF |
56 |
|
|
* |
57 |
|
|
* Data block for digitalization |
58 |
|
|
* |
59 |
|
|
INTEGER NTRA,IDIG,LTRA,NPLANE,LKDN,NTDIGI,JJ |
60 |
|
|
INTEGER KDIGI(4),NUMBVD(NVOL) |
61 |
|
|
REAL XI,YI,XO,YO,PATH,DE,GPGAUS |
62 |
pam-ba |
3.3 |
REAL VPOS(3),BMAGNET(3),ANGLEX,ANGLEY,XMULT,YMULT,DXPOS,DYPOS |
63 |
cafagna |
3.1 |
* |
64 |
|
|
DATA NTRA,LTRA/1,1/ |
65 |
|
|
* |
66 |
|
|
* |
67 |
|
|
* Vector zeroed |
68 |
|
|
* |
69 |
|
|
CALL VZERO(ITRPB ,NHM) |
70 |
|
|
CALL VZERO(ITRSL ,NHM) |
71 |
|
|
CALL VZERO(ITSPA ,NHM) |
72 |
|
|
CALL VZERO(XTSPA,NHM) |
73 |
|
|
CALL VZERO(YTSPA,NHM) |
74 |
|
|
CALL VZERO(ZTSPA,NHM) |
75 |
|
|
CALL VZERO(XOTSPA,NHM) |
76 |
|
|
CALL VZERO(YOTSPA,NHM) |
77 |
|
|
CALL VZERO(ZOTSPA,NHM) |
78 |
|
|
CALL VZERO(ERTSPA,NHM) |
79 |
|
|
CALL VZERO(PATSPA,NHM) |
80 |
|
|
CALL VZERO(NUMD ,NVOL) |
81 |
|
|
CALL VZERO(NDPLAN,NDMSPE) |
82 |
|
|
CALL VZERO(NDSIL ,NDMSPE) |
83 |
|
|
CALL VZERO(NDISTR,NDMSPE) |
84 |
|
|
CALL VZERO(NDIADC,NDMSPE) |
85 |
|
|
* |
86 |
|
|
CONT = .FALSE. |
87 |
|
|
HF = .TRUE. |
88 |
|
|
NTDIGI = 0 |
89 |
|
|
NDISPE = 0 |
90 |
|
|
NV = NVOL |
91 |
|
|
NVM= NVMAX |
92 |
|
|
IS = ISSPE |
93 |
|
|
ID = IDTSPA |
94 |
|
|
CSET = 'SPE ' |
95 |
|
|
IT = -1 |
96 |
|
|
* |
97 |
|
|
* Get the total number of hits stored for TSPA detector |
98 |
|
|
* |
99 |
|
|
NTHIT = GPNHIT(CSET,CNSED(IS,ID) ) |
100 |
|
|
IF (NTHIT.GT.NHM) CONT=.TRUE. |
101 |
|
|
* |
102 |
|
|
* Check on the volume level |
103 |
|
|
* |
104 |
|
|
IF (NV.GT.NVM) THEN |
105 |
|
|
WRITE(CHMAIL,10000) CSET,CNSED(IS,ID),NVOL,NVMAX, |
106 |
|
|
+ IDRUN,IDEVT |
107 |
|
|
CALL GMAIL(1,0) |
108 |
|
|
GO TO 20 |
109 |
|
|
ENDIF |
110 |
|
|
CALL VZERO(VHITS,NH*NHM) |
111 |
|
|
CALL VZERO(ITRA ,NHM) |
112 |
|
|
CALL VZERO(NUMBV,NVOL*NHM) |
113 |
|
|
NHITS = -1 |
114 |
|
|
NHFRST = 1 |
115 |
|
|
LKDN = 0 |
116 |
|
|
10 CALL GPRHIT(CSET,CNSED(IS,ID),IS,ID,NVOL,NH,NHM,NHFRST, |
117 |
|
|
+ IT,NUMD,ITRA,NUMBV,VHITS,NHITS) |
118 |
|
|
* |
119 |
|
|
* If there was a problem in GPRHIT then exit |
120 |
|
|
* |
121 |
|
|
IF(NHITS.LT.0.AND.(NHITS.NE.-(NHM+1)) ) THEN |
122 |
|
|
WRITE(CHMAIL,10100) CSET,CNSED(IS,ID),NHITS,NHM, |
123 |
|
|
+ IDRUN,IDEVT |
124 |
|
|
CALL GMAIL(1,0) |
125 |
|
|
GO TO 20 |
126 |
|
|
ENDIF |
127 |
|
|
IF( NHITS.EQ. -(NHM+1) ) NHITS = NHM |
128 |
|
|
* |
129 |
|
|
* Fill CWN entuple |
130 |
|
|
* |
131 |
|
|
NTHSPE = NHITS |
132 |
|
|
DO I=1,NHITS |
133 |
|
|
ITRPB(I) = NUMBV(1,I) |
134 |
cafagna |
3.2 |
ITRSL(I) = NUMBV(2,I) |
135 |
|
|
ITSPA(I) = NUMBV(3,I) |
136 |
cafagna |
3.1 |
#if defined(GPAMELA_INTER) |
137 |
|
|
XAVSPE(I) = VHITS(1,I) |
138 |
|
|
YAVSPE(I) = VHITS(2,I) |
139 |
|
|
ZAVSPE(I) = VHITS(3,I) |
140 |
|
|
XOUTSPE(I) = VHITS(4,I) |
141 |
|
|
YOUTSPE(I) = VHITS(5,I) |
142 |
|
|
ZOUTSPE(I) = VHITS(6,I) |
143 |
|
|
XINSPE(I) = 2*XAVSPE(I) - XOUTSPE(I) |
144 |
|
|
YINSPE(I) = 2*YAVSPE(I) - YOUTSPE(I) |
145 |
|
|
ZINSPE(I) = 2*ZAVSPE(I) - ZOUTSPE(I) |
146 |
|
|
#endif |
147 |
|
|
#if !defined(GPAMELA_INTER) |
148 |
|
|
XINSPE(I) = VHITS(1,I) |
149 |
|
|
YINSPE(I) = VHITS(2,I) |
150 |
|
|
ZINSPE(I) = VHITS(3,I) |
151 |
|
|
XOUTSPE(I) = VHITS(4,I) |
152 |
|
|
YOUTSPE(I) = VHITS(5,I) |
153 |
|
|
ZOUTSPE(I) = VHITS(6,I) |
154 |
|
|
XAVSPE(I) = (XINSPE(I)+XOUTSPE(I))/2. |
155 |
|
|
YAVSPE(I) = (YINSPE(I)+YOUTSPE(I))/2. |
156 |
|
|
ZAVSPE(I) = (ZINSPE(I)+ZOUTSPE(I))/2. |
157 |
|
|
#endif |
158 |
|
|
ERELSPE(I) = VHITS(7,I) |
159 |
|
|
PATHSPE(I) = VHITS(8,I) |
160 |
|
|
IPARSPE(I) = VHITS(9,I) |
161 |
|
|
P0SPE (I) = VHITS(10,I) |
162 |
cafagna |
3.8 |
IF(FFIELD.NE.0) THEN |
163 |
pam-ba |
3.3 |
C |
164 |
cafagna |
3.8 |
C ADD RESOLUTION SIMULATION TO XAVSPE |
165 |
pam-ba |
3.3 |
C |
166 |
cafagna |
3.8 |
ANGLEX=0. |
167 |
|
|
ANGLEY=0. |
168 |
|
|
IF(ZOUTSPE(I).NE.ZINSPE(I)) THEN |
169 |
|
|
ANGLEX=RADDEG*ATAN( ABS(XOUTSPE(I)-XINSPE(I) )/ |
170 |
pam-ba |
3.3 |
+ ABS(ZOUTSPE(I)-ZINSPE(I) ) ) |
171 |
cafagna |
3.8 |
ANGLEY=RADDEG*ATAN( ABS(YOUTSPE(I)-YINSPE(I) )/ |
172 |
pam-ba |
3.3 |
+ ABS(ZOUTSPE(I)-ZINSPE(I) ) ) |
173 |
cafagna |
3.8 |
ENDIF |
174 |
|
|
|
175 |
|
|
VPOS(1)=XAVSPE(I) |
176 |
|
|
VPOS(2)=YAVSPE(I) |
177 |
|
|
VPOS(3)=ZAVSPE(I) |
178 |
|
|
CALL GUFLD(VPOS,BMAGNET) |
179 |
|
|
|
180 |
|
|
CALL GPRSPE(ANGLEX,ANGLEY,BMAGNET,XMULT,YMULT,DXPOS,DYPOS) |
181 |
pam-ba |
3.3 |
|
182 |
cafagna |
3.8 |
NXMULT(I)=INT(XMULT) |
183 |
|
|
NYMULT(I)=INT(YMULT) |
184 |
|
|
|
185 |
|
|
XAVSPE(I) = XAVSPE(I) + DXPOS |
186 |
|
|
YAVSPE(I) = YAVSPE(I) + DYPOS |
187 |
pam-ba |
3.3 |
|
188 |
|
|
C |
189 |
bottai |
3.4 |
C ADD THE SHIFT INDUCED BY THE MAG. FIELD |
190 |
pam-ba |
3.3 |
C |
191 |
|
|
|
192 |
cafagna |
3.8 |
IF(ITRPB(I).LT.6) THEN |
193 |
|
|
XAVSPE(I) = XAVSPE(I) - 2.64e-4/4.5*BMAGNET(2) |
194 |
|
|
ELSE IF(ITRPB(I).EQ.6) THEN |
195 |
|
|
XAVSPE(I) = XAVSPE(I) + 2.64e-4/4.5*BMAGNET(2) |
196 |
|
|
ENDIF |
197 |
|
|
ENDIF |
198 |
|
|
ENDDO |
199 |
pam-ba |
3.3 |
|
200 |
cafagna |
3.1 |
* |
201 |
bottai |
3.4 |
* Loop on the hits retrived to fill the CWN common and the DIGI b |
202 |
cafagna |
3.1 |
* |
203 |
|
|
C fc IF (HF) NTHSPE = NHITS |
204 |
|
|
C fc DO I=1,NHITS |
205 |
|
|
C fc * |
206 |
|
|
C fc * Start DIGI action |
207 |
|
|
C fc * |
208 |
|
|
C fc NPLANE=NUMBV(3,I) |
209 |
|
|
C fc XI=VHITS(1,I) |
210 |
|
|
C fc YI=VHITS(2,I) |
211 |
|
|
C fc ZI=VHITS(3,I) |
212 |
|
|
C fc XO=VHITS(4,I) |
213 |
|
|
C fc YO=VHITS(5,I) |
214 |
|
|
C fc ZO=VHITS(6,I) |
215 |
|
|
C fc +SELF,IF=INTER |
216 |
|
|
C fc * interactive case: we need the track edges |
217 |
|
|
C fc XI=2.*XI-XO |
218 |
|
|
C fc YI=2.*YI-YO |
219 |
|
|
C fc ZI=2.*ZI-ZO |
220 |
|
|
C fc +SELF. |
221 |
|
|
C fc PATH=VHITS(8,I) |
222 |
|
|
C fc DE=VHITS(7,I) |
223 |
|
|
C fc IF(DE.GT.0.) THEN |
224 |
|
|
C fc DO J=1,6 |
225 |
|
|
C fc NUMBVD(J)=NUMBV(J,I) |
226 |
|
|
C fc ENDDO |
227 |
|
|
C fc c+SELF,IF=PAOLO |
228 |
|
|
C fc c CALL GPSPEHD(I,NPLANE,XI,YI,ZI,XO,YO,ZO,PATH,DE,LKDN) |
229 |
|
|
C fc c+SELF |
230 |
|
|
C fc c+SELF,IF=-PAOLO |
231 |
|
|
C fc c CALL GPSPEHD(I,NUMBVD,NVSPE,XI,YI,ZI,XO,YO,ZO,PATH,DE,LKDN) |
232 |
|
|
C fc c+SELF. |
233 |
|
|
C fc NTDIGI = LKDN |
234 |
|
|
C fc ENDIF |
235 |
|
|
C fc * |
236 |
|
|
C fc * Fill CWN common |
237 |
|
|
C fc * |
238 |
|
|
C fc IF(HF) THEN |
239 |
|
|
C fc ITRPB(I) = NUMBV((NVSPE-3),I) |
240 |
|
|
C fc ITRSL(I) = NUMBV((NVSPE-1),I) |
241 |
|
|
C fc ITSPA(I) = NUMBV(NVSPE,I) |
242 |
|
|
C fc XTSPA(I) = VHITS(1,I) |
243 |
|
|
C fc YTSPA(I) = VHITS(2,I) |
244 |
|
|
C fc ZTSPA(I) = VHITS(3,I) |
245 |
|
|
C fc XOTSPA(I) = VHITS(4,I) |
246 |
|
|
C fc YOTSPA(I) = VHITS(5,I) |
247 |
|
|
C fc ZOTSPA(I) = VHITS(6,I) |
248 |
|
|
C fc ERTSPA(I) = VHITS(7,I) |
249 |
|
|
C fc PATSPA(I) = VHITS(8,I) |
250 |
|
|
C fc ENDIF |
251 |
|
|
C fc IF(CONT) HF = .FALSE. |
252 |
|
|
C fc ENDDO |
253 |
|
|
C fc IF(CONT) THEN |
254 |
|
|
C fc NHFRST = NHFRST + NHM |
255 |
|
|
C fc IF( (NTHIT-NHFRST).LE.NHM) CONT=.FALSE. |
256 |
|
|
C fc GO TO 10 |
257 |
|
|
C fc ENDIF |
258 |
|
|
C fc * |
259 |
|
|
C fc * fill digits with noise included |
260 |
|
|
C fc * |
261 |
|
|
C fc IF(LKDN.GE.1) THEN |
262 |
|
|
C fc DO II=1,LKDN |
263 |
|
|
C fc * plane=0 if the signal is lesser than 1 ADC |
264 |
|
|
C fc IF(INT(RLKD4(II)*ADCX).LE.0.AND.LKD2(II).GE.1. |
265 |
|
|
C fc + AND.LKD2(II).LE.3) LKD1(II)=0 |
266 |
|
|
C fc IF(INT(RLKD4(II)*ADCY).LE.0.AND.LKD2(II).GE.4. |
267 |
|
|
C fc + AND.LKD2(II).LE.5) LKD1(II)=0 |
268 |
|
|
C fc * |
269 |
|
|
C fc JJ=LKDH(II)+(NHFRST-1) |
270 |
|
|
C fc * KDIGI(1)=LKD1(II) |
271 |
|
|
C fc * KDIGI(2)=LKD2(II) |
272 |
|
|
C fc KDIGI(1)=LKD2(II) |
273 |
|
|
C fc KDIGI(2)=LKD3(II) |
274 |
|
|
C fc * R1=RAN(IR) |
275 |
|
|
C fc * R2=RAN(IR) |
276 |
|
|
C fc * GRNDM0=SIN(2.*3.14159*R1)*SQRT(-2.*LOG(R2)) |
277 |
|
|
C fc GRNDM0 = GPGAUS(0.) |
278 |
|
|
C fc IF(LKD2(II).GE.1.AND.LKD2(II).LE.3) THEN |
279 |
|
|
C fc RLKD4(II)=RLKD4(II)+GRNDM0*ENOISX+PIEDX |
280 |
|
|
C fc KDIGI(3)=INT(RLKD4(II)*ADCX) |
281 |
|
|
C fc ENDIF |
282 |
|
|
C fc IF(LKD2(II).GE.4.AND.LKD2(II).LE.5) THEN |
283 |
|
|
C fc RLKD4(II)=RLKD4(II)+GRNDM0*ENOISY+PIEDY |
284 |
|
|
C fc KDIGI(3)=INT(RLKD4(II)*ADCY) |
285 |
|
|
C fc ENDIF |
286 |
|
|
C fc C+SELF,IF=PAOLO |
287 |
|
|
C fc DO J=1,NVOL |
288 |
|
|
C fc NUMBVD(J)=NUMBV(J,JJ) |
289 |
|
|
C fc ENDDO |
290 |
|
|
C fc C+SELF |
291 |
|
|
C fc LTRA=ITRA(JJ) |
292 |
|
|
C fc IF(KDIGI(3).LT.0) KDIGI(3)=0 |
293 |
|
|
C fc IF(KDIGI(3).GE.1024) KDIGI(3)=1023 |
294 |
|
|
C fc IF(KDIGI(3).GT.0.AND.LKD1(II).GT.0) THEN |
295 |
|
|
C fc CALL GSDIGI(IS,ID,LTRA,NTRA,NUMBVD,KDIGI,IDIG) |
296 |
|
|
C fc IF (IDIG.EQ.0) THEN |
297 |
|
|
C fc WRITE(CHMAIL,10200) CSET,CNSED(IS,ID),NVOL,KDIGI |
298 |
|
|
C fc CALL GMAIL(1,0) |
299 |
|
|
C fc GO TO 20 |
300 |
|
|
C fc ENDIF |
301 |
|
|
C fc ENDIF |
302 |
|
|
C fc * |
303 |
|
|
C fc * Fills CWN |
304 |
|
|
C fc * |
305 |
|
|
C fc IF(HF) THEN |
306 |
|
|
C fc IF(LKD2(II).GE.1.AND.LKD2(II).LE.3) KDIGIT=INT(RLKD4(II)* |
307 |
|
|
C fc + ADCX) |
308 |
|
|
C fc IF(LKD2(II).GE.4.AND.LKD2(II).LE.5) KDIGIT=INT(RLKD4(II)* |
309 |
|
|
C fc + ADCY) |
310 |
|
|
C fc IF(KDIGIT.GT.0.AND.LKD1(II).GT.0) THEN |
311 |
|
|
C fc NDISPE=NDISPE+1 |
312 |
|
|
C fc IF (NDISPE.LE.NDMSPE) THEN |
313 |
|
|
C fc NDPLAN(NDISPE)=LKD1(II) |
314 |
|
|
C fc NDSIL (NDISPE)=LKD2(II) |
315 |
|
|
C fc NDISTR(NDISPE)=LKD3(II) |
316 |
|
|
C fc IF(KDIGIT.LT.1024) THEN |
317 |
|
|
C fc NDIADC(NDISPE)=KDIGIT |
318 |
|
|
C fc ELSE |
319 |
|
|
C fc NDIADC(NDISPE)=1023 |
320 |
|
|
C fc ENDIF |
321 |
|
|
C fc ENDIF |
322 |
|
|
C fc ENDIF |
323 |
|
|
C fc ENDIF |
324 |
|
|
C fc ENDDO |
325 |
|
|
C fc ENDIF |
326 |
|
|
* |
327 |
|
|
10000 FORMAT(' GPDSPE: VOLUME level too big: SET=',A4,', DET=',A4,', |
328 |
|
|
+ NVOL=',I3,', NVMAX=',I3,', RUN=',I5,', EVT=',I8) |
329 |
|
|
10100 FORMAT(' GPDSPE: Error in GPRHIT: SET=',A4, |
330 |
|
|
+ ', DET=',A4,',NHITS=',I5,', NHMAX=',I5, |
331 |
|
|
+ ', RUN=',I5,', EVT=',I8) |
332 |
|
|
10200 FORMAT(' GPDSPE: digitization ERROR: SET=',A4,', DET=',A4,', |
333 |
|
|
+ NVOL=',I3,', KDIGI=',4I4) |
334 |
|
|
20 RETURN |
335 |
|
|
END |