subroutine hec_search_1 c c standard search algorithm (D. Striegel). c c only physics trigger events are treated by this algorithm c c Let the datacard search have the following parameters: c 2= i_t1 c 3= i_t2 c 4= ntc c 5= i_cutflag c 6= cut c for each channel the standard algorithm searches for c the maximum adc in the timeslice range [i_t1, i_t2] c Case i_cutflag = 0: c the time distribution is compared to a valid pulse shape. c the comparison uses ntc timeslices (only the values c 3, 5 and 7 are implemented). c Case i_cutflag = 1: c if this maximum is above the value cut*rms, where rms c is the channel's pedestal rms, then c the time distribution is compared to a valid pulse shape. c the comparison uses ntc timeslices (only the values c 3, 5 and 7 are implemented). c c variables specific to this algorithm are in c hec_search_1_sys.inc c implicit none c include'hec_par.inc' !shared parameters include'hec_adc.inc' !adc values include'hec_datacard.inc' !datacard values include'hec_geo.inc' !geometry correspondence tables include'hec_ped.inc' !pedestal values include'hec_search.inc' !search include'hec_search_1_sys.inc' !search algorithm 1 include'hec_trig.inc' !triggers c real a, b, c, d, e, f, g, p, s, t_l integer ic, it integer i, k, end real s_tmp(i_tim_dim) ! tmp array for max search integer indx(i_tim_dim) ! search indx array real search_in(i_tim_dim) character substr*18 parameter (substr=' *** hec_search_1: ') c c start by assuming a negative search c do ic = 1, i_adc_used hec_s_chan(ic) = .false. enddo hec_s_hit = .false. c c only treat physics triggers c if (.not. trig_physics) return c c algorithm c call vzero (hec_s_result,i_adc_dim*i_tim_dim) call vzero (s_tmp,i_tim_dim) ! clear tmp search array call vzero (indx,i_tim_dim) ! clear indx array c c check search boudaries c if (hec_s_start.le.2) then write(*,*) substr,'lower limit of search slices too low !' STOP endif ! if (START.le.2) then if (hec_s_stop.gt.(i_tim_used-4)) then write(*,*) substr,'upper limit of search slices too high !' STOP endif ! if (search_stop.gt.(i_... if (hec_s_stop.lt.hec_s_start) then write(*,*) substr,'upper search limit LOWER then lower one !' write(*,*) substr,'hec_s_start=',hec_s_start write(*,*) substr,'hec_s_stop=',hec_s_stop STOP endif ! if (search_stop.lt.search_start) then do ic=1, i_adc_used ! loop over all channels p = adc_ped(ic) ! pedestal mean of ADC channel s = adc_rms(ic) ! pedestal sigma of ADC channel call vzero (search_in,i_tim_dim) do it=1, i_tim_used search_in(it)=real(i_adc_ic_t(ic,it)) enddo ! do it=1, i_tim_used end = hec_s_stop-hec_s_start+1 ! upper search boundary do i= 1, end s_tmp(i)=search_in(hec_s_start+i-1) enddo ! do i= search_start, search_stop call sortzv (s_tmp,indx,hec_s_stop-hec_s_start,1,1,0) hec_s_im(ic)=indx(1)+hec_s_start-1 ! index of absolut maximum c check for sigma cut on search slices c test absolut detected maximum only c a=search_in(hec_s_im(ic)-2) ! copy puls distribution b=search_in(hec_s_im(ic)-1) c=search_in(hec_s_im(ic)) d=search_in(hec_s_im(ic)+1) e=search_in(hec_s_im(ic)+2) f=search_in(hec_s_im(ic)+3) g=search_in(hec_s_im(ic)+4) t_l = hec_s_lvl*s ! test level for signal if (hec_s_mc) then if ((c-p).le.t_l) then hec_s_hit=.FALSE. Goto 100 endif ! if ( b.lt.t_l .or. ... endif ! if (make_cut) then if ( (b.lt.c).and.(d.lt.c) ) then if (hec_s_five) then if ( (a.lt.b).and.(e.lt.d) ) then if (hec_s_seven) then if ( (f.lt.e).and.(g.lt.f) ) then do k=1, 7 hec_s_result(ic,k)=search_in(hec_s_im(ic)-3+k) enddo ! do k=1, i_tim_used-i+2 hec_s_hit=.TRUE. Goto 100 else hec_s_hit=.FALSE. Goto 100 endif ! if ( (f.lt.e).and.(g.lt.f) ) then else ! take only 5 timeslices do k=1, 5 hec_s_result(ic,k)=search_in(hec_s_im(ic)-3+k) enddo ! do k=1, i_tim_used-i+2 hec_s_hit=.TRUE. Goto 100 endif ! if (seven) then else hec_s_hit=.FALSE. Goto 100 endif ! if ( (a.lt.b).and.(e.lt.d) ) then else ! take only 3 timeslices do k=1, 3 hec_s_result(ic,k)=search_in(hec_s_im(ic)-3+k) enddo ! do k=1, i_tim_used-i+2 hec_s_hit=.TRUE. Goto 100 endif ! if (five) then else hec_s_hit=.FALSE. Goto 100 endif ! if ( (b.lt.c).and.(d.lt.c) ) then 100 if (hec_s_hit) then hec_s_hit=.FALSE. ! reset for next ADC hec_s_chan(ic)=.TRUE. ! got a hit in adc ic else hec_s_chan(ic)=.FALSE. endif ! if (hec_s_hit) then enddo ! do ic=1, i_adc_used hec_s_hit=.FALSE. do ic=1, i_adc_used hec_s_hit = hec_s_hit .OR. hec_s_chan(ic) enddo ! do ic=1, i_adc_used end