--- DarthVader/TrackerLevel2/src/F77/reductionflight.f 2007/05/14 11:03:06 1.19 +++ DarthVader/TrackerLevel2/src/F77/reductionflight.f 2007/05/24 16:45:48 1.20 @@ -33,8 +33,12 @@ call init_level1 +c debug=.true. + if(debug)print*,'-- check LEVEL0 status' + ievco=-1 + mismatch=0 c good1 = good0 c-------------------------------------------------- c check the LEVEL0 event status for missing @@ -51,8 +55,13 @@ c CRC error c ------------------------ if(crc(iv).eq.1) then - GOOD1(DSPnumber(iv)) = 2 - goto 18 !next view +c GOOD1(DSPnumber(iv)) = 2 +c GOOD1(DSPnumber(iv)) = GOOD1(DSPnumber(iv)) + 2**1 + GOOD1(DSPnumber(iv)) = ior(GOOD1(DSPnumber(iv)),2**1) + 102 format(' * WARNING * Event ',i7,' view',i3 + $ ,' CRC error') + if(debug)write(*,102)eventn(1),DSPnumber(iv) +c goto 18 !next view endif c ------------------------ c online-software alarm @@ -67,37 +76,74 @@ $ fc(iv).ne.0.or. $ DATAlength(iv).eq.0.or. $ .false.)then - GOOD1(DSPnumber(iv))=3 - goto 18 +c GOOD1(DSPnumber(iv))=3 +c GOOD1(DSPnumber(iv)) = GOOD1(DSPnumber(iv)) + 2**2 + GOOD1(DSPnumber(iv)) = ior(GOOD1(DSPnumber(iv)),2**2) + 103 format(' * WARNING * Event ',i7,' view',i3 + $ ,' software alarm') + if(debug)write(*,103)eventn(1),DSPnumber(iv) +c goto 18 endif c ------------------------ c DSP-counter jump c ------------------------ - if( - $ eventn_old(iv).ne.0.and. !first event in this file - $ eventn(iv).ne.1.and. !first event in run - $ good_old(DSPnumber(iv)).ne.0.and. !previous event corrupted - $ .true.)then - - if(eventn(iv).ne.(eventn_old(iv)+1))then - GOOD1(DSPnumber(iv))=4 - goto 18 +c commentato perche` non e` un controllo significativo nel caso in cui +c la subroutine venga chiamata per riprocessare l'evento +c sostituito con un check dei contatori dei vari dsp +c$$$ if( +c$$$ $ eventn_old(iv).ne.0.and. !first event in this file +c$$$ $ eventn(iv).ne.1.and. !first event in run +c$$$ $ good_old(DSPnumber(iv)).ne.0.and. !previous event corrupted +c$$$ $ .true.)then +c$$$ +c$$$ if(eventn(iv).ne.(eventn_old(iv)+1))then +c$$$c GOOD1(DSPnumber(iv))=4 +c$$$c GOOD1(DSPnumber(iv)) = GOOD1(DSPnumber(iv)) + 2**3 +c$$$ GOOD1(DSPnumber(iv)) = ior(GOOD1(DSPnumber(iv)),2**3) +c$$$ 104 format(' * WARNING * Event ',i7,' view',i3 +c$$$ $ ,' counter jump ',i10,i10) +c$$$ if(debug)write(*,104)eventn(1),DSPnumber(iv) +c$$$ $ ,eventn_old(iv),eventn(iv)) +c$$$ goto 18 +c$$$ endif +c$$$ +c$$$ endif +c ------------------------ +c 18 continue +c ------------------------ +c DSP-counter +c ------------------------ + if( DSPnumber(iv).ne.0.and.GOOD1(DSPnumber(iv)).ne.1)then + if(iv.ne.1.and.ievco.ne.-1)then + if( eventn(iv).ne.ievco )then + mismatch=1 + endif endif - + ievco = eventn(iv) endif -c ------------------------ - 18 continue endif enddo +c print*,'*** ',(eventn(iv),iv=1,12) + + if(mismatch.eq.1.and.debug) + $ print*,' * WARNING * DSP counter mismatch: ' + $ ,(eventn(iv),iv=1,12) + ngood = 0 do iv = 1,nviews + + if(mismatch.eq.1.and.GOOD1(iv).ne.1) + $ GOOD1(iv)=ior(GOOD1(iv),2**3) + eventn_old(iv) = eventn(iv) good_old(iv) = good1(iv) ngood = ngood + good1(iv) + enddo - if(debug.and.ngood.ne.0)print*,'* WARNING * LEVEL0 event status: ' - $ ,(good1(i),i=1,nviews) +c$$$ if(verbose.and.ngood.ne.0)print*,'* WARNING * Event ',eventn(1) +c$$$ $ ,':LEVEL0 event status: ' +c$$$ $ ,(good1(i),i=1,nviews) c-------------------------------------------------- c read the variable DATATRACKER from LEVEL0 c and fill the variable ADC (invertin view 11) @@ -140,7 +186,7 @@ endif enddo 100 format(' * WARNING * Event ',i7,' view',i3,': VK MASK ',24i1) - if(ima.ne.0.and.debug)write(*,100)eventn(1),iv + if(ima.ne.0.and.verbose)write(*,100)eventn(1),iv $ ,(mask_vk_ev(iv,ik),ik=1,nva1_view) c if(ima.ne.0)write(*,100)eventn(1),iv c $ ,(mask_vk_ev(iv,ik),ik=1,nva1_view) @@ -161,6 +207,9 @@ do is=1,nstrips_view !loop on strips (1) if(mod(iv,2).eq.1) then C=== > Y view +c print*,iv,nvk(is),nst(is),adc(iv,nvk(is),nst(is)) +c $ ,cn(iv,nvk(is)) +c $ ,pedestal(iv,nvk(is),nst(is)) value(is)= -(DBLE(adc(iv,nvk(is),nst(is))) $ -cn(iv,nvk(is))-pedestal(iv,nvk(is),nst(is))) $ *mask(iv,nvk(is),nst(is)) @@ -191,10 +240,12 @@ else fshower(iv) = 1 c GOOD1(DSPnumber(iv)) = 11 !AHAHAHAHA ORRORE!! - GOOD1(iv) = 11 +c GOOD1(iv) = 11 +c GOOD1(iv) = GOOD1(iv) + 2**5 + GOOD1(iv) = ior(GOOD1(iv),2**5) 101 format(' * WARNING * Event ',i7,' view',i3 $ ,' #clusters > ',i5,' --> MASKED') - if(debug)write(*,101)eventn(1),iv,nclstrmax_view + if(verbose)write(*,101)eventn(1),iv,nclstrmax_view endif enddo ! end loop on views do iv=1,nviews @@ -214,7 +265,7 @@ do iv = 1,nviews ngood = ngood + good1(iv) enddo - if(debug.and.ngood.ne.0)print*,'* WARNING * Event ',eventn(1) + if(verbose.and.ngood.ne.0)print*,'* WARNING * Event ',eventn(1) $ ,':LEVEL1 event status: ' $ ,(good1(i),i=1,nviews) c------------------------------------------------------------------------ @@ -572,7 +623,7 @@ do j=lmax_view(ic),rmax_view(ic) !stores sequentially cluter strip values in clsignal(ind) = value(j) ! clsignal array - +c$$$ print*,ind,clsignal(ind) ivk=nvk(j) ist=nst(j) @@ -587,9 +638,10 @@ $ sgnl(nclstr1) = sgnl(nclstr1) + value(j) !cluster charge enddo -c print*,'view ',iv,' -- save_cluster -- nclstr1: ' -c $ ,nclstr1,maxs(nclstr1),mult(nclstr1),sgnl(nclstr1) - +c$$$ print*,'view ',iv,' -- save_cluster -- nclstr1: ' +c$$$ $ ,nclstr1,maxs(nclstr1),mult(nclstr1),sgnl(nclstr1) +c$$$ print*,'----------------------' + enddo return @@ -661,6 +713,8 @@ * - run-based (chip declared bad on the basis of ) * - event-based (failure in CN computation) * -------------------------------------------------------- +c print*,iv,ivk +c $ ,mask_vk(iv,ivk),mask_vk_ev(iv,ivk),mask_vk_run(iv,ivk) if( mask_vk(iv,ivk) .ne. -1)then mask(iv,ivk,is) = 1 $ * mask_vk(iv,ivk) !from DB