/[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.14 by pam-fi, Tue Aug 7 13:56:29 2007 UTC
# Line 210  c      if(mod(int(VIEW(ic)),2).eq.1)then Line 210  c      if(mod(int(VIEW(ic)),2).eq.1)then
210                            
211        endif        endif
212    
213        print*,'---- ',riseta,iview,angle  cc      print*,'---- ',riseta,iview,angle
214    
215   100  return   100  return
216        end        end
# Line 612  c$$$      endif Line 612  c$$$      endif
612    
613    
614  *** * * * *** * * * *** * * * *** * * * *** * * * *** * * * ***  *** * * * *** * * * *** * * * *** * * * *** * * * *** * * * ***
615        real function cog0(ncog,ic)  c$$$      real function cog0(ncog,ic)
616  *-------------------------------------------------  c$$$*-------------------------------------------------
617  *     this function returns  c$$$*     this function returns
618  *  c$$$*
619  *     - the Center-Of-Gravity of the cluster IC  c$$$*     - the Center-Of-Gravity of the cluster IC
620  *     evaluated using NCOG strips,  c$$$*     evaluated using NCOG strips,
621  *     calculated relative to MAXS(IC)  c$$$*     calculated relative to MAXS(IC)
622  *      c$$$*    
623  *     - zero in case that not  enough strips  c$$$*     - zero in case that not  enough strips
624  *     have a positive signal  c$$$*     have a positive signal
625  *      c$$$*    
626  *     NOTE:  c$$$*     NOTE:
627  *     This is the old definition, used by Straulino.  c$$$*     This is the old definition, used by Straulino.
628  *     The new routine, according to Landi,  c$$$*     The new routine, according to Landi,
629  *     is COG(NCOG,IC)  c$$$*     is COG(NCOG,IC)
630  *-------------------------------------------------  c$$$*-------------------------------------------------
631    c$$$
632    c$$$
633        include 'commontracker.f'  c$$$      include 'commontracker.f'
634        include 'level1.f'  c$$$      include 'level1.f'
635          c$$$      
636  *     --> signal of the central strip  c$$$*     --> signal of the central strip
637        sc = CLSIGNAL(INDMAX(ic)) !center  c$$$      sc = CLSIGNAL(INDMAX(ic)) !center
638    c$$$
639  *     signal of adjacent strips  c$$$*     signal of adjacent strips
640  *     --> left  c$$$*     --> left
641        sl1 = 0                  !left 1  c$$$      sl1 = 0                  !left 1
642        if(  c$$$      if(
643       $     (INDMAX(ic)-1).ge.INDSTART(ic)  c$$$     $     (INDMAX(ic)-1).ge.INDSTART(ic)
644       $     )  c$$$     $     )
645       $     sl1 = max(0.,CLSIGNAL(INDMAX(ic)-1))  c$$$     $     sl1 = max(0.,CLSIGNAL(INDMAX(ic)-1))
646    c$$$
647        sl2 = 0                  !left 2  c$$$      sl2 = 0                  !left 2
648        if(  c$$$      if(
649       $     (INDMAX(ic)-2).ge.INDSTART(ic)  c$$$     $     (INDMAX(ic)-2).ge.INDSTART(ic)
650       $     )  c$$$     $     )
651       $     sl2 = max(0.,CLSIGNAL(INDMAX(ic)-2))  c$$$     $     sl2 = max(0.,CLSIGNAL(INDMAX(ic)-2))
652    c$$$
653  *     --> right  c$$$*     --> right
654        sr1 = 0                  !right 1  c$$$      sr1 = 0                  !right 1
655        if(  c$$$      if(
656       $     (ic.ne.NCLSTR1.and.(INDMAX(ic)+1).lt.INDSTART(ic+1))  c$$$     $     (ic.ne.NCLSTR1.and.(INDMAX(ic)+1).lt.INDSTART(ic+1))
657       $     .or.  c$$$     $     .or.
658       $     (ic.eq.NCLSTR1.and.(INDMAX(ic)+1).le.TOTCLLENGTH)  c$$$     $     (ic.eq.NCLSTR1.and.(INDMAX(ic)+1).le.TOTCLLENGTH)
659       $     )  c$$$     $     )
660       $     sr1 = max(0.,CLSIGNAL(INDMAX(ic)+1))  c$$$     $     sr1 = max(0.,CLSIGNAL(INDMAX(ic)+1))
661    c$$$
662        sr2 = 0                  !right 2  c$$$      sr2 = 0                  !right 2
663        if(  c$$$      if(
664       $     (ic.ne.NCLSTR1.and.(INDMAX(ic)+2).lt.INDSTART(ic+1))  c$$$     $     (ic.ne.NCLSTR1.and.(INDMAX(ic)+2).lt.INDSTART(ic+1))
665       $     .or.  c$$$     $     .or.
666       $     (ic.eq.NCLSTR1.and.(INDMAX(ic)+2).le.TOTCLLENGTH)  c$$$     $     (ic.eq.NCLSTR1.and.(INDMAX(ic)+2).le.TOTCLLENGTH)
667       $     )  c$$$     $     )
668       $     sr2 = max(0.,CLSIGNAL(INDMAX(ic)+2))  c$$$     $     sr2 = max(0.,CLSIGNAL(INDMAX(ic)+2))
669          c$$$      
670  ************************************************************  c$$$************************************************************
671  *     COG computation  c$$$*     COG computation
672  ************************************************************  c$$$************************************************************
673    c$$$
674  c      print*,sl2,sl1,sc,sr1,sr2  c$$$c      print*,sl2,sl1,sc,sr1,sr2
675    c$$$
676        COG = 0.  c$$$      COG = 0.
677            c$$$        
678        if(sl1.gt.sr1.and.sl1.gt.0.)then  c$$$      if(sl1.gt.sr1.and.sl1.gt.0.)then
679            c$$$        
680           if(ncog.eq.2.and.sl1.ne.0)then  c$$$         if(ncog.eq.2.and.sl1.ne.0)then
681              COG = -sl1/(sl1+sc)          c$$$            COG = -sl1/(sl1+sc)        
682           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
683              COG = (sr1-sl1)/(sl1+sc+sr1)  c$$$            COG = (sr1-sl1)/(sl1+sc+sr1)
684           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
685              COG = (sr1-sl1-2*sl2)/(sl2+sl1+sc+sr1)  c$$$            COG = (sr1-sl1-2*sl2)/(sl2+sl1+sc+sr1)
686           else  c$$$         else
687              COG = 0.  c$$$            COG = 0.
688           endif  c$$$         endif
689            c$$$        
690        elseif(sl1.le.sr1.and.sr1.gt.0.)then  c$$$      elseif(sl1.le.sr1.and.sr1.gt.0.)then
691    c$$$
692           if(ncog.eq.2.and.sr1.ne.0)then  c$$$         if(ncog.eq.2.and.sr1.ne.0)then
693              COG = sr1/(sc+sr1)              c$$$            COG = sr1/(sc+sr1)            
694           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
695              COG = (sr1-sl1)/(sl1+sc+sr1)  c$$$            COG = (sr1-sl1)/(sl1+sc+sr1)
696           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
697              COG = (2*sr2+sr1-sl1)/(sl2+sl1+sc+sr1)  c$$$            COG = (2*sr2+sr1-sl1)/(sl2+sl1+sc+sr1)
698           else  c$$$         else
699              COG = 0.  c$$$            COG = 0.
700           endif  c$$$         endif
701    c$$$
702        endif  c$$$      endif
703    c$$$
704        COG0 = COG  c$$$      COG0 = COG
705    c$$$
706  c      print *,ncog,ic,cog,'/////////////'  c$$$c      print *,ncog,ic,cog,'/////////////'
707    c$$$
708        return  c$$$      return
709        end  c$$$      end
710    
711  *** * * * *** * * * *** * * * *** * * * *** * * * *** * * * ***  *** * * * *** * * * *** * * * *** * * * *** * * * *** * * * ***
712        real function cog(ncog,ic)        real function cog(ncog,ic)
# Line 738  c      print *,ncog,ic,cog,'//////////// Line 738  c      print *,ncog,ic,cog,'////////////
738  *     --> signal of the central strip  *     --> signal of the central strip
739           sc = CLSIGNAL(INDMAX(ic)) !center           sc = CLSIGNAL(INDMAX(ic)) !center
740  *     signal of adjacent strips  *     signal of adjacent strips
741           sl1 = 0                !left 1           sl1 = -9999.           !left 1
742           if(           if(
743       $        (INDMAX(ic)-1).ge.INDSTART(ic)       $        (INDMAX(ic)-1).ge.INDSTART(ic)
744       $        )       $        )
745       $        sl1 = CLSIGNAL(INDMAX(ic)-1)       $        sl1 = CLSIGNAL(INDMAX(ic)-1)
746                    
747           sl2 = 0                !left 2           sl2 = -9999.           !left 2
748           if(           if(
749       $        (INDMAX(ic)-2).ge.INDSTART(ic)       $        (INDMAX(ic)-2).ge.INDSTART(ic)
750       $        )       $        )
751       $        sl2 = CLSIGNAL(INDMAX(ic)-2)       $        sl2 = CLSIGNAL(INDMAX(ic)-2)
752                    
753           sr1 = 0                !right 1           sr1 = -9999.           !right 1
754           if(           if(
755       $        (ic.ne.NCLSTR1.and.(INDMAX(ic)+1).lt.INDSTART(ic+1))       $        (ic.ne.NCLSTR1.and.(INDMAX(ic)+1).lt.INDSTART(ic+1))
756       $        .or.       $        .or.
# Line 758  c      print *,ncog,ic,cog,'//////////// Line 758  c      print *,ncog,ic,cog,'////////////
758       $        )       $        )
759       $        sr1 = CLSIGNAL(INDMAX(ic)+1)       $        sr1 = CLSIGNAL(INDMAX(ic)+1)
760                    
761           sr2 = 0                !right 2           sr2 = -9999.           !right 2
762           if(           if(
763       $        (ic.ne.NCLSTR1.and.(INDMAX(ic)+2).lt.INDSTART(ic+1))       $        (ic.ne.NCLSTR1.and.(INDMAX(ic)+2).lt.INDSTART(ic+1))
764       $        .or.       $        .or.
# Line 770  c      print *,ncog,ic,cog,'//////////// Line 770  c      print *,ncog,ic,cog,'////////////
770                    
771  c         print*,'## ',sl2,sl1,sc,sr1,sr2  c         print*,'## ',sl2,sl1,sc,sr1,sr2
772    
773    c     ==============================================================
774           if(ncog.eq.1)then           if(ncog.eq.1)then
775              COG = 0.              COG = 0.
776                if(sr1.gt.sc)cog=1. !NEW
777                if(sl1.gt.sc.and.sl1.gt.sr1)cog=-1. !NEW
778    c     ==============================================================
779           elseif(ncog.eq.2)then           elseif(ncog.eq.2)then
780              if(sl1.gt.sr1)then              if(sl1.gt.sr1)then
781                 if((sl1+sc).ne.0)COG = -sl1/(sl1+sc)                         if((sl1+sc).ne.0)COG = -sl1/(sl1+sc)        
782              elseif(sl1.le.sr1)then              elseif(sl1.lt.sr1)then
783                 if((sc+sr1).ne.0)COG = sr1/(sc+sr1)                             if((sc+sr1).ne.0)COG = sr1/(sc+sr1)                        
784              endif              elseif( sl1.eq.sr1.and.sl1.ne.-9999.)then !NEW
785                   if( clsigma(indmax(ic)-1).lt.clsigma(indmax(ic)+1)
786         $              .and.(sl1+sc).ne.0 )cog = -sl1/(sl1+sc) !NEW
787                   if( clsigma(indmax(ic)-1).gt.clsigma(indmax(ic)+1)
788         $              .and.(sc+sr1).ne.0 )cog = sr1/(sc+sr1) !NEW
789                endif
790    c$$$            if(cog==0)print*,'Strange cluster (2) - @maxs ',MAXS(ic)
791    c$$$     $           ,VIEW(ic),LADDER(ic)
792    c$$$     $           ,' : ',sl2,sl1,sc,sr1,sr2
793    c     ==============================================================
794           elseif(ncog.eq.3)then           elseif(ncog.eq.3)then
795               if((sl1+sc+sr1).ne.0)COG = (sr1-sl1)/(sl1+sc+sr1)               if( (sl1+sc+sr1).ne.0 )COG = (sr1-sl1)/(sl1+sc+sr1)
796    c$$$             if(cog==0)print*,'Strange cluster (3) - @maxs ',MAXS(ic)
797    c$$$     $           ,VIEW(ic),LADDER(ic)
798    c$$$     $            ,' : ',sl2,sl1,sc,sr1,sr2
799    c     ==============================================================
800           elseif(ncog.eq.4)then           elseif(ncog.eq.4)then
801              if(sl2.gt.sr2)then              if(sl2.gt.sr2)then
802                 if((sl2+sl1+sc+sr1).ne.0)                 if((sl2+sl1+sc+sr1).ne.0)
803       $              COG = (sr1-sl1-2*sl2)/(sl2+sl1+sc+sr1)       $              COG = (sr1-sl1-2*sl2)/(sl2+sl1+sc+sr1)
804              elseif(sl2.le.sr2)then              elseif(sl2.lt.sr2)then
805                  if((sr2+sl1+sc+sr1).ne.0)                 if((sr2+sl1+sc+sr1).ne.0)
806       $              COG = (2*sr2+sr1-sl1)/(sr2+sl1+sc+sr1)       $              COG = (2*sr2+sr1-sl1)/(sr2+sl1+sc+sr1)
807                elseif(sl2.eq.sr2.and.sl2.ne.-9999.)then !NEW
808                   if( clsigma(indmax(ic)-2).lt.clsigma(indmax(ic)+2)
809         $              .and.(sl2+sl1+sc+sr1).ne.0 )
810         $              cog = (sr1-sl1-2*sl2)/(sl2+sl1+sc+sr1) !NEW
811                   if( clsigma(indmax(ic)-2).gt.clsigma(indmax(ic)+2)
812         $              .and.(sr2+sl1+sc+sr1).ne.0 )
813         $              cog = (2*sr2+sr1-sl1)/(sr2+sl1+sc+sr1)  !NEW              
814              endif              endif
815    c$$$            if(cog==0)print*,'Strange cluster (4) - @maxs ',MAXS(ic)
816    c$$$     $           ,VIEW(ic),LADDER(ic)
817    c$$$     $           ,' : ',sl2,sl1,sc,sr1,sr2
818    c     ==============================================================
819           else           else
820              print*,'function COG(NCOG,IC) ==> WARNING!! NCOG=',NCOG              print*,'function COG(NCOG,IC) ==> WARNING!! NCOG=',NCOG
821       $           ,' not implemented'       $           ,' not implemented'

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

  ViewVC Help
Powered by ViewVC 1.1.23