/[PAMELA software]/DarthVader/TrackerLevel2/src/F77/reductionflight.f
ViewVC logotype

Contents of /DarthVader/TrackerLevel2/src/F77/reductionflight.f

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.24 - (show annotations) (download)
Tue Nov 27 15:28:58 2007 UTC (17 years ago) by pam-fi
Branch: MAIN
CVS Tags: v5r00
Changes since 1.23: +8 -8 lines
*** empty log message ***

1 *************************************************************************
2 *
3 * Program reductionflight.f
4 *
5 * - reads readraw.f output files: LEVEL0 ntuple, and ped, sig and bad histograms
6 * - decodes raw data (DATATRACKER) using DSP ped, sig and bad values
7 * - looks for clusters information using ped, sig and bad values from
8 * DSP histograms
9 * - fills LEVEL1 ntuple
10 *
11 *************************************************************************
12
13 subroutine reductionflight(ierror)
14
15 include 'commontracker.f'
16 include 'level0.f'
17 include 'level1.f'
18 include 'common_reduction.f'
19 include 'calib.f'
20
21 data eventn_old/nviews*0/
22
23 integer ierror
24 ierror = 0
25
26 c$$$ debug = .true.
27 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
39 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
48 c--------------------------------------------------
49 c check the LEVEL0 event status for missing
50 c sections or DSP alarms
51 c ==> set the variable GOOD1(12)
52 c--------------------------------------------------
53 do iv=1,nviews
54 if(DSPnumber(iv).gt.0.and.DSPnumber(iv).le.12)then
55 c ------------------------
56 c GOOD
57 c ------------------------
58 GOOD1(DSPnumber(iv))=0 !OK
59 c ------------------------
60 c CRC error
61 c ------------------------
62 if(crc(iv).eq.1) then
63 c GOOD1(DSPnumber(iv)) = 2
64 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
71 c ------------------------
72 c online-software alarm
73 c ------------------------
74 if(
75 $ fl1(iv).ne.0.or.
76 $ fl2(iv).ne.0.or.
77 $ fl3(iv).ne.0.or.
78 $ fl4(iv).ne.0.or.
79 $ fl5(iv).ne.0.or.
80 $ fl6(iv).ne.0.or.
81 $ fc(iv).ne.0.or.
82 $ DATAlength(iv).eq.0.or.
83 $ .false.)then
84 c GOOD1(DSPnumber(iv))=3
85 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
92 c ------------------------
93 c DSP-counter jump
94 c ------------------------
95 c commentato perche` non e` un controllo significativo nel caso in cui
96 c la subroutine venga chiamata per riprocessare l'evento
97 c sostituito con un check dei contatori dei vari dsp
98 c$$$ if(
99 c$$$ $ eventn_old(iv).ne.0.and. !first event in this file
100 c$$$ $ eventn(iv).ne.1.and. !first event in run
101 c$$$ $ good_old(DSPnumber(iv)).ne.0.and. !previous event corrupted
102 c$$$ $ .true.)then
103 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
127 ievco = eventn(iv)
128 endif
129 endif
130 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
139 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)
145 good_old(iv) = good1(iv)
146 ngood = ngood + good1(iv)
147
148 enddo
149 c$$$ if(verbose.and.ngood.ne.0)print*,'* WARNING * Event ',eventn(1)
150 c$$$ $ ,':LEVEL0 event status: '
151 c$$$ $ ,(good1(i),i=1,nviews)
152 c--------------------------------------------------
153 c read the variable DATATRACKER from LEVEL0
154 c and fill the variable ADC (invertin view 11)
155 c--------------------------------------------------
156
157 if(debug.eq.1)print*,'-- fill ADC vectors'
158
159 call filladc(iflag)
160 if(iflag.ne.0)then
161 ierror = 220
162 endif
163
164 c--------------------------------------------------
165 c computes common noise for each VA1
166 c (excluding strips with signal,
167 c tagged with the flag CLSTR)
168 c--------------------------------------------------
169 if(debug.eq.1)print*,'-- compute CN'
170
171 do iv=1,nviews
172 ima=0
173 do ik=1,nva1_view
174 cn(iv,ik) = 0
175 cnrms(iv,ik) = 0
176 cnn(iv,ik) = -1
177 iflag = 0
178 mask_vk_ev(iv,ik) = 1
179 call stripmask(iv,ik) !compute mask(i,j,k), combining VA1-masks
180 * --------------------------------------
181 * if chip is not masked ---> evaluate CN
182 * --------------------------------------
183 if( mask(iv,ik,1).eq.1 ) then !!!NBNB mask per la striscia 1 !!!!!!!!
184 call cncomp(iv,ik,iflag)
185 if(iflag.ne.0)then
186 ima=ima+1
187 mask_vk_ev(iv,ik)=0
188 ierror = 220
189 endif
190 call stripmask(iv,ik) !compute mask(i,j,k), combining VA1-masks
191 endif
192 enddo
193 100 format(' * WARNING * Event ',i7,' view',i3,': VK MASK ',24i1)
194 if(ima.ne.0.and.verbose.eq.1)write(*,100)eventn(1),iv
195 $ ,(mask_vk_ev(iv,ik),ik=1,nva1_view)
196 c if(ima.ne.0)write(*,100)eventn(1),iv
197 c $ ,(mask_vk_ev(iv,ik),ik=1,nva1_view)
198 enddo
199
200 cc call stripmask !compute mask(i,j,k), combining mask_vk_ev and mask_vk
201
202 c---------------------------------------------
203 c loops on views, VA1 and strips,
204 c and computes strips signals using
205 c badstrip, pedestals, and
206 c sigma informations from histograms
207 c---------------------------------------------
208 ind=1 !clsignal array index
209
210 if(debug.eq.1)print*,'-- search clusters'
211 do iv=1,nviews !loop on views
212 do is=1,nstrips_view !loop on strips (1)
213 if(mod(iv,2).eq.1) then
214 C=== > Y view
215 c print*,iv,nvk(is),nst(is),adc(iv,nvk(is),nst(is))
216 c $ ,cn(iv,nvk(is))
217 c $ ,pedestal(iv,nvk(is),nst(is))
218 value(is)= -(DBLE(adc(iv,nvk(is),nst(is)))
219 $ -cn(iv,nvk(is))-pedestal(iv,nvk(is),nst(is)))
220 $ *mask(iv,nvk(is),nst(is))
221 clseedcut(is)=clcuty*sigma(iv,nvk(is),nst(is))
222 $ *mask(iv,nvk(is),nst(is))
223 clinclcut(is)=incuty*sigma(iv,nvk(is),nst(is))
224 $ *mask(iv,nvk(is),nst(is))
225 sat(is)=0
226 if( adc(iv,nvk(is),nst(is)).lt.adc_saty )sat(is)=1
227 else
228 C=== > X view
229 value(is)= (DBLE(adc(iv,nvk(is),nst(is)))
230 $ -cn(iv,nvk(is))-pedestal(iv,nvk(is),nst(is)))
231 $ *mask(iv,nvk(is),nst(is))
232 clseedcut(is)=clcutx*sigma(iv,nvk(is),nst(is))
233 $ *mask(iv,nvk(is),nst(is))
234 clinclcut(is)=incutx*sigma(iv,nvk(is),nst(is))
235 $ *mask(iv,nvk(is),nst(is))
236 sat(is)=0
237 if( adc(iv,nvk(is),nst(is)).gt.adc_satx )sat(is)=1
238 endif
239 enddo !end loop on strips (1)
240 call search_cluster(iv)
241
242 if(.not.flag_shower)then
243 call save_cluster(iv)
244 if(debug.eq.1)print*,'view ',iv,' #clusters ', nclstr_view
245 else
246 fshower(iv) = 1
247 c GOOD1(DSPnumber(iv)) = 11 !AHAHAHAHA ORRORE!!
248 c GOOD1(iv) = 11
249 c GOOD1(iv) = GOOD1(iv) + 2**5
250 GOOD1(iv) = ior(GOOD1(iv),2**5)
251 101 format(' * WARNING * Event ',i7,' view',i3
252 $ ,' #clusters > ',i5,' --> MASKED')
253 if(verbose.eq.1)write(*,101)eventn(1),iv,nclstrmax_view
254 endif
255 enddo ! end loop on views
256 do iv=1,nviews
257 do ik=1,nva1_view
258 cnev(iv,ik) = cn(iv,ik) !assigns computed CN to ntuple variables
259 cnrmsev(iv,ik) = cnrms(iv,ik) !assigns computed CN to ntuple variables
260 cnnev(iv,ik) = cnn(iv,ik) !assigns computed CN to ntuple variables
261 enddo
262 enddo
263 C---------------------------------------------
264 C come here if GOOD1=0
265 C or the event has too many clusters
266 C---------------------------------------------
267 200 continue
268
269 ngood = 0
270 do iv = 1,nviews
271 ngood = ngood + good1(iv)
272 enddo
273 if(verbose.eq.1.and.ngood.ne.0)
274 $ print*,'* WARNING * Event ',eventn(1)
275 $ ,':LEVEL1 event status: '
276 $ ,(good1(i),i=1,nviews)
277 c------------------------------------------------------------------------
278 c
279 c closes files and exits
280 c
281 c------------------------------------------------------------------------
282 RETURN
283 END
284
285 ***...***...***...***...***...***...***...***...***...***...***...***...***...***...***...***
286 *
287 *
288 *
289 *
290 *
291 *
292 *
293 *
294 *
295 ***...***...***...***...***...***...***...***...***...***...***...***...***...***...***...***
296
297
298 subroutine init_level1
299
300 include 'commontracker.f'
301 include 'level1.f'
302 include 'level0.f'
303
304 c good1 = 0
305 do iv=1,12
306 good1(iv) = 1 !missing packet
307 enddo
308 nclstr1 = 0
309 totCLlength = 0
310 do ic=1,nclstrmax
311 view(ic) = 0
312 ladder(ic) = 0
313 indstart(ic) = 0
314 indmax(ic) = 0
315 maxs(ic) = 0
316 mult(ic) = 0
317 sgnl(ic) = 0
318 whichtrack(ic) = 0 !assigned @ level2
319
320 enddo
321 do id=1,maxlength !???
322 clsignal(id) = 0.
323 clsigma(id) = 0.
324 cladc(id) = 0.
325 clbad(id) = 0.
326 enddo
327 do iv=1,nviews
328 c crc1(iv)=0
329 do ik=1,nva1_view
330 cnev(iv,ik) = 0
331 cnnev(iv,ik) = 0
332 enddo
333 fshower(iv) = 0
334 enddo
335
336 return
337 end
338
339 *---***---***---***---***---***---***---***---***
340 *
341 *
342 *
343 *
344 *
345 *---***---***---***---***---***---***---***---***
346
347 subroutine search_cluster(iv)
348
349 include 'commontracker.f'
350 include 'level0.f'
351 include 'level1.f'
352 include 'calib.f'
353
354 include 'common_reduction.f'
355
356
357 c local variables
358 integer rmax,lmax !estremi del cluster
359 integer rstop,lstop
360 integer first,last
361 integer fsat,lsat
362
363 external nst
364
365 iseed=-999 !cluster seed index initialization
366
367 inext=-999 !index where to start new cluster search
368
369 flag_shower = .false.
370 nclstr_view=0
371
372 do jl=1,nladders_view !1..3 !loops on ladders
373
374 first = 1+nstrips_ladder*(jl-1) !1,1025,2049
375 last = nstrips_ladder*jl !1024,2048,3072
376
377 * X views have 1018 strips instead of 1024
378 if(mod(iv,2).eq.0) then
379 first=first+3
380 last=last-3
381 endif
382
383 do is=first,last !loop on strips in each ladder
384
385 c---------------------------------------------
386 c new-cluster search starts at index inext
387 c---------------------------------------------
388 if(is.lt.inext) goto 220 ! next strip
389
390 if(value(is).gt.clseedcut(is)) then
391 c-----------------------------------------
392 c possible SEED...
393 c-----------------------------------------
394 itemp = is
395 fsat = 0 ! first saturated strip
396 lsat = 0 ! last saturated strip
397 if(itemp.eq.last) goto 230 !estremo...
398 c ------------------------
399 c search for first maximum
400 c ------------------------
401 do while(
402 $ value(itemp).le.value(itemp+1)
403 $ .and.value(itemp+1).gt.clseedcut(itemp+1))
404 itemp = itemp+1
405 if(itemp.eq.last) goto 230 !stops if reaches last strip
406 if(sat(itemp).eq.1) goto 230 !stop if reaches a saturated strip
407 enddo ! of the ladder
408 230 continue
409 c -----------------------------
410 c check if strips are saturated
411 c -----------------------------
412 if( sat(itemp).eq.1 )then
413 fsat = itemp
414 lsat = itemp
415 if(itemp.eq.last) goto 231 !estremo...
416 do while( sat(itemp+1).eq.1 )
417 itemp = itemp+1
418 lsat = itemp
419 if(itemp.eq.last) goto 231 !stops if reaches last strip
420 enddo
421 endif
422 231 continue
423 c---------------------------------------------------------------------------
424 c fownd SEED!!!
425 c (if there are saturated strips, the cluster is centered in the middle)
426 c---------------------------------------------------------------------------
427 if(fsat.eq.0.and.lsat.eq.0)then
428 iseed = itemp ! <<< SEED
429 else
430 iseed = int((lsat+fsat)/2) ! <<< SEED
431 c$$$ print*,'saturated strips ',fsat,lsat,iseed
432 c$$$ print*,'--> ',(value(ii),ii=fsat,lsat)
433 endif
434 c---------------------------------------------------------------
435 c after finding a cluster seed, checks also adjacent strips,
436 C and tags the ones exceeding clinclcut
437 c---------------------------------------------------------------
438 ir=iseed !indici destro
439 il=iseed ! e sinistro
440
441 rmax=ir !estremo destro del cluster
442 lmax=il ! e sinistro
443
444 rstop=0 !initialize flags used to exit from
445 lstop=0 ! inclusion loop
446
447 do while(lstop.eq.0.or.rstop.eq.0) !shifts left and right from
448
449
450 ir=ir+1 !index for right side
451 il=il-1 !index for left side
452 c------------------------------------------------------------------------
453 c checks for last or first strip of the ladder
454 c------------------------------------------------------------------------
455 if( ir.gt.last ) rstop = 1
456 if( il.lt.first ) lstop = 1
457
458 c------------------------------------------------------------------------
459 c add strips exceeding inclusion cut
460 c------------------------------------------------------------------------
461 if( (rmax-lmax+1).ge.nclstrp )goto 210 !exits inclusion loop
462
463 if(rstop.eq.0) then !if right cluster border has not been reached
464 if(value(ir).gt.clinclcut(ir)) then
465 rmax=ir !include a strip on the right
466 else
467 rstop=1 !cluster right end
468 endif
469 endif
470
471 if( (rmax-lmax+1).ge.nclstrp )goto 210 !exits inclusion loop
472
473 if(lstop.eq.0) then !if left cluster border has not been reached
474 if(value(il).gt.clinclcut(il)) then
475 lmax=il !include a strip on the left
476 else
477 lstop=1 !cluster left end
478 endif
479 endif
480
481 c if( (rmax-lmax+1).ge.nclstrp )goto 210 !exits inclusion loop
482
483 enddo !ends strip inclusion loop
484 goto 211
485 210 continue !jumps here if more than nclstrp have been included
486 c print*,'>>> nclstrp! '
487 211 continue
488 c-----------------------------------------
489 c end of inclusion loop!
490 c-----------------------------------------
491
492 c------------------------------------------------------------------------
493 c adjust the cluster in order to have at least a strip around the seed
494 c------------------------------------------------------------------------
495 if(iseed.eq.lmax.and.lmax.ne.first)then
496 lmax = lmax-1
497 if( (rmax-lmax+1).gt.nclstrp )rmax=rmax-1
498 endif
499 if(iseed.eq.rmax.and.rmax.ne.last )then
500 rmax = rmax+1
501 if( (rmax-lmax+1).gt.nclstrp )lmax=lmax+1
502 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------------------------------------------------------------------------
519 c adjust the cluster in order to store a minimum number of strips
520 c------------------------------------------------------------------------
521 do while( (rmax-lmax+1).lt.nclstrpmin )
522
523 vl = -99999
524 vr = -99999
525 if(lmax-1.ge.first) vl = value(lmax-1)
526 if(rmax+1.le.last ) vr = value(rmax+1)
527 if(vr.ge.vl) then
528 rmax = rmax+1
529 else
530 lmax = lmax-1
531 endif
532
533 enddo
534
535 c--------------------------------------------------------
536 c store cluster info
537 c--------------------------------------------------------
538 nclstr_view = nclstr_view + 1 !cluster number
539
540 if(nclstr_view.gt.nclstrmax_view) then !too many clusters for the view:
541 c$$$ if(verbose) print*,'Event ',eventn(1),
542 c$$$ $ ': more than ',nclstrmax_view
543 c$$$ $ ,' clusters on view ',iv
544 flag_shower = .true.
545 goto 2000
546 endif
547
548 ladder_view(nclstr_view) = nld(iseed,iv)
549 maxs_view(nclstr_view) = iseed
550 rmax_view(nclstr_view) = rmax
551 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)
561 c$$$ $ print*,'view ',iv
562 c$$$ $ ,' cl ',nclstr_view,' mult ',rmax-lmax+1
563 c------------------------------------------------------------------------
564 c search for a double peak inside the cluster
565 c------------------------------------------------------------------------
566 inext = rmax+1 !<< index where to start new-cluster search
567
568 vmax = 0
569 vmin = value(iseed)
570 imax = iseed
571 imin = iseed
572 do iss = max(iseed+1,lsat+1),rmax
573 if( value(iss).lt.vmin )then
574 if( imax.ne.iseed )goto 221 !found dowble peek
575 imin = iss
576 vmin = value(iss)
577 else
578 delta = value(iss) - value(imin)
579 cut = sqrt(clinclcut(iss)**2 + clinclcut(imin)**2)
580 if(
581 $ delta.gt.cut .and.
582 $ value(iss).gt.clseedcut(iss).and.
583 $ .true.)then
584 if( value(iss).gt.vmax )then
585 imax = iss
586 vmax = value(iss)
587 else
588 goto 221 !found dowble peek
589 endif
590 endif
591 endif
592 enddo
593 221 continue
594
595 if(imax.gt.iseed)then
596 inext = imax !<< index where to start new-cluster search
597 c$$$ print*,'--- double peek ---'
598 c$$$ print*,(value(ii),ii=lmax,rmax)
599 c$$$ print*,'seed ',iseed,' imin ',imin,' imax ',imax
600 endif
601 c--------------------------------------------------------
602 c
603 c--------------------------------------------------------
604 endif !end possible seed conditio
605 220 continue !jumps here to skip strips left of last seed
606
607 enddo ! end loop on strips
608 enddo !end loop on ladders
609 2000 continue
610 return
611 end
612
613
614 *---***---***---***---***---***---***---***---***
615 *
616 *
617 *
618 *
619 *
620 *---***---***---***---***---***---***---***---***
621
622 subroutine save_cluster(iv)
623 *
624 * (080/2006 Elena Vannuccini)
625 * Save the clusters view by view
626
627 include 'commontracker.f'
628 include 'level1.f'
629 include 'calib.f'
630 include 'common_reduction.f'
631
632 integer CLlength !lunghezza in strip del cluster
633
634 do ic=1,nclstr_view
635
636 nclstr1 = nclstr1+1
637 view(nclstr1) = iv
638 ladder(nclstr1) = ladder_view(ic)
639 maxs(nclstr1) = maxs_view(ic)
640 mult(nclstr1) = mult_view(ic)
641
642 c posizione dell'inizio del cluster nell' array clsignal
643 indstart(nclstr1) = ind
644 c posizione del cluster seed nell'array clsignal
645 indmax(nclstr1) = indstart(nclstr1)
646 $ +( maxs_view(ic) - lmax_view(ic) )
647
648 CLlength = rmax_view(ic) - lmax_view(ic) + 1 !numero di strip salvate
649 totCLlength = totCLlength + CLlength
650 sgnl(nclstr1) = 0
651 do j=lmax_view(ic),rmax_view(ic) !stores sequentially cluter strip values in
652
653 clsignal(ind) = value(j) ! clsignal array
654 c$$$ print*,ind,clsignal(ind)
655 ivk=nvk(j)
656 ist=nst(j)
657
658 clsigma(ind) = sigma(iv,ivk,ist)
659 cladc(ind) = adc(iv,ivk,ist)
660 clbad(ind) = bad(iv,ivk,ist)
661 c clped(ind) = pedestal(iv,ivk,ist)
662
663 ind=ind+1
664 c if(value(j).gt.0)
665 if(value(j).gt.clinclcut(j))
666 $ sgnl(nclstr1) = sgnl(nclstr1) + value(j) !cluster charge
667 enddo
668
669 c$$$ print*,'view ',iv,' -- save_cluster -- nclstr1: '
670 c$$$ $ ,nclstr1,maxs(nclstr1),mult(nclstr1),sgnl(nclstr1)
671 c$$$ print*,'----------------------'
672
673 enddo
674
675 return
676 end
677 *---***---***---***---***---***---***---***---***
678 *
679 *
680 *
681 *
682 *
683 *---***---***---***---***---***---***---***---***
684
685
686 c$$$ subroutine stripmask
687 c$$$
688 c$$$* this routine set va1 and single-strip masks,
689 c$$$* on the basis of the VA1 mask saved in the DB
690 c$$$*
691 c$$$* mask(nviews,nva1_view,nstrips_va1) !strip mask
692 c$$$* mask_vk(nviews,nva1_view) !VA1 mask
693 c$$$*
694 c$$$ include 'commontracker.f'
695 c$$$ include 'level1.f'
696 c$$$ include 'common_reduction.f'
697 c$$$ include 'calib.f'
698 c$$$
699 c$$$* init mask
700 c$$$ do iv=1,nviews
701 c$$$ do ivk=1,nva1_view
702 c$$$ do is=1,nstrips_va1
703 c$$$c mask(iv,ivk,is) = mask_vk(iv,ivk)
704 c$$$ if( mask_vk(iv,ivk) .ne. -1)then
705 c$$$ mask(iv,ivk,is) = 1
706 c$$$ $ * mask_vk(iv,ivk) !from DB
707 c$$$ $ * mask_vk_ev(iv,ivk) !from <SIG>
708 c$$$ $ * mask_vk_run(iv,ivk) !from CN
709 c$$$ else
710 c$$$ mask(iv,ivk,is) = -1
711 c$$$ $ * mask_vk(iv,ivk) !from DB
712 c$$$ $ * mask_vk_ev(iv,ivk) !from CN
713 c$$$ endif
714 c$$$ enddo
715 c$$$ enddo
716 c$$$ enddo
717 c$$$
718 c$$$
719 c$$$ return
720 c$$$ end
721
722 subroutine stripmask(iv,ivk)
723
724 * -----------------------------------------------
725 * this routine set va1 and single-strip masks,
726 * on the basis of the VA1 mask saved in the DB
727 *
728 * mask(nviews,nva1_view,nstrips_va1) !strip mask
729 * mask_vk(nviews,nva1_view) !VA1 mask
730 * -----------------------------------------------
731 include 'commontracker.f'
732 include 'level1.f'
733 include 'common_reduction.f'
734 include 'calib.f'
735
736 * init mask
737 do is=1,nstrips_va1
738 * --------------------------------------------------------
739 * if VA1-mask from DB is 0 or 1, three masks are combined:
740 * - from DB (a-priori mask)
741 * - run-based (chip declared bad on the basis of <SIG>)
742 * - event-based (failure in CN computation)
743 * --------------------------------------------------------
744 c print*,iv,ivk
745 c $ ,mask_vk(iv,ivk),mask_vk_ev(iv,ivk),mask_vk_run(iv,ivk)
746 if( mask_vk(iv,ivk) .ne. -1)then
747 mask(iv,ivk,is) = 1
748 $ * mask_vk(iv,ivk) !from DB
749 $ * mask_vk_ev(iv,ivk) !from <SIG>
750 $ * mask_vk_run(iv,ivk) !from CN
751 * -----------------------------------------------------------
752 * if VA1-mask from DB is -1 only event-based mask is applied
753 * -----------------------------------------------------------
754 else
755 mask(iv,ivk,is) = -1
756 $ * mask_vk(iv,ivk) !from DB
757 $ * mask_vk_ev(iv,ivk) !from CN
758 endif
759 enddo
760
761
762 return
763 end

  ViewVC Help
Powered by ViewVC 1.1.23