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

Annotation of /gpamela/gpspe/gpdspe.F

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3.11 - (hide annotations) (download)
Fri Apr 23 10:03:06 2010 UTC (14 years, 7 months ago) by pam-fi
Branch: MAIN
CVS Tags: HEAD
Changes since 3.10: +9 -3 lines
 changes needed for rototrasled silicon sensor geometry

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

  ViewVC Help
Powered by ViewVC 1.1.23