subroutine hec_adc_fill c c adc values in the adc channel system (ic) are directly read c from testbeam data. c fill the adc values arrays for c - the database system (db) c - the physics system (ph) c implicit none c include'hec_par.inc' !shared parameters include'hec_adc.inc' !adc values include'hec_geo.inc' !geometry correspondence tables c c local variables c integer ic !adc channel number integer i_t !time sampling number integer i_mod integer i_seg integer i_pad integer i_eta integer i_phi integer i_z c c reset adc arrays c call vzero(i_adc_db_t, i_mod_max*i_seg_max*i_pad_max*i_tim_dim) call vzero(i_adc_ph_t, i_eta_max*i_phi_max*i_z_max*i_tim_dim) c c fill adc array in database and physics systems c some ic's might not correspond to any used adc channel c this is why it is better to loop over ic since the c ic -> db mapping is one to one while the c db -> ic mapping can be two to one if there is ganging c like for the new electronics cabling in Sept 96. c therefore summing all the i_adc_db over all the allowed c i_mod, i_seg, i_pad will not double count the energy c of the ganged gaps. c do ic = 1, i_adc_used i_mod = ictodb(ic, 1) i_seg = ictodb(ic, 2) i_pad = ictodb(ic, 3) if (i_mod*i_seg*i_pad .ne. 0) then do i_t = 1, i_tim_used i_adc_db_t(i_mod, i_seg, i_pad, i_t) = i_adc_ic_t(ic, i_t) enddo endif c i_eta = ictoph(ic, 1) i_phi = ictoph(ic, 2) i_z = ictoph(ic, 3) if (i_eta*i_phi*i_z .ne. 0) then do i_t = 1, i_tim_used i_adc_ph_t(i_eta, i_phi, i_z, i_t) = i_adc_ic_t(ic, i_t) enddo endif enddo c end