1 |
pam-fi |
1.1 |
************************************************************************* |
2 |
|
|
* |
3 |
|
|
* Subroutine cnoise.f!DA COMMENTARE!??? |
4 |
|
|
* |
5 |
|
|
* uses adc(nviews,nva1_view,nstrips_va1) and |
6 |
|
|
* pedestal(nviews,nva1_view,nstrips_va1) variables to compute common noise, |
7 |
|
|
* and fills cn(nviews,nva1_view) variable. in the computation only |
8 |
|
|
* not-bad and not-signal-affected strips are used |
9 |
|
|
* (bad(nviews,nva1_view,nstrips_va1) and |
10 |
|
|
* clstr(nviews,nva1_view,nstrips_va1) flags) |
11 |
|
|
* |
12 |
|
|
* needs: |
13 |
|
|
* - ./common_calib.f |
14 |
|
|
* |
15 |
|
|
* to be called inside ./cncomp.f |
16 |
|
|
* |
17 |
|
|
************************************************************************* |
18 |
|
|
|
19 |
|
|
subroutine cnoise(i,j,gulp) !(view, VA1) |
20 |
|
|
|
21 |
|
|
include '../common/commontracker.f' |
22 |
|
|
include '../common/common_reduction.f' |
23 |
|
|
include '../common/calib.f' |
24 |
|
|
|
25 |
|
|
|
26 |
|
|
integer gulp !error flag |
27 |
|
|
|
28 |
|
|
ncn=0 !number of strips in cn computation |
29 |
|
|
cn(i,j)=0 !initializes cn variable |
30 |
|
|
|
31 |
|
|
|
32 |
|
|
do k=1,nstrips_va1 !loops on strips |
33 |
|
|
iok=strange(i,j,k)*bad(i,j,k)*clstr(i,j,k) !flag to mark strange, bad |
34 |
|
|
! or signal affected strips |
35 |
|
|
c print*,i,j,k,strange(i,j,k),bad(i,j,k),clstr(i,j,k),iok !??? |
36 |
|
|
|
37 |
|
|
cn(i,j)=cn(i,j) + (DBLE(adc(i,j,k)) - pedestal(i,j,k))*iok !sums ADC-PED |
38 |
|
|
! values to compute common noise |
39 |
|
|
ncn=ncn+iok !counts number of strips in cn computation |
40 |
|
|
enddo |
41 |
|
|
|
42 |
|
|
if(ncn.eq.0) then !no signal free strips on this VA1... |
43 |
|
|
print*,'cnoise: WARNING, NO SIGNAL FREE STRIPS ON VA1 ',j, |
44 |
|
|
$ ', VIEW ',i |
45 |
|
|
gulp=1 |
46 |
|
|
else |
47 |
|
|
cn(i,j)=cn(i,j)/DBLE(ncn) !computes common noise |
48 |
|
|
gulp=0 !resets error flag |
49 |
|
|
endif |
50 |
|
|
|
51 |
|
|
return |
52 |
|
|
end |