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

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

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

revision 1.2 by pam-fi, Tue May 30 16:30:37 2006 UTC revision 1.6 by pam-fi, Thu Oct 26 16:22:37 2006 UTC
# Line 10  Line 10 
10        subroutine cncomp(i,j,errflag)    !(view, VA1)        subroutine cncomp(i,j,errflag)    !(view, VA1)
11    
12        include 'commontracker.f'        include 'commontracker.f'
13          include 'level1.f'
14        include 'common_reduction.f'        include 'common_reduction.f'
15        include 'calib.f'        include 'calib.f'
16    
# Line 50  c--------------------------------------- Line 51  c---------------------------------------
51                
52        do k=1,nstrips_va1        do k=1,nstrips_va1
53           nstr = nstr + strange(i,j,k) !uses only           nstr = nstr + strange(i,j,k) !uses only
54           if(mod(i,2).eq.1) then !odd strip ---> Y view           if(mod(i,2).eq.1) then ! ---> Y view
55              signal(k) = - (DBLE(adc(i,j,k)) - pedestal(i,j,k)) !negative signal              signal(k) = - (DBLE(adc(i,j,k)) - pedestal(i,j,k)) !negative signal
56           else                   !even strip ---> X view           else                   ! ---> X view
57              signal(k) =    DBLE(adc(i,j,k)) - pedestal(i,j,k) !positive signal              signal(k) =    DBLE(adc(i,j,k)) - pedestal(i,j,k) !positive signal
58           endif           endif
59           smean = smean + signal(k)*strange(i,j,k)           smean = smean + signal(k)*strange(i,j,k)
60           ssigma = ssigma + (signal(k)**2)*strange(i,j,k)           ssigma = ssigma + (signal(k)**2)*strange(i,j,k)
61        enddo        enddo
62                
63        smean=smean/nstr          !strips value distribution mean        smean=smean/nstr          !strips value distribution mean      
         
64        ssigma=SQRT((ssigma/nstr)-smean**2) !strips value distribution sigma        ssigma=SQRT((ssigma/nstr)-smean**2) !strips value distribution sigma
65                
66        cut=scut*ssigma           !exclusion cut        cut=scut*ssigma           !exclusion cut
67                
68          nco=0
69          nbo=0
70        do k=1,nstrips_va1        do k=1,nstrips_va1
71           if(ABS(signal(k)-smean).gt.cut) then           if(ABS(signal(k)-smean).gt.cut) then
72              strange(i,j,k)=0    !marks strips exceeding cut              strange(i,j,k)=0    !marks strips exceeding cut
73    c            print*,i,j,k,signal(k),smean
74           endif           endif
75             nco=nco+strange(i,j,k)
76             nbo=nbo+bad(i,j,k)
77        enddo                     ! in order not to use them in CN computation        enddo                     ! in order not to use them in CN computation
78    
79    c$$$      if(i.eq.12.and.(j.eq.2.or.j.eq.3))then
80    c$$$         print*,'view ',i,' vk ',j
81    c$$$         print*,'ADC (1-51-128) = ',adc(i,j,1),adc(i,j,52),adc(i,j,128)
82    c$$$         print*,'<ADC-PED> = ',smean
83    c$$$         print*,'s         = ',ssigma
84    c$$$         print*,'nstrange  = ',128-nco
85    c$$$         print*,'nbad      = ',128-nbo
86    c$$$      endif
87    
88        countme = countme + 1         !???        countme = countme + 1         !???
89        if (countme.le.3) goto 666 !???        if (countme.le.3) goto 666 !???
# Line 133  c--------------------------------------- Line 146  c---------------------------------------
146        subroutine cnoise(i,j,gulp) !(view, VA1)        subroutine cnoise(i,j,gulp) !(view, VA1)
147    
148        include 'commontracker.f'        include 'commontracker.f'
149          include 'level0.f'
150          include 'level1.f'
151        include 'common_reduction.f'        include 'common_reduction.f'
152        include 'calib.f'        include 'calib.f'
153                
# Line 141  c--------------------------------------- Line 156  c---------------------------------------
156                
157        ncn=0                     !number of strips in cn computation        ncn=0                     !number of strips in cn computation
158        cn(i,j)=0                 !initializes cn variable        cn(i,j)=0                 !initializes cn variable
159          cnrms(i,j)=0              !initializes cn rms
160          cnn(i,j)=0                !initialize cn flag
161    
162        do k=1,nstrips_va1        !loops on strips        do k=1,nstrips_va1        !loops on strips
163  *        tags strange, bad or signal-affected strips  *        tags strange, bad or signal-affected strips
164           iok=strange(i,j,k)*bad(i,j,k)*clstr(i,j,k)           iok = strange(i,j,k)*bad(i,j,k)*clstr(i,j,k)
165           cn(i,j)=cn(i,j) + (DBLE(adc(i,j,k)) - pedestal(i,j,k))*iok           cn(i,j) = cn(i,j) + (DBLE(adc(i,j,k)) - pedestal(i,j,k))*iok
166             cnrms(i,j) = cnrms(i,j)
167         $        + (DBLE(adc(i,j,k)) - pedestal(i,j,k))
168         $        *(DBLE(adc(i,j,k)) - pedestal(i,j,k))*iok
169           ncn = ncn + iok            !counts number of strips in cn computation           ncn = ncn + iok            !counts number of strips in cn computation
170        enddo        enddo
171                
172        NSTRIPMAX=10        if(ncn.lt.NSTRIPMIN) then         !no signal free strips on this VA1...
       if(ncn.lt.NSTRIPMAX) then         !no signal free strips on this VA1...  
173           if(ncn.eq.0)then           if(ncn.eq.0)then
174              if(debug)print*,' WARNING - cnoise: ',              if(debug)print*,' WARNING - cnoise: ',
175       $        'no strips for CN computation on VA1 ',j,       $        'no strips for CN computation on VA1 ',j,
176       $        ', VIEW ',i       $        ', VIEW ',i,'  >>> FAILED '
177           else           else
178              if(debug)print*,' WARNING - cnoise: ',              if(debug)print*,' WARNING - cnoise: ',
179       $        'less than ',NSTRIPMAX       $        'less than ',NSTRIPMIN
180       $           ,'strips for CN computation on VA1 ',j,       $           ,' strips for CN computation on VA1 ',j,
181       $        ', VIEW ',i       $        ', VIEW ',i,'  >>> FAILED '
182           endif           endif
183           gulp=1           gulp=1
184             cnn(i,j) = 0
185        else        else
186           cn(i,j)=cn(i,j)/DBLE(ncn) !<<<< computes common noise           cn(i,j)=cn(i,j)/DBLE(ncn) !<<<< computes common noise
187             cnrms(i,j)= SQRT( cnrms(i,j)/DBLE(ncn) - cn(i,j)**2 )
188             cnn(i,j) = ncn
189           gulp=0                           gulp=0                
190             if(debug.and.ABS(cn(i,j)).gt.1000)
191         $        print*,'Event ',eventn(1)
192         $        ,': cn(',i,',',j,')= ',cn(i,j),' ncn ',ncn
193        endif        endif
194    
195        return        return
# Line 191  c--------------------------------------- Line 216  c---------------------------------------
216        subroutine cutcn(i,j)     !(view, VA1)        subroutine cutcn(i,j)     !(view, VA1)
217    
218        include 'commontracker.f'        include 'commontracker.f'
219          include 'level1.f'
220        include 'common_reduction.f'        include 'common_reduction.f'
221        include 'calib.f'        include 'calib.f'
222    

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.6

  ViewVC Help
Powered by ViewVC 1.1.23