subroutine hec_dig_calc_weights c c calculate a weight for each time slice used in the digital c filtering method for each channel used, c both for the amplitude and time reconstruction c in the process, compute the time phase and the time slice shift c for each cell c improved by A. Minaenko, Nov 00 c ML 08/2001 all run dependent global time offsets are now treated in hec_dig.f c implicit none c include'hec_par.inc' ! shared parameters include'hec_geo.inc' ! geometry correspondence tables include'hec_datacard.inc' ! datacard values include'hec_dig.inc' ! digital filtering common include'hec_dig_sys.inc' ! digital filtering system common include'hec_runh.inc' ! run header include'hec_tdc.inc' ! tdc values c c local variables c integer ic, i_t, iw real dig_ns_ref integer dig_slice_shift_ref c c initialize the weights to zero c call vzero(dig_weight_amp, i_adc_dim*mx_dig_nslice) call vzero(dig_weight_tim, i_adc_dim*mx_dig_nslice) c c using the tdc_ns value, set c the time phase dig_ns (time phases [0,25ns]) c the time slice shift dig_slice_shift (time slice shift wrt dig_slice_1) c for each cell to the ref cell values c dig_ns_ref = tdc_ns + dig_t_global c if (dig_ns_ref .ge. 0.) then dig_slice_shift_ref = - int(dig_ns_ref/25.) else dig_slice_shift_ref = int(-dig_ns_ref/25.) + 1 endif dig_ns_ref = dig_ns_ref + dig_slice_shift_ref*25. c c the definition region of these weights is tdc=5.0-30.0 ns (not 0-25 !!) c if (dig_weight_version.eq.980414) then dig_ns_ref = dig_ns_ref + 5. elseif (dig_weight_version.eq.981014) then dig_ns_ref = dig_ns_ref + 0.86 endif call vfill(dig_ns, i_adc_used, dig_ns_ref) call vfill(dig_slice_shift, i_adc_used, dig_slice_shift_ref) c c do over all cells used c do ic = 1, i_adc_used c c if t0's are to be used by the dig package, c using the tdc_ns value, set for each cell c the time phase dig_ns (time phases [0,25ns]) c the time slice shift dig_slice_shift (time slice shift wrt dig_slice_1) c if (mk_dig .gt. 1) then dig_ns(ic) = dig_ns_ref - dig_t0(ic) if (dig_ns(ic) .ge. 0.) then dig_slice_shift(ic) = - int(dig_ns(ic)/25.) else dig_slice_shift(ic) = int(-dig_ns(ic)/25.) + 1 endif dig_ns(ic) = dig_ns(ic) + dig_slice_shift(ic)*25. c c the definition region of these weights is tdc=5.0-30.0 ns (not 0-25 !!) c if (dig_weight_version.eq.980414) then dig_ns(ic) = dig_ns(ic) + 5. elseif (dig_weight_version.eq.981014) then dig_ns(ic) = dig_ns(ic) + 0.86 endif endif c c calculate the weights for amplitude and time reconstruction c don't bother if the cell does not have weight coefficients c if (ic_has_amp_weights(ic)) then do i_t = 1, dig_nslice do iw = 1, dig_nwpar dig_weight_amp(ic,i_t) = dig_weight_amp(ic,i_t) + + dig_amp_par(ic,i_t,iw)*(dig_ns(ic))**(iw-1) enddo enddo endif if (ic_has_tim_weights(ic)) then do i_t = 1, dig_nslice do iw = 1, dig_nwpar dig_weight_tim(ic,i_t) = dig_weight_tim(ic,i_t) + + dig_tim_par(ic,i_t,iw)*(dig_ns(ic))**(iw-1) enddo enddo endif enddo c return end