9 |
|
|
10 |
include 'common_reduction.f' |
include 'common_reduction.f' |
11 |
|
|
|
|
|
12 |
external nvk |
external nvk |
13 |
external nst |
external nst |
14 |
|
|
43 |
C jump to next view |
C jump to next view |
44 |
C --------------------------- |
C --------------------------- |
45 |
|
|
46 |
|
nword_DSP = 0 |
47 |
if(DSPn.eq.0 |
if(DSPn.eq.0 |
48 |
|
$ .or.DSPn.gt.nviews |
49 |
$ .or.datalength(iv).eq.0)goto 333 |
$ .or.datalength(iv).eq.0)goto 333 |
50 |
|
|
51 |
C++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
C++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
52 |
if( iand(DAQmode(iv),z'0003').eq.z'0002'.or. |
if( iand(DAQmode(iv),z'0003').eq.z'0002'.or. |
53 |
$ iand(DAQmode(iv),z'0003').eq.z'0003'.or. |
$ iand(DAQmode(iv),z'0003').eq.z'0003'.or. |
60 |
prec_ind = 0 |
prec_ind = 0 |
61 |
222 continue |
222 continue |
62 |
idata = idata+1 |
idata = idata+1 |
63 |
word=datatracker(idata) |
if( idata.gt.NWORDMAX )goto 335 !end to end |
64 |
|
nword_DSP = nword_DSP +1 |
65 |
|
if( nword_DSP.gt.datalength(iv) )then |
66 |
|
if( verbose )print*,'filladc --> missing end-of-ladder', |
67 |
|
$ ' in COMPRESSED mode - DSP ',DSPn |
68 |
|
if(verbose)print*,'datalength = ',datalength(iv) |
69 |
|
iflag=1 |
70 |
|
GOOD1(DSPn) = 10 |
71 |
|
goto 334 !next view |
72 |
|
endif |
73 |
|
word = datatracker(idata) |
74 |
C------------------------------------------------------ |
C------------------------------------------------------ |
75 |
C call routine to uncompress data |
C call routine to uncompress data |
76 |
C------------------------------------------------------ |
C------------------------------------------------------ |
101 |
il = info |
il = info |
102 |
do js=is+1,1024*il |
do js=is+1,1024*il |
103 |
|
|
104 |
if( DSPn.le.nviews |
if( DSPn.le.nviews |
105 |
|
$ .and.nvk(js).gt.0 |
106 |
$ .and.nvk(js).le.nva1_view |
$ .and.nvk(js).le.nva1_view |
107 |
|
$ .and.nst(js).gt.0 |
108 |
$ .and.nst(js).le.nstrips_va1 |
$ .and.nst(js).le.nstrips_va1 |
|
$ .and.nvk(is).le.nva1_view |
|
|
$ .and.nst(is).le.nstrips_va1 |
|
109 |
$ )then |
$ )then |
110 |
|
|
111 |
newVAL=oldVAL-pedestal_t(DSPn,nvk(is),nst(is)) |
newVAL = 0 |
112 |
$ +pedestal_t(DSPn,nvk(js),nst(js)) |
if( |
113 |
newVAL=max(0,newVAL) |
$ nvk(is).gt.0.and. |
114 |
newVAL=min(4095,newVAL) |
$ nvk(is).le.nva1_view.and. |
115 |
|
$ nst(is).gt.0.and. |
116 |
|
$ nst(is).le.nstrips_va1.and. |
117 |
|
$ .true.)then |
118 |
|
newVAL=oldVAL-pedestal_t(DSPn,nvk(is),nst(is)) |
119 |
|
$ +pedestal_t(DSPn,nvk(js),nst(js)) |
120 |
|
newVAL=max(0,newVAL) |
121 |
|
newVAL=min(4095,newVAL) |
122 |
|
endif |
123 |
adc(DSPn,nvk(js),nst(js))=newVAL |
adc(DSPn,nvk(js),nst(js))=newVAL |
124 |
else |
else |
125 |
print*,'filladc -->' |
print*,'filladc -->' |
126 |
$ ,' attempt to access array elements (1)' |
$ ,' attempt to access array element (1)' |
127 |
$ ,'(',DSPn,nvk(is),nst(is),')' |
c $ ,'(',DSPn,nvk(is),nst(is),')' |
128 |
$ ,'(',DSPn,nvk(js),nst(js),')' |
$ ,'pedestal_t(',DSPn,nvk(js),nst(js),')' |
129 |
endif |
endif |
130 |
c$$$ print*,DSPn,nvk(js),nst(js) |
c$$$ print*,DSPn,nvk(js),nst(js) |
131 |
c$$$ $ ,pedestal_t(DSPn,nvk(js),nst(js)),newval |
c$$$ $ ,pedestal_t(DSPn,nvk(js),nst(js)),newval |
142 |
if(tipo.eq.1) then ! tipo: indirizzo |
if(tipo.eq.1) then ! tipo: indirizzo |
143 |
iaddr = info + il*1024 |
iaddr = info + il*1024 |
144 |
if(iaddr.ge.is+1.and.iaddr.le.3072) then |
if(iaddr.ge.is+1.and.iaddr.le.3072) then |
145 |
|
|
146 |
|
if(is.eq.0.or.is.eq.1024.or.is.eq.2048)then |
147 |
|
if(verbose)print*,'filladc -->' |
148 |
|
$ ,' previous transmitted strip ',is |
149 |
|
$ ,' - missing first ADC value' |
150 |
|
iflag=1 |
151 |
|
GOOD1(DSPn) = 10 |
152 |
|
endif |
153 |
do js = is+1,iaddr-1 |
do js = is+1,iaddr-1 |
154 |
|
|
155 |
if( DSPn.le.nviews |
if( DSPn.le.nviews |
156 |
|
$ .and.nvk(js).gt.0 |
157 |
$ .and.nvk(js).le.nva1_view |
$ .and.nvk(js).le.nva1_view |
158 |
|
$ .and.nst(js).gt.0 |
159 |
$ .and.nst(js).le.nstrips_va1 |
$ .and.nst(js).le.nstrips_va1 |
|
$ .and.nvk(is).le.nva1_view |
|
|
$ .and.nst(is).le.nstrips_va1 |
|
160 |
$ )then |
$ )then |
161 |
|
|
162 |
newVAL=oldVAL |
newVAL = 0 |
163 |
$ -pedestal_t(DSPn,nvk(is),nst(is)) |
if( |
164 |
$ +pedestal_t(DSPn,nvk(js),nst(js)) |
$ nvk(is).gt.0.and. |
165 |
newVAL=max(0,newVAL) |
$ nvk(is).le.nva1_view.and. |
166 |
newVAL=min(4095,newVAL) |
$ nst(is).gt.0.and. |
167 |
|
$ nst(is).le.nstrips_va1.and. |
168 |
|
$ .true.)then |
169 |
|
newVAL=oldVAL |
170 |
|
$ -pedestal_t(DSPn,nvk(is),nst(is)) |
171 |
|
$ +pedestal_t(DSPn,nvk(js),nst(js)) |
172 |
|
newVAL=max(0,newVAL) |
173 |
|
newVAL=min(4095,newVAL) |
174 |
|
endif |
175 |
adc(DSPn,nvk(js),nst(js))=newVAL |
adc(DSPn,nvk(js),nst(js))=newVAL |
176 |
else |
else |
177 |
print*,'filladc -->' |
print*,'filladc -->' |
178 |
$ ,' attempt to access array elements (2)' |
$ ,' attempt to access array element (2) ' |
179 |
$ ,'(',DSPn,nvk(is),nst(is),')' |
c $ ,'(',DSPn,nvk(is),nst(is),')' |
180 |
$ ,'(',DSPn,nvk(js),nst(js),')' |
$ ,'pedestal_t(',DSPn,nvk(js),nst(js),')' |
181 |
|
c iflag=1 |
182 |
|
c if(DSPn.le.nviews)GOOD1(DSPn) = 10 |
183 |
endif |
endif |
184 |
c print*,DSPn,nvk(js),nst(js),newval |
c print*,DSPn,nvk(js),nst(js),newval |
185 |
|
|
255 |
do i=1,3 !loop over ladder |
do i=1,3 !loop over ladder |
256 |
do j=1,1024 !loop over strips |
do j=1,1024 !loop over strips |
257 |
idata = idata+1 |
idata = idata+1 |
258 |
|
if( idata.gt.NWORDMAX )goto 335 !go to end |
259 |
|
nword_DSP = nword_DSP +1 |
260 |
|
if( nword_DSP.gt.datalength(iv) )then |
261 |
|
if( verbose ) |
262 |
|
$ print*,'filladc --> missing end-of-ladder', |
263 |
|
$ ' in FULL mode - DSP ',DSPn |
264 |
|
if(verbose)print*,'datalength = ',datalength |
265 |
|
goto 334 !next view |
266 |
|
endif |
267 |
is=j+1024*(i-1) |
is=j+1024*(i-1) |
268 |
c adcadc=adc(DSPn,nvk(is),nst(is)) |
c adcadc=adc(DSPn,nvk(is),nst(is)) |
269 |
if( DSPn.le.nviews |
if( DSPn.le.nviews |
283 |
c endif |
c endif |
284 |
enddo !loop over strips |
enddo !loop over strips |
285 |
idata = idata+1 |
idata = idata+1 |
286 |
|
if( idata.gt.NWORDMAX )goto 335 !go to end |
287 |
|
nword_DSP = nword_DSP +1 |
288 |
|
if( nword_DSP.gt.datalength(iv) )then |
289 |
|
if( verbose ) |
290 |
|
$ print*,'filladc --> missing end-of-ladder', |
291 |
|
$ ' in FULL mode - DSP ',DSPn |
292 |
|
if(verbose)print*,'datalength = ',datalength |
293 |
|
goto 334 !next view |
294 |
|
endif |
295 |
if(datatracker(idata).ne.ior(z'1800',i+3)) then |
if(datatracker(idata).ne.ior(z'1800',i+3)) then |
296 |
if(verbose) |
if(verbose) |
297 |
$ print*,'filladc --> ', |
$ print*,'filladc --> ', |
307 |
enddo!endl loop over ladder |
enddo!endl loop over ladder |
308 |
endif |
endif |
309 |
goto 334 |
goto 334 |
310 |
333 continue |
333 continue |
311 |
if(verbose)print*,'filladc --> ',iv |
if(verbose)print*,'filladc --> ',iv |
312 |
$ ,'^ DSP packet missing or corrupted: ' |
$ ,'^ DSP packet missing or corrupted: ' |
313 |
$ ,'DSPn, datalength(iv) => ' |
$ ,'DSPn, datalength(iv) => ' |
314 |
$ ,DSPn,datalength(iv) |
$ ,DSPn,datalength(iv) |
315 |
334 continue |
334 continue |
316 |
enddo |
enddo |
317 |
|
goto 336 |
318 |
|
335 continue |
319 |
|
if(verbose)print*,'filladc --> reached end of buffer:', |
320 |
|
$ ' datatracker(',NWORDMAX,')' |
321 |
|
|
322 |
|
336 continue |
323 |
return |
return |
324 |
end |
end |
325 |
|
|