subroutine hec_ped_evt1 c c pass 1 pedestal computation over all events event routine c implicit none c include'hec_par.inc' !shared parameters include'hec_adc.inc' !adc values include'hec_datacard.inc' !datacard values include'hec_evth.inc' !event header include'hec_geo.inc' !geometry correspondence tables include'hec_ped.inc' !pedestal values include'hec_ped_sys.inc' !pedestal computation include'hec_trig.inc' !event trigger c integer ic !adc channel number c c before the first event, reset the channel arrays c if (i_event .le. 1) then i_ped_evt1 = 0 i_ped_evt2 = 0 do ic = 1, i_adc_used i_adc0_1(ic) = 0 r_adc1(ic) = 0.d0 r_adc2(ic) = 0.d0 enddo endif c c before run period 4 (Feb 97) the data had no time samplings c in this case only select random trigger events. c if (irunpd .lt. 4 .and. trig_random) then i_ped_evt1 = i_ped_evt1 + 1 c c gather adc sums c do ic = 1, i_adc_used i_adc0_1(ic) = i_adc0_1(ic) + 1 r_adc1(ic) = r_adc1(ic) + dble(i_adc_ic(ic)) r_adc2(ic) = r_adc2(ic) + dble(i_adc_ic(ic)**2) enddo c c for run period 4 and up, use datacard tr_ped value to choose trigger c elseif (irunpd .ge. 4 .and. + ((tr_ped .le. 0) .or. + (tr_ped .eq. 1 .and. trig_random) .or. + (tr_ped .eq. 2 .and. trig_pretrigger))) then i_ped_evt1 = i_ped_evt1 + 1 c c compute pedestals for the event c call hec_ped_evt c c gather adc sums c do ic = 1, i_adc_used i_adc0_1(ic) = i_adc0_1(ic) + 1 r_adc1(ic) = r_adc1(ic) + dble(adc_ped_evt(ic)) r_adc2(ic) = r_adc2(ic) + dble(adc_ped_evt(ic)**2) enddo c endif c end