/[PAMELA software]/DarthVader/TrackerLevel2/src/F77/functionspfa.f
ViewVC logotype

Annotation of /DarthVader/TrackerLevel2/src/F77/functionspfa.f

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.12 - (hide annotations) (download)
Wed May 23 15:31:19 2007 UTC (17 years, 6 months ago) by pam-fi
Branch: MAIN
CVS Tags: v3r06
Changes since 1.11: +5 -5 lines
fixed bug in COG4 :-(

1 pam-fi 1.9
2 pam-fi 1.10
3     subroutine idtoc(ipfa,cpfa)
4    
5     integer ipfa
6     character*4 cpfa
7    
8     CPFA='COG4'
9     if(ipfa.eq.0)CPFA='ETA'
10     if(ipfa.eq.2)CPFA='ETA2'
11     if(ipfa.eq.3)CPFA='ETA3'
12     if(ipfa.eq.4)CPFA='ETA4'
13     if(ipfa.eq.10)CPFA='COG'
14     if(ipfa.eq.11)CPFA='COG1'
15     if(ipfa.eq.12)CPFA='COG2'
16     if(ipfa.eq.13)CPFA='COG3'
17     if(ipfa.eq.14)CPFA='COG4'
18    
19     end
20    
21 mocchiut 1.1 *** * * * *** * * * *** * * * *** * * * *** * * * *** * * * ***
22     * this file contains all subroutines and functions
23     * that are needed for position finding algorithms
24     *
25     *
26     *** * * * *** * * * *** * * * *** * * * *** * * * *** * * * ***
27    
28    
29 pam-fi 1.9 integer function npfastrips(ic,PFA,angle)
30     *--------------------------------------------------------------
31     * thid function returns the number of strips used
32     * to evaluate the position of a cluster, according to the p.f.a.
33     *--------------------------------------------------------------
34     include 'commontracker.f'
35     include 'level1.f'
36     include 'calib.f'
37    
38     character*4 usedPFA,PFA
39    
40    
41     usedPFA=PFA
42    
43     npfastrips=0
44    
45     if(usedPFA.eq.'COG1')npfastrips=1
46     if(usedPFA.eq.'COG2')npfastrips=2
47     if(usedPFA.eq.'COG3')npfastrips=3
48     if(usedPFA.eq.'COG4')npfastrips=4
49     if(usedPFA.eq.'ETA2')npfastrips=2
50     if(usedPFA.eq.'ETA3')npfastrips=3
51     if(usedPFA.eq.'ETA4')npfastrips=4
52     * ----------------------------------------------------------------
53     if(usedPFA.eq.'ETA')then
54     c print*,VIEW(ic),angle
55     if(mod(int(VIEW(ic)),2).eq.1)then !Y-view
56     if( abs(angle).ge.e2fay.and.abs(angle).lt.e2tay )then
57     npfastrips=2
58     elseif( abs(angle).ge.e3fay.and.abs(angle).lt.e3tay )then
59     npfastrips=3
60     elseif( abs(angle).ge.e4fay.and.abs(angle).lt.e4tay )then
61     npfastrips=4
62     else
63     npfastrips=4
64     c usedPFA='COG'
65     endif
66     else !X-view
67     if( abs(angle).ge.e2fax.and.abs(angle).lt.e2tax )then
68     npfastrips=2
69     elseif( abs(angle).ge.e3fax.and.abs(angle).lt.e3tax )then
70     npfastrips=3
71     elseif( abs(angle).ge.e4fax.and.abs(angle).lt.e4tax )then
72     npfastrips=4
73     else
74     npfastrips=4
75     c usedPFA='COG'
76     endif
77     endif
78     endif
79     * ----------------------------------------------------------------
80     if(usedPFA.eq.'COG')then
81    
82     iv=VIEW(ic)
83     if(mod(iv,2).eq.1)incut=incuty
84     if(mod(iv,2).eq.0)incut=incutx
85     istart = INDSTART(IC)
86     istop = TOTCLLENGTH
87     if(ic.lt.NCLSTR1)istop=INDSTART(IC+1)-1
88     mu = 0
89     do i = INDMAX(IC),istart,-1
90     ipos = i-INDMAX(ic)
91     cut = incut*CLSIGMA(i)
92     if(CLSIGNAL(i).ge.cut)then
93     mu = mu + 1
94     print*,i,mu
95     else
96     goto 10
97     endif
98     enddo
99     10 continue
100     do i = INDMAX(IC)+1,istop
101     ipos = i-INDMAX(ic)
102     cut = incut*CLSIGMA(i)
103     if(CLSIGNAL(i).ge.cut)then
104     mu = mu + 1
105     print*,i,mu
106     else
107     goto 20
108     endif
109     enddo
110     20 continue
111     npfastrips=mu
112    
113     endif
114     * ----------------------------------------------------------------
115    
116     c print*,pfastrips
117    
118     return
119     end
120    
121 mocchiut 1.1 *** * * * *** * * * *** * * * *** * * * *** * * * *** * * * ***
122 pam-fi 1.4 real function pfaeta(ic,angle)
123 mocchiut 1.1 *--------------------------------------------------------------
124     * this function returns the position (in strip units)
125     * it calls:
126 pam-fi 1.4 * - pfaeta2(ic,angle)
127     * - pfaeta3(ic,angle)
128     * - pfaeta4(ic,angle)
129 mocchiut 1.1 * according to the angle
130     *--------------------------------------------------------------
131     include 'commontracker.f'
132     include 'level1.f'
133 pam-fi 1.9 include 'calib.f'
134 mocchiut 1.1
135 pam-fi 1.4 pfaeta = 0
136 mocchiut 1.1
137     if(mod(int(VIEW(ic)),2).eq.1)then !Y-view
138    
139 pam-fi 1.9 if( abs(angle).ge.e2fay.and.abs(angle).le.e2tay )then
140     pfaeta = pfaeta2(ic,angle)
141     elseif( abs(angle).ge.e3fay.and.abs(angle).le.e3tay )then
142     pfaeta = pfaeta3(ic,angle)
143     elseif( abs(angle).ge.e4fay.and.abs(angle).le.e4tay )then
144     pfaeta = pfaeta4(ic,angle)
145     else
146     pfaeta = cog(4,ic)
147     endif
148    
149 mocchiut 1.1 else !X-view
150    
151 pam-fi 1.9 if( abs(angle).ge.e2fax.and.abs(angle).le.e2tax )then
152 pam-fi 1.4 pfaeta = pfaeta2(ic,angle)
153 pam-fi 1.9 elseif( abs(angle).ge.e3fax.and.abs(angle).le.e3tax )then
154 pam-fi 1.4 pfaeta = pfaeta3(ic,angle)
155 pam-fi 1.9 elseif( abs(angle).ge.e4fax.and.abs(angle).le.e4tax )then
156 pam-fi 1.4 pfaeta = pfaeta4(ic,angle)
157 pam-fi 1.9 else
158     pfaeta = cog(4,ic)
159     endif
160 mocchiut 1.1
161     endif
162 pam-fi 1.5
163 mocchiut 1.1 100 return
164     end
165    
166     *** * * * *** * * * *** * * * *** * * * *** * * * *** * * * ***
167 pam-fi 1.11 c real function riseta(ic,angle)
168     real function riseta(iview,angle)
169 mocchiut 1.1 *--------------------------------------------------------------
170     * this function returns the average spatial resolution
171 pam-fi 1.4 * (in cm) for the ETA algorithm (function pfaeta(ic,angle))
172 mocchiut 1.1 * it calls:
173     * - risx_eta2(angle)
174     * - risy_eta2(angle)
175     * - risx_eta3(angle)
176     * - risx_eta4(angle)
177     * according to the angle
178     *--------------------------------------------------------------
179     include 'commontracker.f'
180     include 'level1.f'
181 pam-fi 1.9 include 'calib.f'
182 mocchiut 1.1
183 pam-fi 1.11 riseta = 0
184 mocchiut 1.1
185 pam-fi 1.11 c if(mod(int(VIEW(ic)),2).eq.1)then !Y-view
186     if(mod(iview,2).eq.1)then !Y-view
187 mocchiut 1.1
188 pam-fi 1.9
189     if( abs(angle).ge.e2fay.and.abs(angle).le.e2tay )then
190 pam-fi 1.11 riseta = risy_eta2(angle)
191 pam-fi 1.9 elseif( abs(angle).ge.e3fay.and.abs(angle).le.e3tay )then
192 pam-fi 1.11 riseta = risy_cog(angle) !ATTENZIONE!!
193 pam-fi 1.9 elseif( abs(angle).ge.e4fay.and.abs(angle).le.e4tay )then
194 pam-fi 1.11 riseta = risy_cog(angle) !ATTENZIONE!!
195 pam-fi 1.9 else
196 pam-fi 1.11 riseta = risy_cog(angle)
197 pam-fi 1.9 endif
198 mocchiut 1.1
199     else !X-view
200    
201 pam-fi 1.9 if( abs(angle).ge.e2fax.and.abs(angle).le.e2tax )then
202 pam-fi 1.11 riseta = risx_eta2(angle)
203 pam-fi 1.9 elseif( abs(angle).ge.e3fax.and.abs(angle).le.e3tax )then
204 pam-fi 1.11 riseta = risx_eta3(angle)
205 pam-fi 1.9 elseif( abs(angle).ge.e4fax.and.abs(angle).le.e4tax )then
206 pam-fi 1.11 riseta = risx_eta4(angle)
207 pam-fi 1.9 else
208 pam-fi 1.11 riseta = risx_cog(angle)
209 pam-fi 1.9 endif
210 mocchiut 1.1
211     endif
212    
213 pam-fi 1.11 print*,'---- ',riseta,iview,angle
214    
215 mocchiut 1.1 100 return
216     end
217    
218     *** * * * *** * * * *** * * * *** * * * *** * * * *** * * * ***
219     real function fbad_eta(ic,angle)
220     *-------------------------------------------------------
221     * this function returns a factor that takes into
222     * account deterioration of the spatial resolution
223     * in the case BAD strips are included in the cluster.
224     * This factor should multiply the nominal spatial
225     * resolution.
226     * It calls the function FBAD_COG(NCOG,IC),
227     * accordingto the angle
228     *-------------------------------------------------------
229    
230     include 'commontracker.f'
231     include 'level1.f'
232 pam-fi 1.9 include 'calib.f'
233 mocchiut 1.1 fbad_eta = 0
234    
235     if(mod(int(VIEW(ic)),2).eq.1)then !Y-view
236    
237 pam-fi 1.9 if( abs(angle).ge.e2fay.and.abs(angle).le.e2tay )then
238     fbad_eta = fbad_cog(2,ic)
239     elseif( abs(angle).ge.e3fay.and.abs(angle).le.e3tay )then
240     fbad_eta = fbad_cog(3,ic)
241     elseif( abs(angle).ge.e4fay.and.abs(angle).le.e4tay )then
242     fbad_eta = fbad_cog(4,ic)
243     else
244     fbad_eta = fbad_cog(4,ic)
245     endif
246 mocchiut 1.1
247     else !X-view
248    
249 pam-fi 1.9 if( abs(angle).ge.e2fax.and.abs(angle).le.e2tax )then
250 mocchiut 1.1 fbad_eta = fbad_cog(2,ic)
251 pam-fi 1.9 elseif( abs(angle).ge.e3fax.and.abs(angle).le.e3tax )then
252 mocchiut 1.1 fbad_eta = fbad_cog(3,ic)
253 pam-fi 1.9 elseif( abs(angle).ge.e4fax.and.abs(angle).le.e4tax )then
254     fbad_eta = fbad_cog(4,ic)
255     else
256 mocchiut 1.1 fbad_eta = fbad_cog(4,ic)
257 pam-fi 1.9 endif
258 mocchiut 1.1
259     endif
260    
261     return
262     end
263    
264     *** * * * *** * * * *** * * * *** * * * *** * * * *** * * * ***
265 pam-fi 1.4 real function pfaeta2(ic,angle) !(1)
266 mocchiut 1.1 *--------------------------------------------------------------
267     * this function returns
268     *
269     * - the position (in strip units)
270     * corrected according to the ETA2 Position Finding Algorithm.
271     * The function performs an interpolation of FETA2%ETA2
272     *
273     * - if the angle is out of range, the calibration parameters
274     * of the lowest or higher bin are used
275     *
276     *--------------------------------------------------------------
277     include 'commontracker.f'
278     include 'calib.f'
279     include 'level1.f'
280    
281     real cog2,angle
282     integer iview,lad
283    
284 pam-fi 1.9 iview = VIEW(ic)
285     lad = nld(MAXS(ic),VIEW(ic))
286     cog2 = cog(2,ic)
287 pam-fi 1.4 pfaeta2=cog2
288 mocchiut 1.1
289     * find angular bin
290     * (in futuro possiamo pensare di interpolare anche sull'angolo)
291     do iang=1,nangbin
292     if(angL(iang).lt.angle.and.angR(iang).ge.angle)then
293     iangle=iang
294     goto 98
295     endif
296     enddo
297     if(DEBUG)
298 pam-fi 1.4 $ print*,'pfaeta2 *** warning *** angle out of range: ',angle
299 mocchiut 1.1 if(angle.lt.angL(1))iang=1
300     if(angle.gt.angR(nangbin))iang=nangbin
301     98 continue !jump here if ok
302    
303    
304     c$$$* find extremes of interpolation
305     c$$$ iflag=0
306     c$$$* --------------------------------
307     c$$$ if(cog2.lt.eta2(1,iang).or.cog2.gt.eta2(netaval,iang))then
308 pam-fi 1.4 c$$$c print*,'pfaeta2 *** warning *** argument out of range: ',cog2
309 mocchiut 1.1 c$$$* goto 100
310     c$$$* ----------------------------------------------
311     c$$$* non salto piu`, ma scalo di 1 o -1
312     c$$$* nel caso si tratti di un cluster
313     c$$$* in cui la strip con il segnale massimo non coincide
314     c$$$* con la strip con il rapposto s/n massimo!!!
315     c$$$* ----------------------------------------------
316     c$$$ if(cog2.lt.eta2(1,iang))then !temp
317     c$$$ cog2=cog2+1. !temp
318     c$$$ iflag=1 !temp
319     c$$$ else !temp
320     c$$$ cog2=cog2-1. !temp
321     c$$$ iflag=-1 !temp
322     c$$$ endif !temp
323     c$$$c print*,'shifted >>> ',cog2
324     c$$$ endif
325    
326     iadd=0
327     10 continue
328     if(cog2.lt.eta2(1,iang))then
329     cog2 = cog2 + 1
330     iadd = iadd + 1
331     goto 10
332     endif
333     20 continue
334     if(cog2.gt.eta2(netaval,iang))then
335     cog2 = cog2 - 1
336     iadd = iadd - 1
337     goto 20
338     endif
339    
340     * --------------------------------
341     c print*,'*****',i,view,lad,iang,'------> cog2 ',cog2
342     do i=2,netaval
343     if(eta2(i,iang).gt.cog2)then
344    
345     x1 = eta2(i-1,iang)
346     x2 = eta2(i,iang)
347     y1 = feta2(i-1,iview,lad,iang)
348     y2 = feta2(i,iview,lad,iang)
349    
350     c print*,'*****',i,view,lad,iang
351     c print*,'-----',x1,x2,y1,y2
352     goto 99
353     endif
354     enddo
355     99 continue
356    
357    
358     AA=(y2-y1)/(x2-x1)
359     BB=y1-AA*x1
360    
361 pam-fi 1.4 pfaeta2 = AA*cog2+BB
362     pfaeta2 = pfaeta2 - iadd
363 mocchiut 1.1
364     c$$$ if(iflag.eq.1)then
365 pam-fi 1.4 c$$$ pfaeta2=pfaeta2-1. !temp
366 mocchiut 1.1 c$$$ cog2=cog2-1. !temp
367     c$$$ endif
368     c$$$ if(iflag.eq.-1)then
369 pam-fi 1.4 c$$$ pfaeta2=pfaeta2+1. !temp
370 mocchiut 1.1 c$$$ cog2=cog2+1. !temp
371     c$$$ endif
372    
373     if(DEBUG)print*,'ETA2 (ic ',ic,' ang',angle,')'
374 pam-fi 1.4 $ ,cog2-iadd,' -->',pfaeta2
375 mocchiut 1.1
376    
377     100 return
378     end
379    
380     *** * * * *** * * * *** * * * *** * * * *** * * * *** * * * ***
381 pam-fi 1.4 real function pfaeta3(ic,angle) !(1)
382 mocchiut 1.1 *--------------------------------------------------------------
383     * this function returns
384     *
385     * - the position (in strip units)
386     * corrected according to the ETA3 Position Finding Algorithm.
387     * The function performs an interpolation of FETA3%ETA3
388     *
389     * - if the angle is out of range, the calibration parameters
390     * of the lowest or higher bin are used
391     *
392     *--------------------------------------------------------------
393     include 'commontracker.f'
394     include 'calib.f'
395     include 'level1.f'
396    
397     real cog3,angle
398     integer iview,lad
399    
400    
401 pam-fi 1.9 iview = VIEW(ic)
402     lad = nld(MAXS(ic),VIEW(ic))
403     cog3 = cog(3,ic)
404 pam-fi 1.4 pfaeta3=cog3
405 mocchiut 1.1
406     * find angular bin
407     * (in futuro possiamo pensare di interpolare anche sull'angolo)
408     do iang=1,nangbin
409     c print*,'~~~~~~~~~~~~ ',iang,angL(iang),angR(iang),angle
410     if(angL(iang).lt.angle.and.angR(iang).ge.angle)then
411     iangle=iang
412     goto 98
413     endif
414     enddo
415     if(DEBUG)
416 pam-fi 1.4 $ print*,'pfaeta3 *** warning *** angle out of range: ',angle
417 mocchiut 1.1 if(angle.lt.angL(1))iang=1
418     if(angle.gt.angR(nangbin))iang=nangbin
419     98 continue !jump here if ok
420    
421    
422     c$$$* find extremes of interpolation
423     c$$$ iflag=0
424     c$$$* --------------------------------
425     c$$$ if(cog3.lt.eta3(1,iang).or.cog3.gt.eta3(netaval,iang))then
426     c$$$* ----------------------------------------------
427     c$$$* non salto piu`, ma scalo di 1 o -1
428     c$$$* nel caso si tratti di un cluster
429     c$$$* in cui la strip con il segnale massimo non coincide
430     c$$$* con la strip con il rapposto s/n massimo!!!
431     c$$$* ----------------------------------------------
432     c$$$ if(cog2.lt.eta2(1,iang))then !temp
433     c$$$ cog2=cog2+1. !temp
434     c$$$ iflag=1 !temp
435     c$$$ else !temp
436     c$$$ cog2=cog2-1. !temp
437     c$$$ iflag=-1 !temp
438     c$$$ endif !temp
439     c$$$c print*,'shifted >>> ',cog2
440     c$$$ endif
441    
442    
443     iadd=0
444     10 continue
445     if(cog3.lt.eta3(1,iang))then
446     cog3 = cog3 + 1
447     iadd = iadd + 1
448     goto 10
449     endif
450     20 continue
451     if(cog3.gt.eta3(netaval,iang))then
452     cog3 = cog3 - 1
453     iadd = iadd - 1
454     goto 20
455     endif
456    
457     * --------------------------------
458     c print*,'*****',i,view,lad,iang,'------> cog2 ',cog2
459     do i=2,netaval
460     if(eta3(i,iang).gt.cog3)then
461    
462     x1 = eta3(i-1,iang)
463     x2 = eta3(i,iang)
464     y1 = feta3(i-1,iview,lad,iang)
465     y2 = feta3(i,iview,lad,iang)
466    
467     c print*,'*****',i,view,lad,iang
468     c print*,'-----',x1,x2,y1,y2
469     goto 99
470     endif
471     enddo
472     99 continue
473    
474    
475     AA=(y2-y1)/(x2-x1)
476     BB=y1-AA*x1
477    
478 pam-fi 1.4 pfaeta3 = AA*cog3+BB
479     pfaeta3 = pfaeta3 - iadd
480 mocchiut 1.1
481     c$$$ if(iflag.eq.1)then
482 pam-fi 1.4 c$$$ pfaeta2=pfaeta2-1. !temp
483 mocchiut 1.1 c$$$ cog2=cog2-1. !temp
484     c$$$ endif
485     c$$$ if(iflag.eq.-1)then
486 pam-fi 1.4 c$$$ pfaeta2=pfaeta2+1. !temp
487 mocchiut 1.1 c$$$ cog2=cog2+1. !temp
488     c$$$ endif
489    
490     if(DEBUG)print*,'ETA3 (ic ',ic,' ang',angle,')'
491 pam-fi 1.4 $ ,cog3-iadd,' -->',pfaeta3
492 mocchiut 1.1
493     100 return
494     end
495    
496     *** * * * *** * * * *** * * * *** * * * *** * * * *** * * * ***
497 pam-fi 1.9 real function pfaeta4(ic,angle)
498 mocchiut 1.1 *--------------------------------------------------------------
499     * this function returns
500     *
501     * - the position (in strip units)
502     * corrected according to the ETA4 Position Finding Algorithm.
503     * The function performs an interpolation of FETA3%ETA3
504     *
505     * - if the angle is out of range, the calibration parameters
506     * of the lowest or higher bin are used
507     *
508     *--------------------------------------------------------------
509     include 'commontracker.f'
510     include 'calib.f'
511     include 'level1.f'
512    
513     real cog4,angle
514     integer iview,lad
515    
516 pam-fi 1.6
517 pam-fi 1.9 iview = VIEW(ic)
518     lad = nld(MAXS(ic),VIEW(ic))
519     cog4=cog(4,ic)
520 pam-fi 1.4 pfaeta4=cog4
521 mocchiut 1.1
522     * find angular bin
523     * (in futuro possiamo pensare di interpolare anche sull'angolo)
524     do iang=1,nangbin
525     c print*,'~~~~~~~~~~~~ ',iang,angL(iang),angR(iang),angle
526     if(angL(iang).lt.angle.and.angR(iang).ge.angle)then
527     iangle=iang
528     goto 98
529     endif
530     enddo
531     if(DEBUG)
532 pam-fi 1.4 $ print*,'pfaeta4 *** warning *** angle out of range: ',angle
533 mocchiut 1.1 if(angle.lt.angL(1))iang=1
534     if(angle.gt.angR(nangbin))iang=nangbin
535     98 continue !jump here if ok
536    
537    
538     c$$$* find extremes of interpolation
539     c$$$ iflag=0
540     c$$$* --------------------------------
541     c$$$ if(cog3.lt.eta3(1,iang).or.cog3.gt.eta3(netaval,iang))then
542     c$$$* ----------------------------------------------
543     c$$$* non salto piu`, ma scalo di 1 o -1
544     c$$$* nel caso si tratti di un cluster
545     c$$$* in cui la strip con il segnale massimo non coincide
546     c$$$* con la strip con il rapposto s/n massimo!!!
547     c$$$* ----------------------------------------------
548     c$$$ if(cog2.lt.eta2(1,iang))then !temp
549     c$$$ cog2=cog2+1. !temp
550     c$$$ iflag=1 !temp
551     c$$$ else !temp
552     c$$$ cog2=cog2-1. !temp
553     c$$$ iflag=-1 !temp
554     c$$$ endif !temp
555     c$$$c print*,'shifted >>> ',cog2
556     c$$$ endif
557    
558    
559     iadd=0
560     10 continue
561     if(cog4.lt.eta4(1,iang))then
562     cog4 = cog4 + 1
563     iadd = iadd + 1
564     goto 10
565     endif
566     20 continue
567     if(cog4.gt.eta4(netaval,iang))then
568     cog4 = cog4 - 1
569     iadd = iadd - 1
570     goto 20
571     endif
572    
573     * --------------------------------
574     c print*,'*****',i,view,lad,iang,'------> cog2 ',cog2
575     do i=2,netaval
576     if(eta4(i,iang).gt.cog4)then
577    
578     x1 = eta4(i-1,iang)
579     x2 = eta4(i,iang)
580     y1 = feta4(i-1,iview,lad,iang)
581     y2 = feta4(i,iview,lad,iang)
582    
583     c print*,'*****',i,view,lad,iang
584     c print*,'-----',x1,x2,y1,y2
585     goto 99
586     endif
587     enddo
588     99 continue
589    
590    
591     AA=(y2-y1)/(x2-x1)
592     BB=y1-AA*x1
593    
594 pam-fi 1.4 pfaeta4 = AA*cog4+BB
595     pfaeta4 = pfaeta4 - iadd
596 mocchiut 1.1
597     c$$$ if(iflag.eq.1)then
598 pam-fi 1.4 c$$$ pfaeta2=pfaeta2-1. !temp
599 mocchiut 1.1 c$$$ cog2=cog2-1. !temp
600     c$$$ endif
601     c$$$ if(iflag.eq.-1)then
602 pam-fi 1.4 c$$$ pfaeta2=pfaeta2+1. !temp
603 mocchiut 1.1 c$$$ cog2=cog2+1. !temp
604     c$$$ endif
605    
606     if(DEBUG)print*,'ETA4 (ic ',ic,' ang',angle,')'
607 pam-fi 1.4 $ ,cog4-iadd,' -->',pfaeta4
608 mocchiut 1.1
609     100 return
610     end
611    
612    
613    
614     *** * * * *** * * * *** * * * *** * * * *** * * * *** * * * ***
615     real function cog0(ncog,ic)
616     *-------------------------------------------------
617     * this function returns
618     *
619     * - the Center-Of-Gravity of the cluster IC
620     * evaluated using NCOG strips,
621     * calculated relative to MAXS(IC)
622     *
623     * - zero in case that not enough strips
624     * have a positive signal
625     *
626     * NOTE:
627     * This is the old definition, used by Straulino.
628     * The new routine, according to Landi,
629     * is COG(NCOG,IC)
630     *-------------------------------------------------
631    
632    
633     include 'commontracker.f'
634     include 'level1.f'
635    
636     * --> signal of the central strip
637     sc = CLSIGNAL(INDMAX(ic)) !center
638    
639     * signal of adjacent strips
640     * --> left
641     sl1 = 0 !left 1
642     if(
643     $ (INDMAX(ic)-1).ge.INDSTART(ic)
644     $ )
645     $ sl1 = max(0.,CLSIGNAL(INDMAX(ic)-1))
646    
647     sl2 = 0 !left 2
648     if(
649     $ (INDMAX(ic)-2).ge.INDSTART(ic)
650     $ )
651     $ sl2 = max(0.,CLSIGNAL(INDMAX(ic)-2))
652    
653     * --> right
654     sr1 = 0 !right 1
655     if(
656     $ (ic.ne.NCLSTR1.and.(INDMAX(ic)+1).lt.INDSTART(ic+1))
657     $ .or.
658     $ (ic.eq.NCLSTR1.and.(INDMAX(ic)+1).le.TOTCLLENGTH)
659     $ )
660     $ sr1 = max(0.,CLSIGNAL(INDMAX(ic)+1))
661    
662     sr2 = 0 !right 2
663     if(
664     $ (ic.ne.NCLSTR1.and.(INDMAX(ic)+2).lt.INDSTART(ic+1))
665     $ .or.
666     $ (ic.eq.NCLSTR1.and.(INDMAX(ic)+2).le.TOTCLLENGTH)
667     $ )
668     $ sr2 = max(0.,CLSIGNAL(INDMAX(ic)+2))
669    
670     ************************************************************
671     * COG computation
672     ************************************************************
673    
674     c print*,sl2,sl1,sc,sr1,sr2
675    
676     COG = 0.
677    
678     if(sl1.gt.sr1.and.sl1.gt.0.)then
679    
680     if(ncog.eq.2.and.sl1.ne.0)then
681     COG = -sl1/(sl1+sc)
682     elseif(ncog.eq.3.and.sl1.ne.0.and.sr1.ne.0)then
683     COG = (sr1-sl1)/(sl1+sc+sr1)
684     elseif(ncog.eq.4.and.sl1.ne.0.and.sr1.ne.0.and.sl2.ne.0)then
685     COG = (sr1-sl1-2*sl2)/(sl2+sl1+sc+sr1)
686     else
687     COG = 0.
688     endif
689    
690     elseif(sl1.le.sr1.and.sr1.gt.0.)then
691    
692     if(ncog.eq.2.and.sr1.ne.0)then
693     COG = sr1/(sc+sr1)
694     elseif(ncog.eq.3.and.sr1.ne.0.and.sl1.ne.0)then
695     COG = (sr1-sl1)/(sl1+sc+sr1)
696     elseif(ncog.eq.4.and.sr1.ne.0.and.sl1.ne.0.and.sr2.ne.0)then
697     COG = (2*sr2+sr1-sl1)/(sl2+sl1+sc+sr1)
698     else
699     COG = 0.
700     endif
701    
702     endif
703    
704     COG0 = COG
705    
706     c print *,ncog,ic,cog,'/////////////'
707    
708     return
709     end
710    
711     *** * * * *** * * * *** * * * *** * * * *** * * * *** * * * ***
712     real function cog(ncog,ic)
713     *-------------------------------------------------
714     * this function returns
715     *
716     * - if NCOG=0, the Center-Of-Gravity of the
717     * cluster IC, relative to MAXS(IC), according to
718     * the cluster multiplicity
719     *
720     * - if NCOG>0, the Center-Of-Gravity of the cluster IC
721     * evaluated using NCOG strips, even if they have a
722     * negative signal (according to Landi)
723     *
724     *-------------------------------------------------
725    
726    
727     include 'commontracker.f'
728     include 'calib.f'
729     include 'level1.f'
730    
731    
732    
733     if (ncog.gt.0) then
734     * ===========================
735     * ETA2 ETA3 ETA4 computation
736     * ===========================
737    
738     * --> signal of the central strip
739     sc = CLSIGNAL(INDMAX(ic)) !center
740     * signal of adjacent strips
741     sl1 = 0 !left 1
742     if(
743     $ (INDMAX(ic)-1).ge.INDSTART(ic)
744     $ )
745     $ sl1 = CLSIGNAL(INDMAX(ic)-1)
746    
747     sl2 = 0 !left 2
748     if(
749     $ (INDMAX(ic)-2).ge.INDSTART(ic)
750     $ )
751     $ sl2 = CLSIGNAL(INDMAX(ic)-2)
752    
753     sr1 = 0 !right 1
754     if(
755     $ (ic.ne.NCLSTR1.and.(INDMAX(ic)+1).lt.INDSTART(ic+1))
756     $ .or.
757     $ (ic.eq.NCLSTR1.and.(INDMAX(ic)+1).le.TOTCLLENGTH)
758     $ )
759     $ sr1 = CLSIGNAL(INDMAX(ic)+1)
760    
761     sr2 = 0 !right 2
762     if(
763     $ (ic.ne.NCLSTR1.and.(INDMAX(ic)+2).lt.INDSTART(ic+1))
764     $ .or.
765     $ (ic.eq.NCLSTR1.and.(INDMAX(ic)+2).le.TOTCLLENGTH)
766     $ )
767     $ sr2 = CLSIGNAL(INDMAX(ic)+2)
768    
769     COG = 0.
770    
771 pam-fi 1.6 c print*,'## ',sl2,sl1,sc,sr1,sr2
772    
773 pam-fi 1.4 if(ncog.eq.1)then
774     COG = 0.
775     elseif(ncog.eq.2)then
776 mocchiut 1.1 if(sl1.gt.sr1)then
777 pam-fi 1.6 if((sl1+sc).ne.0)COG = -sl1/(sl1+sc)
778 mocchiut 1.1 elseif(sl1.le.sr1)then
779 pam-fi 1.6 if((sc+sr1).ne.0)COG = sr1/(sc+sr1)
780 mocchiut 1.1 endif
781     elseif(ncog.eq.3)then
782 pam-fi 1.6 if((sl1+sc+sr1).ne.0)COG = (sr1-sl1)/(sl1+sc+sr1)
783 mocchiut 1.1 elseif(ncog.eq.4)then
784     if(sl2.gt.sr2)then
785 pam-fi 1.6 if((sl2+sl1+sc+sr1).ne.0)
786     $ COG = (sr1-sl1-2*sl2)/(sl2+sl1+sc+sr1)
787 mocchiut 1.1 elseif(sl2.le.sr2)then
788 pam-fi 1.12 if((sr2+sl1+sc+sr1).ne.0)
789     $ COG = (2*sr2+sr1-sl1)/(sr2+sl1+sc+sr1)
790 mocchiut 1.1 endif
791     else
792     print*,'function COG(NCOG,IC) ==> WARNING!! NCOG=',NCOG
793 pam-fi 1.7 $ ,' not implemented'
794 mocchiut 1.1 COG = 0.
795     endif
796    
797     c print*,'NCOG ',ncog,ic,' @@@ ',sl1,sc,sr1,' @@@ ',cog
798    
799     elseif(ncog.eq.0)then
800     * =========================
801     * COG computation
802     * =========================
803    
804     iv=VIEW(ic)
805     if(mod(iv,2).eq.1)incut=incuty
806     if(mod(iv,2).eq.0)incut=incutx
807 pam-fi 1.3 istart = INDSTART(IC)
808     istop = TOTCLLENGTH
809 mocchiut 1.1 if(ic.lt.NCLSTR1)istop=INDSTART(IC+1)-1
810 pam-fi 1.3 COG = 0
811 pam-fi 1.9 SGN = 0.
812 pam-fi 1.3 mu = 0
813 pam-fi 1.9 c print*,'-------'
814     do i = INDMAX(IC),istart,-1
815     ipos = i-INDMAX(ic)
816     cut = incut*CLSIGMA(i)
817     if(CLSIGNAL(i).ge.cut)then
818     COG = COG + ipos*CLSIGNAL(i)
819     SGN = SGN + CLSIGNAL(i)
820     mu = mu + 1
821 pam-fi 1.12 c print*,ipos,CLSIGNAL(i)
822 pam-fi 1.9 else
823     goto 10
824     endif
825     enddo
826     10 continue
827     do i = INDMAX(IC)+1,istop
828 pam-fi 1.3 ipos = i-INDMAX(ic)
829 pam-fi 1.4 cut = incut*CLSIGMA(i)
830 mocchiut 1.1 if(CLSIGNAL(i).ge.cut)then
831     COG = COG + ipos*CLSIGNAL(i)
832 pam-fi 1.9 SGN = SGN + CLSIGNAL(i)
833 mocchiut 1.1 mu = mu + 1
834 pam-fi 1.12 c print*,ipos,CLSIGNAL(i)
835 pam-fi 1.9 else
836     goto 20
837 mocchiut 1.1 endif
838     enddo
839 pam-fi 1.9 20 continue
840     if(SGN.le.0)then
841 pam-fi 1.12 print*,'cog(0,ic) --> ic, dedx ',ic,SGN
842 pam-fi 1.3 print*,(CLSIGNAL(i)/CLSIGMA(i),i=istart,istop)
843     print*,(CLSIGNAL(i),i=istart,istop)
844 pam-fi 1.9 c print*,'cog(0,ic) --> NOT EVALUATED '
845 pam-fi 1.3 else
846 pam-fi 1.9 COG=COG/SGN
847 pam-fi 1.3 endif
848 pam-fi 1.9 c print*,'-------'
849 mocchiut 1.1
850     else
851    
852     COG=0
853     print*,'function COG(NCOG,IC) ==> WARNING!! NCOG=',NCOG
854     print*,' (NCOG must be >= 0)'
855    
856    
857     endif
858    
859 pam-fi 1.6 c print *,'## cog ',ncog,ic,cog,'/////////////'
860 mocchiut 1.1
861     return
862     end
863    
864     *** * * * *** * * * *** * * * *** * * * *** * * * *** * * * ***
865 pam-fi 1.9
866 mocchiut 1.1 real function fbad_cog(ncog,ic)
867     *-------------------------------------------------------
868     * this function returns a factor that takes into
869     * account deterioration of the spatial resolution
870     * in the case BAD strips are included in the cluster.
871     * This factor should multiply the nominal spatial
872     * resolution.
873     *
874     *-------------------------------------------------------
875    
876     include 'commontracker.f'
877     include 'level1.f'
878     include 'calib.f'
879    
880     if(mod(int(VIEW(ic)),2).eq.1)then !Y-view
881 pam-fi 1.9 si = 8.4 !average good-strip noise
882     f = 4. !average bad-strip noise: f*si
883 mocchiut 1.1 incut=incuty
884     else !X-view
885 pam-fi 1.9 si = 3.9 !average good-strip noise
886     f = 6. !average bad-strip noise: f*si
887 mocchiut 1.1 incut=incutx
888     endif
889    
890     fbad_cog = 1.
891    
892     if (ncog.gt.0) then
893    
894     * --> signal of the central strip
895     sc = CLSIGNAL(INDMAX(ic)) !center
896     fsc = 1
897 pam-fi 1.9 c if( CLBAD(INDMAX(ic)).eq.0 )fsc=f
898     fsc = clsigma(INDMAX(ic))/si
899 mocchiut 1.1 * --> signal of adjacent strips
900     sl1 = 0 !left 1
901     fsl1 = 1 !left 1
902     if(
903     $ (INDMAX(ic)-1).ge.INDSTART(ic)
904     $ )then
905     sl1 = CLSIGNAL(INDMAX(ic)-1)
906 pam-fi 1.9 c if( CLBAD(INDMAX(ic)-1).eq.0)fsl1=f
907     fsl1 = clsigma(INDMAX(ic)-1)/si
908 mocchiut 1.1 endif
909    
910     sl2 = 0 !left 2
911     fsl2 = 1 !left 2
912     if(
913     $ (INDMAX(ic)-2).ge.INDSTART(ic)
914     $ )then
915     sl2 = CLSIGNAL(INDMAX(ic)-2)
916 pam-fi 1.9 c if(CLBAD(INDMAX(ic)-2).eq.0)fsl2=f
917     fsl2 = clsigma(INDMAX(ic)-2)/si
918 mocchiut 1.1 endif
919     sr1 = 0 !right 1
920     fsr1 = 1 !right 1
921     if(
922     $ (ic.ne.NCLSTR1.and.(INDMAX(ic)+1).lt.INDSTART(ic+1))
923     $ .or.
924     $ (ic.eq.NCLSTR1.and.(INDMAX(ic)+1).le.TOTCLLENGTH)
925     $ )then
926     sr1 = CLSIGNAL(INDMAX(ic)+1)
927 pam-fi 1.9 c if(CLBAD(INDMAX(ic)+1).eq.0)fsr1=f
928     fsr1 = clsigma(INDMAX(ic)+1)/si
929 mocchiut 1.1 endif
930     sr2 = 0 !right 2
931     fsr2 = 1 !right 2
932     if(
933     $ (ic.ne.NCLSTR1.and.(INDMAX(ic)+2).lt.INDSTART(ic+1))
934     $ .or.
935     $ (ic.eq.NCLSTR1.and.(INDMAX(ic)+2).le.TOTCLLENGTH)
936     $ )then
937     sr2 = CLSIGNAL(INDMAX(ic)+2)
938 pam-fi 1.9 c if(CLBAD(INDMAX(ic)+2).eq.0)fsr2=f
939     fsr2 = clsigma(INDMAX(ic)+2)/si
940 mocchiut 1.1 endif
941    
942    
943    
944     ************************************************************
945 pam-fi 1.9 * COG2-3-4 computation
946 mocchiut 1.1 ************************************************************
947    
948     c print*,sl2,sl1,sc,sr1,sr2
949    
950 pam-fi 1.9 vCOG = cog(ncog,ic)!0.
951 mocchiut 1.1
952     if(ncog.eq.2)then
953     if(sl1.gt.sr1)then
954 pam-fi 1.9 c COG = -sl1/(sl1+sc)
955     fbad_cog = (fsl1*(-1-vCOG)**2+fsc*(-vCOG)**2)
956     fbad_cog = fbad_cog / ((-1-vCOG)**2+(-vCOG)**2)
957 mocchiut 1.1 elseif(sl1.le.sr1)then
958 pam-fi 1.9 c COG = sr1/(sc+sr1)
959     fbad_cog = (fsc*(-vCOG)**2+fsr1*(1-vCOG)**2)
960     fbad_cog = fbad_cog / ((-vCOG)**2+(1-vCOG)**2)
961 mocchiut 1.1 endif
962     elseif(ncog.eq.3)then
963 pam-fi 1.9 c COG = (sr1-sl1)/(sl1+sc+sr1)
964 mocchiut 1.1 fbad_cog =
965 pam-fi 1.9 $ (fsl1*(-1-vCOG)**2+fsc*(-vCOG)**2+fsr1*(1-vCOG)**2)
966 mocchiut 1.1 fbad_cog =
967 pam-fi 1.9 $ fbad_cog / ((-1-vCOG)**2+(-vCOG)**2+(1-vCOG)**2)
968 mocchiut 1.1 elseif(ncog.eq.4)then
969     if(sl2.gt.sr2)then
970 pam-fi 1.9 c COG = (sr1-sl1-2*sl2)/(sl2+sl1+sc+sr1)
971 mocchiut 1.1 fbad_cog =
972 pam-fi 1.9 $ (fsl2*(-2-vCOG)**2+fsl1*(-1-vCOG)**2
973     $ +fsc*(-vCOG)**2+fsr1*(1-vCOG)**2)
974 mocchiut 1.1 fbad_cog =
975 pam-fi 1.9 $ fbad_cog / ((-2-vCOG)**2+(-1-vCOG)**2
976     $ +(-vCOG)**2+(1-vCOG)**2)
977 mocchiut 1.1 elseif(sl2.le.sr2)then
978 pam-fi 1.9 c COG = (2*sr2+sr1-sl1)/(sl2+sl1+sc+sr1)
979 mocchiut 1.1 fbad_cog =
980 pam-fi 1.9 $ (fsl1*(-1-vCOG)**2
981     $ +fsc*(-vCOG)**2+fsr1*(1-vCOG)**2+fsr2*(2-vCOG)**2)
982 mocchiut 1.1 fbad_cog =
983 pam-fi 1.9 $ fbad_cog / ((-1-vCOG)**2
984     $ +(-vCOG)**2+(1-vCOG)**2+(2-vCOG)**2)
985 mocchiut 1.1 endif
986     else
987     print*,'function FBAD_COG(NCOG,IC) ==> WARNING!! NCOG=',NCOG
988     print*,' (NCOG must be <= 4)'
989 pam-fi 1.9 c COG = 0.
990 mocchiut 1.1 endif
991    
992     elseif(ncog.eq.0)then
993 pam-fi 1.9 * =========================
994     * COG computation
995     * =========================
996    
997     vCOG = cog(0,ic)
998 mocchiut 1.1
999 pam-fi 1.9 iv = VIEW(ic)
1000     istart = INDSTART(IC)
1001     istop = TOTCLLENGTH
1002     if(ic.lt.NCLSTR1)istop = INDSTART(IC+1)-1
1003     SGN = 0.
1004     SNU = 0.
1005     SDE = 0.
1006     c$$$ do i=INDMAX(IC),istart,-1
1007     c$$$ ipos = i-INDMAX(ic)
1008     c$$$ cut = incut*CLSIGMA(i)
1009     c$$$ if(CLSIGNAL(i).gt.cut)then
1010     c$$$ COG = COG + ipos*CLSIGNAL(i)
1011     c$$$ SGN = SGN + CLSIGNAL(i)
1012     c$$$ else
1013     c$$$ goto 10
1014     c$$$ endif
1015     c$$$ enddo
1016     c$$$ 10 continue
1017     c$$$ do i=INDMAX(IC)+1,istop
1018     c$$$ ipos = i-INDMAX(ic)
1019     c$$$ cut = incut*CLSIGMA(i)
1020     c$$$ if(CLSIGNAL(i).gt.cut)then
1021     c$$$ COG = COG + ipos*CLSIGNAL(i)
1022     c$$$ SGN = SGN + CLSIGNAL(i)
1023     c$$$ else
1024     c$$$ goto 20
1025     c$$$ endif
1026     c$$$ enddo
1027     c$$$ 20 continue
1028     c$$$ if(SGN.le.0)then
1029     c$$$ print*,'fbad_cog(0,ic) --> ic, dedx ',ic,SGN
1030     c$$$ print*,(CLSIGNAL(i)/CLSIGMA(i),i=istart,istop)
1031     c$$$ print*,(CLSIGNAL(i),i=istart,istop)
1032     c$$$ print*,'fbad_cog(0,ic) --> NOT EVALUATED '
1033     c$$$ else
1034     c$$$ COG=COG/SGN
1035     c$$$ endif
1036    
1037     do i=INDMAX(IC),istart,-1
1038     ipos = i-INDMAX(ic)
1039     cut = incut*CLSIGMA(i)
1040 mocchiut 1.1 if(CLSIGNAL(i).gt.cut)then
1041 pam-fi 1.9 fs = clsigma(i)/si
1042     SNU = SNU + fs*(ipos-vCOG)**2
1043     SDE = SDE + (ipos-vCOG)**2
1044     else
1045     goto 10
1046     endif
1047 mocchiut 1.1 enddo
1048 pam-fi 1.9 10 continue
1049     do i=INDMAX(IC)+1,istop
1050     ipos = i-INDMAX(ic)
1051     cut = incut*CLSIGMA(i)
1052 mocchiut 1.1 if(CLSIGNAL(i).gt.cut)then
1053 pam-fi 1.9 fs = clsigma(i)/si
1054     SNU = SNU + fs*(ipos-vCOG)**2
1055     SDE = SDE + (ipos-vCOG)**2
1056     else
1057     goto 20
1058 mocchiut 1.1 endif
1059     enddo
1060 pam-fi 1.9 20 continue
1061     if(SDE.ne.0)then
1062     FBAD_COG=SNU/SDE
1063     else
1064    
1065     endif
1066 mocchiut 1.1
1067     else
1068    
1069     FBAD_COG=0
1070     print*,'function FBAD_COG(NCOG,IC) ==> WARNING!! NCOG=',NCOG
1071     print*,' (NCOG must be >= 0)'
1072    
1073    
1074     endif
1075    
1076    
1077     fbad_cog = sqrt(fbad_cog)
1078    
1079     return
1080     end
1081    
1082    
1083     *** * * * *** * * * *** * * * *** * * * *** * * * *** * * * ***
1084     real function fbad_cog0(ncog,ic)
1085     *-------------------------------------------------------
1086     * this function returns a factor that takes into
1087     * account deterioration of the spatial resolution
1088     * in the case BAD strips are included in the cluster.
1089     * This factor should multiply the nominal spatial
1090     * resolution.
1091     *
1092     * NB!!!
1093     * (this is the old version. It consider only the two
1094     * strips with the greatest signal. The new one is
1095     * fbad_cog(ncog,ic) )
1096     *
1097     *-------------------------------------------------------
1098    
1099     include 'commontracker.f'
1100     include 'level1.f'
1101     include 'calib.f'
1102    
1103     * --> signal of the central strip
1104     sc = CLSIGNAL(INDMAX(ic)) !center
1105    
1106     * signal of adjacent strips
1107     * --> left
1108     sl1 = 0 !left 1
1109     if(
1110     $ (INDMAX(ic)-1).ge.INDSTART(ic)
1111     $ )
1112     $ sl1 = max(0.,CLSIGNAL(INDMAX(ic)-1))
1113    
1114     sl2 = 0 !left 2
1115     if(
1116     $ (INDMAX(ic)-2).ge.INDSTART(ic)
1117     $ )
1118     $ sl2 = max(0.,CLSIGNAL(INDMAX(ic)-2))
1119    
1120     * --> right
1121     sr1 = 0 !right 1
1122     if(
1123     $ (ic.ne.NCLSTR1.and.(INDMAX(ic)+1).lt.INDSTART(ic+1))
1124     $ .or.
1125     $ (ic.eq.NCLSTR1.and.(INDMAX(ic)+1).le.TOTCLLENGTH)
1126     $ )
1127     $ sr1 = max(0.,CLSIGNAL(INDMAX(ic)+1))
1128    
1129     sr2 = 0 !right 2
1130     if(
1131     $ (ic.ne.NCLSTR1.and.(INDMAX(ic)+2).lt.INDSTART(ic+1))
1132     $ .or.
1133     $ (ic.eq.NCLSTR1.and.(INDMAX(ic)+2).le.TOTCLLENGTH)
1134     $ )
1135     $ sr2 = max(0.,CLSIGNAL(INDMAX(ic)+2))
1136    
1137    
1138     if(mod(int(VIEW(ic)),2).eq.1)then !Y-view
1139     f = 4.
1140     si = 8.4
1141     else !X-view
1142     f = 6.
1143     si = 3.9
1144     endif
1145    
1146     fbad_cog = 1.
1147     f0 = 1
1148     f1 = 1
1149     f2 = 1
1150     f3 = 1
1151     if(sl1.gt.sr1.and.sl1.gt.0.)then
1152    
1153     if(BAD(VIEW(ic),nvk(MAXS(ic)),nst(MAXS(ic)) ).eq.0)f0=f
1154     if(BAD(VIEW(ic),nvk(MAXS(ic)),nst(MAXS(ic)-1)).eq.0)f1=f
1155     c if(BAD(VIEW(ic),nvk(MAXS(ic)),nst(MAXS(ic)+1)).eq.0)f3=f
1156    
1157     if(ncog.eq.2.and.sl1.ne.0)then
1158     fbad_cog = (f1**2*sc**2/sl1**2+f0**2)/(sc**2/sl1**2+1.)
1159     elseif(ncog.eq.3.and.sl1.ne.0.and.sr1.ne.0)then
1160     fbad_cog = 1.
1161     elseif(ncog.eq.4.and.sl1.ne.0.and.sr1.ne.0.and.sl2.ne.0)then
1162     fbad_cog = 1.
1163     else
1164     fbad_cog = 1.
1165     endif
1166    
1167     elseif(sl1.le.sr1.and.sr1.gt.0.)then
1168    
1169    
1170     if(BAD(VIEW(ic),nvk(MAXS(ic)),nst(MAXS(ic)) ).eq.0)f0=f
1171     if(BAD(VIEW(ic),nvk(MAXS(ic)),nst(MAXS(ic)+1)).eq.0)f1=f
1172     c if(BAD(VIEW(ic),nvk(MAXS(ic)),nst(MAXS(ic)-1)).eq.0)f3=f
1173    
1174     if(ncog.eq.2.and.sr1.ne.0)then
1175     fbad_cog = (f1**2*sc**2/sr1**2+f0**2)/(sc**2/sr1**2+1.)
1176     elseif(ncog.eq.3.and.sr1.ne.0.and.sl1.ne.0)then
1177     fbad_cog = 1.
1178     elseif(ncog.eq.4.and.sr1.ne.0.and.sl1.ne.0.and.sr2.ne.0)then
1179     fbad_cog = 1.
1180     else
1181     fbad_cog = 1.
1182     endif
1183    
1184     endif
1185    
1186     fbad_cog0 = sqrt(fbad_cog)
1187    
1188     return
1189     end
1190    
1191    
1192    
1193    
1194     *** * * * *** * * * *** * * * *** * * * *** * * * *** * * * ***
1195    
1196     FUNCTION risx_eta2(x)
1197    
1198     DOUBLE PRECISION V( 1)
1199     INTEGER NPAR, NDIM, IMQFUN, I, J
1200     DOUBLE PRECISION HQDJ, VV, VCONST
1201     DOUBLE PRECISION SIGVMI( 1), SIGVT( 1)
1202     DOUBLE PRECISION SIGV( 18, 1)
1203     DOUBLE PRECISION SIGDEL( 18)
1204     DOUBLE PRECISION SIGA( 18)
1205     DATA NPAR, NDIM, IMQFUN / 18, 1, 1/
1206     DATA VCONST / 0.000000000000 /
1207     DATA SIGVMI / -20.50000000000 /
1208     DATA SIGVT / 41.00000000000 /
1209     DATA SIGV / 0.6097560748458E-01
1210     +, 0.1097560971975
1211     +, 0.1341463327408
1212     +, 0.1829268187284
1213     +, 0.2317073047161
1214     +, 0.4268292486668
1215     +, 0.4756097495556
1216     +, 0.4999999701977
1217     +, 0.5243902206421
1218     +, 0.5731707215309
1219     +, 0.7682926654816
1220     +, 0.8170731663704
1221     +, 0.8658536076546
1222     +, 0.8902438879013
1223     +, 0.9390243291855
1224     +, 0.000000000000
1225     +, 1.000000000000
1226     +, 0.3658536374569
1227     +/
1228     DATA SIGDEL / 0.4878048598766E-01
1229     +, 0.4878048598766E-01
1230     +, 0.4878048598766E-01
1231     +, 0.4878048598766E-01
1232     +, 0.4878048598766E-01
1233     +, 0.4878048598766E-01
1234     +, 0.4878048598766E-01
1235     +, 0.4878048598766E-01
1236     +, 0.4878048598766E-01
1237     +, 0.4878048598766E-01
1238     +, 0.4878048598766E-01
1239     +, 0.4878048598766E-01
1240     +, 0.4878048598766E-01
1241     +, 0.4878048598766E-01
1242     +, 0.4878048598766E-01
1243     +, 0.1999999994950E-05
1244     +, 0.1999999994950E-05
1245     +, 0.9756097197533E-01
1246     +/
1247     DATA SIGA / 51.65899502118
1248     +, -150.4733247841
1249     +, 143.0468613786
1250     +, -16.56096738997
1251     +, 5.149319798083
1252     +, 21.57149712673
1253     +, -39.46652322782
1254     +, 47.13181632948
1255     +, -32.93197883680
1256     +, 16.38645317092
1257     +, 1.453688482992
1258     +, -10.00547244421
1259     +, 131.3517670587
1260     +, -140.6351538257
1261     +, 49.05515749582
1262     +, -23.00028974788
1263     +, -22.58470403729
1264     +, -3.824682486418
1265     +/
1266    
1267     V(1)= abs(x)
1268 pam-fi 1.9 if(V(1).gt.20.)V(1)=20.
1269 mocchiut 1.1
1270     HQUADF = 0.
1271     DO 20 J = 1, NPAR
1272     HQDJ = 0.
1273     DO 10 I = 1, NDIM
1274     VV = (V (I) - SIGVMI (I)) / SIGVT (I)
1275     HQDJ = HQDJ + (VV - SIGV (J, I)) ** 2
1276     10 CONTINUE
1277     HQDJ = HQDJ + SIGDEL (J) ** 2
1278     HQDJ = SQRT (HQDJ)
1279     HQUADF = HQUADF + SIGA (J) * HQDJ
1280     20 CONTINUE
1281     IF (IMQFUN .EQ. 2) HQUADF = VCONST * EXP (HQUADF)
1282    
1283     risx_eta2=HQUADF* 1e-4
1284    
1285     END
1286    
1287     *** * * * *** * * * *** * * * *** * * * *** * * * *** * * * ***
1288     FUNCTION risx_eta3(x)
1289     DOUBLE PRECISION V( 1)
1290     INTEGER NPAR, NDIM, IMQFUN, I, J
1291     DOUBLE PRECISION HQDJ, VV, VCONST
1292     DOUBLE PRECISION SIGVMI( 1), SIGVT( 1)
1293     DOUBLE PRECISION SIGV( 18, 1)
1294     DOUBLE PRECISION SIGDEL( 18)
1295     DOUBLE PRECISION SIGA( 18)
1296     DATA NPAR, NDIM, IMQFUN / 18, 1, 1/
1297     DATA VCONST / 0.000000000000 /
1298     DATA SIGVMI / -20.50000000000 /
1299     DATA SIGVT / 41.00000000000 /
1300     DATA SIGV / 0.6097560748458E-01
1301     +, 0.1097560971975
1302     +, 0.1341463327408
1303     +, 0.1829268187284
1304     +, 0.2317073047161
1305     +, 0.4756097495556
1306     +, 0.4999999701977
1307     +, 0.5243902206421
1308     +, 0.7682926654816
1309     +, 0.8170731663704
1310     +, 0.8658536076546
1311     +, 0.8902438879013
1312     +, 0.9390243291855
1313     +, 0.000000000000
1314     +, 1.000000000000
1315     +, 0.3658536374569
1316     +, 0.4146341383457
1317     +, 0.6097560524940
1318     +/
1319     DATA SIGDEL / 0.4878048598766E-01
1320     +, 0.4878048598766E-01
1321     +, 0.4878048598766E-01
1322     +, 0.4878048598766E-01
1323     +, 0.4878048598766E-01
1324     +, 0.4878048598766E-01
1325     +, 0.4878048598766E-01
1326     +, 0.4878048598766E-01
1327     +, 0.4878048598766E-01
1328     +, 0.4878048598766E-01
1329     +, 0.4878048598766E-01
1330     +, 0.4878048598766E-01
1331     +, 0.4878048598766E-01
1332     +, 0.1999999994950E-05
1333     +, 0.1999999994950E-05
1334     +, 0.9756097197533E-01
1335     +, 0.9756097197533E-01
1336     +, 0.9756097197533E-01
1337     +/
1338     DATA SIGA / 55.18284054458
1339     +, -160.3358431242
1340     +, 144.6939185763
1341     +, -20.45200854118
1342     +, 5.223570087108
1343     +,-0.4171476953945
1344     +, -27.67911907462
1345     +, 17.70327157495
1346     +, -1.867165491707
1347     +, -8.884458169181
1348     +, 124.3526608791
1349     +, -143.3309398345
1350     +, 50.80345027122
1351     +, -16.44454904415
1352     +, -15.73785568450
1353     +, -22.71810502561
1354     +, 36.86170101430
1355     +, 2.437918198452
1356     +/
1357    
1358     V(1) = abs(x)
1359 pam-fi 1.9 if(V(1).gt.20.)V(1)=20.
1360    
1361 mocchiut 1.1 HQUADF = 0.
1362     DO 20 J = 1, NPAR
1363     HQDJ = 0.
1364     DO 10 I = 1, NDIM
1365     VV = (V (I) - SIGVMI (I)) / SIGVT (I)
1366     HQDJ = HQDJ + (VV - SIGV (J, I)) ** 2
1367     10 CONTINUE
1368     HQDJ = HQDJ + SIGDEL (J) ** 2
1369     HQDJ = SQRT (HQDJ)
1370     HQUADF = HQUADF + SIGA (J) * HQDJ
1371     20 CONTINUE
1372     IF (IMQFUN .EQ. 2) HQUADF = VCONST * EXP (HQUADF)
1373    
1374     risx_eta3 = HQUADF* 1e-4
1375    
1376     END
1377     *** * * * *** * * * *** * * * *** * * * *** * * * *** * * * ***
1378     FUNCTION risx_eta4(x)
1379     DOUBLE PRECISION V( 1)
1380     INTEGER NPAR, NDIM, IMQFUN, I, J
1381     DOUBLE PRECISION HQDJ, VV, VCONST
1382     DOUBLE PRECISION SIGVMI( 1), SIGVT( 1)
1383     DOUBLE PRECISION SIGV( 18, 1)
1384     DOUBLE PRECISION SIGDEL( 18)
1385     DOUBLE PRECISION SIGA( 18)
1386     DATA NPAR, NDIM, IMQFUN / 18, 1, 1/
1387     DATA VCONST / 0.000000000000 /
1388     DATA SIGVMI / -20.50000000000 /
1389     DATA SIGVT / 41.00000000000 /
1390     DATA SIGV / 0.3658536449075E-01
1391     +, 0.6097560748458E-01
1392     +, 0.1097560971975
1393     +, 0.1341463327408
1394     +, 0.4756097495556
1395     +, 0.5243902206421
1396     +, 0.8658536076546
1397     +, 0.8902438879013
1398     +, 0.9390243291855
1399     +, 0.9634146094322
1400     +, 0.000000000000
1401     +, 1.000000000000
1402     +, 0.3658536374569
1403     +, 0.4146341383457
1404     +, 0.6097560524940
1405     +, 0.6585365533829
1406     +, 0.7560975551605
1407     +, 0.2439024299383
1408     +/
1409     DATA SIGDEL / 0.4878048598766E-01
1410     +, 0.4878048598766E-01
1411     +, 0.4878048598766E-01
1412     +, 0.4878048598766E-01
1413     +, 0.4878048598766E-01
1414     +, 0.4878048598766E-01
1415     +, 0.4878048598766E-01
1416     +, 0.4878048598766E-01
1417     +, 0.4878048598766E-01
1418     +, 0.4878048598766E-01
1419     +, 0.1999999994950E-05
1420     +, 0.1999999994950E-05
1421     +, 0.9756097197533E-01
1422     +, 0.9756097197533E-01
1423     +, 0.9756097197533E-01
1424     +, 0.9756097197533E-01
1425     +, 0.9756097197533E-01
1426     +, 0.1951219439507
1427     +/
1428     DATA SIGA / -43.61551887895
1429     +, 57.88466995373
1430     +, -92.04113299504
1431     +, 74.08166649890
1432     +, -9.768686062558
1433     +, -4.304496875334
1434     +, 72.62237333937
1435     +, -91.21920840618
1436     +, 56.75519978630
1437     +, -43.21115751243
1438     +, 12.79984505413
1439     +, 12.10074868595
1440     +, -6.238587250860
1441     +, 23.43447356326
1442     +, 17.98221401495
1443     +, -7.980332610975
1444     +, -3.426733307051
1445     +, -8.683439558751
1446     +/
1447    
1448     V(1)=abs(x)
1449 pam-fi 1.9 if(V(1).gt.20.)V(1)=20.
1450 mocchiut 1.1
1451     HQUADF = 0.
1452     DO 20 J = 1, NPAR
1453     HQDJ = 0.
1454     DO 10 I = 1, NDIM
1455     VV = (V (I) - SIGVMI (I)) / SIGVT (I)
1456     HQDJ = HQDJ + (VV - SIGV (J, I)) ** 2
1457     10 CONTINUE
1458     HQDJ = HQDJ + SIGDEL (J) ** 2
1459     HQDJ = SQRT (HQDJ)
1460     HQUADF = HQUADF + SIGA (J) * HQDJ
1461     20 CONTINUE
1462     IF (IMQFUN .EQ. 2) HQUADF = VCONST * EXP (HQUADF)
1463    
1464     risx_eta4=HQUADF* 1e-4
1465    
1466     END
1467     *** * * * *** * * * *** * * * *** * * * *** * * * *** * * * ***
1468     FUNCTION risy_eta2(x)
1469     DOUBLE PRECISION V( 1)
1470     INTEGER NPAR, NDIM, IMQFUN, I, J
1471     DOUBLE PRECISION HQDJ, VV, VCONST
1472     DOUBLE PRECISION SIGVMI( 1), SIGVT( 1)
1473     DOUBLE PRECISION SIGV( 12, 1)
1474     DOUBLE PRECISION SIGDEL( 12)
1475     DOUBLE PRECISION SIGA( 12)
1476     DATA NPAR, NDIM, IMQFUN / 12, 1, 1/
1477     DATA VCONST / 0.000000000000 /
1478     DATA SIGVMI / -20.50000000000 /
1479     DATA SIGVT / 41.00000000000 /
1480     DATA SIGV / 0.1585365831852
1481     +, 0.4024389982224
1482     +, 0.4756097495556
1483     +, 0.5243902206421
1484     +, 0.5975609421730
1485     +, 0.8414633870125
1486     +, 0.000000000000
1487     +, 1.000000000000
1488     +, 0.2682926654816
1489     +, 0.3170731663704
1490     +, 0.7073170542717
1491     +, 0.7560975551605
1492     +/
1493     DATA SIGDEL / 0.4878048598766E-01
1494     +, 0.4878048598766E-01
1495     +, 0.4878048598766E-01
1496     +, 0.4878048598766E-01
1497     +, 0.4878048598766E-01
1498     +, 0.4878048598766E-01
1499     +, 0.1999999994950E-05
1500     +, 0.1999999994950E-05
1501     +, 0.9756097197533E-01
1502     +, 0.9756097197533E-01
1503     +, 0.9756097197533E-01
1504     +, 0.9756097197533E-01
1505     +/
1506     DATA SIGA / 14.57433603529
1507     +, -15.93532436156
1508     +, -13.24628335221
1509     +, -14.31193855410
1510     +, -12.67339684488
1511     +, 18.19876051780
1512     +, -5.270493486725
1513     +, -5.107670990828
1514     +, -9.553262933901
1515     +, 43.34150727448
1516     +, 55.91366786432
1517     +, -29.38037318563
1518     +/
1519    
1520     v(1)= abs(x)
1521 pam-fi 1.9 if(V(1).gt.20.)V(1)=20.
1522 mocchiut 1.1
1523     HQUADF = 0.
1524     DO 20 J = 1, NPAR
1525     HQDJ = 0.
1526     DO 10 I = 1, NDIM
1527     VV = (V (I) - SIGVMI (I)) / SIGVT (I)
1528     HQDJ = HQDJ + (VV - SIGV (J, I)) ** 2
1529     10 CONTINUE
1530     HQDJ = HQDJ + SIGDEL (J) ** 2
1531     HQDJ = SQRT (HQDJ)
1532     HQUADF = HQUADF + SIGA (J) * HQDJ
1533     20 CONTINUE
1534     IF (IMQFUN .EQ. 2) HQUADF = VCONST * EXP (HQUADF)
1535    
1536     risy_eta2=HQUADF* 1e-4
1537    
1538     END
1539     *** * * * *** * * * *** * * * *** * * * *** * * * *** * * * ***
1540    
1541     FUNCTION risy_cog(x)
1542     DOUBLE PRECISION V( 1)
1543     INTEGER NPAR, NDIM, IMQFUN, I, J
1544     DOUBLE PRECISION HQDJ, VV, VCONST
1545     DOUBLE PRECISION SIGVMI( 1), SIGVT( 1)
1546     DOUBLE PRECISION SIGV( 10, 1)
1547     DOUBLE PRECISION SIGDEL( 10)
1548     DOUBLE PRECISION SIGA( 10)
1549     DATA NPAR, NDIM, IMQFUN / 10, 1, 1/
1550     DATA VCONST / 0.000000000000 /
1551     DATA SIGVMI / -20.50000000000 /
1552     DATA SIGVT / 41.00000000000 /
1553     DATA SIGV / 0.1585365831852
1554     +, 0.8414633870125
1555     +, 0.000000000000
1556     +, 1.000000000000
1557     +, 0.4634146094322
1558     +, 0.5121951103210
1559     +, 0.5609756112099
1560     +, 0.6585365533829
1561     +, 0.7073170542717
1562     +, 0.3414633870125
1563     +/
1564     DATA SIGDEL / 0.4878048598766E-01
1565     +, 0.4878048598766E-01
1566     +, 0.1999999994950E-05
1567     +, 0.1999999994950E-05
1568     +, 0.9756097197533E-01
1569     +, 0.9756097197533E-01
1570     +, 0.9756097197533E-01
1571     +, 0.9756097197533E-01
1572     +, 0.9756097197533E-01
1573     +, 0.1951219439507
1574     +/
1575     DATA SIGA / 23.73833445988
1576     +, 24.10182100013
1577     +, 1.865894323190
1578     +, 1.706006262931
1579     +, -1.075607857202
1580     +, -22.11489493403
1581     +, 1.663100707801
1582     +, 4.089852595440
1583     +, -4.314993873697
1584     +, -2.174479487744
1585     +/
1586    
1587     V(1)=abs(x)
1588 pam-fi 1.9 if(V(1).gt.20.)V(1)=20.
1589 mocchiut 1.1
1590     HQUADF = 0.
1591     DO 20 J = 1, NPAR
1592     HQDJ = 0.
1593     DO 10 I = 1, NDIM
1594     VV = (V (I) - SIGVMI (I)) / SIGVT (I)
1595     HQDJ = HQDJ + (VV - SIGV (J, I)) ** 2
1596     10 CONTINUE
1597     HQDJ = HQDJ + SIGDEL (J) ** 2
1598     HQDJ = SQRT (HQDJ)
1599     HQUADF = HQUADF + SIGA (J) * HQDJ
1600     20 CONTINUE
1601     IF (IMQFUN .EQ. 2) HQUADF = VCONST * EXP (HQUADF)
1602    
1603     risy_cog=HQUADF* 1e-4
1604    
1605     END
1606     *** * * * *** * * * *** * * * *** * * * *** * * * *** * * * ***
1607     FUNCTION risx_cog(x)
1608     DOUBLE PRECISION V( 1)
1609     INTEGER NPAR, NDIM, IMQFUN, I, J
1610     DOUBLE PRECISION HQDJ, VV, VCONST
1611     DOUBLE PRECISION SIGVMI( 1), SIGVT( 1)
1612     DOUBLE PRECISION SIGV( 15, 1)
1613     DOUBLE PRECISION SIGDEL( 15)
1614     DOUBLE PRECISION SIGA( 15)
1615     DATA NPAR, NDIM, IMQFUN / 15, 1, 1/
1616     DATA VCONST / 0.000000000000 /
1617     DATA SIGVMI / -20.50000000000 /
1618     DATA SIGVT / 41.00000000000 /
1619     DATA SIGV / 0.6097560748458E-01
1620     +, 0.8536584675312E-01
1621     +, 0.1341463327408
1622     +, 0.2317073047161
1623     +, 0.2804878056049
1624     +, 0.3780487775803
1625     +, 0.6219512224197
1626     +, 0.7195121645927
1627     +, 0.7682926654816
1628     +, 0.8658536076546
1629     +, 0.9146341085434
1630     +, 0.9390243291855
1631     +, 0.000000000000
1632     +, 1.000000000000
1633     +, 0.5121951103210
1634     +/
1635     DATA SIGDEL / 0.4878048598766E-01
1636     +, 0.4878048598766E-01
1637     +, 0.4878048598766E-01
1638     +, 0.4878048598766E-01
1639     +, 0.4878048598766E-01
1640     +, 0.4878048598766E-01
1641     +, 0.4878048598766E-01
1642     +, 0.4878048598766E-01
1643     +, 0.4878048598766E-01
1644     +, 0.4878048598766E-01
1645     +, 0.4878048598766E-01
1646     +, 0.4878048598766E-01
1647     +, 0.1999999994950E-05
1648     +, 0.1999999994950E-05
1649     +, 0.9756097197533E-01
1650     +/
1651     DATA SIGA / 31.95672945139
1652     +, -34.23286209245
1653     +, -6.298459168211
1654     +, 10.98847700545
1655     +,-0.3052213535054
1656     +, 13.10517991464
1657     +, 15.60290821679
1658     +, -1.956118448507
1659     +, 12.41453816720
1660     +, -7.354056408553
1661     +, -32.32512668778
1662     +, 30.61116178966
1663     +, 1.418505329236
1664     +, 1.583492573619
1665     +, -18.48799977042
1666     +/
1667    
1668     V(1)=abs(x)
1669 pam-fi 1.9 if(V(1).gt.20.)V(1)=20.
1670 mocchiut 1.1
1671     HQUADF = 0.
1672     DO 20 J = 1, NPAR
1673     HQDJ = 0.
1674     DO 10 I = 1, NDIM
1675     VV = (V (I) - SIGVMI (I)) / SIGVT (I)
1676     HQDJ = HQDJ + (VV - SIGV (J, I)) ** 2
1677     10 CONTINUE
1678     HQDJ = HQDJ + SIGDEL (J) ** 2
1679     HQDJ = SQRT (HQDJ)
1680     HQUADF = HQUADF + SIGA (J) * HQDJ
1681     20 CONTINUE
1682     IF (IMQFUN .EQ. 2) HQUADF = VCONST * EXP (HQUADF)
1683    
1684     risx_cog = HQUADF * 1e-4
1685    
1686     END

  ViewVC Help
Powered by ViewVC 1.1.23