/[PAMELA software]/gpamela/gpobsolete/gpspehd.F
ViewVC logotype

Contents of /gpamela/gpobsolete/gpspehd.F

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3.1.1.1 - (show annotations) (download) (vendor branch)
Thu Jul 11 16:02:14 2002 UTC (22 years, 4 months ago) by cafagna
Branch: v3r0, MAIN
CVS Tags: v4r4, v4r5, v4r6, v4r7, v4r0, v4r1, v4r2, v4r3, v4r8, v4r9, firstrelease, v4r14, v4r12, v4r13, v4r10, v4r11, v3r3, v3r1, v3r2, HEAD
Changes since 3.1: +0 -0 lines
First GPAMELA release on CVS

1 *
2 * $Id$
3 *
4 * $Log$
5 *
6 *CMZ : 2.01/00 06/03/2000 13.07.03 by Francesco Cafagna
7 *CMZ : 2.00/00 03/03/2000 15.39.06 by Francesco Cafagna
8 *CMZ : 1.02/00 22/10/99 11.10.56 by Francesco Cafagna
9 *CMZ : 1.01/00 21/05/96 08.53.57 by Francesco Cafagna
10 *-- Author : Paolo (The Magic) Papini 23/04/96
11 #if defined(GPAMELA_PAOLO)
12 SUBROUTINE GPSPEHD(NHIT,NPLANE,XI,YI,ZI,XO,YO,ZO,PATH,DE,LKDN)
13 #endif
14 #if !defined(GPAMELA_PAOLO)
15 SUBROUTINE GPSPEHD(NHIT,NUMV,NLEV,XI,YI,ZI,XO,YO,ZO,PATH,DE,
16 + LKDN)
17 #endif
18 ************************************************************************
19 * *
20 * To perform hit/digit conversion for spectrometer. *
21 * This routine fills the LKD1,LKD2,LKD3,LKD4 array *
22 * and it up-date LKND as total number of digit *
23 * *
24 * Variables definition: *
25 * IN: *
26 * NHIT - hit number *
27 * NPLANE - plane number *
28 * XI,YI,ZI,XO,YO,ZO - input and output hit coordinates *
29 * PATH,DE - hit path lenght and dE/dx *
30 * *
31 * OUT: *
32 * LKDN - total number of digit *
33 * *
34 * Called by: GPDSPE *
35 * Author: Paolo (The Magic) Papini, 23/04/96 15.45.26 *
36 * *
37 ************************************************************************
38 #include "gcunit.inc"
39 #include "gpphit.inc"
40 #include "gppdigi.inc"
41 PARAMETER (NH=NHSPE,NHM=NHMSPE,NVOL=4)
42 #include "gpspe.inc"
43 #include "gpsed.inc"
44 #include "gpgeo.inc"
45 #include "gpdspe.inc"
46 *
47 * Data block for digitalization
48 *
49 INTEGER NHIT,NPLANE,LKDN,NSIL,NSTRIP,NADC,NEWD
50 REAL XSIL,YSIL,XBORD,YBORD
51 REAL XI,YI,XO,YO,PATH,DE,CH_DIG(2048)
52 REAL RR(3),BB(3)
53 #if !defined(GPAMELA_PAOLO)
54 INTEGER LNAM,LNUM
55 DIMENSION NUMV(NLEV),LNAM(NVOL),LNUM(NVOL)
56 REAL XYZISI(3),XYZOSI(3),XYZIMA(3),XYZOMA(3),XYZMO(3),XYZSO(3)
57 #endif
58 *
59 BB(1)=0.
60 BB(2)=0.
61 BB(3)=0.
62 #if defined(GPAMELA_MAGN)
63 RR(1)=(XI+XO)/2.
64 RR(2)=(YI+YO)/2.
65 RR(3)=(ZI+ZO)/2.
66 CALL GUFLD(RR,BB)
67 #endif
68 NSEPX=1+INT(ABS(XO-XI)/STEPX)
69 NSEPY=1+INT(ABS(YO-YI)/STEPY)
70 NSEPZ=1+INT(ABS(ZO-ZI)/STEPZ)
71 #if defined(GPAMELA_PAOLO)
72 C*
73 C* X-view digitalization
74 C*
75 C NSIL=INT(((XI+XO)/2.+3.*TSPA(1))/(2.*TSPA(1)))+1
76 C* go way if no in the silicon
77 C IF(NSIL.LT.1.OR.NSIL.GT.3) GOTO 10
78 C* n.division of hit path
79 C NSEP=MAX0(NSEPX,NSEPZ)
80 C* energy loss in each path division
81 C DDE=DE/FLOAT(NSEP)
82 C* XI-ccor. in the silicon
83 C XSIL_I=MOD(XI+3.*TSPA(1),2.*TSPA(1))
84 C* XO-coor. in the silicon
85 C XSIL_O=MOD(XO+3.*TSPA(1),2.*TSPA(1))
86 C* x-coor. of sensitive edge
87 C XBORD=(2.*TSPA(1)-NXSTR*WXSTR)/2.
88 C* XI of the strip
89 C NSTR_I=INT((XSIL_I-XBORD)/WXSTR)+1
90 C* XO of the strip
91 C NSTR_O=INT((XSIL_O-XBORD)/WXSTR)+1
92 C NSTR_MIN=MIN0(NSTR_I,NSTR_O)-10
93 C* minimum strip to be calculated
94 C IF(NSTR_MIN.LT.1) NSTR_MIN=1
95 C NSTR_MAX=MAX0(NSTR_I,NSTR_O)+10
96 C* maximum strip to be calculated
97 C IF(NSTR_MAX.GT.NXSTR) NSTR_MAX=NXSTR
98 C+SELF
99 #endif
100 #if !defined(GPAMELA_PAOLO)
101 *
102 * Fill up the GCVOLU common block
103 *
104 * CALL GFPATH (ISSPE,IDTSPA,NUMV,NLEV,LNAM,LNUM)
105 c LNAM(1) =4HPAME
106 c LNAM(2) =4HSPEB
107 LNAM(1) =4HTRPB
108 LNAM(2) =4HTRPL
109 LNAM(3) =4HTRSL
110 LNAM(4) =4HTSPA
111 CALL GLVOLU (NLEV,LNAM,NUMV,IER)
112 *
113 * X-view digitalization
114 *
115 NSIL=NUMV(NLEV-1)
116 * go way if no in the silicon
117 IF(NSIL.LT.1.OR.NSIL.GT.3) GOTO 10
118 *
119 * Calculate the stripes
120 *
121 NPLANE = NUMV(NLEV-3)
122 * n.division of hit path
123 NSEP=MAX0(NSEPX,NSEPZ)
124 * energy loss in each path division
125 DDE=DE/FLOAT(NSEP)
126 * trasform coordinates from MARS to silicon center
127 XYZIMA(1) = XI
128 XYZIMA(2) = YI
129 XYZIMA(3) = ZI
130 CALL GMTOD(XYZIMA,XYZISI,1)
131 XYZOMA(1) = XO
132 XYZOMA(2) = YO
133 XYZOMA(3) = ZO
134 CALL GMTOD(XYZOMA,XYZOSI,1)
135 * xy-coor. of sensitive edge
136 XBORD=(2.*TSPA(1)-NXSTR*WXSTR)/2.
137 YBORD=(2.*TSPA(2)-NYSTR*WYSTR)/2.
138 * xyz-coord. of the paddle origin in MARS
139 CALL VZERO(XYZSO,3)
140 CALL GDTOM(XYZSO,XYZMO,1)
141 * Move origin of coordinates to the paddle edge, a guard zone added
142 XYZISI(1) = XYZISI(1) + (TSPA(1) - XBORD)
143 XYZISI(2) = XYZISI(2) + (TSPA(2) - YBORD)
144 *
145 XYZOSI(1) = XYZOSI(1) + (TSPA(1) - XBORD)
146 XYZOSI(2) = XYZOSI(2) + (TSPA(2) - YBORD)
147 * Calculated the strip number now
148 NSTR_I=INT(XYZISI(1)/WXSTR)+1
149 NSTR_O=INT(XYZOSI(1)/WXSTR)+1
150 NSTR_MIN=MIN0(NSTR_I,NSTR_O)-10
151 * minimum strip to be calculated
152 IF(NSTR_MIN.LT.1) NSTR_MIN=1
153 NSTR_MAX=MAX0(NSTR_I,NSTR_O)+10
154 * maximum strip to be calculated
155 IF(NSTR_MAX.GT.NXSTR) NSTR_MAX=NXSTR
156 #endif
157 C PRINT *,'X DIGIT, N.HIT:',NHIT
158 C PRINT *,'NSTR_MIN,NSTR_MAX,NSEP',NSTR_MIN,NSTR_MAX,NSEP
159
160 * loop on the strip (for the diffusion of Q)
161 DO IS=NSTR_MIN,NSTR_MAX
162 * x-center of the strip IS
163 XSTR=XBORD+(IS-0.5)*WXSTR+(2*NSIL-5)*TSPA(1)
164 C+SELF,IF=PAOLO
165 C* z-center of the strip
166 C ZSTR=ZSPEC+(3.5-NPLANE)*2.*MGPL(3)+(3-NPLANE)*2.*TRPB(3)+
167 C + 2.*TRCP(3)+2.*TRRP(3)+2.*TSKP(3)
168 C+SELF
169 #if !defined(GPAMELA_PAOLO)
170 * XSTR=XYZMO(1)
171 * Z-coord. of the implanted strip. The upper is the Y view
172 ZSTR=XYZMO(3)-TSPA(3)
173 #endif
174 * magnetic field effect
175 XI=XI-ABS(ZI-ZSTR)*0.2475*BB(2)/15.
176 XO=XO-ABS(ZO-ZSTR)*0.2475*BB(2)/15.
177 *
178 C PRINT *,ZSPEC,NPLANE,MGPL(3),TRPB(3),TRCP(3),TRRP(3),TSKP(3)
179 * charge definition for the strip IS
180 CH_DIG(IS)=0.
181 * loop on the hit path division
182 DO IH=1,NSEP
183 * x-coor. hit division
184 XH=XI+(IH-0.5)*(XO-XI)/FLOAT(NSEP)
185 * Z-coor. hit division
186 ZH=ZI+(IH-0.5)*(ZO-ZI)/FLOAT(NSEP)
187 IX=1+INT(ABS(XH-XSTR)/STEPX)
188 IZ=1+INT(ABS(ZH-ZSTR)/STEPZ)
189 C PRINT *,'IX,IZ',IX,IZ,XH,XSTR,ZH,ZSTR
190 C PRINT *,IS,IH,IX,IZ,CHARX(IX,IZ)
191 IF(IX.LE.NPCHXY.AND.IZ.LE.NPCHZ) THEN
192 IF(MOD(IS,2).EQ.1) THEN
193 CH_DIG(IS)=CH_DIG(IS)+DDE*CHARX(IX,IZ)
194 ELSE
195 CH_DIG(IS)=CH_DIG(IS)+DDE*CHARX_I(IX,IZ)
196 ENDIF
197 ENDIF
198 ENDDO
199 END DO
200 * loop for C-coupling
201 DO IS=NSTR_MIN,NSTR_MAX
202 * X-view has double strip (ISR is the read strip)
203 ISR=INT((IS+1)/2)
204 CHARGE=0.
205 DO ISSR=ISR-2,ISR+2,1
206 IF(2*ISSR-2.GE.NSTR_MIN.AND.2*ISSR.LE.NSTR_MAX) CHARGE=
207 + CHARGE+CCX(1+IABS(ISSR-ISR))* (CH_DIG(2*ISSR-1)+CH_DIG(2*
208 + ISSR)/2+CH_DIG(2*ISSR-2)/2)
209 ENDDO
210 C CHARGE=CH_DIG(IS)
211 *
212 * digitaz record
213 NEWD=1
214 * X-view has double strip (ISR is the read strip)
215 IF(LKDN.NE.0) THEN
216 DO I=1,LKDN
217 IF(NPLANE.EQ.LKD1(I).AND.NSIL.EQ.LKD2(I)
218 + .AND.ISR.EQ.LKD3(I)) THEN
219 NEWD=0
220 RLKD4(I)=RLKD4(I)+CHARGE
221 ENDIF
222 ENDDO
223 ENDIF
224 IF(NEWD.EQ.1) THEN
225 LKDN=LKDN+1
226 IF (LKDN.GT.NDMSPE) THEN
227 WRITE(10000,CHMAIL) LKDN
228 CALL GMAIL(1,0)
229 GO TO 30
230 ENDIF
231 LKD1(LKDN)=NPLANE
232 LKD2(LKDN)=NSIL
233 LKD3(LKDN)=ISR
234 RLKD4(LKDN)=CHARGE
235 LKDH(LKDN)=NHIT
236 ENDIF
237 ENDDO
238 10 CONTINUE
239 *
240 * Y-view digitalization
241 *
242 NSEP=MAX0(NSEPY,NSEPZ)
243 DDE=DE/NSEP
244 C+SELF,IF=PAOLO
245 C NSIL=INT(((YI+YO)/2.+2.*TSPA(2))/(2.*TSPA(2)))+4
246 C IF(NSIL.LT.4.OR.NSIL.GT.5) GOTO 20
247 C YSIL_I=MOD(YI+2.*TSPA(2),2.*TSPA(2))
248 C YSIL_O=MOD(YO+2.*TSPA(2),2.*TSPA(2))
249 C YBORD=(2.*TSPA(2)-NYSTR*WYSTR)/2.
250 C NSTR_I=INT((YSIL_I-YBORD)/WYSTR)+1
251 C NSTR_O=INT((YSIL_O-YBORD)/WYSTR)+1
252 C NSTR_MIN=MIN0(NSTR_I,NSTR_O)-5
253 C IF(NSTR_MIN.LT.1) NSTR_MIN=1
254 C NSTR_MAX=MAX0(NSTR_I,NSTR_O)+5
255 C IF(NSTR_MAX.GT.NYSTR) NSTR_MAX=NYSTR
256 C+SELF.
257 #if !defined(GPAMELA_PAOLO)
258 NSIL = 5 - (NUMV(NLEV)-1)
259 IF(NSIL.LT.4.OR.NSIL.GT.5) GOTO 20
260 * Calculate the strip number now
261 NSTR_I=INT((XYZISI(2))/WYSTR)+1
262 NSTR_O=INT((XYZOSI(2))/WYSTR)+1
263 NSTR_MIN=MIN0(NSTR_I,NSTR_O)-5
264 * minimum strip to be calculated
265 IF(NSTR_MIN.LT.1) NSTR_MIN=1
266 NSTR_MAX=MAX0(NSTR_I,NSTR_O)+5
267 * maximum strip to be calculated
268 IF(NSTR_MAX.GT.NYSTR) NSTR_MAX=NYSTR
269 #endif
270 DO IS=NSTR_MIN,NSTR_MAX
271 YSTR=YBORD+(IS-0.5)*WYSTR+(NSIL-5)*2.*TSPA(2)
272 C+SELF,IF=PAOLO
273 C ZSTR=ZSPEC+(3.5-NPLANE)*2.*MGPL(3)+(3-NPLANE)*2.*TRPB(3)+
274 C + 2.*TRCP(3)+2.*TRRP(3)+2.*TSKP(3)+2.*TSPA(3)
275 C+SELF
276 #if !defined(GPAMELA_PAOLO)
277 * YSTR=XYZMO(2)
278 * Z-coord. of the implanted strip. The lower is the X view
279 ZSTR=XYZMO(3) + TSPA(3)
280 #endif
281 * magnetic field effect
282 XI=XI+ABS(ZI-ZSTR)*0.04716*BB(2)/15.
283 XO=XO+ABS(ZO-ZSTR)*0.04716*BB(2)/15.
284 *
285 CH_DIG(IS)=0.
286 DO IH=1,NSEP
287 YH=YI+(IH-0.5)*(YO-YI)/NSEP
288 ZH=ZI+(IH-0.5)*(ZO-ZI)/NSEP
289 IY=1+INT(ABS(YH-YSTR)/STEPY)
290 IZ=1+INT(ABS(ZH-ZSTR)/STEPZ)
291 C PRINT *,IS,IH,IY,IZ,CHARY(IY,IZ)
292 IF(IY.LE.NPCHXY.AND.IZ.LE.NPCHZ) CH_DIG(IS)=CH_DIG(IS)+DDE*
293 + CHARY(IY,IZ)
294 ENDDO
295 ENDDO
296 DO IS=NSTR_MIN,NSTR_MAX
297 CHARGE=0.
298 DO ISS=IS-2,IS+2,1
299 IF(ISS.GE.NSTR_MIN.AND.ISS.LE.NSTR_MAX) CHARGE=
300 + CHARGE+CCY(1+IABS(ISS-IS))*CH_DIG(ISS)
301 ENDDO
302 *
303 * digitaz record
304 NEWD=1
305 * the Y view paddles are connected
306 IF(NSIL.EQ.5) NSIL=4
307 IF(LKDN.NE.0) THEN
308 DO I=1,LKDN
309 IF(NPLANE.EQ.LKD1(I).AND.NSIL.EQ.LKD2(I)
310 + .AND.IS.EQ.LKD3(I)) THEN
311 NEWD=0
312 RLKD4(I)=RLKD4(I)+CHARGE
313 ENDIF
314 ENDDO
315 ENDIF
316 IF(NEWD.EQ.1) THEN
317 LKDN=LKDN+1
318 IF (LKDN.GT.NDMSPE) THEN
319 WRITE(CHMAIL,10000) LKDN
320 CALL GMAIL(1,0)
321 GO TO 30
322 ENDIF
323 LKD1(LKDN)=NPLANE
324 LKD2(LKDN)=NSIL
325 LKD3(LKDN)=IS
326 RLKD4(LKDN)=CHARGE
327 LKDH(LKDN)=NHIT
328 ENDIF
329 ENDDO
330 20 CONTINUE
331 *
332 10000 FORMAT(' GPSPEHD: too much digitalization= ',I5)
333 30 RETURN
334 END

  ViewVC Help
Powered by ViewVC 1.1.23