2 |
|
|
3 |
|
|
4 |
include 'commontracker.f' |
include 'commontracker.f' |
|
include 'common_reduction.f' |
|
5 |
include 'level0.f' |
include 'level0.f' |
6 |
|
include 'level1.f' |
7 |
include 'calib.f' |
include 'calib.f' |
8 |
|
|
9 |
|
|
10 |
|
include 'common_reduction.f' |
11 |
|
|
12 |
|
|
13 |
external nvk |
external nvk |
14 |
external nst |
external nst |
15 |
|
|
66 |
call compdecode(word,flag,tipo,info,errflag) |
call compdecode(word,flag,tipo,info,errflag) |
67 |
|
|
68 |
if(errflag.ne.0.) then |
if(errflag.ne.0.) then |
69 |
print*,'filladc --> ERROR on compdecode' |
if(debug)print*,'filladc --> ERROR on compdecode' |
70 |
iflag=1 |
iflag=1 |
71 |
return |
return |
72 |
endif |
endif |
74 |
if(flag.eq.1) then ! flag: fine messaggio (ladder) |
if(flag.eq.1) then ! flag: fine messaggio (ladder) |
75 |
|
|
76 |
if(info.ne.1.and.info.ne.2.and.info.ne.3) then |
if(info.ne.1.and.info.ne.2.and.info.ne.3) then |
77 |
print*, |
if(debug)print*, |
78 |
$ 'filladc --> wrong end-of-ladder ' |
$ 'filladc --> wrong end-of-ladder ' |
79 |
$ //'in COMPRESSED mode' |
$ //'in COMPRESSED mode' |
80 |
print*, |
if(debug)print*, |
81 |
$ ' info(=ladder) ',info,' type ',tipo |
$ ' info(=ladder) ',info,' type ',tipo |
82 |
iflag=1 |
iflag=1 |
83 |
return |
return |
90 |
newVAL=max(0,newVAL) |
newVAL=max(0,newVAL) |
91 |
newVAL=min(4095,newVAL) |
newVAL=min(4095,newVAL) |
92 |
adc(DSPn,nvk(js),nst(js))=newVAL |
adc(DSPn,nvk(js),nst(js))=newVAL |
93 |
ccc print*,DSPn,nvk(js),nst(js),newval |
c$$$ print*,DSPn,nvk(js),nst(js) |
94 |
|
c$$$ $ ,pedestal_t(DSPn,nvk(js),nst(js)),newval |
95 |
|
c$$$ $ ,pedestal(DSPn,nvk(js),nst(js)) |
96 |
enddo |
enddo |
97 |
|
|
98 |
if(info.eq.3) goto 1000 |
if(info.eq.3) goto 1000 |
119 |
is = iaddr |
is = iaddr |
120 |
prec_ind = 1 |
prec_ind = 1 |
121 |
else |
else |
122 |
print*,'filladc --> address '// |
if(debug)print*,'filladc --> address '// |
123 |
$ 'out of range - iaddr,is',iaddr,is |
$ 'out of range - iaddr,is',iaddr,is |
124 |
iflag=1 |
iflag=1 |
125 |
return |
return |
129 |
if(prec_ind.eq.0) is=is+1 |
if(prec_ind.eq.0) is=is+1 |
130 |
if(info.ge.0.and.info.le.4095) then |
if(info.ge.0.and.info.le.4095) then |
131 |
if(is.gt.3072)then |
if(is.gt.3072)then |
132 |
print*, |
if(debug)print*, |
133 |
$ 'filladc --> strip out of range - DSPn,is' |
$ 'filladc --> strip out of range - DSPn,is' |
134 |
$ ,DSPn,is |
$ ,DSPn,is |
135 |
iflag=1 |
iflag=1 |
142 |
|
|
143 |
oldVAL=newVAL |
oldVAL=newVAL |
144 |
else |
else |
145 |
print*,'filladc --> datum out of range - info',info |
if(debug) |
146 |
|
$ print*,'filladc --> datum out of range - info',info |
147 |
iflag=1 |
iflag=1 |
148 |
return |
return |
149 |
endif |
endif |
183 |
enddo |
enddo |
184 |
idata = idata+1 |
idata = idata+1 |
185 |
if(datatracker(idata).ne.ior(z'1800',i+3)) then |
if(datatracker(idata).ne.ior(z'1800',i+3)) then |
186 |
print*,'filladc --> wrong end-of-ladder in FULL mode' |
if(debug) |
187 |
print*,' word ',datatracker(idata) |
$ print*,'filladc --> wrong end-of-ladder in FULL mode' |
188 |
print*,' should be ',ior(z'1800',i+3) |
if(debug) |
189 |
|
$ print*,' word ',datatracker(idata) |
190 |
|
if(debug) |
191 |
|
$ print*,' should be ',ior(z'1800',i+3) |
192 |
iflag=1 |
iflag=1 |
193 |
return |
return |
194 |
endif |
endif |
222 |
flag=ishft(flag,-12) |
flag=ishft(flag,-12) |
223 |
|
|
224 |
if(flag.ne.0.and.flag.ne.1) then |
if(flag.ne.0.and.flag.ne.1) then |
225 |
print*,'compdecode --> error on uncompression: flag=',flag |
c print*,'compdecode --> error on uncompression: flag=',flag |
226 |
errflag=1. |
errflag=1. |
227 |
endif |
endif |
228 |
if(flag.eq.0) then ! valore ADC |
if(flag.eq.0) then ! valore ADC |
233 |
info=iand(word,z'03ff') |
info=iand(word,z'03ff') |
234 |
tipo=iand(word,z'0c00') |
tipo=iand(word,z'0c00') |
235 |
if(tipo.ne.0.and.tipo.ne.z'0800') then |
if(tipo.ne.0.and.tipo.ne.z'0800') then |
236 |
print*,'compdecode --> error on decompression: tipo=',tipo |
c print*,'compdecode --> error on decompression: tipo=',tipo |
237 |
errflag=1. |
errflag=1. |
238 |
endif |
endif |
239 |
if(tipo.eq.0) then ! indirizzo |
if(tipo.eq.0) then ! indirizzo |