| 27 |
c$$$ verbose = .true. |
c$$$ verbose = .true. |
| 28 |
c$$$ warning = .true. |
c$$$ warning = .true. |
| 29 |
|
|
| 30 |
|
c$$$ print*,debug,verbose,warning |
| 31 |
|
c$$$ debug=1 |
| 32 |
|
c$$$ verbose=1 |
| 33 |
|
c$$$ warning=1 |
| 34 |
|
|
| 35 |
* ////////////////////////// |
* ////////////////////////// |
| 36 |
* initialize some parameters |
* initialize some parameters |
| 37 |
* ////////////////////////// |
* ////////////////////////// |
| 40 |
|
|
| 41 |
c debug=.true. |
c debug=.true. |
| 42 |
|
|
| 43 |
if(debug)print*,'-- check LEVEL0 status' |
if(debug.eq.1)print*,'-- check LEVEL0 status' |
| 44 |
|
|
| 45 |
ievco=-1 |
ievco=-1 |
| 46 |
mismatch=0 |
mismatch=0 |
| 65 |
GOOD1(DSPnumber(iv)) = ior(GOOD1(DSPnumber(iv)),2**1) |
GOOD1(DSPnumber(iv)) = ior(GOOD1(DSPnumber(iv)),2**1) |
| 66 |
102 format(' * WARNING * Event ',i7,' view',i3 |
102 format(' * WARNING * Event ',i7,' view',i3 |
| 67 |
$ ,' CRC error') |
$ ,' CRC error') |
| 68 |
if(debug)write(*,102)eventn(1),DSPnumber(iv) |
if(debug.eq.1)write(*,102)eventn(1),DSPnumber(iv) |
| 69 |
c goto 18 !next view |
c goto 18 !next view |
| 70 |
endif |
endif |
| 71 |
c ------------------------ |
c ------------------------ |
| 86 |
GOOD1(DSPnumber(iv)) = ior(GOOD1(DSPnumber(iv)),2**2) |
GOOD1(DSPnumber(iv)) = ior(GOOD1(DSPnumber(iv)),2**2) |
| 87 |
103 format(' * WARNING * Event ',i7,' view',i3 |
103 format(' * WARNING * Event ',i7,' view',i3 |
| 88 |
$ ,' software alarm') |
$ ,' software alarm') |
| 89 |
if(debug)write(*,103)eventn(1),DSPnumber(iv) |
if(debug.eq.1)write(*,103)eventn(1),DSPnumber(iv) |
| 90 |
c goto 18 |
c goto 18 |
| 91 |
endif |
endif |
| 92 |
c ------------------------ |
c ------------------------ |
| 107 |
c$$$ GOOD1(DSPnumber(iv)) = ior(GOOD1(DSPnumber(iv)),2**3) |
c$$$ GOOD1(DSPnumber(iv)) = ior(GOOD1(DSPnumber(iv)),2**3) |
| 108 |
c$$$ 104 format(' * WARNING * Event ',i7,' view',i3 |
c$$$ 104 format(' * WARNING * Event ',i7,' view',i3 |
| 109 |
c$$$ $ ,' counter jump ',i10,i10) |
c$$$ $ ,' counter jump ',i10,i10) |
| 110 |
c$$$ if(debug)write(*,104)eventn(1),DSPnumber(iv) |
c$$$ if(debug.eq.1)write(*,104)eventn(1),DSPnumber(iv) |
| 111 |
c$$$ $ ,eventn_old(iv),eventn(iv)) |
c$$$ $ ,eventn_old(iv),eventn(iv)) |
| 112 |
c$$$ goto 18 |
c$$$ goto 18 |
| 113 |
c$$$ endif |
c$$$ endif |
| 131 |
|
|
| 132 |
c print*,'*** ',(eventn(iv),iv=1,12) |
c print*,'*** ',(eventn(iv),iv=1,12) |
| 133 |
|
|
| 134 |
if(mismatch.eq.1.and.debug) |
if(mismatch.eq.1.and.debug.eq.1) |
| 135 |
$ print*,' * WARNING * DSP counter mismatch: ' |
$ print*,' * WARNING * DSP counter mismatch: ' |
| 136 |
$ ,(eventn(iv),iv=1,12) |
$ ,(eventn(iv),iv=1,12) |
| 137 |
|
|
| 154 |
c and fill the variable ADC (invertin view 11) |
c and fill the variable ADC (invertin view 11) |
| 155 |
c-------------------------------------------------- |
c-------------------------------------------------- |
| 156 |
|
|
| 157 |
if(debug)print*,'-- fill ADC vectors' |
if(debug.eq.1)print*,'-- fill ADC vectors' |
| 158 |
|
|
| 159 |
call filladc(iflag) |
call filladc(iflag) |
| 160 |
if(iflag.ne.0)then |
if(iflag.ne.0)then |
| 166 |
c (excluding strips with signal, |
c (excluding strips with signal, |
| 167 |
c tagged with the flag CLSTR) |
c tagged with the flag CLSTR) |
| 168 |
c-------------------------------------------------- |
c-------------------------------------------------- |
| 169 |
if(debug)print*,'-- compute CN' |
if(debug.eq.1)print*,'-- compute CN' |
| 170 |
|
|
| 171 |
do iv=1,nviews |
do iv=1,nviews |
| 172 |
ima=0 |
ima=0 |
| 191 |
endif |
endif |
| 192 |
enddo |
enddo |
| 193 |
100 format(' * WARNING * Event ',i7,' view',i3,': VK MASK ',24i1) |
100 format(' * WARNING * Event ',i7,' view',i3,': VK MASK ',24i1) |
| 194 |
if(ima.ne.0.and.verbose)write(*,100)eventn(1),iv |
if(ima.ne.0.and.verbose.eq.1)write(*,100)eventn(1),iv |
| 195 |
$ ,(mask_vk_ev(iv,ik),ik=1,nva1_view) |
$ ,(mask_vk_ev(iv,ik),ik=1,nva1_view) |
| 196 |
c if(ima.ne.0)write(*,100)eventn(1),iv |
c if(ima.ne.0)write(*,100)eventn(1),iv |
| 197 |
c $ ,(mask_vk_ev(iv,ik),ik=1,nva1_view) |
c $ ,(mask_vk_ev(iv,ik),ik=1,nva1_view) |
| 207 |
c--------------------------------------------- |
c--------------------------------------------- |
| 208 |
ind=1 !clsignal array index |
ind=1 !clsignal array index |
| 209 |
|
|
| 210 |
if(debug)print*,'-- search clusters' |
if(debug.eq.1)print*,'-- search clusters' |
| 211 |
do iv=1,nviews !loop on views |
do iv=1,nviews !loop on views |
| 212 |
do is=1,nstrips_view !loop on strips (1) |
do is=1,nstrips_view !loop on strips (1) |
| 213 |
if(mod(iv,2).eq.1) then |
if(mod(iv,2).eq.1) then |
| 241 |
|
|
| 242 |
if(.not.flag_shower)then |
if(.not.flag_shower)then |
| 243 |
call save_cluster(iv) |
call save_cluster(iv) |
| 244 |
if(debug)print*,'view ',iv,' #clusters ', nclstr_view |
if(debug.eq.1)print*,'view ',iv,' #clusters ', nclstr_view |
| 245 |
else |
else |
| 246 |
fshower(iv) = 1 |
fshower(iv) = 1 |
| 247 |
c GOOD1(DSPnumber(iv)) = 11 !AHAHAHAHA ORRORE!! |
c GOOD1(DSPnumber(iv)) = 11 !AHAHAHAHA ORRORE!! |
| 250 |
GOOD1(iv) = ior(GOOD1(iv),2**5) |
GOOD1(iv) = ior(GOOD1(iv),2**5) |
| 251 |
101 format(' * WARNING * Event ',i7,' view',i3 |
101 format(' * WARNING * Event ',i7,' view',i3 |
| 252 |
$ ,' #clusters > ',i5,' --> MASKED') |
$ ,' #clusters > ',i5,' --> MASKED') |
| 253 |
if(verbose)write(*,101)eventn(1),iv,nclstrmax_view |
if(verbose.eq.1)write(*,101)eventn(1),iv,nclstrmax_view |
| 254 |
endif |
endif |
| 255 |
enddo ! end loop on views |
enddo ! end loop on views |
| 256 |
do iv=1,nviews |
do iv=1,nviews |
| 270 |
do iv = 1,nviews |
do iv = 1,nviews |
| 271 |
ngood = ngood + good1(iv) |
ngood = ngood + good1(iv) |
| 272 |
enddo |
enddo |
| 273 |
if(verbose.and.ngood.ne.0)print*,'* WARNING * Event ',eventn(1) |
if(verbose.eq.1.and.ngood.ne.0) |
| 274 |
|
$ print*,'* WARNING * Event ',eventn(1) |
| 275 |
$ ,':LEVEL1 event status: ' |
$ ,':LEVEL1 event status: ' |
| 276 |
$ ,(good1(i),i=1,nviews) |
$ ,(good1(i),i=1,nviews) |
| 277 |
c------------------------------------------------------------------------ |
c------------------------------------------------------------------------ |
| 460 |
c------------------------------------------------------------------------ |
c------------------------------------------------------------------------ |
| 461 |
if( (rmax-lmax+1).ge.nclstrp )goto 210 !exits inclusion loop |
if( (rmax-lmax+1).ge.nclstrp )goto 210 !exits inclusion loop |
| 462 |
|
|
| 463 |
if(rstop.eq.0) then !if right cluster morder has not been reached |
if(rstop.eq.0) then !if right cluster border has not been reached |
| 464 |
if(value(ir).gt.clinclcut(ir)) then |
if(value(ir).gt.clinclcut(ir)) then |
| 465 |
rmax=ir !include a strip on the right |
rmax=ir !include a strip on the right |
| 466 |
else |
else |
| 470 |
|
|
| 471 |
if( (rmax-lmax+1).ge.nclstrp )goto 210 !exits inclusion loop |
if( (rmax-lmax+1).ge.nclstrp )goto 210 !exits inclusion loop |
| 472 |
|
|
| 473 |
if(lstop.eq.0) then !if left cluster morder has not been reached |
if(lstop.eq.0) then !if left cluster border has not been reached |
| 474 |
if(value(il).gt.clinclcut(il)) then |
if(value(il).gt.clinclcut(il)) then |
| 475 |
lmax=il !include a strip on the left |
lmax=il !include a strip on the left |
| 476 |
else |
else |
| 478 |
endif |
endif |
| 479 |
endif |
endif |
| 480 |
|
|
| 481 |
|
c if( (rmax-lmax+1).ge.nclstrp )goto 210 !exits inclusion loop |
| 482 |
|
|
| 483 |
enddo !ends strip inclusion loop |
enddo !ends strip inclusion loop |
| 484 |
goto 211 |
goto 211 |
| 485 |
210 continue !jumps here if more than nclstrp have been included |
210 continue !jumps here if more than nclstrp have been included |
| 500 |
rmax = rmax+1 |
rmax = rmax+1 |
| 501 |
if( (rmax-lmax+1).gt.nclstrp )lmax=lmax+1 |
if( (rmax-lmax+1).gt.nclstrp )lmax=lmax+1 |
| 502 |
endif |
endif |
| 503 |
|
c------------------------------------------------------------------------------- |
| 504 |
|
c adjust the cluster in order to have at least ANOTHER strip around the seed |
| 505 |
|
c------------------------------------------------------------------------------- |
| 506 |
|
if(iseed-1.eq.lmax.and.lmax.ne.first)then |
| 507 |
|
lmax = lmax-1 |
| 508 |
|
if( (rmax-lmax+1).gt.nclstrp )rmax=rmax-1 |
| 509 |
|
endif |
| 510 |
|
if(iseed+1.eq.rmax.and.rmax.ne.last )then |
| 511 |
|
rmax = rmax+1 |
| 512 |
|
if( (rmax-lmax+1).gt.nclstrp )lmax=lmax+1 |
| 513 |
|
endif |
| 514 |
|
c--------------------------------------------------- |
| 515 |
|
c now we have 5 stored-strips around the maximum |
| 516 |
|
c--------------------------------------------------- |
| 517 |
|
|
| 518 |
c------------------------------------------------------------------------ |
c------------------------------------------------------------------------ |
| 519 |
c adjust the cluster in order to store a minimum number of strips |
c adjust the cluster in order to store a minimum number of strips |
| 547 |
|
|
| 548 |
ladder_view(nclstr_view) = nld(iseed,iv) |
ladder_view(nclstr_view) = nld(iseed,iv) |
| 549 |
maxs_view(nclstr_view) = iseed |
maxs_view(nclstr_view) = iseed |
|
mult_view(nclstr_view) = rmax-lmax+1 |
|
| 550 |
rmax_view(nclstr_view) = rmax |
rmax_view(nclstr_view) = rmax |
| 551 |
lmax_view(nclstr_view) = lmax |
lmax_view(nclstr_view) = lmax |
| 552 |
|
c mult_view(nclstr_view) = rmax-lmax+1 |
| 553 |
|
mult_view(nclstr_view) = 0 |
| 554 |
|
do ii=lmax,rmax |
| 555 |
|
if(value(ii).gt.clinclcut(ii)) |
| 556 |
|
$ mult_view(nclstr_view) = mult_view(nclstr_view)+1 |
| 557 |
|
enddo |
| 558 |
|
|
| 559 |
|
|
| 560 |
c$$$ if(rmax-lmax+1.gt.25) |
c$$$ if(rmax-lmax+1.gt.25) |
| 561 |
c$$$ $ print*,'view ',iv |
c$$$ $ print*,'view ',iv |