/[PAMELA software]/gpamela/gpspe/gpdspe.F
ViewVC logotype

Contents of /gpamela/gpspe/gpdspe.F

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3.10 - (show annotations) (download)
Tue May 8 15:05:18 2007 UTC (17 years, 7 months ago) by bottai
Branch: MAIN
CVS Tags: v4r14, v4r12, v4r13
Changes since 3.9: +16 -9 lines
 avoid simulating Lorentz angle drift in SPE spread positions
 since new reconstruction correct it at strip level

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

  ViewVC Help
Powered by ViewVC 1.1.23