/[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.13 by pam-fi, Thu May 24 13:29:09 2007 UTC revision 1.17 by pam-fi, Fri Aug 17 16:08:15 2007 UTC
# Line 10  Line 10 
10        if(ipfa.eq.2)CPFA='ETA2'        if(ipfa.eq.2)CPFA='ETA2'
11        if(ipfa.eq.3)CPFA='ETA3'        if(ipfa.eq.3)CPFA='ETA3'
12        if(ipfa.eq.4)CPFA='ETA4'        if(ipfa.eq.4)CPFA='ETA4'
13          if(ipfa.eq.5)CPFA='ETAL'
14        if(ipfa.eq.10)CPFA='COG'        if(ipfa.eq.10)CPFA='COG'
15        if(ipfa.eq.11)CPFA='COG1'        if(ipfa.eq.11)CPFA='COG1'
16        if(ipfa.eq.12)CPFA='COG2'        if(ipfa.eq.12)CPFA='COG2'
# Line 164  c      print*,pfastrips Line 165  c      print*,pfastrips
165        end        end
166    
167  *** * * * *** * * * *** * * * *** * * * *** * * * *** * * * ***  *** * * * *** * * * *** * * * *** * * * *** * * * *** * * * ***
168          real function pfaetal(ic,angle)
169    *--------------------------------------------------------------
170    *     this function returns the position (in strip units)
171    *     it calls:
172    *     - pfaeta2(ic,angle)+pfcorr(ic,angle)
173    *     - pfaeta3(ic,angle)+pfcorr(ic,angle)
174    *     - pfaeta4(ic,angle)+pfcorr(ic,angle)
175    *     according to the angle
176    *--------------------------------------------------------------
177          include 'commontracker.f'
178          include 'level1.f'
179          include 'calib.f'
180          
181          pfaeta = 0
182    
183          if(mod(int(VIEW(ic)),2).eq.1)then !Y-view
184          
185             if( abs(angle).ge.e2fay.and.abs(angle).le.e2tay )then
186                pfaeta = pfaeta2(ic,angle)+pfacorr(ic,angle)
187             elseif( abs(angle).ge.e3fay.and.abs(angle).le.e3tay )then
188                pfaeta = pfaeta3(ic,angle)+pfacorr(ic,angle)
189             elseif( abs(angle).ge.e4fay.and.abs(angle).le.e4tay )then
190                pfaeta = pfaeta4(ic,angle)+pfacorr(ic,angle)
191             else
192                pfaeta = cog(4,ic)
193             endif            
194    
195          else                      !X-view
196    
197             if( abs(angle).ge.e2fax.and.abs(angle).le.e2tax )then
198                pfaeta = pfaeta2(ic,angle)+pfacorr(ic,angle)
199             elseif( abs(angle).ge.e3fax.and.abs(angle).le.e3tax )then
200                pfaeta = pfaeta3(ic,angle)+pfacorr(ic,angle)
201             elseif( abs(angle).ge.e4fax.and.abs(angle).le.e4tax )then
202                pfaeta = pfaeta4(ic,angle)+pfacorr(ic,angle)
203             else
204                pfaeta = cog(4,ic)
205             endif            
206                
207          endif
208          
209     100  return
210          end
211    *** * * * *** * * * *** * * * *** * * * *** * * * *** * * * ***
212  c      real function riseta(ic,angle)  c      real function riseta(ic,angle)
213        real function riseta(iview,angle)        real function riseta(iview,angle)
214  *--------------------------------------------------------------  *--------------------------------------------------------------
# Line 210  c      if(mod(int(VIEW(ic)),2).eq.1)then Line 255  c      if(mod(int(VIEW(ic)),2).eq.1)then
255                            
256        endif        endif
257    
       print*,'---- ',riseta,iview,angle  
258    
259   100  return   100  return
260        end        end
# Line 612  c$$$      endif Line 656  c$$$      endif
656    
657    
658  *** * * * *** * * * *** * * * *** * * * *** * * * *** * * * ***  *** * * * *** * * * *** * * * *** * * * *** * * * *** * * * ***
659        real function cog0(ncog,ic)  c$$$      real function cog0(ncog,ic)
660  *-------------------------------------------------  c$$$*-------------------------------------------------
661  *     this function returns  c$$$*     this function returns
662  *  c$$$*
663  *     - the Center-Of-Gravity of the cluster IC  c$$$*     - the Center-Of-Gravity of the cluster IC
664  *     evaluated using NCOG strips,  c$$$*     evaluated using NCOG strips,
665  *     calculated relative to MAXS(IC)  c$$$*     calculated relative to MAXS(IC)
666  *      c$$$*    
667  *     - zero in case that not  enough strips  c$$$*     - zero in case that not  enough strips
668  *     have a positive signal  c$$$*     have a positive signal
669  *      c$$$*    
670  *     NOTE:  c$$$*     NOTE:
671  *     This is the old definition, used by Straulino.  c$$$*     This is the old definition, used by Straulino.
672  *     The new routine, according to Landi,  c$$$*     The new routine, according to Landi,
673  *     is COG(NCOG,IC)  c$$$*     is COG(NCOG,IC)
674  *-------------------------------------------------  c$$$*-------------------------------------------------
675    c$$$
676    c$$$
677        include 'commontracker.f'  c$$$      include 'commontracker.f'
678        include 'level1.f'  c$$$      include 'level1.f'
679          c$$$      
680  *     --> signal of the central strip  c$$$*     --> signal of the central strip
681        sc = CLSIGNAL(INDMAX(ic)) !center  c$$$      sc = CLSIGNAL(INDMAX(ic)) !center
682    c$$$
683  *     signal of adjacent strips  c$$$*     signal of adjacent strips
684  *     --> left  c$$$*     --> left
685        sl1 = 0                  !left 1  c$$$      sl1 = 0                  !left 1
686        if(  c$$$      if(
687       $     (INDMAX(ic)-1).ge.INDSTART(ic)  c$$$     $     (INDMAX(ic)-1).ge.INDSTART(ic)
688       $     )  c$$$     $     )
689       $     sl1 = max(0.,CLSIGNAL(INDMAX(ic)-1))  c$$$     $     sl1 = max(0.,CLSIGNAL(INDMAX(ic)-1))
690    c$$$
691        sl2 = 0                  !left 2  c$$$      sl2 = 0                  !left 2
692        if(  c$$$      if(
693       $     (INDMAX(ic)-2).ge.INDSTART(ic)  c$$$     $     (INDMAX(ic)-2).ge.INDSTART(ic)
694       $     )  c$$$     $     )
695       $     sl2 = max(0.,CLSIGNAL(INDMAX(ic)-2))  c$$$     $     sl2 = max(0.,CLSIGNAL(INDMAX(ic)-2))
696    c$$$
697  *     --> right  c$$$*     --> right
698        sr1 = 0                  !right 1  c$$$      sr1 = 0                  !right 1
699        if(  c$$$      if(
700       $     (ic.ne.NCLSTR1.and.(INDMAX(ic)+1).lt.INDSTART(ic+1))  c$$$     $     (ic.ne.NCLSTR1.and.(INDMAX(ic)+1).lt.INDSTART(ic+1))
701       $     .or.  c$$$     $     .or.
702       $     (ic.eq.NCLSTR1.and.(INDMAX(ic)+1).le.TOTCLLENGTH)  c$$$     $     (ic.eq.NCLSTR1.and.(INDMAX(ic)+1).le.TOTCLLENGTH)
703       $     )  c$$$     $     )
704       $     sr1 = max(0.,CLSIGNAL(INDMAX(ic)+1))  c$$$     $     sr1 = max(0.,CLSIGNAL(INDMAX(ic)+1))
705    c$$$
706        sr2 = 0                  !right 2  c$$$      sr2 = 0                  !right 2
707        if(  c$$$      if(
708       $     (ic.ne.NCLSTR1.and.(INDMAX(ic)+2).lt.INDSTART(ic+1))  c$$$     $     (ic.ne.NCLSTR1.and.(INDMAX(ic)+2).lt.INDSTART(ic+1))
709       $     .or.  c$$$     $     .or.
710       $     (ic.eq.NCLSTR1.and.(INDMAX(ic)+2).le.TOTCLLENGTH)  c$$$     $     (ic.eq.NCLSTR1.and.(INDMAX(ic)+2).le.TOTCLLENGTH)
711       $     )  c$$$     $     )
712       $     sr2 = max(0.,CLSIGNAL(INDMAX(ic)+2))  c$$$     $     sr2 = max(0.,CLSIGNAL(INDMAX(ic)+2))
713          c$$$      
714  ************************************************************  c$$$************************************************************
715  *     COG computation  c$$$*     COG computation
716  ************************************************************  c$$$************************************************************
717    c$$$
718  c      print*,sl2,sl1,sc,sr1,sr2  c$$$c      print*,sl2,sl1,sc,sr1,sr2
719    c$$$
720        COG = 0.  c$$$      COG = 0.
721            c$$$        
722        if(sl1.gt.sr1.and.sl1.gt.0.)then  c$$$      if(sl1.gt.sr1.and.sl1.gt.0.)then
723            c$$$        
724           if(ncog.eq.2.and.sl1.ne.0)then  c$$$         if(ncog.eq.2.and.sl1.ne.0)then
725              COG = -sl1/(sl1+sc)          c$$$            COG = -sl1/(sl1+sc)        
726           elseif(ncog.eq.3.and.sl1.ne.0.and.sr1.ne.0)then  c$$$         elseif(ncog.eq.3.and.sl1.ne.0.and.sr1.ne.0)then
727              COG = (sr1-sl1)/(sl1+sc+sr1)  c$$$            COG = (sr1-sl1)/(sl1+sc+sr1)
728           elseif(ncog.eq.4.and.sl1.ne.0.and.sr1.ne.0.and.sl2.ne.0)then  c$$$         elseif(ncog.eq.4.and.sl1.ne.0.and.sr1.ne.0.and.sl2.ne.0)then
729              COG = (sr1-sl1-2*sl2)/(sl2+sl1+sc+sr1)  c$$$            COG = (sr1-sl1-2*sl2)/(sl2+sl1+sc+sr1)
730           else  c$$$         else
731              COG = 0.  c$$$            COG = 0.
732           endif  c$$$         endif
733            c$$$        
734        elseif(sl1.le.sr1.and.sr1.gt.0.)then  c$$$      elseif(sl1.le.sr1.and.sr1.gt.0.)then
735    c$$$
736           if(ncog.eq.2.and.sr1.ne.0)then  c$$$         if(ncog.eq.2.and.sr1.ne.0)then
737              COG = sr1/(sc+sr1)              c$$$            COG = sr1/(sc+sr1)            
738           elseif(ncog.eq.3.and.sr1.ne.0.and.sl1.ne.0)then  c$$$         elseif(ncog.eq.3.and.sr1.ne.0.and.sl1.ne.0)then
739              COG = (sr1-sl1)/(sl1+sc+sr1)  c$$$            COG = (sr1-sl1)/(sl1+sc+sr1)
740           elseif(ncog.eq.4.and.sr1.ne.0.and.sl1.ne.0.and.sr2.ne.0)then  c$$$         elseif(ncog.eq.4.and.sr1.ne.0.and.sl1.ne.0.and.sr2.ne.0)then
741              COG = (2*sr2+sr1-sl1)/(sl2+sl1+sc+sr1)  c$$$            COG = (2*sr2+sr1-sl1)/(sl2+sl1+sc+sr1)
742           else  c$$$         else
743              COG = 0.  c$$$            COG = 0.
744           endif  c$$$         endif
745    c$$$
746        endif  c$$$      endif
747    c$$$
748        COG0 = COG  c$$$      COG0 = COG
749    c$$$
750  c      print *,ncog,ic,cog,'/////////////'  c$$$c      print *,ncog,ic,cog,'/////////////'
751    c$$$
752        return  c$$$      return
753        end  c$$$      end
754    
755  *** * * * *** * * * *** * * * *** * * * *** * * * *** * * * ***  *** * * * *** * * * *** * * * *** * * * *** * * * *** * * * ***
756        real function cog(ncog,ic)        real function cog(ncog,ic)
# Line 738  c      print *,ncog,ic,cog,'//////////// Line 782  c      print *,ncog,ic,cog,'////////////
782  *     --> signal of the central strip  *     --> signal of the central strip
783           sc = CLSIGNAL(INDMAX(ic)) !center           sc = CLSIGNAL(INDMAX(ic)) !center
784  *     signal of adjacent strips  *     signal of adjacent strips
785           sl1 = 0                !left 1           sl1 = -9999.           !left 1
786           if(           if(
787       $        (INDMAX(ic)-1).ge.INDSTART(ic)       $        (INDMAX(ic)-1).ge.INDSTART(ic)
788       $        )       $        )
789       $        sl1 = CLSIGNAL(INDMAX(ic)-1)       $        sl1 = CLSIGNAL(INDMAX(ic)-1)
790                    
791           sl2 = 0                !left 2           sl2 = -9999.           !left 2
792           if(           if(
793       $        (INDMAX(ic)-2).ge.INDSTART(ic)       $        (INDMAX(ic)-2).ge.INDSTART(ic)
794       $        )       $        )
795       $        sl2 = CLSIGNAL(INDMAX(ic)-2)       $        sl2 = CLSIGNAL(INDMAX(ic)-2)
796                    
797           sr1 = 0                !right 1           sr1 = -9999.           !right 1
798           if(           if(
799       $        (ic.ne.NCLSTR1.and.(INDMAX(ic)+1).lt.INDSTART(ic+1))       $        (ic.ne.NCLSTR1.and.(INDMAX(ic)+1).lt.INDSTART(ic+1))
800       $        .or.       $        .or.
# Line 758  c      print *,ncog,ic,cog,'//////////// Line 802  c      print *,ncog,ic,cog,'////////////
802       $        )       $        )
803       $        sr1 = CLSIGNAL(INDMAX(ic)+1)       $        sr1 = CLSIGNAL(INDMAX(ic)+1)
804                    
805           sr2 = 0                !right 2           sr2 = -9999.           !right 2
806           if(           if(
807       $        (ic.ne.NCLSTR1.and.(INDMAX(ic)+2).lt.INDSTART(ic+1))       $        (ic.ne.NCLSTR1.and.(INDMAX(ic)+2).lt.INDSTART(ic+1))
808       $        .or.       $        .or.
# Line 770  c      print *,ncog,ic,cog,'//////////// Line 814  c      print *,ncog,ic,cog,'////////////
814                    
815  c         print*,'## ',sl2,sl1,sc,sr1,sr2  c         print*,'## ',sl2,sl1,sc,sr1,sr2
816    
817    c     ==============================================================
818           if(ncog.eq.1)then           if(ncog.eq.1)then
819              COG = 0.              COG = 0.
820                if(sr1.gt.sc)cog=1. !NEW
821                if(sl1.gt.sc.and.sl1.gt.sr1)cog=-1. !NEW
822    c     ==============================================================
823           elseif(ncog.eq.2)then           elseif(ncog.eq.2)then
824              if(sl1.gt.sr1)then              if(sl1.gt.sr1)then
825                 if((sl1+sc).ne.0)COG = -sl1/(sl1+sc)                         if((sl1+sc).ne.0)COG = -sl1/(sl1+sc)        
826              elseif(sl1.le.sr1)then              elseif(sl1.lt.sr1)then
827                 if((sc+sr1).ne.0)COG = sr1/(sc+sr1)                             if((sc+sr1).ne.0)COG = sr1/(sc+sr1)                        
828              endif              elseif( sl1.eq.sr1.and.sl1.ne.-9999.)then !NEW
829                   if( clsigma(indmax(ic)-1).lt.clsigma(indmax(ic)+1)
830         $              .and.(sl1+sc).ne.0 )cog = -sl1/(sl1+sc) !NEW
831                   if( clsigma(indmax(ic)-1).gt.clsigma(indmax(ic)+1)
832         $              .and.(sc+sr1).ne.0 )cog = sr1/(sc+sr1) !NEW
833                endif
834    c            if(cog==0)print*,'Strange cluster (2) - @maxs ',MAXS(ic)
835    c     $           ,' : ',sl2,sl1,sc,sr1,sr2
836    c     ==============================================================
837           elseif(ncog.eq.3)then           elseif(ncog.eq.3)then
838               if((sl1+sc+sr1).ne.0)COG = (sr1-sl1)/(sl1+sc+sr1)               if( (sl1+sc+sr1).ne.0 )COG = (sr1-sl1)/(sl1+sc+sr1)
839    c             if(cog==0)print*,'Strange cluster (3) - @maxs ',MAXS(ic)
840    c     $            ,' : ',sl2,sl1,sc,sr1,sr2
841    c     ==============================================================
842           elseif(ncog.eq.4)then           elseif(ncog.eq.4)then
843              if(sl2.gt.sr2)then              if(sl2.gt.sr2)then
844                 if((sl2+sl1+sc+sr1).ne.0)                 if((sl2+sl1+sc+sr1).ne.0)
845       $              COG = (sr1-sl1-2*sl2)/(sl2+sl1+sc+sr1)       $              COG = (sr1-sl1-2*sl2)/(sl2+sl1+sc+sr1)
846              elseif(sl2.le.sr2)then              elseif(sl2.lt.sr2)then
847                  if((sr2+sl1+sc+sr1).ne.0)                 if((sr2+sl1+sc+sr1).ne.0)
848       $              COG = (2*sr2+sr1-sl1)/(sr2+sl1+sc+sr1)       $              COG = (2*sr2+sr1-sl1)/(sr2+sl1+sc+sr1)
849                elseif(sl2.eq.sr2.and.sl2.ne.-9999.)then !NEW
850                   if( clsigma(indmax(ic)-2).lt.clsigma(indmax(ic)+2)
851         $              .and.(sl2+sl1+sc+sr1).ne.0 )
852         $              cog = (sr1-sl1-2*sl2)/(sl2+sl1+sc+sr1) !NEW
853                   if( clsigma(indmax(ic)-2).gt.clsigma(indmax(ic)+2)
854         $              .and.(sr2+sl1+sc+sr1).ne.0 )
855         $              cog = (2*sr2+sr1-sl1)/(sr2+sl1+sc+sr1)  !NEW              
856              endif              endif
857           else           else
858              print*,'function COG(NCOG,IC) ==> WARNING!! NCOG=',NCOG              print*,'function COG(NCOG,IC) ==> WARNING!! NCOG=',NCOG
# Line 1684  c         if(BAD(VIEW(ic),nvk(MAXS(ic)), Line 1750  c         if(BAD(VIEW(ic),nvk(MAXS(ic)),
1750        risx_cog = HQUADF * 1e-4        risx_cog = HQUADF * 1e-4
1751    
1752        END        END
1753    
1754    
1755    *** * * * *** * * * *** * * * *** * * * *** * * * *** * * * ***
1756          real function pfacorr(ic,angle) !(1)
1757    *--------------------------------------------------------------
1758    *     this function returns the landi correction for this cluster
1759    *--------------------------------------------------------------
1760          include 'commontracker.f'
1761          include 'calib.f'
1762          include 'level1.f'
1763    
1764          real angle
1765          integer iview,lad
1766    
1767          iview = VIEW(ic)            
1768          lad = nld(MAXS(ic),VIEW(ic))
1769    
1770    *     find angular bin
1771    *     (in futuro possiamo pensare di interpolare anche sull'angolo)
1772          do iang=1,nangbin
1773             if(angL(iang).lt.angle.and.angR(iang).ge.angle)then
1774                iangle=iang
1775                goto 98
1776             endif
1777          enddo
1778          if(DEBUG)
1779         $     print*,'pfacorr *** warning *** angle out of range: ',angle
1780          if(angle.lt.angL(1))iang=1
1781          if(angle.gt.angR(nangbin))iang=nangbin
1782     98   continue                  !jump here if ok
1783    
1784          pfacorr = fcorr(iview,lad,iang)
1785    
1786          if(DEBUG)print*,'CORR  (ic ',ic,' ang',angle,') -->',pfacorr
1787    
1788    
1789     100  return
1790          end

Legend:
Removed from v.1.13  
changed lines
  Added in v.1.17

  ViewVC Help
Powered by ViewVC 1.1.23