23 |
integer ierror |
integer ierror |
24 |
ierror = 0 |
ierror = 0 |
25 |
|
|
26 |
|
c$$$ debug = .true. |
27 |
|
c$$$ verbose = .true. |
28 |
|
c$$$ warning = .true. |
29 |
|
|
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 |
122 |
iflag=0 |
iflag = 0 |
123 |
mask_vk_ev(iv,ik)=1 |
mask_vk_ev(iv,ik) = 1 |
124 |
call stripmask(iv,ik) !compute mask(i,j,k), combining VA1-masks |
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) |
* if chip is not masked ---> evaluate CN |
127 |
if(iflag.ne.0)then |
* -------------------------------------- |
128 |
ima=ima+1 |
if( mask(iv,ik,1).eq.1 ) then !!!NBNB mask per la striscia 1 !!!!!!!! |
129 |
mask_vk_ev(iv,ik)=0 |
call cncomp(iv,ik,iflag) |
130 |
ierror = 220 |
if(iflag.ne.0)then |
131 |
|
ima=ima+1 |
132 |
|
mask_vk_ev(iv,ik)=0 |
133 |
|
ierror = 220 |
134 |
|
endif |
135 |
|
call stripmask(iv,ik) !compute mask(i,j,k), combining VA1-masks |
136 |
endif |
endif |
|
call stripmask(iv,ik) !compute mask(i,j,k), combining VA1-masks |
|
|
|
|
137 |
enddo |
enddo |
138 |
100 format(' * WARNING * Event ',i7,' view',i3,': VK MASK ',24i1) |
100 format(' * WARNING * Event ',i7,' view',i3,': VK MASK ',24i1) |
139 |
if(ima.ne.0.and.debug)write(*,100)eventn(1),iv |
if(ima.ne.0.and.debug)write(*,100)eventn(1),iv |
140 |
$ ,(mask_vk_ev(iv,ik),ik=1,nva1_view) |
$ ,(mask_vk_ev(iv,ik),ik=1,nva1_view) |
141 |
|
c if(ima.ne.0)write(*,100)eventn(1),iv |
142 |
|
c $ ,(mask_vk_ev(iv,ik),ik=1,nva1_view) |
143 |
enddo |
enddo |
144 |
|
|
145 |
cc 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 |
152 |
c--------------------------------------------- |
c--------------------------------------------- |
153 |
ind=1 !clsignal array index |
ind=1 !clsignal array index |
154 |
|
|
155 |
|
if(debug)print*,'-- search clusters' |
156 |
do iv=1,nviews !loop on views |
do iv=1,nviews !loop on views |
157 |
do is=1,nstrips_view !loop on strips (1) |
do is=1,nstrips_view !loop on strips (1) |
158 |
if(mod(iv,2).eq.1) then |
if(mod(iv,2).eq.1) then |
183 |
|
|
184 |
if(.not.flag_shower)then |
if(.not.flag_shower)then |
185 |
call save_cluster(iv) |
call save_cluster(iv) |
186 |
|
if(debug)print*,'view ',iv,' #clusters ', nclstr_view |
187 |
else |
else |
188 |
fshower(iv) = 1 |
fshower(iv) = 1 |
189 |
GOOD1(DSPnumber(iv)) = 11 |
c GOOD1(DSPnumber(iv)) = 11 !AHAHAHAHA ORRORE!! |
190 |
|
GOOD1(iv) = 11 |
191 |
|
101 format(' * WARNING * Event ',i7,' view',i3 |
192 |
|
$ ,' #clusters > ',i5,' --> MASKED') |
193 |
|
if(debug)write(*,101)eventn(1),iv,nclstrmax_view |
194 |
endif |
endif |
195 |
enddo ! end loop on views |
enddo ! end loop on views |
196 |
do iv=1,nviews |
do iv=1,nviews |
210 |
do iv = 1,nviews |
do iv = 1,nviews |
211 |
ngood = ngood + good1(iv) |
ngood = ngood + good1(iv) |
212 |
enddo |
enddo |
213 |
c$$$ if(ngood.ne.0)print*,'* WARNING * Event ',eventn(1) |
if(debug.and.ngood.ne.0)print*,'* WARNING * Event ',eventn(1) |
214 |
c$$$ $ ,':LEVEL1 event status: ' |
$ ,':LEVEL1 event status: ' |
215 |
c$$$ $ ,(good1(i),i=1,nviews) |
$ ,(good1(i),i=1,nviews) |
216 |
c------------------------------------------------------------------------ |
c------------------------------------------------------------------------ |
217 |
c |
c |
218 |
c closes files and exits |
c closes files and exits |
253 |
indmax(ic) = 0 |
indmax(ic) = 0 |
254 |
maxs(ic) = 0 |
maxs(ic) = 0 |
255 |
mult(ic) = 0 |
mult(ic) = 0 |
256 |
dedx(ic) = 0 |
sgnl(ic) = 0 |
257 |
whichtrack(ic) = 0 |
whichtrack(ic) = 0 !assigned @ level2 |
258 |
|
|
259 |
enddo |
enddo |
260 |
do id=1,maxlength !??? |
do id=1,maxlength !??? |
564 |
|
|
565 |
CLlength = rmax_view(ic) - lmax_view(ic) + 1 !numero di strip salvate |
CLlength = rmax_view(ic) - lmax_view(ic) + 1 !numero di strip salvate |
566 |
totCLlength = totCLlength + CLlength |
totCLlength = totCLlength + CLlength |
567 |
dedx(nclstr1) = 0 |
sgnl(nclstr1) = 0 |
568 |
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 |
569 |
|
|
570 |
clsignal(ind) = value(j) ! clsignal array |
clsignal(ind) = value(j) ! clsignal array |
580 |
ind=ind+1 |
ind=ind+1 |
581 |
c if(value(j).gt.0) |
c if(value(j).gt.0) |
582 |
if(value(j).gt.clinclcut(j)) |
if(value(j).gt.clinclcut(j)) |
583 |
$ dedx(nclstr1) = dedx(nclstr1) + value(j) !cluster charge |
$ sgnl(nclstr1) = sgnl(nclstr1) + value(j) !cluster charge |
584 |
enddo |
enddo |
585 |
|
|
586 |
c print*,'view ',iv,' -- save_cluster -- nclstr1: ' |
c print*,'view ',iv,' -- save_cluster -- nclstr1: ' |
587 |
c $ ,nclstr1,maxs(nclstr1),mult(nclstr1),dedx(nclstr1) |
c $ ,nclstr1,maxs(nclstr1),mult(nclstr1),sgnl(nclstr1) |
588 |
|
|
589 |
enddo |
enddo |
590 |
|
|
637 |
|
|
638 |
subroutine stripmask(iv,ivk) |
subroutine stripmask(iv,ivk) |
639 |
|
|
640 |
|
* ----------------------------------------------- |
641 |
* this routine set va1 and single-strip masks, |
* this routine set va1 and single-strip masks, |
642 |
* on the basis of the VA1 mask saved in the DB |
* on the basis of the VA1 mask saved in the DB |
643 |
* |
* |
644 |
* mask(nviews,nva1_view,nstrips_va1) !strip mask |
* mask(nviews,nva1_view,nstrips_va1) !strip mask |
645 |
* mask_vk(nviews,nva1_view) !VA1 mask |
* mask_vk(nviews,nva1_view) !VA1 mask |
646 |
* |
* ----------------------------------------------- |
647 |
include 'commontracker.f' |
include 'commontracker.f' |
648 |
include 'level1.f' |
include 'level1.f' |
649 |
include 'common_reduction.f' |
include 'common_reduction.f' |
651 |
|
|
652 |
* init mask |
* init mask |
653 |
do is=1,nstrips_va1 |
do is=1,nstrips_va1 |
654 |
|
* -------------------------------------------------------- |
655 |
|
* if VA1-mask from DB is 0 or 1, three masks are combined: |
656 |
|
* - from DB (a-priori mask) |
657 |
|
* - run-based (chip declared bad on the basis of <SIG>) |
658 |
|
* - event-based (failure in CN computation) |
659 |
|
* -------------------------------------------------------- |
660 |
if( mask_vk(iv,ivk) .ne. -1)then |
if( mask_vk(iv,ivk) .ne. -1)then |
661 |
mask(iv,ivk,is) = 1 |
mask(iv,ivk,is) = 1 |
662 |
$ * mask_vk(iv,ivk) !from DB |
$ * mask_vk(iv,ivk) !from DB |
663 |
$ * mask_vk_ev(iv,ivk) !from <SIG> |
$ * mask_vk_ev(iv,ivk) !from <SIG> |
664 |
$ * mask_vk_run(iv,ivk) !from CN |
$ * mask_vk_run(iv,ivk) !from CN |
665 |
|
* ----------------------------------------------------------- |
666 |
|
* if VA1-mask from DB is -1 only event-based mask is applied |
667 |
|
* ----------------------------------------------------------- |
668 |
else |
else |
669 |
mask(iv,ivk,is) = -1 |
mask(iv,ivk,is) = -1 |
670 |
$ * mask_vk(iv,ivk) !from DB |
$ * mask_vk(iv,ivk) !from DB |
671 |
$ * mask_vk_ev(iv,ivk) !from CN |
$ * mask_vk_ev(iv,ivk) !from CN |
672 |
endif |
endif |
673 |
enddo |
enddo |
674 |
|
|