18 |
include 'common_reduction.f' |
include 'common_reduction.f' |
19 |
include 'calib.f' |
include 'calib.f' |
20 |
|
|
21 |
|
data eventn_old/nviews*0/ |
22 |
|
|
23 |
integer ierror |
integer ierror |
24 |
ierror = 0 |
ierror = 0 |
25 |
|
|
30 |
c call stripmask !called later, after CN computation |
c call stripmask !called later, after CN computation |
31 |
call init_level1 |
call init_level1 |
32 |
|
|
33 |
good1 = good0 |
c good1 = good0 |
34 |
|
c-------------------------------------------------- |
35 |
|
c check the LEVEL0 event status for missing |
36 |
|
c sections or DSP alarms |
37 |
|
c ==> set the variable GOOD1(12) |
38 |
|
c-------------------------------------------------- |
39 |
|
do iv=1,nviews |
40 |
|
if(DSPnumber(iv).gt.0.and.DSPnumber(iv).le.12)then |
41 |
|
c ------------------------ |
42 |
|
c GOOD |
43 |
|
c ------------------------ |
44 |
|
GOOD1(DSPnumber(iv))=0 !OK |
45 |
|
c ------------------------ |
46 |
|
c CRC error |
47 |
|
c ------------------------ |
48 |
|
if(crc(iv).eq.1) then |
49 |
|
GOOD1(DSPnumber(iv)) = 2 |
50 |
|
goto 18 !next view |
51 |
|
endif |
52 |
|
c ------------------------ |
53 |
|
c online-software alarm |
54 |
|
c ------------------------ |
55 |
|
if( |
56 |
|
$ fl1(iv).ne.0.or. |
57 |
|
$ fl2(iv).ne.0.or. |
58 |
|
$ fl3(iv).ne.0.or. |
59 |
|
$ fl4(iv).ne.0.or. |
60 |
|
$ fl5(iv).ne.0.or. |
61 |
|
$ fl6(iv).ne.0.or. |
62 |
|
$ fc(iv).ne.0.or. |
63 |
|
$ DATAlength(iv).eq.0.or. |
64 |
|
$ .false.)then |
65 |
|
GOOD1(DSPnumber(iv))=3 |
66 |
|
goto 18 |
67 |
|
endif |
68 |
|
c ------------------------ |
69 |
|
c DSP-counter jump |
70 |
|
c ------------------------ |
71 |
|
if( |
72 |
|
$ eventn_old(iv).ne.0.and. !first event in this file |
73 |
|
$ eventn(iv).ne.1.and. !first event in run |
74 |
|
$ good_old(DSPnumber(iv)).ne.0.and. !previous event corrupted |
75 |
|
$ .true.)then |
76 |
|
|
77 |
|
if(eventn(iv).ne.(eventn_old(iv)+1))then |
78 |
|
GOOD1(DSPnumber(iv))=4 |
79 |
|
goto 18 |
80 |
|
endif |
81 |
|
|
82 |
|
endif |
83 |
|
c ------------------------ |
84 |
|
18 continue |
85 |
|
endif |
86 |
|
enddo |
87 |
|
|
88 |
|
ngood = 0 |
89 |
|
do iv = 1,nviews |
90 |
|
eventn_old(iv) = eventn(iv) |
91 |
|
good_old(iv) = good1(iv) |
92 |
|
ngood = ngood + good1(iv) |
93 |
|
enddo |
94 |
|
c if(ngood.ne.0)print*,'* WARNING * LEVEL0 event status: ' |
95 |
|
c $ ,(good1(i),i=1,nviews) |
96 |
c-------------------------------------------------- |
c-------------------------------------------------- |
97 |
c read the variable DATATRACKER from LEVEL0 |
c read the variable DATATRACKER from LEVEL0 |
98 |
c and fill the variable ADC (inverting view 11) |
c and fill the variable ADC (invertin view 11) |
99 |
c-------------------------------------------------- |
c-------------------------------------------------- |
100 |
call filladc(iflag) |
call filladc(iflag) |
101 |
if(iflag.ne.0)then |
if(iflag.ne.0)then |
102 |
good1=0 |
c good1=0!<<<<<<<<<<<<<<< |
103 |
c if(DEBUG)print*,'event ',eventn(1),' >>>>> decode ERROR' |
c if(DEBUG)print*,'event ',eventn(1),' >>>>> decode ERROR' |
104 |
ierror = 220 |
ierror = 220 |
105 |
goto 200 |
c goto 200 |
106 |
|
c print*,'filladc error' |
107 |
endif |
endif |
108 |
|
|
109 |
c-------------------------------------------------- |
c-------------------------------------------------- |
112 |
c tagged with the flag CLSTR) |
c tagged with the flag CLSTR) |
113 |
c-------------------------------------------------- |
c-------------------------------------------------- |
114 |
do iv=1,nviews |
do iv=1,nviews |
115 |
do ik=1,nva1_view |
ima=0 |
116 |
cn(iv,ik) = 0 |
do ik=1,nva1_view |
117 |
cnn(iv,ik) = -1 |
cn(iv,ik) = 0 |
118 |
mask_vk_ev(iv,ik)=1 |
cnn(iv,ik) = -1 |
119 |
iflag=0 |
mask_vk_ev(iv,ik)=1 |
120 |
if(mask_vk(iv,ik).eq.1)call cncomp(iv,ik,iflag) |
iflag=0 |
121 |
c if(iflag.ne.0)good1=0 |
if(mask_vk(iv,ik).eq.1)call cncomp(iv,ik,iflag) |
122 |
if(iflag.ne.0)then |
c if(iflag.ne.0)good1=0 |
123 |
mask_vk_ev(iv,ik)=0 |
if(iflag.ne.0)then |
124 |
ierror = 220 |
ima=ima+1 |
125 |
endif |
mask_vk_ev(iv,ik)=0 |
126 |
enddo |
ierror = 220 |
127 |
|
c$$$ if(verbose) |
128 |
|
c$$$ $ print*,' * WARNING * Event ',eventn(1) |
129 |
|
c$$$ $ ,': masked vk ',ik,' on view',iv |
130 |
|
endif |
131 |
|
enddo |
132 |
|
if(ima.ne.0.and.verbose)print*,' * WARNING * Event ',eventn(1) |
133 |
|
$ ,' view',iv,': VK MASK ' |
134 |
|
$ ,(mask_vk_ev(iv,ik),ik=1,nva1_view) |
135 |
enddo |
enddo |
136 |
c if(good1.eq.0)then |
c if(good1.eq.0)then |
137 |
c ierror = 220 |
c ierror = 220 |
188 |
call save_cluster(iv) |
call save_cluster(iv) |
189 |
else |
else |
190 |
fshower(iv) = 1 |
fshower(iv) = 1 |
191 |
|
GOOD1(DSPn) = 11 |
192 |
endif |
endif |
193 |
enddo ! end loop on views |
enddo ! end loop on views |
194 |
do iv=1,nviews |
do iv=1,nviews |
203 |
C or the event has too many clusters |
C or the event has too many clusters |
204 |
C--------------------------------------------- |
C--------------------------------------------- |
205 |
200 continue |
200 continue |
206 |
|
|
207 |
|
ngood = 0 |
208 |
|
do iv = 1,nviews |
209 |
|
ngood = ngood + good1(iv) |
210 |
|
enddo |
211 |
|
if(ngood.ne.0)print*,'* WARNING * Event ',eventn(1) |
212 |
|
$ ,':LEVEL1 event status: ' |
213 |
|
$ ,(good1(i),i=1,nviews) |
214 |
c------------------------------------------------------------------------ |
c------------------------------------------------------------------------ |
215 |
c |
c |
216 |
c closes files and exits |
c closes files and exits |
238 |
include 'level1.f' |
include 'level1.f' |
239 |
include 'level0.f' |
include 'level0.f' |
240 |
|
|
241 |
good1 = 0 |
c good1 = 0 |
242 |
|
do iv=1,12 |
243 |
|
good1(iv) = 1 !missing packet |
244 |
|
enddo |
245 |
nclstr1 = 0 |
nclstr1 = 0 |
246 |
totCLlength = 0 |
totCLlength = 0 |
247 |
do ic=1,nclstrmax |
do ic=1,nclstrmax |
338 |
first=first+3 |
first=first+3 |
339 |
last=last-3 |
last=last-3 |
340 |
endif |
endif |
341 |
|
|
342 |
do is=first,last !loop on strips in each ladder |
do is=first,last !loop on strips in each ladder |
343 |
|
|
344 |
if(is.le.iseed+1) goto 220 |
if(is.le.iseed+1) goto 220 |
345 |
******************************************************* |
******************************************************* |
346 |
* Elena 08/2006 |
* Elena 08/2006 |
347 |
* QUESTA PARTE NON E` ADEGUATA per cluster con grossi rilasci di carica |
* QUESTA PARTE NON E` ADEGUATA per cluster con grossi rilasci di carica |
348 |
* perche` salva molte volte lo stesso cluster |
* perche` salva molte volte lo stesso cluster |
349 |
* (salvo il cluster rispetto al massimo e basta...) |
* (salvo il cluster rispetto al primo massimo e basta...) |
350 |
******************************************************* |
******************************************************* |
351 |
c$$$c----------------------------------------- |
c$$$c----------------------------------------- |
352 |
c$$$c after a cluster seed as been found, |
c$$$c after a cluster seed as been found, |
387 |
c$$$ itemp=itemp+1 |
c$$$ itemp=itemp+1 |
388 |
c$$$ if(itemp.eq.last) goto 230 !stops if reaches last strip |
c$$$ if(itemp.eq.last) goto 230 !stops if reaches last strip |
389 |
c$$$ enddo ! of the ladder |
c$$$ enddo ! of the ladder |
390 |
do while(value(itemp).le.value(itemp+1)) |
do while( |
391 |
|
$ value(itemp).le.value(itemp+1) |
392 |
|
$ .and.value(itemp+1).gt.clseedcut(itemp+1)) |
393 |
itemp=itemp+1 |
itemp=itemp+1 |
394 |
if(itemp.eq.last) goto 230 !stops if reaches last strip |
if(itemp.eq.last) goto 230 !stops if reaches last strip |
395 |
enddo ! of the ladder |
enddo ! of the ladder |