/[PAMELA software]/yoda/techmodel/forroutines/calorimeter/calpedestal.f
ViewVC logotype

Annotation of /yoda/techmodel/forroutines/calorimeter/calpedestal.f

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (hide annotations) (download)
Tue Jul 6 12:20:23 2004 UTC (20 years, 9 months ago) by kusanagi
Branch: MAIN
Initial revision

1 kusanagi 1.1 C------------------------------------------------
2     SUBROUTINE calpedestal(vect,ERROR,CAL_PED,CAL_GOOD,CAL_THR,
3     & CAL_RMS,CAL_BASE,CAL_VAR)
4     C------------------------------------------------
5     IMPLICIT NONE
6     EXTERNAL CRC
7     C
8     C Normal variables definition
9     C
10     INTEGER ERROR
11     C
12     INTEGER i, j, ival
13     C
14     INTEGER*2 VECT(20000)
15     C
16     integer*2 check, crc
17     C
18     INTEGER ic, k
19     INTEGER status
20     INTEGER inf, sup
21    
22     INTEGER*2 length, length2
23    
24     INTEGER*2 st1, st2
25    
26     REAL CAL_PED(4,11,96), CAL_GOOD(4,11,96), CAL_THR(4,11,6)
27     REAL CAL_RMS(4,11,96), CAL_BASE(4,11,6), CAL_VAR(4,11,6)
28    
29     C
30     C Begin !
31     C
32     ERROR = 0
33     ival = 0
34     C
35     ic = 0
36     c
37     length = ic
38     do k = 1,4
39     C
40     C Check consistency of status word.
41     C
42     ic = length + 1
43     st1 = IAND(vect(ic),'00FF'x)
44     if (st1.ne.0) then
45     write (*,10) k,vect(ic)
46     endif
47     st2 = IAND(vect(ic),'FF00'x)
48     status = ISHFT(st2,-8)
49     if (k.eq.1.and.status.ne.170) then
50     write (*,11) k,vect(ic)
51     ERROR = 1
52     goto 50
53     endif
54     if (k.eq.2.and.status.ne.182) then
55     write (*,11) k,vect(ic)
56     ERROR = 1
57     goto 50
58     endif
59     if (k.eq.3.and.status.ne.177) then
60     write (*,11) k,vect(ic)
61     ERROR = 1
62     goto 50
63     endif
64     if (k.eq.4.and.status.ne.173) then
65     write (*,11) k,vect(ic)
66     ERROR = 1
67     goto 50
68     endif
69     10 FORMAT(2X,'Error for view:',2X,I1,2X,'Status word:',2X,Z4)
70     11 FORMAT(2X,'View or command not recorgnized for view:',2X,I1,2X,
71     & 'Status word:',2X,Z4)
72     C
73     ic = ic + 1
74     length = length + (vect(ic) + 2)
75     length2 = vect(ic)
76     C
77     C Check validity of length.
78     C
79     if (vect(ic).ne.4629) then
80     print *,'problems with view',k
81     ERROR = 1
82     goto 50
83     endif
84     C
85     C Check consistency of CRC.
86     C
87     check = 0.
88     inf = (length-length2-2)+1
89     sup = length - 1
90     do i = inf,sup
91     check=CRC(check,vect(i))
92     enddo
93     if (check.ne.vect(length)) then
94     print *,'Problems with CRC of view:',k
95     ERROR = 1
96     goto 50
97     endif
98     C
99     C Process data.
100     C
101     do i = 1,11
102     do j = 1,96
103     ic = ic + 1
104     cal_ped(k,i,j) = vect(ic)
105     cal_good(k,i,j) = vect(ic+1)
106     ic = ic + 1
107     enddo
108     enddo
109     C
110     ic = ic + 4
111     do i = 1,11
112     do j = 1,6
113     ic = ic + 1
114     cal_thr(k,i,j) = vect(ic)
115     ic = ic + 1
116     enddo
117     enddo
118    
119     c
120     ic = ic + 4
121     do i = 1,11
122     do j = 1,96
123     ic = ic + 1
124     cal_rms(k,i,j) = vect(ic)
125     ic = ic + 1
126     enddo
127     enddo
128     c
129     do i = 1,11
130     do j = 1,6
131     ic = ic + 1
132     cal_base(k,i,j) = vect(ic)
133     ic = ic + 1
134     ic = ic + 1
135     cal_var(k,i,j) = vect(ic)
136     ic = ic + 1
137     enddo
138     enddo
139     c
140     50 continue
141     c
142     enddo
143     C
144    
145     RETURN
146     END
147    
148    

  ViewVC Help
Powered by ViewVC 1.1.23