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 |
|
|
30 |
|
c$$$ print*,debug,verbose,warning |
31 |
|
c$$$ debug=1 |
32 |
|
c$$$ verbose=1 |
33 |
|
c$$$ warning=1 |
34 |
|
|
35 |
|
* ////////////////////////// |
36 |
|
* initialize some parameters |
37 |
|
* ////////////////////////// |
38 |
|
|
|
c call stripmask !called later, after CN computation |
|
39 |
call init_level1 |
call init_level1 |
40 |
|
|
41 |
|
c debug=.true. |
42 |
|
|
43 |
|
if(debug.eq.1)print*,'-- check LEVEL0 status' |
44 |
|
|
45 |
|
ievco=-1 |
46 |
|
mismatch=0 |
47 |
c good1 = good0 |
c good1 = good0 |
48 |
c-------------------------------------------------- |
c-------------------------------------------------- |
49 |
c check the LEVEL0 event status for missing |
c check the LEVEL0 event status for missing |
60 |
c CRC error |
c CRC error |
61 |
c ------------------------ |
c ------------------------ |
62 |
if(crc(iv).eq.1) then |
if(crc(iv).eq.1) then |
63 |
GOOD1(DSPnumber(iv)) = 2 |
c GOOD1(DSPnumber(iv)) = 2 |
64 |
goto 18 !next view |
c GOOD1(DSPnumber(iv)) = GOOD1(DSPnumber(iv)) + 2**1 |
65 |
|
GOOD1(DSPnumber(iv)) = ior(GOOD1(DSPnumber(iv)),2**1) |
66 |
|
102 format(' * WARNING * Event ',i7,' view',i3 |
67 |
|
$ ,' CRC error') |
68 |
|
if(debug.eq.1)write(*,102)eventn(1),DSPnumber(iv) |
69 |
|
c goto 18 !next view |
70 |
endif |
endif |
71 |
c ------------------------ |
c ------------------------ |
72 |
c online-software alarm |
c online-software alarm |
81 |
$ fc(iv).ne.0.or. |
$ fc(iv).ne.0.or. |
82 |
$ DATAlength(iv).eq.0.or. |
$ DATAlength(iv).eq.0.or. |
83 |
$ .false.)then |
$ .false.)then |
84 |
GOOD1(DSPnumber(iv))=3 |
c GOOD1(DSPnumber(iv))=3 |
85 |
goto 18 |
c GOOD1(DSPnumber(iv)) = GOOD1(DSPnumber(iv)) + 2**2 |
86 |
|
GOOD1(DSPnumber(iv)) = ior(GOOD1(DSPnumber(iv)),2**2) |
87 |
|
103 format(' * WARNING * Event ',i7,' view',i3 |
88 |
|
$ ,' software alarm') |
89 |
|
if(debug.eq.1)write(*,103)eventn(1),DSPnumber(iv) |
90 |
|
c goto 18 |
91 |
endif |
endif |
92 |
c ------------------------ |
c ------------------------ |
93 |
c DSP-counter jump |
c DSP-counter jump |
94 |
c ------------------------ |
c ------------------------ |
95 |
if( |
c commentato perche` non e` un controllo significativo nel caso in cui |
96 |
$ eventn_old(iv).ne.0.and. !first event in this file |
c la subroutine venga chiamata per riprocessare l'evento |
97 |
$ eventn(iv).ne.1.and. !first event in run |
c sostituito con un check dei contatori dei vari dsp |
98 |
$ good_old(DSPnumber(iv)).ne.0.and. !previous event corrupted |
c$$$ if( |
99 |
$ .true.)then |
c$$$ $ eventn_old(iv).ne.0.and. !first event in this file |
100 |
|
c$$$ $ eventn(iv).ne.1.and. !first event in run |
101 |
if(eventn(iv).ne.(eventn_old(iv)+1))then |
c$$$ $ good_old(DSPnumber(iv)).ne.0.and. !previous event corrupted |
102 |
GOOD1(DSPnumber(iv))=4 |
c$$$ $ .true.)then |
103 |
goto 18 |
c$$$ |
104 |
|
c$$$ if(eventn(iv).ne.(eventn_old(iv)+1))then |
105 |
|
c$$$c GOOD1(DSPnumber(iv))=4 |
106 |
|
c$$$c GOOD1(DSPnumber(iv)) = GOOD1(DSPnumber(iv)) + 2**3 |
107 |
|
c$$$ GOOD1(DSPnumber(iv)) = ior(GOOD1(DSPnumber(iv)),2**3) |
108 |
|
c$$$ 104 format(' * WARNING * Event ',i7,' view',i3 |
109 |
|
c$$$ $ ,' counter jump ',i10,i10) |
110 |
|
c$$$ if(debug.eq.1)write(*,104)eventn(1),DSPnumber(iv) |
111 |
|
c$$$ $ ,eventn_old(iv),eventn(iv)) |
112 |
|
c$$$ goto 18 |
113 |
|
c$$$ endif |
114 |
|
c$$$ |
115 |
|
c$$$ endif |
116 |
|
c ------------------------ |
117 |
|
c 18 continue |
118 |
|
c ------------------------ |
119 |
|
c DSP-counter |
120 |
|
c ------------------------ |
121 |
|
if( DSPnumber(iv).ne.0.and.GOOD1(DSPnumber(iv)).ne.1)then |
122 |
|
if(iv.ne.1.and.ievco.ne.-1)then |
123 |
|
if( eventn(iv).ne.ievco )then |
124 |
|
mismatch=1 |
125 |
|
endif |
126 |
endif |
endif |
127 |
|
ievco = eventn(iv) |
128 |
endif |
endif |
|
c ------------------------ |
|
|
18 continue |
|
129 |
endif |
endif |
130 |
enddo |
enddo |
131 |
|
|
132 |
|
c print*,'*** ',(eventn(iv),iv=1,12) |
133 |
|
|
134 |
|
if(mismatch.eq.1.and.debug.eq.1) |
135 |
|
$ print*,' * WARNING * DSP counter mismatch: ' |
136 |
|
$ ,(eventn(iv),iv=1,12) |
137 |
|
|
138 |
ngood = 0 |
ngood = 0 |
139 |
do iv = 1,nviews |
do iv = 1,nviews |
140 |
|
|
141 |
|
if(mismatch.eq.1.and.GOOD1(iv).ne.1) |
142 |
|
$ GOOD1(iv)=ior(GOOD1(iv),2**3) |
143 |
|
|
144 |
eventn_old(iv) = eventn(iv) |
eventn_old(iv) = eventn(iv) |
145 |
good_old(iv) = good1(iv) |
good_old(iv) = good1(iv) |
146 |
ngood = ngood + good1(iv) |
ngood = ngood + good1(iv) |
147 |
|
|
148 |
enddo |
enddo |
149 |
c if(ngood.ne.0)print*,'* WARNING * LEVEL0 event status: ' |
c$$$ if(verbose.and.ngood.ne.0)print*,'* WARNING * Event ',eventn(1) |
150 |
c $ ,(good1(i),i=1,nviews) |
c$$$ $ ,':LEVEL0 event status: ' |
151 |
|
c$$$ $ ,(good1(i),i=1,nviews) |
152 |
c-------------------------------------------------- |
c-------------------------------------------------- |
153 |
c read the variable DATATRACKER from LEVEL0 |
c read the variable DATATRACKER from LEVEL0 |
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.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 |
161 |
ierror = 220 |
ierror = 220 |
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.eq.1)print*,'-- compute CN' |
170 |
|
|
171 |
do iv=1,nviews |
do iv=1,nviews |
172 |
ima=0 |
|
173 |
do ik=1,nva1_view |
call evaluatecn(iv) |
174 |
cn(iv,ik) = 0 |
c$$$ ima=0 |
175 |
cnrms(iv,ik) = 0 |
c$$$ do ik=1,nva1_view |
176 |
cnn(iv,ik) = -1 |
c$$$ cn(iv,ik) = 0 |
177 |
mask_vk_ev(iv,ik)=1 |
c$$$ cnrms(iv,ik) = 0 |
178 |
iflag=0 |
c$$$ cnn(iv,ik) = -1 |
179 |
if(mask_vk(iv,ik).eq.1)call cncomp(iv,ik,iflag) |
c$$$ iflag = 0 |
180 |
if(iflag.ne.0)then |
c$$$ mask_vk_ev(iv,ik) = 1 |
181 |
ima=ima+1 |
c$$$ call stripmask(iv,ik) !compute mask(i,j,k), combining VA1-masks |
182 |
mask_vk_ev(iv,ik)=0 |
c$$$* -------------------------------------- |
183 |
ierror = 220 |
c$$$* if chip is not masked ---> evaluate CN |
184 |
endif |
c$$$* -------------------------------------- |
185 |
enddo |
c$$$ if( mask(iv,ik,1).eq.1 ) then !!!NBNB mask per la striscia 1 !!!!!!!! |
186 |
100 format(' * WARNING * Event ',i7,' view',i3,': VK MASK ',24i1) |
c$$$ call cncomp(iv,ik,iflag) |
187 |
if(ima.ne.0.and.debug)write(*,100)eventn(1),iv |
c$$$ if(iflag.ne.0)then |
188 |
$ ,(mask_vk_ev(iv,ik),ik=1,nva1_view) |
c$$$ ima=ima+1 |
189 |
|
c$$$ mask_vk_ev(iv,ik)=0 |
190 |
|
c$$$ ierror = 220 |
191 |
|
c$$$ endif |
192 |
|
c$$$ call stripmask(iv,ik) !compute mask(i,j,k), combining VA1-masks |
193 |
|
c$$$ endif |
194 |
|
c$$$ enddo |
195 |
|
c$$$ 100 format(' * WARNING * Event ',i7,' view',i3,': VK MASK ',24i1) |
196 |
|
c$$$ if(ima.ne.0.and.verbose.eq.1)write(*,100)eventn(1),iv |
197 |
|
c$$$ $ ,(mask_vk_ev(iv,ik),ik=1,nva1_view) |
198 |
|
|
199 |
enddo |
enddo |
200 |
|
|
201 |
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 |
202 |
|
|
203 |
c--------------------------------------------- |
c--------------------------------------------- |
204 |
c loops on views, VA1 and strips, |
c loops on views, VA1 and strips, |
208 |
c--------------------------------------------- |
c--------------------------------------------- |
209 |
ind=1 !clsignal array index |
ind=1 !clsignal array index |
210 |
|
|
211 |
|
if(debug.eq.1)print*,'-- search clusters' |
212 |
do iv=1,nviews !loop on views |
do iv=1,nviews !loop on views |
213 |
do is=1,nstrips_view !loop on strips (1) |
c$$$ do is=1,nstrips_view !loop on strips (1) |
214 |
if(mod(iv,2).eq.1) then |
c$$$ if(mod(iv,2).eq.1) then |
215 |
C=== > Y view |
c$$$C=== > Y view |
216 |
value(is)= -(DBLE(adc(iv,nvk(is),nst(is))) |
c$$$c print*,iv,nvk(is),nst(is),adc(iv,nvk(is),nst(is)) |
217 |
$ -cn(iv,nvk(is))-pedestal(iv,nvk(is),nst(is))) |
c$$$c $ ,cn(iv,nvk(is)) |
218 |
$ *mask(iv,nvk(is),nst(is)) |
c$$$c $ ,pedestal(iv,nvk(is),nst(is)) |
219 |
clseedcut(is)=clcuty*sigma(iv,nvk(is),nst(is)) |
c$$$ value(is)= -(DBLE(adc(iv,nvk(is),nst(is))) |
220 |
$ *mask(iv,nvk(is),nst(is)) |
c$$$ $ -cn(iv,nvk(is))-pedestal(iv,nvk(is),nst(is))) |
221 |
clinclcut(is)=incuty*sigma(iv,nvk(is),nst(is)) |
c$$$ $ *mask(iv,nvk(is),nst(is)) |
222 |
$ *mask(iv,nvk(is),nst(is)) |
c$$$ clseedcut(is)=clcuty*sigma(iv,nvk(is),nst(is)) |
223 |
sat(is)=0 |
c$$$ $ *mask(iv,nvk(is),nst(is)) |
224 |
if( adc(iv,nvk(is),nst(is)).lt.adc_saty )sat(is)=1 |
c$$$ clinclcut(is)=incuty*sigma(iv,nvk(is),nst(is)) |
225 |
else |
c$$$ $ *mask(iv,nvk(is),nst(is)) |
226 |
C=== > X view |
c$$$ sat(is)=0 |
227 |
value(is)= (DBLE(adc(iv,nvk(is),nst(is))) |
c$$$ if( adc(iv,nvk(is),nst(is)).lt.adc_saty )sat(is)=1 |
228 |
$ -cn(iv,nvk(is))-pedestal(iv,nvk(is),nst(is))) |
c$$$ else |
229 |
$ *mask(iv,nvk(is),nst(is)) |
c$$$C=== > X view |
230 |
clseedcut(is)=clcutx*sigma(iv,nvk(is),nst(is)) |
c$$$ value(is)= (DBLE(adc(iv,nvk(is),nst(is))) |
231 |
$ *mask(iv,nvk(is),nst(is)) |
c$$$ $ -cn(iv,nvk(is))-pedestal(iv,nvk(is),nst(is))) |
232 |
clinclcut(is)=incutx*sigma(iv,nvk(is),nst(is)) |
c$$$ $ *mask(iv,nvk(is),nst(is)) |
233 |
$ *mask(iv,nvk(is),nst(is)) |
c$$$ clseedcut(is)=clcutx*sigma(iv,nvk(is),nst(is)) |
234 |
sat(is)=0 |
c$$$ $ *mask(iv,nvk(is),nst(is)) |
235 |
if( adc(iv,nvk(is),nst(is)).gt.adc_satx )sat(is)=1 |
c$$$ clinclcut(is)=incutx*sigma(iv,nvk(is),nst(is)) |
236 |
endif |
c$$$ $ *mask(iv,nvk(is),nst(is)) |
237 |
enddo !end loop on strips (1) |
c$$$ sat(is)=0 |
238 |
call search_cluster(iv) |
c$$$ if( adc(iv,nvk(is),nst(is)).gt.adc_satx )sat(is)=1 |
239 |
|
c$$$ endif |
240 |
if(.not.flag_shower)then |
c$$$ enddo !end loop on strips (1) |
241 |
call save_cluster(iv) |
call subtractped(iv) |
242 |
else |
call searchcluster(iv) |
243 |
fshower(iv) = 1 |
|
244 |
GOOD1(DSPnumber(iv)) = 11 |
if(.not.flag_shower)then |
245 |
endif |
call savecluster(iv) |
246 |
|
c$$$ if(debug.eq.1)print*,' view ',iv,' #clusters ', nclstr_view |
247 |
|
else |
248 |
|
fshower(iv) = 1 |
249 |
|
c GOOD1(DSPnumber(iv)) = 11 !AHAHAHAHA ORRORE!! |
250 |
|
c GOOD1(iv) = 11 |
251 |
|
c GOOD1(iv) = GOOD1(iv) + 2**5 |
252 |
|
GOOD1(iv) = ior(GOOD1(iv),2**5) |
253 |
|
101 format(' * WARNING * Event ',i7,' view',i3 |
254 |
|
$ ,' #clusters > ',i5,' --> MASKED') |
255 |
|
if(verbose.eq.1)write(*,101)eventn(1),iv,nclstrmax_view |
256 |
|
endif |
257 |
enddo ! end loop on views |
enddo ! end loop on views |
258 |
do iv=1,nviews |
do iv=1,nviews |
259 |
do ik=1,nva1_view |
do ik=1,nva1_view |
260 |
cnev(iv,ik) = cn(iv,ik) !assigns computed CN to ntuple variables |
cnev(iv,ik) = cn(iv,ik) !assigns computed CN to ntuple variables |
261 |
cnrmsev(iv,ik) = cnrms(iv,ik) !assigns computed CN to ntuple variables |
cnrmsev(iv,ik) = cnrms(iv,ik) !assigns computed CN to ntuple variables |
262 |
cnnev(iv,ik) = cnn(iv,ik) !assigns computed CN to ntuple variables |
cnnev(iv,ik) = cnn(iv,ik) !assigns computed CN to ntuple variables |
263 |
enddo |
enddo |
264 |
enddo |
enddo |
265 |
C--------------------------------------------- |
C--------------------------------------------- |
266 |
C come here if GOOD1=0 |
C come here if GOOD1=0 |
272 |
do iv = 1,nviews |
do iv = 1,nviews |
273 |
ngood = ngood + good1(iv) |
ngood = ngood + good1(iv) |
274 |
enddo |
enddo |
275 |
if(ngood.ne.0)print*,'* WARNING * Event ',eventn(1) |
if(verbose.eq.1.and.ngood.ne.0) |
276 |
|
$ print*,'* WARNING * Event ',eventn(1) |
277 |
$ ,':LEVEL1 event status: ' |
$ ,':LEVEL1 event status: ' |
278 |
$ ,(good1(i),i=1,nviews) |
$ ,(good1(i),i=1,nviews) |
279 |
c------------------------------------------------------------------------ |
c------------------------------------------------------------------------ |
316 |
indmax(ic) = 0 |
indmax(ic) = 0 |
317 |
maxs(ic) = 0 |
maxs(ic) = 0 |
318 |
mult(ic) = 0 |
mult(ic) = 0 |
319 |
dedx(ic) = 0 |
sgnl(ic) = 0 |
320 |
whichtrack(ic) = 0 |
whichtrack(ic) = 0 !assigned @ level2 |
321 |
|
|
322 |
enddo |
enddo |
323 |
do id=1,maxlength !??? |
do id=1,maxlength !??? |
346 |
* |
* |
347 |
*---***---***---***---***---***---***---***---*** |
*---***---***---***---***---***---***---***---*** |
348 |
|
|
349 |
subroutine search_cluster(iv) |
subroutine searchcluster(iv) |
350 |
|
|
351 |
include 'commontracker.f' |
include 'commontracker.f' |
352 |
include 'level0.f' |
include 'level0.f' |
393 |
c----------------------------------------- |
c----------------------------------------- |
394 |
c possible SEED... |
c possible SEED... |
395 |
c----------------------------------------- |
c----------------------------------------- |
396 |
|
c$$$ if(debug.eq.1)print*,'|||| ',value(is),' @',is |
397 |
|
c$$$ $ ,' cut ',clseedcut(is) |
398 |
|
|
399 |
itemp = is |
itemp = is |
400 |
fsat = 0 ! first saturated strip |
fsat = 0 ! first saturated strip |
401 |
lsat = 0 ! last saturated strip |
lsat = 0 ! last saturated strip |
407 |
$ value(itemp).le.value(itemp+1) |
$ value(itemp).le.value(itemp+1) |
408 |
$ .and.value(itemp+1).gt.clseedcut(itemp+1)) |
$ .and.value(itemp+1).gt.clseedcut(itemp+1)) |
409 |
itemp = itemp+1 |
itemp = itemp+1 |
410 |
|
c$$$ if(debug.eq.1)print*,'|||| ',value(itemp),' @',is |
411 |
|
c$$$ $ ,' cut ',clseedcut(itemp) |
412 |
if(itemp.eq.last) goto 230 !stops if reaches last strip |
if(itemp.eq.last) goto 230 !stops if reaches last strip |
413 |
if(sat(itemp).eq.1) goto 230 !stop if reaches a saturated strip |
if(sat(itemp).eq.1) goto 230 !stop if reaches a saturated strip |
414 |
enddo ! of the ladder |
enddo ! of the ladder |
420 |
fsat = itemp |
fsat = itemp |
421 |
lsat = itemp |
lsat = itemp |
422 |
if(itemp.eq.last) goto 231 !estremo... |
if(itemp.eq.last) goto 231 !estremo... |
423 |
do while( sat(itemp+1).eq.1 ) |
do while( |
424 |
|
$ sat(itemp+1).eq.1 .and. |
425 |
|
$ value(itemp+1).gt.clseedcut(itemp+1) .and. |
426 |
|
$ .true.) |
427 |
itemp = itemp+1 |
itemp = itemp+1 |
428 |
lsat = itemp |
lsat = itemp |
429 |
if(itemp.eq.last) goto 231 !stops if reaches last strip |
if(itemp.eq.last) goto 231 !stops if reaches last strip |
438 |
iseed = itemp ! <<< SEED |
iseed = itemp ! <<< SEED |
439 |
else |
else |
440 |
iseed = int((lsat+fsat)/2) ! <<< SEED |
iseed = int((lsat+fsat)/2) ! <<< SEED |
441 |
c$$$ print*,'saturated strips ',fsat,lsat,iseed |
if(debug.eq.1) |
442 |
|
$ print*,'saturated strips (first,last) ',fsat,lsat |
443 |
c$$$ print*,'--> ',(value(ii),ii=fsat,lsat) |
c$$$ print*,'--> ',(value(ii),ii=fsat,lsat) |
444 |
endif |
endif |
445 |
c--------------------------------------------------------------- |
c--------------------------------------------------------------- |
446 |
c after finding a cluster seed, checks also adjacent strips, |
c after finding a cluster seed, checks also adjacent strips, |
447 |
C and tags the ones exceeding clinclcut |
C and tags the ones exceeding clinclcut |
448 |
c--------------------------------------------------------------- |
c--------------------------------------------------------------- |
449 |
|
|
450 |
|
if(debug.eq.1)print*,'SEED ',value(iseed),' @',iseed |
451 |
|
$ ,' cut ',clseedcut(iseed) |
452 |
|
|
453 |
ir=iseed !indici destro |
ir=iseed !indici destro |
454 |
il=iseed ! e sinistro |
il=iseed ! e sinistro |
455 |
|
|
475 |
c------------------------------------------------------------------------ |
c------------------------------------------------------------------------ |
476 |
if( (rmax-lmax+1).ge.nclstrp )goto 210 !exits inclusion loop |
if( (rmax-lmax+1).ge.nclstrp )goto 210 !exits inclusion loop |
477 |
|
|
478 |
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 |
479 |
if(value(ir).gt.clinclcut(ir)) then |
if(value(ir).gt.clinclcut(ir)) then |
480 |
rmax=ir !include a strip on the right |
rmax=ir !include a strip on the right |
481 |
else |
else |
485 |
|
|
486 |
if( (rmax-lmax+1).ge.nclstrp )goto 210 !exits inclusion loop |
if( (rmax-lmax+1).ge.nclstrp )goto 210 !exits inclusion loop |
487 |
|
|
488 |
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 |
489 |
if(value(il).gt.clinclcut(il)) then |
if(value(il).gt.clinclcut(il)) then |
490 |
lmax=il !include a strip on the left |
lmax=il !include a strip on the left |
491 |
else |
else |
493 |
endif |
endif |
494 |
endif |
endif |
495 |
|
|
496 |
|
c if( (rmax-lmax+1).ge.nclstrp )goto 210 !exits inclusion loop |
497 |
|
|
498 |
enddo !ends strip inclusion loop |
enddo !ends strip inclusion loop |
499 |
goto 211 |
goto 211 |
500 |
210 continue !jumps here if more than nclstrp have been included |
210 continue !jumps here if more than nclstrp have been included |
515 |
rmax = rmax+1 |
rmax = rmax+1 |
516 |
if( (rmax-lmax+1).gt.nclstrp )lmax=lmax+1 |
if( (rmax-lmax+1).gt.nclstrp )lmax=lmax+1 |
517 |
endif |
endif |
518 |
|
c------------------------------------------------------------------------------- |
519 |
|
c adjust the cluster in order to have at least ANOTHER strip around the seed |
520 |
|
c------------------------------------------------------------------------------- |
521 |
|
if(iseed-1.eq.lmax.and.lmax.ne.first)then |
522 |
|
lmax = lmax-1 |
523 |
|
if( (rmax-lmax+1).gt.nclstrp )rmax=rmax-1 |
524 |
|
endif |
525 |
|
if(iseed+1.eq.rmax.and.rmax.ne.last )then |
526 |
|
rmax = rmax+1 |
527 |
|
if( (rmax-lmax+1).gt.nclstrp )lmax=lmax+1 |
528 |
|
endif |
529 |
|
c--------------------------------------------------- |
530 |
|
c now we have 5 stored-strips around the maximum |
531 |
|
c--------------------------------------------------- |
532 |
|
|
533 |
c------------------------------------------------------------------------ |
c------------------------------------------------------------------------ |
534 |
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 |
562 |
|
|
563 |
ladder_view(nclstr_view) = nld(iseed,iv) |
ladder_view(nclstr_view) = nld(iseed,iv) |
564 |
maxs_view(nclstr_view) = iseed |
maxs_view(nclstr_view) = iseed |
|
mult_view(nclstr_view) = rmax-lmax+1 |
|
565 |
rmax_view(nclstr_view) = rmax |
rmax_view(nclstr_view) = rmax |
566 |
lmax_view(nclstr_view) = lmax |
lmax_view(nclstr_view) = lmax |
567 |
|
c mult_view(nclstr_view) = rmax-lmax+1 |
568 |
|
mult_view(nclstr_view) = 0 |
569 |
|
do ii=lmax,rmax |
570 |
|
if(value(ii).gt.clinclcut(ii)) |
571 |
|
$ mult_view(nclstr_view) = mult_view(nclstr_view)+1 |
572 |
|
enddo |
573 |
|
|
574 |
|
c$$$ print*,(value(ii),ii=lmax,rmax) |
575 |
|
c$$$ print*,(clinclcut(ii),ii=lmax,rmax) |
576 |
|
c$$$ print*,(clseedcut(ii),ii=lmax,rmax) |
577 |
|
|
578 |
c$$$ if(rmax-lmax+1.gt.25) |
c$$$ if(rmax-lmax+1.gt.25) |
579 |
c$$$ $ print*,'view ',iv |
c$$$ $ print*,'view ',iv |
580 |
c$$$ $ ,' cl ',nclstr_view,' mult ',rmax-lmax+1 |
c$$$ $ ,' cl ',nclstr_view,' mult ',rmax-lmax+1 |
581 |
c------------------------------------------------------------------------ |
c------------------------------------------------------------------------ |
582 |
c search for a dowble peak inside the cluster |
c search for a double peak inside the cluster |
583 |
c------------------------------------------------------------------------ |
c------------------------------------------------------------------------ |
584 |
inext = rmax+1 !<< index where to start new-cluster search |
inext = rmax+1 !<< index where to start new-cluster search |
585 |
|
|
637 |
* |
* |
638 |
*---***---***---***---***---***---***---***---*** |
*---***---***---***---***---***---***---***---*** |
639 |
|
|
640 |
subroutine save_cluster(iv) |
subroutine savecluster(iv) |
641 |
* |
* |
642 |
* (080/2006 Elena Vannuccini) |
* (080/2006 Elena Vannuccini) |
643 |
* Save the clusters view by view |
* Save the clusters view by view |
665 |
|
|
666 |
CLlength = rmax_view(ic) - lmax_view(ic) + 1 !numero di strip salvate |
CLlength = rmax_view(ic) - lmax_view(ic) + 1 !numero di strip salvate |
667 |
totCLlength = totCLlength + CLlength |
totCLlength = totCLlength + CLlength |
668 |
dedx(nclstr1) = 0 |
sgnl(nclstr1) = 0 |
669 |
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 |
670 |
|
|
671 |
clsignal(ind) = value(j) ! clsignal array |
clsignal(ind) = value(j) ! clsignal array |
672 |
|
c$$$ print*,ind,clsignal(ind) |
673 |
ivk=nvk(j) |
ivk=nvk(j) |
674 |
ist=nst(j) |
ist=nst(j) |
675 |
|
|
681 |
ind=ind+1 |
ind=ind+1 |
682 |
c if(value(j).gt.0) |
c if(value(j).gt.0) |
683 |
if(value(j).gt.clinclcut(j)) |
if(value(j).gt.clinclcut(j)) |
684 |
$ dedx(nclstr1) = dedx(nclstr1) + value(j) !cluster charge |
$ sgnl(nclstr1) = sgnl(nclstr1) + value(j) !cluster charge |
685 |
enddo |
enddo |
686 |
|
|
687 |
c print*,'view ',iv,' -- save_cluster -- nclstr1: ' |
if(debug.eq.1)then |
688 |
c $ ,nclstr1,maxs(nclstr1),mult(nclstr1),dedx(nclstr1) |
print*,'view ',iv,' -- ' |
689 |
|
$ ,' n.cl: ',nclstr1 |
690 |
|
$ ,' maxs: ',maxs(nclstr1) |
691 |
|
$ ,' mult: ',mult(nclstr1) |
692 |
|
$ ,' sign: ',sgnl(nclstr1) |
693 |
|
print*,'----------------------' |
694 |
|
endif |
695 |
|
enddo |
696 |
|
|
697 |
|
return |
698 |
|
end |
699 |
|
*---***---***---***---***---***---***---***---*** |
700 |
|
* |
701 |
|
* |
702 |
|
* |
703 |
|
* |
704 |
|
* |
705 |
|
*---***---***---***---***---***---***---***---*** |
706 |
|
|
707 |
|
subroutine evaluatecn(iv) |
708 |
|
|
709 |
|
include 'commontracker.f' |
710 |
|
include 'level0.f' |
711 |
|
include 'level1.f' |
712 |
|
include 'common_reduction.f' |
713 |
|
include 'calib.f' |
714 |
|
|
715 |
|
ima=0 |
716 |
|
do ik=1,nva1_view |
717 |
|
cn(iv,ik) = 0 |
718 |
|
cnrms(iv,ik) = 0 |
719 |
|
cnn(iv,ik) = -1 |
720 |
|
iflag = 0 |
721 |
|
mask_vk_ev(iv,ik) = 1 |
722 |
|
call stripmask(iv,ik) !compute mask(i,j,k), combining VA1-masks |
723 |
|
* -------------------------------------- |
724 |
|
* if chip is not masked ---> evaluate CN |
725 |
|
* -------------------------------------- |
726 |
|
if( mask(iv,ik,1).eq.1 ) then !!!NBNB mask per la striscia 1 !!!!!!!! |
727 |
|
call cncomp(iv,ik,iflag) |
728 |
|
if(iflag.ne.0)then |
729 |
|
ima=ima+1 |
730 |
|
mask_vk_ev(iv,ik)=0 |
731 |
|
ierror = 220 |
732 |
|
endif |
733 |
|
call stripmask(iv,ik) !compute mask(i,j,k), combining VA1-masks |
734 |
|
endif |
735 |
enddo |
enddo |
736 |
|
100 format(' * WARNING * Event ',i7,' view',i3,': VK MASK ',24i1) |
737 |
|
if(ima.ne.0.and.verbose.eq.1)write(*,100)eventn(1),iv |
738 |
|
$ ,(mask_vk_ev(iv,ik),ik=1,nva1_view) |
739 |
|
|
740 |
return |
return |
741 |
end |
end |
742 |
|
|
743 |
*---***---***---***---***---***---***---***---*** |
*---***---***---***---***---***---***---***---*** |
744 |
* |
* |
745 |
* |
* |
747 |
* |
* |
748 |
* |
* |
749 |
*---***---***---***---***---***---***---***---*** |
*---***---***---***---***---***---***---***---*** |
750 |
|
subroutine subtractped(iv) |
751 |
|
|
752 |
|
include 'commontracker.f' |
753 |
|
include 'level1.f' |
754 |
|
include 'calib.f' |
755 |
|
include 'common_reduction.f' |
756 |
|
|
757 |
|
do is=1,nstrips_view !loop on strips (1) |
758 |
|
if(mod(iv,2).eq.1) then |
759 |
|
C=== > Y view |
760 |
|
c print*,iv,nvk(is),nst(is),adc(iv,nvk(is),nst(is)) |
761 |
|
c $ ,cn(iv,nvk(is)) |
762 |
|
c $ ,pedestal(iv,nvk(is),nst(is)) |
763 |
|
value(is)= -(DBLE(adc(iv,nvk(is),nst(is))) |
764 |
|
$ -cn(iv,nvk(is))-pedestal(iv,nvk(is),nst(is))) |
765 |
|
$ *mask(iv,nvk(is),nst(is)) |
766 |
|
clseedcut(is)=clcuty*sigma(iv,nvk(is),nst(is)) |
767 |
|
$ *mask(iv,nvk(is),nst(is)) |
768 |
|
clinclcut(is)=incuty*sigma(iv,nvk(is),nst(is)) |
769 |
|
$ *mask(iv,nvk(is),nst(is)) |
770 |
|
sat(is)=0 |
771 |
|
if( adc(iv,nvk(is),nst(is)).lt.adc_saty ) |
772 |
|
$ sat(is)=mask(iv,nvk(is),nst(is)) |
773 |
|
else |
774 |
|
C=== > X view |
775 |
|
value(is)= (DBLE(adc(iv,nvk(is),nst(is))) |
776 |
|
$ -cn(iv,nvk(is))-pedestal(iv,nvk(is),nst(is))) |
777 |
|
$ *mask(iv,nvk(is),nst(is)) |
778 |
|
clseedcut(is)=clcutx*sigma(iv,nvk(is),nst(is)) |
779 |
|
$ *mask(iv,nvk(is),nst(is)) |
780 |
|
clinclcut(is)=incutx*sigma(iv,nvk(is),nst(is)) |
781 |
|
$ *mask(iv,nvk(is),nst(is)) |
782 |
|
sat(is)=0 |
783 |
|
if( adc(iv,nvk(is),nst(is)).gt.adc_satx ) |
784 |
|
$ sat(is)=mask(iv,nvk(is),nst(is)) |
785 |
|
endif |
786 |
|
enddo !end loop on strips (1) |
787 |
|
|
788 |
|
|
789 |
|
return |
790 |
|
end |
791 |
|
*---***---***---***---***---***---***---***---*** |
792 |
|
* |
793 |
|
* |
794 |
|
* |
795 |
|
* |
796 |
|
* |
797 |
|
*---***---***---***---***---***---***---***---*** |
798 |
|
c$$$ subroutine stripmask |
799 |
|
c$$$ |
800 |
|
c$$$* this routine set va1 and single-strip masks, |
801 |
|
c$$$* on the basis of the VA1 mask saved in the DB |
802 |
|
c$$$* |
803 |
|
c$$$* mask(nviews,nva1_view,nstrips_va1) !strip mask |
804 |
|
c$$$* mask_vk(nviews,nva1_view) !VA1 mask |
805 |
|
c$$$* |
806 |
|
c$$$ include 'commontracker.f' |
807 |
|
c$$$ include 'level1.f' |
808 |
|
c$$$ include 'common_reduction.f' |
809 |
|
c$$$ include 'calib.f' |
810 |
|
c$$$ |
811 |
|
c$$$* init mask |
812 |
|
c$$$ do iv=1,nviews |
813 |
|
c$$$ do ivk=1,nva1_view |
814 |
|
c$$$ do is=1,nstrips_va1 |
815 |
|
c$$$c mask(iv,ivk,is) = mask_vk(iv,ivk) |
816 |
|
c$$$ if( mask_vk(iv,ivk) .ne. -1)then |
817 |
|
c$$$ mask(iv,ivk,is) = 1 |
818 |
|
c$$$ $ * mask_vk(iv,ivk) !from DB |
819 |
|
c$$$ $ * mask_vk_ev(iv,ivk) !from <SIG> |
820 |
|
c$$$ $ * mask_vk_run(iv,ivk) !from CN |
821 |
|
c$$$ else |
822 |
|
c$$$ mask(iv,ivk,is) = -1 |
823 |
|
c$$$ $ * mask_vk(iv,ivk) !from DB |
824 |
|
c$$$ $ * mask_vk_ev(iv,ivk) !from CN |
825 |
|
c$$$ endif |
826 |
|
c$$$ enddo |
827 |
|
c$$$ enddo |
828 |
|
c$$$ enddo |
829 |
|
c$$$ |
830 |
|
c$$$ |
831 |
|
c$$$ return |
832 |
|
c$$$ end |
833 |
|
|
834 |
subroutine stripmask |
subroutine stripmask(iv,ivk) |
835 |
|
|
836 |
|
* ----------------------------------------------- |
837 |
* this routine set va1 and single-strip masks, |
* this routine set va1 and single-strip masks, |
838 |
* on the basis of the VA1 mask saved in the DB |
* on the basis of the VA1 mask saved in the DB |
839 |
* |
* |
840 |
* mask(nviews,nva1_view,nstrips_va1) !strip mask |
* mask(nviews,nva1_view,nstrips_va1) !strip mask |
841 |
* mask_vk(nviews,nva1_view) !VA1 mask |
* mask_vk(nviews,nva1_view) !VA1 mask |
842 |
* |
* ----------------------------------------------- |
843 |
include 'commontracker.f' |
include 'commontracker.f' |
844 |
include 'level1.f' |
include 'level1.f' |
845 |
include 'common_reduction.f' |
include 'common_reduction.f' |
846 |
include 'calib.f' |
include 'calib.f' |
847 |
|
|
848 |
* init mask |
* init mask |
849 |
do iv=1,nviews |
do is=1,nstrips_va1 |
850 |
do ivk=1,nva1_view |
* -------------------------------------------------------- |
851 |
do is=1,nstrips_va1 |
* if VA1-mask from DB is 0 or 1, three masks are combined: |
852 |
c mask(iv,ivk,is) = mask_vk(iv,ivk) |
* - from DB (a-priori mask) |
853 |
mask(iv,ivk,is) = mask_vk(iv,ivk) * mask_vk_ev(iv,ivk) |
* - run-based (chip declared bad on the basis of <SIG>) |
854 |
enddo |
* - event-based (failure in CN computation) |
855 |
enddo |
* -------------------------------------------------------- |
856 |
|
c print*,iv,ivk |
857 |
|
c $ ,mask_vk(iv,ivk),mask_vk_ev(iv,ivk),mask_vk_run(iv,ivk) |
858 |
|
if( mask_vk(iv,ivk) .ne. -1)then |
859 |
|
mask(iv,ivk,is) = 1 |
860 |
|
$ * mask_vk(iv,ivk) !from DB |
861 |
|
$ * mask_vk_ev(iv,ivk) !from <SIG> |
862 |
|
$ * mask_vk_run(iv,ivk) !from CN |
863 |
|
* ----------------------------------------------------------- |
864 |
|
* if VA1-mask from DB is -1 only event-based mask is applied |
865 |
|
* ----------------------------------------------------------- |
866 |
|
else |
867 |
|
mask(iv,ivk,is) = -1 |
868 |
|
$ * mask_vk(iv,ivk) !from DB |
869 |
|
$ * mask_vk_ev(iv,ivk) !from CN |
870 |
|
endif |
871 |
enddo |
enddo |
872 |
|
|
873 |
|
|
874 |
return |
return |
875 |
end |
end |
|
|
|