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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.3 by pam-fi, Thu Sep 28 14:04:40 2006 UTC revision 1.5 by pam-fi, Thu Oct 26 16:22:37 2006 UTC
# Line 7  Line 7 
7    
8    
9  *** * * * *** * * * *** * * * *** * * * *** * * * *** * * * ***  *** * * * *** * * * *** * * * *** * * * *** * * * *** * * * ***
10        real function pfa_eta(ic,angle)        real function pfaeta(ic,angle)
11  *--------------------------------------------------------------  *--------------------------------------------------------------
12  *     this function returns the position (in strip units)  *     this function returns the position (in strip units)
13  *     it calls:  *     it calls:
14  *     - pfa_eta2(ic,angle)  *     - pfaeta2(ic,angle)
15  *     - pfa_eta3(ic,angle)  *     - pfaeta3(ic,angle)
16  *     - pfa_eta4(ic,angle)  *     - pfaeta4(ic,angle)
17  *     according to the angle  *     according to the angle
18  *--------------------------------------------------------------  *--------------------------------------------------------------
19        include 'commontracker.f'        include 'commontracker.f'
20  c      include 'calib.f'  c      include 'calib.f'
21        include 'level1.f'        include 'level1.f'
22                
23        pfa_eta = 0        pfaeta = 0
24    
25        if(mod(int(VIEW(ic)),2).eq.1)then !Y-view        if(mod(int(VIEW(ic)),2).eq.1)then !Y-view
26                
27           pfa_eta = pfa_eta2(ic,angle)           pfaeta = pfaeta2(ic,angle)
28        
29        else                      !X-view        else                      !X-view
30    
31           if(abs(angle).le.10.)then           if(abs(angle).le.10.)then
32              pfa_eta = pfa_eta2(ic,angle)              pfaeta = pfaeta2(ic,angle)
33           elseif(abs(angle).gt.10..and.abs(angle).le.15.)then           elseif(abs(angle).gt.10..and.abs(angle).le.15.)then
34              pfa_eta = pfa_eta3(ic,angle)              pfaeta = pfaeta3(ic,angle)
35           elseif(abs(angle).gt.15.)then           elseif(abs(angle).gt.15.)then
36              pfa_eta = pfa_eta4(ic,angle)              pfaeta = pfaeta4(ic,angle)
37           endif           endif
38                            
39        endif        endif
40          
41    c      print*,'pfaeta ',pfaeta, angle
42    
43   100  return   100  return
44        end        end
# Line 46  c      include 'calib.f' Line 47  c      include 'calib.f'
47        real function ris_eta(ic,angle)        real function ris_eta(ic,angle)
48  *--------------------------------------------------------------  *--------------------------------------------------------------
49  *     this function returns the average spatial resolution  *     this function returns the average spatial resolution
50  *     (in cm) for the ETA algorithm (function pfa_eta(ic,angle))  *     (in cm) for the ETA algorithm (function pfaeta(ic,angle))
51  *     it calls:  *     it calls:
52  *     - risx_eta2(angle)  *     - risx_eta2(angle)
53  *     - risy_eta2(angle)  *     - risy_eta2(angle)
# Line 129  c$$$     $     ,' -->',ris_eta Line 130  c$$$     $     ,' -->',ris_eta
130  c*****************************************************  c*****************************************************
131  cccccc 02/02/2006 modified by Elena Vannuccini --> (1)  cccccc 02/02/2006 modified by Elena Vannuccini --> (1)
132  c*****************************************************  c*****************************************************
133  c      real function pfa_eta2(cog2,view,lad,angle)  c      real function pfaeta2(cog2,view,lad,angle)
134        real function pfa_eta2(ic,angle) !(1)        real function pfaeta2(ic,angle) !(1)
135  *--------------------------------------------------------------  *--------------------------------------------------------------
136  *     this function returns  *     this function returns
137  *  *
# Line 155  c      common/dbg/DEBUG Line 156  c      common/dbg/DEBUG
156        iview = VIEW(ic)              !(1)        iview = VIEW(ic)              !(1)
157        lad = nld(MAXS(ic),VIEW(ic)) !(1)        lad = nld(MAXS(ic),VIEW(ic)) !(1)
158        cog2 = cog(2,ic)             !(1)        cog2 = cog(2,ic)             !(1)
159        pfa_eta2=cog2        pfaeta2=cog2
160    
161  *     find angular bin  *     find angular bin
162  *     (in futuro possiamo pensare di interpolare anche sull'angolo)  *     (in futuro possiamo pensare di interpolare anche sull'angolo)
# Line 167  c         print*,'~~~~~~~~~~~~ ',iang,an Line 168  c         print*,'~~~~~~~~~~~~ ',iang,an
168           endif           endif
169        enddo        enddo
170        if(DEBUG)        if(DEBUG)
171       $     print*,'pfa_eta2 *** warning *** angle out of range: ',angle       $     print*,'pfaeta2 *** warning *** angle out of range: ',angle
172        if(angle.lt.angL(1))iang=1        if(angle.lt.angL(1))iang=1
173        if(angle.gt.angR(nangbin))iang=nangbin        if(angle.gt.angR(nangbin))iang=nangbin
174   98   continue                  !jump here if ok   98   continue                  !jump here if ok
# Line 177  c$$$*     find extremes of interpolation Line 178  c$$$*     find extremes of interpolation
178  c$$$      iflag=0  c$$$      iflag=0
179  c$$$*     --------------------------------  c$$$*     --------------------------------
180  c$$$      if(cog2.lt.eta2(1,iang).or.cog2.gt.eta2(netaval,iang))then  c$$$      if(cog2.lt.eta2(1,iang).or.cog2.gt.eta2(netaval,iang))then
181  c$$$c         print*,'pfa_eta2 *** warning *** argument out of range: ',cog2  c$$$c         print*,'pfaeta2 *** warning *** argument out of range: ',cog2
182  c$$$*         goto 100  c$$$*         goto 100
183  c$$$*     ----------------------------------------------  c$$$*     ----------------------------------------------
184  c$$$*     non salto piu`, ma scalo di 1 o -1  c$$$*     non salto piu`, ma scalo di 1 o -1
# Line 230  c            print*,'-----',x1,x2,y1,y2 Line 231  c            print*,'-----',x1,x2,y1,y2
231        AA=(y2-y1)/(x2-x1)        AA=(y2-y1)/(x2-x1)
232        BB=y1-AA*x1        BB=y1-AA*x1
233    
234        pfa_eta2 = AA*cog2+BB        pfaeta2 = AA*cog2+BB
235        pfa_eta2 = pfa_eta2 - iadd        pfaeta2 = pfaeta2 - iadd
236    
237  c$$$      if(iflag.eq.1)then  c$$$      if(iflag.eq.1)then
238  c$$$         pfa_eta2=pfa_eta2-1.   !temp  c$$$         pfaeta2=pfaeta2-1.   !temp
239  c$$$         cog2=cog2-1.           !temp  c$$$         cog2=cog2-1.           !temp
240  c$$$      endif  c$$$      endif
241  c$$$      if(iflag.eq.-1)then  c$$$      if(iflag.eq.-1)then
242  c$$$         pfa_eta2=pfa_eta2+1.   !temp  c$$$         pfaeta2=pfaeta2+1.   !temp
243  c$$$         cog2=cog2+1.           !temp  c$$$         cog2=cog2+1.           !temp
244  c$$$      endif  c$$$      endif
245    
246        if(DEBUG)print*,'ETA2  (ic ',ic,' ang',angle,')'        if(DEBUG)print*,'ETA2  (ic ',ic,' ang',angle,')'
247       $     ,cog2-iadd,' -->',pfa_eta2       $     ,cog2-iadd,' -->',pfaeta2
248    
249    
250   100  return   100  return
# Line 253  c$$$      endif Line 254  c$$$      endif
254  c*****************************************************  c*****************************************************
255  cccccc 02/02/2006 modified by Elena Vannuccini --> (1)  cccccc 02/02/2006 modified by Elena Vannuccini --> (1)
256  c*****************************************************  c*****************************************************
257  c      real function pfa_eta3(cog3,view,lad,angle)  c      real function pfaeta3(cog3,view,lad,angle)
258        real function pfa_eta3(ic,angle) !(1)        real function pfaeta3(ic,angle) !(1)
259  *--------------------------------------------------------------  *--------------------------------------------------------------
260  *     this function returns  *     this function returns
261  *  *
# Line 280  c      common/dbg/DEBUG Line 281  c      common/dbg/DEBUG
281        iview = VIEW(ic)              !(1)        iview = VIEW(ic)              !(1)
282        lad = nld(MAXS(ic),VIEW(ic)) !(1)        lad = nld(MAXS(ic),VIEW(ic)) !(1)
283        cog3 = cog(3,ic)             !(1)        cog3 = cog(3,ic)             !(1)
284        pfa_eta3=cog3        pfaeta3=cog3
285    
286  *     find angular bin  *     find angular bin
287  *     (in futuro possiamo pensare di interpolare anche sull'angolo)  *     (in futuro possiamo pensare di interpolare anche sull'angolo)
# Line 292  c         print*,'~~~~~~~~~~~~ ',iang,an Line 293  c         print*,'~~~~~~~~~~~~ ',iang,an
293           endif           endif
294        enddo        enddo
295        if(DEBUG)        if(DEBUG)
296       $     print*,'pfa_eta3 *** warning *** angle out of range: ',angle       $     print*,'pfaeta3 *** warning *** angle out of range: ',angle
297        if(angle.lt.angL(1))iang=1        if(angle.lt.angL(1))iang=1
298        if(angle.gt.angR(nangbin))iang=nangbin        if(angle.gt.angR(nangbin))iang=nangbin
299   98   continue                  !jump here if ok   98   continue                  !jump here if ok
# Line 354  c            print*,'-----',x1,x2,y1,y2 Line 355  c            print*,'-----',x1,x2,y1,y2
355        AA=(y2-y1)/(x2-x1)        AA=(y2-y1)/(x2-x1)
356        BB=y1-AA*x1        BB=y1-AA*x1
357    
358        pfa_eta3 = AA*cog3+BB        pfaeta3 = AA*cog3+BB
359        pfa_eta3 = pfa_eta3 - iadd        pfaeta3 = pfaeta3 - iadd
360    
361  c$$$      if(iflag.eq.1)then  c$$$      if(iflag.eq.1)then
362  c$$$         pfa_eta2=pfa_eta2-1.   !temp  c$$$         pfaeta2=pfaeta2-1.   !temp
363  c$$$         cog2=cog2-1.           !temp  c$$$         cog2=cog2-1.           !temp
364  c$$$      endif  c$$$      endif
365  c$$$      if(iflag.eq.-1)then  c$$$      if(iflag.eq.-1)then
366  c$$$         pfa_eta2=pfa_eta2+1.   !temp  c$$$         pfaeta2=pfaeta2+1.   !temp
367  c$$$         cog2=cog2+1.           !temp  c$$$         cog2=cog2+1.           !temp
368  c$$$      endif  c$$$      endif
369    
370        if(DEBUG)print*,'ETA3  (ic ',ic,' ang',angle,')'        if(DEBUG)print*,'ETA3  (ic ',ic,' ang',angle,')'
371       $     ,cog3-iadd,' -->',pfa_eta3       $     ,cog3-iadd,' -->',pfaeta3
372    
373   100  return   100  return
374        end        end
# Line 376  c$$$      endif Line 377  c$$$      endif
377  c*****************************************************  c*****************************************************
378  cccccc 02/02/2006 modified by Elena Vannuccini --> (1)  cccccc 02/02/2006 modified by Elena Vannuccini --> (1)
379  c*****************************************************  c*****************************************************
380  c      real function pfa_eta4(cog4,view,lad,angle)  c      real function pfaeta4(cog4,view,lad,angle)
381        real function pfa_eta4(ic,angle) !(1)        real function pfaeta4(ic,angle) !(1)
382  *--------------------------------------------------------------  *--------------------------------------------------------------
383  *     this function returns  *     this function returns
384  *  *
# Line 399  c      real function pfa_eta4(cog4,view, Line 400  c      real function pfa_eta4(cog4,view,
400  c      logical DEBUG  c      logical DEBUG
401  c      common/dbg/DEBUG  c      common/dbg/DEBUG
402    
403        iview = VIEW(ic)              !(1)        iview = VIEW(ic)             !(1)
404        lad = nld(MAXS(ic),VIEW(ic)) !(1)        lad = nld(MAXS(ic),VIEW(ic)) !(1)
405        cog4=cog(4,ic)               !(1)        cog4=cog(4,ic)               !(1)
406        pfa_eta4=cog4        pfaeta4=cog4
407    
408  *     find angular bin  *     find angular bin
409  *     (in futuro possiamo pensare di interpolare anche sull'angolo)  *     (in futuro possiamo pensare di interpolare anche sull'angolo)
# Line 414  c         print*,'~~~~~~~~~~~~ ',iang,an Line 415  c         print*,'~~~~~~~~~~~~ ',iang,an
415           endif           endif
416        enddo        enddo
417        if(DEBUG)        if(DEBUG)
418       $     print*,'pfa_eta4 *** warning *** angle out of range: ',angle       $     print*,'pfaeta4 *** warning *** angle out of range: ',angle
419        if(angle.lt.angL(1))iang=1        if(angle.lt.angL(1))iang=1
420        if(angle.gt.angR(nangbin))iang=nangbin        if(angle.gt.angR(nangbin))iang=nangbin
421   98   continue                  !jump here if ok   98   continue                  !jump here if ok
# Line 476  c            print*,'-----',x1,x2,y1,y2 Line 477  c            print*,'-----',x1,x2,y1,y2
477        AA=(y2-y1)/(x2-x1)        AA=(y2-y1)/(x2-x1)
478        BB=y1-AA*x1        BB=y1-AA*x1
479    
480        pfa_eta4 = AA*cog4+BB        pfaeta4 = AA*cog4+BB
481        pfa_eta4 = pfa_eta4 - iadd        pfaeta4 = pfaeta4 - iadd
482    
483  c$$$      if(iflag.eq.1)then  c$$$      if(iflag.eq.1)then
484  c$$$         pfa_eta2=pfa_eta2-1.   !temp  c$$$         pfaeta2=pfaeta2-1.   !temp
485  c$$$         cog2=cog2-1.           !temp  c$$$         cog2=cog2-1.           !temp
486  c$$$      endif  c$$$      endif
487  c$$$      if(iflag.eq.-1)then  c$$$      if(iflag.eq.-1)then
488  c$$$         pfa_eta2=pfa_eta2+1.   !temp  c$$$         pfaeta2=pfaeta2+1.   !temp
489  c$$$         cog2=cog2+1.           !temp  c$$$         cog2=cog2+1.           !temp
490  c$$$      endif  c$$$      endif
491    
492        if(DEBUG)print*,'ETA4  (ic ',ic,' ang',angle,')'        if(DEBUG)print*,'ETA4  (ic ',ic,' ang',angle,')'
493       $     ,cog4-iadd,' -->',pfa_eta4       $     ,cog4-iadd,' -->',pfaeta4
494    
495   100  return   100  return
496        end        end
# Line 655  c      common/dbg/DEBUG Line 656  c      common/dbg/DEBUG
656                    
657           COG = 0.           COG = 0.
658                    
659           if(ncog.eq.2)then           if(ncog.eq.1)then
660                COG = 0.
661             elseif(ncog.eq.2)then
662              if(sl1.gt.sr1)then              if(sl1.gt.sr1)then
663                 COG = -sl1/(sl1+sc)                         COG = -sl1/(sl1+sc)        
664              elseif(sl1.le.sr1)then              elseif(sl1.le.sr1)then
# Line 693  ' Line 696  '
696           mu  = 0           mu  = 0
697           do i = istart,istop           do i = istart,istop
698              ipos = i-INDMAX(ic)              ipos = i-INDMAX(ic)
699              ivk  = nvk(MAXS(ic)+ipos)  cc            ivk  = nvk(MAXS(ic)+ipos)
700              is   = nst(MAXS(ic)+ipos)  cc            is   = nst(MAXS(ic)+ipos)
701  *            print*,'******************',istart,istop,ipos  *            print*,'******************',istart,istop,ipos
702  *     $           ,MAXS(ic)+ipos,iv,ivk,is  *     $           ,MAXS(ic)+ipos,iv,ivk,is
703              cut  = incut*SIGMA(iv,ivk,is)  cc            cut  = incut*SIGMA(iv,ivk,is)
704              if(SIGMA(iv,ivk,is).ne.CLSIGMA(i))              cut  = incut*CLSIGMA(i)
705       $           print*,'cog(0,ic) --> hai fatto qualche cazzata'  c            if(SIGMA(iv,ivk,is).ne.CLSIGMA(i))
706    c     $           print*,'cog(0,ic) --> hai fatto qualche cazzata'
707              if(CLSIGNAL(i).ge.cut)then              if(CLSIGNAL(i).ge.cut)then
708                 COG = COG + ipos*CLSIGNAL(i)                 COG = COG + ipos*CLSIGNAL(i)
709                 mu = mu + 1                 mu = mu + 1

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.5

  ViewVC Help
Powered by ViewVC 1.1.23