| 23 |
integer ierror |
integer ierror |
| 24 |
ierror = 0 |
ierror = 0 |
| 25 |
|
|
| 26 |
* ------------------------------------------------------- |
c$$$ debug = .true. |
| 27 |
* STRIP MASK |
c$$$ verbose = .true. |
| 28 |
* ------------------------------------------------------- |
c$$$ warning = .true. |
| 29 |
|
|
|
c call stripmask !called later, after CN computation |
|
| 30 |
call init_level1 |
call init_level1 |
| 31 |
|
|
| 32 |
|
if(debug)print*,'-- check LEVEL0 status' |
| 33 |
|
|
| 34 |
c good1 = good0 |
c good1 = good0 |
| 35 |
c-------------------------------------------------- |
c-------------------------------------------------- |
| 36 |
c check the LEVEL0 event status for missing |
c check the LEVEL0 event status for missing |
| 92 |
good_old(iv) = good1(iv) |
good_old(iv) = good1(iv) |
| 93 |
ngood = ngood + good1(iv) |
ngood = ngood + good1(iv) |
| 94 |
enddo |
enddo |
| 95 |
c if(ngood.ne.0)print*,'* WARNING * LEVEL0 event status: ' |
if(debug.and.ngood.ne.0)print*,'* WARNING * LEVEL0 event status: ' |
| 96 |
c $ ,(good1(i),i=1,nviews) |
$ ,(good1(i),i=1,nviews) |
| 97 |
c-------------------------------------------------- |
c-------------------------------------------------- |
| 98 |
c read the variable DATATRACKER from LEVEL0 |
c read the variable DATATRACKER from LEVEL0 |
| 99 |
c and fill the variable ADC (invertin view 11) |
c and fill the variable ADC (invertin view 11) |
| 100 |
c-------------------------------------------------- |
c-------------------------------------------------- |
| 101 |
|
|
| 102 |
|
if(debug)print*,'-- fill ADC vectors' |
| 103 |
|
|
| 104 |
call filladc(iflag) |
call filladc(iflag) |
| 105 |
if(iflag.ne.0)then |
if(iflag.ne.0)then |
| 106 |
ierror = 220 |
ierror = 220 |
| 111 |
c (excluding strips with signal, |
c (excluding strips with signal, |
| 112 |
c tagged with the flag CLSTR) |
c tagged with the flag CLSTR) |
| 113 |
c-------------------------------------------------- |
c-------------------------------------------------- |
| 114 |
|
if(debug)print*,'-- compute CN' |
| 115 |
|
|
| 116 |
do iv=1,nviews |
do iv=1,nviews |
| 117 |
ima=0 |
ima=0 |
| 118 |
do ik=1,nva1_view |
do ik=1,nva1_view |
| 119 |
cn(iv,ik) = 0 |
cn(iv,ik) = 0 |
| 120 |
cnrms(iv,ik) = 0 |
cnrms(iv,ik) = 0 |
| 121 |
cnn(iv,ik) = -1 |
cnn(iv,ik) = -1 |
|
mask_vk_ev(iv,ik)=1 |
|
| 122 |
iflag=0 |
iflag=0 |
| 123 |
if(mask_vk(iv,ik).eq.1)call cncomp(iv,ik,iflag) |
mask_vk_ev(iv,ik)=1 |
| 124 |
|
call stripmask(iv,ik) !compute mask(i,j,k), combining VA1-masks |
| 125 |
|
c NBNBNBNBNB mask per la striscia 1 !!!!!!!! |
| 126 |
|
if(mask(iv,ik,1).eq.1)call cncomp(iv,ik,iflag) |
| 127 |
if(iflag.ne.0)then |
if(iflag.ne.0)then |
| 128 |
ima=ima+1 |
ima=ima+1 |
| 129 |
mask_vk_ev(iv,ik)=0 |
mask_vk_ev(iv,ik)=0 |
| 130 |
ierror = 220 |
ierror = 220 |
| 131 |
endif |
endif |
| 132 |
|
call stripmask(iv,ik) !compute mask(i,j,k), combining VA1-masks |
| 133 |
|
|
| 134 |
enddo |
enddo |
| 135 |
100 format(' * WARNING * Event ',i7,' view',i3,': VK MASK ',24i1) |
100 format(' * WARNING * Event ',i7,' view',i3,': VK MASK ',24i1) |
| 136 |
if(ima.ne.0.and.debug)write(*,100)eventn(1),iv |
if(ima.ne.0.and.debug)write(*,100)eventn(1),iv |
| 137 |
$ ,(mask_vk_ev(iv,ik),ik=1,nva1_view) |
$ ,(mask_vk_ev(iv,ik),ik=1,nva1_view) |
| 138 |
enddo |
enddo |
| 139 |
|
|
| 140 |
call stripmask !compute mask(i,j,k), combining mask_vk_ev and mask_vk |
cc call stripmask !compute mask(i,j,k), combining mask_vk_ev and mask_vk |
| 141 |
|
|
| 142 |
c--------------------------------------------- |
c--------------------------------------------- |
| 143 |
c loops on views, VA1 and strips, |
c loops on views, VA1 and strips, |
| 147 |
c--------------------------------------------- |
c--------------------------------------------- |
| 148 |
ind=1 !clsignal array index |
ind=1 !clsignal array index |
| 149 |
|
|
| 150 |
|
if(debug)print*,'-- search clusters' |
| 151 |
do iv=1,nviews !loop on views |
do iv=1,nviews !loop on views |
| 152 |
do is=1,nstrips_view !loop on strips (1) |
do is=1,nstrips_view !loop on strips (1) |
| 153 |
if(mod(iv,2).eq.1) then |
if(mod(iv,2).eq.1) then |
| 178 |
|
|
| 179 |
if(.not.flag_shower)then |
if(.not.flag_shower)then |
| 180 |
call save_cluster(iv) |
call save_cluster(iv) |
| 181 |
|
if(debug)print*,'view ',iv,' #clusters ', nclstr_view |
| 182 |
else |
else |
| 183 |
fshower(iv) = 1 |
fshower(iv) = 1 |
| 184 |
GOOD1(DSPnumber(iv)) = 11 |
c GOOD1(DSPnumber(iv)) = 11 !AHAHAHAHA ORRORE!! |
| 185 |
|
GOOD1(iv) = 11 |
| 186 |
|
101 format(' * WARNING * Event ',i7,' view',i3 |
| 187 |
|
$ ,' #clusters > ',i5,' --> MASKED') |
| 188 |
|
if(debug)write(*,101)eventn(1),iv,nclstrmax_view |
| 189 |
endif |
endif |
| 190 |
enddo ! end loop on views |
enddo ! end loop on views |
| 191 |
do iv=1,nviews |
do iv=1,nviews |
| 205 |
do iv = 1,nviews |
do iv = 1,nviews |
| 206 |
ngood = ngood + good1(iv) |
ngood = ngood + good1(iv) |
| 207 |
enddo |
enddo |
| 208 |
if(ngood.ne.0)print*,'* WARNING * Event ',eventn(1) |
if(debug.and.ngood.ne.0)print*,'* WARNING * Event ',eventn(1) |
| 209 |
$ ,':LEVEL1 event status: ' |
$ ,':LEVEL1 event status: ' |
| 210 |
$ ,(good1(i),i=1,nviews) |
$ ,(good1(i),i=1,nviews) |
| 211 |
c------------------------------------------------------------------------ |
c------------------------------------------------------------------------ |
| 248 |
indmax(ic) = 0 |
indmax(ic) = 0 |
| 249 |
maxs(ic) = 0 |
maxs(ic) = 0 |
| 250 |
mult(ic) = 0 |
mult(ic) = 0 |
| 251 |
dedx(ic) = 0 |
sgnl(ic) = 0 |
| 252 |
whichtrack(ic) = 0 |
whichtrack(ic) = 0 !assigned @ level2 |
| 253 |
|
|
| 254 |
enddo |
enddo |
| 255 |
do id=1,maxlength !??? |
do id=1,maxlength !??? |
| 473 |
c$$$ $ print*,'view ',iv |
c$$$ $ print*,'view ',iv |
| 474 |
c$$$ $ ,' cl ',nclstr_view,' mult ',rmax-lmax+1 |
c$$$ $ ,' cl ',nclstr_view,' mult ',rmax-lmax+1 |
| 475 |
c------------------------------------------------------------------------ |
c------------------------------------------------------------------------ |
| 476 |
c search for a dowble peak inside the cluster |
c search for a double peak inside the cluster |
| 477 |
c------------------------------------------------------------------------ |
c------------------------------------------------------------------------ |
| 478 |
inext = rmax+1 !<< index where to start new-cluster search |
inext = rmax+1 !<< index where to start new-cluster search |
| 479 |
|
|
| 559 |
|
|
| 560 |
CLlength = rmax_view(ic) - lmax_view(ic) + 1 !numero di strip salvate |
CLlength = rmax_view(ic) - lmax_view(ic) + 1 !numero di strip salvate |
| 561 |
totCLlength = totCLlength + CLlength |
totCLlength = totCLlength + CLlength |
| 562 |
dedx(nclstr1) = 0 |
sgnl(nclstr1) = 0 |
| 563 |
do j=lmax_view(ic),rmax_view(ic) !stores sequentially cluter strip values in |
do j=lmax_view(ic),rmax_view(ic) !stores sequentially cluter strip values in |
| 564 |
|
|
| 565 |
clsignal(ind) = value(j) ! clsignal array |
clsignal(ind) = value(j) ! clsignal array |
| 575 |
ind=ind+1 |
ind=ind+1 |
| 576 |
c if(value(j).gt.0) |
c if(value(j).gt.0) |
| 577 |
if(value(j).gt.clinclcut(j)) |
if(value(j).gt.clinclcut(j)) |
| 578 |
$ dedx(nclstr1) = dedx(nclstr1) + value(j) !cluster charge |
$ sgnl(nclstr1) = sgnl(nclstr1) + value(j) !cluster charge |
| 579 |
enddo |
enddo |
| 580 |
|
|
| 581 |
c print*,'view ',iv,' -- save_cluster -- nclstr1: ' |
c print*,'view ',iv,' -- save_cluster -- nclstr1: ' |
| 582 |
c $ ,nclstr1,maxs(nclstr1),mult(nclstr1),dedx(nclstr1) |
c $ ,nclstr1,maxs(nclstr1),mult(nclstr1),sgnl(nclstr1) |
| 583 |
|
|
| 584 |
enddo |
enddo |
| 585 |
|
|
| 594 |
*---***---***---***---***---***---***---***---*** |
*---***---***---***---***---***---***---***---*** |
| 595 |
|
|
| 596 |
|
|
| 597 |
subroutine stripmask |
c$$$ subroutine stripmask |
| 598 |
|
c$$$ |
| 599 |
|
c$$$* this routine set va1 and single-strip masks, |
| 600 |
|
c$$$* on the basis of the VA1 mask saved in the DB |
| 601 |
|
c$$$* |
| 602 |
|
c$$$* mask(nviews,nva1_view,nstrips_va1) !strip mask |
| 603 |
|
c$$$* mask_vk(nviews,nva1_view) !VA1 mask |
| 604 |
|
c$$$* |
| 605 |
|
c$$$ include 'commontracker.f' |
| 606 |
|
c$$$ include 'level1.f' |
| 607 |
|
c$$$ include 'common_reduction.f' |
| 608 |
|
c$$$ include 'calib.f' |
| 609 |
|
c$$$ |
| 610 |
|
c$$$* init mask |
| 611 |
|
c$$$ do iv=1,nviews |
| 612 |
|
c$$$ do ivk=1,nva1_view |
| 613 |
|
c$$$ do is=1,nstrips_va1 |
| 614 |
|
c$$$c mask(iv,ivk,is) = mask_vk(iv,ivk) |
| 615 |
|
c$$$ if( mask_vk(iv,ivk) .ne. -1)then |
| 616 |
|
c$$$ mask(iv,ivk,is) = 1 |
| 617 |
|
c$$$ $ * mask_vk(iv,ivk) !from DB |
| 618 |
|
c$$$ $ * mask_vk_ev(iv,ivk) !from <SIG> |
| 619 |
|
c$$$ $ * mask_vk_run(iv,ivk) !from CN |
| 620 |
|
c$$$ else |
| 621 |
|
c$$$ mask(iv,ivk,is) = -1 |
| 622 |
|
c$$$ $ * mask_vk(iv,ivk) !from DB |
| 623 |
|
c$$$ $ * mask_vk_ev(iv,ivk) !from CN |
| 624 |
|
c$$$ endif |
| 625 |
|
c$$$ enddo |
| 626 |
|
c$$$ enddo |
| 627 |
|
c$$$ enddo |
| 628 |
|
c$$$ |
| 629 |
|
c$$$ |
| 630 |
|
c$$$ return |
| 631 |
|
c$$$ end |
| 632 |
|
|
| 633 |
|
subroutine stripmask(iv,ivk) |
| 634 |
|
|
| 635 |
* this routine set va1 and single-strip masks, |
* this routine set va1 and single-strip masks, |
| 636 |
* on the basis of the VA1 mask saved in the DB |
* on the basis of the VA1 mask saved in the DB |
| 644 |
include 'calib.f' |
include 'calib.f' |
| 645 |
|
|
| 646 |
* init mask |
* init mask |
| 647 |
do iv=1,nviews |
do is=1,nstrips_va1 |
| 648 |
do ivk=1,nva1_view |
if( mask_vk(iv,ivk) .ne. -1)then |
| 649 |
do is=1,nstrips_va1 |
mask(iv,ivk,is) = 1 |
| 650 |
c mask(iv,ivk,is) = mask_vk(iv,ivk) |
$ * mask_vk(iv,ivk) !from DB |
| 651 |
mask(iv,ivk,is) = mask_vk(iv,ivk) * mask_vk_ev(iv,ivk) |
$ * mask_vk_ev(iv,ivk) !from <SIG> |
| 652 |
enddo |
$ * mask_vk_run(iv,ivk) !from CN |
| 653 |
enddo |
else |
| 654 |
|
mask(iv,ivk,is) = -1 |
| 655 |
|
$ * mask_vk(iv,ivk) !from DB |
| 656 |
|
$ * mask_vk_ev(iv,ivk) !from CN |
| 657 |
|
endif |
| 658 |
enddo |
enddo |
| 659 |
|
|
| 660 |
|
|
| 661 |
return |
return |
| 662 |
end |
end |
|
|
|