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

Annotation of /gpamela/gpspe/gpdspe.F

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3.9 - (hide annotations) (download)
Tue May 2 12:00:24 2006 UTC (18 years, 7 months ago) by bottai
Branch: MAIN
CVS Tags: v4r6, v4r7, v4r8, v4r9, v4r10, v4r11
Changes since 3.8: +75 -20 lines
 call gpucollection for strip simulation, condition on FFIELD repositioned

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

  ViewVC Help
Powered by ViewVC 1.1.23