--- DarthVader/TrackerLevel2/src/F77/reductionflight.f 2006/09/05 12:52:21 1.5 +++ DarthVader/TrackerLevel2/src/F77/reductionflight.f 2006/09/28 14:04:40 1.6 @@ -18,6 +18,8 @@ include 'common_reduction.f' include 'calib.f' + data eventn_old/nviews*0/ + integer ierror ierror = 0 @@ -28,17 +30,80 @@ c call stripmask !called later, after CN computation call init_level1 - good1 = good0 +c good1 = good0 +c-------------------------------------------------- +c check the LEVEL0 event status for missing +c sections or DSP alarms +c ==> set the variable GOOD1(12) +c-------------------------------------------------- + do iv=1,nviews + if(DSPnumber(iv).gt.0.and.DSPnumber(iv).le.12)then +c ------------------------ +c GOOD +c ------------------------ + GOOD1(DSPnumber(iv))=0 !OK +c ------------------------ +c CRC error +c ------------------------ + if(crc(iv).eq.1) then + GOOD1(DSPnumber(iv)) = 2 + goto 18 !next view + endif +c ------------------------ +c online-software alarm +c ------------------------ + if( + $ fl1(iv).ne.0.or. + $ fl2(iv).ne.0.or. + $ fl3(iv).ne.0.or. + $ fl4(iv).ne.0.or. + $ fl5(iv).ne.0.or. + $ fl6(iv).ne.0.or. + $ fc(iv).ne.0.or. + $ DATAlength(iv).eq.0.or. + $ .false.)then + GOOD1(DSPnumber(iv))=3 + 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 + endif + + endif +c ------------------------ + 18 continue + endif + enddo + + ngood = 0 + do iv = 1,nviews + eventn_old(iv) = eventn(iv) + good_old(iv) = good1(iv) + ngood = ngood + good1(iv) + enddo +c if(ngood.ne.0)print*,'* WARNING * LEVEL0 event status: ' +c $ ,(good1(i),i=1,nviews) c-------------------------------------------------- c read the variable DATATRACKER from LEVEL0 -c and fill the variable ADC (inverting view 11) +c and fill the variable ADC (invertin view 11) c-------------------------------------------------- call filladc(iflag) if(iflag.ne.0)then - good1=0 +c good1=0!<<<<<<<<<<<<<<< c if(DEBUG)print*,'event ',eventn(1),' >>>>> decode ERROR' - ierror = 220 - goto 200 + ierror = 220 +c goto 200 +c print*,'filladc error' endif c-------------------------------------------------- @@ -115,6 +180,7 @@ call save_cluster(iv) else fshower(iv) = 1 + GOOD1(DSPn) = 11 endif enddo ! end loop on views do iv=1,nviews @@ -129,6 +195,13 @@ C or the event has too many clusters C--------------------------------------------- 200 continue + + ngood = 0 + do iv = 1,nviews + ngood = ngood + good1(iv) + enddo + if(ngood.ne.0)print*,'* WARNING * LEVEL1 event status: ' + $ ,(good1(i),i=1,nviews) c------------------------------------------------------------------------ c c closes files and exits @@ -156,7 +229,10 @@ include 'level1.f' include 'level0.f' - good1 = 0 +c good1 = 0 + do iv=1,12 + good1(iv) = 1 !missing packet + enddo nclstr1 = 0 totCLlength = 0 do ic=1,nclstrmax @@ -253,13 +329,15 @@ first=first+3 last=last-3 endif + do is=first,last !loop on strips in each ladder + if(is.le.iseed+1) goto 220 ******************************************************* * Elena 08/2006 * QUESTA PARTE NON E` ADEGUATA per cluster con grossi rilasci di carica * perche` salva molte volte lo stesso cluster -* (salvo il cluster rispetto al massimo e basta...) +* (salvo il cluster rispetto al primo massimo e basta...) ******************************************************* c$$$c----------------------------------------- c$$$c after a cluster seed as been found, @@ -300,7 +378,9 @@ c$$$ itemp=itemp+1 c$$$ if(itemp.eq.last) goto 230 !stops if reaches last strip c$$$ enddo ! of the ladder - do while(value(itemp).le.value(itemp+1)) + do while( + $ value(itemp).le.value(itemp+1) + $ .and.value(itemp+1).gt.clseedcut(itemp+1)) itemp=itemp+1 if(itemp.eq.last) goto 230 !stops if reaches last strip enddo ! of the ladder