subroutine hec_max_fill c c fill the max adc and time values common c for the preferred max finding package c c for 1996, just copy the adc arrays c for 1997+,if only one max finding package is used, then c fill with the corresponding max adc and times; c if more than one max finding package are used, c fill with the max adc and time values of the c preferred max finding package (max adc is pedestal c subtracted, max time is in ns) c implicit none c include'hec_par.inc' !shared parameters include'hec_adc.inc' !adc values include'hec_cub.inc' !max adc and time for simple cubic fit include'hec_datacard.inc' !datacard values include'hec_dig.inc' !max adc and time for digital filtering include'hec_dig_sys.inc' !system common for digital filtering include'hec_geo.inc' !geometry correspondence tables include'hec_max.inc' !max adc and time values include'hec_ped.inc' !pedestal values c integer ic !adc channel number integer i_mod integer i_seg integer i_pad integer i_eta integer i_phi integer i_z c logical l_fill c c reset the arrays c call vzero(adc_max_ic, 2*i_adc_dim) call vzero(adc_max_db, 2*i_mod_max*i_seg_max*i_pad_max) call vzero(adc_max_ph, 2*i_eta_max*i_phi_max*i_z_max) l_fill = .false. c c for 1996 c if (irunpd .le. 3) then do ic = 1, i_adc_dim adc_max_ic(ic, 1) = real(i_adc_ic(ic)) - adc_ped(ic) enddo l_fill = .true. c c for 1997 and later c else c c preferred peak-finder is cubic fit c if (m_pref .eq. 1) then do ic = 1, i_adc_dim adc_max_ic(ic, 1) = adc_cub_ic(ic, 1) - adc_ped(ic) adc_max_ic(ic, 2) = adc_cub_ic(ic, 2)*25.-25. enddo l_fill = .true. endif c c preferred peak-finder is digital filtering only c if (m_pref .eq. 2) then do ic = 1, i_adc_dim adc_max_ic(ic, 1) = adc_dig_ic(ic, 1) adc_max_ic(ic, 2) = adc_dig_ic(ic, 2) enddo l_fill = .true. endif c c preferred peak-finder is digital filtering c but for cells with bad amplitude weights use the signal c in time slice (dig_slice_1 + 3) c if (m_pref .eq. 3) then do ic = 1, i_adc_dim if (ic_has_amp_weights(ic)) then adc_max_ic(ic, 1) = adc_dig_ic(ic, 1) adc_max_ic(ic, 2) = adc_dig_ic(ic, 2) else adc_max_ic(ic,1) = real(i_adc_ic_t(ic,dig_slice_1+3)) + - adc_ped(ic) endif enddo l_fill = .true. endif c c preferred peak-finder is digital filtering c but for cells with bad amplitude weights cubic fit is used c if (m_pref .eq. 4) then do ic = 1, i_adc_dim if (ic_has_amp_weights(ic)) then adc_max_ic(ic, 1) = adc_dig_ic(ic, 1) adc_max_ic(ic, 2) = adc_dig_ic(ic, 2) else adc_max_ic(ic,1) = adc_cub_ic(ic,1) - adc_ped(ic) endif enddo l_fill = .true. endif endif c c fill arrays in database and physics systems c if (l_fill) then do i_pad = 1, i_pad_used do i_seg = 1, i_seg_used do i_mod = 1, i_mod_used ic = dbtoic(i_mod, i_seg, i_pad) if (ic .gt. 0 .and. ic .le. i_adc_used) then adc_max_db(i_mod, i_seg, i_pad, 1) = + adc_max_ic(ic, 1) endif enddo enddo enddo do i_z = 1, i_z_used do i_phi = 1, i_phi_used do i_eta = 1, i_eta_used ic = phtoic(i_eta, i_phi, i_z) if (ic .gt. 0 .and. ic .le. i_adc_used) then adc_max_ph(i_eta, i_phi, i_z, 1) = + adc_max_ic(ic, 1) endif enddo enddo enddo endif c end